beyond-webui 1.1.40 → 1.1.41
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/dist/index.full.js +1 -1
- package/dist/index.full.min.js +1 -1
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +5 -5
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +1 -1
- package/es/components/affix/index.mjs +2 -2
- package/es/components/affix/src/affix.mjs +26 -117
- package/es/components/affix/src/affix.mjs.map +1 -1
- package/es/components/affix/src/affix2.mjs +117 -26
- package/es/components/affix/src/affix2.mjs.map +1 -1
- package/es/components/autocomplete/index.mjs +2 -2
- package/es/components/autocomplete/src/autocomplete.mjs +397 -96
- package/es/components/autocomplete/src/autocomplete.mjs.map +1 -1
- package/es/components/autocomplete/src/autocomplete2.mjs +96 -397
- package/es/components/autocomplete/src/autocomplete2.mjs.map +1 -1
- package/es/components/avatar/index.mjs +2 -2
- package/es/components/avatar/src/avatar.mjs +67 -32
- package/es/components/avatar/src/avatar.mjs.map +1 -1
- package/es/components/avatar/src/avatar2.mjs +32 -67
- package/es/components/avatar/src/avatar2.mjs.map +1 -1
- package/es/components/backtop/index.mjs +2 -2
- package/es/components/backtop/src/backtop.mjs +21 -54
- package/es/components/backtop/src/backtop.mjs.map +1 -1
- package/es/components/backtop/src/backtop2.mjs +54 -21
- package/es/components/backtop/src/backtop2.mjs.map +1 -1
- package/es/components/calendar/index.mjs +2 -2
- package/es/components/calendar/src/calendar.mjs +18 -131
- package/es/components/calendar/src/calendar.mjs.map +1 -1
- package/es/components/calendar/src/calendar2.mjs +131 -18
- package/es/components/calendar/src/calendar2.mjs.map +1 -1
- package/es/components/carousel/index.mjs +2 -2
- package/es/components/carousel/src/carousel.mjs +159 -56
- package/es/components/carousel/src/carousel.mjs.map +1 -1
- package/es/components/carousel/src/carousel2.mjs +56 -159
- package/es/components/carousel/src/carousel2.mjs.map +1 -1
- package/es/components/checkbox/index.mjs +2 -2
- package/es/components/checkbox/src/checkbox-button.mjs +1 -1
- package/es/components/checkbox/src/checkbox.mjs +49 -117
- package/es/components/checkbox/src/checkbox.mjs.map +1 -1
- package/es/components/checkbox/src/checkbox2.mjs +117 -49
- package/es/components/checkbox/src/checkbox2.mjs.map +1 -1
- package/es/components/collapse/index.mjs +2 -2
- package/es/components/collapse/src/collapse.mjs +17 -30
- package/es/components/collapse/src/collapse.mjs.map +1 -1
- package/es/components/collapse/src/collapse2.mjs +30 -17
- package/es/components/collapse/src/collapse2.mjs.map +1 -1
- package/es/components/dropdown/index.mjs +2 -2
- package/es/components/dropdown/src/dropdown-item-impl.mjs +2 -2
- package/es/components/dropdown/src/dropdown-item.mjs +1 -1
- package/es/components/dropdown/src/dropdown-menu.mjs +2 -2
- package/es/components/dropdown/src/dropdown.mjs +97 -307
- package/es/components/dropdown/src/dropdown.mjs.map +1 -1
- package/es/components/dropdown/src/dropdown2.mjs +307 -97
- package/es/components/dropdown/src/dropdown2.mjs.map +1 -1
- package/es/components/empty/index.mjs +2 -2
- package/es/components/empty/src/empty.mjs +11 -55
- package/es/components/empty/src/empty.mjs.map +1 -1
- package/es/components/empty/src/empty2.mjs +55 -11
- package/es/components/empty/src/empty2.mjs.map +1 -1
- package/es/components/form/index.mjs +2 -2
- package/es/components/form/src/form-item.mjs +317 -43
- package/es/components/form/src/form-item.mjs.map +1 -1
- package/es/components/form/src/form-item2.mjs +43 -317
- package/es/components/form/src/form-item2.mjs.map +1 -1
- package/es/components/icon/index.mjs +2 -2
- package/es/components/icon/src/icon.mjs +8 -36
- package/es/components/icon/src/icon.mjs.map +1 -1
- package/es/components/icon/src/icon2.mjs +36 -8
- package/es/components/icon/src/icon2.mjs.map +1 -1
- package/es/components/image/index.mjs +2 -2
- package/es/components/image/src/image.mjs +220 -62
- package/es/components/image/src/image.mjs.map +1 -1
- package/es/components/image/src/image2.mjs +62 -220
- package/es/components/image/src/image2.mjs.map +1 -1
- package/es/components/image-viewer/index.mjs +2 -2
- package/es/components/image-viewer/src/image-viewer.mjs +39 -396
- package/es/components/image-viewer/src/image-viewer.mjs.map +1 -1
- package/es/components/image-viewer/src/image-viewer2.mjs +396 -39
- package/es/components/image-viewer/src/image-viewer2.mjs.map +1 -1
- package/es/components/index.mjs +33 -33
- package/es/components/input/index.mjs +2 -2
- package/es/components/input/src/input.mjs +143 -552
- package/es/components/input/src/input.mjs.map +1 -1
- package/es/components/input/src/input2.mjs +552 -143
- package/es/components/input/src/input2.mjs.map +1 -1
- package/es/components/message/index.mjs +1 -1
- package/es/components/message/src/message.mjs +198 -91
- package/es/components/message/src/message.mjs.map +1 -1
- package/es/components/message/src/message2.mjs +91 -198
- package/es/components/message/src/message2.mjs.map +1 -1
- package/es/components/message/src/method.mjs +2 -2
- package/es/components/notification/index.mjs +1 -1
- package/es/components/notification/src/notification.mjs +69 -147
- package/es/components/notification/src/notification.mjs.map +1 -1
- package/es/components/notification/src/notification2.mjs +147 -69
- package/es/components/notification/src/notification2.mjs.map +1 -1
- package/es/components/notification/src/notify.mjs +2 -2
- package/es/components/page-header/index.mjs +2 -2
- package/es/components/page-header/src/page-header.mjs +103 -17
- package/es/components/page-header/src/page-header.mjs.map +1 -1
- package/es/components/page-header/src/page-header2.mjs +17 -103
- package/es/components/page-header/src/page-header2.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper.mjs +60 -9
- package/es/components/pagination/src/components/jumper.mjs.map +1 -1
- package/es/components/pagination/src/components/jumper2.mjs +9 -60
- package/es/components/pagination/src/components/jumper2.mjs.map +1 -1
- package/es/components/pagination/src/components/next.mjs +58 -19
- package/es/components/pagination/src/components/next.mjs.map +1 -1
- package/es/components/pagination/src/components/next2.mjs +19 -58
- package/es/components/pagination/src/components/next2.mjs.map +1 -1
- package/es/components/pagination/src/pagination.mjs +2 -2
- package/es/components/popconfirm/index.mjs +2 -2
- package/es/components/popconfirm/src/popconfirm.mjs +110 -47
- package/es/components/popconfirm/src/popconfirm.mjs.map +1 -1
- package/es/components/popconfirm/src/popconfirm2.mjs +47 -110
- package/es/components/popconfirm/src/popconfirm2.mjs.map +1 -1
- package/es/components/popover/src/popover.mjs +2 -2
- package/es/components/popper/index.mjs +2 -2
- package/es/components/popper/src/content.mjs +137 -94
- package/es/components/popper/src/content.mjs.map +1 -1
- package/es/components/popper/src/content2.mjs +94 -137
- package/es/components/popper/src/content2.mjs.map +1 -1
- package/es/components/progress/index.mjs +2 -2
- package/es/components/progress/src/progress.mjs +202 -57
- package/es/components/progress/src/progress.mjs.map +1 -1
- package/es/components/progress/src/progress2.mjs +57 -202
- package/es/components/progress/src/progress2.mjs.map +1 -1
- package/es/components/radio/index.mjs +2 -2
- package/es/components/radio/src/radio-group.mjs +68 -36
- package/es/components/radio/src/radio-group.mjs.map +1 -1
- package/es/components/radio/src/radio-group2.mjs +36 -68
- package/es/components/radio/src/radio-group2.mjs.map +1 -1
- package/es/components/rate/index.mjs +2 -2
- package/es/components/rate/src/rate.mjs +87 -255
- package/es/components/rate/src/rate.mjs.map +1 -1
- package/es/components/rate/src/rate2.mjs +255 -87
- package/es/components/rate/src/rate2.mjs.map +1 -1
- package/es/components/roving-focus-group/index.mjs +3 -3
- package/es/components/roving-focus-group/src/roving-focus-group-impl.mjs +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group.mjs +27 -29
- package/es/components/roving-focus-group/src/roving-focus-group.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs +29 -27
- package/es/components/roving-focus-group/src/roving-focus-group2.mjs.map +1 -1
- package/es/components/roving-focus-group/src/roving-focus-item.mjs +1 -1
- package/es/components/row/index.mjs +2 -2
- package/es/components/row/src/row.mjs +45 -30
- package/es/components/row/src/row.mjs.map +1 -1
- package/es/components/row/src/row2.mjs +30 -45
- package/es/components/row/src/row2.mjs.map +1 -1
- package/es/components/scrollbar/src/bar.mjs +17 -42
- package/es/components/scrollbar/src/bar.mjs.map +1 -1
- package/es/components/scrollbar/src/bar2.mjs +42 -17
- package/es/components/scrollbar/src/bar2.mjs.map +1 -1
- package/es/components/scrollbar/src/scrollbar.mjs +1 -1
- package/es/components/select/src/select.mjs +1 -1
- package/es/components/select/src/select.mjs.map +1 -1
- package/es/components/skeleton/index.mjs +4 -4
- package/es/components/skeleton/src/skeleton-item.mjs +18 -23
- package/es/components/skeleton/src/skeleton-item.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton-item2.mjs +23 -18
- package/es/components/skeleton/src/skeleton-item2.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton.mjs +22 -49
- package/es/components/skeleton/src/skeleton.mjs.map +1 -1
- package/es/components/skeleton/src/skeleton2.mjs +49 -22
- package/es/components/skeleton/src/skeleton2.mjs.map +1 -1
- package/es/components/slider/src/button.mjs +21 -93
- package/es/components/slider/src/button.mjs.map +1 -1
- package/es/components/slider/src/button2.mjs +93 -21
- package/es/components/slider/src/button2.mjs.map +1 -1
- package/es/components/slider/src/slider.mjs +1 -1
- package/es/components/steps/index.mjs +2 -2
- package/es/components/steps/src/item.mjs +188 -19
- package/es/components/steps/src/item.mjs.map +1 -1
- package/es/components/steps/src/item2.mjs +19 -188
- package/es/components/steps/src/item2.mjs.map +1 -1
- package/es/components/switch/index.mjs +2 -2
- package/es/components/switch/src/switch.mjs +241 -88
- package/es/components/switch/src/switch.mjs.map +1 -1
- package/es/components/switch/src/switch2.mjs +88 -241
- package/es/components/switch/src/switch2.mjs.map +1 -1
- package/es/components/timeline/index.mjs +2 -2
- package/es/components/timeline/src/timeline-item.mjs +70 -42
- package/es/components/timeline/src/timeline-item.mjs.map +1 -1
- package/es/components/timeline/src/timeline-item2.mjs +42 -70
- package/es/components/timeline/src/timeline-item2.mjs.map +1 -1
- package/es/components/tooltip/index.mjs +1 -1
- package/es/components/tooltip/src/content.mjs +1 -1
- package/es/components/tooltip/src/content2.mjs +1 -1
- package/es/components/tooltip/src/tooltip.mjs +1 -1
- package/es/components/tooltip/src/tooltip2.mjs +1 -1
- package/es/components/tooltip/src/trigger.mjs +73 -16
- package/es/components/tooltip/src/trigger.mjs.map +1 -1
- package/es/components/tooltip/src/trigger2.mjs +16 -73
- package/es/components/tooltip/src/trigger2.mjs.map +1 -1
- package/es/components/tooltip-v2/index.mjs +4 -4
- package/es/components/tooltip-v2/src/arrow.mjs +37 -22
- package/es/components/tooltip-v2/src/arrow.mjs.map +1 -1
- package/es/components/tooltip-v2/src/arrow2.mjs +22 -37
- package/es/components/tooltip-v2/src/arrow2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content.mjs +50 -112
- package/es/components/tooltip-v2/src/content.mjs.map +1 -1
- package/es/components/tooltip-v2/src/content2.mjs +112 -50
- package/es/components/tooltip-v2/src/content2.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip.mjs +20 -73
- package/es/components/tooltip-v2/src/tooltip.mjs.map +1 -1
- package/es/components/tooltip-v2/src/tooltip2.mjs +73 -20
- package/es/components/tooltip-v2/src/tooltip2.mjs.map +1 -1
- package/es/components/upload/index.mjs +3 -3
- package/es/components/upload/src/upload-content.mjs +33 -173
- package/es/components/upload/src/upload-content.mjs.map +1 -1
- package/es/components/upload/src/upload-content2.mjs +173 -33
- package/es/components/upload/src/upload-content2.mjs.map +1 -1
- package/es/components/upload/src/upload-list.mjs +1 -1
- package/es/components/upload/src/upload.mjs +119 -105
- package/es/components/upload/src/upload.mjs.map +1 -1
- package/es/components/upload/src/upload2.mjs +105 -119
- package/es/components/upload/src/upload2.mjs.map +1 -1
- package/es/components/upload/src/use-handlers.mjs +1 -1
- package/es/index.mjs +33 -33
- package/lib/components/affix/index.js +2 -2
- package/lib/components/affix/src/affix.js +27 -117
- package/lib/components/affix/src/affix.js.map +1 -1
- package/lib/components/affix/src/affix2.js +117 -27
- package/lib/components/affix/src/affix2.js.map +1 -1
- package/lib/components/autocomplete/index.js +2 -2
- package/lib/components/autocomplete/src/autocomplete.js +396 -96
- package/lib/components/autocomplete/src/autocomplete.js.map +1 -1
- package/lib/components/autocomplete/src/autocomplete2.js +96 -396
- package/lib/components/autocomplete/src/autocomplete2.js.map +1 -1
- package/lib/components/avatar/index.js +2 -2
- package/lib/components/avatar/src/avatar.js +67 -33
- package/lib/components/avatar/src/avatar.js.map +1 -1
- package/lib/components/avatar/src/avatar2.js +33 -67
- package/lib/components/avatar/src/avatar2.js.map +1 -1
- package/lib/components/backtop/index.js +2 -2
- package/lib/components/backtop/src/backtop.js +22 -54
- package/lib/components/backtop/src/backtop.js.map +1 -1
- package/lib/components/backtop/src/backtop2.js +54 -22
- package/lib/components/backtop/src/backtop2.js.map +1 -1
- package/lib/components/calendar/index.js +2 -2
- package/lib/components/calendar/src/calendar.js +19 -131
- package/lib/components/calendar/src/calendar.js.map +1 -1
- package/lib/components/calendar/src/calendar2.js +131 -19
- package/lib/components/calendar/src/calendar2.js.map +1 -1
- package/lib/components/carousel/index.js +2 -2
- package/lib/components/carousel/src/carousel.js +159 -57
- package/lib/components/carousel/src/carousel.js.map +1 -1
- package/lib/components/carousel/src/carousel2.js +57 -159
- package/lib/components/carousel/src/carousel2.js.map +1 -1
- package/lib/components/checkbox/index.js +2 -2
- package/lib/components/checkbox/src/checkbox-button.js +1 -1
- package/lib/components/checkbox/src/checkbox.js +50 -117
- package/lib/components/checkbox/src/checkbox.js.map +1 -1
- package/lib/components/checkbox/src/checkbox2.js +117 -50
- package/lib/components/checkbox/src/checkbox2.js.map +1 -1
- package/lib/components/collapse/index.js +2 -2
- package/lib/components/collapse/src/collapse.js +19 -30
- package/lib/components/collapse/src/collapse.js.map +1 -1
- package/lib/components/collapse/src/collapse2.js +30 -19
- package/lib/components/collapse/src/collapse2.js.map +1 -1
- package/lib/components/dropdown/index.js +2 -2
- package/lib/components/dropdown/src/dropdown-item-impl.js +2 -2
- package/lib/components/dropdown/src/dropdown-item.js +1 -1
- package/lib/components/dropdown/src/dropdown-menu.js +2 -2
- package/lib/components/dropdown/src/dropdown.js +106 -307
- package/lib/components/dropdown/src/dropdown.js.map +1 -1
- package/lib/components/dropdown/src/dropdown2.js +307 -106
- package/lib/components/dropdown/src/dropdown2.js.map +1 -1
- package/lib/components/empty/index.js +2 -2
- package/lib/components/empty/src/empty.js +11 -55
- package/lib/components/empty/src/empty.js.map +1 -1
- package/lib/components/empty/src/empty2.js +55 -11
- package/lib/components/empty/src/empty2.js.map +1 -1
- package/lib/components/form/index.js +2 -2
- package/lib/components/form/src/form-item.js +321 -44
- package/lib/components/form/src/form-item.js.map +1 -1
- package/lib/components/form/src/form-item2.js +44 -321
- package/lib/components/form/src/form-item2.js.map +1 -1
- package/lib/components/icon/index.js +2 -2
- package/lib/components/icon/src/icon.js +8 -36
- package/lib/components/icon/src/icon.js.map +1 -1
- package/lib/components/icon/src/icon2.js +36 -8
- package/lib/components/icon/src/icon2.js.map +1 -1
- package/lib/components/image/index.js +2 -2
- package/lib/components/image/src/image.js +219 -62
- package/lib/components/image/src/image.js.map +1 -1
- package/lib/components/image/src/image2.js +62 -219
- package/lib/components/image/src/image2.js.map +1 -1
- package/lib/components/image-viewer/index.js +2 -2
- package/lib/components/image-viewer/src/image-viewer.js +40 -396
- package/lib/components/image-viewer/src/image-viewer.js.map +1 -1
- package/lib/components/image-viewer/src/image-viewer2.js +396 -40
- package/lib/components/image-viewer/src/image-viewer2.js.map +1 -1
- package/lib/components/index.js +33 -33
- package/lib/components/input/index.js +2 -2
- package/lib/components/input/src/input.js +143 -551
- package/lib/components/input/src/input.js.map +1 -1
- package/lib/components/input/src/input2.js +551 -143
- package/lib/components/input/src/input2.js.map +1 -1
- package/lib/components/message/index.js +1 -1
- package/lib/components/message/src/message.js +196 -92
- package/lib/components/message/src/message.js.map +1 -1
- package/lib/components/message/src/message2.js +92 -196
- package/lib/components/message/src/message2.js.map +1 -1
- package/lib/components/message/src/method.js +2 -2
- package/lib/components/notification/index.js +1 -1
- package/lib/components/notification/src/notification.js +70 -146
- package/lib/components/notification/src/notification.js.map +1 -1
- package/lib/components/notification/src/notification2.js +146 -70
- package/lib/components/notification/src/notification2.js.map +1 -1
- package/lib/components/notification/src/notify.js +2 -2
- package/lib/components/page-header/index.js +2 -2
- package/lib/components/page-header/src/page-header.js +103 -18
- package/lib/components/page-header/src/page-header.js.map +1 -1
- package/lib/components/page-header/src/page-header2.js +18 -103
- package/lib/components/page-header/src/page-header2.js.map +1 -1
- package/lib/components/pagination/src/components/jumper.js +60 -9
- package/lib/components/pagination/src/components/jumper.js.map +1 -1
- package/lib/components/pagination/src/components/jumper2.js +9 -60
- package/lib/components/pagination/src/components/jumper2.js.map +1 -1
- package/lib/components/pagination/src/components/next.js +58 -19
- package/lib/components/pagination/src/components/next.js.map +1 -1
- package/lib/components/pagination/src/components/next2.js +19 -58
- package/lib/components/pagination/src/components/next2.js.map +1 -1
- package/lib/components/pagination/src/pagination.js +2 -2
- package/lib/components/popconfirm/index.js +2 -2
- package/lib/components/popconfirm/src/popconfirm.js +110 -48
- package/lib/components/popconfirm/src/popconfirm.js.map +1 -1
- package/lib/components/popconfirm/src/popconfirm2.js +48 -110
- package/lib/components/popconfirm/src/popconfirm2.js.map +1 -1
- package/lib/components/popover/src/popover.js +2 -2
- package/lib/components/popper/index.js +2 -2
- package/lib/components/popper/src/content.js +137 -99
- package/lib/components/popper/src/content.js.map +1 -1
- package/lib/components/popper/src/content2.js +99 -137
- package/lib/components/popper/src/content2.js.map +1 -1
- package/lib/components/progress/index.js +2 -2
- package/lib/components/progress/src/progress.js +202 -57
- package/lib/components/progress/src/progress.js.map +1 -1
- package/lib/components/progress/src/progress2.js +57 -202
- package/lib/components/progress/src/progress2.js.map +1 -1
- package/lib/components/radio/index.js +2 -2
- package/lib/components/radio/src/radio-group.js +68 -37
- package/lib/components/radio/src/radio-group.js.map +1 -1
- package/lib/components/radio/src/radio-group2.js +37 -68
- package/lib/components/radio/src/radio-group2.js.map +1 -1
- package/lib/components/rate/index.js +2 -2
- package/lib/components/rate/src/rate.js +87 -254
- package/lib/components/rate/src/rate.js.map +1 -1
- package/lib/components/rate/src/rate2.js +254 -87
- package/lib/components/rate/src/rate2.js.map +1 -1
- package/lib/components/roving-focus-group/index.js +2 -2
- package/lib/components/roving-focus-group/src/roving-focus-group-impl.js +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group.js +27 -33
- package/lib/components/roving-focus-group/src/roving-focus-group.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-group2.js +33 -27
- package/lib/components/roving-focus-group/src/roving-focus-group2.js.map +1 -1
- package/lib/components/roving-focus-group/src/roving-focus-item.js +1 -1
- package/lib/components/row/index.js +2 -2
- package/lib/components/row/src/row.js +45 -32
- package/lib/components/row/src/row.js.map +1 -1
- package/lib/components/row/src/row2.js +32 -45
- package/lib/components/row/src/row2.js.map +1 -1
- package/lib/components/scrollbar/src/bar.js +17 -42
- package/lib/components/scrollbar/src/bar.js.map +1 -1
- package/lib/components/scrollbar/src/bar2.js +42 -17
- package/lib/components/scrollbar/src/bar2.js.map +1 -1
- package/lib/components/scrollbar/src/scrollbar.js +1 -1
- package/lib/components/select/src/select.js +1 -1
- package/lib/components/select/src/select.js.map +1 -1
- package/lib/components/skeleton/index.js +4 -4
- package/lib/components/skeleton/src/skeleton-item.js +18 -23
- package/lib/components/skeleton/src/skeleton-item.js.map +1 -1
- package/lib/components/skeleton/src/skeleton-item2.js +23 -18
- package/lib/components/skeleton/src/skeleton-item2.js.map +1 -1
- package/lib/components/skeleton/src/skeleton.js +22 -49
- package/lib/components/skeleton/src/skeleton.js.map +1 -1
- package/lib/components/skeleton/src/skeleton2.js +49 -22
- package/lib/components/skeleton/src/skeleton2.js.map +1 -1
- package/lib/components/slider/src/button.js +22 -93
- package/lib/components/slider/src/button.js.map +1 -1
- package/lib/components/slider/src/button2.js +93 -22
- package/lib/components/slider/src/button2.js.map +1 -1
- package/lib/components/slider/src/slider.js +1 -1
- package/lib/components/steps/index.js +2 -2
- package/lib/components/steps/src/item.js +188 -19
- package/lib/components/steps/src/item.js.map +1 -1
- package/lib/components/steps/src/item2.js +19 -188
- package/lib/components/steps/src/item2.js.map +1 -1
- package/lib/components/switch/index.js +2 -2
- package/lib/components/switch/src/switch.js +240 -88
- package/lib/components/switch/src/switch.js.map +1 -1
- package/lib/components/switch/src/switch2.js +88 -240
- package/lib/components/switch/src/switch2.js.map +1 -1
- package/lib/components/timeline/index.js +2 -2
- package/lib/components/timeline/src/timeline-item.js +70 -42
- package/lib/components/timeline/src/timeline-item.js.map +1 -1
- package/lib/components/timeline/src/timeline-item2.js +42 -70
- package/lib/components/timeline/src/timeline-item2.js.map +1 -1
- package/lib/components/tooltip/index.js +1 -1
- package/lib/components/tooltip/src/content.js +1 -1
- package/lib/components/tooltip/src/content2.js +1 -1
- package/lib/components/tooltip/src/tooltip.js +1 -1
- package/lib/components/tooltip/src/tooltip2.js +1 -1
- package/lib/components/tooltip/src/trigger.js +73 -16
- package/lib/components/tooltip/src/trigger.js.map +1 -1
- package/lib/components/tooltip/src/trigger2.js +16 -73
- package/lib/components/tooltip/src/trigger2.js.map +1 -1
- package/lib/components/tooltip-v2/index.js +4 -4
- package/lib/components/tooltip-v2/src/arrow.js +37 -23
- package/lib/components/tooltip-v2/src/arrow.js.map +1 -1
- package/lib/components/tooltip-v2/src/arrow2.js +23 -37
- package/lib/components/tooltip-v2/src/arrow2.js.map +1 -1
- package/lib/components/tooltip-v2/src/content.js +50 -112
- package/lib/components/tooltip-v2/src/content.js.map +1 -1
- package/lib/components/tooltip-v2/src/content2.js +112 -50
- package/lib/components/tooltip-v2/src/content2.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip.js +20 -73
- package/lib/components/tooltip-v2/src/tooltip.js.map +1 -1
- package/lib/components/tooltip-v2/src/tooltip2.js +73 -20
- package/lib/components/tooltip-v2/src/tooltip2.js.map +1 -1
- package/lib/components/upload/index.js +3 -3
- package/lib/components/upload/src/upload-content.js +33 -173
- package/lib/components/upload/src/upload-content.js.map +1 -1
- package/lib/components/upload/src/upload-content2.js +173 -33
- package/lib/components/upload/src/upload-content2.js.map +1 -1
- package/lib/components/upload/src/upload-list.js +1 -1
- package/lib/components/upload/src/upload.js +119 -108
- package/lib/components/upload/src/upload.js.map +1 -1
- package/lib/components/upload/src/upload2.js +108 -119
- package/lib/components/upload/src/upload2.js.map +1 -1
- package/lib/components/upload/src/use-handlers.js +1 -1
- package/lib/index.js +33 -33
- package/package.json +1 -1
|
@@ -1,194 +1,25 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, getCurrentInstance, onMounted, watch, onBeforeUnmount, computed, reactive, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createCommentVNode, createElementVNode, renderSlot, createBlock, withCtx, resolveDynamicComponent, createVNode, toDisplayString, createTextVNode } from 'vue';
|
|
2
|
-
import '../../../hooks/index.mjs';
|
|
3
|
-
import { ElIcon } from '../../icon/index.mjs';
|
|
4
|
-
import { Check, Close } from '@element-plus/icons-vue';
|
|
5
1
|
import '../../../utils/index.mjs';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
9
|
-
import { isNumber } from '../../../utils/types.mjs';
|
|
2
|
+
import { buildProps } from '../../../utils/vue/props/runtime.mjs';
|
|
3
|
+
import { iconPropType } from '../../../utils/vue/icon.mjs';
|
|
10
4
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
() => parent.props.active,
|
|
28
|
-
() => parent.props.processStatus,
|
|
29
|
-
() => parent.props.finishStatus
|
|
30
|
-
], ([active]) => {
|
|
31
|
-
updateStatus(active);
|
|
32
|
-
}, { immediate: true });
|
|
33
|
-
});
|
|
34
|
-
onBeforeUnmount(() => {
|
|
35
|
-
parent.steps.value = parent.steps.value.filter((instance) => instance.uid !== (currentInstance == null ? void 0 : currentInstance.uid));
|
|
36
|
-
});
|
|
37
|
-
const currentStatus = computed(() => {
|
|
38
|
-
return props.status || internalStatus.value;
|
|
39
|
-
});
|
|
40
|
-
const prevStatus = computed(() => {
|
|
41
|
-
const prevStep = parent.steps.value[index.value - 1];
|
|
42
|
-
return prevStep ? prevStep.currentStatus : "wait";
|
|
43
|
-
});
|
|
44
|
-
const isCenter = computed(() => {
|
|
45
|
-
return parent.props.alignCenter;
|
|
46
|
-
});
|
|
47
|
-
const isVertical = computed(() => {
|
|
48
|
-
return parent.props.direction === "vertical";
|
|
49
|
-
});
|
|
50
|
-
const isSimple = computed(() => {
|
|
51
|
-
return parent.props.simple;
|
|
52
|
-
});
|
|
53
|
-
const stepsCount = computed(() => {
|
|
54
|
-
return parent.steps.value.length;
|
|
55
|
-
});
|
|
56
|
-
const isLast = computed(() => {
|
|
57
|
-
var _a;
|
|
58
|
-
return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
|
|
59
|
-
});
|
|
60
|
-
const space = computed(() => {
|
|
61
|
-
return isSimple.value ? "" : parent.props.space;
|
|
62
|
-
});
|
|
63
|
-
const style = computed(() => {
|
|
64
|
-
const style2 = {
|
|
65
|
-
flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
|
|
66
|
-
};
|
|
67
|
-
if (isVertical.value)
|
|
68
|
-
return style2;
|
|
69
|
-
if (isLast.value) {
|
|
70
|
-
style2.maxWidth = `${100 / stepsCount.value}%`;
|
|
71
|
-
}
|
|
72
|
-
return style2;
|
|
73
|
-
});
|
|
74
|
-
const setIndex = (val) => {
|
|
75
|
-
index.value = val;
|
|
76
|
-
};
|
|
77
|
-
const calcProgress = (status) => {
|
|
78
|
-
const isWait = status === "wait";
|
|
79
|
-
const style2 = {
|
|
80
|
-
transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
|
|
81
|
-
};
|
|
82
|
-
const step = status === parent.props.processStatus || isWait ? 0 : 100;
|
|
83
|
-
style2.borderWidth = step && !isSimple.value ? "1px" : 0;
|
|
84
|
-
style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
|
|
85
|
-
lineStyle.value = style2;
|
|
86
|
-
};
|
|
87
|
-
const updateStatus = (activeIndex) => {
|
|
88
|
-
if (activeIndex > index.value) {
|
|
89
|
-
internalStatus.value = parent.props.finishStatus;
|
|
90
|
-
} else if (activeIndex === index.value && prevStatus.value !== "error") {
|
|
91
|
-
internalStatus.value = parent.props.processStatus;
|
|
92
|
-
} else {
|
|
93
|
-
internalStatus.value = "wait";
|
|
94
|
-
}
|
|
95
|
-
const prevChild = parent.steps.value[index.value - 1];
|
|
96
|
-
if (prevChild)
|
|
97
|
-
prevChild.calcProgress(internalStatus.value);
|
|
98
|
-
};
|
|
99
|
-
const stepItemState = reactive({
|
|
100
|
-
uid: computed(() => currentInstance == null ? void 0 : currentInstance.uid),
|
|
101
|
-
currentStatus,
|
|
102
|
-
setIndex,
|
|
103
|
-
calcProgress
|
|
104
|
-
});
|
|
105
|
-
parent.steps.value = [...parent.steps.value, stepItemState];
|
|
106
|
-
return (_ctx, _cache) => {
|
|
107
|
-
return openBlock(), createElementBlock("div", {
|
|
108
|
-
style: normalizeStyle(unref(style)),
|
|
109
|
-
class: normalizeClass([
|
|
110
|
-
unref(ns).b(),
|
|
111
|
-
unref(ns).is(unref(isSimple) ? "simple" : unref(parent).props.direction),
|
|
112
|
-
unref(ns).is("flex", unref(isLast) && !unref(space) && !unref(isCenter)),
|
|
113
|
-
unref(ns).is("center", unref(isCenter) && !unref(isVertical) && !unref(isSimple))
|
|
114
|
-
])
|
|
115
|
-
}, [
|
|
116
|
-
createCommentVNode(" icon & line "),
|
|
117
|
-
createElementVNode("div", {
|
|
118
|
-
class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
|
|
119
|
-
}, [
|
|
120
|
-
!unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
121
|
-
key: 0,
|
|
122
|
-
class: normalizeClass(unref(ns).e("line"))
|
|
123
|
-
}, [
|
|
124
|
-
createElementVNode("i", {
|
|
125
|
-
class: normalizeClass(unref(ns).e("line-inner")),
|
|
126
|
-
style: normalizeStyle(lineStyle.value)
|
|
127
|
-
}, null, 6)
|
|
128
|
-
], 2)) : createCommentVNode("v-if", true),
|
|
129
|
-
createElementVNode("div", {
|
|
130
|
-
class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
|
|
131
|
-
}, [
|
|
132
|
-
renderSlot(_ctx.$slots, "icon", {}, () => [
|
|
133
|
-
_ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
134
|
-
key: 0,
|
|
135
|
-
class: normalizeClass(unref(ns).e("icon-inner"))
|
|
136
|
-
}, {
|
|
137
|
-
default: withCtx(() => [
|
|
138
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
|
|
139
|
-
]),
|
|
140
|
-
_: 1
|
|
141
|
-
}, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
142
|
-
key: 1,
|
|
143
|
-
class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
|
|
144
|
-
}, {
|
|
145
|
-
default: withCtx(() => [
|
|
146
|
-
createVNode(unref(Check))
|
|
147
|
-
]),
|
|
148
|
-
_: 1
|
|
149
|
-
}, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
150
|
-
key: 2,
|
|
151
|
-
class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
|
|
152
|
-
}, {
|
|
153
|
-
default: withCtx(() => [
|
|
154
|
-
createVNode(unref(Close))
|
|
155
|
-
]),
|
|
156
|
-
_: 1
|
|
157
|
-
}, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
158
|
-
key: 3,
|
|
159
|
-
class: normalizeClass(unref(ns).e("icon-inner"))
|
|
160
|
-
}, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)
|
|
161
|
-
])
|
|
162
|
-
], 2)
|
|
163
|
-
], 2),
|
|
164
|
-
createCommentVNode(" title & description "),
|
|
165
|
-
createElementVNode("div", {
|
|
166
|
-
class: normalizeClass(unref(ns).e("main"))
|
|
167
|
-
}, [
|
|
168
|
-
createElementVNode("div", {
|
|
169
|
-
class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
|
|
170
|
-
}, [
|
|
171
|
-
renderSlot(_ctx.$slots, "title", {}, () => [
|
|
172
|
-
createTextVNode(toDisplayString(_ctx.title), 1)
|
|
173
|
-
])
|
|
174
|
-
], 2),
|
|
175
|
-
unref(isSimple) ? (openBlock(), createElementBlock("div", {
|
|
176
|
-
key: 0,
|
|
177
|
-
class: normalizeClass(unref(ns).e("arrow"))
|
|
178
|
-
}, null, 2)) : (openBlock(), createElementBlock("div", {
|
|
179
|
-
key: 1,
|
|
180
|
-
class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
|
|
181
|
-
}, [
|
|
182
|
-
renderSlot(_ctx.$slots, "description", {}, () => [
|
|
183
|
-
createTextVNode(toDisplayString(_ctx.description), 1)
|
|
184
|
-
])
|
|
185
|
-
], 2))
|
|
186
|
-
], 2)
|
|
187
|
-
], 6);
|
|
188
|
-
};
|
|
5
|
+
const stepProps = buildProps({
|
|
6
|
+
title: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: ""
|
|
9
|
+
},
|
|
10
|
+
icon: {
|
|
11
|
+
type: iconPropType
|
|
12
|
+
},
|
|
13
|
+
description: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: ""
|
|
16
|
+
},
|
|
17
|
+
status: {
|
|
18
|
+
type: String,
|
|
19
|
+
values: ["", "wait", "process", "finish", "error", "success"],
|
|
20
|
+
default: ""
|
|
189
21
|
}
|
|
190
22
|
});
|
|
191
|
-
var Step = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:\\beyondtrucks\\beyond-ui\\packages\\components\\steps\\src\\item.vue"]]);
|
|
192
23
|
|
|
193
|
-
export {
|
|
24
|
+
export { stepProps };
|
|
194
25
|
//# sourceMappingURL=item2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item2.mjs","sources":["../../../../../../packages/components/steps/src/item.
|
|
1
|
+
{"version":3,"file":"item2.mjs","sources":["../../../../../../packages/components/steps/src/item.ts"],"sourcesContent":["import { buildProps, iconPropType } from '@element-plus/utils'\nimport type Step from './item.vue'\nimport type { ExtractPropTypes } from 'vue'\n\nexport const stepProps = buildProps({\n title: {\n type: String,\n default: '',\n },\n icon: {\n type: iconPropType,\n },\n description: {\n type: String,\n default: '',\n },\n status: {\n type: String,\n values: ['', 'wait', 'process', 'finish', 'error', 'success'],\n default: '',\n },\n} as const)\n\nexport type StepProps = ExtractPropTypes<typeof stepProps>\n\nexport type StepInstance = InstanceType<typeof Step>\n"],"names":[],"mappings":";;;;AACY,MAAC,SAAS,GAAG,UAAU,CAAC;AACpC,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,YAAY;AACtB,GAAG;AACH,EAAE,WAAW,EAAE;AACf,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;AACjE,IAAI,OAAO,EAAE,EAAE;AACf,GAAG;AACH,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../utils/index.mjs';
|
|
2
|
-
import Switch from './src/
|
|
3
|
-
export { switchEmits, switchProps } from './src/
|
|
2
|
+
import Switch from './src/switch.mjs';
|
|
3
|
+
export { switchEmits, switchProps } from './src/switch2.mjs';
|
|
4
4
|
import { withInstall } from '../../utils/vue/install.mjs';
|
|
5
5
|
|
|
6
6
|
const ElSwitch = withInstall(Switch);
|
|
@@ -1,96 +1,249 @@
|
|
|
1
|
+
import { defineComponent, getCurrentInstance, computed, ref, watch, nextTick, onMounted, openBlock, createElementBlock, normalizeClass, unref, normalizeStyle, withModifiers, createElementVNode, withKeys, createBlock, withCtx, resolveDynamicComponent, createCommentVNode, toDisplayString, createVNode } from 'vue';
|
|
2
|
+
import { isPromise } from '@vue/shared';
|
|
1
3
|
import '../../../utils/index.mjs';
|
|
4
|
+
import { ElIcon } from '../../icon/index.mjs';
|
|
5
|
+
import '../../form/index.mjs';
|
|
6
|
+
import { Loading } from '@element-plus/icons-vue';
|
|
2
7
|
import '../../../constants/index.mjs';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
8
|
+
import '../../../hooks/index.mjs';
|
|
9
|
+
import { switchProps, switchEmits } from './switch2.mjs';
|
|
10
|
+
import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
|
|
11
|
+
import { useFormItem, useFormItemInputId } from '../../form/src/hooks/use-form-item.mjs';
|
|
12
|
+
import { useFormSize, useFormDisabled } from '../../form/src/hooks/use-form-common-props.mjs';
|
|
13
|
+
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
|
|
14
|
+
import { useDeprecated } from '../../../hooks/use-deprecated/index.mjs';
|
|
15
|
+
import { addUnit } from '../../../utils/dom/style.mjs';
|
|
6
16
|
import { UPDATE_MODEL_EVENT, CHANGE_EVENT, INPUT_EVENT } from '../../../constants/event.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
17
|
+
import { debugWarn, throwError } from '../../../utils/error.mjs';
|
|
18
|
+
import { isBoolean } from '../../../utils/types.mjs';
|
|
9
19
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
20
|
+
const _hoisted_1 = ["onClick"];
|
|
21
|
+
const _hoisted_2 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
|
|
22
|
+
const _hoisted_3 = ["aria-hidden"];
|
|
23
|
+
const _hoisted_4 = ["aria-hidden"];
|
|
24
|
+
const _hoisted_5 = ["aria-hidden"];
|
|
25
|
+
const COMPONENT_NAME = "ElSwitch";
|
|
26
|
+
const __default__ = defineComponent({
|
|
27
|
+
name: COMPONENT_NAME
|
|
28
|
+
});
|
|
29
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
30
|
+
...__default__,
|
|
31
|
+
props: switchProps,
|
|
32
|
+
emits: switchEmits,
|
|
33
|
+
setup(__props, { expose, emit }) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const vm = getCurrentInstance();
|
|
36
|
+
const { formItem } = useFormItem();
|
|
37
|
+
const switchSize = useFormSize();
|
|
38
|
+
const ns = useNamespace("switch");
|
|
39
|
+
useDeprecated({
|
|
40
|
+
from: '"value"',
|
|
41
|
+
replacement: '"model-value" or "v-model"',
|
|
42
|
+
scope: COMPONENT_NAME,
|
|
43
|
+
version: "2.3.0",
|
|
44
|
+
ref: "https://element-plus.org/en-US/component/switch.html#attributes",
|
|
45
|
+
type: "Attribute"
|
|
46
|
+
}, computed(() => {
|
|
47
|
+
var _a;
|
|
48
|
+
return !!((_a = vm.vnode.props) == null ? void 0 : _a.value);
|
|
49
|
+
}));
|
|
50
|
+
const { inputId } = useFormItemInputId(props, {
|
|
51
|
+
formItemContext: formItem
|
|
52
|
+
});
|
|
53
|
+
const switchDisabled = useFormDisabled(computed(() => props.loading));
|
|
54
|
+
const isControlled = ref(props.modelValue !== false);
|
|
55
|
+
const input = ref();
|
|
56
|
+
const core = ref();
|
|
57
|
+
const switchKls = computed(() => [
|
|
58
|
+
ns.b(),
|
|
59
|
+
ns.m(switchSize.value),
|
|
60
|
+
ns.is("disabled", switchDisabled.value),
|
|
61
|
+
ns.is("checked", checked.value)
|
|
62
|
+
]);
|
|
63
|
+
const coreStyle = computed(() => ({
|
|
64
|
+
width: addUnit(props.width)
|
|
65
|
+
}));
|
|
66
|
+
watch(() => props.modelValue, () => {
|
|
67
|
+
isControlled.value = true;
|
|
68
|
+
});
|
|
69
|
+
watch(() => props.value, () => {
|
|
70
|
+
isControlled.value = false;
|
|
71
|
+
});
|
|
72
|
+
const actualValue = computed(() => {
|
|
73
|
+
return isControlled.value ? props.modelValue : props.value;
|
|
74
|
+
});
|
|
75
|
+
const checked = computed(() => actualValue.value === props.activeValue);
|
|
76
|
+
if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
|
|
77
|
+
emit(UPDATE_MODEL_EVENT, props.inactiveValue);
|
|
78
|
+
emit(CHANGE_EVENT, props.inactiveValue);
|
|
79
|
+
emit(INPUT_EVENT, props.inactiveValue);
|
|
80
|
+
}
|
|
81
|
+
watch(checked, (val) => {
|
|
82
|
+
var _a;
|
|
83
|
+
input.value.checked = val;
|
|
84
|
+
if (props.validateEvent) {
|
|
85
|
+
(_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
const handleChange = () => {
|
|
89
|
+
const val = checked.value ? props.inactiveValue : props.activeValue;
|
|
90
|
+
emit(UPDATE_MODEL_EVENT, val);
|
|
91
|
+
emit(CHANGE_EVENT, val);
|
|
92
|
+
emit(INPUT_EVENT, val);
|
|
93
|
+
nextTick(() => {
|
|
94
|
+
input.value.checked = checked.value;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const switchValue = () => {
|
|
98
|
+
if (switchDisabled.value)
|
|
99
|
+
return;
|
|
100
|
+
const { beforeChange } = props;
|
|
101
|
+
if (!beforeChange) {
|
|
102
|
+
handleChange();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const shouldChange = beforeChange();
|
|
106
|
+
const isPromiseOrBool = [
|
|
107
|
+
isPromise(shouldChange),
|
|
108
|
+
isBoolean(shouldChange)
|
|
109
|
+
].includes(true);
|
|
110
|
+
if (!isPromiseOrBool) {
|
|
111
|
+
throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
|
|
112
|
+
}
|
|
113
|
+
if (isPromise(shouldChange)) {
|
|
114
|
+
shouldChange.then((result) => {
|
|
115
|
+
if (result) {
|
|
116
|
+
handleChange();
|
|
117
|
+
}
|
|
118
|
+
}).catch((e) => {
|
|
119
|
+
debugWarn(COMPONENT_NAME, `some error occurred: ${e}`);
|
|
120
|
+
});
|
|
121
|
+
} else if (shouldChange) {
|
|
122
|
+
handleChange();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const styles = computed(() => {
|
|
126
|
+
return ns.cssVarBlock({
|
|
127
|
+
...props.activeColor ? { "on-color": props.activeColor } : null,
|
|
128
|
+
...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
|
|
129
|
+
...props.borderColor ? { "border-color": props.borderColor } : null
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
const focus = () => {
|
|
133
|
+
var _a, _b;
|
|
134
|
+
(_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
|
|
135
|
+
};
|
|
136
|
+
onMounted(() => {
|
|
137
|
+
input.value.checked = checked.value;
|
|
138
|
+
});
|
|
139
|
+
expose({
|
|
140
|
+
focus,
|
|
141
|
+
checked
|
|
142
|
+
});
|
|
143
|
+
return (_ctx, _cache) => {
|
|
144
|
+
return openBlock(), createElementBlock("div", {
|
|
145
|
+
class: normalizeClass(unref(switchKls)),
|
|
146
|
+
style: normalizeStyle(unref(styles)),
|
|
147
|
+
onClick: withModifiers(switchValue, ["prevent"])
|
|
148
|
+
}, [
|
|
149
|
+
createElementVNode("input", {
|
|
150
|
+
id: unref(inputId),
|
|
151
|
+
ref_key: "input",
|
|
152
|
+
ref: input,
|
|
153
|
+
class: normalizeClass(unref(ns).e("input")),
|
|
154
|
+
type: "checkbox",
|
|
155
|
+
role: "switch",
|
|
156
|
+
"aria-checked": unref(checked),
|
|
157
|
+
"aria-disabled": unref(switchDisabled),
|
|
158
|
+
name: _ctx.name,
|
|
159
|
+
"true-value": _ctx.activeValue,
|
|
160
|
+
"false-value": _ctx.inactiveValue,
|
|
161
|
+
disabled: unref(switchDisabled),
|
|
162
|
+
tabindex: _ctx.tabindex,
|
|
163
|
+
onChange: handleChange,
|
|
164
|
+
onKeydown: withKeys(switchValue, ["enter"])
|
|
165
|
+
}, null, 42, _hoisted_2),
|
|
166
|
+
!_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
|
|
167
|
+
key: 0,
|
|
168
|
+
class: normalizeClass([
|
|
169
|
+
unref(ns).e("label"),
|
|
170
|
+
unref(ns).em("label", "left"),
|
|
171
|
+
unref(ns).is("active", !unref(checked))
|
|
172
|
+
])
|
|
173
|
+
}, [
|
|
174
|
+
_ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
|
175
|
+
default: withCtx(() => [
|
|
176
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
|
|
177
|
+
]),
|
|
178
|
+
_: 1
|
|
179
|
+
})) : createCommentVNode("v-if", true),
|
|
180
|
+
!_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
|
|
181
|
+
key: 1,
|
|
182
|
+
"aria-hidden": unref(checked)
|
|
183
|
+
}, toDisplayString(_ctx.inactiveText), 9, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
184
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
185
|
+
createElementVNode("span", {
|
|
186
|
+
ref_key: "core",
|
|
187
|
+
ref: core,
|
|
188
|
+
class: normalizeClass(unref(ns).e("core")),
|
|
189
|
+
style: normalizeStyle(unref(coreStyle))
|
|
190
|
+
}, [
|
|
191
|
+
_ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
|
|
192
|
+
key: 0,
|
|
193
|
+
class: normalizeClass(unref(ns).e("inner"))
|
|
194
|
+
}, [
|
|
195
|
+
_ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
|
|
196
|
+
key: 0,
|
|
197
|
+
class: normalizeClass(unref(ns).is("icon"))
|
|
198
|
+
}, {
|
|
199
|
+
default: withCtx(() => [
|
|
200
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
|
|
201
|
+
]),
|
|
202
|
+
_: 1
|
|
203
|
+
}, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
|
|
204
|
+
key: 1,
|
|
205
|
+
class: normalizeClass(unref(ns).is("text")),
|
|
206
|
+
"aria-hidden": !unref(checked)
|
|
207
|
+
}, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4)) : createCommentVNode("v-if", true)
|
|
208
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
209
|
+
createElementVNode("div", {
|
|
210
|
+
class: normalizeClass(unref(ns).e("action"))
|
|
211
|
+
}, [
|
|
212
|
+
_ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
|
|
213
|
+
key: 0,
|
|
214
|
+
class: normalizeClass(unref(ns).is("loading"))
|
|
215
|
+
}, {
|
|
216
|
+
default: withCtx(() => [
|
|
217
|
+
createVNode(unref(Loading))
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
221
|
+
], 2)
|
|
222
|
+
], 6),
|
|
223
|
+
!_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
|
|
224
|
+
key: 1,
|
|
225
|
+
class: normalizeClass([
|
|
226
|
+
unref(ns).e("label"),
|
|
227
|
+
unref(ns).em("label", "right"),
|
|
228
|
+
unref(ns).is("active", unref(checked))
|
|
229
|
+
])
|
|
230
|
+
}, [
|
|
231
|
+
_ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
|
232
|
+
default: withCtx(() => [
|
|
233
|
+
(openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
})) : createCommentVNode("v-if", true),
|
|
237
|
+
!_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
|
|
238
|
+
key: 1,
|
|
239
|
+
"aria-hidden": !unref(checked)
|
|
240
|
+
}, toDisplayString(_ctx.activeText), 9, _hoisted_5)) : createCommentVNode("v-if", true)
|
|
241
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
242
|
+
], 14, _hoisted_1);
|
|
243
|
+
};
|
|
87
244
|
}
|
|
88
245
|
});
|
|
89
|
-
|
|
90
|
-
[UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
|
|
91
|
-
[CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
|
|
92
|
-
[INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
|
|
93
|
-
};
|
|
246
|
+
var Switch = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "D:\\beyondtrucks\\beyond-ui\\packages\\components\\switch\\src\\switch.vue"]]);
|
|
94
247
|
|
|
95
|
-
export {
|
|
248
|
+
export { Switch as default };
|
|
96
249
|
//# sourceMappingURL=switch.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.mjs","sources":["../../../../../../packages/components/switch/src/switch.ts"],"sourcesContent":["import {\n buildProps,\n definePropType,\n iconPropType,\n isBoolean,\n isNumber,\n isString,\n isValidComponentSize,\n} from '@element-plus/utils'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport type { ComponentSize } from '@element-plus/constants'\nimport type Switch from './switch.vue'\nimport type { ExtractPropTypes, PropType } from 'vue'\n\nexport const switchProps = buildProps({\n modelValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n value: {\n type: [Boolean, String, Number],\n default: false,\n },\n disabled: {\n type: Boolean,\n default: false,\n },\n width: {\n type: [String, Number],\n default: '',\n },\n inlinePrompt: {\n type: Boolean,\n default: false,\n },\n activeIcon: {\n type: iconPropType,\n },\n inactiveIcon: {\n type: iconPropType,\n },\n activeText: {\n type: String,\n default: '',\n },\n inactiveText: {\n type: String,\n default: '',\n },\n activeColor: {\n type: String,\n default: '',\n },\n inactiveColor: {\n type: String,\n default: '',\n },\n borderColor: {\n type: String,\n default: '',\n },\n activeValue: {\n type: [Boolean, String, Number],\n default: true,\n },\n inactiveValue: {\n type: [Boolean, String, Number],\n default: false,\n },\n name: {\n type: String,\n default: '',\n },\n validateEvent: {\n type: Boolean,\n default: true,\n },\n id: String,\n loading: {\n type: Boolean,\n default: false,\n },\n beforeChange: {\n type: definePropType<() => Promise<boolean> | boolean>(Function),\n },\n size: {\n type: String as PropType<ComponentSize>,\n validator: isValidComponentSize,\n },\n tabindex: {\n type: [String, Number],\n },\n} as const)\n\nexport type SwitchProps = ExtractPropTypes<typeof switchProps>\n\nexport const switchEmits = {\n [UPDATE_MODEL_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [CHANGE_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n [INPUT_EVENT]: (val: boolean | string | number) =>\n isBoolean(val) || isString(val) || isNumber(val),\n}\nexport type SwitchEmits = typeof switchEmits\n\nexport type SwitchInstance = InstanceType<typeof Switch>\n"],"names":[],"mappings":";;;;;;;;;AAcY,MAAC,WAAW,GAAG,UAAU,CAAC;AACtC,EAAE,UAAU,EAAE;AACd,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;AACnC,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,M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OAAO,EAAE;AACX,IAAI,IAAI,EAAE,OAAO;AACjB,IAAI,OAAO,EAAE,KAAK;AAClB,GAAG;AACH,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,GAAG;AACH,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,SAAS,EAAE,oBAAoB;AACnC,GAAG;AACH,EAAE,QAAQ,EAAE;AACZ,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;AAC1B,GAAG;AACH,CAAC,EAAE;AACS,MAAC,WAAW,GAAG;AAC3B,EAAE,CAAC,kBAAkB,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AACjF,EAAE,CAAC,YAAY,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC3E,EAAE,CAAC,WAAW,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC;AAC1E;;;;"}
|
|
1
|
+
{"version":3,"file":"switch.mjs","sources":["../../../../../../packages/components/switch/src/switch.vue"],"sourcesContent":["<template>\n <div :class=\"switchKls\" :style=\"styles\" @click.prevent=\"switchValue\">\n <input\n :id=\"inputId\"\n ref=\"input\"\n :class=\"ns.e('input')\"\n type=\"checkbox\"\n role=\"switch\"\n :aria-checked=\"checked\"\n :aria-disabled=\"switchDisabled\"\n :name=\"name\"\n :true-value=\"activeValue\"\n :false-value=\"inactiveValue\"\n :disabled=\"switchDisabled\"\n :tabindex=\"tabindex\"\n @change=\"handleChange\"\n @keydown.enter=\"switchValue\"\n />\n <span\n v-if=\"!inlinePrompt && (inactiveIcon || inactiveText)\"\n :class=\"[\n ns.e('label'),\n ns.em('label', 'left'),\n ns.is('active', !checked),\n ]\"\n >\n <el-icon v-if=\"inactiveIcon\">\n <component :is=\"inactiveIcon\" />\n </el-icon>\n <span v-if=\"!inactiveIcon && inactiveText\" :aria-hidden=\"checked\">{{\n inactiveText\n }}</span>\n </span>\n <span ref=\"core\" :class=\"ns.e('core')\" :style=\"coreStyle\">\n <div v-if=\"inlinePrompt\" :class=\"ns.e('inner')\">\n <template v-if=\"activeIcon || inactiveIcon\">\n <el-icon :class=\"ns.is('icon')\">\n <component :is=\"checked ? activeIcon : inactiveIcon\" />\n </el-icon>\n </template>\n <template v-else-if=\"activeText || inactiveText\">\n <span :class=\"ns.is('text')\" :aria-hidden=\"!checked\">\n {{ checked ? activeText : inactiveText }}\n </span>\n </template>\n </div>\n <div :class=\"ns.e('action')\">\n <el-icon v-if=\"loading\" :class=\"ns.is('loading')\">\n <loading />\n </el-icon>\n </div>\n </span>\n <span\n v-if=\"!inlinePrompt && (activeIcon || activeText)\"\n :class=\"[\n ns.e('label'),\n ns.em('label', 'right'),\n ns.is('active', checked),\n ]\"\n >\n <el-icon v-if=\"activeIcon\">\n <component :is=\"activeIcon\" />\n </el-icon>\n <span v-if=\"!activeIcon && activeText\" :aria-hidden=\"!checked\">{{\n activeText\n }}</span>\n </span>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport {\n computed,\n getCurrentInstance,\n nextTick,\n onMounted,\n ref,\n watch,\n} from 'vue'\nimport { isPromise } from '@vue/shared'\nimport { addUnit, debugWarn, isBoolean, throwError } from '@element-plus/utils'\nimport ElIcon from '@element-plus/components/icon'\nimport {\n useFormDisabled,\n useFormItem,\n useFormItemInputId,\n useFormSize,\n} from '@element-plus/components/form'\nimport { Loading } from '@element-plus/icons-vue'\nimport {\n CHANGE_EVENT,\n INPUT_EVENT,\n UPDATE_MODEL_EVENT,\n} from '@element-plus/constants'\nimport { useDeprecated, useNamespace } from '@element-plus/hooks'\nimport { switchEmits, switchProps } from './switch'\nimport type { CSSProperties } from 'vue'\n\nconst COMPONENT_NAME = 'ElSwitch'\ndefineOptions({\n name: COMPONENT_NAME,\n})\n\nconst props = defineProps(switchProps)\nconst emit = defineEmits(switchEmits)\n\nconst vm = getCurrentInstance()!\nconst { formItem } = useFormItem()\nconst switchSize = useFormSize()\nconst ns = useNamespace('switch')\n\nuseDeprecated(\n {\n from: '\"value\"',\n replacement: '\"model-value\" or \"v-model\"',\n scope: COMPONENT_NAME,\n version: '2.3.0',\n ref: 'https://element-plus.org/en-US/component/switch.html#attributes',\n type: 'Attribute',\n },\n computed(() => !!vm.vnode.props?.value)\n)\n\nconst { inputId } = useFormItemInputId(props, {\n formItemContext: formItem,\n})\n\nconst switchDisabled = useFormDisabled(computed(() => props.loading))\nconst isControlled = ref(props.modelValue !== false)\nconst input = ref<HTMLInputElement>()\nconst core = ref<HTMLSpanElement>()\n\nconst switchKls = computed(() => [\n ns.b(),\n ns.m(switchSize.value),\n ns.is('disabled', switchDisabled.value),\n ns.is('checked', checked.value),\n])\n\nconst coreStyle = computed<CSSProperties>(() => ({\n width: addUnit(props.width),\n}))\n\nwatch(\n () => props.modelValue,\n () => {\n isControlled.value = true\n }\n)\n\nwatch(\n () => props.value,\n () => {\n isControlled.value = false\n }\n)\n\nconst actualValue = computed(() => {\n return isControlled.value ? props.modelValue : props.value\n})\n\nconst checked = computed(() => actualValue.value === props.activeValue)\n\nif (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {\n emit(UPDATE_MODEL_EVENT, props.inactiveValue)\n emit(CHANGE_EVENT, props.inactiveValue)\n emit(INPUT_EVENT, props.inactiveValue)\n}\n\nwatch(checked, (val) => {\n input.value!.checked = val\n\n if (props.validateEvent) {\n formItem?.validate?.('change').catch((err) => debugWarn(err))\n }\n})\n\nconst handleChange = () => {\n const val = checked.value ? props.inactiveValue : props.activeValue\n emit(UPDATE_MODEL_EVENT, val)\n emit(CHANGE_EVENT, val)\n emit(INPUT_EVENT, val)\n nextTick(() => {\n input.value!.checked = checked.value\n })\n}\n\nconst switchValue = () => {\n if (switchDisabled.value) return\n\n const { beforeChange } = props\n if (!beforeChange) {\n handleChange()\n return\n }\n\n const shouldChange = beforeChange()\n\n const isPromiseOrBool = [\n isPromise(shouldChange),\n isBoolean(shouldChange),\n ].includes(true)\n if (!isPromiseOrBool) {\n throwError(\n COMPONENT_NAME,\n 'beforeChange must return type `Promise<boolean>` or `boolean`'\n )\n }\n\n if (isPromise(shouldChange)) {\n shouldChange\n .then((result) => {\n if (result) {\n handleChange()\n }\n })\n .catch((e) => {\n debugWarn(COMPONENT_NAME, `some error occurred: ${e}`)\n })\n } else if (shouldChange) {\n handleChange()\n }\n}\n\nconst styles = computed(() => {\n return ns.cssVarBlock({\n ...(props.activeColor ? { 'on-color': props.activeColor } : null),\n ...(props.inactiveColor ? { 'off-color': props.inactiveColor } : null),\n ...(props.borderColor ? { 'border-color': props.borderColor } : null),\n })\n})\n\nconst focus = (): void => {\n input.value?.focus?.()\n}\n\nonMounted(() => {\n input.value!.checked = checked.value\n})\n\ndefineExpose({\n /**\n * @description manual focus to the switch component\n **/\n focus,\n /**\n * @description whether Switch is checked\n */\n checked,\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;mCAmGc,CAAA;AAAA,EACZ,IAAM,EAAA,cAAA;AACR;;;;;;;AAKA,IAAA,MAAM,KAAK,kBAAmB,EAAA,CAAA;AAC9B,IAAM,MAAA,EAAE,aAAa,WAAY,EAAA,CAAA;AACjC,IAAA,MAAM,aAAa,WAAY,EAAA,CAAA;AAC/B,IAAM,MAAA,EAAA,GAAK,aAAa,QAAQ,CAAA,CAAA;AAEhC,IACE,aAAA,CAAA;AAAA,MACE,IAAM,EAAA,SAAA;AAAA,MACN,WAAa,EAAA,4BAAA;AAAA,MACb,KAAO,EAAA,cAAA;AAAA,MACP,OAAS,EAAA,OAAA;AAAA,MACT,GAAK,EAAA,iEAAA;AAAA,MACL,IAAM,EAA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