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/date_picker/index.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { initAttr as l } from "../utils/index.js";
|
|
2
|
-
import n from "../form/form_inner.js";
|
|
3
|
-
import { iterate as o, formatStyle as d, $ as c, on as a, off as r, $$ as h } from "ph-utils/dom";
|
|
4
|
-
import { parse as m } from "ph-utils/date";
|
|
5
|
-
const u = ":host{display:inline-flex;align-items:center;width:var(--l-date-picker-width, auto)}.l-date-inner{height:var(--l-form-control-height, 32px);border-radius:3px;outline:none;border:1px solid var(--l-border-color, #dedede);cursor:text;padding:0 5px;flex-grow:1;transition:border-color .3s}.l-date-inner:hover{border-color:var(--l-primary-color-light1, #9254de)}.l-date-inner:focus{border-color:var(--l-primary-color, #722ed1)}.l-date-range-divider{margin:0 10px}";
|
|
6
|
-
class y extends n {
|
|
7
|
-
static baseName = "date-picker";
|
|
8
|
-
/** 是否显示日期范围选择 */
|
|
9
|
-
range = !1;
|
|
10
|
-
/** 范围选择器时,为了性能考虑, 立即改变一个日期后,会延迟 300ms 通知, 以响应其它选择器, 0 - 立即触发 */
|
|
11
|
-
emitTimeout = 300;
|
|
12
|
-
/** 原生 type 属性 */
|
|
13
|
-
type = "date";
|
|
14
|
-
width;
|
|
15
|
-
/** 日期范围 */
|
|
16
|
-
min;
|
|
17
|
-
max;
|
|
18
|
-
allowEmpty = !0;
|
|
19
|
-
#t = [];
|
|
20
|
-
#e = [];
|
|
21
|
-
#i = -1;
|
|
22
|
-
// 至上一次触发change后,是否有更改
|
|
23
|
-
#s = !1;
|
|
24
|
-
set value(t) {
|
|
25
|
-
this.setValue(t), this.#e = t.split(","), o(this.#t, (i, e) => {
|
|
26
|
-
i.value = this.#e[e];
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
connectedCallback() {
|
|
30
|
-
l(this), this.loadStyleText(u);
|
|
31
|
-
const t = {};
|
|
32
|
-
this.width && (t["--l-date-picker-width"] = this.width), this.style.cssText = d(t), super.connectedCallback();
|
|
33
|
-
}
|
|
34
|
-
afterInit() {
|
|
35
|
-
this.#t = c(".l-date-inner", this.root), a(this.#t, "change", this.#h), this.range && (a(this.#t, "focus", this.#n), a(this.#t, "blur", this.#o));
|
|
36
|
-
}
|
|
37
|
-
beforeDestroy() {
|
|
38
|
-
r(this.#t, "change", this.#h), this.range && (r(this.#t, "focus", this.#n), r(this.#t, "blur", this.#o)), this.#a();
|
|
39
|
-
}
|
|
40
|
-
attributeChange(t, i, e) {
|
|
41
|
-
t === "value" && e !== this._value && (this.value = e);
|
|
42
|
-
}
|
|
43
|
-
render() {
|
|
44
|
-
const t = document.createDocumentFragment();
|
|
45
|
-
if (t.appendChild(this.#r(0)), this.range) {
|
|
46
|
-
const i = h("span", {
|
|
47
|
-
class: "l-date-range-divider",
|
|
48
|
-
textContent: "-"
|
|
49
|
-
});
|
|
50
|
-
t.appendChild(i), t.appendChild(this.#r(1));
|
|
51
|
-
}
|
|
52
|
-
return t;
|
|
53
|
-
}
|
|
54
|
-
#r(t = 0) {
|
|
55
|
-
return h("input", {
|
|
56
|
-
type: this.type,
|
|
57
|
-
class: `l-date-inner l-date-inner${t}`,
|
|
58
|
-
name: this.getName(),
|
|
59
|
-
value: this.#e[t],
|
|
60
|
-
"l-datepicker": `${t}`,
|
|
61
|
-
disabled: this.isDisabled(),
|
|
62
|
-
min: this.min,
|
|
63
|
-
max: this.max
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
#h = (t) => {
|
|
67
|
-
const i = t.target, e = Number(i.getAttribute("l-datepicker"));
|
|
68
|
-
let s = i.value;
|
|
69
|
-
!s && !this.allowEmpty && (s = this._resetValue || "", s = s.split(",")[e], i.value = s), this.#e[e] = s, this.#e.join(",") !== this._value && (this.setValue(this.#e.join(",")), this.#s = !0), e === 0 && this.#t.length > 1 ? this.#t[1].min = s : e === 1 && (this.#t[0].max = s), this.range ? this.#l() : this.#d();
|
|
70
|
-
};
|
|
71
|
-
#a() {
|
|
72
|
-
this.#i !== -1 && (clearTimeout(this.#i), this.#i = -1);
|
|
73
|
-
}
|
|
74
|
-
#l() {
|
|
75
|
-
this.#s && (this.#a(), this.#i = setTimeout(() => {
|
|
76
|
-
this.#d(), this.#s = !1;
|
|
77
|
-
}, this.emitTimeout));
|
|
78
|
-
}
|
|
79
|
-
#n = () => {
|
|
80
|
-
this.#a();
|
|
81
|
-
};
|
|
82
|
-
#o = () => {
|
|
83
|
-
this.#l();
|
|
84
|
-
};
|
|
85
|
-
#d() {
|
|
86
|
-
this.dispatchEvent(
|
|
87
|
-
new CustomEvent("change", {
|
|
88
|
-
detail: {
|
|
89
|
-
value: this.getValue(),
|
|
90
|
-
dateStr: this.#e,
|
|
91
|
-
dates: this.#e.map((t) => m(t))
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export {
|
|
98
|
-
y as default
|
|
99
|
-
};
|