@unizhen/ui 0.1.35 → 0.1.36

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 (2) hide show
  1. package/lib/ui.js +81 -81
  2. package/package.json +1 -1
package/lib/ui.js CHANGED
@@ -5380,112 +5380,112 @@ async function Ep(e, t = !1, n = 0, r = () => {}, i = {}, a = !1) {
5380
5380
  ...e.table,
5381
5381
  children: e.params.children.map((e) => e.key)
5382
5382
  })) : (d.push(e), p.push(e.key));
5383
- for await (let e of d) {
5384
- if (e.source && !e.table.render && (e.input === "select" || e.input === "cascader")) if (e.table.render = (t) => t[`${e.key}Str`], t || e.params.immediately || e.search.defaultValue) {
5385
- let { sourceData: t, n } = await _p(e.source, a);
5386
- if (t && Array.isArray(t)) if (e.sourceFn) {
5387
- let n = e.sourceFn, r = Function("sourceData", n);
5388
- e.params.options = r(t);
5389
- } else e.params.options = mp(e, t, n);
5390
- } else e.params.options = [{
5383
+ for await (let [e, u] of d.entries()) {
5384
+ if (u.source && !u.table.render && (u.input === "select" || u.input === "cascader")) if (u.table.render = (e) => e[`${u.key}Str`], t || u.params.immediately || u.search.defaultValue) {
5385
+ let { sourceData: t, n } = await _p(u.source, a && e === 0);
5386
+ if (t && Array.isArray(t)) if (u.sourceFn) {
5387
+ let e = u.sourceFn, n = Function("sourceData", e);
5388
+ u.params.options = n(t);
5389
+ } else u.params.options = mp(u, t, n);
5390
+ } else u.params.options = [{
5391
5391
  label: "加载中......",
5392
5392
  value: "loading",
5393
5393
  disabled: !0
5394
- }], e.params._async = !0, e.params._fetch = !1, e.params._asyncFn = async () => {
5395
- let { sourceData: t, n } = await _p(e.source);
5396
- if (t && Array.isArray(t)) if (e.sourceFn) {
5397
- let n = e.sourceFn;
5398
- return Function("sourceData", n)(t);
5399
- } else return mp(e, t, n);
5394
+ }], u.params._async = !0, u.params._fetch = !1, u.params._asyncFn = async () => {
5395
+ let { sourceData: e, n: t } = await _p(u.source);
5396
+ if (e && Array.isArray(e)) if (u.sourceFn) {
5397
+ let t = u.sourceFn;
5398
+ return Function("sourceData", t)(e);
5399
+ } else return mp(u, e, t);
5400
5400
  };
5401
- !e.table.render && !e.source && e.input === "select" && typeof e.params.options != "function" && e.params.options.length > 0 && (e.table.render = (t) => {
5402
- let n = e.params.options.find((n) => n.value === t[e.key]);
5403
- if (n) return n.label;
5404
- }), e.input === "upload" && !e.table.render && (e.table.render = function(t) {
5405
- return f(zf, { value: t[e.key] }, { default: () => null });
5406
- }), o += Number(e.table.width || 140);
5407
- let u = {
5408
- input: e.input,
5409
- title: e.label,
5410
- key: e.key,
5411
- params: e.params,
5412
- form: e.form,
5401
+ !u.table.render && !u.source && u.input === "select" && typeof u.params.options != "function" && u.params.options.length > 0 && (u.table.render = (e) => {
5402
+ let t = u.params.options.find((t) => t.value === e[u.key]);
5403
+ if (t) return t.label;
5404
+ }), u.input === "upload" && !u.table.render && (u.table.render = function(e) {
5405
+ return f(zf, { value: e[u.key] }, { default: () => null });
5406
+ }), o += Number(u.table.width || 140);
5407
+ let d = {
5408
+ input: u.input,
5409
+ title: u.label,
5410
+ key: u.key,
5411
+ params: u.params,
5412
+ form: u.form,
5413
5413
  ellipsisComponent: "performant-ellipsis",
5414
- ...e.table,
5415
- width: Number(e.table.width || 140),
5416
- ellipsis: e.table.ellipsis ? {
5414
+ ...u.table,
5415
+ width: Number(u.table.width || 140),
5416
+ ellipsis: u.table.ellipsis ? {
5417
5417
  tooltip: !0,
5418
- "line-clamp": e.table.clamp ?? 0
5418
+ "line-clamp": u.table.clamp ?? 0
5419
5419
  } : !1,
5420
- render: e.table.render ? await pp(e.key, e.table.render, i) : void 0,
5421
- show: K.isMobile ? e.table.mobile ?? !1 : e.table.show ?? !0,
5422
- pin: !!e.table.fixed,
5423
- fixTemp: e.table.fixed
5420
+ render: u.table.render ? await pp(u.key, u.table.render, i) : void 0,
5421
+ show: K.isMobile ? u.table.mobile ?? !1 : u.table.show ?? !0,
5422
+ pin: !!u.table.fixed,
5423
+ fixTemp: u.table.fixed
5424
5424
  };
5425
- if (t) if (!u.form.edit.show) u = null;
5425
+ if (t) if (!d.form.edit.show) d = null;
5426
5426
  else {
5427
- if (u.ellipsis = !1, u.resizable = !0, K.isMobile && (u.show = e.table.mobile), e.table.show && (n === 0 && (u.show = e.form.create.show), n === 1 && (u.show = e.form.edit.show), n === 2 && (u.show = e.form.show)), e.form.rule?.required && typeof e.form.rule.validator == "string") {
5428
- delete e.form.rule.message;
5429
- let t = e.form.rule.validator, n = Function("rule", "value", "index", "formValues", t);
5430
- e.form.rule.validator === "" ? e.form.rule.validator = (t, n) => r()[t.index].delete || n ? !0 : Error(e.form.rule.message) : e.form.rule.validator = (e, t) => r()[e.index].delete ? !0 : n(e, t, e.index, () => r());
5427
+ if (d.ellipsis = !1, d.resizable = !0, K.isMobile && (d.show = u.table.mobile), u.table.show && (n === 0 && (d.show = u.form.create.show), n === 1 && (d.show = u.form.edit.show), n === 2 && (d.show = u.form.show)), u.form.rule?.required && typeof u.form.rule.validator == "string") {
5428
+ delete u.form.rule.message;
5429
+ let e = u.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5430
+ u.form.rule.validator === "" ? u.form.rule.validator = (e, t) => r()[e.index].delete || t ? !0 : Error(u.form.rule.message) : u.form.rule.validator = (e, n) => r()[e.index].delete ? !0 : t(e, n, e.index, () => r());
5431
5431
  }
5432
- u.render = function(t, r) {
5432
+ d.render = function(e, t) {
5433
5433
  return f(me, {
5434
5434
  showLabel: !1,
5435
5435
  showFeedback: !1,
5436
- path: `child[${r}].${e.key}`,
5437
- rule: e.form.rule?.required ? {
5438
- ...e.form.rule,
5439
- index: r
5436
+ path: `child[${t}].${u.key}`,
5437
+ rule: u.form.rule?.required ? {
5438
+ ...u.form.rule,
5439
+ index: t
5440
5440
  } : void 0
5441
5441
  }, { default: () => f(bf, {
5442
- item: e,
5443
- formValue: t,
5442
+ item: u,
5443
+ formValue: e,
5444
5444
  status: n,
5445
- itemIndex: r
5445
+ itemIndex: t
5446
5446
  }) });
5447
5447
  };
5448
5448
  }
5449
- if (u && e.input !== "divider" && e.input !== "subTable" && l.push(u), e.input !== "divider" && e.input !== "switch" && e.input !== "subTable" && e.input !== "upload" && e.search.show) {
5450
- if (e.search.title && (e.label = e.search.title), e.search.source) if (e.input = "select", e.params.type = e.search.type, e.params.valueKey = e.search.valueKey, e.params.valueKey = e.search.valueKey, e.search.source === "from-up") e.params.options = e.params.options;
5451
- else if (e.params.immediately || e.search.defaultValue) {
5452
- let { sourceData: t, n } = await _p(e.search.source);
5453
- if (t && Array.isArray(t)) if (e.sourceFn) {
5454
- let n = e.sourceFn, r = Function("sourceData", n);
5455
- e.params.options = r(t);
5456
- } else e.params.options = mp(e, t, n);
5457
- } else e.params._async = !0, e.params._fetch = !1, e.params._asyncFn = async () => {
5458
- let { sourceData: t, n } = await _p(e.search.source);
5459
- if (t && Array.isArray(t)) if (e.sourceFn) {
5460
- let n = e.sourceFn;
5461
- return Function("sourceData", n)(t);
5462
- } else return mp(e, t, n);
5449
+ if (d && u.input !== "divider" && u.input !== "subTable" && l.push(d), u.input !== "divider" && u.input !== "switch" && u.input !== "subTable" && u.input !== "upload" && u.search.show) {
5450
+ if (u.search.title && (u.label = u.search.title), u.search.source) if (u.input = "select", u.params.type = u.search.type, u.params.valueKey = u.search.valueKey, u.params.valueKey = u.search.valueKey, u.search.source === "from-up") u.params.options = u.params.options;
5451
+ else if (u.params.immediately || u.search.defaultValue) {
5452
+ let { sourceData: e, n: t } = await _p(u.search.source);
5453
+ if (e && Array.isArray(e)) if (u.sourceFn) {
5454
+ let t = u.sourceFn, n = Function("sourceData", t);
5455
+ u.params.options = n(e);
5456
+ } else u.params.options = mp(u, e, t);
5457
+ } else u.params._async = !0, u.params._fetch = !1, u.params._asyncFn = async () => {
5458
+ let { sourceData: e, n: t } = await _p(u.search.source);
5459
+ if (e && Array.isArray(e)) if (u.sourceFn) {
5460
+ let t = u.sourceFn;
5461
+ return Function("sourceData", t)(e);
5462
+ } else return mp(u, e, t);
5463
5463
  };
5464
- if (e.search.multiple && (e.params.multiple = !0, e.search.defaultValue && (e.search.defaultValue = dp(e.search.defaultValue))), e.search.show) {
5465
- let t = H(e);
5466
- t.params._async && (t.params._search = !0, t.params._asyncFn = async () => {
5467
- let { sourceData: e, n } = await _p(t.source || t.search.source);
5468
- if (e && Array.isArray(e)) if (t.sourceFn) {
5469
- let n = t.sourceFn;
5470
- return Function("sourceData", n)(e);
5471
- } else return mp(t, e, n);
5464
+ if (u.search.multiple && (u.params.multiple = !0, u.search.defaultValue && (u.search.defaultValue = dp(u.search.defaultValue))), u.search.show) {
5465
+ let e = H(u);
5466
+ e.params._async && (e.params._search = !0, e.params._asyncFn = async () => {
5467
+ let { sourceData: t, n } = await _p(e.source || e.search.source);
5468
+ if (t && Array.isArray(t)) if (e.sourceFn) {
5469
+ let n = e.sourceFn;
5470
+ return Function("sourceData", n)(t);
5471
+ } else return mp(e, t, n);
5472
5472
  }), s.push({
5473
- input: t.input,
5474
- label: t.label,
5475
- key: t.key,
5476
- defaultValue: t.search.defaultValue,
5473
+ input: e.input,
5474
+ label: e.label,
5475
+ key: e.key,
5476
+ defaultValue: e.search.defaultValue,
5477
5477
  params: {
5478
- ...t.params,
5479
- placeholder: t.label,
5478
+ ...e.params,
5479
+ placeholder: e.label,
5480
5480
  filterable: !0,
5481
- type: t.params.type
5481
+ type: e.params.type
5482
5482
  },
5483
- form: { show: t.search.show },
5484
- search: t.search
5483
+ form: { show: e.search.show },
5484
+ search: e.search
5485
5485
  });
5486
5486
  }
5487
5487
  }
5488
- e.input === "subTable" && e.params.link && !e.params.quest && c.push(e.params.link);
5488
+ u.input === "subTable" && u.params.link && !u.params.quest && c.push(u.params.link);
5489
5489
  }
5490
5490
  let m = [];
5491
5491
  if (p.length > 0) {
@@ -6117,7 +6117,7 @@ var kp = /*#__PURE__*/ U(Dp, [["render", Op]]), Ap = d({
6117
6117
  Ce(), e.columns ? (M.value = e.columns || [], N.value = e.actions || [], P.value = e.suffixes || [], I.value = wp(e.options), await xe()) : await vp(t).then(async (e) => {
6118
6118
  De(e), await xe();
6119
6119
  }).catch((e) => {
6120
- L.value = e.message, te.value = !0;
6120
+ L.value = e?.message || o("Notice.network"), te.value = !0;
6121
6121
  });
6122
6122
  }, ke = (e) => {
6123
6123
  if (e.type !== "group" && e.optionsType) {
@@ -7989,7 +7989,7 @@ function Xm(e, t, n) {
7989
7989
  }
7990
7990
  //#endregion
7991
7991
  //#region package.json
7992
- var Zm = "0.1.35", Qm;
7992
+ var Zm = "0.1.36", Qm;
7993
7993
  async function $m() {
7994
7994
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
7995
7995
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },