@sheinx/hooks 3.0.0-rc.1 → 3.0.0-rc.10
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/cjs/common/type.d.ts +15 -15
- package/cjs/common/type.d.ts.map +1 -1
- package/cjs/common/use-click-away/index.d.ts +2 -2
- package/cjs/common/use-click-away/index.d.ts.map +1 -1
- package/cjs/common/use-click-away/index.js +2 -3
- package/cjs/common/use-default-value/index.js +2 -2
- package/cjs/common/use-default-value/use-default-value.js +9 -5
- package/cjs/common/use-drag-mock/index.js +2 -2
- package/cjs/common/use-drag-mock/use-drag-mock.js +11 -8
- package/cjs/common/use-drag-mock/use-drag-move.js +15 -11
- package/cjs/common/use-drag-mock/use-drag-resize.js +9 -5
- package/cjs/common/use-filter/index.js +2 -2
- package/cjs/common/use-filter/use-filter.js +17 -13
- package/cjs/common/use-fork-ref/index.js +5 -10
- package/cjs/common/use-func-change/index.js +2 -2
- package/cjs/common/use-func-change/use-func-change.d.ts +1 -1
- package/cjs/common/use-func-change/use-func-change.js +2 -3
- package/cjs/common/use-input-able/index.js +2 -2
- package/cjs/common/use-input-able/use-Input-able.js +8 -4
- package/cjs/common/use-input-able/use-Input-able.type.d.ts +1 -1
- package/cjs/common/use-input-able/use-Input-able.type.d.ts.map +1 -1
- package/cjs/common/use-key-event/index.js +6 -8
- package/cjs/common/use-latest-obj/index.js +1 -3
- package/cjs/common/use-list-select/index.js +2 -2
- package/cjs/common/use-list-select/use-list-select-multiple.js +26 -39
- package/cjs/common/use-list-select/use-list-select-single.js +9 -11
- package/cjs/common/use-list-select/use-list-select.js +10 -12
- package/cjs/common/use-pagination-list/index.js +17 -15
- package/cjs/common/use-persist-fn/index.js +1 -2
- package/cjs/common/use-position-style/get-position-style.js +10 -7
- package/cjs/common/use-position-style/index.d.ts +3 -3
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +16 -22
- package/cjs/common/use-previous/index.js +1 -2
- package/cjs/common/use-render/index.js +8 -5
- package/cjs/common/use-resize/index.js +11 -9
- package/cjs/common/use-safe-state/index.js +8 -5
- package/cjs/common/use-style/index.js +0 -2
- package/cjs/common/use-toggle/index.d.ts +1 -1
- package/cjs/common/use-toggle/index.d.ts.map +1 -1
- package/cjs/common/use-toggle/index.js +7 -3
- package/cjs/common/use-transform/index.js +2 -2
- package/cjs/common/use-transform/use-transform.js +13 -11
- package/cjs/common/use-unmounted-ref/index.js +1 -2
- package/cjs/components/use-button/index.js +2 -2
- package/cjs/components/use-button/use-button.d.ts +5 -6
- package/cjs/components/use-button/use-button.d.ts.map +1 -1
- package/cjs/components/use-button/use-button.js +15 -32
- package/cjs/components/use-button/use-button.type.d.ts +3 -8
- package/cjs/components/use-button/use-button.type.d.ts.map +1 -1
- package/cjs/components/use-carousel/index.js +2 -2
- package/cjs/components/use-carousel/use-carousel.d.ts +1 -1
- package/cjs/components/use-carousel/use-carousel.d.ts.map +1 -1
- package/cjs/components/use-carousel/use-carousel.js +9 -5
- package/cjs/components/use-cascader/index.js +2 -2
- package/cjs/components/use-cascader/use-cascader.js +2 -3
- package/cjs/components/use-check/index.js +2 -2
- package/cjs/components/use-check/use-check.d.ts +3 -3
- package/cjs/components/use-check/use-check.js +24 -17
- package/cjs/components/use-collapse/index.js +2 -2
- package/cjs/components/use-collapse/use-collapse-item.d.ts +4 -4
- package/cjs/components/use-collapse/use-collapse-item.js +7 -10
- package/cjs/components/use-collapse/use-collapse-item.type.d.ts +1 -1
- package/cjs/components/use-collapse/use-collapse-item.type.d.ts.map +1 -1
- package/cjs/components/use-collapse/use-collapse.js +14 -13
- package/cjs/components/use-datepicker/index.js +2 -2
- package/cjs/components/use-datepicker/use-date.js +13 -11
- package/cjs/components/use-datepicker/use-datepicker-format.js +26 -21
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +4 -4
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-range.js +10 -7
- package/cjs/components/use-datepicker/use-datepicker-range.type.d.ts +1 -1
- package/cjs/components/use-datepicker/use-datepicker-range.type.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-month.js +13 -11
- package/cjs/components/use-datepicker/use-quarter.js +13 -12
- package/cjs/components/use-datepicker/use-time.js +3 -8
- package/cjs/components/use-datepicker/use-year.js +13 -11
- package/cjs/components/use-datepicker/util.d.ts +3 -3
- package/cjs/components/use-datepicker/util.d.ts.map +1 -1
- package/cjs/components/use-datepicker/util.js +13 -20
- package/cjs/components/use-descriptions/index.js +2 -2
- package/cjs/components/use-descriptions/use-descriptions.js +14 -11
- package/cjs/components/use-form/Provider.js +6 -10
- package/cjs/components/use-form/form-bind-context.js +6 -11
- package/cjs/components/use-form/form-config-context.js +6 -11
- package/cjs/components/use-form/form-func-context.js +6 -11
- package/cjs/components/use-form/index.js +2 -3
- package/cjs/components/use-form/use-form-control/index.js +2 -2
- package/cjs/components/use-form/use-form-control/use-form-control.js +23 -23
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +10 -19
- package/cjs/components/use-form/use-form-fieldset/index.js +2 -2
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.js +3 -5
- package/cjs/components/use-form/use-form-flow/index.js +2 -2
- package/cjs/components/use-form/use-form-flow/use-form-datum.js +1 -2
- package/cjs/components/use-form/use-form-flow/use-form-flow.js +2 -3
- package/cjs/components/use-form/use-form-item/form-item-context.js +5 -9
- package/cjs/components/use-form/use-form-item/index.js +2 -2
- package/cjs/components/use-form/use-form-item/use-form-item.js +12 -13
- package/cjs/components/use-form/use-form.d.ts +2 -2
- package/cjs/components/use-form/use-form.js +28 -37
- package/cjs/components/use-form/use-form.type.d.ts +4 -4
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-image/index.js +2 -2
- package/cjs/components/use-image/use-image-gallery.d.ts +4 -4
- package/cjs/components/use-image/use-image-gallery.d.ts.map +1 -1
- package/cjs/components/use-image/use-image-gallery.js +18 -15
- package/cjs/components/use-image/use-image-gallery.type.d.ts +1 -1
- package/cjs/components/use-image/use-image-gallery.type.d.ts.map +1 -1
- package/cjs/components/use-image/use-image-group.d.ts +2 -2
- package/cjs/components/use-image/use-image-group.d.ts.map +1 -1
- package/cjs/components/use-image/use-image-group.js +9 -12
- package/cjs/components/use-image/use-image-magnify.js +13 -13
- package/cjs/components/use-image/use-image.d.ts +3 -3
- package/cjs/components/use-image/use-image.d.ts.map +1 -1
- package/cjs/components/use-image/use-image.js +17 -23
- package/cjs/components/use-image/use-image.type.d.ts +4 -4
- package/cjs/components/use-image/use-image.type.d.ts.map +1 -1
- package/cjs/components/use-input/index.js +2 -2
- package/cjs/components/use-input/use-input-format.d.ts +1 -1
- package/cjs/components/use-input/use-input-format.js +13 -15
- package/cjs/components/use-input/use-input-format.type.d.ts +1 -1
- package/cjs/components/use-input/use-input-format.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.js +15 -16
- package/cjs/components/use-input/use-input-number.type.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-password.js +11 -9
- package/cjs/components/use-input/use-input-password.type.d.ts +1 -1
- package/cjs/components/use-input/use-input-password.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input.d.ts +3 -3
- package/cjs/components/use-input/use-input.js +30 -29
- package/cjs/components/use-input/use-input.type.d.ts +5 -5
- package/cjs/components/use-input/use-input.type.d.ts.map +1 -1
- package/cjs/components/use-menu/index.js +2 -2
- package/cjs/components/use-menu/use-menu-item.d.ts +1 -1
- package/cjs/components/use-menu/use-menu-item.d.ts.map +1 -1
- package/cjs/components/use-menu/use-menu-item.js +11 -12
- package/cjs/components/use-menu/use-menu.js +2 -8
- package/cjs/components/use-menu/use-menu.type.d.ts +1 -1
- package/cjs/components/use-menu/use-menu.type.d.ts.map +1 -1
- package/cjs/components/use-pagination/index.js +2 -2
- package/cjs/components/use-pagination/use-pagination.d.ts +1 -1
- package/cjs/components/use-pagination/use-pagination.d.ts.map +1 -1
- package/cjs/components/use-pagination/use-pagination.js +19 -13
- package/cjs/components/use-popup/index.js +2 -2
- package/cjs/components/use-popup/popup-context.js +1 -2
- package/cjs/components/use-popup/use-popup.js +14 -11
- package/cjs/components/use-popup/use-popup.type.d.ts +1 -1
- package/cjs/components/use-popup/use-popup.type.d.ts.map +1 -1
- package/cjs/components/use-select/index.js +2 -2
- package/cjs/components/use-select/use-select-group.js +13 -10
- package/cjs/components/use-select/use-select.js +1 -2
- package/cjs/components/use-select/use-select.type.d.ts +1 -1
- package/cjs/components/use-select/use-select.type.d.ts.map +1 -1
- package/cjs/components/use-slider/index.js +2 -2
- package/cjs/components/use-slider/use-slider.js +15 -10
- package/cjs/components/use-table/index.js +2 -2
- package/cjs/components/use-table/use-table-columns.d.ts +1 -1
- package/cjs/components/use-table/use-table-columns.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-columns.js +4 -8
- package/cjs/components/use-table/use-table-expand.js +19 -20
- package/cjs/components/use-table/use-table-group.js +1 -7
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +36 -34
- package/cjs/components/use-table/use-table-row.js +8 -9
- package/cjs/components/use-table/use-table-sort.d.ts +1 -1
- package/cjs/components/use-table/use-table-sort.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-sort.js +21 -22
- package/cjs/components/use-table/use-table-tree.d.ts +1 -1
- package/cjs/components/use-table/use-table-tree.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-tree.js +48 -57
- package/cjs/components/use-table/use-table-virtual.js +17 -13
- package/cjs/components/use-table/use-table.type.d.ts +4 -4
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/components/use-tabs/context.js +7 -13
- package/cjs/components/use-tabs/index.js +2 -2
- package/cjs/components/use-tabs/use-tabs.js +9 -6
- package/cjs/components/use-tabs/use-tabs.type.d.ts +1 -1
- package/cjs/components/use-tabs/use-tabs.type.d.ts.map +1 -1
- package/cjs/components/use-textarea/index.js +2 -2
- package/cjs/components/use-textarea/use-textarea-format.js +5 -7
- package/cjs/components/use-textarea/use-textarea-format.type.d.ts +1 -1
- package/cjs/components/use-textarea/use-textarea-format.type.d.ts.map +1 -1
- package/cjs/components/use-textarea/use-textarea.d.ts +2 -2
- package/cjs/components/use-textarea/use-textarea.js +23 -18
- package/cjs/components/use-textarea/use-textarea.type.d.ts +3 -3
- package/cjs/components/use-textarea/use-textarea.type.d.ts.map +1 -1
- package/cjs/components/use-transfer/index.js +2 -2
- package/cjs/components/use-transfer/use-transfer.js +20 -19
- package/cjs/components/use-transfer/use-transfer.type.d.ts +1 -1
- package/cjs/components/use-transfer/use-transfer.type.d.ts.map +1 -1
- package/cjs/components/use-tree/index.js +2 -2
- package/cjs/components/use-tree/use-tree-node.js +11 -7
- package/cjs/components/use-tree/use-tree-node.type.d.ts +2 -2
- package/cjs/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +11 -16
- package/cjs/components/use-tree/use-tree.type.d.ts +3 -3
- package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/cjs/components/use-treeselect/index.js +2 -2
- package/cjs/components/use-treeselect/use-tiled.js +13 -9
- package/cjs/components/use-treeselect/use-tiled.type.d.ts +1 -1
- package/cjs/components/use-treeselect/use-tiled.type.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-treeselect.js +1 -2
- package/cjs/components/use-upload/index.js +2 -2
- package/cjs/components/use-upload/use-upload.js +36 -34
- package/cjs/components/use-upload/xhr.js +0 -1
- package/cjs/components/use-validate/index.js +2 -2
- package/cjs/components/use-validate/use-validate.js +9 -5
- package/cjs/index.js +4 -9
- package/cjs/utils/accept.d.ts +1 -1
- package/cjs/utils/accept.d.ts.map +1 -1
- package/cjs/utils/accept.js +0 -4
- package/cjs/utils/array.js +2 -4
- package/cjs/utils/attribute.js +3 -5
- package/cjs/utils/clone.js +11 -20
- package/cjs/utils/document.js +2 -4
- package/cjs/utils/dom/element.js +11 -11
- package/cjs/utils/dom/index.js +2 -3
- package/cjs/utils/dom/responsiveObserve.js +10 -15
- package/cjs/utils/dom/responsiveObserve.type.d.ts +4 -4
- package/cjs/utils/dom/responsiveObserve.type.d.ts.map +1 -1
- package/cjs/utils/dom/scroll-behavior.js +2 -3
- package/cjs/utils/extract-event-handlers.js +0 -6
- package/cjs/utils/func.js +3 -5
- package/cjs/utils/immer.d.ts +1 -8
- package/cjs/utils/immer.d.ts.map +1 -1
- package/cjs/utils/immer.js +11 -8
- package/cjs/utils/index.js +2 -3
- package/cjs/utils/is.d.ts +1 -1
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +30 -55
- package/cjs/utils/lazyload.d.ts +1 -1
- package/cjs/utils/lazyload.d.ts.map +1 -1
- package/cjs/utils/lazyload.js +0 -1
- package/cjs/utils/number.js +0 -7
- package/cjs/utils/object.d.ts +4 -4
- package/cjs/utils/object.d.ts.map +1 -1
- package/cjs/utils/object.js +18 -37
- package/cjs/utils/position.js +4 -3
- package/cjs/utils/react-render.d.ts +1 -1
- package/cjs/utils/react-render.d.ts.map +1 -1
- package/cjs/utils/react-render.js +17 -24
- package/cjs/utils/render.d.ts +1 -1
- package/cjs/utils/render.d.ts.map +1 -1
- package/cjs/utils/render.js +3 -5
- package/cjs/utils/rule/index.js +2 -2
- package/cjs/utils/rule/length.d.ts +1 -1
- package/cjs/utils/rule/length.js +9 -11
- package/cjs/utils/rule/regexp.d.ts +1 -1
- package/cjs/utils/rule/regexp.js +4 -9
- package/cjs/utils/rule/required.d.ts +1 -1
- package/cjs/utils/rule/required.js +3 -5
- package/cjs/utils/rule/rule.js +4 -9
- package/cjs/utils/rule/rule.type.d.ts +8 -8
- package/cjs/utils/rule/rule.type.d.ts.map +1 -1
- package/cjs/utils/rule/type.d.ts +1 -1
- package/cjs/utils/rule/type.js +3 -5
- package/cjs/utils/shallow-equal.js +4 -9
- package/cjs/utils/string.js +0 -7
- package/cjs/utils/style-unit.js +0 -2
- package/cjs/utils/tree.d.ts +1 -1
- package/cjs/utils/tree.d.ts.map +1 -1
- package/cjs/utils/tree.js +19 -21
- package/cjs/utils/uid.js +0 -11
- package/cjs/utils/validate/error.js +22 -18
- package/cjs/utils/validate/get-rule.js +1 -4
- package/cjs/utils/validate/index.d.ts +1 -1
- package/cjs/utils/validate/index.d.ts.map +1 -1
- package/cjs/utils/validate/index.js +13 -13
- package/cjs/utils/validate/isJson.js +2 -5
- package/cjs/utils/validate/nullable.js +2 -3
- package/cjs/utils/validate/type.d.ts +1 -1
- package/cjs/utils/validate/type.d.ts.map +1 -1
- package/cjs/utils/validate/type.js +4 -9
- package/esm/common/type.d.ts +15 -15
- package/esm/common/type.d.ts.map +1 -1
- package/esm/common/type.js +1 -5
- package/esm/common/use-click-away/index.d.ts +2 -2
- package/esm/common/use-click-away/index.d.ts.map +1 -1
- package/esm/common/use-click-away/index.js +8 -17
- package/esm/common/use-default-value/index.js +2 -26
- package/esm/common/use-default-value/use-default-value.js +16 -19
- package/esm/common/use-default-value/use-previous.js +4 -10
- package/esm/common/use-drag-mock/index.js +3 -33
- package/esm/common/use-drag-mock/use-drag-mock.js +17 -20
- package/esm/common/use-drag-mock/use-drag-move.js +25 -28
- package/esm/common/use-drag-mock/use-drag-resize.js +19 -22
- package/esm/common/use-filter/index.js +1 -19
- package/esm/common/use-filter/use-filter.js +34 -36
- package/esm/common/use-filter/use-filter.type.js +1 -5
- package/esm/common/use-fork-ref/index.js +5 -20
- package/esm/common/use-fork-ref/setRef.js +1 -7
- package/esm/common/use-func-change/index.js +1 -19
- package/esm/common/use-func-change/use-func-change.d.ts +1 -1
- package/esm/common/use-func-change/use-func-change.js +8 -16
- package/esm/common/use-input-able/index.js +1 -19
- package/esm/common/use-input-able/use-Input-able.js +25 -28
- package/esm/common/use-input-able/use-Input-able.type.d.ts +1 -1
- package/esm/common/use-input-able/use-Input-able.type.d.ts.map +1 -1
- package/esm/common/use-input-able/use-Input-able.type.js +1 -5
- package/esm/common/use-key-event/index.js +7 -15
- package/esm/common/use-latest-obj/index.js +4 -12
- package/esm/common/use-list-select/index.js +3 -33
- package/esm/common/use-list-select/use-list-select-multiple.js +41 -64
- package/esm/common/use-list-select/use-list-select-single.js +17 -26
- package/esm/common/use-list-select/use-list-select.js +16 -25
- package/esm/common/use-list-select/use-list.type.js +1 -5
- package/esm/common/use-pagination-list/index.js +22 -26
- package/esm/common/use-persist-fn/index.js +5 -11
- package/esm/common/use-position-style/get-position-style.js +10 -13
- package/esm/common/use-position-style/index.d.ts +3 -3
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +25 -41
- package/esm/common/use-previous/index.js +5 -13
- package/esm/common/use-render/index.js +15 -19
- package/esm/common/use-resize/index.js +17 -21
- package/esm/common/use-safe-state/index.js +15 -19
- package/esm/common/use-style/index.js +3 -11
- package/esm/common/use-toggle/index.d.ts +1 -1
- package/esm/common/use-toggle/index.d.ts.map +1 -1
- package/esm/common/use-toggle/index.js +12 -14
- package/esm/common/use-transform/index.js +1 -19
- package/esm/common/use-transform/use-transform.js +23 -27
- package/esm/common/use-transform/use-transform.type.js +1 -5
- package/esm/common/use-unmounted-ref/index.js +5 -13
- package/esm/components/use-button/index.js +1 -19
- package/esm/components/use-button/use-button-group.type.js +1 -5
- package/esm/components/use-button/use-button.d.ts +5 -6
- package/esm/components/use-button/use-button.d.ts.map +1 -1
- package/esm/components/use-button/use-button.js +20 -43
- package/esm/components/use-button/use-button.type.d.ts +3 -8
- package/esm/components/use-button/use-button.type.d.ts.map +1 -1
- package/esm/components/use-button/use-button.type.js +1 -5
- package/esm/components/use-carousel/index.js +1 -19
- package/esm/components/use-carousel/use-carousel.d.ts +1 -1
- package/esm/components/use-carousel/use-carousel.d.ts.map +1 -1
- package/esm/components/use-carousel/use-carousel.js +21 -24
- package/esm/components/use-cascader/index.js +1 -19
- package/esm/components/use-cascader/use-cascader.js +5 -13
- package/esm/components/use-cascader/use-cascader.type.js +1 -5
- package/esm/components/use-check/index.js +1 -19
- package/esm/components/use-check/use-check.d.ts +3 -3
- package/esm/components/use-check/use-check.js +32 -31
- package/esm/components/use-check/use-check.type.js +1 -5
- package/esm/components/use-collapse/index.js +2 -26
- package/esm/components/use-collapse/use-collapse-item.d.ts +4 -4
- package/esm/components/use-collapse/use-collapse-item.js +9 -18
- package/esm/components/use-collapse/use-collapse-item.type.d.ts +1 -1
- package/esm/components/use-collapse/use-collapse-item.type.d.ts.map +1 -1
- package/esm/components/use-collapse/use-collapse-item.type.js +1 -5
- package/esm/components/use-collapse/use-collapse.js +17 -22
- package/esm/components/use-collapse/use-collapse.type.js +1 -5
- package/esm/components/use-datepicker/index.js +8 -62
- package/esm/components/use-datepicker/use-date.js +53 -57
- package/esm/components/use-datepicker/use-date.type.js +1 -5
- package/esm/components/use-datepicker/use-datepicker-format.js +54 -56
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +4 -4
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.type.js +1 -5
- package/esm/components/use-datepicker/use-datepicker-range.js +43 -47
- package/esm/components/use-datepicker/use-datepicker-range.type.d.ts +1 -1
- package/esm/components/use-datepicker/use-datepicker-range.type.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-range.type.js +1 -5
- package/esm/components/use-datepicker/use-month.js +37 -41
- package/esm/components/use-datepicker/use-month.type.js +1 -5
- package/esm/components/use-datepicker/use-quarter.js +36 -41
- package/esm/components/use-datepicker/use-quarter.type.js +1 -5
- package/esm/components/use-datepicker/use-time.js +23 -35
- package/esm/components/use-datepicker/use-time.type.js +1 -5
- package/esm/components/use-datepicker/use-year.js +37 -41
- package/esm/components/use-datepicker/use-year.type.js +1 -5
- package/esm/components/use-datepicker/util.d.ts +3 -3
- package/esm/components/use-datepicker/util.d.ts.map +1 -1
- package/esm/components/use-datepicker/util.js +67 -80
- package/esm/components/use-descriptions/index.js +1 -19
- package/esm/components/use-descriptions/use-descriptions.js +24 -27
- package/esm/components/use-descriptions/use-descriptions.type.js +1 -5
- package/esm/components/use-form/Provider.js +12 -26
- package/esm/components/use-form/form-bind-context.js +4 -17
- package/esm/components/use-form/form-config-context.js +4 -17
- package/esm/components/use-form/form-func-context.js +4 -17
- package/esm/components/use-form/index.js +7 -87
- package/esm/components/use-form/use-form-control/index.js +1 -19
- package/esm/components/use-form/use-form-control/use-form-control.js +57 -66
- package/esm/components/use-form/use-form-control/use-form-control.type.js +1 -5
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +13 -29
- package/esm/components/use-form/use-form-fieldset/index.js +2 -26
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.js +6 -15
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.type.js +1 -5
- package/esm/components/use-form/use-form-flow/index.js +2 -26
- package/esm/components/use-form/use-form-flow/use-form-datum.js +4 -11
- package/esm/components/use-form/use-form-flow/use-form-flow.js +9 -17
- package/esm/components/use-form/use-form-flow/use-form-flow.type.js +1 -5
- package/esm/components/use-form/use-form-item/form-item-context.js +3 -15
- package/esm/components/use-form/use-form-item/index.js +1 -19
- package/esm/components/use-form/use-form-item/use-form-item.js +21 -32
- package/esm/components/use-form/use-form.d.ts +2 -2
- package/esm/components/use-form/use-form.js +65 -83
- package/esm/components/use-form/use-form.type.d.ts +4 -4
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-form/use-form.type.js +1 -5
- package/esm/components/use-image/index.js +4 -40
- package/esm/components/use-image/use-image-gallery.d.ts +4 -4
- package/esm/components/use-image/use-image-gallery.d.ts.map +1 -1
- package/esm/components/use-image/use-image-gallery.js +34 -37
- package/esm/components/use-image/use-image-gallery.type.d.ts +1 -1
- package/esm/components/use-image/use-image-gallery.type.d.ts.map +1 -1
- package/esm/components/use-image/use-image-gallery.type.js +1 -5
- package/esm/components/use-image/use-image-group.d.ts +2 -2
- package/esm/components/use-image/use-image-group.d.ts.map +1 -1
- package/esm/components/use-image/use-image-group.js +15 -24
- package/esm/components/use-image/use-image-group.type.js +1 -5
- package/esm/components/use-image/use-image-magnify.js +17 -26
- package/esm/components/use-image/use-image-magnify.type.js +1 -5
- package/esm/components/use-image/use-image.d.ts +3 -3
- package/esm/components/use-image/use-image.d.ts.map +1 -1
- package/esm/components/use-image/use-image.js +28 -41
- package/esm/components/use-image/use-image.type.d.ts +4 -4
- package/esm/components/use-image/use-image.type.d.ts.map +1 -1
- package/esm/components/use-image/use-image.type.js +1 -5
- package/esm/components/use-input/index.js +4 -40
- package/esm/components/use-input/use-input-format.d.ts +1 -1
- package/esm/components/use-input/use-input-format.js +18 -27
- package/esm/components/use-input/use-input-format.type.d.ts +1 -1
- package/esm/components/use-input/use-input-format.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.type.js +1 -5
- package/esm/components/use-input/use-input-number.d.ts +1 -1
- package/esm/components/use-input/use-input-number.js +23 -31
- package/esm/components/use-input/use-input-number.type.d.ts +1 -1
- package/esm/components/use-input/use-input-number.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.type.js +1 -5
- package/esm/components/use-input/use-input-password.js +16 -21
- package/esm/components/use-input/use-input-password.type.d.ts +1 -1
- package/esm/components/use-input/use-input-password.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-password.type.js +1 -5
- package/esm/components/use-input/use-input.d.ts +3 -3
- package/esm/components/use-input/use-input.js +34 -42
- package/esm/components/use-input/use-input.type.d.ts +5 -5
- package/esm/components/use-input/use-input.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input.type.js +1 -5
- package/esm/components/use-menu/index.js +2 -20
- package/esm/components/use-menu/use-menu-item.d.ts +1 -1
- package/esm/components/use-menu/use-menu-item.d.ts.map +1 -1
- package/esm/components/use-menu/use-menu-item.js +23 -31
- package/esm/components/use-menu/use-menu.js +15 -28
- package/esm/components/use-menu/use-menu.type.d.ts +1 -1
- package/esm/components/use-menu/use-menu.type.d.ts.map +1 -1
- package/esm/components/use-menu/use-menu.type.js +1 -5
- package/esm/components/use-pagination/index.js +1 -19
- package/esm/components/use-pagination/use-pagination.d.ts +1 -1
- package/esm/components/use-pagination/use-pagination.d.ts.map +1 -1
- package/esm/components/use-pagination/use-pagination.js +25 -25
- package/esm/components/use-pagination/use-pagination.type.js +1 -5
- package/esm/components/use-popup/index.js +1 -19
- package/esm/components/use-popup/popup-context.js +3 -9
- package/esm/components/use-popup/use-popup.js +35 -39
- package/esm/components/use-popup/use-popup.type.d.ts +1 -1
- package/esm/components/use-popup/use-popup.type.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.type.js +1 -5
- package/esm/components/use-select/index.js +2 -26
- package/esm/components/use-select/use-select-group.js +19 -22
- package/esm/components/use-select/use-select-group.type.js +1 -5
- package/esm/components/use-select/use-select.js +5 -12
- package/esm/components/use-select/use-select.type.d.ts +1 -1
- package/esm/components/use-select/use-select.type.d.ts.map +1 -1
- package/esm/components/use-select/use-select.type.js +1 -5
- package/esm/components/use-slider/index.js +1 -19
- package/esm/components/use-slider/use-slider.js +30 -32
- package/esm/components/use-slider/use-slider.type.js +1 -5
- package/esm/components/use-table/index.js +8 -68
- package/esm/components/use-table/use-table-columns.d.ts +1 -1
- package/esm/components/use-table/use-table-columns.d.ts.map +1 -1
- package/esm/components/use-table/use-table-columns.js +9 -20
- package/esm/components/use-table/use-table-expand.js +24 -35
- package/esm/components/use-table/use-table-group.js +5 -17
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +68 -75
- package/esm/components/use-table/use-table-row.js +18 -25
- package/esm/components/use-table/use-table-sort.d.ts +1 -1
- package/esm/components/use-table/use-table-sort.d.ts.map +1 -1
- package/esm/components/use-table/use-table-sort.js +34 -41
- package/esm/components/use-table/use-table-tree.d.ts +1 -1
- package/esm/components/use-table/use-table-tree.d.ts.map +1 -1
- package/esm/components/use-table/use-table-tree.js +61 -76
- package/esm/components/use-table/use-table-virtual.js +34 -36
- package/esm/components/use-table/use-table.type.d.ts +4 -4
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/components/use-table/use-table.type.js +1 -5
- package/esm/components/use-tabs/context.js +7 -21
- package/esm/components/use-tabs/context.type.js +1 -5
- package/esm/components/use-tabs/index.js +2 -26
- package/esm/components/use-tabs/use-tabs.js +13 -16
- package/esm/components/use-tabs/use-tabs.type.d.ts +1 -1
- package/esm/components/use-tabs/use-tabs.type.d.ts.map +1 -1
- package/esm/components/use-tabs/use-tabs.type.js +1 -5
- package/esm/components/use-textarea/index.js +2 -26
- package/esm/components/use-textarea/use-textarea-format.js +6 -15
- package/esm/components/use-textarea/use-textarea-format.type.d.ts +1 -1
- package/esm/components/use-textarea/use-textarea-format.type.d.ts.map +1 -1
- package/esm/components/use-textarea/use-textarea-format.type.js +1 -5
- package/esm/components/use-textarea/use-textarea.d.ts +2 -2
- package/esm/components/use-textarea/use-textarea.js +31 -32
- package/esm/components/use-textarea/use-textarea.type.d.ts +3 -3
- package/esm/components/use-textarea/use-textarea.type.d.ts.map +1 -1
- package/esm/components/use-textarea/use-textarea.type.js +1 -5
- package/esm/components/use-transfer/index.js +1 -19
- package/esm/components/use-transfer/use-transfer.js +33 -38
- package/esm/components/use-transfer/use-transfer.type.d.ts +1 -1
- package/esm/components/use-transfer/use-transfer.type.d.ts.map +1 -1
- package/esm/components/use-transfer/use-transfer.type.js +1 -5
- package/esm/components/use-tree/index.js +2 -26
- package/esm/components/use-tree/use-tree-node.js +17 -20
- package/esm/components/use-tree/use-tree-node.type.d.ts +2 -2
- package/esm/components/use-tree/use-tree-node.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree-node.type.js +1 -5
- package/esm/components/use-tree/use-tree.js +25 -37
- package/esm/components/use-tree/use-tree.type.d.ts +3 -3
- package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.type.js +1 -5
- package/esm/components/use-treeselect/index.js +2 -26
- package/esm/components/use-treeselect/use-tiled.js +22 -24
- package/esm/components/use-treeselect/use-tiled.type.d.ts +1 -1
- package/esm/components/use-treeselect/use-tiled.type.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-tiled.type.js +1 -5
- package/esm/components/use-treeselect/use-treeselect.js +3 -10
- package/esm/components/use-treeselect/use-treeselect.type.js +1 -5
- package/esm/components/use-upload/index.js +1 -19
- package/esm/components/use-upload/use-upload.js +57 -62
- package/esm/components/use-upload/use-upload.type.js +1 -5
- package/esm/components/use-upload/xhr.js +1 -8
- package/esm/components/use-validate/index.js +1 -19
- package/esm/components/use-validate/use-validate.js +16 -19
- package/esm/components/use-validate/use-validate.type.js +1 -5
- package/esm/index.js +48 -547
- package/esm/utils/accept.d.ts +1 -1
- package/esm/utils/accept.d.ts.map +1 -1
- package/esm/utils/accept.js +1 -11
- package/esm/utils/array.js +2 -10
- package/esm/utils/attribute.js +3 -11
- package/esm/utils/clone.js +19 -34
- package/esm/utils/document.js +11 -20
- package/esm/utils/dom/element.js +23 -33
- package/esm/utils/dom/index.js +5 -69
- package/esm/utils/dom/normalize-wheel.js +1 -7
- package/esm/utils/dom/normalize-wheel.type.js +1 -5
- package/esm/utils/dom/ready.js +3 -9
- package/esm/utils/dom/responsiveObserve.js +10 -21
- package/esm/utils/dom/responsiveObserve.type.d.ts +4 -4
- package/esm/utils/dom/responsiveObserve.type.d.ts.map +1 -1
- package/esm/utils/dom/responsiveObserve.type.js +1 -5
- package/esm/utils/dom/scroll-behavior.js +2 -9
- package/esm/utils/extract-event-handlers.js +1 -13
- package/esm/utils/func.js +3 -11
- package/esm/utils/immer.d.ts +1 -8
- package/esm/utils/immer.d.ts.map +1 -1
- package/esm/utils/immer.js +12 -20
- package/esm/utils/index.js +22 -269
- package/esm/utils/is.d.ts +1 -1
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +33 -69
- package/esm/utils/lazyload.d.ts +1 -1
- package/esm/utils/lazyload.d.ts.map +1 -1
- package/esm/utils/lazyload.js +6 -15
- package/esm/utils/number.js +6 -24
- package/esm/utils/object.d.ts +4 -4
- package/esm/utils/object.d.ts.map +1 -1
- package/esm/utils/object.js +30 -59
- package/esm/utils/position.js +8 -13
- package/esm/utils/react-render.d.ts +1 -1
- package/esm/utils/react-render.d.ts.map +1 -1
- package/esm/utils/react-render.js +16 -31
- package/esm/utils/render.d.ts +1 -1
- package/esm/utils/render.d.ts.map +1 -1
- package/esm/utils/render.js +4 -13
- package/esm/utils/rule/index.js +1 -19
- package/esm/utils/rule/length.d.ts +1 -1
- package/esm/utils/rule/length.js +11 -19
- package/esm/utils/rule/regexp.d.ts +1 -1
- package/esm/utils/rule/regexp.js +7 -18
- package/esm/utils/rule/required.d.ts +1 -1
- package/esm/utils/rule/required.js +6 -14
- package/esm/utils/rule/rule.js +20 -33
- package/esm/utils/rule/rule.type.d.ts +8 -8
- package/esm/utils/rule/rule.type.d.ts.map +1 -1
- package/esm/utils/rule/rule.type.js +1 -5
- package/esm/utils/rule/type.d.ts +1 -1
- package/esm/utils/rule/type.js +6 -14
- package/esm/utils/shallow-equal.js +7 -21
- package/esm/utils/string.js +2 -16
- package/esm/utils/style-unit.js +3 -11
- package/esm/utils/tree.d.ts +1 -1
- package/esm/utils/tree.d.ts.map +1 -1
- package/esm/utils/tree.js +24 -32
- package/esm/utils/uid.js +2 -20
- package/esm/utils/validate/error.js +23 -26
- package/esm/utils/validate/get-rule.js +16 -26
- package/esm/utils/validate/index.d.ts +1 -1
- package/esm/utils/validate/index.d.ts.map +1 -1
- package/esm/utils/validate/index.js +20 -40
- package/esm/utils/validate/isJson.js +3 -12
- package/esm/utils/validate/nullable.js +2 -9
- package/esm/utils/validate/type.d.ts +1 -1
- package/esm/utils/validate/type.d.ts.map +1 -1
- package/esm/utils/validate/type.js +8 -19
- package/package.json +3 -2
@@ -1,19 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
require("core-js/modules/es.array.iterator.js");
|
8
|
-
require("core-js/modules/es.map.js");
|
9
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
10
|
-
require("core-js/modules/es.array.concat.js");
|
11
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
12
|
-
var _react = require("react");
|
13
|
-
var _uid = require("../../utils/uid");
|
1
|
+
import { useRef } from 'react';
|
2
|
+
import { getUidStr } from "../../utils/uid";
|
14
3
|
var cacheGroup = new Map();
|
15
4
|
var useTableGroup = function useTableGroup(props) {
|
16
|
-
var _useRef =
|
5
|
+
var _useRef = useRef({
|
17
6
|
columns: [],
|
18
7
|
rightBorderRecord: {},
|
19
8
|
columnLevel: 0
|
@@ -44,7 +33,7 @@ var useTableGroup = function useTableGroup(props) {
|
|
44
33
|
var group = g[level];
|
45
34
|
var groupCol = {
|
46
35
|
name: g[level],
|
47
|
-
key: typeof g[level] === 'string' ? "".concat(index, "-").concat(g[level]) : cacheGroup.get(group) || cacheGroup.set(group,
|
36
|
+
key: typeof g[level] === 'string' ? "".concat(index, "-").concat(g[level]) : cacheGroup.get(group) || cacheGroup.set(group, getUidStr()).get(group),
|
48
37
|
colSpan: colSpan,
|
49
38
|
level: level,
|
50
39
|
fixed: col.fixed,
|
@@ -69,5 +58,4 @@ var useTableGroup = function useTableGroup(props) {
|
|
69
58
|
columnLevel: context.columnLevel
|
70
59
|
};
|
71
60
|
};
|
72
|
-
|
73
|
-
exports.default = _default;
|
61
|
+
export default useTableGroup;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;
|
1
|
+
{"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAcrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;CACzC;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA8CX,MAAM,UAAU,MAAM;;;;;;;;CAiM5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -1,33 +1,25 @@
|
|
1
|
-
"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
var
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
var _usePersistFn = _interopRequireDefault(require("../../common/use-persist-fn"));
|
24
|
-
var _usePrevious = _interopRequireDefault(require("../../common/use-previous"));
|
25
|
-
var _element = require("../../utils/dom/element");
|
26
|
-
var _is = require("../../utils/is");
|
27
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
9
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
10
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
17
|
+
import React, { useEffect, useRef, useLayoutEffect } from 'react';
|
18
|
+
import useLatestObj from "../../common/use-latest-obj";
|
19
|
+
import usePersistFn from "../../common/use-persist-fn";
|
20
|
+
import usePrevious from "../../common/use-previous";
|
21
|
+
import { addResizeObserver } from "../../utils/dom/element";
|
22
|
+
import { isFunc, isNumber } from "../../utils/is";
|
31
23
|
var MIN_RESIZABLE_WIDTH = 20;
|
32
24
|
function compareColumnWidth(curCols, preCols) {
|
33
25
|
if (curCols.length !== preCols.length) return false;
|
@@ -40,60 +32,60 @@ var useTableLayout = function useTableLayout(props) {
|
|
40
32
|
var theadRef = props.theadRef,
|
41
33
|
tbodyRef = props.tbodyRef,
|
42
34
|
scrollRef = props.scrollRef;
|
43
|
-
var preColumns = (
|
44
|
-
var preData = (
|
45
|
-
var _useRef =
|
35
|
+
var preColumns = usePrevious(props.columns);
|
36
|
+
var preData = usePrevious(props.data);
|
37
|
+
var _useRef = useRef({
|
46
38
|
checkNum: 0,
|
47
39
|
cachedWidth: null,
|
48
40
|
dragWidth: 0,
|
49
41
|
clientWidth: 0
|
50
42
|
}),
|
51
43
|
context = _useRef.current;
|
52
|
-
var _React$useState =
|
53
|
-
_React$useState2 = (
|
44
|
+
var _React$useState = React.useState(false),
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
54
46
|
isScrollX = _React$useState2[0],
|
55
47
|
setIsScrollX = _React$useState2[1];
|
56
|
-
var _React$useState3 =
|
57
|
-
_React$useState4 = (
|
48
|
+
var _React$useState3 = React.useState(0),
|
49
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
58
50
|
deltaXSum = _React$useState4[0],
|
59
51
|
setDeltaXSum = _React$useState4[1];
|
60
|
-
var _React$useState5 =
|
61
|
-
_React$useState6 = (
|
52
|
+
var _React$useState5 = React.useState(false),
|
53
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
62
54
|
isScrollY = _React$useState6[0],
|
63
55
|
setIsScrollY = _React$useState6[1];
|
64
|
-
var _React$useState7 =
|
65
|
-
_React$useState8 = (
|
56
|
+
var _React$useState7 = React.useState(false),
|
57
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
66
58
|
floatLeft = _React$useState8[0],
|
67
59
|
setFloatLeft = _React$useState8[1];
|
68
|
-
var _React$useState9 =
|
69
|
-
_React$useState10 = (
|
60
|
+
var _React$useState9 = React.useState(false),
|
61
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
70
62
|
floatRight = _React$useState10[0],
|
71
63
|
setFloatRight = _React$useState10[1];
|
72
|
-
var _React$useState11 =
|
73
|
-
_React$useState12 = (
|
64
|
+
var _React$useState11 = React.useState(0),
|
65
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
74
66
|
resizeFlag = _React$useState12[0],
|
75
67
|
setResizeFlag = _React$useState12[1];
|
76
|
-
var _React$useState13 =
|
77
|
-
_React$useState14 = (
|
68
|
+
var _React$useState13 = React.useState(0),
|
69
|
+
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
78
70
|
scrollBarWidth = _React$useState14[0],
|
79
71
|
setScrollBarWidth = _React$useState14[1];
|
80
|
-
var _React$useState15 =
|
81
|
-
_React$useState16 = (
|
72
|
+
var _React$useState15 = React.useState(0),
|
73
|
+
_React$useState16 = _slicedToArray(_React$useState15, 2),
|
82
74
|
scrollWidth = _React$useState16[0],
|
83
75
|
setScrollWidth = _React$useState16[1];
|
84
|
-
var _React$useState17 =
|
76
|
+
var _React$useState17 = React.useState(props.columns.map(function (v) {
|
85
77
|
return v.width;
|
86
78
|
})),
|
87
|
-
_React$useState18 = (
|
79
|
+
_React$useState18 = _slicedToArray(_React$useState17, 2),
|
88
80
|
colgroup = _React$useState18[0],
|
89
81
|
setColgroup = _React$useState18[1];
|
90
|
-
var _React$useState19 =
|
91
|
-
_React$useState20 = (
|
82
|
+
var _React$useState19 = React.useState(true),
|
83
|
+
_React$useState20 = _slicedToArray(_React$useState19, 2),
|
92
84
|
adjust = _React$useState20[0],
|
93
85
|
setAdjust = _React$useState20[1];
|
94
86
|
|
95
87
|
// 检查滚动状态
|
96
|
-
var checkScroll = (
|
88
|
+
var checkScroll = usePersistFn(function () {
|
97
89
|
var scrollEl = scrollRef.current;
|
98
90
|
if (!scrollEl) return;
|
99
91
|
if (context.checkNum > 10) {
|
@@ -115,7 +107,7 @@ var useTableLayout = function useTableLayout(props) {
|
|
115
107
|
});
|
116
108
|
|
117
109
|
// 拖拽列
|
118
|
-
var dragCol = (
|
110
|
+
var dragCol = usePersistFn(function (index, deltaX) {
|
119
111
|
var col = props.columns[index];
|
120
112
|
if (!colgroup) return;
|
121
113
|
var table = theadRef.current || tbodyRef.current;
|
@@ -127,12 +119,12 @@ var useTableLayout = function useTableLayout(props) {
|
|
127
119
|
oWidth = colEl.getBoundingClientRect().width;
|
128
120
|
}
|
129
121
|
var w = oWidth + deltaX;
|
130
|
-
if (
|
122
|
+
if (isNumber(col.minWidth)) {
|
131
123
|
w = Math.max(w, col.minWidth);
|
132
124
|
} else {
|
133
125
|
w = Math.max(w, MIN_RESIZABLE_WIDTH);
|
134
126
|
}
|
135
|
-
if (
|
127
|
+
if (isNumber(col.maxWidth)) {
|
136
128
|
w = Math.min(w, col.maxWidth);
|
137
129
|
}
|
138
130
|
colEl.style.width = "".concat(w, "px");
|
@@ -152,13 +144,13 @@ var useTableLayout = function useTableLayout(props) {
|
|
152
144
|
};
|
153
145
|
|
154
146
|
// 完成拖拽
|
155
|
-
var resizeCol = (
|
147
|
+
var resizeCol = usePersistFn(function (index) {
|
156
148
|
if (!props.columnResizable) return;
|
157
149
|
if (!colgroup) return;
|
158
150
|
var deltaX = context.dragWidth - colgroup[index];
|
159
|
-
var newColgroup = (
|
151
|
+
var newColgroup = _toConsumableArray(colgroup);
|
160
152
|
newColgroup[index] = context.dragWidth;
|
161
|
-
if (
|
153
|
+
if (isFunc(props.onColumnResize)) {
|
162
154
|
var newColumns = props.columns.map(function (item) {
|
163
155
|
return _objectSpread(_objectSpread({}, item), {}, {
|
164
156
|
width: newColgroup[index]
|
@@ -174,7 +166,7 @@ var useTableLayout = function useTableLayout(props) {
|
|
174
166
|
});
|
175
167
|
|
176
168
|
// 根据column的宽度计算colgroup
|
177
|
-
var resetColGroup = (
|
169
|
+
var resetColGroup = usePersistFn(function () {
|
178
170
|
var columnLengthChange = preColumns && preColumns.length !== props.columns.length;
|
179
171
|
// 当支持拖拽列 并且有缓存 并且 column 的数量没有发生变化的时候, 从缓存中获取宽度
|
180
172
|
var useCache = props.columnResizable && context.cachedWidth && !columnLengthChange;
|
@@ -188,7 +180,7 @@ var useTableLayout = function useTableLayout(props) {
|
|
188
180
|
});
|
189
181
|
|
190
182
|
// 根据渲染内容计算colgroup
|
191
|
-
var getColgroup = (
|
183
|
+
var getColgroup = usePersistFn(function (fromDrag) {
|
192
184
|
var _props$data, _target$current;
|
193
185
|
var target = props !== null && props !== void 0 && (_props$data = props.data) !== null && _props$data !== void 0 && _props$data.length ? tbodyRef : theadRef;
|
194
186
|
var group = (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.querySelector('colgroup');
|
@@ -219,13 +211,13 @@ var useTableLayout = function useTableLayout(props) {
|
|
219
211
|
});
|
220
212
|
}
|
221
213
|
context.cachedWidth = new Map();
|
222
|
-
for (var
|
223
|
-
context.cachedWidth.set(props.columns[
|
214
|
+
for (var _i = 0; _i < props.columns.length; _i++) {
|
215
|
+
context.cachedWidth.set(props.columns[_i].key, widthArr[_i] || 0);
|
224
216
|
}
|
225
217
|
}
|
226
218
|
changeColGroup(newCols, false);
|
227
219
|
});
|
228
|
-
var checkFloat = (
|
220
|
+
var checkFloat = usePersistFn(function () {
|
229
221
|
var scrollEl = scrollRef.current;
|
230
222
|
var max = scrollEl.scrollWidth - scrollEl.clientWidth;
|
231
223
|
var min = 0;
|
@@ -235,7 +227,7 @@ var useTableLayout = function useTableLayout(props) {
|
|
235
227
|
if (l !== floatLeft) setFloatLeft(l);
|
236
228
|
if (r !== floatRight) setFloatRight(r);
|
237
229
|
});
|
238
|
-
var syncScrollWidth = (
|
230
|
+
var syncScrollWidth = usePersistFn(function () {
|
239
231
|
if (!scrollRef.current) return;
|
240
232
|
var scrollEl = scrollRef.current;
|
241
233
|
var w = scrollEl.scrollWidth;
|
@@ -243,7 +235,7 @@ var useTableLayout = function useTableLayout(props) {
|
|
243
235
|
});
|
244
236
|
|
245
237
|
// 页面resize
|
246
|
-
var handleResize = (
|
238
|
+
var handleResize = usePersistFn(function (_, dir) {
|
247
239
|
checkScroll();
|
248
240
|
syncScrollWidth();
|
249
241
|
if (dir.x) {
|
@@ -251,14 +243,14 @@ var useTableLayout = function useTableLayout(props) {
|
|
251
243
|
resetColGroup();
|
252
244
|
}
|
253
245
|
});
|
254
|
-
var func = (
|
246
|
+
var func = useLatestObj({
|
255
247
|
scrollCheck: checkScroll,
|
256
248
|
resetColGroup: resetColGroup,
|
257
249
|
resizeCol: resizeCol,
|
258
250
|
dragCol: dragCol,
|
259
251
|
checkFloat: checkFloat
|
260
252
|
});
|
261
|
-
|
253
|
+
useEffect(function () {
|
262
254
|
if (!colgroup) return;
|
263
255
|
// columns 增加或者减少列, 或者宽度发生变化且和colgroup的宽度不一致时
|
264
256
|
if (preColumns && !compareColumnWidth(props.columns, preColumns)) {
|
@@ -272,26 +264,28 @@ var useTableLayout = function useTableLayout(props) {
|
|
272
264
|
if (preData.length === 0 || props.dataChangeResize) resetColGroup();
|
273
265
|
}
|
274
266
|
}, [props.columns, props.data, props.dataChangeResize]);
|
275
|
-
|
267
|
+
useEffect(function () {
|
276
268
|
var cancelFunc;
|
277
269
|
syncScrollWidth();
|
278
270
|
if (scrollRef.current) {
|
279
|
-
cancelFunc =
|
271
|
+
cancelFunc = addResizeObserver(scrollRef.current, handleResize, {
|
280
272
|
direction: true
|
281
273
|
});
|
282
274
|
}
|
283
275
|
return function () {
|
284
276
|
var _cancelFunc;
|
285
|
-
(_cancelFunc = cancelFunc) === null || _cancelFunc === void 0
|
277
|
+
(_cancelFunc = cancelFunc) === null || _cancelFunc === void 0 || _cancelFunc();
|
286
278
|
};
|
287
279
|
}, [scrollRef.current]);
|
288
|
-
|
280
|
+
useLayoutEffect(function () {
|
289
281
|
if (adjust) {
|
290
282
|
getColgroup(adjust === 'drag');
|
291
283
|
setAdjust(false);
|
292
284
|
} else {
|
293
285
|
checkFloat();
|
294
286
|
checkScroll();
|
287
|
+
// 拖拽列会导致 scrollWidth 变化
|
288
|
+
syncScrollWidth();
|
295
289
|
}
|
296
290
|
}, [colgroup]);
|
297
291
|
return {
|
@@ -309,5 +303,4 @@ var useTableLayout = function useTableLayout(props) {
|
|
309
303
|
resizeFlag: resizeFlag
|
310
304
|
};
|
311
305
|
};
|
312
|
-
|
313
|
-
exports.default = _default;
|
306
|
+
export default useTableLayout;
|
@@ -1,18 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
require("core-js/modules/es.array.iterator.js");
|
11
|
-
require("core-js/modules/es.set.js");
|
12
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
13
|
-
var _is = require("../../utils/is");
|
14
|
-
var _react = require("react");
|
15
|
-
var _usePersistFn = require("../../common/use-persist-fn");
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
7
|
+
import { isObject, isFunc } from "../../utils/is";
|
8
|
+
import { useMemo, useState, useRef } from 'react';
|
9
|
+
import { usePersistFn } from "../../common/use-persist-fn";
|
16
10
|
// handle rowSpan colSpan
|
17
11
|
function format(columns, data, nextRow, index) {
|
18
12
|
var row = columns.map(function (col, i) {
|
@@ -25,9 +19,9 @@ function format(columns, data, nextRow, index) {
|
|
25
19
|
var rowSpan = col.rowSpan;
|
26
20
|
if (rowSpan && nextRow && nextRow[i]) {
|
27
21
|
if (col.type !== 'checkbox') {
|
28
|
-
if (typeof col.render === 'string' &&
|
22
|
+
if (typeof col.render === 'string' && isObject(data)) {
|
29
23
|
cell.content = data[col.render];
|
30
|
-
} else if (
|
24
|
+
} else if (isFunc(col.render)) {
|
31
25
|
cell.content = col.render(data, index);
|
32
26
|
}
|
33
27
|
}
|
@@ -54,15 +48,15 @@ function format(columns, data, nextRow, index) {
|
|
54
48
|
*/
|
55
49
|
var useTableRow = function useTableRow(props) {
|
56
50
|
var currentIndex = props.currentIndex;
|
57
|
-
var _useRef =
|
51
|
+
var _useRef = useRef({
|
58
52
|
rowSelectMergeStartData: []
|
59
53
|
}),
|
60
54
|
context = _useRef.current;
|
61
|
-
var _useState =
|
62
|
-
_useState2 = (
|
55
|
+
var _useState = useState(new Set()),
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
63
57
|
hoverIndex = _useState2[0],
|
64
58
|
setHoverIndex = _useState2[1];
|
65
|
-
var handleCellHover =
|
59
|
+
var handleCellHover = usePersistFn(function (rowIndex) {
|
66
60
|
var colSpan = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
67
61
|
if (!props.hover) return;
|
68
62
|
var hoverIndex = new Set();
|
@@ -71,7 +65,7 @@ var useTableRow = function useTableRow(props) {
|
|
71
65
|
}
|
72
66
|
setHoverIndex(hoverIndex);
|
73
67
|
});
|
74
|
-
var isCellHover =
|
68
|
+
var isCellHover = usePersistFn(function (rowIndex) {
|
75
69
|
var colSpan = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
76
70
|
if (!props.hover) return false;
|
77
71
|
var isHover = false;
|
@@ -81,7 +75,7 @@ var useTableRow = function useTableRow(props) {
|
|
81
75
|
}
|
82
76
|
return isHover;
|
83
77
|
});
|
84
|
-
var rowData =
|
78
|
+
var rowData = useMemo(function () {
|
85
79
|
var rows = [];
|
86
80
|
context.rowSelectMergeStartData = [];
|
87
81
|
var data = props.data || [];
|
@@ -113,5 +107,4 @@ var useTableRow = function useTableRow(props) {
|
|
113
107
|
rowSelectMergeStartData: context.rowSelectMergeStartData
|
114
108
|
};
|
115
109
|
};
|
116
|
-
|
117
|
-
exports.default = _default;
|
110
|
+
export default useTableRow;
|
@@ -10,7 +10,7 @@ export interface SortInfo {
|
|
10
10
|
manual: boolean;
|
11
11
|
multiple?: boolean;
|
12
12
|
}
|
13
|
-
export
|
13
|
+
export type SortMap = Map<string | number, SortInfo>;
|
14
14
|
declare const useTableSort: <Item = any>(props: UseTableSorterProps<Item>) => {
|
15
15
|
sortInfo: SortMap;
|
16
16
|
onSorterChange: (columnKey: KeygenResult, direction: 'desc' | 'asc' | null, manual: boolean | undefined, columnSorter: string | import("./use-table.type").TableColumnSorter | ((order: import("./use-table.type").TableColumnOrder) => void | ((prevRowData: Item, nextRowData: Item) => number)) | undefined) => void;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-sort.d.ts","sourceRoot":"","sources":["use-table-sort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;CACpC;AACD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,
|
1
|
+
{"version":3,"file":"use-table-sort.d.ts","sourceRoot":"","sources":["use-table-sort.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;CACpC;AACD,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC;AACrD,QAAA,MAAM,YAAY;;gCAoCD,YAAY,aAIZ,MAAM,GAAG,KAAK,GAAG,IAAI;;CAoGrC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -1,36 +1,30 @@
|
|
1
|
-
"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
});
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
21
|
-
var _react = require("react");
|
22
|
-
var _ = require("../..");
|
23
|
-
var _is = require("../../utils/is");
|
24
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
8
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
9
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
10
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
17
|
+
import { useState, useMemo, useEffect, useRef } from 'react';
|
18
|
+
import { usePersistFn } from "../..";
|
19
|
+
import { isObject, isFunc } from "../../utils/is";
|
26
20
|
var useTableSort = function useTableSort(props) {
|
27
21
|
var sorter = props.sorter,
|
28
22
|
data = props.data;
|
29
|
-
var _useState =
|
30
|
-
_useState2 = (
|
23
|
+
var _useState = useState(new Map()),
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
31
25
|
sortInfo = _useState2[0],
|
32
26
|
setSortInfo = _useState2[1];
|
33
|
-
var _useRef =
|
27
|
+
var _useRef = useRef({
|
34
28
|
mounted: false,
|
35
29
|
sortInfo: new Map()
|
36
30
|
}),
|
@@ -38,7 +32,7 @@ var useTableSort = function useTableSort(props) {
|
|
38
32
|
if (!context.sortInfo) {
|
39
33
|
context.sortInfo = sortInfo;
|
40
34
|
}
|
41
|
-
var getSortList =
|
35
|
+
var getSortList = usePersistFn(function (info) {
|
42
36
|
return Array.from(info.keys()).filter(function (name) {
|
43
37
|
var _info$get;
|
44
38
|
return (_info$get = info.get(name)) === null || _info$get === void 0 ? void 0 : _info$get.order;
|
@@ -54,21 +48,21 @@ var useTableSort = function useTableSort(props) {
|
|
54
48
|
});
|
55
49
|
});
|
56
50
|
});
|
57
|
-
var sortedData =
|
58
|
-
var newData = (
|
51
|
+
var sortedData = useMemo(function () {
|
52
|
+
var newData = _toConsumableArray(data || []);
|
59
53
|
var sortList = getSortList(sortInfo);
|
60
54
|
sortList.forEach(function (sort) {
|
61
55
|
if (sort.sort) newData.sort(sort.sort);
|
62
56
|
});
|
63
57
|
return newData;
|
64
58
|
}, [sortInfo, data]);
|
65
|
-
var onSorterChange =
|
59
|
+
var onSorterChange = usePersistFn(function (columnKey, direction) {
|
66
60
|
var manual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
67
61
|
var columnSorter = arguments.length > 3 ? arguments[3] : undefined;
|
68
62
|
var sortName = undefined;
|
69
63
|
if (typeof columnSorter === 'string') {
|
70
64
|
sortName = columnSorter;
|
71
|
-
} else if (
|
65
|
+
} else if (isObject(columnSorter) && !isFunc(columnSorter)) {
|
72
66
|
if (typeof columnSorter.rule === 'string') {
|
73
67
|
sortName = columnSorter.rule;
|
74
68
|
}
|
@@ -85,14 +79,14 @@ var useTableSort = function useTableSort(props) {
|
|
85
79
|
};
|
86
80
|
var newInfo = multiple ? new Map(_sortInfo) : new Map();
|
87
81
|
newInfo.set(columnKey, sortObj);
|
88
|
-
if (
|
82
|
+
if (isFunc(columnSorter)) {
|
89
83
|
sortObj.sort = columnSorter(direction);
|
90
84
|
sortObj.multiple = false;
|
91
|
-
} else if (
|
85
|
+
} else if (isObject(columnSorter)) {
|
92
86
|
sortObj.weight = columnSorter.weight || 0;
|
93
87
|
sortObj.multiple = true;
|
94
88
|
var rule = columnSorter.rule;
|
95
|
-
if (typeof rule === 'string') {} else if (
|
89
|
+
if (typeof rule === 'string') {} else if (isFunc(rule)) {
|
96
90
|
var infoList = getSortList(newInfo).map(function (item) {
|
97
91
|
return {
|
98
92
|
key: item.key,
|
@@ -137,17 +131,17 @@ var useTableSort = function useTableSort(props) {
|
|
137
131
|
});
|
138
132
|
if (sortName) {
|
139
133
|
var _props$onSortCancel;
|
140
|
-
(_props$onSortCancel = props.onSortCancel) === null || _props$onSortCancel === void 0
|
134
|
+
(_props$onSortCancel = props.onSortCancel) === null || _props$onSortCancel === void 0 || _props$onSortCancel.call(props, beforeSortOrder, columnKey, _infoList2, sortName);
|
141
135
|
}
|
142
136
|
}
|
143
137
|
});
|
144
|
-
|
138
|
+
useEffect(function () {
|
145
139
|
if (context.mounted) return;
|
146
140
|
var hasSingleDefaultOrder = false;
|
147
141
|
for (var i = 0; i < props.columns.length; i++) {
|
148
142
|
var col = props.columns[i];
|
149
143
|
if (col.defaultOrder && col.sorter) {
|
150
|
-
if ((
|
144
|
+
if (_typeof(col.sorter) !== 'object') {
|
151
145
|
if (hasSingleDefaultOrder) {
|
152
146
|
break;
|
153
147
|
} else {
|
@@ -165,5 +159,4 @@ var useTableSort = function useTableSort(props) {
|
|
165
159
|
sortedData: sortedData
|
166
160
|
};
|
167
161
|
};
|
168
|
-
|
169
|
-
exports.default = _default;
|
162
|
+
export default useTableSort;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { BaseTableProps } from './use-table.type';
|
2
2
|
import { OptionalToRequired } from '../../common/type';
|
3
|
-
export interface UseTableTreeProps extends Pick<OptionalToRequired<BaseTableProps<any>>, 'onTreeExpand' | '
|
3
|
+
export interface UseTableTreeProps extends Pick<OptionalToRequired<BaseTableProps<any>>, 'onTreeExpand' | 'treeExpandKeys' | 'defaultTreeExpandKeys' | 'keygen'> {
|
4
4
|
treeColumnsName: string | undefined;
|
5
5
|
data: any[];
|
6
6
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-table-tree.d.ts","sourceRoot":"","sources":["use-table-tree.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAoCvD,MAAM,WAAW,iBACf,SAAQ,IAAI,CACV,kBAAkB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,EACvC,cAAc,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,QAAQ,CACvE;IACD,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,IAAI,EAAE,GAAG,EAAE,CAAC;CACb;AAED,eAAO,MAAM,YAAY,UAAW,iBAAiB;;;;;;+BA6BR,GAAG,SAAS,MAAM;iCAjBhB,GAAG,SAAS,MAAM;;CA2ChE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|