@sheinx/hooks 3.0.0-rc.1 → 3.0.0-rc.4
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 +4 -4
- 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.js +16 -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 +4 -4
- 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.js +22 -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,27 +1,3 @@
|
|
1
|
-
"use strict";
|
2
1
|
"use client";
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
Object.defineProperty(exports, "default", {
|
9
|
-
enumerable: true,
|
10
|
-
get: function get() {
|
11
|
-
return _useSelect.default;
|
12
|
-
}
|
13
|
-
});
|
14
|
-
Object.defineProperty(exports, "useGroup", {
|
15
|
-
enumerable: true,
|
16
|
-
get: function get() {
|
17
|
-
return _useSelectGroup.default;
|
18
|
-
}
|
19
|
-
});
|
20
|
-
Object.defineProperty(exports, "useSelect", {
|
21
|
-
enumerable: true,
|
22
|
-
get: function get() {
|
23
|
-
return _useSelect.default;
|
24
|
-
}
|
25
|
-
});
|
26
|
-
var _useSelect = _interopRequireDefault(require("./use-select"));
|
27
|
-
var _useSelectGroup = _interopRequireDefault(require("./use-select-group"));
|
2
|
+
export { default, default as useSelect } from "./use-select";
|
3
|
+
export { default as useGroup } from "./use-select-group";
|
@@ -1,26 +1,24 @@
|
|
1
|
-
"
|
2
|
-
|
3
|
-
var
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
var _react = require("react");
|
14
|
-
var _utils = require("../../utils");
|
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 _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; }
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
4
|
+
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); }
|
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 { useEffect, useState, useRef } from 'react';
|
12
|
+
import { getUidStr } from "../../utils";
|
15
13
|
var UseSelectGroup = function UseSelectGroup(props) {
|
16
14
|
var _props$data = props.data,
|
17
15
|
dataProp = _props$data === void 0 ? [] : _props$data,
|
18
16
|
groupBy = props.groupBy;
|
19
|
-
var _useState =
|
20
|
-
_useState2 = (
|
17
|
+
var _useState = useState([]),
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
21
19
|
data = _useState2[0],
|
22
20
|
setData = _useState2[1];
|
23
|
-
var groupKey =
|
21
|
+
var groupKey = useRef('');
|
24
22
|
var initGroupData = function initGroupData() {
|
25
23
|
if (typeof groupBy !== 'function') {
|
26
24
|
setData(dataProp);
|
@@ -29,7 +27,7 @@ var UseSelectGroup = function UseSelectGroup(props) {
|
|
29
27
|
var groupData = {};
|
30
28
|
dataProp.forEach(function (item, index) {
|
31
29
|
var group = groupBy(item, index, dataProp);
|
32
|
-
if (!groupData[group]) groupData[group || ''] = group ? [(
|
30
|
+
if (!groupData[group]) groupData[group || ''] = group ? [_defineProperty({}, groupKey.current, group)] : [];
|
33
31
|
groupData[group].push(item);
|
34
32
|
});
|
35
33
|
var newData = Object.keys(groupData).reduce(function (p, v) {
|
@@ -37,9 +35,9 @@ var UseSelectGroup = function UseSelectGroup(props) {
|
|
37
35
|
}, []);
|
38
36
|
setData(newData);
|
39
37
|
};
|
40
|
-
|
38
|
+
useEffect(function () {
|
41
39
|
if (!groupBy) return;
|
42
|
-
groupKey.current =
|
40
|
+
groupKey.current = getUidStr();
|
43
41
|
initGroupData();
|
44
42
|
}, [dataProp]);
|
45
43
|
return {
|
@@ -47,5 +45,4 @@ var UseSelectGroup = function UseSelectGroup(props) {
|
|
47
45
|
groupKey: groupKey.current
|
48
46
|
};
|
49
47
|
};
|
50
|
-
|
51
|
-
exports.default = _default;
|
48
|
+
export default UseSelectGroup;
|
@@ -1,11 +1,5 @@
|
|
1
|
-
"use
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
var _useInputAble2 = require("../../common/use-input-able");
|
8
|
-
var _useListSelect = require("../../common/use-list-select");
|
1
|
+
import { useInputAble } from "../../common/use-input-able";
|
2
|
+
import { useListSelect } from "../../common/use-list-select";
|
9
3
|
var emptyArray = [];
|
10
4
|
var useSelect = function useSelect(props) {
|
11
5
|
var data = props.data,
|
@@ -21,7 +15,7 @@ var useSelect = function useSelect(props) {
|
|
21
15
|
valueProp = props.value,
|
22
16
|
onChangeProp = props.onChange,
|
23
17
|
filterSameChange = props.filterSameChange;
|
24
|
-
var _useInputAble =
|
18
|
+
var _useInputAble = useInputAble({
|
25
19
|
value: valueProp,
|
26
20
|
control: control,
|
27
21
|
defaultValue: defaultValue,
|
@@ -31,7 +25,7 @@ var useSelect = function useSelect(props) {
|
|
31
25
|
}),
|
32
26
|
value = _useInputAble.value,
|
33
27
|
onChange = _useInputAble.onChange;
|
34
|
-
var datum =
|
28
|
+
var datum = useListSelect({
|
35
29
|
data: data || treeData || emptyArray,
|
36
30
|
separator: separator,
|
37
31
|
format: format,
|
@@ -46,5 +40,4 @@ var useSelect = function useSelect(props) {
|
|
46
40
|
datum: datum
|
47
41
|
};
|
48
42
|
};
|
49
|
-
|
50
|
-
exports.default = _default;
|
43
|
+
export default useSelect;
|
@@ -28,7 +28,7 @@ export interface BaseSelectProps<DataItem, Value> {
|
|
28
28
|
* @cn 默认使用 format 函数执行的结果来比较是否匹配,在某些情况下(例如返回原始数据的对象,更新数据时,生成了一个值相同,非同一个对象的选项),需要借助 prediction 函数来判断是否匹配
|
29
29
|
* @default (val, d) => val===format(d)
|
30
30
|
*/
|
31
|
-
prediction?: (value: Value, Data: DataItem) => boolean;
|
31
|
+
prediction?: (value: Value extends (infer U)[] ? U : Value, Data: DataItem) => boolean;
|
32
32
|
/**
|
33
33
|
* @en Format value. The defaule value is return the original data. When it is a string, the value is fetched from the original data as a key equivalent to (d) => d[format] When it is a function, use its return value
|
34
34
|
* @cn 格式化 value, 默认值,返回原始数据。 为 string 时,会作为 key 从原始数据中获取值,相当于 (d) => d[format]; 为函数时,以函数返回结果作为 value
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-select.type.d.ts","sourceRoot":"","sources":["use-select.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,eAAe,CAAC,QAAQ,EAAE,KAAK;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC;IAEnD;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"use-select.type.d.ts","sourceRoot":"","sources":["use-select.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,MAAM,WAAW,eAAe,CAAC,QAAQ,EAAE,KAAK;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,QAAQ,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC;IAEnD;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC;IAEvF;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,KAAK,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE3F;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC;IAErC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnF;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,KAAK,MAAM,CAAC;IACxE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B"}
|
@@ -1,20 +1,2 @@
|
|
1
|
-
"use strict";
|
2
1
|
"use client";
|
3
|
-
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
6
|
-
value: true
|
7
|
-
});
|
8
|
-
Object.defineProperty(exports, "default", {
|
9
|
-
enumerable: true,
|
10
|
-
get: function get() {
|
11
|
-
return _useSlider.default;
|
12
|
-
}
|
13
|
-
});
|
14
|
-
Object.defineProperty(exports, "useSlider", {
|
15
|
-
enumerable: true,
|
16
|
-
get: function get() {
|
17
|
-
return _useSlider.default;
|
18
|
-
}
|
19
|
-
});
|
20
|
-
var _useSlider = _interopRequireDefault(require("./use-slider"));
|
2
|
+
export { default, default as useSlider } from "./use-slider";
|
@@ -1,18 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
var
|
9
|
-
var
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 { useState, useRef } from 'react';
|
12
|
+
import { toPrecision } from "../../utils/number";
|
13
|
+
import usePersistFn from "../../common/use-persist-fn";
|
14
|
+
import useLatestObj from "../../common/use-latest-obj";
|
15
|
+
import useDragMock from "../../common/use-drag-mock";
|
16
16
|
/**
|
17
17
|
* 结构:
|
18
18
|
* <track>
|
@@ -34,7 +34,7 @@ var getValueFromRate = function getValueFromRate(per, scale) {
|
|
34
34
|
var max = scale[ps + 1];
|
35
35
|
var count = (max - min) / step;
|
36
36
|
var sper = (per - ps / range) * range;
|
37
|
-
return
|
37
|
+
return toPrecision(min + Math.round(sper * count) * step);
|
38
38
|
};
|
39
39
|
var getRateFromValue = function getRateFromValue(value, scale) {
|
40
40
|
if (value <= scale[0]) return 0;
|
@@ -49,33 +49,33 @@ var getRateFromValue = function getRateFromValue(value, scale) {
|
|
49
49
|
var max = scale[ps + 1];
|
50
50
|
return (ps + (value - min) / (max - min)) / range;
|
51
51
|
};
|
52
|
-
var useSlider = function useSlider(props) {
|
52
|
+
export var useSlider = function useSlider(props) {
|
53
53
|
var scale = props.scale,
|
54
54
|
step = props.step;
|
55
|
-
var _useState =
|
56
|
-
_useState2 = (
|
55
|
+
var _useState = useState([0, 0]),
|
56
|
+
_useState2 = _slicedToArray(_useState, 2),
|
57
57
|
rate = _useState2[0],
|
58
58
|
setRate = _useState2[1];
|
59
59
|
var startValue = props.range && Array.isArray(props.value) ? props.value[0] : 0;
|
60
60
|
var endValue = props.range && Array.isArray(props.value) ? props.value[1] : props.value || 0;
|
61
|
-
var _useRef =
|
61
|
+
var _useRef = useRef({
|
62
62
|
dragIndex: -1,
|
63
63
|
clickLock: false,
|
64
64
|
clickLockTimer: null
|
65
65
|
}),
|
66
66
|
context = _useRef.current;
|
67
|
-
var trackRef =
|
68
|
-
var handleDragStart = (
|
67
|
+
var trackRef = useRef(null);
|
68
|
+
var handleDragStart = usePersistFn(function () {
|
69
69
|
setRate([getRateFromValue(startValue, scale), getRateFromValue(endValue, scale)]);
|
70
70
|
});
|
71
|
-
var lockClick = (
|
71
|
+
var lockClick = usePersistFn(function () {
|
72
72
|
context.clickLock = true;
|
73
73
|
if (context.clickLockTimer) clearTimeout(context.clickLockTimer);
|
74
74
|
context.clickLockTimer = setTimeout(function () {
|
75
75
|
context.clickLock = false;
|
76
76
|
}, 100);
|
77
77
|
});
|
78
|
-
var handleDragEnd = (
|
78
|
+
var handleDragEnd = usePersistFn(function () {
|
79
79
|
lockClick();
|
80
80
|
var start = getValueFromRate(rate[0], scale, step);
|
81
81
|
var end = getValueFromRate(rate[1], scale, step);
|
@@ -86,11 +86,11 @@ var useSlider = function useSlider(props) {
|
|
86
86
|
props.onChange(end);
|
87
87
|
}
|
88
88
|
});
|
89
|
-
var handleDragMove = (
|
89
|
+
var handleDragMove = usePersistFn(function (deltaX, deltaY) {
|
90
90
|
setRate(function (r) {
|
91
91
|
var target = trackRef.current;
|
92
92
|
if (!target) return r;
|
93
|
-
var newRate = (
|
93
|
+
var newRate = _toConsumableArray(r);
|
94
94
|
var v = context.dragIndex === 0 ? r[0] : r[1];
|
95
95
|
var max = props.vertical ? target.clientHeight : target.clientWidth;
|
96
96
|
var delta = props.vertical ? deltaY * -1 : deltaX;
|
@@ -109,7 +109,7 @@ var useSlider = function useSlider(props) {
|
|
109
109
|
return newRate;
|
110
110
|
});
|
111
111
|
});
|
112
|
-
var dragInfo = (
|
112
|
+
var dragInfo = useDragMock({
|
113
113
|
onDragStart: handleDragStart,
|
114
114
|
onDragMove: handleDragMove,
|
115
115
|
onDragEnd: handleDragEnd
|
@@ -122,7 +122,7 @@ var useSlider = function useSlider(props) {
|
|
122
122
|
context.dragIndex = 1;
|
123
123
|
dragInfo.handleMouseDown(e);
|
124
124
|
};
|
125
|
-
var handleTrackClick = (
|
125
|
+
var handleTrackClick = usePersistFn(function (e) {
|
126
126
|
if (context.clickLock) return;
|
127
127
|
var target = e.currentTarget;
|
128
128
|
var rect = target.getBoundingClientRect();
|
@@ -153,7 +153,7 @@ var useSlider = function useSlider(props) {
|
|
153
153
|
right: (1 - end) * 100 + '%'
|
154
154
|
};
|
155
155
|
};
|
156
|
-
var func = (
|
156
|
+
var func = useLatestObj({
|
157
157
|
handleStartMouseDown: handleStartMouseDown,
|
158
158
|
handleEndMouseDown: handleEndMouseDown,
|
159
159
|
handleTrackClick: handleTrackClick
|
@@ -172,6 +172,4 @@ var useSlider = function useSlider(props) {
|
|
172
172
|
innerStyle: innerStyle
|
173
173
|
};
|
174
174
|
};
|
175
|
-
|
176
|
-
var _default = useSlider;
|
177
|
-
exports.default = _default;
|
175
|
+
export default useSlider;
|
@@ -1,69 +1,9 @@
|
|
1
|
-
"use strict";
|
2
1
|
"use client";
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
}
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
return _useTableLayout.default;
|
12
|
-
}
|
13
|
-
});
|
14
|
-
Object.defineProperty(exports, "useTableColumns", {
|
15
|
-
enumerable: true,
|
16
|
-
get: function get() {
|
17
|
-
return _useTableColumns.default;
|
18
|
-
}
|
19
|
-
});
|
20
|
-
Object.defineProperty(exports, "useTableExpand", {
|
21
|
-
enumerable: true,
|
22
|
-
get: function get() {
|
23
|
-
return _useTableExpand.default;
|
24
|
-
}
|
25
|
-
});
|
26
|
-
Object.defineProperty(exports, "useTableGroup", {
|
27
|
-
enumerable: true,
|
28
|
-
get: function get() {
|
29
|
-
return _useTableGroup.default;
|
30
|
-
}
|
31
|
-
});
|
32
|
-
Object.defineProperty(exports, "useTableLayout", {
|
33
|
-
enumerable: true,
|
34
|
-
get: function get() {
|
35
|
-
return _useTableLayout.default;
|
36
|
-
}
|
37
|
-
});
|
38
|
-
Object.defineProperty(exports, "useTableRow", {
|
39
|
-
enumerable: true,
|
40
|
-
get: function get() {
|
41
|
-
return _useTableRow.default;
|
42
|
-
}
|
43
|
-
});
|
44
|
-
Object.defineProperty(exports, "useTableSort", {
|
45
|
-
enumerable: true,
|
46
|
-
get: function get() {
|
47
|
-
return _useTableSort.default;
|
48
|
-
}
|
49
|
-
});
|
50
|
-
Object.defineProperty(exports, "useTableTree", {
|
51
|
-
enumerable: true,
|
52
|
-
get: function get() {
|
53
|
-
return _useTableTree.default;
|
54
|
-
}
|
55
|
-
});
|
56
|
-
Object.defineProperty(exports, "useTableVirtual", {
|
57
|
-
enumerable: true,
|
58
|
-
get: function get() {
|
59
|
-
return _useTableVirtual.default;
|
60
|
-
}
|
61
|
-
});
|
62
|
-
var _useTableLayout = _interopRequireDefault(require("./use-table-layout"));
|
63
|
-
var _useTableColumns = _interopRequireDefault(require("./use-table-columns"));
|
64
|
-
var _useTableGroup = _interopRequireDefault(require("./use-table-group"));
|
65
|
-
var _useTableSort = _interopRequireDefault(require("./use-table-sort"));
|
66
|
-
var _useTableRow = _interopRequireDefault(require("./use-table-row"));
|
67
|
-
var _useTableExpand = _interopRequireDefault(require("./use-table-expand"));
|
68
|
-
var _useTableTree = _interopRequireDefault(require("./use-table-tree"));
|
69
|
-
var _useTableVirtual = _interopRequireDefault(require("./use-table-virtual"));
|
2
|
+
export { default, default as useTableLayout } from "./use-table-layout";
|
3
|
+
export { default as useTableColumns } from "./use-table-columns";
|
4
|
+
export { default as useTableGroup } from "./use-table-group";
|
5
|
+
export { default as useTableSort } from "./use-table-sort";
|
6
|
+
export { default as useTableRow } from "./use-table-row";
|
7
|
+
export { default as useTableExpand } from "./use-table-expand";
|
8
|
+
export { default as useTableTree } from "./use-table-tree";
|
9
|
+
export { default as useTableVirtual } from "./use-table-virtual";
|
@@ -4,7 +4,7 @@ export interface UseColumnsProps<Data> {
|
|
4
4
|
columns?: TableColumnItem<Data>[];
|
5
5
|
showCheckbox?: boolean;
|
6
6
|
}
|
7
|
-
export
|
7
|
+
export type RxpandHideColType = {
|
8
8
|
hide?: boolean;
|
9
9
|
type: 'expand' | 'row-expand';
|
10
10
|
render?: (data: any, index: number) => (() => React.ReactNode) | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-columns.d.ts","sourceRoot":"","sources":["use-table-columns.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAYD,
|
1
|
+
{"version":3,"file":"use-table-columns.d.ts","sourceRoot":"","sources":["use-table-columns.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAItE,MAAM,WAAW,eAAe,CAAC,IAAI;IACnC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAYD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC9B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IAC3E,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,GAAG,IAAI,CAAC;AAET,QAAA,MAAM,UAAU;;;CAgEf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
@@ -1,17 +1,7 @@
|
|
1
|
-
"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
value: true
|
6
|
-
});
|
7
|
-
exports.default = void 0;
|
8
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
9
|
-
require("core-js/modules/es.array.filter.js");
|
10
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
11
|
-
require("core-js/modules/es.array.map.js");
|
12
|
-
var _immer = require("../../utils/immer");
|
13
|
-
var _react = require("react");
|
14
|
-
var _usePersistFn = _interopRequireDefault(require("../../common/use-persist-fn"));
|
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
|
+
import { produce } from "../../utils/immer";
|
3
|
+
import { useRef } from 'react';
|
4
|
+
import usePersistFn from "../../common/use-persist-fn";
|
15
5
|
var getHideExpandCol = function getHideExpandCol() {
|
16
6
|
var cols = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
17
7
|
var expandCol = cols.find(function (col) {
|
@@ -25,7 +15,7 @@ var getHideExpandCol = function getHideExpandCol() {
|
|
25
15
|
var useColumns = function useColumns(props) {
|
26
16
|
var _props$columns = props.columns,
|
27
17
|
propsColumns = _props$columns === void 0 ? [] : _props$columns;
|
28
|
-
var _useRef =
|
18
|
+
var _useRef = useRef({
|
29
19
|
cachedColumns: null,
|
30
20
|
oldColumns: null,
|
31
21
|
groupLevel: 0,
|
@@ -35,13 +25,13 @@ var useColumns = function useColumns(props) {
|
|
35
25
|
|
36
26
|
// 隐藏的展开列
|
37
27
|
|
38
|
-
var getColumns = (
|
28
|
+
var getColumns = usePersistFn(function (columnsA) {
|
39
29
|
if (columnsA === context.oldColumns) {
|
40
30
|
return context.cachedColumns;
|
41
31
|
}
|
42
32
|
context.expandHideCol = getHideExpandCol(columnsA);
|
43
33
|
var columns = columnsA.filter(function (c) {
|
44
|
-
return (
|
34
|
+
return _typeof(c) === 'object';
|
45
35
|
}).filter(function (c) {
|
46
36
|
return c !== context.expandHideCol;
|
47
37
|
});
|
@@ -64,7 +54,7 @@ var useColumns = function useColumns(props) {
|
|
64
54
|
}
|
65
55
|
});
|
66
56
|
context.cachedColumns = columns.map(function (c, i) {
|
67
|
-
return
|
57
|
+
return produce(c, function (draft) {
|
68
58
|
draft.index = i;
|
69
59
|
if (draft.key === undefined) draft.key = i;
|
70
60
|
if (i <= left) draft.fixed = 'left';
|
@@ -82,5 +72,4 @@ var useColumns = function useColumns(props) {
|
|
82
72
|
expandHideCol: context.expandHideCol
|
83
73
|
};
|
84
74
|
};
|
85
|
-
|
86
|
-
exports.default = _default;
|
75
|
+
export default useColumns;
|
@@ -1,40 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
var
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
require("core-js/modules/es.array.concat.js");
|
16
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
17
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
19
|
-
var _usePersistFn = _interopRequireDefault(require("../../common/use-persist-fn"));
|
20
|
-
var _render = require("../..//utils/render");
|
21
|
-
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); }
|
22
|
-
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; }
|
23
|
-
var useTableExpand = function useTableExpand(props) {
|
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 React, { useEffect } from 'react';
|
12
|
+
import usePersistFn from "../../common/use-persist-fn";
|
13
|
+
import { getKey } from "../..//utils/render";
|
14
|
+
export var useTableExpand = function useTableExpand(props) {
|
24
15
|
var columns = props.columns,
|
25
16
|
expandKeys = props.expandKeys;
|
26
|
-
var _React$useState =
|
27
|
-
_React$useState2 = (
|
17
|
+
var _React$useState = React.useState([]),
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
28
19
|
expandState = _React$useState2[0],
|
29
20
|
setExpandState = _React$useState2[1];
|
30
|
-
var isRowExpand = (
|
31
|
-
var key =
|
21
|
+
var isRowExpand = usePersistFn(function (data, index) {
|
22
|
+
var key = getKey(props.keygen, data, index);
|
32
23
|
if (expandKeys) {
|
33
24
|
return expandKeys.includes(key);
|
34
25
|
}
|
35
26
|
return expandState.includes(key);
|
36
27
|
});
|
37
|
-
var handleExpandClick = (
|
28
|
+
var handleExpandClick = usePersistFn(function (col, data, index) {
|
38
29
|
if (col && typeof col.render === 'function') {
|
39
30
|
var expandRender = col.render(data, index);
|
40
31
|
if (typeof expandRender === 'function') {
|
@@ -42,21 +33,21 @@ var useTableExpand = function useTableExpand(props) {
|
|
42
33
|
var expand = isRowExpand(data, index);
|
43
34
|
if (expandKeys) {
|
44
35
|
var _col$onClick;
|
45
|
-
(_col$onClick = col.onClick) === null || _col$onClick === void 0
|
36
|
+
(_col$onClick = col.onClick) === null || _col$onClick === void 0 || _col$onClick.call(col, data, !expand);
|
46
37
|
} else {
|
47
|
-
var key =
|
38
|
+
var key = getKey(props.keygen, data, index);
|
48
39
|
if (expand) {
|
49
40
|
setExpandState(expandState.filter(function (item) {
|
50
41
|
return item !== key;
|
51
42
|
}));
|
52
43
|
} else {
|
53
|
-
setExpandState([].concat((
|
44
|
+
setExpandState([].concat(_toConsumableArray(expandState), [key]));
|
54
45
|
}
|
55
46
|
}
|
56
47
|
}
|
57
48
|
}
|
58
49
|
});
|
59
|
-
|
50
|
+
useEffect(function () {
|
60
51
|
var expandNum = columns.filter(function (col) {
|
61
52
|
return col.type === 'expand' || col.type === 'row-expand';
|
62
53
|
}).length;
|
@@ -69,6 +60,4 @@ var useTableExpand = function useTableExpand(props) {
|
|
69
60
|
isRowExpand: isRowExpand
|
70
61
|
};
|
71
62
|
};
|
72
|
-
|
73
|
-
var _default = useTableExpand;
|
74
|
-
exports.default = _default;
|
63
|
+
export default useTableExpand;
|
@@ -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;
|