amis-ui 3.5.2 → 3.6.0
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/esm/components/404.js +1 -1
- package/esm/components/Alert.js +1 -1
- package/esm/components/Alert2.d.ts +11 -10
- package/esm/components/Alert2.js +3 -2
- package/esm/components/AnchorNav.js +1 -1
- package/esm/components/ArrayInput.js +1 -1
- package/esm/components/AsideNav.js +1 -1
- package/esm/components/AssociatedSelection.d.ts +40 -40
- package/esm/components/AssociatedSelection.js +7 -7
- package/esm/components/Avatar.js +1 -1
- package/esm/components/Badge.js +1 -1
- package/esm/components/BaiduMapPicker.d.ts +3 -1
- package/esm/components/BaiduMapPicker.js +37 -18
- package/esm/components/BarCode.js +1 -1
- package/esm/components/Breadcrumb.js +1 -1
- package/esm/components/Button.d.ts +10 -10
- package/esm/components/Button.js +1 -1
- package/esm/components/CalendarMobile.js +1 -1
- package/esm/components/Card.d.ts +10 -10
- package/esm/components/Card.js +1 -1
- package/esm/components/Cascader.js +1 -1
- package/esm/components/ChainedDropdownSelection.d.ts +40 -40
- package/esm/components/ChainedDropdownSelection.js +1 -1
- package/esm/components/ChainedSelection.d.ts +40 -40
- package/esm/components/ChainedSelection.js +6 -6
- package/esm/components/Checkbox.js +1 -1
- package/esm/components/CityArea.js +1 -1
- package/esm/components/CityDB.js +1 -1
- package/esm/components/CodeMirror.js +1 -1
- package/esm/components/Collapse.js +1 -1
- package/esm/components/CollapseGroup.js +1 -1
- package/esm/components/ColorPicker.js +1 -1
- package/esm/components/Combo.js +1 -1
- package/esm/components/ConfirmBox.js +1 -1
- package/esm/components/ContextMenu.js +1 -1
- package/esm/components/DatePicker.d.ts +52 -41
- package/esm/components/DatePicker.js +114 -27
- package/esm/components/DateRangePicker.d.ts +18 -10
- package/esm/components/DateRangePicker.js +39 -11
- package/esm/components/DndContainer.js +1 -1
- package/esm/components/Drawer.js +3 -2
- package/esm/components/DropDownSelection.d.ts +40 -40
- package/esm/components/DropDownSelection.js +1 -1
- package/esm/components/Editor.js +1 -1
- package/esm/components/Form.js +1 -1
- package/esm/components/FormField.js +1 -1
- package/esm/components/GaodeMapPicker.js +1 -1
- package/esm/components/GridNav.js +1 -1
- package/esm/components/GroupedSelection.d.ts +40 -40
- package/esm/components/GroupedSelection.js +1 -1
- package/esm/components/Html.js +1 -1
- package/esm/components/ImageGallery.js +1 -1
- package/esm/components/Input.js +1 -1
- package/esm/components/InputBox.d.ts +10 -10
- package/esm/components/InputBox.js +1 -1
- package/esm/components/InputBoxWithSuggestion.js +1 -1
- package/esm/components/InputTable.js +1 -1
- package/esm/components/Layout.js +1 -1
- package/esm/components/Link.js +1 -1
- package/esm/components/ListGroup.d.ts +10 -10
- package/esm/components/ListGroup.js +1 -1
- package/esm/components/ListMenu.js +1 -1
- package/esm/components/LocationPicker.d.ts +84 -40
- package/esm/components/LocationPicker.js +7 -6
- package/esm/components/Markdown.js +11 -1
- package/esm/components/Modal.d.ts +54 -0
- package/esm/components/Modal.js +93 -7
- package/esm/components/ModalManager.js +1 -1
- package/esm/components/MultilineText.js +1 -1
- package/esm/components/NumberInput.js +1 -1
- package/esm/components/Pagination.d.ts +40 -41
- package/esm/components/Pagination.js +9 -18
- package/esm/components/Picker.js +1 -1
- package/esm/components/PickerColumn.js +1 -1
- package/esm/components/PickerContainer.js +1 -1
- package/esm/components/PopOverContainer.js +1 -1
- package/esm/components/PopUp.js +1 -1
- package/esm/components/Progress.js +1 -1
- package/esm/components/PullRefresh.js +1 -1
- package/esm/components/Radios.js +1 -1
- package/esm/components/Range.js +9 -3
- package/esm/components/Rating.js +1 -1
- package/esm/components/ResultBox.d.ts +40 -40
- package/esm/components/ResultBox.js +1 -1
- package/esm/components/ResultList.js +1 -1
- package/esm/components/ResultTableList.d.ts +40 -40
- package/esm/components/ResultTableList.js +1 -1
- package/esm/components/ResultTreeList.d.ts +40 -40
- package/esm/components/ResultTreeList.js +1 -1
- package/esm/components/RichText.js +13 -4
- package/esm/components/SearchBox.js +1 -1
- package/esm/components/Select.d.ts +4 -0
- package/esm/components/Select.js +44 -40
- package/esm/components/SelectMobile.js +1 -1
- package/esm/components/Selection.d.ts +41 -40
- package/esm/components/Selection.js +1 -1
- package/esm/components/SparkLine.d.ts +44 -42
- package/esm/components/SparkLine.js +4 -4
- package/esm/components/Spinner.d.ts +13 -0
- package/esm/components/Spinner.js +8 -6
- package/esm/components/Steps.js +1 -1
- package/esm/components/Switch.d.ts +15 -10
- package/esm/components/Switch.js +13 -5
- package/esm/components/TableSelection.d.ts +40 -40
- package/esm/components/TableSelection.js +1 -1
- package/esm/components/Tabs.d.ts +1 -0
- package/esm/components/Tabs.js +2 -2
- package/esm/components/TabsTransfer.d.ts +40 -40
- package/esm/components/TabsTransfer.js +3 -3
- package/esm/components/TabsTransferPicker.js +1 -1
- package/esm/components/Tag.js +1 -1
- package/esm/components/Textarea.js +6 -2
- package/esm/components/Timeline.js +1 -1
- package/esm/components/TimelineItem.js +1 -1
- package/esm/components/Tinymce.d.ts +2 -1
- package/esm/components/Tinymce.js +30 -15
- package/esm/components/TitleBar.js +1 -1
- package/esm/components/Toast.js +1 -1
- package/esm/components/Tooltip.js +1 -1
- package/esm/components/TooltipWrapper.d.ts +11 -10
- package/esm/components/TooltipWrapper.js +1 -1
- package/esm/components/Transfer.d.ts +96 -40
- package/esm/components/Transfer.js +25 -11
- package/esm/components/TransferDropDown.d.ts +40 -40
- package/esm/components/TransferDropDown.js +1 -1
- package/esm/components/TransferPicker.js +1 -1
- package/esm/components/TransferSearch.js +1 -1
- package/esm/components/Tree.d.ts +51 -3
- package/esm/components/Tree.js +12 -11
- package/esm/components/TreeSelection.d.ts +40 -40
- package/esm/components/TreeSelection.js +11 -11
- package/esm/components/UserSelect.d.ts +42 -0
- package/esm/components/UserSelect.js +5 -4
- package/esm/components/UserTabSelect.js +1 -1
- package/esm/components/WithRemoteConfig.js +14 -2
- package/esm/components/WithStore.js +1 -1
- package/esm/components/calendar/Calendar.d.ts +9 -1
- package/esm/components/calendar/Calendar.js +27 -5
- package/esm/components/calendar/CalendarContainer.js +1 -1
- package/esm/components/calendar/DaysView.d.ts +11 -0
- package/esm/components/calendar/DaysView.js +44 -8
- package/esm/components/calendar/MonthsView.d.ts +5 -0
- package/esm/components/calendar/MonthsView.js +18 -3
- package/esm/components/calendar/QuartersView.js +1 -1
- package/esm/components/calendar/TimeView.js +1 -1
- package/esm/components/calendar/YearsView.js +1 -1
- package/esm/components/condition-builder/Expression.js +1 -1
- package/esm/components/condition-builder/Field.js +1 -1
- package/esm/components/condition-builder/Func.js +1 -1
- package/esm/components/condition-builder/Group.js +1 -1
- package/esm/components/condition-builder/GroupOrItem.js +1 -1
- package/esm/components/condition-builder/InputSwitch.js +1 -1
- package/esm/components/condition-builder/Item.js +6 -2
- package/esm/components/condition-builder/Value.js +1 -1
- package/esm/components/condition-builder/config.js +7 -1
- package/esm/components/condition-builder/index.js +1 -1
- package/esm/components/formula/Editor.js +1 -1
- package/esm/components/formula/FuncList.js +1 -1
- package/esm/components/formula/Input.js +2 -2
- package/esm/components/formula/Picker.js +1 -1
- package/esm/components/formula/VariableList.js +1 -1
- package/esm/components/formula/plugin.js +1 -1
- package/esm/components/icons.js +23 -6
- package/esm/components/json-schema/Array.js +1 -1
- package/esm/components/json-schema/Item.js +1 -1
- package/esm/components/json-schema/Object.js +1 -1
- package/esm/components/json-schema/index.js +1 -1
- package/esm/components/menu/MenuContext.js +1 -1
- package/esm/components/menu/MenuItem.js +1 -1
- package/esm/components/menu/SubMenu.js +1 -1
- package/esm/components/menu/index.d.ts +17 -17
- package/esm/components/menu/index.js +5 -4
- package/esm/components/schema-editor/Array.js +1 -1
- package/esm/components/schema-editor/Common.js +1 -1
- package/esm/components/schema-editor/Item.js +1 -1
- package/esm/components/schema-editor/Object.js +1 -1
- package/esm/components/schema-editor/SchemaVariableList.js +1 -1
- package/esm/components/schema-editor/SchemaVariableListPicker.js +1 -1
- package/esm/components/schema-editor/index.js +1 -1
- package/esm/components/table/Cell.d.ts +3 -455
- package/esm/components/table/Cell.js +6 -8
- package/esm/components/table/ColGroup.d.ts +8 -3
- package/esm/components/table/ColGroup.js +28 -22
- package/esm/components/table/Head.d.ts +42 -0
- package/esm/components/table/Head.js +142 -0
- package/esm/components/table/HeadCellDropDown.d.ts +1 -1
- package/esm/components/table/HeadCellDropDown.js +5 -3
- package/esm/components/table/HeadCellFilter.d.ts +41 -41
- package/esm/components/table/HeadCellFilter.js +2 -2
- package/esm/components/table/HeadCellSelect.d.ts +1 -1
- package/esm/components/table/HeadCellSelect.js +2 -2
- package/esm/components/table/HeadCellSort.d.ts +1 -1
- package/esm/components/table/HeadCellSort.js +2 -2
- package/esm/components/table/ItemActionsWrapper.d.ts +1 -1
- package/esm/components/table/ItemActionsWrapper.js +2 -2
- package/esm/components/table/Row.d.ts +60 -0
- package/esm/components/table/Row.js +183 -0
- package/esm/components/table/SummaryRow.d.ts +28 -0
- package/esm/components/table/SummaryRow.js +73 -0
- package/esm/components/table/index.d.ts +62 -67
- package/esm/components/table/index.js +347 -646
- package/esm/components/table/util.d.ts +54 -0
- package/esm/components/table/util.js +207 -0
- package/esm/components/virtual-list/AutoSizer.js +1 -1
- package/esm/components/virtual-list/SizeAndPositionManager.js +1 -1
- package/esm/components/virtual-list/constants.js +1 -1
- package/esm/components/virtual-list/index.js +1 -1
- package/esm/hooks/use-set-state.js +1 -1
- package/esm/hooks/use-sub-form.js +1 -1
- package/esm/hooks/use-touch.js +1 -1
- package/esm/hooks/use-update-effect.js +1 -1
- package/esm/hooks/use-validation-resolver.js +1 -1
- package/esm/icons/alert-danger.svg.js +1 -1
- package/esm/icons/alert-info.svg.js +1 -1
- package/esm/icons/alert-success.svg.js +1 -1
- package/esm/icons/alert-warning.svg.js +1 -1
- package/esm/icons/back.svg.js +1 -1
- package/esm/icons/calendar.svg.js +1 -1
- package/esm/icons/caret.svg.js +1 -1
- package/esm/icons/check.svg.js +1 -1
- package/esm/icons/clock.svg.js +1 -1
- package/esm/icons/close-small.svg.js +1 -1
- package/esm/icons/close.svg.js +1 -1
- package/esm/icons/cloud-upload.svg.js +1 -1
- package/esm/icons/column-filter.svg.js +1 -1
- package/esm/icons/columns.svg.js +1 -1
- package/esm/icons/compress-alt.svg.js +1 -1
- package/esm/icons/copy.svg.js +1 -1
- package/esm/icons/date.svg.js +1 -1
- package/esm/icons/department.svg.js +1 -1
- package/esm/icons/desk-empty.svg.js +1 -1
- package/esm/icons/dot.svg.js +1 -1
- package/esm/icons/down-arrow-bold.svg.js +1 -1
- package/esm/icons/down.svg.js +1 -1
- package/esm/icons/download.svg.js +1 -1
- package/esm/icons/drag-bar.svg.js +1 -1
- package/esm/icons/drag.svg.js +1 -1
- package/esm/icons/edit.svg.js +1 -1
- package/esm/icons/ellipsis-v.svg.js +1 -1
- package/esm/icons/enter.svg.js +1 -1
- package/esm/icons/exchange.svg.js +1 -1
- package/esm/icons/expand-alt.svg.js +1 -1
- package/esm/icons/fail.svg.js +1 -1
- package/esm/icons/file.svg.js +1 -1
- package/esm/icons/filter.svg.js +1 -1
- package/esm/icons/folder.svg.js +1 -1
- package/esm/icons/function.svg.js +1 -1
- package/esm/icons/home.svg.js +1 -1
- package/esm/icons/if.svg.js +1 -1
- package/esm/icons/image.svg.js +1 -1
- package/esm/icons/info-circle.svg.js +1 -1
- package/esm/icons/info.svg.js +1 -1
- package/esm/icons/input-clear.svg.js +1 -1
- package/esm/icons/invisible.svg.js +1 -1
- package/esm/icons/left-arrow.svg.js +1 -1
- package/esm/icons/loading-outline.svg.js +1 -1
- package/esm/icons/location.svg.js +1 -1
- package/esm/icons/menu.svg.js +1 -1
- package/esm/icons/minus.svg.js +1 -1
- package/esm/icons/move.svg.js +1 -1
- package/esm/icons/mute.svg.js +1 -1
- package/esm/icons/new-edit.svg.js +1 -1
- package/esm/icons/pause.svg.js +1 -1
- package/esm/icons/pencil.svg.js +1 -1
- package/esm/icons/play.svg.js +1 -1
- package/esm/icons/plus-cicle.svg.js +1 -1
- package/esm/icons/plus-fine.svg.js +1 -1
- package/esm/icons/plus.svg.js +1 -1
- package/esm/icons/post.svg.js +1 -1
- package/esm/icons/question-mark.svg.js +1 -1
- package/esm/icons/question.svg.js +1 -1
- package/esm/icons/redo.svg.js +1 -1
- package/esm/icons/refresh.svg.js +1 -1
- package/esm/icons/reload.svg.js +1 -1
- package/esm/icons/remove.svg.js +1 -1
- package/esm/icons/retry.svg.js +1 -1
- package/esm/icons/right-arrow-bold.svg.js +1 -1
- package/esm/icons/right-arrow.svg.js +1 -1
- package/esm/icons/right-double-arrow.svg.js +1 -1
- package/esm/icons/role.svg.js +1 -1
- package/esm/icons/rotate-left.svg.js +1 -1
- package/esm/icons/rotate-right.svg.js +1 -1
- package/esm/icons/scale-origin.svg.js +1 -1
- package/esm/icons/schedule.svg.js +1 -1
- package/esm/icons/search.svg.js +1 -1
- package/esm/icons/setting.svg.js +1 -1
- package/esm/icons/slider-handle-icon.svg.js +1 -1
- package/esm/icons/sort-asc.svg.js +1 -1
- package/esm/icons/sort-default.svg.js +1 -1
- package/esm/icons/sort-desc.svg.js +1 -1
- package/esm/icons/star.svg.js +1 -1
- package/esm/icons/status-close.svg.js +1 -1
- package/esm/icons/steps-finsh.svg.js +1 -1
- package/esm/icons/success.svg.js +1 -1
- package/esm/icons/transparent.svg.js +1 -1
- package/esm/icons/trash.svg.js +1 -1
- package/esm/icons/tree-down.svg.js +1 -1
- package/esm/icons/undo.svg.js +1 -1
- package/esm/icons/upload.svg.js +1 -1
- package/esm/icons/user-remove.svg.js +1 -1
- package/esm/icons/view.svg.js +1 -1
- package/esm/icons/volume.svg.js +1 -1
- package/esm/icons/warning-mark.svg.js +1 -1
- package/esm/icons/warning.svg.js +1 -1
- package/esm/icons/window-restore.svg.js +1 -1
- package/esm/icons/zoom-in.svg.js +1 -1
- package/esm/icons/zoom-out.svg.js +1 -1
- package/esm/index.js +1 -1
- package/esm/locale/de-DE.js +4 -1
- package/esm/locale/en-US.js +4 -1
- package/esm/locale/zh-CN.js +4 -1
- package/esm/themes/ang.js +1 -1
- package/esm/themes/antd.js +1 -1
- package/esm/themes/cxd.js +1 -1
- package/esm/themes/dark.js +1 -1
- package/lib/components/404.js +1 -1
- package/lib/components/Alert.d.ts +120 -120
- package/lib/components/Alert.js +1 -1
- package/lib/components/Alert2.d.ts +21 -20
- package/lib/components/Alert2.js +3 -2
- package/lib/components/AnchorNav.d.ts +20 -20
- package/lib/components/AnchorNav.js +1 -1
- package/lib/components/ArrayInput.d.ts +40 -40
- package/lib/components/ArrayInput.js +1 -1
- package/lib/components/AsideNav.js +1 -1
- package/lib/components/AssociatedSelection.d.ts +80 -80
- package/lib/components/AssociatedSelection.js +7 -7
- package/lib/components/Avatar.d.ts +90 -90
- package/lib/components/Avatar.js +1 -1
- package/lib/components/Badge.js +1 -1
- package/lib/components/BaiduMapPicker.d.ts +3 -1
- package/lib/components/BaiduMapPicker.js +37 -18
- package/lib/components/BarCode.js +1 -1
- package/lib/components/Breadcrumb.js +1 -1
- package/lib/components/Button.d.ts +20 -20
- package/lib/components/Button.js +1 -1
- package/lib/components/CalendarMobile.d.ts +40 -40
- package/lib/components/CalendarMobile.js +1 -1
- package/lib/components/Card.d.ts +100 -100
- package/lib/components/Card.js +1 -1
- package/lib/components/Cascader.js +1 -1
- package/lib/components/ChainedDropdownSelection.d.ts +80 -80
- package/lib/components/ChainedDropdownSelection.js +1 -1
- package/lib/components/ChainedSelection.d.ts +80 -80
- package/lib/components/ChainedSelection.js +6 -6
- package/lib/components/Checkbox.d.ts +10 -10
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/CityArea.js +1 -1
- package/lib/components/CityDB.js +1 -1
- package/lib/components/CodeMirror.js +1 -1
- package/lib/components/Collapse.d.ts +120 -120
- package/lib/components/Collapse.js +1 -1
- package/lib/components/CollapseGroup.d.ts +20 -20
- package/lib/components/CollapseGroup.js +1 -1
- package/lib/components/ColorPicker.d.ts +40 -40
- package/lib/components/ColorPicker.js +1 -1
- package/lib/components/Combo.js +1 -1
- package/lib/components/ConfirmBox.d.ts +80 -80
- package/lib/components/ConfirmBox.js +1 -1
- package/lib/components/ContextMenu.js +1 -1
- package/lib/components/DatePicker.d.ts +132 -121
- package/lib/components/DatePicker.js +112 -25
- package/lib/components/DateRangePicker.d.ts +338 -330
- package/lib/components/DateRangePicker.js +39 -11
- package/lib/components/DndContainer.js +1 -1
- package/lib/components/Drawer.d.ts +30 -30
- package/lib/components/Drawer.js +3 -2
- package/lib/components/DropDownSelection.d.ts +80 -80
- package/lib/components/DropDownSelection.js +1 -1
- package/lib/components/Editor.d.ts +120 -120
- package/lib/components/Editor.js +1 -1
- package/lib/components/Form.js +1 -1
- package/lib/components/FormField.js +1 -1
- package/lib/components/GaodeMapPicker.js +1 -1
- package/lib/components/GridNav.js +1 -1
- package/lib/components/GroupedSelection.d.ts +80 -80
- package/lib/components/GroupedSelection.js +1 -1
- package/lib/components/Html.js +1 -1
- package/lib/components/ImageGallery.d.ts +40 -40
- package/lib/components/ImageGallery.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/InputBox.d.ts +10 -10
- package/lib/components/InputBox.js +1 -1
- package/lib/components/InputBoxWithSuggestion.js +1 -1
- package/lib/components/InputTable.js +1 -1
- package/lib/components/Layout.d.ts +10 -10
- package/lib/components/Layout.js +1 -1
- package/lib/components/Link.js +1 -1
- package/lib/components/ListGroup.d.ts +10 -10
- package/lib/components/ListGroup.js +1 -1
- package/lib/components/ListMenu.d.ts +80 -80
- package/lib/components/ListMenu.js +1 -1
- package/lib/components/LocationPicker.d.ts +84 -40
- package/lib/components/LocationPicker.js +7 -6
- package/lib/components/Markdown.js +11 -1
- package/lib/components/Modal.d.ts +134 -80
- package/lib/components/Modal.js +93 -5
- package/lib/components/ModalManager.js +1 -1
- package/lib/components/MonthRangePicker.d.ts +160 -160
- package/lib/components/MultilineText.d.ts +40 -40
- package/lib/components/MultilineText.js +1 -1
- package/lib/components/NumberInput.d.ts +30 -30
- package/lib/components/NumberInput.js +1 -1
- package/lib/components/Pagination.d.ts +80 -81
- package/lib/components/Pagination.js +8 -17
- package/lib/components/Picker.js +1 -1
- package/lib/components/PickerColumn.js +1 -1
- package/lib/components/PickerContainer.js +1 -1
- package/lib/components/PopOverContainer.js +1 -1
- package/lib/components/PopUp.d.ts +80 -80
- package/lib/components/PopUp.js +1 -1
- package/lib/components/Progress.d.ts +60 -60
- package/lib/components/Progress.js +1 -1
- package/lib/components/PullRefresh.js +1 -1
- package/lib/components/Radios.d.ts +40 -40
- package/lib/components/Radios.js +1 -1
- package/lib/components/Range.js +9 -3
- package/lib/components/Rating.d.ts +20 -20
- package/lib/components/Rating.js +1 -1
- package/lib/components/ResultBox.d.ts +80 -80
- package/lib/components/ResultBox.js +1 -1
- package/lib/components/ResultList.d.ts +40 -40
- package/lib/components/ResultList.js +1 -1
- package/lib/components/ResultTableList.d.ts +80 -80
- package/lib/components/ResultTableList.js +1 -1
- package/lib/components/ResultTreeList.d.ts +40 -40
- package/lib/components/ResultTreeList.js +1 -1
- package/lib/components/RichText.js +13 -4
- package/lib/components/SearchBox.d.ts +120 -120
- package/lib/components/SearchBox.js +1 -1
- package/lib/components/Select.d.ts +1741 -1738
- package/lib/components/Select.js +44 -40
- package/lib/components/SelectMobile.js +1 -1
- package/lib/components/Selection.d.ts +81 -80
- package/lib/components/Selection.js +1 -1
- package/lib/components/SparkLine.d.ts +44 -42
- package/lib/components/SparkLine.js +3 -3
- package/lib/components/Spinner.d.ts +73 -60
- package/lib/components/Spinner.js +8 -6
- package/lib/components/Steps.js +1 -1
- package/lib/components/Switch.d.ts +15 -10
- package/lib/components/Switch.js +13 -5
- package/lib/components/TableSelection.d.ts +80 -80
- package/lib/components/TableSelection.js +1 -1
- package/lib/components/Tabs.d.ts +81 -80
- package/lib/components/Tabs.js +2 -2
- package/lib/components/TabsTransfer.d.ts +40 -40
- package/lib/components/TabsTransfer.js +3 -3
- package/lib/components/TabsTransferPicker.js +1 -1
- package/lib/components/Tag.d.ts +60 -60
- package/lib/components/Tag.js +1 -1
- package/lib/components/Textarea.d.ts +40 -40
- package/lib/components/Textarea.js +6 -2
- package/lib/components/Timeline.js +1 -1
- package/lib/components/TimelineItem.js +1 -1
- package/lib/components/Tinymce.d.ts +2 -1
- package/lib/components/Tinymce.js +29 -14
- package/lib/components/TitleBar.d.ts +10 -10
- package/lib/components/TitleBar.js +1 -1
- package/lib/components/Toast.d.ts +80 -80
- package/lib/components/Toast.js +1 -1
- package/lib/components/Tooltip.js +1 -1
- package/lib/components/TooltipWrapper.d.ts +31 -30
- package/lib/components/TooltipWrapper.js +1 -1
- package/lib/components/Transfer.d.ts +225 -169
- package/lib/components/Transfer.js +25 -11
- package/lib/components/TransferDropDown.d.ts +160 -160
- package/lib/components/TransferDropDown.js +1 -1
- package/lib/components/TransferPicker.js +1 -1
- package/lib/components/TransferSearch.js +1 -1
- package/lib/components/Tree.d.ts +291 -243
- package/lib/components/Tree.js +12 -11
- package/lib/components/TreeSelection.d.ts +120 -120
- package/lib/components/TreeSelection.js +11 -11
- package/lib/components/UserSelect.d.ts +82 -40
- package/lib/components/UserSelect.js +5 -4
- package/lib/components/UserTabSelect.d.ts +40 -40
- package/lib/components/UserTabSelect.js +1 -1
- package/lib/components/WithRemoteConfig.d.ts +0 -1
- package/lib/components/WithRemoteConfig.js +14 -2
- package/lib/components/WithStore.js +1 -1
- package/lib/components/calendar/Calendar.d.ts +9 -1
- package/lib/components/calendar/Calendar.js +27 -5
- package/lib/components/calendar/CalendarContainer.js +1 -1
- package/lib/components/calendar/DaysView.d.ts +11 -0
- package/lib/components/calendar/DaysView.js +44 -8
- package/lib/components/calendar/MonthsView.d.ts +5 -0
- package/lib/components/calendar/MonthsView.js +18 -3
- package/lib/components/calendar/QuartersView.js +1 -1
- package/lib/components/calendar/TimeView.js +1 -1
- package/lib/components/calendar/YearsView.js +1 -1
- package/lib/components/condition-builder/Expression.js +1 -1
- package/lib/components/condition-builder/Field.js +1 -1
- package/lib/components/condition-builder/Func.js +1 -1
- package/lib/components/condition-builder/Group.js +1 -1
- package/lib/components/condition-builder/GroupOrItem.js +1 -1
- package/lib/components/condition-builder/InputSwitch.js +1 -1
- package/lib/components/condition-builder/Item.js +6 -2
- package/lib/components/condition-builder/Value.js +1 -1
- package/lib/components/condition-builder/config.js +7 -1
- package/lib/components/condition-builder/index.d.ts +1 -1
- package/lib/components/condition-builder/index.js +1 -1
- package/lib/components/formula/Editor.d.ts +40 -40
- package/lib/components/formula/Editor.js +1 -1
- package/lib/components/formula/FuncList.js +1 -1
- package/lib/components/formula/Input.js +2 -2
- package/lib/components/formula/Picker.d.ts +40 -40
- package/lib/components/formula/Picker.js +1 -1
- package/lib/components/formula/VariableList.js +1 -1
- package/lib/components/formula/plugin.js +1 -1
- package/lib/components/icons.js +22 -5
- package/lib/components/json-schema/Array.js +1 -1
- package/lib/components/json-schema/Item.js +1 -1
- package/lib/components/json-schema/Object.js +1 -1
- package/lib/components/json-schema/index.js +1 -1
- package/lib/components/menu/MenuContext.js +1 -1
- package/lib/components/menu/MenuItem.js +1 -1
- package/lib/components/menu/SubMenu.js +1 -1
- package/lib/components/menu/index.d.ts +77 -77
- package/lib/components/menu/index.js +5 -5
- package/lib/components/schema-editor/Array.js +1 -1
- package/lib/components/schema-editor/Common.js +1 -1
- package/lib/components/schema-editor/Item.js +1 -1
- package/lib/components/schema-editor/Object.js +1 -1
- package/lib/components/schema-editor/SchemaVariableList.js +1 -1
- package/lib/components/schema-editor/SchemaVariableListPicker.js +1 -1
- package/lib/components/schema-editor/index.d.ts +40 -40
- package/lib/components/schema-editor/index.js +1 -1
- package/lib/components/table/Cell.d.ts +3 -455
- package/lib/components/table/Cell.js +6 -9
- package/lib/components/table/ColGroup.d.ts +8 -3
- package/lib/components/table/ColGroup.js +28 -23
- package/lib/components/table/Head.d.ts +42 -0
- package/lib/components/table/Head.js +149 -0
- package/lib/components/table/HeadCellDropDown.d.ts +1 -1
- package/lib/components/table/HeadCellDropDown.js +5 -3
- package/lib/components/table/HeadCellFilter.d.ts +81 -81
- package/lib/components/table/HeadCellFilter.js +2 -2
- package/lib/components/table/HeadCellSelect.d.ts +41 -41
- package/lib/components/table/HeadCellSelect.js +2 -2
- package/lib/components/table/HeadCellSort.d.ts +1 -1
- package/lib/components/table/HeadCellSort.js +2 -2
- package/lib/components/table/ItemActionsWrapper.d.ts +1 -1
- package/lib/components/table/ItemActionsWrapper.js +2 -2
- package/lib/components/table/Row.d.ts +60 -0
- package/lib/components/table/Row.js +190 -0
- package/lib/components/table/SummaryRow.d.ts +28 -0
- package/lib/components/table/SummaryRow.js +81 -0
- package/lib/components/table/index.d.ts +62 -67
- package/lib/components/table/index.js +344 -644
- package/lib/components/table/util.d.ts +54 -0
- package/lib/components/table/util.js +227 -0
- package/lib/components/virtual-list/AutoSizer.js +1 -1
- package/lib/components/virtual-list/SizeAndPositionManager.js +1 -1
- package/lib/components/virtual-list/constants.js +1 -1
- package/lib/components/virtual-list/index.js +1 -1
- package/lib/hooks/use-set-state.js +1 -1
- package/lib/hooks/use-sub-form.js +1 -1
- package/lib/hooks/use-touch.js +1 -1
- package/lib/hooks/use-update-effect.js +1 -1
- package/lib/hooks/use-validation-resolver.js +1 -1
- package/lib/icons/alert-danger.svg.js +1 -1
- package/lib/icons/alert-info.svg.js +1 -1
- package/lib/icons/alert-success.svg.js +1 -1
- package/lib/icons/alert-warning.svg.js +1 -1
- package/lib/icons/back.svg.js +1 -1
- package/lib/icons/calendar.svg.js +1 -1
- package/lib/icons/caret.svg.js +1 -1
- package/lib/icons/check.svg.js +1 -1
- package/lib/icons/clock.svg.js +1 -1
- package/lib/icons/close-small.svg.js +1 -1
- package/lib/icons/close.svg.js +1 -1
- package/lib/icons/cloud-upload.svg.js +1 -1
- package/lib/icons/column-filter.svg.js +1 -1
- package/lib/icons/columns.svg.js +1 -1
- package/lib/icons/compress-alt.svg.js +1 -1
- package/lib/icons/copy.svg.js +1 -1
- package/lib/icons/date.svg.js +1 -1
- package/lib/icons/department.svg.js +1 -1
- package/lib/icons/desk-empty.svg.js +1 -1
- package/lib/icons/dot.svg.js +1 -1
- package/lib/icons/down-arrow-bold.svg.js +1 -1
- package/lib/icons/down.svg.js +1 -1
- package/lib/icons/download.svg.js +1 -1
- package/lib/icons/drag-bar.svg.js +1 -1
- package/lib/icons/drag.svg.js +1 -1
- package/lib/icons/edit.svg.js +1 -1
- package/lib/icons/ellipsis-v.svg.js +1 -1
- package/lib/icons/enter.svg.js +1 -1
- package/lib/icons/exchange.svg.js +1 -1
- package/lib/icons/expand-alt.svg.js +1 -1
- package/lib/icons/fail.svg.js +1 -1
- package/lib/icons/file.svg.js +1 -1
- package/lib/icons/filter.svg.js +1 -1
- package/lib/icons/folder.svg.js +1 -1
- package/lib/icons/function.svg.js +1 -1
- package/lib/icons/home.svg.js +1 -1
- package/lib/icons/if.svg.js +1 -1
- package/lib/icons/image.svg.js +1 -1
- package/lib/icons/info-circle.svg.js +1 -1
- package/lib/icons/info.svg.js +1 -1
- package/lib/icons/input-clear.svg.js +1 -1
- package/lib/icons/invisible.svg.js +1 -1
- package/lib/icons/left-arrow.svg.js +1 -1
- package/lib/icons/loading-outline.svg.js +1 -1
- package/lib/icons/location.svg.js +1 -1
- package/lib/icons/menu.svg.js +1 -1
- package/lib/icons/minus.svg.js +1 -1
- package/lib/icons/move.svg.js +1 -1
- package/lib/icons/mute.svg.js +1 -1
- package/lib/icons/new-edit.svg.js +1 -1
- package/lib/icons/pause.svg.js +1 -1
- package/lib/icons/pencil.svg.js +1 -1
- package/lib/icons/play.svg.js +1 -1
- package/lib/icons/plus-cicle.svg.js +1 -1
- package/lib/icons/plus-fine.svg.js +1 -1
- package/lib/icons/plus.svg.js +1 -1
- package/lib/icons/post.svg.js +1 -1
- package/lib/icons/question-mark.svg.js +1 -1
- package/lib/icons/question.svg.js +1 -1
- package/lib/icons/redo.svg.js +1 -1
- package/lib/icons/refresh.svg.js +1 -1
- package/lib/icons/reload.svg.js +1 -1
- package/lib/icons/remove.svg.js +1 -1
- package/lib/icons/retry.svg.js +1 -1
- package/lib/icons/right-arrow-bold.svg.js +1 -1
- package/lib/icons/right-arrow.svg.js +1 -1
- package/lib/icons/right-double-arrow.svg.js +1 -1
- package/lib/icons/role.svg.js +1 -1
- package/lib/icons/rotate-left.svg.js +1 -1
- package/lib/icons/rotate-right.svg.js +1 -1
- package/lib/icons/scale-origin.svg.js +1 -1
- package/lib/icons/schedule.svg.js +1 -1
- package/lib/icons/search.svg.js +1 -1
- package/lib/icons/setting.svg.js +1 -1
- package/lib/icons/slider-handle-icon.svg.js +1 -1
- package/lib/icons/sort-asc.svg.js +1 -1
- package/lib/icons/sort-default.svg.js +1 -1
- package/lib/icons/sort-desc.svg.js +1 -1
- package/lib/icons/star.svg.js +1 -1
- package/lib/icons/status-close.svg.js +1 -1
- package/lib/icons/steps-finsh.svg.js +1 -1
- package/lib/icons/success.svg.js +1 -1
- package/lib/icons/transparent.svg.js +1 -1
- package/lib/icons/trash.svg.js +1 -1
- package/lib/icons/tree-down.svg.js +1 -1
- package/lib/icons/undo.svg.js +1 -1
- package/lib/icons/upload.svg.js +1 -1
- package/lib/icons/user-remove.svg.js +1 -1
- package/lib/icons/view.svg.js +1 -1
- package/lib/icons/volume.svg.js +1 -1
- package/lib/icons/warning-mark.svg.js +1 -1
- package/lib/icons/warning.svg.js +1 -1
- package/lib/icons/window-restore.svg.js +1 -1
- package/lib/icons/zoom-in.svg.js +1 -1
- package/lib/icons/zoom-out.svg.js +1 -1
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +4 -1
- package/lib/locale/en-US.js +4 -1
- package/lib/locale/zh-CN.js +4 -1
- package/lib/scss/helper.scss.js +1 -1
- package/lib/scss/themes/ang.scss.js +1 -1
- package/lib/scss/themes/antd.scss.js +1 -1
- package/lib/scss/themes/cxd.scss.js +1 -1
- package/lib/scss/themes/dark.scss.js +1 -1
- package/lib/scss/themes/default.scss.js +1 -1
- package/lib/themes/ang.css +220 -69
- package/lib/themes/ang.js +1 -1
- package/lib/themes/antd.css +222 -71
- package/lib/themes/antd.js +1 -1
- package/lib/themes/cxd.css +220 -69
- package/lib/themes/cxd.js +1 -1
- package/lib/themes/dark.css +220 -69
- package/lib/themes/dark.js +1 -1
- package/lib/themes/default.css +220 -69
- package/package.json +5 -6
- package/scss/_components.scss +22 -14
- package/scss/_properties.scss +7 -11
- package/scss/base/_common.scss +8 -0
- package/scss/components/_alert.scss +4 -0
- package/scss/components/_audio.scss +1 -1
- package/scss/components/_card.scss +2 -1
- package/scss/components/_dropdown.scss +4 -2
- package/scss/components/_menu.scss +7 -2
- package/scss/components/_modal.scss +4 -0
- package/scss/components/_page.scss +6 -6
- package/scss/components/_pagination.scss +41 -44
- package/scss/components/_progress.scss +1 -1
- package/scss/components/_spinner.scss +12 -0
- package/scss/components/_steps.scss +7 -5
- package/scss/components/_table.scss +16 -2
- package/scss/components/_table2.scss +7 -0
- package/scss/components/_tabs.scss +21 -24
- package/scss/components/form/_combo.scss +6 -0
- package/scss/components/form/_date-range.scss +3 -6
- package/scss/components/form/_date.scss +3 -5
- package/scss/components/form/_excel.scss +2 -2
- package/scss/components/form/_fieldset.scss +1 -1
- package/scss/components/form/_form.scss +2 -0
- package/scss/components/form/_location.scss +19 -1
- package/scss/components/form/_nested-select.scss +20 -7
- package/scss/components/form/_picker.scss +3 -1
- package/scss/components/form/_range.scss +2 -2
- package/scss/components/form/_rating.scss +17 -3
- package/scss/components/form/_select.scss +0 -11
- package/scss/components/form/_selection.scss +2 -1
- package/scss/components/form/_switch.scss +38 -0
- package/scss/components/form/_text.scss +9 -8
- package/scss/components/form/_textarea.scss +4 -0
- package/scss/components/form/_transfer.scss +40 -0
- package/scss/themes/_ang-variables.scss +63 -61
- package/scss/themes/_antd-variables.scss +63 -61
- package/scss/themes/_cxd-variables.scss +64 -61
- package/scss/themes/_dark-variables.scss +63 -61
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-ui v3.
|
|
2
|
+
* amis-ui v3.6.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -10,31 +10,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var tslib = require('tslib');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var ReactDOM = require('react-dom');
|
|
13
|
-
var findLastIndex = require('lodash/findLastIndex');
|
|
14
13
|
var find = require('lodash/find');
|
|
15
14
|
var isEqual = require('lodash/isEqual');
|
|
16
|
-
var filter = require('lodash/filter');
|
|
17
15
|
var debounce = require('lodash/debounce');
|
|
18
16
|
var intersection = require('lodash/intersection');
|
|
19
17
|
var Sortable = require('sortablejs');
|
|
20
18
|
var amisCore = require('amis-core');
|
|
21
|
-
var icons = require('../icons.js');
|
|
22
|
-
var Checkbox = require('../Checkbox.js');
|
|
23
19
|
var Spinner = require('../Spinner.js');
|
|
24
|
-
var HeadCellSort = require('./HeadCellSort.js');
|
|
25
|
-
var HeadCellFilter = require('./HeadCellFilter.js');
|
|
26
|
-
var HeadCellSelect = require('./HeadCellSelect.js');
|
|
27
20
|
var ItemActionsWrapper = require('./ItemActionsWrapper.js');
|
|
28
21
|
var Cell = require('./Cell.js');
|
|
29
22
|
var ColGroup = require('./ColGroup.js');
|
|
23
|
+
var Row = require('./Row.js');
|
|
24
|
+
var Head = require('./Head.js');
|
|
25
|
+
var SummaryRow = require('./SummaryRow.js');
|
|
26
|
+
var util = require('./util.js');
|
|
30
27
|
|
|
31
28
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
32
29
|
|
|
33
30
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
|
-
var findLastIndex__default = /*#__PURE__*/_interopDefaultLegacy(findLastIndex);
|
|
35
31
|
var find__default = /*#__PURE__*/_interopDefaultLegacy(find);
|
|
36
32
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
37
|
-
var filter__default = /*#__PURE__*/_interopDefaultLegacy(filter);
|
|
38
33
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
39
34
|
var intersection__default = /*#__PURE__*/_interopDefaultLegacy(intersection);
|
|
40
35
|
var Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
|
|
@@ -42,131 +37,26 @@ var Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
|
|
|
42
37
|
var __react_jsx__ = require('react');
|
|
43
38
|
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
44
39
|
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
45
|
-
function getMaxLevelThRowSpan(columns) {
|
|
46
|
-
var maxLevel = 0;
|
|
47
|
-
Array.isArray(columns) &&
|
|
48
|
-
columns.forEach(function (c) {
|
|
49
|
-
var level = getThRowSpan(c);
|
|
50
|
-
if (maxLevel < level) {
|
|
51
|
-
maxLevel = level;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return maxLevel;
|
|
55
|
-
}
|
|
56
|
-
function getThRowSpan(column) {
|
|
57
|
-
if (!column.children || (column.children && !column.children.length)) {
|
|
58
|
-
return 1;
|
|
59
|
-
}
|
|
60
|
-
return 1 + getMaxLevelThRowSpan(column.children);
|
|
61
|
-
}
|
|
62
|
-
function getThColSpan(column) {
|
|
63
|
-
if (!column.children || (column.children && !column.children.length)) {
|
|
64
|
-
return 1;
|
|
65
|
-
}
|
|
66
|
-
var childrenLength = 0;
|
|
67
|
-
column.children.forEach(function (item) { return (childrenLength += getThColSpan(item)); });
|
|
68
|
-
return childrenLength;
|
|
69
|
-
}
|
|
70
|
-
function buildColumns(columns, thColumns, tdColumns, maxLevel, depth, id, fixed) {
|
|
71
|
-
if (columns === void 0) { columns = []; }
|
|
72
|
-
if (tdColumns === void 0) { tdColumns = []; }
|
|
73
|
-
if (depth === void 0) { depth = 0; }
|
|
74
|
-
// 在处理表头时,如果父级column设置了fixed属性,那么所有children保持一致
|
|
75
|
-
Array.isArray(columns) &&
|
|
76
|
-
columns.forEach(function (column) {
|
|
77
|
-
var groupId = id || amisCore.guid();
|
|
78
|
-
var childMaxLevel = 0;
|
|
79
|
-
if (column.children) {
|
|
80
|
-
childMaxLevel = getMaxLevelThRowSpan(column.children);
|
|
81
|
-
}
|
|
82
|
-
var newColumn = tslib.__assign(tslib.__assign({}, column), { rowSpan: childMaxLevel ? 1 : maxLevel - depth, colSpan: getThColSpan(column), groupId: groupId, depth: depth });
|
|
83
|
-
var tdColumn = tslib.__assign(tslib.__assign({}, column), { groupId: groupId });
|
|
84
|
-
if (fixed) {
|
|
85
|
-
newColumn.fixed = fixed;
|
|
86
|
-
tdColumn.fixed = fixed;
|
|
87
|
-
}
|
|
88
|
-
if (!thColumns[depth]) {
|
|
89
|
-
thColumns[depth] = [];
|
|
90
|
-
}
|
|
91
|
-
thColumns[depth].push(newColumn);
|
|
92
|
-
if (column.children && column.children.length > 0) {
|
|
93
|
-
buildColumns(column.children, thColumns, tdColumns, maxLevel, depth + 1, groupId, column.fixed);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
tdColumn.children; var rest = tslib.__rest(tdColumn, ["children"]);
|
|
97
|
-
tdColumns.push(rest);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function isFixedLeftColumn(fixed) {
|
|
102
|
-
return fixed === true || fixed === 'left';
|
|
103
|
-
}
|
|
104
|
-
function isFixedRightColumn(fixed) {
|
|
105
|
-
return fixed === 'right';
|
|
106
|
-
}
|
|
107
|
-
function getPreviousLeftWidth(doms, index, columns) {
|
|
108
|
-
var width = 0;
|
|
109
|
-
for (var i = 0; i < index; i++) {
|
|
110
|
-
if (columns && columns[i] && isFixedLeftColumn(columns[i].fixed)) {
|
|
111
|
-
var dom = doms[i];
|
|
112
|
-
width += dom.offsetWidth;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return width;
|
|
116
|
-
}
|
|
117
|
-
function getAfterRightWidth(doms, index, columns) {
|
|
118
|
-
var width = 0;
|
|
119
|
-
for (var i = doms.length - 0; i > index; i--) {
|
|
120
|
-
if (columns && columns[i] && isFixedRightColumn(columns[i].fixed)) {
|
|
121
|
-
var dom = doms[i];
|
|
122
|
-
width += dom.offsetWidth;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return width;
|
|
126
|
-
}
|
|
127
|
-
function hasFixedColumn(columns) {
|
|
128
|
-
return find__default["default"](columns, function (column) { return column.fixed; });
|
|
129
|
-
}
|
|
130
|
-
function getSummaryColumns(summary) {
|
|
131
|
-
if (!summary) {
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
var last = [];
|
|
135
|
-
var first = [];
|
|
136
|
-
summary.forEach(function (item) {
|
|
137
|
-
if (amisCore.isObject(item)) {
|
|
138
|
-
first.push(item);
|
|
139
|
-
}
|
|
140
|
-
else if (Array.isArray(item)) {
|
|
141
|
-
last.push(item);
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
return tslib.__spreadArray([first], tslib.__read(last), false);
|
|
145
|
-
}
|
|
146
40
|
var DefaultCellWidth = 40;
|
|
147
41
|
var Table = /** @class */ (function (_super) {
|
|
148
42
|
tslib.__extends(Table, _super);
|
|
149
43
|
function Table(props) {
|
|
150
|
-
var _this = this;
|
|
151
|
-
var _a;
|
|
152
|
-
_this = _super.call(this, props) || this;
|
|
44
|
+
var _this = _super.call(this, props) || this;
|
|
153
45
|
_this.tableDom = React__default["default"].createRef();
|
|
154
|
-
_this.theadDom = React__default["default"].createRef();
|
|
155
46
|
_this.tbodyDom = React__default["default"].createRef();
|
|
156
47
|
_this.contentDom = React__default["default"].createRef();
|
|
157
48
|
_this.headerDom = React__default["default"].createRef();
|
|
158
|
-
_this.tfootDom = React__default["default"].createRef();
|
|
159
49
|
_this.footDom = React__default["default"].createRef();
|
|
50
|
+
_this.containerDom = React__default["default"].createRef();
|
|
160
51
|
_this.toDispose = [];
|
|
161
52
|
_this.updateTableInfoLazy = debounce__default["default"](_this.updateTableInfo.bind(_this), 250, {
|
|
162
53
|
trailing: true,
|
|
163
54
|
leading: false
|
|
164
55
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
56
|
+
_this.updateAutoFillHeightLazy = debounce__default["default"](_this.updateAutoFillHeight.bind(_this), 250, {
|
|
57
|
+
trailing: true,
|
|
58
|
+
leading: false
|
|
59
|
+
});
|
|
170
60
|
_this.state = {
|
|
171
61
|
selectedRowKeys: props.rowSelection
|
|
172
62
|
? props.rowSelection.selectedRowKeys.map(function (key) { return key; }) || []
|
|
@@ -183,46 +73,6 @@ var Table = /** @class */ (function (_super) {
|
|
|
183
73
|
Table.prototype.getPopOverContainer = function () {
|
|
184
74
|
return ReactDOM.findDOMNode(this);
|
|
185
75
|
};
|
|
186
|
-
Table.prototype.getSelectedRows = function (dataSource, selectedRowKeys) {
|
|
187
|
-
var _this = this;
|
|
188
|
-
var selectedRows = [];
|
|
189
|
-
var unSelectedRows = [];
|
|
190
|
-
dataSource.forEach(function (data) {
|
|
191
|
-
if (find__default["default"](selectedRowKeys, function (key) { return key === data[_this.getRowSelectionKeyField()]; })) {
|
|
192
|
-
selectedRows.push(data);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
unSelectedRows.push(data);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
return { selectedRows: selectedRows, unSelectedRows: unSelectedRows };
|
|
199
|
-
};
|
|
200
|
-
Table.prototype.updateTableBodyFixed = function () {
|
|
201
|
-
var tbodyDom = this.tbodyDom && this.tbodyDom.current;
|
|
202
|
-
var tdColumns = tslib.__spreadArray([], tslib.__read(this.tdColumns), false);
|
|
203
|
-
if (!tbodyDom) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
this.updateTbodyFixedRow(tbodyDom, tdColumns);
|
|
207
|
-
this.updateHeadSummaryFixedRow(tbodyDom);
|
|
208
|
-
};
|
|
209
|
-
Table.prototype.updateTableFixedRows = function () {
|
|
210
|
-
if (hasFixedColumn(this.props.columns)) {
|
|
211
|
-
var headerDom = this.headerDom && this.headerDom.current;
|
|
212
|
-
if (headerDom) {
|
|
213
|
-
var headerBody = headerDom.getElementsByTagName('tbody');
|
|
214
|
-
headerBody &&
|
|
215
|
-
headerBody[0] &&
|
|
216
|
-
this.updateHeadSummaryFixedRow(headerBody[0]);
|
|
217
|
-
}
|
|
218
|
-
var tfootDom = this.tfootDom && this.tfootDom.current;
|
|
219
|
-
tfootDom && this.updateFootSummaryFixedRow(tfootDom);
|
|
220
|
-
var theadDom = this.theadDom && this.theadDom.current;
|
|
221
|
-
var thColumns = this.thColumns;
|
|
222
|
-
this.updateTheadFixedRow(theadDom, thColumns);
|
|
223
|
-
this.updateTableBodyFixed();
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
76
|
Table.prototype.componentDidMount = function () {
|
|
227
77
|
var _this = this;
|
|
228
78
|
var _a, _b, _c, _d, _e;
|
|
@@ -230,9 +80,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
230
80
|
if (this.props.loading) {
|
|
231
81
|
return;
|
|
232
82
|
}
|
|
233
|
-
this.
|
|
234
|
-
var current = (_c = this.contentDom) === null || _c === void 0 ? void 0 : _c.current;
|
|
235
|
-
if ((_d = this.headerDom) === null || _d === void 0 ? void 0 : _d.current) {
|
|
83
|
+
if ((_c = this.headerDom) === null || _c === void 0 ? void 0 : _c.current) {
|
|
236
84
|
// overflow设置为hidden的情况
|
|
237
85
|
var hiddenDomRefs = [this.headerDom, this.footDom];
|
|
238
86
|
hiddenDomRefs.forEach(function (ref) {
|
|
@@ -241,40 +89,43 @@ var Table = /** @class */ (function (_super) {
|
|
|
241
89
|
ref.current.addEventListener('wheel', _this.onWheel.bind(_this));
|
|
242
90
|
});
|
|
243
91
|
}
|
|
92
|
+
var current = (_d = this.contentDom) === null || _d === void 0 ? void 0 : _d.current;
|
|
244
93
|
current && this.updateTableDom(current);
|
|
245
94
|
if (this.props.draggable && ((_e = this.tbodyDom) === null || _e === void 0 ? void 0 : _e.current)) {
|
|
246
95
|
this.initDragging();
|
|
247
96
|
}
|
|
248
97
|
this.updateStickyHeader();
|
|
249
98
|
var currentNode = ReactDOM.findDOMNode(this);
|
|
99
|
+
if (this.props.autoFillHeight) {
|
|
100
|
+
this.toDispose.push(amisCore.resizeSensor(currentNode.parentElement, this.updateAutoFillHeightLazy, false, 'height'));
|
|
101
|
+
this.updateAutoFillHeight();
|
|
102
|
+
}
|
|
250
103
|
this.toDispose.push(amisCore.resizeSensor(currentNode, this.updateTableInfoLazy, false, 'width'));
|
|
251
104
|
};
|
|
252
105
|
Table.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
253
106
|
var _this = this;
|
|
254
107
|
var _a, _b, _c, _d;
|
|
255
|
-
// 数据源发生了变化
|
|
256
|
-
// 异步加载数据需求再更新一次
|
|
257
|
-
// 翻页
|
|
258
108
|
if (!isEqual__default["default"](prevProps.dataSource, this.props.dataSource)) {
|
|
259
109
|
this.setState({
|
|
260
110
|
dataSource: tslib.__spreadArray([], tslib.__read(this.props.dataSource), false)
|
|
261
|
-
}, function () {
|
|
262
|
-
_this.updateTableFixedRows();
|
|
263
111
|
});
|
|
264
112
|
}
|
|
113
|
+
if (prevProps.autoFillHeight !== this.props.autoFillHeight ||
|
|
114
|
+
((!isEqual__default["default"](prevState.dataSource, this.state.dataSource) ||
|
|
115
|
+
prevProps.loading !== this.props.loading) &&
|
|
116
|
+
this.props.autoFillHeight)) {
|
|
117
|
+
this.updateAutoFillHeight();
|
|
118
|
+
}
|
|
265
119
|
// 选择项发生了变化触发
|
|
266
120
|
if (!isEqual__default["default"](prevState.selectedRowKeys, this.state.selectedRowKeys)) {
|
|
121
|
+
var rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
122
|
+
var childrenColumnName = this.getChildrenColumnName();
|
|
267
123
|
// 更新保存的已选择行数据
|
|
268
|
-
var selectedResult =
|
|
269
|
-
this.selectedRows = selectedResult.selectedRows;
|
|
270
|
-
this.unSelectedRows = selectedResult.unSelectedRows;
|
|
124
|
+
var selectedResult = util.getSelectedRows(this.state.dataSource, this.state.selectedRowKeys, rowSelectionKeyField, childrenColumnName);
|
|
271
125
|
var rowSelection = this.props.rowSelection;
|
|
272
126
|
rowSelection &&
|
|
273
127
|
rowSelection.onChange &&
|
|
274
|
-
rowSelection.onChange(this.state.selectedRowKeys,
|
|
275
|
-
this.setState({
|
|
276
|
-
selectedRowKeys: this.state.selectedRowKeys.filter(function (key, i, a) { return a.indexOf(key) === i; })
|
|
277
|
-
});
|
|
128
|
+
rowSelection.onChange(this.state.selectedRowKeys, selectedResult.selectedRows);
|
|
278
129
|
}
|
|
279
130
|
// 外部传入的选择项发生了变化
|
|
280
131
|
if (!isEqual__default["default"]((_a = prevProps.rowSelection) === null || _a === void 0 ? void 0 : _a.selectedRowKeys, (_b = this.props.rowSelection) === null || _b === void 0 ? void 0 : _b.selectedRowKeys)) {
|
|
@@ -282,9 +133,6 @@ var Table = /** @class */ (function (_super) {
|
|
|
282
133
|
this.setState({
|
|
283
134
|
selectedRowKeys: this.props.rowSelection.selectedRowKeys
|
|
284
135
|
});
|
|
285
|
-
var selectedResult = this.getSelectedRows(this.state.dataSource, this.state.selectedRowKeys);
|
|
286
|
-
this.selectedRows = selectedResult.selectedRows;
|
|
287
|
-
this.unSelectedRows = selectedResult.unSelectedRows;
|
|
288
136
|
}
|
|
289
137
|
}
|
|
290
138
|
// 外部传入的展开项发生了变化
|
|
@@ -313,7 +161,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
313
161
|
this.updateStickyHeader();
|
|
314
162
|
}
|
|
315
163
|
if (prevProps.columns !== this.props.columns) {
|
|
316
|
-
this.
|
|
164
|
+
this.syncTableWidth();
|
|
317
165
|
}
|
|
318
166
|
};
|
|
319
167
|
Table.prototype.componentWillUnmount = function () {
|
|
@@ -328,6 +176,69 @@ var Table = /** @class */ (function (_super) {
|
|
|
328
176
|
this.toDispose.forEach(function (fn) { return fn(); });
|
|
329
177
|
this.toDispose = [];
|
|
330
178
|
this.updateTableInfoLazy.cancel();
|
|
179
|
+
this.updateAutoFillHeightLazy.cancel();
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* 自动设置表格高度占满界面剩余区域
|
|
183
|
+
* 用 css 实现有点麻烦,要改很多结构,所以先用 dom hack 了,避免对之前的功能有影响
|
|
184
|
+
*/
|
|
185
|
+
Table.prototype.updateAutoFillHeight = function () {
|
|
186
|
+
var tableContent = this.containerDom.current;
|
|
187
|
+
if (!tableContent) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
tableContent.removeAttribute('style');
|
|
191
|
+
var autoFillHeight = this.props.autoFillHeight;
|
|
192
|
+
if (!autoFillHeight) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// 计算 table-content 在 dom 中的位置
|
|
196
|
+
var viewportHeight = window.innerHeight;
|
|
197
|
+
var tableContentTop = amisCore.offset(tableContent).top;
|
|
198
|
+
var parent = amisCore.getScrollParent(tableContent.parentElement);
|
|
199
|
+
if (parent && parent !== document.body) {
|
|
200
|
+
viewportHeight = parent.clientHeight - 1;
|
|
201
|
+
tableContentTop = amisCore.position(tableContent, parent).top;
|
|
202
|
+
}
|
|
203
|
+
var tableContentBottom = 0;
|
|
204
|
+
var selfNode = tableContent;
|
|
205
|
+
var parentNode = selfNode.parentElement;
|
|
206
|
+
while (parentNode) {
|
|
207
|
+
var paddingBottom = amisCore.getStyleNumber(parentNode, 'padding-bottom');
|
|
208
|
+
var borderBottom = amisCore.getStyleNumber(parentNode, 'border-bottom-width');
|
|
209
|
+
var nextSiblingHeight = 0;
|
|
210
|
+
var nextSibling = selfNode.nextElementSibling;
|
|
211
|
+
while (nextSibling) {
|
|
212
|
+
var positon = getComputedStyle(nextSibling).position;
|
|
213
|
+
if (positon !== 'absolute' && positon !== 'fixed') {
|
|
214
|
+
nextSiblingHeight +=
|
|
215
|
+
nextSibling.offsetHeight +
|
|
216
|
+
amisCore.getStyleNumber(nextSibling, 'margin-bottom');
|
|
217
|
+
}
|
|
218
|
+
nextSibling = nextSibling.nextElementSibling;
|
|
219
|
+
}
|
|
220
|
+
var marginBottom = amisCore.getStyleNumber(selfNode, 'margin-bottom');
|
|
221
|
+
tableContentBottom +=
|
|
222
|
+
paddingBottom + borderBottom + marginBottom + nextSiblingHeight;
|
|
223
|
+
selfNode = parentNode;
|
|
224
|
+
parentNode = selfNode.parentElement;
|
|
225
|
+
if (parent && parent !== document.body && parent === selfNode) {
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
var heightField = autoFillHeight && autoFillHeight.maxHeight
|
|
230
|
+
? 'maxHeight'
|
|
231
|
+
: 'height';
|
|
232
|
+
var heightValue = amisCore.isObject(autoFillHeight)
|
|
233
|
+
? autoFillHeight[heightField]
|
|
234
|
+
: 0;
|
|
235
|
+
var tableContentHeight = heightValue
|
|
236
|
+
? heightValue
|
|
237
|
+
: Math.round(viewportHeight - tableContentTop - tableContentBottom);
|
|
238
|
+
if (tableContentHeight > 0) {
|
|
239
|
+
tableContent.style[heightField] = "".concat(tableContentHeight, "px");
|
|
240
|
+
tableContent.style['overflow'] = 'auto';
|
|
241
|
+
}
|
|
331
242
|
};
|
|
332
243
|
Table.prototype.initDragging = function () {
|
|
333
244
|
var _this = this;
|
|
@@ -355,15 +266,24 @@ var Table = /** @class */ (function (_super) {
|
|
|
355
266
|
return true;
|
|
356
267
|
},
|
|
357
268
|
onEnd: function (e) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
358
|
-
var rowLevels;
|
|
269
|
+
var oldIndex, newIndex, rowLevels, i;
|
|
359
270
|
return tslib.__generator(this, function (_a) {
|
|
360
271
|
// 没有移动
|
|
361
272
|
if (e.newIndex === e.oldIndex) {
|
|
362
273
|
return [2 /*return*/];
|
|
363
274
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
275
|
+
oldIndex = e.oldIndex;
|
|
276
|
+
newIndex = e.newIndex;
|
|
277
|
+
rowLevels = util.levelsSplit(e.item.getAttribute('row-levels'));
|
|
278
|
+
if (rowLevels.length) {
|
|
279
|
+
i = 0;
|
|
280
|
+
while (i < rowLevels.length) {
|
|
281
|
+
oldIndex = oldIndex - rowLevels[i] - 1;
|
|
282
|
+
newIndex = newIndex - rowLevels[i] - 1;
|
|
283
|
+
i++;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
onDrag && onDrag(oldIndex, newIndex, rowLevels);
|
|
367
287
|
return [2 /*return*/];
|
|
368
288
|
});
|
|
369
289
|
}); }
|
|
@@ -398,109 +318,10 @@ var Table = /** @class */ (function (_super) {
|
|
|
398
318
|
});
|
|
399
319
|
}
|
|
400
320
|
};
|
|
401
|
-
// 更新一个tr下的td的left和class
|
|
402
|
-
Table.prototype.updateFixedRow = function (row, columns) {
|
|
403
|
-
var _a, _b, _c;
|
|
404
|
-
var cx = this.props.classnames;
|
|
405
|
-
var children = row.children;
|
|
406
|
-
for (var i = 0; i < children.length; i++) {
|
|
407
|
-
var dom = children[i];
|
|
408
|
-
dom.style.removeProperty('left');
|
|
409
|
-
var fixed = columns[i] ? columns[i].fixed || '' : '';
|
|
410
|
-
if (isFixedLeftColumn(fixed)) {
|
|
411
|
-
dom.style.left =
|
|
412
|
-
i > 0 ? getPreviousLeftWidth(children, i, columns) + 'px' : '0';
|
|
413
|
-
}
|
|
414
|
-
else if (isFixedRightColumn(fixed)) {
|
|
415
|
-
dom.style.right =
|
|
416
|
-
i < children.length - 1
|
|
417
|
-
? getAfterRightWidth(children, i, columns) + 'px'
|
|
418
|
-
: '0';
|
|
419
|
-
}
|
|
420
|
-
dom.classList.remove(cx('Table-cell-fix-left-last'));
|
|
421
|
-
dom.classList.remove(cx('Table-cell-fix-right-first'));
|
|
422
|
-
dom.classList.remove(cx('Table-cell-fix-right-first-prev'));
|
|
423
|
-
}
|
|
424
|
-
// 最后一个左fixed的添加样式
|
|
425
|
-
var leftIndex = findLastIndex__default["default"](columns, function (column) {
|
|
426
|
-
return isFixedLeftColumn(column.fixed);
|
|
427
|
-
});
|
|
428
|
-
if (leftIndex > -1) {
|
|
429
|
-
(_a = children[leftIndex]) === null || _a === void 0 ? void 0 : _a.classList.add(cx('Table-cell-fix-left-last'));
|
|
430
|
-
}
|
|
431
|
-
// 第一个右fixed的添加样式
|
|
432
|
-
var rightIndex = columns.findIndex(function (column) {
|
|
433
|
-
return isFixedRightColumn(column.fixed);
|
|
434
|
-
});
|
|
435
|
-
if (rightIndex > -1) {
|
|
436
|
-
(_b = children[rightIndex]) === null || _b === void 0 ? void 0 : _b.classList.add(cx('Table-cell-fix-right-first'));
|
|
437
|
-
if (rightIndex > 0) {
|
|
438
|
-
(_c = children[rightIndex - 1]) === null || _c === void 0 ? void 0 : _c.classList.add(cx('Table-cell-fix-right-first-prev'));
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
};
|
|
442
|
-
// 在可选、可展开、可拖拽的情况下,补充column,方便fix处理
|
|
443
|
-
Table.prototype.prependColumns = function (columns) {
|
|
444
|
-
var _a = this.props, rowSelection = _a.rowSelection, expandable = _a.expandable, draggable = _a.draggable;
|
|
445
|
-
if (draggable) {
|
|
446
|
-
columns.unshift({});
|
|
447
|
-
}
|
|
448
|
-
else {
|
|
449
|
-
if (expandable) {
|
|
450
|
-
columns.unshift(expandable);
|
|
451
|
-
}
|
|
452
|
-
if (rowSelection) {
|
|
453
|
-
columns.unshift(rowSelection);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
Table.prototype.updateTheadFixedRow = function (thead, columns) {
|
|
458
|
-
var children = thead.children;
|
|
459
|
-
for (var i = 0; i < children.length; i++) {
|
|
460
|
-
var cols = tslib.__spreadArray([], tslib.__read(columns[i]), false);
|
|
461
|
-
if (i === 0) {
|
|
462
|
-
this.prependColumns(cols);
|
|
463
|
-
}
|
|
464
|
-
this.updateFixedRow(children[i], cols);
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
Table.prototype.updateTbodyFixedRow = function (tbody, columns) {
|
|
468
|
-
var cx = this.props.classnames;
|
|
469
|
-
var children = filter__default["default"](tbody.children, function (child) {
|
|
470
|
-
return !child.classList.contains(cx('Table-summary-row')) &&
|
|
471
|
-
!child.classList.contains(cx('Table-empty-row'));
|
|
472
|
-
});
|
|
473
|
-
this.prependColumns(columns);
|
|
474
|
-
for (var i = 0; i < children.length; i++) {
|
|
475
|
-
this.updateFixedRow(children[i], columns);
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
Table.prototype.updateSummaryFixedRow = function (children, columns) {
|
|
479
|
-
for (var i = 0; i < children.length; i++) {
|
|
480
|
-
this.updateFixedRow(children[i], columns[i]);
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
Table.prototype.updateFootSummaryFixedRow = function (tfoot) {
|
|
484
|
-
var footSummary = this.props.footSummary;
|
|
485
|
-
if (Array.isArray(footSummary)) {
|
|
486
|
-
var columns = getSummaryColumns(footSummary);
|
|
487
|
-
this.updateSummaryFixedRow(tfoot.children, columns);
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
Table.prototype.updateHeadSummaryFixedRow = function (tbody) {
|
|
491
|
-
var _a = this.props, headSummary = _a.headSummary, cx = _a.classnames;
|
|
492
|
-
if (Array.isArray(headSummary)) {
|
|
493
|
-
var columns = getSummaryColumns(headSummary);
|
|
494
|
-
var children = filter__default["default"](tbody.children, function (child) {
|
|
495
|
-
return child.classList.contains(cx('Table-summary-row'));
|
|
496
|
-
});
|
|
497
|
-
this.updateSummaryFixedRow(children, columns);
|
|
498
|
-
}
|
|
499
|
-
};
|
|
500
321
|
Table.prototype.renderColGroup = function (showReal) {
|
|
501
|
-
var _a = this.props, scroll = _a.scroll, tableLayout = _a.tableLayout;
|
|
322
|
+
var _a = this.props, scroll = _a.scroll, tableLayout = _a.tableLayout, columns = _a.columns, rowSelection = _a.rowSelection, expandable = _a.expandable, draggable = _a.draggable;
|
|
502
323
|
var isFixed = !!((scroll && scroll.x) || tableLayout === 'fixed');
|
|
503
|
-
return (_J$X_(ColGroup["default"], { columns:
|
|
324
|
+
return (_J$X_(ColGroup["default"], { columns: columns, colWidths: this.state.colWidths, isFixed: isFixed, syncTableWidth: this.syncTableWidth, initTableWidth: this.initTableWidth, selectable: !!rowSelection, expandable: !!expandable, draggable: !!draggable, rowSelectionColumnWidth: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.columnWidth) || DefaultCellWidth, expandableColumnWidth: (expandable === null || expandable === void 0 ? void 0 : expandable.columnWidth) || DefaultCellWidth, isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), showReal: showReal }));
|
|
504
325
|
};
|
|
505
326
|
Table.prototype.onResizeMouseDown = function (event, index) {
|
|
506
327
|
// 点击记录起始坐标
|
|
@@ -508,7 +329,8 @@ var Table = /** @class */ (function (_super) {
|
|
|
508
329
|
this.resizeTarget = event.currentTarget;
|
|
509
330
|
var column = this.tdColumns[index];
|
|
510
331
|
this.resizeIndex = index;
|
|
511
|
-
|
|
332
|
+
var colWidth = this.state.colWidths[column.name];
|
|
333
|
+
this.resizeWidth = colWidth.width || colWidth.realWidth;
|
|
512
334
|
this.resizeTarget.classList.add('is-resizing');
|
|
513
335
|
document.addEventListener('mousemove', this.onResizeMouseMove);
|
|
514
336
|
document.addEventListener('mouseup', this.onResizeMouseUp);
|
|
@@ -542,147 +364,60 @@ var Table = /** @class */ (function (_super) {
|
|
|
542
364
|
this.resizeWidth = 0;
|
|
543
365
|
delete this.resizeTarget;
|
|
544
366
|
};
|
|
545
|
-
Table.prototype.
|
|
367
|
+
Table.prototype.renderHead = function () {
|
|
546
368
|
var _this = this;
|
|
547
|
-
var _a
|
|
548
|
-
var
|
|
549
|
-
var
|
|
550
|
-
// 获取一行最多th个数
|
|
551
|
-
var maxCount = 0;
|
|
552
|
-
thColumns.forEach(function (columns) {
|
|
553
|
-
if (columns.length > maxCount) {
|
|
554
|
-
maxCount = columns.length;
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
var keyField = this.getRowSelectionKeyField();
|
|
369
|
+
var _a;
|
|
370
|
+
var _b = this.props, columns = _b.columns, cx = _b.classnames, classPrefix = _b.classPrefix, expandable = _b.expandable, rowSelection = _b.rowSelection, draggable = _b.draggable, resizable = _b.resizable, dataSource = _b.dataSource, onSort = _b.onSort, onSelectAll = _b.onSelectAll, onFilter = _b.onFilter;
|
|
371
|
+
var rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
558
372
|
var dataList = rowSelection && rowSelection.getCheckboxProps
|
|
559
373
|
? this.state.dataSource.filter(function (data, index) {
|
|
560
374
|
var props = rowSelection.getCheckboxProps(data, index);
|
|
561
375
|
return !props.disabled;
|
|
562
376
|
})
|
|
563
377
|
: this.state.dataSource;
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var expandableCell = !draggable && isExpandable ? (_J$X_(Cell["default"], { wrapperComponent: "th", rowSpan: thColumns.length, fixed: expandable && expandable.fixed ? 'left' : '', className: cx('Table-row-expand-icon-cell'), style: { width: ((expandable === null || expandable === void 0 ? void 0 : expandable.columnWidth) || DefaultCellWidth) + 'px' } })) : null;
|
|
568
|
-
var allRowKeys = [];
|
|
569
|
-
var allRows = [];
|
|
570
|
-
dataList.forEach(function (data) {
|
|
571
|
-
allRowKeys.push(data[keyField]);
|
|
572
|
-
allRows.push(data);
|
|
573
|
-
if (!expandable && _this.hasChildrenRow(data)) {
|
|
574
|
-
allRowKeys = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(allRowKeys), false), tslib.__read(_this.getDataChildrenKeys(data)), false);
|
|
575
|
-
data[_this.getChildrenColumnName()].forEach(function (item) {
|
|
576
|
-
return allRows.push(item);
|
|
378
|
+
return (_J$X_(Head["default"], { key: "thead", columns: columns, draggable: !!draggable, selectable: !!rowSelection, rowSelectionFixed: !!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.fixed), rowSelectionType: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type, selections: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selections, rowSelectionKeyField: rowSelectionKeyField, maxSelectedLength: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.maxSelectedLength, isExpandable: this.isExpandableTable(), isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), selectedRowKeys: this.state.selectedRowKeys, dataSource: dataList, resizable: resizable, expandable: !!expandable, expandableFixed: expandable === null || expandable === void 0 ? void 0 : expandable.fixed, childrenColumnName: this.getChildrenColumnName(), orderBy: (_a = this.state.sort) === null || _a === void 0 ? void 0 : _a.orderBy, popOverContainer: this.getPopOverContainer, classnames: cx, classPrefix: classPrefix, onSort: function (payload, column) {
|
|
379
|
+
_this.setState({
|
|
380
|
+
sort: payload
|
|
577
381
|
});
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
return (_J$X_("thead", { ref: this.theadDom, className: cx('Table-thead') }, thColumns.map(function (data, index) {
|
|
594
|
-
return (_J$X_("tr", { key: 'th-cell-' + index },
|
|
595
|
-
draggable && index === 0 ? (_J$X_(Cell["default"], { wrapperComponent: "th", rowSpan: thColumns.length, className: cx('Table-dragCell'), style: { width: DefaultCellWidth + 'px' }, col: "drag" })) : null,
|
|
596
|
-
!draggable && rowSelection && index === 0 ? (_J$X_(Cell["default"], { wrapperComponent: "th", rowSpan: thColumns.length, fixed: rowSelection.fixed ? 'left' : '', className: cx('Table-checkCell'), style: {
|
|
597
|
-
width: (rowSelection.columnWidth || DefaultCellWidth) + 'px'
|
|
598
|
-
}, col: "select" }, rowSelection.type !== 'radio'
|
|
599
|
-
? [
|
|
600
|
-
_J$X_(Checkbox["default"], { key: "checkAll", partial: selectedRowKeys.length > 0 &&
|
|
601
|
-
selectedRowKeys.length < allRowKeys.length, checked: selectedRowKeys.length > 0, onChange: function (value) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
602
|
-
var selectedRows, selectedRowKeys, prevented;
|
|
603
|
-
return tslib.__generator(this, function (_a) {
|
|
604
|
-
switch (_a.label) {
|
|
605
|
-
case 0:
|
|
606
|
-
selectedRows = value ? allRows : [];
|
|
607
|
-
selectedRowKeys = value ? allRowKeys : [];
|
|
608
|
-
if (!onSelectAll) return [3 /*break*/, 2];
|
|
609
|
-
return [4 /*yield*/, onSelectAll(selectedRows, value ? selectedRowKeys : [], value ? [] : selectedRows)];
|
|
610
|
-
case 1:
|
|
611
|
-
prevented = _a.sent();
|
|
612
|
-
if (prevented) {
|
|
613
|
-
return [2 /*return*/];
|
|
614
|
-
}
|
|
615
|
-
_a.label = 2;
|
|
616
|
-
case 2:
|
|
617
|
-
this.setState({
|
|
618
|
-
selectedRowKeys: tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(selectedRowKeys), false), tslib.__read(restSelectedRowKeys // 更新数据要把非当前页的数据也加上
|
|
619
|
-
), false)
|
|
620
|
-
});
|
|
621
|
-
return [2 /*return*/];
|
|
622
|
-
}
|
|
623
|
-
});
|
|
624
|
-
}); } }),
|
|
625
|
-
rowSelection.selections &&
|
|
626
|
-
rowSelection.selections.length > 0 ? (_J$X_(HeadCellSelect["default"], { key: "checkSelection", keys: allRowKeys, selections: rowSelection.selections, popOverContainer: _this.getPopOverContainer })) : null
|
|
627
|
-
]
|
|
628
|
-
: null)) : null,
|
|
629
|
-
isLeftExpandable && index === 0 ? expandableCell : null,
|
|
630
|
-
data.map(function (item, i) {
|
|
631
|
-
var _a, _b, _c;
|
|
632
|
-
var sort = null;
|
|
633
|
-
if (item.sorter) {
|
|
634
|
-
sort = (_J$X_(HeadCellSort["default"], { column: item, active: !!((_a = _this.state.sort) === null || _a === void 0 ? void 0 : _a.orderBy) &&
|
|
635
|
-
_this.state.sort.orderBy === (item === null || item === void 0 ? void 0 : item.name), onSort: function (payload) {
|
|
636
|
-
_this.setState({
|
|
637
|
-
sort: payload
|
|
638
|
-
});
|
|
639
|
-
if (onSort) {
|
|
640
|
-
onSort(payload);
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
if (typeof item.sorter === 'function') {
|
|
644
|
-
if (payload.orderBy) {
|
|
645
|
-
var sortList = tslib.__spreadArray([], tslib.__read(_this.state.dataSource), false);
|
|
646
|
-
_this.setState({
|
|
647
|
-
dataSource: sortList.sort(item.sorter)
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
else {
|
|
651
|
-
_this.setState({ dataSource: tslib.__spreadArray([], tslib.__read(dataSource), false) });
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
} }));
|
|
656
|
-
}
|
|
657
|
-
var filter = null;
|
|
658
|
-
if (item.filterDropdown) {
|
|
659
|
-
filter = item.filterDropdown;
|
|
660
|
-
}
|
|
661
|
-
else if (item.filters && item.filters.length > 0) {
|
|
662
|
-
filter = (_J$X_(HeadCellFilter["default"], { column: item, popOverContainer: _this.getPopOverContainer, onFilter: onFilter }));
|
|
382
|
+
if (onSort) {
|
|
383
|
+
onSort(payload);
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
if (typeof column.sorter === 'function') {
|
|
387
|
+
if (payload.orderBy) {
|
|
388
|
+
var sortList = tslib.__spreadArray([], tslib.__read(_this.state.dataSource), false);
|
|
389
|
+
_this.setState({
|
|
390
|
+
dataSource: sortList.sort(column.sorter)
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
else {
|
|
394
|
+
_this.setState({ dataSource: tslib.__spreadArray([], tslib.__read(dataSource), false) });
|
|
395
|
+
}
|
|
663
396
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
397
|
+
}
|
|
398
|
+
}, onSelectAll: function (value, selectedRowKeys, selectedRows, restSelectedKeys) { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
399
|
+
var prevented, keys;
|
|
400
|
+
return tslib.__generator(this, function (_a) {
|
|
401
|
+
switch (_a.label) {
|
|
402
|
+
case 0:
|
|
403
|
+
if (!onSelectAll) return [3 /*break*/, 2];
|
|
404
|
+
return [4 /*yield*/, onSelectAll(selectedRows, value ? selectedRowKeys : [], value ? [] : selectedRows)];
|
|
405
|
+
case 1:
|
|
406
|
+
prevented = _a.sent();
|
|
407
|
+
if (prevented) {
|
|
408
|
+
return [2 /*return*/];
|
|
409
|
+
}
|
|
410
|
+
_a.label = 2;
|
|
411
|
+
case 2:
|
|
412
|
+
keys = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(selectedRowKeys), false), tslib.__read(restSelectedKeys // 更新数据要把非当前页的数据也加上
|
|
413
|
+
), false);
|
|
414
|
+
if (!isEqual__default["default"](keys, this.state.selectedRowKeys)) {
|
|
415
|
+
this.setState({ selectedRowKeys: keys });
|
|
416
|
+
}
|
|
417
|
+
return [2 /*return*/];
|
|
673
418
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
filter,
|
|
677
|
-
resizable ? (_J$X_("i", { className: cx('Table-thead-resizable'), onMouseDown: function (e) { return _this.onResizeMouseDown(e, cIndex); } })) : null)) : null;
|
|
678
|
-
return (_J$X_(Cell["default"], { wrapperComponent: "th", rowSpan: item.rowSpan, colSpan: item.colSpan, key: "cell-".concat(i), fixed: item.fixed === true ? 'left' : item.fixed, className: cx({
|
|
679
|
-
'Table-cell-last': i === maxCount - 1 && i === data.length - 1
|
|
680
|
-
}), groupId: item.groupId, depth: item.depth, col: cIndex > -1 ? cIndex.toString() : undefined }, typeof item.title === 'function'
|
|
681
|
-
? item.title(children)
|
|
682
|
-
: item.title));
|
|
683
|
-
}),
|
|
684
|
-
isRightExpandable && index === 0 ? expandableCell : null));
|
|
685
|
-
})));
|
|
419
|
+
});
|
|
420
|
+
}); }, onFilter: onFilter, onResizeMouseDown: this.onResizeMouseDown.bind(this) }));
|
|
686
421
|
};
|
|
687
422
|
Table.prototype.onRowClick = function (event, record, rowIndex) {
|
|
688
423
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
@@ -710,6 +445,26 @@ var Table = /** @class */ (function (_super) {
|
|
|
710
445
|
});
|
|
711
446
|
});
|
|
712
447
|
};
|
|
448
|
+
Table.prototype.onRowDbClick = function (event, record, rowIndex) {
|
|
449
|
+
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
450
|
+
var onRow, prevented;
|
|
451
|
+
return tslib.__generator(this, function (_a) {
|
|
452
|
+
switch (_a.label) {
|
|
453
|
+
case 0:
|
|
454
|
+
onRow = this.props.onRow;
|
|
455
|
+
if (!(onRow && onRow.onRowDbClick)) return [3 /*break*/, 2];
|
|
456
|
+
return [4 /*yield*/, onRow.onRowDbClick(event, record, rowIndex)];
|
|
457
|
+
case 1:
|
|
458
|
+
prevented = _a.sent();
|
|
459
|
+
if (prevented === false) {
|
|
460
|
+
return [2 /*return*/];
|
|
461
|
+
}
|
|
462
|
+
_a.label = 2;
|
|
463
|
+
case 2: return [2 /*return*/];
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
});
|
|
467
|
+
};
|
|
713
468
|
Table.prototype.onRowMouseEnter = function (event, record, rowIndex) {
|
|
714
469
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
715
470
|
var _a, onRow, itemActions, prevented, target;
|
|
@@ -785,204 +540,118 @@ var Table = /** @class */ (function (_super) {
|
|
|
785
540
|
var _a = this.props, expandable = _a.expandable, keyField = _a.keyField;
|
|
786
541
|
return (expandable === null || expandable === void 0 ? void 0 : expandable.keyField) || keyField || 'key';
|
|
787
542
|
};
|
|
788
|
-
Table.prototype.hasChildrenRow = function (data) {
|
|
789
|
-
var key = this.getChildrenColumnName();
|
|
790
|
-
return data[key] && Array.isArray(data[key]) && data[key].length > 0;
|
|
791
|
-
};
|
|
792
|
-
// 展开和嵌套不能共存
|
|
793
|
-
Table.prototype.isExpandableRow = function (data, rowIndex) {
|
|
794
|
-
var expandable = this.props.expandable;
|
|
795
|
-
return (expandable &&
|
|
796
|
-
(!expandable.rowExpandable ||
|
|
797
|
-
(expandable.rowExpandable && expandable.rowExpandable(data, rowIndex))));
|
|
798
|
-
};
|
|
799
|
-
// 获取当前行数据所有子行的key值
|
|
800
|
-
Table.prototype.getDataChildrenKeys = function (data) {
|
|
801
|
-
var _this = this;
|
|
802
|
-
var keys = [];
|
|
803
|
-
if (this.hasChildrenRow(data)) {
|
|
804
|
-
var key = this.getChildrenColumnName();
|
|
805
|
-
data[key].forEach(function (item) {
|
|
806
|
-
return (keys = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(keys), false), tslib.__read(_this.getDataChildrenKeys(item)), false), [
|
|
807
|
-
item[_this.getRowSelectionKeyField()]
|
|
808
|
-
], false));
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
return keys;
|
|
812
|
-
};
|
|
813
|
-
Table.prototype.hasCheckedRows = function (data) {
|
|
814
|
-
var selectedRowKeys = this.state.selectedRowKeys;
|
|
815
|
-
var childrenKeys = this.getDataChildrenKeys(data);
|
|
816
|
-
return (intersection__default["default"](selectedRowKeys, tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(childrenKeys), false), [
|
|
817
|
-
data[this.getRowSelectionKeyField()]
|
|
818
|
-
], false)).length > 0);
|
|
819
|
-
};
|
|
820
543
|
Table.prototype.hasCheckedChildrenRows = function (data) {
|
|
821
544
|
var selectedRowKeys = this.state.selectedRowKeys;
|
|
822
|
-
var
|
|
545
|
+
var childrenColumnName = this.getChildrenColumnName();
|
|
546
|
+
var rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
547
|
+
var childrenKeys = util.getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField);
|
|
823
548
|
var length = intersection__default["default"](selectedRowKeys, childrenKeys).length;
|
|
824
549
|
return length > 0;
|
|
825
550
|
};
|
|
826
|
-
Table.prototype.
|
|
827
|
-
var
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
var
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
551
|
+
Table.prototype.getSelectedRowKeys = function (isSelected, data) {
|
|
552
|
+
var rowSelection = this.props.rowSelection;
|
|
553
|
+
var rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
554
|
+
var childrenColumnName = this.getChildrenColumnName();
|
|
555
|
+
var isRadio = rowSelection && rowSelection.type === 'radio';
|
|
556
|
+
var selected = [];
|
|
557
|
+
if (isSelected) {
|
|
558
|
+
if (isRadio) {
|
|
559
|
+
selected = [data[rowSelectionKeyField]];
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
selected = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(this.state.selectedRowKeys), false), [
|
|
563
|
+
data[rowSelectionKeyField]
|
|
564
|
+
], false), tslib.__read(util.getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField)), false).filter(function (key, i, a) { return a.indexOf(key) === i; });
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
if (!isRadio) {
|
|
569
|
+
selected = this.state.selectedRowKeys.filter(function (key) {
|
|
570
|
+
return !tslib.__spreadArray([
|
|
571
|
+
data[rowSelectionKeyField]
|
|
572
|
+
], tslib.__read(util.getDataChildrenKeys(data, childrenColumnName, rowSelectionKeyField)), false).includes(key);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return selected;
|
|
835
577
|
};
|
|
836
578
|
Table.prototype.selectedSingleRow = function (value, data) {
|
|
837
579
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
838
|
-
var
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
switch (_b.label) {
|
|
580
|
+
var onSelect, selectedRowKeys, rowSelectionKeyField, childrenColumnName, selectedResult, prevented;
|
|
581
|
+
return tslib.__generator(this, function (_a) {
|
|
582
|
+
switch (_a.label) {
|
|
842
583
|
case 0:
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
isRadio = rowSelection && rowSelection.type === 'radio';
|
|
846
|
-
selectedRowKeys = [];
|
|
847
|
-
if (value) {
|
|
848
|
-
if (isRadio) {
|
|
849
|
-
selectedRowKeys = [data[defaultKey]];
|
|
850
|
-
}
|
|
851
|
-
else {
|
|
852
|
-
selectedRowKeys = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(this.state.selectedRowKeys), false), [
|
|
853
|
-
data[defaultKey]
|
|
854
|
-
], false), tslib.__read(this.getDataChildrenKeys(data)), false).filter(function (key, i, a) { return a.indexOf(key) === i; });
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
else {
|
|
858
|
-
if (!isRadio) {
|
|
859
|
-
selectedRowKeys = this.state.selectedRowKeys.filter(function (key) {
|
|
860
|
-
return !tslib.__spreadArray([data[defaultKey]], tslib.__read(_this.getDataChildrenKeys(data)), false).includes(key);
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
}
|
|
584
|
+
onSelect = this.props.onSelect;
|
|
585
|
+
selectedRowKeys = this.getSelectedRowKeys(value, data);
|
|
864
586
|
if (!onSelect) return [3 /*break*/, 2];
|
|
865
|
-
|
|
587
|
+
rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
588
|
+
childrenColumnName = this.getChildrenColumnName();
|
|
589
|
+
selectedResult = util.getSelectedRows(this.state.dataSource, selectedRowKeys, rowSelectionKeyField, childrenColumnName);
|
|
866
590
|
return [4 /*yield*/, onSelect(selectedResult.selectedRows, selectedRowKeys, selectedResult.unSelectedRows)];
|
|
867
591
|
case 1:
|
|
868
|
-
prevented =
|
|
592
|
+
prevented = _a.sent();
|
|
869
593
|
if (prevented) {
|
|
870
594
|
return [2 /*return*/];
|
|
871
595
|
}
|
|
872
|
-
|
|
596
|
+
_a.label = 2;
|
|
873
597
|
case 2:
|
|
874
|
-
this.
|
|
598
|
+
if (!isEqual__default["default"](this.state.selectedRowKeys, selectedRowKeys)) {
|
|
599
|
+
this.setState({ selectedRowKeys: selectedRowKeys });
|
|
600
|
+
}
|
|
875
601
|
return [2 /*return*/];
|
|
876
602
|
}
|
|
877
603
|
});
|
|
878
604
|
});
|
|
879
605
|
};
|
|
606
|
+
// 展开和嵌套不能共存
|
|
607
|
+
Table.prototype.isExpandableRow = function (data, rowIndex) {
|
|
608
|
+
var expandable = this.props.expandable;
|
|
609
|
+
return (expandable &&
|
|
610
|
+
(!expandable.rowExpandable ||
|
|
611
|
+
(expandable.rowExpandable && expandable.rowExpandable(data, rowIndex))));
|
|
612
|
+
};
|
|
613
|
+
Table.prototype.isExpanded = function (record) {
|
|
614
|
+
var expandableKeyField = this.getExpandableKeyField();
|
|
615
|
+
return !!find__default["default"](this.state.expandedRowKeys, function (key) { return key == record[expandableKeyField]; }); // == 匹配 否则'3'、3匹配不上
|
|
616
|
+
};
|
|
880
617
|
Table.prototype.renderRow = function (data, rowIndex, levels) {
|
|
881
618
|
var _this = this;
|
|
882
|
-
var _a = this.props,
|
|
883
|
-
;
|
|
884
|
-
var
|
|
885
|
-
var
|
|
886
|
-
var defaultKey = this.getRowSelectionKeyField();
|
|
887
|
-
var colCount = this.getExtraColumnCount();
|
|
888
|
-
var isLeftExpandable = this.isLeftExpandable();
|
|
889
|
-
var isRightExpandable = this.isRightExpandable();
|
|
619
|
+
var _a = this.props, rowSelection = _a.rowSelection, expandable = _a.expandable, indentSize = _a.indentSize, lineHeight = _a.lineHeight, draggable = _a.draggable, rowClassName = _a.rowClassName, keyField = _a.keyField, columns = _a.columns, classPrefix = _a.classPrefix, cx = _a.classnames;
|
|
620
|
+
var rowSelectionKeyField = this.getRowSelectionKeyField();
|
|
621
|
+
var isChecked = !!find__default["default"](this.state.selectedRowKeys, function (key) { return key === data[rowSelectionKeyField]; });
|
|
622
|
+
var childrenColumnName = this.getChildrenColumnName();
|
|
890
623
|
// 当前行是否可展开
|
|
891
624
|
var isExpandableRow = this.isExpandableRow(data, rowIndex);
|
|
892
|
-
|
|
893
|
-
var
|
|
894
|
-
var isExpanded = this.isExpanded(data);
|
|
895
|
-
// 设置缩进效果
|
|
896
|
-
var indentDom = levels.length > 0 ? (_J$X_("span", { className: cx('Table-row-indent', "indent-level-".concat(levels.length)), style: levels.length > 0 ? { width: indentSize * levels.length + 'px' } : {} })) : null;
|
|
897
|
-
var cells = tdColumns.map(function (item, i) {
|
|
898
|
-
var _a, _b;
|
|
899
|
-
// 为了支持灵活合并单元格,renderers层的Table2传递的render方法,返回{children: <ReactElement>, props: {rowSpan, colSpan}}
|
|
900
|
-
// 但直接使用amis-ui的table,render方法一般直接返回ReactElement
|
|
901
|
-
var render = item.render && typeof item.render === 'function'
|
|
902
|
-
? item.render(data[item.name], data, rowIndex, i, levels)
|
|
903
|
-
: null;
|
|
904
|
-
var props = { rowSpan: 1, colSpan: 1 };
|
|
905
|
-
var children = render;
|
|
906
|
-
if (render && !React__default["default"].isValidElement(render) && amisCore.isObject(render)) {
|
|
907
|
-
if (render.props) {
|
|
908
|
-
props = render.props;
|
|
909
|
-
}
|
|
910
|
-
children = render.children;
|
|
911
|
-
// 如果合并行 且有展开行,那么合并行不生效
|
|
912
|
-
if (props.rowSpan > 1 && isExpandableRow && hasChildrenRow) {
|
|
913
|
-
props.rowSpan === 1;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
var className = typeof item.className === 'function'
|
|
917
|
-
? item.className(data, rowIndex)
|
|
918
|
-
: '';
|
|
919
|
-
return props.rowSpan === 0 || props.colSpan === 0 ? null : (_J$X_(Cell["default"], tslib.__assign({ key: i }, props, { fixed: item.fixed === true ? 'left' : item.fixed, column: item, groupId: item.groupId, className: cx((_a = {},
|
|
920
|
-
_a["".concat(className)] = !!className,
|
|
921
|
-
_a)), col: i > -1 ? i.toString() : undefined }),
|
|
922
|
-
_J$X_("div", { className: cx('Table-cell-wrapper', (_b = {},
|
|
923
|
-
_b[cx('Table-cell-wrapper-prefix')] = i === 0 &&
|
|
924
|
-
(!!indentDom || (levels.length === 0 && hasChildrenRow)),
|
|
925
|
-
_b[cx("Table-cell-height-".concat(lineHeight))] = !!lineHeight,
|
|
926
|
-
_b)) },
|
|
927
|
-
i === 0 && levels.length > 0 ? indentDom : null,
|
|
928
|
-
i === 0 && hasChildrenRow ? _this.getExpandedIcons(data) : null,
|
|
929
|
-
render ? children : data[item.name])));
|
|
930
|
-
});
|
|
931
|
-
var rowClassNameClass = rowClassName && typeof rowClassName === 'function'
|
|
932
|
-
? rowClassName(data, rowIndex)
|
|
933
|
-
: '';
|
|
934
|
-
// 可展开和嵌套不能同时支持
|
|
935
|
-
// 设置了expandable 数据源里有children也就不生效了
|
|
936
|
-
// 拖拽排序 可选、可展开都先不支持了,可以支持嵌套展示
|
|
937
|
-
var checkboxProps = rowSelection && rowSelection.getCheckboxProps
|
|
938
|
-
? rowSelection.getCheckboxProps(data, rowIndex)
|
|
939
|
-
: {};
|
|
625
|
+
var hasChildrenRow = util.checkChildrenRow(data, childrenColumnName);
|
|
626
|
+
var hasChildrenChecked = !!rowSelection && hasChildrenRow && this.hasCheckedChildrenRows(data);
|
|
940
627
|
var expandedRowClassName = expandable &&
|
|
941
628
|
expandable.expandedRowClassName &&
|
|
942
629
|
typeof expandable.expandedRowClassName === 'function'
|
|
943
630
|
? expandable.expandedRowClassName(data, rowIndex)
|
|
944
631
|
: '';
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
var isChecked = !!find__default["default"](this.state.selectedRowKeys, function (key) { return key === data[defaultKey]; });
|
|
955
|
-
var hasChildrenChecked = this.hasCheckedChildrenRows(data);
|
|
956
|
-
var isRadio = rowSelection && rowSelection.type === 'radio';
|
|
957
|
-
var expandableCell = !draggable && isExpandable ? (_J$X_(Cell["default"], { fixed: expandable && expandable.fixed
|
|
958
|
-
? isRightExpandable
|
|
959
|
-
? 'right'
|
|
960
|
-
: 'left'
|
|
961
|
-
: '', className: cx('Table-cell-expand-icon-cell') }, isExpandableRow || hasChildrenRow
|
|
962
|
-
? this.getExpandedIcons(data)
|
|
963
|
-
: null)) : null;
|
|
632
|
+
var isExpanded = this.isExpanded(data);
|
|
633
|
+
var checkboxProps = rowSelection && rowSelection.getCheckboxProps
|
|
634
|
+
? rowSelection.getCheckboxProps(data, rowIndex)
|
|
635
|
+
: {};
|
|
636
|
+
var children = !expandable && childrenColumnName && hasChildrenRow && isExpanded
|
|
637
|
+
? data[childrenColumnName].map(function (item, index) {
|
|
638
|
+
return _this.renderRow(item, index, tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(levels), false), [rowIndex], false));
|
|
639
|
+
})
|
|
640
|
+
: null;
|
|
964
641
|
return [
|
|
965
|
-
_J$X_("
|
|
966
|
-
'Table-row-disabled': !!checkboxProps.disabled
|
|
967
|
-
}), onMouseEnter: function (e) { return _this.onRowMouseEnter(e, data, rowIndex); }, onMouseLeave: function (e) { return _this.onRowMouseLeave(e, data, rowIndex); }, onClick: function (e) { return _this.onRowClick(e, data, rowIndex); } },
|
|
968
|
-
draggable ? (_J$X_(Cell["default"], { className: cx('Table-dragCell') },
|
|
969
|
-
_J$X_(icons.Icon, { icon: "drag-bar", className: "icon" }))) : null,
|
|
970
|
-
!draggable && rowSelection ? (_J$X_(Cell["default"], { fixed: rowSelection.fixed ? 'left' : '', className: cx('Table-checkCell') },
|
|
971
|
-
_J$X_(Checkbox["default"], tslib.__assign({ name: 'Table-checkbox', type: rowSelection.type || 'checkbox', partial: !isRadio && hasChildrenChecked && !isChecked, checked: isRadio ? isChecked : hasChildrenChecked || isChecked, onChange: function (value) {
|
|
972
|
-
if (!(rowSelection && rowSelection.rowClick)) {
|
|
973
|
-
_this.selectedSingleRow(value, data);
|
|
974
|
-
}
|
|
975
|
-
event && event.stopPropagation();
|
|
976
|
-
} }, checkboxProps)))) : null,
|
|
977
|
-
isLeftExpandable ? expandableCell : null,
|
|
978
|
-
cells,
|
|
979
|
-
isRightExpandable ? expandableCell : null),
|
|
642
|
+
_J$X_(Row["default"], tslib.__assign({ key: "row-".concat(rowIndex), data: data, rowIndex: rowIndex, levels: levels.join(','), columns: columns, selectable: !!rowSelection, rowSelectionFixed: !!(rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.fixed), rowSelectionType: (rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.type) || 'checkbox', expandable: !!expandable, expandableFixed: expandable === null || expandable === void 0 ? void 0 : expandable.fixed, expandedRowClassName: expandedRowClassName, expandedRowRender: expandable === null || expandable === void 0 ? void 0 : expandable.expandedRowRender, isExpanded: isExpanded, hasChildrenRow: hasChildrenRow, hasChildrenChecked: hasChildrenChecked, indentSize: indentSize, lineHeight: lineHeight, draggable: !!draggable, isExpandable: this.isExpandableTable(), isExpandableRow: isExpandableRow, colCount: this.getExtraColumnCount(), isRightExpandable: this.isRightExpandable(), isLeftExpandable: this.isLeftExpandable(), isChecked: isChecked, rowClassName: rowClassName, onExpand: this.onExpandRows, onCollapse: this.onCollapseRows, onMouseEnter: this.onRowMouseEnter, onMouseLeave: this.onRowMouseLeave, onClick: this.onRowClick, onDoubleClick: this.onRowDbClick, onChange: this.onRowChange, childrenColumnName: this.getChildrenColumnName(), keyField: keyField, classnames: cx, classPrefix: classPrefix }, checkboxProps)),
|
|
980
643
|
children
|
|
981
644
|
];
|
|
982
645
|
};
|
|
983
|
-
Table.prototype.
|
|
646
|
+
Table.prototype.onRowChange = function (value, record) {
|
|
647
|
+
var rowSelection = this.props.rowSelection;
|
|
648
|
+
if (!(rowSelection && rowSelection.rowClick)) {
|
|
649
|
+
this.selectedSingleRow(value, record);
|
|
650
|
+
}
|
|
651
|
+
};
|
|
652
|
+
Table.prototype.renderBody = function () {
|
|
984
653
|
var _this = this;
|
|
985
|
-
var _a = this.props, cx = _a.classnames, headSummary = _a.headSummary, scroll = _a.scroll, placeholder = _a.placeholder, sticky = _a.sticky, loading = _a.loading, loadingConfig = _a.loadingConfig;
|
|
654
|
+
var _a = this.props, cx = _a.classnames, headSummary = _a.headSummary, scroll = _a.scroll, placeholder = _a.placeholder, sticky = _a.sticky, loading = _a.loading, loadingConfig = _a.loadingConfig, classPrefix = _a.classPrefix;
|
|
986
655
|
var tdColumns = this.tdColumns;
|
|
987
656
|
var hasScrollY = scroll && scroll.y;
|
|
988
657
|
var colCount = this.getExtraColumnCount();
|
|
@@ -991,9 +660,9 @@ var Table = /** @class */ (function (_super) {
|
|
|
991
660
|
? this.renderSummaryRow(headSummary)
|
|
992
661
|
: null,
|
|
993
662
|
!!loading ? (_J$X_("tr", { className: cx('Table-row', 'Table-loading-row') },
|
|
994
|
-
_J$X_(Cell["default"], { colSpan: tdColumns.length + colCount },
|
|
663
|
+
_J$X_(Cell["default"], { classnames: cx, classPrefix: classPrefix, colSpan: tdColumns.length + colCount },
|
|
995
664
|
_J$X_("div", { className: cx('Table-loading') }, typeof loading === 'boolean' ? (_J$X_(Spinner["default"], { overlay: true, show: loading, loadingConfig: loadingConfig })) : React__default["default"].isValidElement(loading) ? (loading) : null)))) : !this.state.dataSource.length ? (_J$X_("tr", { className: cx('Table-row', 'Table-empty-row') },
|
|
996
|
-
_J$X_(Cell["default"], { colSpan: tdColumns.length + colCount },
|
|
665
|
+
_J$X_(Cell["default"], { classnames: cx, classPrefix: classPrefix, colSpan: tdColumns.length + colCount },
|
|
997
666
|
_J$X_("div", { className: cx('Table-empty') }, typeof placeholder === 'function'
|
|
998
667
|
? placeholder()
|
|
999
668
|
: placeholder)))) : (this.state.dataSource.map(function (data, index) {
|
|
@@ -1011,16 +680,11 @@ var Table = /** @class */ (function (_super) {
|
|
|
1011
680
|
var expandable = this.props.expandable;
|
|
1012
681
|
return expandable && expandable.position === 'right';
|
|
1013
682
|
};
|
|
1014
|
-
// 展开列放到左侧
|
|
683
|
+
// 展开列放到左侧 还有一种情况是position为none 无展开按钮
|
|
1015
684
|
Table.prototype.isLeftExpandable = function () {
|
|
1016
685
|
var expandable = this.props.expandable;
|
|
1017
686
|
return (expandable && (!expandable.position || expandable.position === 'left'));
|
|
1018
687
|
};
|
|
1019
|
-
Table.prototype.isNestedTable = function () {
|
|
1020
|
-
var _this = this;
|
|
1021
|
-
var dataSource = this.props.dataSource;
|
|
1022
|
-
return !!find__default["default"](dataSource, function (item) { return _this.hasChildrenRow(item); });
|
|
1023
|
-
};
|
|
1024
688
|
// 计算自动增加的列数
|
|
1025
689
|
// 选择、拖拽、展开
|
|
1026
690
|
Table.prototype.getExtraColumnCount = function () {
|
|
@@ -1040,46 +704,18 @@ var Table = /** @class */ (function (_super) {
|
|
|
1040
704
|
return count;
|
|
1041
705
|
};
|
|
1042
706
|
Table.prototype.renderSummaryRow = function (summary) {
|
|
1043
|
-
var
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
Array.isArray(s)
|
|
1052
|
-
? trs.push(_J$X_("tr", { onMouseEnter: function (e) { return _this.onRowMouseEnter(e); }, onMouseLeave: function (e) { return _this.onRowMouseLeave(e); }, key: 'summary-tr-' + index, className: cx('Table-summary-row') }, s.map(function (d, i) {
|
|
1053
|
-
// 将操作列自动添加到第一列,用户的colSpan只需要关心实际的列数
|
|
1054
|
-
var colSpan = i === 0
|
|
1055
|
-
? (d.colSpan || 1) + colCount - isRightExpandable
|
|
1056
|
-
: i === s.length - 1
|
|
1057
|
-
? (d.colSpan || 1) + isRightExpandable
|
|
1058
|
-
: d.colSpan;
|
|
1059
|
-
return (_J$X_(Cell["default"], { key: 'summary-tr-cell-' + i, fixed: d.fixed, colSpan: colSpan }, typeof d.render === 'function'
|
|
1060
|
-
? d.render(dataSource)
|
|
1061
|
-
: d.render));
|
|
1062
|
-
})))
|
|
1063
|
-
: cells.push(_J$X_(Cell["default"], { key: 'summary-cell-' + index, fixed: s.fixed, colSpan: cells.length === 0
|
|
1064
|
-
? (s.colSpan || 1) + colCount - isRightExpandable
|
|
1065
|
-
: index === summary.length - 1
|
|
1066
|
-
? (s.colSpan || 1) + isRightExpandable
|
|
1067
|
-
: s.colSpan }, typeof s.render === 'function'
|
|
1068
|
-
? s.render(dataSource)
|
|
1069
|
-
: s.render));
|
|
1070
|
-
})
|
|
1071
|
-
: null;
|
|
1072
|
-
return summary
|
|
1073
|
-
? typeof summary === 'function'
|
|
1074
|
-
? summary(dataSource)
|
|
1075
|
-
: tslib.__spreadArray([
|
|
1076
|
-
cells.length > 0 ? (_J$X_("tr", { onMouseEnter: function (e) { return _this.onRowMouseEnter(e); }, onMouseLeave: function (e) { return _this.onRowMouseLeave(e); }, key: "summary-row", className: cx('Table-summary-row') }, cells)) : null
|
|
1077
|
-
], tslib.__read(trs), false)
|
|
1078
|
-
: null;
|
|
707
|
+
var _a = this.props, cx = _a.classnames, classPrefix = _a.classPrefix;
|
|
708
|
+
if (typeof summary === 'function') {
|
|
709
|
+
return summary(this.state.dataSource);
|
|
710
|
+
}
|
|
711
|
+
if (React__default["default"].isValidElement(summary)) {
|
|
712
|
+
return summary;
|
|
713
|
+
}
|
|
714
|
+
return (_J$X_(SummaryRow["default"], { summary: summary, colCount: this.getExtraColumnCount(), isRightExpandable: this.isRightExpandable(), classnames: cx, classPrefix: classPrefix, dataSource: this.state.dataSource, onMouseEnter: this.onRowMouseEnter, onMouseLeave: this.onRowMouseLeave }));
|
|
1079
715
|
};
|
|
1080
|
-
Table.prototype.
|
|
716
|
+
Table.prototype.renderFoot = function () {
|
|
1081
717
|
var _a = this.props, cx = _a.classnames, footSummary = _a.footSummary;
|
|
1082
|
-
return (_J$X_("tfoot", {
|
|
718
|
+
return (_J$X_("tfoot", { className: cx('Table-summary') }, this.renderSummaryRow(footSummary)));
|
|
1083
719
|
};
|
|
1084
720
|
Table.prototype.updateTableDom = function (dom) {
|
|
1085
721
|
var cx = this.props.classnames;
|
|
@@ -1131,15 +767,15 @@ var Table = /** @class */ (function (_super) {
|
|
|
1131
767
|
var tableStyle = hasScrollX
|
|
1132
768
|
? { width: scroll.x + 'px', tableLayout: 'fixed' }
|
|
1133
769
|
: {};
|
|
1134
|
-
return (_J$X_("div", { ref: this.contentDom, className: cx('Table-content'), style: hasScrollX ? { overflow: 'auto hidden' } : {}, onMouseLeave: this.onMouseLeave
|
|
770
|
+
return (_J$X_("div", { ref: this.contentDom, className: cx('Table-content'), style: hasScrollX ? { overflow: 'auto hidden' } : {}, onMouseLeave: this.onMouseLeave, onScroll: this.onTableContentScroll.bind(this) },
|
|
1135
771
|
itemActions && hoverRow ? (_J$X_(ItemActionsWrapper["default"], { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
|
|
1136
772
|
? itemActions(hoverRow.record, hoverRow.rowIndex)
|
|
1137
773
|
: null)) : null,
|
|
1138
774
|
_J$X_("table", { style: tslib.__assign(tslib.__assign({}, tableStyle), { tableLayout: tableLayout === 'fixed' ? 'fixed' : 'auto' }), className: cx('Table-table') },
|
|
1139
775
|
this.renderColGroup(),
|
|
1140
|
-
showHeader ? this.
|
|
1141
|
-
this.
|
|
1142
|
-
footSummary ? this.
|
|
776
|
+
showHeader ? this.renderHead() : null,
|
|
777
|
+
this.renderBody(),
|
|
778
|
+
footSummary ? this.renderFoot() : null)));
|
|
1143
779
|
};
|
|
1144
780
|
Table.prototype.renderScrollTableHeader = function () {
|
|
1145
781
|
var _a;
|
|
@@ -1159,7 +795,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
1159
795
|
_a)), style: style },
|
|
1160
796
|
_J$X_("table", { className: cx('Table-table'), style: tslib.__assign(tslib.__assign({}, tableStyle), { tableLayout: 'fixed' }) },
|
|
1161
797
|
this.renderColGroup(true),
|
|
1162
|
-
showHeader ? this.
|
|
798
|
+
showHeader ? this.renderHead() : null,
|
|
1163
799
|
headSummary ? (_J$X_("tbody", null, this.renderSummaryRow(headSummary))) : null)));
|
|
1164
800
|
};
|
|
1165
801
|
Table.prototype.renderScrollTableBody = function () {
|
|
@@ -1176,22 +812,22 @@ var Table = /** @class */ (function (_super) {
|
|
|
1176
812
|
});
|
|
1177
813
|
}
|
|
1178
814
|
var hoverRow = this.state.hoverRow;
|
|
1179
|
-
return (_J$X_("div", { ref: this.contentDom, className: cx('Table-body'), style: style, onMouseLeave: this.onMouseLeave
|
|
815
|
+
return (_J$X_("div", { ref: this.contentDom, className: cx('Table-body'), style: style, onMouseLeave: this.onMouseLeave, onScroll: this.onTableScroll },
|
|
1180
816
|
itemActions && hoverRow ? (_J$X_(ItemActionsWrapper["default"], { dom: hoverRow.target, classnames: cx }, typeof itemActions === 'function'
|
|
1181
817
|
? itemActions(hoverRow.record, hoverRow.rowIndex)
|
|
1182
818
|
: null)) : null,
|
|
1183
819
|
_J$X_("table", { className: cx('Table-table'), style: tslib.__assign(tslib.__assign({}, tableStyle), { tableLayout: 'fixed' }) },
|
|
1184
820
|
this.renderColGroup(),
|
|
1185
|
-
this.
|
|
821
|
+
this.renderBody())));
|
|
1186
822
|
};
|
|
1187
823
|
Table.prototype.renderScrollTableFoot = function () {
|
|
1188
824
|
var _a = this.props, scroll = _a.scroll, cx = _a.classnames;
|
|
1189
825
|
return (_J$X_("div", { ref: this.footDom, className: cx('Table-summary'), style: { overflow: 'hidden' } },
|
|
1190
|
-
_J$X_("table", { className: cx('Table-table'), style: { width: (scroll === null || scroll === void 0 ? void 0 : scroll.x) + 'px' || '100%', tableLayout: 'fixed' } }, this.
|
|
826
|
+
_J$X_("table", { className: cx('Table-table'), style: { width: (scroll === null || scroll === void 0 ? void 0 : scroll.x) + 'px' || '100%', tableLayout: 'fixed' } }, this.renderFoot())));
|
|
1191
827
|
};
|
|
1192
828
|
Table.prototype.renderScrollTable = function () {
|
|
1193
829
|
var _a = this.props, footSummary = _a.footSummary, cx = _a.classnames;
|
|
1194
|
-
return (_J$X_("div", { className: cx('Table-container') },
|
|
830
|
+
return (_J$X_("div", { className: cx('Table-container'), ref: this.containerDom },
|
|
1195
831
|
this.renderScrollTableHeader(),
|
|
1196
832
|
this.renderScrollTableBody(),
|
|
1197
833
|
footSummary ? this.renderScrollTableFoot() : null));
|
|
@@ -1223,15 +859,19 @@ var Table = /** @class */ (function (_super) {
|
|
|
1223
859
|
};
|
|
1224
860
|
Table.prototype.initTableWidth = function () {
|
|
1225
861
|
var _this = this;
|
|
1226
|
-
var _a;
|
|
1227
862
|
var tableWrapperDom = this.contentDom.current;
|
|
1228
863
|
if (!tableWrapperDom) {
|
|
1229
864
|
return;
|
|
1230
865
|
}
|
|
1231
|
-
var
|
|
866
|
+
var _a = this.props, scroll = _a.scroll, tableLayout = _a.tableLayout;
|
|
1232
867
|
var table = tableWrapperDom.querySelector('table');
|
|
868
|
+
var thead = tableWrapperDom.querySelector('thead');
|
|
869
|
+
if (!thead) {
|
|
870
|
+
if (this.headerDom.current) {
|
|
871
|
+
thead = this.headerDom.current.querySelector('thead');
|
|
872
|
+
}
|
|
873
|
+
}
|
|
1233
874
|
var tableWidth = scroll && scroll.x ? scroll.x : tableWrapperDom.offsetWidth;
|
|
1234
|
-
var thead = (_a = this.theadDom) === null || _a === void 0 ? void 0 : _a.current;
|
|
1235
875
|
var tbody = null;
|
|
1236
876
|
var htmls = [];
|
|
1237
877
|
var isFixed = tableLayout === 'fixed' || (scroll && scroll.x);
|
|
@@ -1309,16 +949,15 @@ var Table = /** @class */ (function (_super) {
|
|
|
1309
949
|
if (this.resizeTarget) {
|
|
1310
950
|
return;
|
|
1311
951
|
}
|
|
952
|
+
this.syncTableWidth();
|
|
1312
953
|
this.initTableWidth();
|
|
1313
954
|
};
|
|
1314
955
|
Table.prototype.render = function () {
|
|
1315
956
|
var _a;
|
|
1316
957
|
var _b = this.props, title = _b.title, footer = _b.footer, className = _b.className, scroll = _b.scroll, size = _b.size, bordered = _b.bordered, resizable = _b.resizable, columns = _b.columns, sticky = _b.sticky, cx = _b.classnames;
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
this.
|
|
1320
|
-
this.tdColumns = [];
|
|
1321
|
-
buildColumns(filterColumns, this.thColumns, this.tdColumns, getMaxLevelThRowSpan(filterColumns));
|
|
958
|
+
var _c = util.getBuildColumns(columns), thColumns = _c.thColumns, tdColumns = _c.tdColumns;
|
|
959
|
+
this.thColumns = thColumns;
|
|
960
|
+
this.tdColumns = tdColumns;
|
|
1322
961
|
// 是否设置了纵向滚动
|
|
1323
962
|
var hasScrollY = scroll && scroll.y;
|
|
1324
963
|
// 是否设置了横向滚动
|
|
@@ -1330,7 +969,7 @@ var Table = /** @class */ (function (_super) {
|
|
|
1330
969
|
_a[cx('Table-resizable')] = resizable,
|
|
1331
970
|
_a)) },
|
|
1332
971
|
title ? (_J$X_("div", { className: cx('Table-title') }, typeof title === 'function' ? title() : title)) : null,
|
|
1333
|
-
hasScrollY || sticky ? (this.renderScrollTable()) : (_J$X_("div", { className: cx('Table-container') }, this.renderTable())),
|
|
972
|
+
hasScrollY || sticky ? (this.renderScrollTable()) : (_J$X_("div", { className: cx('Table-container'), ref: this.containerDom }, this.renderTable())),
|
|
1334
973
|
footer ? (_J$X_("div", { className: cx('Table-footer') }, typeof footer === 'function' ? footer() : footer)) : null));
|
|
1335
974
|
};
|
|
1336
975
|
Table.defaultProps = {
|
|
@@ -1349,6 +988,12 @@ var Table = /** @class */ (function (_super) {
|
|
|
1349
988
|
tslib.__metadata("design:paramtypes", []),
|
|
1350
989
|
tslib.__metadata("design:returntype", void 0)
|
|
1351
990
|
], Table.prototype, "getPopOverContainer", null);
|
|
991
|
+
tslib.__decorate([
|
|
992
|
+
amisCore.autobind,
|
|
993
|
+
tslib.__metadata("design:type", Function),
|
|
994
|
+
tslib.__metadata("design:paramtypes", []),
|
|
995
|
+
tslib.__metadata("design:returntype", void 0)
|
|
996
|
+
], Table.prototype, "updateAutoFillHeight", null);
|
|
1352
997
|
tslib.__decorate([
|
|
1353
998
|
amisCore.autobind,
|
|
1354
999
|
tslib.__metadata("design:type", Function),
|
|
@@ -1361,6 +1006,60 @@ var Table = /** @class */ (function (_super) {
|
|
|
1361
1006
|
tslib.__metadata("design:paramtypes", [MouseEvent]),
|
|
1362
1007
|
tslib.__metadata("design:returntype", void 0)
|
|
1363
1008
|
], Table.prototype, "onResizeMouseUp", null);
|
|
1009
|
+
tslib.__decorate([
|
|
1010
|
+
amisCore.autobind,
|
|
1011
|
+
tslib.__metadata("design:type", Function),
|
|
1012
|
+
tslib.__metadata("design:paramtypes", [Object, Object, Number]),
|
|
1013
|
+
tslib.__metadata("design:returntype", Promise)
|
|
1014
|
+
], Table.prototype, "onRowClick", null);
|
|
1015
|
+
tslib.__decorate([
|
|
1016
|
+
amisCore.autobind,
|
|
1017
|
+
tslib.__metadata("design:type", Function),
|
|
1018
|
+
tslib.__metadata("design:paramtypes", [Object, Object, Number]),
|
|
1019
|
+
tslib.__metadata("design:returntype", Promise)
|
|
1020
|
+
], Table.prototype, "onRowDbClick", null);
|
|
1021
|
+
tslib.__decorate([
|
|
1022
|
+
amisCore.autobind,
|
|
1023
|
+
tslib.__metadata("design:type", Function),
|
|
1024
|
+
tslib.__metadata("design:paramtypes", [Object, Object, Number]),
|
|
1025
|
+
tslib.__metadata("design:returntype", Promise)
|
|
1026
|
+
], Table.prototype, "onRowMouseEnter", null);
|
|
1027
|
+
tslib.__decorate([
|
|
1028
|
+
amisCore.autobind,
|
|
1029
|
+
tslib.__metadata("design:type", Function),
|
|
1030
|
+
tslib.__metadata("design:paramtypes", [Object, Object, Number]),
|
|
1031
|
+
tslib.__metadata("design:returntype", Promise)
|
|
1032
|
+
], Table.prototype, "onRowMouseLeave", null);
|
|
1033
|
+
tslib.__decorate([
|
|
1034
|
+
amisCore.autobind,
|
|
1035
|
+
tslib.__metadata("design:type", Function),
|
|
1036
|
+
tslib.__metadata("design:paramtypes", []),
|
|
1037
|
+
tslib.__metadata("design:returntype", void 0)
|
|
1038
|
+
], Table.prototype, "onMouseLeave", null);
|
|
1039
|
+
tslib.__decorate([
|
|
1040
|
+
amisCore.autobind,
|
|
1041
|
+
tslib.__metadata("design:type", Function),
|
|
1042
|
+
tslib.__metadata("design:paramtypes", [Array]),
|
|
1043
|
+
tslib.__metadata("design:returntype", void 0)
|
|
1044
|
+
], Table.prototype, "onExpandRows", null);
|
|
1045
|
+
tslib.__decorate([
|
|
1046
|
+
amisCore.autobind,
|
|
1047
|
+
tslib.__metadata("design:type", Function),
|
|
1048
|
+
tslib.__metadata("design:paramtypes", [Array]),
|
|
1049
|
+
tslib.__metadata("design:returntype", void 0)
|
|
1050
|
+
], Table.prototype, "onCollapseRows", null);
|
|
1051
|
+
tslib.__decorate([
|
|
1052
|
+
amisCore.autobind,
|
|
1053
|
+
tslib.__metadata("design:type", Function),
|
|
1054
|
+
tslib.__metadata("design:paramtypes", [Boolean, Object]),
|
|
1055
|
+
tslib.__metadata("design:returntype", void 0)
|
|
1056
|
+
], Table.prototype, "onRowChange", null);
|
|
1057
|
+
tslib.__decorate([
|
|
1058
|
+
amisCore.autobind,
|
|
1059
|
+
tslib.__metadata("design:type", Function),
|
|
1060
|
+
tslib.__metadata("design:paramtypes", [Object]),
|
|
1061
|
+
tslib.__metadata("design:returntype", void 0)
|
|
1062
|
+
], Table.prototype, "onTableScroll", null);
|
|
1364
1063
|
tslib.__decorate([
|
|
1365
1064
|
amisCore.autobind,
|
|
1366
1065
|
tslib.__metadata("design:type", Function),
|
|
@@ -1383,5 +1082,6 @@ var Table = /** @class */ (function (_super) {
|
|
|
1383
1082
|
}(React__default["default"].PureComponent));
|
|
1384
1083
|
var index = amisCore.themeable(amisCore.localeable(Table));
|
|
1385
1084
|
|
|
1085
|
+
exports.DefaultCellWidth = DefaultCellWidth;
|
|
1386
1086
|
exports.Table = Table;
|
|
1387
1087
|
exports["default"] = index;
|