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
|
@@ -1,120 +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 { $ as i, $$ as a, iterate as o, off as s, on as c } from "ph-utils/browser";
|
|
4
|
-
import { parse as l } from "ph-utils";
|
|
5
|
-
//#region src/components/date_picker_ori/index.less?inline
|
|
6
|
-
var u = ":host{width:var(--l-date-picker-width,auto);align-items:center;display:inline-flex}.l-date-inner{height:var(--l-form-control-height,32px);border:1px solid var(--l-border-color,#dedede);cursor:text;border-radius:3px;outline:none;flex-grow:1;padding:0 5px;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1,#9254de)}.l-date-inner:focus{border-color:var(--l-primary-color,#722ed1)}.l-date-range-divider{margin:0 10px}", d = class extends r {
|
|
7
|
-
static baseName = "date-picker-ori";
|
|
8
|
-
#e;
|
|
9
|
-
#t;
|
|
10
|
-
#n;
|
|
11
|
-
#r;
|
|
12
|
-
_state;
|
|
13
|
-
constructor() {
|
|
14
|
-
super(), this._state = {
|
|
15
|
-
range: !1,
|
|
16
|
-
delay: 300,
|
|
17
|
-
type: "date",
|
|
18
|
-
allowEmpty: !0
|
|
19
|
-
}, this.#t = [], this.#r = !1;
|
|
20
|
-
}
|
|
21
|
-
setValue(e) {
|
|
22
|
-
super.setValue(e), this.#t = e.split(","), this.rendered && o(this.#e, (e, t) => {
|
|
23
|
-
e.value = this.#t[t];
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static get observedAttributes() {
|
|
27
|
-
return [
|
|
28
|
-
...r.observedAttributes,
|
|
29
|
-
"range",
|
|
30
|
-
"delay",
|
|
31
|
-
"type",
|
|
32
|
-
"width",
|
|
33
|
-
"min",
|
|
34
|
-
"max",
|
|
35
|
-
"allow-empty"
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
connectedCallback() {
|
|
39
|
-
this.loadStyleText(u), this._updateWidth(), super.connectedCallback();
|
|
40
|
-
}
|
|
41
|
-
afterInit() {
|
|
42
|
-
this.#e = i(".l-date-inner", this.root), c(this.#e, "change", this.#a), this._state.range && (c(this.#e, "focus", this.#c), c(this.#e, "blur", this.#l));
|
|
43
|
-
}
|
|
44
|
-
beforeDestroy() {
|
|
45
|
-
s(this.#e, "change", this.#a), this._state.range && (s(this.#e, "focus", this.#c), s(this.#e, "blur", this.#l)), this.#o();
|
|
46
|
-
}
|
|
47
|
-
attributeChange(r, i, a) {
|
|
48
|
-
switch (r) {
|
|
49
|
-
case "type":
|
|
50
|
-
case "min":
|
|
51
|
-
case "max":
|
|
52
|
-
this._state[r] = a;
|
|
53
|
-
break;
|
|
54
|
-
case "range":
|
|
55
|
-
case "allow-empty":
|
|
56
|
-
this._state[e(r)] = t(a, !1, r);
|
|
57
|
-
break;
|
|
58
|
-
case "delay":
|
|
59
|
-
this._state.delay = t(a, 300);
|
|
60
|
-
break;
|
|
61
|
-
case "width": this._state.width = n(a);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
updateDOM(e) {
|
|
65
|
-
e.has("width") && this._updateWidth();
|
|
66
|
-
}
|
|
67
|
-
_updateWidth() {
|
|
68
|
-
this._state.width ? this.style.setProperty("--l-date-picker-width", this._state.width) : this.style.removeProperty("--l-date-picker-width");
|
|
69
|
-
}
|
|
70
|
-
render() {
|
|
71
|
-
let e = document.createDocumentFragment();
|
|
72
|
-
if (e.appendChild(this.#i(0)), this._state.range) {
|
|
73
|
-
let t = a("span", {
|
|
74
|
-
class: "l-date-range-divider",
|
|
75
|
-
textContent: "-"
|
|
76
|
-
});
|
|
77
|
-
e.appendChild(t), e.appendChild(this.#i(1));
|
|
78
|
-
}
|
|
79
|
-
return e;
|
|
80
|
-
}
|
|
81
|
-
#i(e = 0) {
|
|
82
|
-
return a("input", {
|
|
83
|
-
type: this._state.type,
|
|
84
|
-
class: `l-date-inner l-date-inner${e}`,
|
|
85
|
-
name: this.getName(),
|
|
86
|
-
value: this.#t[e],
|
|
87
|
-
"l-datepicker": `${e}`,
|
|
88
|
-
disabled: this.isDisabled() ? !0 : void 0,
|
|
89
|
-
min: this._state.min,
|
|
90
|
-
max: this._state.max
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
#a = (e) => {
|
|
94
|
-
let t = e.target, n = Number(t.getAttribute("l-datepicker")), r = t.value;
|
|
95
|
-
!r && !this._state.allowEmpty && (r = this._resetValue || "", r = r.split(",")[n], t.value = r), this.#t[n] = r, this.#t.join(",") !== this._value && (this.setValue(this.#t.join(",")), this.#r = !0), n === 0 && this.#e.length > 1 ? this.#e[1].min = r : n === 1 && (this.#e[0].max = r), this._state.range ? this.#s() : this.#u();
|
|
96
|
-
};
|
|
97
|
-
#o() {
|
|
98
|
-
this.#n !== -1 && (clearTimeout(this.#n), this.#n = -1);
|
|
99
|
-
}
|
|
100
|
-
#s() {
|
|
101
|
-
this.#r && (this.#o(), this.#n = setTimeout(() => {
|
|
102
|
-
this.#u(), this.#r = !1;
|
|
103
|
-
}, this._state.delay));
|
|
104
|
-
}
|
|
105
|
-
#c = () => {
|
|
106
|
-
this.#o();
|
|
107
|
-
};
|
|
108
|
-
#l = () => {
|
|
109
|
-
this.#s();
|
|
110
|
-
};
|
|
111
|
-
#u() {
|
|
112
|
-
this.dispatchEvent(new CustomEvent("change", { detail: {
|
|
113
|
-
value: this.getValue(),
|
|
114
|
-
dateStr: this.#t,
|
|
115
|
-
dates: this.#t.map((e) => l(e))
|
|
116
|
-
} }));
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
//#endregion
|
|
120
|
-
export { d as t };
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { kebabToCamel as t, parseAttrValue as n } from "./utils/index.js";
|
|
3
|
-
import { $one as r, addClass as i, hasClass as a, on as o, removeClass as s, shouldEventNext as c } from "ph-utils/browser";
|
|
4
|
-
//#region src/components/description_panel/index.less?inline
|
|
5
|
-
var l = ":host{--l-desc-panel-min-height:100px;--l-desc-panel-font-size:14px;--l-desc-panel-textindent:calc(var(--l-desc-panel-font-size) * 2);max-height:var(--l-desc-panel-max-height,max-content);color:#1f2937;font-size:var(--l-desc-panel-font-size);text-indent:var(--l-desc-panel-textindent);box-sizing:border-box;transition:all .15s linear;display:block;position:relative}.content{box-sizing:border-box;border:1px solid #0000}.l-desc-panel-operator{z-index:2;box-sizing:border-box;background:0 0;justify-content:center;width:100%;padding-top:0;padding-bottom:0;display:flex}.l-desc-panel-btnmore{font-size:var(--nt-desc-panel-font-size)}.l-desc-panel-btnmore:before{content:attr(data-text)}.l-desc-panel-arrow{transition:transform .3s ease-in-out;transform:rotate(180deg)}:host(.collapse){max-height:var(--l-desc-panel-min-height);overflow-y:hidden}:host(.collapse) .l-desc-panel-operator{background:linear-gradient(-180deg,#fff0 0%,#fff 80%);padding-top:65px;position:absolute;bottom:0;left:0}:host(.collapse) .l-desc-panel-arrow{transform:rotateX(0)}", u = class extends e {
|
|
6
|
-
static baseName = "description-panel";
|
|
7
|
-
collapseHeight = 100;
|
|
8
|
-
static get observedAttributes() {
|
|
9
|
-
return ["collapse-height"];
|
|
10
|
-
}
|
|
11
|
-
attributeChangedCallback(e, r, i) {
|
|
12
|
-
e = t(e);
|
|
13
|
-
let a = n(i, this[e]);
|
|
14
|
-
a !== this[e] && (this[e] = a, e === "collapseHeight") && (this.collapseHeight === 100 ? this.style.removeProperty("--l-desc-panel-min-height") : this.style.setProperty("--l-desc-panel-min-height", `${this.collapseHeight}px`));
|
|
15
|
-
}
|
|
16
|
-
connectedCallback() {
|
|
17
|
-
this.loadStyleText(l), super.connectedCallback();
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
return [
|
|
21
|
-
"<div class=\"content\"><slot></slot></div>",
|
|
22
|
-
"<div class=\"l-desc-panel-operator\">",
|
|
23
|
-
"<l-button type=\"primary\" data-action=\"collapse\" class=\"l-desc-panel-btnmore\" text>",
|
|
24
|
-
"<span>查看更多</span>",
|
|
25
|
-
"<l-arrow-down-icon class=\"l-desc-panel-arrow\"></l-arrow-down-icon>",
|
|
26
|
-
"</l-button></div>"
|
|
27
|
-
].join("");
|
|
28
|
-
}
|
|
29
|
-
afterInit() {
|
|
30
|
-
this.classList.add("collapse");
|
|
31
|
-
let e = r(".content", this.root), t = r(".l-desc-panel-operator", this.root);
|
|
32
|
-
if (e) {
|
|
33
|
-
let n = e.getBoundingClientRect().height;
|
|
34
|
-
n <= this.collapseHeight && (t &&= (t.remove(), null));
|
|
35
|
-
let r = 0;
|
|
36
|
-
if (t) {
|
|
37
|
-
let e = t.getBoundingClientRect().height, n = getComputedStyle(t).getPropertyValue("padding-top");
|
|
38
|
-
r = e - parseInt(n);
|
|
39
|
-
}
|
|
40
|
-
this.style.setProperty("--l-desc-panel-max-height", `${n + r}px`);
|
|
41
|
-
}
|
|
42
|
-
t && o(t, "click", this.#e);
|
|
43
|
-
}
|
|
44
|
-
#e = (e) => {
|
|
45
|
-
let [t, n, o] = c(e, "data-action", e.currentTarget);
|
|
46
|
-
if (t) {
|
|
47
|
-
let e = r("span", o);
|
|
48
|
-
a(this, "collapse") ? (s(this, "collapse"), e && (e.textContent = "收起")) : (i(this, "collapse"), e && (e.textContent = "查看更多"));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
//#endregion
|
|
53
|
-
export { u as t };
|
package/lib/esm-DAha108i.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/alien-signals@3.2.1/node_modules/alien-signals/esm/system.mjs
|
|
2
|
-
function e({ update: e, notify: t, unwatched: n }) {
|
|
3
|
-
return {
|
|
4
|
-
link: r,
|
|
5
|
-
unlink: i,
|
|
6
|
-
propagate: a,
|
|
7
|
-
checkDirty: o,
|
|
8
|
-
shallowPropagate: s
|
|
9
|
-
};
|
|
10
|
-
function r(e, t, n) {
|
|
11
|
-
let r = t.depsTail;
|
|
12
|
-
if (r !== void 0 && r.dep === e) return;
|
|
13
|
-
let i = r === void 0 ? t.deps : r.nextDep;
|
|
14
|
-
if (i !== void 0 && i.dep === e) {
|
|
15
|
-
i.version = n, t.depsTail = i;
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
let a = e.subsTail;
|
|
19
|
-
if (a !== void 0 && a.version === n && a.sub === t) return;
|
|
20
|
-
let o = t.depsTail = e.subsTail = {
|
|
21
|
-
version: n,
|
|
22
|
-
dep: e,
|
|
23
|
-
sub: t,
|
|
24
|
-
prevDep: r,
|
|
25
|
-
nextDep: i,
|
|
26
|
-
prevSub: a,
|
|
27
|
-
nextSub: void 0
|
|
28
|
-
};
|
|
29
|
-
i !== void 0 && (i.prevDep = o), r === void 0 ? t.deps = o : r.nextDep = o, a === void 0 ? e.subs = o : a.nextSub = o;
|
|
30
|
-
}
|
|
31
|
-
function i(e, t = e.sub) {
|
|
32
|
-
let { dep: r, prevDep: i, nextDep: a, nextSub: o, prevSub: s } = e;
|
|
33
|
-
return a === void 0 ? t.depsTail = i : a.prevDep = i, i === void 0 ? t.deps = a : i.nextDep = a, o === void 0 ? r.subsTail = s : o.prevSub = s, s === void 0 ? (r.subs = o) === void 0 && n(r) : s.nextSub = o, a;
|
|
34
|
-
}
|
|
35
|
-
function a(e, n) {
|
|
36
|
-
let r = e.nextSub, i;
|
|
37
|
-
top: do {
|
|
38
|
-
let a = e.sub, o = a.flags;
|
|
39
|
-
if (o & 60 ? o & 12 ? o & 4 ? !(o & 48) && c(e, a) ? (a.flags = o | 40, o &= 1) : o = 0 : a.flags = o & -9 | 32 : o = 0 : (a.flags = o | 32, n && (a.flags |= 8)), o & 2 && t(a), o & 1) {
|
|
40
|
-
let t = a.subs;
|
|
41
|
-
if (t !== void 0) {
|
|
42
|
-
let n = (e = t).nextSub;
|
|
43
|
-
n !== void 0 && (i = {
|
|
44
|
-
value: r,
|
|
45
|
-
prev: i
|
|
46
|
-
}, r = n);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if ((e = r) !== void 0) {
|
|
51
|
-
r = e.nextSub;
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
for (; i !== void 0;) if (e = i.value, i = i.prev, e !== void 0) {
|
|
55
|
-
r = e.nextSub;
|
|
56
|
-
continue top;
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
|
-
} while (!0);
|
|
60
|
-
}
|
|
61
|
-
function o(t, n) {
|
|
62
|
-
let r, i = 0, a = !1;
|
|
63
|
-
top: do {
|
|
64
|
-
let o = t.dep, c = o.flags;
|
|
65
|
-
if (n.flags & 16) a = !0;
|
|
66
|
-
else if ((c & 17) == 17) {
|
|
67
|
-
let t = o.subs;
|
|
68
|
-
e(o) && (t.nextSub !== void 0 && s(t), a = !0);
|
|
69
|
-
} else if ((c & 33) == 33) {
|
|
70
|
-
r = {
|
|
71
|
-
value: t,
|
|
72
|
-
prev: r
|
|
73
|
-
}, t = o.deps, n = o, ++i;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (!a) {
|
|
77
|
-
let e = t.nextDep;
|
|
78
|
-
if (e !== void 0) {
|
|
79
|
-
t = e;
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
for (; i--;) {
|
|
84
|
-
if (t = r.value, r = r.prev, a) {
|
|
85
|
-
let r = n.subs;
|
|
86
|
-
if (e(n)) {
|
|
87
|
-
r.nextSub !== void 0 && s(r), n = t.sub;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
a = !1;
|
|
91
|
-
} else n.flags &= -33;
|
|
92
|
-
n = t.sub;
|
|
93
|
-
let i = t.nextDep;
|
|
94
|
-
if (i !== void 0) {
|
|
95
|
-
t = i;
|
|
96
|
-
continue top;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
return a && !!n.flags;
|
|
100
|
-
} while (!0);
|
|
101
|
-
}
|
|
102
|
-
function s(e) {
|
|
103
|
-
do {
|
|
104
|
-
let n = e.sub, r = n.flags;
|
|
105
|
-
(r & 48) == 32 && (n.flags = r | 16, (r & 6) == 2 && t(n));
|
|
106
|
-
} while ((e = e.nextSub) !== void 0);
|
|
107
|
-
}
|
|
108
|
-
function c(e, t) {
|
|
109
|
-
let n = t.depsTail;
|
|
110
|
-
for (; n !== void 0;) {
|
|
111
|
-
if (n === e) return !0;
|
|
112
|
-
n = n.prevDep;
|
|
113
|
-
}
|
|
114
|
-
return !1;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region node_modules/.pnpm/alien-signals@3.2.1/node_modules/alien-signals/esm/index.mjs
|
|
119
|
-
var t = 0, n = 0, r = 0, i = 0, a, o = [], { link: s, unlink: c, propagate: l, checkDirty: u, shallowPropagate: d } = e({
|
|
120
|
-
update(e) {
|
|
121
|
-
return "getter" in e ? h(e) : "currentValue" in e ? g(e) : (e.flags = 1, !0);
|
|
122
|
-
},
|
|
123
|
-
notify(e) {
|
|
124
|
-
let t = i, n = t;
|
|
125
|
-
do
|
|
126
|
-
if (o[t++] = e, e.flags &= -3, e = e.subs?.sub, e === void 0 || !(e.flags & 2)) break;
|
|
127
|
-
while (!0);
|
|
128
|
-
for (i = t; n < --t;) {
|
|
129
|
-
let e = o[n];
|
|
130
|
-
o[n++] = o[t], o[t] = e;
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
unwatched(e) {
|
|
134
|
-
"getter" in e ? e.depsTail !== void 0 && (e.flags = 17, C(e)) : "currentValue" in e || ("fn" in e ? x.call(e) : S.call(e));
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
function f(e) {
|
|
138
|
-
let t = a;
|
|
139
|
-
return a = e, t;
|
|
140
|
-
}
|
|
141
|
-
function p(e) {
|
|
142
|
-
return y.bind({
|
|
143
|
-
currentValue: e,
|
|
144
|
-
pendingValue: e,
|
|
145
|
-
subs: void 0,
|
|
146
|
-
subsTail: void 0,
|
|
147
|
-
flags: 1
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
function m(e) {
|
|
151
|
-
let t = {
|
|
152
|
-
fn: e,
|
|
153
|
-
cleanup: void 0,
|
|
154
|
-
subs: void 0,
|
|
155
|
-
subsTail: void 0,
|
|
156
|
-
deps: void 0,
|
|
157
|
-
depsTail: void 0,
|
|
158
|
-
flags: 6
|
|
159
|
-
}, r = f(t);
|
|
160
|
-
r !== void 0 && (s(t, r, 0), r.flags |= 64);
|
|
161
|
-
try {
|
|
162
|
-
++n, t.cleanup = t.fn();
|
|
163
|
-
} finally {
|
|
164
|
-
--n, a = r, t.flags &= -5;
|
|
165
|
-
}
|
|
166
|
-
return x.bind(t);
|
|
167
|
-
}
|
|
168
|
-
function h(e) {
|
|
169
|
-
if (e.flags & 64) {
|
|
170
|
-
let t = e.depsTail;
|
|
171
|
-
for (; t !== void 0;) {
|
|
172
|
-
let n = t.prevDep, r = t.dep;
|
|
173
|
-
!("getter" in r) && !("currentValue" in r) && c(t, e), t = n;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
e.depsTail = void 0, e.flags = 5;
|
|
177
|
-
let n = f(e);
|
|
178
|
-
try {
|
|
179
|
-
++t;
|
|
180
|
-
let n = e.value;
|
|
181
|
-
return n !== (e.value = e.getter(n));
|
|
182
|
-
} finally {
|
|
183
|
-
a = n, e.flags &= -5, w(e);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function g(e) {
|
|
187
|
-
return e.flags = 1, e.currentValue !== (e.currentValue = e.pendingValue);
|
|
188
|
-
}
|
|
189
|
-
function _(e) {
|
|
190
|
-
let r = e.flags;
|
|
191
|
-
if (r & 16 || r & 32 && u(e.deps, e)) {
|
|
192
|
-
if (r & 64) {
|
|
193
|
-
let t = e.depsTail;
|
|
194
|
-
for (; t !== void 0;) {
|
|
195
|
-
let n = t.prevDep, r = t.dep;
|
|
196
|
-
!("getter" in r) && !("currentValue" in r) && c(t, e), t = n;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
if (e.cleanup && (b(e), !e.flags)) return;
|
|
200
|
-
e.depsTail = void 0, e.flags = 6;
|
|
201
|
-
let i = f(e);
|
|
202
|
-
try {
|
|
203
|
-
++t, ++n, e.cleanup = e.fn();
|
|
204
|
-
} finally {
|
|
205
|
-
--n, a = i, e.flags &= -5, w(e);
|
|
206
|
-
}
|
|
207
|
-
} else e.deps !== void 0 && (e.flags = 2 | r & 64);
|
|
208
|
-
}
|
|
209
|
-
function v() {
|
|
210
|
-
try {
|
|
211
|
-
for (; r < i;) {
|
|
212
|
-
let e = o[r];
|
|
213
|
-
o[r++] = void 0, _(e);
|
|
214
|
-
}
|
|
215
|
-
} finally {
|
|
216
|
-
for (; r < i;) {
|
|
217
|
-
let e = o[r];
|
|
218
|
-
o[r++] = void 0, e.flags |= 10;
|
|
219
|
-
}
|
|
220
|
-
r = 0, i = 0;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
function y(...e) {
|
|
224
|
-
if (e.length) {
|
|
225
|
-
if (this.pendingValue !== (this.pendingValue = e[0])) {
|
|
226
|
-
this.flags = 17;
|
|
227
|
-
let e = this.subs;
|
|
228
|
-
e !== void 0 && (l(e, !!n), v());
|
|
229
|
-
}
|
|
230
|
-
} else {
|
|
231
|
-
if (this.flags & 16 && g(this)) {
|
|
232
|
-
let e = this.subs;
|
|
233
|
-
e !== void 0 && d(e);
|
|
234
|
-
}
|
|
235
|
-
let e = a;
|
|
236
|
-
return e !== void 0 && s(this, e, t), this.currentValue;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function b(e) {
|
|
240
|
-
let t = e.cleanup;
|
|
241
|
-
e.cleanup = void 0;
|
|
242
|
-
let n = a;
|
|
243
|
-
a = void 0;
|
|
244
|
-
try {
|
|
245
|
-
t();
|
|
246
|
-
} finally {
|
|
247
|
-
a = n;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function x() {
|
|
251
|
-
S.call(this), this.cleanup && b(this);
|
|
252
|
-
}
|
|
253
|
-
function S() {
|
|
254
|
-
this.flags = 0, C(this);
|
|
255
|
-
let e = this.subs;
|
|
256
|
-
e !== void 0 && c(e);
|
|
257
|
-
}
|
|
258
|
-
function C(e) {
|
|
259
|
-
let t = e.depsTail;
|
|
260
|
-
for (; t !== void 0;) {
|
|
261
|
-
let n = t.prevDep;
|
|
262
|
-
c(t, e), t = n;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function w(e) {
|
|
266
|
-
let t = e.depsTail, n = t === void 0 ? e.deps : t.nextDep;
|
|
267
|
-
for (; n !== void 0;) n = c(n, e);
|
|
268
|
-
}
|
|
269
|
-
//#endregion
|
|
270
|
-
export { p as n, m as t };
|
package/lib/form-DJxvBiLy.js
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { kebabToCamel as t, parseAttrValue as n, unitNumberStr as r } from "./utils/index.js";
|
|
3
|
-
import { n as i } from "./esm-DAha108i.js";
|
|
4
|
-
import { $one as a, formatClass as o, off as s, on as c } from "ph-utils/browser";
|
|
5
|
-
import { Validator as l } from "ph-utils";
|
|
6
|
-
//#region src/components/form/index.less?inline
|
|
7
|
-
var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column;display:flex}.l-form-inline{gap:var(--l-form-gap,20px);flex-flow:wrap;display:flex}.l-form.l-form-inline{--l-form-item-display:flex}.l-form.l-form--left{--l-form-label-align:left}.l-form.l-form--top{--l-form-item-display:grid;--l-form-label-align:left;--l-form-label-empty-display:none;grid-template-columns:1fr}", d = class extends e {
|
|
8
|
-
static baseName = "form";
|
|
9
|
-
validator;
|
|
10
|
-
_data;
|
|
11
|
-
context;
|
|
12
|
-
errors;
|
|
13
|
-
resetCtx;
|
|
14
|
-
constructor() {
|
|
15
|
-
super(), this.version = 2, this._state = {
|
|
16
|
-
inline: !1,
|
|
17
|
-
labelPosition: "right",
|
|
18
|
-
labelWidth: "80px",
|
|
19
|
-
novalidate: !1,
|
|
20
|
-
emitError: !1
|
|
21
|
-
}, this.validator = new l([]), this.context = i({ innerBlock: !1 }), this.errors = i({}), this.resetCtx = i(0);
|
|
22
|
-
}
|
|
23
|
-
static get observedAttributes() {
|
|
24
|
-
return [
|
|
25
|
-
"label-position",
|
|
26
|
-
"inner-block",
|
|
27
|
-
"inline",
|
|
28
|
-
"novalidate",
|
|
29
|
-
"label-width",
|
|
30
|
-
"label-height",
|
|
31
|
-
"emit-error"
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
attributeChanged(e, i, a) {
|
|
35
|
-
switch (e) {
|
|
36
|
-
case "label-position":
|
|
37
|
-
this._state.labelPosition = a;
|
|
38
|
-
break;
|
|
39
|
-
case "inner-block":
|
|
40
|
-
let i = n(a, !1, e);
|
|
41
|
-
this.context({ innerBlock: i });
|
|
42
|
-
break;
|
|
43
|
-
case "label-width":
|
|
44
|
-
case "label-height":
|
|
45
|
-
this._state[t(e)] = r(a);
|
|
46
|
-
break;
|
|
47
|
-
default:
|
|
48
|
-
let o = n(a, !1, e);
|
|
49
|
-
this._state[t(e)] = o;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
updateDOM(e) {
|
|
53
|
-
if (e.has("label-position") || e.has("inline")) {
|
|
54
|
-
let e = a("form", this.root);
|
|
55
|
-
e && (e.className = o([
|
|
56
|
-
"l-form",
|
|
57
|
-
this._state.inline ? "l-form-inline" : void 0,
|
|
58
|
-
`l-form--${this._state.labelPosition}`
|
|
59
|
-
]));
|
|
60
|
-
}
|
|
61
|
-
e.has("label-width") && (this._state.labelWidth ? this.style.setProperty("--l-form-label-width", this._state.labelWidth) : this.style.removeProperty("--l-form-label-width")), e.has("label-height") && (this._state.labelHeight ? this.style.setProperty("--l-form-label-height", this._state.labelHeight) : this.style.removeProperty("--l-form-label-height"));
|
|
62
|
-
}
|
|
63
|
-
connectedCallback() {
|
|
64
|
-
c(this, "form-context-request", this._provide), super.connectedCallback();
|
|
65
|
-
}
|
|
66
|
-
afterInit() {
|
|
67
|
-
c(this, "form-rule-change", this.ruleChange), c(this, "form-value-change", this._valueChange), c(this, "form-action", this._formAction);
|
|
68
|
-
}
|
|
69
|
-
disconnectedCallback() {
|
|
70
|
-
this.validator = void 0, s(this, "form-rule-change", this.ruleChange), s(this, "form-value-change", this._valueChange), s(this, "form-context-request", this._provide), s(this, "form-action", this._formAction), super.disconnectedCallback();
|
|
71
|
-
}
|
|
72
|
-
render_v2() {
|
|
73
|
-
return {
|
|
74
|
-
style: [u],
|
|
75
|
-
template: this.render()
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
render() {
|
|
79
|
-
let e = o([
|
|
80
|
-
"l-form",
|
|
81
|
-
this._state.inline ? "l-form-inline" : void 0,
|
|
82
|
-
`l-form--${this._state.labelPosition}`
|
|
83
|
-
]);
|
|
84
|
-
return this._state.labelWidth && this.style.setProperty("--l-form-label-width", this._state.labelWidth), `<form class="${e}"><slot></slot></form>`;
|
|
85
|
-
}
|
|
86
|
-
ruleChange = (e) => {
|
|
87
|
-
e.stopPropagation(), this.validator.addSchema(e.detail);
|
|
88
|
-
};
|
|
89
|
-
addSchemas(e) {
|
|
90
|
-
this.validator.addSchemas(e);
|
|
91
|
-
}
|
|
92
|
-
setSchemas(e) {
|
|
93
|
-
this.validator.setSchemas(e);
|
|
94
|
-
}
|
|
95
|
-
setSchema(e) {
|
|
96
|
-
this.validator.setSchema(e);
|
|
97
|
-
}
|
|
98
|
-
addSchema(e) {
|
|
99
|
-
this.validator.addSchema(e);
|
|
100
|
-
}
|
|
101
|
-
_provide(e) {
|
|
102
|
-
let { context: t, callback: n } = e.detail;
|
|
103
|
-
t === "form-context-request" && n(this.context, this.errors, this.resetCtx);
|
|
104
|
-
}
|
|
105
|
-
_formAction = (e) => {
|
|
106
|
-
e.detail === "submit" ? this.submit() : this.reset();
|
|
107
|
-
};
|
|
108
|
-
_valueChange = (e) => {
|
|
109
|
-
let { name: t, value: n, valid: r } = e.detail;
|
|
110
|
-
if (!t) return;
|
|
111
|
-
this._data ??= {};
|
|
112
|
-
let i = Object.hasOwn(this._data, t);
|
|
113
|
-
if (this._data[t] = n, !this._state.novalidate && i && r) try {
|
|
114
|
-
let e = this.errors();
|
|
115
|
-
e[t] = void 0, this.setValidateErrors({ ...e });
|
|
116
|
-
} catch (e) {
|
|
117
|
-
this.setValidateErrors({
|
|
118
|
-
...this.errors(),
|
|
119
|
-
...e.detail
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
setValidateErrors(e, t = !0) {
|
|
124
|
-
this._state.emitError ? this.emit("validate-error", { detail: {
|
|
125
|
-
errors: e,
|
|
126
|
-
all: t
|
|
127
|
-
} }) : this.errors(e);
|
|
128
|
-
}
|
|
129
|
-
async validateField(e) {
|
|
130
|
-
let t = !1, n = {};
|
|
131
|
-
if (this._data != null) {
|
|
132
|
-
if (Array.isArray(e)) for (let r = 0, i = e.length; r < i; r++) {
|
|
133
|
-
let i = e[r];
|
|
134
|
-
try {
|
|
135
|
-
n[i] = void 0;
|
|
136
|
-
} catch (e) {
|
|
137
|
-
n[i] = e.detail, t = !0;
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else try {
|
|
142
|
-
n[e] = void 0;
|
|
143
|
-
} catch (r) {
|
|
144
|
-
n[e] = r.detail, t = !0;
|
|
145
|
-
}
|
|
146
|
-
if (t) {
|
|
147
|
-
let e = /* @__PURE__ */ Error("validate field error");
|
|
148
|
-
return e.detail = n, Promise.reject(e);
|
|
149
|
-
}
|
|
150
|
-
return Promise.resolve();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
clearValidate() {
|
|
154
|
-
this.errors({});
|
|
155
|
-
}
|
|
156
|
-
reset() {
|
|
157
|
-
this.clearValidate();
|
|
158
|
-
let e = this.resetCtx();
|
|
159
|
-
this.resetCtx(e >= 100 ? 1 : e + 1);
|
|
160
|
-
}
|
|
161
|
-
submit() {
|
|
162
|
-
this._state.novalidate ? this.emit("submit", { detail: this.getData() }) : this.validate().then((e) => {
|
|
163
|
-
e.result ? this.emit("submit", { detail: this.getData() }) : this._state.emitError ? this.emit("validate-error", { detail: {
|
|
164
|
-
errors: e.errors,
|
|
165
|
-
all: !0
|
|
166
|
-
} }) : this.errors(e.errors);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
validate() {
|
|
170
|
-
try {
|
|
171
|
-
return this.validator.validate(this._data || {}), Promise.resolve({
|
|
172
|
-
result: !0,
|
|
173
|
-
errors: {}
|
|
174
|
-
});
|
|
175
|
-
} catch (e) {
|
|
176
|
-
return Promise.resolve({
|
|
177
|
-
result: !1,
|
|
178
|
-
errors: e.detail
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
getData() {
|
|
183
|
-
return { ...this._data };
|
|
184
|
-
}
|
|
185
|
-
setErrors(e) {
|
|
186
|
-
this.errors(e);
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
//#endregion
|
|
190
|
-
export { d as t };
|