@class-kit/vue 0.1.2 → 0.1.3
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/CHANGELOG.md +20 -3
- package/dist/components/affix.cjs +71 -26
- package/dist/components/affix.cjs.map +1 -1
- package/dist/components/affix.js +72 -27
- package/dist/components/affix.js.map +1 -1
- package/dist/components/backtop.cjs +72 -26
- package/dist/components/backtop.cjs.map +1 -1
- package/dist/components/backtop.js +73 -27
- package/dist/components/backtop.js.map +1 -1
- package/dist/components/badge.cjs +51 -9
- package/dist/components/badge.cjs.map +1 -1
- package/dist/components/badge.js +52 -10
- package/dist/components/badge.js.map +1 -1
- package/dist/components/barcode.cjs +60 -16
- package/dist/components/barcode.cjs.map +1 -1
- package/dist/components/barcode.js +61 -17
- package/dist/components/barcode.js.map +1 -1
- package/dist/components/breadcrumb.cjs +49 -8
- package/dist/components/breadcrumb.cjs.map +1 -1
- package/dist/components/breadcrumb.js +50 -9
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +69 -25
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.js +70 -26
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +53 -10
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +54 -11
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/canvas-editor.cjs +198 -142
- package/dist/components/canvas-editor.cjs.map +1 -1
- package/dist/components/canvas-editor.js +199 -143
- package/dist/components/canvas-editor.js.map +1 -1
- package/dist/components/canvas-image.cjs +50 -9
- package/dist/components/canvas-image.cjs.map +1 -1
- package/dist/components/canvas-image.js +51 -10
- package/dist/components/canvas-image.js.map +1 -1
- package/dist/components/chat-textarea.cjs +61 -16
- package/dist/components/chat-textarea.cjs.map +1 -1
- package/dist/components/chat-textarea.js +62 -17
- package/dist/components/chat-textarea.js.map +1 -1
- package/dist/components/chat-virtual-list.cjs +98 -50
- package/dist/components/chat-virtual-list.cjs.map +1 -1
- package/dist/components/chat-virtual-list.js +99 -51
- package/dist/components/chat-virtual-list.js.map +1 -1
- package/dist/components/checkbox.cjs +63 -19
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.js +64 -20
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/checked.cjs +63 -19
- package/dist/components/checked.cjs.map +1 -1
- package/dist/components/checked.js +64 -20
- package/dist/components/checked.js.map +1 -1
- package/dist/components/code-preview.cjs +88 -36
- package/dist/components/code-preview.cjs.map +1 -1
- package/dist/components/code-preview.js +89 -37
- package/dist/components/code-preview.js.map +1 -1
- package/dist/components/color-picker.cjs +68 -21
- package/dist/components/color-picker.cjs.map +1 -1
- package/dist/components/color-picker.js +69 -22
- package/dist/components/color-picker.js.map +1 -1
- package/dist/components/comic-reader.cjs +72 -27
- package/dist/components/comic-reader.cjs.map +1 -1
- package/dist/components/comic-reader.js +73 -28
- package/dist/components/comic-reader.js.map +1 -1
- package/dist/components/config-provider.cjs +49 -8
- package/dist/components/config-provider.cjs.map +1 -1
- package/dist/components/config-provider.js +50 -9
- package/dist/components/config-provider.js.map +1 -1
- package/dist/components/config-table.cjs +105 -53
- package/dist/components/config-table.cjs.map +1 -1
- package/dist/components/config-table.js +106 -54
- package/dist/components/config-table.js.map +1 -1
- package/dist/components/countdown.cjs +53 -9
- package/dist/components/countdown.cjs.map +1 -1
- package/dist/components/countdown.js +54 -10
- package/dist/components/countdown.js.map +1 -1
- package/dist/components/danmaku.cjs +73 -29
- package/dist/components/danmaku.cjs.map +1 -1
- package/dist/components/danmaku.js +74 -30
- package/dist/components/danmaku.js.map +1 -1
- package/dist/components/date-picker.cjs +64 -19
- package/dist/components/date-picker.cjs.map +1 -1
- package/dist/components/date-picker.js +65 -20
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.cjs +64 -19
- package/dist/components/date-range-picker.cjs.map +1 -1
- package/dist/components/date-range-picker.js +65 -20
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/design-effect.cjs +51 -9
- package/dist/components/design-effect.cjs.map +1 -1
- package/dist/components/design-effect.js +52 -10
- package/dist/components/design-effect.js.map +1 -1
- package/dist/components/drag-drop-board.cjs +189 -134
- package/dist/components/drag-drop-board.cjs.map +1 -1
- package/dist/components/drag-drop-board.js +190 -135
- package/dist/components/drag-drop-board.js.map +1 -1
- package/dist/components/draggable.cjs +91 -44
- package/dist/components/draggable.cjs.map +1 -1
- package/dist/components/draggable.js +92 -45
- package/dist/components/draggable.js.map +1 -1
- package/dist/components/ellipsis-text.cjs +57 -14
- package/dist/components/ellipsis-text.cjs.map +1 -1
- package/dist/components/ellipsis-text.js +58 -15
- package/dist/components/ellipsis-text.js.map +1 -1
- package/dist/components/empty.cjs +58 -14
- package/dist/components/empty.cjs.map +1 -1
- package/dist/components/empty.js +59 -15
- package/dist/components/empty.js.map +1 -1
- package/dist/components/field.cjs +63 -19
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.js +64 -20
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-preview.cjs +99 -36
- package/dist/components/file-preview.cjs.map +1 -1
- package/dist/components/file-preview.js +100 -37
- package/dist/components/file-preview.js.map +1 -1
- package/dist/components/floating-ball.cjs +100 -51
- package/dist/components/floating-ball.cjs.map +1 -1
- package/dist/components/floating-ball.js +101 -52
- package/dist/components/floating-ball.js.map +1 -1
- package/dist/components/form.cjs +73 -28
- package/dist/components/form.cjs.map +1 -1
- package/dist/components/form.js +74 -29
- package/dist/components/form.js.map +1 -1
- package/dist/components/gradient-text.cjs +51 -9
- package/dist/components/gradient-text.cjs.map +1 -1
- package/dist/components/gradient-text.js +52 -10
- package/dist/components/gradient-text.js.map +1 -1
- package/dist/components/height-transition.cjs +71 -26
- package/dist/components/height-transition.cjs.map +1 -1
- package/dist/components/height-transition.js +72 -27
- package/dist/components/height-transition.js.map +1 -1
- package/dist/components/input.cjs +63 -19
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.js +64 -20
- package/dist/components/input.js.map +1 -1
- package/dist/components/lazy-image.cjs +62 -21
- package/dist/components/lazy-image.cjs.map +1 -1
- package/dist/components/lazy-image.js +63 -22
- package/dist/components/lazy-image.js.map +1 -1
- package/dist/components/live-room.cjs +100 -46
- package/dist/components/live-room.cjs.map +1 -1
- package/dist/components/live-room.js +101 -47
- package/dist/components/live-room.js.map +1 -1
- package/dist/components/loading.cjs +63 -19
- package/dist/components/loading.cjs.map +1 -1
- package/dist/components/loading.js +64 -20
- package/dist/components/loading.js.map +1 -1
- package/dist/components/marquee.cjs +64 -17
- package/dist/components/marquee.cjs.map +1 -1
- package/dist/components/marquee.js +65 -18
- package/dist/components/marquee.js.map +1 -1
- package/dist/components/masonry-virtual-list.cjs +72 -25
- package/dist/components/masonry-virtual-list.cjs.map +1 -1
- package/dist/components/masonry-virtual-list.js +73 -26
- package/dist/components/masonry-virtual-list.js.map +1 -1
- package/dist/components/menu.cjs +73 -29
- package/dist/components/menu.cjs.map +1 -1
- package/dist/components/menu.js +74 -30
- package/dist/components/menu.js.map +1 -1
- package/dist/components/modal.cjs +64 -19
- package/dist/components/modal.cjs.map +1 -1
- package/dist/components/modal.js +65 -20
- package/dist/components/modal.js.map +1 -1
- package/dist/components/multi-column-picker.cjs +78 -28
- package/dist/components/multi-column-picker.cjs.map +1 -1
- package/dist/components/multi-column-picker.js +79 -29
- package/dist/components/multi-column-picker.js.map +1 -1
- package/dist/components/novel-reader.cjs +96 -54
- package/dist/components/novel-reader.cjs.map +1 -1
- package/dist/components/novel-reader.js +97 -55
- package/dist/components/novel-reader.js.map +1 -1
- package/dist/components/number-input.cjs +67 -21
- package/dist/components/number-input.cjs.map +1 -1
- package/dist/components/number-input.js +68 -22
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/orbital-sphere.cjs +69 -25
- package/dist/components/orbital-sphere.cjs.map +1 -1
- package/dist/components/orbital-sphere.js +70 -26
- package/dist/components/orbital-sphere.js.map +1 -1
- package/dist/components/pagination.cjs +49 -8
- package/dist/components/pagination.cjs.map +1 -1
- package/dist/components/pagination.js +50 -9
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/password-input.cjs +74 -33
- package/dist/components/password-input.cjs.map +1 -1
- package/dist/components/password-input.js +75 -34
- package/dist/components/password-input.js.map +1 -1
- package/dist/components/popconfirm.cjs +59 -15
- package/dist/components/popconfirm.cjs.map +1 -1
- package/dist/components/popconfirm.js +60 -16
- package/dist/components/popconfirm.js.map +1 -1
- package/dist/components/popup.cjs +68 -22
- package/dist/components/popup.cjs.map +1 -1
- package/dist/components/popup.js +69 -23
- package/dist/components/popup.js.map +1 -1
- package/dist/components/progress-bar.cjs +76 -25
- package/dist/components/progress-bar.cjs.map +1 -1
- package/dist/components/progress-bar.js +77 -26
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.cjs +52 -10
- package/dist/components/qr-code.cjs.map +1 -1
- package/dist/components/qr-code.js +53 -11
- package/dist/components/qr-code.js.map +1 -1
- package/dist/components/radio-group.cjs +63 -19
- package/dist/components/radio-group.cjs.map +1 -1
- package/dist/components/radio-group.js +64 -20
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/rating.cjs +67 -22
- package/dist/components/rating.cjs.map +1 -1
- package/dist/components/rating.js +68 -23
- package/dist/components/rating.js.map +1 -1
- package/dist/components/rolling-number.cjs +49 -8
- package/dist/components/rolling-number.cjs.map +1 -1
- package/dist/components/rolling-number.js +50 -9
- package/dist/components/rolling-number.js.map +1 -1
- package/dist/components/select.cjs +69 -24
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.js +70 -25
- package/dist/components/select.js.map +1 -1
- package/dist/components/signature.cjs +77 -28
- package/dist/components/signature.cjs.map +1 -1
- package/dist/components/signature.js +78 -29
- package/dist/components/signature.js.map +1 -1
- package/dist/components/skeleton.cjs +52 -10
- package/dist/components/skeleton.cjs.map +1 -1
- package/dist/components/skeleton.js +53 -11
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slide-captcha.cjs +74 -24
- package/dist/components/slide-captcha.cjs.map +1 -1
- package/dist/components/slide-captcha.js +75 -25
- package/dist/components/slide-captcha.js.map +1 -1
- package/dist/components/swiper.cjs +75 -21
- package/dist/components/swiper.cjs.map +1 -1
- package/dist/components/swiper.js +76 -22
- package/dist/components/swiper.js.map +1 -1
- package/dist/components/switch.cjs +63 -19
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.js +64 -20
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +105 -53
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.js +106 -54
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +91 -43
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +92 -44
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tag.cjs +51 -9
- package/dist/components/tag.cjs.map +1 -1
- package/dist/components/tag.js +52 -10
- package/dist/components/tag.js.map +1 -1
- package/dist/components/textarea.cjs +63 -19
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.js +64 -20
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme-box.cjs +132 -0
- package/dist/components/theme-box.cjs.map +1 -0
- package/dist/components/theme-box.d.ts +2 -0
- package/dist/components/theme-box.d.ts.map +1 -0
- package/dist/components/theme-box.js +130 -0
- package/dist/components/theme-box.js.map +1 -0
- package/dist/components/tilt-card.cjs +88 -41
- package/dist/components/tilt-card.cjs.map +1 -1
- package/dist/components/tilt-card.js +89 -42
- package/dist/components/tilt-card.js.map +1 -1
- package/dist/components/timeline.cjs +64 -20
- package/dist/components/timeline.cjs.map +1 -1
- package/dist/components/timeline.js +65 -21
- package/dist/components/timeline.js.map +1 -1
- package/dist/components/toast.cjs +67 -21
- package/dist/components/toast.cjs.map +1 -1
- package/dist/components/toast.js +68 -22
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.cjs +59 -15
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +60 -16
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/typewriter-text.cjs +66 -24
- package/dist/components/typewriter-text.cjs.map +1 -1
- package/dist/components/typewriter-text.js +67 -25
- package/dist/components/typewriter-text.js.map +1 -1
- package/dist/components/upload.cjs +68 -22
- package/dist/components/upload.cjs.map +1 -1
- package/dist/components/upload.js +69 -23
- package/dist/components/upload.js.map +1 -1
- package/dist/components/verification-code.cjs +119 -69
- package/dist/components/verification-code.cjs.map +1 -1
- package/dist/components/verification-code.js +120 -70
- package/dist/components/verification-code.js.map +1 -1
- package/dist/components/video-detail-transition.cjs +80 -28
- package/dist/components/video-detail-transition.cjs.map +1 -1
- package/dist/components/video-detail-transition.js +81 -29
- package/dist/components/video-detail-transition.js.map +1 -1
- package/dist/components/video-player.cjs +76 -25
- package/dist/components/video-player.cjs.map +1 -1
- package/dist/components/video-player.js +77 -26
- package/dist/components/video-player.js.map +1 -1
- package/dist/components/virtual-list.cjs +86 -37
- package/dist/components/virtual-list.cjs.map +1 -1
- package/dist/components/virtual-list.js +87 -38
- package/dist/components/virtual-list.js.map +1 -1
- package/dist/components/virtual-select.cjs +71 -25
- package/dist/components/virtual-select.cjs.map +1 -1
- package/dist/components/virtual-select.js +72 -26
- package/dist/components/virtual-select.js.map +1 -1
- package/dist/components/virtual-table.cjs +105 -53
- package/dist/components/virtual-table.cjs.map +1 -1
- package/dist/components/virtual-table.js +106 -54
- package/dist/components/virtual-table.js.map +1 -1
- package/dist/components/width-transition.cjs +163 -0
- package/dist/components/width-transition.cjs.map +1 -0
- package/dist/components/width-transition.d.ts +2 -0
- package/dist/components/width-transition.d.ts.map +1 -0
- package/dist/components/width-transition.js +161 -0
- package/dist/components/width-transition.js.map +1 -0
- package/dist/import-transform-B8NYJq5a.js +150 -0
- package/dist/import-transform-B8NYJq5a.js.map +1 -0
- package/dist/{import-transform-BFq5_6VQ.js → import-transform-D0YbYGmj.js} +4 -4
- package/dist/{import-transform-BFq5_6VQ.js.map → import-transform-D0YbYGmj.js.map} +1 -1
- package/dist/{import-transform-CvGKNZyR.js → import-transform-DgmJXsp_.js} +4 -4
- package/dist/{import-transform-CvGKNZyR.js.map → import-transform-DgmJXsp_.js.map} +1 -1
- package/dist/import-transform-DydmFGaG.js +152 -0
- package/dist/import-transform-DydmFGaG.js.map +1 -0
- package/dist/import-transform.d.ts.map +1 -1
- package/dist/index.cjs +1486 -1070
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +124 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1480 -1074
- package/dist/index.js.map +1 -1
- package/dist/styles/base.css +66 -222
- package/dist/styles/components/backtop.css +8 -14
- package/dist/styles/components/barcode.css +14 -24
- package/dist/styles/components/button.css +10 -27
- package/dist/styles/components/calendar.css +2 -2
- package/dist/styles/components/canvas-editor.css +15 -15
- package/dist/styles/components/chat-textarea.css +17 -16
- package/dist/styles/components/chat-virtual-list.css +3 -7
- package/dist/styles/components/checkbox.css +26 -33
- package/dist/styles/components/checked.css +26 -33
- package/dist/styles/components/code-preview.css +14 -24
- package/dist/styles/components/color-picker.css +25 -41
- package/dist/styles/components/comic-reader.css +5 -23
- package/dist/styles/components/config-provider.css +87 -1
- package/dist/styles/components/config-table.css +16 -45
- package/dist/styles/components/date-picker.css +32 -36
- package/dist/styles/components/date-range-picker.css +38 -40
- package/dist/styles/components/design-effect.css +24 -85
- package/dist/styles/components/draggable.css +3 -10
- package/dist/styles/components/ellipsis-text.css +6 -7
- package/dist/styles/components/empty.css +13 -27
- package/dist/styles/components/field.css +23 -30
- package/dist/styles/components/file-preview.css +10 -25
- package/dist/styles/components/form.css +23 -30
- package/dist/styles/components/gradient-text.css +2 -16
- package/dist/styles/components/input.css +23 -30
- package/dist/styles/components/live-room.css +5 -19
- package/dist/styles/components/loading.css +9 -14
- package/dist/styles/components/marquee.css +4 -0
- package/dist/styles/components/masonry-virtual-list.css +0 -1
- package/dist/styles/components/menu.css +13 -13
- package/dist/styles/components/modal.css +8 -1
- package/dist/styles/components/multi-column-picker.css +5 -3
- package/dist/styles/components/novel-reader.css +5 -28
- package/dist/styles/components/number-input.css +23 -30
- package/dist/styles/components/orbital-sphere.css +3 -3
- package/dist/styles/components/password-input.css +29 -31
- package/dist/styles/components/popup.css +8 -2
- package/dist/styles/components/qr-code.css +14 -24
- package/dist/styles/components/radio-group.css +26 -33
- package/dist/styles/components/rating.css +28 -30
- package/dist/styles/components/select.css +27 -32
- package/dist/styles/components/signature.css +26 -38
- package/dist/styles/components/skeleton.css +8 -8
- package/dist/styles/components/slide-captcha.css +15 -54
- package/dist/styles/components/swiper.css +2 -3
- package/dist/styles/components/switch.css +26 -37
- package/dist/styles/components/table.css +16 -45
- package/dist/styles/components/tag.css +3 -12
- package/dist/styles/components/textarea.css +23 -30
- package/dist/styles/components/theme-box.css +39 -0
- package/dist/styles/components/tilt-card.css +1 -5
- package/dist/styles/components/toast.css +7 -1
- package/dist/styles/components/upload.css +24 -32
- package/dist/styles/components/verification-code.css +23 -30
- package/dist/styles/components/video-detail-transition.css +20 -2
- package/dist/styles/components/video-player.css +0 -5
- package/dist/styles/components/virtual-list.css +9 -13
- package/dist/styles/components/virtual-select.css +34 -38
- package/dist/styles/components/virtual-table.css +16 -45
- package/dist/styles/components/width-transition.css +50 -0
- package/dist/styles/components.css +527 -743
- package/dist/styles/themes/business-blue.css +26 -17
- package/dist/styles/themes/cartoon-3d.css +27 -96
- package/dist/styles/themes/creative-purple.css +26 -17
- package/dist/styles/themes/dark-tech.css +31 -34
- package/dist/styles/themes/liquid-glass.css +28 -116
- package/dist/styles/themes/minimal.css +21 -17
- package/dist/styles/themes/soft-pink.css +26 -17
- package/dist/styles.css +527 -743
- package/dist/vite.cjs +2 -2
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.js +2 -2
- package/dist/vite.js.map +1 -1
- package/dist/webpack-loader.cjs +5 -4
- package/dist/webpack-loader.cjs.map +1 -1
- package/dist/webpack-loader.js +5 -4
- package/dist/webpack-loader.js.map +1 -1
- package/dist/webpack.cjs +11 -6
- package/dist/webpack.cjs.map +1 -1
- package/dist/webpack.d.ts.map +1 -1
- package/dist/webpack.js +11 -6
- package/dist/webpack.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, h, inject, shallowRef,
|
|
2
|
-
import { configureClassComponents, ToastManager, FormController, getClassComponentsLocale, PasswordInputController, ColorPickerController, DatePickerController, DateRangePickerController, ChatTextareaController, VerificationCodeController, SlideCaptchaController, VirtualSelectController, VirtualListController, RollingNumberController, CountdownController, CalendarController, TypewriterTextController, DesignEffectController, GradientTextController, LazyImageController, TiltCardController, OrbitalSphereController, HeightTransitionController, CodePreviewController, VideoPlayerController, VideoDetailTransitionController, FilePreviewController, CanvasEditorController, ProgressController, SignatureController, TimelineController, DragController, DropController, GestureController, FloatingBallController, MultiColumnPickerController, SwiperController, MasonryVirtualListController, ChatVirtualListController, BadgeController, TagController, SkeletonController, BreadcrumbController, MenuController, PaginationController, BacktopController, ModalController, PopupController, TooltipController, TabsController, TableController, UploadController, NovelReaderController, ComicReaderController, DanmakuController, LiveRoomController, AffixController, CanvasImageController, MarqueeController, getSafeTooltipPlacement } from '@class-kit/core';
|
|
3
|
-
export { AffixController, BacktopController, BadgeController, BreadcrumbController, CalendarController, CanvasEditorController, CanvasImageController, ChatVirtualListController, CodePreviewController, ColorPickerController, ComicReaderController, CountdownController, DanmakuController, DatePickerController, DateRangePickerController, DesignEffectController, DragController, DropController, FilePreviewController, FloatingBallController, FormController, GestureController, GradientTextController, HeightTransitionController, LazyImageController, LiveRoomController, MasonryVirtualListController, MenuController, ModalController, MultiColumnPickerController, NovelReaderController, OrbitalSphereController, PaginationController, PasswordInputController, PopupController, ProgressController, SignatureController, SkeletonController, SlideCaptchaController, SwiperController, TableController, TabsController, TagController, TiltCardController, TimelineController, ToastManager, TooltipController, TypewriterTextController, UploadController, VerificationCodeController, VideoDetailTransitionController, VideoPlayerController, VirtualListController, VirtualSelectController, configureClassComponents, getClassComponentsConfig, getClassComponentsLocale, resetClassComponentsConfig } from '@class-kit/core';
|
|
1
|
+
import { defineComponent, ref, watch, onBeforeUnmount, h, inject, shallowRef, onMounted, provide, computed, Teleport, nextTick } from 'vue';
|
|
2
|
+
import { configureClassComponents, ToastManager, FormController, getClassComponentsLocale, PasswordInputController, ColorPickerController, DatePickerController, DateRangePickerController, ChatTextareaController, VerificationCodeController, SlideCaptchaController, VirtualSelectController, VirtualListController, RollingNumberController, CountdownController, CalendarController, TypewriterTextController, DesignEffectController, GradientTextController, LazyImageController, TiltCardController, OrbitalSphereController, HeightTransitionController, WidthTransitionController, ThemeBoxController, CodePreviewController, VideoPlayerController, VideoDetailTransitionController, FilePreviewController, CanvasEditorController, ProgressController, SignatureController, TimelineController, DragController, DropController, GestureController, FloatingBallController, MultiColumnPickerController, SwiperController, MasonryVirtualListController, ChatVirtualListController, BadgeController, TagController, SkeletonController, BreadcrumbController, MenuController, PaginationController, BacktopController, ModalController, PopupController, TooltipController, TabsController, TableController, UploadController, NovelReaderController, ComicReaderController, DanmakuController, LiveRoomController, AffixController, CanvasImageController, MarqueeController, getSafeTooltipPlacement } from '@class-kit/core';
|
|
3
|
+
export { AffixController, BacktopController, BadgeController, BreadcrumbController, CalendarController, CanvasEditorController, CanvasImageController, ChatVirtualListController, CodePreviewController, ColorPickerController, ComicReaderController, CountdownController, DanmakuController, DatePickerController, DateRangePickerController, DesignEffectController, DragController, DropController, FilePreviewController, FloatingBallController, FormController, GestureController, GradientTextController, HeightTransitionController, LazyImageController, LiveRoomController, MasonryVirtualListController, MenuController, ModalController, MultiColumnPickerController, NovelReaderController, OrbitalSphereController, PaginationController, PasswordInputController, PopupController, ProgressController, SignatureController, SkeletonController, SlideCaptchaController, SwiperController, TableController, TabsController, TagController, ThemeBoxController, TiltCardController, TimelineController, ToastManager, TooltipController, TypewriterTextController, UploadController, VerificationCodeController, VideoDetailTransitionController, VideoPlayerController, VirtualListController, VirtualSelectController, WidthTransitionController, configureClassComponents, getClassComponentsConfig, getClassComponentsLocale, resetClassComponentsConfig } from '@class-kit/core';
|
|
4
4
|
|
|
5
5
|
const formSymbol = /*#__PURE__*/ Symbol("ClassComponentsForm");
|
|
6
6
|
const formInteractivitySymbol = /*#__PURE__*/ Symbol("ClassComponentsFormInteractivity");
|
|
@@ -22,6 +22,21 @@ const classIconPaths = {
|
|
|
22
22
|
],
|
|
23
23
|
x: ["M18 6 6 18", "M6 6l12 12"],
|
|
24
24
|
};
|
|
25
|
+
function getClassKitGlobal() {
|
|
26
|
+
if (typeof window !== "undefined") {
|
|
27
|
+
return window;
|
|
28
|
+
}
|
|
29
|
+
if (typeof self !== "undefined") {
|
|
30
|
+
return self;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
async function writeClipboardText(text) {
|
|
35
|
+
const clipboard = typeof navigator !== "undefined" ? navigator.clipboard : undefined;
|
|
36
|
+
if (clipboard && typeof clipboard.writeText === "function") {
|
|
37
|
+
await clipboard.writeText(text);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
25
40
|
function classIcon(name, className = "cc-icon") {
|
|
26
41
|
return h("svg", {
|
|
27
42
|
"aria-hidden": "true",
|
|
@@ -38,13 +53,37 @@ function classIcon(name, className = "cc-icon") {
|
|
|
38
53
|
})));
|
|
39
54
|
}
|
|
40
55
|
function resolveClassKitThemeName(theme) {
|
|
56
|
+
var _a;
|
|
41
57
|
if (typeof theme === "string")
|
|
42
58
|
return theme;
|
|
43
|
-
return theme
|
|
59
|
+
return (_a = theme === null || theme === void 0 ? void 0 : theme.name) !== null && _a !== void 0 ? _a : "minimal";
|
|
60
|
+
}
|
|
61
|
+
function applyDocumentTheme(themeName) {
|
|
62
|
+
if (typeof document === "undefined")
|
|
63
|
+
return undefined;
|
|
64
|
+
const root = document.documentElement;
|
|
65
|
+
const previousTheme = root.getAttribute("data-cc-theme");
|
|
66
|
+
const previousPage = root.getAttribute("data-cc-theme-page");
|
|
67
|
+
root.setAttribute("data-cc-theme", themeName);
|
|
68
|
+
root.setAttribute("data-cc-theme-page", "true");
|
|
69
|
+
return () => {
|
|
70
|
+
if (previousTheme === null)
|
|
71
|
+
root.removeAttribute("data-cc-theme");
|
|
72
|
+
else
|
|
73
|
+
root.setAttribute("data-cc-theme", previousTheme);
|
|
74
|
+
if (previousPage === null)
|
|
75
|
+
root.removeAttribute("data-cc-theme-page");
|
|
76
|
+
else
|
|
77
|
+
root.setAttribute("data-cc-theme-page", previousPage);
|
|
78
|
+
};
|
|
44
79
|
}
|
|
45
80
|
const ClassConfigProvider = defineComponent({
|
|
46
81
|
name: "ClassConfigProvider",
|
|
47
82
|
props: {
|
|
83
|
+
applyGlobalTheme: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: true,
|
|
86
|
+
},
|
|
48
87
|
class: {
|
|
49
88
|
type: String,
|
|
50
89
|
default: "",
|
|
@@ -64,6 +103,7 @@ const ClassConfigProvider = defineComponent({
|
|
|
64
103
|
},
|
|
65
104
|
setup(props, { slots }) {
|
|
66
105
|
const version = ref(0);
|
|
106
|
+
let restoreDocumentTheme;
|
|
67
107
|
const applyConfig = () => {
|
|
68
108
|
configureClassComponents({
|
|
69
109
|
locale: props.locale,
|
|
@@ -71,20 +111,37 @@ const ClassConfigProvider = defineComponent({
|
|
|
71
111
|
});
|
|
72
112
|
version.value += 1;
|
|
73
113
|
};
|
|
114
|
+
const applyGlobalTheme = () => {
|
|
115
|
+
restoreDocumentTheme === null || restoreDocumentTheme === void 0 ? void 0 : restoreDocumentTheme();
|
|
116
|
+
restoreDocumentTheme = props.applyGlobalTheme
|
|
117
|
+
? applyDocumentTheme(resolveClassKitThemeName(props.theme))
|
|
118
|
+
: undefined;
|
|
119
|
+
};
|
|
74
120
|
watch(() => [props.locale, props.theme], applyConfig, {
|
|
75
121
|
deep: true,
|
|
76
122
|
immediate: true,
|
|
77
123
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
124
|
+
watch(() => [props.applyGlobalTheme, props.theme], applyGlobalTheme, {
|
|
125
|
+
deep: true,
|
|
126
|
+
immediate: true,
|
|
127
|
+
});
|
|
128
|
+
onBeforeUnmount(() => {
|
|
129
|
+
restoreDocumentTheme === null || restoreDocumentTheme === void 0 ? void 0 : restoreDocumentTheme();
|
|
130
|
+
});
|
|
131
|
+
return () => {
|
|
132
|
+
var _a;
|
|
133
|
+
return h("div", {
|
|
134
|
+
class: ["cc-config-provider", props.class].filter(Boolean),
|
|
135
|
+
"data-cc-theme": resolveClassKitThemeName(props.theme),
|
|
136
|
+
style: props.style,
|
|
137
|
+
}, [
|
|
138
|
+
h("div", { key: version.value, class: "cc-config-provider__content" }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
139
|
+
]);
|
|
140
|
+
};
|
|
85
141
|
},
|
|
86
142
|
});
|
|
87
143
|
function resolveAnimation(animation, fallbackName) {
|
|
144
|
+
var _a, _b, _c, _d;
|
|
88
145
|
if (animation === false) {
|
|
89
146
|
return {
|
|
90
147
|
duration: 0,
|
|
@@ -94,10 +151,10 @@ function resolveAnimation(animation, fallbackName) {
|
|
|
94
151
|
};
|
|
95
152
|
}
|
|
96
153
|
return {
|
|
97
|
-
duration: animation
|
|
98
|
-
easing: animation
|
|
99
|
-
enabled: animation
|
|
100
|
-
name: animation
|
|
154
|
+
duration: (_a = animation === null || animation === void 0 ? void 0 : animation.duration) !== null && _a !== void 0 ? _a : 180,
|
|
155
|
+
easing: (_b = animation === null || animation === void 0 ? void 0 : animation.easing) !== null && _b !== void 0 ? _b : "cubic-bezier(0.22, 0.8, 0.28, 1)",
|
|
156
|
+
enabled: (_c = animation === null || animation === void 0 ? void 0 : animation.enabled) !== null && _c !== void 0 ? _c : true,
|
|
157
|
+
name: (_d = animation === null || animation === void 0 ? void 0 : animation.name) !== null && _d !== void 0 ? _d : fallbackName,
|
|
101
158
|
};
|
|
102
159
|
}
|
|
103
160
|
function animationStyle(animation) {
|
|
@@ -129,8 +186,9 @@ function getFocusableElements(container) {
|
|
|
129
186
|
element.getAttribute("aria-hidden") !== "true");
|
|
130
187
|
}
|
|
131
188
|
function focusInitialElement(container) {
|
|
132
|
-
|
|
133
|
-
target
|
|
189
|
+
var _a;
|
|
190
|
+
const target = (_a = getFocusableElements(container)[0]) !== null && _a !== void 0 ? _a : container;
|
|
191
|
+
target === null || target === void 0 ? void 0 : target.focus({ preventScroll: true });
|
|
134
192
|
}
|
|
135
193
|
function trapFocus(event, container) {
|
|
136
194
|
if (event.key !== "Tab" || !container)
|
|
@@ -178,7 +236,7 @@ function setupLayerA11y(container, options) {
|
|
|
178
236
|
if (options.lockScroll)
|
|
179
237
|
document.body.style.overflow = previousOverflow;
|
|
180
238
|
if (options.restoreFocus)
|
|
181
|
-
previousActiveElement
|
|
239
|
+
previousActiveElement === null || previousActiveElement === void 0 ? void 0 : previousActiveElement.focus({ preventScroll: true });
|
|
182
240
|
};
|
|
183
241
|
}
|
|
184
242
|
function resolveTabsDirection(tabs, previousId, nextId, direction) {
|
|
@@ -202,10 +260,10 @@ function useFormInteractivity() {
|
|
|
202
260
|
});
|
|
203
261
|
}
|
|
204
262
|
function resolveFieldInteractivity(form, disabled, readOnly) {
|
|
205
|
-
const resolvedDisabled = disabled
|
|
263
|
+
const resolvedDisabled = disabled !== null && disabled !== void 0 ? disabled : form.disabled.value;
|
|
206
264
|
return {
|
|
207
265
|
disabled: resolvedDisabled,
|
|
208
|
-
readOnly: !resolvedDisabled && (readOnly
|
|
266
|
+
readOnly: !resolvedDisabled && (readOnly !== null && readOnly !== void 0 ? readOnly : form.readOnly.value),
|
|
209
267
|
};
|
|
210
268
|
}
|
|
211
269
|
function useForm() {
|
|
@@ -225,6 +283,7 @@ function useFormState() {
|
|
|
225
283
|
return state;
|
|
226
284
|
}
|
|
227
285
|
function useField(name, options = {}) {
|
|
286
|
+
var _a;
|
|
228
287
|
const form = useForm();
|
|
229
288
|
const state = useFormState();
|
|
230
289
|
let unsubscribe;
|
|
@@ -232,11 +291,11 @@ function useField(name, options = {}) {
|
|
|
232
291
|
unsubscribe = form.registerField(name, options);
|
|
233
292
|
});
|
|
234
293
|
onBeforeUnmount(() => {
|
|
235
|
-
unsubscribe
|
|
294
|
+
unsubscribe === null || unsubscribe === void 0 ? void 0 : unsubscribe();
|
|
236
295
|
});
|
|
237
|
-
const value = ref((form.getValue(name)
|
|
238
|
-
watch(() => state.value.fields[name]
|
|
239
|
-
value.value = (nextValue
|
|
296
|
+
const value = ref(((_a = form.getValue(name)) !== null && _a !== void 0 ? _a : ""));
|
|
297
|
+
watch(() => { var _a; return (_a = state.value.fields[name]) === null || _a === void 0 ? void 0 : _a.value; }, (nextValue) => {
|
|
298
|
+
value.value = (nextValue !== null && nextValue !== void 0 ? nextValue : "");
|
|
240
299
|
});
|
|
241
300
|
return {
|
|
242
301
|
value,
|
|
@@ -260,28 +319,30 @@ function createEmptyFormState() {
|
|
|
260
319
|
};
|
|
261
320
|
}
|
|
262
321
|
function useOptionalField(name, options = {}) {
|
|
322
|
+
var _a, _b, _c;
|
|
263
323
|
const form = inject(formSymbol, null);
|
|
264
|
-
const state = shallowRef(form
|
|
265
|
-
const value = ref((name ? form
|
|
324
|
+
const state = shallowRef((_a = form === null || form === void 0 ? void 0 : form.getState()) !== null && _a !== void 0 ? _a : createEmptyFormState());
|
|
325
|
+
const value = ref((_c = (_b = (name ? form === null || form === void 0 ? void 0 : form.getValue(name) : undefined)) !== null && _b !== void 0 ? _b : options.initialValue) !== null && _c !== void 0 ? _c : "");
|
|
266
326
|
let unsubscribeForm;
|
|
267
327
|
let unsubscribeField;
|
|
268
328
|
onMounted(() => {
|
|
329
|
+
var _a;
|
|
269
330
|
if (!form || !name)
|
|
270
331
|
return;
|
|
271
332
|
unsubscribeForm = form.subscribe((nextState) => {
|
|
272
333
|
state.value = nextState;
|
|
273
334
|
});
|
|
274
335
|
unsubscribeField = form.registerField(name, options);
|
|
275
|
-
value.value = (form.getValue(name)
|
|
336
|
+
value.value = ((_a = form.getValue(name)) !== null && _a !== void 0 ? _a : "");
|
|
276
337
|
});
|
|
277
338
|
onBeforeUnmount(() => {
|
|
278
|
-
unsubscribeField
|
|
279
|
-
unsubscribeForm
|
|
339
|
+
unsubscribeField === null || unsubscribeField === void 0 ? void 0 : unsubscribeField();
|
|
340
|
+
unsubscribeForm === null || unsubscribeForm === void 0 ? void 0 : unsubscribeForm();
|
|
280
341
|
});
|
|
281
|
-
watch(() => (name ? state.value.fields[name]
|
|
342
|
+
watch(() => { var _a; return (name ? (_a = state.value.fields[name]) === null || _a === void 0 ? void 0 : _a.value : undefined); }, (nextValue) => {
|
|
282
343
|
if (!form || !name)
|
|
283
344
|
return;
|
|
284
|
-
value.value = (nextValue
|
|
345
|
+
value.value = (nextValue !== null && nextValue !== void 0 ? nextValue : "");
|
|
285
346
|
});
|
|
286
347
|
return {
|
|
287
348
|
value,
|
|
@@ -323,28 +384,31 @@ const ClassForm = /*#__PURE__*/ defineComponent({
|
|
|
323
384
|
},
|
|
324
385
|
},
|
|
325
386
|
setup(props, { slots }) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
387
|
+
var _a;
|
|
388
|
+
const controller = (_a = props.form) !== null && _a !== void 0 ? _a : new FormController({
|
|
389
|
+
initialValues: props.initialValues,
|
|
390
|
+
onSubmit: props.onSubmit,
|
|
391
|
+
validateOn: props.validateOn,
|
|
392
|
+
});
|
|
332
393
|
provide(formSymbol, controller);
|
|
333
394
|
provide(formInteractivitySymbol, {
|
|
334
395
|
disabled: computed(() => props.disabled),
|
|
335
396
|
readOnly: computed(() => props.readOnly || props.readonly),
|
|
336
397
|
});
|
|
337
398
|
onBeforeUnmount(() => controller.destroy());
|
|
338
|
-
return () =>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
399
|
+
return () => {
|
|
400
|
+
var _a;
|
|
401
|
+
return h("form", {
|
|
402
|
+
class: props.className,
|
|
403
|
+
"data-disabled": props.disabled ? "true" : "false",
|
|
404
|
+
"data-readonly": props.readOnly || props.readonly ? "true" : "false",
|
|
405
|
+
novalidate: true,
|
|
406
|
+
onSubmit: (event) => {
|
|
407
|
+
event.preventDefault();
|
|
408
|
+
void controller.submit();
|
|
409
|
+
},
|
|
410
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
|
|
411
|
+
};
|
|
348
412
|
},
|
|
349
413
|
});
|
|
350
414
|
function renderError(errors, errorId) {
|
|
@@ -426,13 +490,14 @@ const ClassInput = /*#__PURE__*/ defineComponent({
|
|
|
426
490
|
rules: props.rules,
|
|
427
491
|
});
|
|
428
492
|
return () => {
|
|
493
|
+
var _a, _b;
|
|
429
494
|
const fieldState = props.name
|
|
430
495
|
? field.state.value.fields[props.name]
|
|
431
496
|
: undefined;
|
|
432
|
-
const errors = fieldState
|
|
497
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
433
498
|
const invalid = errors.length > 0;
|
|
434
499
|
const errorId = `${props.name}-error`;
|
|
435
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
500
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
436
501
|
const canClear = props.clearable &&
|
|
437
502
|
field.value.value !== "" &&
|
|
438
503
|
!interactivity.disabled &&
|
|
@@ -527,14 +592,15 @@ const ClassPasswordInput = /*#__PURE__*/ defineComponent({
|
|
|
527
592
|
});
|
|
528
593
|
const innerVisible = ref(props.defaultVisible);
|
|
529
594
|
return () => {
|
|
595
|
+
var _a, _b, _c, _d;
|
|
530
596
|
const fieldState = props.name
|
|
531
597
|
? field.state.value.fields[props.name]
|
|
532
598
|
: undefined;
|
|
533
|
-
const errors = fieldState
|
|
599
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
534
600
|
const invalid = errors.length > 0;
|
|
535
601
|
const errorId = `${props.name}-error`;
|
|
536
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
537
|
-
const visible = props.visible
|
|
602
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
603
|
+
const visible = (_c = props.visible) !== null && _c !== void 0 ? _c : innerVisible.value;
|
|
538
604
|
const controller = new PasswordInputController({ visible });
|
|
539
605
|
const state = controller.getState();
|
|
540
606
|
const canClear = props.clearable &&
|
|
@@ -543,6 +609,7 @@ const ClassPasswordInput = /*#__PURE__*/ defineComponent({
|
|
|
543
609
|
!interactivity.readOnly;
|
|
544
610
|
const canToggle = props.showToggle && !interactivity.disabled;
|
|
545
611
|
const renderToggleContent = () => {
|
|
612
|
+
var _a, _b, _c, _d;
|
|
546
613
|
if (state.visible && slots.visibleIcon)
|
|
547
614
|
return slots.visibleIcon({ visible: state.visible });
|
|
548
615
|
if (!state.visible && slots.hiddenIcon)
|
|
@@ -558,10 +625,8 @@ const ClassPasswordInput = /*#__PURE__*/ defineComponent({
|
|
|
558
625
|
src,
|
|
559
626
|
})
|
|
560
627
|
: state.visible
|
|
561
|
-
? (props.visibleIcon
|
|
562
|
-
|
|
563
|
-
: (props.hiddenIcon ??
|
|
564
|
-
getClassComponentsLocale().passwordHiddenIcon);
|
|
628
|
+
? ((_a = props.visibleIcon) !== null && _a !== void 0 ? _a : getClassComponentsLocale().passwordVisibleIcon)
|
|
629
|
+
: ((_b = props.hiddenIcon) !== null && _b !== void 0 ? _b : getClassComponentsLocale().passwordHiddenIcon);
|
|
565
630
|
}
|
|
566
631
|
if (props.toggleType === "icon" &&
|
|
567
632
|
(state.visible ? props.visibleIcon : props.hiddenIcon) === undefined) {
|
|
@@ -592,9 +657,8 @@ const ClassPasswordInput = /*#__PURE__*/ defineComponent({
|
|
|
592
657
|
]);
|
|
593
658
|
}
|
|
594
659
|
return state.visible
|
|
595
|
-
? (props.visibleIcon
|
|
596
|
-
|
|
597
|
-
: (props.hiddenIcon ?? getClassComponentsLocale().passwordHiddenIcon);
|
|
660
|
+
? ((_c = props.visibleIcon) !== null && _c !== void 0 ? _c : getClassComponentsLocale().passwordVisibleIcon)
|
|
661
|
+
: ((_d = props.hiddenIcon) !== null && _d !== void 0 ? _d : getClassComponentsLocale().passwordHiddenIcon);
|
|
598
662
|
};
|
|
599
663
|
return h("div", {
|
|
600
664
|
class: props.fieldClass,
|
|
@@ -641,12 +705,11 @@ const ClassPasswordInput = /*#__PURE__*/ defineComponent({
|
|
|
641
705
|
: null,
|
|
642
706
|
canToggle
|
|
643
707
|
? h("button", {
|
|
644
|
-
"aria-label": props.toggleLabel
|
|
645
|
-
(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
.passwordToggleHiddenLabel),
|
|
708
|
+
"aria-label": (_d = props.toggleLabel) !== null && _d !== void 0 ? _d : (state.visible
|
|
709
|
+
? getClassComponentsLocale()
|
|
710
|
+
.passwordToggleVisibleLabel
|
|
711
|
+
: getClassComponentsLocale()
|
|
712
|
+
.passwordToggleHiddenLabel),
|
|
650
713
|
"aria-pressed": state.visible,
|
|
651
714
|
class: "cc-password-field__toggle",
|
|
652
715
|
"data-type": props.toggleType,
|
|
@@ -714,8 +777,9 @@ const ClassColorPicker = /*#__PURE__*/ defineComponent({
|
|
|
714
777
|
};
|
|
715
778
|
};
|
|
716
779
|
const closeOnOutside = (event) => {
|
|
780
|
+
var _a, _b;
|
|
717
781
|
const target = event.target;
|
|
718
|
-
if (!rootRef.value
|
|
782
|
+
if (!((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) && !((_b = panelRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
719
783
|
open.value = false;
|
|
720
784
|
};
|
|
721
785
|
watch(open, (value) => {
|
|
@@ -733,7 +797,8 @@ const ClassColorPicker = /*#__PURE__*/ defineComponent({
|
|
|
733
797
|
window.removeEventListener("scroll", updatePanelPosition, true);
|
|
734
798
|
});
|
|
735
799
|
return () => {
|
|
736
|
-
|
|
800
|
+
var _a;
|
|
801
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
737
802
|
const controller = new ColorPickerController(String(field.value.value || "#1d2129"));
|
|
738
803
|
const state = controller.getState();
|
|
739
804
|
const commit = (value) => {
|
|
@@ -812,8 +877,9 @@ const ClassColorPicker = /*#__PURE__*/ defineComponent({
|
|
|
812
877
|
},
|
|
813
878
|
tabindex: interactivity.disabled ? -1 : 0,
|
|
814
879
|
onPointerdown: (event) => {
|
|
880
|
+
var _a, _b;
|
|
815
881
|
updateSpectrum(event);
|
|
816
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
882
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
817
883
|
},
|
|
818
884
|
onPointermove: (event) => {
|
|
819
885
|
if (event.buttons > 0)
|
|
@@ -827,8 +893,9 @@ const ClassColorPicker = /*#__PURE__*/ defineComponent({
|
|
|
827
893
|
role: "slider",
|
|
828
894
|
tabindex: interactivity.disabled ? -1 : 0,
|
|
829
895
|
onPointerdown: (event) => {
|
|
896
|
+
var _a, _b;
|
|
830
897
|
updateHue(event);
|
|
831
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
898
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
832
899
|
},
|
|
833
900
|
onPointermove: (event) => {
|
|
834
901
|
if (event.buttons > 0)
|
|
@@ -995,8 +1062,9 @@ const ClassDatePicker = /*#__PURE__*/ defineComponent({
|
|
|
995
1062
|
requestAnimationFrame(updatePanelPosition);
|
|
996
1063
|
});
|
|
997
1064
|
const closeOnOutside = (event) => {
|
|
1065
|
+
var _a, _b;
|
|
998
1066
|
const target = event.target;
|
|
999
|
-
if (!rootRef.value
|
|
1067
|
+
if (!((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) && !((_b = panelRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
1000
1068
|
open.value = false;
|
|
1001
1069
|
};
|
|
1002
1070
|
onMounted(() => {
|
|
@@ -1018,7 +1086,8 @@ const ClassDatePicker = /*#__PURE__*/ defineComponent({
|
|
|
1018
1086
|
open.value = false;
|
|
1019
1087
|
};
|
|
1020
1088
|
return () => {
|
|
1021
|
-
|
|
1089
|
+
var _a;
|
|
1090
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1022
1091
|
return h("div", {
|
|
1023
1092
|
...attrs,
|
|
1024
1093
|
class: props.fieldClass,
|
|
@@ -1215,8 +1284,9 @@ const ClassDateRangePicker = /*#__PURE__*/ defineComponent({
|
|
|
1215
1284
|
requestAnimationFrame(updatePanelPosition);
|
|
1216
1285
|
});
|
|
1217
1286
|
const closeOnOutside = (event) => {
|
|
1287
|
+
var _a, _b;
|
|
1218
1288
|
const target = event.target;
|
|
1219
|
-
if (!rootRef.value
|
|
1289
|
+
if (!((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) && !((_b = panelRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
1220
1290
|
open.value = false;
|
|
1221
1291
|
};
|
|
1222
1292
|
onMounted(() => {
|
|
@@ -1269,7 +1339,8 @@ const ClassDateRangePicker = /*#__PURE__*/ defineComponent({
|
|
|
1269
1339
|
}, day.day))),
|
|
1270
1340
|
]);
|
|
1271
1341
|
return () => {
|
|
1272
|
-
|
|
1342
|
+
var _a;
|
|
1343
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1273
1344
|
const currentValue = { start: state.value.start, end: state.value.end };
|
|
1274
1345
|
return h("div", {
|
|
1275
1346
|
...attrs,
|
|
@@ -1414,13 +1485,14 @@ const ClassTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1414
1485
|
rules: props.rules,
|
|
1415
1486
|
});
|
|
1416
1487
|
return () => {
|
|
1488
|
+
var _a, _b;
|
|
1417
1489
|
const fieldState = props.name
|
|
1418
1490
|
? field.state.value.fields[props.name]
|
|
1419
1491
|
: undefined;
|
|
1420
|
-
const errors = fieldState
|
|
1492
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
1421
1493
|
const invalid = errors.length > 0;
|
|
1422
1494
|
const errorId = `${props.name}-error`;
|
|
1423
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
1495
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
1424
1496
|
const canClear = props.clearable &&
|
|
1425
1497
|
field.value.value !== "" &&
|
|
1426
1498
|
!interactivity.disabled &&
|
|
@@ -1511,11 +1583,12 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1511
1583
|
},
|
|
1512
1584
|
emits: ["change", "input", "update:modelValue", "update:value"],
|
|
1513
1585
|
setup(props, { attrs, emit, expose }) {
|
|
1586
|
+
var _a, _b;
|
|
1514
1587
|
const textareaRef = ref(null);
|
|
1515
1588
|
const controller = new ChatTextareaController({
|
|
1516
1589
|
maxRows: props.maxRows,
|
|
1517
1590
|
minRows: props.minRows,
|
|
1518
|
-
value: props.modelValue
|
|
1591
|
+
value: (_b = (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value) !== null && _b !== void 0 ? _b : props.defaultValue,
|
|
1519
1592
|
});
|
|
1520
1593
|
const state = ref(controller.getState());
|
|
1521
1594
|
const controlled = computed(() => props.modelValue !== undefined || props.value !== undefined);
|
|
@@ -1534,11 +1607,12 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1534
1607
|
element.scrollHeight > maxHeight + 1 ? "auto" : "hidden";
|
|
1535
1608
|
};
|
|
1536
1609
|
const syncState = () => {
|
|
1610
|
+
var _a, _b;
|
|
1537
1611
|
state.value = controller.update({
|
|
1538
1612
|
maxRows: props.maxRows,
|
|
1539
1613
|
minRows: props.minRows,
|
|
1540
1614
|
value: controlled.value
|
|
1541
|
-
? (props.modelValue
|
|
1615
|
+
? ((_b = (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value) !== null && _b !== void 0 ? _b : "")
|
|
1542
1616
|
: state.value.value,
|
|
1543
1617
|
});
|
|
1544
1618
|
nextTick(resize);
|
|
@@ -1552,7 +1626,7 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1552
1626
|
resizeObserver.observe(textareaRef.value);
|
|
1553
1627
|
});
|
|
1554
1628
|
onBeforeUnmount(() => {
|
|
1555
|
-
resizeObserver
|
|
1629
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
1556
1630
|
});
|
|
1557
1631
|
const commit = (nextValue, event) => {
|
|
1558
1632
|
const nextState = controller.setValue(nextValue);
|
|
@@ -1565,14 +1639,15 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1565
1639
|
nextTick(resize);
|
|
1566
1640
|
};
|
|
1567
1641
|
expose({
|
|
1568
|
-
blur: () => textareaRef.value
|
|
1569
|
-
focus: () => textareaRef.value
|
|
1642
|
+
blur: () => { var _a; return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.blur(); },
|
|
1643
|
+
focus: () => { var _a; return (_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus(); },
|
|
1570
1644
|
getElement: () => textareaRef.value,
|
|
1571
1645
|
});
|
|
1572
1646
|
return () => {
|
|
1647
|
+
var _a, _b, _c;
|
|
1573
1648
|
const locked = props.disabled || props.readOnly || props.readonly;
|
|
1574
1649
|
const currentValue = controlled.value
|
|
1575
|
-
? (props.modelValue
|
|
1650
|
+
? ((_b = (_a = props.modelValue) !== null && _a !== void 0 ? _a : props.value) !== null && _b !== void 0 ? _b : "")
|
|
1576
1651
|
: state.value.value;
|
|
1577
1652
|
const canClear = props.clearable && currentValue !== "" && !locked;
|
|
1578
1653
|
return h("div", {
|
|
@@ -1595,7 +1670,7 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1595
1670
|
style: {
|
|
1596
1671
|
"--cc-chat-textarea-max-rows": state.value.maxRows,
|
|
1597
1672
|
"--cc-chat-textarea-min-rows": state.value.minRows,
|
|
1598
|
-
...(props.textareaStyle
|
|
1673
|
+
...((_c = props.textareaStyle) !== null && _c !== void 0 ? _c : {}),
|
|
1599
1674
|
},
|
|
1600
1675
|
value: currentValue,
|
|
1601
1676
|
onInput: (event) => {
|
|
@@ -1610,8 +1685,9 @@ const ClassChatTextarea = /*#__PURE__*/ defineComponent({
|
|
|
1610
1685
|
class: "cc-chat-textarea__clear",
|
|
1611
1686
|
type: "button",
|
|
1612
1687
|
onClick: (event) => {
|
|
1688
|
+
var _a;
|
|
1613
1689
|
commit("", event);
|
|
1614
|
-
textareaRef.value
|
|
1690
|
+
(_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1615
1691
|
},
|
|
1616
1692
|
}, props.clearIcon)
|
|
1617
1693
|
: null,
|
|
@@ -1659,15 +1735,17 @@ const ClassVerificationCode = /*#__PURE__*/ defineComponent({
|
|
|
1659
1735
|
if (nextState.complete)
|
|
1660
1736
|
emit("complete", nextState.value);
|
|
1661
1737
|
if (focusIndex !== undefined)
|
|
1662
|
-
void nextTick(() => inputRefs[focusIndex]
|
|
1738
|
+
void nextTick(() => { var _a; return (_a = inputRefs[focusIndex]) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
1663
1739
|
};
|
|
1664
1740
|
onMounted(() => {
|
|
1665
|
-
|
|
1741
|
+
var _a, _b;
|
|
1742
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1666
1743
|
if (props.autoFocus && !interactivity.disabled && !interactivity.readOnly)
|
|
1667
|
-
inputRefs[0]
|
|
1744
|
+
(_b = inputRefs[0]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1668
1745
|
});
|
|
1669
1746
|
return () => {
|
|
1670
|
-
|
|
1747
|
+
var _a;
|
|
1748
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1671
1749
|
return h("div", {
|
|
1672
1750
|
...attrs,
|
|
1673
1751
|
class: props.fieldClass,
|
|
@@ -1677,55 +1755,60 @@ const ClassVerificationCode = /*#__PURE__*/ defineComponent({
|
|
|
1677
1755
|
props.label
|
|
1678
1756
|
? h("span", { class: "cc-field__label" }, props.label)
|
|
1679
1757
|
: null,
|
|
1680
|
-
h("div", { class: "cc-verification-code__group" }, state.value.chars.map((char, index) =>
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1758
|
+
h("div", { class: "cc-verification-code__group" }, state.value.chars.map((char, index) => {
|
|
1759
|
+
var _a;
|
|
1760
|
+
return h("input", {
|
|
1761
|
+
"aria-label": `${(_a = props.label) !== null && _a !== void 0 ? _a : props.name} ${index + 1}`,
|
|
1762
|
+
class: "cc-verification-code__input",
|
|
1763
|
+
disabled: interactivity.disabled,
|
|
1764
|
+
inputmode: props.inputMode,
|
|
1765
|
+
key: index,
|
|
1766
|
+
maxlength: 1,
|
|
1767
|
+
readonly: interactivity.readOnly,
|
|
1768
|
+
ref: ((element) => {
|
|
1769
|
+
inputRefs[index] = element;
|
|
1770
|
+
}),
|
|
1771
|
+
value: char,
|
|
1772
|
+
onInput: (event) => {
|
|
1773
|
+
if (interactivity.disabled || interactivity.readOnly)
|
|
1774
|
+
return;
|
|
1775
|
+
const value = event.target.value;
|
|
1776
|
+
if (value === "") {
|
|
1777
|
+
commit(controller.remove(index), index);
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
if (value.length > 1) {
|
|
1781
|
+
const next = controller.paste(value, controller.getNextInputIndex(index));
|
|
1782
|
+
commit(next, Math.min(next.length - 1, next.value.length));
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
const next = controller.inputAtNextSlot(index, value);
|
|
1786
|
+
commit(next.state, next.focusIndex);
|
|
1787
|
+
},
|
|
1788
|
+
onKeydown: (event) => {
|
|
1789
|
+
var _a, _b;
|
|
1790
|
+
if (event.key === "Backspace" &&
|
|
1791
|
+
!state.value.chars[index] &&
|
|
1792
|
+
index > 0) {
|
|
1793
|
+
event.preventDefault();
|
|
1794
|
+
commit(controller.remove(index - 1), index - 1);
|
|
1795
|
+
}
|
|
1796
|
+
if (event.key === "ArrowLeft" && index > 0)
|
|
1797
|
+
(_a = inputRefs[index - 1]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1798
|
+
if (event.key === "ArrowRight" &&
|
|
1799
|
+
index < state.value.length - 1)
|
|
1800
|
+
(_b = inputRefs[index + 1]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1801
|
+
},
|
|
1802
|
+
onPaste: (event) => {
|
|
1803
|
+
var _a, _b;
|
|
1804
|
+
if (interactivity.disabled || interactivity.readOnly)
|
|
1805
|
+
return;
|
|
1712
1806
|
event.preventDefault();
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
index < state.value.length - 1)
|
|
1719
|
-
inputRefs[index + 1]?.focus();
|
|
1720
|
-
},
|
|
1721
|
-
onPaste: (event) => {
|
|
1722
|
-
if (interactivity.disabled || interactivity.readOnly)
|
|
1723
|
-
return;
|
|
1724
|
-
event.preventDefault();
|
|
1725
|
-
const text = event.clipboardData?.getData("text") ?? "";
|
|
1726
|
-
commit(controller.paste(text, index), Math.min(state.value.length - 1, index + text.length));
|
|
1727
|
-
},
|
|
1728
|
-
}))),
|
|
1807
|
+
const text = (_b = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text")) !== null && _b !== void 0 ? _b : "";
|
|
1808
|
+
commit(controller.paste(text, index), Math.min(state.value.length - 1, index + text.length));
|
|
1809
|
+
},
|
|
1810
|
+
});
|
|
1811
|
+
})),
|
|
1729
1812
|
h("input", {
|
|
1730
1813
|
name: props.name,
|
|
1731
1814
|
type: "hidden",
|
|
@@ -1773,6 +1856,7 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1773
1856
|
},
|
|
1774
1857
|
emits: ["change", "fail", "success"],
|
|
1775
1858
|
setup(props, { attrs, emit }) {
|
|
1859
|
+
var _a;
|
|
1776
1860
|
const formInteractivity = useFormInteractivity();
|
|
1777
1861
|
const field = useOptionalField(props.name, {
|
|
1778
1862
|
rules: props.rules,
|
|
@@ -1780,7 +1864,7 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1780
1864
|
const controller = new SlideCaptchaController({
|
|
1781
1865
|
height: props.height,
|
|
1782
1866
|
moveAxis: props.moveAxis,
|
|
1783
|
-
originY: props.pieceTop
|
|
1867
|
+
originY: (_a = props.pieceTop) !== null && _a !== void 0 ? _a : Math.round(props.height * 0.38),
|
|
1784
1868
|
pieceHeight: props.pieceHeight,
|
|
1785
1869
|
pieceWidth: props.pieceWidth,
|
|
1786
1870
|
targetX: props.targetX,
|
|
@@ -1805,10 +1889,11 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1805
1889
|
props.tolerance,
|
|
1806
1890
|
props.width,
|
|
1807
1891
|
], () => {
|
|
1892
|
+
var _a;
|
|
1808
1893
|
state.value = controller.updateOptions({
|
|
1809
1894
|
height: props.height,
|
|
1810
1895
|
moveAxis: props.moveAxis,
|
|
1811
|
-
originY: props.pieceTop
|
|
1896
|
+
originY: (_a = props.pieceTop) !== null && _a !== void 0 ? _a : Math.round(props.height * 0.38),
|
|
1812
1897
|
pieceHeight: props.pieceHeight,
|
|
1813
1898
|
pieceWidth: props.pieceWidth,
|
|
1814
1899
|
targetX: props.targetX,
|
|
@@ -1838,7 +1923,8 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1838
1923
|
}
|
|
1839
1924
|
};
|
|
1840
1925
|
const reset = () => {
|
|
1841
|
-
|
|
1926
|
+
var _a;
|
|
1927
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1842
1928
|
if (interactivity.disabled || interactivity.readOnly)
|
|
1843
1929
|
return;
|
|
1844
1930
|
if (failedResetTimer !== null) {
|
|
@@ -1852,7 +1938,8 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1852
1938
|
window.clearTimeout(failedResetTimer);
|
|
1853
1939
|
});
|
|
1854
1940
|
return () => {
|
|
1855
|
-
|
|
1941
|
+
var _a;
|
|
1942
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
1856
1943
|
const safePieceTop = Math.max(0, Math.min(state.value.height - state.value.pieceHeight, state.value.originY));
|
|
1857
1944
|
const scaleX = cardRef.value
|
|
1858
1945
|
? state.value.width /
|
|
@@ -1863,12 +1950,13 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1863
1950
|
Math.max(1, cardRef.value.getBoundingClientRect().height)
|
|
1864
1951
|
: 1;
|
|
1865
1952
|
const startDrag = (event) => {
|
|
1953
|
+
var _a, _b;
|
|
1866
1954
|
if (interactivity.disabled ||
|
|
1867
1955
|
interactivity.readOnly ||
|
|
1868
1956
|
state.value.status === "success")
|
|
1869
1957
|
return;
|
|
1870
1958
|
event.preventDefault();
|
|
1871
|
-
event.currentTarget.setPointerCapture
|
|
1959
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
1872
1960
|
drag.value = {
|
|
1873
1961
|
pointerId: event.pointerId,
|
|
1874
1962
|
startClientX: event.clientX,
|
|
@@ -1886,15 +1974,17 @@ const ClassSlideCaptcha = /*#__PURE__*/ defineComponent({
|
|
|
1886
1974
|
(event.clientY - drag.value.startClientY) * scaleY), false);
|
|
1887
1975
|
};
|
|
1888
1976
|
const cancelDrag = (event) => {
|
|
1889
|
-
|
|
1977
|
+
var _a;
|
|
1978
|
+
if (((_a = drag.value) === null || _a === void 0 ? void 0 : _a.pointerId) !== event.pointerId)
|
|
1890
1979
|
return;
|
|
1891
1980
|
drag.value = null;
|
|
1892
1981
|
commit(controller.reset());
|
|
1893
1982
|
};
|
|
1894
1983
|
const endDrag = (event) => {
|
|
1984
|
+
var _a, _b;
|
|
1895
1985
|
if (!drag.value || drag.value.pointerId !== event.pointerId)
|
|
1896
1986
|
return;
|
|
1897
|
-
event.currentTarget.releasePointerCapture
|
|
1987
|
+
(_b = (_a = event.currentTarget).releasePointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
1898
1988
|
drag.value = null;
|
|
1899
1989
|
commit(controller.verify());
|
|
1900
1990
|
};
|
|
@@ -2004,12 +2094,13 @@ function countFractionDigits(value) {
|
|
|
2004
2094
|
return fraction.length;
|
|
2005
2095
|
}
|
|
2006
2096
|
function applyNumberStep(current, direction, options) {
|
|
2097
|
+
var _a;
|
|
2007
2098
|
const step = Number.isFinite(options.step) &&
|
|
2008
2099
|
options.step !== undefined &&
|
|
2009
2100
|
options.step > 0
|
|
2010
2101
|
? options.step
|
|
2011
2102
|
: 1;
|
|
2012
|
-
const base = current
|
|
2103
|
+
const base = (_a = current !== null && current !== void 0 ? current : options.min) !== null && _a !== void 0 ? _a : 0;
|
|
2013
2104
|
const precision = Math.max(countFractionDigits(base), countFractionDigits(step));
|
|
2014
2105
|
const factor = 10 ** precision;
|
|
2015
2106
|
let next = (Math.round(base * factor) + direction * Math.round(step * factor)) /
|
|
@@ -2127,13 +2218,14 @@ const ClassNumberInput = /*#__PURE__*/ defineComponent({
|
|
|
2127
2218
|
void field.setValue(nextValue);
|
|
2128
2219
|
};
|
|
2129
2220
|
return () => {
|
|
2221
|
+
var _a, _b;
|
|
2130
2222
|
const fieldState = props.name
|
|
2131
2223
|
? field.state.value.fields[props.name]
|
|
2132
2224
|
: undefined;
|
|
2133
|
-
const errors = fieldState
|
|
2225
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
2134
2226
|
const invalid = errors.length > 0;
|
|
2135
2227
|
const errorId = `${props.name}-error`;
|
|
2136
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
2228
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
2137
2229
|
const currentValue = field.value.value;
|
|
2138
2230
|
const currentNumber = currentValue === undefined || currentValue === ""
|
|
2139
2231
|
? undefined
|
|
@@ -2198,7 +2290,8 @@ const ClassNumberInput = /*#__PURE__*/ defineComponent({
|
|
|
2198
2290
|
void field.setValue(parseNumberDraft(target.value));
|
|
2199
2291
|
},
|
|
2200
2292
|
onKeydown: (event) => {
|
|
2201
|
-
|
|
2293
|
+
var _a;
|
|
2294
|
+
callEventHandler((_a = attrs.onKeydown) !== null && _a !== void 0 ? _a : attrs.onKeyDown, event);
|
|
2202
2295
|
if (event.defaultPrevented ||
|
|
2203
2296
|
interactivity.disabled ||
|
|
2204
2297
|
interactivity.readOnly)
|
|
@@ -2313,8 +2406,9 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2313
2406
|
menuPosition.value = getSelectMenuPosition(triggerRef.value, 240, true);
|
|
2314
2407
|
};
|
|
2315
2408
|
const closeOnOutsideClick = (event) => {
|
|
2409
|
+
var _a, _b;
|
|
2316
2410
|
const target = event.target;
|
|
2317
|
-
if (!rootRef.value
|
|
2411
|
+
if (!((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) && !((_b = menuRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
2318
2412
|
open.value = false;
|
|
2319
2413
|
};
|
|
2320
2414
|
onMounted(() => {
|
|
@@ -2332,14 +2426,15 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2332
2426
|
updateMenuPosition();
|
|
2333
2427
|
});
|
|
2334
2428
|
return () => {
|
|
2429
|
+
var _a, _b, _c;
|
|
2335
2430
|
const fieldState = props.name
|
|
2336
2431
|
? field.state.value.fields[props.name]
|
|
2337
2432
|
: undefined;
|
|
2338
|
-
const errors = fieldState
|
|
2433
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
2339
2434
|
const invalid = errors.length > 0;
|
|
2340
2435
|
const errorId = `${props.name}-error`;
|
|
2341
2436
|
const listboxId = `${props.name}-listbox`;
|
|
2342
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
2437
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
2343
2438
|
const rawValue = field.value.value;
|
|
2344
2439
|
const selectedValues = Array.isArray(rawValue)
|
|
2345
2440
|
? rawValue
|
|
@@ -2349,7 +2444,7 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2349
2444
|
const selectedOptions = props.options.filter((option) => selectedValues.includes(option.value));
|
|
2350
2445
|
const displayText = selectedOptions.length > 0
|
|
2351
2446
|
? selectedOptions.map((option) => option.label).join("、")
|
|
2352
|
-
: (props.placeholder
|
|
2447
|
+
: ((_c = props.placeholder) !== null && _c !== void 0 ? _c : "Select");
|
|
2353
2448
|
const setValue = (nextValue) => {
|
|
2354
2449
|
void field.setValue(nextValue);
|
|
2355
2450
|
emit("valueChange", nextValue);
|
|
@@ -2486,6 +2581,7 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2486
2581
|
...menuPosition.value.style,
|
|
2487
2582
|
},
|
|
2488
2583
|
}, props.options.map((option) => {
|
|
2584
|
+
var _a, _b;
|
|
2489
2585
|
const selected = selectedValues.includes(option.value);
|
|
2490
2586
|
return h("button", {
|
|
2491
2587
|
"aria-selected": selected,
|
|
@@ -2502,8 +2598,7 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2502
2598
|
? h("span", {
|
|
2503
2599
|
"aria-hidden": "true",
|
|
2504
2600
|
class: props.selectedIconClass,
|
|
2505
|
-
}, slots.selectedIcon
|
|
2506
|
-
props.selectedIcon)
|
|
2601
|
+
}, (_b = (_a = slots.selectedIcon) === null || _a === void 0 ? void 0 : _a.call(slots, { option })) !== null && _b !== void 0 ? _b : props.selectedIcon)
|
|
2507
2602
|
: null,
|
|
2508
2603
|
]);
|
|
2509
2604
|
})))
|
|
@@ -2513,7 +2608,7 @@ const ClassSelect = /*#__PURE__*/ defineComponent({
|
|
|
2513
2608
|
type: "hidden",
|
|
2514
2609
|
value: props.multiple
|
|
2515
2610
|
? selectedValues.join(",")
|
|
2516
|
-
: String(rawValue
|
|
2611
|
+
: String(rawValue !== null && rawValue !== void 0 ? rawValue : ""),
|
|
2517
2612
|
}),
|
|
2518
2613
|
]),
|
|
2519
2614
|
renderError(errors, errorId),
|
|
@@ -2627,8 +2722,9 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2627
2722
|
menuPosition.value = getSelectMenuPosition(triggerRef.value, props.menuHeight + (props.searchable ? 52 : 12));
|
|
2628
2723
|
};
|
|
2629
2724
|
const closeOnOutsideClick = (event) => {
|
|
2725
|
+
var _a, _b;
|
|
2630
2726
|
const target = event.target;
|
|
2631
|
-
if (!rootRef.value
|
|
2727
|
+
if (!((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) && !((_b = menuRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
2632
2728
|
open.value = false;
|
|
2633
2729
|
};
|
|
2634
2730
|
onMounted(() => {
|
|
@@ -2649,15 +2745,16 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2649
2745
|
scrollOffset.value = 0;
|
|
2650
2746
|
});
|
|
2651
2747
|
return () => {
|
|
2748
|
+
var _a, _b, _c, _d;
|
|
2652
2749
|
const fieldState = props.name
|
|
2653
2750
|
? field.state.value.fields[props.name]
|
|
2654
2751
|
: undefined;
|
|
2655
|
-
const errors = fieldState
|
|
2752
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
2656
2753
|
const invalid = errors.length > 0;
|
|
2657
2754
|
const errorId = `${props.name}-error`;
|
|
2658
2755
|
const listboxId = `${props.name}-virtual-listbox`;
|
|
2659
2756
|
const labelId = `${props.name}-label`;
|
|
2660
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
2757
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
2661
2758
|
const rawValue = field.value.value;
|
|
2662
2759
|
const coreOptions = props.options.map((option) => ({
|
|
2663
2760
|
disabled: option.disabled,
|
|
@@ -2680,12 +2777,12 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2680
2777
|
estimateSize: props.itemHeight,
|
|
2681
2778
|
overscan: props.overscan,
|
|
2682
2779
|
});
|
|
2683
|
-
const menuMaxHeight = Number.parseFloat(String(menuPosition.value.style.maxHeight
|
|
2780
|
+
const menuMaxHeight = Number.parseFloat(String((_c = menuPosition.value.style.maxHeight) !== null && _c !== void 0 ? _c : props.menuHeight));
|
|
2684
2781
|
const viewportHeight = Math.max(80, Math.min(props.menuHeight, menuMaxHeight - (props.searchable ? 52 : 12)));
|
|
2685
2782
|
const range = listController.getRange(scrollOffset.value, viewportHeight);
|
|
2686
2783
|
const displayText = selectedOptions.length > 0
|
|
2687
2784
|
? selectedOptions.map((option) => option.label).join("、")
|
|
2688
|
-
: (props.placeholder
|
|
2785
|
+
: ((_d = props.placeholder) !== null && _d !== void 0 ? _d : "Select");
|
|
2689
2786
|
const setValue = (nextValue) => {
|
|
2690
2787
|
void field.setValue(nextValue);
|
|
2691
2788
|
emit("valueChange", nextValue);
|
|
@@ -2821,6 +2918,7 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2821
2918
|
.selectEmptyText),
|
|
2822
2919
|
]
|
|
2823
2920
|
: range.items.map((item) => {
|
|
2921
|
+
var _a, _b;
|
|
2824
2922
|
const optionIndex = filteredIndexes[item.index];
|
|
2825
2923
|
if (optionIndex === undefined)
|
|
2826
2924
|
return null;
|
|
@@ -2848,9 +2946,9 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2848
2946
|
? h("span", {
|
|
2849
2947
|
"aria-hidden": "true",
|
|
2850
2948
|
class: props.selectedIconClass,
|
|
2851
|
-
}, slots.selectedIcon
|
|
2949
|
+
}, (_b = (_a = slots.selectedIcon) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
2852
2950
|
option,
|
|
2853
|
-
})
|
|
2951
|
+
})) !== null && _b !== void 0 ? _b : props.selectedIcon)
|
|
2854
2952
|
: null,
|
|
2855
2953
|
]);
|
|
2856
2954
|
})),
|
|
@@ -2862,7 +2960,7 @@ const ClassVirtualSelect = /*#__PURE__*/ defineComponent({
|
|
|
2862
2960
|
type: "hidden",
|
|
2863
2961
|
value: props.multiple
|
|
2864
2962
|
? selectState.selectedValues.join(",")
|
|
2865
|
-
: String(rawValue
|
|
2963
|
+
: String(rawValue !== null && rawValue !== void 0 ? rawValue : ""),
|
|
2866
2964
|
}),
|
|
2867
2965
|
]),
|
|
2868
2966
|
renderError(errors, errorId),
|
|
@@ -2907,12 +3005,13 @@ const ClassRadioGroup = /*#__PURE__*/ defineComponent({
|
|
|
2907
3005
|
rules: props.rules,
|
|
2908
3006
|
});
|
|
2909
3007
|
return () => {
|
|
3008
|
+
var _a, _b;
|
|
2910
3009
|
const fieldState = props.name
|
|
2911
3010
|
? field.state.value.fields[props.name]
|
|
2912
3011
|
: undefined;
|
|
2913
|
-
const errors = fieldState
|
|
3012
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
2914
3013
|
const errorId = `${props.name}-error`;
|
|
2915
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
3014
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
2916
3015
|
return h("fieldset", {
|
|
2917
3016
|
...attrs,
|
|
2918
3017
|
"aria-readonly": interactivity.readOnly || undefined,
|
|
@@ -2975,12 +3074,13 @@ const ClassCheckbox = /*#__PURE__*/ defineComponent({
|
|
|
2975
3074
|
rules: props.rules,
|
|
2976
3075
|
});
|
|
2977
3076
|
return () => {
|
|
3077
|
+
var _a, _b;
|
|
2978
3078
|
const fieldState = props.name
|
|
2979
3079
|
? field.state.value.fields[props.name]
|
|
2980
3080
|
: undefined;
|
|
2981
|
-
const errors = fieldState
|
|
3081
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
2982
3082
|
const errorId = `${props.name}-error`;
|
|
2983
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
3083
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
2984
3084
|
return h("label", {
|
|
2985
3085
|
class: props.fieldClass,
|
|
2986
3086
|
"data-disabled": interactivity.disabled,
|
|
@@ -3052,12 +3152,13 @@ const ClassSwitch = /*#__PURE__*/ defineComponent({
|
|
|
3052
3152
|
rules: props.rules,
|
|
3053
3153
|
});
|
|
3054
3154
|
return () => {
|
|
3155
|
+
var _a, _b;
|
|
3055
3156
|
const fieldState = props.name
|
|
3056
3157
|
? field.state.value.fields[props.name]
|
|
3057
3158
|
: undefined;
|
|
3058
|
-
const errors = fieldState
|
|
3159
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
3059
3160
|
const errorId = `${props.name}-error`;
|
|
3060
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
3161
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
3061
3162
|
return h("label", {
|
|
3062
3163
|
class: props.fieldClass,
|
|
3063
3164
|
"data-disabled": interactivity.disabled,
|
|
@@ -3140,13 +3241,14 @@ const ClassRating = /*#__PURE__*/ defineComponent({
|
|
|
3140
3241
|
rules: props.rules,
|
|
3141
3242
|
});
|
|
3142
3243
|
return () => {
|
|
3244
|
+
var _a, _b, _c;
|
|
3143
3245
|
const fieldState = props.name
|
|
3144
3246
|
? field.state.value.fields[props.name]
|
|
3145
3247
|
: undefined;
|
|
3146
|
-
const errors = fieldState
|
|
3248
|
+
const errors = (_a = fieldState === null || fieldState === void 0 ? void 0 : fieldState.errors) !== null && _a !== void 0 ? _a : [];
|
|
3147
3249
|
const errorId = `${props.name}-error`;
|
|
3148
3250
|
const value = Number(field.value.value) || 0;
|
|
3149
|
-
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, props.readOnly
|
|
3251
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly);
|
|
3150
3252
|
return h("fieldset", {
|
|
3151
3253
|
...attrs,
|
|
3152
3254
|
"aria-readonly": interactivity.readOnly || undefined,
|
|
@@ -3160,13 +3262,14 @@ const ClassRating = /*#__PURE__*/ defineComponent({
|
|
|
3160
3262
|
h("div", {
|
|
3161
3263
|
class: props.starsClass,
|
|
3162
3264
|
role: "radiogroup",
|
|
3163
|
-
"aria-label": props.label
|
|
3265
|
+
"aria-label": (_c = props.label) !== null && _c !== void 0 ? _c : props.name,
|
|
3164
3266
|
}, Array.from({ length: props.max }, (_, index) => {
|
|
3267
|
+
var _a, _b, _c, _d;
|
|
3165
3268
|
const starValue = index + 1;
|
|
3166
3269
|
const active = starValue <= value;
|
|
3167
3270
|
return h("button", {
|
|
3168
3271
|
"aria-checked": value === starValue,
|
|
3169
|
-
"aria-label": props.starLabel
|
|
3272
|
+
"aria-label": (_b = (_a = props.starLabel) === null || _a === void 0 ? void 0 : _a.call(props, starValue)) !== null && _b !== void 0 ? _b : `${starValue} star`,
|
|
3170
3273
|
class: props.starClass,
|
|
3171
3274
|
"data-active": active,
|
|
3172
3275
|
"data-readonly": interactivity.readOnly,
|
|
@@ -3180,7 +3283,7 @@ const ClassRating = /*#__PURE__*/ defineComponent({
|
|
|
3180
3283
|
return;
|
|
3181
3284
|
void field.setValue(starValue);
|
|
3182
3285
|
},
|
|
3183
|
-
}, slots.icon
|
|
3286
|
+
}, (_d = (_c = slots.icon) === null || _c === void 0 ? void 0 : _c.call(slots, { active, value: starValue })) !== null && _d !== void 0 ? _d : props.icon);
|
|
3184
3287
|
})),
|
|
3185
3288
|
renderError(errors, errorId),
|
|
3186
3289
|
]);
|
|
@@ -3294,7 +3397,10 @@ const ClassCountdown = /*#__PURE__*/ defineComponent({
|
|
|
3294
3397
|
start();
|
|
3295
3398
|
}, { immediate: true });
|
|
3296
3399
|
onBeforeUnmount(stop);
|
|
3297
|
-
return () =>
|
|
3400
|
+
return () => {
|
|
3401
|
+
var _a, _b;
|
|
3402
|
+
return h("span", { ...attrs, class: props.className, "data-done": state.value.done }, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, state.value)) !== null && _b !== void 0 ? _b : state.value.display);
|
|
3403
|
+
};
|
|
3298
3404
|
},
|
|
3299
3405
|
});
|
|
3300
3406
|
const ClassCalendar = /*#__PURE__*/ defineComponent({
|
|
@@ -3322,17 +3428,19 @@ const ClassCalendar = /*#__PURE__*/ defineComponent({
|
|
|
3322
3428
|
},
|
|
3323
3429
|
emits: ["change", "update:value"],
|
|
3324
3430
|
setup(props, { attrs, emit }) {
|
|
3431
|
+
var _a;
|
|
3325
3432
|
const controller = new CalendarController({
|
|
3326
3433
|
max: props.max,
|
|
3327
3434
|
min: props.min,
|
|
3328
|
-
value: props.value
|
|
3435
|
+
value: (_a = props.value) !== null && _a !== void 0 ? _a : props.defaultValue,
|
|
3329
3436
|
});
|
|
3330
3437
|
const state = ref(controller.getState());
|
|
3331
3438
|
watch(() => [props.value, props.max, props.min], () => {
|
|
3439
|
+
var _a;
|
|
3332
3440
|
state.value = controller.updateOptions({
|
|
3333
3441
|
max: props.max,
|
|
3334
3442
|
min: props.min,
|
|
3335
|
-
value: props.value
|
|
3443
|
+
value: (_a = props.value) !== null && _a !== void 0 ? _a : state.value.value,
|
|
3336
3444
|
});
|
|
3337
3445
|
});
|
|
3338
3446
|
const commit = (value) => {
|
|
@@ -3489,22 +3597,23 @@ const ClassTypewriterText = /*#__PURE__*/ defineComponent({
|
|
|
3489
3597
|
});
|
|
3490
3598
|
onMounted(schedule);
|
|
3491
3599
|
onBeforeUnmount(clearTimers);
|
|
3492
|
-
return () =>
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
h("span", { "aria-hidden": "true", class: props.cursorClass }))
|
|
3506
|
-
|
|
3507
|
-
|
|
3600
|
+
return () => {
|
|
3601
|
+
var _a, _b, _c, _d, _e;
|
|
3602
|
+
return h("span", {
|
|
3603
|
+
...attrs,
|
|
3604
|
+
"aria-label": (_a = attrs["aria-label"]) !== null && _a !== void 0 ? _a : props.text,
|
|
3605
|
+
class: props.className,
|
|
3606
|
+
"data-done": state.value.done,
|
|
3607
|
+
}, [
|
|
3608
|
+
h("span", { class: "cc-typewriter-text__content" }, state.value.displayedText),
|
|
3609
|
+
state.value.loading
|
|
3610
|
+
? ((_c = (_b = slots.loading) === null || _b === void 0 ? void 0 : _b.call(slots)) !== null && _c !== void 0 ? _c : h("span", { "aria-hidden": "true", class: props.loadingClass }))
|
|
3611
|
+
: null,
|
|
3612
|
+
state.value.cursor
|
|
3613
|
+
? ((_e = (_d = slots.cursor) === null || _d === void 0 ? void 0 : _d.call(slots)) !== null && _e !== void 0 ? _e : h("span", { "aria-hidden": "true", class: props.cursorClass }))
|
|
3614
|
+
: null,
|
|
3615
|
+
]);
|
|
3616
|
+
};
|
|
3508
3617
|
},
|
|
3509
3618
|
});
|
|
3510
3619
|
const ClassDesignEffect = /*#__PURE__*/ defineComponent({
|
|
@@ -3543,6 +3652,7 @@ const ClassDesignEffect = /*#__PURE__*/ defineComponent({
|
|
|
3543
3652
|
},
|
|
3544
3653
|
setup(props, { attrs, slots }) {
|
|
3545
3654
|
return () => {
|
|
3655
|
+
var _a;
|
|
3546
3656
|
const state = new DesignEffectController({
|
|
3547
3657
|
animated: props.animated,
|
|
3548
3658
|
colors: props.colors,
|
|
@@ -3568,7 +3678,7 @@ const ClassDesignEffect = /*#__PURE__*/ defineComponent({
|
|
|
3568
3678
|
state.overlay
|
|
3569
3679
|
? h("span", { "aria-hidden": "true", class: props.overlayClass })
|
|
3570
3680
|
: null,
|
|
3571
|
-
h("div", { class: props.contentClass }, slots.default
|
|
3681
|
+
h("div", { class: props.contentClass }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
3572
3682
|
]);
|
|
3573
3683
|
};
|
|
3574
3684
|
},
|
|
@@ -3595,6 +3705,7 @@ const ClassGradientText = /*#__PURE__*/ defineComponent({
|
|
|
3595
3705
|
},
|
|
3596
3706
|
setup(props, { attrs, slots }) {
|
|
3597
3707
|
return () => {
|
|
3708
|
+
var _a, _b;
|
|
3598
3709
|
const controller = new GradientTextController({
|
|
3599
3710
|
animated: props.animated,
|
|
3600
3711
|
backgroundSize: props.backgroundSize,
|
|
@@ -3617,7 +3728,7 @@ const ClassGradientText = /*#__PURE__*/ defineComponent({
|
|
|
3617
3728
|
"--cc-gradient-text-easing": state.easing,
|
|
3618
3729
|
"--cc-gradient-text-font-weight": state.fontWeight,
|
|
3619
3730
|
},
|
|
3620
|
-
}, slots.default
|
|
3731
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) !== null && _b !== void 0 ? _b : state.text);
|
|
3621
3732
|
};
|
|
3622
3733
|
},
|
|
3623
3734
|
});
|
|
@@ -3663,7 +3774,7 @@ const ClassLazyImage = /*#__PURE__*/ defineComponent({
|
|
|
3663
3774
|
const state = shallowRef(controller.getState());
|
|
3664
3775
|
let observer;
|
|
3665
3776
|
const disconnect = () => {
|
|
3666
|
-
observer
|
|
3777
|
+
observer === null || observer === void 0 ? void 0 : observer.disconnect();
|
|
3667
3778
|
observer = undefined;
|
|
3668
3779
|
};
|
|
3669
3780
|
const startLoading = () => {
|
|
@@ -3711,6 +3822,7 @@ const ClassLazyImage = /*#__PURE__*/ defineComponent({
|
|
|
3711
3822
|
onMounted(setupObserver);
|
|
3712
3823
|
onBeforeUnmount(disconnect);
|
|
3713
3824
|
return () => {
|
|
3825
|
+
var _a, _b, _c, _d;
|
|
3714
3826
|
const current = state.value;
|
|
3715
3827
|
const slotState = { status: current.status };
|
|
3716
3828
|
return h("div", {
|
|
@@ -3747,23 +3859,22 @@ const ClassLazyImage = /*#__PURE__*/ defineComponent({
|
|
|
3747
3859
|
(current.status === "idle" || current.status === "loading") &&
|
|
3748
3860
|
(props.loadingVariant !== "none" || Boolean(slots.placeholder))
|
|
3749
3861
|
? h("span", { class: props.placeholderClass }, [
|
|
3750
|
-
slots.placeholder
|
|
3751
|
-
(
|
|
3752
|
-
|
|
3753
|
-
|
|
3862
|
+
(_b = (_a = slots.placeholder) === null || _a === void 0 ? void 0 : _a.call(slots, slotState)) !== null && _b !== void 0 ? _b : (props.loadingVariant === "image" && current.placeholderSrc
|
|
3863
|
+
? h("img", {
|
|
3864
|
+
alt: "",
|
|
3865
|
+
"aria-hidden": "true",
|
|
3866
|
+
src: current.placeholderSrc,
|
|
3867
|
+
})
|
|
3868
|
+
: props.loadingVariant === "skeleton"
|
|
3869
|
+
? h("span", {
|
|
3754
3870
|
"aria-hidden": "true",
|
|
3755
|
-
|
|
3871
|
+
class: props.skeletonClass,
|
|
3756
3872
|
})
|
|
3757
|
-
:
|
|
3758
|
-
? h("span", {
|
|
3759
|
-
"aria-hidden": "true",
|
|
3760
|
-
class: props.skeletonClass,
|
|
3761
|
-
})
|
|
3762
|
-
: null),
|
|
3873
|
+
: null),
|
|
3763
3874
|
])
|
|
3764
3875
|
: null,
|
|
3765
3876
|
current.status === "error"
|
|
3766
|
-
? h("span", { class: props.errorClass }, slots.error
|
|
3877
|
+
? h("span", { class: props.errorClass }, (_d = (_c = slots.error) === null || _c === void 0 ? void 0 : _c.call(slots, slotState)) !== null && _d !== void 0 ? _d : "Image unavailable")
|
|
3767
3878
|
: null,
|
|
3768
3879
|
]);
|
|
3769
3880
|
};
|
|
@@ -3832,12 +3943,13 @@ const ClassTiltCard = /*#__PURE__*/ defineComponent({
|
|
|
3832
3943
|
});
|
|
3833
3944
|
});
|
|
3834
3945
|
const syncRect = (event) => {
|
|
3946
|
+
var _a, _b, _c;
|
|
3835
3947
|
if (event) {
|
|
3836
|
-
callEventHandler(attrs.onPointerenter
|
|
3948
|
+
callEventHandler((_a = attrs.onPointerenter) !== null && _a !== void 0 ? _a : attrs.onPointerEnter, event);
|
|
3837
3949
|
if (event.defaultPrevented)
|
|
3838
3950
|
return;
|
|
3839
3951
|
}
|
|
3840
|
-
rect = rootRef.value
|
|
3952
|
+
rect = (_c = (_b = rootRef.value) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) !== null && _c !== void 0 ? _c : null;
|
|
3841
3953
|
if (!event || props.disabled || !rect)
|
|
3842
3954
|
return;
|
|
3843
3955
|
useEnterTransition = true;
|
|
@@ -3850,12 +3962,13 @@ const ClassTiltCard = /*#__PURE__*/ defineComponent({
|
|
|
3850
3962
|
});
|
|
3851
3963
|
};
|
|
3852
3964
|
const handlePointerMove = (event) => {
|
|
3853
|
-
|
|
3965
|
+
var _a, _b, _c;
|
|
3966
|
+
callEventHandler((_a = attrs.onPointermove) !== null && _a !== void 0 ? _a : attrs.onPointerMove, event);
|
|
3854
3967
|
if (event.defaultPrevented)
|
|
3855
3968
|
return;
|
|
3856
3969
|
if (props.disabled)
|
|
3857
3970
|
return;
|
|
3858
|
-
rect = rect
|
|
3971
|
+
rect = (_c = rect !== null && rect !== void 0 ? rect : (_b = rootRef.value) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect()) !== null && _c !== void 0 ? _c : null;
|
|
3859
3972
|
if (!rect)
|
|
3860
3973
|
return;
|
|
3861
3974
|
pendingPoint = {
|
|
@@ -3880,7 +3993,8 @@ const ClassTiltCard = /*#__PURE__*/ defineComponent({
|
|
|
3880
3993
|
});
|
|
3881
3994
|
};
|
|
3882
3995
|
const handlePointerLeave = (event) => {
|
|
3883
|
-
|
|
3996
|
+
var _a;
|
|
3997
|
+
callEventHandler((_a = attrs.onPointerleave) !== null && _a !== void 0 ? _a : attrs.onPointerLeave, event);
|
|
3884
3998
|
if (event.defaultPrevented)
|
|
3885
3999
|
return;
|
|
3886
4000
|
rect = null;
|
|
@@ -3896,34 +4010,37 @@ const ClassTiltCard = /*#__PURE__*/ defineComponent({
|
|
|
3896
4010
|
if (frame !== undefined)
|
|
3897
4011
|
window.cancelAnimationFrame(frame);
|
|
3898
4012
|
});
|
|
3899
|
-
return () =>
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
4013
|
+
return () => {
|
|
4014
|
+
var _a;
|
|
4015
|
+
return h("div", {
|
|
4016
|
+
...attrs,
|
|
4017
|
+
class: [props.className, attrs.class],
|
|
4018
|
+
"data-active": state.value.isActive,
|
|
4019
|
+
"data-disabled": props.disabled,
|
|
4020
|
+
onPointerenter: syncRect,
|
|
4021
|
+
onPointerleave: handlePointerLeave,
|
|
4022
|
+
onPointermove: handlePointerMove,
|
|
4023
|
+
ref: rootRef,
|
|
4024
|
+
style: [
|
|
4025
|
+
attrs.style,
|
|
4026
|
+
{
|
|
4027
|
+
"--cc-tilt-card-glare-opacity": String(state.value.glareOpacity),
|
|
4028
|
+
"--cc-tilt-card-glare-x": `${state.value.glareX}%`,
|
|
4029
|
+
"--cc-tilt-card-glare-y": `${state.value.glareY}%`,
|
|
4030
|
+
"--cc-tilt-card-transition-easing": state.value.transitionEasing,
|
|
4031
|
+
"--cc-tilt-card-transition-duration": `${state.value.transitionDuration}ms`,
|
|
4032
|
+
"--cc-tilt-card-transform": state.value.transform,
|
|
4033
|
+
},
|
|
4034
|
+
],
|
|
4035
|
+
}, [
|
|
4036
|
+
h("div", { class: props.surfaceClass }, [
|
|
4037
|
+
h("div", { class: props.contentClass }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
4038
|
+
state.value.glare
|
|
4039
|
+
? h("span", { "aria-hidden": "true", class: props.glareClass })
|
|
4040
|
+
: null,
|
|
4041
|
+
]),
|
|
4042
|
+
]);
|
|
4043
|
+
};
|
|
3927
4044
|
},
|
|
3928
4045
|
});
|
|
3929
4046
|
const ClassOrbitalSphere = /*#__PURE__*/ defineComponent({
|
|
@@ -3978,23 +4095,26 @@ const ClassOrbitalSphere = /*#__PURE__*/ defineComponent({
|
|
|
3978
4095
|
style: [state.styleVars, attrs.style],
|
|
3979
4096
|
}, [
|
|
3980
4097
|
h("span", { "aria-hidden": "true", class: props.shellClass }),
|
|
3981
|
-
h("div", { class: props.stageClass }, state.items.map((item) =>
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
4098
|
+
h("div", { class: props.stageClass }, state.items.map((item) => {
|
|
4099
|
+
var _a, _b;
|
|
4100
|
+
return h("button", {
|
|
4101
|
+
"aria-label": item.label,
|
|
4102
|
+
class: props.itemClass,
|
|
4103
|
+
"data-tone": item.tone,
|
|
4104
|
+
disabled: state.disabled,
|
|
4105
|
+
key: item.id,
|
|
4106
|
+
onClick: (event) => emit("item-click", item, event),
|
|
4107
|
+
style: [
|
|
4108
|
+
{
|
|
4109
|
+
"--cc-orbital-index": item.index,
|
|
4110
|
+
},
|
|
4111
|
+
item.styleVars,
|
|
4112
|
+
],
|
|
4113
|
+
type: "button",
|
|
4114
|
+
}, [
|
|
4115
|
+
h("span", { class: props.itemContentClass }, (_b = (_a = slots.item) === null || _a === void 0 ? void 0 : _a.call(slots, { index: item.index, item })) !== null && _b !== void 0 ? _b : item.content),
|
|
4116
|
+
]);
|
|
4117
|
+
})),
|
|
3998
4118
|
]);
|
|
3999
4119
|
};
|
|
4000
4120
|
},
|
|
@@ -4025,7 +4145,8 @@ const ClassHeightTransition = /*#__PURE__*/ defineComponent({
|
|
|
4025
4145
|
const state = ref(controller.getState());
|
|
4026
4146
|
let observer;
|
|
4027
4147
|
const measure = () => {
|
|
4028
|
-
|
|
4148
|
+
var _a, _b;
|
|
4149
|
+
height.value = (_b = (_a = contentRef.value) === null || _a === void 0 ? void 0 : _a.scrollHeight) !== null && _b !== void 0 ? _b : 0;
|
|
4029
4150
|
};
|
|
4030
4151
|
watch(() => [props.duration, props.easing, props.expanded, props.mode], () => {
|
|
4031
4152
|
state.value = controller.update({
|
|
@@ -4043,23 +4164,129 @@ const ClassHeightTransition = /*#__PURE__*/ defineComponent({
|
|
|
4043
4164
|
observer.observe(contentRef.value);
|
|
4044
4165
|
}
|
|
4045
4166
|
});
|
|
4046
|
-
onBeforeUnmount(() => observer
|
|
4047
|
-
return () =>
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4167
|
+
onBeforeUnmount(() => observer === null || observer === void 0 ? void 0 : observer.disconnect());
|
|
4168
|
+
return () => {
|
|
4169
|
+
var _a;
|
|
4170
|
+
return h("div", {
|
|
4171
|
+
...attrs,
|
|
4172
|
+
class: props.className,
|
|
4173
|
+
"data-expanded": state.value.expanded,
|
|
4174
|
+
"data-mode": state.value.mode,
|
|
4175
|
+
style: [
|
|
4176
|
+
attrs.style,
|
|
4177
|
+
{
|
|
4178
|
+
"--cc-height-transition-duration": `${state.value.duration}ms`,
|
|
4179
|
+
"--cc-height-transition-easing": state.value.easing,
|
|
4180
|
+
"--cc-height-transition-height": `${height.value}px`,
|
|
4181
|
+
},
|
|
4182
|
+
],
|
|
4183
|
+
}, [
|
|
4184
|
+
h("div", { ref: contentRef, class: props.contentClass }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
4185
|
+
]);
|
|
4186
|
+
};
|
|
4187
|
+
},
|
|
4188
|
+
});
|
|
4189
|
+
const ClassWidthTransition = /*#__PURE__*/ defineComponent({
|
|
4190
|
+
name: "ClassWidthTransition",
|
|
4191
|
+
inheritAttrs: false,
|
|
4192
|
+
props: {
|
|
4193
|
+
className: { type: String, default: "cc-width-transition" },
|
|
4194
|
+
contentClass: { type: String, default: "cc-width-transition__content" },
|
|
4195
|
+
duration: { type: Number, default: 220 },
|
|
4196
|
+
easing: { type: String, default: "cubic-bezier(0.22, 0.8, 0.28, 1)" },
|
|
4197
|
+
expanded: { type: Boolean, default: false },
|
|
4198
|
+
mode: {
|
|
4199
|
+
type: String,
|
|
4200
|
+
default: "auto",
|
|
4201
|
+
},
|
|
4202
|
+
},
|
|
4203
|
+
setup(props, { attrs, slots }) {
|
|
4204
|
+
const contentRef = ref(null);
|
|
4205
|
+
const width = ref(0);
|
|
4206
|
+
const controller = new WidthTransitionController({
|
|
4207
|
+
duration: props.duration,
|
|
4208
|
+
easing: props.easing,
|
|
4209
|
+
expanded: props.expanded,
|
|
4210
|
+
mode: props.mode,
|
|
4211
|
+
});
|
|
4212
|
+
const state = ref(controller.getState());
|
|
4213
|
+
let observer;
|
|
4214
|
+
const measure = () => {
|
|
4215
|
+
var _a, _b;
|
|
4216
|
+
width.value = (_b = (_a = contentRef.value) === null || _a === void 0 ? void 0 : _a.scrollWidth) !== null && _b !== void 0 ? _b : 0;
|
|
4217
|
+
};
|
|
4218
|
+
watch(() => [props.duration, props.easing, props.expanded, props.mode], () => {
|
|
4219
|
+
state.value = controller.update({
|
|
4220
|
+
duration: props.duration,
|
|
4221
|
+
easing: props.easing,
|
|
4222
|
+
expanded: props.expanded,
|
|
4223
|
+
mode: props.mode,
|
|
4224
|
+
});
|
|
4225
|
+
nextTick(measure);
|
|
4226
|
+
}, { immediate: true });
|
|
4227
|
+
onMounted(() => {
|
|
4228
|
+
measure();
|
|
4229
|
+
if (typeof ResizeObserver !== "undefined" && contentRef.value) {
|
|
4230
|
+
observer = new ResizeObserver(measure);
|
|
4231
|
+
observer.observe(contentRef.value);
|
|
4232
|
+
}
|
|
4233
|
+
});
|
|
4234
|
+
onBeforeUnmount(() => observer === null || observer === void 0 ? void 0 : observer.disconnect());
|
|
4235
|
+
return () => {
|
|
4236
|
+
var _a;
|
|
4237
|
+
return h("div", {
|
|
4238
|
+
...attrs,
|
|
4239
|
+
class: props.className,
|
|
4240
|
+
"data-expanded": state.value.expanded,
|
|
4241
|
+
"data-mode": state.value.mode,
|
|
4242
|
+
style: [
|
|
4243
|
+
attrs.style,
|
|
4244
|
+
{
|
|
4245
|
+
"--cc-width-transition-duration": `${state.value.duration}ms`,
|
|
4246
|
+
"--cc-width-transition-easing": state.value.easing,
|
|
4247
|
+
"--cc-width-transition-width": `${width.value}px`,
|
|
4248
|
+
},
|
|
4249
|
+
],
|
|
4250
|
+
}, [
|
|
4251
|
+
h("div", { ref: contentRef, class: props.contentClass }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
4252
|
+
]);
|
|
4253
|
+
};
|
|
4254
|
+
},
|
|
4255
|
+
});
|
|
4256
|
+
const ClassThemeBox = /*#__PURE__*/ defineComponent({
|
|
4257
|
+
name: "ClassThemeBox",
|
|
4258
|
+
inheritAttrs: false,
|
|
4259
|
+
props: {
|
|
4260
|
+
className: { type: String, default: "" },
|
|
4261
|
+
radius: { type: String, default: undefined },
|
|
4262
|
+
size: { type: String, default: "md" },
|
|
4263
|
+
theme: {
|
|
4264
|
+
type: [String, Object],
|
|
4265
|
+
default: undefined,
|
|
4266
|
+
},
|
|
4267
|
+
variant: { type: String, default: "surface" },
|
|
4268
|
+
},
|
|
4269
|
+
setup(props, { attrs, slots }) {
|
|
4270
|
+
const state = computed(() => new ThemeBoxController({
|
|
4271
|
+
radius: props.radius,
|
|
4272
|
+
size: props.size,
|
|
4273
|
+
theme: resolveClassKitThemeName(props.theme),
|
|
4274
|
+
variant: props.variant,
|
|
4275
|
+
}).getState());
|
|
4276
|
+
return () => {
|
|
4277
|
+
var _a;
|
|
4278
|
+
return h("div", {
|
|
4279
|
+
...attrs,
|
|
4280
|
+
class: ["cc-theme-box", props.className, attrs.class].filter(Boolean),
|
|
4281
|
+
"data-cc-theme": state.value.theme,
|
|
4282
|
+
"data-size": state.value.size,
|
|
4283
|
+
"data-variant": state.value.variant,
|
|
4284
|
+
style: [
|
|
4285
|
+
attrs.style,
|
|
4286
|
+
{ "--cc-theme-box-radius": state.value.radius },
|
|
4287
|
+
],
|
|
4288
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
|
|
4289
|
+
};
|
|
4063
4290
|
},
|
|
4064
4291
|
});
|
|
4065
4292
|
const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
@@ -4108,7 +4335,8 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4108
4335
|
});
|
|
4109
4336
|
};
|
|
4110
4337
|
const resolvePlacement = (estimate = false) => {
|
|
4111
|
-
|
|
4338
|
+
var _a, _b, _c, _d;
|
|
4339
|
+
const rect = (_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
4112
4340
|
const panel = panelRef.value;
|
|
4113
4341
|
if (!rect || (!panel && !estimate) || typeof window === "undefined")
|
|
4114
4342
|
return;
|
|
@@ -4119,10 +4347,10 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4119
4347
|
const maxPanelHeight = Math.max(160, viewportHeight - padding * 2);
|
|
4120
4348
|
const maxPanelWidth = Math.max(160, viewportWidth - padding * 2);
|
|
4121
4349
|
const minPanelHeight = Math.min(160, maxPanelHeight);
|
|
4122
|
-
const panelContent = panel
|
|
4123
|
-
const measuredPanelHeight = Math.max(panel
|
|
4350
|
+
const panelContent = panel === null || panel === void 0 ? void 0 : panel.querySelector("pre");
|
|
4351
|
+
const measuredPanelHeight = Math.max((_b = panel === null || panel === void 0 ? void 0 : panel.offsetHeight) !== null && _b !== void 0 ? _b : 0, (_c = panel === null || panel === void 0 ? void 0 : panel.scrollHeight) !== null && _c !== void 0 ? _c : 0, (_d = panelContent === null || panelContent === void 0 ? void 0 : panelContent.scrollHeight) !== null && _d !== void 0 ? _d : 0, estimate ? 420 : 0);
|
|
4124
4352
|
const preferredPanelHeight = Math.min(Math.max(160, measuredPanelHeight || 420), maxPanelHeight);
|
|
4125
|
-
const panelWidth = Math.min(Math.max(rect.width, panel
|
|
4353
|
+
const panelWidth = Math.min(Math.max(rect.width, (panel === null || panel === void 0 ? void 0 : panel.offsetWidth) || 720), maxPanelWidth);
|
|
4126
4354
|
const availableBelow = Math.max(minPanelHeight, viewportHeight - rect.bottom - gap - padding);
|
|
4127
4355
|
const availableAbove = Math.max(minPanelHeight, rect.top - gap - padding);
|
|
4128
4356
|
const placementHeight = Math.min(preferredPanelHeight, Math.max(availableBelow, availableAbove));
|
|
@@ -4177,9 +4405,7 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4177
4405
|
};
|
|
4178
4406
|
const resolvePlacementFromViewport = () => resolvePlacement();
|
|
4179
4407
|
const copy = async () => {
|
|
4180
|
-
|
|
4181
|
-
await navigator.clipboard?.writeText(props.code);
|
|
4182
|
-
}
|
|
4408
|
+
await writeClipboardText(props.code);
|
|
4183
4409
|
state.value = controller.copied();
|
|
4184
4410
|
emit("copy", props.code);
|
|
4185
4411
|
window.clearTimeout(resetTimer);
|
|
@@ -4200,10 +4426,11 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4200
4426
|
state.value = controller.close();
|
|
4201
4427
|
};
|
|
4202
4428
|
const closeOnOutside = (event) => {
|
|
4429
|
+
var _a, _b;
|
|
4203
4430
|
const target = event.target;
|
|
4204
4431
|
if (target &&
|
|
4205
|
-
(rootRef.value
|
|
4206
|
-
panelRef.value
|
|
4432
|
+
(((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) ||
|
|
4433
|
+
((_b = panelRef.value) === null || _b === void 0 ? void 0 : _b.contains(target))))
|
|
4207
4434
|
return;
|
|
4208
4435
|
close();
|
|
4209
4436
|
};
|
|
@@ -4229,6 +4456,7 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4229
4456
|
window.removeEventListener("scroll", resolvePlacementFromViewport, true);
|
|
4230
4457
|
});
|
|
4231
4458
|
return () => {
|
|
4459
|
+
var _a, _b;
|
|
4232
4460
|
const panel = h("div", {
|
|
4233
4461
|
ref: panelRef,
|
|
4234
4462
|
class: "cc-code-preview__panel",
|
|
@@ -4259,7 +4487,7 @@ const ClassCodePreview = /*#__PURE__*/ defineComponent({
|
|
|
4259
4487
|
h("div", { class: "cc-code-preview__bar" }, [
|
|
4260
4488
|
h("div", { class: "cc-code-preview__meta" }, [
|
|
4261
4489
|
h("span", { class: "cc-code-preview__title" }, [
|
|
4262
|
-
slots.title
|
|
4490
|
+
(_b = (_a = slots.title) === null || _a === void 0 ? void 0 : _a.call(slots)) !== null && _b !== void 0 ? _b : props.title,
|
|
4263
4491
|
]),
|
|
4264
4492
|
h("span", { class: "cc-code-preview__lang" }, state.value.language),
|
|
4265
4493
|
]),
|
|
@@ -4341,7 +4569,8 @@ const ClassQRCode = /*#__PURE__*/ defineComponent({
|
|
|
4341
4569
|
}
|
|
4342
4570
|
}, { immediate: true });
|
|
4343
4571
|
return () => {
|
|
4344
|
-
|
|
4572
|
+
var _a, _b, _c;
|
|
4573
|
+
const logoSize = (_a = props.logoSize) !== null && _a !== void 0 ? _a : Math.round(props.size * 0.22);
|
|
4345
4574
|
return h("span", {
|
|
4346
4575
|
...attrs,
|
|
4347
4576
|
"aria-label": error.value ? props.errorText : props.value,
|
|
@@ -4350,7 +4579,7 @@ const ClassQRCode = /*#__PURE__*/ defineComponent({
|
|
|
4350
4579
|
style: { height: `${props.size}px`, width: `${props.size}px` },
|
|
4351
4580
|
}, [
|
|
4352
4581
|
error.value
|
|
4353
|
-
? h("span", { class: "cc-code__error" }, slots.error
|
|
4582
|
+
? h("span", { class: "cc-code__error" }, (_c = (_b = slots.error) === null || _b === void 0 ? void 0 : _b.call(slots, { error: error.value })) !== null && _c !== void 0 ? _c : props.errorText)
|
|
4354
4583
|
: h("span", { class: "cc-qr-code__svg", innerHTML: svg.value }),
|
|
4355
4584
|
!error.value && props.logoSrc
|
|
4356
4585
|
? h("span", {
|
|
@@ -4429,14 +4658,17 @@ const ClassBarcode = /*#__PURE__*/ defineComponent({
|
|
|
4429
4658
|
error.value = optionalDependencyError("jsbarcode", "Barcode rendering", "window.JsBarcode", nextError);
|
|
4430
4659
|
}
|
|
4431
4660
|
}, { immediate: true });
|
|
4432
|
-
return () =>
|
|
4433
|
-
|
|
4434
|
-
"
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4661
|
+
return () => {
|
|
4662
|
+
var _a, _b;
|
|
4663
|
+
return h("span", {
|
|
4664
|
+
...attrs,
|
|
4665
|
+
"aria-label": error.value ? props.errorText : props.value,
|
|
4666
|
+
class: props.className,
|
|
4667
|
+
role: "img",
|
|
4668
|
+
}, error.value
|
|
4669
|
+
? h("span", { class: "cc-code__error" }, (_b = (_a = slots.error) === null || _a === void 0 ? void 0 : _a.call(slots, { error: error.value })) !== null && _b !== void 0 ? _b : props.errorText)
|
|
4670
|
+
: h("span", { innerHTML: svg.value }));
|
|
4671
|
+
};
|
|
4440
4672
|
},
|
|
4441
4673
|
});
|
|
4442
4674
|
const ClassEllipsisText = /*#__PURE__*/ defineComponent({
|
|
@@ -4506,15 +4738,17 @@ const ClassEllipsisText = /*#__PURE__*/ defineComponent({
|
|
|
4506
4738
|
handler(event);
|
|
4507
4739
|
};
|
|
4508
4740
|
const toggleExpanded = () => {
|
|
4509
|
-
|
|
4741
|
+
var _a, _b;
|
|
4742
|
+
const current = (_a = props.expanded) !== null && _a !== void 0 ? _a : innerExpanded.value;
|
|
4510
4743
|
const next = !current;
|
|
4511
4744
|
if (props.expanded === undefined)
|
|
4512
4745
|
innerExpanded.value = next;
|
|
4513
|
-
props.onExpandedChange
|
|
4746
|
+
(_b = props.onExpandedChange) === null || _b === void 0 ? void 0 : _b.call(props, next);
|
|
4514
4747
|
};
|
|
4515
4748
|
return () => {
|
|
4749
|
+
var _a, _b;
|
|
4516
4750
|
const { class: attrClass, onClick, onKeydown, onKeyDown, role, style: attrStyle, tabindex, tabIndex, ...restAttrs } = attrs;
|
|
4517
|
-
const isExpanded = props.expanded
|
|
4751
|
+
const isExpanded = (_a = props.expanded) !== null && _a !== void 0 ? _a : innerExpanded.value;
|
|
4518
4752
|
const cssVars = {
|
|
4519
4753
|
"--cc-ellipsis-collapsed-height": `calc(var(--cc-ellipsis-line-height) * ${Math.max(1, Math.floor(props.lines))})`,
|
|
4520
4754
|
"--cc-ellipsis-expanded-max-height": typeof props.expandedMaxHeight === "number"
|
|
@@ -4543,7 +4777,7 @@ const ClassEllipsisText = /*#__PURE__*/ defineComponent({
|
|
|
4543
4777
|
toggleExpanded();
|
|
4544
4778
|
},
|
|
4545
4779
|
onKeydown: (event) => {
|
|
4546
|
-
invokeAttrHandler(onKeydown
|
|
4780
|
+
invokeAttrHandler(onKeydown !== null && onKeydown !== void 0 ? onKeydown : onKeyDown, event);
|
|
4547
4781
|
if (!props.expandable ||
|
|
4548
4782
|
event.defaultPrevented ||
|
|
4549
4783
|
(event.key !== "Enter" && event.key !== " "))
|
|
@@ -4554,8 +4788,8 @@ const ClassEllipsisText = /*#__PURE__*/ defineComponent({
|
|
|
4554
4788
|
role: props.expandable ? "button" : role,
|
|
4555
4789
|
style: [attrStyle, cssVars],
|
|
4556
4790
|
tabindex: props.expandable
|
|
4557
|
-
? (tabindex
|
|
4558
|
-
: (tabindex
|
|
4791
|
+
? ((_b = tabindex !== null && tabindex !== void 0 ? tabindex : tabIndex) !== null && _b !== void 0 ? _b : 0)
|
|
4792
|
+
: (tabindex !== null && tabindex !== void 0 ? tabindex : tabIndex),
|
|
4559
4793
|
}, [h("span", { class: props.contentClass }, String(props.text))]);
|
|
4560
4794
|
};
|
|
4561
4795
|
},
|
|
@@ -4653,12 +4887,13 @@ const ClassMarquee = /*#__PURE__*/ defineComponent({
|
|
|
4653
4887
|
return { "data-clickable": false };
|
|
4654
4888
|
return {
|
|
4655
4889
|
"data-clickable": true,
|
|
4656
|
-
onClick: (event) => props.onItemClick
|
|
4890
|
+
onClick: (event) => { var _a; return (_a = props.onItemClick) === null || _a === void 0 ? void 0 : _a.call(props, item, index, event); },
|
|
4657
4891
|
onKeydown: (event) => {
|
|
4892
|
+
var _a;
|
|
4658
4893
|
if (event.key !== "Enter" && event.key !== " ")
|
|
4659
4894
|
return;
|
|
4660
4895
|
event.preventDefault();
|
|
4661
|
-
props.onItemClick
|
|
4896
|
+
(_a = props.onItemClick) === null || _a === void 0 ? void 0 : _a.call(props, item, index, event);
|
|
4662
4897
|
},
|
|
4663
4898
|
role: "button",
|
|
4664
4899
|
tabindex: 0,
|
|
@@ -4667,12 +4902,16 @@ const ClassMarquee = /*#__PURE__*/ defineComponent({
|
|
|
4667
4902
|
const renderGroup = (items, groupIndex) => h("span", {
|
|
4668
4903
|
"aria-hidden": groupIndex > 0,
|
|
4669
4904
|
class: props.groupClass,
|
|
4670
|
-
}, items.map((item, index) =>
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4905
|
+
}, items.map((item, index) => {
|
|
4906
|
+
var _a, _b;
|
|
4907
|
+
return h("span", {
|
|
4908
|
+
class: props.itemClass,
|
|
4909
|
+
key: `${groupIndex}-${item.key}`,
|
|
4910
|
+
...getItemInteractiveProps(item, index),
|
|
4911
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, { index, item })) !== null && _b !== void 0 ? _b : item.text);
|
|
4912
|
+
}));
|
|
4675
4913
|
const renderStepItem = (items, index, itemClass, phase) => {
|
|
4914
|
+
var _a, _b;
|
|
4676
4915
|
const item = items[index];
|
|
4677
4916
|
if (!item)
|
|
4678
4917
|
return null;
|
|
@@ -4681,7 +4920,7 @@ const ClassMarquee = /*#__PURE__*/ defineComponent({
|
|
|
4681
4920
|
"data-phase": phase,
|
|
4682
4921
|
key: `${phase}-${item.key}-${activeIndex.value}`,
|
|
4683
4922
|
...getItemInteractiveProps(item, index),
|
|
4684
|
-
}, slots.default
|
|
4923
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, { index, item })) !== null && _b !== void 0 ? _b : item.text);
|
|
4685
4924
|
};
|
|
4686
4925
|
const resolveState = () => new MarqueeController(props.items, {
|
|
4687
4926
|
direction: props.direction,
|
|
@@ -4734,6 +4973,7 @@ const ClassMarquee = /*#__PURE__*/ defineComponent({
|
|
|
4734
4973
|
clearPreviousTimer();
|
|
4735
4974
|
});
|
|
4736
4975
|
return () => {
|
|
4976
|
+
var _a;
|
|
4737
4977
|
const state = resolveState();
|
|
4738
4978
|
const isStepMarquee = state.direction === "vertical" && state.verticalMode === "step";
|
|
4739
4979
|
return h("div", {
|
|
@@ -4744,7 +4984,7 @@ const ClassMarquee = /*#__PURE__*/ defineComponent({
|
|
|
4744
4984
|
"data-direction": state.direction,
|
|
4745
4985
|
"data-pause-on-hover": state.pauseOnHover,
|
|
4746
4986
|
"data-reverse": state.reverse,
|
|
4747
|
-
"data-step-animation": state.stepAnimation
|
|
4987
|
+
"data-step-animation": (_a = state.stepAnimation) !== null && _a !== void 0 ? _a : "none",
|
|
4748
4988
|
"data-vertical-mode": state.verticalMode,
|
|
4749
4989
|
role: "region",
|
|
4750
4990
|
style: {
|
|
@@ -4881,7 +5121,7 @@ const ClassVideoPlayer = /*#__PURE__*/ defineComponent({
|
|
|
4881
5121
|
},
|
|
4882
5122
|
});
|
|
4883
5123
|
function resolveVideoDetailContainer(container) {
|
|
4884
|
-
return typeof container === "function" ? container() : (container
|
|
5124
|
+
return typeof container === "function" ? container() : (container !== null && container !== void 0 ? container : null);
|
|
4885
5125
|
}
|
|
4886
5126
|
function videoDetailContainerRect(container) {
|
|
4887
5127
|
const element = resolveVideoDetailContainer(container);
|
|
@@ -4924,12 +5164,13 @@ function videoDetailTargetRect(sourceRect, container) {
|
|
|
4924
5164
|
};
|
|
4925
5165
|
}
|
|
4926
5166
|
function videoDetailOverlayStyle(backdropColor, container) {
|
|
5167
|
+
var _a;
|
|
4927
5168
|
const rect = videoDetailContainerRect(container);
|
|
4928
5169
|
return {
|
|
4929
5170
|
"--cc-video-detail-backdrop-color": backdropColor,
|
|
4930
5171
|
...(rect
|
|
4931
5172
|
? {
|
|
4932
|
-
borderRadius: rect.borderRadius
|
|
5173
|
+
borderRadius: (_a = rect.borderRadius) !== null && _a !== void 0 ? _a : 0,
|
|
4933
5174
|
height: `${rect.height}px`,
|
|
4934
5175
|
left: "0px",
|
|
4935
5176
|
overflow: "hidden",
|
|
@@ -4950,7 +5191,7 @@ function videoDetailStyle(state, full, container) {
|
|
|
4950
5191
|
top: state.sourceRect.top - containerRect.top,
|
|
4951
5192
|
}
|
|
4952
5193
|
: state.sourceRect;
|
|
4953
|
-
const rect = full ? target : (sourceRect
|
|
5194
|
+
const rect = full ? target : (sourceRect !== null && sourceRect !== void 0 ? sourceRect : target);
|
|
4954
5195
|
return {
|
|
4955
5196
|
"--cc-video-detail-duration": `${state.animationDuration}ms`,
|
|
4956
5197
|
"--cc-video-detail-backdrop-color": state.backdropColor,
|
|
@@ -5105,29 +5346,36 @@ const ClassVideoDetailTransition = /*#__PURE__*/ defineComponent({
|
|
|
5105
5346
|
});
|
|
5106
5347
|
async function importOptionalLibrary(name) {
|
|
5107
5348
|
try {
|
|
5108
|
-
|
|
5349
|
+
if (name === "xlsx")
|
|
5350
|
+
return await import('xlsx');
|
|
5351
|
+
if (name === "mammoth")
|
|
5352
|
+
return await import('mammoth');
|
|
5353
|
+
return null;
|
|
5109
5354
|
}
|
|
5110
|
-
catch {
|
|
5355
|
+
catch (_a) {
|
|
5111
5356
|
return null;
|
|
5112
5357
|
}
|
|
5113
5358
|
}
|
|
5114
5359
|
function getGlobalLibrary(name) {
|
|
5115
|
-
|
|
5116
|
-
|
|
5360
|
+
var _a;
|
|
5361
|
+
const record = getClassKitGlobal();
|
|
5362
|
+
return record ? ((_a = record[name]) !== null && _a !== void 0 ? _a : null) : null;
|
|
5117
5363
|
}
|
|
5118
5364
|
async function renderExcelFileWithExternalLibrary(file) {
|
|
5119
|
-
|
|
5365
|
+
var _a, _b;
|
|
5366
|
+
const xlsx = (_a = getGlobalLibrary("XLSX")) !== null && _a !== void 0 ? _a : (await importOptionalLibrary("xlsx"));
|
|
5120
5367
|
if (!xlsx)
|
|
5121
5368
|
throw new Error("Excel local preview requires xlsx. Install it or load it from CDN.");
|
|
5122
5369
|
const workbook = xlsx.read(await file.arrayBuffer(), { type: "array" });
|
|
5123
|
-
const sheetName = workbook.SheetNames
|
|
5370
|
+
const sheetName = (_b = workbook.SheetNames) === null || _b === void 0 ? void 0 : _b[0];
|
|
5124
5371
|
const sheet = sheetName ? workbook.Sheets[sheetName] : undefined;
|
|
5125
5372
|
if (!sheet)
|
|
5126
5373
|
return '<div class="cc-file-preview__local-empty">Empty workbook</div>';
|
|
5127
5374
|
return xlsx.utils.sheet_to_html(sheet, { editable: false });
|
|
5128
5375
|
}
|
|
5129
5376
|
async function renderWordFileWithExternalLibrary(file) {
|
|
5130
|
-
|
|
5377
|
+
var _a;
|
|
5378
|
+
const mammoth = (_a = getGlobalLibrary("mammoth")) !== null && _a !== void 0 ? _a : (await importOptionalLibrary("mammoth"));
|
|
5131
5379
|
if (!mammoth)
|
|
5132
5380
|
throw new Error("Word local preview requires mammoth. Install it or load it from CDN.");
|
|
5133
5381
|
const result = await mammoth.convertToHtml({
|
|
@@ -5157,7 +5405,8 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5157
5405
|
},
|
|
5158
5406
|
emits: ["pageChange", "update:currentPage"],
|
|
5159
5407
|
setup(props, { attrs, emit }) {
|
|
5160
|
-
|
|
5408
|
+
var _a;
|
|
5409
|
+
const innerPage = ref((_a = props.currentPage) !== null && _a !== void 0 ? _a : 1);
|
|
5161
5410
|
const objectUrl = ref("");
|
|
5162
5411
|
const localContent = ref("");
|
|
5163
5412
|
const localError = ref("");
|
|
@@ -5210,6 +5459,7 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5210
5459
|
props.renderLocalPpt,
|
|
5211
5460
|
props.renderLocalWord,
|
|
5212
5461
|
], async () => {
|
|
5462
|
+
var _a, _b, _c, _d;
|
|
5213
5463
|
const file = props.file;
|
|
5214
5464
|
if (!file) {
|
|
5215
5465
|
localContent.value = "";
|
|
@@ -5217,8 +5467,8 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5217
5467
|
return;
|
|
5218
5468
|
}
|
|
5219
5469
|
const state = new FilePreviewController({
|
|
5220
|
-
currentPage: props.currentPage
|
|
5221
|
-
fileName: props.fileName
|
|
5470
|
+
currentPage: (_a = props.currentPage) !== null && _a !== void 0 ? _a : innerPage.value,
|
|
5471
|
+
fileName: (_b = props.fileName) !== null && _b !== void 0 ? _b : file.name,
|
|
5222
5472
|
pageCount: props.pageCount,
|
|
5223
5473
|
src: objectUrl.value || props.src || "",
|
|
5224
5474
|
type: props.type,
|
|
@@ -5236,9 +5486,9 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5236
5486
|
localError.value = "";
|
|
5237
5487
|
try {
|
|
5238
5488
|
const renderer = state.type === "excel"
|
|
5239
|
-
? (props.renderLocalExcel
|
|
5489
|
+
? ((_c = props.renderLocalExcel) !== null && _c !== void 0 ? _c : renderExcelFileWithExternalLibrary)
|
|
5240
5490
|
: state.type === "word"
|
|
5241
|
-
? (props.renderLocalWord
|
|
5491
|
+
? ((_d = props.renderLocalWord) !== null && _d !== void 0 ? _d : renderWordFileWithExternalLibrary)
|
|
5242
5492
|
: props.renderLocalPpt;
|
|
5243
5493
|
if (!renderer)
|
|
5244
5494
|
throw new Error("PPT/PPTX 本地预览需要传入 renderLocalPpt,或先转换成 PDF 文件后按 PDF 预览。");
|
|
@@ -5259,10 +5509,11 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5259
5509
|
URL.revokeObjectURL(objectUrl.value);
|
|
5260
5510
|
});
|
|
5261
5511
|
return () => {
|
|
5262
|
-
|
|
5512
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5513
|
+
const activePage = (_a = props.currentPage) !== null && _a !== void 0 ? _a : innerPage.value;
|
|
5263
5514
|
const controller = new FilePreviewController({
|
|
5264
5515
|
currentPage: activePage,
|
|
5265
|
-
fileName: props.fileName
|
|
5516
|
+
fileName: (_b = props.fileName) !== null && _b !== void 0 ? _b : (_c = props.file) === null || _c === void 0 ? void 0 : _c.name,
|
|
5266
5517
|
pageCount: props.pageCount,
|
|
5267
5518
|
src: objectUrl.value || props.src || "",
|
|
5268
5519
|
type: props.type,
|
|
@@ -5304,7 +5555,7 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5304
5555
|
h("div", { class: "cc-file-preview__toolbar" }, [
|
|
5305
5556
|
h("div", { class: "cc-file-preview__meta" }, [
|
|
5306
5557
|
h("span", { class: "cc-file-preview__badge" }, state.type.toUpperCase()),
|
|
5307
|
-
h("strong", null, props.title
|
|
5558
|
+
h("strong", null, (_d = props.title) !== null && _d !== void 0 ? _d : state.title),
|
|
5308
5559
|
h("small", null, state.mode === "office"
|
|
5309
5560
|
? "Office viewer"
|
|
5310
5561
|
: state.mode === "pdf"
|
|
@@ -5346,7 +5597,7 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5346
5597
|
localError.value
|
|
5347
5598
|
? h("div", { class: "cc-file-preview__empty" }, [
|
|
5348
5599
|
h("strong", null, "本地预览依赖未就绪"),
|
|
5349
|
-
h("span", null, props.localUnsupportedText
|
|
5600
|
+
h("span", null, (_e = props.localUnsupportedText) !== null && _e !== void 0 ? _e : localError.value),
|
|
5350
5601
|
])
|
|
5351
5602
|
: h("div", {
|
|
5352
5603
|
class: "cc-file-preview__local-html",
|
|
@@ -5367,7 +5618,7 @@ const ClassFilePreview = /*#__PURE__*/ defineComponent({
|
|
|
5367
5618
|
class: "cc-file-preview__frame",
|
|
5368
5619
|
key: state.previewUrl,
|
|
5369
5620
|
src: state.previewUrl,
|
|
5370
|
-
title: props.title
|
|
5621
|
+
title: (_f = props.title) !== null && _f !== void 0 ? _f : state.title,
|
|
5371
5622
|
onLoad: () => hidePreviewLoading(),
|
|
5372
5623
|
}),
|
|
5373
5624
|
h("div", {
|
|
@@ -5426,7 +5677,7 @@ const ClassCanvasImage = /*#__PURE__*/ defineComponent({
|
|
|
5426
5677
|
};
|
|
5427
5678
|
expose({
|
|
5428
5679
|
render,
|
|
5429
|
-
toDataURL: (type = "image/png", quality) => canvasRef.value
|
|
5680
|
+
toDataURL: (type = "image/png", quality) => { var _a, _b; return (_b = (_a = canvasRef.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality)) !== null && _b !== void 0 ? _b : ""; },
|
|
5430
5681
|
});
|
|
5431
5682
|
onMounted(() => {
|
|
5432
5683
|
void render();
|
|
@@ -5483,12 +5734,13 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5483
5734
|
"update:nodes",
|
|
5484
5735
|
],
|
|
5485
5736
|
setup(props, { attrs, emit }) {
|
|
5737
|
+
var _a, _b;
|
|
5486
5738
|
const innerMode = ref(props.defaultMode);
|
|
5487
5739
|
const innerNodes = ref(props.defaultNodes);
|
|
5488
5740
|
const controller = new CanvasEditorController({
|
|
5489
5741
|
disabled: props.disabled,
|
|
5490
|
-
mode: props.mode
|
|
5491
|
-
nodes: props.nodes
|
|
5742
|
+
mode: (_a = props.mode) !== null && _a !== void 0 ? _a : innerMode.value,
|
|
5743
|
+
nodes: (_b = props.nodes) !== null && _b !== void 0 ? _b : innerNodes.value,
|
|
5492
5744
|
readOnly: props.readOnly,
|
|
5493
5745
|
rootId: props.rootId,
|
|
5494
5746
|
});
|
|
@@ -5508,10 +5760,10 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5508
5760
|
}
|
|
5509
5761
|
};
|
|
5510
5762
|
const centerMindRoot = (nextState = controller.getState()) => {
|
|
5763
|
+
var _a, _b, _c, _d, _e;
|
|
5511
5764
|
if (nextState.mode !== "mind" || didCenterMind.value || !mindRef.value)
|
|
5512
5765
|
return;
|
|
5513
|
-
const rootNode = nextState.nodes.find((node) => node.id === nextState.rootId)
|
|
5514
|
-
nextState.nodes[0];
|
|
5766
|
+
const rootNode = (_a = nextState.nodes.find((node) => node.id === nextState.rootId)) !== null && _a !== void 0 ? _a : nextState.nodes[0];
|
|
5515
5767
|
if (!rootNode)
|
|
5516
5768
|
return;
|
|
5517
5769
|
const rect = mindRef.value.getBoundingClientRect();
|
|
@@ -5520,8 +5772,8 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5520
5772
|
didCenterMind.value = true;
|
|
5521
5773
|
commit(controller.updateOptions({
|
|
5522
5774
|
viewport: {
|
|
5523
|
-
x: rect.width / 2 - (rootNode.x
|
|
5524
|
-
y: rect.height / 2 - (rootNode.y
|
|
5775
|
+
x: rect.width / 2 - ((_b = rootNode.x) !== null && _b !== void 0 ? _b : 0) - ((_c = rootNode.width) !== null && _c !== void 0 ? _c : 0) / 2,
|
|
5776
|
+
y: rect.height / 2 - ((_d = rootNode.y) !== null && _d !== void 0 ? _d : 0) - ((_e = rootNode.height) !== null && _e !== void 0 ? _e : 0) / 2,
|
|
5525
5777
|
},
|
|
5526
5778
|
}));
|
|
5527
5779
|
};
|
|
@@ -5532,10 +5784,11 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5532
5784
|
props.readOnly,
|
|
5533
5785
|
props.rootId,
|
|
5534
5786
|
], () => {
|
|
5787
|
+
var _a, _b;
|
|
5535
5788
|
const nextState = controller.updateOptions({
|
|
5536
5789
|
disabled: props.disabled,
|
|
5537
|
-
mode: props.mode
|
|
5538
|
-
nodes: props.nodes
|
|
5790
|
+
mode: (_a = props.mode) !== null && _a !== void 0 ? _a : innerMode.value,
|
|
5791
|
+
nodes: (_b = props.nodes) !== null && _b !== void 0 ? _b : innerNodes.value,
|
|
5539
5792
|
readOnly: props.readOnly,
|
|
5540
5793
|
rootId: props.rootId,
|
|
5541
5794
|
});
|
|
@@ -5593,11 +5846,15 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5593
5846
|
event.stopPropagation();
|
|
5594
5847
|
drag.value = null;
|
|
5595
5848
|
};
|
|
5596
|
-
const getMindTitleRows = (node) =>
|
|
5597
|
-
|
|
5849
|
+
const getMindTitleRows = (node) => {
|
|
5850
|
+
var _a;
|
|
5851
|
+
return Math.max(1, Math.ceil(String(node.title || " ").length /
|
|
5852
|
+
Math.max(1, Math.floor((((_a = node.width) !== null && _a !== void 0 ? _a : 160) - 24) / 7.2))));
|
|
5853
|
+
};
|
|
5598
5854
|
const getMindContentRows = (node) => {
|
|
5599
|
-
|
|
5600
|
-
const
|
|
5855
|
+
var _a, _b;
|
|
5856
|
+
const charsPerLine = Math.max(1, Math.floor((((_a = node.width) !== null && _a !== void 0 ? _a : 160) - 24) / 7.2));
|
|
5857
|
+
const content = String((_b = node.content) !== null && _b !== void 0 ? _b : "");
|
|
5601
5858
|
if (content.trim() === "")
|
|
5602
5859
|
return 1;
|
|
5603
5860
|
return content
|
|
@@ -5618,63 +5875,67 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5618
5875
|
event.currentTarget.blur();
|
|
5619
5876
|
}
|
|
5620
5877
|
};
|
|
5621
|
-
const renderDocumentNode = (node, nodeMap, depth = 0) =>
|
|
5622
|
-
|
|
5623
|
-
"
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5878
|
+
const renderDocumentNode = (node, nodeMap, depth = 0) => {
|
|
5879
|
+
var _a, _b, _c, _d;
|
|
5880
|
+
return h("section", {
|
|
5881
|
+
class: "cc-canvas-editor__doc-node",
|
|
5882
|
+
"data-depth": depth,
|
|
5883
|
+
"data-editing": editingId.value === node.id,
|
|
5884
|
+
key: node.id,
|
|
5885
|
+
}, [
|
|
5886
|
+
h("div", { class: "cc-canvas-editor__doc-head" }, [
|
|
5887
|
+
h("input", {
|
|
5888
|
+
class: "cc-canvas-editor__doc-title",
|
|
5889
|
+
disabled: props.disabled,
|
|
5890
|
+
readonly: props.readOnly,
|
|
5891
|
+
value: node.title,
|
|
5892
|
+
onBlur: () => blurNode(node.id),
|
|
5893
|
+
onFocus: () => focusNode(node.id),
|
|
5894
|
+
onInput: (event) => updateNode(node.id, {
|
|
5895
|
+
title: event.currentTarget.value,
|
|
5896
|
+
}),
|
|
5897
|
+
onKeydown: handleTitleKeydown,
|
|
5898
|
+
onPointerdown: stopInputPointer,
|
|
5899
|
+
}),
|
|
5900
|
+
h("span", { class: "cc-canvas-editor__doc-actions" }, [
|
|
5901
|
+
h("button", {
|
|
5902
|
+
disabled: props.disabled || props.readOnly,
|
|
5903
|
+
type: "button",
|
|
5904
|
+
onClick: () => addNode(node.id),
|
|
5905
|
+
}, "子节点"),
|
|
5906
|
+
h("button", {
|
|
5907
|
+
disabled: props.disabled ||
|
|
5908
|
+
props.readOnly ||
|
|
5909
|
+
node.id === state.value.rootId,
|
|
5910
|
+
type: "button",
|
|
5911
|
+
onClick: () => commit(controller.removeNode(node.id), true),
|
|
5912
|
+
}, "删除"),
|
|
5913
|
+
]),
|
|
5654
5914
|
]),
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5915
|
+
h("textarea", {
|
|
5916
|
+
class: "cc-canvas-editor__doc-content",
|
|
5917
|
+
disabled: props.disabled,
|
|
5918
|
+
readonly: props.readOnly,
|
|
5919
|
+
rows: Math.max(2, Math.ceil(((_b = (_a = node.content) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) / 42)),
|
|
5920
|
+
value: (_c = node.content) !== null && _c !== void 0 ? _c : "",
|
|
5921
|
+
onBlur: () => blurNode(node.id),
|
|
5922
|
+
onFocus: () => focusNode(node.id),
|
|
5923
|
+
onInput: (event) => updateNode(node.id, {
|
|
5924
|
+
content: event.currentTarget.value,
|
|
5925
|
+
}),
|
|
5926
|
+
onKeydown: handleContentKeydown,
|
|
5927
|
+
onPointerdown: stopInputPointer,
|
|
5666
5928
|
}),
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
}),
|
|
5674
|
-
]);
|
|
5929
|
+
...((_d = node.children) !== null && _d !== void 0 ? _d : []).map((childId) => {
|
|
5930
|
+
const child = nodeMap.get(childId);
|
|
5931
|
+
return child ? renderDocumentNode(child, nodeMap, depth + 1) : null;
|
|
5932
|
+
}),
|
|
5933
|
+
]);
|
|
5934
|
+
};
|
|
5675
5935
|
return () => {
|
|
5936
|
+
var _a;
|
|
5676
5937
|
const nodeMap = new Map(state.value.nodes.map((node) => [node.id, node]));
|
|
5677
|
-
const root = nodeMap.get(state.value.rootId)
|
|
5938
|
+
const root = (_a = nodeMap.get(state.value.rootId)) !== null && _a !== void 0 ? _a : state.value.nodes[0];
|
|
5678
5939
|
return h("div", {
|
|
5679
5940
|
...attrs,
|
|
5680
5941
|
class: props.className,
|
|
@@ -5735,6 +5996,7 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5735
5996
|
class: "cc-canvas-editor__mind",
|
|
5736
5997
|
ref: mindRef,
|
|
5737
5998
|
onPointerdown: (event) => {
|
|
5999
|
+
var _a, _b;
|
|
5738
6000
|
if (props.disabled ||
|
|
5739
6001
|
event.target.closest(".cc-canvas-editor__card"))
|
|
5740
6002
|
return;
|
|
@@ -5743,7 +6005,7 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5743
6005
|
lastY: event.clientY,
|
|
5744
6006
|
type: "pan",
|
|
5745
6007
|
};
|
|
5746
|
-
event.currentTarget.setPointerCapture
|
|
6008
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
5747
6009
|
},
|
|
5748
6010
|
onPointermove: (event) => {
|
|
5749
6011
|
if (!drag.value || drag.value.type !== "pan")
|
|
@@ -5771,83 +6033,87 @@ const ClassCanvasEditor = /*#__PURE__*/ defineComponent({
|
|
|
5771
6033
|
d: link.d,
|
|
5772
6034
|
key: `${link.from}-${link.to}`,
|
|
5773
6035
|
}))),
|
|
5774
|
-
...state.value.nodes.map((node) =>
|
|
5775
|
-
|
|
5776
|
-
"
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
6036
|
+
...state.value.nodes.map((node) => {
|
|
6037
|
+
var _a;
|
|
6038
|
+
return h("article", {
|
|
6039
|
+
class: "cc-canvas-editor__card",
|
|
6040
|
+
"data-editing": editingId.value === node.id,
|
|
6041
|
+
"data-selected": state.value.selectedId === node.id,
|
|
6042
|
+
key: node.id,
|
|
6043
|
+
style: {
|
|
6044
|
+
minHeight: `${node.height}px`,
|
|
6045
|
+
transform: `translate3d(${node.x}px, ${node.y}px, 0)`,
|
|
6046
|
+
width: `${node.width}px`,
|
|
6047
|
+
},
|
|
6048
|
+
onPointerdown: (event) => {
|
|
6049
|
+
var _a, _b;
|
|
6050
|
+
if (props.disabled || props.readOnly)
|
|
6051
|
+
return;
|
|
6052
|
+
event.stopPropagation();
|
|
6053
|
+
if (event.target.closest("input, textarea")) {
|
|
6054
|
+
focusNode(node.id);
|
|
6055
|
+
return;
|
|
6056
|
+
}
|
|
6057
|
+
drag.value = {
|
|
6058
|
+
id: node.id,
|
|
6059
|
+
lastX: event.clientX,
|
|
6060
|
+
lastY: event.clientY,
|
|
6061
|
+
type: "node",
|
|
6062
|
+
};
|
|
6063
|
+
commit(controller.select(node.id));
|
|
6064
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
6065
|
+
},
|
|
6066
|
+
onPointermove: (event) => {
|
|
6067
|
+
if (!drag.value ||
|
|
6068
|
+
drag.value.type !== "node" ||
|
|
6069
|
+
drag.value.id !== node.id)
|
|
6070
|
+
return;
|
|
6071
|
+
const deltaX = event.clientX - drag.value.lastX;
|
|
6072
|
+
const deltaY = event.clientY - drag.value.lastY;
|
|
6073
|
+
drag.value.lastX = event.clientX;
|
|
6074
|
+
drag.value.lastY = event.clientY;
|
|
6075
|
+
commit(controller.moveNode({
|
|
6076
|
+
deltaX,
|
|
6077
|
+
deltaY,
|
|
6078
|
+
id: node.id,
|
|
6079
|
+
}), true);
|
|
6080
|
+
},
|
|
6081
|
+
onPointerup: () => {
|
|
6082
|
+
drag.value = null;
|
|
6083
|
+
},
|
|
6084
|
+
onPointercancel: () => {
|
|
6085
|
+
drag.value = null;
|
|
6086
|
+
},
|
|
6087
|
+
}, [
|
|
6088
|
+
h("textarea", {
|
|
6089
|
+
class: "cc-canvas-editor__card-title",
|
|
6090
|
+
disabled: props.disabled,
|
|
6091
|
+
readonly: props.readOnly,
|
|
6092
|
+
rows: getMindTitleRows(node),
|
|
6093
|
+
value: node.title,
|
|
6094
|
+
onBlur: () => blurNode(node.id),
|
|
6095
|
+
onFocus: () => focusNode(node.id),
|
|
6096
|
+
onInput: (event) => updateNode(node.id, {
|
|
6097
|
+
title: event.currentTarget.value,
|
|
6098
|
+
}),
|
|
6099
|
+
onKeydown: handleTitleKeydown,
|
|
6100
|
+
onPointerdown: stopInputPointer,
|
|
5833
6101
|
}),
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
6102
|
+
h("textarea", {
|
|
6103
|
+
disabled: props.disabled,
|
|
6104
|
+
readonly: props.readOnly,
|
|
6105
|
+
rows: getMindContentRows(node),
|
|
6106
|
+
value: (_a = node.content) !== null && _a !== void 0 ? _a : "",
|
|
6107
|
+
onBlur: () => blurNode(node.id),
|
|
6108
|
+
onFocus: () => focusNode(node.id),
|
|
6109
|
+
onInput: (event) => updateNode(node.id, {
|
|
6110
|
+
content: event.currentTarget.value,
|
|
6111
|
+
}),
|
|
6112
|
+
onKeydown: handleContentKeydown,
|
|
6113
|
+
onPointerdown: stopInputPointer,
|
|
5846
6114
|
}),
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
}),
|
|
5850
|
-
])),
|
|
6115
|
+
]);
|
|
6116
|
+
}),
|
|
5851
6117
|
]),
|
|
5852
6118
|
]),
|
|
5853
6119
|
]);
|
|
@@ -5880,9 +6146,10 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5880
6146
|
},
|
|
5881
6147
|
emits: ["change", "changeEnd", "update:value"],
|
|
5882
6148
|
setup(props, { attrs, emit }) {
|
|
6149
|
+
var _a, _b, _c;
|
|
5883
6150
|
const form = inject(formSymbol, null);
|
|
5884
6151
|
const formInteractivity = useFormInteractivity();
|
|
5885
|
-
const formState = shallowRef(form
|
|
6152
|
+
const formState = shallowRef((_a = form === null || form === void 0 ? void 0 : form.getState()) !== null && _a !== void 0 ? _a : null);
|
|
5886
6153
|
const trackRef = ref(null);
|
|
5887
6154
|
const thumbRef = ref(null);
|
|
5888
6155
|
const dragging = ref(false);
|
|
@@ -5891,8 +6158,8 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5891
6158
|
? Math.max(safeMin.value, props.max)
|
|
5892
6159
|
: Math.max(safeMin.value, 100));
|
|
5893
6160
|
const safeStep = computed(() => Number.isFinite(props.step) && props.step > 0 ? props.step : 1);
|
|
5894
|
-
const formField = computed(() => props.name ? formState.value
|
|
5895
|
-
const formFieldValue = computed(() => Number(formField.value
|
|
6161
|
+
const formField = computed(() => { var _a; return props.name ? (_a = formState.value) === null || _a === void 0 ? void 0 : _a.fields[props.name] : undefined; });
|
|
6162
|
+
const formFieldValue = computed(() => { var _a; return Number((_a = formField.value) === null || _a === void 0 ? void 0 : _a.value); });
|
|
5896
6163
|
const usesFormField = computed(() => Boolean(form && props.name));
|
|
5897
6164
|
const safeValue = computed(() => usesFormField.value && Number.isFinite(formFieldValue.value)
|
|
5898
6165
|
? formFieldValue.value
|
|
@@ -5903,33 +6170,37 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5903
6170
|
const fieldInitialValue = computed(() => Number.isFinite(props.initialValue)
|
|
5904
6171
|
? props.initialValue
|
|
5905
6172
|
: safeDefaultValue.value);
|
|
5906
|
-
const interactivity = computed(() =>
|
|
6173
|
+
const interactivity = computed(() => {
|
|
6174
|
+
var _a;
|
|
6175
|
+
return resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
6176
|
+
});
|
|
5907
6177
|
const locked = computed(() => interactivity.value.disabled || interactivity.value.readOnly);
|
|
5908
6178
|
const controller = new ProgressController({
|
|
5909
6179
|
disabled: locked.value,
|
|
5910
6180
|
max: safeMax.value,
|
|
5911
6181
|
min: safeMin.value,
|
|
5912
6182
|
step: safeStep.value,
|
|
5913
|
-
value: safeValue.value
|
|
6183
|
+
value: (_c = (_b = safeValue.value) !== null && _b !== void 0 ? _b : fieldInitialValue.value) !== null && _c !== void 0 ? _c : safeMin.value,
|
|
5914
6184
|
});
|
|
5915
6185
|
const state = ref(controller.getState());
|
|
5916
6186
|
let unsubscribeField;
|
|
5917
6187
|
let unsubscribeForm;
|
|
5918
6188
|
onMounted(() => {
|
|
6189
|
+
var _a;
|
|
5919
6190
|
if (!form || !props.name)
|
|
5920
6191
|
return;
|
|
5921
6192
|
unsubscribeForm = form.subscribe((nextState) => {
|
|
5922
6193
|
formState.value = nextState;
|
|
5923
6194
|
});
|
|
5924
6195
|
unsubscribeField = form.registerField(props.name, {
|
|
5925
|
-
initialValue: fieldInitialValue.value
|
|
6196
|
+
initialValue: (_a = fieldInitialValue.value) !== null && _a !== void 0 ? _a : safeMin.value,
|
|
5926
6197
|
rules: props.rules,
|
|
5927
6198
|
validateOn: props.validateOn,
|
|
5928
6199
|
});
|
|
5929
6200
|
});
|
|
5930
6201
|
onBeforeUnmount(() => {
|
|
5931
|
-
unsubscribeField
|
|
5932
|
-
unsubscribeForm
|
|
6202
|
+
unsubscribeField === null || unsubscribeField === void 0 ? void 0 : unsubscribeField();
|
|
6203
|
+
unsubscribeForm === null || unsubscribeForm === void 0 ? void 0 : unsubscribeForm();
|
|
5933
6204
|
});
|
|
5934
6205
|
watch(() => [
|
|
5935
6206
|
locked.value,
|
|
@@ -5939,12 +6210,13 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5939
6210
|
props.value,
|
|
5940
6211
|
formFieldValue.value,
|
|
5941
6212
|
], () => {
|
|
6213
|
+
var _a;
|
|
5942
6214
|
state.value = controller.updateOptions({
|
|
5943
6215
|
disabled: locked.value,
|
|
5944
6216
|
max: safeMax.value,
|
|
5945
6217
|
min: safeMin.value,
|
|
5946
6218
|
step: safeStep.value,
|
|
5947
|
-
value: safeValue.value
|
|
6219
|
+
value: (_a = safeValue.value) !== null && _a !== void 0 ? _a : state.value.value,
|
|
5948
6220
|
});
|
|
5949
6221
|
});
|
|
5950
6222
|
const commitValue = (nextValue, end = false) => {
|
|
@@ -5957,10 +6229,11 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5957
6229
|
emit("changeEnd", state.value.value);
|
|
5958
6230
|
};
|
|
5959
6231
|
const updateFromClientX = (clientX, end = false) => {
|
|
5960
|
-
|
|
6232
|
+
var _a, _b, _c;
|
|
6233
|
+
const rect = (_a = trackRef.value) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
5961
6234
|
if (!rect)
|
|
5962
6235
|
return;
|
|
5963
|
-
state.value = controller.valueFromClientX(clientX, rect, thumbRef.value
|
|
6236
|
+
state.value = controller.valueFromClientX(clientX, rect, (_c = (_b = thumbRef.value) === null || _b === void 0 ? void 0 : _b.offsetWidth) !== null && _c !== void 0 ? _c : 0);
|
|
5964
6237
|
if (form && props.name)
|
|
5965
6238
|
void form.setValue(props.name, state.value.value);
|
|
5966
6239
|
emit("update:value", state.value.value);
|
|
@@ -5969,7 +6242,8 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
5969
6242
|
emit("changeEnd", state.value.value);
|
|
5970
6243
|
};
|
|
5971
6244
|
return () => {
|
|
5972
|
-
|
|
6245
|
+
var _a, _b, _c;
|
|
6246
|
+
const errors = (_b = (_a = formField.value) === null || _a === void 0 ? void 0 : _a.errors) !== null && _b !== void 0 ? _b : [];
|
|
5973
6247
|
const errorId = props.name ? `${props.name}-error` : undefined;
|
|
5974
6248
|
const progress = h("div", {
|
|
5975
6249
|
...attrs,
|
|
@@ -6000,12 +6274,13 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
6000
6274
|
commitValue(state.value.max);
|
|
6001
6275
|
},
|
|
6002
6276
|
onPointerdown: (event) => {
|
|
6277
|
+
var _a, _b;
|
|
6003
6278
|
if (locked.value || !props.interactive)
|
|
6004
6279
|
return;
|
|
6005
6280
|
event.preventDefault();
|
|
6006
6281
|
dragging.value = true;
|
|
6007
6282
|
updateFromClientX(event.clientX);
|
|
6008
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6283
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
6009
6284
|
},
|
|
6010
6285
|
onPointermove: (event) => {
|
|
6011
6286
|
if (!props.interactive ||
|
|
@@ -6016,10 +6291,11 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
6016
6291
|
updateFromClientX(event.clientX);
|
|
6017
6292
|
},
|
|
6018
6293
|
onPointerup: (event) => {
|
|
6294
|
+
var _a, _b;
|
|
6019
6295
|
if (locked.value || !props.interactive)
|
|
6020
6296
|
return;
|
|
6021
6297
|
dragging.value = false;
|
|
6022
|
-
event.currentTarget.releasePointerCapture
|
|
6298
|
+
(_b = (_a = event.currentTarget).releasePointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
6023
6299
|
updateFromClientX(event.clientX, true);
|
|
6024
6300
|
},
|
|
6025
6301
|
onPointercancel: () => {
|
|
@@ -6051,7 +6327,7 @@ const ClassProgressBar = /*#__PURE__*/ defineComponent({
|
|
|
6051
6327
|
: null,
|
|
6052
6328
|
progress,
|
|
6053
6329
|
errorId && errors.length > 0
|
|
6054
|
-
? h("div", { class: props.errorClass
|
|
6330
|
+
? h("div", { class: (_c = props.errorClass) !== null && _c !== void 0 ? _c : "cc-field__error", id: errorId }, errors.join(","))
|
|
6055
6331
|
: null,
|
|
6056
6332
|
]);
|
|
6057
6333
|
};
|
|
@@ -6158,15 +6434,16 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6158
6434
|
},
|
|
6159
6435
|
emits: ["change", "clear", "end", "undo"],
|
|
6160
6436
|
setup(props, { attrs, emit, expose }) {
|
|
6437
|
+
var _a, _b;
|
|
6161
6438
|
const form = inject(formSymbol, null);
|
|
6162
6439
|
const formInteractivity = useFormInteractivity();
|
|
6163
|
-
const formState = shallowRef(form
|
|
6440
|
+
const formState = shallowRef((_a = form === null || form === void 0 ? void 0 : form.getState()) !== null && _a !== void 0 ? _a : null);
|
|
6164
6441
|
const canvasRef = ref(null);
|
|
6165
6442
|
const controller = new SignatureController({
|
|
6166
6443
|
disabled: Boolean(props.disabled),
|
|
6167
6444
|
lineWidth: props.lineWidth,
|
|
6168
6445
|
penColor: props.penColor,
|
|
6169
|
-
readOnly: Boolean(props.readOnly
|
|
6446
|
+
readOnly: Boolean((_b = props.readOnly) !== null && _b !== void 0 ? _b : props.readonly),
|
|
6170
6447
|
});
|
|
6171
6448
|
const state = ref(controller.getState());
|
|
6172
6449
|
let resizeObserver;
|
|
@@ -6198,24 +6475,25 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6198
6475
|
expose({
|
|
6199
6476
|
clear,
|
|
6200
6477
|
isEmpty: () => controller.getState().isEmpty,
|
|
6201
|
-
toDataURL: (type = props.exportType, quality) => canvasRef.value
|
|
6478
|
+
toDataURL: (type = props.exportType, quality) => { var _a, _b; return (_b = (_a = canvasRef.value) === null || _a === void 0 ? void 0 : _a.toDataURL(type, quality)) !== null && _b !== void 0 ? _b : ""; },
|
|
6202
6479
|
undo,
|
|
6203
6480
|
});
|
|
6204
6481
|
onMounted(() => {
|
|
6482
|
+
var _a, _b;
|
|
6205
6483
|
if (form && props.name) {
|
|
6206
6484
|
unsubscribeForm = form.subscribe((nextState) => {
|
|
6207
6485
|
formState.value = nextState;
|
|
6208
6486
|
});
|
|
6209
6487
|
unsubscribeField = form.registerField(props.name, {
|
|
6210
|
-
initialValue: props.initialValue
|
|
6488
|
+
initialValue: (_a = props.initialValue) !== null && _a !== void 0 ? _a : controller.getState(),
|
|
6211
6489
|
rules: props.rules,
|
|
6212
6490
|
validateOn: props.validateOn,
|
|
6213
6491
|
});
|
|
6214
6492
|
}
|
|
6215
6493
|
const initialStrokes = Array.isArray(props.initialValue)
|
|
6216
6494
|
? props.initialValue
|
|
6217
|
-
: props.initialValue
|
|
6218
|
-
if (initialStrokes
|
|
6495
|
+
: (_b = props.initialValue) === null || _b === void 0 ? void 0 : _b.strokes;
|
|
6496
|
+
if (initialStrokes === null || initialStrokes === void 0 ? void 0 : initialStrokes.length)
|
|
6219
6497
|
commit(controller.replaceStrokes(initialStrokes), false);
|
|
6220
6498
|
if (canvasRef.value && typeof ResizeObserver !== "undefined") {
|
|
6221
6499
|
resizeObserver = new ResizeObserver(() => redraw());
|
|
@@ -6224,13 +6502,16 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6224
6502
|
redraw();
|
|
6225
6503
|
});
|
|
6226
6504
|
onBeforeUnmount(() => {
|
|
6227
|
-
resizeObserver
|
|
6228
|
-
unsubscribeField
|
|
6229
|
-
unsubscribeForm
|
|
6230
|
-
});
|
|
6231
|
-
watch(() =>
|
|
6232
|
-
|
|
6233
|
-
|
|
6505
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
6506
|
+
unsubscribeField === null || unsubscribeField === void 0 ? void 0 : unsubscribeField();
|
|
6507
|
+
unsubscribeForm === null || unsubscribeForm === void 0 ? void 0 : unsubscribeForm();
|
|
6508
|
+
});
|
|
6509
|
+
watch(() => {
|
|
6510
|
+
var _a;
|
|
6511
|
+
return formState.value && props.name
|
|
6512
|
+
? (_a = formState.value.fields[props.name]) === null || _a === void 0 ? void 0 : _a.value
|
|
6513
|
+
: undefined;
|
|
6514
|
+
}, (nextValue) => {
|
|
6234
6515
|
if (!nextValue ||
|
|
6235
6516
|
typeof nextValue !== "object" ||
|
|
6236
6517
|
!("strokes" in nextValue))
|
|
@@ -6250,7 +6531,8 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6250
6531
|
formInteractivity.disabled.value,
|
|
6251
6532
|
formInteractivity.readOnly.value,
|
|
6252
6533
|
], () => {
|
|
6253
|
-
|
|
6534
|
+
var _a;
|
|
6535
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
6254
6536
|
commit(controller.updateOptions({
|
|
6255
6537
|
disabled: interactivity.disabled,
|
|
6256
6538
|
lineWidth: props.lineWidth,
|
|
@@ -6260,10 +6542,11 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6260
6542
|
}, { immediate: true });
|
|
6261
6543
|
watch(() => props.backgroundColor, () => redraw());
|
|
6262
6544
|
const handlePointerDown = (event) => {
|
|
6545
|
+
var _a, _b;
|
|
6263
6546
|
if (state.value.disabled || state.value.readOnly || !canvasRef.value)
|
|
6264
6547
|
return;
|
|
6265
6548
|
event.preventDefault();
|
|
6266
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6549
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
6267
6550
|
const point = signaturePointFromEvent(canvasRef.value, event);
|
|
6268
6551
|
commit(controller.beginStroke(point.x, point.y, point, point.pressure));
|
|
6269
6552
|
};
|
|
@@ -6285,11 +6568,12 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6285
6568
|
emit("end", next);
|
|
6286
6569
|
};
|
|
6287
6570
|
return () => {
|
|
6288
|
-
|
|
6571
|
+
var _a, _b, _c, _d;
|
|
6572
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
6289
6573
|
const field = props.name
|
|
6290
|
-
? formState.value
|
|
6574
|
+
? (_b = formState.value) === null || _b === void 0 ? void 0 : _b.fields[props.name]
|
|
6291
6575
|
: undefined;
|
|
6292
|
-
const errors = field
|
|
6576
|
+
const errors = (_c = field === null || field === void 0 ? void 0 : field.errors) !== null && _c !== void 0 ? _c : [];
|
|
6293
6577
|
const errorId = props.name ? `${props.name}-error` : undefined;
|
|
6294
6578
|
const signature = h("div", {
|
|
6295
6579
|
...attrs,
|
|
@@ -6350,7 +6634,7 @@ const ClassSignature = /*#__PURE__*/ defineComponent({
|
|
|
6350
6634
|
: null,
|
|
6351
6635
|
signature,
|
|
6352
6636
|
errors.length > 0 && errorId
|
|
6353
|
-
? h("span", { class: props.errorClass
|
|
6637
|
+
? h("span", { class: (_d = props.errorClass) !== null && _d !== void 0 ? _d : "cc-field__error", id: errorId }, errors[0])
|
|
6354
6638
|
: null,
|
|
6355
6639
|
]);
|
|
6356
6640
|
};
|
|
@@ -6373,18 +6657,21 @@ const ClassTimeline = /*#__PURE__*/ defineComponent({
|
|
|
6373
6657
|
direction: props.direction,
|
|
6374
6658
|
items: props.items,
|
|
6375
6659
|
}).getState();
|
|
6376
|
-
return h("ol", { ...attrs, class: props.className, "data-direction": state.direction }, state.items.map((item, index) =>
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
h("
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6660
|
+
return h("ol", { ...attrs, class: props.className, "data-direction": state.direction }, state.items.map((item, index) => {
|
|
6661
|
+
var _a, _b, _c;
|
|
6662
|
+
return h("li", {
|
|
6663
|
+
class: "cc-timeline__item",
|
|
6664
|
+
"data-status": (_a = item.status) !== null && _a !== void 0 ? _a : "pending",
|
|
6665
|
+
key: item.id,
|
|
6666
|
+
}, [
|
|
6667
|
+
h("span", { class: "cc-timeline__dot" }),
|
|
6668
|
+
h("div", { class: "cc-timeline__content" }, (_c = (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots, { index, item })) !== null && _c !== void 0 ? _c : [
|
|
6669
|
+
h("strong", item.title),
|
|
6670
|
+
item.meta ? h("span", item.meta) : null,
|
|
6671
|
+
item.description ? h("p", item.description) : null,
|
|
6672
|
+
]),
|
|
6673
|
+
]);
|
|
6674
|
+
}));
|
|
6388
6675
|
};
|
|
6389
6676
|
},
|
|
6390
6677
|
});
|
|
@@ -6430,22 +6717,24 @@ const ClassDraggable = /*#__PURE__*/ defineComponent({
|
|
|
6430
6717
|
};
|
|
6431
6718
|
};
|
|
6432
6719
|
const getLocalPoint = (event) => {
|
|
6433
|
-
|
|
6720
|
+
var _a, _b, _c;
|
|
6721
|
+
const rect = (_a = props.boundary) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
6434
6722
|
return {
|
|
6435
|
-
x: event.clientX - (rect
|
|
6436
|
-
y: event.clientY - (rect
|
|
6723
|
+
x: event.clientX - ((_b = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _b !== void 0 ? _b : 0),
|
|
6724
|
+
y: event.clientY - ((_c = rect === null || rect === void 0 ? void 0 : rect.top) !== null && _c !== void 0 ? _c : 0),
|
|
6437
6725
|
};
|
|
6438
6726
|
};
|
|
6439
6727
|
const syncTarget = (position) => {
|
|
6728
|
+
var _a, _b, _c;
|
|
6440
6729
|
const element = elementRef.value;
|
|
6441
6730
|
const target = props.target;
|
|
6442
|
-
const boundaryRect = props.boundary
|
|
6731
|
+
const boundaryRect = (_a = props.boundary) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
6443
6732
|
if (!element || !target)
|
|
6444
6733
|
return false;
|
|
6445
6734
|
const targetRect = target.getBoundingClientRect();
|
|
6446
6735
|
const nextOverTarget = controller.isOverTarget({
|
|
6447
|
-
x: position.x + (boundaryRect
|
|
6448
|
-
y: position.y + (boundaryRect
|
|
6736
|
+
x: position.x + ((_b = boundaryRect === null || boundaryRect === void 0 ? void 0 : boundaryRect.left) !== null && _b !== void 0 ? _b : 0),
|
|
6737
|
+
y: position.y + ((_c = boundaryRect === null || boundaryRect === void 0 ? void 0 : boundaryRect.top) !== null && _c !== void 0 ? _c : 0),
|
|
6449
6738
|
width: element.offsetWidth,
|
|
6450
6739
|
height: element.offsetHeight,
|
|
6451
6740
|
}, {
|
|
@@ -6494,36 +6783,40 @@ const ClassDraggable = /*#__PURE__*/ defineComponent({
|
|
|
6494
6783
|
window.removeEventListener("pointerup", handleEnd);
|
|
6495
6784
|
window.removeEventListener("pointercancel", handleEnd);
|
|
6496
6785
|
});
|
|
6497
|
-
return () =>
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6786
|
+
return () => {
|
|
6787
|
+
var _a;
|
|
6788
|
+
return h("div", {
|
|
6789
|
+
...attrs,
|
|
6790
|
+
class: props.className,
|
|
6791
|
+
"data-disabled": props.disabled,
|
|
6792
|
+
"data-dragging": state.value.dragging,
|
|
6793
|
+
"data-over-target": overTarget.value,
|
|
6794
|
+
ref: elementRef,
|
|
6795
|
+
style: {
|
|
6796
|
+
transform: `translate3d(${state.value.position.x}px, ${state.value.position.y}px, 0)`,
|
|
6797
|
+
},
|
|
6798
|
+
onPointerdown: (event) => {
|
|
6799
|
+
var _a, _b;
|
|
6800
|
+
if (props.disabled)
|
|
6801
|
+
return;
|
|
6802
|
+
syncOptions();
|
|
6803
|
+
state.value = controller.start(getLocalPoint(event), state.value.position);
|
|
6804
|
+
syncTarget(state.value.position);
|
|
6805
|
+
emit("dragStart", state.value.position);
|
|
6806
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
6807
|
+
window.addEventListener("pointermove", handleMove, {
|
|
6808
|
+
passive: true,
|
|
6809
|
+
});
|
|
6810
|
+
window.addEventListener("pointerup", handleEnd, { passive: true });
|
|
6811
|
+
window.addEventListener("pointercancel", handleEnd, {
|
|
6812
|
+
passive: true,
|
|
6813
|
+
});
|
|
6814
|
+
},
|
|
6815
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
6816
|
+
dragging: state.value.dragging,
|
|
6817
|
+
position: state.value.position,
|
|
6818
|
+
}));
|
|
6819
|
+
};
|
|
6527
6820
|
},
|
|
6528
6821
|
});
|
|
6529
6822
|
function reorderDropItems(items, fromIndex, toIndex, mode) {
|
|
@@ -6570,7 +6863,13 @@ function readDragDropPreviewStyleVars(element) {
|
|
|
6570
6863
|
"--cc-drag-drop-preview-shadow": read("--cc-drag-drop-preview-shadow"),
|
|
6571
6864
|
"--cc-drag-drop-motion-duration": read("--cc-drag-drop-motion-duration"),
|
|
6572
6865
|
};
|
|
6573
|
-
|
|
6866
|
+
const next = {};
|
|
6867
|
+
Object.entries(values).forEach(([key, value]) => {
|
|
6868
|
+
if (value.length > 0) {
|
|
6869
|
+
next[key] = value;
|
|
6870
|
+
}
|
|
6871
|
+
});
|
|
6872
|
+
return next;
|
|
6574
6873
|
}
|
|
6575
6874
|
const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
6576
6875
|
name: "ClassDragDropBoard",
|
|
@@ -6619,7 +6918,8 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6619
6918
|
moveFrame = window.requestAnimationFrame(flushPreviewPosition);
|
|
6620
6919
|
};
|
|
6621
6920
|
const isPreviewInsideBoard = (currentPreview) => {
|
|
6622
|
-
|
|
6921
|
+
var _a;
|
|
6922
|
+
const boardRect = (_a = boardRef.value) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
6623
6923
|
if (!boardRect)
|
|
6624
6924
|
return true;
|
|
6625
6925
|
return (getRectOverlapRatio(getPreviewRect(currentPreview), boardRect) > 0.05);
|
|
@@ -6631,9 +6931,10 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6631
6931
|
if (!isPreviewInsideBoard(currentPreview))
|
|
6632
6932
|
return nextIndex;
|
|
6633
6933
|
itemRefs.forEach((element, id) => {
|
|
6934
|
+
var _a;
|
|
6634
6935
|
if (id === state.value.draggingId)
|
|
6635
6936
|
return;
|
|
6636
|
-
const rect = slotRects.get(id)
|
|
6937
|
+
const rect = (_a = slotRects.get(id)) !== null && _a !== void 0 ? _a : element.getBoundingClientRect();
|
|
6637
6938
|
const ratio = getRectOverlapRatio(previewRect, rect);
|
|
6638
6939
|
if (ratio >= 0.8 && ratio > bestRatio) {
|
|
6639
6940
|
bestRatio = ratio;
|
|
@@ -6679,9 +6980,10 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6679
6980
|
return `translate3d(${deltaX}px, ${deltaY}px, 0)`;
|
|
6680
6981
|
};
|
|
6681
6982
|
const finishDrag = (action) => {
|
|
6983
|
+
var _a;
|
|
6682
6984
|
if (action === "end") {
|
|
6683
6985
|
const fromIndex = state.value.items.findIndex((item) => item.id === state.value.draggingId);
|
|
6684
|
-
const toIndex = state.value.overIndex
|
|
6986
|
+
const toIndex = (_a = state.value.overIndex) !== null && _a !== void 0 ? _a : fromIndex;
|
|
6685
6987
|
const nextItems = reorderDropItems(state.value.items, fromIndex, toIndex, props.mode);
|
|
6686
6988
|
controller.cancel();
|
|
6687
6989
|
isCommittingDrop.value = true;
|
|
@@ -6702,7 +7004,7 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6702
7004
|
preview.value = null;
|
|
6703
7005
|
};
|
|
6704
7006
|
const endDrag = () => {
|
|
6705
|
-
const currentPreview = dragSession
|
|
7007
|
+
const currentPreview = dragSession !== null && dragSession !== void 0 ? dragSession : preview.value;
|
|
6706
7008
|
if (currentPreview && !currentPreview.dropping) {
|
|
6707
7009
|
const originalIndex = getOriginalIndex();
|
|
6708
7010
|
const shouldCancel = !isPreviewInsideBoard(currentPreview) ||
|
|
@@ -6744,7 +7046,7 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6744
7046
|
finishDrag("end");
|
|
6745
7047
|
};
|
|
6746
7048
|
const cancelDrag = () => {
|
|
6747
|
-
const currentPreview = dragSession
|
|
7049
|
+
const currentPreview = dragSession !== null && dragSession !== void 0 ? dragSession : preview.value;
|
|
6748
7050
|
if (currentPreview && !currentPreview.dropping) {
|
|
6749
7051
|
const returningPreview = {
|
|
6750
7052
|
...currentPreview,
|
|
@@ -6770,128 +7072,133 @@ const ClassDragDropBoard = /*#__PURE__*/ defineComponent({
|
|
|
6770
7072
|
if (commitFrame)
|
|
6771
7073
|
window.cancelAnimationFrame(commitFrame);
|
|
6772
7074
|
});
|
|
6773
|
-
return () =>
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
"
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
7075
|
+
return () => {
|
|
7076
|
+
var _a, _b;
|
|
7077
|
+
return h("div", {
|
|
7078
|
+
...attrs,
|
|
7079
|
+
class: props.className,
|
|
7080
|
+
ref: boardRef,
|
|
7081
|
+
style: { "--cc-drag-drop-columns": props.columns },
|
|
7082
|
+
}, [
|
|
7083
|
+
...state.value.items.map((item, index) => {
|
|
7084
|
+
var _a, _b;
|
|
7085
|
+
const dragging = state.value.draggingId === item.id;
|
|
7086
|
+
const over = state.value.overIndex === index &&
|
|
7087
|
+
state.value.draggingId !== undefined;
|
|
7088
|
+
const transform = dragging
|
|
7089
|
+
? undefined
|
|
7090
|
+
: getSlotTransform(item, index);
|
|
7091
|
+
const slotStyle = {
|
|
7092
|
+
...(transform ? { transform } : {}),
|
|
7093
|
+
...(isCommittingDrop.value ? { transition: "none" } : {}),
|
|
7094
|
+
};
|
|
7095
|
+
return h("div", {
|
|
7096
|
+
class: "cc-drag-drop-board__slot",
|
|
7097
|
+
"data-disabled": item.disabled,
|
|
7098
|
+
"data-dragging": dragging,
|
|
7099
|
+
"data-over": over,
|
|
7100
|
+
key: item.id,
|
|
7101
|
+
style: Object.keys(slotStyle).length ? slotStyle : undefined,
|
|
7102
|
+
ref: (node) => {
|
|
7103
|
+
if (node instanceof HTMLElement)
|
|
7104
|
+
itemRefs.set(item.id, node);
|
|
7105
|
+
else
|
|
7106
|
+
itemRefs.delete(item.id);
|
|
7107
|
+
},
|
|
7108
|
+
onPointerdown: (event) => {
|
|
7109
|
+
var _a, _b;
|
|
7110
|
+
if (item.disabled)
|
|
7111
|
+
return;
|
|
7112
|
+
const nextSlotRects = new Map();
|
|
7113
|
+
itemRefs.forEach((element, id) => {
|
|
7114
|
+
const itemRect = element.getBoundingClientRect();
|
|
7115
|
+
nextSlotRects.set(id, {
|
|
7116
|
+
bottom: itemRect.bottom,
|
|
7117
|
+
height: itemRect.height,
|
|
7118
|
+
left: itemRect.left,
|
|
7119
|
+
right: itemRect.right,
|
|
7120
|
+
top: itemRect.top,
|
|
7121
|
+
width: itemRect.width,
|
|
7122
|
+
});
|
|
6816
7123
|
});
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
y: rect.top,
|
|
6831
|
-
};
|
|
6832
|
-
state.value = controller.start(item.id);
|
|
6833
|
-
dragSession = nextPreview;
|
|
6834
|
-
preview.value = nextPreview;
|
|
6835
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
6836
|
-
},
|
|
6837
|
-
onPointermove: (event) => {
|
|
6838
|
-
if (!state.value.draggingId ||
|
|
6839
|
-
!dragSession ||
|
|
6840
|
-
dragSession.dropping)
|
|
6841
|
-
return;
|
|
6842
|
-
const nextPreview = {
|
|
6843
|
-
...dragSession,
|
|
6844
|
-
x: event.clientX - dragSession.offsetX,
|
|
6845
|
-
y: event.clientY - dragSession.offsetY,
|
|
6846
|
-
};
|
|
6847
|
-
dragSession = nextPreview;
|
|
6848
|
-
schedulePreviewPosition();
|
|
6849
|
-
if (!isPreviewInsideBoard(nextPreview)) {
|
|
6850
|
-
state.value = controller.moveToIndex(getOriginalIndex());
|
|
6851
|
-
const returningPreview = {
|
|
6852
|
-
...nextPreview,
|
|
6853
|
-
dropping: true,
|
|
6854
|
-
offsetX: 0,
|
|
6855
|
-
offsetY: 0,
|
|
6856
|
-
returning: true,
|
|
6857
|
-
x: nextPreview.originX,
|
|
6858
|
-
y: nextPreview.originY,
|
|
7124
|
+
slotRects = nextSlotRects;
|
|
7125
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
7126
|
+
const nextPreview = {
|
|
7127
|
+
height: rect.height,
|
|
7128
|
+
item,
|
|
7129
|
+
offsetX: event.clientX - rect.left,
|
|
7130
|
+
offsetY: event.clientY - rect.top,
|
|
7131
|
+
originX: rect.left,
|
|
7132
|
+
originY: rect.top,
|
|
7133
|
+
styleVars: readDragDropPreviewStyleVars(boardRef.value),
|
|
7134
|
+
width: rect.width,
|
|
7135
|
+
x: rect.left,
|
|
7136
|
+
y: rect.top,
|
|
6859
7137
|
};
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
}
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
7138
|
+
state.value = controller.start(item.id);
|
|
7139
|
+
dragSession = nextPreview;
|
|
7140
|
+
preview.value = nextPreview;
|
|
7141
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
7142
|
+
},
|
|
7143
|
+
onPointermove: (event) => {
|
|
7144
|
+
if (!state.value.draggingId ||
|
|
7145
|
+
!dragSession ||
|
|
7146
|
+
dragSession.dropping)
|
|
7147
|
+
return;
|
|
7148
|
+
const nextPreview = {
|
|
7149
|
+
...dragSession,
|
|
7150
|
+
x: event.clientX - dragSession.offsetX,
|
|
7151
|
+
y: event.clientY - dragSession.offsetY,
|
|
7152
|
+
};
|
|
7153
|
+
dragSession = nextPreview;
|
|
7154
|
+
schedulePreviewPosition();
|
|
7155
|
+
if (!isPreviewInsideBoard(nextPreview)) {
|
|
7156
|
+
state.value = controller.moveToIndex(getOriginalIndex());
|
|
7157
|
+
const returningPreview = {
|
|
7158
|
+
...nextPreview,
|
|
7159
|
+
dropping: true,
|
|
7160
|
+
offsetX: 0,
|
|
7161
|
+
offsetY: 0,
|
|
7162
|
+
returning: true,
|
|
7163
|
+
x: nextPreview.originX,
|
|
7164
|
+
y: nextPreview.originY,
|
|
7165
|
+
};
|
|
7166
|
+
dragSession = returningPreview;
|
|
7167
|
+
preview.value = returningPreview;
|
|
7168
|
+
dropTimer = setTimeout(() => finishDrag("cancel"), 320);
|
|
7169
|
+
return;
|
|
7170
|
+
}
|
|
7171
|
+
const nextIndex = resolveIndexFromPreview(nextPreview);
|
|
7172
|
+
if (nextIndex !== state.value.overIndex)
|
|
7173
|
+
state.value = controller.moveToIndex(nextIndex);
|
|
7174
|
+
},
|
|
7175
|
+
onPointerup: endDrag,
|
|
7176
|
+
onPointercancel: cancelDrag,
|
|
7177
|
+
}, [
|
|
7178
|
+
h("div", { class: "cc-drag-drop-board__item" }, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, { dragging, item, over })) !== null && _b !== void 0 ? _b : item.id),
|
|
7179
|
+
]);
|
|
7180
|
+
}),
|
|
7181
|
+
preview.value
|
|
7182
|
+
? h(Teleport, { to: "body" }, h("div", {
|
|
7183
|
+
"aria-hidden": "true",
|
|
7184
|
+
class: "cc-drag-drop-board__preview",
|
|
7185
|
+
"data-dropping": preview.value.dropping,
|
|
7186
|
+
"data-returning": preview.value.returning,
|
|
7187
|
+
ref: previewRef,
|
|
7188
|
+
style: {
|
|
7189
|
+
...preview.value.styleVars,
|
|
7190
|
+
height: `${preview.value.height}px`,
|
|
7191
|
+
transform: `translate3d(${preview.value.x}px, ${preview.value.y}px, 0)`,
|
|
7192
|
+
width: `${preview.value.width}px`,
|
|
7193
|
+
},
|
|
7194
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
7195
|
+
dragging: true,
|
|
7196
|
+
item: preview.value.item,
|
|
7197
|
+
over: false,
|
|
7198
|
+
})) !== null && _b !== void 0 ? _b : preview.value.item.id))
|
|
7199
|
+
: null,
|
|
7200
|
+
]);
|
|
7201
|
+
};
|
|
6895
7202
|
},
|
|
6896
7203
|
});
|
|
6897
7204
|
const ClassFloatingBall = /*#__PURE__*/ defineComponent({
|
|
@@ -6931,23 +7238,27 @@ const ClassFloatingBall = /*#__PURE__*/ defineComponent({
|
|
|
6931
7238
|
moveAxis: props.moveAxis,
|
|
6932
7239
|
});
|
|
6933
7240
|
const state = ref(controller.getState());
|
|
6934
|
-
const getBounds = () =>
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
7241
|
+
const getBounds = () => {
|
|
7242
|
+
var _a, _b, _c, _d;
|
|
7243
|
+
return ({
|
|
7244
|
+
size: {
|
|
7245
|
+
height: (_b = (_a = elementRef.value) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 56,
|
|
7246
|
+
width: (_d = (_c = elementRef.value) === null || _c === void 0 ? void 0 : _c.offsetWidth) !== null && _d !== void 0 ? _d : 56,
|
|
7247
|
+
},
|
|
7248
|
+
viewport: props.boundary
|
|
7249
|
+
? {
|
|
7250
|
+
height: props.boundary.clientHeight,
|
|
7251
|
+
width: props.boundary.clientWidth,
|
|
7252
|
+
}
|
|
7253
|
+
: { height: window.innerHeight, width: window.innerWidth },
|
|
7254
|
+
});
|
|
7255
|
+
};
|
|
6946
7256
|
const toLocalPoint = (event) => {
|
|
6947
|
-
|
|
7257
|
+
var _a, _b, _c;
|
|
7258
|
+
const rect = (_a = props.boundary) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
6948
7259
|
return {
|
|
6949
|
-
x: event.clientX - (rect
|
|
6950
|
-
y: event.clientY - (rect
|
|
7260
|
+
x: event.clientX - ((_b = rect === null || rect === void 0 ? void 0 : rect.left) !== null && _b !== void 0 ? _b : 0),
|
|
7261
|
+
y: event.clientY - ((_c = rect === null || rect === void 0 ? void 0 : rect.top) !== null && _c !== void 0 ? _c : 0),
|
|
6951
7262
|
};
|
|
6952
7263
|
};
|
|
6953
7264
|
const flushMove = () => {
|
|
@@ -7012,34 +7323,38 @@ const ClassFloatingBall = /*#__PURE__*/ defineComponent({
|
|
|
7012
7323
|
if (frame)
|
|
7013
7324
|
window.cancelAnimationFrame(frame);
|
|
7014
7325
|
});
|
|
7015
|
-
return () =>
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7326
|
+
return () => {
|
|
7327
|
+
var _a;
|
|
7328
|
+
return h("div", {
|
|
7329
|
+
...attrs,
|
|
7330
|
+
class: props.className,
|
|
7331
|
+
"data-edge": state.value.edge,
|
|
7332
|
+
"data-dragging": dragging.value,
|
|
7333
|
+
ref: elementRef,
|
|
7334
|
+
style: {
|
|
7335
|
+
left: `${state.value.position.x}px`,
|
|
7336
|
+
top: `${state.value.position.y}px`,
|
|
7337
|
+
},
|
|
7338
|
+
onPointerdown: (event) => {
|
|
7339
|
+
var _a, _b;
|
|
7340
|
+
const localPoint = toLocalPoint(event);
|
|
7341
|
+
drag.value = {
|
|
7342
|
+
dx: localPoint.x - state.value.position.x,
|
|
7343
|
+
dy: localPoint.y - state.value.position.y,
|
|
7344
|
+
};
|
|
7345
|
+
dragging.value = true;
|
|
7346
|
+
gesture.start({ x: event.clientX, y: event.clientY });
|
|
7347
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
7348
|
+
window.addEventListener("pointermove", handleMove, {
|
|
7349
|
+
passive: true,
|
|
7350
|
+
});
|
|
7351
|
+
window.addEventListener("pointerup", handleUp, { passive: true });
|
|
7352
|
+
window.addEventListener("pointercancel", handleUp, {
|
|
7353
|
+
passive: true,
|
|
7354
|
+
});
|
|
7355
|
+
},
|
|
7356
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots));
|
|
7357
|
+
};
|
|
7043
7358
|
},
|
|
7044
7359
|
});
|
|
7045
7360
|
const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
@@ -7076,12 +7391,14 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7076
7391
|
},
|
|
7077
7392
|
emits: ["change", "update:values"],
|
|
7078
7393
|
setup(props, { attrs, emit }) {
|
|
7394
|
+
var _a;
|
|
7079
7395
|
const form = inject(formSymbol, null);
|
|
7080
7396
|
const formInteractivity = useFormInteractivity();
|
|
7081
|
-
const formState = shallowRef(form
|
|
7397
|
+
const formState = shallowRef((_a = form === null || form === void 0 ? void 0 : form.getState()) !== null && _a !== void 0 ? _a : null);
|
|
7082
7398
|
const getValues = () => {
|
|
7399
|
+
var _a, _b;
|
|
7083
7400
|
const fieldValue = props.name
|
|
7084
|
-
? formState.value
|
|
7401
|
+
? (_b = (_a = formState.value) === null || _a === void 0 ? void 0 : _a.fields[props.name]) === null || _b === void 0 ? void 0 : _b.value
|
|
7085
7402
|
: undefined;
|
|
7086
7403
|
return Array.isArray(fieldValue)
|
|
7087
7404
|
? fieldValue
|
|
@@ -7100,28 +7417,32 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7100
7417
|
let unsubscribeField;
|
|
7101
7418
|
let unsubscribeForm;
|
|
7102
7419
|
onMounted(() => {
|
|
7420
|
+
var _a;
|
|
7103
7421
|
if (!form || !props.name)
|
|
7104
7422
|
return;
|
|
7105
7423
|
unsubscribeForm = form.subscribe((nextState) => {
|
|
7106
7424
|
formState.value = nextState;
|
|
7107
7425
|
});
|
|
7108
7426
|
unsubscribeField = form.registerField(props.name, {
|
|
7109
|
-
initialValue: props.initialValue
|
|
7427
|
+
initialValue: (_a = props.initialValue) !== null && _a !== void 0 ? _a : props.values,
|
|
7110
7428
|
rules: props.rules,
|
|
7111
7429
|
validateOn: props.validateOn,
|
|
7112
7430
|
});
|
|
7113
7431
|
});
|
|
7114
7432
|
onBeforeUnmount(() => {
|
|
7115
|
-
unsubscribeField
|
|
7116
|
-
unsubscribeForm
|
|
7433
|
+
unsubscribeField === null || unsubscribeField === void 0 ? void 0 : unsubscribeField();
|
|
7434
|
+
unsubscribeForm === null || unsubscribeForm === void 0 ? void 0 : unsubscribeForm();
|
|
7117
7435
|
});
|
|
7118
|
-
watch(() =>
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7436
|
+
watch(() => {
|
|
7437
|
+
var _a, _b;
|
|
7438
|
+
return [
|
|
7439
|
+
props.cascade,
|
|
7440
|
+
props.columns,
|
|
7441
|
+
props.source,
|
|
7442
|
+
props.values,
|
|
7443
|
+
props.name ? (_b = (_a = formState.value) === null || _a === void 0 ? void 0 : _a.fields[props.name]) === null || _b === void 0 ? void 0 : _b.value : undefined,
|
|
7444
|
+
];
|
|
7445
|
+
}, () => {
|
|
7125
7446
|
state.value = controller.updateOptions({
|
|
7126
7447
|
cascade: props.cascade,
|
|
7127
7448
|
columns: props.columns,
|
|
@@ -7138,12 +7459,13 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7138
7459
|
emit("change", state.value.values, state.value.selectedOptions);
|
|
7139
7460
|
};
|
|
7140
7461
|
return () => {
|
|
7141
|
-
|
|
7462
|
+
var _a, _b, _c, _d;
|
|
7463
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
7142
7464
|
const locked = interactivity.disabled || interactivity.readOnly;
|
|
7143
7465
|
const field = props.name
|
|
7144
|
-
? formState.value
|
|
7466
|
+
? (_b = formState.value) === null || _b === void 0 ? void 0 : _b.fields[props.name]
|
|
7145
7467
|
: undefined;
|
|
7146
|
-
const errors = field
|
|
7468
|
+
const errors = (_c = field === null || field === void 0 ? void 0 : field.errors) !== null && _c !== void 0 ? _c : [];
|
|
7147
7469
|
const errorId = props.name ? `${props.name}-error` : undefined;
|
|
7148
7470
|
const safeItemHeight = Math.max(1, Number.isFinite(props.itemHeight) ? props.itemHeight : 38);
|
|
7149
7471
|
const safeVisibleItemCount = Math.max(3, Math.floor(Number.isFinite(props.visibleItemCount) ? props.visibleItemCount : 5));
|
|
@@ -7152,17 +7474,19 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7152
7474
|
: safeVisibleItemCount;
|
|
7153
7475
|
const wheelHeight = safeItemHeight * visibleCount;
|
|
7154
7476
|
const columnNodes = state.value.columns.map((column, columnIndex) => {
|
|
7477
|
+
var _a;
|
|
7155
7478
|
const selectedIndex = Math.max(0, column.findIndex((item) => item.value === state.value.values[columnIndex]));
|
|
7156
7479
|
return h("div", {
|
|
7157
7480
|
class: "cc-picker__column",
|
|
7158
7481
|
key: columnIndex,
|
|
7159
7482
|
style: { height: `${wheelHeight}px` },
|
|
7160
7483
|
onPointerdown: (event) => {
|
|
7484
|
+
var _a, _b;
|
|
7161
7485
|
if (locked)
|
|
7162
7486
|
return;
|
|
7163
7487
|
activeColumn.value = columnIndex;
|
|
7164
7488
|
gesture.start({ x: event.clientX, y: event.clientY });
|
|
7165
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
7489
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
7166
7490
|
},
|
|
7167
7491
|
onPointermove: (event) => {
|
|
7168
7492
|
if (locked ||
|
|
@@ -7201,7 +7525,7 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7201
7525
|
h("div", {
|
|
7202
7526
|
class: "cc-picker__wheel",
|
|
7203
7527
|
style: {
|
|
7204
|
-
transform: `translate3d(0, ${((visibleCount - 1) / 2 - selectedIndex) * safeItemHeight + (dragOffsets.value[columnIndex]
|
|
7528
|
+
transform: `translate3d(0, ${((visibleCount - 1) / 2 - selectedIndex) * safeItemHeight + ((_a = dragOffsets.value[columnIndex]) !== null && _a !== void 0 ? _a : 0)}px, 0)`,
|
|
7205
7529
|
},
|
|
7206
7530
|
}, column.map((option, optionIndex) => h("button", {
|
|
7207
7531
|
class: "cc-picker__option",
|
|
@@ -7247,7 +7571,7 @@ const ClassMultiColumnPicker = /*#__PURE__*/ defineComponent({
|
|
|
7247
7571
|
: null,
|
|
7248
7572
|
picker,
|
|
7249
7573
|
errors.length > 0 && errorId
|
|
7250
|
-
? h("span", { class: props.errorClass
|
|
7574
|
+
? h("span", { class: (_d = props.errorClass) !== null && _d !== void 0 ? _d : "cc-field__error", id: errorId }, errors[0])
|
|
7251
7575
|
: null,
|
|
7252
7576
|
]);
|
|
7253
7577
|
};
|
|
@@ -7314,6 +7638,7 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7314
7638
|
let timer;
|
|
7315
7639
|
let resizeObserver;
|
|
7316
7640
|
let initialTransitionFrame;
|
|
7641
|
+
let removeViewportResizeFallback = () => { };
|
|
7317
7642
|
const setCurrent = (nextState) => {
|
|
7318
7643
|
state.value = nextState;
|
|
7319
7644
|
dragOffset.value = 0;
|
|
@@ -7376,10 +7701,11 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7376
7701
|
startAutoplay();
|
|
7377
7702
|
if (viewportRef.value) {
|
|
7378
7703
|
const syncSize = () => {
|
|
7704
|
+
var _a, _b, _c, _d;
|
|
7379
7705
|
viewportSize.value =
|
|
7380
7706
|
props.direction === "vertical"
|
|
7381
|
-
? (viewportRef.value
|
|
7382
|
-
: (viewportRef.value
|
|
7707
|
+
? ((_b = (_a = viewportRef.value) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0)
|
|
7708
|
+
: ((_d = (_c = viewportRef.value) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
7383
7709
|
if (!props.disableInitialTransition || viewportSize.value <= 0)
|
|
7384
7710
|
return;
|
|
7385
7711
|
if (initialTransitionFrame !== undefined)
|
|
@@ -7389,23 +7715,31 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7389
7715
|
});
|
|
7390
7716
|
};
|
|
7391
7717
|
syncSize();
|
|
7392
|
-
|
|
7393
|
-
|
|
7718
|
+
if (typeof ResizeObserver === "undefined") {
|
|
7719
|
+
window.addEventListener("resize", syncSize);
|
|
7720
|
+
removeViewportResizeFallback = () => window.removeEventListener("resize", syncSize);
|
|
7721
|
+
}
|
|
7722
|
+
else {
|
|
7723
|
+
resizeObserver = new ResizeObserver(syncSize);
|
|
7724
|
+
resizeObserver.observe(viewportRef.value);
|
|
7725
|
+
}
|
|
7394
7726
|
}
|
|
7395
7727
|
});
|
|
7396
7728
|
watch(() => props.direction, () => {
|
|
7729
|
+
var _a, _b;
|
|
7397
7730
|
const element = viewportRef.value;
|
|
7398
7731
|
viewportSize.value =
|
|
7399
7732
|
props.direction === "vertical"
|
|
7400
|
-
? (element
|
|
7401
|
-
: (element
|
|
7733
|
+
? ((_a = element === null || element === void 0 ? void 0 : element.clientHeight) !== null && _a !== void 0 ? _a : 0)
|
|
7734
|
+
: ((_b = element === null || element === void 0 ? void 0 : element.clientWidth) !== null && _b !== void 0 ? _b : 0);
|
|
7402
7735
|
dragOffset.value = 0;
|
|
7403
7736
|
});
|
|
7404
7737
|
onBeforeUnmount(() => {
|
|
7405
7738
|
stopAutoplay();
|
|
7406
7739
|
if (initialTransitionFrame !== undefined)
|
|
7407
7740
|
window.cancelAnimationFrame(initialTransitionFrame);
|
|
7408
|
-
|
|
7741
|
+
removeViewportResizeFallback();
|
|
7742
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
7409
7743
|
});
|
|
7410
7744
|
return () => {
|
|
7411
7745
|
const isVertical = props.direction === "vertical";
|
|
@@ -7423,9 +7757,11 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7423
7757
|
? centeredOffset - state.value.current * stepSize + dragOffset.value
|
|
7424
7758
|
: -state.value.current * stepSize + dragOffset.value;
|
|
7425
7759
|
const resolvePressedSlideIndex = (event) => {
|
|
7760
|
+
var _a;
|
|
7426
7761
|
const fallback = () => {
|
|
7427
|
-
|
|
7428
|
-
const
|
|
7762
|
+
var _a;
|
|
7763
|
+
const slide = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest(".cc-swiper__slide");
|
|
7764
|
+
const index = Number(slide === null || slide === void 0 ? void 0 : slide.dataset.swiperIndex);
|
|
7429
7765
|
return Number.isFinite(index) ? index : null;
|
|
7430
7766
|
};
|
|
7431
7767
|
if (!isCinemaMode.value ||
|
|
@@ -7433,7 +7769,7 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7433
7769
|
slideSize <= 0 ||
|
|
7434
7770
|
safeData.value.length <= 0)
|
|
7435
7771
|
return fallback();
|
|
7436
|
-
const rect = viewportRef.value
|
|
7772
|
+
const rect = (_a = viewportRef.value) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
7437
7773
|
if (!rect)
|
|
7438
7774
|
return fallback();
|
|
7439
7775
|
const localPoint = isVertical
|
|
@@ -7461,12 +7797,13 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7461
7797
|
class: "cc-swiper__viewport",
|
|
7462
7798
|
ref: viewportRef,
|
|
7463
7799
|
onPointerdown: (event) => {
|
|
7800
|
+
var _a, _b;
|
|
7464
7801
|
event.preventDefault();
|
|
7465
7802
|
clickSuppressed.value = false;
|
|
7466
7803
|
pressedSlideIndex.value = resolvePressedSlideIndex(event);
|
|
7467
7804
|
gesture.start({ x: event.clientX, y: event.clientY });
|
|
7468
7805
|
dragging.value = true;
|
|
7469
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
7806
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
7470
7807
|
},
|
|
7471
7808
|
onPointermove: (event) => {
|
|
7472
7809
|
if (!gesture.getState().active)
|
|
@@ -7524,6 +7861,7 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7524
7861
|
: `translate3d(${trackOffset}px, 0, 0)`,
|
|
7525
7862
|
},
|
|
7526
7863
|
}, safeData.value.map((item, index) => {
|
|
7864
|
+
var _a, _b;
|
|
7527
7865
|
const rawOffset = index - state.value.current;
|
|
7528
7866
|
const normalizedOffset = Math.max(-3, Math.min(3, rawOffset));
|
|
7529
7867
|
const distance = Math.min(3, Math.abs(rawOffset));
|
|
@@ -7575,8 +7913,7 @@ const ClassSwiper = /*#__PURE__*/ defineComponent({
|
|
|
7575
7913
|
"--cc-swiper-slide-shift-y": `${slideVerticalShift}px`,
|
|
7576
7914
|
zIndex: 30 - distance,
|
|
7577
7915
|
},
|
|
7578
|
-
}, slots.default
|
|
7579
|
-
String(item ?? ""));
|
|
7916
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, { data: item, index })) !== null && _b !== void 0 ? _b : String(item !== null && item !== void 0 ? item : ""));
|
|
7580
7917
|
})),
|
|
7581
7918
|
]),
|
|
7582
7919
|
props.showArrows && swiperCount.value > 1
|
|
@@ -7751,10 +8088,12 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7751
8088
|
emit("rangeChange", { endIndex, startIndex });
|
|
7752
8089
|
}, { immediate: true });
|
|
7753
8090
|
const updateViewportHeight = () => {
|
|
7754
|
-
|
|
8091
|
+
var _a, _b;
|
|
8092
|
+
viewportHeight.value = (_b = (_a = viewportRef.value) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0;
|
|
7755
8093
|
};
|
|
7756
8094
|
const updateHeaderHeight = () => {
|
|
7757
|
-
|
|
8095
|
+
var _a, _b;
|
|
8096
|
+
headerHeight.value = (_b = (_a = headerRef.value) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
|
|
7758
8097
|
};
|
|
7759
8098
|
const finishPullDown = () => {
|
|
7760
8099
|
pullDownStatus.value = "success";
|
|
@@ -7801,19 +8140,21 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7801
8140
|
}
|
|
7802
8141
|
});
|
|
7803
8142
|
const handlePullDownStart = (event) => {
|
|
8143
|
+
var _a, _b;
|
|
7804
8144
|
const element = event.currentTarget;
|
|
7805
8145
|
if (!props.enablePullDown ||
|
|
7806
8146
|
pullDownPending.value ||
|
|
7807
8147
|
props.pullDownLoading ||
|
|
7808
8148
|
element.scrollTop > 0)
|
|
7809
8149
|
return;
|
|
7810
|
-
pullDownStartY.value = event.touches[0]
|
|
8150
|
+
pullDownStartY.value = (_b = (_a = event.touches[0]) === null || _a === void 0 ? void 0 : _a.clientY) !== null && _b !== void 0 ? _b : null;
|
|
7811
8151
|
};
|
|
7812
8152
|
const handlePullDownMove = (event) => {
|
|
8153
|
+
var _a;
|
|
7813
8154
|
if (!props.enablePullDown || pullDownStartY.value === null)
|
|
7814
8155
|
return;
|
|
7815
8156
|
const element = event.currentTarget;
|
|
7816
|
-
const touchY = event.touches[0]
|
|
8157
|
+
const touchY = (_a = event.touches[0]) === null || _a === void 0 ? void 0 : _a.clientY;
|
|
7817
8158
|
if (touchY === undefined)
|
|
7818
8159
|
return;
|
|
7819
8160
|
const delta = touchY - pullDownStartY.value;
|
|
@@ -7887,7 +8228,7 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7887
8228
|
}
|
|
7888
8229
|
if (typeof IntersectionObserver !== "undefined") {
|
|
7889
8230
|
const pullObserver = new IntersectionObserver(([entry]) => {
|
|
7890
|
-
if (entry
|
|
8231
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isIntersecting)
|
|
7891
8232
|
triggerPullUp();
|
|
7892
8233
|
}, {
|
|
7893
8234
|
root: viewportRef.value,
|
|
@@ -7916,7 +8257,8 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7916
8257
|
observers.clear();
|
|
7917
8258
|
});
|
|
7918
8259
|
const observeItem = (index, element) => {
|
|
7919
|
-
|
|
8260
|
+
var _a;
|
|
8261
|
+
(_a = observers.get(index)) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
7920
8262
|
observers.delete(index);
|
|
7921
8263
|
if (!(element instanceof HTMLElement))
|
|
7922
8264
|
return;
|
|
@@ -7932,6 +8274,7 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7932
8274
|
observers.set(index, observer);
|
|
7933
8275
|
};
|
|
7934
8276
|
return () => {
|
|
8277
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7935
8278
|
const range = visibleRange.value;
|
|
7936
8279
|
const resolvedHeight = typeof props.height === "number" ? `${props.height}px` : props.height;
|
|
7937
8280
|
const pullDownProgress = props.pullDownThreshold <= 0
|
|
@@ -7978,16 +8321,16 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
7978
8321
|
return undefined;
|
|
7979
8322
|
};
|
|
7980
8323
|
const resolvedPullDownIconNode = resolvedPullDownStatus === "success"
|
|
7981
|
-
? ((props.pullDownSuccessImage
|
|
8324
|
+
? ((_b = (props.pullDownSuccessImage
|
|
7982
8325
|
? iconNode("success", props.pullDownSuccessIcon, props.pullDownSuccessImage)
|
|
7983
8326
|
: props.pullDownSuccessIcon
|
|
7984
8327
|
? iconNode("success", props.pullDownSuccessIcon)
|
|
7985
|
-
: slots.pullDownSuccessIcon
|
|
7986
|
-
: ((props.pullDownLoadingImage
|
|
8328
|
+
: (_a = slots.pullDownSuccessIcon) === null || _a === void 0 ? void 0 : _a.call(slots))) !== null && _b !== void 0 ? _b : defaultPullDownIcon())
|
|
8329
|
+
: ((_d = (props.pullDownLoadingImage
|
|
7987
8330
|
? iconNode("loading", props.pullDownLoadingIcon, props.pullDownLoadingImage)
|
|
7988
8331
|
: props.pullDownLoadingIcon
|
|
7989
8332
|
? iconNode("loading", props.pullDownLoadingIcon)
|
|
7990
|
-
: slots.pullDownLoadingIcon
|
|
8333
|
+
: (_c = slots.pullDownLoadingIcon) === null || _c === void 0 ? void 0 : _c.call(slots))) !== null && _d !== void 0 ? _d : defaultPullDownIcon());
|
|
7991
8334
|
return h("div", {
|
|
7992
8335
|
...attrs,
|
|
7993
8336
|
class: props.className,
|
|
@@ -8008,11 +8351,11 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8008
8351
|
"--cc-virtual-list-pull-down-distance": `${pullDownDistance.value}px`,
|
|
8009
8352
|
"--cc-virtual-list-pull-down-progress": pullDownProgress,
|
|
8010
8353
|
},
|
|
8011
|
-
}, slots.pullDown
|
|
8354
|
+
}, (_f = (_e = slots.pullDown) === null || _e === void 0 ? void 0 : _e.call(slots, {
|
|
8012
8355
|
distance: pullDownDistance.value,
|
|
8013
8356
|
progress: pullDownProgress,
|
|
8014
8357
|
status: resolvedPullDownStatus,
|
|
8015
|
-
})
|
|
8358
|
+
})) !== null && _f !== void 0 ? _f : resolvedPullDownIconNode)
|
|
8016
8359
|
: null,
|
|
8017
8360
|
h("div", {
|
|
8018
8361
|
class: "cc-virtual-list__content",
|
|
@@ -8027,29 +8370,31 @@ const ClassVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8027
8370
|
h("div", {
|
|
8028
8371
|
class: props.listClass,
|
|
8029
8372
|
style: { height: `${range.totalSize}px` },
|
|
8030
|
-
}, range.items.map((item) =>
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8373
|
+
}, range.items.map((item) => {
|
|
8374
|
+
var _a;
|
|
8375
|
+
return h("div", {
|
|
8376
|
+
class: props.itemClass,
|
|
8377
|
+
key: item.key,
|
|
8378
|
+
ref: (element) => observeItem(item.index, element),
|
|
8379
|
+
style: { transform: `translateY(${item.start}px)` },
|
|
8380
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
8381
|
+
data: props.data[item.index],
|
|
8382
|
+
index: item.index,
|
|
8383
|
+
item,
|
|
8384
|
+
}));
|
|
8385
|
+
})),
|
|
8040
8386
|
props.enablePullUp
|
|
8041
8387
|
? h("div", {
|
|
8042
8388
|
class: props.pullUpClass,
|
|
8043
8389
|
"data-loading": props.pullUpLoading || pullUpPending.value,
|
|
8044
8390
|
ref: pullUpRef,
|
|
8045
|
-
}, slots.pullUp
|
|
8391
|
+
}, (_h = (_g = slots.pullUp) === null || _g === void 0 ? void 0 : _g.call(slots, {
|
|
8046
8392
|
loading: props.pullUpLoading || pullUpPending.value,
|
|
8047
|
-
})
|
|
8048
|
-
(
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
.virtualListPullUpReadyText))
|
|
8393
|
+
})) !== null && _h !== void 0 ? _h : (props.pullUpLoading || pullUpPending.value
|
|
8394
|
+
? getClassComponentsLocale()
|
|
8395
|
+
.virtualListPullUpLoadingText
|
|
8396
|
+
: getClassComponentsLocale()
|
|
8397
|
+
.virtualListPullUpReadyText))
|
|
8053
8398
|
: null,
|
|
8054
8399
|
]),
|
|
8055
8400
|
]),
|
|
@@ -8161,11 +8506,13 @@ const ClassMasonryVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8161
8506
|
emit("rangeChange", { columns, endIndex, startIndex });
|
|
8162
8507
|
}, { immediate: true });
|
|
8163
8508
|
const updateViewportSize = () => {
|
|
8164
|
-
|
|
8165
|
-
|
|
8509
|
+
var _a, _b, _c, _d;
|
|
8510
|
+
viewportHeight.value = (_b = (_a = viewportRef.value) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0;
|
|
8511
|
+
containerWidth.value = (_d = (_c = viewportRef.value) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : 0;
|
|
8166
8512
|
};
|
|
8167
8513
|
const updateHeaderHeight = () => {
|
|
8168
|
-
|
|
8514
|
+
var _a, _b;
|
|
8515
|
+
headerHeight.value = (_b = (_a = headerRef.value) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0;
|
|
8169
8516
|
};
|
|
8170
8517
|
onMounted(() => {
|
|
8171
8518
|
updateViewportSize();
|
|
@@ -8186,7 +8533,8 @@ const ClassMasonryVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8186
8533
|
observers.clear();
|
|
8187
8534
|
});
|
|
8188
8535
|
const observeItem = (index, element) => {
|
|
8189
|
-
|
|
8536
|
+
var _a;
|
|
8537
|
+
(_a = observers.get(index)) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
8190
8538
|
observers.delete(index);
|
|
8191
8539
|
if (!(element instanceof HTMLElement))
|
|
8192
8540
|
return;
|
|
@@ -8225,19 +8573,22 @@ const ClassMasonryVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8225
8573
|
h("div", {
|
|
8226
8574
|
class: props.listClass,
|
|
8227
8575
|
style: { height: `${range.totalSize}px` },
|
|
8228
|
-
}, range.items.map((item) =>
|
|
8229
|
-
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8576
|
+
}, range.items.map((item) => {
|
|
8577
|
+
var _a;
|
|
8578
|
+
return h("div", {
|
|
8579
|
+
class: props.itemClass,
|
|
8580
|
+
key: item.key,
|
|
8581
|
+
ref: (element) => observeItem(item.index, element),
|
|
8582
|
+
style: {
|
|
8583
|
+
transform: `translate3d(${item.x}px, ${item.y}px, 0)`,
|
|
8584
|
+
width: `${item.width}px`,
|
|
8585
|
+
},
|
|
8586
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots, {
|
|
8587
|
+
data: props.data[item.index],
|
|
8588
|
+
index: item.index,
|
|
8589
|
+
item,
|
|
8590
|
+
}));
|
|
8591
|
+
})),
|
|
8241
8592
|
]),
|
|
8242
8593
|
]);
|
|
8243
8594
|
};
|
|
@@ -8550,18 +8901,19 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8550
8901
|
props.pullUpThreshold,
|
|
8551
8902
|
viewportHeight.value,
|
|
8552
8903
|
], () => {
|
|
8904
|
+
var _a, _b, _c;
|
|
8553
8905
|
const viewport = viewportRef.value;
|
|
8554
8906
|
const keys = getKeys();
|
|
8555
8907
|
const oldTotal = previousTotal.value;
|
|
8556
|
-
const oldScrollTop = viewport
|
|
8557
|
-
const wasNearBottom = chatController.isNearBottom(oldScrollTop, viewport
|
|
8908
|
+
const oldScrollTop = (_a = viewport === null || viewport === void 0 ? void 0 : viewport.scrollTop) !== null && _a !== void 0 ? _a : previousScrollTop.value;
|
|
8909
|
+
const wasNearBottom = chatController.isNearBottom(oldScrollTop, (_b = viewport === null || viewport === void 0 ? void 0 : viewport.clientHeight) !== null && _b !== void 0 ? _b : viewportHeight.value, oldTotal, (_c = viewport === null || viewport === void 0 ? void 0 : viewport.scrollHeight) !== null && _c !== void 0 ? _c : oldTotal);
|
|
8558
8910
|
const prependCount = chatController.detectPrependCount(previousKeys.value, keys);
|
|
8559
8911
|
const previousAnchor = (() => {
|
|
8912
|
+
var _a;
|
|
8560
8913
|
if (!viewport || previousKeys.value.length === 0)
|
|
8561
8914
|
return null;
|
|
8562
8915
|
const previousRange = listController.getRange(oldScrollTop, viewport.clientHeight || viewportHeight.value);
|
|
8563
|
-
const anchorItem = previousRange.items.find((item) => item.end > oldScrollTop)
|
|
8564
|
-
previousRange.items[0];
|
|
8916
|
+
const anchorItem = (_a = previousRange.items.find((item) => item.end > oldScrollTop)) !== null && _a !== void 0 ? _a : previousRange.items[0];
|
|
8565
8917
|
if (!anchorItem)
|
|
8566
8918
|
return null;
|
|
8567
8919
|
const anchorKey = previousKeys.value[anchorItem.index];
|
|
@@ -8664,7 +9016,8 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8664
9016
|
emit("rangeChange", { endIndex, startIndex });
|
|
8665
9017
|
}, { immediate: true });
|
|
8666
9018
|
const updateViewportHeight = () => {
|
|
8667
|
-
|
|
9019
|
+
var _a, _b;
|
|
9020
|
+
viewportHeight.value = (_b = (_a = viewportRef.value) === null || _a === void 0 ? void 0 : _a.clientHeight) !== null && _b !== void 0 ? _b : 0;
|
|
8668
9021
|
};
|
|
8669
9022
|
const triggerPullUp = () => {
|
|
8670
9023
|
if (!props.enablePullUp || props.pullUpLoading || pullUpPending.value)
|
|
@@ -8700,13 +9053,13 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8700
9053
|
onMounted(() => {
|
|
8701
9054
|
updateViewportHeight();
|
|
8702
9055
|
const viewport = viewportRef.value;
|
|
8703
|
-
viewport
|
|
9056
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.addEventListener("wheel", preventWhileTopLoading, {
|
|
8704
9057
|
passive: false,
|
|
8705
9058
|
});
|
|
8706
|
-
viewport
|
|
9059
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.addEventListener("touchmove", preventWhileTopLoading, {
|
|
8707
9060
|
passive: false,
|
|
8708
9061
|
});
|
|
8709
|
-
viewport
|
|
9062
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.addEventListener("keydown", preventScrollKeys);
|
|
8710
9063
|
if (typeof ResizeObserver === "undefined" || !viewportRef.value)
|
|
8711
9064
|
return;
|
|
8712
9065
|
const observer = new ResizeObserver(updateViewportHeight);
|
|
@@ -8714,7 +9067,7 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8714
9067
|
observers.set("__viewport", observer);
|
|
8715
9068
|
if (typeof IntersectionObserver !== "undefined") {
|
|
8716
9069
|
const pullObserver = new IntersectionObserver(([entry]) => {
|
|
8717
|
-
if (entry
|
|
9070
|
+
if (entry === null || entry === void 0 ? void 0 : entry.isIntersecting)
|
|
8718
9071
|
triggerPullUp();
|
|
8719
9072
|
}, {
|
|
8720
9073
|
root: viewportRef.value,
|
|
@@ -8729,9 +9082,9 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8729
9082
|
});
|
|
8730
9083
|
onBeforeUnmount(() => {
|
|
8731
9084
|
const viewport = viewportRef.value;
|
|
8732
|
-
viewport
|
|
8733
|
-
viewport
|
|
8734
|
-
viewport
|
|
9085
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.removeEventListener("wheel", preventWhileTopLoading);
|
|
9086
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.removeEventListener("touchmove", preventWhileTopLoading);
|
|
9087
|
+
viewport === null || viewport === void 0 ? void 0 : viewport.removeEventListener("keydown", preventScrollKeys);
|
|
8735
9088
|
if (bottomFrame !== undefined)
|
|
8736
9089
|
window.cancelAnimationFrame(bottomFrame);
|
|
8737
9090
|
if (bottomTimer !== undefined)
|
|
@@ -8748,11 +9101,13 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8748
9101
|
observers.clear();
|
|
8749
9102
|
});
|
|
8750
9103
|
const observeItem = (index, key, element) => {
|
|
8751
|
-
|
|
9104
|
+
var _a;
|
|
9105
|
+
(_a = observers.get(key)) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
8752
9106
|
observers.delete(key);
|
|
8753
9107
|
if (!(element instanceof HTMLElement))
|
|
8754
9108
|
return;
|
|
8755
9109
|
const measure = () => {
|
|
9110
|
+
var _a;
|
|
8756
9111
|
const keys = getKeys();
|
|
8757
9112
|
const oldKeys = previousKeys.value;
|
|
8758
9113
|
const hasPendingKeySync = oldKeys.length !== keys.length ||
|
|
@@ -8762,7 +9117,7 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8762
9117
|
const viewport = viewportRef.value;
|
|
8763
9118
|
const oldTotal = listController.getTotalSize();
|
|
8764
9119
|
const oldItem = listController.getItem(index);
|
|
8765
|
-
const oldScrollTop = viewport
|
|
9120
|
+
const oldScrollTop = (_a = viewport === null || viewport === void 0 ? void 0 : viewport.scrollTop) !== null && _a !== void 0 ? _a : 0;
|
|
8766
9121
|
if (!listController.measure(index, element.offsetHeight))
|
|
8767
9122
|
return;
|
|
8768
9123
|
const nextTotal = listController.getTotalSize();
|
|
@@ -8813,6 +9168,7 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8813
9168
|
observers.set(key, observer);
|
|
8814
9169
|
};
|
|
8815
9170
|
return () => {
|
|
9171
|
+
var _a, _b, _c, _d;
|
|
8816
9172
|
const range = visibleRange.value;
|
|
8817
9173
|
const resolvedHeight = typeof props.height === "number" ? `${props.height}px` : props.height;
|
|
8818
9174
|
const keys = getKeys();
|
|
@@ -8822,14 +9178,13 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8822
9178
|
"data-top-loading": topLoadingPending.value ? "true" : undefined,
|
|
8823
9179
|
style: { "--cc-chat-virtual-list-height": resolvedHeight },
|
|
8824
9180
|
}, [
|
|
8825
|
-
slots.topLoading
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
}),
|
|
9181
|
+
(_b = (_a = slots.topLoading) === null || _a === void 0 ? void 0 : _a.call(slots, { loading: topLoadingPending.value })) !== null && _b !== void 0 ? _b : h(ClassLoading, {
|
|
9182
|
+
"aria-hidden": topLoadingPending.value ? undefined : "true",
|
|
9183
|
+
className: props.topLoadingClass,
|
|
9184
|
+
"data-active": topLoadingPending.value ? "true" : "false",
|
|
9185
|
+
role: topLoadingPending.value ? "status" : undefined,
|
|
9186
|
+
text: props.topLoadingContent,
|
|
9187
|
+
}),
|
|
8833
9188
|
h("div", {
|
|
8834
9189
|
class: props.viewportClass,
|
|
8835
9190
|
"data-top-loading": topLoadingPending.value ? "true" : undefined,
|
|
@@ -8859,13 +9214,14 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8859
9214
|
class: props.listClass,
|
|
8860
9215
|
style: { height: `${range.totalSize}px` },
|
|
8861
9216
|
}, range.items.map((item) => {
|
|
8862
|
-
|
|
9217
|
+
var _a, _b;
|
|
9218
|
+
const key = (_a = keys[item.index]) !== null && _a !== void 0 ? _a : item.key;
|
|
8863
9219
|
return h("div", {
|
|
8864
9220
|
class: props.itemClass,
|
|
8865
9221
|
key,
|
|
8866
9222
|
ref: (element) => observeItem(item.index, key, element),
|
|
8867
9223
|
style: { transform: `translateY(${item.start}px)` },
|
|
8868
|
-
}, slots.default
|
|
9224
|
+
}, (_b = slots.default) === null || _b === void 0 ? void 0 : _b.call(slots, {
|
|
8869
9225
|
data: props.data[item.index],
|
|
8870
9226
|
index: item.index,
|
|
8871
9227
|
item,
|
|
@@ -8876,14 +9232,13 @@ const ClassChatVirtualList = /*#__PURE__*/ defineComponent({
|
|
|
8876
9232
|
class: props.pullUpClass,
|
|
8877
9233
|
"data-loading": props.pullUpLoading || pullUpPending.value,
|
|
8878
9234
|
ref: pullUpRef,
|
|
8879
|
-
}, slots.pullUp
|
|
9235
|
+
}, (_d = (_c = slots.pullUp) === null || _c === void 0 ? void 0 : _c.call(slots, {
|
|
8880
9236
|
loading: props.pullUpLoading || pullUpPending.value,
|
|
8881
|
-
})
|
|
8882
|
-
(
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
.virtualListPullUpReadyText))
|
|
9237
|
+
})) !== null && _d !== void 0 ? _d : (props.pullUpLoading || pullUpPending.value
|
|
9238
|
+
? getClassComponentsLocale()
|
|
9239
|
+
.virtualListPullUpLoadingText
|
|
9240
|
+
: getClassComponentsLocale()
|
|
9241
|
+
.virtualListPullUpReadyText))
|
|
8887
9242
|
: null,
|
|
8888
9243
|
]),
|
|
8889
9244
|
]);
|
|
@@ -8920,23 +9275,26 @@ const ClassButton = /*#__PURE__*/ defineComponent({
|
|
|
8920
9275
|
if (typeof handler === "function")
|
|
8921
9276
|
handler(event);
|
|
8922
9277
|
};
|
|
8923
|
-
return () =>
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
|
|
9278
|
+
return () => {
|
|
9279
|
+
var _a;
|
|
9280
|
+
return h("button", {
|
|
9281
|
+
...attrs,
|
|
9282
|
+
class: ["cc-button", `cc-button--${props.variant}`, props.className],
|
|
9283
|
+
disabled: props.disabled || props.loading,
|
|
9284
|
+
onClick: (event) => {
|
|
9285
|
+
if (props.disabled || props.loading)
|
|
9286
|
+
return;
|
|
9287
|
+
invokeClick(event);
|
|
9288
|
+
emit("click", event);
|
|
9289
|
+
},
|
|
9290
|
+
type: props.type,
|
|
9291
|
+
}, [
|
|
9292
|
+
props.loading
|
|
9293
|
+
? h("span", { "aria-hidden": "true", class: "cc-button__spinner" })
|
|
9294
|
+
: null,
|
|
9295
|
+
h("span", (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
9296
|
+
]);
|
|
9297
|
+
};
|
|
8940
9298
|
},
|
|
8941
9299
|
});
|
|
8942
9300
|
function renderDefaultLoadingIndicator() {
|
|
@@ -8976,17 +9334,20 @@ const ClassLoading = /*#__PURE__*/ defineComponent({
|
|
|
8976
9334
|
},
|
|
8977
9335
|
},
|
|
8978
9336
|
setup(props, { attrs, slots }) {
|
|
8979
|
-
return () =>
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
9337
|
+
return () => {
|
|
9338
|
+
var _a, _b;
|
|
9339
|
+
return h("div", {
|
|
9340
|
+
...attrs,
|
|
9341
|
+
"aria-live": "polite",
|
|
9342
|
+
class: ["cc-loading", props.className],
|
|
9343
|
+
role: "status",
|
|
9344
|
+
}, [
|
|
9345
|
+
h("span", { "aria-hidden": "true", class: "cc-loading__indicator" }, (_b = (_a = slots.indicator) === null || _a === void 0 ? void 0 : _a.call(slots)) !== null && _b !== void 0 ? _b : renderDefaultLoadingIndicator()),
|
|
9346
|
+
props.text
|
|
9347
|
+
? h("span", { class: "cc-loading__text" }, props.text)
|
|
9348
|
+
: null,
|
|
9349
|
+
]);
|
|
9350
|
+
};
|
|
8990
9351
|
},
|
|
8991
9352
|
});
|
|
8992
9353
|
function renderDefaultEmptyIcon() {
|
|
@@ -9050,12 +9411,15 @@ const ClassEmpty = /*#__PURE__*/ defineComponent({
|
|
|
9050
9411
|
},
|
|
9051
9412
|
},
|
|
9052
9413
|
setup(props, { attrs, slots }) {
|
|
9053
|
-
return () =>
|
|
9054
|
-
|
|
9055
|
-
props.
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9414
|
+
return () => {
|
|
9415
|
+
var _a, _b;
|
|
9416
|
+
return h("div", { ...attrs, class: ["cc-empty", props.className], role: "status" }, [
|
|
9417
|
+
h("span", { "aria-hidden": "true", class: "cc-empty__icon" }, (_b = (_a = slots.icon) === null || _a === void 0 ? void 0 : _a.call(slots)) !== null && _b !== void 0 ? _b : renderDefaultEmptyIcon()),
|
|
9418
|
+
props.description
|
|
9419
|
+
? h("span", { class: "cc-empty__description" }, props.description)
|
|
9420
|
+
: null,
|
|
9421
|
+
]);
|
|
9422
|
+
};
|
|
9059
9423
|
},
|
|
9060
9424
|
});
|
|
9061
9425
|
const ClassBadge = /*#__PURE__*/ defineComponent({
|
|
@@ -9072,6 +9436,7 @@ const ClassBadge = /*#__PURE__*/ defineComponent({
|
|
|
9072
9436
|
},
|
|
9073
9437
|
setup(props, { attrs, slots }) {
|
|
9074
9438
|
return () => {
|
|
9439
|
+
var _a;
|
|
9075
9440
|
const state = new BadgeController({
|
|
9076
9441
|
dot: props.dot,
|
|
9077
9442
|
max: props.max,
|
|
@@ -9083,7 +9448,7 @@ const ClassBadge = /*#__PURE__*/ defineComponent({
|
|
|
9083
9448
|
class: props.className,
|
|
9084
9449
|
"data-dot": state.dot,
|
|
9085
9450
|
"data-tone": state.tone,
|
|
9086
|
-
}, [slots.default
|
|
9451
|
+
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots), h("sup", null, state.displayValue)]);
|
|
9087
9452
|
};
|
|
9088
9453
|
},
|
|
9089
9454
|
});
|
|
@@ -9120,6 +9485,7 @@ const ClassTag = /*#__PURE__*/ defineComponent({
|
|
|
9120
9485
|
setup(props, { attrs, emit, slots }) {
|
|
9121
9486
|
const closing = ref(false);
|
|
9122
9487
|
return () => {
|
|
9488
|
+
var _a;
|
|
9123
9489
|
const state = new TagController(props).getState();
|
|
9124
9490
|
return h("span", {
|
|
9125
9491
|
...attrs,
|
|
@@ -9137,7 +9503,7 @@ const ClassTag = /*#__PURE__*/ defineComponent({
|
|
|
9137
9503
|
state.checkable &&
|
|
9138
9504
|
emit("checkedChange", !state.checked),
|
|
9139
9505
|
}, [
|
|
9140
|
-
h("span", slots.default
|
|
9506
|
+
h("span", (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
9141
9507
|
state.closable
|
|
9142
9508
|
? h("button", {
|
|
9143
9509
|
disabled: state.disabled,
|
|
@@ -9163,12 +9529,13 @@ const ClassSkeleton = /*#__PURE__*/ defineComponent({
|
|
|
9163
9529
|
},
|
|
9164
9530
|
setup(props, { attrs, slots }) {
|
|
9165
9531
|
return () => {
|
|
9532
|
+
var _a;
|
|
9166
9533
|
const state = new SkeletonController({
|
|
9167
9534
|
animated: props.animated,
|
|
9168
9535
|
count: props.count,
|
|
9169
9536
|
}).getState();
|
|
9170
|
-
const content = slots.default
|
|
9171
|
-
if (content
|
|
9537
|
+
const content = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots);
|
|
9538
|
+
if (content === null || content === void 0 ? void 0 : content.length) {
|
|
9172
9539
|
const children = [
|
|
9173
9540
|
h("div", { class: "cc-skeleton__content" }, content),
|
|
9174
9541
|
...(props.loading
|
|
@@ -9223,10 +9590,9 @@ const ClassBreadcrumb = /*#__PURE__*/ defineComponent({
|
|
|
9223
9590
|
});
|
|
9224
9591
|
function renderVueMenuItems(items, collapsed, slots, toggle, select) {
|
|
9225
9592
|
return items.map((item) => {
|
|
9593
|
+
var _a, _b, _c;
|
|
9226
9594
|
const hasChildren = item.children.length > 0;
|
|
9227
|
-
const icon = slots.icon
|
|
9228
|
-
item.icon ??
|
|
9229
|
-
(collapsed ? item.label.slice(0, 1) : undefined);
|
|
9595
|
+
const icon = (_c = (_b = (_a = slots.icon) === null || _a === void 0 ? void 0 : _a.call(slots, { item })) !== null && _b !== void 0 ? _b : item.icon) !== null && _c !== void 0 ? _c : (collapsed ? item.label.slice(0, 1) : undefined);
|
|
9230
9596
|
return h("li", {
|
|
9231
9597
|
class: "cc-menu__item",
|
|
9232
9598
|
"data-active": item.isActive,
|
|
@@ -9469,9 +9835,10 @@ const ClassPopconfirm = /*#__PURE__*/ defineComponent({
|
|
|
9469
9835
|
}, motion.enabled ? motion.duration : 0);
|
|
9470
9836
|
};
|
|
9471
9837
|
const closeOnOutside = (event) => {
|
|
9838
|
+
var _a, _b;
|
|
9472
9839
|
if (!props.closeOnOutsideClick ||
|
|
9473
|
-
rootRef.value
|
|
9474
|
-
panelRef.value
|
|
9840
|
+
((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||
|
|
9841
|
+
((_b = panelRef.value) === null || _b === void 0 ? void 0 : _b.contains(event.target)))
|
|
9475
9842
|
return;
|
|
9476
9843
|
hide();
|
|
9477
9844
|
};
|
|
@@ -9497,6 +9864,7 @@ const ClassPopconfirm = /*#__PURE__*/ defineComponent({
|
|
|
9497
9864
|
});
|
|
9498
9865
|
watch(() => props.placement, updatePlacement);
|
|
9499
9866
|
return () => {
|
|
9867
|
+
var _a;
|
|
9500
9868
|
const motion = resolveAnimation(props.animation, "scale");
|
|
9501
9869
|
const rootClass = [
|
|
9502
9870
|
"cc-popconfirm",
|
|
@@ -9528,7 +9896,7 @@ const ClassPopconfirm = /*#__PURE__*/ defineComponent({
|
|
|
9528
9896
|
ref: rootRef,
|
|
9529
9897
|
style: animationStyle(motion),
|
|
9530
9898
|
}, [
|
|
9531
|
-
h("span", { onClick: show }, slots.default
|
|
9899
|
+
h("span", { onClick: show }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
9532
9900
|
props.portal ? null : panelNode,
|
|
9533
9901
|
]);
|
|
9534
9902
|
if (!props.portal)
|
|
@@ -9568,12 +9936,13 @@ const ClassBacktop = /*#__PURE__*/ defineComponent({
|
|
|
9568
9936
|
let currentTarget = null;
|
|
9569
9937
|
let bindFrame = 0;
|
|
9570
9938
|
const resolveTarget = () => {
|
|
9939
|
+
var _a, _b;
|
|
9571
9940
|
const propTarget = props.target;
|
|
9572
9941
|
if (typeof propTarget === "function")
|
|
9573
|
-
return propTarget()
|
|
9942
|
+
return (_a = propTarget()) !== null && _a !== void 0 ? _a : null;
|
|
9574
9943
|
if (typeof propTarget === "string")
|
|
9575
|
-
return document.querySelector(propTarget)
|
|
9576
|
-
return propTarget
|
|
9944
|
+
return (_b = document.querySelector(propTarget)) !== null && _b !== void 0 ? _b : window;
|
|
9945
|
+
return propTarget !== null && propTarget !== void 0 ? propTarget : window;
|
|
9577
9946
|
};
|
|
9578
9947
|
const readScrollTop = (target) => target instanceof Window ? target.scrollY : target.scrollTop;
|
|
9579
9948
|
const writeScrollTop = (target, top) => {
|
|
@@ -9584,7 +9953,8 @@ const ClassBacktop = /*#__PURE__*/ defineComponent({
|
|
|
9584
9953
|
target.scrollTop = top;
|
|
9585
9954
|
};
|
|
9586
9955
|
const scrollToTop = (target) => {
|
|
9587
|
-
|
|
9956
|
+
var _a, _b;
|
|
9957
|
+
const duration = Math.max(0, Number.isFinite((_a = props.duration) !== null && _a !== void 0 ? _a : 0) ? ((_b = props.duration) !== null && _b !== void 0 ? _b : 0) : 0);
|
|
9588
9958
|
if (duration <= 0) {
|
|
9589
9959
|
target.scrollTo({ top: 0, behavior: "smooth" });
|
|
9590
9960
|
return;
|
|
@@ -9601,7 +9971,7 @@ const ClassBacktop = /*#__PURE__*/ defineComponent({
|
|
|
9601
9971
|
requestAnimationFrame(step);
|
|
9602
9972
|
};
|
|
9603
9973
|
const onScroll = () => {
|
|
9604
|
-
const target = currentTarget
|
|
9974
|
+
const target = currentTarget !== null && currentTarget !== void 0 ? currentTarget : resolveTarget();
|
|
9605
9975
|
if (!target)
|
|
9606
9976
|
return;
|
|
9607
9977
|
visible.value = controller.resolve(readScrollTop(target), visible.value).visible;
|
|
@@ -9633,19 +10003,22 @@ const ClassBacktop = /*#__PURE__*/ defineComponent({
|
|
|
9633
10003
|
if (currentTarget)
|
|
9634
10004
|
currentTarget.removeEventListener("scroll", onScroll);
|
|
9635
10005
|
});
|
|
9636
|
-
return () =>
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
10006
|
+
return () => {
|
|
10007
|
+
var _a, _b;
|
|
10008
|
+
return visible.value
|
|
10009
|
+
? h("button", {
|
|
10010
|
+
...attrs,
|
|
10011
|
+
class: props.className,
|
|
10012
|
+
type: "button",
|
|
10013
|
+
onClick: (event) => {
|
|
10014
|
+
emit("click", event);
|
|
10015
|
+
const target = currentTarget !== null && currentTarget !== void 0 ? currentTarget : resolveTarget();
|
|
10016
|
+
if (target)
|
|
10017
|
+
scrollToTop(target);
|
|
10018
|
+
},
|
|
10019
|
+
}, (_b = (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)) !== null && _b !== void 0 ? _b : classIcon("chevronUp"))
|
|
10020
|
+
: null;
|
|
10021
|
+
};
|
|
9649
10022
|
},
|
|
9650
10023
|
});
|
|
9651
10024
|
const ClassAffix = /*#__PURE__*/ defineComponent({
|
|
@@ -9662,10 +10035,11 @@ const ClassAffix = /*#__PURE__*/ defineComponent({
|
|
|
9662
10035
|
const windowTarget = ref(true);
|
|
9663
10036
|
let scrollTarget = window;
|
|
9664
10037
|
const resolveTarget = () => {
|
|
10038
|
+
var _a;
|
|
9665
10039
|
const propTarget = typeof props.target === "function" ? props.target() : props.target;
|
|
9666
10040
|
if (typeof propTarget === "string")
|
|
9667
|
-
return document.querySelector(propTarget)
|
|
9668
|
-
return propTarget
|
|
10041
|
+
return (_a = document.querySelector(propTarget)) !== null && _a !== void 0 ? _a : window;
|
|
10042
|
+
return propTarget !== null && propTarget !== void 0 ? propTarget : window;
|
|
9669
10043
|
};
|
|
9670
10044
|
const onScroll = () => {
|
|
9671
10045
|
const element = scrollTarget;
|
|
@@ -9707,22 +10081,25 @@ const ClassAffix = /*#__PURE__*/ defineComponent({
|
|
|
9707
10081
|
watch(() => props.target, attach);
|
|
9708
10082
|
watch(() => props.offsetTop, onScroll);
|
|
9709
10083
|
onBeforeUnmount(detach);
|
|
9710
|
-
return () =>
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
10084
|
+
return () => {
|
|
10085
|
+
var _a;
|
|
10086
|
+
return h("div", {
|
|
10087
|
+
...attrs,
|
|
10088
|
+
class: props.className,
|
|
10089
|
+
"data-fixed": fixed.value,
|
|
10090
|
+
"data-target": windowTarget.value ? "window" : "element",
|
|
10091
|
+
ref: root,
|
|
10092
|
+
style: {
|
|
10093
|
+
...(windowTarget.value && fixed.value
|
|
10094
|
+
? { height: fixedStyle.value.height }
|
|
10095
|
+
: {}),
|
|
10096
|
+
...(!windowTarget.value ? { top: `${props.offsetTop}px` } : {}),
|
|
10097
|
+
},
|
|
10098
|
+
}, h("div", {
|
|
10099
|
+
class: "cc-affix__inner",
|
|
10100
|
+
style: windowTarget.value && fixed.value ? fixedStyle.value : undefined,
|
|
10101
|
+
}, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)));
|
|
10102
|
+
};
|
|
9726
10103
|
},
|
|
9727
10104
|
});
|
|
9728
10105
|
const ClassModal = /*#__PURE__*/ defineComponent({
|
|
@@ -9783,7 +10160,8 @@ const ClassModal = /*#__PURE__*/ defineComponent({
|
|
|
9783
10160
|
},
|
|
9784
10161
|
emits: ["update:open"],
|
|
9785
10162
|
setup(props, { attrs, emit, slots }) {
|
|
9786
|
-
|
|
10163
|
+
var _a;
|
|
10164
|
+
const controller = (_a = props.controller) !== null && _a !== void 0 ? _a : new ModalController(props.open);
|
|
9787
10165
|
const open = ref(controller.isOpen());
|
|
9788
10166
|
const rendered = ref(open.value);
|
|
9789
10167
|
const panelRef = ref(null);
|
|
@@ -9838,10 +10216,11 @@ const ClassModal = /*#__PURE__*/ defineComponent({
|
|
|
9838
10216
|
clearTimeout(timer);
|
|
9839
10217
|
if (frame)
|
|
9840
10218
|
cancelAnimationFrame(frame);
|
|
9841
|
-
cleanupA11y
|
|
10219
|
+
cleanupA11y === null || cleanupA11y === void 0 ? void 0 : cleanupA11y();
|
|
9842
10220
|
unsubscribe();
|
|
9843
10221
|
});
|
|
9844
10222
|
return () => {
|
|
10223
|
+
var _a, _b;
|
|
9845
10224
|
const motion = resolveAnimation(props.animation, "scale");
|
|
9846
10225
|
const { style: attrStyle, ...restAttrs } = attrs;
|
|
9847
10226
|
const modalNode = h("div", {
|
|
@@ -9879,11 +10258,11 @@ const ClassModal = /*#__PURE__*/ defineComponent({
|
|
|
9879
10258
|
}, props.closeIcon),
|
|
9880
10259
|
])
|
|
9881
10260
|
: null,
|
|
9882
|
-
h("div", { class: "cc-modal__body" }, slots.default
|
|
10261
|
+
h("div", { class: "cc-modal__body" }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
9883
10262
|
]),
|
|
9884
10263
|
]);
|
|
9885
10264
|
return rendered.value
|
|
9886
|
-
? h(Teleport, { to: props.container
|
|
10265
|
+
? h(Teleport, { to: (_b = props.container) !== null && _b !== void 0 ? _b : "body" }, modalNode)
|
|
9887
10266
|
: null;
|
|
9888
10267
|
};
|
|
9889
10268
|
},
|
|
@@ -9958,7 +10337,8 @@ const ClassPopup = /*#__PURE__*/ defineComponent({
|
|
|
9958
10337
|
},
|
|
9959
10338
|
emits: ["update:open"],
|
|
9960
10339
|
setup(props, { attrs, emit, slots }) {
|
|
9961
|
-
|
|
10340
|
+
var _a;
|
|
10341
|
+
const controller = (_a = props.controller) !== null && _a !== void 0 ? _a : new PopupController(props.open, props.placement);
|
|
9962
10342
|
const state = ref(controller.getState());
|
|
9963
10343
|
const rendered = ref(state.value.open);
|
|
9964
10344
|
const panelRef = ref(null);
|
|
@@ -9968,6 +10348,7 @@ const ClassPopup = /*#__PURE__*/ defineComponent({
|
|
|
9968
10348
|
let cleanupA11y;
|
|
9969
10349
|
let pushSnapshot = null;
|
|
9970
10350
|
const syncPushTarget = () => {
|
|
10351
|
+
var _a, _b, _c, _d, _e;
|
|
9971
10352
|
const target = props.pushTarget;
|
|
9972
10353
|
if (!target)
|
|
9973
10354
|
return;
|
|
@@ -9981,11 +10362,11 @@ const ClassPopup = /*#__PURE__*/ defineComponent({
|
|
|
9981
10362
|
const original = pushSnapshot;
|
|
9982
10363
|
const motion = resolveAnimation(props.animation, "slide");
|
|
9983
10364
|
const measuredDistance = state.value.placement === "left" || state.value.placement === "right"
|
|
9984
|
-
? (panelRef.value
|
|
9985
|
-
: (panelRef.value
|
|
10365
|
+
? ((_b = (_a = panelRef.value) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0)
|
|
10366
|
+
: ((_d = (_c = panelRef.value) === null || _c === void 0 ? void 0 : _c.offsetHeight) !== null && _d !== void 0 ? _d : 0);
|
|
9986
10367
|
const distance = typeof props.pushDistance === "number"
|
|
9987
10368
|
? `${props.pushDistance}px`
|
|
9988
|
-
: (props.pushDistance
|
|
10369
|
+
: ((_e = props.pushDistance) !== null && _e !== void 0 ? _e : `${measuredDistance}px`);
|
|
9989
10370
|
const signedDistance = state.value.placement === "left" || state.value.placement === "top"
|
|
9990
10371
|
? distance
|
|
9991
10372
|
: `calc(-1 * ${distance})`;
|
|
@@ -10052,10 +10433,11 @@ const ClassPopup = /*#__PURE__*/ defineComponent({
|
|
|
10052
10433
|
pushSnapshot.target.style.transition = pushSnapshot.transition;
|
|
10053
10434
|
pushSnapshot = null;
|
|
10054
10435
|
}
|
|
10055
|
-
cleanupA11y
|
|
10436
|
+
cleanupA11y === null || cleanupA11y === void 0 ? void 0 : cleanupA11y();
|
|
10056
10437
|
unsubscribe();
|
|
10057
10438
|
});
|
|
10058
10439
|
return () => {
|
|
10440
|
+
var _a, _b;
|
|
10059
10441
|
const motion = resolveAnimation(props.animation, "slide");
|
|
10060
10442
|
const { style: attrStyle, ...restAttrs } = attrs;
|
|
10061
10443
|
const popupNode = h("div", {
|
|
@@ -10094,11 +10476,11 @@ const ClassPopup = /*#__PURE__*/ defineComponent({
|
|
|
10094
10476
|
}, props.closeIcon),
|
|
10095
10477
|
])
|
|
10096
10478
|
: null,
|
|
10097
|
-
h("div", { class: "cc-popup__body" }, slots.default
|
|
10479
|
+
h("div", { class: "cc-popup__body" }, (_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots)),
|
|
10098
10480
|
]),
|
|
10099
10481
|
]);
|
|
10100
10482
|
return rendered.value
|
|
10101
|
-
? h(Teleport, { to: props.container
|
|
10483
|
+
? h(Teleport, { to: (_b = props.container) !== null && _b !== void 0 ? _b : "body" }, popupNode)
|
|
10102
10484
|
: null;
|
|
10103
10485
|
};
|
|
10104
10486
|
},
|
|
@@ -10180,9 +10562,10 @@ const ClassTooltip = /*#__PURE__*/ defineComponent({
|
|
|
10180
10562
|
typeof document === "undefined")
|
|
10181
10563
|
return;
|
|
10182
10564
|
const handlePointerDown = (event) => {
|
|
10565
|
+
var _a, _b;
|
|
10183
10566
|
if (!props.closeOnOutsideClick ||
|
|
10184
|
-
rootRef.value
|
|
10185
|
-
contentRef.value
|
|
10567
|
+
((_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||
|
|
10568
|
+
((_b = contentRef.value) === null || _b === void 0 ? void 0 : _b.contains(event.target)))
|
|
10186
10569
|
return;
|
|
10187
10570
|
controller.close();
|
|
10188
10571
|
};
|
|
@@ -10208,6 +10591,7 @@ const ClassTooltip = /*#__PURE__*/ defineComponent({
|
|
|
10208
10591
|
});
|
|
10209
10592
|
watch(() => props.placement, () => updatePlacement());
|
|
10210
10593
|
return () => {
|
|
10594
|
+
var _a;
|
|
10211
10595
|
const openEvents = props.trigger === "click"
|
|
10212
10596
|
? {
|
|
10213
10597
|
onClick: () => {
|
|
@@ -10250,7 +10634,7 @@ const ClassTooltip = /*#__PURE__*/ defineComponent({
|
|
|
10250
10634
|
ref: rootRef,
|
|
10251
10635
|
style: animationStyle(motion),
|
|
10252
10636
|
tabindex: props.trigger === "click" ? 0 : undefined,
|
|
10253
|
-
}, [slots.default
|
|
10637
|
+
}, [(_a = slots.default) === null || _a === void 0 ? void 0 : _a.call(slots), props.portal ? null : tooltipContent]);
|
|
10254
10638
|
if (!props.portal)
|
|
10255
10639
|
return rootNode;
|
|
10256
10640
|
const portalNode = open.value || anchorStyle.value.left > -9999
|
|
@@ -10297,7 +10681,8 @@ const ClassToastViewport = /*#__PURE__*/ defineComponent({
|
|
|
10297
10681
|
},
|
|
10298
10682
|
},
|
|
10299
10683
|
setup(props, { attrs, slots }) {
|
|
10300
|
-
|
|
10684
|
+
var _a;
|
|
10685
|
+
const activeManager = shallowRef((_a = props.manager) !== null && _a !== void 0 ? _a : defaultToastManager);
|
|
10301
10686
|
const items = shallowRef(activeManager.value.getToasts());
|
|
10302
10687
|
const getVisibleItems = (source) => {
|
|
10303
10688
|
const positionItems = source.filter((item) => item.position === props.position);
|
|
@@ -10371,13 +10756,16 @@ const ClassToastViewport = /*#__PURE__*/ defineComponent({
|
|
|
10371
10756
|
const enteringIds = nextItems
|
|
10372
10757
|
.filter((item) => !currentIds.has(item.id))
|
|
10373
10758
|
.map((item) => item.id);
|
|
10374
|
-
const retainedOrExiting = renderedItems.value.map(({ item }) =>
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
:
|
|
10380
|
-
|
|
10759
|
+
const retainedOrExiting = renderedItems.value.map(({ item }) => {
|
|
10760
|
+
var _a;
|
|
10761
|
+
return ({
|
|
10762
|
+
item: (_a = incomingById.get(item.id)) !== null && _a !== void 0 ? _a : item,
|
|
10763
|
+
motion: !incomingIds.has(item.id),
|
|
10764
|
+
state: incomingIds.has(item.id)
|
|
10765
|
+
? "enter"
|
|
10766
|
+
: "exit",
|
|
10767
|
+
});
|
|
10768
|
+
});
|
|
10381
10769
|
const entering = nextItems
|
|
10382
10770
|
.filter((item) => !currentIds.has(item.id))
|
|
10383
10771
|
.map((item) => ({ item, motion: true, state: "prepare" }));
|
|
@@ -10424,7 +10812,7 @@ const ClassToastViewport = /*#__PURE__*/ defineComponent({
|
|
|
10424
10812
|
};
|
|
10425
10813
|
subscribeManager(activeManager.value);
|
|
10426
10814
|
watch(() => props.manager, (nextManager) => {
|
|
10427
|
-
subscribeManager(nextManager
|
|
10815
|
+
subscribeManager(nextManager !== null && nextManager !== void 0 ? nextManager : defaultToastManager);
|
|
10428
10816
|
});
|
|
10429
10817
|
watch(() => [props.position, props.maxVisible], () => syncRenderedItems(getVisibleItems(items.value)));
|
|
10430
10818
|
onBeforeUnmount(() => {
|
|
@@ -10513,7 +10901,8 @@ const ClassTabs = /*#__PURE__*/ defineComponent({
|
|
|
10513
10901
|
},
|
|
10514
10902
|
emits: ["update:activeId"],
|
|
10515
10903
|
setup(props, { attrs, emit, slots }) {
|
|
10516
|
-
|
|
10904
|
+
var _a;
|
|
10905
|
+
const controller = (_a = props.controller) !== null && _a !== void 0 ? _a : new TabsController(props.tabs, props.activeId);
|
|
10517
10906
|
const activeId = ref(controller.getActiveId());
|
|
10518
10907
|
const visited = ref(new Set([activeId.value]));
|
|
10519
10908
|
const direction = ref("forward");
|
|
@@ -10528,7 +10917,7 @@ const ClassTabs = /*#__PURE__*/ defineComponent({
|
|
|
10528
10917
|
};
|
|
10529
10918
|
const unsubscribe = controller.subscribe((nextActiveId) => {
|
|
10530
10919
|
const tabsAnimation = props.animation;
|
|
10531
|
-
direction.value = resolveTabsDirection(props.tabs, activeId.value, nextActiveId, tabsAnimation === false ? "none" : tabsAnimation
|
|
10920
|
+
direction.value = resolveTabsDirection(props.tabs, activeId.value, nextActiveId, tabsAnimation === false ? "none" : tabsAnimation === null || tabsAnimation === void 0 ? void 0 : tabsAnimation.direction);
|
|
10532
10921
|
activeId.value = nextActiveId;
|
|
10533
10922
|
visited.value = new Set([...visited.value, nextActiveId]);
|
|
10534
10923
|
emit("update:activeId", nextActiveId);
|
|
@@ -10542,7 +10931,7 @@ const ClassTabs = /*#__PURE__*/ defineComponent({
|
|
|
10542
10931
|
return () => {
|
|
10543
10932
|
const tabsAnimation = props.animation;
|
|
10544
10933
|
const tabsFallbackAnimation = tabsAnimation !== false &&
|
|
10545
|
-
tabsAnimation
|
|
10934
|
+
(tabsAnimation === null || tabsAnimation === void 0 ? void 0 : tabsAnimation.direction) &&
|
|
10546
10935
|
tabsAnimation.direction !== "none"
|
|
10547
10936
|
? "slide"
|
|
10548
10937
|
: "fade";
|
|
@@ -10572,6 +10961,7 @@ const ClassTabs = /*#__PURE__*/ defineComponent({
|
|
|
10572
10961
|
onClick: () => controller.activate(tab.id),
|
|
10573
10962
|
}, tab.label))),
|
|
10574
10963
|
h("div", { class: "cc-tabs__panes" }, panelIds.map((panelId) => {
|
|
10964
|
+
var _a, _b, _c, _d, _e;
|
|
10575
10965
|
const active = panelId === activeId.value;
|
|
10576
10966
|
const loading = resolveFlag(props.loadingTabs, panelId);
|
|
10577
10967
|
const empty = !loading && resolveFlag(props.emptyTabs, panelId);
|
|
@@ -10584,18 +10974,16 @@ const ClassTabs = /*#__PURE__*/ defineComponent({
|
|
|
10584
10974
|
key: panelId,
|
|
10585
10975
|
role: "tabpanel",
|
|
10586
10976
|
}, loading
|
|
10587
|
-
? (slots.loading
|
|
10588
|
-
|
|
10589
|
-
|
|
10590
|
-
|
|
10591
|
-
}))
|
|
10977
|
+
? ((_b = (_a = slots.loading) === null || _a === void 0 ? void 0 : _a.call(slots, { activeId: panelId })) !== null && _b !== void 0 ? _b : h(ClassLoading, {
|
|
10978
|
+
className: "cc-tabs__loading",
|
|
10979
|
+
text: getClassComponentsLocale().tabsLoadingText,
|
|
10980
|
+
}))
|
|
10592
10981
|
: empty
|
|
10593
|
-
? (slots.empty
|
|
10594
|
-
|
|
10595
|
-
|
|
10596
|
-
|
|
10597
|
-
|
|
10598
|
-
: slots.default?.({ activeId: panelId, active }));
|
|
10982
|
+
? ((_d = (_c = slots.empty) === null || _c === void 0 ? void 0 : _c.call(slots, { activeId: panelId })) !== null && _d !== void 0 ? _d : h(ClassEmpty, {
|
|
10983
|
+
className: "cc-tabs__empty",
|
|
10984
|
+
description: getClassComponentsLocale().tabsEmptyText,
|
|
10985
|
+
}))
|
|
10986
|
+
: (_e = slots.default) === null || _e === void 0 ? void 0 : _e.call(slots, { activeId: panelId, active }));
|
|
10599
10987
|
})),
|
|
10600
10988
|
]);
|
|
10601
10989
|
};
|
|
@@ -10670,9 +11058,12 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10670
11058
|
let resizeObserver;
|
|
10671
11059
|
let bodyResizeObserver;
|
|
10672
11060
|
let settingsTimer;
|
|
10673
|
-
const getContentWidth = () =>
|
|
10674
|
-
|
|
10675
|
-
(
|
|
11061
|
+
const getContentWidth = () => {
|
|
11062
|
+
var _a, _b;
|
|
11063
|
+
return Math.max(0, ((_b = (_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : 0) -
|
|
11064
|
+
(props.rowSelection ? 44 : 0) -
|
|
11065
|
+
(props.virtual ? bodyScrollbarWidth.value : 0));
|
|
11066
|
+
};
|
|
10676
11067
|
const updateContainerWidth = () => {
|
|
10677
11068
|
containerWidth.value = getContentWidth();
|
|
10678
11069
|
};
|
|
@@ -10736,10 +11127,11 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10736
11127
|
showSettings();
|
|
10737
11128
|
};
|
|
10738
11129
|
const closeSettingsOnOutside = (event) => {
|
|
11130
|
+
var _a, _b;
|
|
10739
11131
|
const target = event.target;
|
|
10740
11132
|
if (!settingsOpen.value ||
|
|
10741
|
-
settingsRef.value
|
|
10742
|
-
settingsMenuRef.value
|
|
11133
|
+
((_a = settingsRef.value) === null || _a === void 0 ? void 0 : _a.contains(target)) ||
|
|
11134
|
+
((_b = settingsMenuRef.value) === null || _b === void 0 ? void 0 : _b.contains(target)))
|
|
10743
11135
|
return;
|
|
10744
11136
|
hideSettings();
|
|
10745
11137
|
};
|
|
@@ -10801,8 +11193,8 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10801
11193
|
}
|
|
10802
11194
|
});
|
|
10803
11195
|
onBeforeUnmount(() => {
|
|
10804
|
-
resizeObserver
|
|
10805
|
-
bodyResizeObserver
|
|
11196
|
+
resizeObserver === null || resizeObserver === void 0 ? void 0 : resizeObserver.disconnect();
|
|
11197
|
+
bodyResizeObserver === null || bodyResizeObserver === void 0 ? void 0 : bodyResizeObserver.disconnect();
|
|
10806
11198
|
document.removeEventListener("mousedown", closeSettingsOnOutside);
|
|
10807
11199
|
window.removeEventListener("resize", updateSettingsPosition);
|
|
10808
11200
|
window.removeEventListener("scroll", updateSettingsPosition, true);
|
|
@@ -10812,8 +11204,8 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10812
11204
|
window.removeEventListener("resize", updateContainerWidth);
|
|
10813
11205
|
});
|
|
10814
11206
|
return () => {
|
|
10815
|
-
|
|
10816
|
-
|
|
11207
|
+
var _a, _b, _c, _d, _e, _f;
|
|
11208
|
+
const tableViewportWidth = (_b = (_a = rootRef.value) === null || _a === void 0 ? void 0 : _a.clientWidth) !== null && _b !== void 0 ? _b : containerWidth.value + (props.rowSelection ? 44 : 0);
|
|
10817
11209
|
const displayColumns = state.value.columns;
|
|
10818
11210
|
const dataGridTemplateColumns = `${props.rowSelection ? "44px " : ""}${displayColumns.map((column) => `${column.width}px`).join(" ")}`;
|
|
10819
11211
|
const headerScrollbarWidth = props.virtual ? bodyScrollbarWidth.value : 0;
|
|
@@ -10853,17 +11245,18 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10853
11245
|
: tableWidthStyle;
|
|
10854
11246
|
const hasHorizontalOverflow = tableContentWidth() + headerScrollbarWidth > tableViewportWidth + 1;
|
|
10855
11247
|
const getFixedEdge = (column) => {
|
|
11248
|
+
var _a, _b;
|
|
10856
11249
|
if (!hasHorizontalOverflow)
|
|
10857
11250
|
return undefined;
|
|
10858
11251
|
if (column.fixed === "left") {
|
|
10859
11252
|
const leftFixed = displayColumns.filter((item) => item.fixed === "left");
|
|
10860
|
-
return leftFixed[leftFixed.length - 1]
|
|
11253
|
+
return ((_a = leftFixed[leftFixed.length - 1]) === null || _a === void 0 ? void 0 : _a.key) === column.key
|
|
10861
11254
|
? "left"
|
|
10862
11255
|
: undefined;
|
|
10863
11256
|
}
|
|
10864
11257
|
if (column.fixed === "right") {
|
|
10865
11258
|
const rightFixed = displayColumns.filter((item) => item.fixed === "right");
|
|
10866
|
-
return rightFixed[0]
|
|
11259
|
+
return ((_b = rightFixed[0]) === null || _b === void 0 ? void 0 : _b.key) === column.key ? "right" : undefined;
|
|
10867
11260
|
}
|
|
10868
11261
|
return undefined;
|
|
10869
11262
|
};
|
|
@@ -10915,16 +11308,18 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
10915
11308
|
: undefined,
|
|
10916
11309
|
}, renderCheckbox(state.value.selectedKeys.includes(key), false, `${getClassComponentsLocale().tableSelectRowLabel} ${String(key)}`, (checked) => toggle(key, checked)))
|
|
10917
11310
|
: null,
|
|
10918
|
-
...displayColumns.map((column) =>
|
|
10919
|
-
|
|
10920
|
-
"
|
|
10921
|
-
|
|
10922
|
-
:
|
|
10923
|
-
|
|
10924
|
-
|
|
10925
|
-
|
|
10926
|
-
|
|
10927
|
-
|
|
11311
|
+
...displayColumns.map((column) => {
|
|
11312
|
+
var _a, _b, _c;
|
|
11313
|
+
return h("div", {
|
|
11314
|
+
class: "cc-table__cell",
|
|
11315
|
+
"data-fixed": hasHorizontalOverflow
|
|
11316
|
+
? column.fixed
|
|
11317
|
+
: undefined,
|
|
11318
|
+
"data-fixed-edge": getFixedEdge(column),
|
|
11319
|
+
key: column.key,
|
|
11320
|
+
style: getColumnStickyStyle(column),
|
|
11321
|
+
}, (_b = (_a = slots.cell) === null || _a === void 0 ? void 0 : _a.call(slots, { column, row, rowIndex })) !== null && _b !== void 0 ? _b : String((_c = row[column.dataIndex]) !== null && _c !== void 0 ? _c : ""));
|
|
11322
|
+
}),
|
|
10928
11323
|
]);
|
|
10929
11324
|
};
|
|
10930
11325
|
return h("div", {
|
|
@@ -11057,11 +11452,10 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
11057
11452
|
: bodyWidthStyle,
|
|
11058
11453
|
}, !props.loading && state.value.rows.length === 0
|
|
11059
11454
|
? [
|
|
11060
|
-
h("div", { class: "cc-table__state" }, slots.empty
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
})),
|
|
11455
|
+
h("div", { class: "cc-table__state" }, (_d = (_c = slots.empty) === null || _c === void 0 ? void 0 : _c.call(slots)) !== null && _d !== void 0 ? _d : h(ClassEmpty, {
|
|
11456
|
+
className: "cc-table__empty",
|
|
11457
|
+
description: props.emptyText,
|
|
11458
|
+
})),
|
|
11065
11459
|
]
|
|
11066
11460
|
: props.virtual && range
|
|
11067
11461
|
? [
|
|
@@ -11085,8 +11479,7 @@ const ClassTable = /*#__PURE__*/ defineComponent({
|
|
|
11085
11479
|
? h("div", {
|
|
11086
11480
|
class: "cc-table__loading",
|
|
11087
11481
|
"data-cover-header": props.loadingCoverHeader,
|
|
11088
|
-
}, slots.loading
|
|
11089
|
-
h(ClassLoading, { text: props.loadingText }))
|
|
11482
|
+
}, (_f = (_e = slots.loading) === null || _e === void 0 ? void 0 : _e.call(slots)) !== null && _f !== void 0 ? _f : h(ClassLoading, { text: props.loadingText }))
|
|
11090
11483
|
: null,
|
|
11091
11484
|
]);
|
|
11092
11485
|
};
|
|
@@ -11130,9 +11523,10 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11130
11523
|
},
|
|
11131
11524
|
emits: ["change"],
|
|
11132
11525
|
setup(props, { attrs, emit }) {
|
|
11526
|
+
var _a;
|
|
11133
11527
|
const form = inject(formSymbol, null);
|
|
11134
11528
|
const formInteractivity = useFormInteractivity();
|
|
11135
|
-
const formState = shallowRef(form
|
|
11529
|
+
const formState = shallowRef((_a = form === null || form === void 0 ? void 0 : form.getState()) !== null && _a !== void 0 ? _a : null);
|
|
11136
11530
|
const inputRef = ref(null);
|
|
11137
11531
|
const controller = new UploadController({
|
|
11138
11532
|
accept: props.accept,
|
|
@@ -11144,20 +11538,21 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11144
11538
|
let unsubscribeField;
|
|
11145
11539
|
let unsubscribeForm;
|
|
11146
11540
|
onMounted(() => {
|
|
11541
|
+
var _a;
|
|
11147
11542
|
if (!form || !props.name)
|
|
11148
11543
|
return;
|
|
11149
11544
|
unsubscribeForm = form.subscribe((nextState) => {
|
|
11150
11545
|
formState.value = nextState;
|
|
11151
11546
|
});
|
|
11152
11547
|
unsubscribeField = form.registerField(props.name, {
|
|
11153
|
-
initialValue: props.initialValue
|
|
11548
|
+
initialValue: (_a = props.initialValue) !== null && _a !== void 0 ? _a : [],
|
|
11154
11549
|
rules: props.rules,
|
|
11155
11550
|
validateOn: props.validateOn,
|
|
11156
11551
|
});
|
|
11157
11552
|
});
|
|
11158
11553
|
onBeforeUnmount(() => {
|
|
11159
|
-
unsubscribeField
|
|
11160
|
-
unsubscribeForm
|
|
11554
|
+
unsubscribeField === null || unsubscribeField === void 0 ? void 0 : unsubscribeField();
|
|
11555
|
+
unsubscribeForm === null || unsubscribeForm === void 0 ? void 0 : unsubscribeForm();
|
|
11161
11556
|
});
|
|
11162
11557
|
watch(() => [props.accept, props.maxSize, props.multiple], () => {
|
|
11163
11558
|
state.value = controller.updateOptions({
|
|
@@ -11166,7 +11561,7 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11166
11561
|
multiple: props.multiple,
|
|
11167
11562
|
});
|
|
11168
11563
|
});
|
|
11169
|
-
watch(() => props.name ? formState.value
|
|
11564
|
+
watch(() => { var _a, _b; return props.name ? (_b = (_a = formState.value) === null || _a === void 0 ? void 0 : _a.fields[props.name]) === null || _b === void 0 ? void 0 : _b.value : undefined; }, (nextValue) => {
|
|
11170
11565
|
if (!Array.isArray(nextValue))
|
|
11171
11566
|
return;
|
|
11172
11567
|
state.value = controller.replaceFiles(nextValue);
|
|
@@ -11177,19 +11572,21 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11177
11572
|
emit("change", files);
|
|
11178
11573
|
};
|
|
11179
11574
|
const addFiles = (files) => {
|
|
11180
|
-
|
|
11575
|
+
var _a;
|
|
11576
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
11181
11577
|
if (interactivity.disabled || interactivity.readOnly)
|
|
11182
11578
|
return;
|
|
11183
11579
|
state.value = controller.addFiles(Array.from(files));
|
|
11184
11580
|
commitFiles(state.value.files);
|
|
11185
11581
|
};
|
|
11186
11582
|
return () => {
|
|
11187
|
-
|
|
11583
|
+
var _a, _b, _c, _d;
|
|
11584
|
+
const interactivity = resolveFieldInteractivity(formInteractivity, props.disabled, (_a = props.readOnly) !== null && _a !== void 0 ? _a : props.readonly);
|
|
11188
11585
|
const locked = interactivity.disabled || interactivity.readOnly;
|
|
11189
11586
|
const field = props.name
|
|
11190
|
-
? formState.value
|
|
11587
|
+
? (_b = formState.value) === null || _b === void 0 ? void 0 : _b.fields[props.name]
|
|
11191
11588
|
: undefined;
|
|
11192
|
-
const errors = field
|
|
11589
|
+
const errors = (_c = field === null || field === void 0 ? void 0 : field.errors) !== null && _c !== void 0 ? _c : [];
|
|
11193
11590
|
const errorId = props.name ? `${props.name}-error` : undefined;
|
|
11194
11591
|
const upload = h("div", {
|
|
11195
11592
|
...attrs,
|
|
@@ -11208,9 +11605,10 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11208
11605
|
},
|
|
11209
11606
|
onDragover: (event) => event.preventDefault(),
|
|
11210
11607
|
onDrop: (event) => {
|
|
11608
|
+
var _a;
|
|
11211
11609
|
event.preventDefault();
|
|
11212
11610
|
dragging.value = false;
|
|
11213
|
-
if (!locked && event.dataTransfer
|
|
11611
|
+
if (!locked && ((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files))
|
|
11214
11612
|
addFiles(event.dataTransfer.files);
|
|
11215
11613
|
},
|
|
11216
11614
|
}, [
|
|
@@ -11229,7 +11627,7 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11229
11627
|
h("button", {
|
|
11230
11628
|
disabled: locked,
|
|
11231
11629
|
type: "button",
|
|
11232
|
-
onClick: () => inputRef.value
|
|
11630
|
+
onClick: () => { var _a; return (_a = inputRef.value) === null || _a === void 0 ? void 0 : _a.click(); },
|
|
11233
11631
|
}, props.buttonText),
|
|
11234
11632
|
h("span", { class: "cc-upload__drag" }, props.dragText),
|
|
11235
11633
|
h("ul", null, state.value.files.map((file) => h("li", { key: file.id }, [
|
|
@@ -11258,7 +11656,7 @@ const ClassUpload = /*#__PURE__*/ defineComponent({
|
|
|
11258
11656
|
: null,
|
|
11259
11657
|
upload,
|
|
11260
11658
|
errors.length > 0 && errorId
|
|
11261
|
-
? h("span", { class: props.errorClass
|
|
11659
|
+
? h("span", { class: (_d = props.errorClass) !== null && _d !== void 0 ? _d : "cc-field__error", id: errorId }, errors[0])
|
|
11262
11660
|
: null,
|
|
11263
11661
|
]);
|
|
11264
11662
|
};
|
|
@@ -11302,7 +11700,7 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11302
11700
|
const dragState = ref(null);
|
|
11303
11701
|
let activeDragState = null;
|
|
11304
11702
|
const turningPage = ref(null);
|
|
11305
|
-
const activeCurrent = () => props.current
|
|
11703
|
+
const activeCurrent = () => { var _a; return (_a = props.current) !== null && _a !== void 0 ? _a : innerCurrent.value; };
|
|
11306
11704
|
const finishTurn = () => {
|
|
11307
11705
|
const finished = turningPage.value;
|
|
11308
11706
|
if (!finished)
|
|
@@ -11314,15 +11712,16 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11314
11712
|
turningPage.value = null;
|
|
11315
11713
|
};
|
|
11316
11714
|
let turnTimer;
|
|
11317
|
-
const renderNovelPage = (page, current, total, className, onAnimationEnd, key) =>
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
getClassComponentsLocale().novelReaderTitle),
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11715
|
+
const renderNovelPage = (page, current, total, className, onAnimationEnd, key) => {
|
|
11716
|
+
var _a, _b, _c;
|
|
11717
|
+
return h("div", { class: className, key, onAnimationEnd }, [
|
|
11718
|
+
h("div", { class: "cc-novel-reader__header" }, [
|
|
11719
|
+
h("strong", null, (_b = (_a = page === null || page === void 0 ? void 0 : page.title) !== null && _a !== void 0 ? _a : props.title) !== null && _b !== void 0 ? _b : getClassComponentsLocale().novelReaderTitle),
|
|
11720
|
+
h("span", null, total ? `${current + 1} / ${total}` : "0 / 0"),
|
|
11721
|
+
]),
|
|
11722
|
+
h("div", { class: "cc-novel-reader__content" }, (_c = page === null || page === void 0 ? void 0 : page.content) !== null && _c !== void 0 ? _c : getClassComponentsLocale().novelReaderEmptyText),
|
|
11723
|
+
]);
|
|
11724
|
+
};
|
|
11326
11725
|
const getStateAt = (nextCurrent) => {
|
|
11327
11726
|
const total = props.pages.length;
|
|
11328
11727
|
const normalized = props.loop && total > 0
|
|
@@ -11377,7 +11776,7 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11377
11776
|
clearTimeout(turnTimer);
|
|
11378
11777
|
});
|
|
11379
11778
|
const updateDrag = (pointerId, clientX, width, state, end = false) => {
|
|
11380
|
-
const drag = activeDragState
|
|
11779
|
+
const drag = activeDragState !== null && activeDragState !== void 0 ? activeDragState : dragState.value;
|
|
11381
11780
|
if (!drag || drag.pointerId !== pointerId)
|
|
11382
11781
|
return;
|
|
11383
11782
|
const delta = clientX - drag.startX;
|
|
@@ -11409,15 +11808,16 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11409
11808
|
dragState.value = activeDragState;
|
|
11410
11809
|
};
|
|
11411
11810
|
return () => {
|
|
11811
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
11412
11812
|
const state = new NovelReaderController({
|
|
11413
11813
|
current: activeCurrent(),
|
|
11414
11814
|
loop: props.loop,
|
|
11415
11815
|
pages: props.pages,
|
|
11416
11816
|
}).getState();
|
|
11417
|
-
const activeTurningPage = turningPage.value
|
|
11418
|
-
const dragMetrics = dragState.value
|
|
11419
|
-
const releaseProgress = turningPage.value
|
|
11420
|
-
const dragProgress = dragMetrics
|
|
11817
|
+
const activeTurningPage = (_a = turningPage.value) !== null && _a !== void 0 ? _a : dragState.value;
|
|
11818
|
+
const dragMetrics = (_b = dragState.value) === null || _b === void 0 ? void 0 : _b.metrics;
|
|
11819
|
+
const releaseProgress = (_d = (_c = turningPage.value) === null || _c === void 0 ? void 0 : _c.releaseProgress) !== null && _d !== void 0 ? _d : 0;
|
|
11820
|
+
const dragProgress = (_e = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.progress) !== null && _e !== void 0 ? _e : releaseProgress;
|
|
11421
11821
|
const releaseDuration = Math.max(80, Math.round(props.animationDuration * (1 - releaseProgress)));
|
|
11422
11822
|
const releaseEnterOpacity = 0.18 + releaseProgress * 0.82;
|
|
11423
11823
|
const releaseLeaveOpacity = 1 - releaseProgress * 0.82;
|
|
@@ -11426,9 +11826,7 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11426
11826
|
const releaseEnterNextX = (1 - releaseProgress) * 10;
|
|
11427
11827
|
const releaseEnterPreviousX = (releaseProgress - 1) * 10;
|
|
11428
11828
|
const releaseLeaveX = releaseProgress * 18;
|
|
11429
|
-
const activeDirection = dragMetrics
|
|
11430
|
-
activeTurningPage?.direction ??
|
|
11431
|
-
direction.value;
|
|
11829
|
+
const activeDirection = (_g = (_f = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.direction) !== null && _f !== void 0 ? _f : activeTurningPage === null || activeTurningPage === void 0 ? void 0 : activeTurningPage.direction) !== null && _g !== void 0 ? _g : direction.value;
|
|
11432
11830
|
const dragSign = activeDirection === "previous" ? 1 : -1;
|
|
11433
11831
|
const dragCanTurn = dragState.value
|
|
11434
11832
|
? dragState.value.direction === "next"
|
|
@@ -11451,26 +11849,26 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11451
11849
|
ref: readerRef,
|
|
11452
11850
|
class: props.className,
|
|
11453
11851
|
"data-animation": props.animation,
|
|
11454
|
-
"data-direction": dragState.value
|
|
11852
|
+
"data-direction": (_j = (_h = dragState.value) === null || _h === void 0 ? void 0 : _h.direction) !== null && _j !== void 0 ? _j : direction.value,
|
|
11455
11853
|
"data-dragging": dragState.value ? "true" : "false",
|
|
11456
11854
|
"data-turning": activeTurningPage ? "true" : "false",
|
|
11457
11855
|
style: [
|
|
11458
11856
|
inheritedStyle,
|
|
11459
11857
|
{
|
|
11460
11858
|
"--cc-novel-reader-duration": `${props.animationDuration}ms`,
|
|
11461
|
-
"--cc-novel-drag-angle": `${dragMetrics
|
|
11462
|
-
"--cc-novel-drag-clip-end": `${dragMetrics
|
|
11463
|
-
"--cc-novel-drag-clip-x": `${dragMetrics
|
|
11464
|
-
"--cc-novel-drag-clip-y": `${(dragMetrics
|
|
11465
|
-
"--cc-novel-drag-curl": dragMetrics
|
|
11859
|
+
"--cc-novel-drag-angle": `${(_k = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.angle) !== null && _k !== void 0 ? _k : 0}deg`,
|
|
11860
|
+
"--cc-novel-drag-clip-end": `${(_l = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.clipEnd) !== null && _l !== void 0 ? _l : 4}%`,
|
|
11861
|
+
"--cc-novel-drag-clip-x": `${(_m = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.clipStart) !== null && _m !== void 0 ? _m : 0}%`,
|
|
11862
|
+
"--cc-novel-drag-clip-y": `${((_o = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.clipStart) !== null && _o !== void 0 ? _o : 0) * 0.72}%`,
|
|
11863
|
+
"--cc-novel-drag-curl": (_p = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.curl) !== null && _p !== void 0 ? _p : 0,
|
|
11466
11864
|
"--cc-novel-drag-filter-shadow": `${dragSign * 38 * dragProgress}px`,
|
|
11467
|
-
"--cc-novel-drag-fold-opacity": dragMetrics
|
|
11468
|
-
"--cc-novel-drag-fold-scale": dragMetrics
|
|
11469
|
-
"--cc-novel-drag-fold-skew": `${dragMetrics
|
|
11470
|
-
"--cc-novel-drag-fold-translate": `${dragMetrics
|
|
11471
|
-
"--cc-novel-drag-fold-translate-signed": `${-dragSign * (dragMetrics
|
|
11472
|
-
"--cc-novel-drag-next-opacity": dragMetrics
|
|
11473
|
-
"--cc-novel-drag-opacity": dragMetrics
|
|
11865
|
+
"--cc-novel-drag-fold-opacity": (_q = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.foldOpacity) !== null && _q !== void 0 ? _q : 0.18,
|
|
11866
|
+
"--cc-novel-drag-fold-scale": (_r = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.foldScale) !== null && _r !== void 0 ? _r : 0.48,
|
|
11867
|
+
"--cc-novel-drag-fold-skew": `${(_s = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.foldSkew) !== null && _s !== void 0 ? _s : 0}deg`,
|
|
11868
|
+
"--cc-novel-drag-fold-translate": `${(_t = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.foldTranslate) !== null && _t !== void 0 ? _t : 58}%`,
|
|
11869
|
+
"--cc-novel-drag-fold-translate-signed": `${-dragSign * ((_u = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.foldTranslate) !== null && _u !== void 0 ? _u : 58)}%`,
|
|
11870
|
+
"--cc-novel-drag-next-opacity": (_v = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.nextOpacity) !== null && _v !== void 0 ? _v : 0.42,
|
|
11871
|
+
"--cc-novel-drag-opacity": (_w = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.pageOpacity) !== null && _w !== void 0 ? _w : 1,
|
|
11474
11872
|
"--cc-novel-drag-progress": dragProgress,
|
|
11475
11873
|
"--cc-novel-release-progress": releaseProgress,
|
|
11476
11874
|
"--cc-novel-release-duration": `${releaseProgress > 0 ? releaseDuration : props.animationDuration}ms`,
|
|
@@ -11480,13 +11878,13 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11480
11878
|
"--cc-novel-slide-leave-start-opacity": releaseLeaveOpacity,
|
|
11481
11879
|
"--cc-novel-slide-leave-next-start-transform": `translate3d(${-releaseLeaveX}%, 0, 0) scale(${releaseLeaveScale})`,
|
|
11482
11880
|
"--cc-novel-slide-leave-previous-start-transform": `translate3d(${releaseLeaveX}%, 0, 0) scale(${releaseLeaveScale})`,
|
|
11483
|
-
"--cc-novel-drag-shadow-opacity": dragMetrics
|
|
11484
|
-
"--cc-novel-drag-shadow-scale": dragMetrics
|
|
11485
|
-
"--cc-novel-drag-shadow-translate": `${dragMetrics
|
|
11486
|
-
"--cc-novel-drag-shadow-translate-signed": `${dragSign * (dragMetrics
|
|
11487
|
-
"--cc-novel-drag-skew": `${dragMetrics
|
|
11488
|
-
"--cc-novel-drag-translate": `${dragMetrics
|
|
11489
|
-
"--cc-novel-drag-x": `${dragMetrics
|
|
11881
|
+
"--cc-novel-drag-shadow-opacity": (_x = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.shadowOpacity) !== null && _x !== void 0 ? _x : 0.12,
|
|
11882
|
+
"--cc-novel-drag-shadow-scale": (_y = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.shadowScale) !== null && _y !== void 0 ? _y : 0.8,
|
|
11883
|
+
"--cc-novel-drag-shadow-translate": `${(_z = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.shadowTranslate) !== null && _z !== void 0 ? _z : 22}%`,
|
|
11884
|
+
"--cc-novel-drag-shadow-translate-signed": `${dragSign * ((_0 = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.shadowTranslate) !== null && _0 !== void 0 ? _0 : 22)}%`,
|
|
11885
|
+
"--cc-novel-drag-skew": `${(_1 = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.skew) !== null && _1 !== void 0 ? _1 : 0}deg`,
|
|
11886
|
+
"--cc-novel-drag-translate": `${(_2 = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.translate) !== null && _2 !== void 0 ? _2 : 0}%`,
|
|
11887
|
+
"--cc-novel-drag-x": `${(_3 = dragMetrics === null || dragMetrics === void 0 ? void 0 : dragMetrics.dragX) !== null && _3 !== void 0 ? _3 : 0}px`,
|
|
11490
11888
|
},
|
|
11491
11889
|
],
|
|
11492
11890
|
onPointerCancel: (event) => {
|
|
@@ -11495,20 +11893,20 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11495
11893
|
dragState.value = null;
|
|
11496
11894
|
},
|
|
11497
11895
|
onPointerDown: (event) => {
|
|
11896
|
+
var _a, _b, _c, _d;
|
|
11498
11897
|
if (event.button !== 0 || turningPage.value)
|
|
11499
11898
|
return;
|
|
11500
11899
|
const target = event.target;
|
|
11501
11900
|
if (target.closest("button, input, textarea, select, a, [data-no-reader-drag='true']"))
|
|
11502
11901
|
return;
|
|
11503
11902
|
event.preventDefault();
|
|
11504
|
-
event.currentTarget.setPointerCapture
|
|
11903
|
+
(_b = (_a = event.currentTarget).setPointerCapture) === null || _b === void 0 ? void 0 : _b.call(_a, event.pointerId);
|
|
11505
11904
|
const pointerId = event.pointerId;
|
|
11506
|
-
const width = Math.max(1, readerRef.value
|
|
11507
|
-
event.currentTarget.clientWidth);
|
|
11905
|
+
const width = Math.max(1, (_d = (_c = readerRef.value) === null || _c === void 0 ? void 0 : _c.clientWidth) !== null && _d !== void 0 ? _d : event.currentTarget.clientWidth);
|
|
11508
11906
|
const startX = event.clientX;
|
|
11509
11907
|
const targetNode = event.currentTarget;
|
|
11510
11908
|
const ensureDrag = (clientX) => {
|
|
11511
|
-
if (activeDragState
|
|
11909
|
+
if ((activeDragState === null || activeDragState === void 0 ? void 0 : activeDragState.pointerId) === pointerId)
|
|
11512
11910
|
return activeDragState;
|
|
11513
11911
|
if (Math.abs(clientX - startX) < NOVEL_READER_DRAG_THRESHOLD)
|
|
11514
11912
|
return null;
|
|
@@ -11542,11 +11940,12 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11542
11940
|
updateDrag(pointerId, moveEvent.clientX, width, state);
|
|
11543
11941
|
};
|
|
11544
11942
|
const handleEnd = (endEvent) => {
|
|
11943
|
+
var _a;
|
|
11545
11944
|
if (endEvent.pointerId !== pointerId)
|
|
11546
11945
|
return;
|
|
11547
11946
|
endEvent.preventDefault();
|
|
11548
|
-
targetNode.releasePointerCapture
|
|
11549
|
-
if (activeDragState
|
|
11947
|
+
(_a = targetNode.releasePointerCapture) === null || _a === void 0 ? void 0 : _a.call(targetNode, pointerId);
|
|
11948
|
+
if ((activeDragState === null || activeDragState === void 0 ? void 0 : activeDragState.pointerId) === pointerId ||
|
|
11550
11949
|
ensureDrag(endEvent.clientX)) {
|
|
11551
11950
|
updateDrag(pointerId, endEvent.clientX, width, state, true);
|
|
11552
11951
|
}
|
|
@@ -11564,9 +11963,9 @@ const ClassNovelReader = /*#__PURE__*/ defineComponent({
|
|
|
11564
11963
|
},
|
|
11565
11964
|
}, [
|
|
11566
11965
|
h("div", { class: "cc-novel-reader__book" }, [
|
|
11567
|
-
renderNovelPage(baseState.page, baseState.current, state.total, "cc-novel-reader__page cc-novel-reader__page--base", undefined, `base-${baseState.current}-${turningPage.value
|
|
11966
|
+
renderNovelPage(baseState.page, baseState.current, state.total, "cc-novel-reader__page cc-novel-reader__page--base", undefined, `base-${baseState.current}-${(_7 = (_5 = (_4 = turningPage.value) === null || _4 === void 0 ? void 0 : _4.key) !== null && _5 !== void 0 ? _5 : (_6 = dragState.value) === null || _6 === void 0 ? void 0 : _6.key) !== null && _7 !== void 0 ? _7 : "idle"}`),
|
|
11568
11967
|
previewState
|
|
11569
|
-
? renderNovelPage(previewState.page, previewState.current, state.total, "cc-novel-reader__page cc-novel-reader__page--preview", undefined, `preview-${previewState.current}-${dragState.value
|
|
11968
|
+
? renderNovelPage(previewState.page, previewState.current, state.total, "cc-novel-reader__page cc-novel-reader__page--preview", undefined, `preview-${previewState.current}-${(_9 = (_8 = dragState.value) === null || _8 === void 0 ? void 0 : _8.key) !== null && _9 !== void 0 ? _9 : "idle"}`)
|
|
11570
11969
|
: null,
|
|
11571
11970
|
activeTurningPage
|
|
11572
11971
|
? renderNovelPage(activeTurningPage.page, activeTurningPage.current, state.total, `cc-novel-reader__page cc-novel-reader__page--turning${dragState.value ? " cc-novel-reader__page--dragging" : ""}`, () => {
|
|
@@ -11626,8 +12025,9 @@ const ClassComicReader = /*#__PURE__*/ defineComponent({
|
|
|
11626
12025
|
const sentinel = ref(null);
|
|
11627
12026
|
const pageRefs = shallowRef([]);
|
|
11628
12027
|
let observer = null;
|
|
11629
|
-
const activeCurrent = () => props.current
|
|
12028
|
+
const activeCurrent = () => { var _a; return (_a = props.current) !== null && _a !== void 0 ? _a : innerCurrent.value; };
|
|
11630
12029
|
const commit = (index) => {
|
|
12030
|
+
var _a;
|
|
11631
12031
|
const next = new ComicReaderController({
|
|
11632
12032
|
current: activeCurrent(),
|
|
11633
12033
|
hasMore: props.hasMore,
|
|
@@ -11638,13 +12038,13 @@ const ClassComicReader = /*#__PURE__*/ defineComponent({
|
|
|
11638
12038
|
innerCurrent.value = next.current;
|
|
11639
12039
|
emit("update:current", next.current);
|
|
11640
12040
|
emit("pageChange", next.current, next.page);
|
|
11641
|
-
pageRefs.value[next.current]
|
|
12041
|
+
(_a = pageRefs.value[next.current]) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
11642
12042
|
behavior: "smooth",
|
|
11643
12043
|
block: "start",
|
|
11644
12044
|
});
|
|
11645
12045
|
};
|
|
11646
12046
|
onMounted(() => {
|
|
11647
|
-
if (!sentinel.value)
|
|
12047
|
+
if (!sentinel.value || typeof IntersectionObserver === "undefined")
|
|
11648
12048
|
return;
|
|
11649
12049
|
observer = new IntersectionObserver((entries) => {
|
|
11650
12050
|
if (entries.some((entry) => entry.isIntersecting) &&
|
|
@@ -11654,7 +12054,7 @@ const ClassComicReader = /*#__PURE__*/ defineComponent({
|
|
|
11654
12054
|
}, { rootMargin: "240px" });
|
|
11655
12055
|
observer.observe(sentinel.value);
|
|
11656
12056
|
});
|
|
11657
|
-
onBeforeUnmount(() => observer
|
|
12057
|
+
onBeforeUnmount(() => observer === null || observer === void 0 ? void 0 : observer.disconnect());
|
|
11658
12058
|
return () => {
|
|
11659
12059
|
const state = new ComicReaderController({
|
|
11660
12060
|
current: activeCurrent(),
|
|
@@ -11682,21 +12082,24 @@ const ClassComicReader = /*#__PURE__*/ defineComponent({
|
|
|
11682
12082
|
}, [readerIcon("chevronRight")]),
|
|
11683
12083
|
]),
|
|
11684
12084
|
h("div", { class: "cc-comic-reader__pages" }, [
|
|
11685
|
-
...state.pages.map((page, index) =>
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
11690
|
-
|
|
11691
|
-
|
|
11692
|
-
|
|
11693
|
-
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
12085
|
+
...state.pages.map((page, index) => {
|
|
12086
|
+
var _a;
|
|
12087
|
+
return h("div", {
|
|
12088
|
+
key: page.id,
|
|
12089
|
+
class: "cc-comic-reader__page",
|
|
12090
|
+
"data-active": index === state.current,
|
|
12091
|
+
ref: (node) => {
|
|
12092
|
+
if (node)
|
|
12093
|
+
pageRefs.value[index] = node;
|
|
12094
|
+
},
|
|
12095
|
+
}, [
|
|
12096
|
+
h("img", {
|
|
12097
|
+
alt: (_a = page.alt) !== null && _a !== void 0 ? _a : "",
|
|
12098
|
+
loading: "lazy",
|
|
12099
|
+
src: page.src,
|
|
12100
|
+
}),
|
|
12101
|
+
]);
|
|
12102
|
+
}),
|
|
11700
12103
|
h("div", { ref: sentinel, class: "cc-comic-reader__load" }, props.loading
|
|
11701
12104
|
? getClassComponentsLocale().comicReaderLoadingText
|
|
11702
12105
|
: props.hasMore
|
|
@@ -11742,29 +12145,32 @@ const ClassDanmaku = /*#__PURE__*/ defineComponent({
|
|
|
11742
12145
|
"--cc-danmaku-track-count": state.maxTracks,
|
|
11743
12146
|
},
|
|
11744
12147
|
],
|
|
11745
|
-
}, state.items.map((item) =>
|
|
11746
|
-
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
"
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11754
|
-
|
|
11755
|
-
|
|
11756
|
-
?
|
|
11757
|
-
|
|
11758
|
-
alt: item.imageAlt ?? item.content,
|
|
11759
|
-
src: item.imageSrc,
|
|
11760
|
-
}),
|
|
11761
|
-
item.content ? h("span", null, item.content) : null,
|
|
11762
|
-
]
|
|
11763
|
-
: item.type === "icon"
|
|
12148
|
+
}, state.items.map((item) => {
|
|
12149
|
+
var _a, _b;
|
|
12150
|
+
return h("div", {
|
|
12151
|
+
key: item.id,
|
|
12152
|
+
class: "cc-danmaku__item",
|
|
12153
|
+
style: {
|
|
12154
|
+
"--cc-danmaku-color": item.color,
|
|
12155
|
+
"--cc-danmaku-duration": `${item.duration}ms`,
|
|
12156
|
+
"--cc-danmaku-track": item.track,
|
|
12157
|
+
},
|
|
12158
|
+
}, slots.default
|
|
12159
|
+
? slots.default({ item })
|
|
12160
|
+
: item.type === "image" && item.imageSrc
|
|
11764
12161
|
? [
|
|
11765
|
-
h("
|
|
12162
|
+
h("img", {
|
|
12163
|
+
alt: (_a = item.imageAlt) !== null && _a !== void 0 ? _a : item.content,
|
|
12164
|
+
src: item.imageSrc,
|
|
12165
|
+
}),
|
|
12166
|
+
item.content ? h("span", null, item.content) : null,
|
|
11766
12167
|
]
|
|
11767
|
-
:
|
|
12168
|
+
: item.type === "icon"
|
|
12169
|
+
? [
|
|
12170
|
+
h("span", { "aria-hidden": "true", class: "cc-danmaku__icon" }, (_b = item.icon) !== null && _b !== void 0 ? _b : item.content),
|
|
12171
|
+
]
|
|
12172
|
+
: [h("span", null, item.content)]);
|
|
12173
|
+
}));
|
|
11768
12174
|
};
|
|
11769
12175
|
},
|
|
11770
12176
|
});
|
|
@@ -11968,5 +12374,5 @@ const ClassLiveRoom = /*#__PURE__*/ defineComponent({
|
|
|
11968
12374
|
},
|
|
11969
12375
|
});
|
|
11970
12376
|
|
|
11971
|
-
export { ClassAffix, ClassBacktop, ClassBadge, ClassBarcode, ClassBreadcrumb, ClassButton, ClassCalendar, ClassCanvasEditor, ClassCanvasImage, ClassChatTextarea, ClassChatVirtualList, ClassCheckbox, ClassChecked, ClassCodePreview, ClassColorPicker, ClassComicReader, ClassConfigProvider, ClassConfigTable, ClassCountdown, ClassDanmaku, ClassDatePicker, ClassDateRangePicker, ClassDesignEffect, ClassDragDropBoard, ClassDraggable, ClassEllipsisText, ClassEmpty, ClassField, ClassFilePreview, ClassFloatingBall, ClassForm, ClassGradientText, ClassHeightTransition, ClassInput, ClassLazyImage, ClassLiveRoom, ClassLoading, ClassMarquee, ClassMasonryVirtualList, ClassMenu, ClassModal, ClassMultiColumnPicker, ClassNovelReader, ClassNumberInput, ClassOrbitalSphere, ClassPagination, ClassPasswordInput, ClassPopconfirm, ClassPopup, ClassProgressBar, ClassQRCode, ClassRadioGroup, ClassRating, ClassRollingNumber, ClassSelect, ClassSignature, ClassSkeleton, ClassSlideCaptcha, ClassSwiper, ClassSwitch, ClassTable, ClassTabs, ClassTag, ClassTextarea, ClassTiltCard, ClassTimeline, ClassToastViewport, ClassTooltip, ClassTypewriterText, ClassUpload, ClassVerificationCode, ClassVideoDetailTransition, ClassVideoPlayer, ClassVirtualList, ClassVirtualSelect, ClassVirtualTable, defaultToastManager, useField, useForm, useFormState };
|
|
12377
|
+
export { ClassAffix, ClassBacktop, ClassBadge, ClassBarcode, ClassBreadcrumb, ClassButton, ClassCalendar, ClassCanvasEditor, ClassCanvasImage, ClassChatTextarea, ClassChatVirtualList, ClassCheckbox, ClassChecked, ClassCodePreview, ClassColorPicker, ClassComicReader, ClassConfigProvider, ClassConfigTable, ClassCountdown, ClassDanmaku, ClassDatePicker, ClassDateRangePicker, ClassDesignEffect, ClassDragDropBoard, ClassDraggable, ClassEllipsisText, ClassEmpty, ClassField, ClassFilePreview, ClassFloatingBall, ClassForm, ClassGradientText, ClassHeightTransition, ClassInput, ClassLazyImage, ClassLiveRoom, ClassLoading, ClassMarquee, ClassMasonryVirtualList, ClassMenu, ClassModal, ClassMultiColumnPicker, ClassNovelReader, ClassNumberInput, ClassOrbitalSphere, ClassPagination, ClassPasswordInput, ClassPopconfirm, ClassPopup, ClassProgressBar, ClassQRCode, ClassRadioGroup, ClassRating, ClassRollingNumber, ClassSelect, ClassSignature, ClassSkeleton, ClassSlideCaptcha, ClassSwiper, ClassSwitch, ClassTable, ClassTabs, ClassTag, ClassTextarea, ClassThemeBox, ClassTiltCard, ClassTimeline, ClassToastViewport, ClassTooltip, ClassTypewriterText, ClassUpload, ClassVerificationCode, ClassVideoDetailTransition, ClassVideoPlayer, ClassVirtualList, ClassVirtualSelect, ClassVirtualTable, ClassWidthTransition, defaultToastManager, useField, useForm, useFormState };
|
|
11972
12378
|
//# sourceMappingURL=index.js.map
|