litos-ui 0.17.4 → 0.18.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.
Files changed (161) hide show
  1. package/README.md +49 -49
  2. package/lib/animation-CTt9qgA7.js +4 -0
  3. package/lib/base-Dm0WS1pK.js +62 -0
  4. package/lib/base.js +111 -147
  5. package/lib/button/index.d.ts +8 -3
  6. package/lib/button/index.js +2 -137
  7. package/lib/button-CC5PmAb1.js +146 -0
  8. package/lib/calendar/index.d.ts +15 -4
  9. package/lib/calendar/index.js +2 -95
  10. package/lib/calendar-DeP6yZB0.js +149 -0
  11. package/lib/carousel/index.js +2 -280
  12. package/lib/carousel/item.js +2 -15
  13. package/lib/carousel-D4Fe3LEx.js +272 -0
  14. package/lib/check/checkbox.js +2 -18
  15. package/lib/check/checkbox_group.js +6 -6
  16. package/lib/check/radio.js +2 -15
  17. package/lib/check/radio_group.js +9 -9
  18. package/lib/check-B0XraJvb.js +73 -0
  19. package/lib/check-CvGaONEx.js +117 -0
  20. package/lib/checkbox-DbWsmAaL.js +16 -0
  21. package/lib/collapse/index.d.ts +18 -11
  22. package/lib/collapse/index.js +2 -88
  23. package/lib/collapse/item.d.ts +28 -9
  24. package/lib/collapse/item.js +2 -115
  25. package/lib/collapse/types.d.ts +7 -0
  26. package/lib/collapse-CeKRZ-43.js +104 -0
  27. package/lib/color_picker/index.js +2 -42
  28. package/lib/color_picker-D0brKFm-.js +41 -0
  29. package/lib/date_picker/index.d.ts +23 -0
  30. package/lib/date_picker/index.js +3 -0
  31. package/lib/date_picker-DQGoiN8v.js +103 -0
  32. package/lib/date_picker_ori/index.js +2 -129
  33. package/lib/date_picker_ori-aRuSSi9D.js +122 -0
  34. package/lib/description_panel/index.js +2 -66
  35. package/lib/description_panel-Df_8rVbX.js +57 -0
  36. package/lib/dialog/dialog_container.js +2 -131
  37. package/lib/dialog/index.js +67 -85
  38. package/lib/dialog_container-DcN87wj0.js +126 -0
  39. package/lib/esm-sVEoAVPu.js +244 -0
  40. package/lib/form/form_item.d.ts +1 -0
  41. package/lib/form/form_item.js +2 -136
  42. package/lib/form/index.js +2 -147
  43. package/lib/form-DdU0yK0k.js +154 -0
  44. package/lib/form_inner-DR9tyB_r.js +117 -0
  45. package/lib/form_item-Bv-YafZK.js +137 -0
  46. package/lib/icon/arrow_down.js +12 -12
  47. package/lib/icon/arrow_left.js +9 -9
  48. package/lib/icon/arrow_right.js +9 -9
  49. package/lib/icon/arrow_up.js +12 -12
  50. package/lib/icon/base.d.ts +16 -2
  51. package/lib/icon/base.js +2 -38
  52. package/lib/icon/calendar.d.ts +5 -0
  53. package/lib/icon/calendar.js +10 -0
  54. package/lib/icon/caret_bottom.js +9 -9
  55. package/lib/icon/caret_top.js +9 -9
  56. package/lib/icon/close.js +9 -9
  57. package/lib/icon/close_filled.js +12 -12
  58. package/lib/icon/d_arrow_left.js +12 -12
  59. package/lib/icon/d_arrow_right.js +12 -12
  60. package/lib/icon/font_icon.d.ts +2 -3
  61. package/lib/icon/font_icon.js +35 -39
  62. package/lib/icon/info.js +12 -12
  63. package/lib/icon/loading.js +9 -9
  64. package/lib/icon/moon.js +12 -12
  65. package/lib/icon/more.js +12 -12
  66. package/lib/icon/reduction.js +12 -12
  67. package/lib/icon/refresh.d.ts +5 -0
  68. package/lib/icon/refresh.js +10 -0
  69. package/lib/icon/refresh_left.js +12 -12
  70. package/lib/icon/refresh_right.js +9 -9
  71. package/lib/icon/search.js +9 -9
  72. package/lib/icon/select.js +12 -12
  73. package/lib/icon/sort.js +9 -9
  74. package/lib/icon/success.js +12 -12
  75. package/lib/icon/sun.js +12 -12
  76. package/lib/icon/theme_default.js +12 -12
  77. package/lib/icon/warn.js +12 -12
  78. package/lib/icon/zoom_in.js +12 -12
  79. package/lib/icon/zoom_out.js +12 -12
  80. package/lib/image/image_preview.js +2 -104
  81. package/lib/image/index.js +2 -176
  82. package/lib/image-CeQVfS-v.js +162 -0
  83. package/lib/image_preview-PzZzwo6m.js +92 -0
  84. package/lib/index.d.ts +10 -4
  85. package/lib/index.js +80 -169
  86. package/lib/input/index.d.ts +6 -2
  87. package/lib/input/index.js +188 -203
  88. package/lib/input-DjKxcxry.js +4 -0
  89. package/lib/input_inner-BKJg9n9A.js +4 -0
  90. package/lib/item-Cuw_ZPyn.js +14 -0
  91. package/lib/item-DV842Aux.js +57 -0
  92. package/lib/item-ZXLWFzSm.js +119 -0
  93. package/lib/list/index.js +2 -58
  94. package/lib/list-CU7vHS6s.js +51 -0
  95. package/lib/loading/index.d.ts +4 -2
  96. package/lib/loading/index.js +109 -123
  97. package/lib/mask/index.js +2 -105
  98. package/lib/mask-BlV5QfTj.js +112 -0
  99. package/lib/md_input/index.js +2 -60
  100. package/lib/md_input-DSQx5TMW.js +58 -0
  101. package/lib/menu/index.js +2 -105
  102. package/lib/menu/menu_item.js +2 -21
  103. package/lib/menu/sub_menu.js +2 -83
  104. package/lib/menu-DAtplYAH.js +91 -0
  105. package/lib/menu_item-BW1Tu11Q.js +20 -0
  106. package/lib/message/index.js +67 -60
  107. package/lib/modal/index.js +2 -196
  108. package/lib/modal/modal_box.js +87 -86
  109. package/lib/modal-DWyWrN-D.js +192 -0
  110. package/lib/page_header/index.js +2 -109
  111. package/lib/page_header-DdeRDN4U.js +101 -0
  112. package/lib/pagination/index.js +2 -248
  113. package/lib/pagination-BoPzSPjT.js +210 -0
  114. package/lib/polygon/index.js +2 -27
  115. package/lib/polygon-C4Ow2lxi.js +20 -0
  116. package/lib/qrcode/index.d.ts +13 -4
  117. package/lib/qrcode/index.js +2 -57
  118. package/lib/qrcode-BFxsD_OP.js +64 -0
  119. package/lib/radio-2mNSYujz.js +13 -0
  120. package/lib/select/index.js +3 -401
  121. package/lib/select-CAgggYh7.js +326 -0
  122. package/lib/select_ori/index.js +47 -50
  123. package/lib/space/index.js +2 -35
  124. package/lib/space-CpTmBfHP.js +38 -0
  125. package/lib/sub_menu-D1s8ABNu.js +75 -0
  126. package/lib/switch/index.js +2 -50
  127. package/lib/switch-BaVBi5Ip.js +48 -0
  128. package/lib/tabbar/index.js +2 -109
  129. package/lib/tabbar/item.js +2 -58
  130. package/lib/tabbar-4_d2Fj1n.js +91 -0
  131. package/lib/table/index.js +2 -269
  132. package/lib/table-Hifj8jAX.js +234 -0
  133. package/lib/tabs/index.js +38 -42
  134. package/lib/tag/index.js +2 -72
  135. package/lib/tag-DPENZf_V.js +76 -0
  136. package/lib/theme/index.js +2 -89
  137. package/lib/theme/theme_color.js +22 -26
  138. package/lib/theme-BRTI2-Yk.js +83 -0
  139. package/lib/utils/clickoutside.js +18 -18
  140. package/lib/utils/context_provide.js +21 -21
  141. package/lib/utils/event.js +13 -18
  142. package/lib/utils/index.js +55 -58
  143. package/lib/utils/popover.d.ts +4 -1
  144. package/lib/utils/popover.js +276 -352
  145. package/lib/utils/transition.js +33 -31
  146. package/package.json +10 -11
  147. package/styles/container.css +4 -0
  148. package/styles/datepicker.css +55 -0
  149. package/styles/popover.css +14 -1
  150. package/lib/animation-DttknHkX.js +0 -4
  151. package/lib/calendar/langs.js +0 -8
  152. package/lib/carousel/timer.js +0 -19
  153. package/lib/check/check.js +0 -118
  154. package/lib/check/index.js +0 -68
  155. package/lib/check-CksURvTv.js +0 -4
  156. package/lib/form/form_inner.js +0 -125
  157. package/lib/form/types.js +0 -1
  158. package/lib/index-CrMiSe0x.js +0 -249
  159. package/lib/index-DY6m9Wbe.js +0 -4
  160. package/lib/litos-ui.css +0 -1
  161. package/lib/table/types.js +0 -1
package/lib/form/index.js CHANGED
@@ -1,147 +1,2 @@
1
- import { $one as c, formatClass as d, on as r, off as o } from "ph-utils/dom";
2
- import { unitNumberStr as m, parseAttrValue as f } from "../utils/index.js";
3
- import u from "ph-utils/validator";
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:var(--l-form-gap, 20px);flex-flow:column nowrap}.l-form-inline{display:flex;gap:var(--l-form-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 {
8
- static baseName = "form";
9
- validator;
10
- _data;
11
- context;
12
- errors;
13
- // 验证错误
14
- resetCtx;
15
- constructor() {
16
- super(), this._state = {
17
- /** 是否行内表单 */
18
- inline: !1,
19
- labelPosition: "right",
20
- labelWidth: "80px",
21
- novalidate: !1
22
- }, this.validator = new u([]), this.context = n({ innerBlock: !1 }), this.errors = n({}), this.resetCtx = n(0);
23
- }
24
- static get observedAttributes() {
25
- return ["label-position", "inner-block", "inline", "novalidate", "label-width"];
26
- }
27
- attributeChanged(t, i, e) {
28
- switch (t) {
29
- case "label-position":
30
- this._state.labelPosition = e;
31
- break;
32
- case "inner-block":
33
- const a = f(e, !1, t);
34
- this.context({ innerBlock: a });
35
- break;
36
- case "label-width":
37
- this._state.labelWidth = m(e);
38
- break;
39
- default:
40
- const s = f(e, !1, t);
41
- this._state[t] = s;
42
- break;
43
- }
44
- }
45
- updateDOM(t) {
46
- if (t.has("label-position") || t.has("inline")) {
47
- const i = c("form", this.root);
48
- i && (i.className = d([
49
- "l-form",
50
- this._state.inline ? "l-form-inline" : void 0,
51
- `l-form--${this._state.labelPosition}`
52
- ]));
53
- }
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
- }
56
- connectedCallback() {
57
- r(this, "form-context-request", this._provide), this.loadStyleText([b]), super.connectedCallback();
58
- }
59
- afterInit() {
60
- r(this, "form-rule-change", this.ruleChange), r(this, "form-value-change", this._valueChange), r(this, "form-action", this._formAction);
61
- }
62
- disconnectedCallback() {
63
- this.validator = void 0, o(this, "form-rule-change", this.ruleChange), o(this, "form-value-change", this._valueChange), o(this, "form-context-request", this._provide), o(this, "form-action", this._formAction), super.disconnectedCallback();
64
- }
65
- render() {
66
- const t = d([
67
- "l-form",
68
- this._state.inline ? "l-form-inline" : void 0,
69
- `l-form--${this._state.labelPosition}`
70
- ]);
71
- return this._state.labelWidth && this.style.setProperty("--l-form-label-width", this._state.labelWidth), `<form class="${t}"><slot></slot></form>`;
72
- }
73
- ruleChange = (t) => {
74
- t.stopPropagation(), this.validator.addSchema(t.detail);
75
- };
76
- _provide(t) {
77
- const { context: i, callback: e } = t.detail;
78
- i === "form-context-request" && e(this.context, this.errors, this.resetCtx);
79
- }
80
- _formAction = (t) => {
81
- t.detail === "submit" ? this.submit() : this.reset();
82
- };
83
- _valueChange = (t) => {
84
- const { name: i, value: e, valid: a } = t.detail;
85
- if (!i) return;
86
- this._data == null && (this._data = {});
87
- const s = Object.hasOwn(this._data, i);
88
- this._data[i] = e, !this._state.novalidate && s && a && this.validator.validateKey(i, e, this._data).then(() => {
89
- const l = this.errors();
90
- l[i] = void 0, this.errors({ ...l });
91
- }).catch((l) => {
92
- this.errors({ ...this.errors(), ...l.detail });
93
- });
94
- };
95
- validateField(t) {
96
- const i = [];
97
- if (this._data != null) {
98
- if (Array.isArray(t))
99
- for (let e = 0, a = t.length; e < a; e++) {
100
- const s = t[e];
101
- i.push(this.validator.validateKey(s, this._data[s], this._data));
102
- }
103
- else
104
- i.push(this.validator.validateKey(t, this._data[t], this._data));
105
- Promise.allSettled(i).then((e) => {
106
- let a = {};
107
- for (let s = 0, l = e.length; s < l; s++) {
108
- const h = e[s];
109
- h.status === "rejected" ? a = { ...a, ...h.reason.detail } : a[h.value.key] = void 0;
110
- }
111
- this.errors({ ...this.errors(), ...a });
112
- });
113
- }
114
- }
115
- clearValidate() {
116
- this.errors({});
117
- }
118
- reset() {
119
- this.clearValidate();
120
- const t = this.resetCtx();
121
- this.resetCtx(t >= 100 ? 1 : t + 1);
122
- }
123
- submit() {
124
- this._state.novalidate ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this.validate().then((t) => {
125
- t && this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() }));
126
- });
127
- }
128
- /**
129
- * 校验全部表单数据
130
- */
131
- async validate() {
132
- try {
133
- return await this.validator.validate(this._data), this.errors({}), Promise.resolve(!0);
134
- } catch (t) {
135
- return this.errors(t.detail), Promise.resolve(!1);
136
- }
137
- }
138
- getData() {
139
- return { ...this._data };
140
- }
141
- setErrors(t) {
142
- this.errors(t);
143
- }
144
- }
145
- export {
146
- k as default
147
- };
1
+ import { t as e } from "../form-DdU0yK0k.js";
2
+ export { e as default };
@@ -0,0 +1,154 @@
1
+ import e from "./base.js";
2
+ import { parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
3
+ import { n as r } from "./esm-sVEoAVPu.js";
4
+ import { $one as i, formatClass as a, off as o, on as s } from "ph-utils/dom";
5
+ import c from "ph-utils/validator";
6
+ //#region src/components/form/index.less?inline
7
+ var l = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column;display:flex}.l-form-inline{gap:var(--l-form-gap,20px);flex-flow:wrap;display:flex}.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}", u = class extends e {
8
+ static baseName = "form";
9
+ validator;
10
+ _data;
11
+ context;
12
+ errors;
13
+ resetCtx;
14
+ constructor() {
15
+ super(), this._state = {
16
+ inline: !1,
17
+ labelPosition: "right",
18
+ labelWidth: "80px",
19
+ novalidate: !1
20
+ }, this.validator = new c([]), this.context = r({ innerBlock: !1 }), this.errors = r({}), this.resetCtx = r(0);
21
+ }
22
+ static get observedAttributes() {
23
+ return [
24
+ "label-position",
25
+ "inner-block",
26
+ "inline",
27
+ "novalidate",
28
+ "label-width"
29
+ ];
30
+ }
31
+ attributeChanged(e, r, i) {
32
+ switch (e) {
33
+ case "label-position":
34
+ this._state.labelPosition = i;
35
+ break;
36
+ case "inner-block":
37
+ let r = t(i, !1, e);
38
+ this.context({ innerBlock: r });
39
+ break;
40
+ case "label-width":
41
+ this._state.labelWidth = n(i);
42
+ break;
43
+ default:
44
+ let a = t(i, !1, e);
45
+ this._state[e] = a;
46
+ break;
47
+ }
48
+ }
49
+ updateDOM(e) {
50
+ if (e.has("label-position") || e.has("inline")) {
51
+ let e = i("form", this.root);
52
+ e && (e.className = a([
53
+ "l-form",
54
+ this._state.inline ? "l-form-inline" : void 0,
55
+ `l-form--${this._state.labelPosition}`
56
+ ]));
57
+ }
58
+ e.has("label-width") && (this._state.labelWidth ? this.style.setProperty("--l-form-label-width", this._state.labelWidth) : this.style.removeProperty("--l-form-label-width"));
59
+ }
60
+ connectedCallback() {
61
+ s(this, "form-context-request", this._provide), this.loadStyleText([l]), super.connectedCallback();
62
+ }
63
+ afterInit() {
64
+ s(this, "form-rule-change", this.ruleChange), s(this, "form-value-change", this._valueChange), s(this, "form-action", this._formAction);
65
+ }
66
+ disconnectedCallback() {
67
+ this.validator = void 0, o(this, "form-rule-change", this.ruleChange), o(this, "form-value-change", this._valueChange), o(this, "form-context-request", this._provide), o(this, "form-action", this._formAction), super.disconnectedCallback();
68
+ }
69
+ render() {
70
+ let e = a([
71
+ "l-form",
72
+ this._state.inline ? "l-form-inline" : void 0,
73
+ `l-form--${this._state.labelPosition}`
74
+ ]);
75
+ return this._state.labelWidth && this.style.setProperty("--l-form-label-width", this._state.labelWidth), `<form class="${e}"><slot></slot></form>`;
76
+ }
77
+ ruleChange = (e) => {
78
+ e.stopPropagation(), this.validator.addSchema(e.detail);
79
+ };
80
+ _provide(e) {
81
+ let { context: t, callback: n } = e.detail;
82
+ t === "form-context-request" && n(this.context, this.errors, this.resetCtx);
83
+ }
84
+ _formAction = (e) => {
85
+ e.detail === "submit" ? this.submit() : this.reset();
86
+ };
87
+ _valueChange = (e) => {
88
+ let { name: t, value: n, valid: r } = e.detail;
89
+ if (!t) return;
90
+ this._data ??= {};
91
+ let i = Object.hasOwn(this._data, t);
92
+ this._data[t] = n, !this._state.novalidate && i && r && this.validator.validateKey(t, n, this._data).then(() => {
93
+ let e = this.errors();
94
+ e[t] = void 0, this.errors({ ...e });
95
+ }).catch((e) => {
96
+ this.errors({
97
+ ...this.errors(),
98
+ ...e.detail
99
+ });
100
+ });
101
+ };
102
+ validateField(e) {
103
+ let t = [];
104
+ if (this._data != null) {
105
+ if (Array.isArray(e)) for (let n = 0, r = e.length; n < r; n++) {
106
+ let r = e[n];
107
+ t.push(this.validator.validateKey(r, this._data[r], this._data));
108
+ }
109
+ else t.push(this.validator.validateKey(e, this._data[e], this._data));
110
+ Promise.allSettled(t).then((e) => {
111
+ let t = {};
112
+ for (let n = 0, r = e.length; n < r; n++) {
113
+ let r = e[n];
114
+ r.status === "rejected" ? t = {
115
+ ...t,
116
+ ...r.reason.detail
117
+ } : t[r.value.key] = void 0;
118
+ }
119
+ this.errors({
120
+ ...this.errors(),
121
+ ...t
122
+ });
123
+ });
124
+ }
125
+ }
126
+ clearValidate() {
127
+ this.errors({});
128
+ }
129
+ reset() {
130
+ this.clearValidate();
131
+ let e = this.resetCtx();
132
+ this.resetCtx(e >= 100 ? 1 : e + 1);
133
+ }
134
+ submit() {
135
+ this._state.novalidate ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this.validate().then((e) => {
136
+ e && this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() }));
137
+ });
138
+ }
139
+ async validate() {
140
+ try {
141
+ return await this.validator.validate(this._data), this.errors({}), Promise.resolve(!0);
142
+ } catch (e) {
143
+ return this.errors(e.detail), Promise.resolve(!1);
144
+ }
145
+ }
146
+ getData() {
147
+ return { ...this._data };
148
+ }
149
+ setErrors(e) {
150
+ this.errors(e);
151
+ }
152
+ };
153
+ //#endregion
154
+ export { u as t };
@@ -0,0 +1,117 @@
1
+ import e from "./base.js";
2
+ import { parseAttrValue as t, stopSignal as n } from "./utils/index.js";
3
+ import { t as r } from "./esm-sVEoAVPu.js";
4
+ import { getAttr as i } from "ph-utils/dom";
5
+ //#region src/components/form/form_inner.ts
6
+ var a = class extends e {
7
+ disabled = !1;
8
+ _value = void 0;
9
+ _resetValue;
10
+ _firstPushValue = !0;
11
+ _isReset = !1;
12
+ _name;
13
+ formContext;
14
+ formItemContext;
15
+ formErrors;
16
+ resetCtx;
17
+ _signalStop;
18
+ _errorSignalStop;
19
+ _resetSignalStop;
20
+ constructor(e = !0, t = !0) {
21
+ super(!0, { delegatesFocus: t }), this._firstPushValue = e;
22
+ }
23
+ get name() {
24
+ return this._name;
25
+ }
26
+ set name(e) {
27
+ this._name = e;
28
+ }
29
+ get value() {
30
+ return this._value;
31
+ }
32
+ set value(e) {
33
+ this.setValue(e);
34
+ }
35
+ setValue(e) {
36
+ this._value = e, this._resetValue ??= e, this.pushValueChange();
37
+ }
38
+ getValue() {
39
+ return this._value;
40
+ }
41
+ static get observedAttributes() {
42
+ return [
43
+ "disabled",
44
+ "value",
45
+ "name",
46
+ "inner-block"
47
+ ];
48
+ }
49
+ attributeChanged(e, n, r) {
50
+ switch (e) {
51
+ case "value":
52
+ case "name":
53
+ this[e] = r;
54
+ break;
55
+ case "disabled":
56
+ this.disabled = t(r, !1, e);
57
+ break;
58
+ case "inner-block":
59
+ let i = t(r, !1, e);
60
+ this.innerBlockChange(i);
61
+ break;
62
+ default:
63
+ this.attributeChange(e, n, r);
64
+ break;
65
+ }
66
+ }
67
+ attributeChange(e, t, n) {}
68
+ connectedCallback() {
69
+ this.emitInject("form-context-request", this.formInject), this.emitInject("form-item-context-request", this.formItemInject), super.connectedCallback(), this._signalStop = r(() => {
70
+ let e = this.formItemContext ? this.formItemContext() : null, t = this.formContext ? this.formContext() : null;
71
+ if (!this.name && e && e.prop && this.setAttribute("name", e.prop), !i(this, "inner-block")) {
72
+ let n = e?.innerBlock || t?.innerBlock;
73
+ n != null && this.innerBlockChange(n);
74
+ }
75
+ }), this._value ?? (this._resetValue = "", this._firstPushValue && this.pushValueChange()), this._errorSignalStop = r(() => {
76
+ if (!this.name) return;
77
+ let e = (this.formErrors ? this.formErrors() : {})[this.name];
78
+ this.validResult(e);
79
+ }), this._resetSignalStop = r(() => {
80
+ (this.resetCtx ? this.resetCtx() : 0) > 0 && this.reset();
81
+ });
82
+ }
83
+ disconnectedCallback() {
84
+ super.disconnectedCallback(), this._signalStop = n(this._signalStop), this._errorSignalStop = n(this._errorSignalStop), this._resetSignalStop = n(this._resetSignalStop);
85
+ }
86
+ isDisabled() {
87
+ return this.disabled;
88
+ }
89
+ getName() {
90
+ return this.name;
91
+ }
92
+ disabledChange() {}
93
+ innerBlockChange(e) {}
94
+ validResult(e) {}
95
+ formInject = (e, t, n) => {
96
+ this.formContext = e, this.formErrors = t, this.resetCtx = n;
97
+ };
98
+ formItemInject = (e) => {
99
+ this.formItemContext = e;
100
+ };
101
+ pushValueChange() {
102
+ this.name && this.emit("form-value-change", {
103
+ bubbles: !0,
104
+ composed: !0,
105
+ detail: {
106
+ name: this.name,
107
+ value: this._value,
108
+ valid: !this._isReset
109
+ }
110
+ }), this._isReset = !1;
111
+ }
112
+ reset() {
113
+ this._isReset = !0, this.value = this._resetValue || "";
114
+ }
115
+ };
116
+ //#endregion
117
+ export { a as t };
@@ -0,0 +1,137 @@
1
+ import { parseAttrValue as e, stopSignal as t } from "./utils/index.js";
2
+ import { n, t as r } from "./esm-sVEoAVPu.js";
3
+ import i from "./utils/context_provide.js";
4
+ import { $$ as a, $one as o, addClass as s, removeClass as c } from "ph-utils/dom";
5
+ //#region src/components/form/form_item.less?inline
6
+ var l = ":host{display:var(--l-form-item-display,flex);font-size:14px}.l-form-item__label{text-align:var(--l-form-label-align,right);width:var(--l-form-label-width,auto);height:var(--l-form-control-height,32px);line-height:var(--l-form-control-height,32px);color:#606266;box-sizing:border-box;padding:0 10px 0 0;display:inline-block}.l-form-item__label:empty{display:var(--l-form-label-empty-display,inline-block)}:host(.is-required) .l-form-item__label:before{content:\"*\";color:var(--l-warn-color,#f56c6c);vertical-align:middle;margin-right:4px}.l-form-item__content{flex:1;align-items:center;display:flex;position:relative}.l-form-item__error{color:var(--nt-error-color,#ed3f13);padding-top:3px;font-size:12px;line-height:1;position:absolute;top:100%;left:0}:host(.l-form-item--left){--l-form-label-align:left}:host(.l-form-item--top){--l-form-item-display:grid;--l-form-label-align:left;--l-form-label-empty-display:none;grid-template-columns:1fr}", u = class extends i {
7
+ static baseName = "form-item";
8
+ formErrors;
9
+ _errorSignalStop;
10
+ constructor() {
11
+ super(), this.contextEventName = "form-item-context-request", this._state = {
12
+ labelPosition: "right",
13
+ required: !1
14
+ }, this.context = n({ innerBlock: !1 });
15
+ }
16
+ static get observedAttributes() {
17
+ return [
18
+ "error",
19
+ "label",
20
+ "required",
21
+ "inner-block",
22
+ "prop",
23
+ "label-position",
24
+ "verify",
25
+ "pattern",
26
+ "validity"
27
+ ];
28
+ }
29
+ attributeChanged(t, n, r) {
30
+ switch (t) {
31
+ case "error":
32
+ case "label":
33
+ case "verify":
34
+ case "pattern":
35
+ case "validity":
36
+ this._state[t] = r;
37
+ break;
38
+ case "label-position":
39
+ this._state.labelPosition = r;
40
+ break;
41
+ case "inner-block":
42
+ let n = e(r, !1, t);
43
+ this.context({ innerBlock: n });
44
+ break;
45
+ case "required":
46
+ let i = e(r, !1, t);
47
+ this._state.required = i;
48
+ break;
49
+ case "prop":
50
+ this._state.prop = r, this.context({
51
+ ...this.context(),
52
+ prop: r
53
+ });
54
+ break;
55
+ }
56
+ }
57
+ updateDOM(e) {
58
+ e.has("required") && this._updateRequired(), e.has("label") && this._updateLabel(), e.has("error") && this._updateError();
59
+ }
60
+ connectedCallback() {
61
+ this.loadStyleText([l]), super.connectedCallback(), this._updateRequired(), this._parseSchema(), this.emitInject("form-context-request", ((e, t) => {
62
+ this.formErrors = t;
63
+ })), this._errorSignalStop = r(() => {
64
+ let e = this.context().prop, t = this.formErrors ? this.formErrors() : null;
65
+ e && t && (this._state.error = t[e], this._updateError());
66
+ });
67
+ }
68
+ beforeDestroy() {
69
+ this._errorSignalStop = t(this._errorSignalStop);
70
+ }
71
+ setRules(e) {
72
+ let t = this._state.prop;
73
+ if (t) {
74
+ let n = {
75
+ ...e,
76
+ key: t
77
+ };
78
+ this._updateRules(n);
79
+ }
80
+ }
81
+ render() {
82
+ this.classList.add(`l-form-item--${this._state.labelPosition}`);
83
+ let e = document.createDocumentFragment();
84
+ this._state.label != null && e.appendChild(a("label", {
85
+ class: "l-form-item__label",
86
+ textContent: this._state.label
87
+ }));
88
+ let t = a("div", { class: "l-form-item__content" }), n = a("slot");
89
+ return t.appendChild(n), this._state.error && t.appendChild(a("div", {
90
+ class: "l-form-item__error",
91
+ textContent: this._state.error
92
+ })), e.appendChild(t), e;
93
+ }
94
+ _updateRequired() {
95
+ this._state.required ? s(this, "is-required") : c(this, "is-required");
96
+ }
97
+ _parseSchema() {
98
+ let e = this.context().prop;
99
+ if (e) {
100
+ let t = [], n = this._state.verify;
101
+ n && (t = n.split("|"));
102
+ let r = this._state.pattern;
103
+ r && t.push(new RegExp(r));
104
+ let i = {
105
+ key: e,
106
+ required: this._state.required,
107
+ message: this._state.validity,
108
+ rules: t
109
+ };
110
+ this._updateRules(i);
111
+ }
112
+ }
113
+ _updateError() {
114
+ if (this._state.error ? s(this, "is-error") : c(this, "is-error"), !this.rendered) return;
115
+ let e = o(".l-form-item__error", this.root);
116
+ if (e) this._state.error ? e.textContent = this._state.error : e.remove();
117
+ else if (this._state.error) {
118
+ e = document.createElement("div"), e.className = "l-form-item__error", e.textContent = this._state.error;
119
+ let t = o(".l-form-item__content", this.root);
120
+ t && t.appendChild(e);
121
+ }
122
+ }
123
+ _updateLabel() {
124
+ if (!this.rendered) return;
125
+ let e = o(".l-form-item__label", this.root);
126
+ e == null ? this._state.label != null && (e = document.createElement("div"), e.className = "l-form-item__label", e.textContent = this._state.label, this.root.prepend(e)) : this._state.label == null ? e.remove() : e.textContent = this._state.label;
127
+ }
128
+ _updateRules(e) {
129
+ this.emit("form-rule-change", {
130
+ bubbles: !0,
131
+ composed: !0,
132
+ detail: e
133
+ });
134
+ }
135
+ };
136
+ //#endregion
137
+ export { u as t };
@@ -1,13 +1,13 @@
1
- import a from "./base.js";
2
- class n extends a {
3
- static baseName = "arrow-down-icon";
4
- connectedCallback() {
5
- super.connectedCallback();
6
- }
7
- renderChildren() {
8
- return '<path fill="currentColor" d="M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"></path>';
9
- }
10
- }
11
- export {
12
- n as default
1
+ import { t as e } from "../base-Dm0WS1pK.js";
2
+ //#region src/components/icon/arrow_down.ts
3
+ var t = class extends e {
4
+ static baseName = "arrow-down-icon";
5
+ connectedCallback() {
6
+ super.connectedCallback();
7
+ }
8
+ renderChildren() {
9
+ return "<path fill=\"currentColor\" d=\"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z\"></path>";
10
+ }
13
11
  };
12
+ //#endregion
13
+ export { t as default };
@@ -1,10 +1,10 @@
1
- import r from "./base.js";
2
- class t extends r {
3
- static baseName = "arrow-left-icon";
4
- renderChildren() {
5
- return '<path fill="currentColor" d="M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"></path>';
6
- }
7
- }
8
- export {
9
- t as default
1
+ import { t as e } from "../base-Dm0WS1pK.js";
2
+ //#region src/components/icon/arrow_left.ts
3
+ var t = class extends e {
4
+ static baseName = "arrow-left-icon";
5
+ renderChildren() {
6
+ return "<path fill=\"currentColor\" d=\"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z\"></path>";
7
+ }
10
8
  };
9
+ //#endregion
10
+ export { t as default };
@@ -1,10 +1,10 @@
1
- import r from "./base.js";
2
- class t extends r {
3
- static baseName = "arrow-right-icon";
4
- renderChildren() {
5
- return '<path fill="currentColor" d="M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"></path>';
6
- }
7
- }
8
- export {
9
- t as default
1
+ import { t as e } from "../base-Dm0WS1pK.js";
2
+ //#region src/components/icon/arrow_right.ts
3
+ var t = class extends e {
4
+ static baseName = "arrow-right-icon";
5
+ renderChildren() {
6
+ return "<path fill=\"currentColor\" d=\"M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z\"></path>";
7
+ }
10
8
  };
9
+ //#endregion
10
+ export { t as default };
@@ -1,13 +1,13 @@
1
- import a from "./base.js";
2
- class l extends a {
3
- static baseName = "arrow-up-icon";
4
- connectedCallback() {
5
- super.connectedCallback();
6
- }
7
- renderChildren() {
8
- return '<path fill="currentColor" d="m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"></path>';
9
- }
10
- }
11
- export {
12
- l as default
1
+ import { t as e } from "../base-Dm0WS1pK.js";
2
+ //#region src/components/icon/arrow_up.ts
3
+ var t = class extends e {
4
+ static baseName = "arrow-up-icon";
5
+ connectedCallback() {
6
+ super.connectedCallback();
7
+ }
8
+ renderChildren() {
9
+ return "<path fill=\"currentColor\" d=\"m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0\"></path>";
10
+ }
13
11
  };
12
+ //#endregion
13
+ export { t as default };
@@ -1,10 +1,24 @@
1
1
  import BaseComponent from "../base";
2
- export default class BaseIcon extends BaseComponent {
2
+ type ColorState = {
3
+ color?: string;
4
+ size?: string;
5
+ };
6
+ export default class BaseIcon extends BaseComponent<ColorState> {
3
7
  static baseName: string;
4
8
  useLink: boolean;
5
9
  viewBox: string;
10
+ constructor();
11
+ static get observedAttributes(): string[] | null | undefined;
12
+ protected attributeChanged(name: string, oldValue: string, newValue: string): void;
6
13
  connectedCallback(): void;
7
- render(): void;
14
+ protected updateDOM(changedProps: Set<string>): void;
15
+ private _updateSize;
16
+ private _updateColor;
17
+ render_v2(): {
18
+ template?: string | HTMLElement | DocumentFragment;
19
+ style?: string | string[];
20
+ };
8
21
  renderChildren(): string;
9
22
  createEl(tagName: string): SVGElement;
10
23
  }
24
+ export {};