litos-ui 0.18.4 → 0.18.5

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 (40) hide show
  1. package/lib/check/checkbox.js +1 -1
  2. package/lib/check/checkbox_group.js +1 -1
  3. package/lib/check/radio.js +1 -1
  4. package/lib/check/radio_group.js +1 -1
  5. package/lib/{check-CuKgzwRS.js → check-BDOpD_0-.js} +1 -1
  6. package/lib/{check-BQWzxdO2.js → check-CrlZ7zVL.js} +2 -2
  7. package/lib/checkbox-D_bZGoUD.js +16 -0
  8. package/lib/color_picker/index.js +1 -1
  9. package/lib/{color_picker-fDdSa0hC.js → color_picker-AaFcIczZ.js} +1 -1
  10. package/lib/date_picker/index.js +1 -1
  11. package/lib/{date_picker-DHCCvMnX.js → date_picker-HjkRma9j.js} +1 -1
  12. package/lib/date_picker_ori/index.js +1 -1
  13. package/lib/{date_picker_ori-JXqzXaYz.js → date_picker_ori-1IOHZsan.js} +1 -1
  14. package/lib/form/form_inner.d.ts +4 -1
  15. package/lib/form/index.d.ts +9 -1
  16. package/lib/form/index.js +1 -1
  17. package/lib/{form-uOybauzi.js → form-BvZHaqAt.js} +42 -18
  18. package/lib/{form_inner-B7IMSpMf.js → form_inner-52DR1IPu.js} +12 -3
  19. package/lib/index.js +11 -11
  20. package/lib/input/index.js +1 -1
  21. package/lib/loading/index.js +6 -5
  22. package/lib/md_input/index.js +1 -1
  23. package/lib/{md_input-DHz8GRs3.js → md_input-DN3ceqsw.js} +1 -1
  24. package/lib/{radio-C8FTHdm3.js → radio-C7dkhgwc.js} +1 -1
  25. package/lib/select/index.d.ts +24 -15
  26. package/lib/select/index.js +1 -1
  27. package/lib/select-Cis6kRjQ.js +351 -0
  28. package/lib/select_ori/index.d.ts +5 -0
  29. package/lib/select_ori/index.js +2 -48
  30. package/lib/select_ori-DcJbNYYr.js +57 -0
  31. package/lib/switch/index.js +1 -1
  32. package/lib/{switch-DDNxkTiM.js → switch-UyhlgW7F.js} +1 -1
  33. package/lib/theme/index.js +1 -1
  34. package/lib/{theme-DBghUmYD.js → theme-Barcq234.js} +5 -2
  35. package/lib/utils/popover.js +11 -14
  36. package/package.json +68 -65
  37. package/styles/vars.css +1 -2
  38. package/types/preact.d.ts +128 -0
  39. package/lib/checkbox-CNluBmyo.js +0 -16
  40. package/lib/select-CnwPEFQ3.js +0 -326
@@ -1,2 +1,2 @@
1
- import { t as e } from "../checkbox-CNluBmyo.js";
1
+ import { t as e } from "../checkbox-D_bZGoUD.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../check-CuKgzwRS.js";
1
+ import { t as e } from "../check-BDOpD_0-.js";
2
2
  //#region src/components/check/checkbox_group.ts
3
3
  var t = class extends e {
4
4
  static baseName = "checkbox-group";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../radio-C8FTHdm3.js";
1
+ import { t as e } from "../radio-C7dkhgwc.js";
2
2
  export { e as default };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../check-CuKgzwRS.js";
1
+ import { t as e } from "../check-BDOpD_0-.js";
2
2
  //#region src/components/check/radio_group.ts
3
3
  var t = class extends e {
4
4
  static baseName = "radio-group";
@@ -1,6 +1,6 @@
1
1
  import { unitNumberStr as e } from "./utils/index.js";
2
2
  import { n as t } from "./esm-Cir9D6cn.js";
3
- import { t as n } from "./form_inner-B7IMSpMf.js";
3
+ import { t as n } from "./form_inner-52DR1IPu.js";
4
4
  import { $$ as r, off as i, on as a } from "ph-utils/dom";
5
5
  //#region src/components/check/index.less?inline
6
6
  var o = ":host{align-items:center;gap:var(--l-check-gap,0px);display:flex}", s = class extends n {
@@ -1,6 +1,6 @@
1
1
  import { parseAttrValue as e, stopSignal as t } from "./utils/index.js";
2
2
  import { t as n } from "./esm-Cir9D6cn.js";
3
- import { t as r } from "./form_inner-B7IMSpMf.js";
3
+ import { t as r } from "./form_inner-52DR1IPu.js";
4
4
  import { $$ as i, addClass as a, off as o, on as s, removeClass as c, toggleClass as l } from "ph-utils/dom";
5
5
  //#region src/components/check/check.ts
6
6
  var u = class extends r {
@@ -112,6 +112,6 @@ var u = class extends r {
112
112
  });
113
113
  }
114
114
  _doChangeAction() {}
115
- }, d = ":host{--l-check-size:14px;cursor:pointer;outline:none;align-items:center;width:auto;transition:color .3s,border-color .3s,background-color .3s;display:inline-flex;position:relative}.l-check__input{z-index:-1;opacity:0;width:0;height:0;margin:0;position:absolute}.l-check__inner{width:var(--l-check-size,14px);height:var(--l-check-size,14px);box-sizing:border-box;border:1px solid #dcddd9;border-radius:3px;flex-shrink:0;justify-content:center;align-items:center;margin-right:5px;transition:border-color .3s ease-in-out;display:flex;position:relative}.l-check__label{cursor:inherit;line-height:1;transition:color .3s}:host(.is-checked){color:var(--l-primary-color,#722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color,#722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color,#e6e6e6)}:host([button]){height:var(--l-form-control-height,32px);border-radius:inherit;border:1px solid #c0c4cc;border-left-width:0;justify-content:center;margin-left:0;padding:0 15px}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color,#722ed1);color:#fff;border-color:var(--l-primary-color,#722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color,#722ed1)}";
115
+ }, d = ":host{cursor:pointer;outline:none;align-items:center;width:auto;transition:color .3s,border-color .3s,background-color .3s;display:inline-flex;position:relative}.l-check__input{z-index:-1;opacity:0;width:0;height:0;margin:0;position:absolute}.l-check__inner{width:var(--l-check-size,14px);height:var(--l-check-size,14px);border-radius:var(--l-check-border-radius,var(--l-border-radius,13px));box-sizing:border-box;border:1px solid #dcddd9;flex-shrink:0;justify-content:center;align-items:center;margin-right:5px;transition:border-color .3s ease-in-out;display:flex;position:relative}.l-check__label{cursor:inherit;line-height:1;transition:color .3s}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color,#722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color,#e6e6e6)}:host([button]){height:var(--l-form-control-height,32px);border-radius:inherit;border:1px solid #c0c4cc;border-left-width:0;justify-content:center;margin-left:0;padding:0 15px}:host([button]:first-child){border-top-left-radius:var(--l-check-border-radius,var(--l-border-radius,13px));border-bottom-left-radius:var(--l-check-border-radius,var(--l-border-radius,13px));border-left-width:1px}:host([button]:last-child){border-top-right-radius:var(--l-check-border-radius,var(--l-border-radius,13px));border-bottom-right-radius:var(--l-check-border-radius,var(--l-border-radius,13px))}:host([button].is-checked){background-color:var(--l-primary-color,#722ed1);color:#fff;border-color:var(--l-primary-color,#722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color,#722ed1)}";
116
116
  //#endregion
117
117
  export { u as n, d as t };
@@ -0,0 +1,16 @@
1
+ import { n as e, t } from "./check-CrlZ7zVL.js";
2
+ //#region src/components/check/checkbox.less?inline
3
+ var n = ":host(.is-indeterminate) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-indeterminate) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size,14px) * .4);border:none;border-bottom:1px solid #fff;height:1px;margin-top:0;display:block;transform:rotate(0)}.l-check__inner:after,:host(.is-checked) .l-check__inner:after{content:\"\";width:calc(var(--l-check-size,14px) * .6);height:calc(var(--l-check-size,14px) * .3);border-top:none;border-bottom:1px solid #0000;border-left:1px solid #0000;border-right:none;margin-top:-3px;transition:border-color .2s ease-in-out;display:block;transform:rotate(-45deg)}:host(.is-checked) .l-check__inner{background-color:var(--l-primary-color,#722ed1)}:host(.is-checked) .l-check__inner:after{border-color:#fff}:host(.is-disabled) .l-check__inner{background-color:var(--l-disabled-color,#e6e6e6);border-color:var(--l-disabled-color,#e6e6e6)}", r = class extends e {
4
+ static baseName = "checkbox";
5
+ constructor() {
6
+ super(), this._inputType = "checkbox";
7
+ }
8
+ connectedCallback() {
9
+ this.loadStyleText([t, n]), super.connectedCallback();
10
+ }
11
+ _doChangeAction() {
12
+ this.getChecked() ? this.setChecked(!1) : this.setChecked(!0), this.emitChange();
13
+ }
14
+ };
15
+ //#endregion
16
+ export { r as t };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../color_picker-fDdSa0hC.js";
1
+ import { t as e } from "../color_picker-AaFcIczZ.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  import { initAttr as e, setAttrs as t } from "./utils/index.js";
2
- import { t as n } from "./form_inner-B7IMSpMf.js";
2
+ import { t as n } from "./form_inner-52DR1IPu.js";
3
3
  import { t as r } from "./input-DUBlLEXS.js";
4
4
  import { $one as i, off as a, on as o } from "ph-utils/dom";
5
5
  //#region src/components/color_picker/index.less?inline
@@ -1,3 +1,3 @@
1
1
  import "../utils/popover.js";
2
- import { t as e } from "../date_picker-DHCCvMnX.js";
2
+ import { t as e } from "../date_picker-HjkRma9j.js";
3
3
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  import { unitNumberStr as e } from "./utils/index.js";
2
- import { t } from "./form_inner-B7IMSpMf.js";
2
+ import { t } from "./form_inner-52DR1IPu.js";
3
3
  import { t as n } from "./input_inner-x4GfLGjj.js";
4
4
  import { Popover as r } from "./utils/popover.js";
5
5
  import { $$ as i, on as a } from "ph-utils/dom";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../date_picker_ori-JXqzXaYz.js";
1
+ import { t as e } from "../date_picker_ori-1IOHZsan.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  import { kebabToCamel as e, parseAttrValue as t, unitNumberStr as n } from "./utils/index.js";
2
- import { t as r } from "./form_inner-B7IMSpMf.js";
2
+ import { t as r } from "./form_inner-52DR1IPu.js";
3
3
  import { $ as i, $$ as a, iterate as o, off as s, on as c } from "ph-utils/dom";
4
4
  import { parse as l } from "ph-utils/date";
5
5
  //#region src/components/date_picker_ori/index.less?inline
@@ -1,7 +1,7 @@
1
1
  import BaseComponent from "../base";
2
2
  import type { FormItemSignal, FormSignal } from "./types";
3
3
  export default class FormInner<T = Record<string, any>> extends BaseComponent<T> {
4
- disabled: boolean;
4
+ _disabled: boolean;
5
5
  _value: any;
6
6
  _resetValue?: any;
7
7
  protected _firstPushValue: boolean;
@@ -32,6 +32,9 @@ export default class FormInner<T = Record<string, any>> extends BaseComponent<T>
32
32
  connectedCallback(): void;
33
33
  disconnectedCallback(): void;
34
34
  isDisabled(): boolean;
35
+ get disabled(): boolean;
36
+ set disabled(value: boolean);
37
+ setDisabled(value: boolean): void;
35
38
  getName(): string | undefined;
36
39
  protected disabledChange(): void;
37
40
  protected innerBlockChange(_innerBlock: boolean): void;
@@ -8,6 +8,8 @@ interface FormState {
8
8
  labelWidth: string;
9
9
  labelHeight?: string;
10
10
  novalidate: boolean;
11
+ /** 验证错误,不直接处理,而是通过事件上报 */
12
+ emitError: boolean;
11
13
  }
12
14
  export default class Form extends BaseComponent<FormState> {
13
15
  static baseName: string;
@@ -30,10 +32,13 @@ export default class Form extends BaseComponent<FormState> {
30
32
  render(): string;
31
33
  ruleChange: (e: CustomEvent) => void;
32
34
  addSchemas(schemas: SchemaType[]): void;
35
+ setSchemas(schemas: SchemaType[]): void;
36
+ setSchema(schema: SchemaType): void;
33
37
  addSchema(schema: SchemaType): void;
34
38
  private _provide;
35
39
  _formAction: (e: CustomEvent) => void;
36
40
  _valueChange: (e: CustomEvent) => void;
41
+ setValidateErrors(errs: Record<string, string | undefined>, all?: string | string[] | boolean): void;
37
42
  validateField(field: string | string[]): void;
38
43
  clearValidate(): void;
39
44
  reset(): void;
@@ -41,7 +46,10 @@ export default class Form extends BaseComponent<FormState> {
41
46
  /**
42
47
  * 校验全部表单数据
43
48
  */
44
- validate(): Promise<boolean>;
49
+ validate(): Promise<{
50
+ result: boolean;
51
+ errors: any;
52
+ }>;
45
53
  getData(): {
46
54
  [x: string]: any;
47
55
  };
package/lib/form/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "../form-uOybauzi.js";
1
+ import { t as e } from "../form-BvZHaqAt.js";
2
2
  export { e as default };
@@ -16,7 +16,8 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
16
16
  inline: !1,
17
17
  labelPosition: "right",
18
18
  labelWidth: "80px",
19
- novalidate: !1
19
+ novalidate: !1,
20
+ emitError: !1
20
21
  }, this.validator = new l([]), this.context = i({ innerBlock: !1 }), this.errors = i({}), this.resetCtx = i(0);
21
22
  }
22
23
  static get observedAttributes() {
@@ -26,7 +27,8 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
26
27
  "inline",
27
28
  "novalidate",
28
29
  "label-width",
29
- "label-height"
30
+ "label-height",
31
+ "emit-error"
30
32
  ];
31
33
  }
32
34
  attributeChanged(e, i, a) {
@@ -44,7 +46,7 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
44
46
  break;
45
47
  default:
46
48
  let o = n(a, !1, e);
47
- this._state[e] = o;
49
+ this._state[t(e)] = o;
48
50
  break;
49
51
  }
50
52
  }
@@ -88,6 +90,12 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
88
90
  addSchemas(e) {
89
91
  this.validator.addSchemas(e);
90
92
  }
93
+ setSchemas(e) {
94
+ this.validator.setSchemas(e);
95
+ }
96
+ setSchema(e) {
97
+ this.validator.setSchema(e);
98
+ }
91
99
  addSchema(e) {
92
100
  this.validator.addSchema(e);
93
101
  }
@@ -105,14 +113,20 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
105
113
  let i = Object.hasOwn(this._data, t);
106
114
  this._data[t] = n, !this._state.novalidate && i && r && this.validator.validateKey(t, n, this._data).then(() => {
107
115
  let e = this.errors();
108
- e[t] = void 0, this.errors({ ...e });
116
+ e[t] = void 0, this.setValidateErrors({ ...e });
109
117
  }).catch((e) => {
110
- this.errors({
118
+ this.setValidateErrors({
111
119
  ...this.errors(),
112
120
  ...e.detail
113
121
  });
114
122
  });
115
123
  };
124
+ setValidateErrors(e, t = !0) {
125
+ this._state.emitError ? this.emit("validate-error", { detail: {
126
+ errors: e,
127
+ all: t
128
+ } }) : this.errors(e);
129
+ }
116
130
  validateField(e) {
117
131
  let t = [];
118
132
  if (this._data != null) {
@@ -121,19 +135,20 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
121
135
  t.push(this.validator.validateKey(r, this._data[r], this._data));
122
136
  }
123
137
  else t.push(this.validator.validateKey(e, this._data[e], this._data));
124
- Promise.allSettled(t).then((e) => {
125
- let t = {};
126
- for (let n = 0, r = e.length; n < r; n++) {
127
- let r = e[n];
128
- r.status === "rejected" ? t = {
129
- ...t,
138
+ Promise.allSettled(t).then((t) => {
139
+ let n = {};
140
+ for (let e = 0, r = t.length; e < r; e++) {
141
+ let r = t[e];
142
+ r.status === "rejected" ? n = {
143
+ ...n,
130
144
  ...r.reason.detail
131
- } : t[r.value.key] = void 0;
145
+ } : n[r.value.key] = void 0;
132
146
  }
133
- this.errors({
147
+ let r = {
134
148
  ...this.errors(),
135
- ...t
136
- });
149
+ ...n
150
+ };
151
+ this.setValidateErrors(r, e);
137
152
  });
138
153
  }
139
154
  }
@@ -147,14 +162,23 @@ var u = ":host{display:block}.l-form{gap:var(--l-form-gap,20px);flex-flow:column
147
162
  }
148
163
  submit() {
149
164
  this._state.novalidate ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this.validate().then((e) => {
150
- e && this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() }));
165
+ e.result ? this.dispatchEvent(new CustomEvent("submit", { detail: this.getData() })) : this._state.emitError ? this.emit("validate-error", { detail: {
166
+ errors: e.errors,
167
+ all: !0
168
+ } }) : this.errors(e.errors);
151
169
  });
152
170
  }
153
171
  async validate() {
154
172
  try {
155
- return await this.validator.validate(this._data || {}), this.errors({}), Promise.resolve(!0);
173
+ return await this.validator.validate(this._data || {}), Promise.resolve({
174
+ result: !0,
175
+ errors: {}
176
+ });
156
177
  } catch (e) {
157
- return this.errors(e.detail), Promise.resolve(!1);
178
+ return Promise.resolve({
179
+ result: !1,
180
+ errors: e.detail
181
+ });
158
182
  }
159
183
  }
160
184
  getData() {
@@ -4,7 +4,7 @@ import { t as r } from "./esm-Cir9D6cn.js";
4
4
  import { getAttr as i } from "ph-utils/dom";
5
5
  //#region src/components/form/form_inner.ts
6
6
  var a = class extends e {
7
- disabled = !1;
7
+ _disabled = !1;
8
8
  _value = void 0;
9
9
  _resetValue;
10
10
  _firstPushValue = !0;
@@ -53,7 +53,7 @@ var a = class extends e {
53
53
  this[e] = r;
54
54
  break;
55
55
  case "disabled":
56
- this.disabled = t(r, !1, e);
56
+ this.setDisabled(t(r, !1, e));
57
57
  break;
58
58
  case "inner-block":
59
59
  let i = t(r, !1, e);
@@ -84,7 +84,16 @@ var a = class extends e {
84
84
  super.disconnectedCallback(), this._signalStop = n(this._signalStop), this._errorSignalStop = n(this._errorSignalStop), this._resetSignalStop = n(this._resetSignalStop);
85
85
  }
86
86
  isDisabled() {
87
- return this.disabled;
87
+ return this._disabled;
88
+ }
89
+ get disabled() {
90
+ return this._disabled;
91
+ }
92
+ set disabled(e) {
93
+ this.setDisabled(e);
94
+ }
95
+ setDisabled(e) {
96
+ this._disabled = e, this.disabledChange();
88
97
  }
89
98
  getName() {
90
99
  return this.name;
package/lib/index.js CHANGED
@@ -37,27 +37,27 @@ import G from "./icon/zoom_out.js";
37
37
  import K from "./icon/select.js";
38
38
  import q from "./icon/calendar.js";
39
39
  import J from "./icon/refresh.js";
40
- import { t as Y } from "./form-uOybauzi.js";
40
+ import { t as Y } from "./form-BvZHaqAt.js";
41
41
  import { t as X } from "./form_item-DtqChzc3.js";
42
42
  import Z from "./check/radio_group.js";
43
- import { t as Q } from "./radio-C8FTHdm3.js";
44
- import { t as $ } from "./checkbox-CNluBmyo.js";
43
+ import { t as Q } from "./radio-C7dkhgwc.js";
44
+ import { t as $ } from "./checkbox-D_bZGoUD.js";
45
45
  import ee from "./check/checkbox_group.js";
46
46
  import { t as te } from "./button-CC5NBWtI.js";
47
47
  import ne from "./input/index.js";
48
- import re from "./select_ori/index.js";
49
- import { t as ie } from "./switch-DDNxkTiM.js";
50
- import { t as ae } from "./md_input-DHz8GRs3.js";
51
- import { t as oe } from "./select-CnwPEFQ3.js";
48
+ import { t as re } from "./select_ori-DcJbNYYr.js";
49
+ import { t as ie } from "./switch-UyhlgW7F.js";
50
+ import { t as ae } from "./md_input-DN3ceqsw.js";
51
+ import { t as oe } from "./select-Cis6kRjQ.js";
52
52
  import { Popover as se, autoUpdate as ce, createPopoverObserver as le, getOverflowAncestors as ue, popconfirmProps as de, updatePosition as fe } from "./utils/popover.js";
53
- import { t as pe } from "./date_picker-DHCCvMnX.js";
54
- import { t as me } from "./date_picker_ori-JXqzXaYz.js";
55
- import { t as he } from "./color_picker-fDdSa0hC.js";
53
+ import { t as pe } from "./date_picker-HjkRma9j.js";
54
+ import { t as me } from "./date_picker_ori-1IOHZsan.js";
55
+ import { t as he } from "./color_picker-AaFcIczZ.js";
56
56
  import { t as ge } from "./list-Dz1Ya118.js";
57
57
  import { t as _e } from "./polygon-BY1FAACc.js";
58
58
  import { t as ve } from "./tabbar-DO0kB58Y.js";
59
59
  import { t as ye } from "./item-CX8C9X57.js";
60
- import { t as be } from "./theme-DBghUmYD.js";
60
+ import { t as be } from "./theme-Barcq234.js";
61
61
  import xe from "./theme/theme_color.js";
62
62
  import { t as Se } from "./menu-BOmVa4xN.js";
63
63
  import { t as Ce } from "./carousel-Dgirxwzb.js";
@@ -1,5 +1,5 @@
1
1
  import { parseAttrValue as e, unitNumberStr as t } from "../utils/index.js";
2
- import { t as n } from "../form_inner-B7IMSpMf.js";
2
+ import { t as n } from "../form_inner-52DR1IPu.js";
3
3
  import { t as r } from "../input-DUBlLEXS.js";
4
4
  import { t as i } from "../input_inner-x4GfLGjj.js";
5
5
  import { $ as a, $$ as o, $one as s, addClass as c, formatStyle as l, off as u, on as d, removeClass as f } from "ph-utils/dom";
@@ -38,12 +38,13 @@ function o(e, a) {
38
38
  function s(e, t) {
39
39
  let i = e.tagName === "BODY" ? "body" : ".l-loading", a = n(`${i} > .l-loading-mask`, e), o = n(`${i} > .l-loading-spinner`, e);
40
40
  if (!o) return;
41
- function s() {
42
- a &&= (a.remove(), null), o.remove(), o = null, e.classList.remove("l-loading", "l-loading-fullscreen", "l-loading-lock");
41
+ let s = -1;
42
+ function c() {
43
+ a &&= (a.remove(), null), o &&= (o.remove(), null), e.classList.remove("l-loading", "l-loading-fullscreen", "l-loading-lock"), clearTimeout(s);
43
44
  }
44
- o.addEventListener("transitionend", s, { once: !0 }), requestAnimationFrame(() => {
45
- a && (a.style.opacity = "0"), r(o, "l-loading-bar--finish"), o.style.opacity = "0", setTimeout(() => {
46
- s();
45
+ o.addEventListener("transitionend", c, { once: !0 }), requestAnimationFrame(() => {
46
+ a && (a.style.opacity = "0"), r(o, "l-loading-bar--finish"), o.style.opacity = "0", s = setTimeout(() => {
47
+ c();
47
48
  }, 3e3);
48
49
  });
49
50
  }
@@ -1,2 +1,2 @@
1
- import { t as e } from "../md_input-DHz8GRs3.js";
1
+ import { t as e } from "../md_input-DN3ceqsw.js";
2
2
  export { e as default };
@@ -1,5 +1,5 @@
1
1
  import { initAttr as e } from "./utils/index.js";
2
- import { t } from "./form_inner-B7IMSpMf.js";
2
+ import { t } from "./form_inner-52DR1IPu.js";
3
3
  import { $$ as n, $one as r, addClass as i, off as a, on as o, removeClass as s } from "ph-utils/dom";
4
4
  import { isBlank as c, random as l } from "ph-utils";
5
5
  //#region src/components/md_input/index.less?inline
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./check-BQWzxdO2.js";
1
+ import { n as e, t } from "./check-CrlZ7zVL.js";
2
2
  //#region src/components/check/radio.less?inline
3
3
  var n = ".l-check__inner{border-radius:50%}.l-check__inner:after{content:\"\";background-color:#0000;border-radius:50%;width:60%;height:60%;transition:background-color .3s ease-in-out;display:block}:host(.is-checked) .l-check__inner:after{background-color:var(--l-primary-color,#722ed1)}:host(.is-disabled) .l-check__inner{border-color:var(--l-disabled-color,#e6e6e6)}:host(.is-disabled) .l-check__inner:after{background-color:var(--l-disabled-color,#e6e6e6)}", r = class extends e {
4
4
  static baseName = "radio";
@@ -1,18 +1,15 @@
1
1
  import FormInner from "../form/form_inner";
2
- type SelectOption = {
2
+ export type SelectOption = {
3
3
  class?: string;
4
4
  render?: (option: SelectOption, isSelect: boolean, selectedValues?: any | any[]) => HTMLElement | DocumentFragment;
5
5
  label?: string;
6
6
  value?: any;
7
7
  [index: string]: any;
8
8
  };
9
- export default class Select extends FormInner {
10
- static baseName: string;
11
- /** 选中的标签 */
12
- selectedLabels: string[];
9
+ type SelectState = {
13
10
  /** 是否启用过滤 */
14
11
  filterable?: boolean;
15
- placeholder?: string;
12
+ placeholder: string;
16
13
  /** 选项 label 的字段名 */
17
14
  labelField: string;
18
15
  /** 选项 value 的字段名 */
@@ -21,36 +18,44 @@ export default class Select extends FormInner {
21
18
  multiple?: boolean;
22
19
  /** 多选时是否折叠标签 */
23
20
  collapseTags?: boolean;
24
- /** 是否加载中, 远程搜索时使用 */
25
- _loading?: boolean;
26
21
  /** 宽度 */
27
22
  width?: string;
28
23
  /** 是否可清除 */
29
24
  clearable?: boolean;
30
- /** 是否展开下拉选择 */
31
- _expanded: boolean;
25
+ /** 是否远程搜索 */
32
26
  remote: boolean;
27
+ /** 是否加载中, 远程搜索时使用 */
28
+ loading?: boolean;
29
+ /** 是否展开下拉选择 */
30
+ expanded?: boolean;
31
+ };
32
+ export default class Select extends FormInner<SelectState> {
33
+ static baseName: string;
34
+ /** 选中的标签 */
35
+ selectedLabels: string[];
33
36
  filter?: (match: string, option: SelectOption) => boolean;
34
- options?: SelectOption[];
37
+ _options?: SelectOption[];
38
+ /** 备份数据, 搜索过滤时有用 */
35
39
  private _backOptions?;
36
40
  inputHandler?: (match: string) => void;
41
+ /** 下拉弹窗主体 */
37
42
  private _popover?;
38
43
  private _searchEl?;
39
44
  constructor();
40
- connectedCallback(): void;
41
45
  setInputHandler(handler: (match: string) => void): void;
42
46
  setFilter(filter: (match: string, option: SelectOption) => boolean): void;
43
47
  get loading(): boolean | undefined;
44
48
  set loading(loading: boolean | undefined);
45
49
  setLoading(loading: boolean): void;
46
- private get expanded();
47
- private set expanded(value);
48
50
  setExpanded(value: boolean): void;
49
51
  setValue(value: string | string[] | number): void;
50
52
  private _updateSelectedLabels;
51
53
  static get observedAttributes(): string[];
52
54
  protected attributeChange(name: string, _oldValue: string, newValue: string): void;
53
- setOptions(options: any[]): void;
55
+ protected updateDOM(changedProps: Set<string>): void;
56
+ get options(): SelectOption[] | undefined;
57
+ set options(opts: SelectOption[] | undefined);
58
+ setOptions(options: SelectOption[] | undefined): void;
54
59
  private _isOptionSelect;
55
60
  private _updateOptionSelect;
56
61
  private _renderOption;
@@ -69,6 +74,10 @@ export default class Select extends FormInner {
69
74
  private _filteOption;
70
75
  afterInit(): void;
71
76
  beforeDestroy(): void;
77
+ render_v2(): {
78
+ template?: string | HTMLElement | DocumentFragment;
79
+ style?: string | string[];
80
+ };
72
81
  render(): DocumentFragment;
73
82
  protected disabledChange(): void;
74
83
  private _renderTag;
@@ -1,3 +1,3 @@
1
- import { t as e } from "../select-CnwPEFQ3.js";
1
+ import { t as e } from "../select-Cis6kRjQ.js";
2
2
  import "../utils/popover.js";
3
3
  export { e as default };