@sheinx/hooks 3.0.0-alpha.9 → 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 +3 -2
- package/cjs/common/use-click-away/index.d.ts.map +1 -1
- package/cjs/common/use-click-away/index.js +8 -6
- package/cjs/common/use-default-value/index.js +3 -2
- package/cjs/common/use-default-value/use-default-value.js +9 -5
- package/cjs/common/use-drag-mock/index.js +3 -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 +3 -2
- package/cjs/common/use-filter/use-filter.d.ts +2 -3
- package/cjs/common/use-filter/use-filter.d.ts.map +1 -1
- package/cjs/common/use-filter/use-filter.js +48 -36
- package/cjs/common/use-filter/use-filter.type.d.ts +2 -1
- package/cjs/common/use-filter/use-filter.type.d.ts.map +1 -1
- package/cjs/common/use-fork-ref/index.js +6 -10
- package/cjs/common/use-func-change/index.js +3 -2
- package/cjs/common/use-func-change/use-func-change.d.ts +1 -1
- package/cjs/common/use-func-change/use-func-change.d.ts.map +1 -1
- package/cjs/common/use-func-change/use-func-change.js +3 -4
- package/cjs/common/use-input-able/index.js +3 -2
- package/cjs/common/use-input-able/use-Input-able.d.ts.map +1 -1
- package/cjs/common/use-input-able/use-Input-able.js +15 -7
- package/cjs/common/use-input-able/use-Input-able.type.d.ts +2 -1
- package/cjs/common/use-input-able/use-Input-able.type.d.ts.map +1 -1
- package/cjs/common/use-key-event/index.js +7 -8
- package/cjs/common/use-latest-obj/index.js +2 -3
- package/cjs/common/use-list-select/index.js +3 -2
- package/cjs/common/use-list-select/use-list-select-multiple.d.ts.map +1 -1
- package/cjs/common/use-list-select/use-list-select-multiple.js +29 -44
- 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.d.ts +2 -1
- package/cjs/common/use-pagination-list/index.d.ts.map +1 -1
- package/cjs/common/use-pagination-list/index.js +20 -16
- package/cjs/common/use-persist-fn/index.js +2 -2
- package/cjs/common/use-position-style/get-position-style.d.ts +1 -0
- package/cjs/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/cjs/common/use-position-style/get-position-style.js +16 -9
- package/cjs/common/use-position-style/index.d.ts +6 -6
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +61 -46
- package/cjs/common/use-previous/index.js +2 -2
- package/cjs/common/use-render/index.js +9 -5
- package/cjs/common/use-resize/index.js +12 -9
- package/cjs/common/use-safe-state/index.js +9 -5
- package/cjs/common/use-style/index.js +1 -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 +8 -3
- package/cjs/common/use-transform/index.js +3 -2
- package/cjs/common/use-transform/use-transform.d.ts.map +1 -1
- package/cjs/common/use-transform/use-transform.js +19 -20
- package/cjs/common/use-unmounted-ref/index.js +2 -2
- package/cjs/components/use-button/index.js +3 -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 +3 -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 +3 -2
- package/cjs/components/use-cascader/use-cascader.d.ts +4 -0
- package/cjs/components/use-cascader/use-cascader.d.ts.map +1 -1
- package/cjs/components/use-cascader/use-cascader.js +6 -5
- package/cjs/components/use-cascader/use-cascader.type.d.ts +1 -0
- package/cjs/components/use-cascader/use-cascader.type.d.ts.map +1 -1
- package/cjs/components/use-check/index.js +3 -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 +3 -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 +3 -2
- package/cjs/components/use-datepicker/use-date.d.ts +1 -1
- package/cjs/components/use-datepicker/use-date.js +13 -11
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +30 -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.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-range.js +12 -8
- 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.d.ts +1 -1
- package/cjs/components/use-datepicker/use-month.js +13 -11
- package/cjs/components/use-datepicker/use-quarter.d.ts +1 -1
- 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.d.ts +1 -1
- 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 +3 -2
- package/cjs/components/use-descriptions/use-descriptions.js +14 -11
- package/cjs/components/use-form/Provider.d.ts.map +1 -1
- package/cjs/components/use-form/Provider.js +16 -12
- package/cjs/components/use-form/form-bind-context.d.ts.map +1 -1
- package/cjs/components/use-form/form-bind-context.js +7 -11
- package/cjs/components/use-form/form-config-context.d.ts.map +1 -1
- package/cjs/components/use-form/form-config-context.js +7 -11
- package/cjs/components/use-form/form-func-context.d.ts.map +1 -1
- package/cjs/components/use-form/form-func-context.js +7 -11
- package/cjs/components/use-form/index.js +3 -3
- package/cjs/components/use-form/use-form-control/index.js +3 -2
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts +1 -0
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +31 -27
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +24 -25
- package/cjs/components/use-form/use-form-fieldset/index.js +3 -2
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +1 -1
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/use-form-fieldset.js +9 -19
- package/cjs/components/use-form/use-form-flow/index.js +3 -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.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-item/form-item-context.js +6 -9
- package/cjs/components/use-form/use-form-item/index.js +3 -2
- package/cjs/components/use-form/use-form-item/use-form-item.js +13 -14
- package/cjs/components/use-form/use-form.d.ts +2 -2
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +44 -41
- package/cjs/components/use-form/use-form.type.d.ts +8 -5
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-image/index.js +3 -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 +3 -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.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.js +16 -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.d.ts.map +1 -1
- package/cjs/components/use-input/use-input.js +37 -30
- package/cjs/components/use-input/use-input.type.d.ts +6 -5
- package/cjs/components/use-input/use-input.type.d.ts.map +1 -1
- package/cjs/components/use-menu/index.js +3 -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 +3 -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 +3 -2
- package/cjs/components/use-popup/popup-context.d.ts.map +1 -1
- package/cjs/components/use-popup/popup-context.js +2 -2
- package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
- package/cjs/components/use-popup/use-popup.js +20 -13
- 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 +3 -2
- package/cjs/components/use-select/use-select-group.js +13 -10
- package/cjs/components/use-select/use-select.d.ts.map +1 -1
- package/cjs/components/use-select/use-select.js +7 -5
- package/cjs/components/use-select/use-select.type.d.ts +2 -1
- package/cjs/components/use-select/use-select.type.d.ts.map +1 -1
- package/cjs/components/use-slider/index.js +3 -2
- package/cjs/components/use-slider/use-slider.js +15 -10
- package/cjs/components/use-table/index.js +3 -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 +13 -20
- 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 +1 -0
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +60 -45
- 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.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +23 -15
- 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.d.ts.map +1 -1
- package/cjs/components/use-tabs/context.js +8 -13
- package/cjs/components/use-tabs/index.js +3 -2
- package/cjs/components/use-tabs/use-tabs.js +9 -6
- package/cjs/components/use-tabs/use-tabs.type.d.ts +2 -1
- package/cjs/components/use-tabs/use-tabs.type.d.ts.map +1 -1
- package/cjs/components/use-textarea/index.js +3 -2
- package/cjs/components/use-textarea/use-textarea-format.js +5 -7
- package/cjs/components/use-textarea/use-textarea-format.type.d.ts +1 -5
- 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 +3 -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 +3 -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.d.ts +4 -9
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +20 -29
- 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 +3 -2
- package/cjs/components/use-treeselect/use-tiled.d.ts +2 -2
- package/cjs/components/use-treeselect/use-tiled.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-tiled.js +18 -21
- package/cjs/components/use-treeselect/use-tiled.type.d.ts +4 -3
- package/cjs/components/use-treeselect/use-tiled.type.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-treeselect.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-treeselect.js +5 -4
- package/cjs/components/use-treeselect/use-treeselect.type.d.ts +1 -0
- package/cjs/components/use-treeselect/use-treeselect.type.d.ts.map +1 -1
- package/cjs/components/use-upload/index.js +3 -2
- package/cjs/components/use-upload/use-upload.js +44 -42
- package/cjs/components/use-upload/use-upload.type.d.ts +5 -1
- package/cjs/components/use-upload/use-upload.type.d.ts.map +1 -1
- package/cjs/components/use-upload/xhr.js +0 -1
- package/cjs/components/use-validate/index.js +3 -2
- package/cjs/components/use-validate/use-validate.js +9 -5
- package/cjs/index.js +5 -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.d.ts +1 -1
- package/cjs/utils/attribute.d.ts.map +1 -1
- package/cjs/utils/attribute.js +6 -6
- package/cjs/utils/clone.js +11 -20
- package/cjs/utils/document.d.ts.map +1 -1
- package/cjs/utils/document.js +10 -5
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/element.js +20 -17
- package/cjs/utils/dom/index.js +2 -3
- package/cjs/utils/dom/ready.d.ts.map +1 -1
- package/cjs/utils/dom/ready.js +2 -0
- 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 +3 -0
- package/cjs/utils/immer.d.ts.map +1 -0
- package/cjs/utils/immer.js +24 -0
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.d.ts.map +1 -1
- package/cjs/utils/index.js +14 -3
- package/cjs/utils/is.d.ts +2 -1
- package/cjs/utils/is.d.ts.map +1 -1
- package/cjs/utils/is.js +37 -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 +2 -2
- package/cjs/utils/tree.d.ts.map +1 -1
- package/cjs/utils/tree.js +20 -22
- package/cjs/utils/uid.js +2 -13
- 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 +3 -2
- package/esm/common/use-click-away/index.d.ts.map +1 -1
- package/esm/common/use-click-away/index.js +14 -20
- package/esm/common/use-default-value/index.js +3 -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 +4 -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 +2 -19
- package/esm/common/use-filter/use-filter.d.ts +2 -3
- package/esm/common/use-filter/use-filter.d.ts.map +1 -1
- package/esm/common/use-filter/use-filter.js +62 -56
- package/esm/common/use-filter/use-filter.type.d.ts +2 -1
- package/esm/common/use-filter/use-filter.type.d.ts.map +1 -1
- package/esm/common/use-filter/use-filter.type.js +1 -5
- package/esm/common/use-fork-ref/index.js +6 -20
- package/esm/common/use-fork-ref/setRef.js +1 -7
- package/esm/common/use-func-change/index.js +2 -19
- package/esm/common/use-func-change/use-func-change.d.ts +1 -1
- package/esm/common/use-func-change/use-func-change.d.ts.map +1 -1
- package/esm/common/use-func-change/use-func-change.js +8 -16
- package/esm/common/use-input-able/index.js +2 -19
- package/esm/common/use-input-able/use-Input-able.d.ts.map +1 -1
- package/esm/common/use-input-able/use-Input-able.js +27 -26
- package/esm/common/use-input-able/use-Input-able.type.d.ts +2 -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 +8 -15
- package/esm/common/use-latest-obj/index.js +5 -12
- package/esm/common/use-list-select/index.js +4 -33
- package/esm/common/use-list-select/use-list-select-multiple.d.ts.map +1 -1
- package/esm/common/use-list-select/use-list-select-multiple.js +44 -69
- 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.d.ts +2 -1
- package/esm/common/use-pagination-list/index.d.ts.map +1 -1
- package/esm/common/use-pagination-list/index.js +25 -27
- package/esm/common/use-persist-fn/index.js +6 -11
- package/esm/common/use-position-style/get-position-style.d.ts +1 -0
- package/esm/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/esm/common/use-position-style/get-position-style.js +16 -15
- package/esm/common/use-position-style/index.d.ts +6 -6
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +67 -62
- package/esm/common/use-previous/index.js +6 -13
- package/esm/common/use-render/index.js +16 -19
- package/esm/common/use-resize/index.js +18 -21
- package/esm/common/use-safe-state/index.js +16 -19
- package/esm/common/use-style/index.js +4 -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 +13 -14
- package/esm/common/use-transform/index.js +2 -19
- package/esm/common/use-transform/use-transform.d.ts.map +1 -1
- package/esm/common/use-transform/use-transform.js +29 -36
- package/esm/common/use-transform/use-transform.type.js +1 -5
- package/esm/common/use-unmounted-ref/index.js +6 -13
- package/esm/components/use-button/index.js +2 -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 +2 -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 +2 -19
- package/esm/components/use-cascader/use-cascader.d.ts +4 -0
- package/esm/components/use-cascader/use-cascader.d.ts.map +1 -1
- package/esm/components/use-cascader/use-cascader.js +9 -15
- package/esm/components/use-cascader/use-cascader.type.d.ts +1 -0
- package/esm/components/use-cascader/use-cascader.type.d.ts.map +1 -1
- package/esm/components/use-cascader/use-cascader.type.js +1 -5
- package/esm/components/use-check/index.js +2 -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 +3 -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 +9 -62
- package/esm/components/use-datepicker/use-date.d.ts +1 -1
- 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.d.ts +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +58 -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.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-range.js +44 -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.d.ts +1 -1
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- 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 +2 -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.d.ts.map +1 -1
- package/esm/components/use-form/Provider.js +19 -25
- package/esm/components/use-form/form-bind-context.d.ts.map +1 -1
- package/esm/components/use-form/form-bind-context.js +5 -17
- package/esm/components/use-form/form-config-context.d.ts.map +1 -1
- package/esm/components/use-form/form-config-context.js +5 -17
- package/esm/components/use-form/form-func-context.d.ts.map +1 -1
- package/esm/components/use-form/form-func-context.js +5 -17
- package/esm/components/use-form/index.js +8 -87
- package/esm/components/use-form/use-form-control/index.js +2 -19
- package/esm/components/use-form/use-form-control/use-form-control.d.ts +1 -0
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +64 -69
- 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.d.ts +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +27 -35
- package/esm/components/use-form/use-form-fieldset/index.js +3 -26
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts +1 -1
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/use-form-fieldset.js +11 -28
- 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 +3 -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.d.ts.map +1 -1
- package/esm/components/use-form/use-form-item/form-item-context.js +4 -15
- package/esm/components/use-form/use-form-item/index.js +2 -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.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +80 -86
- package/esm/components/use-form/use-form.type.d.ts +8 -5
- 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 +5 -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 +5 -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.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.js +24 -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.d.ts.map +1 -1
- package/esm/components/use-input/use-input.js +41 -43
- package/esm/components/use-input/use-input.type.d.ts +6 -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 +3 -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 +2 -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 +2 -19
- package/esm/components/use-popup/popup-context.d.ts.map +1 -1
- package/esm/components/use-popup/popup-context.js +4 -9
- package/esm/components/use-popup/use-popup.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.js +40 -40
- 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 +3 -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.d.ts.map +1 -1
- package/esm/components/use-select/use-select.js +11 -15
- package/esm/components/use-select/use-select.type.d.ts +2 -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 +2 -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 +9 -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 +17 -31
- 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 +1 -0
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +89 -83
- 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.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +40 -38
- 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.d.ts.map +1 -1
- package/esm/components/use-tabs/context.js +8 -21
- package/esm/components/use-tabs/context.type.js +1 -5
- package/esm/components/use-tabs/index.js +3 -26
- package/esm/components/use-tabs/use-tabs.js +13 -16
- package/esm/components/use-tabs/use-tabs.type.d.ts +2 -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 +3 -26
- package/esm/components/use-textarea/use-textarea-format.js +6 -15
- package/esm/components/use-textarea/use-textarea-format.type.d.ts +1 -5
- 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 +2 -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 +3 -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.d.ts +4 -9
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +33 -49
- 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 +3 -26
- package/esm/components/use-treeselect/use-tiled.d.ts +2 -2
- package/esm/components/use-treeselect/use-tiled.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-tiled.js +27 -36
- package/esm/components/use-treeselect/use-tiled.type.d.ts +4 -3
- 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.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-treeselect.js +7 -12
- package/esm/components/use-treeselect/use-treeselect.type.d.ts +1 -0
- package/esm/components/use-treeselect/use-treeselect.type.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-treeselect.type.js +1 -5
- package/esm/components/use-upload/index.js +2 -19
- package/esm/components/use-upload/use-upload.js +62 -67
- package/esm/components/use-upload/use-upload.type.d.ts +5 -1
- package/esm/components/use-upload/use-upload.type.d.ts.map +1 -1
- 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 +2 -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 +49 -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.d.ts +1 -1
- package/esm/utils/attribute.d.ts.map +1 -1
- package/esm/utils/attribute.js +6 -12
- package/esm/utils/clone.js +19 -34
- package/esm/utils/document.d.ts.map +1 -1
- package/esm/utils/document.js +11 -13
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/element.js +30 -37
- 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.d.ts.map +1 -1
- package/esm/utils/dom/ready.js +3 -7
- 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 +3 -0
- package/esm/utils/immer.d.ts.map +1 -0
- package/esm/utils/immer.js +13 -0
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +22 -257
- package/esm/utils/is.d.ts +2 -1
- package/esm/utils/is.d.ts.map +1 -1
- package/esm/utils/is.js +36 -65
- 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 +2 -2
- package/esm/utils/tree.d.ts.map +1 -1
- package/esm/utils/tree.js +24 -32
- package/esm/utils/uid.js +4 -22
- 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 +5 -3
@@ -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"}
|
@@ -1,47 +1,61 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
var
|
24
|
-
var
|
25
|
-
|
26
|
-
var
|
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 _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; } }
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
6
|
+
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."); }
|
7
|
+
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); }
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
10
|
+
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; }
|
11
|
+
import { useState, useEffect, useRef, useMemo } from 'react';
|
12
|
+
import { usePersistFn } from "../../common/use-persist-fn";
|
13
|
+
import { getKey } from "../../utils/render";
|
14
|
+
import { isObject } from "../../utils/is";
|
15
|
+
import { useLatestObj } from "../../common/use-latest-obj";
|
16
|
+
var getExpandData = function getExpandData(data, keys, keygen, treeColumnsName) {
|
17
|
+
var expandKeys = keys;
|
18
|
+
var expandSet = new Set(expandKeys);
|
19
|
+
var expandLevel = new Map();
|
20
|
+
if (expandSet.size === 0 || !treeColumnsName) {
|
21
|
+
return [data, expandLevel];
|
22
|
+
}
|
23
|
+
var newData = _toConsumableArray(data || []);
|
24
|
+
var _loop = function _loop() {
|
25
|
+
if (expandSet.size === 0) return 1; // break
|
26
|
+
var item = newData[i];
|
27
|
+
var key = getKey(keygen, item, i);
|
28
|
+
var parentLevel = expandLevel.get(key) || 0;
|
29
|
+
var children = isObject(item) && item[treeColumnsName];
|
30
|
+
if (expandSet.has(key) && children) {
|
31
|
+
children.forEach(function (child) {
|
32
|
+
expandLevel.set(getKey(keygen, child), parentLevel + 1);
|
33
|
+
});
|
34
|
+
newData.splice.apply(newData, [i + 1, 0].concat(_toConsumableArray(children)));
|
35
|
+
expandSet.delete(key);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
for (var i = 0; i < newData.length; i++) {
|
39
|
+
if (_loop()) break;
|
40
|
+
}
|
41
|
+
return [newData, expandLevel];
|
42
|
+
};
|
43
|
+
export var useTableTree = function useTableTree(props) {
|
27
44
|
var _props$data$filter;
|
28
|
-
var _useState =
|
29
|
-
_useState2 = (
|
45
|
+
var _useState = useState(props.defaultTreeExpandKeys || []),
|
46
|
+
_useState2 = _slicedToArray(_useState, 2),
|
30
47
|
expandKeysState = _useState2[0],
|
31
48
|
setExpandKeysState = _useState2[1];
|
32
|
-
var _useRef =
|
49
|
+
var _useRef = useRef({
|
33
50
|
changedByExpand: false
|
34
51
|
}),
|
35
52
|
context = _useRef.current;
|
36
|
-
|
53
|
+
useEffect(function () {
|
37
54
|
context.changedByExpand = false;
|
38
55
|
}, [expandKeysState, props.treeExpandKeys]);
|
39
|
-
var
|
40
|
-
|
41
|
-
|
42
|
-
var handleTreeExpand = (0, _usePersistFn.usePersistFn)(function (data, index) {
|
43
|
-
var expandKeys = getExpandKeys();
|
44
|
-
var key = (0, _render.getKey)(props.keygen, data, index);
|
56
|
+
var expandKeys = props.treeExpandKeys === undefined ? expandKeysState : props.treeExpandKeys;
|
57
|
+
var handleTreeExpand = usePersistFn(function (data, index) {
|
58
|
+
var key = getKey(props.keygen, data, index);
|
45
59
|
var changeKeys = new Set(expandKeys);
|
46
60
|
if (changeKeys.has(key)) {
|
47
61
|
changeKeys.delete(key);
|
@@ -52,52 +66,25 @@ var useTableTree = function useTableTree(props) {
|
|
52
66
|
setExpandKeysState(Array.from(changeKeys));
|
53
67
|
} else if (props.onTreeExpand) {
|
54
68
|
var _props$onTreeExpand;
|
55
|
-
(_props$onTreeExpand = props.onTreeExpand) === null || _props$onTreeExpand === void 0
|
69
|
+
(_props$onTreeExpand = props.onTreeExpand) === null || _props$onTreeExpand === void 0 || _props$onTreeExpand.call(props, Array.from(changeKeys), data, changeKeys.has(key), index);
|
56
70
|
}
|
57
71
|
context.changedByExpand = true;
|
58
72
|
});
|
59
|
-
var
|
60
|
-
var expandKeys = getExpandKeys();
|
61
|
-
var expandSet = new Set(expandKeys);
|
62
|
-
var expandLevel = new Map();
|
63
|
-
if (expandSet.size === 0 || !props.treeColumnsName) {
|
64
|
-
return [props.data, expandLevel];
|
65
|
-
}
|
66
|
-
var newData = (0, _toConsumableArray2.default)(props.data || []);
|
67
|
-
var _loop = function _loop() {
|
68
|
-
if (expandSet.size === 0) return "break";
|
69
|
-
var item = newData[i];
|
70
|
-
var key = (0, _render.getKey)(props.keygen, item, i);
|
71
|
-
var parentLevel = expandLevel.get(key) || 0;
|
72
|
-
var children = (0, _is.isObject)(item) && item[props.treeColumnsName];
|
73
|
-
if (expandSet.has(key) && children) {
|
74
|
-
children.forEach(function (child) {
|
75
|
-
expandLevel.set((0, _render.getKey)(props.keygen, child), parentLevel + 1);
|
76
|
-
});
|
77
|
-
newData.splice.apply(newData, [i + 1, 0].concat((0, _toConsumableArray2.default)(children)));
|
78
|
-
expandSet.delete(key);
|
79
|
-
}
|
80
|
-
};
|
81
|
-
for (var i = 0; i < newData.length; i++) {
|
82
|
-
var _ret = _loop();
|
83
|
-
if (_ret === "break") break;
|
84
|
-
}
|
85
|
-
return [newData, expandLevel];
|
86
|
-
};
|
87
|
-
var isTreeExpanded = (0, _usePersistFn.usePersistFn)(function (data, index) {
|
73
|
+
var isTreeExpanded = usePersistFn(function (data, index) {
|
88
74
|
if (!props.treeColumnsName) return false;
|
89
|
-
var
|
90
|
-
var key = (0, _render.getKey)(props.keygen, data, index);
|
75
|
+
var key = getKey(props.keygen, data, index);
|
91
76
|
return expandKeys.includes(key);
|
92
77
|
});
|
93
|
-
var func =
|
78
|
+
var func = useLatestObj({
|
94
79
|
isTreeExpanded: isTreeExpanded,
|
95
80
|
handleTreeExpand: handleTreeExpand
|
96
81
|
});
|
97
|
-
var
|
98
|
-
|
99
|
-
|
100
|
-
|
82
|
+
var _useMemo = useMemo(function () {
|
83
|
+
return getExpandData(props.data, expandKeys, props.keygen, props.treeColumnsName);
|
84
|
+
}, [props.data, expandKeys, props.treeColumnsName]),
|
85
|
+
_useMemo2 = _slicedToArray(_useMemo, 2),
|
86
|
+
treeData = _useMemo2[0],
|
87
|
+
treeExpandLevel = _useMemo2[1];
|
101
88
|
var isEmptyTree = ((_props$data$filter = props.data.filter(function (item) {
|
102
89
|
var _item;
|
103
90
|
return (_item = item[props.treeColumnsName]) === null || _item === void 0 ? void 0 : _item.length;
|
@@ -110,6 +97,4 @@ var useTableTree = function useTableTree(props) {
|
|
110
97
|
func: func
|
111
98
|
};
|
112
99
|
};
|
113
|
-
|
114
|
-
var _default = useTableTree;
|
115
|
-
exports.default = _default;
|
100
|
+
export default useTableTree;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAIA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;
|
1
|
+
{"version":3,"file":"use-table-virtual.d.ts","sourceRoot":"","sources":["use-table-virtual.tsx"],"names":[],"mappings":";AAIA,UAAU,oBAAoB;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,QAAA,MAAM,eAAe,UAAW,oBAAoB;;;;;;;oBAsGpC,MAAM;mBACP,MAAM;WACd,MAAM;gBACD,MAAM;kBACJ,OAAO;;0BAjEuB,MAAM,UAAU,MAAM;0BApBtB,MAAM,QAAQ,MAAM;2BAqHnB,MAAM;CAkDlD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
@@ -1,42 +1,41 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
var _react = require("react");
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
2
|
+
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."); }
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
6
|
+
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."); }
|
7
|
+
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); }
|
8
|
+
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; }
|
9
|
+
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; } }
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
11
|
+
import { usePrevious } from "../.../../../common/use-previous";
|
12
|
+
import { usePersistFn } from "../../common/use-persist-fn";
|
13
|
+
import { useState, useRef, useEffect } from 'react';
|
15
14
|
var useTableVirtual = function useTableVirtual(props) {
|
16
|
-
var _useState =
|
17
|
-
_useState2 = (
|
15
|
+
var _useState = useState(0),
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
18
17
|
innerLeft = _useState2[0],
|
19
18
|
setLeft = _useState2[1];
|
20
|
-
var _useState3 =
|
21
|
-
_useState4 = (
|
19
|
+
var _useState3 = useState(0),
|
20
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
22
21
|
innerTop = _useState4[0],
|
23
22
|
setTop = _useState4[1];
|
24
|
-
var _useState5 =
|
25
|
-
_useState6 = (
|
23
|
+
var _useState5 = useState(props.data.length * props.rowHeight),
|
24
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
26
25
|
scrollHeight = _useState6[0],
|
27
26
|
setHeight = _useState6[1];
|
28
|
-
var _useState7 =
|
29
|
-
_useState8 = (
|
27
|
+
var _useState7 = useState(0),
|
28
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
30
29
|
startIndex = _useState8[0],
|
31
30
|
setStartIndex = _useState8[1];
|
32
|
-
var preIndex =
|
33
|
-
var _useState9 =
|
34
|
-
_useState10 = (
|
31
|
+
var preIndex = usePrevious(startIndex);
|
32
|
+
var _useState9 = useState(0),
|
33
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
35
34
|
offsetY = _useState10[0],
|
36
35
|
setOffsetY = _useState10[1];
|
37
36
|
var rowsInView = props.rowsInView === 0 ? props.data.length : props.rowsInView;
|
38
37
|
var sleft = props.scrollLeft !== undefined ? props.scrollLeft : innerLeft;
|
39
|
-
var _useRef =
|
38
|
+
var _useRef = useRef({
|
40
39
|
cachedHeight: [],
|
41
40
|
shouldUpdateHeight: true,
|
42
41
|
rateTimer: null,
|
@@ -45,9 +44,15 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
45
44
|
heightCallback: null
|
46
45
|
}),
|
47
46
|
context = _useRef.current;
|
48
|
-
var getTranslate =
|
47
|
+
var getTranslate = usePersistFn(function (left, top) {
|
49
48
|
var l = left === undefined ? sleft : left;
|
50
49
|
var t = top === undefined ? innerTop + offsetY : top;
|
50
|
+
if (t < 0) {
|
51
|
+
t = 0;
|
52
|
+
}
|
53
|
+
if (l < 0) {
|
54
|
+
l = 0;
|
55
|
+
}
|
51
56
|
return "translate3d(-".concat(l, "px, -").concat(t, "px, 0)");
|
52
57
|
});
|
53
58
|
var getContentHeight = function getContentHeight(index) {
|
@@ -57,7 +62,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
57
62
|
}
|
58
63
|
return sum;
|
59
64
|
};
|
60
|
-
var setRowHeight =
|
65
|
+
var setRowHeight = usePersistFn(function (index, height) {
|
61
66
|
var beforeHeight = context.cachedHeight[index];
|
62
67
|
if (beforeHeight && beforeHeight === height) return;
|
63
68
|
context.cachedHeight[index] = height;
|
@@ -92,7 +97,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
92
97
|
}
|
93
98
|
setTop(top);
|
94
99
|
};
|
95
|
-
var updateRateScroll =
|
100
|
+
var updateRateScroll = usePersistFn(function (rate) {
|
96
101
|
var scrollRef = props.scrollRef;
|
97
102
|
var sumHeight = getContentHeight(props.data.length - 1);
|
98
103
|
if (sumHeight === scrollHeight) return;
|
@@ -128,7 +133,6 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
128
133
|
scrollTop = max;
|
129
134
|
}
|
130
135
|
// 拖动滚动条后保持滚动位置
|
131
|
-
console.log(context.controlScrollRate, 'controlScrollRate');
|
132
136
|
if (context.controlScrollRate !== null) {
|
133
137
|
var top = context.controlScrollRate * max;
|
134
138
|
updateIndexAndTopFromTop(top);
|
@@ -138,7 +142,6 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
138
142
|
}
|
139
143
|
// 拖动滚动条
|
140
144
|
if (fromDrag) {
|
141
|
-
console.log('fromDrag');
|
142
145
|
var _top = y * max;
|
143
146
|
updateIndexAndTopFromTop(_top);
|
144
147
|
if (context.rateTimer) clearTimeout(context.rateTimer);
|
@@ -149,7 +152,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
149
152
|
updateIndexAndTopFromTop(scrollTop);
|
150
153
|
}
|
151
154
|
};
|
152
|
-
var scrollToIndex =
|
155
|
+
var scrollToIndex = usePersistFn(function (index) {
|
153
156
|
if (props.scrollRef.current) {
|
154
157
|
context.shouldUpdateHeight = true;
|
155
158
|
var i = Math.max(0, Math.min(index, props.data.length - 1));
|
@@ -163,7 +166,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
163
166
|
props.scrollRef.current.scrollTop = beforeHeight;
|
164
167
|
}
|
165
168
|
});
|
166
|
-
|
169
|
+
useEffect(function () {
|
167
170
|
if (offsetY) {
|
168
171
|
if (props.scrollRef.current && props.innerRef.current) {
|
169
172
|
setOffsetY(0);
|
@@ -174,17 +177,17 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
174
177
|
}
|
175
178
|
}
|
176
179
|
}, [offsetY, startIndex]);
|
177
|
-
|
180
|
+
useEffect(function () {
|
178
181
|
setHeight(getContentHeight(props.data.length - 1));
|
179
182
|
}, [props.data.length]);
|
180
|
-
|
183
|
+
useEffect(function () {
|
181
184
|
if (context.heightCallback) {
|
182
185
|
var cb = context.heightCallback;
|
183
186
|
context.heightCallback = null;
|
184
187
|
cb();
|
185
188
|
}
|
186
189
|
}, [scrollHeight]);
|
187
|
-
var renderData = (
|
190
|
+
var renderData = _toConsumableArray(props.data).slice(startIndex, startIndex + rowsInView);
|
188
191
|
return {
|
189
192
|
scrollHeight: scrollHeight,
|
190
193
|
startIndex: startIndex,
|
@@ -197,5 +200,4 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
197
200
|
scrollToIndex: scrollToIndex
|
198
201
|
};
|
199
202
|
};
|
200
|
-
|
201
|
-
exports.default = _default;
|
203
|
+
export default useTableVirtual;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { KeygenResult, ObjectKey, StructKeygenType } from '../../common/type';
|
3
|
-
export
|
4
|
-
export
|
5
|
-
export
|
3
|
+
export type TableColumnOrder = 'asc' | 'desc';
|
4
|
+
export type TableColumnFix = 'left' | 'right';
|
5
|
+
export type TableColumnType = 'expand' | 'row-expand' | 'checkbox';
|
6
6
|
export interface SortItem {
|
7
7
|
order: 'desc' | 'asc';
|
8
8
|
weight?: number;
|
@@ -266,5 +266,5 @@ export interface TableGroupColumn {
|
|
266
266
|
lastFixed?: boolean;
|
267
267
|
index: number;
|
268
268
|
}
|
269
|
-
export
|
269
|
+
export type TableHeadColumn = TableGroupColumn | TableFormatColumn<any>;
|
270
270
|
//# sourceMappingURL=use-table.type.d.ts.map
|