amis 1.9.0-beta.12 → 1.9.0-beta.15
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/Schema.d.ts +4 -2
- package/lib/Schema.js.map +1 -1
- package/lib/SchemaRenderer.d.ts +2 -2
- package/lib/SchemaRenderer.js +3 -3
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/actions/Action.d.ts +8 -6
- package/lib/actions/Action.js.map +2 -2
- package/lib/actions/AjaxAction.d.ts +10 -7
- package/lib/actions/AjaxAction.js +27 -21
- package/lib/actions/AjaxAction.js.map +2 -2
- package/lib/actions/BreakAction.d.ts +2 -2
- package/lib/actions/BreakAction.js.map +1 -1
- package/lib/actions/BroadcastAction.d.ts +3 -3
- package/lib/actions/BroadcastAction.js +3 -2
- package/lib/actions/BroadcastAction.js.map +2 -2
- package/lib/actions/CmptAction.d.ts +2 -2
- package/lib/actions/CmptAction.js +7 -9
- package/lib/actions/CmptAction.js.map +2 -2
- package/lib/actions/ContinueAction.d.ts +2 -2
- package/lib/actions/ContinueAction.js.map +1 -1
- package/lib/actions/CopyAction.d.ts +7 -4
- package/lib/actions/CopyAction.js +8 -6
- package/lib/actions/CopyAction.js.map +2 -2
- package/lib/actions/CustomAction.d.ts +2 -2
- package/lib/actions/CustomAction.js.map +1 -1
- package/lib/actions/DialogAction.d.ts +14 -8
- package/lib/actions/DialogAction.js +6 -6
- package/lib/actions/DialogAction.js.map +2 -2
- package/lib/actions/DrawerAction.d.ts +3 -3
- package/lib/actions/DrawerAction.js.map +1 -1
- package/lib/actions/EmailAction.d.ts +10 -7
- package/lib/actions/EmailAction.js +4 -5
- package/lib/actions/EmailAction.js.map +2 -2
- package/lib/actions/LinkAction.d.ts +19 -11
- package/lib/actions/LinkAction.js +6 -5
- package/lib/actions/LinkAction.js.map +2 -2
- package/lib/actions/LoopAction.d.ts +6 -3
- package/lib/actions/LoopAction.js +22 -20
- package/lib/actions/LoopAction.js.map +2 -2
- package/lib/actions/PageAction.d.ts +8 -5
- package/lib/actions/PageAction.js +3 -2
- package/lib/actions/PageAction.js.map +2 -2
- package/lib/actions/ParallelAction.d.ts +2 -2
- package/lib/actions/ParallelAction.js.map +1 -1
- package/lib/actions/SwitchAction.d.ts +2 -2
- package/lib/actions/SwitchAction.js.map +1 -1
- package/lib/actions/ToastAction.d.ts +2 -2
- package/lib/actions/ToastAction.js +6 -4
- package/lib/actions/ToastAction.js.map +2 -2
- package/lib/components/Editor.d.ts +84 -84
- package/lib/components/InputBox.js +1 -1
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/Pagination.d.ts +1175 -0
- package/lib/components/Pagination.js +274 -0
- package/lib/components/Pagination.js.map +13 -0
- package/lib/components/PickerContainer.d.ts +1 -0
- package/lib/components/PickerContainer.js +3 -2
- package/lib/components/PickerContainer.js.map +2 -2
- package/lib/components/Rating.js +11 -9
- package/lib/components/Rating.js.map +2 -2
- package/lib/components/Select.js +3 -3
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Tag.d.ts +148 -0
- package/lib/components/Tag.js +96 -0
- package/lib/components/Tag.js.map +13 -0
- package/lib/components/TooltipWrapper.d.ts +25 -21
- package/lib/components/TooltipWrapper.js +11 -1
- package/lib/components/TooltipWrapper.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +85 -84
- package/lib/components/TransferDropDown.js +2 -2
- package/lib/components/TransferDropDown.js.map +2 -2
- package/lib/components/Tree.d.ts +84 -84
- package/lib/components/formula/VariableList.d.ts +1 -0
- package/lib/components/formula/VariableList.js.map +2 -2
- package/lib/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/components/index.d.ts +4 -1
- package/lib/components/index.js +7 -1
- package/lib/components/index.js.map +2 -2
- package/lib/components/schema-editor/Array.d.ts +11 -0
- package/lib/components/schema-editor/Array.js +66 -0
- package/lib/components/schema-editor/Array.js.map +13 -0
- package/lib/components/schema-editor/Common.d.ts +29 -0
- package/lib/components/schema-editor/Common.js +69 -0
- package/lib/components/schema-editor/Common.js.map +13 -0
- package/lib/components/schema-editor/Item.d.ts +9 -0
- package/lib/components/schema-editor/Item.js +31 -0
- package/lib/components/schema-editor/Item.js.map +13 -0
- package/lib/components/schema-editor/Object.d.ts +44 -0
- package/lib/components/schema-editor/Object.js +191 -0
- package/lib/components/schema-editor/Object.js.map +13 -0
- package/lib/components/schema-editor/SchemaVariableList.d.ts +316 -0
- package/lib/components/schema-editor/SchemaVariableList.js +74 -0
- package/lib/components/schema-editor/SchemaVariableList.js.map +13 -0
- package/lib/components/schema-editor/SchemaVariableListPicker.d.ts +305 -0
- package/lib/components/schema-editor/SchemaVariableListPicker.js +32 -0
- package/lib/components/schema-editor/SchemaVariableListPicker.js.map +13 -0
- package/lib/components/schema-editor/index.d.ts +520 -0
- package/lib/components/schema-editor/index.js +118 -0
- package/lib/components/schema-editor/index.js.map +13 -0
- package/lib/components/table/Cell.d.ts +930 -0
- package/lib/components/table/Cell.js +36 -0
- package/lib/components/table/Cell.js.map +13 -0
- package/lib/components/table/HeadCellDropDown.d.ts +514 -0
- package/lib/components/table/HeadCellDropDown.js +52 -0
- package/lib/components/table/HeadCellDropDown.js.map +13 -0
- package/lib/components/table/HeadCellFilter.d.ts +771 -0
- package/lib/components/table/HeadCellFilter.js +106 -0
- package/lib/components/table/HeadCellFilter.js.map +13 -0
- package/lib/components/table/HeadCellSelect.d.ts +672 -0
- package/lib/components/table/HeadCellSelect.js +46 -0
- package/lib/components/table/HeadCellSelect.js.map +13 -0
- package/lib/components/table/HeadCellSort.d.ts +498 -0
- package/lib/components/table/HeadCellSort.js +67 -0
- package/lib/components/table/HeadCellSort.js.map +13 -0
- package/lib/components/table/index.d.ts +1355 -0
- package/lib/components/table/index.js +1095 -0
- package/lib/components/table/index.js.map +13 -0
- package/lib/env.d.ts +2 -4
- package/lib/env.js.map +2 -2
- package/lib/factory.js +0 -95
- package/lib/factory.js.map +2 -2
- package/lib/icons/dot.js +11 -0
- package/lib/index.d.ts +6 -1
- package/lib/index.js +9 -2
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +18 -1
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +18 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +20 -1
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.js +0 -2
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/Carousel.d.ts +5 -1
- package/lib/renderers/Carousel.js +18 -5
- package/lib/renderers/Carousel.js.map +2 -2
- package/lib/renderers/Form/ButtonGroupSelect.d.ts +2 -0
- package/lib/renderers/Form/ButtonGroupSelect.js +7 -0
- package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
- package/lib/renderers/Form/Checkbox.js +3 -4
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.d.ts +2 -1
- package/lib/renderers/Form/Checkboxes.js +19 -14
- package/lib/renderers/Form/Checkboxes.js.map +2 -2
- package/lib/renderers/Form/Combo.js +23 -4
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +126 -18
- package/lib/renderers/Form/Editor.d.ts +412 -112
- package/lib/renderers/Form/Editor.js +10 -1
- package/lib/renderers/Form/Editor.js.map +2 -2
- package/lib/renderers/Form/InputExcel.js +6 -1
- package/lib/renderers/Form/InputExcel.js.map +2 -2
- package/lib/renderers/Form/InputFile.js +1 -2
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputTree.js +1 -1
- package/lib/renderers/Form/InputTree.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +0 -6
- package/lib/renderers/Form/JSONSchemaEditor.d.ts +41 -0
- package/lib/renderers/Form/JSONSchemaEditor.js +33 -0
- package/lib/renderers/Form/JSONSchemaEditor.js.map +13 -0
- package/lib/renderers/Form/ListSelect.d.ts +2 -0
- package/lib/renderers/Form/ListSelect.js +7 -0
- package/lib/renderers/Form/ListSelect.js.map +2 -2
- package/lib/renderers/Form/Options.js +1 -0
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Select.js +12 -1
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TabsTransfer.d.ts +1 -1
- package/lib/renderers/Form/TabsTransfer.js +2 -2
- package/lib/renderers/Form/TabsTransfer.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.d.ts +4 -0
- package/lib/renderers/Form/TreeSelect.js +2 -2
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +10 -5
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/Pagination.d.ts +49 -30
- package/lib/renderers/Pagination.js +3 -132
- package/lib/renderers/Pagination.js.map +2 -2
- package/lib/renderers/Table/HeadCellSearchDropdown.js +0 -1
- package/lib/renderers/Table/HeadCellSearchDropdown.js.map +2 -2
- package/lib/renderers/Table-v2/HeadCellSearchDropdown.d.ts +29 -0
- package/lib/renderers/Table-v2/HeadCellSearchDropdown.js +158 -0
- package/lib/renderers/Table-v2/HeadCellSearchDropdown.js.map +13 -0
- package/lib/renderers/Table-v2/TableCell.d.ts +6 -0
- package/lib/renderers/Table-v2/TableCell.js +28 -0
- package/lib/renderers/Table-v2/TableCell.js.map +13 -0
- package/lib/renderers/Table-v2/index.d.ts +256 -0
- package/lib/renderers/Table-v2/index.js +548 -0
- package/lib/renderers/Table-v2/index.js.map +13 -0
- package/lib/renderers/Tabs.js +1 -1
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/Tag.d.ts +66 -0
- package/lib/renderers/Tag.js +53 -0
- package/lib/renderers/Tag.js.map +13 -0
- package/lib/renderers/Wizard.js +3 -3
- package/lib/renderers/Wizard.js.map +2 -2
- package/lib/schemaExtend.js +24 -30
- package/lib/schemaExtend.js.map +2 -2
- package/lib/store/combo.d.ts +140 -20
- package/lib/store/form.d.ts +56 -8
- package/lib/store/formItem.d.ts +3 -1
- package/lib/store/formItem.js +3 -1
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/index.js +2 -0
- package/lib/store/index.js.map +2 -2
- package/lib/store/table-v2.d.ts +308 -0
- package/lib/store/table-v2.js +452 -0
- package/lib/store/table-v2.js.map +13 -0
- package/lib/store/table.d.ts +112 -16
- package/lib/store/table.js +1 -1
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +1686 -120
- package/lib/themes/ang.css +1807 -208
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +1667 -101
- package/lib/themes/antd.css +1789 -201
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1662 -97
- package/lib/themes/cxd.css +1983 -394
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +1667 -101
- package/lib/themes/dark.css +1789 -201
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +1662 -97
- package/lib/themes/default.css +1983 -394
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/DataSchema.d.ts +25 -0
- package/lib/utils/DataSchema.js +104 -0
- package/lib/utils/DataSchema.js.map +13 -0
- package/lib/utils/DataScope.d.ts +23 -0
- package/lib/utils/DataScope.js +140 -0
- package/lib/utils/DataScope.js.map +13 -0
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/handleAction.js.map +2 -2
- package/lib/utils/renderer-event.d.ts +8 -2
- package/lib/utils/renderer-event.js +102 -1
- package/lib/utils/renderer-event.js.map +2 -2
- package/package.json +3 -2
- package/schema.json +1476 -469
- package/scss/_properties.scss +69 -0
- package/scss/components/_button.scss +37 -39
- package/scss/components/_context-menu.scss +3 -18
- package/scss/components/_json-schema-editor.scss +126 -0
- package/scss/components/_pagination.scss +104 -23
- package/scss/components/_result-box.scss +2 -2
- package/scss/components/_table-v2.scss +912 -0
- package/scss/components/_tag.scss +177 -0
- package/scss/components/form/_selection.scss +1 -14
- package/scss/components/form/_text.scss +1 -1
- package/scss/themes/_antd-variables.scss +0 -13
- package/scss/themes/_common.scss +3 -0
- package/scss/themes/_cxd-variables.scss +7 -17
- package/scss/themes/_dark-variables.scss +0 -13
- package/scss/themes/cxd.scss +1 -1
- package/sdk/ang-ie11.css +2240 -227
- package/sdk/ang.css +2905 -859
- package/sdk/antd-ie11.css +2233 -220
- package/sdk/antd.css +2905 -870
- 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 +2223 -211
- package/sdk/cxd.css +2911 -875
- package/sdk/dark-ie11.css +2233 -220
- package/sdk/dark.css +2905 -870
- package/sdk/exceljs.js +1 -1
- package/sdk/locale/de-DE.js +18 -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 +16 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +2223 -211
- package/sdk/sdk.css +2911 -875
- package/sdk/sdk.js +1326 -1270
- 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/Schema.ts +7 -0
- package/src/SchemaRenderer.tsx +4 -5
- package/src/actions/Action.ts +7 -6
- package/src/actions/AjaxAction.ts +33 -24
- package/src/actions/BreakAction.ts +2 -2
- package/src/actions/BroadcastAction.ts +6 -5
- package/src/actions/CmptAction.ts +5 -6
- package/src/actions/ContinueAction.ts +2 -2
- package/src/actions/CopyAction.ts +14 -8
- package/src/actions/CustomAction.ts +2 -2
- package/src/actions/DialogAction.ts +16 -10
- package/src/actions/DrawerAction.ts +3 -3
- package/src/actions/EmailAction.ts +12 -12
- package/src/actions/LinkAction.ts +34 -14
- package/src/actions/LoopAction.ts +13 -8
- package/src/actions/PageAction.ts +9 -6
- package/src/actions/ParallelAction.ts +2 -2
- package/src/actions/SwitchAction.ts +2 -2
- package/src/actions/ToastAction.ts +9 -5
- package/src/components/InputBox.tsx +1 -0
- package/src/components/Pagination.tsx +446 -0
- package/src/components/PickerContainer.tsx +8 -5
- package/src/components/Rating.tsx +16 -9
- package/src/components/Select.tsx +3 -3
- package/src/components/Tag.tsx +179 -0
- package/src/components/TooltipWrapper.tsx +14 -1
- package/src/components/TransferDropDown.tsx +3 -0
- package/src/components/formula/VariableList.tsx +1 -0
- package/src/components/icons.tsx +2 -0
- package/src/components/index.tsx +7 -1
- package/src/components/schema-editor/Array.tsx +95 -0
- package/src/components/schema-editor/Common.tsx +138 -0
- package/src/components/schema-editor/Item.tsx +36 -0
- package/src/components/schema-editor/Object.tsx +299 -0
- package/src/components/schema-editor/SchemaVariableList.tsx +97 -0
- package/src/components/schema-editor/SchemaVariableListPicker.tsx +66 -0
- package/src/components/schema-editor/index.tsx +211 -0
- package/src/components/table/Cell.tsx +70 -0
- package/src/components/table/HeadCellDropDown.tsx +115 -0
- package/src/components/table/HeadCellFilter.tsx +193 -0
- package/src/components/table/HeadCellSelect.tsx +86 -0
- package/src/components/table/HeadCellSort.tsx +102 -0
- package/src/components/table/index.tsx +1681 -0
- package/src/env.tsx +7 -14
- package/src/factory.tsx +3 -106
- package/src/icons/dot.svg +11 -0
- package/src/index.tsx +8 -1
- package/src/locale/de-DE.ts +18 -1
- package/src/locale/en-US.ts +18 -1
- package/src/locale/zh-CN.ts +20 -1
- package/src/renderers/Action.tsx +1 -1
- package/src/renderers/Carousel.tsx +21 -6
- package/src/renderers/Form/ButtonGroupSelect.tsx +10 -1
- package/src/renderers/Form/Checkbox.tsx +4 -4
- package/src/renderers/Form/Checkboxes.tsx +31 -25
- package/src/renderers/Form/Combo.tsx +20 -4
- package/src/renderers/Form/Editor.tsx +15 -1
- package/src/renderers/Form/InputExcel.tsx +6 -1
- package/src/renderers/Form/InputFile.tsx +1 -2
- package/src/renderers/Form/InputTree.tsx +1 -1
- package/src/renderers/Form/JSONSchemaEditor.tsx +67 -0
- package/src/renderers/Form/ListSelect.tsx +9 -1
- package/src/renderers/Form/Options.tsx +1 -1
- package/src/renderers/Form/Select.tsx +7 -0
- package/src/renderers/Form/TabsTransfer.tsx +2 -2
- package/src/renderers/Form/TreeSelect.tsx +8 -1
- package/src/renderers/Form/wrapControl.tsx +11 -5
- package/src/renderers/Pagination.tsx +65 -253
- package/src/renderers/Table/HeadCellSearchDropdown.tsx +0 -1
- package/src/renderers/Table-v2/HeadCellSearchDropdown.tsx +244 -0
- package/src/renderers/Table-v2/TableCell.tsx +19 -0
- package/src/renderers/Table-v2/index.tsx +1140 -0
- package/src/renderers/Tabs.tsx +1 -1
- package/src/renderers/Tag.tsx +128 -0
- package/src/renderers/Wizard.tsx +3 -3
- package/src/schemaExtend.ts +24 -28
- package/src/store/formItem.ts +5 -1
- package/src/store/index.ts +2 -0
- package/src/store/table-v2.ts +646 -0
- package/src/store/table.ts +1 -1
- package/src/utils/DataSchema.ts +131 -0
- package/src/utils/DataScope.ts +190 -0
- package/src/utils/handleAction.ts +1 -1
- package/src/utils/renderer-event.ts +113 -2
@@ -0,0 +1,191 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SchemaEditorItemObject = void 0;
|
4
|
+
var tslib_1 = require("tslib");
|
5
|
+
var react_1 = (0, tslib_1.__importDefault)(require("react"));
|
6
|
+
var helper_1 = require("../../utils/helper");
|
7
|
+
var Button_1 = (0, tslib_1.__importDefault)(require("../Button"));
|
8
|
+
var icons_1 = require("../icons");
|
9
|
+
var InputBox_1 = (0, tslib_1.__importDefault)(require("../InputBox"));
|
10
|
+
var Common_1 = require("./Common");
|
11
|
+
var Item_1 = require("./Item");
|
12
|
+
var SchemaEditorItemObject = /** @class */ (function (_super) {
|
13
|
+
(0, tslib_1.__extends)(SchemaEditorItemObject, _super);
|
14
|
+
function SchemaEditorItemObject() {
|
15
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
16
|
+
_this.state = {
|
17
|
+
members: _this.propsToMembers(_this.props),
|
18
|
+
collapsed: false
|
19
|
+
};
|
20
|
+
return _this;
|
21
|
+
}
|
22
|
+
SchemaEditorItemObject.prototype.componentDidUpdate = function (prevProps) {
|
23
|
+
var props = this.props;
|
24
|
+
// 外部属性变化,更新 state
|
25
|
+
if (props.value !== prevProps.value &&
|
26
|
+
JSON.stringify(props.value) !== JSON.stringify(this.lastValue)) {
|
27
|
+
this.setState({
|
28
|
+
members: this.propsToMembers(props)
|
29
|
+
});
|
30
|
+
}
|
31
|
+
};
|
32
|
+
SchemaEditorItemObject.prototype.propsToMembers = function (props) {
|
33
|
+
var _a, _b;
|
34
|
+
var members = [];
|
35
|
+
var required = Array.isArray((_a = props.value) === null || _a === void 0 ? void 0 : _a.required)
|
36
|
+
? props.value.required
|
37
|
+
: [];
|
38
|
+
if ((_b = props.value) === null || _b === void 0 ? void 0 : _b.properties) {
|
39
|
+
var properties_1 = props.value.properties;
|
40
|
+
Object.keys(properties_1).forEach(function (key) {
|
41
|
+
var value = properties_1[key];
|
42
|
+
members.push({
|
43
|
+
id: (0, helper_1.guid)(),
|
44
|
+
key: key || '',
|
45
|
+
hasError: !key || members.some(function (i) { return i.key === key; }),
|
46
|
+
required: !!~required.indexOf(key),
|
47
|
+
schema: value
|
48
|
+
});
|
49
|
+
});
|
50
|
+
}
|
51
|
+
return members;
|
52
|
+
};
|
53
|
+
SchemaEditorItemObject.prototype.pipeOut = function () {
|
54
|
+
var members = this.state.members;
|
55
|
+
var _a = this.props, value = _a.value, onChange = _a.onChange;
|
56
|
+
var properties = {};
|
57
|
+
var required = [];
|
58
|
+
members
|
59
|
+
.filter(function (item) { return !item.hasError; })
|
60
|
+
.forEach(function (member) {
|
61
|
+
properties[member.key] = member.schema;
|
62
|
+
if (member.required) {
|
63
|
+
required.push(member.key);
|
64
|
+
}
|
65
|
+
});
|
66
|
+
this.lastValue = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, value), { properties: properties, required: required });
|
67
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(this.lastValue);
|
68
|
+
};
|
69
|
+
SchemaEditorItemObject.prototype.handleAdd = function () {
|
70
|
+
var members = this.state.members.concat();
|
71
|
+
members.push({
|
72
|
+
id: (0, helper_1.guid)(),
|
73
|
+
key: '',
|
74
|
+
hasError: true,
|
75
|
+
required: false,
|
76
|
+
schema: {
|
77
|
+
type: 'string'
|
78
|
+
}
|
79
|
+
});
|
80
|
+
this.setState({
|
81
|
+
members: members
|
82
|
+
}, this.pipeOut);
|
83
|
+
};
|
84
|
+
SchemaEditorItemObject.prototype.handlePropKeyChange = function (index, key) {
|
85
|
+
var members = this.state.members.concat();
|
86
|
+
members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { key: key, hasError: !key || members.some(function (m, i) { return i !== index && m.key === key; }) });
|
87
|
+
this.setState({ members: members }, this.pipeOut);
|
88
|
+
};
|
89
|
+
SchemaEditorItemObject.prototype.handlePropTitleChange = function (index, title) {
|
90
|
+
var members = this.state.members.concat();
|
91
|
+
members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { schema: (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index].schema), { title: title }) });
|
92
|
+
this.setState({ members: members }, this.pipeOut);
|
93
|
+
};
|
94
|
+
SchemaEditorItemObject.prototype.handlePropRemove = function (index) {
|
95
|
+
var members = this.state.members.concat();
|
96
|
+
members.splice(index, 1);
|
97
|
+
this.setState({ members: members }, this.pipeOut);
|
98
|
+
};
|
99
|
+
SchemaEditorItemObject.prototype.handlePropChange = function (index, item) {
|
100
|
+
var members = this.state.members.concat();
|
101
|
+
members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { schema: (0, tslib_1.__assign)({}, item) });
|
102
|
+
this.setState({ members: members }, this.pipeOut);
|
103
|
+
};
|
104
|
+
SchemaEditorItemObject.prototype.handlePropRequiredChange = function (index, required) {
|
105
|
+
var members = this.state.members.concat();
|
106
|
+
members[index] = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, members[index]), { required: required });
|
107
|
+
this.setState({ members: members }, this.pipeOut);
|
108
|
+
};
|
109
|
+
SchemaEditorItemObject.prototype.toggleCollapsed = function () {
|
110
|
+
this.setState({
|
111
|
+
collapsed: !this.state.collapsed
|
112
|
+
});
|
113
|
+
};
|
114
|
+
SchemaEditorItemObject.prototype.rendererProps = function () {
|
115
|
+
var _this = this;
|
116
|
+
var _a = this.props, value = _a.value, __ = _a.translate, cx = _a.classnames, renderExtraProps = _a.renderExtraProps, locale = _a.locale, classPrefix = _a.classPrefix, disabled = _a.disabled, showInfo = _a.showInfo, types = _a.types, onTypeChange = _a.onTypeChange;
|
117
|
+
var members = this.state.members;
|
118
|
+
return (react_1.default.createElement("div", { className: cx('SchemaEditorProps', {
|
119
|
+
'SchemaEditorProps--depth': showInfo !== false
|
120
|
+
}) },
|
121
|
+
members.length ? (members.map(function (member, index) { return (react_1.default.createElement(Item_1.SchemaEditorItem, { key: member.id, types: types, onTypeChange: onTypeChange, prefix: react_1.default.createElement(react_1.default.Fragment, null,
|
122
|
+
react_1.default.createElement(InputBox_1.default, { className: cx('SchemaEditor-key'), hasError: member.hasError, value: member.key || '', onChange: _this.handlePropKeyChange.bind(_this, index), placeholder: __('JSONSchema.key'), disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) }),
|
123
|
+
react_1.default.createElement(InputBox_1.default, { className: cx('SchemaEditor-title'), value: member.schema.title || '', onChange: _this.handlePropTitleChange.bind(_this, index), placeholder: __('JSONSchema.title'), disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) })), affix: react_1.default.createElement(Button_1.default, { className: cx('SchemaEditor-btn'), onClick: _this.handlePropRemove.bind(_this, index), iconOnly: true, disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) },
|
124
|
+
react_1.default.createElement(icons_1.Icon, { icon: "remove", className: "icon" })), value: member.schema, onChange: _this.handlePropChange.bind(_this, index), renderExtraProps: renderExtraProps, locale: locale, translate: __, classnames: cx, classPrefix: classPrefix, disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref), required: member.required, onRequiredChange: _this.handlePropRequiredChange.bind(_this, index) })); })) : (react_1.default.createElement("div", { className: cx('SchemaEditorProps-placeholder') }, __('placeholder.empty'))),
|
125
|
+
react_1.default.createElement(Button_1.default, { level: "link", onClick: this.handleAdd, size: "xs", disabled: disabled || !!(value === null || value === void 0 ? void 0 : value.$ref) }, __('JSONSchema.add_prop'))));
|
126
|
+
};
|
127
|
+
SchemaEditorItemObject.prototype.render = function () {
|
128
|
+
var _a = this.props, cx = _a.classnames, showInfo = _a.showInfo, __ = _a.translate, disabled = _a.disabled;
|
129
|
+
return (react_1.default.createElement("div", { className: cx('SchemaEditorItem SchemaEditorObject', {
|
130
|
+
'is-collapsed': this.state.collapsed
|
131
|
+
}) },
|
132
|
+
showInfo !== false ? (react_1.default.createElement(react_1.default.Fragment, null,
|
133
|
+
react_1.default.createElement("a", { className: cx('SchemaEditor-caret', {
|
134
|
+
'is-collapsed': this.state.collapsed
|
135
|
+
}), onClick: this.toggleCollapsed },
|
136
|
+
react_1.default.createElement(icons_1.Icon, { icon: "caret", className: "icon" })),
|
137
|
+
this.renderCommon())) : null,
|
138
|
+
this.state.collapsed ? null : this.rendererProps()));
|
139
|
+
};
|
140
|
+
(0, tslib_1.__decorate)([
|
141
|
+
helper_1.autobind,
|
142
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
143
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
144
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
145
|
+
], SchemaEditorItemObject.prototype, "pipeOut", null);
|
146
|
+
(0, tslib_1.__decorate)([
|
147
|
+
helper_1.autobind,
|
148
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
149
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
150
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
151
|
+
], SchemaEditorItemObject.prototype, "handleAdd", null);
|
152
|
+
(0, tslib_1.__decorate)([
|
153
|
+
helper_1.autobind,
|
154
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
155
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Number, String]),
|
156
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
157
|
+
], SchemaEditorItemObject.prototype, "handlePropKeyChange", null);
|
158
|
+
(0, tslib_1.__decorate)([
|
159
|
+
helper_1.autobind,
|
160
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
161
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Number, String]),
|
162
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
163
|
+
], SchemaEditorItemObject.prototype, "handlePropTitleChange", null);
|
164
|
+
(0, tslib_1.__decorate)([
|
165
|
+
helper_1.autobind,
|
166
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
167
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Number]),
|
168
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
169
|
+
], SchemaEditorItemObject.prototype, "handlePropRemove", null);
|
170
|
+
(0, tslib_1.__decorate)([
|
171
|
+
helper_1.autobind,
|
172
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
173
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Number, Object]),
|
174
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
175
|
+
], SchemaEditorItemObject.prototype, "handlePropChange", null);
|
176
|
+
(0, tslib_1.__decorate)([
|
177
|
+
helper_1.autobind,
|
178
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
179
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Number, Boolean]),
|
180
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
181
|
+
], SchemaEditorItemObject.prototype, "handlePropRequiredChange", null);
|
182
|
+
(0, tslib_1.__decorate)([
|
183
|
+
helper_1.autobind,
|
184
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
185
|
+
(0, tslib_1.__metadata)("design:paramtypes", []),
|
186
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
187
|
+
], SchemaEditorItemObject.prototype, "toggleCollapsed", null);
|
188
|
+
return SchemaEditorItemObject;
|
189
|
+
}(Common_1.SchemaEditorItemCommon));
|
190
|
+
exports.SchemaEditorItemObject = SchemaEditorItemObject;
|
191
|
+
//# sourceMappingURL=./components/schema-editor/Object.js.map
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"file": "Object.js",
|
4
|
+
"sourceRoot": "",
|
5
|
+
"sources": [
|
6
|
+
"/src/components/schema-editor/Object.tsx"
|
7
|
+
],
|
8
|
+
"names": [],
|
9
|
+
"mappings": ";;;;AAAA,6DAA0B;AAE1B,6CAAkD;AAClD,kEAA+B;AAC/B,kCAA8B;AAC9B,sEAAmC;AACnC,mCAA6E;AAC7E,+BAAwC;AAaxC;IAA4C,uDAG3C;IAHD;QAAA,qEAsRC;QAlRC,WAAK,GAAG;YACN,OAAO,EAAE,KAAI,CAAC,cAAc,CAAC,KAAI,CAAC,KAAK,CAAC;YACxC,SAAS,EAAE,KAAK;SACjB,CAAC;;IA+QJ,CAAC;IA3QC,mDAAkB,GAAlB,UAAmB,SAAsC;QACvD,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,kBAAkB;QAClB,IACE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK;YAC/B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAC9D;YACA,IAAI,CAAC,QAAQ,CAAC;gBACZ,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;aACpC,CAAC,CAAC;SACJ;IACH,CAAC;IAED,+CAAc,GAAd,UAAe,KAAkC;;QAC/C,IAAM,OAAO,GAMR,EAAE,CAAC;QACR,IAAM,QAAQ,GA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;;;;kEAKR;IAGD;QADC,iBAAQ;;;;kEAWR;IAGD;QADC,iBAAQ;;;;0EASR;IAGD;QADC,iBAAQ;;;;iEAKR;IAmHH,6BAAC;CAAA,AAtRD,CAA4C,+BAAsB,GAsRjE;AAtRY,wDAAsB",
|
10
|
+
"sourcesContent": [
|
11
|
+
"import React from 'react';\nimport type {JSONSchema} from '../../utils/DataScope';\nimport {autobind, guid} from '../../utils/helper';\nimport Button from '../Button';\nimport {Icon} from '../icons';\nimport InputBox from '../InputBox';\nimport {SchemaEditorItemCommon, SchemaEditorItemCommonProps} from './Common';\nimport {SchemaEditorItem} from './Item';\n\nexport interface SchemaEditorItemObjectState {\n members: Array<{\n id: string;\n key: string;\n hasError?: boolean;\n required?: boolean;\n schema: JSONSchema;\n }>;\n collapsed: boolean;\n}\n\nexport class SchemaEditorItemObject extends SchemaEditorItemCommon<\n SchemaEditorItemCommonProps,\n SchemaEditorItemObjectState\n> {\n state = {\n members: this.propsToMembers(this.props),\n collapsed: false\n };\n\n lastValue: any;\n\n componentDidUpdate(prevProps: SchemaEditorItemCommonProps) {\n const props = this.props;\n\n // 外部属性变化,更新 state\n if (\n props.value !== prevProps.value &&\n JSON.stringify(props.value) !== JSON.stringify(this.lastValue)\n ) {\n this.setState({\n members: this.propsToMembers(props)\n });\n }\n }\n\n propsToMembers(props: SchemaEditorItemCommonProps) {\n const members: Array<{\n id: string;\n key: string;\n hasError?: boolean;\n required?: boolean;\n schema: JSONSchema;\n }> = [];\n const required = Array.isArray(props.value?.required)\n ? props.value!.required\n : [];\n\n if (props.value?.properties) {\n const properties = props.value.properties;\n Object.keys(properties).forEach(key => {\n const value = properties[key] as any;\n\n members.push({\n id: guid(),\n key: key || '',\n hasError: !key || members.some(i => i.key === key),\n required: !!~required.indexOf(key),\n schema: value\n });\n });\n }\n\n return members;\n }\n\n @autobind\n pipeOut() {\n const members = this.state.members;\n const {value, onChange} = this.props;\n const properties: any = {};\n const required: Array<string> = [];\n\n members\n .filter(item => !item.hasError)\n .forEach(member => {\n properties[member.key] = member.schema;\n\n if (member.required) {\n required.push(member.key);\n }\n });\n\n this.lastValue = {\n ...value,\n properties,\n required\n };\n onChange?.(this.lastValue);\n }\n\n @autobind\n handleAdd() {\n const members = this.state.members.concat();\n members.push({\n id: guid(),\n key: '',\n hasError: true,\n required: false,\n schema: {\n type: 'string'\n }\n });\n\n this.setState(\n {\n members\n },\n this.pipeOut\n );\n }\n\n @autobind\n handlePropKeyChange(index: number, key: string) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n key,\n hasError: !key || members.some((m, i) => i !== index && m.key === key)\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropTitleChange(index: number, title: string) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n schema: {\n ...members[index].schema,\n title\n }\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropRemove(index: number) {\n const members = this.state.members.concat();\n members.splice(index, 1);\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropChange(index: number, item: any) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n schema: {\n ...item\n }\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n handlePropRequiredChange(index: number, required: boolean) {\n const members = this.state.members.concat();\n members[index] = {\n ...members[index],\n required\n };\n\n this.setState({members}, this.pipeOut);\n }\n\n @autobind\n toggleCollapsed() {\n this.setState({\n collapsed: !this.state.collapsed\n });\n }\n\n rendererProps() {\n const {\n value,\n translate: __,\n classnames: cx,\n renderExtraProps,\n locale,\n classPrefix,\n disabled,\n showInfo,\n types,\n onTypeChange\n } = this.props;\n const members = this.state.members;\n\n return (\n <div\n className={cx('SchemaEditorProps', {\n 'SchemaEditorProps--depth': showInfo !== false\n })}\n >\n {members.length ? (\n members.map((member, index) => (\n <SchemaEditorItem\n key={member.id}\n types={types}\n onTypeChange={onTypeChange}\n prefix={\n <>\n <InputBox\n className={cx('SchemaEditor-key')}\n hasError={member.hasError}\n value={member.key || ''}\n onChange={this.handlePropKeyChange.bind(this, index)}\n placeholder={__('JSONSchema.key')}\n disabled={disabled || !!value?.$ref}\n />\n\n <InputBox\n className={cx('SchemaEditor-title')}\n value={member.schema.title || ''}\n onChange={this.handlePropTitleChange.bind(this, index)}\n placeholder={__('JSONSchema.title')}\n disabled={disabled || !!value?.$ref}\n />\n </>\n }\n affix={\n <Button\n className={cx('SchemaEditor-btn')}\n onClick={this.handlePropRemove.bind(this, index)}\n iconOnly\n disabled={disabled || !!value?.$ref}\n >\n <Icon icon=\"remove\" className=\"icon\" />\n </Button>\n }\n value={member.schema}\n onChange={this.handlePropChange.bind(this, index)}\n renderExtraProps={renderExtraProps}\n locale={locale}\n translate={__}\n classnames={cx}\n classPrefix={classPrefix}\n disabled={disabled || !!value?.$ref}\n required={member.required}\n onRequiredChange={this.handlePropRequiredChange.bind(this, index)}\n />\n ))\n ) : (\n <div className={cx('SchemaEditorProps-placeholder')}>\n {__('placeholder.empty')}\n </div>\n )}\n\n <Button\n level=\"link\"\n onClick={this.handleAdd}\n size=\"xs\"\n disabled={disabled || !!value?.$ref}\n >\n {__('JSONSchema.add_prop')}\n </Button>\n </div>\n );\n }\n\n render() {\n const {classnames: cx, showInfo, translate: __, disabled} = this.props;\n\n return (\n <div\n className={cx('SchemaEditorItem SchemaEditorObject', {\n 'is-collapsed': this.state.collapsed\n })}\n >\n {showInfo !== false ? (\n <>\n <a\n className={cx('SchemaEditor-caret', {\n 'is-collapsed': this.state.collapsed\n })}\n onClick={this.toggleCollapsed}\n >\n <Icon icon=\"caret\" className=\"icon\" />\n </a>\n {this.renderCommon()}\n </>\n ) : null}\n {this.state.collapsed ? null : this.rendererProps()}\n </div>\n );\n }\n}\n"
|
12
|
+
]
|
13
|
+
}
|
@@ -0,0 +1,316 @@
|
|
1
|
+
/// <reference types="hoist-non-react-statics" />
|
2
|
+
import React from 'react';
|
3
|
+
import { LocaleProps } from '../../locale';
|
4
|
+
import { ThemeProps } from '../../theme';
|
5
|
+
import { DataSchema } from '../../utils/DataSchema';
|
6
|
+
import type { JSONSchema } from '../../utils/DataScope';
|
7
|
+
import { VariableItem } from '../formula/Editor';
|
8
|
+
export interface SchemaVariableListProps extends LocaleProps, ThemeProps {
|
9
|
+
schemas?: Array<JSONSchema> | JSONSchema;
|
10
|
+
value?: string;
|
11
|
+
onSelect?: (value: string, schema: JSONSchema) => void;
|
12
|
+
}
|
13
|
+
export interface SchemaVariableListState {
|
14
|
+
variables: Array<VariableItem>;
|
15
|
+
}
|
16
|
+
export declare class SchemaVariableList extends React.Component<SchemaVariableListProps, SchemaVariableListState> {
|
17
|
+
state: {
|
18
|
+
variables: any[];
|
19
|
+
};
|
20
|
+
dataSchema?: DataSchema;
|
21
|
+
constructor(props: SchemaVariableListProps);
|
22
|
+
componentDidUpdate(prevProps: SchemaVariableListProps): void;
|
23
|
+
schemasToVaraibles(props: SchemaVariableListProps): any[];
|
24
|
+
handleSelect(item: any): void;
|
25
|
+
itemRender(option: any): JSX.Element;
|
26
|
+
render(): JSX.Element;
|
27
|
+
}
|
28
|
+
declare const _default: {
|
29
|
+
new (props: (Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
30
|
+
locale?: string | undefined;
|
31
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
32
|
+
}) | Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
33
|
+
locale?: string | undefined;
|
34
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
35
|
+
}>): {
|
36
|
+
render(): JSX.Element;
|
37
|
+
context: any;
|
38
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
39
|
+
locale?: string | undefined;
|
40
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
41
|
+
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
42
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
43
|
+
readonly props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
44
|
+
locale?: string | undefined;
|
45
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
46
|
+
}> & Readonly<{
|
47
|
+
children?: React.ReactNode;
|
48
|
+
}>;
|
49
|
+
state: Readonly<{}>;
|
50
|
+
refs: {
|
51
|
+
[key: string]: React.ReactInstance;
|
52
|
+
};
|
53
|
+
componentDidMount?(): void;
|
54
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
55
|
+
locale?: string | undefined;
|
56
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
57
|
+
}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
58
|
+
componentWillUnmount?(): void;
|
59
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
60
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
61
|
+
locale?: string | undefined;
|
62
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
63
|
+
}>, prevState: Readonly<{}>): any;
|
64
|
+
componentDidUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
65
|
+
locale?: string | undefined;
|
66
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
67
|
+
}>, prevState: Readonly<{}>, snapshot?: any): void;
|
68
|
+
componentWillMount?(): void;
|
69
|
+
UNSAFE_componentWillMount?(): void;
|
70
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
71
|
+
locale?: string | undefined;
|
72
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
73
|
+
}>, nextContext: any): void;
|
74
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
75
|
+
locale?: string | undefined;
|
76
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
77
|
+
}>, nextContext: any): void;
|
78
|
+
componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
79
|
+
locale?: string | undefined;
|
80
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
81
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
82
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
83
|
+
locale?: string | undefined;
|
84
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
85
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
86
|
+
};
|
87
|
+
new (props: Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
88
|
+
locale?: string | undefined;
|
89
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
90
|
+
}, context: any): {
|
91
|
+
render(): JSX.Element;
|
92
|
+
context: any;
|
93
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
94
|
+
locale?: string | undefined;
|
95
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
96
|
+
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
97
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
98
|
+
readonly props: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
99
|
+
locale?: string | undefined;
|
100
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
101
|
+
}> & Readonly<{
|
102
|
+
children?: React.ReactNode;
|
103
|
+
}>;
|
104
|
+
state: Readonly<{}>;
|
105
|
+
refs: {
|
106
|
+
[key: string]: React.ReactInstance;
|
107
|
+
};
|
108
|
+
componentDidMount?(): void;
|
109
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
110
|
+
locale?: string | undefined;
|
111
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
112
|
+
}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
113
|
+
componentWillUnmount?(): void;
|
114
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
115
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
116
|
+
locale?: string | undefined;
|
117
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
118
|
+
}>, prevState: Readonly<{}>): any;
|
119
|
+
componentDidUpdate?(prevProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
120
|
+
locale?: string | undefined;
|
121
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
122
|
+
}>, prevState: Readonly<{}>, snapshot?: any): void;
|
123
|
+
componentWillMount?(): void;
|
124
|
+
UNSAFE_componentWillMount?(): void;
|
125
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
126
|
+
locale?: string | undefined;
|
127
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
128
|
+
}>, nextContext: any): void;
|
129
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
130
|
+
locale?: string | undefined;
|
131
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
132
|
+
}>, nextContext: any): void;
|
133
|
+
componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
134
|
+
locale?: string | undefined;
|
135
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
136
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
137
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, keyof LocaleProps> & {
|
138
|
+
locale?: string | undefined;
|
139
|
+
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
140
|
+
}>, nextState: Readonly<{}>, nextContext: any): void;
|
141
|
+
};
|
142
|
+
displayName: string;
|
143
|
+
contextType: React.Context<string>;
|
144
|
+
ComposedComponent: React.ComponentType<{
|
145
|
+
new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
|
146
|
+
render(): JSX.Element;
|
147
|
+
context: any;
|
148
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
149
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
150
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
151
|
+
children?: React.ReactNode;
|
152
|
+
}>;
|
153
|
+
state: Readonly<{}>;
|
154
|
+
refs: {
|
155
|
+
[key: string]: React.ReactInstance;
|
156
|
+
};
|
157
|
+
componentDidMount?(): void;
|
158
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
159
|
+
componentWillUnmount?(): void;
|
160
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
161
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
162
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
163
|
+
componentWillMount?(): void;
|
164
|
+
UNSAFE_componentWillMount?(): void;
|
165
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
166
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
167
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
168
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
169
|
+
};
|
170
|
+
new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
|
171
|
+
render(): JSX.Element;
|
172
|
+
context: any;
|
173
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
174
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
175
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
176
|
+
children?: React.ReactNode;
|
177
|
+
}>;
|
178
|
+
state: Readonly<{}>;
|
179
|
+
refs: {
|
180
|
+
[key: string]: React.ReactInstance;
|
181
|
+
};
|
182
|
+
componentDidMount?(): void;
|
183
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
184
|
+
componentWillUnmount?(): void;
|
185
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
186
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
187
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
188
|
+
componentWillMount?(): void;
|
189
|
+
UNSAFE_componentWillMount?(): void;
|
190
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
191
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
192
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
193
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
194
|
+
};
|
195
|
+
displayName: string;
|
196
|
+
contextType: React.Context<string>;
|
197
|
+
ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
|
198
|
+
} & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
|
199
|
+
ComposedComponent: typeof SchemaVariableList;
|
200
|
+
}>;
|
201
|
+
} & import("hoist-non-react-statics").NonReactStatics<{
|
202
|
+
new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
|
203
|
+
render(): JSX.Element;
|
204
|
+
context: any;
|
205
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
206
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
207
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
208
|
+
children?: React.ReactNode;
|
209
|
+
}>;
|
210
|
+
state: Readonly<{}>;
|
211
|
+
refs: {
|
212
|
+
[key: string]: React.ReactInstance;
|
213
|
+
};
|
214
|
+
componentDidMount?(): void;
|
215
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
216
|
+
componentWillUnmount?(): void;
|
217
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
218
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
219
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
220
|
+
componentWillMount?(): void;
|
221
|
+
UNSAFE_componentWillMount?(): void;
|
222
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
223
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
224
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
225
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
226
|
+
};
|
227
|
+
new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
|
228
|
+
render(): JSX.Element;
|
229
|
+
context: any;
|
230
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
231
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
232
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
233
|
+
children?: React.ReactNode;
|
234
|
+
}>;
|
235
|
+
state: Readonly<{}>;
|
236
|
+
refs: {
|
237
|
+
[key: string]: React.ReactInstance;
|
238
|
+
};
|
239
|
+
componentDidMount?(): void;
|
240
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
241
|
+
componentWillUnmount?(): void;
|
242
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
243
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
244
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
245
|
+
componentWillMount?(): void;
|
246
|
+
UNSAFE_componentWillMount?(): void;
|
247
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
248
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
249
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
250
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
251
|
+
};
|
252
|
+
displayName: string;
|
253
|
+
contextType: React.Context<string>;
|
254
|
+
ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
|
255
|
+
} & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
|
256
|
+
ComposedComponent: typeof SchemaVariableList;
|
257
|
+
}, {}> & {
|
258
|
+
ComposedComponent: {
|
259
|
+
new (props: (Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps) | Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>): {
|
260
|
+
render(): JSX.Element;
|
261
|
+
context: any;
|
262
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
263
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
264
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
265
|
+
children?: React.ReactNode;
|
266
|
+
}>;
|
267
|
+
state: Readonly<{}>;
|
268
|
+
refs: {
|
269
|
+
[key: string]: React.ReactInstance;
|
270
|
+
};
|
271
|
+
componentDidMount?(): void;
|
272
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
273
|
+
componentWillUnmount?(): void;
|
274
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
275
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
276
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
277
|
+
componentWillMount?(): void;
|
278
|
+
UNSAFE_componentWillMount?(): void;
|
279
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
280
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
281
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
282
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
283
|
+
};
|
284
|
+
new (props: Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps, context: any): {
|
285
|
+
render(): JSX.Element;
|
286
|
+
context: any;
|
287
|
+
setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
|
288
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
289
|
+
readonly props: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps> & Readonly<{
|
290
|
+
children?: React.ReactNode;
|
291
|
+
}>;
|
292
|
+
state: Readonly<{}>;
|
293
|
+
refs: {
|
294
|
+
[key: string]: React.ReactInstance;
|
295
|
+
};
|
296
|
+
componentDidMount?(): void;
|
297
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
298
|
+
componentWillUnmount?(): void;
|
299
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
300
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
|
301
|
+
componentDidUpdate?(prevProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
302
|
+
componentWillMount?(): void;
|
303
|
+
UNSAFE_componentWillMount?(): void;
|
304
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
305
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextContext: any): void;
|
306
|
+
componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
307
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<SchemaVariableListProps, keyof ThemeProps> & import("../../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
308
|
+
};
|
309
|
+
displayName: string;
|
310
|
+
contextType: React.Context<string>;
|
311
|
+
ComposedComponent: React.ComponentType<typeof SchemaVariableList>;
|
312
|
+
} & import("hoist-non-react-statics").NonReactStatics<typeof SchemaVariableList, {}> & {
|
313
|
+
ComposedComponent: typeof SchemaVariableList;
|
314
|
+
};
|
315
|
+
};
|
316
|
+
export default _default;
|
@@ -0,0 +1,74 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SchemaVariableList = void 0;
|
4
|
+
var tslib_1 = require("tslib");
|
5
|
+
var react_1 = (0, tslib_1.__importDefault)(require("react"));
|
6
|
+
var locale_1 = require("../../locale");
|
7
|
+
var theme_1 = require("../../theme");
|
8
|
+
var DataSchema_1 = require("../../utils/DataSchema");
|
9
|
+
var helper_1 = require("../../utils/helper");
|
10
|
+
var VariableList_1 = (0, tslib_1.__importDefault)(require("../formula/VariableList"));
|
11
|
+
var TooltipWrapper_1 = (0, tslib_1.__importDefault)(require("../TooltipWrapper"));
|
12
|
+
var SchemaVariableList = /** @class */ (function (_super) {
|
13
|
+
(0, tslib_1.__extends)(SchemaVariableList, _super);
|
14
|
+
function SchemaVariableList(props) {
|
15
|
+
var _this = _super.call(this, props) || this;
|
16
|
+
_this.state = {
|
17
|
+
variables: _this.schemasToVaraibles(_this.props)
|
18
|
+
};
|
19
|
+
return _this;
|
20
|
+
}
|
21
|
+
SchemaVariableList.prototype.componentDidUpdate = function (prevProps) {
|
22
|
+
var props = this.props;
|
23
|
+
if (props.schemas !== prevProps.schemas) {
|
24
|
+
this.setState({
|
25
|
+
variables: this.schemasToVaraibles(props)
|
26
|
+
});
|
27
|
+
}
|
28
|
+
};
|
29
|
+
SchemaVariableList.prototype.schemasToVaraibles = function (props) {
|
30
|
+
var schemas = Array.isArray(props.schemas)
|
31
|
+
? props.schemas.concat()
|
32
|
+
: props.schemas
|
33
|
+
? [props.schemas]
|
34
|
+
: [];
|
35
|
+
if (!schemas.length) {
|
36
|
+
return [];
|
37
|
+
}
|
38
|
+
var dataSchema = new DataSchema_1.DataSchema(schemas);
|
39
|
+
this.dataSchema = dataSchema;
|
40
|
+
return dataSchema.getDataPropsAsOptions();
|
41
|
+
};
|
42
|
+
SchemaVariableList.prototype.handleSelect = function (item) {
|
43
|
+
var _a;
|
44
|
+
var onSelect = this.props.onSelect;
|
45
|
+
var schema = (_a = this.dataSchema) === null || _a === void 0 ? void 0 : _a.getSchemaByPath(item.value);
|
46
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(item.value, schema);
|
47
|
+
};
|
48
|
+
SchemaVariableList.prototype.itemRender = function (option) {
|
49
|
+
var _a = this.props, cx = _a.classnames, __ = _a.translate;
|
50
|
+
return (react_1.default.createElement("span", { className: cx("FormulaEditor-VariableList-item") },
|
51
|
+
react_1.default.createElement("label", null, option.label),
|
52
|
+
react_1.default.createElement(TooltipWrapper_1.default, { tooltip: option.description, tooltipTheme: "dark" },
|
53
|
+
react_1.default.createElement("span", { className: cx("FormulaEditor-VariableList-item-tag") }, __("SchemaType.".concat(option.type || 'any'))))));
|
54
|
+
};
|
55
|
+
SchemaVariableList.prototype.render = function () {
|
56
|
+
return (react_1.default.createElement(VariableList_1.default, { data: this.state.variables, value: this.props.value, onSelect: this.handleSelect, selectMode: "tree", itemRender: this.itemRender }));
|
57
|
+
};
|
58
|
+
(0, tslib_1.__decorate)([
|
59
|
+
helper_1.autobind,
|
60
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
61
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Object]),
|
62
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
63
|
+
], SchemaVariableList.prototype, "handleSelect", null);
|
64
|
+
(0, tslib_1.__decorate)([
|
65
|
+
helper_1.autobind,
|
66
|
+
(0, tslib_1.__metadata)("design:type", Function),
|
67
|
+
(0, tslib_1.__metadata)("design:paramtypes", [Object]),
|
68
|
+
(0, tslib_1.__metadata)("design:returntype", void 0)
|
69
|
+
], SchemaVariableList.prototype, "itemRender", null);
|
70
|
+
return SchemaVariableList;
|
71
|
+
}(react_1.default.Component));
|
72
|
+
exports.SchemaVariableList = SchemaVariableList;
|
73
|
+
exports.default = (0, locale_1.localeable)((0, theme_1.themeable)(SchemaVariableList));
|
74
|
+
//# sourceMappingURL=./components/schema-editor/SchemaVariableList.js.map
|