litos-ui 0.15.5 → 0.15.7
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 +84 -57
- package/lib/check/checkbox.js +1 -1
- package/lib/check/radio.js +1 -1
- 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 +2 -1
- package/lib/form/form_inner.js +16 -15
- package/lib/form/form_item.d.ts +3 -1
- package/lib/form/form_item.js +19 -13
- package/lib/form/index.js +8 -6
- 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 +6 -2
- package/lib/input/index.js +70 -51
- 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/menu/index.js +46 -42
- 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 +10 -10
- package/lib/switch/index.js +4 -4
- package/lib/tabbar/index.js +1 -1
- package/lib/tabbar/item.js +1 -1
- package/lib/table/index.d.ts +46 -0
- package/lib/table/index.js +200 -0
- package/lib/table/types.d.ts +28 -0
- package/lib/table/types.js +1 -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 +77 -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 +13 -13
- 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/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
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import h from "../base.js";
|
|
2
|
+
import { kebabToCamel as n, parseAttrValue as d } from "../utils/index.js";
|
|
3
|
+
import { $$ as a, shouldEventNext as p, on as g, off as c } from "ph-utils/dom";
|
|
4
|
+
import { isBlank as r } from "ph-utils";
|
|
5
|
+
const f = ":host{display:block;box-sizing:border-box;display:flex;position:relative;align-items:center;height:var(--l-page-header-height, auto)}.l-page-header-left,.l-page-header-right{display:flex;align-items:center;flex:0 0 auto;z-index:1}.l-page-header-back{height:auto}.l-page-header-back::part(default){--l-btn-padding: 5px 0}.l-page-header-content{display:flex;align-items:center;line-height:1}.l-page-header-title{font-size:16px;font-weight:600}.l-page-header-sub-title{font-size:14px;font-weight:500;color:#999;margin-left:10px}: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{position:absolute;inset:0;justify-content:center}: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)}";
|
|
6
|
+
class w extends h {
|
|
7
|
+
static baseName = "page-header";
|
|
8
|
+
showLeft = !0;
|
|
9
|
+
showBack = !0;
|
|
10
|
+
backText = "返回";
|
|
11
|
+
pageTitle;
|
|
12
|
+
pageSubTitle;
|
|
13
|
+
align = "left";
|
|
14
|
+
showRight = !0;
|
|
15
|
+
border = !1;
|
|
16
|
+
height;
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
this.loadStyleText(f), this.classList.add(`l-page-header-align-${this.align}`), super.connectedCallback();
|
|
19
|
+
}
|
|
20
|
+
static get observedAttributes() {
|
|
21
|
+
return [
|
|
22
|
+
"show-left",
|
|
23
|
+
"show-back",
|
|
24
|
+
"back-text",
|
|
25
|
+
"page-title",
|
|
26
|
+
"page-sub-title",
|
|
27
|
+
"align",
|
|
28
|
+
"show-right",
|
|
29
|
+
"border",
|
|
30
|
+
"height"
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
attributeChangedCallback(t, i, l) {
|
|
34
|
+
t = n(t);
|
|
35
|
+
const e = d(
|
|
36
|
+
l,
|
|
37
|
+
this[t],
|
|
38
|
+
t
|
|
39
|
+
);
|
|
40
|
+
switch (e !== this[t] && (this[t] = e), t) {
|
|
41
|
+
case "border":
|
|
42
|
+
e ? this.classList.add("l-page-header-border") : this.classList.remove("l-page-header-border");
|
|
43
|
+
break;
|
|
44
|
+
case "height":
|
|
45
|
+
e && this.style.setProperty("--l-page-header-height", e);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const t = document.createDocumentFragment();
|
|
51
|
+
if (this.showLeft) {
|
|
52
|
+
const e = a("div", { class: "l-page-header-left" });
|
|
53
|
+
if (this.showBack) {
|
|
54
|
+
const o = a("l-button", {
|
|
55
|
+
text: !0,
|
|
56
|
+
class: "l-page-header-back",
|
|
57
|
+
"l-action": "back",
|
|
58
|
+
innerHTML: `<l-arrow-left-icon></l-arrow-left-icon><span>${this.backText}</span>`
|
|
59
|
+
});
|
|
60
|
+
e.appendChild(o);
|
|
61
|
+
}
|
|
62
|
+
const s = a("slot", { name: "left" });
|
|
63
|
+
e.appendChild(s), t.appendChild(e);
|
|
64
|
+
}
|
|
65
|
+
const i = a("div", {
|
|
66
|
+
class: "l-page-header-content"
|
|
67
|
+
});
|
|
68
|
+
if (!r(this.pageTitle)) {
|
|
69
|
+
const e = a("div", {
|
|
70
|
+
class: "l-page-header-title",
|
|
71
|
+
innerHTML: this.pageTitle
|
|
72
|
+
});
|
|
73
|
+
i.appendChild(e);
|
|
74
|
+
}
|
|
75
|
+
if (!r(this.pageSubTitle)) {
|
|
76
|
+
const e = a("div", {
|
|
77
|
+
class: "l-page-header-sub-title",
|
|
78
|
+
innerHTML: this.pageSubTitle
|
|
79
|
+
});
|
|
80
|
+
i.appendChild(e);
|
|
81
|
+
}
|
|
82
|
+
const l = a("slot");
|
|
83
|
+
if (i.appendChild(l), t.appendChild(i), this.showRight) {
|
|
84
|
+
const e = a("div", { class: "l-page-header-right" }), s = a("slot", { name: "right" });
|
|
85
|
+
e.appendChild(s), t.appendChild(e);
|
|
86
|
+
}
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
#e = (t) => {
|
|
90
|
+
const [i, l, e] = p(
|
|
91
|
+
t,
|
|
92
|
+
"l-action",
|
|
93
|
+
this.root
|
|
94
|
+
);
|
|
95
|
+
if (i) {
|
|
96
|
+
const s = e.dataset;
|
|
97
|
+
this.emit("action", { detail: { action: l, ...s } });
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
afterInit() {
|
|
101
|
+
g(this.root, "click", this.#e);
|
|
102
|
+
}
|
|
103
|
+
beforeDestroy() {
|
|
104
|
+
c(this.root, "click", this.#e);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
w as default
|
|
109
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import BaseComponent from "../base";
|
|
2
|
+
export default class Pagination extends BaseComponent {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
/** 数据总数 */
|
|
6
|
+
total?: number;
|
|
7
|
+
/** 总页数 */
|
|
8
|
+
pageCount?: number;
|
|
9
|
+
/** 每页显示条目个数 */
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
/** 对齐方式 */
|
|
12
|
+
align?: "start" | "center" | "end";
|
|
13
|
+
/** 是否为简单分页 */
|
|
14
|
+
simple?: boolean;
|
|
15
|
+
/** 单页隐藏 */
|
|
16
|
+
hideOnSinglePage?: boolean;
|
|
17
|
+
get current(): number;
|
|
18
|
+
set current(current: number);
|
|
19
|
+
setCurrent(current: number): void;
|
|
20
|
+
connectedCallback(): void;
|
|
21
|
+
static get observedAttributes(): string[] | null | undefined;
|
|
22
|
+
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
23
|
+
rerender(): void;
|
|
24
|
+
render(): string;
|
|
25
|
+
afterInit(): void;
|
|
26
|
+
beforeDestroy(): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import c from "../base.js";
|
|
2
|
+
import { kebabToCamel as p, parseAttrValue as h, tagAttr as g } from "../utils/index.js";
|
|
3
|
+
import { $one as r, on as s, off as l, shouldEventNext as u, formatClass as d } from "ph-utils/dom";
|
|
4
|
+
const m = ":host{white-space:nowrap;font-size:14px;line-height:1;color:#333}.l-pagination{display:flex;align-items:center;justify-content:var(--l-pagination-justify-content, flex-start)}.l-pagination-item{width:30px;height:30px;box-sizing:border-box}.l-pagination-item+.l-pagination-item{margin-left:5px}.l-pagination--btn{--l-btn-padding: 0}.l-pagination--link{display:inline-flex;justify-content:center;align-items:center;text-decoration:none;transition:color .3s,border-color .3s;border:1px solid transparent;border-radius:3px;color:#666;cursor:pointer}.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{display:inline-flex;align-items:center;width:auto}.l-pagination-simple-input{--l-form-control-height: 30px;box-sizing:border-box;width:60px;text-align:center}.l-pagination-simple-divide{margin:0 5px}";
|
|
5
|
+
class k extends c {
|
|
6
|
+
static baseName = "pagination";
|
|
7
|
+
/** 数据总数 */
|
|
8
|
+
total;
|
|
9
|
+
/** 总页数 */
|
|
10
|
+
pageCount;
|
|
11
|
+
/** 每页显示条目个数 */
|
|
12
|
+
pageSize = 10;
|
|
13
|
+
/** 对齐方式 */
|
|
14
|
+
align;
|
|
15
|
+
/** 是否为简单分页 */
|
|
16
|
+
simple = !1;
|
|
17
|
+
/** 单页隐藏 */
|
|
18
|
+
hideOnSinglePage = !1;
|
|
19
|
+
/** 当前页码 */
|
|
20
|
+
#e = 1;
|
|
21
|
+
/** 总页数 */
|
|
22
|
+
#t = 0;
|
|
23
|
+
get current() {
|
|
24
|
+
return this.#e;
|
|
25
|
+
}
|
|
26
|
+
set current(t) {
|
|
27
|
+
this.setCurrent(t);
|
|
28
|
+
}
|
|
29
|
+
setCurrent(t) {
|
|
30
|
+
t !== this.#e && (this.#e = t, this.rerender());
|
|
31
|
+
}
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
this.loadStyleText(m), super.connectedCallback();
|
|
34
|
+
}
|
|
35
|
+
static get observedAttributes() {
|
|
36
|
+
return [
|
|
37
|
+
"align",
|
|
38
|
+
"current",
|
|
39
|
+
"page-count",
|
|
40
|
+
"total",
|
|
41
|
+
"hide-on-single-page",
|
|
42
|
+
"simple"
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
attributeChangedCallback(t, e, n) {
|
|
46
|
+
t = p(t);
|
|
47
|
+
const i = h(
|
|
48
|
+
n,
|
|
49
|
+
this[t],
|
|
50
|
+
t
|
|
51
|
+
);
|
|
52
|
+
if (i !== this[t])
|
|
53
|
+
switch (this[t] = i, t) {
|
|
54
|
+
case "align":
|
|
55
|
+
this.style.setProperty(
|
|
56
|
+
"--l-pagination-justify-content",
|
|
57
|
+
i === "center" ? i : `flex-${i}`
|
|
58
|
+
);
|
|
59
|
+
break;
|
|
60
|
+
case "total":
|
|
61
|
+
case "page-count":
|
|
62
|
+
this.#t = this.#c();
|
|
63
|
+
break;
|
|
64
|
+
case "simple":
|
|
65
|
+
case "hide-on-single-page":
|
|
66
|
+
this.rendered && this.rerender();
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
rerender() {
|
|
71
|
+
const t = r(".l-pagination", this.root);
|
|
72
|
+
t && (this.#s(), t.innerHTML = this.#a(), this.#r());
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
return `<div class="l-pagination">${this.#a()}</div>`;
|
|
76
|
+
}
|
|
77
|
+
afterInit() {
|
|
78
|
+
s(this.root, "click", this.#n), this.#r();
|
|
79
|
+
}
|
|
80
|
+
beforeDestroy() {
|
|
81
|
+
l(this.root, "click", this.#n), this.#s();
|
|
82
|
+
}
|
|
83
|
+
#n = (t) => {
|
|
84
|
+
const [e, n] = u(t, "data-page", this.root);
|
|
85
|
+
if (e) {
|
|
86
|
+
let i = Number(n);
|
|
87
|
+
i = Math.min(this.#t, Math.max(1, i)), i !== this.current && (this.setCurrent(i), this.emit("change", {
|
|
88
|
+
detail: {
|
|
89
|
+
current: i,
|
|
90
|
+
pageSize: this.pageSize || 10,
|
|
91
|
+
totalPage: this.#t
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
#c() {
|
|
97
|
+
let t = this.pageCount;
|
|
98
|
+
return t == null && this.total != null && (t = Math.ceil(this.total / (this.pageSize || 10))), (t == null || t <= 0) && (t = 1), t;
|
|
99
|
+
}
|
|
100
|
+
#a() {
|
|
101
|
+
if (this.#t <= 1) return "";
|
|
102
|
+
const t = [];
|
|
103
|
+
if (t.push(
|
|
104
|
+
this.#i("l-button", {
|
|
105
|
+
title: "上一页",
|
|
106
|
+
disabled: this.current === 1,
|
|
107
|
+
"data-page": this.current - 1,
|
|
108
|
+
innerHTML: "<l-arrow-left-icon></l-arrow-left-icon>",
|
|
109
|
+
class: ["l-pagination-item", "l-pagination--btn", "prev-btn"]
|
|
110
|
+
})
|
|
111
|
+
), this.simple)
|
|
112
|
+
t.push(
|
|
113
|
+
this.#i("div", {
|
|
114
|
+
class: ["l-pagination-item", "l-pagination-simple-layout"],
|
|
115
|
+
innerHTML: [
|
|
116
|
+
this.#i("l-input", {
|
|
117
|
+
inputmode: "numeric",
|
|
118
|
+
value: `${this.current}`,
|
|
119
|
+
class: ["l-pagination-simple-input"],
|
|
120
|
+
"allow-input": "integer"
|
|
121
|
+
}),
|
|
122
|
+
'<span class="l-pagination-simple-divide">/</span>',
|
|
123
|
+
`<span>${this.#t}</span>`
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
else {
|
|
128
|
+
t.push(
|
|
129
|
+
this.#i("a", {
|
|
130
|
+
title: "1",
|
|
131
|
+
innerHTML: "1",
|
|
132
|
+
class: [
|
|
133
|
+
"l-pagination-item",
|
|
134
|
+
"l-pagination--link",
|
|
135
|
+
this.current === 1 ? "active" : ""
|
|
136
|
+
],
|
|
137
|
+
"data-page": "1"
|
|
138
|
+
})
|
|
139
|
+
), this.current > 4 && t.push(
|
|
140
|
+
this.#i("a", {
|
|
141
|
+
title: "上5页",
|
|
142
|
+
innerHTML: [
|
|
143
|
+
"<l-d-arrow-left-icon class='darrow-icon'></l-d-arrow-left-icon>",
|
|
144
|
+
"<l-more-icon class='more-icon'></l-more-icon>"
|
|
145
|
+
],
|
|
146
|
+
class: ["l-pagination-item", "l-pagination--link"],
|
|
147
|
+
"data-page": `${this.current - 5}`
|
|
148
|
+
})
|
|
149
|
+
);
|
|
150
|
+
let e = Math.max(this.current - 2, 1), n = Math.min(this.current + 2, this.#t), i = n - e;
|
|
151
|
+
i < 4 && (n = Math.min(this.#t, n + i)), i = n - e, i < 4 && (e = Math.max(1, e - i));
|
|
152
|
+
for (let a = e; a <= n; a++)
|
|
153
|
+
if (!(a <= 1)) {
|
|
154
|
+
if (a >= this.#t) break;
|
|
155
|
+
t.push(
|
|
156
|
+
this.#i("a", {
|
|
157
|
+
title: `${a}`,
|
|
158
|
+
innerHTML: `${a}`,
|
|
159
|
+
class: [
|
|
160
|
+
"l-pagination-item",
|
|
161
|
+
"l-pagination--link",
|
|
162
|
+
this.current === a ? "active" : ""
|
|
163
|
+
],
|
|
164
|
+
"data-page": `${a}`
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
this.current < this.#t - 3 && t.push(
|
|
169
|
+
this.#i("a", {
|
|
170
|
+
title: "下5页",
|
|
171
|
+
innerHTML: [
|
|
172
|
+
"<l-d-arrow-right-icon class='darrow-icon'></l-d-arrow-right-icon>",
|
|
173
|
+
"<l-more-icon class='more-icon'></l-more-icon>"
|
|
174
|
+
],
|
|
175
|
+
class: ["l-pagination-item", "l-pagination--link"],
|
|
176
|
+
"data-page": `${this.current + 5}`
|
|
177
|
+
})
|
|
178
|
+
), this.#t > 1 && t.push(
|
|
179
|
+
this.#i("a", {
|
|
180
|
+
title: `${this.#t}`,
|
|
181
|
+
innerHTML: `${this.#t}`,
|
|
182
|
+
class: [
|
|
183
|
+
"l-pagination-item",
|
|
184
|
+
"l-pagination--link",
|
|
185
|
+
this.current === this.#t ? "active" : ""
|
|
186
|
+
],
|
|
187
|
+
"data-page": `${this.#t}`
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
return t.push(
|
|
192
|
+
this.#i("l-button", {
|
|
193
|
+
title: `${this.current + 1}`,
|
|
194
|
+
innerHTML: "<l-arrow-right-icon></l-arrow-right-icon>",
|
|
195
|
+
class: ["l-pagination-item", "l-pagination--btn", "next-btn"],
|
|
196
|
+
disabled: this.current === this.#t,
|
|
197
|
+
"data-page": `${this.current + 1}`
|
|
198
|
+
})
|
|
199
|
+
), t.join("");
|
|
200
|
+
}
|
|
201
|
+
#r() {
|
|
202
|
+
const t = r(".l-pagination-simple-input", this.root);
|
|
203
|
+
t && (t.setParser(this.#p), s(t, "keyup", this.#o), s(t, "blur", this.#l));
|
|
204
|
+
}
|
|
205
|
+
#s() {
|
|
206
|
+
const t = r(".l-pagination-simple-input", this.root);
|
|
207
|
+
t && (t.setParser(void 0), l(t, "keyup", this.#o), l(t, "blur", this.#l));
|
|
208
|
+
}
|
|
209
|
+
#l = (t) => {
|
|
210
|
+
const e = t.target, n = e.value;
|
|
211
|
+
if (!n) {
|
|
212
|
+
e.value = `${this.current}`;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
this.setCurrent(Number(n));
|
|
216
|
+
};
|
|
217
|
+
#o = (t) => {
|
|
218
|
+
if (t.key === "Enter") {
|
|
219
|
+
const n = t.target.value;
|
|
220
|
+
if (n) {
|
|
221
|
+
const i = Number(n);
|
|
222
|
+
this.setCurrent(i);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
#p = (t) => {
|
|
227
|
+
if (t) {
|
|
228
|
+
let e = Number(t);
|
|
229
|
+
e = Math.max(1, Math.min(this.#t, e)), t = String(e);
|
|
230
|
+
}
|
|
231
|
+
return t;
|
|
232
|
+
};
|
|
233
|
+
#i(t = "a", e) {
|
|
234
|
+
let n = [], i = "";
|
|
235
|
+
for (const a in e)
|
|
236
|
+
if (a === "innerHTML")
|
|
237
|
+
i = e[a], Array.isArray(i) && (i = i.join(""));
|
|
238
|
+
else if (a === "class") {
|
|
239
|
+
const o = e.class;
|
|
240
|
+
n.push(` class="${d(o)}"`);
|
|
241
|
+
} else
|
|
242
|
+
n.push(g(a, e[a]));
|
|
243
|
+
return `<${t}${n.join("")}>${i}</${t}>`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
export {
|
|
247
|
+
k as default
|
|
248
|
+
};
|
package/lib/qrcode/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import s from "../base.js";
|
|
2
2
|
import { QRCodeRender as o, renderToCanvas as r } from "qrcode-generator-es";
|
|
3
3
|
import { $one as c } from "ph-utils/dom";
|
|
4
|
-
const
|
|
4
|
+
const d = ":host{display:inline-flex}.renderer-el{display:inline-flex}";
|
|
5
5
|
class f extends s {
|
|
6
6
|
static baseName = "qrcode";
|
|
7
7
|
/** 二维码内容 */
|
|
@@ -16,7 +16,7 @@ class f extends s {
|
|
|
16
16
|
icon;
|
|
17
17
|
_qrcode;
|
|
18
18
|
connectedCallback() {
|
|
19
|
-
this.loadStyleText(
|
|
19
|
+
this.loadStyleText(d), super.connectedCallback();
|
|
20
20
|
}
|
|
21
21
|
static get observedAttributes() {
|
|
22
22
|
return ["text", "fill", "size", "level", "icon"];
|
|
@@ -28,7 +28,7 @@ class f extends s {
|
|
|
28
28
|
this.#e();
|
|
29
29
|
}
|
|
30
30
|
beforeDestroy() {
|
|
31
|
-
this._qrcode = void 0;
|
|
31
|
+
this._qrcode && (this._qrcode.destroy(), this._qrcode = void 0);
|
|
32
32
|
}
|
|
33
33
|
#t(e, t) {
|
|
34
34
|
this._qrcode && (e === "icon" ? this._qrcode.option.icon = t ? { src: t } : void 0 : this._qrcode.option[e] = t);
|
|
@@ -36,7 +36,7 @@ class f extends s {
|
|
|
36
36
|
#e() {
|
|
37
37
|
if (!this._qrcode) {
|
|
38
38
|
const e = c("canvas", this.root);
|
|
39
|
-
e && (
|
|
39
|
+
e && (this._qrcode = new o({
|
|
40
40
|
renderFn: r,
|
|
41
41
|
text: this.text,
|
|
42
42
|
size: Number(this.size),
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import FormInner from "../form/form_inner";
|
|
2
|
+
type SelectOption = {
|
|
3
|
+
class?: string;
|
|
4
|
+
render?: (option: SelectOption, isSelect: boolean, selectedValues?: any | any[]) => HTMLElement | DocumentFragment;
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: any;
|
|
7
|
+
[index: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export default class Select extends FormInner {
|
|
10
|
+
static baseName: string;
|
|
11
|
+
/** 选中的标签 */
|
|
12
|
+
selectedLabels: string[];
|
|
13
|
+
/** 是否启用过滤 */
|
|
14
|
+
filterable?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** 选项 label 的字段名 */
|
|
17
|
+
labelField: string;
|
|
18
|
+
/** 选项 value 的字段名 */
|
|
19
|
+
valueField: string;
|
|
20
|
+
/** 是否支持多选 */
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
/** 多选时是否折叠标签 */
|
|
23
|
+
collapseTags?: boolean;
|
|
24
|
+
/** 是否加载中, 远程搜索时使用 */
|
|
25
|
+
_loading?: boolean;
|
|
26
|
+
/** 宽度 */
|
|
27
|
+
width?: string;
|
|
28
|
+
/** 是否可清除 */
|
|
29
|
+
clearable?: boolean;
|
|
30
|
+
/** 是否展开下拉选择 */
|
|
31
|
+
_expanded: boolean;
|
|
32
|
+
remote: boolean;
|
|
33
|
+
filter?: (match: string, option: SelectOption) => boolean;
|
|
34
|
+
options?: SelectOption[];
|
|
35
|
+
private _backOptions?;
|
|
36
|
+
inputHandler?: (match: string) => void;
|
|
37
|
+
private _popover?;
|
|
38
|
+
private _searchEl?;
|
|
39
|
+
constructor();
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
setInputHandler(handler: (match: string) => void): void;
|
|
42
|
+
setFilter(filter: (match: string, option: SelectOption) => boolean): void;
|
|
43
|
+
get loading(): boolean | undefined;
|
|
44
|
+
set loading(loading: boolean | undefined);
|
|
45
|
+
setLoading(loading: boolean): void;
|
|
46
|
+
private get expanded();
|
|
47
|
+
private set expanded(value);
|
|
48
|
+
setExpanded(value: boolean): void;
|
|
49
|
+
setValue(value: string | string[] | number): void;
|
|
50
|
+
private _updateSelectedLabels;
|
|
51
|
+
static get observedAttributes(): string[];
|
|
52
|
+
protected attributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
53
|
+
setOptions(options: any[]): void;
|
|
54
|
+
private _isOptionSelect;
|
|
55
|
+
private _updateOptionSelect;
|
|
56
|
+
private _renderOption;
|
|
57
|
+
private _calculateOffset;
|
|
58
|
+
isEmpty(): boolean;
|
|
59
|
+
private _toggleClearable;
|
|
60
|
+
private _onMouseEnter;
|
|
61
|
+
private _onMouseLeave;
|
|
62
|
+
private _togglePopover;
|
|
63
|
+
private _updatePopoverContent;
|
|
64
|
+
private _onRootTap;
|
|
65
|
+
private _onTap;
|
|
66
|
+
private _onSearchBlur;
|
|
67
|
+
private _onSearchInput;
|
|
68
|
+
private _handleFilte;
|
|
69
|
+
private _filteOption;
|
|
70
|
+
afterInit(): void;
|
|
71
|
+
beforeDestroy(): void;
|
|
72
|
+
render(): DocumentFragment;
|
|
73
|
+
protected disabledChange(): void;
|
|
74
|
+
private _renderTag;
|
|
75
|
+
private _reRenderLabels;
|
|
76
|
+
private _updateSearchValue;
|
|
77
|
+
private _renderSelectedLabels;
|
|
78
|
+
}
|
|
79
|
+
export {};
|