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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通知方位与布局管理
|
|
3
|
+
*
|
|
4
|
+
* 同一个方位上的通知不会相互叠加: 每个通知都是 `position: fixed`,
|
|
5
|
+
* 由这里统一计算它们在所在方位上的位置, 新增/移除时重新排布,
|
|
6
|
+
* 位置变化通过 CSS 过渡形成平滑的位移动画。
|
|
7
|
+
*
|
|
8
|
+
* 通知节点不会被移动到其他位置, 因此声明式使用时依然由使用方管理其生命周期。
|
|
9
|
+
*/
|
|
10
|
+
/** 通知显示方位 */
|
|
11
|
+
export type NotificationPlacement = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
|
|
12
|
+
export declare const PLACEMENTS: NotificationPlacement[];
|
|
13
|
+
/** 默认显示方位 */
|
|
14
|
+
export declare const DEFAULT_PLACEMENT: NotificationPlacement;
|
|
15
|
+
/** 默认距离视口边缘的距离(px) */
|
|
16
|
+
export declare const DEFAULT_OFFSET = 16;
|
|
17
|
+
/** 默认层级 */
|
|
18
|
+
export declare const DEFAULT_ZINDEX = 2000;
|
|
19
|
+
/** 默认通知之间的间距(px) */
|
|
20
|
+
export declare const DEFAULT_GAP = 16;
|
|
21
|
+
/** 参与布局的通知需要提供的信息 */
|
|
22
|
+
export interface NotificationLayoutItem extends HTMLElement {
|
|
23
|
+
/** 距离视口边缘的距离(px) */
|
|
24
|
+
readonly notificationOffset: number;
|
|
25
|
+
/** 与相邻通知的间距(px) */
|
|
26
|
+
readonly notificationGap: number;
|
|
27
|
+
}
|
|
28
|
+
/** 是否为顶部方位 */
|
|
29
|
+
export declare function isTopPlacement(placement: string): boolean;
|
|
30
|
+
/** 是否为左侧方位 */
|
|
31
|
+
export declare function isLeftPlacement(placement: string): boolean;
|
|
32
|
+
/** 规范化方位, 非法值回退为 `topRight` */
|
|
33
|
+
export declare function normalizePlacement(placement?: string | null): NotificationPlacement;
|
|
34
|
+
/** 查询通知所在的方位 */
|
|
35
|
+
export declare function findPlacement($el: HTMLElement): NotificationPlacement | undefined;
|
|
36
|
+
/** 某个方位上正在显示的通知数量 */
|
|
37
|
+
export declare function getGroupSize(placement: NotificationPlacement): number;
|
|
38
|
+
/** 某个方位上最早创建的通知 */
|
|
39
|
+
export declare function getOldestNotification(placement: NotificationPlacement): NotificationLayoutItem | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* 注册到方位分组并重新排布
|
|
42
|
+
*
|
|
43
|
+
* 最新创建的通知显示在最下方。顶部方位向下追加,底部方位将已有通知向上移动。
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerNotification($el: NotificationLayoutItem, placement: NotificationPlacement): void;
|
|
46
|
+
/** 从方位分组中移除并重新排布 */
|
|
47
|
+
export declare function unregisterNotification($el: NotificationLayoutItem): void;
|
|
48
|
+
/** 重新计算某个方位上所有通知的位置 */
|
|
49
|
+
export declare function layoutGroup(placement: NotificationPlacement): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
//#region src/components/notification/placement.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"topLeft",
|
|
4
|
+
"topRight",
|
|
5
|
+
"bottomLeft",
|
|
6
|
+
"bottomRight"
|
|
7
|
+
], t = "topRight", n = 16, r = 2e3, i = 16, a = /* @__PURE__ */ new Map();
|
|
8
|
+
function o(e) {
|
|
9
|
+
return e === "topLeft" || e === "topRight";
|
|
10
|
+
}
|
|
11
|
+
function s(e) {
|
|
12
|
+
return e === "topLeft" || e === "bottomLeft";
|
|
13
|
+
}
|
|
14
|
+
function c(n) {
|
|
15
|
+
return e.includes(n) ? n : t;
|
|
16
|
+
}
|
|
17
|
+
function l(e) {
|
|
18
|
+
for (let [t, n] of a) if (n.includes(e)) return t;
|
|
19
|
+
}
|
|
20
|
+
function u(e) {
|
|
21
|
+
return a.get(e)?.length ?? 0;
|
|
22
|
+
}
|
|
23
|
+
function d(e) {
|
|
24
|
+
let t = a.get(e);
|
|
25
|
+
return t && t.length > 0 ? t[0] : void 0;
|
|
26
|
+
}
|
|
27
|
+
function f(e, t) {
|
|
28
|
+
p(e);
|
|
29
|
+
let n = a.get(t);
|
|
30
|
+
n || (n = [], a.set(t, n)), n.push(e), m(t);
|
|
31
|
+
}
|
|
32
|
+
function p(e) {
|
|
33
|
+
for (let [t, n] of a) {
|
|
34
|
+
let r = n.indexOf(e);
|
|
35
|
+
if (r > -1) {
|
|
36
|
+
n.splice(r, 1), m(t);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function m(e) {
|
|
42
|
+
let t = a.get(e);
|
|
43
|
+
if (!t) return;
|
|
44
|
+
let n = o(e), r = n ? "top" : "bottom", i = n ? "bottom" : "top", s = 0;
|
|
45
|
+
for (let e of n ? t : [...t].reverse()) e.style.setProperty(r, `${e.notificationOffset + s}px`), e.style.removeProperty(i), s += e.offsetHeight + e.notificationGap;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { i as DEFAULT_GAP, n as DEFAULT_OFFSET, t as DEFAULT_PLACEMENT, r as DEFAULT_ZINDEX, e as PLACEMENTS, l as findPlacement, u as getGroupSize, d as getOldestNotification, s as isLeftPlacement, o as isTopPlacement, m as layoutGroup, c as normalizePlacement, f as registerNotification, p as unregisterNotification };
|
package/lib/page_header/index.js
CHANGED
|
@@ -1,2 +1,100 @@
|
|
|
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, off as a, on as o, shouldEventNext as s } from "utilane/browser";
|
|
5
|
+
import { isBlank as c } from "utilane";
|
|
6
|
+
//#region src/components/page_header/index.ts
|
|
7
|
+
var l = class extends e {
|
|
8
|
+
static baseName = "page-header";
|
|
9
|
+
showLeft = !0;
|
|
10
|
+
showBack = !0;
|
|
11
|
+
backText = "返回";
|
|
12
|
+
pageTitle;
|
|
13
|
+
pageSubTitle;
|
|
14
|
+
align = "left";
|
|
15
|
+
showRight = !0;
|
|
16
|
+
border = !1;
|
|
17
|
+
height;
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
this.loadStyleText(r), this.classList.add(`l-page-header-align-${this.align}`), super.connectedCallback();
|
|
20
|
+
}
|
|
21
|
+
static get observedAttributes() {
|
|
22
|
+
return [
|
|
23
|
+
"show-left",
|
|
24
|
+
"show-back",
|
|
25
|
+
"back-text",
|
|
26
|
+
"page-title",
|
|
27
|
+
"page-sub-title",
|
|
28
|
+
"align",
|
|
29
|
+
"show-right",
|
|
30
|
+
"border",
|
|
31
|
+
"height"
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
attributeChangedCallback(e, r, i) {
|
|
35
|
+
e = t(e);
|
|
36
|
+
let a = n(i, this[e], e);
|
|
37
|
+
switch (a !== this[e] && (this[e] = a), e) {
|
|
38
|
+
case "border":
|
|
39
|
+
a ? this.classList.add("l-page-header-border") : this.classList.remove("l-page-header-border");
|
|
40
|
+
break;
|
|
41
|
+
case "height": a && this.style.setProperty("--l-page-header-height", a);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
let e = document.createDocumentFragment();
|
|
46
|
+
if (this.showLeft) {
|
|
47
|
+
let t = i("div", { class: "l-page-header-left" });
|
|
48
|
+
if (this.showBack) {
|
|
49
|
+
let e = i("l-button", {
|
|
50
|
+
text: !0,
|
|
51
|
+
class: "l-page-header-back",
|
|
52
|
+
"l-action": "back",
|
|
53
|
+
innerHTML: `<l-arrow-left-icon></l-arrow-left-icon><span>${this.backText}</span>`
|
|
54
|
+
});
|
|
55
|
+
t.appendChild(e);
|
|
56
|
+
}
|
|
57
|
+
let n = i("slot", { name: "left" });
|
|
58
|
+
t.appendChild(n), e.appendChild(t);
|
|
59
|
+
}
|
|
60
|
+
let t = i("div", { class: "l-page-header-content" });
|
|
61
|
+
if (!c(this.pageTitle)) {
|
|
62
|
+
let e = i("div", {
|
|
63
|
+
class: "l-page-header-title",
|
|
64
|
+
innerHTML: this.pageTitle
|
|
65
|
+
});
|
|
66
|
+
t.appendChild(e);
|
|
67
|
+
}
|
|
68
|
+
if (!c(this.pageSubTitle)) {
|
|
69
|
+
let e = i("div", {
|
|
70
|
+
class: "l-page-header-sub-title",
|
|
71
|
+
innerHTML: this.pageSubTitle
|
|
72
|
+
});
|
|
73
|
+
t.appendChild(e);
|
|
74
|
+
}
|
|
75
|
+
let n = i("slot");
|
|
76
|
+
if (t.appendChild(n), e.appendChild(t), this.showRight) {
|
|
77
|
+
let t = i("div", { class: "l-page-header-right" }), n = i("slot", { name: "right" });
|
|
78
|
+
t.appendChild(n), e.appendChild(t);
|
|
79
|
+
}
|
|
80
|
+
return e;
|
|
81
|
+
}
|
|
82
|
+
#e = (e) => {
|
|
83
|
+
let [t, n, r] = s(e, "l-action", this.root);
|
|
84
|
+
if (t) {
|
|
85
|
+
let e = r.dataset;
|
|
86
|
+
this.emit("action", { detail: {
|
|
87
|
+
action: n,
|
|
88
|
+
...e
|
|
89
|
+
} });
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
afterInit() {
|
|
93
|
+
o(this.root, "click", this.#e);
|
|
94
|
+
}
|
|
95
|
+
beforeDestroy() {
|
|
96
|
+
a(this.root, "click", this.#e);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
export { l as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/page_header/index.less?inline
|
|
2
|
+
var e = ":host{box-sizing:border-box;height:var(--l-page-header-height,auto);align-items:center;display:flex;position:relative}.l-page-header-left,.l-page-header-right{z-index:1;flex:none;align-items:center;display:flex}.l-page-header-back{height:auto}.l-page-header-back::part(default){--l-btn-padding:5px 0}.l-page-header-content{align-items:center;line-height:1;display:flex}.l-page-header-title{font-size:16px;font-weight:600}.l-page-header-sub-title{color:#999;margin-left:10px;font-size:14px;font-weight:500}:host(.l-page-header-align-left) .l-page-header-left{margin-right:15px}:host(.l-page-header-align-left) .l-page-header-content{flex:1 0 auto}:host(.l-page-header-align-left) .l-page-header-right{margin-left:15px}:host(.l-page-header-align-center){justify-content:space-between}:host(.l-page-header-align-center) .l-page-header-content{justify-content:center;position:absolute;inset:0}:host(.l-page-header-align-center) .l-page-header-back::part(default){--l-btn-padding:8px 0;--l-btn-gap:0}:host(.l-page-header-border){border-bottom:1px solid var(--l-border-color,#dedede)}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/pagination/index.js
CHANGED
|
@@ -1,2 +1,214 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import { kebabToCamel as t, parseAttrValue as n, tagAttr as r } from "../utils/index.js";
|
|
3
|
+
import i from "./index.less_inline.js";
|
|
4
|
+
import { $one as a, clsx as o, off as s, on as c, shouldEventNext as l } from "utilane/browser";
|
|
5
|
+
//#region src/components/pagination/index.ts
|
|
6
|
+
var u = class extends e {
|
|
7
|
+
static baseName = "pagination";
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this.version = 2, this._state = {
|
|
10
|
+
total: 0,
|
|
11
|
+
pageCount: 0,
|
|
12
|
+
pageSize: 10,
|
|
13
|
+
align: "start",
|
|
14
|
+
simple: !1,
|
|
15
|
+
hideOnSinglePage: !1,
|
|
16
|
+
currentPage: 1
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
static get observedAttributes() {
|
|
20
|
+
return [
|
|
21
|
+
"align",
|
|
22
|
+
"current-page",
|
|
23
|
+
"page-count",
|
|
24
|
+
"total",
|
|
25
|
+
"hide-on-single-page",
|
|
26
|
+
"simple",
|
|
27
|
+
"page-size"
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
attributeChanged(e, r, i) {
|
|
31
|
+
switch (e) {
|
|
32
|
+
case "align":
|
|
33
|
+
this._state.align = i || "start";
|
|
34
|
+
break;
|
|
35
|
+
case "total":
|
|
36
|
+
case "page-count":
|
|
37
|
+
case "page-size":
|
|
38
|
+
case "current-page":
|
|
39
|
+
let r = n(i, this._state[e]);
|
|
40
|
+
this._state[t(e)] = r, (e === "total" || e === "page-count") && (this._state.pageCount = this.#t());
|
|
41
|
+
break;
|
|
42
|
+
case "simple":
|
|
43
|
+
case "hide-on-single-page": this._state[t(e)] = n(i, !1, e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
updateDOM(e) {
|
|
47
|
+
if (e.has("align")) {
|
|
48
|
+
let e = this._state.align === "center" ? this._state.align : `flex-${this._state.align}`;
|
|
49
|
+
this.style.setProperty("--l-pagination-justify-content", e);
|
|
50
|
+
} else this.rerender(), e.clear();
|
|
51
|
+
}
|
|
52
|
+
rerender() {
|
|
53
|
+
let e = a(".l-pagination", this.root);
|
|
54
|
+
e && (this.#i(), e.innerHTML = this.#n(), this.#r());
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
return `<div class="l-pagination">${this.#n()}</div>`;
|
|
58
|
+
}
|
|
59
|
+
render_v2() {
|
|
60
|
+
return {
|
|
61
|
+
template: this.render(),
|
|
62
|
+
style: i
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
afterInit() {
|
|
66
|
+
c(this.root, "click", this.#e), this.#r();
|
|
67
|
+
}
|
|
68
|
+
beforeDestroy() {
|
|
69
|
+
s(this.root, "click", this.#e), this.#i();
|
|
70
|
+
}
|
|
71
|
+
#e = (e) => {
|
|
72
|
+
let [t, n] = l(e, "data-page", this.root);
|
|
73
|
+
if (t) {
|
|
74
|
+
let e = Number(n);
|
|
75
|
+
e = Math.min(this._state.pageCount, Math.max(1, e)), e !== this._state.currentPage && (this._state.currentPage = e, this.rerender(), this.emit("change", { detail: {
|
|
76
|
+
current: e,
|
|
77
|
+
pageSize: this._state.pageSize || 10,
|
|
78
|
+
totalPage: this._state.pageCount
|
|
79
|
+
} }));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
#t() {
|
|
83
|
+
let e = this._state.pageCount, t = this._state.total;
|
|
84
|
+
return e === 0 && t > 0 && (e = Math.ceil(t / (this._state.pageSize || 10))), e;
|
|
85
|
+
}
|
|
86
|
+
#n() {
|
|
87
|
+
if (this._state.pageCount <= 1) return "";
|
|
88
|
+
let e = [];
|
|
89
|
+
if (e.push(this.#c("l-button", {
|
|
90
|
+
title: "上一页",
|
|
91
|
+
disabled: this._state.currentPage === 1,
|
|
92
|
+
"data-page": this._state.currentPage - 1,
|
|
93
|
+
innerHTML: "<l-arrow-left-icon></l-arrow-left-icon>",
|
|
94
|
+
class: [
|
|
95
|
+
"l-pagination-item",
|
|
96
|
+
"l-pagination--btn",
|
|
97
|
+
"prev-btn"
|
|
98
|
+
]
|
|
99
|
+
})), this._state.simple) e.push(this.#c("div", {
|
|
100
|
+
class: ["l-pagination-item", "l-pagination-simple-layout"],
|
|
101
|
+
innerHTML: [
|
|
102
|
+
this.#c("l-input", {
|
|
103
|
+
inputmode: "numeric",
|
|
104
|
+
value: `${this._state.currentPage}`,
|
|
105
|
+
class: ["l-pagination-simple-input"],
|
|
106
|
+
"allow-input": "integer"
|
|
107
|
+
}),
|
|
108
|
+
"<span class=\"l-pagination-simple-divide\">/</span>",
|
|
109
|
+
`<span>${this._state.pageCount}</span>`
|
|
110
|
+
]
|
|
111
|
+
}));
|
|
112
|
+
else {
|
|
113
|
+
e.push(this.#c("a", {
|
|
114
|
+
title: "1",
|
|
115
|
+
innerHTML: "1",
|
|
116
|
+
class: [
|
|
117
|
+
"l-pagination-item",
|
|
118
|
+
"l-pagination--link",
|
|
119
|
+
this._state.currentPage === 1 ? "active" : ""
|
|
120
|
+
],
|
|
121
|
+
"data-page": "1"
|
|
122
|
+
})), this._state.currentPage > 4 && e.push(this.#c("a", {
|
|
123
|
+
title: "上5页",
|
|
124
|
+
innerHTML: ["<l-d-arrow-left-icon class='darrow-icon'></l-d-arrow-left-icon>", "<l-more-icon class='more-icon'></l-more-icon>"],
|
|
125
|
+
class: ["l-pagination-item", "l-pagination--link"],
|
|
126
|
+
"data-page": `${this._state.currentPage - 5}`
|
|
127
|
+
}));
|
|
128
|
+
let t = Math.max(this._state.currentPage - 2, 1), n = Math.min(this._state.currentPage + 2, this._state.pageCount), r = n - t;
|
|
129
|
+
r < 4 && (n = Math.min(this._state.pageCount, n + (4 - r))), r = n - t, r < 4 && (t = Math.max(1, t - (4 - r)));
|
|
130
|
+
for (let r = t; r <= n; r++) if (!(r <= 1)) {
|
|
131
|
+
if (r >= this._state.pageCount) break;
|
|
132
|
+
e.push(this.#c("a", {
|
|
133
|
+
title: `${r}`,
|
|
134
|
+
innerHTML: `${r}`,
|
|
135
|
+
class: [
|
|
136
|
+
"l-pagination-item",
|
|
137
|
+
"l-pagination--link",
|
|
138
|
+
this._state.currentPage === r ? "active" : ""
|
|
139
|
+
],
|
|
140
|
+
"data-page": `${r}`
|
|
141
|
+
}));
|
|
142
|
+
}
|
|
143
|
+
this._state.currentPage < this._state.pageCount - 3 && e.push(this.#c("a", {
|
|
144
|
+
title: "下5页",
|
|
145
|
+
innerHTML: ["<l-d-arrow-right-icon class='darrow-icon'></l-d-arrow-right-icon>", "<l-more-icon class='more-icon'></l-more-icon>"],
|
|
146
|
+
class: ["l-pagination-item", "l-pagination--link"],
|
|
147
|
+
"data-page": `${this._state.currentPage + 5}`
|
|
148
|
+
})), this._state.pageCount > 1 && e.push(this.#c("a", {
|
|
149
|
+
title: `${this._state.pageCount}`,
|
|
150
|
+
innerHTML: `${this._state.pageCount}`,
|
|
151
|
+
class: [
|
|
152
|
+
"l-pagination-item",
|
|
153
|
+
"l-pagination--link",
|
|
154
|
+
this._state.currentPage === this._state.pageCount ? "active" : ""
|
|
155
|
+
],
|
|
156
|
+
"data-page": `${this._state.pageCount}`
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
return e.push(this.#c("l-button", {
|
|
160
|
+
title: `${this._state.currentPage + 1}`,
|
|
161
|
+
innerHTML: "<l-arrow-right-icon></l-arrow-right-icon>",
|
|
162
|
+
class: [
|
|
163
|
+
"l-pagination-item",
|
|
164
|
+
"l-pagination--btn",
|
|
165
|
+
"next-btn"
|
|
166
|
+
],
|
|
167
|
+
disabled: this._state.currentPage === this._state.pageCount,
|
|
168
|
+
"data-page": `${this._state.currentPage + 1}`
|
|
169
|
+
})), e.join("");
|
|
170
|
+
}
|
|
171
|
+
#r() {
|
|
172
|
+
let e = a(".l-pagination-simple-input", this.root);
|
|
173
|
+
e && (e.setParser(this.#s), c(e, "keyup", this.#o), c(e, "blur", this.#a));
|
|
174
|
+
}
|
|
175
|
+
#i() {
|
|
176
|
+
let e = a(".l-pagination-simple-input", this.root);
|
|
177
|
+
e && (e.setParser(void 0), s(e, "keyup", this.#o), s(e, "blur", this.#a));
|
|
178
|
+
}
|
|
179
|
+
#a = (e) => {
|
|
180
|
+
let t = e.target, n = t.value;
|
|
181
|
+
if (!n) {
|
|
182
|
+
t.value = `${this._state.currentPage}`;
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this._state.currentPage = Number(n), this.rerender();
|
|
186
|
+
};
|
|
187
|
+
#o = (e) => {
|
|
188
|
+
if (e.key === "Enter") {
|
|
189
|
+
let t = e.target.value;
|
|
190
|
+
if (t) {
|
|
191
|
+
let e = Number(t);
|
|
192
|
+
this._state.currentPage = e, this.rerender();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
#s = (e) => {
|
|
197
|
+
if (e) {
|
|
198
|
+
let t = Number(e);
|
|
199
|
+
t = Math.max(1, Math.min(this._state.pageCount, t)), e = String(t);
|
|
200
|
+
}
|
|
201
|
+
return e;
|
|
202
|
+
};
|
|
203
|
+
#c(e = "a", t) {
|
|
204
|
+
let n = [], i = "";
|
|
205
|
+
for (let e in t) if (e === "innerHTML") i = t[e], Array.isArray(i) && (i = i.join(""));
|
|
206
|
+
else if (e === "class") {
|
|
207
|
+
let e = t.class;
|
|
208
|
+
n.push(` class="${o(e)}"`);
|
|
209
|
+
} else n.push(r(e, t[e]));
|
|
210
|
+
return `<${e}${n.join("")}>${i}</${e}>`;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
//#endregion
|
|
214
|
+
export { u as default };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/components/pagination/index.less?inline
|
|
2
|
+
var e = ":host{white-space:nowrap;color:#333;font-size:14px;line-height:1}.l-pagination{align-items:center;justify-content:var(--l-pagination-justify-content,flex-start);display:flex}.l-pagination-item{box-sizing:border-box;width:30px;height:30px}.l-pagination-item+.l-pagination-item{margin-left:5px}.l-pagination--btn{--l-btn-padding:0}.l-pagination--link{color:#666;cursor:pointer;border:1px solid #0000;border-radius:3px;justify-content:center;align-items:center;text-decoration:none;transition:color .3s,border-color .3s;display:inline-flex}.l-pagination--link.active{color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.darrow-icon{display:none}.more-icon{display:inline-block}.l-pagination--link:hover{color:var(--l-primary-color-light1,#9254de)}.l-pagination--link:hover .darrow-icon{display:inline-block}.l-pagination--link:hover .more-icon{display:none}.l-pagination--link:active{color:var(--l-primary-color-light1,#9254de)}.l-pagination-simple-layout{align-items:center;width:auto;display:inline-flex}.l-pagination-simple-input{--l-form-control-height:30px;box-sizing:border-box;text-align:center;width:60px}.l-pagination-simple-divide{margin:0 5px}";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as default };
|
package/lib/polygon/index.js
CHANGED
|
@@ -1,2 +1,21 @@
|
|
|
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 { formatClass as r, formatStyle as i } from "utilane/browser";
|
|
5
|
+
//#region src/components/polygon/index.ts
|
|
6
|
+
var a = class extends e {
|
|
7
|
+
static baseName = "polygon";
|
|
8
|
+
shape = "triangle-top";
|
|
9
|
+
background;
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), t(this);
|
|
12
|
+
}
|
|
13
|
+
connectedCallback() {
|
|
14
|
+
this.loadStyleText(n), super.connectedCallback();
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return `<div part="default" class="${r(["l-polygon", this.shape ? `l-polygon-${this.shape}` : ""])}" style="${i([this.background ? `--l-polygen-background: ${this.background}` : ""])}"></div>`;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { a as default };
|
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import e from "./base.js";
|
|
2
|
-
import { initAttr as t } from "./utils/index.js";
|
|
3
|
-
import { formatClass as n, formatStyle as r } from "ph-utils/browser";
|
|
4
1
|
//#region src/components/polygon/index.less?inline
|
|
5
|
-
var
|
|
6
|
-
static baseName = "polygon";
|
|
7
|
-
shape = "triangle-top";
|
|
8
|
-
background;
|
|
9
|
-
constructor() {
|
|
10
|
-
super(), t(this);
|
|
11
|
-
}
|
|
12
|
-
connectedCallback() {
|
|
13
|
-
this.loadStyleText(i), super.connectedCallback();
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
return `<div part="default" class="${n(["l-polygon", this.shape ? `l-polygon-${this.shape}` : ""])}" style="${r([this.background ? `--l-polygen-background: ${this.background}` : ""])}"></div>`;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
2
|
+
var e = ".l-polygon{--l-polygen-size:10px;--l-polygen-width:var(--l-polygen-size);--l-polygen-height:var(--l-polygen-size);--l-polygen-background:#666;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out;display:inline-block}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width) / 2) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0, var(--l-polygen-width) 0, 0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0, var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0, var(--l-polygen-width) calc(var(--l-polygen-height) / 2), 0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 calc(var(--l-polygen-height) / 2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0, var(--l-polygen-width) 0, calc(var(--l-polygen-width) / 2) var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0, 0 var(--l-polygen-height), var(--l-polygen-width) var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width) 0, var(--l-polygen-width) var(--l-polygen-height), 0 var(--l-polygen-height))}";
|
|
19
3
|
//#endregion
|
|
20
|
-
export {
|
|
4
|
+
export { e as default };
|
package/lib/qrcode/index.js
CHANGED
|
@@ -1,2 +1,65 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from "../base.js";
|
|
2
|
+
import t from "./index.less_inline.js";
|
|
3
|
+
import { $one as n } from "utilane/browser";
|
|
4
|
+
import { QRCodeRender as r, renderToCanvas as i } from "qrcode-generator-es";
|
|
5
|
+
//#region src/components/qrcode/index.ts
|
|
6
|
+
var a = class extends e {
|
|
7
|
+
static baseName = "qrcode";
|
|
8
|
+
_qrcode;
|
|
9
|
+
constructor() {
|
|
10
|
+
super(), this.version = 2;
|
|
11
|
+
}
|
|
12
|
+
connectedCallback() {
|
|
13
|
+
this.loadStyleText(t), super.connectedCallback();
|
|
14
|
+
}
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return [
|
|
17
|
+
"text",
|
|
18
|
+
"fill",
|
|
19
|
+
"size",
|
|
20
|
+
"level",
|
|
21
|
+
"icon"
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
attributeChanged(e, t, n) {
|
|
25
|
+
t !== n && (this._state[e] = n, this.#e(e, n));
|
|
26
|
+
}
|
|
27
|
+
updateDOM() {
|
|
28
|
+
this.#t();
|
|
29
|
+
}
|
|
30
|
+
afterInit() {
|
|
31
|
+
this.#t();
|
|
32
|
+
}
|
|
33
|
+
beforeDestroy() {
|
|
34
|
+
this._qrcode &&= (this._qrcode.destroy(), void 0);
|
|
35
|
+
}
|
|
36
|
+
#e(e, t) {
|
|
37
|
+
this._qrcode && (e === "icon" ? this._qrcode.option.icon = t ? { src: t } : void 0 : this._qrcode.option[e] = t);
|
|
38
|
+
}
|
|
39
|
+
#t() {
|
|
40
|
+
if (!this._qrcode) {
|
|
41
|
+
let e = n("canvas", this.root);
|
|
42
|
+
e && (this._qrcode = new r({
|
|
43
|
+
renderFn: i,
|
|
44
|
+
text: this._state.text,
|
|
45
|
+
size: Number(this._state.size || 120),
|
|
46
|
+
level: this._state.level || "M",
|
|
47
|
+
fill: this._state.fill || "#000000",
|
|
48
|
+
icon: this._state.icon ? { src: this._state.icon } : void 0,
|
|
49
|
+
el: e
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
this._qrcode != null && this._state.text && this._qrcode.render();
|
|
53
|
+
}
|
|
54
|
+
render_v2() {
|
|
55
|
+
return {
|
|
56
|
+
template: this.render(),
|
|
57
|
+
style: t
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return "<canvas class='renderer-el'></canvas>";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//#endregion
|
|
65
|
+
export { a as default };
|