litos-ui 0.11.0 → 0.12.0

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.
@@ -1,100 +1,144 @@
1
- .l-loading:not(.l-loading-fullscreen) {
2
- position: relative;
3
- }
4
- .l-loading-mask {
5
- position: absolute;
6
- top: 0;
7
- right: 0;
8
- bottom: 0;
9
- left: 0;
10
- background: rgba(0, 0, 0, 0.6);
11
- border-radius: inherit;
12
- display: flex;
13
- justify-content: center;
14
- align-items: center;
15
- transition: opacity 0.3s ease-in-out;
16
- opacity: 0;
17
- }
18
-
19
- .l-loading-spinner {
20
- text-align: center;
21
- }
22
- .l-loading-spinner .circle {
23
- display: inline;
24
- width: 40px;
25
- height: 40px;
26
- animation: loading-rotate 1.5s linear infinite;
27
- }
28
-
29
- .l-loading-spinner .path {
30
- stroke: var(--l-primary-color, #722ed1);
31
- stroke-width: 2px;
32
- stroke-linecap: round;
33
- stroke-linejoin: round;
34
- stroke-dasharray: 90, 150;
35
- stroke-dashoffset: 0px;
36
- }
37
-
38
- .l-loading-spinner .l-loading-text {
39
- color: var(--l-primary-color, #722ed1);
40
- margin: 0;
41
- font-size: 14px;
42
- }
43
-
44
- /* 全屏组件 */
45
- .l-loading-fullscreen.l-loading-lock {
46
- overflow: hidden;
47
- }
48
- .l-loading-fullscreen > .l-loading-mask {
49
- position: fixed;
50
- z-index: 100;
51
- }
52
-
53
- /* 进度条样式 */
54
- .l-loading-bar.l-loading-mask {
55
- bottom: auto;
56
- height: 2px;
57
- border-radius: inherit;
58
- background-color: transparent;
59
- justify-content: flex-start;
60
- opacity: 1;
61
- }
62
- .l-loading-bar > .l-loading-spinner {
63
- width: 100%;
64
- height: 100%;
65
- max-width: 0;
66
- opacity: 1;
67
- transition:
68
- max-width 4s linear,
69
- background-color 0.2s linear,
70
- opacity 0.2s linear;
71
- background-color: var(--l-primary-color, #722ed1);
72
- }
73
- .l-loading-bar--start .l-loading-spinner {
74
- max-width: 90%;
75
- }
76
-
77
- .l-loading-bar--finish .l-loading-spinner {
78
- transition:
79
- max-width 0.2s linear,
80
- background-color 0.2s linear,
81
- opacity 0.2s linear;
82
- max-width: 100%;
83
- opacity: 0;
84
- }
85
-
86
- .l-loading-bar--error .l-loading-spinner {
87
- transition:
88
- max-width 0.2s linear,
89
- background-color 0.2s linear,
90
- opacity 0.2s linear;
91
- max-width: 100%;
92
- background-color: var(--l-error-color, #d03050);
93
- opacity: 0;
94
- }
95
-
96
- @keyframes loading-rotate {
97
- 100% {
98
- transform: rotate3d(0, 0, 1, 360deg);
99
- }
100
- }
1
+ .l-loading:not(.l-loading-fullscreen) {
2
+ position: relative;
3
+ }
4
+ .l-loading-mask {
5
+ position: absolute;
6
+ top: 0;
7
+ right: 0;
8
+ bottom: 0;
9
+ left: 0;
10
+ z-index: var(--l-loading-zindex, 10);
11
+ background: rgba(0, 0, 0, 0.4);
12
+ border-radius: inherit;
13
+ transition: opacity 0.3s;
14
+ opacity: 0;
15
+ }
16
+
17
+ .l-loading-spinner {
18
+ --l-loading-color: var(--l-primary-color, #722ed1);
19
+ text-align: center;
20
+ position: absolute;
21
+ z-index: calc(var(--l-loading-zindex, 10) + 1);
22
+ opacity: 0;
23
+ transition: opacity 0.3s;
24
+ display: block;
25
+ }
26
+ .l-loading-spinner.l-loading--circle {
27
+ top: 50%;
28
+ left: 50%;
29
+ transform: translate3d(-50%, -50%, 0);
30
+ }
31
+
32
+ .l-loading-spinner .circle {
33
+ display: inline;
34
+ width: 40px;
35
+ height: 40px;
36
+ animation: loading-rotate 1.5s linear infinite;
37
+ }
38
+
39
+ .l-loading-spinner .path {
40
+ stroke: var(--l-loading-color);
41
+ stroke-width: 2px;
42
+ stroke-linecap: round;
43
+ stroke-linejoin: round;
44
+ stroke-dasharray: 90, 150;
45
+ stroke-dashoffset: 0px;
46
+ }
47
+
48
+ .l-loading-spinner .l-loading-text {
49
+ color: var(--l-loading-color);
50
+ margin: 0;
51
+ font-size: 14px;
52
+ }
53
+
54
+ /* 全屏组件 */
55
+ .l-loading-fullscreen.l-loading-lock {
56
+ overflow: hidden;
57
+ --l-loading-zindex: 50;
58
+ }
59
+ .l-loading-fullscreen > .l-loading-mask {
60
+ position: fixed;
61
+ }
62
+ .l-loading-fullscreen > .l-loading-spinner {
63
+ position: fixed;
64
+ }
65
+
66
+ /* 边框风格 */
67
+ .l-loading-spinner.l-loading--border {
68
+ top: 0;
69
+ left: 0;
70
+ right: 0;
71
+ bottom: 0;
72
+ border: 2px solid var(--l-loading-color);
73
+ border-radius: inherit;
74
+ clip-path: inset(0 0 calc(100% - 2px) 0);
75
+ animation: borderLoadingAnim 5s linear infinite;
76
+ }
77
+
78
+ /* 进度条样式 */
79
+ .l-loading--bar.l-loading-spinner {
80
+ top: 0;
81
+ left: 0;
82
+ width: 100%;
83
+ height: 2px;
84
+ border-radius: inherit;
85
+ display: flex;
86
+ background-color: transparent;
87
+ justify-content: flex-start;
88
+ }
89
+ .l-loading--bar > .l-loading-progress {
90
+ width: 100%;
91
+ height: 100%;
92
+ max-width: 0;
93
+ opacity: 1;
94
+ border-radius: 1px;
95
+ transition:
96
+ max-width 4s linear,
97
+ background-color 0.2s linear,
98
+ opacity 0.2s linear;
99
+ background-color: var(--l-primary-color, #722ed1);
100
+ }
101
+ .l-loading-bar--start .l-loading-progress {
102
+ max-width: 90%;
103
+ }
104
+
105
+ .l-loading-bar--finish .l-loading-progress {
106
+ transition:
107
+ max-width 0.2s linear,
108
+ background-color 0.2s linear,
109
+ opacity 0.2s linear;
110
+ max-width: 100%;
111
+ opacity: 0;
112
+ }
113
+
114
+ .l-loading-bar--error .l-loading-spinner {
115
+ transition:
116
+ max-width 0.2s linear,
117
+ background-color 0.2s linear,
118
+ opacity 0.2s linear;
119
+ max-width: 100%;
120
+ background-color: var(--l-error-color, #d03050);
121
+ opacity: 0;
122
+ }
123
+
124
+ @keyframes loading-rotate {
125
+ 100% {
126
+ transform: rotate3d(0, 0, 1, 360deg);
127
+ }
128
+ }
129
+
130
+ @keyframes borderLoadingAnim {
131
+ 0%,
132
+ 100% {
133
+ clip-path: inset(0 0 calc(100% - 2px) 0);
134
+ }
135
+ 25% {
136
+ clip-path: inset(0 0 0 calc(100% - 2px));
137
+ }
138
+ 50% {
139
+ clip-path: inset(calc(100% - 2px) 0 0 0);
140
+ }
141
+ 75% {
142
+ clip-path: inset(0 calc(100% - 2px) 0 0);
143
+ }
144
+ }
@@ -15,7 +15,7 @@
15
15
  background: #f0faff;
16
16
  color: var(--l-primary-color, #722ed1);
17
17
  border: 1px solid #d4eeff;
18
- z-index: 1000;
18
+ z-index: 500;
19
19
  }
20
20
  .l-message .l-message-icon {
21
21
  margin-right: 5px;
@@ -0,0 +1,7 @@
1
+ .l-modal-box {
2
+ --l-modal-width: 340px;
3
+ }
4
+
5
+ .l-modal-box.l-modal-box--prompt {
6
+ --l-modal-container-padding: 5px 10px 15px 10px;
7
+ }
@@ -1,28 +0,0 @@
1
- import BaseComponent from "../base";
2
- export default class DialogContainer extends BaseComponent {
3
- #private;
4
- static baseName: string;
5
- /** 是否显示标题栏 */
6
- showHeader: boolean;
7
- /** 头部内容 */
8
- header?: string;
9
- /** 是否显示底部 */
10
- showFooter: boolean;
11
- /** 是否显示取消按钮 */
12
- showCancel: boolean;
13
- /** 取消按钮文本 */
14
- cancelText: string;
15
- /** 是否显示确定按钮 */
16
- showOk: boolean;
17
- /** 确定按钮文本 */
18
- okText: string;
19
- /** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
20
- showClose: number;
21
- containerClass?: string;
22
- connectedCallback(): void;
23
- initEvents(): void;
24
- removeEvents(): void;
25
- static get observedAttributes(): string[] | null | undefined;
26
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
27
- render(): HTMLElement[];
28
- }
@@ -1,100 +0,0 @@
1
- import p from "../base.js";
2
- import { $ as d, iterate as c, on as r, off as h, shouldEventNext as g, $one as f, $$ as e, formatClass as u } from "ph-utils/dom";
3
- import { initAttr as x } from "../utils/index.js";
4
- const C = ":host{display:block;position:relative}:host(.l-container-close-outside){padding-top:10px;padding-right:10px}.l-dialog-main{box-shadow:0 0 8px #0000001a;border-radius:5px;background-color:#fff}.l-dialog-header{padding:10px;font-size:16px;border-bottom:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));font-weight:600;display:flex;align-items:center;gap:5px}.l-dialog-footer{padding:10px;border-top:1px solid var(--l-dialog-line-color, rgba(0, 0, 0, .06));display:flex;justify-content:flex-end;gap:10px}.l-dialog-container{padding:15px 10px;font-size:14px}.l-btn-dialog-close{--nt-form-edit-height: auto;position:absolute}.l-dialog-close1{right:5px;top:6px}.l-dialog-close1::part(default){width:auto;height:auto;padding:5px;border:none;font-size:16px}.l-dialog-close2{right:0;top:0}.l-dialog-close2::part(default){width:20px;height:20px;padding:0;background-color:#fff}";
5
- class k extends p {
6
- static baseName = "dialog-container";
7
- /** 是否显示标题栏 */
8
- showHeader = !0;
9
- /** 头部内容 */
10
- header;
11
- /** 是否显示底部 */
12
- showFooter = !0;
13
- /** 是否显示取消按钮 */
14
- showCancel = !0;
15
- /** 取消按钮文本 */
16
- cancelText = "取消";
17
- /** 是否显示确定按钮 */
18
- showOk = !0;
19
- /** 确定按钮文本 */
20
- okText = "确定";
21
- /** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
22
- showClose = 1;
23
- containerClass;
24
- connectedCallback() {
25
- this.loadStyleText(C), x(this), this.showClose === 2 && this.classList.add("l-container-close-outside"), super.connectedCallback();
26
- }
27
- initEvents() {
28
- const t = d("[data-action]", this.root);
29
- c(t, (o) => {
30
- r(o, "click", this.#t);
31
- });
32
- }
33
- removeEvents() {
34
- const t = d("[data-action]", this.root);
35
- c(t, (o) => {
36
- h(o, "click", this.#t);
37
- });
38
- }
39
- #t(t) {
40
- const [o, i] = g(t, "data-action");
41
- o && this.dispatchEvent(
42
- new CustomEvent("dialogAction", {
43
- detail: { action: i },
44
- composed: !0
45
- })
46
- );
47
- }
48
- static get observedAttributes() {
49
- return ["show-close"];
50
- }
51
- attributeChangedCallback(t, o, i) {
52
- switch (t) {
53
- case "show-close":
54
- this.showClose = Number(i), this.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
55
- let s = f(".l-btn-dialog-close", this.root);
56
- this.showClose === 0 && s ? (h(s, "click", this.#t), s.remove()) : s ? s.className = this.#o() : (s = this.#e(), r(s, "click", this.#t), this.root.appendChild(s));
57
- break;
58
- }
59
- }
60
- #o() {
61
- return `l-btn-dialog-close l-dialog-close${this.showClose}`;
62
- }
63
- #e() {
64
- const t = e("l-button", {
65
- shape: "circle",
66
- type: "normal",
67
- class: this.#o(),
68
- "data-action": "close"
69
- }), o = e("l-close-icon");
70
- return t.appendChild(o), t;
71
- }
72
- render() {
73
- const t = [];
74
- this.showClose !== 0 && t.push(this.#e());
75
- const o = e("div", { class: "l-dialog-main" });
76
- if (this.showHeader) {
77
- const l = e("header", { class: "l-dialog-header" }), a = e("slot", { name: "header" });
78
- a.textContent = this.header || "", l.appendChild(a), o.appendChild(l);
79
- }
80
- const i = e("div", {
81
- class: u(["l-dialog-container", this.containerClass])
82
- }), s = e("slot");
83
- if (i.appendChild(s), o.appendChild(i), this.showFooter) {
84
- const l = e("div", { class: "l-dialog-footer" }), a = e("slot", { name: "footer" });
85
- if (this.showCancel) {
86
- const n = e("l-button", { "data-action": "cancel" });
87
- n.textContent = this.cancelText, a.appendChild(n);
88
- }
89
- if (this.showOk) {
90
- const n = e("l-button", { type: "primary", "data-action": "ok" });
91
- n.textContent = this.okText, a.appendChild(n);
92
- }
93
- l.appendChild(a), o.appendChild(l);
94
- }
95
- return t.push(o), t;
96
- }
97
- }
98
- export {
99
- k as default
100
- };
@@ -1,30 +0,0 @@
1
- type DialogProps = {
2
- /** 对话框在垂直方向位置 */
3
- verticalAlign?: "top" | "bottom" | "middle";
4
- /** css translate, 例如: 0,0,0 -> translate3d(0,0,0) */
5
- translate?: string;
6
- /** 对话框宽度 */
7
- width?: string;
8
- /** 是否在点击 esc 时关闭弹窗 */
9
- escClose?: boolean;
10
- /** 是否可以通过点击 mask 关闭对话框 */
11
- maskClosable?: boolean;
12
- /** 是否显示右上角关闭按钮, 1 - 显示在框内, 2 - 显示在框角, 0 - 不显示 */
13
- showClose?: number;
14
- };
15
- /** 初始化对话框配置 */
16
- type DialogInitialParams = DialogProps & {
17
- /** dialog 节点 */
18
- el: HTMLDialogElement | string;
19
- /** 返回 true 表明手动调用 done 关闭 */
20
- onAction?: (action: string, done: () => void) => boolean;
21
- };
22
- declare const Dialog: (option?: DialogInitialParams) => {
23
- init: (option: DialogInitialParams) => void;
24
- open: () => void;
25
- close: () => void;
26
- destroy: () => void;
27
- setProp: (key: keyof DialogProps, value: DialogProps[keyof DialogProps]) => void;
28
- setProps: (props: DialogProps) => void;
29
- };
30
- export default Dialog;
@@ -1,86 +0,0 @@
1
- import { $one as C, hasClass as v, addClass as s, getAttr as a, on as c, off as f, removeClass as $ } from "ph-utils/dom";
2
- const D = (g) => {
3
- let t, l, i;
4
- function w(e) {
5
- e.code === "Escape" && (e.preventDefault(), n());
6
- }
7
- function h(e) {
8
- t.isSameNode(e.target) && i && i.maskClosable && n();
9
- }
10
- function p(e) {
11
- const o = e.detail.action;
12
- i.onAction != null && i.onAction(o, n), n();
13
- }
14
- function u(e) {
15
- if (!i) {
16
- let o = {
17
- escClose: !0,
18
- verticalAlign: "top",
19
- maskClosable: !0,
20
- showClose: 1,
21
- ...e
22
- };
23
- if (t = C(e.el), t) {
24
- v(t, "l-dialog") || s(t, "l-dialog"), l = C("l-dialog-container", t);
25
- const r = a(t, "vertical-align");
26
- o.verticalAlign = r || "top", s(t, `l-dialog--vertical-${o.verticalAlign}`);
27
- const m = a(t, "translate") || o.translate;
28
- m && t.style.setProperty(
29
- "--l-dialog-translate",
30
- `translate3d(${m})`
31
- );
32
- const A = a(t, "width") || o.width;
33
- A && t.style.setProperty("--l-dialog-width", A);
34
- const d = a(t, "show-close", 1);
35
- d === 2 && s(t, "l-dialog-close-outside"), l && l.setAttribute("show-close", `${d}`), o.showClose = d, c(t, "keydown", w), c(t, "click", h), l && c(l, "dialogAction", p);
36
- }
37
- i = o;
38
- }
39
- }
40
- function b() {
41
- t && (t.showModal(), s(t, "l-dialog--open"), s(document.body, "l-body--dialog-open"));
42
- }
43
- function n() {
44
- t && v(t, "l-dialog--open") && (c(
45
- t,
46
- "transitionend",
47
- () => {
48
- t.close(), $(document.body, "l-body--dialog-open");
49
- },
50
- { once: !0 }
51
- ), $(t, "l-dialog--open"));
52
- }
53
- function P() {
54
- t && (n(), f(t, "keydown", w), f(t, "click", h), l && f(l, "dialogAction", p), l = void 0, t = void 0);
55
- }
56
- function y(e, o) {
57
- if (i && (i[e] = o, t))
58
- if (e === "verticalAlign") {
59
- const r = t.className.replace(
60
- /l-dialog--vertical-\w+/g,
61
- function() {
62
- return `l-dialog--vertical-${o || "top"}`;
63
- }
64
- );
65
- t.className = r;
66
- } else e === "translate" ? o ? t.style.setProperty(
67
- "--l-dialog-translate",
68
- `translate3d(${o})`
69
- ) : t.style.removeProperty("--l-dialog-translate") : e === "width" ? o ? t.style.setProperty("--l-dialog-width", o) : t.style.removeProperty("--l-dialog-width") : e === "showClose" && l && l.setAttribute("show-close", `${o}`);
70
- }
71
- function k(e) {
72
- for (const o in e)
73
- y(o, e[o]);
74
- }
75
- return g != null && u(g), {
76
- init: u,
77
- open: b,
78
- close: n,
79
- destroy: P,
80
- setProp: y,
81
- setProps: k
82
- };
83
- };
84
- export {
85
- D as default
86
- };
@@ -1,5 +0,0 @@
1
- import BaseIcon from "./base";
2
- export default class Close extends BaseIcon {
3
- static baseName: string;
4
- renderChildren(): string;
5
- }
package/lib/icon/close.js DELETED
@@ -1,10 +0,0 @@
1
- import e from "./base.js";
2
- class l extends e {
3
- static baseName = "close-icon";
4
- renderChildren() {
5
- return '<path fill="currentColor" d="M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"></path>';
6
- }
7
- }
8
- export {
9
- l as default
10
- };
@@ -1,40 +0,0 @@
1
- type LoadingInstanceParams = {
2
- /** 是否全屏显示, 默认: true */
3
- fullscreen?: boolean;
4
- /** 全屏显示时,是否隐藏滚动条; 默认: true */
5
- lock?: boolean;
6
- /** 是否为条形, 默认: false */
7
- bar?: boolean;
8
- /** 进度条挂载容器 */
9
- to?: string | HTMLElement | null;
10
- /** 显示的文本; 默认: 加载中…… */
11
- text?: string;
12
- /** 进度背景色 */
13
- background?: string;
14
- };
15
- declare class LoadingInstance {
16
- /** 加载容器 */
17
- el: HTMLElement;
18
- option: Required<Omit<LoadingInstanceParams, "to">>;
19
- constructor(option?: LoadingInstanceParams);
20
- /** 显示进度条 */
21
- show(): void;
22
- /** 隐藏进度条 */
23
- hide(): void;
24
- }
25
- declare const _default: {
26
- /** 创建并显示进度条 */
27
- create(option?: LoadingInstanceParams): LoadingInstance;
28
- /** 根据指令参数初始化进度条 */
29
- init(id?: string): void;
30
- /**
31
- * 关闭加载中的元素
32
- *
33
- * 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
34
- * 否则,将关闭所有带有 l-loading 属性的元素
35
- *
36
- * @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
37
- */
38
- close(id?: string): void;
39
- };
40
- export default _default;