1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | "use strict"; var __extends = (this && this.__extends) || (function () { var 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 function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var material_ui_chip_input_1 = require("material-ui-chip-input"); var TagsInputStyles_1 = require("./TagsInputStyles"); var getMuiTheme_1 = require("material-ui/styles/getMuiTheme"); var styles_1 = require("material-ui/styles"); var lightMuiTheme = getMuiTheme_1.default(styles_1.lightBaseTheme); var injectTapEventPlugin = require("react-tap-event-plugin"); injectTapEventPlugin(); var TagsInput = (function (_super) { __extends(TagsInput, _super); function TagsInput(props) { var _this = _super.call(this, props) || this; _this.state = { chips: [], dataSource: ['foo', 'bar'] }; return _this; } TagsInput.prototype.getDataSource = function (paths) { var data = []; return data; }; TagsInput.prototype.handleChange = function (event) { }; TagsInput.prototype.handleRequestAdd = function () { var chips = []; for (var _i = 0; _i < arguments.length; _i++) { chips[_i] = arguments[_i]; } this.setState({ chips: this.state.chips.concat(chips) }); }; TagsInput.prototype.handleRequestDelete = function (deletedChip) { this.setState({ chips: this.state.chips.filter(function (c) { return c !== deletedChip; }) }); }; TagsInput.prototype.chipRenderer = function () { }; TagsInput.prototype.render = function () { var _this = this; switch (this.props['data-actionName']) { case 'edit': return (React.createElement("div", { style: TagsInputStyles_1.styles.container, className: 'col input-field s12' }, React.createElement(styles_1.MuiThemeProvider, { muiTheme: lightMuiTheme }, React.createElement(material_ui_chip_input_1.default, { floatingLabelText: this.props.required ? this.props['data-labelText'] + ' *' : this.props['data-labelText'], defaultValue: ['foo', 'bar'], onRequestAdd: function (chip) { return _this.handleRequestAdd(chip); }, onRequestDelete: function (deletedChip) { return _this.handleRequestDelete(deletedChip); }, fullWidth: true, allowDuplicates: false, dataSource: this.props.dataSource, disabled: this.props.readOnly, errorText: this.props['data-errorText'], hintText: this.props['data-labelText'], id: this.props.name, style: __assign({}, this.props.style, TagsInputStyles_1.styles.chipContainerStyle), value: this.state.chips, chipRenderer: this.chipRenderer })))); case 'new': return (React.createElement("div", { style: TagsInputStyles_1.styles.container, className: 'col input-field s12' }, React.createElement(styles_1.MuiThemeProvider, { muiTheme: lightMuiTheme }, React.createElement(material_ui_chip_input_1.default, { floatingLabelText: this.props.required ? this.props['data-labelText'] + ' *' : this.props['data-labelText'], defaultValue: ['foo', 'bar'], onRequestAdd: function (chip) { return _this.handleRequestAdd(chip); }, onRequestDelete: function (deletedChip) { return _this.handleRequestDelete(deletedChip); }, fullWidth: true, allowDuplicates: false, dataSource: this.props.dataSource, disabled: this.props.readOnly, errorText: this.props['data-errorText'], hintText: this.props['data-labelText'], id: this.props.name, style: __assign({}, this.props.style, TagsInputStyles_1.styles.chipContainerStyle), value: this.state.chips, chipRenderer: this.chipRenderer })))); case 'browse': return (React.createElement("div", null, React.createElement("label", null, this.props['data-labelText']), React.createElement("p", null, this.props['data-fieldValue']))); default: break; } }; return TagsInput; }(React.Component)); exports.TagsInput = TagsInput; //# sourceMappingURL=TagsInput.js.map |