litos-ui 0.21.0 → 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 +10 -10
- package/lib/{dialog_container_style-C1s0aBf7.js → dialog/dialog_container.css_inline.js} +2 -3
- package/lib/dialog/dialog_container.js +2 -2
- package/lib/dialog/dialog_container_style.js +6 -2
- 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/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 +6 -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 +11 -0
- package/lib/index.js +47 -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 +6 -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 +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/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/styles/dark.css +0 -13
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/tabbar/index.less?inline
|
|
2
|
+
var e = ":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}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/tabbar/item.js
CHANGED
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { parseAttrValue as t } from "../utils/index.js";
|
|
3
|
+
import n from "./item.less_inline.js";
|
|
4
|
+
import { $$ as r, $one as i, addClass as a, removeClass as o } from "utilane/browser";
|
|
5
|
+
//#region src/components/tabbar/item.ts
|
|
6
|
+
var s = class extends e {
|
|
7
|
+
static baseName = "tabbar-item";
|
|
8
|
+
name;
|
|
9
|
+
icon;
|
|
10
|
+
onlyIcon;
|
|
11
|
+
static get observedAttributes() {
|
|
12
|
+
return [
|
|
13
|
+
"name",
|
|
14
|
+
"label",
|
|
15
|
+
"icon",
|
|
16
|
+
"only-icon"
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
connectedCallback() {
|
|
20
|
+
this.loadStyleText(n);
|
|
21
|
+
let e = this.parentElement;
|
|
22
|
+
e.gap && a(this, "l-item--gap"), e.type === "card" && a(this, "l-item--card"), super.connectedCallback();
|
|
23
|
+
}
|
|
24
|
+
attributeChangedCallback(e, n, r) {
|
|
25
|
+
if (e === "icon" || e === "only-icon") {
|
|
26
|
+
let n = t(r, !1, "icon");
|
|
27
|
+
this[e] = n, this.#e();
|
|
28
|
+
} else this[e] = r;
|
|
29
|
+
}
|
|
30
|
+
#e() {
|
|
31
|
+
if (!this.rendered) return;
|
|
32
|
+
let e = i(".icon-wrapper", this.root);
|
|
33
|
+
this.icon ? e ? this.onlyIcon ? a(e, "only") : o(e, "only") : (e = r("div", {
|
|
34
|
+
class: ["icon-wrapper", this.onlyIcon ? "only" : ""],
|
|
35
|
+
innerHTML: "<slot name='icon'></slot>"
|
|
36
|
+
}), this.root.prepend(e)) : e && e.remove();
|
|
37
|
+
let t = i("slot:not([name])", this.root);
|
|
38
|
+
if (this.onlyIcon) t && t.remove();
|
|
39
|
+
else if (!t) {
|
|
40
|
+
let e = r("slot");
|
|
41
|
+
this.root.appendChild(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
let e = document.createDocumentFragment();
|
|
46
|
+
if (this.icon) {
|
|
47
|
+
let t = r("div", {
|
|
48
|
+
class: ["icon-wrapper", this.onlyIcon ? "only" : ""],
|
|
49
|
+
innerHTML: "<slot name='icon'></slot>"
|
|
50
|
+
});
|
|
51
|
+
e.appendChild(t);
|
|
52
|
+
}
|
|
53
|
+
if (!this.onlyIcon) {
|
|
54
|
+
let t = r("slot");
|
|
55
|
+
e.appendChild(t);
|
|
56
|
+
}
|
|
57
|
+
return e;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
//#endregion
|
|
61
|
+
export { s as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/tabbar/item.less?inline
|
|
2
|
+
var e = ":host{color:#666;cursor:pointer;flex-direction:column;flex-grow:var(--l-tabbar-item-grow,0);box-sizing:border-box;justify-content:center;align-items:center;line-height:1;transition:all .3s ease-in-out;display:inline-flex}:host(:hover){color:var(--l-tabbar-hover-color)}:host(.active){color:var(--l-tabbar-active-color)}.icon-wrapper{justify-content:center;align-items:center;margin-bottom:3px;font-size:18px;display:flex}.icon-wrapper.only{margin-bottom:0;font-size:24px}:host(.l-item--card){background:#f5f7fa;border:1px solid #f0f0f0;padding:0 15px}:host(.l-item--card:first-child){border-top-left-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card:last-child){border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-item--card.active){background:#fff}:host(.l-item--gap){border-top-left-radius:var(--l-tabbar-card-border-radius);border-top-right-radius:var(--l-tabbar-card-border-radius)}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/table/index.js
CHANGED
|
@@ -1,2 +1,234 @@
|
|
|
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 { $$ as i, $one as a, formatStyle as o, iterate as s, off as c, on as l, shouldEventNext as u } from "utilane/browser";
|
|
5
|
+
import { random as d } from "utilane";
|
|
6
|
+
//#region src/components/table/index.ts
|
|
7
|
+
var f = class extends e {
|
|
8
|
+
static baseName = "table";
|
|
9
|
+
constructor() {
|
|
10
|
+
super(), this._state = {
|
|
11
|
+
stripe: !0,
|
|
12
|
+
border: !1,
|
|
13
|
+
fixedHead: !1,
|
|
14
|
+
fixedColumn: !1
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
columns = [];
|
|
18
|
+
data = [];
|
|
19
|
+
sortInfo;
|
|
20
|
+
_globalColStyles;
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
this.loadStyleText(r), super.connectedCallback();
|
|
23
|
+
}
|
|
24
|
+
setColumns(e) {
|
|
25
|
+
this.columns = this._parseColumns(e, 0, 0), this.rerender("all");
|
|
26
|
+
}
|
|
27
|
+
setData(e, t) {
|
|
28
|
+
this.data = e, this.sortInfo = t, this.columns && this.columns.length > 0 && this.rerender(t ? "all" : "body");
|
|
29
|
+
}
|
|
30
|
+
changeFixed(e) {
|
|
31
|
+
let t = {
|
|
32
|
+
fixedHead: this._state.fixedHead,
|
|
33
|
+
fixedColumn: this._state.fixedColumn,
|
|
34
|
+
...e
|
|
35
|
+
};
|
|
36
|
+
if (this._state.fixedHead = t.fixedHead, this._state.fixedColumn = t.fixedColumn, this.rendered) {
|
|
37
|
+
let e = a(".l-table", this.root);
|
|
38
|
+
e && (this._state.fixedHead || this._state.fixedColumn ? e.classList.add("l-table-fixed") : e.classList.remove("l-table-fixed"));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
static get observedAttributes() {
|
|
42
|
+
return [
|
|
43
|
+
"stripe",
|
|
44
|
+
"border",
|
|
45
|
+
"fixed-head",
|
|
46
|
+
"max-height",
|
|
47
|
+
"table-layout"
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
attributeChanged(e, r, i) {
|
|
51
|
+
let a = t(e);
|
|
52
|
+
switch (a) {
|
|
53
|
+
case "stripe":
|
|
54
|
+
case "border":
|
|
55
|
+
case "fixedHead":
|
|
56
|
+
case "fixedColumn":
|
|
57
|
+
this._state[a] = n(i, !1, e);
|
|
58
|
+
break;
|
|
59
|
+
case "maxHeight":
|
|
60
|
+
this._state.maxHeight = i || void 0;
|
|
61
|
+
break;
|
|
62
|
+
case "tableLayout": this._state.tableLayout = i || void 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
updateDOM(e) {
|
|
66
|
+
e.has("stripe") && this._classAttrChannge("stripe", this._state.stripe), e.has("border") && this._classAttrChannge("border", this._state.border), e.has("fixedHead") && (this._updateFixedHead(), this.changeFixed()), e.has("maxHeight") && this._changeMaxHeight(), e.has("tableLayout") && this._changeCssVar("layout", this._state.tableLayout);
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
let e = i("table", { class: [
|
|
70
|
+
"l-table",
|
|
71
|
+
this._state.stripe ? "l-table-stripe" : "",
|
|
72
|
+
this._state.border ? "l-table-border" : "",
|
|
73
|
+
this._state.fixedHead || this._state.fixedColumn ? "l-table-fixed" : ""
|
|
74
|
+
] });
|
|
75
|
+
return e.appendChild(this._headRender()), e.appendChild(this._bodyRender()), e;
|
|
76
|
+
}
|
|
77
|
+
rerender(e) {
|
|
78
|
+
if (this.rendered) {
|
|
79
|
+
if (e === "all" || e === "head") {
|
|
80
|
+
let e = a("thead", this.root);
|
|
81
|
+
e && e.replaceWith(this._headRender());
|
|
82
|
+
}
|
|
83
|
+
if (e === "all" || e === "body") {
|
|
84
|
+
let e = a("tbody", this.root);
|
|
85
|
+
e && e.replaceWith(this._bodyRender());
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
_changeCssVar(e, t) {
|
|
90
|
+
if (!this.rendered) return;
|
|
91
|
+
let n = `--l-table-${e}`;
|
|
92
|
+
t ? this.style.setProperty(n, t) : this.style.removeProperty(n);
|
|
93
|
+
}
|
|
94
|
+
_changeMaxHeight() {
|
|
95
|
+
let e = this._state.maxHeight;
|
|
96
|
+
e && typeof e == "number" && (e = `${e}px`), this._changeCssVar("max-height", e);
|
|
97
|
+
}
|
|
98
|
+
_classAttrChannge(e, t) {
|
|
99
|
+
if (this.rendered) {
|
|
100
|
+
let n = a("table", this.root);
|
|
101
|
+
n && n.classList.toggle(`l-table-${e}`, t);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
_updateFixedHead() {
|
|
105
|
+
if (this.rendered) {
|
|
106
|
+
let e = a("thead", this.root);
|
|
107
|
+
e && (e.classList.toggle("l-fixed", this._state.fixedHead), e.style.top = this._state.fixedHead ? "0" : "");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
_headRender() {
|
|
111
|
+
let e = i("thead", {
|
|
112
|
+
class: { "l-fixed": this._state.fixedHead },
|
|
113
|
+
style: { top: this._state.fixedHead ? "0" : void 0 }
|
|
114
|
+
});
|
|
115
|
+
return this.columns && this._rendHeadRow(e, this.columns), e;
|
|
116
|
+
}
|
|
117
|
+
_rendHeadRow(e, t) {
|
|
118
|
+
let n = i("tr");
|
|
119
|
+
for (let r = 0, i = t.length; r < i; r++) {
|
|
120
|
+
let i = t[r];
|
|
121
|
+
n.appendChild(this._headColRender(i, r)), i.children && this._rendHeadRow(e, i.children);
|
|
122
|
+
}
|
|
123
|
+
e.appendChild(n);
|
|
124
|
+
}
|
|
125
|
+
_headColRender(e, t) {
|
|
126
|
+
let n = i("th");
|
|
127
|
+
if (e.titleColspan && e.titleColspan > 1 && (n.colSpan = e.titleColspan), e.titleRowspan && e.titleRowspan > 1 && (n.rowSpan = e.titleRowspan), n.style.cssText = this._getColumnStyle(e, "th"), e.fixed && n.classList.add("l-fixed"), n.appendChild(i("span", { textContent: e.title })), e.sorter) {
|
|
128
|
+
let e = i("span", { class: "caret-wrapper" });
|
|
129
|
+
e.appendChild(i("span", { class: "sort-caret ascending" })), e.appendChild(i("span", { class: "sort-caret descending" })), n.classList.add("sort-column"), n.setAttribute("data-action", "sort"), n.setAttribute("data-col", `${t}`), n.appendChild(e);
|
|
130
|
+
}
|
|
131
|
+
return this.sortInfo && this.sortInfo.key === e.key && n.classList.add(this.sortInfo.order === "asc" ? "sort-asc" : "sort-desc"), n;
|
|
132
|
+
}
|
|
133
|
+
_bodyRender() {
|
|
134
|
+
let e = i("tbody");
|
|
135
|
+
if (this.data && this.data.length > 0) for (let t = 0, n = this.data.length; t < n; t++) {
|
|
136
|
+
let n = this.data[t];
|
|
137
|
+
if (this.columns) {
|
|
138
|
+
let r = i("tr");
|
|
139
|
+
this._bodyRowRender(this.columns, t, n, r), e.appendChild(r);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
let t = i("tr"), n = i("td", {
|
|
144
|
+
class: "l-table__empty-col",
|
|
145
|
+
textContent: "暂无数据"
|
|
146
|
+
});
|
|
147
|
+
this.columns && (n.colSpan = this.columns.length), t.appendChild(n), e.appendChild(t);
|
|
148
|
+
}
|
|
149
|
+
return e;
|
|
150
|
+
}
|
|
151
|
+
_bodyRowRender(e, t, n, r) {
|
|
152
|
+
for (let a = 0, o = e.length; a < o; a++) {
|
|
153
|
+
let o = e[a];
|
|
154
|
+
if (o.children && o.children.length > 0) this._bodyRowRender(o.children, t, n, r);
|
|
155
|
+
else {
|
|
156
|
+
let e = i("td");
|
|
157
|
+
if (typeof o.rowspan == "number" && (e.rowSpan = o.rowspan), typeof o.rowspan == "function" && (e.rowSpan = o.rowspan(n, t)), typeof o.colspan == "number" && (e.colSpan = o.colspan), typeof o.colspan == "function" && (e.colSpan = o.colspan(n, t)), o.fixed && (e.className = "l-fixed"), e.style.cssText = this._getColumnStyle(o), o.render) {
|
|
158
|
+
let r = o.render(n, t);
|
|
159
|
+
typeof r == "string" ? e.innerHTML = r : Array.isArray(r) ? s(r, (t) => {
|
|
160
|
+
e.appendChild(t);
|
|
161
|
+
}) : e.appendChild(r);
|
|
162
|
+
} else e.textContent = o.key ? n[o.key] : "";
|
|
163
|
+
r.appendChild(e);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
_parseColumns(e, t, n) {
|
|
168
|
+
let r = [];
|
|
169
|
+
for (let i = 0, a = e.length; i < a; i++) {
|
|
170
|
+
let a = e[i];
|
|
171
|
+
if (a.id ||= a.key || a.title, a.id ||= `${i}_${d(6)}`, a.fixed) {
|
|
172
|
+
let e = Number.parseFloat(`${a.width || 0}`);
|
|
173
|
+
a.fixed === "left" ? (a.left = t, t += e) : a.fixed === "right" && (a.right = n, n += e);
|
|
174
|
+
}
|
|
175
|
+
if (a.children) {
|
|
176
|
+
let e = this._parseColumns(a.children, t, n);
|
|
177
|
+
a.titleRowspan = a.titleRowspan || 1, a.titleColspan ||= e.reduce((e, t) => e + (t.titleColspan || 1), 0), r.push({
|
|
178
|
+
...a,
|
|
179
|
+
children: e
|
|
180
|
+
});
|
|
181
|
+
} else a.titleRowspan = a.titleRowspan || this._getMaxDepth(e), a.titleColspan = a.titleColspan || 1, r.push({ ...a });
|
|
182
|
+
}
|
|
183
|
+
return r;
|
|
184
|
+
}
|
|
185
|
+
_getMaxDepth(e) {
|
|
186
|
+
let t = 1;
|
|
187
|
+
for (let n of e) n.children && (t = Math.max(t, this._getMaxDepth(n.children) + 1));
|
|
188
|
+
return t;
|
|
189
|
+
}
|
|
190
|
+
_getColumnStyle(e, t = "td") {
|
|
191
|
+
let n = e.id;
|
|
192
|
+
if (this._globalColStyles && n in this._globalColStyles) return this._globalColStyles[n][t];
|
|
193
|
+
let r = {};
|
|
194
|
+
e.width && (r.width = typeof e.width == "number" ? `${e.width}px` : e.width), e.fixed && (e.fixed === "left" ? (r.left = `${e.left}px`, r["box-shadow"] = "-4px 0 4px -4px #d9d9d9 inset") : e.fixed === "right" && (r.right = `${e.right}px`, r["box-shadow"] = "4px 0 4px -4px #d9d9d9 inset")), this._globalColStyles ||= {};
|
|
195
|
+
let i = o(r), a = {
|
|
196
|
+
th: i,
|
|
197
|
+
td: i + o(e.style || "")
|
|
198
|
+
};
|
|
199
|
+
return this._globalColStyles[n] = a, a[t];
|
|
200
|
+
}
|
|
201
|
+
_handleTap = (e) => {
|
|
202
|
+
let [t, n, r] = u(e, "data-action", e.currentTarget);
|
|
203
|
+
if (t) {
|
|
204
|
+
let e = r.dataset;
|
|
205
|
+
if (n === "sort") {
|
|
206
|
+
let t = parseInt(e.col), n = this.columns[t], r = this.sortInfo && this.sortInfo.order === "desc" ? "asc" : "desc";
|
|
207
|
+
this.sortInfo = {
|
|
208
|
+
key: n.key,
|
|
209
|
+
order: r
|
|
210
|
+
}, n.sorter === "custom" ? this.emit("sort", { detail: {
|
|
211
|
+
index: t,
|
|
212
|
+
key: n.key,
|
|
213
|
+
dir: r
|
|
214
|
+
} }) : (this.data = this._dataSort(), this.rerender("all"));
|
|
215
|
+
} else this.emit(n, { detail: e });
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
afterInit() {
|
|
219
|
+
this._changeMaxHeight(), l(this.root, "click", this._handleTap);
|
|
220
|
+
}
|
|
221
|
+
beforeDestroy() {
|
|
222
|
+
c(this.root, "click", this._handleTap);
|
|
223
|
+
}
|
|
224
|
+
_dataSort() {
|
|
225
|
+
if (!this.sortInfo || !this.data) return;
|
|
226
|
+
let { key: e, order: t } = this.sortInfo;
|
|
227
|
+
return this.data.sort((n, r) => {
|
|
228
|
+
let i = n[e], a = r[e];
|
|
229
|
+
return t === "asc" ? i - a : a - i;
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
//#endregion
|
|
234
|
+
export { f as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/table/index.less?inline
|
|
2
|
+
var e = ":host{width:100%;max-height:var(--l-table-max-height,100%);font-size:var(--l-table-font-size,14px);display:inline-block;overflow:auto}.l-table{border-collapse:collapse;border-spacing:0;table-layout:var(--l-table-layout,auto);width:100%}.l-table th,.l-table td{border-bottom:1px solid var(--l-table-border-color,#e6e6e6)}.l-table th{padding:var(--l-table-th-padding,10px);text-align:left;background-color:var(--l-table-th-bg,#f2f2f2);color:var(--l-table-th-color,#000)}.l-table td{background-color:var(--l-table-td-bg,#fff);color:var(--l-table-td-color,#000);padding:var(--l-table-td-padding,10px);transition:background-color .3s}.l-table tr:hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table .l-table__empty-col{color:var(--l-table-empty-color,#999);text-align:center}.l-table-stripe tr:nth-child(2n) td{background-color:var(--l-table-stripe-bg,#fafafa)}.l-table-stripe tr:nth-child(2n):hover td{background-color:var(--l-table-row-hover-bg,#f2f2f2)}.l-table-border th,.l-table-border td{border:1px solid var(--l-table-border-color,#e6e6e6)}.l-table-fixed{--l-table-layout:fixed}.l-table-fixed .l-fixed{z-index:1;box-sizing:border-box;position:-webkit-sticky;position:sticky}.l-table-fixed thead.l-fixed,.l-table-fixed tfoot.l-fixed{z-index:2}.l-table .caret-wrapper{vertical-align:middle;justify-content:center;align-items:center;width:20px;height:14px;display:inline-flex;position:relative}.l-table .caret-wrapper .ascending{border-bottom-color:var(--l-table-sort-inactive-color,#c0c4cc);top:-5px}.l-table .caret-wrapper .descending{border-top-color:var(--l-table-sort-inactive-color,#c0c4cc);bottom:-3px}.l-table .sort-caret{border:5px solid #0000;border-radius:3px;width:0;height:0;display:inline-block;position:absolute}.l-table .sort-column{cursor:pointer}.l-table .sort-asc .ascending{border-bottom-color:var(--l-primary-color,#52c41a)}.l-table .sort-desc .descending{border-top-color:var(--l-primary-color,#52c41a)}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/tabs/index.js
CHANGED
package/lib/tag/index.js
CHANGED
|
@@ -1,2 +1,75 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { parseAttrValue as t } from "../utils/index.js";
|
|
3
|
+
import n from "./index.less_inline.js";
|
|
4
|
+
import { $$ as r, $one as i, off as a, on as o, shouldEventNext as s } from "utilane/browser";
|
|
5
|
+
import { adjust as c, isBlank as l } from "utilane";
|
|
6
|
+
//#region src/components/tag/index.ts
|
|
7
|
+
var u = class extends e {
|
|
8
|
+
static baseName = "tag";
|
|
9
|
+
connectedCallback() {
|
|
10
|
+
this.loadStyleText(n), super.connectedCallback();
|
|
11
|
+
}
|
|
12
|
+
static get observedAttributes() {
|
|
13
|
+
return [
|
|
14
|
+
"type",
|
|
15
|
+
"color",
|
|
16
|
+
"closeable"
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
attributeChangedCallback(e, n, r) {
|
|
20
|
+
let a = r.trim();
|
|
21
|
+
switch (e) {
|
|
22
|
+
case "type":
|
|
23
|
+
this._toggleTypeClass(a);
|
|
24
|
+
break;
|
|
25
|
+
case "color":
|
|
26
|
+
this._toggleColorStyle(a);
|
|
27
|
+
break;
|
|
28
|
+
case "closable":
|
|
29
|
+
if (!this.rendered) return;
|
|
30
|
+
let e = t(a, !1, "closeable"), n = i(".l-tag-close", this.root);
|
|
31
|
+
if (n) {
|
|
32
|
+
if (e) return;
|
|
33
|
+
n.remove();
|
|
34
|
+
} else e && this.root.appendChild(this.#e());
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
let e = document.createDocumentFragment();
|
|
39
|
+
return e.appendChild(r("div", {
|
|
40
|
+
class: "l-tag-content",
|
|
41
|
+
innerHTML: "<slot></slot>"
|
|
42
|
+
})), this.getAttr("closeable", !1) && e.appendChild(this.#e()), e.appendChild(r("slot", { name: "suffix" })), e;
|
|
43
|
+
}
|
|
44
|
+
#e() {
|
|
45
|
+
return r("div", {
|
|
46
|
+
class: "l-tag-close",
|
|
47
|
+
innerHTML: "<l-close-icon></l-close-icon>",
|
|
48
|
+
"data-action": "close"
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
#t = (e) => {
|
|
52
|
+
let [t, n, r] = s(e, "data-action", this);
|
|
53
|
+
t && n === "close" && this.emit("close", { detail: { ...r.dataset } });
|
|
54
|
+
};
|
|
55
|
+
afterInit() {
|
|
56
|
+
this.classList.add(`l-tag--${this.getAttr("type", "info")}`), this._toggleColorStyle(), o(this.root, "click", this.#t);
|
|
57
|
+
}
|
|
58
|
+
_toggleTypeClass(e) {
|
|
59
|
+
if (!this.rendered) return;
|
|
60
|
+
let t = !1;
|
|
61
|
+
for (let n of this.classList) if (n.startsWith("l-tag--")) {
|
|
62
|
+
this.classList.replace(n, `l-tag--${e}`), t = !0;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
t || this.classList.add(`l-tag--${e}`);
|
|
66
|
+
}
|
|
67
|
+
_toggleColorStyle(e) {
|
|
68
|
+
this.rendered && (l(e) ? (this.style.removeProperty("--l-tag-color"), this.style.removeProperty("--l-tag-border-color"), this.style.removeProperty("--l-tag-background")) : (this.style.setProperty("--l-tag-color", e), this.style.setProperty("--l-tag-border-color", e), this.style.setProperty("--l-tag-background", c(e, 5, !0))));
|
|
69
|
+
}
|
|
70
|
+
beforeDestroy() {
|
|
71
|
+
a(this.root, "click", this.#t);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { u as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/tag/index.less?inline
|
|
2
|
+
var e = ":host{box-sizing:border-box;vertical-align:middle;height:var(--l-tag-height,22px);border:1px solid var(--l-tag-border-color,var(--l-border-color,#dedede));background:var(--l-tag-background,#fff);white-space:nowrap;color:var(--l-tag-color,#333);border-radius:4px;justify-content:center;align-items:center;padding:0 5px;font-size:12px;line-height:1;display:inline-flex}:host(.l-tag--primary){--l-tag-border-color:var(--l-primary-color-light3,#d3adf7);--l-tag-background:var(--l-primary-color-light5,#f9f0ff);--l-tag-color:var(--l-primary-color-light3,#d3adf7)}:host(.l-tag--error){--l-tag-color:var(--l-error-color,#ed3f13);--l-tag-background:var(--l-error-color-light5,#fff1f0);--l-tag-border-color:var(--l-error-color,#ed3f13)}:host(.l-tag--success){--l-tag-color:var(--l-success-color,#a0d911);--l-tag-background:var(--l-success-color-light5,#fcffe6);--l-tag-border-color:var(--l-success-color,#a0d911)}:host(.l-tag--info){--l-tag-color:var(--l-text-color,#999);--l-tag-background:var(--l-text-secondary-color,#f5f5f5);--l-tag-border-color:var(--l-border-color,#dedede)}:host(.l-tag--warning){--l-tag-color:var(--l-warning-color,#f90);--l-tag-background:var(--l-warning-color-light5,#fff5e6);--l-tag-border-color:var(--l-warning-color,#f90)}.l-tag-close{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-tag-close:hover{background-color:var(--l-tag-color,#1890ff);color:#fff}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/theme/index.js
CHANGED
|
@@ -1,2 +1,86 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { initAttr as t } from "../utils/index.js";
|
|
3
|
+
import n from "./index.less_inline.js";
|
|
4
|
+
import { $one as r, applyTheme as i, create as a, getTheme as o, off as s, on as c } from "utilane/browser";
|
|
5
|
+
//#region src/components/theme/index.ts
|
|
6
|
+
var l = [
|
|
7
|
+
{
|
|
8
|
+
value: "auto",
|
|
9
|
+
text: "跟随系统",
|
|
10
|
+
icon: "l-theme-default-icon"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "light",
|
|
14
|
+
text: "浅色模式",
|
|
15
|
+
icon: "l-sun-icon"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "dark",
|
|
19
|
+
text: "深色模式",
|
|
20
|
+
icon: "l-moon-icon"
|
|
21
|
+
}
|
|
22
|
+
], u = class extends e {
|
|
23
|
+
static baseName = "theme";
|
|
24
|
+
type = "button";
|
|
25
|
+
label = "text";
|
|
26
|
+
theme;
|
|
27
|
+
#e;
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
t(this), this.theme = o(), this.loadStyleText(n), super.connectedCallback(), this.#s();
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
super.disconnectedCallback(), this.#c();
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
switch (this.type) {
|
|
36
|
+
case "select": return this.#r();
|
|
37
|
+
case "radio": return this.#a();
|
|
38
|
+
case "switch": return this.#i();
|
|
39
|
+
default: return this.#t();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
#t() {
|
|
43
|
+
let e = a("l-button", { class: "l-theme-btn l-theme-inner" });
|
|
44
|
+
return this.#n(e), e;
|
|
45
|
+
}
|
|
46
|
+
#n(e) {
|
|
47
|
+
let t = this.theme === "auto" ? "sun" : "moon";
|
|
48
|
+
e.innerHTML = `<l-${t}-icon></l-${t}-icon>`;
|
|
49
|
+
}
|
|
50
|
+
#r() {
|
|
51
|
+
let e = a("l-select-ori", { class: "l-theme-inner" });
|
|
52
|
+
return e.value = this.theme, e.innerHTML = [
|
|
53
|
+
"<option value=\"auto\">跟随系统</option>",
|
|
54
|
+
"<option value=\"light\">浅色模式</option>",
|
|
55
|
+
"<option value=\"dark\">深色模式</option>"
|
|
56
|
+
].join(""), e;
|
|
57
|
+
}
|
|
58
|
+
#i() {
|
|
59
|
+
let e = a("l-switch", { class: "l-theme-switch l-theme-inner" });
|
|
60
|
+
return e.value = this.theme === "dark", e.innerHTML = "<l-sun-icon slot=\"unchecked-action\"></l-sun-icon><l-moon-icon slot=\"checked-action\"></l-moon-icon>", e;
|
|
61
|
+
}
|
|
62
|
+
#a() {
|
|
63
|
+
let e = a("l-radio-group", { class: "l-theme-inner" });
|
|
64
|
+
return e.value = this.theme, e.innerHTML = l.map((e) => {
|
|
65
|
+
let t = "";
|
|
66
|
+
return t = this.label === "icon" ? `<${e.icon}></${e.icon}>` : e.text, `<l-radio value="${e.value}" button>${t}</l-radio>`;
|
|
67
|
+
}).join(""), e;
|
|
68
|
+
}
|
|
69
|
+
#o = async (e) => {
|
|
70
|
+
let t;
|
|
71
|
+
if (this.type === "button") t = this.theme === "dark" ? "auto" : "dark";
|
|
72
|
+
else {
|
|
73
|
+
let n = e.target.value;
|
|
74
|
+
t = this.type === "switch" ? n ? "dark" : "light" : n;
|
|
75
|
+
}
|
|
76
|
+
await i(t), this.theme = t, this.type === "button" && this.#n(this.#e), this.emit("change", { detail: t });
|
|
77
|
+
};
|
|
78
|
+
#s() {
|
|
79
|
+
this.#e = r(".l-theme-inner", this.root), this.type === "button" ? c(this.#e, "click", this.#o) : c(this.#e, "change", this.#o);
|
|
80
|
+
}
|
|
81
|
+
#c() {
|
|
82
|
+
this.#e &&= (this.type === "button" ? s(this.#e, "click", this.#o) : s(this.#e, "change", this.#o), void 0);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { u as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/theme/index.less?inline
|
|
2
|
+
var e = ":host{box-sizing:border-box;width:auto;display:inline-flex}.l-theme-btn::part(default){--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-text-color:#9ca3af;--l-btn-hover-text-color:#666;width:var(--l-form-control-height,32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){color:#fff;background-color:#000}html.dark .l-theme-btn{--l-btn-hover-text-color:#fff}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/theme/theme_color.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "../base.js";
|
|
2
|
-
import { $one as t, applyColorTheme as n, getColorTheme as r, on as i } from "
|
|
2
|
+
import { $one as t, applyColorTheme as n, getColorTheme as r, on as i } from "utilane/browser";
|
|
3
3
|
//#region src/components/theme/theme_color.ts
|
|
4
4
|
var a = class extends e {
|
|
5
5
|
static baseName = "theme-color";
|