@dock365/reform-fabric-fields
Version:
fabric fields reform
72 lines • 3.38 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var Button_1 = require("office-ui-fabric-react/lib/Button");
var StatusViewer = /** @class */ (function (_super) {
__extends(StatusViewer, _super);
function StatusViewer() {
return _super !== null && _super.apply(this, arguments) || this;
}
StatusViewer.prototype.render = function () {
var _this = this;
var options = this.props.options;
var widthOfAStatus = 144;
var noOfOptionsInAColumn = 4;
var noOfOptions = options.length;
var width = Math.ceil(noOfOptions / noOfOptionsInAColumn) * widthOfAStatus;
width = width < widthOfAStatus * 2 ? widthOfAStatus * 2 : width;
return (React.createElement("div", { className: "optionsPickerViewMenu" },
React.createElement("div", { style: {
width: width + "px",
padding: "5px",
height: "140px",
display: "flex",
flexDirection: "column",
flexWrap: "wrap",
alignContent: "flex-start",
boxSizing: "content-box",
} }, options.map(function (option) {
return React.createElement("button", { onClick: _this.props.onSelect, className: "optionsPickerOptionButton", value: option.id, type: "button", style: {
backgroundColor: option.color && _this.props.colors[option.color] || option.color,
height: "30px",
margin: "2px",
width: "140px",
border: "0",
padding: "0 8px",
whiteSpace: "pre",
overflow: "hidden",
textOverflow: "ellipsis",
}, title: option.title }, option.title);
})),
this.props.editable ?
React.createElement(Button_1.DefaultButton, { text: "Add / Edit Labels", onClick: this.props.toggleEdit, type: "button", style: {
display: "block",
width: "100%",
height: "40px",
} })
: null));
};
return StatusViewer;
}(React.Component));
exports.default = StatusViewer;
//# sourceMappingURL=Viewer.js.map