litos-ui 0.15.6 → 0.15.8
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/button/index.d.ts +4 -0
- package/lib/button/index.js +88 -61
- package/lib/check/check.js +6 -7
- package/lib/check/checkbox.js +1 -1
- package/lib/check/radio.js +10 -6
- package/lib/{check-BlDsQQo0.js → check-A86JxUfd.js} +1 -1
- package/lib/collapse/index.d.ts +19 -0
- package/lib/collapse/index.js +88 -0
- package/lib/collapse/item.d.ts +15 -0
- package/lib/collapse/item.js +115 -0
- package/lib/color_picker/index.js +1 -1
- package/lib/date_picker/index.js +1 -1
- package/lib/description_panel/index.d.ts +4 -4
- package/lib/description_panel/index.js +59 -11
- package/lib/dialog/dialog_container.js +1 -1
- package/lib/form/form_inner.d.ts +5 -1
- package/lib/form/form_inner.js +33 -27
- package/lib/form/form_item.js +9 -9
- package/lib/icon/d_arrow_left.d.ts +6 -0
- package/lib/icon/d_arrow_left.js +13 -0
- package/lib/icon/d_arrow_right.d.ts +6 -0
- package/lib/icon/d_arrow_right.js +13 -0
- package/lib/icon/more.d.ts +6 -0
- package/lib/icon/more.js +13 -0
- package/lib/icon/select.d.ts +6 -0
- package/lib/icon/select.js +13 -0
- package/lib/icon/zoom_in.d.ts +6 -0
- package/lib/icon/zoom_in.js +13 -0
- package/lib/icon/zoom_out.d.ts +6 -0
- package/lib/icon/zoom_out.js +13 -0
- package/lib/image/image_preview.d.ts +24 -0
- package/lib/image/image_preview.js +104 -0
- package/lib/image/index.d.ts +50 -0
- package/lib/image/index.js +176 -0
- package/lib/index-D4II9KsF.js +4 -0
- package/lib/index.d.ts +36 -4
- package/lib/index.js +157 -120
- package/lib/input/index.d.ts +5 -0
- package/lib/input/index.js +93 -71
- package/lib/litos-ui.css +1 -1
- package/lib/mask/index.d.ts +23 -0
- package/lib/mask/index.js +110 -0
- package/lib/md_input/index.js +11 -11
- package/lib/message/index.js +2 -2
- package/lib/modal/index.d.ts +1 -1
- package/lib/modal/index.js +7 -7
- package/lib/modal/modal_box.js +10 -10
- package/lib/page_header/index.d.ts +20 -0
- package/lib/page_header/index.js +109 -0
- package/lib/pagination/index.d.ts +27 -0
- package/lib/pagination/index.js +248 -0
- package/lib/qrcode/index.js +4 -4
- package/lib/select/index.d.ts +79 -0
- package/lib/select/index.js +406 -0
- package/lib/select_ori/index.js +1 -1
- package/lib/switch/index.js +4 -4
- package/lib/tabbar/index.d.ts +3 -1
- package/lib/tabbar/index.js +14 -8
- package/lib/tabbar/item.js +1 -1
- package/lib/table/index.d.ts +63 -0
- package/lib/table/index.js +260 -0
- package/lib/table/types.d.ts +36 -0
- package/lib/tabs/index.d.ts +7 -0
- package/lib/tabs/index.js +43 -0
- package/lib/tag/index.d.ts +16 -0
- package/lib/tag/index.js +80 -0
- package/lib/theme/index.js +6 -6
- package/lib/utils/index.d.ts +6 -28
- package/lib/utils/index.js +61 -86
- package/lib/utils/popover.d.ts +137 -0
- package/lib/utils/popover.js +354 -0
- package/lib/utils/transition.js +26 -50
- package/package.json +71 -71
- package/styles/popover.css +66 -0
- package/styles/reset.css +1 -1
- package/styles/select.css +37 -0
- package/styles/tabs.css +13 -0
- package/styles/vars.css +2 -1
- package/lib/index-dwS1N2uN.js +0 -4
- package/lib/popconfirm/index.d.ts +0 -7
- package/lib/popconfirm/index.js +0 -30
- package/lib/popover/index.d.ts +0 -34
- package/lib/popover/index.js +0 -150
- /package/lib/{menu/base.js → table/types.js} +0 -0
package/lib/input/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { addClass as
|
|
2
|
-
import { initAttr as
|
|
1
|
+
import { addClass as h, removeClass as u, $one as d, on as o, formatStyle as c, off as p, $ as f, $$ as n } from "ph-utils/dom";
|
|
2
|
+
import { initAttr as g, parseAttrValue as a } from "../utils/index.js";
|
|
3
3
|
import m from "../form/form_inner.js";
|
|
4
|
-
import { add as
|
|
5
|
-
import { i as
|
|
6
|
-
class
|
|
4
|
+
import { add as b, remove as x } from "../utils/event.js";
|
|
5
|
+
import { i as v } from "../index-D4II9KsF.js";
|
|
6
|
+
class I extends m {
|
|
7
7
|
static baseName = "input";
|
|
8
8
|
/** 原生 input 的 type */
|
|
9
9
|
type = "text";
|
|
@@ -18,144 +18,166 @@ class y extends m {
|
|
|
18
18
|
/** 宽度铺满 */
|
|
19
19
|
block = !1;
|
|
20
20
|
error = !1;
|
|
21
|
+
maxlength;
|
|
22
|
+
minlength;
|
|
23
|
+
inputmode = "text";
|
|
21
24
|
$inner;
|
|
22
|
-
#
|
|
23
|
-
set value(
|
|
24
|
-
this.setValue(
|
|
25
|
+
#t = !1;
|
|
26
|
+
set value(t) {
|
|
27
|
+
this.setValue(t), this.$inner && (this.$inner.value = t);
|
|
25
28
|
}
|
|
26
29
|
get value() {
|
|
27
30
|
return this.getValue();
|
|
28
31
|
}
|
|
29
32
|
get clearable() {
|
|
30
|
-
return this.#
|
|
33
|
+
return this.#t;
|
|
31
34
|
}
|
|
32
|
-
set clearable(
|
|
33
|
-
this.#
|
|
35
|
+
set clearable(t) {
|
|
36
|
+
this.#t = t, t ? h(this, "l-input--clearable") : u(this, "l-input--clearable");
|
|
34
37
|
}
|
|
35
38
|
static get observedAttributes() {
|
|
36
|
-
return [
|
|
39
|
+
return [
|
|
40
|
+
"disabled",
|
|
41
|
+
"value",
|
|
42
|
+
"name",
|
|
43
|
+
"error",
|
|
44
|
+
"clearable",
|
|
45
|
+
"maxlength",
|
|
46
|
+
"inputmode"
|
|
47
|
+
];
|
|
37
48
|
}
|
|
38
49
|
connectedCallback() {
|
|
39
|
-
|
|
50
|
+
g(this), this.loadStyleText([v]), super.connectedCallback(), this.$inner = d(".l-input__inner", this.root), o(this.$inner, "input", this._input), o(this.$inner, "change", this.#s), this.style.cssText = c(this._getStyleObj()) + this.getAttr("style", ""), this.error && h(this, "is-error"), this.getName() && this.formAttrs.id && b(this.formAttrs.id, "validateChange", this._validateChange);
|
|
40
51
|
}
|
|
41
52
|
disconnectedCallback() {
|
|
42
|
-
super.disconnectedCallback(), this.formAttrs.id &&
|
|
53
|
+
super.disconnectedCallback(), this.formAttrs.id && x(this.formAttrs.id, "validateChange", this._validateChange), p(this.$inner, "input", this._input);
|
|
43
54
|
}
|
|
44
|
-
attributeChange(
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
attributeChange(t, s, e) {
|
|
56
|
+
const r = a(
|
|
57
|
+
e,
|
|
58
|
+
this[t],
|
|
59
|
+
t
|
|
60
|
+
);
|
|
61
|
+
if (r !== this[t] && (this[t] = r), t === "error") {
|
|
62
|
+
const i = a(e, !1, t);
|
|
47
63
|
i !== this.error && (this.error = i, this._updateError());
|
|
48
|
-
} else if (
|
|
49
|
-
const i =
|
|
64
|
+
} else if (t === "clearable") {
|
|
65
|
+
const i = a(e, !1, t);
|
|
50
66
|
i !== this.clearable && (this.clearable = i);
|
|
67
|
+
} else if (t === "maxlength") {
|
|
68
|
+
const i = a(e, this.maxlength);
|
|
69
|
+
i !== this.maxlength && (this.maxlength = i);
|
|
51
70
|
}
|
|
52
71
|
}
|
|
53
72
|
render() {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
73
|
+
const t = document.createDocumentFragment();
|
|
74
|
+
if (f('[slot="prefix"]', this).length > 0) {
|
|
75
|
+
const i = n("slot", {
|
|
57
76
|
name: "prefix"
|
|
58
|
-
}), l =
|
|
77
|
+
}), l = n("span", {
|
|
59
78
|
class: "l-input__prefix",
|
|
60
79
|
part: "prefix"
|
|
61
80
|
});
|
|
62
|
-
l.appendChild(
|
|
81
|
+
l.appendChild(i), t.appendChild(l);
|
|
63
82
|
}
|
|
64
|
-
const
|
|
83
|
+
const e = n("input", {
|
|
65
84
|
class: "l-input__inner",
|
|
66
85
|
value: this.value,
|
|
67
|
-
name: this.getName(),
|
|
68
|
-
placeholder: this.placeholder,
|
|
69
|
-
disabled: this.isDisabled(),
|
|
86
|
+
name: this.getName() || "",
|
|
87
|
+
placeholder: this.placeholder || "",
|
|
70
88
|
part: "default",
|
|
71
|
-
type: this.type
|
|
89
|
+
type: this.type,
|
|
90
|
+
inputmode: this.inputmode
|
|
72
91
|
});
|
|
73
|
-
if (e.appendChild(
|
|
74
|
-
const
|
|
92
|
+
if (this.isDisabled() && (e.disabled = !0), this.maxlength && e.setAttribute("maxlength", this.maxlength), this.minlength && e.setAttribute("minlength", this.minlength), t.appendChild(e), f('[slot="suffix"]', this).length > 0) {
|
|
93
|
+
const i = n("slot", {
|
|
75
94
|
name: "suffix"
|
|
76
|
-
}), l =
|
|
95
|
+
}), l = n("span", {
|
|
77
96
|
class: "l-input__suffix",
|
|
78
97
|
part: "suffix"
|
|
79
98
|
});
|
|
80
|
-
l.appendChild(
|
|
99
|
+
l.appendChild(i), t.appendChild(l);
|
|
81
100
|
}
|
|
82
|
-
return
|
|
101
|
+
return t;
|
|
83
102
|
}
|
|
84
103
|
/**
|
|
85
104
|
* 设置自定义的输入解析器
|
|
86
105
|
* @param cb
|
|
87
106
|
*/
|
|
88
|
-
setParser(
|
|
89
|
-
this.parser =
|
|
107
|
+
setParser(t) {
|
|
108
|
+
this.parser = t;
|
|
90
109
|
}
|
|
91
|
-
_input = (
|
|
92
|
-
const s =
|
|
93
|
-
let
|
|
110
|
+
_input = (t) => {
|
|
111
|
+
const s = t.target;
|
|
112
|
+
let e = s.value;
|
|
94
113
|
if (this.allowInput != null) {
|
|
95
|
-
let
|
|
96
|
-
|
|
114
|
+
let r = this.allowInput.indexOf("."), i = r === -1 ? r : parseInt(this.allowInput.substring(r + 1));
|
|
115
|
+
e = this._numberInputParse(e, {
|
|
97
116
|
integer: this.allowInput.includes("integer"),
|
|
98
117
|
negative: this.allowInput.startsWith("-"),
|
|
99
|
-
precition:
|
|
100
|
-
}),
|
|
118
|
+
precition: i
|
|
119
|
+
}), e = String(e);
|
|
101
120
|
}
|
|
102
|
-
this.parser != null && (
|
|
121
|
+
this.parser != null && (e = this.parser(e)), s.value = e, this.setValue(e), this.#e();
|
|
103
122
|
};
|
|
104
|
-
#
|
|
123
|
+
#e() {
|
|
105
124
|
if (this.clearable) {
|
|
106
|
-
let
|
|
125
|
+
let t = d(".l-clearable", this.root);
|
|
107
126
|
if (this.value.length > 0) {
|
|
108
|
-
if (
|
|
109
|
-
|
|
127
|
+
if (t == null) {
|
|
128
|
+
t = n("span", {
|
|
110
129
|
class: "l-input__suffix l-clearable"
|
|
111
130
|
});
|
|
112
|
-
const s =
|
|
113
|
-
|
|
131
|
+
const s = n("l-close-filled-icon");
|
|
132
|
+
t.appendChild(s), this.root.appendChild(t), o(t, "click", this.#i);
|
|
114
133
|
}
|
|
115
134
|
} else
|
|
116
|
-
|
|
135
|
+
t && (p(t, "click", this.#i), t.remove());
|
|
117
136
|
}
|
|
118
137
|
}
|
|
119
138
|
#i = () => {
|
|
120
139
|
this.value = "", this.dispatchEvent(
|
|
121
|
-
new CustomEvent("input", {
|
|
122
|
-
|
|
140
|
+
new CustomEvent("input", {
|
|
141
|
+
bubbles: !0,
|
|
142
|
+
detail: { value: this.value }
|
|
143
|
+
})
|
|
144
|
+
), this.#e();
|
|
123
145
|
};
|
|
124
146
|
disabledChange() {
|
|
125
147
|
this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
|
|
126
148
|
}
|
|
127
|
-
_numberInputParse(
|
|
128
|
-
let
|
|
149
|
+
_numberInputParse(t, s) {
|
|
150
|
+
let e = t, r = s.negative ? "-?" : "";
|
|
129
151
|
if (s.integer) {
|
|
130
|
-
const l =
|
|
131
|
-
return l != null ? l[1] :
|
|
152
|
+
const l = e.match(new RegExp(`^(${r}\\d*)`));
|
|
153
|
+
return l != null ? l[1] : e.substring(0, e.length - 1);
|
|
132
154
|
}
|
|
133
|
-
const
|
|
155
|
+
const i = e.match(
|
|
134
156
|
new RegExp(
|
|
135
|
-
`(${
|
|
157
|
+
`(${r}\\d+\\.\\d{0,${s.precition}})|(${r}\\d*)`
|
|
136
158
|
)
|
|
137
159
|
);
|
|
138
|
-
return
|
|
160
|
+
return i != null ? e = i[1] || i[2] : e = "", i != null ? i[1] || i[2] : "";
|
|
139
161
|
}
|
|
140
162
|
_getStyleObj() {
|
|
141
|
-
const
|
|
142
|
-
return this._isBlock() && (
|
|
163
|
+
const t = {};
|
|
164
|
+
return this._isBlock() && (t["--l-input-width"] = "100%"), this.width && (t["--l-input-width"] = this.width), t;
|
|
143
165
|
}
|
|
144
166
|
_isBlock() {
|
|
145
167
|
return this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0;
|
|
146
168
|
}
|
|
147
169
|
_updateError() {
|
|
148
|
-
this.error ?
|
|
170
|
+
this.error ? h(this, "is-error") : u(this, "is-error");
|
|
149
171
|
}
|
|
150
|
-
_validateChange = (
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
(s == null || s ===
|
|
172
|
+
_validateChange = (t, s) => {
|
|
173
|
+
const e = this.getName();
|
|
174
|
+
if (e) {
|
|
175
|
+
const r = t === !0 ? !1 : t[e] != null;
|
|
176
|
+
(s == null || s === e && this.error != r) && (this.error = r, this._updateError()), Object.keys(t)[0] === e && this.focus();
|
|
155
177
|
}
|
|
156
178
|
};
|
|
157
|
-
#s = (
|
|
158
|
-
const s =
|
|
179
|
+
#s = (t) => {
|
|
180
|
+
const s = t.target;
|
|
159
181
|
this.dispatchEvent(
|
|
160
182
|
new CustomEvent("change", {
|
|
161
183
|
bubbles: !0,
|
|
@@ -166,5 +188,5 @@ class y extends m {
|
|
|
166
188
|
};
|
|
167
189
|
}
|
|
168
190
|
export {
|
|
169
|
-
|
|
191
|
+
I as default
|
|
170
192
|
};
|
package/lib/litos-ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{display:inline-flex}.l-icon{width:1em;height:1em;fill:currentColor;vertical-align:middle;display:inline-block}:host{display:inline-flex;width:auto}
|
|
1
|
+
:host{display:inline-flex}.l-icon{width:1em;height:1em;fill:currentColor;vertical-align:middle;display:inline-block}:host{display:inline-flex;width:auto;box-sizing:border-box}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class Mask extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
zIndex: number;
|
|
6
|
+
/** 是否可以通过点击 mask 关闭对话框 */
|
|
7
|
+
maskClosable: boolean;
|
|
8
|
+
/** 是否在打开时禁用 body 滚动 */
|
|
9
|
+
lockScroll: boolean;
|
|
10
|
+
get open(): boolean;
|
|
11
|
+
set open(value: boolean);
|
|
12
|
+
static customAttributes: string[];
|
|
13
|
+
static get observedAttributes(): string[];
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
16
|
+
render(): DocumentFragment;
|
|
17
|
+
contentRender(): string | HTMLElement | DocumentFragment;
|
|
18
|
+
afterInit(): void;
|
|
19
|
+
beforeDestroy(): void;
|
|
20
|
+
afterOpened(): void;
|
|
21
|
+
afterClosed(): void;
|
|
22
|
+
onAction(action: string): boolean;
|
|
23
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import a from "../base.js";
|
|
2
|
+
import { kebabToCamel as r, parseAttrValue as c } from "../utils/index.js";
|
|
3
|
+
import { $$ as n, addClass as d, $one as i, transition as l, hasClass as p, removeClass as h, on as f, off as m, shouldEventNext as k } from "ph-utils/dom";
|
|
4
|
+
const u = ":host{display:none;position:relative}:host(.open){display:block}.l-mask,.l-panel{position:fixed;inset:0;opacity:1}.l-mask{background-color:#00000080;z-index:var(--l-mask-zindex, 100)}.l-panel{z-index:calc(var(--l-mask-zindex, 100) + 1);color:#fff}";
|
|
5
|
+
class x extends a {
|
|
6
|
+
static baseName = "mask";
|
|
7
|
+
#t = !1;
|
|
8
|
+
zIndex = 100;
|
|
9
|
+
/** 是否可以通过点击 mask 关闭对话框 */
|
|
10
|
+
maskClosable = !0;
|
|
11
|
+
/** 是否在打开时禁用 body 滚动 */
|
|
12
|
+
lockScroll = !0;
|
|
13
|
+
#e = "";
|
|
14
|
+
get open() {
|
|
15
|
+
return this.#t;
|
|
16
|
+
}
|
|
17
|
+
set open(t) {
|
|
18
|
+
this.#t = t, this.rendered && this.#s();
|
|
19
|
+
}
|
|
20
|
+
static customAttributes = [];
|
|
21
|
+
static get observedAttributes() {
|
|
22
|
+
return [
|
|
23
|
+
"open",
|
|
24
|
+
"z-index",
|
|
25
|
+
"mask-closable",
|
|
26
|
+
"lock-scroll",
|
|
27
|
+
...this.customAttributes
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
this.loadStyleText(u), super.connectedCallback();
|
|
32
|
+
}
|
|
33
|
+
attributeChangedCallback(t, e, s) {
|
|
34
|
+
t = r(t);
|
|
35
|
+
const o = c(
|
|
36
|
+
s,
|
|
37
|
+
this[t],
|
|
38
|
+
t
|
|
39
|
+
);
|
|
40
|
+
if (o !== this[t])
|
|
41
|
+
switch (this[t] = o, t) {
|
|
42
|
+
case "zIndex":
|
|
43
|
+
o === 100 ? this.style.removeProperty("--l-mask-zindex") : this.style.setProperty("--l-mask-zindex", o);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
const t = document.createDocumentFragment(), e = n("div", {
|
|
49
|
+
class: "l-mask",
|
|
50
|
+
part: "mask"
|
|
51
|
+
});
|
|
52
|
+
t.appendChild(e);
|
|
53
|
+
const s = n("div", {
|
|
54
|
+
class: "l-panel",
|
|
55
|
+
part: "panel"
|
|
56
|
+
}), o = this.contentRender();
|
|
57
|
+
return typeof o == "string" ? s.innerHTML = o : s.appendChild(o), t.appendChild(s), t;
|
|
58
|
+
}
|
|
59
|
+
contentRender() {
|
|
60
|
+
return "<slot></slot>";
|
|
61
|
+
}
|
|
62
|
+
#s() {
|
|
63
|
+
if (this.open) {
|
|
64
|
+
this.lockScroll && (this.#e = getComputedStyle(document.body).overflow, document.body.style.overflow = "hidden"), d(this, "open");
|
|
65
|
+
const t = i(".l-mask", this.root);
|
|
66
|
+
t && l(t, [["opacity", "0", "0.3s"]], "enter");
|
|
67
|
+
const e = i(".l-panel", this.root);
|
|
68
|
+
e && l(e, [["opacity", "0", "0.3s"]], "enter"), this.afterOpened();
|
|
69
|
+
} else if (p(this, "open")) {
|
|
70
|
+
this.emit("close");
|
|
71
|
+
const t = i(".l-panel", this.root);
|
|
72
|
+
t && l(t, [["opacity", "0", "0.3s"]], "leave");
|
|
73
|
+
const e = i(".l-mask", this.root);
|
|
74
|
+
e && l(e, [["opacity", "0", "0.3s"]], "leave", () => {
|
|
75
|
+
h(this, "open"), this.emit("closed");
|
|
76
|
+
}), this.lockScroll && (document.body.style.overflow = this.#e), this.afterClosed();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
afterInit() {
|
|
80
|
+
this.#s();
|
|
81
|
+
const t = i(".l-panel", this.root);
|
|
82
|
+
t && f(t, "click", this.#o);
|
|
83
|
+
}
|
|
84
|
+
beforeDestroy() {
|
|
85
|
+
const t = i(".l-panel", this.root);
|
|
86
|
+
t && m(t, "click", this.#o);
|
|
87
|
+
}
|
|
88
|
+
#o = (t) => {
|
|
89
|
+
const [e, s] = k(
|
|
90
|
+
t,
|
|
91
|
+
"data-action",
|
|
92
|
+
t.currentTarget
|
|
93
|
+
);
|
|
94
|
+
if (!e) {
|
|
95
|
+
this.maskClosable && (this.open = !1);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
this.onAction(s) || this.emit("action", { detail: s });
|
|
99
|
+
};
|
|
100
|
+
afterOpened() {
|
|
101
|
+
}
|
|
102
|
+
afterClosed() {
|
|
103
|
+
}
|
|
104
|
+
onAction(t) {
|
|
105
|
+
return !1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
x as default
|
|
110
|
+
};
|
package/lib/md_input/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { addClass as
|
|
1
|
+
import { addClass as i, $$ as r, $one as l, on as a, off as d, removeClass as u } from "ph-utils/dom";
|
|
2
2
|
import p from "../form/form_inner.js";
|
|
3
3
|
import { initAttr as m } from "../utils/index.js";
|
|
4
|
-
import { isBlank as s, random as
|
|
5
|
-
const
|
|
4
|
+
import { isBlank as s, random as c } from "ph-utils";
|
|
5
|
+
const h = ":host{--l-input-width: 180px;position:relative;width:var(--l-input-width, 180px);height:var(--l-form-control-height, 32px);display:inline-block}.l-md-input__inner{width:100%;height:100%;border:0;background:transparent;border-style:solid;border-color:silver;border-bottom-width:1px;box-sizing:border-box;outline:none;transition:border-color .3s}.l-md-input__inner:focus{border-color:var(--l-primary-color, #722ed1)}:host(.l-has-value) .l-md-input__label,.l-md-input__inner:focus+.l-md-input__label{transform:translate3d(0,-150%,0);font-size:12px}.l-md-input__inner:focus+.l-md-input__label{color:var(--nt-primary-color, #722ed1)}.l-md-input__label{display:flex;align-items:center;position:absolute;top:50%;bottom:0;left:0;transition:color .3s,transform .3s;color:#8c8c8c;cursor:text;line-height:1;transform:translate3d(0,-50%,0);font-size:13px}:host(.l-md-input-outline){--l-input-label-background: #ffffff}:host(.l-md-input-outline) .l-md-input__inner{border-width:1px;border-radius:4px;padding:0 10px}:host(.l-md-input-outline) .l-md-input__label{left:10px}:host(.l-md-input-outline) .l-md-input__inner:focus{border-width:2px}:host(.l-md-input-outline) .l-md-input__inner:focus+.l-md-input__label,:host(.l-md-input-outline.l-has-value) .l-md-input__label{padding-left:4px;padding-right:4px;background-color:#fff}";
|
|
6
6
|
class v extends p {
|
|
7
7
|
static baseName = "md-input";
|
|
8
8
|
/** 是否显示四周边框 */
|
|
@@ -14,21 +14,21 @@ class v extends p {
|
|
|
14
14
|
return ["disabled"];
|
|
15
15
|
}
|
|
16
16
|
connectedCallback() {
|
|
17
|
-
m(this), this.loadStyleText(
|
|
17
|
+
m(this), this.loadStyleText(h), super.connectedCallback(), this.#e();
|
|
18
18
|
}
|
|
19
19
|
disconnectedCallback() {
|
|
20
|
-
super.disconnectedCallback(), this.#
|
|
20
|
+
super.disconnectedCallback(), this.#n();
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
|
-
s(this.value) ||
|
|
24
|
-
const t = document.createDocumentFragment(), e = `l-md-input-${
|
|
23
|
+
s(this.value) || i(this, "l-has-value"), this.outline && i(this, "l-md-input-outline");
|
|
24
|
+
const t = document.createDocumentFragment(), e = `l-md-input-${c(8)}`, n = r("input", {
|
|
25
25
|
class: "l-md-input__inner",
|
|
26
26
|
type: this.htmlType,
|
|
27
27
|
name: this.getName(),
|
|
28
28
|
inputmode: this.inputmode,
|
|
29
29
|
id: e
|
|
30
30
|
});
|
|
31
|
-
if (t.appendChild(
|
|
31
|
+
if (t.appendChild(n), this.label) {
|
|
32
32
|
const o = r("label", {
|
|
33
33
|
class: "l-md-input__label",
|
|
34
34
|
for: e
|
|
@@ -46,13 +46,13 @@ class v extends p {
|
|
|
46
46
|
const t = l("input", this.root);
|
|
47
47
|
t && a(t, "input", this.#t);
|
|
48
48
|
}
|
|
49
|
-
#
|
|
49
|
+
#n() {
|
|
50
50
|
const t = l("input", this.root);
|
|
51
51
|
t && d(t, "input", this.#t);
|
|
52
52
|
}
|
|
53
53
|
#t = (t) => {
|
|
54
|
-
const
|
|
55
|
-
this.setValue(
|
|
54
|
+
const n = t.target.value;
|
|
55
|
+
this.setValue(n), s(n) ? u(this, "l-has-value") : i(this, "l-has-value");
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
export {
|
package/lib/message/index.js
CHANGED
|
@@ -38,7 +38,7 @@ function x(e) {
|
|
|
38
38
|
"</div>"
|
|
39
39
|
].join(""), t;
|
|
40
40
|
}
|
|
41
|
-
const i = (e) => {
|
|
41
|
+
const i = ((e) => {
|
|
42
42
|
m && (y([h, $, v, w]), m = !1);
|
|
43
43
|
const t = c.reduce(
|
|
44
44
|
(f, l) => f + l.offsetHeight + 15,
|
|
@@ -51,7 +51,7 @@ const i = (e) => {
|
|
|
51
51
|
return o == null && (o = 3e3), o !== 0 && setTimeout(() => {
|
|
52
52
|
g(s);
|
|
53
53
|
}, o), s;
|
|
54
|
-
};
|
|
54
|
+
});
|
|
55
55
|
function a(e, t = "info") {
|
|
56
56
|
const s = typeof e == "string" ? { message: e } : e;
|
|
57
57
|
return s.type || (s.type = t), i(s);
|
package/lib/modal/index.d.ts
CHANGED
package/lib/modal/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import x from "../base.js";
|
|
2
2
|
import { parseAttrValue as c, initAttr as g } from "../utils/index.js";
|
|
3
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-
|
|
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
5
|
class L extends x {
|
|
6
6
|
static baseName = "modal";
|
|
7
7
|
/** 是否显示对话框 */
|
|
8
|
-
|
|
8
|
+
show = !1;
|
|
9
9
|
/** 关闭时销毁 Modal 里的子元素 */
|
|
10
10
|
destroyOnClose = !1;
|
|
11
11
|
/** 点击蒙层是否允许关闭 */
|
|
@@ -36,12 +36,12 @@ class L extends x {
|
|
|
36
36
|
zIndex;
|
|
37
37
|
#t = "";
|
|
38
38
|
static get observedAttributes() {
|
|
39
|
-
return ["
|
|
39
|
+
return ["show", "width", "confirm-loading"];
|
|
40
40
|
}
|
|
41
41
|
attributeChangedCallback(t, e, o) {
|
|
42
42
|
if (this.rendered) {
|
|
43
|
-
if (t === "
|
|
44
|
-
this.
|
|
43
|
+
if (t === "show")
|
|
44
|
+
this.show = c(o, !1), this.show ? this.#e() : this.#i();
|
|
45
45
|
else if (t === "width")
|
|
46
46
|
this.width = c(o, void 0), this.#o();
|
|
47
47
|
else if (t === "confirm-loading") {
|
|
@@ -52,10 +52,10 @@ class L extends x {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
connectedCallback() {
|
|
55
|
-
g(this), this.loadStyleText([
|
|
55
|
+
g(this), this.loadStyleText([w, v]), super.connectedCallback(), this.#o(), this.zIndex && this.style.setProperty("--l-modal-zindex", this.zIndex);
|
|
56
56
|
}
|
|
57
57
|
render() {
|
|
58
|
-
this.
|
|
58
|
+
this.show && this.#e();
|
|
59
59
|
}
|
|
60
60
|
#o() {
|
|
61
61
|
this.width ? this.style.setProperty("--l-modal-width", this.width) : this.style.removeProperty("--l-modal-width");
|
package/lib/modal/modal_box.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import c from "./index.js";
|
|
2
2
|
import i from "../button/index.js";
|
|
3
|
-
import
|
|
3
|
+
import u from "../icon/close.js";
|
|
4
4
|
import d from "../icon/info.js";
|
|
5
|
-
import { regist as
|
|
6
|
-
import { $$ as
|
|
5
|
+
import { regist as p } from "../utils/index.js";
|
|
6
|
+
import { $$ as h, on as m, $one as b } from "ph-utils/dom";
|
|
7
7
|
import $ from "../form/form_item.js";
|
|
8
8
|
import C from "../input/index.js";
|
|
9
9
|
function f(t, e, o, l = "alert") {
|
|
@@ -18,10 +18,10 @@ function f(t, e, o, l = "alert") {
|
|
|
18
18
|
), n.push(
|
|
19
19
|
`<l-input placeholder="${o.placeholder || ""}"></l-input>`
|
|
20
20
|
), n.push("</l-form-item>")) : n.push(`<span>${e}</span>`);
|
|
21
|
-
let r =
|
|
21
|
+
let r = h("l-modal", {
|
|
22
22
|
cancel: `${o.showCancel}`,
|
|
23
23
|
innerHTML: n.join(""),
|
|
24
|
-
|
|
24
|
+
show: !0,
|
|
25
25
|
class: `l-modal-box l-modal-box--${l}`,
|
|
26
26
|
close: `${o.close}`,
|
|
27
27
|
"mask-closable": `${o.maskClosable}`
|
|
@@ -38,7 +38,7 @@ function f(t, e, o, l = "alert") {
|
|
|
38
38
|
"ok",
|
|
39
39
|
() => {
|
|
40
40
|
let s = !0;
|
|
41
|
-
l === "prompt" && (s =
|
|
41
|
+
l === "prompt" && (s = b(".l-modal-box l-input").value), r.removeAttribute("open"), a(s);
|
|
42
42
|
},
|
|
43
43
|
{ once: !0 }
|
|
44
44
|
), m(
|
|
@@ -52,7 +52,7 @@ function f(t, e, o, l = "alert") {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function k(t, e, o) {
|
|
55
|
-
return
|
|
55
|
+
return p([i, c, u]), new Promise((l) => {
|
|
56
56
|
const a = {
|
|
57
57
|
showCancel: !1,
|
|
58
58
|
close: 0,
|
|
@@ -64,18 +64,18 @@ function k(t, e, o) {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
function v(t, e, o) {
|
|
67
|
-
|
|
67
|
+
p([i, c, u, d]);
|
|
68
68
|
const l = {
|
|
69
69
|
showCancel: !0,
|
|
70
70
|
close: 0,
|
|
71
71
|
maskClosable: !0,
|
|
72
|
-
icon: () =>
|
|
72
|
+
icon: () => h("l-info-icon", { style: "color:#1890ff;" }),
|
|
73
73
|
...o
|
|
74
74
|
};
|
|
75
75
|
return f(e || "提示", t, l, "confirm");
|
|
76
76
|
}
|
|
77
77
|
function w(t, e, o) {
|
|
78
|
-
|
|
78
|
+
p([i, c, u, d, $, C]);
|
|
79
79
|
const l = {
|
|
80
80
|
showCancel: !0,
|
|
81
81
|
close: 0,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class PageHeader extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
showLeft?: boolean;
|
|
6
|
+
showBack: boolean;
|
|
7
|
+
backText: string;
|
|
8
|
+
pageTitle?: string;
|
|
9
|
+
pageSubTitle?: string;
|
|
10
|
+
align: "left" | "center";
|
|
11
|
+
showRight: boolean;
|
|
12
|
+
border: boolean;
|
|
13
|
+
height?: string;
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
static get observedAttributes(): string[];
|
|
16
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
17
|
+
render(): DocumentFragment;
|
|
18
|
+
afterInit(): void;
|
|
19
|
+
beforeDestroy(): void;
|
|
20
|
+
}
|