@unizhen/ui 0.1.23 → 0.1.25

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.
@@ -114,7 +114,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
114
114
  params: {
115
115
  placeholder: string | (() => string);
116
116
  filterable: boolean;
117
- options: any;
118
117
  type: any;
119
118
  _async?: boolean;
120
119
  _fetch?: boolean;
@@ -123,7 +122,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
123
122
  } | {
124
123
  placeholder: string | (() => string);
125
124
  filterable: boolean;
126
- options: any;
127
125
  type: any;
128
126
  _async?: boolean;
129
127
  _fetch?: boolean;
@@ -137,12 +135,12 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
137
135
  } | {
138
136
  placeholder: string | (() => string);
139
137
  filterable: boolean;
140
- options: any;
141
138
  type: any;
142
139
  _async?: boolean;
143
140
  _fetch?: boolean;
144
141
  _asyncFn?: () => Promise<any[]>;
145
142
  clearable: boolean;
143
+ options: (() => Promise<any[]>) | any[];
146
144
  minlength?: number | null;
147
145
  maxlength?: number | null;
148
146
  rows?: number | null;
@@ -151,7 +149,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
151
149
  } | {
152
150
  placeholder: string | (() => string);
153
151
  filterable: boolean;
154
- options: any;
155
152
  type: any;
156
153
  _async?: boolean;
157
154
  _fetch?: boolean;
@@ -169,7 +166,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
169
166
  } | {
170
167
  placeholder: string | (() => string);
171
168
  filterable: boolean;
172
- options: any;
173
169
  type: any;
174
170
  _async?: boolean;
175
171
  _fetch?: boolean;
@@ -187,13 +183,13 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
187
183
  } | {
188
184
  placeholder: string | (() => string);
189
185
  filterable: boolean;
190
- options: any;
191
186
  type: any;
192
187
  _async?: boolean;
193
188
  _fetch?: boolean;
194
189
  _asyncFn?: () => Promise<any[]>;
195
190
  immediately: boolean;
196
191
  clearable: boolean;
192
+ options: (() => Promise<any[]>) | any[];
197
193
  multiple?: boolean;
198
194
  tag?: boolean;
199
195
  title?: string;
@@ -207,18 +203,17 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
207
203
  } | {
208
204
  placeholder: string | (() => string);
209
205
  filterable: boolean;
210
- options: any;
211
206
  type: any;
212
207
  _async?: boolean;
213
208
  _fetch?: boolean;
214
209
  _asyncFn?: () => Promise<any[]>;
215
210
  immediately: boolean;
216
211
  clearable: boolean;
212
+ options: (() => Promise<any[]>) | any[];
217
213
  multiple?: boolean;
218
214
  } | {
219
215
  placeholder: string | (() => string);
220
216
  filterable: boolean;
221
- options: any;
222
217
  type: any;
223
218
  _async?: boolean;
224
219
  _fetch?: boolean;
@@ -227,16 +222,15 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
227
222
  } | {
228
223
  placeholder: string | (() => string);
229
224
  filterable: boolean;
230
- options: any;
231
225
  type: any;
232
226
  _async?: boolean;
233
227
  _fetch?: boolean;
234
228
  _asyncFn?: () => Promise<any[]>;
235
229
  clearable: boolean;
230
+ options: (() => Promise<Array<ObjectKey>>) | Array<ObjectKey>;
236
231
  } | {
237
232
  placeholder: string | (() => string);
238
233
  filterable: boolean;
239
- options: any;
240
234
  type: any;
241
235
  _async?: boolean;
242
236
  _fetch?: boolean;
@@ -246,7 +240,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
246
240
  } | {
247
241
  placeholder: string | (() => string);
248
242
  filterable: boolean;
249
- options: any;
250
243
  type: any;
251
244
  _async?: boolean;
252
245
  _fetch?: boolean;
@@ -255,7 +248,6 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
255
248
  } | {
256
249
  placeholder: string | (() => string);
257
250
  filterable: boolean;
258
- options: any;
259
251
  type: any;
260
252
  _async?: boolean;
261
253
  _fetch?: boolean;
@@ -264,7 +256,7 @@ export declare function fnPrepareTableData(items: IUzFormItems, child?: boolean,
264
256
  parentKey: string;
265
257
  };
266
258
  form: {
267
- show: true;
259
+ show: boolean;
268
260
  };
269
261
  search: ISearch;
270
262
  }[];
package/lib/ui.js CHANGED
@@ -3484,7 +3484,10 @@ var xf = /* @__PURE__ */ U(vf, [["render", bf]]), Sf = d({
3484
3484
  }, g = (e) => (u.value = [], e.forEach((e) => {
3485
3485
  if (e.form.defaultValue && !s.value[e.key]) if (e.input === "number") s.value[e.key] = Number(e.form.defaultValue);
3486
3486
  else if (e.input === "select" && e.params.options?.length > 0) {
3487
- e.form.defaultValue === "userId" ? s.value[e.key] = r.userId : s.value[e.key] = e.form.defaultValue;
3487
+ e.form.defaultValue === "userId" ? (s.value[e.key] = r.userId, e.params.options = [{
3488
+ label: r.userName,
3489
+ value: r.userId
3490
+ }]) : s.value[e.key] = e.form.defaultValue;
3488
3491
  let t = e.params.options.find((t) => t.value === s.value[e.key]);
3489
3492
  t && (s.value[`${e.key}Str`] = t.label);
3490
3493
  } else if (e.input === "date") if (e.params.type.indexOf("range") > -1) switch (e.form.defaultValue) {
@@ -3745,7 +3748,10 @@ var Tf = /* @__PURE__ */ U(Sf, [["render", wf]]), Ef = d({
3745
3748
  }, u = (e) => (e.forEach((e) => {
3746
3749
  if (e.form.defaultValue && !a.value[e.key]) if (e.input === "number") a.value[e.key] = Number(e.form.defaultValue);
3747
3750
  else if (e.input === "select" && e.params.options?.length > 0) {
3748
- e.form.defaultValue === "userId" ? a.value[e.key] = r.userId : a.value[e.key] = e.form.defaultValue;
3751
+ e.form.defaultValue === "userId" ? (a.value[e.key] = r.userId, e.params.options = [{
3752
+ label: r.userName,
3753
+ value: r.userId
3754
+ }]) : a.value[e.key] = e.form.defaultValue;
3749
3755
  let t = e.params.options.find((t) => t.value === a.value[e.key]);
3750
3756
  t && (a.value[`${e.key}Str`] = t.label);
3751
3757
  } else if (e.input === "date") switch (e.form.defaultValue) {
@@ -4563,7 +4569,7 @@ var Zf = /* @__PURE__ */ U(Gf, [["render", Xf]]), Qf = d({
4563
4569
  range: !1,
4564
4570
  fuzzy: e.search.fuzzy
4565
4571
  };
4566
- (e.input === "cascader" || e.input === "select") && e.params.multiple && (n.range = !0), e.input === "date" && e.params.type.indexOf("range") > -1 && (n.range = !0, n.time = !0), o.push(n);
4572
+ (e.input === "cascader" || e.input === "select") && (n.str = a[`${e.key}Str`]), (e.input === "cascader" || e.input === "select") && e.params.multiple && (n.range = !0), e.input === "date" && e.params.type.indexOf("range") > -1 && (n.range = !0, n.time = !0), o.push(n);
4567
4573
  }
4568
4574
  }
4569
4575
  }), t("update:loading", !0), t("on-update:value", o);
@@ -4609,6 +4615,13 @@ var Zf = /* @__PURE__ */ U(Gf, [["render", Xf]]), Qf = d({
4609
4615
  if (e.cache && l) {
4610
4616
  let e = Y(`tables_${l}`, !1);
4611
4617
  e && e.params.forEach((e) => {
4618
+ if (e.str) {
4619
+ let t = o.find((t) => t.key === e.key);
4620
+ t && (c[`${e.key}Str`] = e.str, t.params.options = [{
4621
+ label: e.str,
4622
+ value: e.value
4623
+ }]);
4624
+ }
4612
4625
  c[e.key] = e.value;
4613
4626
  });
4614
4627
  }
@@ -4998,7 +5011,7 @@ var pp = () => new Promise((e) => {
4998
5011
  }), r = Ze(r).join("-")) : r = t[n[1]], e.input === "select" && e.params.valueKey && (i = t[e.params.valueKey]), {
4999
5012
  label: r,
5000
5013
  value: i,
5001
- disabled: t?.is_disabled === "1",
5014
+ disabled: e.params._search ? !1 : t?.is_disabled === "1",
5002
5015
  params: t
5003
5016
  };
5004
5017
  });
@@ -5438,24 +5451,29 @@ async function Dp(e, t = !1, n = 0, r = () => {}, i = {}) {
5438
5451
  return Function("sourceData", n)(t);
5439
5452
  } else return hp(e, t, n);
5440
5453
  };
5441
- e.search.multiple && (e.params.multiple = !0, e.search.defaultValue && (e.search.defaultValue = fp(e.search.defaultValue))), o.push({
5442
- input: e.input,
5443
- label: e.label,
5444
- key: e.key,
5445
- defaultValue: e.search.defaultValue,
5446
- params: {
5447
- ...e.params,
5448
- placeholder: e.label,
5449
- filterable: !0,
5450
- options: e.params.options ? e.params.options.map((e) => ({
5451
- ...e,
5452
- disabled: !1
5453
- })) : void 0,
5454
- type: e.params.type
5455
- },
5456
- form: { show: e.search.show },
5457
- search: e.search
5458
- });
5454
+ if (e.search.multiple && (e.params.multiple = !0, e.search.defaultValue && (e.search.defaultValue = fp(e.search.defaultValue))), e.search.show) {
5455
+ let t = H(e);
5456
+ t.params._async && (t.params._search = !0, t.params._asyncFn = async () => {
5457
+ let { sourceData: e, n } = await vp(t.source);
5458
+ if (e && Array.isArray(e)) if (t.sourceFn) {
5459
+ let n = t.sourceFn;
5460
+ return Function("sourceData", n)(e);
5461
+ } else return hp(t, e, n);
5462
+ }), o.push({
5463
+ input: t.input,
5464
+ label: t.label,
5465
+ key: t.key,
5466
+ defaultValue: t.search.defaultValue,
5467
+ params: {
5468
+ ...t.params,
5469
+ placeholder: t.label,
5470
+ filterable: !0,
5471
+ type: t.params.type
5472
+ },
5473
+ form: { show: t.search.show },
5474
+ search: t.search
5475
+ });
5476
+ }
5459
5477
  }
5460
5478
  e.input === "subTable" && e.params.link && !e.params.quest && s.push(e.params.link);
5461
5479
  }
@@ -7921,7 +7939,7 @@ function Qm(e, t, n) {
7921
7939
  }
7922
7940
  //#endregion
7923
7941
  //#region package.json
7924
- var $m = "0.1.23", eh;
7942
+ var $m = "0.1.25", eh;
7925
7943
  async function th() {
7926
7944
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
7927
7945
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },