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
package/src/Schema.ts
CHANGED
@@ -117,6 +117,8 @@ import {UUIDControlSchema} from './renderers/Form/UUID';
|
|
117
117
|
import {FormControlSchema} from './renderers/Form/Control';
|
118
118
|
import {TransferPickerControlSchema} from './renderers/Form/TransferPicker';
|
119
119
|
import {TabsTransferPickerControlSchema} from './renderers/Form/TabsTransferPicker';
|
120
|
+
import {JSONSchemaEditorControlSchema} from './renderers/Form/JSONSchemaEditor';
|
121
|
+
import {TableSchemaV2} from './renderers/Table-v2';
|
120
122
|
|
121
123
|
// 每加个类型,这补充一下。
|
122
124
|
export type SchemaType =
|
@@ -168,6 +170,7 @@ export type SchemaType =
|
|
168
170
|
| 'static-image' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
|
169
171
|
| 'images'
|
170
172
|
| 'static-images' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
|
173
|
+
| 'json-schema-editor'
|
171
174
|
| 'json'
|
172
175
|
| 'static-json' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
|
173
176
|
| 'link'
|
@@ -198,6 +201,7 @@ export type SchemaType =
|
|
198
201
|
| 'switch'
|
199
202
|
| 'table'
|
200
203
|
| 'static-table' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
|
204
|
+
| 'table-v2'
|
201
205
|
| 'tabs'
|
202
206
|
| 'html'
|
203
207
|
| 'tpl'
|
@@ -330,6 +334,7 @@ export type SchemaType =
|
|
330
334
|
| 'table-view'
|
331
335
|
| 'portlet'
|
332
336
|
| 'grid-nav'
|
337
|
+
| 'tag'
|
333
338
|
|
334
339
|
// 原生 input 类型
|
335
340
|
| 'native-date'
|
@@ -389,6 +394,7 @@ export type SchemaObject =
|
|
389
394
|
| StatusSchema
|
390
395
|
| SpinnerSchema
|
391
396
|
| TableSchema
|
397
|
+
| TableSchemaV2
|
392
398
|
| TabsSchema
|
393
399
|
| TasksSchema
|
394
400
|
| VBoxSchema
|
@@ -432,6 +438,7 @@ export type SchemaObject =
|
|
432
438
|
| ImageControlSchema
|
433
439
|
| InputGroupControlSchema
|
434
440
|
| ListControlSchema
|
441
|
+
| JSONSchemaEditorControlSchema
|
435
442
|
| LocationControlSchema
|
436
443
|
| UUIDControlSchema
|
437
444
|
| MatrixControlSchema
|
package/src/SchemaRenderer.tsx
CHANGED
@@ -20,7 +20,7 @@ import getExprProperties from './utils/filter-schema';
|
|
20
20
|
import {anyChanged, chainEvents, autobind} from './utils/helper';
|
21
21
|
import {SimpleMap} from './utils/SimpleMap';
|
22
22
|
|
23
|
-
import
|
23
|
+
import {bindEvent, dispatchEvent, RendererEvent} from './utils/renderer-event';
|
24
24
|
import {isAlive} from 'mobx-state-tree';
|
25
25
|
import {reaction} from 'mobx';
|
26
26
|
import {resolveVariableAndFilter} from './utils/tpl-builtin';
|
@@ -93,9 +93,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
componentDidMount() {
|
96
|
-
const {env} = this.props;
|
97
96
|
// 这里无法区分监听的是不是广播,所以又bind一下,主要是为了绑广播
|
98
|
-
this.unbindEvent =
|
97
|
+
this.unbindEvent = bindEvent(this.cRef);
|
99
98
|
}
|
100
99
|
|
101
100
|
componentWillUnmount() {
|
@@ -206,8 +205,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
206
205
|
async dispatchEvent(
|
207
206
|
e: React.MouseEvent<any>,
|
208
207
|
data: any
|
209
|
-
): Promise<RendererEvent<any> |
|
210
|
-
return await
|
208
|
+
): Promise<RendererEvent<any> | void> {
|
209
|
+
return await dispatchEvent(e, this.cRef, this.context, data);
|
211
210
|
}
|
212
211
|
|
213
212
|
renderChild(
|
package/src/actions/Action.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import {RendererProps} from '../factory';
|
1
2
|
import {extendObject} from '../utils/helper';
|
2
3
|
import {RendererEvent} from '../utils/renderer-event';
|
3
4
|
import {evalExpression} from '../utils/tpl';
|
@@ -29,26 +30,26 @@ export interface LogicAction extends ListenerAction {
|
|
29
30
|
children?: ListenerAction[]; // 子动作
|
30
31
|
}
|
31
32
|
|
32
|
-
export interface ListenerContext {
|
33
|
+
export interface ListenerContext extends React.Component<RendererProps> {
|
33
34
|
[propName: string]: any;
|
34
35
|
}
|
35
36
|
|
36
37
|
// Action 基础接口
|
37
|
-
export interface
|
38
|
+
export interface RendererAction {
|
38
39
|
// 运行这个 Action,每个类型的 Action 都只有一个实例,run 函数是个可重入的函数
|
39
40
|
run: (
|
40
41
|
action: ListenerAction,
|
41
42
|
renderer: ListenerContext,
|
42
43
|
event: RendererEvent<any>,
|
43
44
|
mergeData?: any // 有些Action内部需要通过上下文数据处理专有逻辑,这里的数据是事件数据+渲染器数据
|
44
|
-
) => Promise<void>;
|
45
|
+
) => Promise<RendererEvent<any> | void>;
|
45
46
|
}
|
46
47
|
|
47
48
|
// 存储 Action 和类型的映射关系,用于后续查找
|
48
|
-
const ActionTypeMap: {[key: string]:
|
49
|
+
const ActionTypeMap: {[key: string]: RendererAction} = {};
|
49
50
|
|
50
51
|
// 注册 Action
|
51
|
-
export const registerAction = (type: string, action:
|
52
|
+
export const registerAction = (type: string, action: RendererAction) => {
|
52
53
|
ActionTypeMap[type] = action;
|
53
54
|
};
|
54
55
|
|
@@ -97,7 +98,7 @@ export const runActions = async (
|
|
97
98
|
|
98
99
|
// 执行动作,与原有动作处理打通
|
99
100
|
export const runAction = async (
|
100
|
-
actionInstrance:
|
101
|
+
actionInstrance: RendererAction,
|
101
102
|
actionConfig: ListenerAction,
|
102
103
|
renderer: ListenerContext,
|
103
104
|
event: any
|
@@ -1,23 +1,26 @@
|
|
1
|
+
import omit from 'lodash/omit';
|
1
2
|
import {Api} from '../types';
|
2
3
|
import {normalizeApiResponseData} from '../utils/api';
|
3
4
|
import {ServerError} from '../utils/errors';
|
4
|
-
import {createObject, isEmpty
|
5
|
+
import {createObject, isEmpty} from '../utils/helper';
|
5
6
|
import {RendererEvent} from '../utils/renderer-event';
|
6
|
-
import {filter} from '../utils/tpl';
|
7
7
|
import {
|
8
|
-
|
8
|
+
RendererAction,
|
9
9
|
ListenerAction,
|
10
10
|
ListenerContext,
|
11
11
|
registerAction
|
12
12
|
} from './Action';
|
13
13
|
|
14
14
|
export interface IAjaxAction extends ListenerAction {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
args: {
|
16
|
+
api: Api;
|
17
|
+
messages: {
|
18
|
+
success: string;
|
19
|
+
failed: string;
|
20
|
+
};
|
21
|
+
options: object;
|
22
|
+
[propName: string]: any;
|
19
23
|
};
|
20
|
-
options: object;
|
21
24
|
}
|
22
25
|
|
23
26
|
/**
|
@@ -27,23 +30,27 @@ export interface IAjaxAction extends ListenerAction {
|
|
27
30
|
* @class AjaxAction
|
28
31
|
* @implements {Action}
|
29
32
|
*/
|
30
|
-
export class AjaxAction implements
|
33
|
+
export class AjaxAction implements RendererAction {
|
31
34
|
async run(
|
32
35
|
action: IAjaxAction,
|
33
36
|
renderer: ListenerContext,
|
34
37
|
event: RendererEvent<any>
|
35
38
|
) {
|
39
|
+
if (!renderer.props.env?.fetcher) {
|
40
|
+
throw new Error('env.fetcher is required!');
|
41
|
+
}
|
42
|
+
|
36
43
|
const env = event.context.env;
|
37
44
|
try {
|
38
45
|
const result = await env.fetcher(
|
39
|
-
action.api as string,
|
40
|
-
action.args,
|
41
|
-
action.options ?? {}
|
46
|
+
action.args?.api as string,
|
47
|
+
omit(action.args ?? {}, ['api', 'options', 'messages']),
|
48
|
+
action.args?.options ?? {}
|
42
49
|
);
|
43
50
|
|
44
51
|
if (!isEmpty(result.data) || result.ok) {
|
45
52
|
const responseData = normalizeApiResponseData(result.data);
|
46
|
-
//
|
53
|
+
// 记录请求返回的数据
|
47
54
|
event.setData(
|
48
55
|
createObject(
|
49
56
|
event.data,
|
@@ -58,20 +65,22 @@ export class AjaxAction implements Action {
|
|
58
65
|
|
59
66
|
if (!result.ok) {
|
60
67
|
throw new ServerError(
|
61
|
-
|
68
|
+
action.args?.messages?.failed ?? result.msg,
|
62
69
|
result
|
63
70
|
);
|
64
71
|
} else {
|
65
|
-
|
66
|
-
|
67
|
-
(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
const msg = action.args?.messages?.success ?? result.msg;
|
73
|
+
msg &&
|
74
|
+
env.notify(
|
75
|
+
'success',
|
76
|
+
msg,
|
77
|
+
result.msgTimeout !== undefined
|
78
|
+
? {
|
79
|
+
closeButton: true,
|
80
|
+
timeout: result.msgTimeout
|
81
|
+
}
|
82
|
+
: undefined
|
83
|
+
);
|
75
84
|
}
|
76
85
|
|
77
86
|
return result.data;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {RendererEvent} from '../utils/renderer-event';
|
2
2
|
import {
|
3
|
-
|
3
|
+
RendererAction,
|
4
4
|
ListenerAction,
|
5
5
|
ListenerContext,
|
6
6
|
LoopStatus,
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
* @class BreakAction
|
15
15
|
* @implements {Action}
|
16
16
|
*/
|
17
|
-
export class BreakAction implements
|
17
|
+
export class BreakAction implements RendererAction {
|
18
18
|
async run(
|
19
19
|
action: ListenerAction,
|
20
20
|
renderer: ListenerContext,
|
@@ -1,7 +1,8 @@
|
|
1
|
+
import {RendererProps} from '../factory';
|
1
2
|
import {createObject} from '../utils/helper';
|
2
|
-
import {RendererEvent} from '../utils/renderer-event';
|
3
|
+
import {RendererEvent, dispatchEvent} from '../utils/renderer-event';
|
3
4
|
import {
|
4
|
-
|
5
|
+
RendererAction,
|
5
6
|
ListenerAction,
|
6
7
|
ListenerContext,
|
7
8
|
registerAction
|
@@ -18,14 +19,14 @@ export interface IBroadcastAction extends ListenerAction {
|
|
18
19
|
* @class BroadcastAction
|
19
20
|
* @implements {Action}
|
20
21
|
*/
|
21
|
-
export class BroadcastAction implements
|
22
|
+
export class BroadcastAction implements RendererAction {
|
22
23
|
async run(
|
23
24
|
action: IBroadcastAction,
|
24
25
|
renderer: ListenerContext,
|
25
26
|
event: RendererEvent<any>
|
26
27
|
) {
|
27
28
|
if (!action.eventName) {
|
28
|
-
console.
|
29
|
+
console.error('eventName 未定义,请定义事件名称');
|
29
30
|
return;
|
30
31
|
}
|
31
32
|
|
@@ -33,7 +34,7 @@ export class BroadcastAction implements Action {
|
|
33
34
|
event.setData(createObject(event.data, action.args));
|
34
35
|
|
35
36
|
// 直接触发对应的动作
|
36
|
-
return await
|
37
|
+
return await dispatchEvent(
|
37
38
|
action.eventName,
|
38
39
|
renderer,
|
39
40
|
event.context.scoped,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {RendererEvent} from '../utils/renderer-event';
|
2
2
|
import {dataMapping} from '../utils/tpl-builtin';
|
3
3
|
import {
|
4
|
-
|
4
|
+
RendererAction,
|
5
5
|
ListenerAction,
|
6
6
|
ListenerContext,
|
7
7
|
LoopStatus,
|
@@ -19,7 +19,7 @@ export interface ICmptAction extends ListenerAction {
|
|
19
19
|
* @class CmptAction
|
20
20
|
* @implements {Action}
|
21
21
|
*/
|
22
|
-
export class CmptAction implements
|
22
|
+
export class CmptAction implements RendererAction {
|
23
23
|
async run(
|
24
24
|
action: ICmptAction,
|
25
25
|
renderer: ListenerContext,
|
@@ -49,11 +49,10 @@ export class CmptAction implements Action {
|
|
49
49
|
|
50
50
|
// 数据更新
|
51
51
|
if (action.actionType === 'setValue') {
|
52
|
-
const value = dataMapping(action.value, event.data);
|
53
52
|
if (component.setData) {
|
54
|
-
return component.setData(value);
|
53
|
+
return component.setData(action.args?.value);
|
55
54
|
} else {
|
56
|
-
return component.props.onChange?.(value);
|
55
|
+
return component.props.onChange?.(action.args?.value);
|
57
56
|
}
|
58
57
|
}
|
59
58
|
|
@@ -63,7 +62,7 @@ export class CmptAction implements Action {
|
|
63
62
|
}
|
64
63
|
|
65
64
|
// 执行组件动作
|
66
|
-
return component
|
65
|
+
return component?.doAction?.(action, action.args);
|
67
66
|
}
|
68
67
|
}
|
69
68
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {RendererEvent} from '../utils/renderer-event';
|
2
2
|
import {
|
3
|
-
|
3
|
+
RendererAction,
|
4
4
|
ListenerAction,
|
5
5
|
ListenerContext,
|
6
6
|
LoopStatus,
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
* @class ContinueAction
|
15
15
|
* @implements {Action}
|
16
16
|
*/
|
17
|
-
export class ContinueAction implements
|
17
|
+
export class ContinueAction implements RendererAction {
|
18
18
|
async run(
|
19
19
|
action: ListenerAction,
|
20
20
|
renderer: ListenerContext,
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import {RendererEvent} from '../utils/renderer-event';
|
2
2
|
import {filter} from '../utils/tpl';
|
3
3
|
import {
|
4
|
-
|
4
|
+
RendererAction,
|
5
5
|
ListenerAction,
|
6
6
|
ListenerContext,
|
7
|
-
LoopStatus,
|
8
7
|
registerAction
|
9
8
|
} from './Action';
|
10
9
|
|
11
10
|
export interface ICopyAction extends ListenerAction {
|
12
|
-
|
13
|
-
|
11
|
+
args: {
|
12
|
+
content: string;
|
13
|
+
copyFormat?: string;
|
14
|
+
[propName: string]: any;
|
15
|
+
};
|
14
16
|
}
|
15
17
|
|
16
18
|
/**
|
@@ -20,15 +22,19 @@ export interface ICopyAction extends ListenerAction {
|
|
20
22
|
* @class CopyAction
|
21
23
|
* @implements {Action}
|
22
24
|
*/
|
23
|
-
export class CopyAction implements
|
25
|
+
export class CopyAction implements RendererAction {
|
24
26
|
async run(
|
25
27
|
action: ICopyAction,
|
26
28
|
renderer: ListenerContext,
|
27
29
|
event: RendererEvent<any>
|
28
30
|
) {
|
29
|
-
if (
|
30
|
-
|
31
|
-
|
31
|
+
if (!renderer.props.env?.copy) {
|
32
|
+
throw new Error('env.copy is required!');
|
33
|
+
}
|
34
|
+
|
35
|
+
if (action.args?.content) {
|
36
|
+
renderer.props.env.copy?.(action.args.content, {
|
37
|
+
format: action.args?.copyFormat ?? 'text/html'
|
32
38
|
});
|
33
39
|
}
|
34
40
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {RendererEvent} from '../utils/renderer-event';
|
2
2
|
import {
|
3
|
-
|
3
|
+
RendererAction,
|
4
4
|
ListenerAction,
|
5
5
|
ListenerContext,
|
6
6
|
LoopStatus,
|
@@ -18,7 +18,7 @@ export interface ICustomAction extends ListenerAction {
|
|
18
18
|
* @class CustomAction
|
19
19
|
* @implements {Action}
|
20
20
|
*/
|
21
|
-
export class CustomAction implements
|
21
|
+
export class CustomAction implements RendererAction {
|
22
22
|
async run(
|
23
23
|
action: ICustomAction,
|
24
24
|
renderer: ListenerContext,
|
@@ -1,19 +1,25 @@
|
|
1
1
|
import {SchemaNode} from '../types';
|
2
2
|
import {RendererEvent} from '../utils/renderer-event';
|
3
3
|
import {
|
4
|
-
|
4
|
+
RendererAction,
|
5
5
|
ListenerAction,
|
6
6
|
ListenerContext,
|
7
7
|
registerAction
|
8
8
|
} from './Action';
|
9
9
|
|
10
10
|
export interface IAlertAction extends ListenerAction {
|
11
|
-
|
11
|
+
args: {
|
12
|
+
msg: string;
|
13
|
+
[propName: string]: any;
|
14
|
+
};
|
12
15
|
}
|
13
16
|
|
14
17
|
export interface IConfirmAction extends ListenerAction {
|
15
|
-
|
16
|
-
|
18
|
+
args: {
|
19
|
+
title: string;
|
20
|
+
msg: string;
|
21
|
+
[propName: string]: any;
|
22
|
+
};
|
17
23
|
}
|
18
24
|
|
19
25
|
export interface IDialogAction extends ListenerAction {
|
@@ -27,7 +33,7 @@ export interface IDialogAction extends ListenerAction {
|
|
27
33
|
* @class DialogAction
|
28
34
|
* @implements {Action}
|
29
35
|
*/
|
30
|
-
export class DialogAction implements
|
36
|
+
export class DialogAction implements RendererAction {
|
31
37
|
async run(
|
32
38
|
action: IDialogAction,
|
33
39
|
renderer: ListenerContext,
|
@@ -44,7 +50,7 @@ export class DialogAction implements Action {
|
|
44
50
|
* @class CloseDialogAction
|
45
51
|
* @implements {Action}
|
46
52
|
*/
|
47
|
-
export class CloseDialogAction implements
|
53
|
+
export class CloseDialogAction implements RendererAction {
|
48
54
|
async run(
|
49
55
|
action: ListenerAction,
|
50
56
|
renderer: ListenerContext,
|
@@ -70,26 +76,26 @@ export class CloseDialogAction implements Action {
|
|
70
76
|
/**
|
71
77
|
* alert提示动作
|
72
78
|
*/
|
73
|
-
export class AlertAction implements
|
79
|
+
export class AlertAction implements RendererAction {
|
74
80
|
async run(
|
75
81
|
action: IAlertAction,
|
76
82
|
renderer: ListenerContext,
|
77
83
|
event: RendererEvent<any>
|
78
84
|
) {
|
79
|
-
event.context.env.alert?.(action.msg);
|
85
|
+
event.context.env.alert?.(action.args?.msg);
|
80
86
|
}
|
81
87
|
}
|
82
88
|
|
83
89
|
/**
|
84
90
|
* confirm确认提示动作
|
85
91
|
*/
|
86
|
-
export class ConfirmAction implements
|
92
|
+
export class ConfirmAction implements RendererAction {
|
87
93
|
async run(
|
88
94
|
action: IConfirmAction,
|
89
95
|
renderer: ListenerContext,
|
90
96
|
event: RendererEvent<any>
|
91
97
|
) {
|
92
|
-
event.context.env.confirm?.(action.msg, action.title);
|
98
|
+
event.context.env.confirm?.(action.args?.msg, action.args?.title);
|
93
99
|
}
|
94
100
|
}
|
95
101
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {SchemaNode} from '../types';
|
2
2
|
import {RendererEvent} from '../utils/renderer-event';
|
3
3
|
import {
|
4
|
-
|
4
|
+
RendererAction,
|
5
5
|
ListenerAction,
|
6
6
|
ListenerContext,
|
7
7
|
registerAction
|
@@ -18,7 +18,7 @@ export interface IDrawerAction extends ListenerAction {
|
|
18
18
|
* @class DrawerAction
|
19
19
|
* @implements {Action}
|
20
20
|
*/
|
21
|
-
export class DrawerAction implements
|
21
|
+
export class DrawerAction implements RendererAction {
|
22
22
|
async run(
|
23
23
|
action: IDrawerAction,
|
24
24
|
renderer: ListenerContext,
|
@@ -35,7 +35,7 @@ export class DrawerAction implements Action {
|
|
35
35
|
* @class CloseDrawerAction
|
36
36
|
* @implements {Action}
|
37
37
|
*/
|
38
|
-
export class CloseDrawerAction implements
|
38
|
+
export class CloseDrawerAction implements RendererAction {
|
39
39
|
async run(
|
40
40
|
action: ListenerAction,
|
41
41
|
renderer: ListenerContext,
|
@@ -4,18 +4,21 @@ import pick from 'lodash/pick';
|
|
4
4
|
import mapValues from 'lodash/mapValues';
|
5
5
|
import qs from 'qs';
|
6
6
|
import {
|
7
|
-
|
7
|
+
RendererAction,
|
8
8
|
ListenerAction,
|
9
9
|
ListenerContext,
|
10
10
|
registerAction
|
11
11
|
} from './Action';
|
12
12
|
|
13
13
|
export interface IEmailAction extends ListenerAction {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
args: {
|
15
|
+
to: string;
|
16
|
+
cc: string;
|
17
|
+
bcc: string;
|
18
|
+
subject: string;
|
19
|
+
body: string;
|
20
|
+
[propName: string]: any;
|
21
|
+
};
|
19
22
|
}
|
20
23
|
|
21
24
|
/**
|
@@ -25,17 +28,14 @@ export interface IEmailAction extends ListenerAction {
|
|
25
28
|
* @class EmailAction
|
26
29
|
* @implements {Action}
|
27
30
|
*/
|
28
|
-
export class EmailAction implements
|
31
|
+
export class EmailAction implements RendererAction {
|
29
32
|
async run(
|
30
33
|
action: IEmailAction,
|
31
34
|
renderer: ListenerContext,
|
32
35
|
event: RendererEvent<any>
|
33
36
|
) {
|
34
|
-
const mailTo =
|
35
|
-
const mailInfo =
|
36
|
-
pick(action, 'cc', 'bcc', 'subject', 'body'),
|
37
|
-
val => filter(val, action.args)
|
38
|
-
);
|
37
|
+
const mailTo = action.args?.to;
|
38
|
+
const mailInfo = pick(action.args ?? {}, 'cc', 'bcc', 'subject', 'body');
|
39
39
|
const mailStr = qs.stringify(mailInfo);
|
40
40
|
const mailto = `mailto:${mailTo}?${mailStr}`;
|
41
41
|
|
@@ -1,27 +1,37 @@
|
|
1
|
+
import {Action} from '../types';
|
1
2
|
import {buildApi} from '../utils/api';
|
2
3
|
import {isEmpty, isObject, qsstringify} from '../utils/helper';
|
3
4
|
import {RendererEvent} from '../utils/renderer-event';
|
4
5
|
import {filter} from '../utils/tpl';
|
6
|
+
import omit from 'lodash/omit';
|
5
7
|
import {
|
6
|
-
|
8
|
+
RendererAction,
|
7
9
|
ListenerAction,
|
8
10
|
ListenerContext,
|
9
11
|
registerAction
|
10
12
|
} from './Action';
|
11
13
|
|
12
14
|
export interface ILinkAction extends ListenerAction {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
args: {
|
16
|
+
link: string;
|
17
|
+
url?: never;
|
18
|
+
blank?: boolean;
|
19
|
+
params?: {
|
20
|
+
[key: string]: string;
|
21
|
+
};
|
22
|
+
[propName: string]: any;
|
17
23
|
};
|
18
24
|
}
|
19
25
|
|
20
26
|
export interface IUrlAction extends ListenerAction {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
args: {
|
28
|
+
url: string;
|
29
|
+
link?: never;
|
30
|
+
blank?: boolean;
|
31
|
+
params?: {
|
32
|
+
[key: string]: string;
|
33
|
+
};
|
34
|
+
[propName: string]: any;
|
25
35
|
};
|
26
36
|
}
|
27
37
|
|
@@ -32,9 +42,9 @@ export interface IUrlAction extends ListenerAction {
|
|
32
42
|
* @class LinkAction
|
33
43
|
* @implements {Action}
|
34
44
|
*/
|
35
|
-
export class LinkAction implements
|
45
|
+
export class LinkAction implements RendererAction {
|
36
46
|
async run(
|
37
|
-
action:
|
47
|
+
action: ListenerAction,
|
38
48
|
renderer: ListenerContext,
|
39
49
|
event: RendererEvent<any>
|
40
50
|
) {
|
@@ -45,16 +55,26 @@ export class LinkAction implements Action {
|
|
45
55
|
// 通过buildApi兼容较复杂的url情况
|
46
56
|
let urlObj = buildApi(
|
47
57
|
{
|
48
|
-
url: (action.url || action.link) as string,
|
58
|
+
url: (action.args?.url || action.args?.link) as string,
|
49
59
|
method: 'get'
|
50
60
|
},
|
51
|
-
{
|
61
|
+
{
|
62
|
+
...(action.args?.params ?? {}),
|
63
|
+
...omit(action.args ?? {}, ['params', 'blank', 'url', 'link'])
|
64
|
+
},
|
52
65
|
{
|
53
66
|
autoAppend: true
|
54
67
|
}
|
55
68
|
);
|
56
69
|
|
57
|
-
renderer.props.env.jumpTo(
|
70
|
+
renderer.props.env.jumpTo(
|
71
|
+
urlObj.url,
|
72
|
+
{
|
73
|
+
actionType: action.actionType,
|
74
|
+
...action.args
|
75
|
+
},
|
76
|
+
action.args
|
77
|
+
);
|
58
78
|
}
|
59
79
|
}
|
60
80
|
|