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
@@ -0,0 +1,544 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {findDOMNode} from 'react-dom';
|
3
|
+
import Sortable from 'sortablejs';
|
4
|
+
import cloneDeep from 'lodash/cloneDeep';
|
5
|
+
import {RendererProps} from '../../factory';
|
6
|
+
import Overlay from '../../components/Overlay';
|
7
|
+
import PopOver from '../../components/PopOver';
|
8
|
+
import Modal from '../../components/Modal';
|
9
|
+
import Button from '../../components/Button';
|
10
|
+
import Checkbox from '../../components/Checkbox';
|
11
|
+
import TooltipWrapper from '../../components/TooltipWrapper';
|
12
|
+
import type {TooltipObject} from '../../components/TooltipWrapper';
|
13
|
+
import {noop, autobind} from '../../utils/helper';
|
14
|
+
import {filter} from '../../utils/tpl';
|
15
|
+
import {Icon} from '../../components/icons';
|
16
|
+
import {RootClose} from '../../utils/RootClose';
|
17
|
+
import {IColumn} from '../../store/table';
|
18
|
+
|
19
|
+
export interface ColumnTogglerProps extends RendererProps {
|
20
|
+
/**
|
21
|
+
* 按钮文字
|
22
|
+
*/
|
23
|
+
label?: string | React.ReactNode;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* 按钮提示文字,hover focus 时显示
|
27
|
+
*/
|
28
|
+
tooltip?: string | TooltipObject;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* 禁用状态下的提示
|
32
|
+
*/
|
33
|
+
disabledTip?: string | TooltipObject;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* 点击外部是否关闭
|
37
|
+
*/
|
38
|
+
closeOnOutside?: boolean;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* 点击内容是否关闭
|
42
|
+
*/
|
43
|
+
closeOnClick?: boolean;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* 下拉菜单对齐方式
|
47
|
+
*/
|
48
|
+
align?: 'left' | 'right';
|
49
|
+
|
50
|
+
/**
|
51
|
+
* ColumnToggler的CSS类名
|
52
|
+
*/
|
53
|
+
className?: string;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* 按钮的CSS类名
|
57
|
+
*/
|
58
|
+
btnClassName?: string;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* 按钮大小
|
62
|
+
*/
|
63
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
64
|
+
|
65
|
+
/**
|
66
|
+
* 按钮级别,样式
|
67
|
+
*/
|
68
|
+
level?: 'info' | 'success' | 'danger' | 'warning' | 'primary' | 'link';
|
69
|
+
|
70
|
+
/**
|
71
|
+
* 是否独占一行 `display: block`
|
72
|
+
*/
|
73
|
+
block?: boolean;
|
74
|
+
|
75
|
+
/**
|
76
|
+
* 是否可通过拖拽排序
|
77
|
+
*/
|
78
|
+
draggable?: boolean;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* 默认是否展开
|
82
|
+
*/
|
83
|
+
defaultIsOpened?: boolean;
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 激活状态
|
87
|
+
*/
|
88
|
+
isActived?: boolean;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* ICON名称
|
92
|
+
*/
|
93
|
+
icon?: string | React.ReactNode;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* 是否只显示图标。
|
97
|
+
*/
|
98
|
+
iconOnly?: boolean;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* 是否隐藏展开的Icon
|
102
|
+
*/
|
103
|
+
hideExpandIcon?: boolean;
|
104
|
+
|
105
|
+
/**
|
106
|
+
* 是否显示遮罩层
|
107
|
+
*/
|
108
|
+
overlay?: boolean;
|
109
|
+
|
110
|
+
/**
|
111
|
+
* 列数据
|
112
|
+
*/
|
113
|
+
columns: Array<IColumn>;
|
114
|
+
|
115
|
+
onColumnToggle: (columns: Array<IColumn>) => void;
|
116
|
+
modalContainer?: () => HTMLElement;
|
117
|
+
}
|
118
|
+
|
119
|
+
export interface ColumnTogglerState {
|
120
|
+
isOpened: boolean;
|
121
|
+
enableSorting: boolean;
|
122
|
+
tempColumns: any[];
|
123
|
+
}
|
124
|
+
|
125
|
+
export default class ColumnToggler extends React.Component<
|
126
|
+
ColumnTogglerProps,
|
127
|
+
ColumnTogglerState
|
128
|
+
> {
|
129
|
+
state: ColumnTogglerState = {
|
130
|
+
isOpened: false,
|
131
|
+
enableSorting: false,
|
132
|
+
tempColumns: cloneDeep(this.props.columns)
|
133
|
+
};
|
134
|
+
|
135
|
+
static defaultProps: Pick<
|
136
|
+
ColumnTogglerProps,
|
137
|
+
'placement' | 'tooltipTrigger' | 'tooltipRootClose' | 'draggable'
|
138
|
+
> = {
|
139
|
+
placement: 'top',
|
140
|
+
tooltipTrigger: ['hover', 'focus'],
|
141
|
+
tooltipRootClose: false,
|
142
|
+
draggable: false
|
143
|
+
};
|
144
|
+
|
145
|
+
target: any;
|
146
|
+
sortable?: Sortable;
|
147
|
+
dragRefDOM: HTMLElement;
|
148
|
+
|
149
|
+
constructor(props: ColumnTogglerProps) {
|
150
|
+
super(props);
|
151
|
+
|
152
|
+
this.open = this.open.bind(this);
|
153
|
+
this.close = this.close.bind(this);
|
154
|
+
this.toggle = this.toggle.bind(this);
|
155
|
+
this.domRef = this.domRef.bind(this);
|
156
|
+
this.dragRef = this.dragRef.bind(this);
|
157
|
+
}
|
158
|
+
|
159
|
+
componentDidMount() {
|
160
|
+
if (this.props.defaultIsOpened) {
|
161
|
+
this.setState({
|
162
|
+
isOpened: true
|
163
|
+
});
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
componentWillUnmount() {
|
168
|
+
this.destroyDragging();
|
169
|
+
}
|
170
|
+
|
171
|
+
domRef(ref: any) {
|
172
|
+
this.target = ref;
|
173
|
+
}
|
174
|
+
|
175
|
+
toggle(e: React.MouseEvent<any>) {
|
176
|
+
e.preventDefault();
|
177
|
+
|
178
|
+
this.setState({
|
179
|
+
isOpened: !this.state.isOpened
|
180
|
+
});
|
181
|
+
}
|
182
|
+
|
183
|
+
open() {
|
184
|
+
this.setState({
|
185
|
+
isOpened: true
|
186
|
+
});
|
187
|
+
}
|
188
|
+
|
189
|
+
close() {
|
190
|
+
this.setState({
|
191
|
+
isOpened: false,
|
192
|
+
enableSorting: false,
|
193
|
+
tempColumns: cloneDeep(this.props.columns)
|
194
|
+
});
|
195
|
+
}
|
196
|
+
|
197
|
+
swapColumnPosition(oldIndex: number, newIndex: number) {
|
198
|
+
const columns = this.state.tempColumns;
|
199
|
+
|
200
|
+
columns[oldIndex] = columns.splice(newIndex, 1, columns[oldIndex])[0];
|
201
|
+
this.setState({tempColumns: columns});
|
202
|
+
}
|
203
|
+
|
204
|
+
updateToggledColumn(
|
205
|
+
column: IColumn,
|
206
|
+
index: number,
|
207
|
+
value: any,
|
208
|
+
shift?: boolean
|
209
|
+
) {
|
210
|
+
const tempColumns = this.state.tempColumns.concat();
|
211
|
+
|
212
|
+
tempColumns.splice(index, 1, {
|
213
|
+
...column,
|
214
|
+
toggled: value
|
215
|
+
});
|
216
|
+
this.setState({tempColumns});
|
217
|
+
}
|
218
|
+
|
219
|
+
@autobind
|
220
|
+
dragRef(ref: any) {
|
221
|
+
const {enableSorting} = this.state;
|
222
|
+
const {draggable} = this.props;
|
223
|
+
|
224
|
+
if (enableSorting && draggable && ref) {
|
225
|
+
this.initDragging();
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
initDragging() {
|
230
|
+
const dom = findDOMNode(this) as HTMLElement;
|
231
|
+
const ns = this.props.classPrefix;
|
232
|
+
|
233
|
+
this.sortable = new Sortable(
|
234
|
+
dom.querySelector(`.${ns}ColumnToggler-modal-content`) as HTMLElement,
|
235
|
+
{
|
236
|
+
group: `ColumnToggler-modal-content`,
|
237
|
+
animation: 150,
|
238
|
+
handle: `.${ns}ColumnToggler-menuItem-dragBar`,
|
239
|
+
ghostClass: `${ns}ColumnToggler-menuItem--dragging`,
|
240
|
+
onEnd: (e: any) => {
|
241
|
+
if (e.newIndex === e.oldIndex) {
|
242
|
+
return;
|
243
|
+
}
|
244
|
+
|
245
|
+
const parent = e.to as HTMLElement;
|
246
|
+
if (e.oldIndex < parent.childNodes.length - 1) {
|
247
|
+
parent.insertBefore(e.item, parent.childNodes[e.oldIndex]);
|
248
|
+
} else {
|
249
|
+
parent.appendChild(e.item);
|
250
|
+
}
|
251
|
+
|
252
|
+
this.swapColumnPosition(e.oldIndex, e.newIndex);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
);
|
256
|
+
}
|
257
|
+
|
258
|
+
destroyDragging() {
|
259
|
+
this.sortable && this.sortable.destroy();
|
260
|
+
}
|
261
|
+
|
262
|
+
@autobind
|
263
|
+
onConfirm() {
|
264
|
+
const {tempColumns} = this.state;
|
265
|
+
const {onColumnToggle} = this.props;
|
266
|
+
|
267
|
+
onColumnToggle && onColumnToggle([...tempColumns]);
|
268
|
+
this.setState({
|
269
|
+
isOpened: false,
|
270
|
+
enableSorting: false
|
271
|
+
});
|
272
|
+
}
|
273
|
+
|
274
|
+
renderOuter() {
|
275
|
+
const {
|
276
|
+
popOverContainer,
|
277
|
+
classnames: cx,
|
278
|
+
classPrefix: ns,
|
279
|
+
children,
|
280
|
+
closeOnClick,
|
281
|
+
closeOnOutside
|
282
|
+
} = this.props;
|
283
|
+
const body = (
|
284
|
+
<RootClose
|
285
|
+
disabled={!this.state.isOpened}
|
286
|
+
onRootClose={closeOnOutside !== false ? this.close : noop}
|
287
|
+
>
|
288
|
+
{(ref: any) => {
|
289
|
+
return (
|
290
|
+
<ul
|
291
|
+
className={cx('ColumnToggler-menu')}
|
292
|
+
onClick={closeOnClick ? this.close : noop}
|
293
|
+
ref={ref}
|
294
|
+
>
|
295
|
+
{children}
|
296
|
+
</ul>
|
297
|
+
);
|
298
|
+
}}
|
299
|
+
</RootClose>
|
300
|
+
);
|
301
|
+
|
302
|
+
if (popOverContainer) {
|
303
|
+
return (
|
304
|
+
<Overlay container={popOverContainer} target={() => this.target} show>
|
305
|
+
<PopOver
|
306
|
+
overlay
|
307
|
+
onHide={this.close}
|
308
|
+
classPrefix={ns}
|
309
|
+
className={cx('ColumnToggler-popover')}
|
310
|
+
style={{minWidth: this.target?.offsetWidth}}
|
311
|
+
>
|
312
|
+
{body}
|
313
|
+
</PopOver>
|
314
|
+
</Overlay>
|
315
|
+
);
|
316
|
+
}
|
317
|
+
|
318
|
+
return body;
|
319
|
+
}
|
320
|
+
|
321
|
+
renderModal() {
|
322
|
+
const {
|
323
|
+
render,
|
324
|
+
classnames: cx,
|
325
|
+
classPrefix: ns,
|
326
|
+
modalContainer,
|
327
|
+
draggable,
|
328
|
+
overlay,
|
329
|
+
translate: __
|
330
|
+
} = this.props;
|
331
|
+
|
332
|
+
const {enableSorting, tempColumns} = this.state;
|
333
|
+
|
334
|
+
return (
|
335
|
+
<>
|
336
|
+
<Modal
|
337
|
+
closeOnEsc
|
338
|
+
onHide={this.close}
|
339
|
+
show={this.state.isOpened}
|
340
|
+
contentClassName={cx('ColumnToggler-modal')}
|
341
|
+
container={modalContainer || this.target}
|
342
|
+
overlay={typeof overlay === 'boolean' ? overlay : false}
|
343
|
+
>
|
344
|
+
<header className={cx('ColumnToggler-modal-header')}>
|
345
|
+
<span className={cx('ColumnToggler-modal-title')}>列设置</span>
|
346
|
+
<a
|
347
|
+
data-tooltip={__('Dialog.close')}
|
348
|
+
data-position="left"
|
349
|
+
className={cx('Modal-close')}
|
350
|
+
onClick={this.close}
|
351
|
+
>
|
352
|
+
<Icon icon="close" className="icon" />
|
353
|
+
</a>
|
354
|
+
</header>
|
355
|
+
|
356
|
+
<ul className={cx('ColumnToggler-modal-content')} ref={this.dragRef}>
|
357
|
+
{Array.isArray(tempColumns)
|
358
|
+
? tempColumns.map((column, index) => (
|
359
|
+
<TooltipWrapper
|
360
|
+
tooltipClassName={cx('ColumnToggler-tooltip')}
|
361
|
+
placement="top"
|
362
|
+
tooltip={column.label || ''}
|
363
|
+
trigger={enableSorting ? 'click' : 'hover'}
|
364
|
+
key={column.index}
|
365
|
+
>
|
366
|
+
<li
|
367
|
+
className={cx('ColumnToggler-menuItem')}
|
368
|
+
key={column.index}
|
369
|
+
>
|
370
|
+
{enableSorting && draggable && tempColumns.length > 1 ? (
|
371
|
+
<>
|
372
|
+
<a className={cx('ColumnToggler-menuItem-dragBar')}>
|
373
|
+
<Icon icon="drag-bar" className={cx('icon')} />
|
374
|
+
</a>
|
375
|
+
<span>
|
376
|
+
{column.label ? render('tpl', column.label) : null}
|
377
|
+
</span>
|
378
|
+
</>
|
379
|
+
) : (
|
380
|
+
<Checkbox
|
381
|
+
size="sm"
|
382
|
+
classPrefix={ns}
|
383
|
+
checked={column.toggled}
|
384
|
+
disabled={!column.toggable || enableSorting}
|
385
|
+
onChange={this.updateToggledColumn.bind(
|
386
|
+
this,
|
387
|
+
column,
|
388
|
+
index
|
389
|
+
)}
|
390
|
+
>
|
391
|
+
<span>
|
392
|
+
{column.label ? render('tpl', column.label) : null}
|
393
|
+
</span>
|
394
|
+
</Checkbox>
|
395
|
+
)}
|
396
|
+
</li>
|
397
|
+
</TooltipWrapper>
|
398
|
+
))
|
399
|
+
: null}
|
400
|
+
</ul>
|
401
|
+
|
402
|
+
<footer className={cx('ColumnToggler-modal-footer')}>
|
403
|
+
<div>
|
404
|
+
<Button
|
405
|
+
className={cx(`ColumnToggler-modeSelect`, {
|
406
|
+
'is-actived': !enableSorting
|
407
|
+
})}
|
408
|
+
onClick={() => this.setState({enableSorting: false})}
|
409
|
+
level="link"
|
410
|
+
>
|
411
|
+
{__('Table.toggleColumn')}
|
412
|
+
</Button>
|
413
|
+
<Button
|
414
|
+
className={cx(`ColumnToggler-modeSelect`, {
|
415
|
+
'is-actived': enableSorting
|
416
|
+
})}
|
417
|
+
onClick={() =>
|
418
|
+
this.setState(
|
419
|
+
{enableSorting: true},
|
420
|
+
() =>
|
421
|
+
this.state.enableSorting &&
|
422
|
+
this.props.draggable &&
|
423
|
+
this.initDragging()
|
424
|
+
)
|
425
|
+
}
|
426
|
+
level="link"
|
427
|
+
disabled={tempColumns.length < 2}
|
428
|
+
>
|
429
|
+
{__('sort')}
|
430
|
+
</Button>
|
431
|
+
</div>
|
432
|
+
<div>
|
433
|
+
<Button className="mr-4" onClick={this.close}>
|
434
|
+
{__('cancel')}
|
435
|
+
</Button>
|
436
|
+
<Button level="primary" onClick={this.onConfirm}>
|
437
|
+
{__('confirm')}
|
438
|
+
</Button>
|
439
|
+
</div>
|
440
|
+
</footer>
|
441
|
+
</Modal>
|
442
|
+
</>
|
443
|
+
);
|
444
|
+
}
|
445
|
+
|
446
|
+
render() {
|
447
|
+
const {
|
448
|
+
tooltip,
|
449
|
+
placement,
|
450
|
+
tooltipContainer,
|
451
|
+
tooltipTrigger,
|
452
|
+
tooltipRootClose,
|
453
|
+
disabledTip,
|
454
|
+
block,
|
455
|
+
disabled,
|
456
|
+
btnDisabled,
|
457
|
+
btnClassName,
|
458
|
+
size,
|
459
|
+
label,
|
460
|
+
level,
|
461
|
+
primary,
|
462
|
+
className,
|
463
|
+
classnames: cx,
|
464
|
+
align,
|
465
|
+
iconOnly,
|
466
|
+
icon,
|
467
|
+
isActived,
|
468
|
+
data,
|
469
|
+
draggable,
|
470
|
+
hideExpandIcon
|
471
|
+
} = this.props;
|
472
|
+
|
473
|
+
const button = (
|
474
|
+
<button
|
475
|
+
onClick={this.toggle}
|
476
|
+
disabled={disabled || btnDisabled}
|
477
|
+
className={cx(
|
478
|
+
'Button',
|
479
|
+
btnClassName,
|
480
|
+
typeof level === 'undefined'
|
481
|
+
? 'Button--default'
|
482
|
+
: level
|
483
|
+
? `Button--${level}`
|
484
|
+
: '',
|
485
|
+
{
|
486
|
+
'Button--block': block,
|
487
|
+
'Button--primary': primary,
|
488
|
+
'Button--iconOnly': iconOnly
|
489
|
+
},
|
490
|
+
size ? `Button--${size}` : ''
|
491
|
+
)}
|
492
|
+
>
|
493
|
+
{icon ? (
|
494
|
+
typeof icon === 'string' ? (
|
495
|
+
<i className={cx(icon, 'm-r-xs')} />
|
496
|
+
) : (
|
497
|
+
icon
|
498
|
+
)
|
499
|
+
) : null}
|
500
|
+
{typeof label === 'string' ? filter(label, data) : label}
|
501
|
+
{hideExpandIcon || draggable ? null : (
|
502
|
+
<span className={cx('ColumnToggler-caret')}>
|
503
|
+
<Icon icon="caret" className="icon" />
|
504
|
+
</span>
|
505
|
+
)}
|
506
|
+
</button>
|
507
|
+
);
|
508
|
+
|
509
|
+
return (
|
510
|
+
<div
|
511
|
+
className={cx(
|
512
|
+
'ColumnToggler',
|
513
|
+
{
|
514
|
+
'ColumnToggler-block': block,
|
515
|
+
'ColumnToggler--alignRight': align === 'right',
|
516
|
+
'is-opened': this.state.isOpened,
|
517
|
+
'is-actived': isActived
|
518
|
+
},
|
519
|
+
className
|
520
|
+
)}
|
521
|
+
ref={this.domRef}
|
522
|
+
>
|
523
|
+
{draggable ? (
|
524
|
+
button
|
525
|
+
) : (
|
526
|
+
<TooltipWrapper
|
527
|
+
placement={placement}
|
528
|
+
tooltip={disabled ? disabledTip : tooltip}
|
529
|
+
container={tooltipContainer}
|
530
|
+
trigger={tooltipTrigger}
|
531
|
+
rootClose={tooltipRootClose}
|
532
|
+
>
|
533
|
+
{button}
|
534
|
+
</TooltipWrapper>
|
535
|
+
)}
|
536
|
+
{this.state.isOpened
|
537
|
+
? draggable
|
538
|
+
? this.renderModal()
|
539
|
+
: this.renderOuter()
|
540
|
+
: null}
|
541
|
+
</div>
|
542
|
+
);
|
543
|
+
}
|
544
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import {observer} from 'mobx-react';
|
2
|
+
import React, {useEffect, useRef} from 'react';
|
3
|
+
import {ITableStore} from '../../store/table';
|
4
|
+
import {ClassNamesFn} from '../../theme';
|
5
|
+
|
6
|
+
export interface ItemActionsProps {
|
7
|
+
classnames: ClassNamesFn;
|
8
|
+
children: JSX.Element;
|
9
|
+
store: ITableStore;
|
10
|
+
}
|
11
|
+
|
12
|
+
function ItemActionsWrapper(props: ItemActionsProps) {
|
13
|
+
const cx = props.classnames;
|
14
|
+
const children = props.children;
|
15
|
+
const store = props.store;
|
16
|
+
const divRef = useRef<HTMLDivElement>(null);
|
17
|
+
|
18
|
+
useEffect(() => {
|
19
|
+
const row = store.hoverRow!;
|
20
|
+
if (!row) {
|
21
|
+
return;
|
22
|
+
}
|
23
|
+
|
24
|
+
const frame = divRef.current!.parentElement?.querySelector(
|
25
|
+
'table'
|
26
|
+
) as HTMLElement;
|
27
|
+
const dom = frame?.querySelector(`tr[data-id="${row.id}"]`) as HTMLElement;
|
28
|
+
if (!dom) {
|
29
|
+
return;
|
30
|
+
}
|
31
|
+
const rect = dom.getBoundingClientRect();
|
32
|
+
const height = rect.height;
|
33
|
+
const top = rect.top - frame.getBoundingClientRect().top;
|
34
|
+
divRef.current!.style.cssText += `top: ${top}px;height: ${height}px;`;
|
35
|
+
}, [store.hoverRow?.id]);
|
36
|
+
|
37
|
+
return (
|
38
|
+
<div className={cx('Table-itemActions-wrap')} ref={divRef}>
|
39
|
+
{children}
|
40
|
+
</div>
|
41
|
+
);
|
42
|
+
}
|
43
|
+
|
44
|
+
export default observer(ItemActionsWrapper);
|
@@ -6,11 +6,13 @@ import PopOverable from '../PopOver';
|
|
6
6
|
import {observer} from 'mobx-react';
|
7
7
|
import omit = require('lodash/omit');
|
8
8
|
import {filter} from '../../utils/tpl';
|
9
|
+
import {Badge} from '../../components/Badge';
|
9
10
|
|
10
11
|
export interface TableCellProps extends RendererProps {
|
11
12
|
wrapperComponent?: React.ReactType;
|
12
13
|
column: object;
|
13
14
|
}
|
15
|
+
|
14
16
|
export class TableCell extends React.Component<RendererProps> {
|
15
17
|
static defaultProps = {
|
16
18
|
wrapperComponent: 'td'
|
@@ -51,9 +53,12 @@ export class TableCell extends React.Component<RendererProps> {
|
|
51
53
|
prefix,
|
52
54
|
affix,
|
53
55
|
isHead,
|
56
|
+
colIndex,
|
57
|
+
row,
|
58
|
+
showBadge,
|
59
|
+
itemBadge,
|
54
60
|
...rest
|
55
61
|
} = this.props;
|
56
|
-
|
57
62
|
const schema = {
|
58
63
|
...column,
|
59
64
|
className: innerClassName,
|
@@ -120,6 +125,16 @@ export class TableCell extends React.Component<RendererProps> {
|
|
120
125
|
tabIndex={tabIndex}
|
121
126
|
onKeyUp={onKeyUp}
|
122
127
|
>
|
128
|
+
{showBadge ? (
|
129
|
+
<Badge
|
130
|
+
classnames={cx}
|
131
|
+
badge={{
|
132
|
+
...itemBadge,
|
133
|
+
className: cx(`Table-badge`, itemBadge?.className)
|
134
|
+
}}
|
135
|
+
data={row.data}
|
136
|
+
/>
|
137
|
+
) : null}
|
123
138
|
{prefix}
|
124
139
|
{body}
|
125
140
|
{affix}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import {ClassNamesFn} from '../../theme';
|
3
|
-
import {IColumn, IRow} from '../../store/table';
|
3
|
+
import {IColumn, IRow, ITableStore} from '../../store/table';
|
4
4
|
import {SchemaNode, Action} from '../../types';
|
5
5
|
import {TableBody} from './TableBody';
|
6
6
|
import {LocaleProps} from '../../locale';
|
7
7
|
import {observer} from 'mobx-react';
|
8
8
|
import {ActionSchema} from '../Action';
|
9
|
+
import ItemActionsWrapper from './ItemActionsWrapper';
|
9
10
|
|
10
11
|
export interface TableContentProps extends LocaleProps {
|
11
12
|
className?: string;
|
@@ -50,10 +51,45 @@ export interface TableContentProps extends LocaleProps {
|
|
50
51
|
prefixRow?: Array<any>;
|
51
52
|
affixRow?: Array<any>;
|
52
53
|
itemAction?: ActionSchema;
|
54
|
+
itemActions?: Array<Action>;
|
55
|
+
store: ITableStore;
|
53
56
|
}
|
54
57
|
|
55
58
|
@observer
|
56
59
|
export class TableContent extends React.Component<TableContentProps> {
|
60
|
+
renderItemActions() {
|
61
|
+
const {itemActions, render, store, classnames: cx} = this.props;
|
62
|
+
const finalActions = Array.isArray(itemActions)
|
63
|
+
? itemActions.filter(action => !action.hiddenOnHover)
|
64
|
+
: [];
|
65
|
+
|
66
|
+
if (!finalActions.length) {
|
67
|
+
return null;
|
68
|
+
}
|
69
|
+
|
70
|
+
return (
|
71
|
+
<ItemActionsWrapper store={store} classnames={cx}>
|
72
|
+
<div className={cx('Table-itemActions')}>
|
73
|
+
{finalActions.map((action, index) =>
|
74
|
+
render(
|
75
|
+
`itemAction/${index}`,
|
76
|
+
{
|
77
|
+
...(action as any),
|
78
|
+
isMenuItem: true
|
79
|
+
},
|
80
|
+
{
|
81
|
+
key: index,
|
82
|
+
item: store.hoverRow,
|
83
|
+
data: store.hoverRow!.locals,
|
84
|
+
rowIndex: store.hoverRow!.index
|
85
|
+
}
|
86
|
+
)
|
87
|
+
)}
|
88
|
+
</div>
|
89
|
+
</ItemActionsWrapper>
|
90
|
+
);
|
91
|
+
}
|
92
|
+
|
57
93
|
render() {
|
58
94
|
const {
|
59
95
|
placeholder,
|
@@ -82,7 +118,8 @@ export class TableContent extends React.Component<TableContentProps> {
|
|
82
118
|
locale,
|
83
119
|
translate,
|
84
120
|
itemAction,
|
85
|
-
affixRow
|
121
|
+
affixRow,
|
122
|
+
store
|
86
123
|
} = this.props;
|
87
124
|
|
88
125
|
const tableClassName = cx('Table-table', this.props.tableClassName);
|
@@ -94,6 +131,7 @@ export class TableContent extends React.Component<TableContentProps> {
|
|
94
131
|
className={cx('Table-content', className)}
|
95
132
|
onScroll={onScroll}
|
96
133
|
>
|
134
|
+
{store.hoverRow ? this.renderItemActions() : null}
|
97
135
|
<table ref={tableRef} className={tableClassName}>
|
98
136
|
<thead>
|
99
137
|
{columnsGroup.length ? (
|