amis 1.4.0 → 1.4.2-beta.12
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/README.md +1 -1
- package/lib/Schema.d.ts +26 -2
- package/lib/Schema.js.map +1 -1
- package/lib/components/Alert.js +3 -1
- package/lib/components/Alert.js.map +2 -2
- package/lib/components/AnchorNav.d.ts +22 -21
- package/lib/components/AnchorNav.js +7 -3
- package/lib/components/AnchorNav.js.map +2 -2
- package/lib/components/ArrayInput.d.ts +84 -84
- package/lib/components/AssociatedSelection.d.ts +930 -0
- package/lib/components/AssociatedSelection.js +89 -0
- package/lib/components/AssociatedSelection.js.map +13 -0
- package/lib/components/Badge.d.ts +4 -3
- package/lib/components/Badge.js +42 -7
- package/lib/components/Badge.js.map +2 -2
- package/lib/components/Button.d.ts +24 -22
- package/lib/components/Button.js +13 -7
- package/lib/components/Button.js.map +2 -2
- package/lib/components/{ChainedCheckboxes.d.ts → ChainedSelection.d.ts} +267 -98
- package/lib/components/{ChainedCheckboxes.js → ChainedSelection.js} +30 -24
- package/lib/components/ChainedSelection.js.map +13 -0
- package/lib/components/Collapse.js +1 -1
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/ColorPicker.d.ts +84 -84
- package/lib/components/DatePicker.d.ts +84 -84
- package/lib/components/DatePicker.js +1 -1
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +84 -84
- package/lib/components/DateRangePicker.js +1 -1
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Editor.d.ts +84 -84
- package/lib/components/GroupedSelection.d.ts +907 -0
- package/lib/components/GroupedSelection.js +48 -0
- package/lib/components/GroupedSelection.js.map +13 -0
- package/lib/components/InputBox.js +1 -1
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/Link.d.ts +84 -0
- package/lib/components/Link.js +43 -0
- package/lib/components/Link.js.map +13 -0
- package/lib/components/ListGroup.d.ts +21 -21
- package/lib/components/ModalManager.js +1 -1
- package/lib/components/ModalManager.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/MonthRangePicker.js +1 -1
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/NumberInput.d.ts +20 -20
- package/lib/components/PickerColumn.d.ts +514 -0
- package/lib/components/PickerColumn.js +279 -0
- package/lib/components/PickerColumn.js.map +13 -0
- package/lib/components/PickerContainer.d.ts +513 -0
- package/lib/components/PickerContainer.js +96 -0
- package/lib/components/PickerContainer.js.map +13 -0
- package/lib/components/Radios.d.ts +22 -21
- package/lib/components/Radios.js +1 -0
- package/lib/components/Radios.js.map +2 -2
- package/lib/components/Rating.d.ts +21 -21
- package/lib/components/ResultBox.d.ts +84 -84
- package/lib/components/RichText.d.ts +6 -1
- package/lib/components/RichText.js +207 -8
- package/lib/components/RichText.js.map +2 -2
- package/lib/components/SearchBox.d.ts +84 -84
- package/lib/components/SearchBox.js +4 -4
- package/lib/components/SearchBox.js.map +2 -2
- package/lib/components/Select.d.ts +245 -237
- package/lib/components/Select.js +28 -4
- package/lib/components/Select.js.map +2 -2
- package/lib/components/{Checkboxes.d.ts → Selection.d.ts} +273 -98
- package/lib/components/Selection.js +134 -0
- package/lib/components/Selection.js.map +13 -0
- package/lib/components/SparkLine.d.ts +85 -84
- package/lib/components/SparkLine.js +2 -2
- package/lib/components/SparkLine.js.map +2 -2
- package/lib/components/{TableCheckboxes.d.ts → TableSelection.d.ts} +266 -96
- package/lib/components/{TableCheckboxes.js → TableSelection.js} +30 -30
- package/lib/components/TableSelection.js.map +13 -0
- package/lib/components/Tabs.d.ts +20 -20
- package/lib/components/TabsTransfer.d.ts +84 -84
- package/lib/components/TabsTransfer.js +9 -9
- package/lib/components/TabsTransfer.js.map +2 -2
- package/lib/components/TabsTransferPicker.d.ts +489 -0
- package/lib/components/TabsTransferPicker.js +60 -0
- package/lib/components/TabsTransferPicker.js.map +13 -0
- package/lib/components/Toast.js +2 -2
- package/lib/components/Toast.js.map +2 -2
- package/lib/components/Transfer.d.ts +908 -274
- package/lib/components/Transfer.js +31 -24
- package/lib/components/Transfer.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +487 -0
- package/lib/components/TransferDropDown.js +59 -0
- package/lib/components/TransferDropDown.js.map +13 -0
- package/lib/components/TransferPicker.d.ts +489 -0
- package/lib/components/TransferPicker.js +60 -0
- package/lib/components/TransferPicker.js.map +13 -0
- package/lib/components/Tree.d.ts +84 -84
- package/lib/components/Tree.js +5 -3
- package/lib/components/Tree.js.map +2 -2
- package/lib/components/{TreeCheckboxes.d.ts → TreeSelection.d.ts} +269 -99
- package/lib/components/{TreeCheckboxes.js → TreeSelection.js} +36 -32
- package/lib/components/TreeSelection.js.map +13 -0
- package/lib/components/WithRemoteConfig.js +1 -1
- package/lib/components/WithRemoteConfig.js.map +2 -2
- package/lib/components/calendar/DaysView.js +2 -2
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/condition-builder/Field.js +5 -2
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Func.js +2 -2
- package/lib/components/condition-builder/Func.js.map +2 -2
- package/lib/components/condition-builder/InputSwitch.js +2 -2
- package/lib/components/condition-builder/InputSwitch.js.map +2 -2
- package/lib/components/condition-builder/Item.js +3 -3
- package/lib/components/condition-builder/Item.js.map +2 -2
- package/lib/components/icons.js +14 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/components/index.d.ts +8 -8
- package/lib/components/index.js +16 -16
- package/lib/components/index.js.map +2 -2
- package/lib/envOverwrite.js.map +2 -2
- package/lib/factory.d.ts +4 -0
- package/lib/factory.js +4 -2
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.js +14 -0
- package/lib/hooks/index.js.map +13 -0
- package/lib/hooks/use-set-state.d.ts +2 -0
- package/lib/hooks/use-set-state.js +15 -0
- package/lib/hooks/use-set-state.js.map +13 -0
- package/lib/hooks/use-touch.d.ts +16 -0
- package/lib/hooks/use-touch.js +73 -0
- package/lib/hooks/use-touch.js.map +13 -0
- package/lib/hooks/use-update-effect.d.ts +3 -0
- package/lib/hooks/use-update-effect.js +17 -0
- package/lib/hooks/use-update-effect.js.map +13 -0
- package/lib/icons/clock.js +10 -0
- package/lib/icons/loading-outline.js +7 -0
- package/lib/icons/status-close.js +11 -0
- package/lib/icons/status-fail.js +11 -0
- package/lib/icons/status-info.js +10 -0
- package/lib/icons/status-success.js +11 -0
- package/lib/icons/status-warning.js +10 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +4 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +4 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +7 -3
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +17 -1
- package/lib/renderers/Action.js +21 -8
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/AnchorNav.d.ts +1 -0
- package/lib/renderers/AnchorNav.js +2 -2
- package/lib/renderers/AnchorNav.js.map +2 -2
- package/lib/renderers/Avatar.js +3 -3
- package/lib/renderers/Avatar.js.map +2 -2
- package/lib/renderers/Breadcrumb.js +1 -1
- package/lib/renderers/Breadcrumb.js.map +2 -2
- package/lib/renderers/CRUD.d.ts +9 -0
- package/lib/renderers/CRUD.js +43 -8
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Card.d.ts +4 -0
- package/lib/renderers/Card.js +29 -23
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Chart.js +1 -1
- package/lib/renderers/Chart.js.map +2 -2
- package/lib/renderers/Collapse.js +3 -2
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/Dialog.js +0 -3
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/Drawer.js +0 -3
- package/lib/renderers/Drawer.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +9 -1
- package/lib/renderers/DropDownButton.js +8 -4
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/Checkbox.d.ts +5 -0
- package/lib/renderers/Form/Checkbox.js +4 -0
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Combo.js +2 -2
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +4 -3
- package/lib/renderers/Form/Editor.d.ts +3 -2
- package/lib/renderers/Form/InputCity.d.ts +84 -84
- package/lib/renderers/Form/InputCity.js +7 -6
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputColor.d.ts +84 -84
- package/lib/renderers/Form/InputFile.js +12 -6
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputImage.js +16 -7
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +1 -1
- package/lib/renderers/Form/Item.js.map +1 -1
- package/lib/renderers/Form/Options.js +19 -6
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Picker.js +2 -2
- package/lib/renderers/Form/Picker.js.map +2 -2
- package/lib/renderers/Form/Select.d.ts +41 -4
- package/lib/renderers/Form/Select.js +37 -3
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TabsTransferPicker.d.ts +48 -0
- package/lib/renderers/Form/TabsTransferPicker.js +29 -0
- package/lib/renderers/Form/TabsTransferPicker.js.map +13 -0
- package/lib/renderers/Form/Transfer.js +18 -3
- package/lib/renderers/Form/Transfer.js.map +2 -2
- package/lib/renderers/Form/TransferPicker.d.ts +48 -0
- package/lib/renderers/Form/TransferPicker.js +43 -0
- package/lib/renderers/Form/TransferPicker.js.map +13 -0
- package/lib/renderers/Form/TreeSelect.js +2 -2
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.d.ts +5 -0
- package/lib/renderers/Form/index.js +5 -3
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +15 -3
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/IFrame.js +3 -5
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Image.d.ts +1 -0
- package/lib/renderers/Image.js +15 -1
- package/lib/renderers/Image.js.map +2 -2
- package/lib/renderers/Json.d.ts +4 -0
- package/lib/renderers/Json.js +4 -13
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Link.d.ts +18 -3
- package/lib/renderers/Link.js +27 -15
- package/lib/renderers/Link.js.map +2 -2
- package/lib/renderers/List.js +1 -1
- package/lib/renderers/List.js.map +2 -2
- package/lib/renderers/Log.d.ts +2 -2
- package/lib/renderers/Log.js +7 -1
- package/lib/renderers/Log.js.map +2 -2
- package/lib/renderers/Mapping.d.ts +9 -2
- package/lib/renderers/Mapping.js +18 -6
- package/lib/renderers/Mapping.js.map +2 -2
- package/lib/renderers/Nav.d.ts +81 -25
- package/lib/renderers/Nav.js +292 -31
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +1 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Portlet.d.ts +125 -0
- package/lib/renderers/Portlet.js +156 -0
- package/lib/renderers/Portlet.js.map +13 -0
- package/lib/renderers/Property.js +2 -1
- package/lib/renderers/Property.js.map +2 -2
- package/lib/renderers/SearchBox.d.ts +6 -1
- package/lib/renderers/SearchBox.js +19 -5
- package/lib/renderers/SearchBox.js.map +2 -2
- package/lib/renderers/SparkLine.d.ts +4 -0
- package/lib/renderers/SparkLine.js.map +2 -2
- package/lib/renderers/Table/ColumnToggler.d.ts +113 -0
- package/lib/renderers/Table/ColumnToggler.js +216 -0
- package/lib/renderers/Table/ColumnToggler.js.map +13 -0
- package/lib/renderers/Table/ItemActionsWrapper.d.ts +11 -0
- package/lib/renderers/Table/ItemActionsWrapper.js +31 -0
- package/lib/renderers/Table/ItemActionsWrapper.js.map +13 -0
- package/lib/renderers/Table/TableBody.d.ts +4 -0
- package/lib/renderers/Table/TableCell.js +3 -1
- package/lib/renderers/Table/TableCell.js.map +2 -2
- package/lib/renderers/Table/TableContent.d.ts +4 -1
- package/lib/renderers/Table/TableContent.js +21 -1
- package/lib/renderers/Table/TableContent.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +19 -2
- package/lib/renderers/Table/index.js +172 -57
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tabs.js +9 -1
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/WebComponent.js +1 -1
- package/lib/renderers/WebComponent.js.map +2 -2
- package/lib/store/combo.d.ts +2 -16
- package/lib/store/crud.js +3 -7
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +1 -1
- package/lib/store/form.js +5 -6
- package/lib/store/form.js.map +2 -2
- package/lib/store/service.js +5 -4
- package/lib/store/service.js.map +2 -2
- package/lib/store/table.d.ts +260 -3
- package/lib/store/table.js +64 -6
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +1175 -255
- package/lib/themes/ang.css +1175 -255
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +1175 -255
- package/lib/themes/antd.css +1175 -255
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1761 -514
- package/lib/themes/cxd.css +1761 -514
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +1175 -255
- package/lib/themes/dark.css +1175 -255
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +1761 -514
- package/lib/themes/default.css.map +1 -1
- package/lib/types.d.ts +37 -0
- package/lib/types.js +0 -5
- package/lib/types.js.map +2 -2
- package/lib/utils/api.d.ts +3 -2
- package/lib/utils/api.js +31 -15
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/dom.d.ts +4 -0
- package/lib/utils/dom.js +11 -1
- package/lib/utils/dom.js.map +2 -2
- package/lib/utils/handleAction.d.ts +7 -0
- package/lib/utils/handleAction.js +30 -0
- package/lib/utils/handleAction.js.map +13 -0
- package/lib/utils/helper.d.ts +3 -1
- package/lib/utils/helper.js +14 -5
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/icon.js +3 -0
- package/lib/utils/icon.js.map +2 -2
- package/lib/utils/tpl-builtin.d.ts +1 -1
- package/lib/utils/tpl-builtin.js +25 -15
- package/lib/utils/tpl-builtin.js.map +2 -2
- package/package.json +1 -2
- package/schema.json +3534 -1028
- package/scss/_mixins.scss +27 -0
- package/scss/_properties.scss +84 -13
- package/scss/_utilities.scss +4 -0
- package/scss/base/_normalize.scss +2 -0
- package/scss/components/_anchor-nav.scss +88 -29
- package/scss/components/_badge.scss +52 -1
- package/scss/components/_button.scss +34 -3
- package/scss/components/_card.scss +8 -14
- package/scss/components/_collapse.scss +41 -8
- package/scss/components/_column-toggler.scss +234 -0
- package/scss/components/_dropdown.scss +2 -1
- package/scss/components/_image-gallery.scss +1 -1
- package/scss/components/_images.scss +2 -1
- package/scss/components/_link.scss +6 -0
- package/scss/components/_mapping.scss +6 -0
- package/scss/components/_nav.scss +236 -154
- package/scss/components/_page.scss +5 -4
- package/scss/components/_picker-columns.scss +123 -0
- package/scss/components/_popover.scss +17 -0
- package/scss/components/_portlet.scss +51 -0
- package/scss/components/_progress.scss +2 -0
- package/scss/components/_status.scss +1 -1
- package/scss/components/_steps.scss +1 -1
- package/scss/components/_table.scss +51 -1
- package/scss/components/form/_checks.scss +0 -351
- package/scss/components/form/_color.scss +1 -0
- package/scss/components/form/_date-range.scss +2 -0
- package/scss/components/form/_date.scss +2 -0
- package/scss/components/form/_fieldset.scss +6 -3
- package/scss/components/form/_file.scss +5 -4
- package/scss/components/form/_form.scss +48 -0
- package/scss/components/form/_image.scss +7 -2
- package/scss/components/form/_list.scss +1 -0
- package/scss/components/form/_location.scss +1 -1
- package/scss/components/form/_selection.scss +354 -0
- package/scss/components/form/_text.scss +13 -0
- package/scss/components/form/_textarea.scss +10 -0
- package/scss/components/form/_transfer.scss +77 -18
- package/scss/themes/_common.scss +6 -0
- package/scss/themes/_cxd-colors.scss +56 -0
- package/scss/themes/_cxd-variables.scss +219 -91
- package/scss/themes/cxd.scss +370 -0
- package/sdk/ang-ie11.css +1596 -515
- package/sdk/ang.css +1395 -256
- package/sdk/antd-ie11.css +1397 -318
- package/sdk/antd.css +1395 -256
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +2739 -1361
- package/sdk/cxd.css +2095 -588
- package/sdk/dark-ie11.css +1593 -512
- package/sdk/dark.css +1395 -256
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/iconfont.svg +2513 -0
- package/sdk/iconfont.ttf +0 -0
- package/sdk/iconfont.woff +0 -0
- package/sdk/ie11-patch.css +1 -0
- package/sdk/locale/de-DE.js +4 -0
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +18 -32
- package/sdk/rich-text.js +62 -64
- package/sdk/sdk-ie11.css +2739 -1361
- package/sdk/sdk.css +2095 -588
- package/sdk/sdk.js +1189 -1133
- 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 +32 -0
- package/src/components/Alert.tsx +3 -1
- package/src/components/AnchorNav.tsx +15 -4
- package/src/components/{AssociatedCheckboxes.tsx → AssociatedSelection.tsx} +41 -37
- package/src/components/Badge.tsx +96 -28
- package/src/components/Button.tsx +23 -7
- package/src/components/{ChainedCheckboxes.tsx → ChainedSelection.tsx} +57 -40
- package/src/components/Collapse.tsx +14 -9
- package/src/components/DatePicker.tsx +1 -1
- package/src/components/DateRangePicker.tsx +23 -11
- package/src/components/{ListCheckboxes.tsx → GroupedSelection.tsx} +26 -21
- package/src/components/InputBox.tsx +1 -1
- package/src/components/Link.tsx +85 -0
- package/src/components/ModalManager.ts +1 -1
- package/src/components/MonthRangePicker.tsx +10 -2
- package/src/components/PickerColumn.tsx +429 -0
- package/src/components/PickerContainer.tsx +128 -0
- package/src/components/Radios.tsx +3 -8
- package/src/components/RichText.tsx +244 -3
- package/src/components/SearchBox.tsx +4 -5
- package/src/components/Select.tsx +60 -5
- package/src/components/{Checkboxes.tsx → Selection.tsx} +75 -21
- package/src/components/SparkLine.tsx +4 -1
- package/src/components/{TableCheckboxes.tsx → TableSelection.tsx} +46 -25
- package/src/components/TabsTransfer.tsx +13 -7
- package/src/components/TabsTransferPicker.tsx +85 -0
- package/src/components/Toast.tsx +5 -5
- package/src/components/Transfer.tsx +71 -50
- package/src/components/TransferDropDown.tsx +117 -0
- package/src/components/TransferPicker.tsx +84 -0
- package/src/components/Tree.tsx +6 -8
- package/src/components/{TreeCheckboxes.tsx → TreeSelection.tsx} +33 -26
- package/src/components/WithRemoteConfig.tsx +7 -2
- package/src/components/calendar/DaysView.tsx +2 -2
- package/src/components/condition-builder/Field.tsx +5 -5
- package/src/components/condition-builder/Func.tsx +3 -3
- package/src/components/condition-builder/InputSwitch.tsx +3 -3
- package/src/components/condition-builder/Item.tsx +5 -12
- package/src/components/icons.tsx +15 -0
- package/src/components/index.tsx +13 -13
- package/src/envOverwrite.ts +0 -1
- package/src/factory.tsx +18 -3
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-set-state.ts +19 -0
- package/src/hooks/use-touch.ts +100 -0
- package/src/hooks/use-update-effect.ts +16 -0
- package/src/icons/clock.svg +1 -0
- package/src/icons/loading-outline.svg +4 -0
- package/src/icons/status-close.svg +10 -0
- package/src/icons/status-fail.svg +10 -0
- package/src/icons/status-info.svg +8 -0
- package/src/icons/status-success.svg +10 -0
- package/src/icons/status-warning.svg +8 -0
- package/src/index.tsx +3 -0
- package/src/locale/de-DE.ts +4 -0
- package/src/locale/en-US.ts +4 -0
- package/src/locale/zh-CN.ts +7 -3
- package/src/renderers/Action.tsx +99 -15
- package/src/renderers/AnchorNav.tsx +4 -0
- package/src/renderers/Avatar.tsx +8 -4
- package/src/renderers/Breadcrumb.tsx +5 -1
- package/src/renderers/CRUD.tsx +63 -28
- package/src/renderers/Card.tsx +63 -34
- package/src/renderers/Chart.tsx +6 -2
- package/src/renderers/Collapse.tsx +4 -2
- package/src/renderers/Dialog.tsx +0 -4
- package/src/renderers/Drawer.tsx +0 -4
- package/src/renderers/DropDownButton.tsx +26 -12
- package/src/renderers/Form/Checkbox.tsx +8 -0
- package/src/renderers/Form/Combo.tsx +2 -3
- package/src/renderers/Form/InputCity.tsx +4 -8
- package/src/renderers/Form/InputFile.tsx +30 -20
- package/src/renderers/Form/InputImage.tsx +16 -5
- package/src/renderers/Form/Item.tsx +1 -1
- package/src/renderers/Form/Options.tsx +32 -7
- package/src/renderers/Form/Picker.tsx +3 -2
- package/src/renderers/Form/Select.tsx +158 -21
- package/src/renderers/Form/TabsTransferPicker.tsx +123 -0
- package/src/renderers/Form/Transfer.tsx +19 -4
- package/src/renderers/Form/TransferPicker.tsx +139 -0
- package/src/renderers/Form/TreeSelect.tsx +25 -0
- package/src/renderers/Form/index.tsx +16 -2
- package/src/renderers/Form/wrapControl.tsx +28 -3
- package/src/renderers/IFrame.tsx +4 -5
- package/src/renderers/Image.tsx +10 -0
- package/src/renderers/Json.tsx +9 -9
- package/src/renderers/Link.tsx +53 -14
- package/src/renderers/List.tsx +1 -1
- package/src/renderers/Log.tsx +16 -3
- package/src/renderers/Mapping.tsx +27 -11
- package/src/renderers/Nav.tsx +392 -60
- package/src/renderers/Page.tsx +1 -1
- package/src/renderers/Portlet.tsx +423 -0
- package/src/renderers/Property.tsx +3 -2
- package/src/renderers/SearchBox.tsx +23 -4
- package/src/renderers/SparkLine.tsx +5 -0
- package/src/renderers/Table/ColumnToggler.tsx +544 -0
- package/src/renderers/Table/ItemActionsWrapper.tsx +44 -0
- package/src/renderers/Table/TableCell.tsx +16 -1
- package/src/renderers/Table/TableContent.tsx +40 -2
- package/src/renderers/Table/index.tsx +257 -80
- package/src/renderers/Tabs.tsx +9 -1
- package/src/renderers/WebComponent.tsx +2 -2
- package/src/store/crud.ts +3 -8
- package/src/store/form.ts +5 -10
- package/src/store/service.ts +5 -4
- package/src/store/table.ts +94 -6
- package/src/types.ts +57 -0
- package/src/utils/api.ts +52 -23
- package/src/utils/dom.tsx +12 -0
- package/src/utils/handleAction.ts +41 -0
- package/src/utils/helper.ts +12 -3
- package/src/utils/icon.tsx +4 -0
- package/src/utils/tpl-builtin.ts +48 -17
- package/dump.rdb +0 -0
- package/lib/components/AssociatedCheckboxes.d.ts +0 -762
- package/lib/components/AssociatedCheckboxes.js +0 -90
- package/lib/components/AssociatedCheckboxes.js.map +0 -13
- package/lib/components/ChainedCheckboxes.js.map +0 -13
- package/lib/components/Checkboxes.js +0 -101
- package/lib/components/Checkboxes.js.map +0 -13
- package/lib/components/ListCheckboxes.d.ts +0 -739
- package/lib/components/ListCheckboxes.js +0 -48
- package/lib/components/ListCheckboxes.js.map +0 -13
- package/lib/components/ListRadios.d.ts +0 -763
- package/lib/components/ListRadios.js +0 -86
- package/lib/components/ListRadios.js.map +0 -13
- package/lib/components/TableCheckboxes.js.map +0 -13
- package/lib/components/TreeCheckboxes.js.map +0 -13
- package/lib/components/TreeRadios.d.ts +0 -838
- package/lib/components/TreeRadios.js +0 -116
- package/lib/components/TreeRadios.js.map +0 -13
- package/src/components/ListRadios.tsx +0 -159
- package/src/components/TreeRadios.tsx +0 -202
package/src/store/service.ts
CHANGED
@@ -3,6 +3,7 @@ import {iRendererStore} from './iRenderer';
|
|
3
3
|
import {Api, ApiObject, Payload, fetchOptions} from '../types';
|
4
4
|
import {extendObject, isEmpty, isObject} from '../utils/helper';
|
5
5
|
import {ServerError} from '../utils/errors';
|
6
|
+
import {normalizeApiResponseData} from '../utils/api';
|
6
7
|
|
7
8
|
export const ServiceStore = iRendererStore
|
8
9
|
.named('ServiceStore')
|
@@ -96,7 +97,7 @@ export const ServiceStore = iRendererStore
|
|
96
97
|
let replace = !!(api as ApiObject).replaceData;
|
97
98
|
let data = {
|
98
99
|
...(replace ? {} : self.data),
|
99
|
-
...json.data
|
100
|
+
...normalizeApiResponseData(json.data)
|
100
101
|
};
|
101
102
|
reInitData(data, replace);
|
102
103
|
self.hasRemoteData = true;
|
@@ -176,7 +177,7 @@ export const ServiceStore = iRendererStore
|
|
176
177
|
|
177
178
|
json.data &&
|
178
179
|
self.updateData(
|
179
|
-
json.data,
|
180
|
+
normalizeApiResponseData(json.data),
|
180
181
|
undefined,
|
181
182
|
!!(api as ApiObject).replaceData
|
182
183
|
);
|
@@ -264,7 +265,7 @@ export const ServiceStore = iRendererStore
|
|
264
265
|
|
265
266
|
json.data &&
|
266
267
|
self.updateData(
|
267
|
-
json.data,
|
268
|
+
normalizeApiResponseData(json.data),
|
268
269
|
undefined,
|
269
270
|
!!(api as ApiObject).replaceData
|
270
271
|
);
|
@@ -406,7 +407,7 @@ export const ServiceStore = iRendererStore
|
|
406
407
|
: {
|
407
408
|
type: 'wrapper',
|
408
409
|
wrap: false,
|
409
|
-
...json.data
|
410
|
+
...normalizeApiResponseData(json.data)
|
410
411
|
};
|
411
412
|
self.schemaKey = '' + Date.now();
|
412
413
|
isObject(json.data.data) &&
|
package/src/store/table.ts
CHANGED
@@ -45,6 +45,7 @@ export const Column = types
|
|
45
45
|
checkdisable: false,
|
46
46
|
isPrimary: false,
|
47
47
|
searchable: types.maybe(types.frozen()),
|
48
|
+
enableSearch: true,
|
48
49
|
sortable: false,
|
49
50
|
filterable: types.optional(types.frozen(), undefined),
|
50
51
|
fixed: '',
|
@@ -66,8 +67,13 @@ export const Column = types
|
|
66
67
|
|
67
68
|
table.persistSaveToggledColumns();
|
68
69
|
},
|
70
|
+
|
69
71
|
setToggled(value: boolean) {
|
70
72
|
self.toggled = value;
|
73
|
+
},
|
74
|
+
|
75
|
+
setEnableSearch(value: boolean) {
|
76
|
+
self.enableSearch = value;
|
71
77
|
}
|
72
78
|
}));
|
73
79
|
|
@@ -292,6 +298,10 @@ export const TableStore = iRendererStore
|
|
292
298
|
keepItemSelectionOnPageChange: false
|
293
299
|
})
|
294
300
|
.views(self => {
|
301
|
+
function getColumnsExceptBuiltinTypes() {
|
302
|
+
return self.columns.filter(item => !/^__/.test(item.type));
|
303
|
+
}
|
304
|
+
|
295
305
|
function getForms() {
|
296
306
|
return self.formsRef.map(item => ({
|
297
307
|
store: getStoreById(item.id) as IFormStore,
|
@@ -414,8 +424,8 @@ export const TableStore = iRendererStore
|
|
414
424
|
return getMovedRows().length;
|
415
425
|
}
|
416
426
|
|
417
|
-
function
|
418
|
-
return self.rows.
|
427
|
+
function getHovedRow(): IRow | undefined {
|
428
|
+
return flattenTree<IRow>(self.rows).find((item: IRow) => item.isHover);
|
419
429
|
}
|
420
430
|
|
421
431
|
function getUnSelectedRows() {
|
@@ -499,11 +509,37 @@ export const TableStore = iRendererStore
|
|
499
509
|
});
|
500
510
|
}
|
501
511
|
|
512
|
+
function getFirstToggledColumnIndex() {
|
513
|
+
const column = self.columns.find(
|
514
|
+
column => !/^__/.test(column.type) && column.toggled
|
515
|
+
);
|
516
|
+
|
517
|
+
return column == null ? null : column.index;
|
518
|
+
}
|
519
|
+
|
520
|
+
function getSearchableColumns() {
|
521
|
+
return self.columns.filter(
|
522
|
+
column => column.searchable && isObject(column.searchable)
|
523
|
+
);
|
524
|
+
}
|
525
|
+
|
502
526
|
return {
|
527
|
+
get columnsData() {
|
528
|
+
return getColumnsExceptBuiltinTypes();
|
529
|
+
},
|
530
|
+
|
503
531
|
get forms() {
|
504
532
|
return getForms();
|
505
533
|
},
|
506
534
|
|
535
|
+
get searchableColumns() {
|
536
|
+
return getSearchableColumns();
|
537
|
+
},
|
538
|
+
|
539
|
+
get activedSearchableColumns() {
|
540
|
+
return getSearchableColumns().filter(column => column.enableSearch);
|
541
|
+
},
|
542
|
+
|
507
543
|
get filteredColumns() {
|
508
544
|
return getFilteredColumns();
|
509
545
|
},
|
@@ -583,8 +619,8 @@ export const TableStore = iRendererStore
|
|
583
619
|
return getMovedRows();
|
584
620
|
},
|
585
621
|
|
586
|
-
get
|
587
|
-
return
|
622
|
+
get hoverRow() {
|
623
|
+
return getHovedRow();
|
588
624
|
},
|
589
625
|
|
590
626
|
get disabledHeadCheckbox() {
|
@@ -598,6 +634,10 @@ export const TableStore = iRendererStore
|
|
598
634
|
return maxLength === selectedLength;
|
599
635
|
},
|
600
636
|
|
637
|
+
get firstToggledColumnIndex() {
|
638
|
+
return getFirstToggledColumnIndex();
|
639
|
+
},
|
640
|
+
|
601
641
|
getData,
|
602
642
|
|
603
643
|
get columnGroup() {
|
@@ -716,6 +756,51 @@ export const TableStore = iRendererStore
|
|
716
756
|
}
|
717
757
|
}
|
718
758
|
|
759
|
+
function updateColumns(columns: Array<SColumn>) {
|
760
|
+
if (columns && Array.isArray(columns)) {
|
761
|
+
columns = columns.filter(column => column).concat();
|
762
|
+
|
763
|
+
if (!columns.length) {
|
764
|
+
columns.push({
|
765
|
+
type: 'text',
|
766
|
+
label: '空'
|
767
|
+
});
|
768
|
+
}
|
769
|
+
|
770
|
+
columns.unshift({
|
771
|
+
type: '__expandme',
|
772
|
+
toggable: false,
|
773
|
+
className: 'Table-expandCell'
|
774
|
+
});
|
775
|
+
|
776
|
+
columns.unshift({
|
777
|
+
type: '__checkme',
|
778
|
+
fixed: 'left',
|
779
|
+
toggable: false,
|
780
|
+
className: 'Table-checkCell'
|
781
|
+
});
|
782
|
+
|
783
|
+
columns.unshift({
|
784
|
+
type: '__dragme',
|
785
|
+
toggable: false,
|
786
|
+
className: 'Table-dragCell'
|
787
|
+
});
|
788
|
+
|
789
|
+
columns = columns.map((item, index) => ({
|
790
|
+
...item,
|
791
|
+
index,
|
792
|
+
rawIndex: index - 3,
|
793
|
+
type: item.type || 'plain',
|
794
|
+
pristine: item.pristine || item,
|
795
|
+
toggled: item.toggled !== false,
|
796
|
+
breakpoint: item.breakpoint,
|
797
|
+
isPrimary: index === 3
|
798
|
+
}));
|
799
|
+
|
800
|
+
self.columns.replace(columns as any);
|
801
|
+
}
|
802
|
+
}
|
803
|
+
|
719
804
|
function combineCell(arr: Array<SRow>, keys: Array<string>): Array<SRow> {
|
720
805
|
if (!keys.length || !arr.length) {
|
721
806
|
return arr;
|
@@ -1031,8 +1116,10 @@ export const TableStore = iRendererStore
|
|
1031
1116
|
if (idx === -1) {
|
1032
1117
|
// 如果上一个是选中状态,则将之间的所有 check 都变成可选
|
1033
1118
|
if (lastCheckedRow.checked) {
|
1034
|
-
if (maxLength
|
1035
|
-
self.selectedRows.
|
1119
|
+
if (maxLength) {
|
1120
|
+
if (self.selectedRows.length < maxLength) {
|
1121
|
+
self.selectedRows.push(rowItem);
|
1122
|
+
}
|
1036
1123
|
} else {
|
1037
1124
|
self.selectedRows.push(rowItem);
|
1038
1125
|
}
|
@@ -1177,6 +1264,7 @@ export const TableStore = iRendererStore
|
|
1177
1264
|
|
1178
1265
|
return {
|
1179
1266
|
update,
|
1267
|
+
updateColumns,
|
1180
1268
|
initRows,
|
1181
1269
|
updateSelected,
|
1182
1270
|
toggleAll,
|
package/src/types.ts
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import type {ActionSchema} from './renderers/Action';
|
1
2
|
import {SchemaApiObject} from './Schema';
|
2
3
|
|
3
4
|
export interface ApiObject extends SchemaApiObject {
|
@@ -157,3 +158,59 @@ export interface JSONSchema {
|
|
157
158
|
// export type ExtractProps<
|
158
159
|
// TComponentOrTProps
|
159
160
|
// > = TComponentOrTProps extends React.ComponentType<infer P> ? P : never;
|
161
|
+
|
162
|
+
/**
|
163
|
+
* 事件跟踪的定义
|
164
|
+
*/
|
165
|
+
export interface EventTrack {
|
166
|
+
/**
|
167
|
+
* 事件类型,目前有以下几种
|
168
|
+
*
|
169
|
+
* api: 所有 fetcher 前调用
|
170
|
+
* url: 打开外部链接,组件有可能是 action 也有可能是 link
|
171
|
+
* link: 打开内部链接
|
172
|
+
* dialog: action 的弹框
|
173
|
+
* drawer: action 的抽出式弹框
|
174
|
+
* copy: action 里的复制
|
175
|
+
* reload: action 里的 reload
|
176
|
+
* email: action 里的 email
|
177
|
+
* prev: action 里的 prev
|
178
|
+
* next: action 里的 next
|
179
|
+
* cancel: action 里的 cancel
|
180
|
+
* close: action 里的 close
|
181
|
+
* submit: 有可能是 action 里的 submit,也有可能是表单提交
|
182
|
+
* confirm: action 里的 confirm
|
183
|
+
* add: action 里的 add
|
184
|
+
* reset: action 里的 reset
|
185
|
+
* reset-and-submit: action 里的 reset-and-submit
|
186
|
+
* formItemChange: 表单项内容变化
|
187
|
+
* formError: 表单验证失败
|
188
|
+
* formSubmit: 表单成功提交,在表单验证成功之后才会触发,这个可能会和 api 重合
|
189
|
+
* tabChange: tab 切换
|
190
|
+
* netError: api 报错
|
191
|
+
*/
|
192
|
+
eventType:
|
193
|
+
| 'api'
|
194
|
+
| 'url'
|
195
|
+
| 'link'
|
196
|
+
| 'dialog'
|
197
|
+
| 'drawer'
|
198
|
+
| 'copy'
|
199
|
+
| 'reload'
|
200
|
+
| 'email'
|
201
|
+
| 'prev'
|
202
|
+
| 'next'
|
203
|
+
| 'cancel'
|
204
|
+
| 'close'
|
205
|
+
| 'submit'
|
206
|
+
| 'confirm'
|
207
|
+
| 'reset'
|
208
|
+
| 'reset-and-submit'
|
209
|
+
| 'formItemChange'
|
210
|
+
| 'tabChange';
|
211
|
+
|
212
|
+
/**
|
213
|
+
* 事件数据
|
214
|
+
*/
|
215
|
+
eventData: ActionSchema | Api;
|
216
|
+
}
|
package/src/utils/api.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import omit from 'lodash/omit';
|
2
|
+
import {Api, ApiObject, EventTrack, fetcherResult, Payload} from '../types';
|
2
3
|
import {fetcherConfig} from '../factory';
|
3
4
|
import {tokenize, dataMapping} from './tpl-builtin';
|
4
5
|
import {evalExpression} from './tpl';
|
@@ -12,6 +13,7 @@ import {
|
|
12
13
|
createObject,
|
13
14
|
qsparse
|
14
15
|
} from './helper';
|
16
|
+
import isPlainObject from 'lodash/isPlainObject';
|
15
17
|
|
16
18
|
const rSchema = /(?:^|raw\:)(get|post|put|delete|patch|options|head):/i;
|
17
19
|
|
@@ -61,6 +63,23 @@ export function buildApi(
|
|
61
63
|
};
|
62
64
|
api.method = (api.method || (options as any).method || 'get').toLowerCase();
|
63
65
|
|
66
|
+
if (api.headers) {
|
67
|
+
api.headers = dataMapping(api.headers, data, undefined, false);
|
68
|
+
}
|
69
|
+
|
70
|
+
if (api.requestAdaptor && typeof api.requestAdaptor === 'string') {
|
71
|
+
api.requestAdaptor = str2function(api.requestAdaptor, 'api') as any;
|
72
|
+
}
|
73
|
+
|
74
|
+
if (api.adaptor && typeof api.adaptor === 'string') {
|
75
|
+
api.adaptor = str2function(
|
76
|
+
api.adaptor,
|
77
|
+
'payload',
|
78
|
+
'response',
|
79
|
+
'api'
|
80
|
+
) as any;
|
81
|
+
}
|
82
|
+
|
64
83
|
if (!data) {
|
65
84
|
return api;
|
66
85
|
} else if (
|
@@ -82,7 +101,9 @@ export function buildApi(
|
|
82
101
|
);
|
83
102
|
api.url =
|
84
103
|
tokenize(api.url.substring(0, idx + 1), data, '| url_encode') +
|
85
|
-
qsstringify(
|
104
|
+
qsstringify(
|
105
|
+
(api.query = dataMapping(params, data, undefined, api.convertKeyToPath))
|
106
|
+
) +
|
86
107
|
(~hashIdx ? api.url.substring(hashIdx) : '');
|
87
108
|
} else {
|
88
109
|
api.url = tokenize(api.url, data, '| url_encode');
|
@@ -93,7 +114,12 @@ export function buildApi(
|
|
93
114
|
}
|
94
115
|
|
95
116
|
if (api.data) {
|
96
|
-
api.body = api.data = dataMapping(
|
117
|
+
api.body = api.data = dataMapping(
|
118
|
+
api.data,
|
119
|
+
data,
|
120
|
+
undefined,
|
121
|
+
api.convertKeyToPath
|
122
|
+
);
|
97
123
|
} else if (api.method === 'post' || api.method === 'put') {
|
98
124
|
api.body = api.data = cloneObject(data);
|
99
125
|
}
|
@@ -137,23 +163,6 @@ export function buildApi(
|
|
137
163
|
}
|
138
164
|
}
|
139
165
|
|
140
|
-
if (api.headers) {
|
141
|
-
api.headers = dataMapping(api.headers, data);
|
142
|
-
}
|
143
|
-
|
144
|
-
if (api.requestAdaptor && typeof api.requestAdaptor === 'string') {
|
145
|
-
api.requestAdaptor = str2function(api.requestAdaptor, 'api') as any;
|
146
|
-
}
|
147
|
-
|
148
|
-
if (api.adaptor && typeof api.adaptor === 'string') {
|
149
|
-
api.adaptor = str2function(
|
150
|
-
api.adaptor,
|
151
|
-
'payload',
|
152
|
-
'response',
|
153
|
-
'api'
|
154
|
-
) as any;
|
155
|
-
}
|
156
|
-
|
157
166
|
return api;
|
158
167
|
}
|
159
168
|
|
@@ -190,7 +199,7 @@ export function responseAdaptor(ret: fetcherResult, api: ApiObject) {
|
|
190
199
|
let hasStatusField = true;
|
191
200
|
|
192
201
|
if (!data) {
|
193
|
-
throw new Error('Response is empty
|
202
|
+
throw new Error('Response is empty');
|
194
203
|
}
|
195
204
|
|
196
205
|
// 兼容几种常见写法
|
@@ -248,7 +257,9 @@ export function responseAdaptor(ret: fetcherResult, api: ApiObject) {
|
|
248
257
|
items: payload.data
|
249
258
|
}
|
250
259
|
: payload.data) || {}
|
251
|
-
)
|
260
|
+
),
|
261
|
+
undefined,
|
262
|
+
api.convertKeyToPath
|
252
263
|
);
|
253
264
|
}
|
254
265
|
|
@@ -256,7 +267,8 @@ export function responseAdaptor(ret: fetcherResult, api: ApiObject) {
|
|
256
267
|
}
|
257
268
|
|
258
269
|
export function wrapFetcher(
|
259
|
-
fn: (config: fetcherConfig) => Promise<fetcherResult
|
270
|
+
fn: (config: fetcherConfig) => Promise<fetcherResult>,
|
271
|
+
tracker?: (eventTrack: EventTrack, data: any) => void
|
260
272
|
): (api: Api, data: object, options?: object) => Promise<Payload | void> {
|
261
273
|
return function (api, data, options) {
|
262
274
|
api = buildApi(api, data, options) as ApiObject;
|
@@ -286,6 +298,11 @@ export function wrapFetcher(
|
|
286
298
|
api.headers['Content-Type'] = 'application/json';
|
287
299
|
}
|
288
300
|
|
301
|
+
tracker?.(
|
302
|
+
{eventType: 'api', eventData: omit(api, ['config', 'data', 'body'])},
|
303
|
+
api.data
|
304
|
+
);
|
305
|
+
|
289
306
|
if (typeof api.cache === 'number' && api.cache > 0) {
|
290
307
|
const apiCache = getApiCache(api);
|
291
308
|
return wrapAdaptor(
|
@@ -460,4 +477,16 @@ export function clearApiCache() {
|
|
460
477
|
apiCaches.splice(0, apiCaches.length);
|
461
478
|
}
|
462
479
|
|
480
|
+
export function normalizeApiResponseData(data: any) {
|
481
|
+
if (typeof data === 'undefined') {
|
482
|
+
data = {};
|
483
|
+
} else if (!isPlainObject(data)) {
|
484
|
+
data = {
|
485
|
+
[Array.isArray(data) ? 'items' : 'result']: data
|
486
|
+
};
|
487
|
+
}
|
488
|
+
|
489
|
+
return data;
|
490
|
+
}
|
491
|
+
|
463
492
|
// window.apiCaches = apiCaches;
|
package/src/utils/dom.tsx
CHANGED
@@ -267,3 +267,15 @@ export function calculatePosition(
|
|
267
267
|
activePlacement
|
268
268
|
};
|
269
269
|
}
|
270
|
+
|
271
|
+
/**
|
272
|
+
* 专门用来获取样式的像素值,默认返回 0
|
273
|
+
*/
|
274
|
+
export function getStyleNumber(element: HTMLElement, styleName: string) {
|
275
|
+
if (!element) {
|
276
|
+
return 0;
|
277
|
+
}
|
278
|
+
return (
|
279
|
+
parseInt(getComputedStyle(element).getPropertyValue(styleName), 10) || 0
|
280
|
+
);
|
281
|
+
}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
/**
|
2
|
+
* 后续好多地方可能都要支持 action,所以提取公共功能
|
3
|
+
*/
|
4
|
+
|
5
|
+
import {RendererProps} from '../factory';
|
6
|
+
import {ActionSchema, AjaxActionSchema} from '../renderers/Action';
|
7
|
+
import {normalizeApi, str2function} from './api';
|
8
|
+
|
9
|
+
export default function handleAction(
|
10
|
+
e: React.MouseEvent<any>,
|
11
|
+
action: ActionSchema,
|
12
|
+
props: RendererProps,
|
13
|
+
data?: any
|
14
|
+
) {
|
15
|
+
// https://reactjs.org/docs/legacy-event-pooling.html
|
16
|
+
e.persist();
|
17
|
+
|
18
|
+
const onAction = props.onAction;
|
19
|
+
let onClick: any = action.onClick;
|
20
|
+
|
21
|
+
if (typeof onClick === 'string') {
|
22
|
+
onClick = str2function(onClick, 'event', 'props');
|
23
|
+
}
|
24
|
+
const result: any = onClick && onClick(e, props);
|
25
|
+
|
26
|
+
if (e.isDefaultPrevented() || result === false || !onAction) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
|
30
|
+
e.preventDefault();
|
31
|
+
|
32
|
+
// download 是一种 ajax 的简写
|
33
|
+
if (action.actionType === 'download') {
|
34
|
+
action.actionType = 'ajax';
|
35
|
+
const api = normalizeApi((action as AjaxActionSchema).api);
|
36
|
+
api.responseType = 'blob';
|
37
|
+
(action as AjaxActionSchema).api = api;
|
38
|
+
}
|
39
|
+
|
40
|
+
onAction(e, action, data || props.data);
|
41
|
+
}
|
package/src/utils/helper.ts
CHANGED
@@ -16,6 +16,14 @@ import {
|
|
16
16
|
} from './tpl-builtin';
|
17
17
|
import {isObservable} from 'mobx';
|
18
18
|
|
19
|
+
export function isMobile() {
|
20
|
+
return (window as any).matchMedia?.('(max-width: 768px)').matches;
|
21
|
+
}
|
22
|
+
|
23
|
+
export function range(num: number, min: number, max: number): number {
|
24
|
+
return Math.min(Math.max(num, min), max);
|
25
|
+
}
|
26
|
+
|
19
27
|
// 方便取值的时候能够把上层的取到,但是获取的时候不会全部把所有的数据获取到。
|
20
28
|
export function createObject(
|
21
29
|
superProps?: {[propName: string]: any},
|
@@ -181,7 +189,8 @@ export function getVariable(
|
|
181
189
|
export function setVariable(
|
182
190
|
data: {[propName: string]: any},
|
183
191
|
key: string,
|
184
|
-
value: any
|
192
|
+
value: any,
|
193
|
+
convertKeyToPath?: boolean
|
185
194
|
) {
|
186
195
|
data = data || {};
|
187
196
|
|
@@ -190,7 +199,7 @@ export function setVariable(
|
|
190
199
|
return;
|
191
200
|
}
|
192
201
|
|
193
|
-
const parts = keyToPath(key);
|
202
|
+
const parts = convertKeyToPath !== false ? keyToPath(key) : [key];
|
194
203
|
const last = parts.pop() as string;
|
195
204
|
|
196
205
|
while (parts.length) {
|
@@ -1617,7 +1626,7 @@ export function detectPropValueChanged<
|
|
1617
1626
|
|
1618
1627
|
// 去掉字符串中的 html 标签,不完全准确但效率比较高
|
1619
1628
|
export function removeHTMLTag(str: string) {
|
1620
|
-
return str.replace(/<\/?[^>]+(>|$)/g, '');
|
1629
|
+
return typeof str === 'string' ? str.replace(/<\/?[^>]+(>|$)/g, '') : str;
|
1621
1630
|
}
|
1622
1631
|
|
1623
1632
|
/**
|
package/src/utils/icon.tsx
CHANGED
package/src/utils/tpl-builtin.ts
CHANGED
@@ -383,10 +383,26 @@ export const filters: {
|
|
383
383
|
first: input => input && input[0],
|
384
384
|
nth: (input, nth = 0) => input && input[nth],
|
385
385
|
last: input => input && (input.length ? input[input.length - 1] : null),
|
386
|
-
minus
|
387
|
-
stripNumber(
|
388
|
-
|
389
|
-
|
386
|
+
minus(input, step = 1) {
|
387
|
+
return stripNumber(
|
388
|
+
(Number(input) || 0) - Number(getStrOrVariable(step, this))
|
389
|
+
);
|
390
|
+
},
|
391
|
+
plus(input, step = 1) {
|
392
|
+
return stripNumber(
|
393
|
+
(Number(input) || 0) + Number(getStrOrVariable(step, this))
|
394
|
+
);
|
395
|
+
},
|
396
|
+
times(input, step = 1) {
|
397
|
+
return stripNumber(
|
398
|
+
(Number(input) || 0) * Number(getStrOrVariable(step, this))
|
399
|
+
);
|
400
|
+
},
|
401
|
+
division(input, step = 1) {
|
402
|
+
return stripNumber(
|
403
|
+
(Number(input) || 0) / Number(getStrOrVariable(step, this))
|
404
|
+
);
|
405
|
+
},
|
390
406
|
count: (input: any) =>
|
391
407
|
Array.isArray(input) || typeof input === 'string' ? input.length : 0,
|
392
408
|
sum: (input, field) => {
|
@@ -866,10 +882,13 @@ export function resolveMapping(
|
|
866
882
|
export function dataMapping(
|
867
883
|
to: any,
|
868
884
|
from: PlainObject = {},
|
869
|
-
ignoreFunction: boolean | ((key: string, value: any) => boolean) = false
|
885
|
+
ignoreFunction: boolean | ((key: string, value: any) => boolean) = false,
|
886
|
+
convertKeyToPath?: boolean
|
870
887
|
): any {
|
871
888
|
if (Array.isArray(to)) {
|
872
|
-
return to.map(item =>
|
889
|
+
return to.map(item =>
|
890
|
+
dataMapping(item, from, ignoreFunction, convertKeyToPath)
|
891
|
+
);
|
873
892
|
} else if (typeof to === 'string') {
|
874
893
|
return resolveMapping(to, from);
|
875
894
|
} else if (!isPlainObject(to)) {
|
@@ -883,7 +902,7 @@ export function dataMapping(
|
|
883
902
|
|
884
903
|
if (typeof ignoreFunction === 'function' && ignoreFunction(key, value)) {
|
885
904
|
// 如果被ignore,不做数据映射处理。
|
886
|
-
setVariable(ret, key, value);
|
905
|
+
setVariable(ret, key, value, convertKeyToPath);
|
887
906
|
} else if (key === '&' && value === '$$') {
|
888
907
|
ret = {
|
889
908
|
...ret,
|
@@ -900,7 +919,8 @@ export function dataMapping(
|
|
900
919
|
dataMapping(
|
901
920
|
value[keys[0]],
|
902
921
|
createObject(from, raw),
|
903
|
-
ignoreFunction
|
922
|
+
ignoreFunction,
|
923
|
+
convertKeyToPath
|
904
924
|
)
|
905
925
|
)
|
906
926
|
: resolveMapping(value, from);
|
@@ -919,10 +939,10 @@ export function dataMapping(
|
|
919
939
|
};
|
920
940
|
}
|
921
941
|
} else if (value === '$$') {
|
922
|
-
setVariable(ret, key, from);
|
942
|
+
setVariable(ret, key, from, convertKeyToPath);
|
923
943
|
} else if (value && value[0] === '$') {
|
924
944
|
const v = resolveMapping(value, from);
|
925
|
-
setVariable(ret, key, v);
|
945
|
+
setVariable(ret, key, v, convertKeyToPath);
|
926
946
|
|
927
947
|
if (v === '__undefined') {
|
928
948
|
deleteVariable(ret, key);
|
@@ -952,26 +972,37 @@ export function dataMapping(
|
|
952
972
|
const mapping = value[keys[0]];
|
953
973
|
|
954
974
|
(ret as PlainObject)[key] = arr.map((raw: object) =>
|
955
|
-
dataMapping(
|
975
|
+
dataMapping(
|
976
|
+
mapping,
|
977
|
+
createObject(from, raw),
|
978
|
+
ignoreFunction,
|
979
|
+
convertKeyToPath
|
980
|
+
)
|
956
981
|
);
|
957
982
|
} else if (isPlainObject(value)) {
|
958
|
-
setVariable(
|
983
|
+
setVariable(
|
984
|
+
ret,
|
985
|
+
key,
|
986
|
+
dataMapping(value, from, ignoreFunction, convertKeyToPath),
|
987
|
+
convertKeyToPath
|
988
|
+
);
|
959
989
|
} else if (Array.isArray(value)) {
|
960
990
|
setVariable(
|
961
991
|
ret,
|
962
992
|
key,
|
963
993
|
value.map((value: any) =>
|
964
994
|
isPlainObject(value)
|
965
|
-
? dataMapping(value, from, ignoreFunction)
|
995
|
+
? dataMapping(value, from, ignoreFunction, convertKeyToPath)
|
966
996
|
: resolveMapping(value, from)
|
967
|
-
)
|
997
|
+
),
|
998
|
+
convertKeyToPath
|
968
999
|
);
|
969
1000
|
} else if (typeof value == 'string' && ~value.indexOf('$')) {
|
970
|
-
setVariable(ret, key, resolveMapping(value, from));
|
1001
|
+
setVariable(ret, key, resolveMapping(value, from), convertKeyToPath);
|
971
1002
|
} else if (typeof value === 'function' && ignoreFunction !== true) {
|
972
|
-
setVariable(ret, key, value(from));
|
1003
|
+
setVariable(ret, key, value(from), convertKeyToPath);
|
973
1004
|
} else {
|
974
|
-
setVariable(ret, key, value);
|
1005
|
+
setVariable(ret, key, value, convertKeyToPath);
|
975
1006
|
|
976
1007
|
if (value === '__undefined') {
|
977
1008
|
deleteVariable(ret, key);
|
package/dump.rdb
DELETED
Binary file
|