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/base.d.ts +13 -1
- package/lib/base.js +35 -5
- package/lib/calendar/index.d.ts +30 -0
- package/lib/calendar/index.js +91 -0
- package/lib/calendar/langs.d.ts +4 -0
- package/lib/calendar/langs.js +8 -0
- package/lib/{date_picker → date_picker_ori}/index.d.ts +15 -7
- package/lib/date_picker_ori/index.js +129 -0
- package/lib/dialog/dialog_container.d.ts +16 -8
- package/lib/dialog/dialog_container.js +95 -62
- package/lib/index.d.ts +5 -3
- package/lib/index.js +16 -14
- package/lib/modal/index.d.ts +24 -6
- package/lib/modal/index.js +145 -96
- package/lib/modal/modal_box.js +9 -13
- package/lib/theme/theme_color.d.ts +10 -4
- package/lib/theme/theme_color.js +14 -17
- package/package.json +1 -1
- package/lib/date_picker/index.js +0 -99
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./utils";
|
|
2
|
-
export { set as addClickOutside, remove as removeClickOutside
|
|
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 "./
|
|
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("./
|
|
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
|
|
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
|
|
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
|
|
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 "./
|
|
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
|
|
74
|
-
import { default as
|
|
75
|
-
import { default as
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
167
|
+
or as updatePosition,
|
|
166
168
|
d as useId
|
|
167
169
|
};
|
package/lib/modal/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import BaseComponent from "../base";
|
|
2
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 {};
|
package/lib/modal/index.js
CHANGED
|
@@ -1,147 +1,196 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
class
|
|
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 [
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
52
|
-
this.
|
|
88
|
+
afterInit() {
|
|
89
|
+
this._setWidth(), this._setZIndex(), this._state.show && this.#t();
|
|
53
90
|
}
|
|
54
|
-
|
|
55
|
-
|
|
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
|
-
|
|
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 =
|
|
104
|
+
let t = d(".l-modal-wrapper", this.root);
|
|
60
105
|
if (t) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
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
|
|
67
|
-
let
|
|
68
|
-
this.mask && (
|
|
69
|
-
const
|
|
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 (
|
|
78
|
-
const
|
|
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
|
-
}),
|
|
84
|
-
|
|
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
|
|
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
|
-
}),
|
|
92
|
-
if (
|
|
93
|
-
const
|
|
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
|
-
}),
|
|
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"),
|
|
151
|
+
m.textContent = this._state.cancelText, m.setAttribute("modal-action", "cancel"), i.appendChild(m);
|
|
103
152
|
}
|
|
104
|
-
const
|
|
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
|
-
|
|
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(
|
|
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 =
|
|
118
|
-
|
|
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
|
|
122
|
-
|
|
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 =
|
|
129
|
-
t && (
|
|
130
|
-
const
|
|
131
|
-
|
|
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
|
-
#
|
|
134
|
-
const [
|
|
135
|
-
if (
|
|
136
|
-
let
|
|
137
|
-
this.maskClosable &&
|
|
138
|
-
new CustomEvent(
|
|
139
|
-
detail: { action:
|
|
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
|
-
|
|
195
|
+
z as default
|
|
147
196
|
};
|
package/lib/modal/modal_box.js
CHANGED
|
@@ -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("
|
|
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("
|
|
44
|
+
r.removeAttribute("show"), a(!1);
|
|
49
45
|
},
|
|
50
46
|
{ once: !0 }
|
|
51
47
|
), document.body.appendChild(r);
|
|
52
48
|
});
|
|
53
49
|
}
|
|
54
|
-
function
|
|
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
|
|
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
|
|
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:
|
|
90
|
-
confirm:
|
|
91
|
-
prompt:
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
+
render_v2(): {
|
|
10
|
+
template?: string | HTMLElement | DocumentFragment;
|
|
11
|
+
style?: string | string[];
|
|
12
|
+
};
|
|
13
|
+
afterInit(): void;
|
|
9
14
|
}
|
|
15
|
+
export {};
|
package/lib/theme/theme_color.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import { $one as t, on as r } from "ph-utils/dom";
|
|
2
|
-
import
|
|
3
|
-
import { getColorTheme as
|
|
4
|
-
class m extends
|
|
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.
|
|
7
|
+
super(), this.version = 2, this._state = {
|
|
8
|
+
color: a() || "#722ed1"
|
|
9
|
+
};
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
render_v2() {
|
|
12
|
+
return {
|
|
13
|
+
template: `<l-color-picker value="${this._state.color}"></l-color-picker>`
|
|
14
|
+
};
|
|
12
15
|
}
|
|
13
|
-
|
|
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.#
|
|
18
|
+
e && r(e, "change", this.#e);
|
|
22
19
|
}
|
|
23
|
-
#
|
|
20
|
+
#e = async (e) => {
|
|
24
21
|
const o = e.detail;
|
|
25
|
-
this.color = o, await
|
|
22
|
+
this._state.color = o, await c(o), this.dispatchEvent(new CustomEvent("change", { detail: o }));
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
25
|
export {
|