litos-ui 0.17.1 → 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.
@@ -1,98 +1,131 @@
1
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";
2
+ import { $ as c, iterate as d, on as r, off as h, shouldEventNext as g, $one as b, $$ as s, formatClass as f } from "ph-utils/dom";
4
3
  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{--l-form-control-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 {
4
+ class m extends p {
6
5
  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();
6
+ constructor() {
7
+ super(), this.version = 2, this._state = {
8
+ showHeader: !0,
9
+ showFooter: !0,
10
+ showCancel: !0,
11
+ cancelText: "取消",
12
+ showOk: !0,
13
+ okText: "确定",
14
+ showClose: 1
15
+ };
26
16
  }
27
- initEvents() {
28
- const t = d("[data-action]", this.root);
29
- c(t, (o) => {
17
+ afterInit() {
18
+ this._state.showClose === 2 && this.classList.add("l-container-close-outside");
19
+ const t = c("[data-action]", this.root);
20
+ d(t, (o) => {
30
21
  r(o, "click", this.#t);
31
22
  });
32
23
  }
33
- removeEvents() {
34
- const t = d("[data-action]", this.root);
35
- c(t, (o) => {
24
+ beforeDestroy() {
25
+ const t = c("[data-action]", this.root);
26
+ d(t, (o) => {
36
27
  h(o, "click", this.#t);
37
28
  });
38
29
  }
39
30
  #t(t) {
40
- const [o, i] = g(t, "data-action");
31
+ const [o, e] = g(t, "data-action");
41
32
  o && this.dispatchEvent(
42
33
  new CustomEvent("dialogAction", {
43
- detail: { action: i },
34
+ detail: { action: e },
44
35
  composed: !0
45
36
  })
46
37
  );
47
38
  }
48
39
  static get observedAttributes() {
49
- return ["show-close"];
40
+ return [
41
+ "show-header",
42
+ "header",
43
+ "show-footer",
44
+ "show-cancel",
45
+ "cancel-text",
46
+ "show-ok",
47
+ "ok-text",
48
+ "show-close",
49
+ "container-class"
50
+ ];
50
51
  }
51
- attributeChangedCallback(t, o, i) {
52
- if (t === "show-close") {
53
- this.showClose = Number(i), this.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
54
- let s = f(".l-btn-dialog-close", this.root);
55
- 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));
52
+ attributeChanged(t, o, e) {
53
+ switch (t) {
54
+ case "show-header":
55
+ this._state.showHeader = e !== null, this.connectedCallback();
56
+ break;
57
+ case "header":
58
+ this._state.header = e || void 0, this.connectedCallback();
59
+ break;
60
+ case "show-footer":
61
+ this._state.showFooter = e !== null, this.connectedCallback();
62
+ break;
63
+ case "show-cancel":
64
+ this._state.showCancel = e !== null, this.connectedCallback();
65
+ break;
66
+ case "cancel-text":
67
+ this._state.cancelText = e || "取消", this.connectedCallback();
68
+ break;
69
+ case "show-ok":
70
+ this._state.showOk = e !== null, this.connectedCallback();
71
+ break;
72
+ case "ok-text":
73
+ this._state.okText = e || "确定", this.connectedCallback();
74
+ break;
75
+ case "show-close":
76
+ this._state.showClose = Number(e), this._state.showClose === 2 ? this.classList.add("l-container-close-outside") : this.classList.remove("l-container-close-outside");
77
+ let a = b(".l-btn-dialog-close", this.root);
78
+ this._state.showClose === 0 && a ? (h(a, "click", this.#t), a.remove()) : a ? a.className = this.#e() : (a = this.#o(), r(a, "click", this.#t), this.root.appendChild(a));
79
+ break;
80
+ case "container-class":
81
+ this._state.containerClass = e || void 0, this.connectedCallback();
82
+ break;
56
83
  }
57
84
  }
58
- #o() {
59
- return `l-btn-dialog-close l-dialog-close${this.showClose}`;
60
- }
61
85
  #e() {
62
- const t = e("l-button", {
86
+ return `l-btn-dialog-close l-dialog-close${this._state.showClose}`;
87
+ }
88
+ #o() {
89
+ const t = s("l-button", {
63
90
  shape: "circle",
64
91
  type: "normal",
65
- class: this.#o(),
92
+ class: this.#e(),
66
93
  "data-action": "close"
67
- }), o = e("l-close-icon");
94
+ }), o = s("l-close-icon");
68
95
  return t.appendChild(o), t;
69
96
  }
97
+ render_v2() {
98
+ return {
99
+ style: C,
100
+ template: this.render()
101
+ };
102
+ }
70
103
  render() {
71
- const t = [];
72
- this.showClose !== 0 && t.push(this.#e());
73
- const o = e("div", { class: "l-dialog-main" });
74
- if (this.showHeader) {
75
- const l = e("header", { class: "l-dialog-header" }), a = e("slot", { name: "header" });
76
- a.textContent = this.header || "", l.appendChild(a), o.appendChild(l);
104
+ const t = document.createDocumentFragment();
105
+ this._state.showClose !== 0 && t.appendChild(this.#o());
106
+ const o = s("div", { class: "l-dialog-main" });
107
+ if (this._state.showHeader) {
108
+ const l = s("header", { class: "l-dialog-header" }), i = s("slot", { name: "header" });
109
+ i.textContent = this._state.header || "", l.appendChild(i), o.appendChild(l);
77
110
  }
78
- const i = e("div", {
79
- class: u(["l-dialog-container", this.containerClass])
80
- }), s = e("slot");
81
- if (i.appendChild(s), o.appendChild(i), this.showFooter) {
82
- const l = e("div", { class: "l-dialog-footer" }), a = e("slot", { name: "footer" });
83
- if (this.showCancel) {
84
- const n = e("l-button", { "data-action": "cancel" });
85
- n.textContent = this.cancelText, a.appendChild(n);
111
+ const e = s("div", {
112
+ class: f(["l-dialog-container", this._state.containerClass])
113
+ }), a = s("slot");
114
+ if (e.appendChild(a), o.appendChild(e), this._state.showFooter) {
115
+ const l = s("div", { class: "l-dialog-footer" }), i = s("slot", { name: "footer" });
116
+ if (this._state.showCancel) {
117
+ const n = s("l-button", { "data-action": "cancel" });
118
+ n.textContent = this._state.cancelText, i.appendChild(n);
86
119
  }
87
- if (this.showOk) {
88
- const n = e("l-button", { type: "primary", "data-action": "ok" });
89
- n.textContent = this.okText, a.appendChild(n);
120
+ if (this._state.showOk) {
121
+ const n = s("l-button", { type: "primary", "data-action": "ok" });
122
+ n.textContent = this._state.okText, i.appendChild(n);
90
123
  }
91
- l.appendChild(a), o.appendChild(l);
124
+ l.appendChild(i), o.appendChild(l);
92
125
  }
93
- return t.push(o), t;
126
+ return t.appendChild(o), t;
94
127
  }
95
128
  }
96
129
  export {
97
- k as default
130
+ m as default
98
131
  };
@@ -117,7 +117,7 @@ class _ extends o {
117
117
  }), this._isReset = !1;
118
118
  }
119
119
  reset() {
120
- this._isReset = !0, this.value = this._resetValue || "", console.log("reset");
120
+ this._isReset = !0, this.value = this._resetValue || "";
121
121
  }
122
122
  }
123
123
  export {
package/lib/form/index.js CHANGED
@@ -2,9 +2,9 @@ import { $one as c, formatClass as d, on as r, off as o } from "ph-utils/dom";
2
2
  import { unitNumberStr as m, parseAttrValue as f } from "../utils/index.js";
3
3
  import u from "ph-utils/validator";
4
4
  import { s as n } from "../index-CrMiSe0x.js";
5
- import v from "../base.js";
6
- const b = ":host{display:block}.l-form{display:flex;gap:20px;flex-flow:column nowrap}.l-form-inline{display:flex;gap:20px;flex-flow:row wrap}.l-form.l-form-inline{--l-form-item-display: flex}.l-form.l-form--left{--l-form-label-align: left}.l-form.l-form--top{--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}";
7
- class k extends v {
5
+ import b from "../base.js";
6
+ const v = ":host{display:block}.l-form{display:flex;gap:20px;flex-flow:column nowrap}.l-form-inline{display:flex;gap:20px;flex-flow:row wrap}.l-form.l-form-inline{--l-form-item-display: flex}.l-form.l-form--left{--l-form-label-align: left}.l-form.l-form--top{--l-form-item-display: grid;--l-form-label-align: left;--l-form-label-empty-display: none;grid-template-columns:1fr}";
7
+ class k extends b {
8
8
  static baseName = "form";
9
9
  validator;
10
10
  _data;
@@ -54,7 +54,7 @@ class k extends v {
54
54
  t.has("label-width") && (this._state.labelWidth ? this.style.setProperty("--l-form-label-width", this._state.labelWidth) : this.style.removeProperty("--l-form-label-width"));
55
55
  }
56
56
  connectedCallback() {
57
- r(this, "form-context-request", this._provide), this.loadStyleText([b]), super.connectedCallback();
57
+ r(this, "form-context-request", this._provide), this.loadStyleText([v]), super.connectedCallback();
58
58
  }
59
59
  afterInit() {
60
60
  r(this, "form-rule-change", this.ruleChange), r(this, "form-value-change", this._valueChange), r(this, "form-action", this._formAction);
@@ -121,7 +121,7 @@ class k extends v {
121
121
  this.resetCtx(t >= 100 ? 1 : t + 1);
122
122
  }
123
123
  submit() {
124
- console.log(this._state.novalidate), this._state.novalidate ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this.validate().then((t) => {
124
+ this._state.novalidate ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this.validate().then((t) => {
125
125
  t && this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() }));
126
126
  });
127
127
  }
package/lib/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./utils";
2
- export { set as addClickOutside, remove as removeClickOutside, } from "./utils/clickoutside";
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 "./date_picker";
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("./date_picker").default
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 t, kebabToCamel as r, 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";
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 to } from "./icon/refresh_left.js";
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 re } from "./list/index.js";
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 "./date_picker/index.js";
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 ot } from "./utils/popover.js";
74
- import { default as tt } from "./table/index.js";
75
- import { default as at } from "./space/index.js";
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
- re as List,
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
- to as RefreshLeftIcon,
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
- at as Space,
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
- tt as Table,
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
- t as initAttr,
155
- r as kebabToCamel,
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
- ot as updatePosition,
167
+ or as updatePosition,
166
168
  d as useId
167
169
  };
@@ -1,7 +1,5 @@
1
1
  import BaseComponent from "../base";
2
- export default class Modal extends BaseComponent {
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
- attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
32
- connectedCallback(): void;
33
- render(): void;
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 {};