@unizhen/ui 0.1.71 → 0.1.72

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 +67 -65
  2. package/package.json +1 -1
package/lib/ui.js CHANGED
@@ -5410,89 +5410,89 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5410
5410
  ...e.table,
5411
5411
  children: e.params.children.map((e) => e.key)
5412
5412
  })) : (m.push(e), h.push(e.key));
5413
- for await (let [e, p] of m.entries()) {
5414
- if (p.source && !p.table.render && (p.input === "select" || p.input === "cascader")) if (p.table.render = (e) => e[`${p.key}Str`], t || p.params.immediately || p.search.defaultValue) {
5415
- let { sourceData: t, n } = await Pp(p.source, a && e === 0);
5416
- if (t && Array.isArray(t)) if (p.sourceFn) {
5417
- let e = p.sourceFn, n = Function("sourceData", e);
5418
- p.params.options = n(t);
5419
- } else p.params.options = jp(p, t, n);
5420
- } else p.params.options = [{
5413
+ for await (let [e, s] of m.entries()) {
5414
+ if (s.source && !s.table.render && (s.input === "select" || s.input === "cascader")) if (s.table.render = (e) => e[`${s.key}Str`], t || s.params.immediately || s.search.defaultValue) {
5415
+ let { sourceData: t, n } = await Pp(s.source, a && e === 0);
5416
+ if (t && Array.isArray(t)) if (s.sourceFn) {
5417
+ let e = s.sourceFn, n = Function("sourceData", e);
5418
+ s.params.options = n(t);
5419
+ } else s.params.options = jp(s, t, n);
5420
+ } else s.params.options = [{
5421
5421
  label: "加载中......",
5422
5422
  value: "loading",
5423
5423
  disabled: !0
5424
- }], p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5425
- let { sourceData: e, n: t } = await Pp(p.source);
5426
- if (e && Array.isArray(e)) if (p.sourceFn) {
5427
- let t = p.sourceFn;
5424
+ }], s.params._async = !0, s.params._fetch = !1, s.params._asyncFn = async () => {
5425
+ let { sourceData: e, n: t } = await Pp(s.source);
5426
+ if (e && Array.isArray(e)) if (s.sourceFn) {
5427
+ let t = s.sourceFn;
5428
5428
  return Function("sourceData", t)(e);
5429
- } else return jp(p, e, t);
5429
+ } else return jp(s, e, t);
5430
5430
  };
5431
- !p.table.render && !p.source && p.input === "select" && typeof p.params.options != "function" && p.params.options.length > 0 && (p.table.render = (e) => {
5432
- let t = p.params.options.find((t) => t.value === e[p.key]);
5431
+ !s.table.render && !s.source && s.input === "select" && typeof s.params.options != "function" && s.params.options.length > 0 && (s.table.render = (e) => {
5432
+ let t = s.params.options.find((t) => t.value === e[s.key]);
5433
5433
  if (t) return t.label;
5434
- }), p.input === "upload" && !p.table.render && (p.table.render = function(e) {
5435
- return f(tp, { value: e[p.key] }, { default: () => null });
5436
- }), s += Number(p.table.width || 140);
5437
- let m = {
5438
- input: p.input,
5439
- title: p.label,
5440
- key: p.key,
5441
- params: p.params,
5442
- form: p.form,
5434
+ }), s.input === "upload" && !s.table.render && (s.table.render = function(e) {
5435
+ return f(tp, { value: e[s.key] }, { default: () => null });
5436
+ });
5437
+ let p = {
5438
+ input: s.input,
5439
+ title: s.label,
5440
+ key: s.key,
5441
+ params: s.params,
5442
+ form: s.form,
5443
5443
  ellipsisComponent: "performant-ellipsis",
5444
- ...p.table,
5445
- width: Number(p.table.width || 140),
5446
- ellipsis: p.table.ellipsis ? {
5444
+ ...s.table,
5445
+ width: Number(s.table.width || 140),
5446
+ ellipsis: s.table.ellipsis ? {
5447
5447
  tooltip: !0,
5448
- "line-clamp": p.table.clamp ?? 0
5448
+ "line-clamp": s.table.clamp ?? 0
5449
5449
  } : !1,
5450
- render: p.table.render ? await Ap(p.key, p.table.render, i) : void 0,
5451
- show: K.isMobile ? p.table.mobile ?? !1 : p.table.show ?? !0,
5452
- pin: !!p.table.fixed,
5453
- fixTemp: p.table.fixed
5450
+ render: s.table.render ? await Ap(s.key, s.table.render, i) : void 0,
5451
+ show: K.isMobile ? s.table.mobile ?? !1 : s.table.show ?? !0,
5452
+ pin: !!s.table.fixed,
5453
+ fixTemp: s.table.fixed
5454
5454
  };
5455
- if (m.resizable && (m.minWidth = 80), t) if (!m.form.edit.show) m = null;
5455
+ if (p.resizable && (p.minWidth = 80), t) if (!p.form.edit.show) p = null;
5456
5456
  else {
5457
- if (m.ellipsis = !1, m.resizable = !0, K.isMobile && (m.show = p.table.mobile), p.table.show && (n === 0 && (m.show = p.form.create.show), n === 1 && (m.show = p.form.edit.show), n === 2 && (m.show = p.form.show)), o && (p.form.rule.validator = () => !0), o === !1 && p.form.rule?.required && typeof p.form.rule.validator == "string") {
5458
- delete p.form.rule.message;
5459
- let e = p.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5460
- p.form.rule.validator === "" ? p.form.rule.validator = (e, t) => r()[e.index].delete || t ? !0 : Error(p.form.rule.message) : p.form.rule.validator = (e, n) => r()[e.index].delete ? !0 : t(e, n, e.index, () => r());
5457
+ if (p.ellipsis = !1, p.resizable = !0, K.isMobile && (p.show = s.table.mobile), s.table.show && (n === 0 && (p.show = s.form.create.show), n === 1 && (p.show = s.form.edit.show), n === 2 && (p.show = s.form.show)), o && (s.form.rule.validator = () => !0), o === !1 && s.form.rule?.required && typeof s.form.rule.validator == "string") {
5458
+ delete s.form.rule.message;
5459
+ let e = s.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5460
+ s.form.rule.validator === "" ? s.form.rule.validator = (e, t) => r()[e.index].delete || t ? !0 : Error(s.form.rule.message) : s.form.rule.validator = (e, n) => r()[e.index].delete ? !0 : t(e, n, e.index, () => r());
5461
5461
  }
5462
- m.render = function(e, t) {
5462
+ p.render = function(e, t) {
5463
5463
  return f(he, {
5464
5464
  showLabel: !1,
5465
5465
  showFeedback: !1,
5466
- path: `child[${t}].${p.key}`,
5467
- rule: p.form.rule?.required ? {
5468
- ...p.form.rule,
5466
+ path: `child[${t}].${s.key}`,
5467
+ rule: s.form.rule?.required ? {
5468
+ ...s.form.rule,
5469
5469
  index: t
5470
5470
  } : void 0
5471
5471
  }, { default: () => f(If, {
5472
- item: p,
5472
+ item: s,
5473
5473
  formValue: e,
5474
5474
  status: n,
5475
5475
  itemIndex: t
5476
5476
  }) });
5477
5477
  };
5478
5478
  }
5479
- if (m && p.input !== "divider" && p.input !== "subTable" && (o && (m.show = p.form.expand.show), d.push(m)), p.input !== "divider" && p.input !== "switch" && p.input !== "subTable" && p.input !== "upload" && p.search.show) {
5480
- if (p.search.title && (p.label = p.search.title), p.search.source) if (p.input = "select", p.params.type = p.search.type, p.params.valueKey = p.search.valueKey, p.params.valueKey = p.search.valueKey, p.search.source === "from-up") p.params.options = p.params.options;
5481
- else if (p.params.immediately || p.search.defaultValue) {
5482
- let { sourceData: e, n: t } = await Pp(p.search.source);
5483
- if (e && Array.isArray(e)) if (p.sourceFn) {
5484
- let t = p.sourceFn, n = Function("sourceData", t);
5485
- p.params.options = n(e);
5486
- } else p.params.options = jp(p, e, t);
5487
- } else p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5488
- let { sourceData: e, n: t } = await Pp(p.search.source);
5489
- if (e && Array.isArray(e)) if (p.sourceFn) {
5490
- let t = p.sourceFn;
5479
+ if (p && s.input !== "divider" && s.input !== "subTable" && (o && (p.show = s.form.expand.show), d.push(p)), s.input !== "divider" && s.input !== "switch" && s.input !== "subTable" && s.input !== "upload" && s.search.show) {
5480
+ if (s.search.title && (s.label = s.search.title), s.search.source) if (s.input = "select", s.params.type = s.search.type, s.params.valueKey = s.search.valueKey, s.params.valueKey = s.search.valueKey, s.search.source === "from-up") s.params.options = s.params.options;
5481
+ else if (s.params.immediately || s.search.defaultValue) {
5482
+ let { sourceData: e, n: t } = await Pp(s.search.source);
5483
+ if (e && Array.isArray(e)) if (s.sourceFn) {
5484
+ let t = s.sourceFn, n = Function("sourceData", t);
5485
+ s.params.options = n(e);
5486
+ } else s.params.options = jp(s, e, t);
5487
+ } else s.params._async = !0, s.params._fetch = !1, s.params._asyncFn = async () => {
5488
+ let { sourceData: e, n: t } = await Pp(s.search.source);
5489
+ if (e && Array.isArray(e)) if (s.sourceFn) {
5490
+ let t = s.sourceFn;
5491
5491
  return Function("sourceData", t)(e);
5492
- } else return jp(p, e, t);
5492
+ } else return jp(s, e, t);
5493
5493
  };
5494
- if (p.search.multiple && (p.params.multiple = !0, p.search.defaultValue && (p.search.defaultValue = Op(p.search.defaultValue))), p.search.show) {
5495
- let e = H(p);
5494
+ if (s.search.multiple && (s.params.multiple = !0, s.search.defaultValue && (s.search.defaultValue = Op(s.search.defaultValue))), s.search.show) {
5495
+ let e = H(s);
5496
5496
  e.params._async && (e.params._search = !0, e.params._asyncFn = async () => {
5497
5497
  let { sourceData: t, n } = await Pp(e.source || e.search.source);
5498
5498
  if (t && Array.isArray(t)) if (e.sourceFn) {
@@ -5515,10 +5515,10 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5515
5515
  });
5516
5516
  }
5517
5517
  }
5518
- p.input === "subTable" && p.params.link && !p.params.quest && (l.push(p.params.link), p.params.expandable && (u = {
5519
- key: p.key,
5520
- link: p.params.link,
5521
- merge: p.params.merge
5518
+ s.input === "subTable" && s.params.link && !s.params.quest && (l.push(s.params.link), s.params.expandable && (u = {
5519
+ key: s.key,
5520
+ link: s.params.link,
5521
+ merge: s.params.merge
5522
5522
  }));
5523
5523
  }
5524
5524
  let g = [];
@@ -5539,7 +5539,9 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5539
5539
  }
5540
5540
  d = g;
5541
5541
  }
5542
- return {
5542
+ return d.forEach((e) => {
5543
+ e.show && (s += e.width);
5544
+ }), {
5543
5545
  tableColumns: d,
5544
5546
  search: c,
5545
5547
  subTableIds: l,
@@ -6757,7 +6759,7 @@ var om = /*#__PURE__*/ U(Xp, [["render", am]]), sm = d({
6757
6759
  titleAlign: "center",
6758
6760
  width: 10,
6759
6761
  show: !0
6760
- }), s += 60, e.item.params.draggable && e.status !== 2 && (r.unshift({
6762
+ }), s += 10, e.item.params.draggable && e.status !== 2 && (r.unshift({
6761
6763
  title: " ",
6762
6764
  key: "draggable",
6763
6765
  align: "center",
@@ -6803,7 +6805,7 @@ var om = /*#__PURE__*/ U(Xp, [["render", am]]), sm = d({
6803
6805
  let c = [];
6804
6806
  r.forEach((e) => {
6805
6807
  e.show && c.push(e);
6806
- }), b.value = c, s += 180, E.value = s, g.value = !1;
6808
+ }), b.value = c, s += 60, E.value = s, g.value = !1;
6807
6809
  }, te = (t) => {
6808
6810
  if (e.item.params.summary) {
6809
6811
  if (typeof e.item.params.summary == "function") return e.item.params.summary(t);
@@ -8550,7 +8552,7 @@ function qh(e, t, n) {
8550
8552
  }
8551
8553
  //#endregion
8552
8554
  //#region package.json
8553
- var Jh = "0.1.71", Yh;
8555
+ var Jh = "0.1.72", Yh;
8554
8556
  async function Xh() {
8555
8557
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
8556
8558
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.71",
3
+ "version": "0.1.72",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },