litos-ui 0.20.1 → 0.22.0
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/README.md +119 -15
- package/README.zh-CN.md +153 -0
- package/lib/base.d.ts +1 -0
- package/lib/base.js +1 -1
- package/lib/button/index.js +4 -4
- package/lib/{style-gKR_qwzm.js → button/index.less_inline.js} +2 -3
- package/lib/button/style.js +6 -2
- package/lib/calendar/index.js +140 -2
- package/lib/calendar/index.less_inline.js +4 -0
- package/lib/calendar/langs.js +12 -0
- package/lib/card/index.js +64 -2
- package/lib/card/index.less_inline.js +4 -0
- package/lib/carousel/index.js +257 -2
- package/lib/carousel/index.less_inline.js +4 -0
- package/lib/carousel/item.js +15 -2
- package/lib/carousel/item.less_inline.js +4 -0
- package/lib/carousel/timer.js +19 -0
- package/lib/check/check.d.ts +1 -0
- package/lib/check/check.js +117 -0
- package/lib/check/check.less_inline.js +4 -0
- package/lib/check/checkbox.js +18 -2
- package/lib/{checkbox-DhGHJXwI.js → check/checkbox.less_inline.js} +2 -14
- package/lib/check/checkbox_group.js +1 -1
- package/lib/check/index.d.ts +1 -0
- package/lib/{check-DFlwStH9.js → check/index.js} +10 -9
- package/lib/check/index.less_inline.js +4 -0
- package/lib/check/radio.js +15 -2
- package/lib/{radio-C9NPQWGI.js → check/radio.less_inline.js} +2 -11
- package/lib/check/radio_group.js +1 -1
- package/lib/collapse/index.js +103 -2
- package/lib/collapse/index.less_inline.js +4 -0
- package/lib/collapse/item.d.ts +1 -0
- package/lib/collapse/item.js +118 -2
- package/lib/collapse/item.less_inline.js +4 -0
- package/lib/collapse/types.d.ts +1 -0
- package/lib/color_picker/index.js +42 -2
- package/lib/color_picker/index.less_inline.js +4 -0
- package/lib/date_picker/index.js +100 -3
- package/lib/date_picker/index.less_inline.js +4 -0
- package/lib/date_picker_ori/index.js +121 -2
- package/lib/date_picker_ori/index.less_inline.js +4 -0
- package/lib/description_panel/index.js +54 -2
- package/lib/description_panel/index.less_inline.js +4 -0
- package/lib/dialog/dialog_box.js +11 -11
- package/lib/dialog/dialog_container.css_inline.js +4 -0
- package/lib/dialog/dialog_container.d.ts +1 -1
- package/lib/dialog/dialog_container.js +156 -2
- package/lib/dialog/dialog_container_style.d.ts +2 -0
- package/lib/dialog/dialog_container_style.js +6 -0
- package/lib/dialog/index.js +1 -1
- package/lib/entries/base.d.ts +2 -0
- package/lib/entries/base.js +2 -0
- package/lib/entries/button.d.ts +2 -0
- package/lib/entries/button.js +6 -0
- package/lib/entries/calendar.d.ts +2 -0
- package/lib/entries/calendar.js +6 -0
- package/lib/entries/card.d.ts +2 -0
- package/lib/entries/card.js +6 -0
- package/lib/entries/carousel-item.d.ts +2 -0
- package/lib/entries/carousel-item.js +6 -0
- package/lib/entries/carousel.d.ts +5 -0
- package/lib/entries/carousel.js +6 -0
- package/lib/entries/checkbox-group.d.ts +3 -0
- package/lib/entries/checkbox-group.js +6 -0
- package/lib/entries/checkbox.d.ts +2 -0
- package/lib/entries/checkbox.js +6 -0
- package/lib/entries/collapse-item.d.ts +3 -0
- package/lib/entries/collapse-item.js +6 -0
- package/lib/entries/collapse.d.ts +3 -0
- package/lib/entries/collapse.js +6 -0
- package/lib/entries/color-picker.d.ts +3 -0
- package/lib/entries/color-picker.js +6 -0
- package/lib/entries/date-picker-ori.d.ts +2 -0
- package/lib/entries/date-picker-ori.js +6 -0
- package/lib/entries/date-picker.d.ts +9 -0
- package/lib/entries/date-picker.js +6 -0
- package/lib/entries/description-panel.d.ts +4 -0
- package/lib/entries/description-panel.js +6 -0
- package/lib/entries/dialog-box.d.ts +6 -0
- package/lib/entries/dialog-box.js +2 -0
- package/lib/entries/dialog-container.d.ts +4 -0
- package/lib/entries/dialog-container.js +6 -0
- package/lib/entries/dialog.d.ts +3 -0
- package/lib/entries/dialog.js +2 -0
- package/lib/entries/form-item.d.ts +2 -0
- package/lib/entries/form-item.js +6 -0
- package/lib/entries/form.d.ts +3 -0
- package/lib/entries/form.js +6 -0
- package/lib/entries/icon-arrow-down.d.ts +2 -0
- package/lib/entries/icon-arrow-down.js +6 -0
- package/lib/entries/icon-arrow-left.d.ts +2 -0
- package/lib/entries/icon-arrow-left.js +6 -0
- package/lib/entries/icon-arrow-right.d.ts +2 -0
- package/lib/entries/icon-arrow-right.js +6 -0
- package/lib/entries/icon-arrow-up.d.ts +2 -0
- package/lib/entries/icon-arrow-up.js +6 -0
- package/lib/entries/icon-base.d.ts +2 -0
- package/lib/entries/icon-base.js +6 -0
- package/lib/entries/icon-calendar.d.ts +2 -0
- package/lib/entries/icon-calendar.js +6 -0
- package/lib/entries/icon-caret-bottom.d.ts +2 -0
- package/lib/entries/icon-caret-bottom.js +6 -0
- package/lib/entries/icon-caret-top.d.ts +2 -0
- package/lib/entries/icon-caret-top.js +6 -0
- package/lib/entries/icon-close-filled.d.ts +2 -0
- package/lib/entries/icon-close-filled.js +6 -0
- package/lib/entries/icon-close.d.ts +2 -0
- package/lib/entries/icon-close.js +6 -0
- package/lib/entries/icon-copy.d.ts +2 -0
- package/lib/entries/icon-copy.js +6 -0
- package/lib/entries/icon-d-arrow-left.d.ts +2 -0
- package/lib/entries/icon-d-arrow-left.js +6 -0
- package/lib/entries/icon-d-arrow-right.d.ts +2 -0
- package/lib/entries/icon-d-arrow-right.js +6 -0
- package/lib/entries/icon-delete.d.ts +2 -0
- package/lib/entries/icon-delete.js +6 -0
- package/lib/entries/icon-eye-outline.d.ts +2 -0
- package/lib/entries/icon-eye-outline.js +6 -0
- package/lib/entries/icon-font-icon.d.ts +2 -0
- package/lib/entries/icon-font-icon.js +6 -0
- package/lib/entries/icon-info.d.ts +2 -0
- package/lib/entries/icon-info.js +6 -0
- package/lib/entries/icon-loading.d.ts +2 -0
- package/lib/entries/icon-loading.js +6 -0
- package/lib/entries/icon-minus.d.ts +2 -0
- package/lib/entries/icon-minus.js +6 -0
- package/lib/entries/icon-moon.d.ts +2 -0
- package/lib/entries/icon-moon.js +6 -0
- package/lib/entries/icon-more.d.ts +2 -0
- package/lib/entries/icon-more.js +6 -0
- package/lib/entries/icon-picture.d.ts +2 -0
- package/lib/entries/icon-picture.js +6 -0
- package/lib/entries/icon-plus.d.ts +2 -0
- package/lib/entries/icon-plus.js +6 -0
- package/lib/entries/icon-reduction.d.ts +2 -0
- package/lib/entries/icon-reduction.js +6 -0
- package/lib/entries/icon-refresh-left.d.ts +2 -0
- package/lib/entries/icon-refresh-left.js +6 -0
- package/lib/entries/icon-refresh-right.d.ts +2 -0
- package/lib/entries/icon-refresh-right.js +6 -0
- package/lib/entries/icon-refresh.d.ts +2 -0
- package/lib/entries/icon-refresh.js +6 -0
- package/lib/entries/icon-search.d.ts +2 -0
- package/lib/entries/icon-search.js +6 -0
- package/lib/entries/icon-select.d.ts +2 -0
- package/lib/entries/icon-select.js +6 -0
- package/lib/entries/icon-sort.d.ts +2 -0
- package/lib/entries/icon-sort.js +6 -0
- package/lib/entries/icon-success.d.ts +2 -0
- package/lib/entries/icon-success.js +6 -0
- package/lib/entries/icon-sun.d.ts +2 -0
- package/lib/entries/icon-sun.js +6 -0
- package/lib/entries/icon-theme-default.d.ts +2 -0
- package/lib/entries/icon-theme-default.js +6 -0
- package/lib/entries/icon-warn.d.ts +2 -0
- package/lib/entries/icon-warn.js +6 -0
- package/lib/entries/icon-zoom-in.d.ts +2 -0
- package/lib/entries/icon-zoom-in.js +6 -0
- package/lib/entries/icon-zoom-out.d.ts +2 -0
- package/lib/entries/icon-zoom-out.js +6 -0
- package/lib/entries/image-preview.d.ts +10 -0
- package/lib/entries/image-preview.js +6 -0
- package/lib/entries/image.d.ts +2 -0
- package/lib/entries/image.js +6 -0
- package/lib/entries/input-number.d.ts +2 -0
- package/lib/entries/input-number.js +6 -0
- package/lib/entries/input.d.ts +2 -0
- package/lib/entries/input.js +6 -0
- package/lib/entries/list.d.ts +3 -0
- package/lib/entries/list.js +6 -0
- package/lib/entries/loading.d.ts +2 -0
- package/lib/entries/loading.js +2 -0
- package/lib/entries/mask.d.ts +2 -0
- package/lib/entries/mask.js +6 -0
- package/lib/entries/md-input.d.ts +2 -0
- package/lib/entries/md-input.js +6 -0
- package/lib/entries/menu.d.ts +3 -0
- package/lib/entries/menu.js +6 -0
- package/lib/entries/message.d.ts +6 -0
- package/lib/entries/message.js +2 -0
- package/lib/entries/modal-box.d.ts +6 -0
- package/lib/entries/modal-box.js +2 -0
- package/lib/entries/modal.d.ts +4 -0
- package/lib/entries/modal.js +6 -0
- package/lib/entries/notification.d.ts +7 -0
- package/lib/entries/notification.js +6 -0
- package/lib/entries/page-header.d.ts +4 -0
- package/lib/entries/page-header.js +6 -0
- package/lib/entries/pagination.d.ts +9 -0
- package/lib/entries/pagination.js +6 -0
- package/lib/entries/polygon.d.ts +2 -0
- package/lib/entries/polygon.js +6 -0
- package/lib/entries/popconfirm.d.ts +3 -0
- package/lib/entries/popconfirm.js +2 -0
- package/lib/entries/popover.d.ts +1 -0
- package/lib/entries/popover.js +2 -0
- package/lib/entries/qrcode.d.ts +2 -0
- package/lib/entries/qrcode.js +6 -0
- package/lib/entries/radio-group.d.ts +3 -0
- package/lib/entries/radio-group.js +6 -0
- package/lib/entries/radio.d.ts +2 -0
- package/lib/entries/radio.js +6 -0
- package/lib/entries/select-ori.d.ts +2 -0
- package/lib/entries/select-ori.js +6 -0
- package/lib/entries/select.d.ts +4 -0
- package/lib/entries/select.js +6 -0
- package/lib/entries/space.d.ts +2 -0
- package/lib/entries/space.js +6 -0
- package/lib/entries/switch.d.ts +2 -0
- package/lib/entries/switch.js +6 -0
- package/lib/entries/tabbar-item.d.ts +2 -0
- package/lib/entries/tabbar-item.js +6 -0
- package/lib/entries/tabbar.d.ts +3 -0
- package/lib/entries/tabbar.js +6 -0
- package/lib/entries/table.d.ts +3 -0
- package/lib/entries/table.js +6 -0
- package/lib/entries/tabs.d.ts +3 -0
- package/lib/entries/tabs.js +2 -0
- package/lib/entries/tag.d.ts +2 -0
- package/lib/entries/tag.js +6 -0
- package/lib/entries/theme-color.d.ts +3 -0
- package/lib/entries/theme-color.js +6 -0
- package/lib/entries/theme.d.ts +9 -0
- package/lib/entries/theme.js +6 -0
- package/lib/entries/transition.d.ts +1 -0
- package/lib/entries/transition.js +2 -0
- package/lib/entries/upload.d.ts +3 -0
- package/lib/entries/upload.js +6 -0
- package/lib/entries/utils.d.ts +1 -0
- package/lib/entries/utils.js +2 -0
- package/lib/form/form_inner.d.ts +1 -0
- package/lib/{form_inner-Cnwb6f_Q.js → form/form_inner.js} +9 -9
- package/lib/form/form_item.d.ts +2 -1
- package/lib/form/form_item.js +148 -2
- package/lib/form/form_item.less_inline.js +4 -0
- package/lib/form/index.d.ts +3 -2
- package/lib/form/index.js +191 -2
- package/lib/form/index.less_inline.js +4 -0
- package/lib/icon/arrow_down.js +1 -1
- package/lib/icon/arrow_left.js +1 -1
- package/lib/icon/arrow_right.js +1 -1
- package/lib/icon/arrow_up.js +1 -1
- package/lib/icon/base.d.ts +2 -1
- package/lib/icon/base.js +63 -2
- package/lib/icon/calendar.js +1 -1
- package/lib/icon/caret_bottom.js +1 -1
- package/lib/icon/caret_top.js +1 -1
- package/lib/icon/close.js +1 -1
- package/lib/icon/close_filled.js +1 -1
- package/lib/icon/copy.d.ts +6 -0
- package/lib/icon/copy.js +13 -0
- package/lib/icon/d_arrow_left.js +1 -1
- package/lib/icon/d_arrow_right.js +1 -1
- package/lib/icon/delete.d.ts +5 -0
- package/lib/icon/delete.js +10 -0
- package/lib/icon/eye_outline.d.ts +6 -0
- package/lib/icon/eye_outline.js +13 -0
- package/lib/icon/font_icon.js +1 -1
- package/lib/icon/icon_style.d.ts +2 -0
- package/lib/icon/icon_style.js +6 -0
- package/lib/icon/index.less_inline.js +4 -0
- package/lib/icon/info.js +1 -1
- package/lib/icon/loading.js +1 -1
- package/lib/icon/minus.d.ts +5 -0
- package/lib/icon/minus.js +10 -0
- package/lib/icon/moon.js +1 -1
- package/lib/icon/more.js +1 -1
- package/lib/icon/picture.d.ts +5 -0
- package/lib/icon/picture.js +10 -0
- package/lib/icon/plus.d.ts +5 -0
- package/lib/icon/plus.js +10 -0
- package/lib/icon/reduction.js +1 -1
- package/lib/icon/refresh.js +1 -1
- package/lib/icon/refresh_left.js +1 -1
- package/lib/icon/refresh_right.js +1 -1
- package/lib/icon/search.js +1 -1
- package/lib/icon/select.js +1 -1
- package/lib/icon/sort.js +1 -1
- package/lib/icon/success.js +1 -1
- package/lib/icon/sun.js +1 -1
- package/lib/icon/theme_default.js +1 -1
- package/lib/icon/warn.js +1 -1
- package/lib/icon/zoom_in.js +1 -1
- package/lib/icon/zoom_out.js +1 -1
- package/lib/image/image_preview.js +91 -2
- package/lib/image/image_preview.less_inline.js +4 -0
- package/lib/image/index.js +163 -2
- package/lib/image/index.less_inline.js +4 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +75 -65
- package/lib/input/index.js +4 -4
- package/lib/{input-DUBlLEXS.js → input/index.less_inline.js} +1 -1
- package/lib/{input_inner-x4GfLGjj.js → input/input_inner.less_inline.js} +1 -1
- package/lib/input_number/index.d.ts +59 -0
- package/lib/input_number/index.js +203 -0
- package/lib/input_number/index.less_inline.js +4 -0
- package/lib/input_number/style.d.ts +2 -0
- package/lib/input_number/style.js +6 -0
- package/lib/list/index.js +52 -2
- package/lib/list/index.less_inline.js +4 -0
- package/lib/loading/index.js +1 -1
- package/lib/mask/index.d.ts +1 -1
- package/lib/mask/index.js +109 -2
- package/lib/mask/index.less_inline.js +4 -0
- package/lib/md_input/index.js +59 -2
- package/lib/md_input/index.less_inline.js +4 -0
- package/lib/menu/index.js +275 -2
- package/lib/menu/index.less_inline.js +4 -0
- package/lib/message/index.js +1 -1
- package/lib/modal/index.js +199 -2
- package/lib/modal/index.less_inline.js +4 -0
- package/lib/modal/modal_box.d.ts +22 -0
- package/lib/modal/modal_box.js +21 -22
- package/lib/notification/index.d.ts +212 -0
- package/lib/notification/index.js +380 -0
- package/lib/notification/index.less_inline.js +4 -0
- package/lib/notification/placement.d.ts +49 -0
- package/lib/notification/placement.js +48 -0
- package/lib/notification/style.d.ts +2 -0
- package/lib/notification/style.js +6 -0
- package/lib/page_header/index.js +100 -2
- package/lib/page_header/index.less_inline.js +4 -0
- package/lib/pagination/index.js +214 -2
- package/lib/pagination/index.less_inline.js +4 -0
- package/lib/polygon/index.js +21 -2
- package/lib/{polygon-DhhovlrG.js → polygon/index.less_inline.js} +2 -18
- package/lib/qrcode/index.js +65 -2
- package/lib/qrcode/index.less_inline.js +4 -0
- package/lib/select/index.js +355 -3
- package/lib/select/index.less_inline.js +4 -0
- package/lib/select_ori/index.js +58 -2
- package/lib/select_ori/index.less_inline.js +4 -0
- package/lib/space/index.js +40 -2
- package/lib/space/index.less_inline.js +4 -0
- package/lib/{animation-Bo4jbSGK.js → styles/animation/index.css_inline.js} +2 -3
- package/lib/styles/animation/index.js +6 -2
- package/lib/{mask-Ox6CoyFB.js → styles/mask/index.css_inline.js} +2 -3
- package/lib/styles/mask/index.js +6 -2
- package/lib/switch/index.js +51 -2
- package/lib/switch/index.less_inline.js +4 -0
- package/lib/tabbar/index.js +97 -2
- package/lib/tabbar/index.less_inline.js +4 -0
- package/lib/tabbar/item.js +61 -2
- package/lib/tabbar/item.less_inline.js +4 -0
- package/lib/table/index.js +234 -2
- package/lib/table/index.less_inline.js +4 -0
- package/lib/tabs/index.js +1 -1
- package/lib/tag/index.js +75 -2
- package/lib/tag/index.less_inline.js +4 -0
- package/lib/theme/index.js +86 -2
- package/lib/theme/index.less_inline.js +4 -0
- package/lib/theme/theme_color.js +1 -1
- package/lib/upload/index.d.ts +170 -0
- package/lib/upload/index.js +848 -0
- package/lib/upload/index.less_inline.js +4 -0
- package/lib/upload/style.d.ts +2 -0
- package/lib/upload/style.js +6 -0
- package/lib/utils/context_provide.d.ts +1 -0
- package/lib/utils/context_provide.js +1 -1
- package/lib/utils/event.d.ts +30 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +1 -1
- package/lib/utils/popover.js +1 -1
- package/lib/utils/signal_types.d.ts +5 -0
- package/lib/utils/transition.d.ts +28 -0
- package/lib/utils/transition.js +1 -1
- package/package.json +39 -18
- package/styles/animation.css +2 -2
- package/styles/container.css +8 -8
- package/styles/datepicker.css +9 -9
- package/styles/dialog.css +7 -7
- package/styles/loading.css +17 -17
- package/styles/message.css +9 -9
- package/styles/modal_box.css +3 -3
- package/styles/notification.css +17 -0
- package/styles/popover.css +11 -14
- package/styles/reset.css +13 -15
- package/styles/scrollbar.css +5 -5
- package/styles/select.css +6 -6
- package/styles/tabs.css +3 -3
- package/styles/theme-coral.css +35 -0
- package/styles/theme-jade.css +35 -0
- package/styles/theme-tangerine.css +35 -0
- package/styles/transition.css +1 -1
- package/styles/vars.css +41 -7
- package/lib/base-Dyj1rzaK.js +0 -61
- package/lib/calendar-CvlUsN6w.js +0 -146
- package/lib/card-3DM-lJQV.js +0 -63
- package/lib/carousel-DvkZ1YXq.js +0 -276
- package/lib/check-doQ2ZpQj.js +0 -117
- package/lib/collapse-B6-Rn05A.js +0 -102
- package/lib/color_picker-0a-IGZY9.js +0 -41
- package/lib/date_picker-BDN2PAz5.js +0 -99
- package/lib/date_picker_ori-BXFs1eET.js +0 -120
- package/lib/description_panel--AKXBzLL.js +0 -53
- package/lib/dialog_container-BNPQ9n0V.js +0 -145
- package/lib/esm-DAha108i.js +0 -270
- package/lib/form-DJxvBiLy.js +0 -190
- package/lib/form_item-BqPMRABd.js +0 -147
- package/lib/image-CVQai6NX.js +0 -162
- package/lib/image_preview-DfQAKSJH.js +0 -90
- package/lib/item-CQ2Sknbz.js +0 -14
- package/lib/item-DI6mQXtB.js +0 -117
- package/lib/item-D_ZOPXuE.js +0 -60
- package/lib/list-MG8PRzos.js +0 -51
- package/lib/mask-Bx-yNIJv.js +0 -108
- package/lib/md_input-BX3bujz8.js +0 -58
- package/lib/menu-DKscK5mw.js +0 -274
- package/lib/modal-Cwi3qlEf.js +0 -198
- package/lib/page_header-ujV3pncE.js +0 -99
- package/lib/pagination-aRbGd3Rf.js +0 -213
- package/lib/qrcode-Dip8uLSA.js +0 -64
- package/lib/select-BZMDj5VE.js +0 -354
- package/lib/select_ori-C7sUZxen.js +0 -57
- package/lib/space-CKuTk0YB.js +0 -39
- package/lib/switch-wh2-ivty.js +0 -50
- package/lib/tabbar-CBXK-_AV.js +0 -96
- package/lib/table-BQxMD2Ae.js +0 -233
- package/lib/tag-Di1z9PoZ.js +0 -74
- package/lib/theme-CLbBS-in.js +0 -85
- package/styles/dark.css +0 -13
package/lib/select-BZMDj5VE.js
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
|
|
2
|
-
import { t as r } from "./form_inner-Cnwb6f_Q.js";
|
|
3
|
-
import { Popover as i } from "./utils/popover.js";
|
|
4
|
-
import { $ as a, $$ as o, $one as s, debounce as c, iterate as l, off as u, on as d, shouldEventNext as f } from "ph-utils/browser";
|
|
5
|
-
//#region src/components/select/index.less?inline
|
|
6
|
-
var p = ":host{--l-select-width:100%;min-height:var(--l-form-control-height,32px);width:var(--l-select-width);border:1px solid var(--l-border-color,#d9d9d9);cursor:pointer;box-sizing:border-box;border-radius:4px;justify-content:space-between;align-items:center;gap:5px;padding:4px 10px;font-size:14px;line-height:1;transition:border-color .3s;display:inline-flex;position:relative}:host(:hover){border-color:silver}:host(.l-select--disabled){background-color:var(--l-disabled-color,#f5f7fa);cursor:not-allowed}:host(.l-select--expand),:host(.l-select--active){border-color:var(--l-primary-color,#722ed1)}:host(.l-select--expand) .l-select-arrow{transform:rotate(180deg)}:host(.l-select--loading) .l-select-arrow{opacity:.2}:host(.l-select--clearable) .l-select-arrow{opacity:0}.l-select-main{box-sizing:border-box;flex-flow:wrap;flex-grow:1;gap:5px;display:flex;overflow:hidden}.l-selected-item{flex-shrink:0}.l-select-placeholder{flex-grow:1}.l-select-placeholder,.l-select-arrow{color:#a8abb2}.l-select-filter{background-color:#0000;border:none;outline:none;flex-grow:1;flex-shrink:0;width:0;min-width:15px;max-width:100%}.l-select-filter::placeholder{color:#a8abb2}.l-select-arrow{flex-shrink:0;transition:transform .3s,opacity .3s;transform:rotate(0)}.l-select-tag-close{box-sizing:border-box;cursor:pointer;border-radius:50%;justify-content:center;align-items:center;width:14px;height:14px;margin-left:3px;font-size:12px;transition:color .3s,background-color .3s;display:inline-flex}.l-select-tag-close:hover{color:#fff;background-color:#999}.l-select-clear,.l-select-loading{position:absolute;top:50%;right:10px;transform:translateY(-50%)}.l-select-loading{color:var(--l-primary-color,#722ed1);z-index:2;animation:1.5s linear infinite l-select-loading}.l-select-clear{color:#afafaf;z-index:1}@keyframes l-select-loading{0%{transform:translateY(-50%)rotate(0)}to{transform:translateY(-50%)rotate(360deg)}}", m = class extends r {
|
|
7
|
-
static baseName = "select";
|
|
8
|
-
selectedLabels = [];
|
|
9
|
-
filter;
|
|
10
|
-
_options = [];
|
|
11
|
-
_backOptions;
|
|
12
|
-
inputHandler;
|
|
13
|
-
_popover;
|
|
14
|
-
_searchEl;
|
|
15
|
-
constructor() {
|
|
16
|
-
super(!0, !1), this.version = 2, this._state = {
|
|
17
|
-
filterable: !1,
|
|
18
|
-
placeholder: "请选择",
|
|
19
|
-
labelField: "label",
|
|
20
|
-
valueField: "value",
|
|
21
|
-
multiple: !1,
|
|
22
|
-
collapseTags: !1,
|
|
23
|
-
clearable: !1,
|
|
24
|
-
remote: !1
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
setInputHandler(e) {
|
|
28
|
-
this.inputHandler = e;
|
|
29
|
-
}
|
|
30
|
-
setFilter(e) {
|
|
31
|
-
this.filter = e;
|
|
32
|
-
}
|
|
33
|
-
get loading() {
|
|
34
|
-
return this._state.loading;
|
|
35
|
-
}
|
|
36
|
-
set loading(e) {
|
|
37
|
-
this.setLoading(e ?? !1);
|
|
38
|
-
}
|
|
39
|
-
setLoading(e) {
|
|
40
|
-
if (this._state.loading = e, !this.rendered) return;
|
|
41
|
-
let t = s(".l-select-loading", this.root);
|
|
42
|
-
e && (t || this.root.appendChild(o("l-loading-icon", { class: "l-select-loading" })), this.classList.add("l-select--loading")), t &&= (this.classList.remove("l-select--loading"), t.remove(), null);
|
|
43
|
-
}
|
|
44
|
-
setExpanded(e) {
|
|
45
|
-
this._state.expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
|
|
46
|
-
}
|
|
47
|
-
setValue(e) {
|
|
48
|
-
let t = e;
|
|
49
|
-
typeof e == "string" && (t = e.split(",")), this._state.multiple ? Array.isArray(t) || (t = [t]) : Array.isArray(t) && (t = t[0]), super.setValue(t), this._updateSelectedLabels(), this._reRenderLabels();
|
|
50
|
-
}
|
|
51
|
-
_updateSelectedLabels() {
|
|
52
|
-
if (this._options) {
|
|
53
|
-
this.selectedLabels = this._options.filter((e) => this._isOptionSelect(e[this._state.valueField])).map((e) => e[this._state.labelField]);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
this.selectedLabels = [];
|
|
57
|
-
}
|
|
58
|
-
static get observedAttributes() {
|
|
59
|
-
return [
|
|
60
|
-
"disabled",
|
|
61
|
-
"value",
|
|
62
|
-
"multiple",
|
|
63
|
-
"placeholder",
|
|
64
|
-
"collapse-tags",
|
|
65
|
-
"filterable",
|
|
66
|
-
"loading",
|
|
67
|
-
"label-field",
|
|
68
|
-
"value-field",
|
|
69
|
-
"width",
|
|
70
|
-
"clearable",
|
|
71
|
-
"remote"
|
|
72
|
-
];
|
|
73
|
-
}
|
|
74
|
-
attributeChange(r, i, a) {
|
|
75
|
-
switch (r) {
|
|
76
|
-
case "width":
|
|
77
|
-
this._state.width = n(a);
|
|
78
|
-
break;
|
|
79
|
-
case "label-field":
|
|
80
|
-
case "value-field":
|
|
81
|
-
case "placeholder":
|
|
82
|
-
this._state[r] = a;
|
|
83
|
-
break;
|
|
84
|
-
case "multiple":
|
|
85
|
-
case "clearable":
|
|
86
|
-
case "filterable":
|
|
87
|
-
case "collapse-tags":
|
|
88
|
-
case "remote":
|
|
89
|
-
this._state[e(r)] = t(a, !1, r);
|
|
90
|
-
break;
|
|
91
|
-
case "loading": this.setLoading(t(a, !1, r));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
updateDOM(e) {
|
|
95
|
-
e.has("width") && (this._state.width ? this.style.setProperty("--l-select-width", this._state.width) : this.style.removeProperty("--l-select-width")), (e.has("label-field") || e.has("value-field")) && this._updatePopoverContent();
|
|
96
|
-
}
|
|
97
|
-
get options() {
|
|
98
|
-
return this._options;
|
|
99
|
-
}
|
|
100
|
-
set options(e) {
|
|
101
|
-
this.setOptions(e);
|
|
102
|
-
}
|
|
103
|
-
setOptions(e) {
|
|
104
|
-
this._options = e, this._backOptions = [...e || []], this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
105
|
-
}
|
|
106
|
-
_isOptionSelect(e) {
|
|
107
|
-
let t = !1;
|
|
108
|
-
return e != null && this.value != null && (t = this._state.multiple ? this.value.includes(e) : e === this.value), t;
|
|
109
|
-
}
|
|
110
|
-
_updateOptionSelect(e, t) {
|
|
111
|
-
let n = s(".l-select-icon", e);
|
|
112
|
-
t ? (e.classList.add("l-select-option--selected"), n || (n = o("l-select-icon", { class: "l-select-icon" }), e.appendChild(n))) : (e.classList.remove("l-select-option--selected"), n && n.remove());
|
|
113
|
-
}
|
|
114
|
-
_renderOption() {
|
|
115
|
-
let e = [];
|
|
116
|
-
if (this._options) {
|
|
117
|
-
let t = this._options.length;
|
|
118
|
-
for (let n = 0; n < t; n++) {
|
|
119
|
-
let t = this._options[n], r = t[this._state.valueField], i = t[this._state.labelField], a = this._isOptionSelect(r), s = [o("span", {
|
|
120
|
-
class: "l-select-option-content",
|
|
121
|
-
textContent: i,
|
|
122
|
-
title: i
|
|
123
|
-
})];
|
|
124
|
-
a && s.push(o("l-select-icon", { class: "l-select-icon" }));
|
|
125
|
-
let c = o("li", {
|
|
126
|
-
class: ["l-select-option", a ? "l-select-option--selected" : void 0],
|
|
127
|
-
"data-action": `${n}`
|
|
128
|
-
}, s);
|
|
129
|
-
e.push(c.outerHTML);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (e.length === 0) {
|
|
133
|
-
let t = o("li", {
|
|
134
|
-
class: "l-select-option l-select-option--empty",
|
|
135
|
-
textContent: "暂无数据"
|
|
136
|
-
});
|
|
137
|
-
e.push(t.outerHTML);
|
|
138
|
-
}
|
|
139
|
-
return e.join("");
|
|
140
|
-
}
|
|
141
|
-
_calculateOffset(e, t) {
|
|
142
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
143
|
-
return n.top - r.top + t.scrollTop;
|
|
144
|
-
}
|
|
145
|
-
isEmpty() {
|
|
146
|
-
let e = !0;
|
|
147
|
-
return !this._state.multiple && this.value != null && this.value !== "" && (e = !1), this._state.multiple && this.value && this.value.length > 0 && (e = !1), e;
|
|
148
|
-
}
|
|
149
|
-
_toggleClearable(e = !1) {
|
|
150
|
-
if (this._state.clearable) {
|
|
151
|
-
let t = s(".l-select-clear", this.root);
|
|
152
|
-
if (e || this.isEmpty() || this._state.loading) {
|
|
153
|
-
t && t.remove(), this.classList.remove("l-select--clearable");
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
t || this.root.appendChild(o("l-close-filled-icon", {
|
|
157
|
-
class: "l-select-clear",
|
|
158
|
-
"data-action": "clear"
|
|
159
|
-
})), this.classList.add("l-select--clearable");
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
_onMouseEnter = () => {
|
|
163
|
-
this._toggleClearable(!1);
|
|
164
|
-
};
|
|
165
|
-
_onMouseLeave = () => {
|
|
166
|
-
this._toggleClearable(!0);
|
|
167
|
-
};
|
|
168
|
-
_togglePopover() {
|
|
169
|
-
if (this._popover) {
|
|
170
|
-
if (this._popover.isShow()) {
|
|
171
|
-
this._popover.hide();
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
this._popover.show(this);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
_updatePopoverContent() {
|
|
178
|
-
this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
179
|
-
}
|
|
180
|
-
_onRootTap = (e) => {
|
|
181
|
-
e.stopPropagation();
|
|
182
|
-
let [t, n, r] = f(e, "data-action", e.currentTarget);
|
|
183
|
-
if (t) {
|
|
184
|
-
if (n === "clear") this.value = this._state.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
|
|
185
|
-
else {
|
|
186
|
-
let e = Number(n);
|
|
187
|
-
this.selectedLabels.splice(e, 1), this._value.splice(e, 1), this._updatePopoverContent(), this._reRenderLabels(), this._searchEl && this._searchEl.focus();
|
|
188
|
-
}
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
this._togglePopover();
|
|
192
|
-
};
|
|
193
|
-
_onTap = () => {
|
|
194
|
-
this._togglePopover();
|
|
195
|
-
};
|
|
196
|
-
_onSearchBlur = () => {
|
|
197
|
-
this._updateSearchValue();
|
|
198
|
-
};
|
|
199
|
-
_onSearchInput = (e) => {
|
|
200
|
-
if (this.inputHandler && this._state.filterable) {
|
|
201
|
-
let t = e.target.value;
|
|
202
|
-
this.inputHandler(t);
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
_handleFilte = (e) => {
|
|
206
|
-
if (this._state.remote) {
|
|
207
|
-
this.emit("search", { detail: { value: e } });
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
211
|
-
};
|
|
212
|
-
_filteOption(e) {
|
|
213
|
-
let t = [];
|
|
214
|
-
return this._backOptions && (t = this._backOptions.filter((t) => e ? this.filter ? this.filter(e, t) : t[this._state.labelField].includes(e) : !0)), t;
|
|
215
|
-
}
|
|
216
|
-
afterInit() {
|
|
217
|
-
d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this._searchEl = s(".l-select-filter", this.root), this._searchEl && (this.inputHandler = c(this._handleFilte, 300), d(this._searchEl, "input", this._onSearchInput), d(this._searchEl, "blur", this._onSearchBlur)), this.disabledChange(), this._popover ||= new i({
|
|
218
|
-
arrow: !1,
|
|
219
|
-
offset: 2,
|
|
220
|
-
placement: "bottom",
|
|
221
|
-
popoverWidth: "trigger",
|
|
222
|
-
trigger: "manual",
|
|
223
|
-
reference: this,
|
|
224
|
-
theme: "select",
|
|
225
|
-
disabled: this.isDisabled(),
|
|
226
|
-
contentRender() {
|
|
227
|
-
return "<ul class=\"l-select-list\"></ul>";
|
|
228
|
-
},
|
|
229
|
-
updateContent: (e) => {
|
|
230
|
-
let t = s(".l-select-list", e);
|
|
231
|
-
t && (t.innerHTML = this._renderOption());
|
|
232
|
-
},
|
|
233
|
-
onOpenChange: (e) => {
|
|
234
|
-
this.setExpanded(e);
|
|
235
|
-
},
|
|
236
|
-
onOutsideTap: (e, t, n) => {
|
|
237
|
-
!n && !t && this._popover?.hide();
|
|
238
|
-
},
|
|
239
|
-
onPopoverAction: (e, t) => {
|
|
240
|
-
if (e && this._options) {
|
|
241
|
-
let n = Number(e), r = this._options[n], i = r[this._state.valueField], o = r[this._state.labelField], s = this.value, c = this.selectedLabels;
|
|
242
|
-
if (this._state.multiple === !0) {
|
|
243
|
-
if (!s) s = [i], c = [o];
|
|
244
|
-
else if (Array.isArray(s)) {
|
|
245
|
-
let e = s.indexOf(i);
|
|
246
|
-
e === -1 ? (s.push(i), c.push(o)) : (s.splice(e, 1), c.splice(e, 1));
|
|
247
|
-
} else s != i && (s = [s, i], c = [c, o]);
|
|
248
|
-
} else s = i, c = [o];
|
|
249
|
-
this._value != s && this.emit("change", { detail: {
|
|
250
|
-
value: s,
|
|
251
|
-
labels: c
|
|
252
|
-
} }), this._value = s, this.selectedLabels = c;
|
|
253
|
-
let u = this._isOptionSelect(i);
|
|
254
|
-
if (!this._state.multiple) {
|
|
255
|
-
let e = a(".l-select-option--selected", t.parentElement);
|
|
256
|
-
l(e, (e) => {
|
|
257
|
-
this._updateOptionSelect(e, !1);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
this._updateOptionSelect(t, u), this._reRenderLabels(), !this._state.multiple && this._popover && this._popover.hide(), this._searchEl && this._state.multiple && this._searchEl.focus();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
beforeDestroy() {
|
|
266
|
-
if (u(this, "mouseenter", this._onMouseEnter), u(this, "mouseleave", this._onMouseLeave), u(this.root, "click", this._onRootTap), u(this, "click", this._onTap), this._options = void 0, this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
|
|
267
|
-
if (u(this._searchEl, "blur", this._onSearchBlur), u(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
|
|
268
|
-
try {
|
|
269
|
-
this.inputHandler.cancel();
|
|
270
|
-
} catch {}
|
|
271
|
-
this.inputHandler = void 0;
|
|
272
|
-
}
|
|
273
|
-
this._searchEl = void 0;
|
|
274
|
-
}
|
|
275
|
-
this.filter = void 0;
|
|
276
|
-
}
|
|
277
|
-
render_v2() {
|
|
278
|
-
return {
|
|
279
|
-
template: this.render(),
|
|
280
|
-
style: [p]
|
|
281
|
-
};
|
|
282
|
-
}
|
|
283
|
-
render() {
|
|
284
|
-
let e = document.createDocumentFragment(), t = o("div", { class: "l-select-main" }), n = this._renderSelectedLabels();
|
|
285
|
-
if (t.appendChild(n), this._state.filterable) {
|
|
286
|
-
let e = this._state.placeholder || "请选择", n = "";
|
|
287
|
-
this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], n = this.selectedLabels[0])), t.appendChild(o("input", {
|
|
288
|
-
class: "l-select-filter",
|
|
289
|
-
placeholder: e,
|
|
290
|
-
value: n
|
|
291
|
-
}));
|
|
292
|
-
}
|
|
293
|
-
e.appendChild(t);
|
|
294
|
-
let r = o("l-arrow-down-icon", { class: "l-select-arrow" });
|
|
295
|
-
return e.appendChild(r), e;
|
|
296
|
-
}
|
|
297
|
-
disabledChange() {
|
|
298
|
-
if (!this.rendered) return;
|
|
299
|
-
let e = this.isDisabled();
|
|
300
|
-
this._popover && this._popover.setOption("disabled", e), e ? this.classList.add("l-select--disabled") : this.classList.remove("l-select--disabled"), this._searchEl && (this._searchEl.disabled = e);
|
|
301
|
-
}
|
|
302
|
-
_renderTag(e, t = 0, n = !0) {
|
|
303
|
-
let r = o("l-tag", {
|
|
304
|
-
type: "info",
|
|
305
|
-
class: "l-selected-item",
|
|
306
|
-
textContent: e
|
|
307
|
-
});
|
|
308
|
-
if (n) {
|
|
309
|
-
let e = o("div", {
|
|
310
|
-
class: "l-select-tag-close",
|
|
311
|
-
slot: "suffix",
|
|
312
|
-
innerHTML: "<l-close-icon></l-close-icon>",
|
|
313
|
-
"data-action": `${t}`
|
|
314
|
-
});
|
|
315
|
-
r.appendChild(e);
|
|
316
|
-
}
|
|
317
|
-
return r;
|
|
318
|
-
}
|
|
319
|
-
_reRenderLabels() {
|
|
320
|
-
let e = s(".l-select-main", this.root);
|
|
321
|
-
if (e) {
|
|
322
|
-
let t = a(".l-selected-item", e);
|
|
323
|
-
t.length > 0 && l(t, (e) => {
|
|
324
|
-
e && e != this._searchEl && e.remove();
|
|
325
|
-
});
|
|
326
|
-
let n = this._renderSelectedLabels();
|
|
327
|
-
this._searchEl ? e.insertBefore(n, this._searchEl) : e.appendChild(n);
|
|
328
|
-
}
|
|
329
|
-
this._updateSearchValue();
|
|
330
|
-
}
|
|
331
|
-
_updateSearchValue() {
|
|
332
|
-
if (this._searchEl) {
|
|
333
|
-
let e = this._state.placeholder || "请选择", t = "";
|
|
334
|
-
this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
_renderSelectedLabels() {
|
|
338
|
-
let e = document.createDocumentFragment(), t = this.selectedLabels.length;
|
|
339
|
-
if (t > 0) {
|
|
340
|
-
if (!this._state.multiple) this._state.filterable || e.appendChild(o("span", {
|
|
341
|
-
class: "l-selected-item",
|
|
342
|
-
textContent: this.selectedLabels[0]
|
|
343
|
-
}));
|
|
344
|
-
else if (this._state.collapseTags) e.appendChild(this._renderTag(this.selectedLabels[0])), t > 1 && e.appendChild(this._renderTag(`+${t - 1}`, -1, !1));
|
|
345
|
-
else for (let n = 0; n < t; n++) e.appendChild(this._renderTag(this.selectedLabels[n], n));
|
|
346
|
-
} else this._state.filterable || e.appendChild(o("span", {
|
|
347
|
-
class: "l-selected-item l-select-placeholder",
|
|
348
|
-
textContent: this._state.placeholder
|
|
349
|
-
}));
|
|
350
|
-
return e;
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
//#endregion
|
|
354
|
-
export { m as t };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { tagAttrs as e } from "./utils/index.js";
|
|
2
|
-
import { t } from "./form_inner-Cnwb6f_Q.js";
|
|
3
|
-
import { t as n } from "./input_inner-x4GfLGjj.js";
|
|
4
|
-
import { $one as r, off as i, on as a } from "ph-utils/browser";
|
|
5
|
-
//#region src/components/select_ori/index.less?inline
|
|
6
|
-
var o = ":host{height:var(--l-form-control-height,32px);display:inline-flex}.l-input__inner{border:1px solid var(--l-border-color,#dedede);border-radius:var(--l-border-radius,3px);transition:border-color .3s}.l-input__inner:hover{border-color:var(--l-primary-color-light1,#c6c6c6)}.l-input__inner:focus{border-color:var(--l-primary-color,#1890ff);box-shadow:0 0 0 3px var(--l-primary-color-light5)}", s = class extends t {
|
|
7
|
-
static baseName = "select-ori";
|
|
8
|
-
$select;
|
|
9
|
-
constructor() {
|
|
10
|
-
super(), this.version = 2;
|
|
11
|
-
}
|
|
12
|
-
connectedCallback() {
|
|
13
|
-
super.connectedCallback(), this.$select = r("select", this.root), this.value && (this.$select.value = this.value), a(this.$select, "change", this._handleChange);
|
|
14
|
-
}
|
|
15
|
-
disconnectedCallback() {
|
|
16
|
-
super.disconnectedCallback(), this.$select && i(this.$select, "change", this._handleChange), this.$select = void 0;
|
|
17
|
-
}
|
|
18
|
-
render_v2() {
|
|
19
|
-
return {
|
|
20
|
-
template: this.render(),
|
|
21
|
-
style: [n, o]
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
let t = this.innerHTML.trim();
|
|
26
|
-
return `<select class="l-input__inner"${e([["name", this.getName()], ["disabled", this.isDisabled()]])}>${t}</select>`;
|
|
27
|
-
}
|
|
28
|
-
disabledChange() {
|
|
29
|
-
this.$select && (this.$select.disabled = this.isDisabled());
|
|
30
|
-
}
|
|
31
|
-
setOptions(e) {
|
|
32
|
-
if (!this.$select) return;
|
|
33
|
-
let t = e.map((e) => `<option value="${e.value}">${e.label}</option>`);
|
|
34
|
-
this.$select.innerHTML = t.join("");
|
|
35
|
-
}
|
|
36
|
-
appendOptions(e) {
|
|
37
|
-
if (!this.$select) return;
|
|
38
|
-
let t = document.createDocumentFragment();
|
|
39
|
-
for (let n = 0, r = e.length; n < r; n++) {
|
|
40
|
-
let r = e[n], i = document.createElement("option");
|
|
41
|
-
i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
|
|
42
|
-
}
|
|
43
|
-
this.$select.appendChild(t);
|
|
44
|
-
}
|
|
45
|
-
reset() {
|
|
46
|
-
super.reset(), this.$select && (this.$select.value = this.value);
|
|
47
|
-
}
|
|
48
|
-
setValue(e) {
|
|
49
|
-
super.setValue(e), this.$select && (this.$select.value = this.value);
|
|
50
|
-
}
|
|
51
|
-
_handleChange = (e) => {
|
|
52
|
-
let t = e.target.value;
|
|
53
|
-
super.setValue(t), this.emit("change", { detail: t });
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
//#endregion
|
|
57
|
-
export { s as t };
|
package/lib/space-CKuTk0YB.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
-
import { isNumeric as r } from "ph-utils";
|
|
4
|
-
//#region src/components/space/index.less?inline
|
|
5
|
-
var i = ":host{box-sizing:border-box;display:var(--l-space-display,flex);align-items:var(--l-space-align,center);justify-content:var(--l-space-justify,flex-start);gap:var(--l-space-gap,10px);flex-wrap:var(--l-space-wrap,nowrap);flex-direction:var(--l-space-direction,row)}", a = class extends e {
|
|
6
|
-
static baseName = "space";
|
|
7
|
-
connectedCallback() {
|
|
8
|
-
this.loadStyleText(i), super.connectedCallback();
|
|
9
|
-
}
|
|
10
|
-
static get observedAttributes() {
|
|
11
|
-
return [
|
|
12
|
-
"inline",
|
|
13
|
-
"align",
|
|
14
|
-
"justify",
|
|
15
|
-
"gap",
|
|
16
|
-
"direction",
|
|
17
|
-
"wrap"
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
attributeChangedCallback(e, i, a) {
|
|
21
|
-
e = t(e);
|
|
22
|
-
let o = n(a, this[e], e);
|
|
23
|
-
if (e === "inline") n(a, !1, "inline") ? this.style.setProperty("--l-space-display", "inline-flex") : this.style.removeProperty("--l-space-display");
|
|
24
|
-
else if (e === "gap") {
|
|
25
|
-
if (o) {
|
|
26
|
-
let e = o.split(",").map((e) => r(e) ? `${e}px` : e);
|
|
27
|
-
this.style.setProperty("--l-space-gap", e.join(" "));
|
|
28
|
-
} else this.style.removeProperty("--l-space-gap");
|
|
29
|
-
} else {
|
|
30
|
-
let t = `--l-space-${e}`;
|
|
31
|
-
o ? this.style.setProperty(t, o) : this.style.removeProperty(t);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
return "<slot></slot>";
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
//#endregion
|
|
39
|
-
export { a as t };
|
package/lib/switch-wh2-ivty.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { initAttr as e } from "./utils/index.js";
|
|
2
|
-
import { t } from "./form_inner-Cnwb6f_Q.js";
|
|
3
|
-
import { $one as n, addClass as r, off as i, on as a, removeClass as o } from "ph-utils/browser";
|
|
4
|
-
//#region src/components/switch/index.less?inline
|
|
5
|
-
var s = ":host{box-sizing:border-box;--l-switch-height:22px;--l-switch-width:40px;width:auto;width:var(--l-switch-width);height:var(--l-switch-height);border-radius:calc(var(--l-switch-height) / 2);cursor:pointer;vertical-align:middle;background-color:#dcdfe6;border:1px solid #c2c2c2;justify-content:flex-start;align-items:center;padding:2px;transition:all .3s ease-in-out;display:inline-flex;position:relative}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color,#722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.l-switch-action{width:calc(var(--l-switch-height) - 6px);box-sizing:border-box;background-color:#fff;border-radius:50%;justify-content:center;align-items:center;padding:2px;font-size:12px;transition:all .3s ease-in-out;display:flex;position:absolute;top:2px;bottom:2px;left:2px}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}", c = class extends t {
|
|
6
|
-
static baseName = "switch";
|
|
7
|
-
actionRender;
|
|
8
|
-
checkedText;
|
|
9
|
-
uncheckedText;
|
|
10
|
-
connectedCallback() {
|
|
11
|
-
e(this), this.loadStyleText(s), super.connectedCallback(), this.pushValueChange(), this.#t(), a(this, "click", this.#e);
|
|
12
|
-
}
|
|
13
|
-
disconnectedCallback() {
|
|
14
|
-
super.disconnectedCallback(), i(this, "click", this.#e), this.actionRender = void 0;
|
|
15
|
-
}
|
|
16
|
-
render() {
|
|
17
|
-
this.isDisabled() && this.classList.add("l-switch--disabled"), this.value && this.classList.add("l-switch--checked");
|
|
18
|
-
let e = ["<div class=\"l-switch-action\" part=\"action\"></div>"];
|
|
19
|
-
if (this.checkedText || this.uncheckedText) {
|
|
20
|
-
let t = this.value ? this.checkedText || "" : this.uncheckedText || "";
|
|
21
|
-
e.push(`<span class="l-switch-text">${t}</span>`);
|
|
22
|
-
}
|
|
23
|
-
return e.join("");
|
|
24
|
-
}
|
|
25
|
-
#e = (e) => {
|
|
26
|
-
this.isDisabled() || (this.setValue(!this.value), this.emit("change"));
|
|
27
|
-
};
|
|
28
|
-
setValue(e) {
|
|
29
|
-
super.setValue(e), e ? r(this, "l-switch--checked") : o(this, "l-switch--checked");
|
|
30
|
-
let t = n(".l-switch-text", this.root);
|
|
31
|
-
t && (t.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), this.#t();
|
|
32
|
-
}
|
|
33
|
-
setActionRender(e) {
|
|
34
|
-
this.actionRender = e, this.#t();
|
|
35
|
-
}
|
|
36
|
-
#t() {
|
|
37
|
-
let e = n(".l-switch-action", this.root);
|
|
38
|
-
if (e) {
|
|
39
|
-
if (this.actionRender) {
|
|
40
|
-
let t = this.actionRender({ checked: this.value });
|
|
41
|
-
e.innerHTML = typeof t == "string" ? t : t.outerHTML;
|
|
42
|
-
} else {
|
|
43
|
-
let t = n("[slot=\"checked-action\"]", this), r = n("[slot=\"unchecked-action\"]", this);
|
|
44
|
-
this.value && t ? e.innerHTML = "<slot name=\"checked-action\"></slot>" : !this.value && r && (e.innerHTML = "<slot name=\"unchecked-action\"></slot>");
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
|
-
export { c as t };
|
package/lib/tabbar-CBXK-_AV.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { parseAttrValue as t } from "./utils/index.js";
|
|
3
|
-
import { $$ as n, $one as r, addClass as i, create as a, isVisible as o, off as s, on as c, removeClass as l, shouldEventNext as u } from "ph-utils/browser";
|
|
4
|
-
import { isBlank as d, isNumeric as f } from "ph-utils";
|
|
5
|
-
//#region src/components/tabbar/index.less?inline
|
|
6
|
-
var p = ":host{--l-tabbar-hover-color:var(--l-primary-color-light1,#9254de);--l-tabbar-active-color:var(--l-primary-color,#722ed1);--l-tabbar-item-gap:0;--l-tabbar-height:38px;height:var(--l-tabbar-height);align-items:stretch;gap:var(--l-tabbar-item-gap);box-sizing:border-box;background-color:#fff;flex-wrap:nowrap;display:flex;position:relative;overflow:hidden}:host(.l-tabbar--nav){--l-tabbar-height:50px;--l-tabbar-item-grow:1;width:100%}:host(.l-tabbar--bar){--l-tabbar-bar-vertical-padding:10px;--l-tabbar-item-gap:30px;--l-tabbar-line-color:var(--l-primary-color,#722ed1);white-space:nowrap;overflow:auto}.l-tabbar--bar-line{background-color:var(--l-tabbar-line-color);border-radius:1px;width:32px;height:2px;transition:all .3s ease-in-out;position:absolute;bottom:0;left:0}:host(.l-tabbar--card){--l-tabbar-card-border-color:#f5f7fa;--l-tabbar-line-color:#fff;--l-tabbar-item-gap:0;--l-tabbar-card-border-radius:5px}.l-tabbar-card-border{background-color:var(--l-tabbar-card-border-color);height:1px;position:absolute;bottom:0;left:0;right:0}", m = class extends e {
|
|
7
|
-
static baseName = "tabbar";
|
|
8
|
-
type = "nav";
|
|
9
|
-
_name = "";
|
|
10
|
-
gap;
|
|
11
|
-
$line;
|
|
12
|
-
get name() {
|
|
13
|
-
return this._name;
|
|
14
|
-
}
|
|
15
|
-
set name(e) {
|
|
16
|
-
this._name = e;
|
|
17
|
-
}
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
this.loadStyleText(p), i(this, `l-tabbar--${this.type}`), this.#e(), super.connectedCallback();
|
|
20
|
-
}
|
|
21
|
-
static get observedAttributes() {
|
|
22
|
-
return [
|
|
23
|
-
"name",
|
|
24
|
-
"type",
|
|
25
|
-
"justify-content",
|
|
26
|
-
"gap"
|
|
27
|
-
];
|
|
28
|
-
}
|
|
29
|
-
attributeChangedCallback(e, n, i) {
|
|
30
|
-
if (e === "name") {
|
|
31
|
-
let e = t(i, void 0);
|
|
32
|
-
this.name = e, this._updateActive(), this._updateLine();
|
|
33
|
-
} else if (e === "type") {
|
|
34
|
-
let e = t(i, "nav");
|
|
35
|
-
if (e !== this.type && (l(this, `l-tabbar--${this.type}`), this.type = e, l(this, `l-tabbar--${e}`), e === "card")) {
|
|
36
|
-
let e = r(".l-tabbar-card-border", this.root);
|
|
37
|
-
e || (e = a("div", { class: "l-tabbar-card-border" }), this.root.appendChild(e));
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
let n = t(i, void 0);
|
|
41
|
-
this[e] = n, this.#e();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
let e = document.createDocumentFragment();
|
|
46
|
-
if (e.appendChild(n("slot")), this.type === "card") {
|
|
47
|
-
let t = a("div", { class: "l-tabbar-card-border" });
|
|
48
|
-
e.appendChild(t);
|
|
49
|
-
}
|
|
50
|
-
return e;
|
|
51
|
-
}
|
|
52
|
-
afterInit() {
|
|
53
|
-
c(this.root, "click", this._handleClick), setTimeout(() => {
|
|
54
|
-
this._updateLine();
|
|
55
|
-
}, 300);
|
|
56
|
-
}
|
|
57
|
-
beforeDestroy() {
|
|
58
|
-
s(this.root, "click", this._handleClick), this.$line = void 0;
|
|
59
|
-
}
|
|
60
|
-
_handleClick = (e) => {
|
|
61
|
-
let [t, n] = u(e, "name", this);
|
|
62
|
-
t && n !== this.name && (this.name = n, this.dispatchEvent(new CustomEvent("change", { detail: { name: n } })), this._updateActive(), this._updateLine());
|
|
63
|
-
};
|
|
64
|
-
_updateActive() {
|
|
65
|
-
let e = r(".active", this);
|
|
66
|
-
e && l(e, "active");
|
|
67
|
-
let t = r(`[name="${this.name}"]`, this);
|
|
68
|
-
t && i(t, "active");
|
|
69
|
-
}
|
|
70
|
-
_updateLine() {
|
|
71
|
-
queueMicrotask(() => {
|
|
72
|
-
if (!this.name || this.type === "nav" || !this.rendered) return;
|
|
73
|
-
let e = r(".active", this);
|
|
74
|
-
if (!e) return;
|
|
75
|
-
let t = e.offsetLeft;
|
|
76
|
-
if (!this.$line) {
|
|
77
|
-
let e = a("div", { class: "l-tabbar--bar-line" });
|
|
78
|
-
e.part = "line", this.root.appendChild(e), this.$line = r(".l-tabbar--bar-line", this.root);
|
|
79
|
-
}
|
|
80
|
-
this.$line.style.cssText = `width:${e.offsetWidth}px;left:${t}px`, o(e, this) || this.scrollTo({
|
|
81
|
-
left: t,
|
|
82
|
-
behavior: "smooth"
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
#e() {
|
|
87
|
-
let e = this.getAttr("justify-content");
|
|
88
|
-
if (d(e) ? this.style.removeProperty("justify-content") : this.style.setProperty("justify-content", e), d(this.gap)) this.style.removeProperty("--l-tabbar-item-gap"), l(this, "l-tabbar-gap");
|
|
89
|
-
else {
|
|
90
|
-
let e = this.gap;
|
|
91
|
-
f(e, { isPositive: !0 }) && (e = `${e}px`), i(this, "l-tabbar-gap"), this.style.setProperty("--l-tabbar-item-gap", e);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
//#endregion
|
|
96
|
-
export { m as t };
|