amis 1.8.0-beta.13 → 1.8.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/WithStore.js +1 -1
- package/lib/WithStore.js.map +2 -2
- package/lib/components/DatePicker.js +3 -1
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/Progress.js +3 -4
- package/lib/components/Progress.js.map +2 -2
- package/lib/components/TabsTransfer.d.ts +22 -3
- package/lib/components/TabsTransfer.js +149 -42
- package/lib/components/TabsTransfer.js.map +2 -2
- package/lib/components/Tree.js +3 -1
- package/lib/components/Tree.js.map +2 -2
- package/lib/components/formula/Editor.js +4 -4
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/VariableList.d.ts +63 -4
- package/lib/components/formula/VariableList.js +23 -8
- package/lib/components/formula/VariableList.js.map +2 -2
- package/lib/helper.css +1 -1
- package/lib/helper.css.map +1 -1
- package/lib/index.js +1 -1
- package/lib/renderers/Date.js +6 -1
- package/lib/renderers/Date.js.map +2 -2
- package/lib/renderers/Form/NestedSelect.d.ts +1 -1
- package/lib/renderers/Form/NestedSelect.js +7 -2
- package/lib/renderers/Form/NestedSelect.js.map +2 -2
- package/lib/renderers/Form/TabsTransfer.d.ts +6 -1
- package/lib/renderers/Form/TabsTransfer.js +155 -6
- package/lib/renderers/Form/TabsTransfer.js.map +2 -2
- package/lib/renderers/Form/TabsTransferPicker.d.ts +2 -2
- package/lib/renderers/Form/TabsTransferPicker.js +4 -4
- package/lib/renderers/Form/TabsTransferPicker.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.js +6 -2
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Markdown.js +4 -3
- package/lib/renderers/Markdown.js.map +2 -2
- package/lib/renderers/Nav.d.ts +21 -20
- package/lib/renderers/Nav.js +8 -1
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +1 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Service.js +1 -1
- package/lib/renderers/Service.js.map +2 -2
- package/lib/renderers/Table/exportExcel.d.ts +6 -0
- package/lib/renderers/Table/exportExcel.js +288 -0
- package/lib/renderers/Table/exportExcel.js.map +13 -0
- package/lib/renderers/Table/index.d.ts +1 -1
- package/lib/renderers/Table/index.js +4 -251
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/themes/ang-ie11.css +112 -36
- package/lib/themes/ang.css +100 -21
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +112 -36
- package/lib/themes/antd.css +100 -21
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +97 -21
- package/lib/themes/cxd.css +100 -21
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +112 -36
- package/lib/themes/dark.css +100 -21
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +97 -21
- package/lib/themes/default.css +100 -21
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +35 -6
- package/lib/utils/api.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +1 -1
- package/scss/_properties.scss +4 -0
- package/scss/components/_formula.scss +77 -12
- package/scss/components/_progress.scss +2 -7
- package/scss/components/form/_date.scss +1 -0
- package/scss/components/form/_transfer.scss +21 -0
- package/scss/helper/layout/_display.scss +1 -1
- package/sdk/ang-ie11.css +130 -36
- package/sdk/ang.css +118 -21
- package/sdk/antd-ie11.css +130 -36
- package/sdk/antd.css +118 -21
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +115 -21
- package/sdk/cxd.css +118 -21
- package/sdk/dark-ie11.css +130 -36
- package/sdk/dark.css +118 -21
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +17 -17
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +115 -21
- package/sdk/sdk.css +118 -21
- package/sdk/sdk.js +1270 -1268
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/WithStore.tsx +1 -1
- package/src/components/DatePicker.tsx +2 -1
- package/src/components/Progress.tsx +6 -4
- package/src/components/TabsTransfer.tsx +253 -143
- package/src/components/Tree.tsx +3 -1
- package/src/components/formula/Editor.tsx +12 -5
- package/src/components/formula/VariableList.tsx +55 -21
- package/src/renderers/Date.tsx +14 -1
- package/src/renderers/Form/NestedSelect.tsx +11 -2
- package/src/renderers/Form/TabsTransfer.tsx +174 -11
- package/src/renderers/Form/TabsTransferPicker.tsx +5 -10
- package/src/renderers/Form/TreeSelect.tsx +15 -12
- package/src/renderers/Form/index.tsx +37 -16
- package/src/renderers/Markdown.tsx +4 -5
- package/src/renderers/Nav.tsx +7 -1
- package/src/renderers/Page.tsx +9 -2
- package/src/renderers/Service.tsx +8 -2
- package/src/renderers/Table/exportExcel.ts +289 -0
- package/src/renderers/Table/index.tsx +5 -252
- package/src/utils/api.ts +42 -10
@@ -5,20 +5,91 @@ var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = (0, tslib_1.__importDefault)(require("react"));
|
6
6
|
var helper_1 = require("../utils/helper");
|
7
7
|
var Tabs_1 = tslib_1.__importStar(require("./Tabs"));
|
8
|
-
var
|
8
|
+
var InputBox_1 = (0, tslib_1.__importDefault)(require("./InputBox"));
|
9
9
|
var TableSelection_1 = (0, tslib_1.__importDefault)(require("./TableSelection"));
|
10
10
|
var TreeSelection_1 = (0, tslib_1.__importDefault)(require("./TreeSelection"));
|
11
11
|
var ChainedSelection_1 = (0, tslib_1.__importDefault)(require("./ChainedSelection"));
|
12
12
|
var GroupedSelection_1 = (0, tslib_1.__importDefault)(require("./GroupedSelection"));
|
13
|
+
var Select_1 = require("./Select");
|
13
14
|
var Transfer_1 = (0, tslib_1.__importDefault)(require("./Transfer"));
|
14
15
|
var theme_1 = require("../theme");
|
15
16
|
var AssociatedSelection_1 = (0, tslib_1.__importDefault)(require("./AssociatedSelection"));
|
16
17
|
var locale_1 = require("../locale");
|
18
|
+
var icons_1 = require("./icons");
|
19
|
+
var debounce_1 = (0, tslib_1.__importDefault)(require("lodash/debounce"));
|
17
20
|
var TabsTransfer = /** @class */ (function (_super) {
|
18
21
|
(0, tslib_1.__extends)(TabsTransfer, _super);
|
19
22
|
function TabsTransfer() {
|
20
|
-
|
23
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
24
|
+
_this.state = {
|
25
|
+
inputValue: '',
|
26
|
+
searchResult: null
|
27
|
+
};
|
28
|
+
_this.unmounted = false;
|
29
|
+
_this.lazySearch = (0, debounce_1.default)(function (text, option) {
|
30
|
+
(function (text) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
|
31
|
+
var onSearch, result;
|
32
|
+
var _this = this;
|
33
|
+
return (0, tslib_1.__generator)(this, function (_a) {
|
34
|
+
switch (_a.label) {
|
35
|
+
case 0:
|
36
|
+
onSearch = this.props.onSearch;
|
37
|
+
return [4 /*yield*/, onSearch(text, option, function (cancelExecutor) { return (_this.cancelSearch = cancelExecutor); })];
|
38
|
+
case 1:
|
39
|
+
result = _a.sent();
|
40
|
+
if (this.unmounted) {
|
41
|
+
return [2 /*return*/];
|
42
|
+
}
|
43
|
+
if (!Array.isArray(result)) {
|
44
|
+
throw new Error('onSearch 需要返回数组');
|
45
|
+
}
|
46
|
+
this.setState({
|
47
|
+
searchResult: result
|
48
|
+
});
|
49
|
+
return [2 /*return*/];
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}); })(text).catch(function (e) { return console.error(e); });
|
53
|
+
}, 250, {
|
54
|
+
trailing: true,
|
55
|
+
leading: false
|
56
|
+
});
|
57
|
+
return _this;
|
21
58
|
}
|
59
|
+
TabsTransfer.prototype.componentWillUnmount = function () {
|
60
|
+
this.lazySearch.cancel();
|
61
|
+
this.unmounted = true;
|
62
|
+
};
|
63
|
+
TabsTransfer.prototype.handleSearch = function (text, option) {
|
64
|
+
var _this = this;
|
65
|
+
// text 有值的时候,走搜索否则直接走 handleSeachCancel ,等同于右侧的 clear 按钮
|
66
|
+
if (text) {
|
67
|
+
this.setState({
|
68
|
+
inputValue: text
|
69
|
+
}, function () {
|
70
|
+
// 如果有取消搜索,先取消掉。
|
71
|
+
_this.cancelSearch && _this.cancelSearch();
|
72
|
+
_this.lazySearch(text, option);
|
73
|
+
});
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
this.handleSeachCancel();
|
77
|
+
}
|
78
|
+
};
|
79
|
+
TabsTransfer.prototype.handleSeachCancel = function () {
|
80
|
+
this.setState({
|
81
|
+
inputValue: '',
|
82
|
+
searchResult: null
|
83
|
+
});
|
84
|
+
};
|
85
|
+
TabsTransfer.prototype.handleSearchKeyDown = function (e) {
|
86
|
+
if (e.key === 'Enter') {
|
87
|
+
e.preventDefault();
|
88
|
+
}
|
89
|
+
};
|
90
|
+
TabsTransfer.prototype.handleTabChange = function () {
|
91
|
+
this.handleSeachCancel();
|
92
|
+
};
|
22
93
|
TabsTransfer.prototype.renderSearchResult = function (searchResult) {
|
23
94
|
var _a = this.props, searchResultMode = _a.searchResultMode, noResultsText = _a.noResultsText, searchResultColumns = _a.searchResultColumns, cx = _a.classnames, value = _a.value, disabled = _a.disabled, onChange = _a.onChange, option2value = _a.option2value, cellRender = _a.cellRender, optionItemRender = _a.optionItemRender;
|
24
95
|
var options = searchResult || [];
|
@@ -43,58 +114,94 @@ var TabsTransfer = /** @class */ (function (_super) {
|
|
43
114
|
}
|
44
115
|
: undefined }));
|
45
116
|
};
|
46
|
-
TabsTransfer.prototype.renderSelect = function (
|
47
|
-
var
|
48
|
-
var
|
117
|
+
TabsTransfer.prototype.renderSelect = function () {
|
118
|
+
var _this = this;
|
119
|
+
var _a = this.props, options = _a.options, placeholder = _a.placeholder, cx = _a.classnames, __ = _a.translate;
|
120
|
+
var showOptions = options.filter(function (item) { return item.visible !== false; });
|
49
121
|
if (!Array.isArray(options) || !options.length) {
|
50
122
|
return (react_1.default.createElement("div", { className: cx('TabsTransfer-placeholder') }, __(placeholder || 'placeholder.noOption')));
|
51
123
|
}
|
52
|
-
return (react_1.default.createElement(Tabs_1.default, { mode: "
|
53
|
-
|
54
|
-
react_1.default.createElement(
|
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
|
-
|
124
|
+
return (react_1.default.createElement(Tabs_1.default, { mode: "line", className: cx('TabsTransfer-tabs'), onSelect: this.handleTabChange }, showOptions.map(function (option, index) { return (react_1.default.createElement(Tabs_1.Tab, { eventKey: index, key: index, title: option.label || option.title, className: "TabsTransfer-tab" },
|
125
|
+
option.searchable ? (react_1.default.createElement("div", { className: cx('TabsTransfer-search') },
|
126
|
+
react_1.default.createElement(InputBox_1.default, { value: _this.state.inputValue, onChange: function (text) { return _this.handleSearch(text, option); }, placeholder: __('Transfer.searchKeyword'), clearable: false, onKeyDown: _this.handleSearchKeyDown }, _this.state.searchResult !== null ? (react_1.default.createElement("a", { onClick: _this.handleSeachCancel },
|
127
|
+
react_1.default.createElement(icons_1.Icon, { icon: "close", className: "icon" }))) : (react_1.default.createElement(icons_1.Icon, { icon: "search", className: "icon" }))))) : null,
|
128
|
+
_this.state.searchResult !== null
|
129
|
+
? _this.renderSearchResult(_this.state.searchResult)
|
130
|
+
: _this.renderOptions(option))); })));
|
131
|
+
};
|
132
|
+
TabsTransfer.prototype.renderOptions = function (option) {
|
133
|
+
var _a = this.props, cx = _a.classnames, value = _a.value, disabled = _a.disabled, onChange = _a.onChange, option2value = _a.option2value, onDeferLoad = _a.onDeferLoad, onLeftDeferLoad = _a.onLeftDeferLoad, cellRender = _a.cellRender, __ = _a.translate, optionItemRender = _a.optionItemRender;
|
134
|
+
return option.selectMode === 'table' ? (react_1.default.createElement(TableSelection_1.default, { className: cx('Transfer-checkboxes'), columns: option.columns, options: option.children || [], value: value, disabled: disabled, onChange: onChange, option2value: option2value, onDeferLoad: onDeferLoad, cellRender: cellRender })) : option.selectMode === 'tree' ? (react_1.default.createElement(TreeSelection_1.default, { className: cx('Transfer-checkboxes'), options: option.children || [], value: value, disabled: disabled, onChange: onChange, option2value: option2value, onDeferLoad: onDeferLoad, itemRender: optionItemRender
|
135
|
+
? function (item, states) {
|
136
|
+
return optionItemRender(item, states, {
|
137
|
+
panel: 'tab',
|
138
|
+
tag: option
|
139
|
+
});
|
140
|
+
}
|
141
|
+
: undefined })) : option.selectMode === 'chained' ? (react_1.default.createElement(ChainedSelection_1.default, { className: cx('Transfer-checkboxes'), options: option.children || [], value: value, disabled: disabled, onChange: onChange, option2value: option2value, onDeferLoad: onDeferLoad, defaultSelectedIndex: option.defaultSelectedIndex, itemRender: optionItemRender
|
142
|
+
? function (item, states) {
|
143
|
+
return optionItemRender(item, states, {
|
144
|
+
panel: 'tab',
|
145
|
+
tag: option
|
146
|
+
});
|
147
|
+
}
|
148
|
+
: undefined })) : option.selectMode === 'associated' ? (react_1.default.createElement(AssociatedSelection_1.default, { className: cx('Transfer-checkboxes'), options: option.children || [], value: value, disabled: disabled, onChange: onChange, option2value: option2value, onDeferLoad: onDeferLoad, onLeftDeferLoad: onLeftDeferLoad, leftMode: option.leftMode, leftOptions: option.leftOptions, leftDefaultValue: option.leftDefaultValue, itemRender: optionItemRender
|
149
|
+
? function (item, states) {
|
150
|
+
return optionItemRender(item, states, {
|
151
|
+
panel: 'tab',
|
152
|
+
tag: option
|
153
|
+
});
|
154
|
+
}
|
155
|
+
: undefined })) : (react_1.default.createElement(GroupedSelection_1.default, { className: cx('Transfer-checkboxes'), options: option.children || [], value: value, disabled: disabled, onChange: onChange, option2value: option2value, onDeferLoad: onDeferLoad, itemRender: optionItemRender
|
156
|
+
? function (item, states) {
|
157
|
+
return optionItemRender(item, states, {
|
158
|
+
panel: 'tab',
|
159
|
+
tag: option
|
160
|
+
});
|
161
|
+
}
|
162
|
+
: undefined }));
|
87
163
|
};
|
88
164
|
TabsTransfer.prototype.render = function () {
|
89
|
-
var _a = this.props, className = _a.className, cx = _a.classnames, optionItemRender = _a.optionItemRender, reset = (0, tslib_1.__rest)(_a, ["className", "classnames", "optionItemRender"]);
|
165
|
+
var _a = this.props, className = _a.className, cx = _a.classnames, optionItemRender = _a.optionItemRender, onSearch = _a.onSearch, reset = (0, tslib_1.__rest)(_a, ["className", "classnames", "optionItemRender", "onSearch"]);
|
90
166
|
return (react_1.default.createElement(Transfer_1.default, (0, tslib_1.__assign)({}, reset, { statistics: false, classnames: cx, className: cx('TabsTransfer', className), selectRender: this.renderSelect })));
|
91
167
|
};
|
168
|
+
var _a, _b, _c;
|
169
|
+
(0, tslib_1.__decorate)([
|
170
|
+
helper_1.autobind,
|
171
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
172
|
+
(0, tslib_1.__metadata)("design:paramtypes", [String, typeof (_a = typeof Select_1.Option !== "undefined" && Select_1.Option) === "function" ? _a : Object]),
|
173
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
174
|
+
], TabsTransfer.prototype, "handleSearch", null);
|
175
|
+
(0, tslib_1.__decorate)([
|
176
|
+
helper_1.autobind,
|
177
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
178
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
179
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
180
|
+
], TabsTransfer.prototype, "handleSeachCancel", null);
|
92
181
|
(0, tslib_1.__decorate)([
|
93
182
|
helper_1.autobind,
|
94
183
|
(0, tslib_1.__metadata)("design:type", Function),
|
95
|
-
(0, tslib_1.__metadata)("design:paramtypes", [Object]),
|
184
|
+
(0, tslib_1.__metadata)("design:paramtypes", [typeof (_b = typeof react_1.default !== "undefined" && react_1.default.KeyboardEvent) === "function" ? _b : Object]),
|
185
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
186
|
+
], TabsTransfer.prototype, "handleSearchKeyDown", null);
|
187
|
+
(0, tslib_1.__decorate)([
|
188
|
+
helper_1.autobind,
|
189
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
190
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
191
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
192
|
+
], TabsTransfer.prototype, "handleTabChange", null);
|
193
|
+
(0, tslib_1.__decorate)([
|
194
|
+
helper_1.autobind,
|
195
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
196
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
96
197
|
(0, tslib_1.__metadata)("design:returntype", void 0)
|
97
198
|
], TabsTransfer.prototype, "renderSelect", null);
|
199
|
+
(0, tslib_1.__decorate)([
|
200
|
+
helper_1.autobind,
|
201
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
202
|
+
(0, tslib_1.__metadata)("design:paramtypes", [typeof (_c = typeof Select_1.Option !== "undefined" && Select_1.Option) === "function" ? _c : Object]),
|
203
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
204
|
+
], TabsTransfer.prototype, "renderOptions", null);
|
98
205
|
return TabsTransfer;
|
99
206
|
}(react_1.default.Component));
|
100
207
|
exports.TabsTransfer = TabsTransfer;
|
@@ -6,8 +6,8 @@
|
|
6
6
|
"/src/components/TabsTransfer.tsx"
|
7
7
|
],
|
8
8
|
"names": [],
|
9
|
-
"mappings": ";;;;AAAA,6DAA0B;AAC1B,0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nimport SearchBox from './SearchBox';\nimport TableCheckboxes from './TableSelection';\nimport TreeCheckboxes from './TreeSelection';\nimport ChainedCheckboxes from './ChainedSelection';\nimport ListCheckboxes from './GroupedSelection';\nimport {Options, Option} from './Select';\nimport Transfer, {TransferProps} from './Transfer';\nimport {themeable} from '../theme';\nimport AssociatedCheckboxes from './AssociatedSelection';\nimport {localeable} from '../locale';\nimport {ItemRenderStates} from './Selection';\n\nexport interface TabsTransferProps\n extends Omit<\n TransferProps,\n | 'selectMode'\n | 'columns'\n | 'selectRender'\n | 'statistics'\n | 'optionItemRender'\n > {\n optionItemRender?: (\n option: Option,\n states: ItemRenderStates,\n tab: Option\n ) => JSX.Element;\n cellRender?: (\n column: {\n name: string;\n label: string;\n [propName: string]: any;\n },\n option: Option,\n colIndex: number,\n rowIndex: number\n ) => JSX.Element;\n}\n\nexport class TabsTransfer extends React.Component<TabsTransferProps> {\n renderSearchResult(searchResult: Options | null) {\n const {\n searchResultMode,\n noResultsText,\n searchResultColumns,\n classnames: cx,\n value,\n disabled,\n onChange,\n option2value,\n cellRender,\n optionItemRender\n } = this.props;\n const options = searchResult || [];\n const mode = searchResultMode;\n\n return mode === 'table' ? (\n <TableCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n columns={searchResultColumns!}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n cellRender={cellRender}\n />\n ) : mode === 'tree' ? (\n <TreeCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n ) : mode === 'chained' ? (\n <ChainedCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n ) : (\n <ListCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n );\n }\n\n @autobind\n renderSelect({onSearch, onSearchCancel, searchResult}: any) {\n const {\n options,\n placeholder,\n classnames: cx,\n value,\n disabled,\n onChange,\n onSearch: searchable,\n option2value,\n onDeferLoad,\n onLeftDeferLoad,\n cellRender,\n translate: __,\n optionItemRender\n } = this.props;\n\n if (!Array.isArray(options) || !options.length) {\n return (\n <div className={cx('TabsTransfer-placeholder')}>\n {__(placeholder || 'placeholder.noOption')}\n </div>\n );\n }\n\n return (\n <Tabs\n mode=\"card\"\n className={cx('TabsTransfer-tabs')}\n activeKey={searchResult !== null ? 0 : undefined}\n toolbar={\n searchable ? (\n <>\n <span className={cx('TabsTransfer-tabsMid')}></span>\n <SearchBox onSearch={onSearch} onCancel={onSearchCancel} />\n </>\n ) : null\n }\n >\n {searchResult !== null\n ? [\n <Tab\n className=\"TabsTransfer-tab\"\n title={__('searchResult')}\n key={0}\n eventKey={0}\n >\n {this.renderSearchResult(searchResult)}\n </Tab>\n ]\n : options.map((option, index) => (\n <Tab\n eventKey={index}\n key={index}\n title={option.label || option.title}\n className=\"TabsTransfer-tab\"\n >\n {option.selectMode === 'table' ? (\n <TableCheckboxes\n className={cx('Transfer-checkboxes')}\n columns={option.columns as any}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n cellRender={cellRender}\n />\n ) : option.selectMode === 'tree' ? (\n <TreeCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : option.selectMode === 'chained' ? (\n <ChainedCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n defaultSelectedIndex={option.defaultSelectedIndex}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : option.selectMode === 'associated' ? (\n <AssociatedCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n onLeftDeferLoad={onLeftDeferLoad}\n leftMode={option.leftMode}\n leftOptions={option.leftOptions}\n leftDefaultValue={option.leftDefaultValue}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : (\n <ListCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n )}\n </Tab>\n ))}\n </Tabs>\n );\n }\n\n render() {\n const {className, classnames: cx, optionItemRender, ...reset} = this.props;\n\n return (\n <Transfer\n {...reset}\n statistics={false}\n classnames={cx}\n className={cx('TabsTransfer', className)}\n selectRender={this.renderSelect}\n />\n );\n }\n}\n\nexport default themeable(localeable(TabsTransfer));\n"
|
11
|
+
"import React from 'react';\nimport {autobind} from '../utils/helper';\nimport Tabs, {Tab} from './Tabs';\nimport InputBox from './InputBox';\nimport TableCheckboxes from './TableSelection';\nimport TreeCheckboxes from './TreeSelection';\nimport ChainedCheckboxes from './ChainedSelection';\nimport ListCheckboxes from './GroupedSelection';\nimport {Options, Option} from './Select';\nimport Transfer, {TransferProps} from './Transfer';\nimport {themeable} from '../theme';\nimport AssociatedCheckboxes from './AssociatedSelection';\nimport {localeable} from '../locale';\nimport {ItemRenderStates} from './Selection';\nimport {Icon} from './icons';\nimport debounce from 'lodash/debounce';\n\nexport interface TabsTransferProps\n extends Omit<\n TransferProps,\n | 'selectMode'\n | 'columns'\n | 'selectRender'\n | 'statistics'\n | 'onSearch'\n | 'optionItemRender'\n > {\n onSearch: (\n term: string,\n option: Option,\n setCancel: (cancel: () => void) => void\n ) => Promise<Options | void>;\n optionItemRender?: (\n option: Option,\n states: ItemRenderStates,\n tab: Option\n ) => JSX.Element;\n cellRender?: (\n column: {\n name: string;\n label: string;\n [propName: string]: any;\n },\n option: Option,\n colIndex: number,\n rowIndex: number\n ) => JSX.Element;\n}\n\nexport interface TabsTransferState {\n inputValue: string;\n searchResult: Options | null;\n}\n\nexport class TabsTransfer extends React.Component<\n TabsTransferProps,\n TabsTransferState\n> {\n state = {\n inputValue: '',\n searchResult: null\n };\n\n unmounted = false;\n cancelSearch?: () => void;\n\n componentWillUnmount() {\n this.lazySearch.cancel();\n this.unmounted = true;\n }\n\n @autobind\n handleSearch(text: string, option: Option) {\n // text 有值的时候,走搜索否则直接走 handleSeachCancel ,等同于右侧的 clear 按钮\n if (text) {\n this.setState(\n {\n inputValue: text\n },\n () => {\n // 如果有取消搜索,先取消掉。\n this.cancelSearch && this.cancelSearch();\n this.lazySearch(text, option);\n }\n );\n } else {\n this.handleSeachCancel();\n }\n }\n\n @autobind\n handleSeachCancel() {\n this.setState({\n inputValue: '',\n searchResult: null\n });\n }\n\n lazySearch = debounce(\n (text: string, option: Option) => {\n (async (text: string) => {\n const onSearch = this.props.onSearch;\n let result = await onSearch(\n text,\n option,\n (cancelExecutor: () => void) => (this.cancelSearch = cancelExecutor)\n );\n\n if (this.unmounted) {\n return;\n }\n\n if (!Array.isArray(result)) {\n throw new Error('onSearch 需要返回数组');\n }\n\n this.setState({\n searchResult: result\n });\n })(text).catch(e => console.error(e));\n },\n 250,\n {\n trailing: true,\n leading: false\n }\n );\n\n @autobind\n handleSearchKeyDown(e: React.KeyboardEvent<any>) {\n if (e.key === 'Enter') {\n e.preventDefault();\n }\n }\n\n @autobind\n handleTabChange() {\n this.handleSeachCancel();\n }\n\n renderSearchResult(searchResult: Options | null) {\n const {\n searchResultMode,\n noResultsText,\n searchResultColumns,\n classnames: cx,\n value,\n disabled,\n onChange,\n option2value,\n cellRender,\n optionItemRender\n } = this.props;\n const options = searchResult || [];\n const mode = searchResultMode;\n\n return mode === 'table' ? (\n <TableCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n columns={searchResultColumns!}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n cellRender={cellRender}\n />\n ) : mode === 'tree' ? (\n <TreeCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n ) : mode === 'chained' ? (\n <ChainedCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n ) : (\n <ListCheckboxes\n placeholder={noResultsText}\n className={cx('Transfer-checkboxes')}\n options={options}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'result'\n })\n : undefined\n }\n />\n );\n }\n\n @autobind\n renderSelect() {\n const {options, placeholder, classnames: cx, translate: __} = this.props;\n const showOptions = options.filter(item => item.visible !== false);\n\n if (!Array.isArray(options) || !options.length) {\n return (\n <div className={cx('TabsTransfer-placeholder')}>\n {__(placeholder || 'placeholder.noOption')}\n </div>\n );\n }\n\n return (\n <Tabs\n mode=\"line\"\n className={cx('TabsTransfer-tabs')}\n onSelect={this.handleTabChange}\n >\n {showOptions.map((option, index) => (\n <Tab\n eventKey={index}\n key={index}\n title={option.label || option.title}\n className=\"TabsTransfer-tab\"\n >\n {option.searchable ? (\n <div className={cx('TabsTransfer-search')}>\n <InputBox\n value={this.state.inputValue}\n onChange={(text: string) => this.handleSearch(text, option)}\n placeholder={__('Transfer.searchKeyword')}\n clearable={false}\n onKeyDown={this.handleSearchKeyDown}\n >\n {this.state.searchResult !== null ? (\n <a onClick={this.handleSeachCancel}>\n <Icon icon=\"close\" className=\"icon\" />\n </a>\n ) : (\n <Icon icon=\"search\" className=\"icon\" />\n )}\n </InputBox>\n </div>\n ) : null}\n {this.state.searchResult !== null\n ? this.renderSearchResult(this.state.searchResult)\n : this.renderOptions(option)}\n </Tab>\n ))}\n </Tabs>\n );\n }\n\n @autobind\n renderOptions(option: Option) {\n const {\n classnames: cx,\n value,\n disabled,\n onChange,\n option2value,\n onDeferLoad,\n onLeftDeferLoad,\n cellRender,\n translate: __,\n optionItemRender\n } = this.props;\n return option.selectMode === 'table' ? (\n <TableCheckboxes\n className={cx('Transfer-checkboxes')}\n columns={option.columns as any}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n cellRender={cellRender}\n />\n ) : option.selectMode === 'tree' ? (\n <TreeCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : option.selectMode === 'chained' ? (\n <ChainedCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n defaultSelectedIndex={option.defaultSelectedIndex}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : option.selectMode === 'associated' ? (\n <AssociatedCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n onLeftDeferLoad={onLeftDeferLoad}\n leftMode={option.leftMode}\n leftOptions={option.leftOptions}\n leftDefaultValue={option.leftDefaultValue}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n ) : (\n <ListCheckboxes\n className={cx('Transfer-checkboxes')}\n options={option.children || []}\n value={value}\n disabled={disabled}\n onChange={onChange}\n option2value={option2value}\n onDeferLoad={onDeferLoad}\n itemRender={\n optionItemRender\n ? (item: Option, states: ItemRenderStates) =>\n optionItemRender(item, states, {\n panel: 'tab',\n tag: option\n })\n : undefined\n }\n />\n );\n }\n\n render() {\n const {\n className,\n classnames: cx,\n optionItemRender,\n onSearch,\n ...reset\n } = this.props;\n\n return (\n <Transfer\n {...reset}\n statistics={false}\n classnames={cx}\n className={cx('TabsTransfer', className)}\n selectRender={this.renderSelect}\n />\n );\n }\n}\n\nexport default themeable(localeable(TabsTransfer));\n"
|
12
12
|
]
|
13
13
|
}
|
package/lib/components/Tree.js
CHANGED
@@ -46,8 +46,10 @@ var TreeSelector = /** @class */ (function (_super) {
|
|
46
46
|
return _this;
|
47
47
|
}
|
48
48
|
TreeSelector.prototype.componentDidMount = function () {
|
49
|
+
var _a, _b;
|
49
50
|
var enableNodePath = this.props.enableNodePath;
|
50
|
-
|
51
|
+
// onRef只有渲染器的情况才会使用
|
52
|
+
(_b = (_a = this.props).onRef) === null || _b === void 0 ? void 0 : _b.call(_a, this);
|
51
53
|
enableNodePath && this.expandLazyLoadNodes();
|
52
54
|
};
|
53
55
|
TreeSelector.prototype.componentDidUpdate = function (prevProps) {
|