litos-ui 0.17.2 → 0.17.3

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/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./utils";
2
- export { set as addClickOutside, remove as removeClickOutside, } from "./utils/clickoutside";
2
+ export { set as addClickOutside, remove as removeClickOutside } from "./utils/clickoutside";
3
3
  export { default as BaseComponent } from "./base";
4
4
  export { default as Message } from "./message";
5
5
  export { default as Dialog } from "./dialog";
@@ -54,7 +54,7 @@ export { default as Tabbar } from "./tabbar";
54
54
  export { default as TabbarItem } from "./tabbar/item";
55
55
  export { default as Theme } from "./theme";
56
56
  export { default as ThemeColor } from "./theme/theme_color";
57
- export { default as DatePicker } from "./date_picker";
57
+ export { default as DatePicker } from "./date_picker_ori";
58
58
  export { default as Menu } from "./menu";
59
59
  export { default as MenuItem } from "./menu/menu_item";
60
60
  export { default as SubMenu } from "./menu/sub_menu";
@@ -74,6 +74,7 @@ export * from "./utils/popover";
74
74
  export { default as Table } from "./table";
75
75
  export type { Column } from "./table/types";
76
76
  export { default as Space } from "./space";
77
+ export { default as Calendar } from "./calendar";
77
78
 
78
79
  declare global {
79
80
  interface HTMLElementTagNameMap {
@@ -130,7 +131,7 @@ declare global {
130
131
  "l-tabbar-item": import("./tabbar/item").default
131
132
  "l-theme": import("./theme").default
132
133
  "l-theme-color": import("./theme/theme_color").default
133
- "l-date-picker": import("./date_picker").default
134
+ "l-date-picker": import("./date_picker_ori").default
134
135
  "l-menu": import("./menu").default
135
136
  "l-menu-item": import("./menu/menu_item").default
136
137
  "l-sub-menu": import("./menu/sub_menu").default
@@ -148,5 +149,6 @@ declare global {
148
149
  "l-image-preview": import("./image/image_preview").default
149
150
  "l-table": import("./table").default
150
151
  "l-space": import("./space").default
152
+ "l-calendar": import("./calendar").default
151
153
  }
152
154
  }
package/lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { initAttr as t, kebabToCamel as r, parseAttrValue as a, regist as f, setAttrs as s, stopSignal as l, tagAttr as m, tagAttrs as u, unitNumberStr as p, useId as d } from "./utils/index.js";
1
+ import { initAttr as r, kebabToCamel as t, parseAttrValue as a, regist as f, setAttrs as s, stopSignal as l, tagAttr as m, tagAttrs as u, unitNumberStr as p, useId as d } from "./utils/index.js";
2
2
  import { set as n, remove as c } from "./utils/clickoutside.js";
3
3
  import { default as i } from "./base.js";
4
4
  import { default as C } from "./message/index.js";
@@ -20,7 +20,7 @@ import { default as J } from "./icon/search.js";
20
20
  import { default as X } from "./icon/sun.js";
21
21
  import { default as _ } from "./icon/moon.js";
22
22
  import { default as oo } from "./icon/reduction.js";
23
- import { default as to } from "./icon/refresh_left.js";
23
+ import { default as ro } from "./icon/refresh_left.js";
24
24
  import { default as ao } from "./icon/refresh_right.js";
25
25
  import { default as so } from "./icon/sort.js";
26
26
  import { default as mo } from "./icon/theme_default.js";
@@ -47,14 +47,14 @@ import { default as Ko } from "./select_ori/index.js";
47
47
  import { default as Yo } from "./switch/index.js";
48
48
  import { default as $o } from "./md_input/index.js";
49
49
  import { default as ee } from "./select/index.js";
50
- import { default as re } from "./list/index.js";
50
+ import { default as te } from "./list/index.js";
51
51
  import { default as fe } from "./polygon/index.js";
52
52
  import { default as le } from "./color_picker/index.js";
53
53
  import { default as ue } from "./tabbar/index.js";
54
54
  import { default as de } from "./tabbar/item.js";
55
55
  import { default as ne } from "./theme/index.js";
56
56
  import { default as Ie } from "./theme/theme_color.js";
57
- import { default as ge } from "./date_picker/index.js";
57
+ import { default as ge } from "./date_picker_ori/index.js";
58
58
  import { default as be } from "./menu/index.js";
59
59
  import { default as Ae } from "./menu/menu_item.js";
60
60
  import { default as Pe } from "./menu/sub_menu.js";
@@ -70,9 +70,10 @@ import { default as Qe } from "./collapse/index.js";
70
70
  import { default as We } from "./collapse/item.js";
71
71
  import { default as qe } from "./image/index.js";
72
72
  import { default as Ee } from "./image/image_preview.js";
73
- import { Popover as Ke, autoUpdate as Xe, createPopoverObserver as Ye, getOverflowAncestors as _e, popconfirmProps as $e, updatePosition as ot } from "./utils/popover.js";
74
- import { default as tt } from "./table/index.js";
75
- import { default as at } from "./space/index.js";
73
+ import { Popover as Ke, autoUpdate as Xe, createPopoverObserver as Ye, getOverflowAncestors as _e, popconfirmProps as $e, updatePosition as or } from "./utils/popover.js";
74
+ import { default as rr } from "./table/index.js";
75
+ import { default as ar } from "./space/index.js";
76
+ import { default as sr } from "./calendar/index.js";
76
77
  export {
77
78
  O as ArrowDownIcon,
78
79
  F as ArrowLeftIcon,
@@ -81,6 +82,7 @@ export {
81
82
  i as BaseComponent,
82
83
  v as BaseIcon,
83
84
  qo as Button,
85
+ sr as Calendar,
84
86
  V as CaretBottomIcon,
85
87
  N as CaretTopIcon,
86
88
  Te as Carousel,
@@ -105,7 +107,7 @@ export {
105
107
  Ee as ImagePreview,
106
108
  no as InfoIcon,
107
109
  Eo as Input,
108
- re as List,
110
+ te as List,
109
111
  w as Loading,
110
112
  z as LoadingIcon,
111
113
  Ge as Mask,
@@ -124,21 +126,21 @@ export {
124
126
  Ho as Radio,
125
127
  Zo as RadioGroup,
126
128
  oo as ReductionIcon,
127
- to as RefreshLeftIcon,
129
+ ro as RefreshLeftIcon,
128
130
  ao as RefreshRightIcon,
129
131
  J as SearchIcon,
130
132
  ee as Select,
131
133
  Lo as SelectIcon,
132
134
  Ko as SelectOri,
133
135
  so as SortIcon,
134
- at as Space,
136
+ ar as Space,
135
137
  Pe as SubMenu,
136
138
  Io as SuccessIcon,
137
139
  X as SunIcon,
138
140
  Yo as Switch,
139
141
  ue as Tabbar,
140
142
  de as TabbarItem,
141
- tt as Table,
143
+ rr as Table,
142
144
  M as Tabs,
143
145
  He as Tag,
144
146
  ne as Theme,
@@ -151,8 +153,8 @@ export {
151
153
  Xe as autoUpdate,
152
154
  Ye as createPopoverObserver,
153
155
  _e as getOverflowAncestors,
154
- t as initAttr,
155
- r as kebabToCamel,
156
+ r as initAttr,
157
+ t as kebabToCamel,
156
158
  a as parseAttrValue,
157
159
  $e as popconfirmProps,
158
160
  f as regist,
@@ -162,6 +164,6 @@ export {
162
164
  m as tagAttr,
163
165
  u as tagAttrs,
164
166
  p as unitNumberStr,
165
- ot as updatePosition,
167
+ or as updatePosition,
166
168
  d as useId
167
169
  };
@@ -1,7 +1,5 @@
1
1
  import BaseComponent from "../base";
2
- export default class Modal extends BaseComponent {
3
- #private;
4
- static baseName: string;
2
+ type ModalState = {
5
3
  /** 关闭时销毁 Modal 里的子元素 */
6
4
  destroyOnClose: boolean;
7
5
  /** 点击蒙层是否允许关闭 */
@@ -26,10 +24,30 @@ export default class Modal extends BaseComponent {
26
24
  mobile: boolean;
27
25
  /** 设置 Modal 的 z-index */
28
26
  zIndex?: string;
27
+ /** 是否显示对话框 */
28
+ show: boolean;
29
+ /** 是否显示头部 */
30
+ header: boolean;
31
+ /** 是否显示底部 */
32
+ footer: boolean;
33
+ /** 标题 */
34
+ headerTitle?: string;
35
+ };
36
+ export default class Modal extends BaseComponent<ModalState> {
37
+ #private;
38
+ static baseName: string;
29
39
  _bodyOverflow: string;
40
+ constructor();
30
41
  static get observedAttributes(): string[];
31
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
32
- connectedCallback(): void;
33
- render(): void;
42
+ protected attributeChanged(name: string, oldValue: string, newValue: string): void;
43
+ protected updateDOM(changedProps: Set<string>): void;
44
+ afterInit(): void;
45
+ render_v2(): {
46
+ template?: string | HTMLElement | DocumentFragment;
47
+ style?: string | string[];
48
+ };
49
+ _setZIndex(): void;
50
+ _setWidth(): void;
34
51
  disconnectedCallback(): void;
35
52
  }
53
+ export {};
@@ -1,147 +1,196 @@
1
- import x from "../base.js";
2
- import { parseAttrValue as c, initAttr as g } from "../utils/index.js";
3
- import { $one as i, transition as s, $$ as a, on as u, off as k, shouldEventNext as y } from "ph-utils/dom";
4
- const v = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex, 100)}.l-modal-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(var(--l-modal-zindex, 100) + 1)}.l-modal{--l-modal-translate: translate3d(0, 80px, 0);background-color:#fff;border-radius:5px;width:var(--l-modal-width, 27%);margin:auto;box-shadow:0 0 8px #0000001a;position:relative;opacity:1;transform:var(--l-modal-translate) scaleZ(1);transition:opacity .3s,transform .3s}.l-modal-header{display:block;padding:10px;font-size:16px;border-bottom:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-modal-footer{padding:10px;border-top:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-modal-container{padding:var(--l-modal-container-padding, 15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height: auto;position:absolute}.l-modal-close1{right:5px;top:8px}.l-modal-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-modal-close2{right:-10px;top:-10px}.l-modal-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translateZ(0) scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:transparent;padding:20px 10px 5px;display:flex;justify-content:center}.l-modal--mobile .l-modal-container{--l-modal-container-padding: 5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{display:flex;justify-content:stretch;align-items:stretch;padding:0;text-align:center;height:50px;gap:0}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06))}.l-modal--middle{--l-modal-translate: translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate: translate3d(0, -100%, 0);top:100%;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}@media screen and (max-width:768px){:host{--l-modal-width: 80%}}", w = ".l-mask{position:fixed;z-index:var(--l-mask-zindex, 100);inset:0;background-color:#0009;transition:opacity .3s;opacity:1}";
5
- class S extends x {
1
+ import f from "../base.js";
2
+ import { $one as d, transition as r, $$ as a, on as b, off as x, shouldEventNext as k } from "ph-utils/dom";
3
+ import { parseAttrValue as n, unitNumberStr as g, kebabToCamel as u } from "../utils/index.js";
4
+ const y = ":host{display:none}:host(.open){display:block}.l-modal-mask{z-index:var(--l-modal-zindex, 100)}.l-modal-wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:calc(var(--l-modal-zindex, 100) + 1)}.l-modal{--l-modal-translate: translate3d(0, 80px, 0);background-color:#fff;border-radius:5px;width:var(--l-modal-width, 27%);margin:auto;box-shadow:0 0 8px #0000001a;position:relative;opacity:1;transform:var(--l-modal-translate) scaleZ(1);transition:opacity .3s,transform .3s}.l-modal-header{display:block;padding:10px;font-size:16px;border-bottom:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-modal-footer{padding:10px;border-top:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-modal-container{padding:var(--l-modal-container-padding, 15px 10px);font-size:14px}.l-btn-modal-close{--l-form-control-height: auto;position:absolute}.l-modal-close1{right:5px;top:8px}.l-modal-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-modal-close2{right:-10px;top:-10px}.l-modal-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}.mask-transition-enter-from,.mask-transition-leave-to{opacity:0}.modal-transition-enter-from,.modal-transition-leave-to{transform:translateZ(0) scale3d(0,0,0)}.l-modal--mobile{border-radius:10px}.l-modal--mobile .l-modal-header{text-align:center;border-bottom-color:transparent;padding:20px 10px 5px;display:flex;justify-content:center}.l-modal--mobile .l-modal-container{--l-modal-container-padding: 5px 15px 20px;text-align:center}.l-modal--mobile .l-modal-footer{display:flex;justify-content:stretch;align-items:stretch;padding:0;text-align:center;height:50px;gap:0}.l-modal--mobile .l-modal-footer-btn{flex-grow:1;height:100%}.l-modal--mobile .l-modal-footer-btn+.l-modal-footer-btn{border-left:1px solid var(--l-modal-line-color, rgba(0, 0, 0, .06))}.l-modal--middle{--l-modal-translate: translate3d(0, -50%, 0);top:50%}.l-modal--bottom{--l-modal-translate: translate3d(0, -100%, 0);top:100%;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}@media screen and (max-width:768px){:host{--l-modal-width: 80%}}", v = ".l-mask{position:fixed;z-index:var(--l-mask-zindex, 100);inset:0;background-color:#0009;transition:opacity .3s;opacity:1}";
5
+ class z extends f {
6
6
  static baseName = "modal";
7
- /** 关闭时销毁 Modal 里的子元素 */
8
- destroyOnClose = !1;
9
- /** 点击蒙层是否允许关闭 */
10
- maskClosable = !0;
11
- /** 是否展示遮罩 */
12
- mask = !0;
13
- /** 是否显示取消按钮 */
14
- cancel = !0;
15
- /** 取消按钮文本 */
16
- cancelText = "取消";
17
- /** 确定按钮文本 */
18
- okText = "确定";
19
- /** 对话框宽度 */
20
- width;
21
- /** 确认按钮加载中 */
22
- confirmLoading = !1;
23
- /** 右上角关闭按钮, 1-显示在框内,2-显示在框角, 0-不显示 */
24
- close = 1;
25
- /** 对话框垂直方向位置 */
26
- verticalAlign = "top";
27
- /** 是否是移动风格弹出框 */
28
- mobile = !1;
29
- /** 设置 Modal 的 z-index */
30
- zIndex;
31
7
  _bodyOverflow = "";
8
+ constructor() {
9
+ super(), this.version = 2, this._state = {
10
+ destroyOnClose: !1,
11
+ maskClosable: !0,
12
+ mask: !0,
13
+ cancel: !0,
14
+ cancelText: "取消",
15
+ okText: "确定",
16
+ confirmLoading: !1,
17
+ close: 1,
18
+ verticalAlign: "top",
19
+ mobile: !1,
20
+ show: !1,
21
+ header: !0,
22
+ footer: !0
23
+ };
24
+ }
32
25
  static get observedAttributes() {
33
- return ["show", "width", "confirm-loading"];
26
+ return [
27
+ "show",
28
+ "width",
29
+ "confirm-loading",
30
+ "destroy-on-close",
31
+ "mask-closable",
32
+ "mask",
33
+ "cancel",
34
+ "cancel-text",
35
+ "ok-text",
36
+ "close",
37
+ "vertical-align",
38
+ "mobile",
39
+ "z-index",
40
+ "header",
41
+ "footer",
42
+ "header-title"
43
+ ];
34
44
  }
35
- attributeChangedCallback(t, l, o) {
36
- if (this.rendered) {
37
- if (t === "show")
38
- c(o, !1, "show") ? this.#o() : this.#a();
39
- else if (t === "width")
40
- this.width = c(o, void 0), this.#t();
41
- else if (t === "confirm-loading") {
42
- this.confirmLoading = c(o, !1, "confirm-loading");
43
- const e = i('l-button[modal-action="ok"]', this.root);
44
- e && e.setAttribute("loading", this.confirmLoading.toString());
45
- }
45
+ attributeChanged(t, o, e) {
46
+ switch (t) {
47
+ case "show":
48
+ case "confirm-loading":
49
+ case "destroy-on-close":
50
+ case "mask-closable":
51
+ case "mask":
52
+ case "cancel":
53
+ case "mobile":
54
+ case "header":
55
+ case "footer":
56
+ this._state[u(t)] = n(e, !1, t);
57
+ break;
58
+ case "cancel-text":
59
+ this._state.cancelText = n(e, "取消");
60
+ break;
61
+ case "ok-text":
62
+ this._state.okText = n(e, "确定");
63
+ break;
64
+ case "close":
65
+ this._state.close = n(e, 1);
66
+ break;
67
+ case "width":
68
+ this._state[t] = g(e);
69
+ break;
70
+ case "vertical-align":
71
+ this._state.verticalAlign = n(e, "top");
72
+ break;
73
+ case "z-index":
74
+ this._state.zIndex = e;
75
+ break;
76
+ case "header-title":
77
+ this._state.headerTitle = e;
78
+ break;
46
79
  }
47
80
  }
48
- connectedCallback() {
49
- g(this), this.loadStyleText([w, v]), super.connectedCallback(), this.#t(), this.zIndex && this.style.setProperty("--l-modal-zindex", this.zIndex);
81
+ updateDOM(t) {
82
+ if (t.has("show") && (this._state.show ? this.#t() : this.#a()), t.has("width") && this._setWidth(), t.has("confirm-loading")) {
83
+ const o = d('l-button[modal-action="ok"]', this.root);
84
+ o && o.setAttribute("loading", this._state.confirmLoading.toString());
85
+ }
86
+ t.has("z-index") && this._setZIndex();
50
87
  }
51
- render() {
52
- this.getAttr("show", !1) && this.#o();
88
+ afterInit() {
89
+ this._setWidth(), this._setZIndex(), this._state.show && this.#t();
53
90
  }
54
- #t() {
55
- this.width ? this.style.setProperty("--l-modal-width", this.width) : this.style.removeProperty("--l-modal-width");
91
+ render_v2() {
92
+ return {
93
+ style: [v, y]
94
+ };
95
+ }
96
+ _setZIndex() {
97
+ this._state.zIndex ? this.style.setProperty("--l-modal-zindex", this._state.zIndex) : this.style.removeProperty("--l-modal-zindex");
56
98
  }
57
- #o() {
99
+ _setWidth() {
100
+ this._state.width ? this.style.setProperty("--l-modal-width", this._state.width) : this.style.removeProperty("--l-modal-width");
101
+ }
102
+ #t() {
58
103
  this._bodyOverflow = getComputedStyle(document.body).overflow, this.classList.add("open"), document.body.style.overflow = "hidden";
59
- let t = i(".l-modal-wrapper", this.root);
104
+ let t = d(".l-modal-wrapper", this.root);
60
105
  if (t) {
61
- const l = i(".l-mask", this.root);
62
- l && s(l, "mask-transition");
63
- const o = i(".l-modal", this.root);
64
- s(o, "modal-transition");
106
+ const o = d(".l-mask", this.root);
107
+ o && r(o, "mask-transition");
108
+ const e = d(".l-modal", this.root);
109
+ r(e, "modal-transition");
65
110
  } else {
66
- const l = document.createDocumentFragment();
67
- let o = null;
68
- this.mask && (o = a("div", { class: "l-mask l-modal-mask", part: "mask" }), l.appendChild(o)), t = a("div", { class: "l-modal-wrapper", part: "wrapper" });
69
- const e = a("div", {
111
+ const o = document.createDocumentFragment();
112
+ let e = null;
113
+ this._state.mask && (e = a("div", { class: "l-mask l-modal-mask", part: "mask" }), o.appendChild(e)), t = a("div", { class: "l-modal-wrapper", part: "wrapper" });
114
+ const l = a("div", {
70
115
  class: [
71
116
  "l-modal",
72
- `l-modal--${this.mobile ? "mobile" : "pc"}`,
73
- `l-modal--${this.verticalAlign}`
117
+ `l-modal--${this._state.mobile ? "mobile" : "pc"}`,
118
+ `l-modal--${this._state.verticalAlign}`
74
119
  ],
75
120
  part: "default"
76
121
  });
77
- if (e.setAttribute("modal-action", "modal"), this.close !== 0) {
78
- const d = a("l-button", {
122
+ if (l.setAttribute("modal-action", "modal"), this._state.close !== 0) {
123
+ const s = a("l-button", {
79
124
  shape: "circle",
80
125
  type: "normal",
81
- class: `l-btn-modal-close l-modal-close${this.close}`,
126
+ class: `l-btn-modal-close l-modal-close${this._state.close}`,
82
127
  "modal-action": "close"
83
- }), n = a("l-close-icon");
84
- d.appendChild(n), e.appendChild(d);
128
+ }), i = a("l-close-icon");
129
+ s.appendChild(i), l.appendChild(s);
130
+ }
131
+ if (this._state.header) {
132
+ const s = a("header", { class: "l-modal-header", part: "header" }), i = a("slot", {
133
+ name: "header"
134
+ });
135
+ i.textContent = this._state.headerTitle || "", s.appendChild(i), l.appendChild(s);
85
136
  }
86
- const p = a("header", { class: "l-modal-header", part: "header" }), h = a("slot", { name: "header" });
87
- h.textContent = this.getAttr("header", ""), p.appendChild(h), e.appendChild(p);
88
- const f = a("div", {
137
+ const h = a("div", {
89
138
  class: "l-modal-container",
90
139
  part: "container"
91
- }), b = a("slot");
92
- if (f.appendChild(b), e.appendChild(f), this.getAttr("footer", !0)) {
93
- const d = a("footer", {
140
+ }), p = a("slot");
141
+ if (h.appendChild(p), l.appendChild(h), this._state.footer) {
142
+ const s = a("footer", {
94
143
  class: "l-modal-footer",
95
144
  part: "footer"
96
- }), n = a("slot", { name: "footer" });
97
- if (this.cancel) {
145
+ }), i = a("slot", { name: "footer" });
146
+ if (this._state.cancel) {
98
147
  const m = a("l-button", {
99
148
  class: "l-modal-footer-btn",
100
- text: this.mobile
149
+ text: this._state.mobile
101
150
  });
102
- m.textContent = this.cancelText, m.setAttribute("modal-action", "cancel"), n.appendChild(m);
151
+ m.textContent = this._state.cancelText, m.setAttribute("modal-action", "cancel"), i.appendChild(m);
103
152
  }
104
- const r = a("l-button", {
153
+ const c = a("l-button", {
105
154
  type: "primary",
106
155
  class: "l-modal-footer-btn",
107
- loading: this.confirmLoading,
108
- text: this.mobile
156
+ loading: this._state.confirmLoading,
157
+ text: this._state.mobile
109
158
  });
110
- r.textContent = this.okText, r.setAttribute("modal-action", "ok"), n.appendChild(r), d.appendChild(n), e.appendChild(d);
159
+ c.textContent = this._state.okText, c.setAttribute("modal-action", "ok"), i.appendChild(c), s.appendChild(i), l.appendChild(s);
111
160
  }
112
- t.appendChild(e), t.setAttribute("role", "dialog"), t.setAttribute("modal-action", "mask"), u(t, "click", this.#l), l.appendChild(t), this.appendToRoot(l), s(e, "modal-transition"), o && s(o, "mask-transition");
161
+ t.appendChild(l), t.setAttribute("role", "dialog"), t.setAttribute("modal-action", "mask"), b(t, "click", this.#o), o.appendChild(t), this.appendToRoot(o), r(l, "modal-transition"), e && r(e, "mask-transition");
113
162
  }
114
163
  }
115
164
  #a() {
116
165
  document.body.style.setProperty("overflow", this._bodyOverflow);
117
- const t = i(".l-modal", this.root);
118
- s(t, "modal-transition", "leave", () => {
119
- this.destroyOnClose && this.#e(), this.classList.remove("open"), this.dispatchEvent(new CustomEvent("close"));
166
+ const t = d(".l-modal", this.root);
167
+ r(t, "modal-transition", "leave", () => {
168
+ this._state.destroyOnClose && this.#e(), this.classList.remove("open"), this.dispatchEvent(new CustomEvent("close"));
120
169
  });
121
- const l = i(".l-mask", this.root);
122
- l && s(l, "mask-transition", "leave");
170
+ const o = d(".l-mask", this.root);
171
+ o && r(o, "mask-transition", "leave");
123
172
  }
124
173
  disconnectedCallback() {
125
174
  this.#e(), super.disconnectedCallback();
126
175
  }
127
176
  #e() {
128
- const t = i(".l-modal-wrapper", this.root);
129
- t && (k(t, "click", this.#l), this.root.removeChild(t));
130
- const l = i(".l-mask", this.root);
131
- l && this.root.removeChild(l);
177
+ const t = d(".l-modal-wrapper", this.root);
178
+ t && (x(t, "click", this.#o), this.root.removeChild(t));
179
+ const o = d(".l-mask", this.root);
180
+ o && this.root.removeChild(o);
132
181
  }
133
- #l = (t) => {
134
- const [l, o] = y(t, "modal-action", this.root);
135
- if (l) {
136
- let e = "";
137
- this.maskClosable && o === "mask" || o === "cancel" || o === "close" ? e = "cancel" : o === "ok" && (e = "ok"), e && this.dispatchEvent(
138
- new CustomEvent(e, {
139
- detail: { action: o }
182
+ #o = (t) => {
183
+ const [o, e] = k(t, "modal-action", this.root);
184
+ if (o) {
185
+ let l = "";
186
+ this._state.maskClosable && e === "mask" || e === "cancel" || e === "close" ? l = "cancel" : e === "ok" && (l = "ok"), l && this.dispatchEvent(
187
+ new CustomEvent(l, {
188
+ detail: { action: e }
140
189
  })
141
190
  );
142
191
  }
143
192
  };
144
193
  }
145
194
  export {
146
- S as default
195
+ z as default
147
196
  };
@@ -13,11 +13,7 @@ function f(t, e, o, l = "alert") {
13
13
  let s = o.icon();
14
14
  s.setAttribute("slot", "header"), n.push(s.outerHTML);
15
15
  }
16
- n.push(`<span slot="header">${t}</span>`), l === "prompt" ? (n.push(
17
- `<l-form-item label="${e}" label-position="top" inner-block>`
18
- ), n.push(
19
- `<l-input placeholder="${o.placeholder || ""}"></l-input>`
20
- ), n.push("</l-form-item>")) : n.push(`<span>${e}</span>`);
16
+ n.push(`<span slot="header">${t}</span>`), l === "prompt" ? (n.push(`<l-form-item label="${e}" label-position="top" inner-block>`), n.push(`<l-input placeholder="${o.placeholder || ""}"></l-input>`), n.push("</l-form-item>")) : n.push(`<span>${e}</span>`);
21
17
  let r = h("l-modal", {
22
18
  cancel: `${o.showCancel}`,
23
19
  innerHTML: n.join(""),
@@ -38,20 +34,20 @@ function f(t, e, o, l = "alert") {
38
34
  "ok",
39
35
  () => {
40
36
  let s = !0;
41
- l === "prompt" && (s = b(".l-modal-box l-input").value), r.removeAttribute("open"), a(s);
37
+ l === "prompt" && (s = b(".l-modal-box l-input").value), r.removeAttribute("show"), a(s);
42
38
  },
43
39
  { once: !0 }
44
40
  ), m(
45
41
  r,
46
42
  "cancel",
47
43
  () => {
48
- r.removeAttribute("open"), a(!1);
44
+ r.removeAttribute("show"), a(!1);
49
45
  },
50
46
  { once: !0 }
51
47
  ), document.body.appendChild(r);
52
48
  });
53
49
  }
54
- function k(t, e, o) {
50
+ function w(t, e, o) {
55
51
  return p([i, c, u]), new Promise((l) => {
56
52
  const a = {
57
53
  showCancel: !1,
@@ -63,7 +59,7 @@ function k(t, e, o) {
63
59
  return f(e || "提示", t, a, "alert");
64
60
  });
65
61
  }
66
- function v(t, e, o) {
62
+ function k(t, e, o) {
67
63
  p([i, c, u, d]);
68
64
  const l = {
69
65
  showCancel: !0,
@@ -74,7 +70,7 @@ function v(t, e, o) {
74
70
  };
75
71
  return f(e || "提示", t, l, "confirm");
76
72
  }
77
- function w(t, e, o) {
73
+ function v(t, e, o) {
78
74
  p([i, c, u, d, $, C]);
79
75
  const l = {
80
76
  showCancel: !0,
@@ -86,9 +82,9 @@ function w(t, e, o) {
86
82
  return f(e || "提示", t, l, "prompt");
87
83
  }
88
84
  const j = {
89
- alert: k,
90
- confirm: v,
91
- prompt: w
85
+ alert: w,
86
+ confirm: k,
87
+ prompt: v
92
88
  };
93
89
  export {
94
90
  j as default
@@ -1,9 +1,15 @@
1
1
  import BaseComponent from "../base";
2
- export default class ThemeColor extends BaseComponent {
2
+ type ThemeColorState = {
3
+ color: string;
4
+ };
5
+ export default class ThemeColor extends BaseComponent<ThemeColorState> {
3
6
  #private;
4
7
  static baseName: string;
5
- color: string;
6
8
  constructor();
7
- connectedCallback(): void;
8
- render(): string | void | HTMLElement | HTMLElement[];
9
+ render_v2(): {
10
+ template?: string | HTMLElement | DocumentFragment;
11
+ style?: string | string[];
12
+ };
13
+ afterInit(): void;
9
14
  }
15
+ export {};
@@ -1,28 +1,25 @@
1
1
  import { $one as t, on as r } from "ph-utils/dom";
2
- import c from "../base.js";
3
- import { getColorTheme as n, applyColorTheme as l } from "ph-utils/theme";
4
- class m extends c {
2
+ import s from "../base.js";
3
+ import { getColorTheme as a, applyColorTheme as c } from "ph-utils/theme";
4
+ class m extends s {
5
5
  static baseName = "theme-color";
6
- color;
7
6
  constructor() {
8
- super(), this.color = n() || "#722ed1";
7
+ super(), this.version = 2, this._state = {
8
+ color: a() || "#722ed1"
9
+ };
9
10
  }
10
- connectedCallback() {
11
- super.connectedCallback(), this.#e();
11
+ render_v2() {
12
+ return {
13
+ template: `<l-color-picker value="${this._state.color}"></l-color-picker>`
14
+ };
12
15
  }
13
- render() {
14
- const e = document.createElement(
15
- "l-color-picker"
16
- );
17
- return e.value = this.color, e;
18
- }
19
- #e() {
16
+ afterInit() {
20
17
  const e = t("l-color-picker", this.root);
21
- e && r(e, "change", this.#o);
18
+ e && r(e, "change", this.#e);
22
19
  }
23
- #o = async (e) => {
20
+ #e = async (e) => {
24
21
  const o = e.detail;
25
- this.color = o, await l(o), this.dispatchEvent(new CustomEvent("change", { detail: o }));
22
+ this._state.color = o, await c(o), this.dispatchEvent(new CustomEvent("change", { detail: o }));
26
23
  };
27
24
  }
28
25
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litos-ui",
3
- "version": "0.17.2",
3
+ "version": "0.17.3",
4
4
  "description": "基于 Web Component 的 UI 组件库",
5
5
  "keywords": [
6
6
  "component library",