react-kui 3.0.0 → 3.1.1
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/AI.en-US.md +86 -1
- package/AI.md +68 -4
- package/ai/behaviors.json +114 -14
- package/ai/cli.mjs +180 -17
- package/ai/descriptions.json +446 -0
- package/ai/kui-components.json +4591 -3846
- package/ai/mcp.mjs +2 -189
- package/ai/query.mjs +195 -0
- package/ai/skills/react-kui/SKILL.md +41 -9
- package/ai/skills/react-kui/references/mcp.md +11 -1
- package/ai/skills/react-kui/references/react-to-vue.md +110 -0
- package/ai/skills/react-kui/references/vue-to-react.md +86 -0
- package/ai/validate.mjs +18 -0
- package/es/_virtual/_rolldown/runtime.js +1 -1
- package/es/affix/index.js +1 -1
- package/es/alert/index.js +29 -15
- package/es/anchor/anchor-context.js +1 -1
- package/es/anchor/anchor-link.js +1 -1
- package/es/anchor/anchor.js +1 -1
- package/es/auto-complete/index.js +378 -437
- package/es/avatar/avatar-group-context.js +1 -1
- package/es/avatar/avatar-group.js +1 -1
- package/es/avatar/avatar.js +2 -2
- package/es/back-top/index.js +3 -3
- package/es/badge/index.js +6 -2
- package/es/base/teleport.js +19 -30
- package/es/base/transition-props.js +1 -1
- package/es/base/transition.js +3 -3
- package/es/breadcrumb/breadcrumb-context.js +1 -1
- package/es/breadcrumb/breadcrumb-item.js +1 -1
- package/es/breadcrumb/breadcrumb.js +1 -1
- package/es/button/button-group-context.js +1 -1
- package/es/button/button-group.js +1 -1
- package/es/button/button.js +2 -2
- package/es/calendar/index.js +1 -1
- package/es/card/index.js +1 -1
- package/es/carousel/carousel-context.js +1 -1
- package/es/carousel/carousel-item.js +1 -1
- package/es/carousel/carousel.js +522 -274
- package/es/carousel/drag.js +169 -0
- package/es/cascader/index.js +104 -170
- package/es/check-card/check-card-group.js +1 -1
- package/es/check-card/check-card.js +143 -143
- package/es/check-card/context.js +1 -1
- package/es/checkbox/checkbox-group-context.js +1 -1
- package/es/checkbox/checkbox-group.js +1 -1
- package/es/checkbox/checkbox.js +131 -112
- package/es/checkbox/index.js +1 -1
- package/es/collapse/collapse-panel.js +2 -2
- package/es/collapse/collapse.js +96 -103
- package/es/color-picker/alpha.js +81 -63
- package/es/color-picker/hue.js +69 -51
- package/es/color-picker/index.js +79 -128
- package/es/color-picker/mode.js +1 -1
- package/es/color-picker/paint.js +85 -67
- package/es/color-picker/presets.js +1 -1
- package/es/components.js +4 -2
- package/es/config/config-context.js +1 -1
- package/es/config/context.js +1 -1
- package/es/config/index.js +1 -1
- package/es/config/size-context.js +1 -1
- package/es/config/use-config-appearance.js +1 -1
- package/es/const/var.js +1 -1
- package/es/date-picker/index.js +591 -678
- package/es/descriptions/descriptions-item.js +1 -1
- package/es/descriptions/descriptions.js +2 -2
- package/es/divider/index.js +1 -1
- package/es/drawer/index.js +193 -190
- package/es/dropdown/dropdown-button.js +1 -1
- package/es/dropdown/dropdown-context.js +1 -1
- package/es/dropdown/dropdown.js +173 -331
- package/es/dropdown/trigger.js +1 -1
- package/es/empty/index.js +1 -1
- package/es/feature-card/index.js +1 -1
- package/es/feedback-panel/index.js +1 -1
- package/es/flame-wrap/index.js +1 -1
- package/es/flame-wrap/types.js +1 -1
- package/es/flex/index.js +1 -1
- package/es/form/field-context.js +1 -1
- package/es/form/form-context.js +1 -1
- package/es/form/form-item.js +2 -2
- package/es/form/form.js +1 -1
- package/es/form/utils.js +1 -1
- package/es/grid/grid-item.js +1 -1
- package/es/grid/grid.js +1 -1
- package/es/grid/useBreakpoint.js +1 -1
- package/es/icon/index.js +1 -1
- package/es/image/group.js +1 -1
- package/es/image/image-group-context.js +1 -1
- package/es/image/image.js +1 -1
- package/es/image/instance.js +1 -1
- package/es/image/preview.js +2 -2
- package/es/image/utils.js +1 -1
- package/es/index.js +3 -2
- package/es/input/index.js +1 -1
- package/es/input/input-base.js +202 -0
- package/es/input/input-box.js +1 -1
- package/es/input/input-group.js +2 -2
- package/es/input/input.js +19 -188
- package/es/input/textarea.js +1 -1
- package/es/input-number/index.js +4 -4
- package/es/input-otp/index.js +2 -1
- package/es/input-tag/index.js +13 -43
- package/es/kanban/index.js +1 -1
- package/es/layout/index.js +1 -1
- package/es/layout/layout-context.js +1 -1
- package/es/list-panel/index.js +1 -1
- package/es/loading/index.js +1 -1
- package/es/loading/loading-bar.js +1 -1
- package/es/locale/de.js +1 -1
- package/es/locale/el.js +1 -1
- package/es/locale/en.js +1 -1
- package/es/locale/fr.js +1 -1
- package/es/locale/it.js +1 -1
- package/es/locale/ja.js +1 -1
- package/es/locale/ko.js +1 -1
- package/es/locale/ru.js +1 -1
- package/es/locale/th.js +1 -1
- package/es/locale/uk.js +1 -1
- package/es/locale/vi.js +1 -1
- package/es/locale/zh-CN.js +1 -1
- package/es/locale/zh-TW.js +1 -1
- package/es/mentions/index.js +341 -387
- package/es/menu/menu-context.js +1 -1
- package/es/menu/menu-divider.js +1 -1
- package/es/menu/menu-group.js +1 -1
- package/es/menu/menu-item.js +3 -3
- package/es/menu/menu-keyboard.js +1 -1
- package/es/menu/menu.js +215 -220
- package/es/menu/recursive-menu.js +1 -1
- package/es/menu/sub-menu.js +3 -3
- package/es/message/index.js +1 -1
- package/es/modal/api.js +1 -1
- package/es/modal/modal.js +247 -244
- package/es/modal/toast.js +1 -1
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
- package/es/notice/container.js +1 -1
- package/es/notice/content.js +1 -1
- package/es/notice/index.js +1 -1
- package/es/notice/instance.js +1 -1
- package/es/page/index.js +101 -78
- package/es/page/responsive.js +96 -0
- package/es/page-header/index.js +1 -1
- package/es/popconfirm/index.js +89 -241
- package/es/poptip/index.js +83 -243
- package/es/popup/index.js +429 -0
- package/es/popup/layers.js +33 -0
- package/es/progress/index.js +1 -1
- package/es/qrcode/index.js +1 -1
- package/es/radio/radio-button.js +53 -53
- package/es/radio/radio-group-context.js +1 -1
- package/es/radio/radio-group.js +1 -1
- package/es/radio/radio.js +110 -91
- package/es/rate/index.js +58 -57
- package/es/rate/star.js +1 -1
- package/es/result/index.js +1 -1
- package/es/ripple/index.js +1 -1
- package/es/ripple/types.js +1 -1
- package/es/row-col/col.js +1 -1
- package/es/row-col/row.js +1 -1
- package/es/segmented/index.js +1 -1
- package/es/select/option.js +69 -61
- package/es/select/select.js +78 -213
- package/es/skeleton/skeleton-avatar.js +1 -1
- package/es/skeleton/skeleton-button.js +1 -1
- package/es/skeleton/skeleton-image.js +1 -1
- package/es/skeleton/skeleton-text.js +1 -1
- package/es/skeleton/skeleton.js +1 -1
- package/es/skeleton/use-skeleton-loading.js +1 -1
- package/es/slider/index.js +89 -55
- package/es/slider/thumb.js +2 -1
- package/es/space/index.js +2 -2
- package/es/spin/index.js +1 -1
- package/es/splitter/splitter-panel.js +1 -1
- package/es/splitter/splitter.js +1 -1
- package/es/stat-card/countup.js +8 -4
- package/es/stat-card/rollup.js +122 -0
- package/es/stat-card/stat-card.js +1 -1
- package/es/stat-card/stat-number.js +1 -1
- package/es/stat-card/utils/countup.js +2 -2
- package/es/stat-card/utils/odometer.js +104 -107
- package/es/steps/index.js +1 -1
- package/es/switch/index.js +7 -6
- package/es/table/column-setting.js +1 -1
- package/es/table/index.js +33 -29
- package/es/table/utils.js +1 -1
- package/es/tabs/tab-panel.js +1 -1
- package/es/tabs/tabs.js +15 -6
- package/es/tag/index.js +9 -5
- package/es/time-line/timeline-item.js +1 -1
- package/es/time-line/timeline.js +1 -1
- package/es/tooltip/index.js +127 -248
- package/es/tour/index.js +198 -193
- package/es/transfer/index.js +245 -246
- package/es/tree/index.js +72 -67
- package/es/tree/utils.js +1 -1
- package/es/tree-select/index.js +562 -655
- package/es/typography/index.js +1 -1
- package/es/upload/file-list.js +3 -1
- package/es/upload/index.js +8 -8
- package/es/upload/picture-sort.js +1 -1
- package/es/upload/selector.js +121 -116
- package/es/utils/checked.js +1 -1
- package/es/utils/color.js +1 -1
- package/es/utils/number.js +1 -1
- package/es/utils/placement.js +1 -1
- package/es/utils/popup.js +42 -0
- package/es/utils/react-node.js +1 -1
- package/es/utils/selection-tags.js +55 -0
- package/es/utils/share.js +1 -1
- package/es/utils/theme.js +1 -1
- package/es/utils/transition.js +1 -1
- package/es/utils/use-value.js +1 -1
- package/es/virtual-list/index.js +1 -1
- package/es/virtual-list/range.js +1 -1
- package/es/watermark/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +1 -1
- package/lib/locale/el.cjs +1 -1
- package/lib/locale/en.cjs +1 -1
- package/lib/locale/fr.cjs +1 -1
- package/lib/locale/it.cjs +1 -1
- package/lib/locale/ja.cjs +1 -1
- package/lib/locale/ko.cjs +1 -1
- package/lib/locale/ru.cjs +1 -1
- package/lib/locale/th.cjs +1 -1
- package/lib/locale/uk.cjs +1 -1
- package/lib/locale/vi.cjs +1 -1
- package/lib/locale/zh-CN.cjs +1 -1
- package/lib/locale/zh-TW.cjs +1 -1
- package/package.json +35 -29
- package/style/base.css +1 -1
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +2 -2
- package/types/affix/index.d.cts +1 -1
- package/types/affix/index.d.ts +1 -1
- package/types/alert/index.d.cts +2 -1
- package/types/alert/index.d.ts +2 -1
- package/types/anchor/anchor-link.d.cts +1 -1
- package/types/anchor/anchor-link.d.ts +1 -1
- package/types/anchor/anchor.d.cts +1 -1
- package/types/anchor/anchor.d.ts +1 -1
- package/types/auto-complete/index.d.cts +1 -2
- package/types/auto-complete/index.d.ts +1 -2
- package/types/avatar/avatar-group.d.cts +1 -1
- package/types/avatar/avatar-group.d.ts +1 -1
- package/types/avatar/avatar.d.cts +1 -1
- package/types/avatar/avatar.d.ts +1 -1
- package/types/back-top/index.d.cts +1 -1
- package/types/back-top/index.d.ts +1 -1
- package/types/badge/index.d.cts +1 -1
- package/types/badge/index.d.ts +1 -1
- package/types/base/transition.d.cts +1 -0
- package/types/base/transition.d.ts +1 -0
- package/types/breadcrumb/breadcrumb-item.d.cts +1 -1
- package/types/breadcrumb/breadcrumb-item.d.ts +1 -1
- package/types/breadcrumb/breadcrumb.d.cts +1 -1
- package/types/breadcrumb/breadcrumb.d.ts +1 -1
- package/types/button/button-group.d.cts +1 -1
- package/types/button/button-group.d.ts +1 -1
- package/types/button/button.d.cts +1 -1
- package/types/button/button.d.ts +1 -1
- package/types/calendar/index.d.cts +1 -1
- package/types/calendar/index.d.ts +1 -1
- package/types/card/index.d.cts +2 -2
- package/types/card/index.d.ts +2 -2
- package/types/carousel/carousel-item.d.cts +1 -1
- package/types/carousel/carousel-item.d.ts +1 -1
- package/types/carousel/carousel.d.cts +2 -1
- package/types/carousel/carousel.d.ts +2 -1
- package/types/carousel/drag.d.cts +19 -0
- package/types/carousel/drag.d.ts +19 -0
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/cascader/types.d.cts +1 -2
- package/types/cascader/types.d.ts +1 -2
- package/types/check-card/types.d.cts +2 -3
- package/types/check-card/types.d.ts +2 -3
- package/types/checkbox/checkbox-group.d.cts +1 -1
- package/types/checkbox/checkbox-group.d.ts +1 -1
- package/types/checkbox/checkbox.d.cts +1 -2
- package/types/checkbox/checkbox.d.ts +1 -2
- package/types/checkbox/index.d.cts +1 -1
- package/types/checkbox/index.d.ts +1 -1
- package/types/collapse/collapse-panel.d.cts +1 -1
- package/types/collapse/collapse-panel.d.ts +1 -1
- package/types/collapse/collapse.d.cts +1 -2
- package/types/collapse/collapse.d.ts +1 -2
- package/types/color-picker/alpha.d.cts +2 -1
- package/types/color-picker/alpha.d.ts +2 -1
- package/types/color-picker/hue.d.cts +2 -1
- package/types/color-picker/hue.d.ts +2 -1
- package/types/color-picker/index.d.cts +3 -4
- package/types/color-picker/index.d.ts +3 -4
- package/types/color-picker/paint.d.cts +2 -1
- package/types/color-picker/paint.d.ts +2 -1
- package/types/components.d.cts +17 -13
- package/types/components.d.ts +17 -13
- package/types/date-picker/index.d.cts +3 -4
- package/types/date-picker/index.d.ts +3 -4
- package/types/descriptions/descriptions.d.cts +1 -1
- package/types/descriptions/descriptions.d.ts +1 -1
- package/types/divider/index.d.cts +1 -1
- package/types/divider/index.d.ts +1 -1
- package/types/drawer/index.d.cts +0 -1
- package/types/drawer/index.d.ts +0 -1
- package/types/dropdown/dropdown-button.d.cts +1 -1
- package/types/dropdown/dropdown-button.d.ts +1 -1
- package/types/dropdown/dropdown.d.cts +1 -2
- package/types/dropdown/dropdown.d.ts +1 -2
- package/types/empty/index.d.cts +1 -1
- package/types/empty/index.d.ts +1 -1
- package/types/feature-card/index.d.cts +1 -1
- package/types/feature-card/index.d.ts +1 -1
- package/types/feedback-panel/index.d.cts +1 -1
- package/types/feedback-panel/index.d.ts +1 -1
- package/types/flex/index.d.cts +1 -1
- package/types/flex/index.d.ts +1 -1
- package/types/form/form.d.cts +1 -1
- package/types/form/form.d.ts +1 -1
- package/types/grid/grid-item.d.cts +1 -1
- package/types/grid/grid-item.d.ts +1 -1
- package/types/grid/grid.d.cts +1 -1
- package/types/grid/grid.d.ts +1 -1
- package/types/icon/index.d.cts +1 -1
- package/types/icon/index.d.ts +1 -1
- package/types/image/group.d.cts +1 -1
- package/types/image/group.d.ts +1 -1
- package/types/image/image.d.cts +1 -1
- package/types/image/image.d.ts +1 -1
- package/types/input/index.d.cts +1 -1
- package/types/input/index.d.ts +1 -1
- package/types/input/input-base.d.cts +31 -0
- package/types/input/input-base.d.ts +31 -0
- package/types/input/input-box.d.cts +1 -1
- package/types/input/input-box.d.ts +1 -1
- package/types/input/input-group.d.cts +1 -1
- package/types/input/input-group.d.ts +1 -1
- package/types/input/input.d.cts +2 -25
- package/types/input/input.d.ts +2 -25
- package/types/input/textarea.d.cts +1 -1
- package/types/input/textarea.d.ts +1 -1
- package/types/input-number/index.d.cts +1 -1
- package/types/input-number/index.d.ts +1 -1
- package/types/input-otp/index.d.cts +1 -1
- package/types/input-otp/index.d.ts +1 -1
- package/types/input-tag/index.d.cts +1 -1
- package/types/input-tag/index.d.ts +1 -1
- package/types/kanban/index.d.cts +1 -1
- package/types/kanban/index.d.ts +1 -1
- package/types/layout/index.d.cts +2 -2
- package/types/layout/index.d.ts +2 -2
- package/types/list-panel/index.d.cts +1 -1
- package/types/list-panel/index.d.ts +1 -1
- package/types/mentions/index.d.cts +1 -1
- package/types/mentions/index.d.ts +1 -1
- package/types/menu/menu.d.cts +1 -2
- package/types/menu/menu.d.ts +1 -2
- package/types/modal/modal.d.cts +1 -2
- package/types/modal/modal.d.ts +1 -2
- package/types/page/index.d.cts +2 -1
- package/types/page/index.d.ts +2 -1
- package/types/page/responsive.d.cts +1 -0
- package/types/page/responsive.d.ts +1 -0
- package/types/page-header/index.d.cts +1 -1
- package/types/page-header/index.d.ts +1 -1
- package/types/popconfirm/index.d.cts +1 -2
- package/types/popconfirm/index.d.ts +1 -2
- package/types/poptip/index.d.cts +1 -2
- package/types/poptip/index.d.ts +1 -2
- package/types/popup/index.d.cts +48 -0
- package/types/popup/index.d.ts +48 -0
- package/types/popup/layers.d.cts +9 -0
- package/types/popup/layers.d.ts +9 -0
- package/types/popup/types.d.cts +15 -0
- package/types/popup/types.d.ts +15 -0
- package/types/progress/index.d.cts +1 -1
- package/types/progress/index.d.ts +1 -1
- package/types/qrcode/index.d.cts +1 -1
- package/types/qrcode/index.d.ts +1 -1
- package/types/radio/index.d.cts +1 -0
- package/types/radio/index.d.ts +1 -0
- package/types/radio/radio-button.d.cts +1 -2
- package/types/radio/radio-button.d.ts +1 -2
- package/types/radio/radio-group.d.cts +1 -1
- package/types/radio/radio-group.d.ts +1 -1
- package/types/radio/radio.d.cts +1 -2
- package/types/radio/radio.d.ts +1 -2
- package/types/rate/index.d.cts +1 -1
- package/types/rate/index.d.ts +1 -1
- package/types/result/index.d.cts +1 -1
- package/types/result/index.d.ts +1 -1
- package/types/row-col/col.d.cts +1 -1
- package/types/row-col/col.d.ts +1 -1
- package/types/row-col/row.d.cts +1 -1
- package/types/row-col/row.d.ts +1 -1
- package/types/segmented/index.d.cts +1 -1
- package/types/segmented/index.d.ts +1 -1
- package/types/select/index.d.cts +2 -2
- package/types/select/index.d.ts +2 -2
- package/types/select/option.d.cts +1 -1
- package/types/select/option.d.ts +1 -1
- package/types/select/select.d.cts +1 -2
- package/types/select/select.d.ts +1 -2
- package/types/skeleton/skeleton-avatar.d.cts +1 -1
- package/types/skeleton/skeleton-avatar.d.ts +1 -1
- package/types/skeleton/skeleton-button.d.cts +1 -1
- package/types/skeleton/skeleton-button.d.ts +1 -1
- package/types/skeleton/skeleton-image.d.cts +1 -1
- package/types/skeleton/skeleton-image.d.ts +1 -1
- package/types/skeleton/skeleton-text.d.cts +1 -1
- package/types/skeleton/skeleton-text.d.ts +1 -1
- package/types/skeleton/skeleton.d.cts +1 -1
- package/types/skeleton/skeleton.d.ts +1 -1
- package/types/slider/index.d.cts +1 -1
- package/types/slider/index.d.ts +1 -1
- package/types/space/index.d.cts +1 -1
- package/types/space/index.d.ts +1 -1
- package/types/spin/index.d.cts +1 -1
- package/types/spin/index.d.ts +1 -1
- package/types/splitter/splitter-panel.d.cts +1 -1
- package/types/splitter/splitter-panel.d.ts +1 -1
- package/types/splitter/splitter.d.cts +1 -1
- package/types/splitter/splitter.d.ts +1 -1
- package/types/stat-card/countup.d.cts +1 -1
- package/types/stat-card/countup.d.ts +1 -1
- package/types/stat-card/rollup.d.cts +3 -2
- package/types/stat-card/rollup.d.ts +3 -2
- package/types/stat-card/stat-card.d.cts +1 -1
- package/types/stat-card/stat-card.d.ts +1 -1
- package/types/stat-card/stat-number.d.cts +1 -1
- package/types/stat-card/stat-number.d.ts +1 -1
- package/types/stat-card/utils/countup.d.cts +1 -1
- package/types/stat-card/utils/countup.d.ts +1 -1
- package/types/stat-card/utils/odometer.d.cts +7 -4
- package/types/stat-card/utils/odometer.d.ts +7 -4
- package/types/steps/index.d.cts +1 -1
- package/types/steps/index.d.ts +1 -1
- package/types/switch/index.d.cts +1 -2
- package/types/switch/index.d.ts +1 -2
- package/types/table/index.d.cts +1 -1
- package/types/table/index.d.ts +1 -1
- package/types/table/types.d.cts +2 -4
- package/types/table/types.d.ts +2 -4
- package/types/tabs/index.d.cts +1 -0
- package/types/tabs/index.d.ts +1 -0
- package/types/tabs/tab-panel.d.cts +1 -1
- package/types/tabs/tab-panel.d.ts +1 -1
- package/types/tabs/tabs.d.cts +1 -1
- package/types/tabs/tabs.d.ts +1 -1
- package/types/tag/index.d.cts +2 -1
- package/types/tag/index.d.ts +2 -1
- package/types/time-line/timeline-item.d.cts +1 -1
- package/types/time-line/timeline-item.d.ts +1 -1
- package/types/time-line/timeline.d.cts +1 -1
- package/types/time-line/timeline.d.ts +1 -1
- package/types/tooltip/index.d.cts +2 -2
- package/types/tooltip/index.d.ts +2 -2
- package/types/tour/index.d.cts +0 -2
- package/types/tour/index.d.ts +0 -2
- package/types/transfer/index.d.cts +2 -3
- package/types/transfer/index.d.ts +2 -3
- package/types/tree/index.d.cts +2 -4
- package/types/tree/index.d.ts +2 -4
- package/types/tree-select/index.d.cts +2 -3
- package/types/tree-select/index.d.ts +2 -3
- package/types/typography/index.d.cts +1 -1
- package/types/typography/index.d.ts +1 -1
- package/types/upload/index.d.cts +1 -2
- package/types/upload/index.d.ts +1 -2
- package/types/upload/selector.d.cts +1 -1
- package/types/upload/selector.d.ts +1 -1
- package/types/utils/popup.d.cts +11 -0
- package/types/utils/popup.d.ts +11 -0
- package/types/utils/selection-tags.d.cts +19 -0
- package/types/utils/selection-tags.d.ts +19 -0
- package/types/virtual-list/index.d.cts +1 -1
- package/types/virtual-list/index.d.ts +1 -1
- package/types/watermark/index.d.cts +1 -1
- package/types/watermark/index.d.ts +1 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* react-kui v3.1.1
|
|
3
|
+
* Copyright 2017-present, kui-react.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Homepage: https://react.k-ui.cn
|
|
6
|
+
* Author: Qiu / https://chuchur.com
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
//#region components/carousel/drag.ts
|
|
10
|
+
var swipeThreshold = 5;
|
|
11
|
+
var shortSwipeMs = 300;
|
|
12
|
+
var longSwipeRatio = .5;
|
|
13
|
+
var flickVelocity = .5;
|
|
14
|
+
function bindCarouselDrag(root, callbacks) {
|
|
15
|
+
let gesture;
|
|
16
|
+
let suppressClickUntil = 0;
|
|
17
|
+
const view = root.ownerDocument.defaultView;
|
|
18
|
+
const changed = (active, options) => active.options.vertical !== options.vertical || active.options.size !== options.size || active.options.count !== options.count || active.options.index !== options.index || active.options.loop !== options.loop || !options.swipeable;
|
|
19
|
+
const finish = (cancel = false) => {
|
|
20
|
+
const active = gesture;
|
|
21
|
+
if (!active) return;
|
|
22
|
+
gesture = void 0;
|
|
23
|
+
const options = callbacks.options();
|
|
24
|
+
const distance = Math.abs(active.delta);
|
|
25
|
+
const now = performance.now();
|
|
26
|
+
const velocity = active.velocity * Math.max(0, 1 - (now - active.time) / 140);
|
|
27
|
+
const shortSwipe = now - active.started <= shortSwipeMs;
|
|
28
|
+
const progress = distance / options.size;
|
|
29
|
+
const flick = Math.sign(velocity) === Math.sign(active.delta) && Math.abs(velocity) >= flickVelocity;
|
|
30
|
+
const step = !cancel && !changed(active, options) && active.axis && distance >= swipeThreshold && (shortSwipe || flick || progress >= longSwipeRatio) ? active.delta < 0 ? 1 : -1 : 0;
|
|
31
|
+
if (active.axis) suppressClickUntil = Date.now() + 400;
|
|
32
|
+
const atEdge = !options.loop && (options.index + step < 0 || options.index + step >= options.count);
|
|
33
|
+
const target = atEdge ? 0 : -step * options.size;
|
|
34
|
+
const remaining = Math.abs(target - Math.max(-options.size, Math.min(options.size, active.base + active.delta)));
|
|
35
|
+
const duration = !cancel && step && !atEdge ? Math.max(140, Math.min(280, remaining * 1.5 / Math.max(.5, Math.abs(velocity)))) : 200;
|
|
36
|
+
if (active.axis) callbacks.settle?.(duration);
|
|
37
|
+
callbacks.offset(0);
|
|
38
|
+
callbacks.finish(step);
|
|
39
|
+
if (root.hasPointerCapture?.(active.id)) root.releasePointerCapture(active.id);
|
|
40
|
+
};
|
|
41
|
+
const down = (event) => {
|
|
42
|
+
if (gesture) {
|
|
43
|
+
if (event.pointerId !== gesture.id) finish(true);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const options = callbacks.options();
|
|
47
|
+
const target = event.target;
|
|
48
|
+
if (target !== root && !target.closest?.(".k-carousel-wrapper") || target.closest(".k-carousel") !== root || target.closest("input, textarea, select, button, [contenteditable]:not([contenteditable=false])") || options.count < 2 || options.size <= 0 || event.isPrimary === false || event.button !== 0 || !options.swipeable) return;
|
|
49
|
+
suppressClickUntil = 0;
|
|
50
|
+
const now = performance.now();
|
|
51
|
+
gesture = {
|
|
52
|
+
id: event.pointerId,
|
|
53
|
+
x: event.clientX,
|
|
54
|
+
y: event.clientY,
|
|
55
|
+
axis: false,
|
|
56
|
+
delta: 0,
|
|
57
|
+
base: 0,
|
|
58
|
+
last: 0,
|
|
59
|
+
time: now,
|
|
60
|
+
velocity: 0,
|
|
61
|
+
started: now,
|
|
62
|
+
samples: [{
|
|
63
|
+
time: now,
|
|
64
|
+
delta: 0
|
|
65
|
+
}],
|
|
66
|
+
options: { ...options }
|
|
67
|
+
};
|
|
68
|
+
gesture.base = callbacks.start() ?? 0;
|
|
69
|
+
callbacks.offset(gesture.base);
|
|
70
|
+
};
|
|
71
|
+
const move = (event) => {
|
|
72
|
+
if (!gesture || event.pointerId !== gesture.id) return;
|
|
73
|
+
const options = callbacks.options();
|
|
74
|
+
if (changed(gesture, options)) {
|
|
75
|
+
finish(true);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const dx = event.clientX - gesture.x;
|
|
79
|
+
const dy = event.clientY - gesture.y;
|
|
80
|
+
const delta = options.vertical ? dy : dx;
|
|
81
|
+
const cross = options.vertical ? dx : dy;
|
|
82
|
+
if (!gesture.axis) {
|
|
83
|
+
if (Math.max(Math.abs(delta), Math.abs(cross)) < swipeThreshold) return;
|
|
84
|
+
if (Math.abs(cross) > Math.abs(delta)) {
|
|
85
|
+
finish(true);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
gesture.axis = true;
|
|
89
|
+
if (event.type === "pointermove") root.setPointerCapture?.(event.pointerId);
|
|
90
|
+
}
|
|
91
|
+
if (event.cancelable) event.preventDefault();
|
|
92
|
+
const now = performance.now();
|
|
93
|
+
if (delta !== gesture.last) {
|
|
94
|
+
gesture.samples.push({
|
|
95
|
+
time: now,
|
|
96
|
+
delta
|
|
97
|
+
});
|
|
98
|
+
while (gesture.samples.length > 2 && gesture.samples[0].time < now - 80) gesture.samples.shift();
|
|
99
|
+
const sample = gesture.samples[0];
|
|
100
|
+
gesture.velocity = (delta - sample.delta) / Math.max(1, now - sample.time);
|
|
101
|
+
gesture.time = now;
|
|
102
|
+
}
|
|
103
|
+
gesture.last = delta;
|
|
104
|
+
gesture.delta = delta;
|
|
105
|
+
const atEdge = !options.loop && (options.index === 0 && delta > 0 || options.index === options.count - 1 && delta < 0);
|
|
106
|
+
callbacks.offset(gesture.base + Math.max(-options.size, Math.min(options.size, delta * (atEdge ? .3 : 1))));
|
|
107
|
+
};
|
|
108
|
+
const up = (event) => {
|
|
109
|
+
if (event.type === "lostpointercapture" && event.target !== root) return;
|
|
110
|
+
if (event.type === "pointerup" && gesture?.id === event.pointerId && (event.clientX !== gesture.x + (gesture.options.vertical ? 0 : gesture.last) || event.clientY !== gesture.y + (gesture.options.vertical ? gesture.last : 0))) move(event);
|
|
111
|
+
if (gesture?.id === event.pointerId) finish(event.type !== "pointerup");
|
|
112
|
+
};
|
|
113
|
+
const blur = () => finish(true);
|
|
114
|
+
const click = (event) => {
|
|
115
|
+
if (Date.now() < suppressClickUntil && event.detail !== 0) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
event.stopPropagation();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const nativeDrag = (event) => {
|
|
121
|
+
if (gesture) event.preventDefault();
|
|
122
|
+
};
|
|
123
|
+
root.addEventListener("pointerdown", down);
|
|
124
|
+
root.addEventListener("click", click, true);
|
|
125
|
+
root.addEventListener("dragstart", nativeDrag);
|
|
126
|
+
root.addEventListener("lostpointercapture", up);
|
|
127
|
+
view.addEventListener("pointermove", move, { passive: false });
|
|
128
|
+
view.addEventListener("pointerup", up);
|
|
129
|
+
view.addEventListener("pointercancel", up);
|
|
130
|
+
view.addEventListener("blur", blur);
|
|
131
|
+
return () => {
|
|
132
|
+
const active = gesture;
|
|
133
|
+
gesture = void 0;
|
|
134
|
+
if (active && root.hasPointerCapture?.(active.id)) root.releasePointerCapture(active.id);
|
|
135
|
+
root.removeEventListener("pointerdown", down);
|
|
136
|
+
root.removeEventListener("click", click, true);
|
|
137
|
+
root.removeEventListener("dragstart", nativeDrag);
|
|
138
|
+
root.removeEventListener("lostpointercapture", up);
|
|
139
|
+
view.removeEventListener("pointermove", move);
|
|
140
|
+
view.removeEventListener("pointerup", up);
|
|
141
|
+
view.removeEventListener("pointercancel", up);
|
|
142
|
+
view.removeEventListener("blur", blur);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function retargetCarousel(root, vertical, size, count, next, step) {
|
|
146
|
+
const track = root.querySelector(".k-carousel-wrapper");
|
|
147
|
+
if (!track || !size) return next + 1;
|
|
148
|
+
const visible = ((-readCarouselOffset(root, vertical, 0, size) / size - 1) % count + count) % count + 1;
|
|
149
|
+
let target = next + 1;
|
|
150
|
+
if (step > 0 && target < visible) target += count;
|
|
151
|
+
if (step < 0 && target > visible) target -= count;
|
|
152
|
+
const duration = track.style.transitionDuration;
|
|
153
|
+
track.style.transitionDuration = "0s";
|
|
154
|
+
track.style.transform = vertical ? `translate3d(0, ${-visible * size}px, 0)` : `translate3d(${-visible * size}px, 0, 0)`;
|
|
155
|
+
track.getBoundingClientRect();
|
|
156
|
+
track.style.transitionDuration = duration;
|
|
157
|
+
track.style.transform = vertical ? `translate3d(0, ${-target * size}px, 0)` : `translate3d(${-target * size}px, 0, 0)`;
|
|
158
|
+
return target;
|
|
159
|
+
}
|
|
160
|
+
function readCarouselOffset(root, vertical, position, size) {
|
|
161
|
+
const track = root.querySelector(".k-carousel-wrapper");
|
|
162
|
+
if (!track) return 0;
|
|
163
|
+
const transform = root.ownerDocument.defaultView.getComputedStyle(track).transform;
|
|
164
|
+
const values = transform.slice(transform.indexOf("(") + 1, -1).split(",").map(parseFloat);
|
|
165
|
+
const offset = transform.startsWith("matrix3d") ? values[vertical ? 13 : 12] : transform.startsWith("matrix") ? values[vertical ? 5 : 4] : transform.startsWith("translate3d") ? values[vertical ? 1 : 0] : void 0;
|
|
166
|
+
return Number.isFinite(offset) ? offset + position * size : 0;
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { bindCarouselDrag, readCarouselOffset, retargetCarousel };
|
package/es/cascader/index.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.1.1
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import Popup from "../popup/index.js";
|
|
9
10
|
import { useConfigAppearance } from "../config/use-config-appearance.js";
|
|
10
11
|
import { ChevronDown, ChevronRight, CircleAlert, CircleX, Loading } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
11
12
|
import Icon from "../icon/index.js";
|
|
12
13
|
import { useValue } from "../utils/use-value.js";
|
|
13
14
|
import Empty from "../empty/index.js";
|
|
14
15
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
15
|
-
import Teleport from "../base/teleport.js";
|
|
16
|
-
import { Transition } from "../base/transition.js";
|
|
17
|
-
import { setPlacement } from "../utils/placement.js";
|
|
18
16
|
import clsx from "clsx";
|
|
19
17
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
18
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -31,7 +29,7 @@ var pathFromValue = (options, value, getChildren) => {
|
|
|
31
29
|
}
|
|
32
30
|
return path;
|
|
33
31
|
};
|
|
34
|
-
function Cascader({ value, open: openProp,
|
|
32
|
+
function Cascader({ value, open: openProp, options: optionsProp, theme: themeProp, bordered = true, shape: shapeProp, showArrow = true, placeholder = "请选择", icon, arrowIcon = ChevronDown, emptyText, loadData, disabled, readOnly, clearable = true, size: sizeProp, expandTrigger = "click", showAllLevels = true, separator = " / ", placement = "bottom-left", onChange, onExpandChange, onOpenChange, className, style, onClick, onKeyDown, ...rest }) {
|
|
35
33
|
const inheritedAppearance = useConfigAppearance();
|
|
36
34
|
const theme = themeProp ?? inheritedAppearance.theme ?? "fill";
|
|
37
35
|
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
@@ -69,22 +67,11 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
69
67
|
selectionKey
|
|
70
68
|
});
|
|
71
69
|
};
|
|
72
|
-
const [innerOpen, setInnerOpen] =
|
|
70
|
+
const [innerOpen, setInnerOpen] = useValue(openProp, (next_0) => next_0 ?? false);
|
|
73
71
|
const [activeColumn, setActiveColumn] = useState(0);
|
|
74
|
-
const visible =
|
|
75
|
-
const [rendered, setRendered] = useState(visible);
|
|
76
|
-
const [position, setPosition] = useState({
|
|
77
|
-
left: 0,
|
|
78
|
-
top: 0,
|
|
79
|
-
minWidth: 0,
|
|
80
|
-
origin: "top"
|
|
81
|
-
});
|
|
72
|
+
const visible = innerOpen;
|
|
82
73
|
const selectionRef = useRef(null);
|
|
83
74
|
const overlayRef = useRef(null);
|
|
84
|
-
const currentPlacementRef = useRef(placement);
|
|
85
|
-
const topRef = useRef(0);
|
|
86
|
-
const leftRef = useRef(0);
|
|
87
|
-
const originRef = useRef("top");
|
|
88
75
|
useEffect(() => {
|
|
89
76
|
mountedRef.current = true;
|
|
90
77
|
return () => {
|
|
@@ -106,87 +93,35 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
106
93
|
]);
|
|
107
94
|
const displayLabel = selectedPath.map((item_0) => item_0.label).filter(Boolean).join(showAllLevels ? separator : "") || "";
|
|
108
95
|
const shownLabel = showAllLevels ? displayLabel : selectedPath.at(-1)?.label ?? "";
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
refSelection: selectionRef,
|
|
115
|
-
refPopper: overlayRef,
|
|
116
|
-
currentPlacement: currentPlacementRef,
|
|
117
|
-
transOrigin: originRef,
|
|
118
|
-
top: topRef,
|
|
119
|
-
left: leftRef
|
|
120
|
-
});
|
|
121
|
-
setPosition({
|
|
122
|
-
left: leftRef.current,
|
|
123
|
-
top: topRef.current,
|
|
124
|
-
minWidth: selection.offsetWidth,
|
|
125
|
-
origin: originRef.current
|
|
126
|
-
});
|
|
127
|
-
}, [placement]);
|
|
128
|
-
const setOpen = useCallback((next_0) => {
|
|
129
|
-
if (disabled || readOnly || next_0 === visible) return;
|
|
130
|
-
if (next_0) {
|
|
131
|
-
setRendered(true);
|
|
132
|
-
setActiveColumn(0);
|
|
133
|
-
}
|
|
134
|
-
if (openProp === void 0) setInnerOpen(next_0);
|
|
135
|
-
onOpenChange?.(next_0);
|
|
96
|
+
const setOpen = useCallback((next_1) => {
|
|
97
|
+
if (next_1 && (disabled || readOnly) || next_1 === visible) return;
|
|
98
|
+
if (next_1) setActiveColumn(0);
|
|
99
|
+
setInnerOpen(next_1);
|
|
100
|
+
onOpenChange?.(next_1);
|
|
136
101
|
}, [
|
|
137
102
|
disabled,
|
|
138
103
|
onOpenChange,
|
|
139
|
-
|
|
104
|
+
setInnerOpen,
|
|
140
105
|
readOnly,
|
|
141
106
|
visible
|
|
142
107
|
]);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
const outside = (event) => {
|
|
147
|
-
const target = event.target;
|
|
148
|
-
if (!selectionRef.current?.contains(target) && !overlayRef.current?.contains(target)) setOpen(false);
|
|
149
|
-
};
|
|
150
|
-
document.addEventListener("mousedown", outside);
|
|
151
|
-
window.addEventListener("resize", updatePosition);
|
|
152
|
-
window.addEventListener("scroll", updatePosition, true);
|
|
153
|
-
return () => {
|
|
154
|
-
document.removeEventListener("mousedown", outside);
|
|
155
|
-
window.removeEventListener("resize", updatePosition);
|
|
156
|
-
window.removeEventListener("scroll", updatePosition, true);
|
|
157
|
-
};
|
|
158
|
-
}, [
|
|
159
|
-
setOpen,
|
|
160
|
-
updatePosition,
|
|
161
|
-
visible
|
|
162
|
-
]);
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
if (visible) requestAnimationFrame(updatePosition);
|
|
165
|
-
}, [
|
|
166
|
-
activePath,
|
|
167
|
-
updatePosition,
|
|
168
|
-
visible
|
|
169
|
-
]);
|
|
170
|
-
const commit = (next_1) => {
|
|
171
|
-
setInnerValue(next_1);
|
|
172
|
-
onChange?.(next_1);
|
|
108
|
+
const commit = (next_2) => {
|
|
109
|
+
setInnerValue(next_2);
|
|
110
|
+
onChange?.(next_2);
|
|
173
111
|
};
|
|
174
112
|
const loadOption = async (option_2, path_0) => {
|
|
175
113
|
if (!loadData || loadingRef.current.has(option_2)) return getOptionChildren(option_2);
|
|
176
114
|
loadingRef.current.add(option_2);
|
|
177
115
|
setLoadingOptions(new Set(loadingRef.current));
|
|
178
116
|
setFailedOptions((current) => {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
return
|
|
117
|
+
const next_3 = new Set(current);
|
|
118
|
+
next_3.delete(option_2);
|
|
119
|
+
return next_3;
|
|
182
120
|
});
|
|
183
121
|
try {
|
|
184
122
|
const result_0 = await loadData(option_2, path_0);
|
|
185
123
|
const children_0 = Array.isArray(result_0) ? result_0 : option_2.children ?? [];
|
|
186
|
-
if (mountedRef.current)
|
|
187
|
-
setLoadedChildren((current_1) => new Map(current_1).set(option_2, children_0));
|
|
188
|
-
requestAnimationFrame(updatePosition);
|
|
189
|
-
}
|
|
124
|
+
if (mountedRef.current) setLoadedChildren((current_1) => new Map(current_1).set(option_2, children_0));
|
|
190
125
|
return children_0;
|
|
191
126
|
} catch {
|
|
192
127
|
if (mountedRef.current) setFailedOptions((current_0) => new Set(current_0).add(option_2));
|
|
@@ -197,7 +132,7 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
197
132
|
}
|
|
198
133
|
};
|
|
199
134
|
const choose = (option_3, column, hover = false) => {
|
|
200
|
-
if (readOnly || option_3.disabled) return;
|
|
135
|
+
if (disabled || readOnly || option_3.disabled) return;
|
|
201
136
|
const nextPath = [...activePath.slice(0, column), option_3];
|
|
202
137
|
setActivePath(nextPath);
|
|
203
138
|
const children_1 = getOptionChildren(option_3);
|
|
@@ -209,19 +144,19 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
209
144
|
setOpen(false);
|
|
210
145
|
} else if (!children_1.length) loadOption(option_3, nextPath);
|
|
211
146
|
};
|
|
212
|
-
const clear = (
|
|
213
|
-
if (readOnly) return;
|
|
214
|
-
|
|
147
|
+
const clear = (event) => {
|
|
148
|
+
if (disabled || readOnly) return;
|
|
149
|
+
event.stopPropagation();
|
|
215
150
|
setActivePath([]);
|
|
216
151
|
setActiveColumn(0);
|
|
217
152
|
commit([]);
|
|
218
153
|
};
|
|
219
|
-
const keyboard = (
|
|
220
|
-
onKeyDown?.(
|
|
221
|
-
if (
|
|
222
|
-
if (
|
|
154
|
+
const keyboard = (event_0) => {
|
|
155
|
+
onKeyDown?.(event_0);
|
|
156
|
+
if (event_0.defaultPrevented || disabled || readOnly) return;
|
|
157
|
+
if (event_0.key === "Escape") {
|
|
223
158
|
if (visible) {
|
|
224
|
-
|
|
159
|
+
event_0.preventDefault();
|
|
225
160
|
setOpen(false);
|
|
226
161
|
}
|
|
227
162
|
return;
|
|
@@ -231,8 +166,8 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
231
166
|
" ",
|
|
232
167
|
"ArrowDown",
|
|
233
168
|
"ArrowUp"
|
|
234
|
-
].includes(
|
|
235
|
-
|
|
169
|
+
].includes(event_0.key)) {
|
|
170
|
+
event_0.preventDefault();
|
|
236
171
|
const first = selectedPath.length ? selectedPath : options.filter((item_3) => !item_3.disabled).slice(0, 1);
|
|
237
172
|
setActivePath(first);
|
|
238
173
|
setOpen(true);
|
|
@@ -248,26 +183,26 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
248
183
|
"ArrowUp",
|
|
249
184
|
"Home",
|
|
250
185
|
"End"
|
|
251
|
-
].includes(
|
|
252
|
-
|
|
186
|
+
].includes(event_0.key)) {
|
|
187
|
+
event_0.preventDefault();
|
|
253
188
|
let nextIndex;
|
|
254
|
-
if (
|
|
255
|
-
else if (
|
|
256
|
-
else if (
|
|
189
|
+
if (event_0.key === "Home") nextIndex = 0;
|
|
190
|
+
else if (event_0.key === "End") nextIndex = enabled.length - 1;
|
|
191
|
+
else if (event_0.key === "ArrowDown") nextIndex = (currentIndex + 1) % enabled.length;
|
|
257
192
|
else nextIndex = currentIndex <= 0 ? enabled.length - 1 : currentIndex - 1;
|
|
258
193
|
setActivePath([...activePath.slice(0, column_0), enabled[nextIndex]]);
|
|
259
194
|
if (enabled[nextIndex].children?.length) onExpandChange?.([...activePath.slice(0, column_0), enabled[nextIndex]].map((item_6) => item_6.value));
|
|
260
|
-
} else if (
|
|
261
|
-
|
|
195
|
+
} else if (event_0.key === "ArrowLeft" && activePath.length > 1) {
|
|
196
|
+
event_0.preventDefault();
|
|
262
197
|
const nextPath_0 = activePath.slice(0, column_0);
|
|
263
198
|
setActiveColumn(Math.max(0, column_0 - 1));
|
|
264
199
|
setActivePath(nextPath_0);
|
|
265
200
|
onExpandChange?.(nextPath_0.map((item_7) => item_7.value));
|
|
266
|
-
} else if (
|
|
201
|
+
} else if (event_0.key === "ArrowRight") {
|
|
267
202
|
const option_4 = activePath[column_0];
|
|
268
203
|
const children_2 = option_4 ? getOptionChildren(option_4) : [];
|
|
269
204
|
if (option_4 && !children_2.length && isExpandable(option_4)) {
|
|
270
|
-
|
|
205
|
+
event_0.preventDefault();
|
|
271
206
|
loadOption(option_4, activePath.slice(0, column_0 + 1)).then((items) => {
|
|
272
207
|
const first_0 = items.find((item_8) => !item_8.disabled);
|
|
273
208
|
if (first_0) {
|
|
@@ -279,12 +214,12 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
279
214
|
}
|
|
280
215
|
const first_1 = children_2.find((item_9) => !item_9.disabled);
|
|
281
216
|
if (first_1) {
|
|
282
|
-
|
|
217
|
+
event_0.preventDefault();
|
|
283
218
|
setActivePath([...activePath.slice(0, column_0 + 1), first_1]);
|
|
284
219
|
setActiveColumn(column_0 + 1);
|
|
285
220
|
}
|
|
286
|
-
} else if (
|
|
287
|
-
|
|
221
|
+
} else if (event_0.key === "Enter" || event_0.key === " ") {
|
|
222
|
+
event_0.preventDefault();
|
|
288
223
|
const option_5 = activePath[column_0] ?? enabled[0];
|
|
289
224
|
const children_3 = getOptionChildren(option_5);
|
|
290
225
|
if (!children_3.length && isExpandable(option_5)) {
|
|
@@ -329,9 +264,10 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
329
264
|
"aria-readonly": readOnly || void 0,
|
|
330
265
|
tabIndex: disabled ? -1 : 0,
|
|
331
266
|
onKeyDown: keyboard,
|
|
332
|
-
onClick: (
|
|
333
|
-
|
|
334
|
-
|
|
267
|
+
onClick: (event_1) => {
|
|
268
|
+
if (disabled) return;
|
|
269
|
+
onClick?.(event_1);
|
|
270
|
+
if (!event_1.defaultPrevented) {
|
|
335
271
|
if (!visible) setActivePath(selectedPath);
|
|
336
272
|
setOpen(!visible);
|
|
337
273
|
}
|
|
@@ -362,71 +298,69 @@ function Cascader({ value, open: openProp, defaultOpen = false, options: options
|
|
|
362
298
|
role: "button",
|
|
363
299
|
tabIndex: 0,
|
|
364
300
|
"aria-label": "Clear",
|
|
365
|
-
onPointerDown: (
|
|
301
|
+
onPointerDown: (event_2) => event_2.preventDefault(),
|
|
366
302
|
onClick: clear,
|
|
367
|
-
onKeyDown: (
|
|
368
|
-
if (
|
|
303
|
+
onKeyDown: (event_3) => {
|
|
304
|
+
if (event_3.key === "Enter" || event_3.key === " ") clear(event_3);
|
|
369
305
|
}
|
|
370
306
|
})
|
|
371
307
|
]
|
|
372
|
-
}),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}) : /* @__PURE__ */ jsx(Empty, { description: emptyText })
|
|
429
|
-
})
|
|
308
|
+
}), /* @__PURE__ */ jsx(Popup, {
|
|
309
|
+
raw: true,
|
|
310
|
+
open: visible,
|
|
311
|
+
target: selectionRef,
|
|
312
|
+
trigger: "manual",
|
|
313
|
+
placement,
|
|
314
|
+
prefixCls: "k-cascader-dropdown",
|
|
315
|
+
transitionName: "k-cascader",
|
|
316
|
+
transitionDuration: 250,
|
|
317
|
+
matchTriggerWidth: true,
|
|
318
|
+
destroyOnClose: true,
|
|
319
|
+
outsideEvent: "mousedown",
|
|
320
|
+
onOpenChange: setOpen,
|
|
321
|
+
overlay: /* @__PURE__ */ jsx("div", {
|
|
322
|
+
ref: overlayRef,
|
|
323
|
+
className: clsx("k-cascader-dropdown", {
|
|
324
|
+
"k-cascader-dropdown-sm": size === "small",
|
|
325
|
+
"k-cascader-dropdown-lg": size === "large"
|
|
326
|
+
}),
|
|
327
|
+
children: options.length ? /* @__PURE__ */ jsx("div", {
|
|
328
|
+
className: "k-cascader-dropdown-menus",
|
|
329
|
+
children: menus.map((menu, column_1) => /* @__PURE__ */ jsx("ul", {
|
|
330
|
+
className: "k-cascader-dropdown-menu k-scroll",
|
|
331
|
+
role: "listbox",
|
|
332
|
+
children: menu.map((item_12) => {
|
|
333
|
+
const hasChildren = isExpandable(item_12);
|
|
334
|
+
const isLoading = loadingOptions.has(item_12);
|
|
335
|
+
const isFailed = failedOptions.has(item_12);
|
|
336
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
337
|
+
className: clsx("k-cascader-dropdown-item", {
|
|
338
|
+
"k-cascader-dropdown-item-active": activePath[column_1]?.value === item_12.value,
|
|
339
|
+
"k-cascader-dropdown-item-selected": currentValue[column_1] === item_12.value,
|
|
340
|
+
"k-cascader-dropdown-item-disabled": item_12.disabled
|
|
341
|
+
}),
|
|
342
|
+
role: "option",
|
|
343
|
+
"aria-disabled": item_12.disabled,
|
|
344
|
+
"aria-selected": currentValue[column_1] === item_12.value,
|
|
345
|
+
onClick: () => choose(item_12, column_1),
|
|
346
|
+
onMouseEnter: () => {
|
|
347
|
+
if (expandTrigger === "hover" && hasChildren) choose(item_12, column_1, true);
|
|
348
|
+
},
|
|
349
|
+
children: [/* @__PURE__ */ jsx("span", { children: item_12.label }), isLoading ? /* @__PURE__ */ jsx(Icon, {
|
|
350
|
+
className: "k-cascader-item-arrow",
|
|
351
|
+
type: Loading,
|
|
352
|
+
spin: true
|
|
353
|
+
}) : isFailed ? /* @__PURE__ */ jsx(Icon, {
|
|
354
|
+
className: "k-cascader-item-arrow",
|
|
355
|
+
type: CircleAlert
|
|
356
|
+
}) : hasChildren ? /* @__PURE__ */ jsx(Icon, {
|
|
357
|
+
className: "k-cascader-item-arrow",
|
|
358
|
+
type: ChevronRight
|
|
359
|
+
}) : null]
|
|
360
|
+
}, item_12.value);
|
|
361
|
+
})
|
|
362
|
+
}, column_1))
|
|
363
|
+
}) : /* @__PURE__ */ jsx(Empty, { description: emptyText })
|
|
430
364
|
})
|
|
431
365
|
})] });
|
|
432
366
|
}
|