litos-ui 0.21.0 → 0.23.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 +121 -15
- package/README.zh-CN.md +155 -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 +8 -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 +10 -10
- package/lib/{dialog_container_style-C1s0aBf7.js → dialog/dialog_container.css_inline.js} +2 -3
- package/lib/dialog/dialog_container.d.ts +1 -0
- package/lib/dialog/dialog_container.js +71 -60
- package/lib/dialog/dialog_container_style.js +8 -2
- package/lib/dialog/index.d.ts +1 -0
- package/lib/dialog/index.js +11 -6
- 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-box.d.ts +2 -0
- package/lib/entries/notification-box.js +2 -0
- package/lib/entries/notification.d.ts +2 -0
- package/lib/entries/notification.js +2 -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/base.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/icon_style.js +8 -2
- package/lib/{icon_style-J7iiDS_a.js → icon/index.less_inline.js} +2 -3
- package/lib/icon/minus.d.ts +5 -0
- package/lib/icon/minus.js +10 -0
- 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/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 +12 -0
- package/lib/index.js +48 -40
- 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.js +3 -3
- package/lib/{style-C5wUmE2b.js → input_number/index.less_inline.js} +2 -3
- package/lib/input_number/style.js +8 -2
- 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.js +21 -22
- package/lib/notification/index.d.ts +171 -0
- package/lib/notification/index.js +326 -0
- package/lib/notification/index.less_inline.js +4 -0
- package/lib/notification/notification_box.d.ts +40 -0
- package/lib/notification/notification_box.js +57 -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 +8 -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 +8 -2
- package/lib/{mask-Ox6CoyFB.js → styles/mask/index.css_inline.js} +2 -3
- package/lib/styles/mask/index.js +8 -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 +8 -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/dark.css +21 -1
- 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 +7 -7
- 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/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/lib/select/index.js
CHANGED
|
@@ -1,3 +1,355 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../
|
|
3
|
-
|
|
1
|
+
import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "../utils/index.js";
|
|
2
|
+
import r from "../form/form_inner.js";
|
|
3
|
+
import i from "./index.less_inline.js";
|
|
4
|
+
import { Popover as a } from "../utils/popover.js";
|
|
5
|
+
import { $ as o, $$ as s, $one as c, debounce as l, iterate as u, off as d, on as f, shouldEventNext as p } from "utilane/browser";
|
|
6
|
+
//#region src/components/select/index.ts
|
|
7
|
+
var m = class extends r {
|
|
8
|
+
static baseName = "select";
|
|
9
|
+
selectedLabels = [];
|
|
10
|
+
filter;
|
|
11
|
+
_options = [];
|
|
12
|
+
_backOptions;
|
|
13
|
+
inputHandler;
|
|
14
|
+
_popover;
|
|
15
|
+
_searchEl;
|
|
16
|
+
constructor() {
|
|
17
|
+
super(!0, !1), this.version = 2, this._state = {
|
|
18
|
+
filterable: !1,
|
|
19
|
+
placeholder: "请选择",
|
|
20
|
+
labelField: "label",
|
|
21
|
+
valueField: "value",
|
|
22
|
+
multiple: !1,
|
|
23
|
+
collapseTags: !1,
|
|
24
|
+
clearable: !1,
|
|
25
|
+
remote: !1
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
setInputHandler(e) {
|
|
29
|
+
this.inputHandler = e;
|
|
30
|
+
}
|
|
31
|
+
setFilter(e) {
|
|
32
|
+
this.filter = e;
|
|
33
|
+
}
|
|
34
|
+
get loading() {
|
|
35
|
+
return this._state.loading;
|
|
36
|
+
}
|
|
37
|
+
set loading(e) {
|
|
38
|
+
this.setLoading(e ?? !1);
|
|
39
|
+
}
|
|
40
|
+
setLoading(e) {
|
|
41
|
+
if (this._state.loading = e, !this.rendered) return;
|
|
42
|
+
let t = c(".l-select-loading", this.root);
|
|
43
|
+
e && (t || this.root.appendChild(s("l-loading-icon", { class: "l-select-loading" })), this.classList.add("l-select--loading")), t &&= (this.classList.remove("l-select--loading"), t.remove(), null);
|
|
44
|
+
}
|
|
45
|
+
setExpanded(e) {
|
|
46
|
+
this._state.expanded = e, e ? (this.classList.add("l-select--expand"), this._searchEl && this._searchEl.focus()) : this.classList.remove("l-select--expand");
|
|
47
|
+
}
|
|
48
|
+
setValue(e) {
|
|
49
|
+
let t = e;
|
|
50
|
+
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();
|
|
51
|
+
}
|
|
52
|
+
_updateSelectedLabels() {
|
|
53
|
+
if (this._options) {
|
|
54
|
+
this.selectedLabels = this._options.filter((e) => this._isOptionSelect(e[this._state.valueField])).map((e) => e[this._state.labelField]);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.selectedLabels = [];
|
|
58
|
+
}
|
|
59
|
+
static get observedAttributes() {
|
|
60
|
+
return [
|
|
61
|
+
"disabled",
|
|
62
|
+
"value",
|
|
63
|
+
"multiple",
|
|
64
|
+
"placeholder",
|
|
65
|
+
"collapse-tags",
|
|
66
|
+
"filterable",
|
|
67
|
+
"loading",
|
|
68
|
+
"label-field",
|
|
69
|
+
"value-field",
|
|
70
|
+
"width",
|
|
71
|
+
"clearable",
|
|
72
|
+
"remote"
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
attributeChange(r, i, a) {
|
|
76
|
+
switch (r) {
|
|
77
|
+
case "width":
|
|
78
|
+
this._state.width = n(a);
|
|
79
|
+
break;
|
|
80
|
+
case "label-field":
|
|
81
|
+
case "value-field":
|
|
82
|
+
case "placeholder":
|
|
83
|
+
this._state[r] = a;
|
|
84
|
+
break;
|
|
85
|
+
case "multiple":
|
|
86
|
+
case "clearable":
|
|
87
|
+
case "filterable":
|
|
88
|
+
case "collapse-tags":
|
|
89
|
+
case "remote":
|
|
90
|
+
this._state[e(r)] = t(a, !1, r);
|
|
91
|
+
break;
|
|
92
|
+
case "loading": this.setLoading(t(a, !1, r));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
updateDOM(e) {
|
|
96
|
+
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();
|
|
97
|
+
}
|
|
98
|
+
get options() {
|
|
99
|
+
return this._options;
|
|
100
|
+
}
|
|
101
|
+
set options(e) {
|
|
102
|
+
this.setOptions(e);
|
|
103
|
+
}
|
|
104
|
+
setOptions(e) {
|
|
105
|
+
this._options = e, this._backOptions = [...e || []], this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
106
|
+
}
|
|
107
|
+
_isOptionSelect(e) {
|
|
108
|
+
let t = !1;
|
|
109
|
+
return e != null && this.value != null && (t = this._state.multiple ? this.value.includes(e) : e === this.value), t;
|
|
110
|
+
}
|
|
111
|
+
_updateOptionSelect(e, t) {
|
|
112
|
+
let n = c(".l-select-icon", e);
|
|
113
|
+
t ? (e.classList.add("l-select-option--selected"), n || (n = s("l-select-icon", { class: "l-select-icon" }), e.appendChild(n))) : (e.classList.remove("l-select-option--selected"), n && n.remove());
|
|
114
|
+
}
|
|
115
|
+
_renderOption() {
|
|
116
|
+
let e = [];
|
|
117
|
+
if (this._options) {
|
|
118
|
+
let t = this._options.length;
|
|
119
|
+
for (let n = 0; n < t; n++) {
|
|
120
|
+
let t = this._options[n], r = t[this._state.valueField], i = t[this._state.labelField], a = this._isOptionSelect(r), o = [s("span", {
|
|
121
|
+
class: "l-select-option-content",
|
|
122
|
+
textContent: i,
|
|
123
|
+
title: i
|
|
124
|
+
})];
|
|
125
|
+
a && o.push(s("l-select-icon", { class: "l-select-icon" }));
|
|
126
|
+
let c = s("li", {
|
|
127
|
+
class: ["l-select-option", a ? "l-select-option--selected" : void 0],
|
|
128
|
+
"data-action": `${n}`
|
|
129
|
+
}, o);
|
|
130
|
+
e.push(c.outerHTML);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (e.length === 0) {
|
|
134
|
+
let t = s("li", {
|
|
135
|
+
class: "l-select-option l-select-option--empty",
|
|
136
|
+
textContent: "暂无数据"
|
|
137
|
+
});
|
|
138
|
+
e.push(t.outerHTML);
|
|
139
|
+
}
|
|
140
|
+
return e.join("");
|
|
141
|
+
}
|
|
142
|
+
_calculateOffset(e, t) {
|
|
143
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
144
|
+
return n.top - r.top + t.scrollTop;
|
|
145
|
+
}
|
|
146
|
+
isEmpty() {
|
|
147
|
+
let e = !0;
|
|
148
|
+
return !this._state.multiple && this.value != null && this.value !== "" && (e = !1), this._state.multiple && this.value && this.value.length > 0 && (e = !1), e;
|
|
149
|
+
}
|
|
150
|
+
_toggleClearable(e = !1) {
|
|
151
|
+
if (this._state.clearable) {
|
|
152
|
+
let t = c(".l-select-clear", this.root);
|
|
153
|
+
if (e || this.isEmpty() || this._state.loading) {
|
|
154
|
+
t && t.remove(), this.classList.remove("l-select--clearable");
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
t || this.root.appendChild(s("l-close-filled-icon", {
|
|
158
|
+
class: "l-select-clear",
|
|
159
|
+
"data-action": "clear"
|
|
160
|
+
})), this.classList.add("l-select--clearable");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
_onMouseEnter = () => {
|
|
164
|
+
this._toggleClearable(!1);
|
|
165
|
+
};
|
|
166
|
+
_onMouseLeave = () => {
|
|
167
|
+
this._toggleClearable(!0);
|
|
168
|
+
};
|
|
169
|
+
_togglePopover() {
|
|
170
|
+
if (this._popover) {
|
|
171
|
+
if (this._popover.isShow()) {
|
|
172
|
+
this._popover.hide();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this._popover.show(this);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
_updatePopoverContent() {
|
|
179
|
+
this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
180
|
+
}
|
|
181
|
+
_onRootTap = (e) => {
|
|
182
|
+
e.stopPropagation();
|
|
183
|
+
let [t, n, r] = p(e, "data-action", e.currentTarget);
|
|
184
|
+
if (t) {
|
|
185
|
+
if (n === "clear") this.value = this._state.multiple ? [] : "", this.selectedLabels = [], this._toggleClearable(!0), this._reRenderLabels(), this._updatePopoverContent();
|
|
186
|
+
else {
|
|
187
|
+
let e = Number(n);
|
|
188
|
+
this.selectedLabels.splice(e, 1), this._value.splice(e, 1), this._updatePopoverContent(), this._reRenderLabels(), this._searchEl && this._searchEl.focus();
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this._togglePopover();
|
|
193
|
+
};
|
|
194
|
+
_onTap = () => {
|
|
195
|
+
this._togglePopover();
|
|
196
|
+
};
|
|
197
|
+
_onSearchBlur = () => {
|
|
198
|
+
this._updateSearchValue();
|
|
199
|
+
};
|
|
200
|
+
_onSearchInput = (e) => {
|
|
201
|
+
if (this.inputHandler && this._state.filterable) {
|
|
202
|
+
let t = e.target.value;
|
|
203
|
+
this.inputHandler(t);
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
_handleFilte = (e) => {
|
|
207
|
+
if (this._state.remote) {
|
|
208
|
+
this.emit("search", { detail: { value: e } });
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this._options = this._filteOption(e), this._popover && this._state.expanded && this._popover.updatePopoverContent();
|
|
212
|
+
};
|
|
213
|
+
_filteOption(e) {
|
|
214
|
+
let t = [];
|
|
215
|
+
return this._backOptions && (t = this._backOptions.filter((t) => e ? this.filter ? this.filter(e, t) : t[this._state.labelField].includes(e) : !0)), t;
|
|
216
|
+
}
|
|
217
|
+
afterInit() {
|
|
218
|
+
f(this, "mouseenter", this._onMouseEnter), f(this, "mouseleave", this._onMouseLeave), f(this.root, "click", this._onRootTap), f(this, "click", this._onTap), this._searchEl = c(".l-select-filter", this.root), this._searchEl && (this.inputHandler = l(this._handleFilte, 300), f(this._searchEl, "input", this._onSearchInput), f(this._searchEl, "blur", this._onSearchBlur)), this.disabledChange(), this._popover ||= new a({
|
|
219
|
+
arrow: !1,
|
|
220
|
+
offset: 2,
|
|
221
|
+
placement: "bottom",
|
|
222
|
+
popoverWidth: "trigger",
|
|
223
|
+
trigger: "manual",
|
|
224
|
+
reference: this,
|
|
225
|
+
theme: "select",
|
|
226
|
+
disabled: this.isDisabled(),
|
|
227
|
+
contentRender() {
|
|
228
|
+
return "<ul class=\"l-select-list\"></ul>";
|
|
229
|
+
},
|
|
230
|
+
updateContent: (e) => {
|
|
231
|
+
let t = c(".l-select-list", e);
|
|
232
|
+
t && (t.innerHTML = this._renderOption());
|
|
233
|
+
},
|
|
234
|
+
onOpenChange: (e) => {
|
|
235
|
+
this.setExpanded(e);
|
|
236
|
+
},
|
|
237
|
+
onOutsideTap: (e, t, n) => {
|
|
238
|
+
!n && !t && this._popover?.hide();
|
|
239
|
+
},
|
|
240
|
+
onPopoverAction: (e, t) => {
|
|
241
|
+
if (e && this._options) {
|
|
242
|
+
let n = Number(e), r = this._options[n], i = r[this._state.valueField], a = r[this._state.labelField], s = this.value, c = this.selectedLabels;
|
|
243
|
+
if (this._state.multiple === !0) {
|
|
244
|
+
if (!s) s = [i], c = [a];
|
|
245
|
+
else if (Array.isArray(s)) {
|
|
246
|
+
let e = s.indexOf(i);
|
|
247
|
+
e === -1 ? (s.push(i), c.push(a)) : (s.splice(e, 1), c.splice(e, 1));
|
|
248
|
+
} else s != i && (s = [s, i], c = [c, a]);
|
|
249
|
+
} else s = i, c = [a];
|
|
250
|
+
this._value != s && this.emit("change", { detail: {
|
|
251
|
+
value: s,
|
|
252
|
+
labels: c
|
|
253
|
+
} }), this._value = s, this.selectedLabels = c;
|
|
254
|
+
let l = this._isOptionSelect(i);
|
|
255
|
+
if (!this._state.multiple) {
|
|
256
|
+
let e = o(".l-select-option--selected", t.parentElement);
|
|
257
|
+
u(e, (e) => {
|
|
258
|
+
this._updateOptionSelect(e, !1);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
this._updateOptionSelect(t, l), this._reRenderLabels(), !this._state.multiple && this._popover && this._popover.hide(), this._searchEl && this._state.multiple && this._searchEl.focus();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
beforeDestroy() {
|
|
267
|
+
if (d(this, "mouseenter", this._onMouseEnter), d(this, "mouseleave", this._onMouseLeave), d(this.root, "click", this._onRootTap), d(this, "click", this._onTap), this._options = void 0, this._popover &&= (this._popover.destroy(), void 0), this._searchEl) {
|
|
268
|
+
if (d(this._searchEl, "blur", this._onSearchBlur), d(this._searchEl, "input", this._onSearchInput), this.inputHandler) {
|
|
269
|
+
try {
|
|
270
|
+
this.inputHandler.cancel();
|
|
271
|
+
} catch {}
|
|
272
|
+
this.inputHandler = void 0;
|
|
273
|
+
}
|
|
274
|
+
this._searchEl = void 0;
|
|
275
|
+
}
|
|
276
|
+
this.filter = void 0;
|
|
277
|
+
}
|
|
278
|
+
render_v2() {
|
|
279
|
+
return {
|
|
280
|
+
template: this.render(),
|
|
281
|
+
style: [i]
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
render() {
|
|
285
|
+
let e = document.createDocumentFragment(), t = s("div", { class: "l-select-main" }), n = this._renderSelectedLabels();
|
|
286
|
+
if (t.appendChild(n), this._state.filterable) {
|
|
287
|
+
let e = this._state.placeholder || "请选择", n = "";
|
|
288
|
+
this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], n = this.selectedLabels[0])), t.appendChild(s("input", {
|
|
289
|
+
class: "l-select-filter",
|
|
290
|
+
placeholder: e,
|
|
291
|
+
value: n
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
e.appendChild(t);
|
|
295
|
+
let r = s("l-arrow-down-icon", { class: "l-select-arrow" });
|
|
296
|
+
return e.appendChild(r), e;
|
|
297
|
+
}
|
|
298
|
+
disabledChange() {
|
|
299
|
+
if (!this.rendered) return;
|
|
300
|
+
let e = this.isDisabled();
|
|
301
|
+
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);
|
|
302
|
+
}
|
|
303
|
+
_renderTag(e, t = 0, n = !0) {
|
|
304
|
+
let r = s("l-tag", {
|
|
305
|
+
type: "info",
|
|
306
|
+
class: "l-selected-item",
|
|
307
|
+
textContent: e
|
|
308
|
+
});
|
|
309
|
+
if (n) {
|
|
310
|
+
let e = s("div", {
|
|
311
|
+
class: "l-select-tag-close",
|
|
312
|
+
slot: "suffix",
|
|
313
|
+
innerHTML: "<l-close-icon></l-close-icon>",
|
|
314
|
+
"data-action": `${t}`
|
|
315
|
+
});
|
|
316
|
+
r.appendChild(e);
|
|
317
|
+
}
|
|
318
|
+
return r;
|
|
319
|
+
}
|
|
320
|
+
_reRenderLabels() {
|
|
321
|
+
let e = c(".l-select-main", this.root);
|
|
322
|
+
if (e) {
|
|
323
|
+
let t = o(".l-selected-item", e);
|
|
324
|
+
t.length > 0 && u(t, (e) => {
|
|
325
|
+
e && e != this._searchEl && e.remove();
|
|
326
|
+
});
|
|
327
|
+
let n = this._renderSelectedLabels();
|
|
328
|
+
this._searchEl ? e.insertBefore(n, this._searchEl) : e.appendChild(n);
|
|
329
|
+
}
|
|
330
|
+
this._updateSearchValue();
|
|
331
|
+
}
|
|
332
|
+
_updateSearchValue() {
|
|
333
|
+
if (this._searchEl) {
|
|
334
|
+
let e = this._state.placeholder || "请选择", t = "";
|
|
335
|
+
this.selectedLabels.length > 0 && (this._state.multiple ? e = "" : (e = this.selectedLabels[0], t = this.selectedLabels[0])), this._searchEl.placeholder = e, this._searchEl.value = t;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
_renderSelectedLabels() {
|
|
339
|
+
let e = document.createDocumentFragment(), t = this.selectedLabels.length;
|
|
340
|
+
if (t > 0) {
|
|
341
|
+
if (!this._state.multiple) this._state.filterable || e.appendChild(s("span", {
|
|
342
|
+
class: "l-selected-item",
|
|
343
|
+
textContent: this.selectedLabels[0]
|
|
344
|
+
}));
|
|
345
|
+
else if (this._state.collapseTags) e.appendChild(this._renderTag(this.selectedLabels[0])), t > 1 && e.appendChild(this._renderTag(`+${t - 1}`, -1, !1));
|
|
346
|
+
else for (let n = 0; n < t; n++) e.appendChild(this._renderTag(this.selectedLabels[n], n));
|
|
347
|
+
} else this._state.filterable || e.appendChild(s("span", {
|
|
348
|
+
class: "l-selected-item l-select-placeholder",
|
|
349
|
+
textContent: this._state.placeholder
|
|
350
|
+
}));
|
|
351
|
+
return e;
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
//#endregion
|
|
355
|
+
export { m as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/select/index.less?inline
|
|
2
|
+
var e = ":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)}}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/select_ori/index.js
CHANGED
|
@@ -1,2 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { tagAttrs as e } from "../utils/index.js";
|
|
2
|
+
import t from "../form/form_inner.js";
|
|
3
|
+
import n from "../input/input_inner.less_inline.js";
|
|
4
|
+
import r from "./index.less_inline.js";
|
|
5
|
+
import { $one as i, off as a, on as o } from "utilane/browser";
|
|
6
|
+
//#region src/components/select_ori/index.ts
|
|
7
|
+
var s = class extends t {
|
|
8
|
+
static baseName = "select-ori";
|
|
9
|
+
$select;
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this.version = 2;
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
super.connectedCallback(), this.$select = i("select", this.root), this.value && (this.$select.value = this.value), o(this.$select, "change", this._handleChange);
|
|
15
|
+
}
|
|
16
|
+
disconnectedCallback() {
|
|
17
|
+
super.disconnectedCallback(), this.$select && a(this.$select, "change", this._handleChange), this.$select = void 0;
|
|
18
|
+
}
|
|
19
|
+
render_v2() {
|
|
20
|
+
return {
|
|
21
|
+
template: this.render(),
|
|
22
|
+
style: [n, r]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
let t = this.innerHTML.trim();
|
|
27
|
+
return `<select class="l-input__inner"${e([["name", this.getName()], ["disabled", this.isDisabled()]])}>${t}</select>`;
|
|
28
|
+
}
|
|
29
|
+
disabledChange() {
|
|
30
|
+
this.$select && (this.$select.disabled = this.isDisabled());
|
|
31
|
+
}
|
|
32
|
+
setOptions(e) {
|
|
33
|
+
if (!this.$select) return;
|
|
34
|
+
let t = e.map((e) => `<option value="${e.value}">${e.label}</option>`);
|
|
35
|
+
this.$select.innerHTML = t.join("");
|
|
36
|
+
}
|
|
37
|
+
appendOptions(e) {
|
|
38
|
+
if (!this.$select) return;
|
|
39
|
+
let t = document.createDocumentFragment();
|
|
40
|
+
for (let n = 0, r = e.length; n < r; n++) {
|
|
41
|
+
let r = e[n], i = document.createElement("option");
|
|
42
|
+
i.value = r.value, i.innerHTML = r.label, t.appendChild(i);
|
|
43
|
+
}
|
|
44
|
+
this.$select.appendChild(t);
|
|
45
|
+
}
|
|
46
|
+
reset() {
|
|
47
|
+
super.reset(), this.$select && (this.$select.value = this.value);
|
|
48
|
+
}
|
|
49
|
+
setValue(e) {
|
|
50
|
+
super.setValue(e), this.$select && (this.$select.value = this.value);
|
|
51
|
+
}
|
|
52
|
+
_handleChange = (e) => {
|
|
53
|
+
let t = e.target.value;
|
|
54
|
+
super.setValue(t), this.emit("change", { detail: t });
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { s as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/select_ori/index.less?inline
|
|
2
|
+
var e = ":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)}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/space/index.js
CHANGED
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n } from "../utils/index.js";
|
|
3
|
+
import r from "./index.less_inline.js";
|
|
4
|
+
import { isNumeric as i } from "utilane";
|
|
5
|
+
//#region src/components/space/index.ts
|
|
6
|
+
var a = class extends e {
|
|
7
|
+
static baseName = "space";
|
|
8
|
+
connectedCallback() {
|
|
9
|
+
this.loadStyleText(r), super.connectedCallback();
|
|
10
|
+
}
|
|
11
|
+
static get observedAttributes() {
|
|
12
|
+
return [
|
|
13
|
+
"inline",
|
|
14
|
+
"align",
|
|
15
|
+
"justify",
|
|
16
|
+
"gap",
|
|
17
|
+
"direction",
|
|
18
|
+
"wrap"
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
attributeChangedCallback(e, r, a) {
|
|
22
|
+
e = t(e);
|
|
23
|
+
let o = n(a, this[e], e);
|
|
24
|
+
if (e === "inline") n(a, !1, "inline") ? this.style.setProperty("--l-space-display", "inline-flex") : this.style.removeProperty("--l-space-display");
|
|
25
|
+
else if (e === "gap") {
|
|
26
|
+
if (o) {
|
|
27
|
+
let e = o.split(",").map((e) => i(e) ? `${e}px` : e);
|
|
28
|
+
this.style.setProperty("--l-space-gap", e.join(" "));
|
|
29
|
+
} else this.style.removeProperty("--l-space-gap");
|
|
30
|
+
} else {
|
|
31
|
+
let t = `--l-space-${e}`;
|
|
32
|
+
o ? this.style.setProperty(t, o) : this.style.removeProperty(t);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return "<slot></slot>";
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/space/index.less?inline
|
|
2
|
+
var e = ":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)}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/components/styles/animation/index.css?inline
|
|
2
|
-
var e = "@keyframes l-rotate-frame{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.l-rotate-anim{animation:1.5s linear infinite l-rotate-frame}"
|
|
3
|
-
t.replaceSync(e);
|
|
2
|
+
var e = "@keyframes l-rotate-frame{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.l-rotate-anim{animation:1.5s linear infinite l-rotate-frame}";
|
|
4
3
|
//#endregion
|
|
5
|
-
export {
|
|
4
|
+
export { e as default };
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "./index.css_inline.js";
|
|
2
|
+
//#region src/components/styles/animation/index.ts
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/components/styles/mask/index.css?inline
|
|
2
|
-
var e = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}"
|
|
3
|
-
t.replaceSync(e);
|
|
2
|
+
var e = ".l-mask{z-index:var(--l-mask-zindex,100);opacity:1;background-color:#0009;transition:opacity .3s;position:fixed;inset:0}";
|
|
4
3
|
//#endregion
|
|
5
|
-
export {
|
|
4
|
+
export { e as default };
|
package/lib/styles/mask/index.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "./index.css_inline.js";
|
|
2
|
+
//#region src/components/styles/mask/index.ts
|
|
3
|
+
var t = /* @__PURE__ */ (() => {
|
|
4
|
+
let t = new CSSStyleSheet();
|
|
5
|
+
return t.replaceSync(e), t;
|
|
6
|
+
})();
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as default };
|
package/lib/switch/index.js
CHANGED
|
@@ -1,2 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { initAttr as e } from "../utils/index.js";
|
|
2
|
+
import t from "../form/form_inner.js";
|
|
3
|
+
import n from "./index.less_inline.js";
|
|
4
|
+
import { $one as r, addClass as i, off as a, on as o, removeClass as s } from "utilane/browser";
|
|
5
|
+
//#region src/components/switch/index.ts
|
|
6
|
+
var c = class extends t {
|
|
7
|
+
static baseName = "switch";
|
|
8
|
+
actionRender;
|
|
9
|
+
checkedText;
|
|
10
|
+
uncheckedText;
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
e(this), this.loadStyleText(n), super.connectedCallback(), this.pushValueChange(), this.#t(), o(this, "click", this.#e);
|
|
13
|
+
}
|
|
14
|
+
disconnectedCallback() {
|
|
15
|
+
super.disconnectedCallback(), a(this, "click", this.#e), this.actionRender = void 0;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
this.isDisabled() && this.classList.add("l-switch--disabled"), this.value && this.classList.add("l-switch--checked");
|
|
19
|
+
let e = ["<div class=\"l-switch-action\" part=\"action\"></div>"];
|
|
20
|
+
if (this.checkedText || this.uncheckedText) {
|
|
21
|
+
let t = this.value ? this.checkedText || "" : this.uncheckedText || "";
|
|
22
|
+
e.push(`<span class="l-switch-text">${t}</span>`);
|
|
23
|
+
}
|
|
24
|
+
return e.join("");
|
|
25
|
+
}
|
|
26
|
+
#e = (e) => {
|
|
27
|
+
this.isDisabled() || (this.setValue(!this.value), this.emit("change"));
|
|
28
|
+
};
|
|
29
|
+
setValue(e) {
|
|
30
|
+
super.setValue(e), e ? i(this, "l-switch--checked") : s(this, "l-switch--checked");
|
|
31
|
+
let t = r(".l-switch-text", this.root);
|
|
32
|
+
t && (t.textContent = this.value ? this.checkedText || "" : this.uncheckedText || ""), this.#t();
|
|
33
|
+
}
|
|
34
|
+
setActionRender(e) {
|
|
35
|
+
this.actionRender = e, this.#t();
|
|
36
|
+
}
|
|
37
|
+
#t() {
|
|
38
|
+
let e = r(".l-switch-action", this.root);
|
|
39
|
+
if (e) {
|
|
40
|
+
if (this.actionRender) {
|
|
41
|
+
let t = this.actionRender({ checked: this.value });
|
|
42
|
+
e.innerHTML = typeof t == "string" ? t : t.outerHTML;
|
|
43
|
+
} else {
|
|
44
|
+
let t = r("[slot=\"checked-action\"]", this), n = r("[slot=\"unchecked-action\"]", this);
|
|
45
|
+
this.value && t ? e.innerHTML = "<slot name=\"checked-action\"></slot>" : !this.value && n && (e.innerHTML = "<slot name=\"unchecked-action\"></slot>");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
//#endregion
|
|
51
|
+
export { c as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/switch/index.less?inline
|
|
2
|
+
var e = ":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}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|