@unizhen/ui 0.1.65 → 0.1.66

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.
package/lib/ui.js CHANGED
@@ -5140,6 +5140,11 @@ var Ip = (e) => e.map((e) => {
5140
5140
  d: +!!e.form.edit.disabled,
5141
5141
  r: +!!e.form.edit.readonly,
5142
5142
  s: +!!e.form.edit.show
5143
+ },
5144
+ p: {
5145
+ d: +!!e.form.expand.disabled,
5146
+ r: +!!e.form.expand.readonly,
5147
+ s: +!!e.form.expand.show
5143
5148
  }
5144
5149
  }
5145
5150
  };
@@ -5211,6 +5216,11 @@ var Ip = (e) => e.map((e) => {
5211
5216
  disabled: !!e.f.e.d,
5212
5217
  readonly: !!e.f.e.r,
5213
5218
  show: !!e.f.e.s
5219
+ },
5220
+ expand: {
5221
+ disabled: !!e.f.p?.d,
5222
+ readonly: !!e.f.p?.r,
5223
+ show: !!e.f.p?.s
5214
5224
  }
5215
5225
  }
5216
5226
  };
@@ -5388,104 +5398,104 @@ function Hp(e, t, n, r) {
5388
5398
  });
5389
5399
  });
5390
5400
  }
5391
- async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1) {
5392
- let o = 0, s = [], c = [], l = [], u = [], d = H(e), p = [], m = [];
5393
- for (let e of d) e.input === "group" ? (p.push(...e.params.children), m.push({
5401
+ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5402
+ let s = 0, c = [], l = [], u = [], d = [], p = H(e), m = [], h = [];
5403
+ for (let e of p) e.input === "group" ? (m.push(...e.params.children), h.push({
5394
5404
  title: e.label,
5395
5405
  key: e.key,
5396
5406
  ...e.table,
5397
5407
  children: e.params.children.map((e) => e.key)
5398
- })) : (p.push(e), m.push(e.key));
5399
- for await (let [e, d] of p.entries()) {
5400
- if (d.source && !d.table.render && (d.input === "select" || d.input === "cascader")) if (d.table.render = (e) => e[`${d.key}Str`], t || d.params.immediately || d.search.defaultValue) {
5401
- let { sourceData: t, n } = await Pp(d.source, a && e === 0);
5402
- if (t && Array.isArray(t)) if (d.sourceFn) {
5403
- let e = d.sourceFn, n = Function("sourceData", e);
5404
- d.params.options = n(t);
5405
- } else d.params.options = jp(d, t, n);
5406
- } else d.params.options = [{
5408
+ })) : (m.push(e), h.push(e.key));
5409
+ for await (let [e, p] of m.entries()) {
5410
+ 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) {
5411
+ let { sourceData: t, n } = await Pp(p.source, a && e === 0);
5412
+ if (t && Array.isArray(t)) if (p.sourceFn) {
5413
+ let e = p.sourceFn, n = Function("sourceData", e);
5414
+ p.params.options = n(t);
5415
+ } else p.params.options = jp(p, t, n);
5416
+ } else p.params.options = [{
5407
5417
  label: "加载中......",
5408
5418
  value: "loading",
5409
5419
  disabled: !0
5410
- }], d.params._async = !0, d.params._fetch = !1, d.params._asyncFn = async () => {
5411
- let { sourceData: e, n: t } = await Pp(d.source);
5412
- if (e && Array.isArray(e)) if (d.sourceFn) {
5413
- let t = d.sourceFn;
5420
+ }], p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5421
+ let { sourceData: e, n: t } = await Pp(p.source);
5422
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5423
+ let t = p.sourceFn;
5414
5424
  return Function("sourceData", t)(e);
5415
- } else return jp(d, e, t);
5425
+ } else return jp(p, e, t);
5416
5426
  };
5417
- !d.table.render && !d.source && d.input === "select" && typeof d.params.options != "function" && d.params.options.length > 0 && (d.table.render = (e) => {
5418
- let t = d.params.options.find((t) => t.value === e[d.key]);
5427
+ !p.table.render && !p.source && p.input === "select" && typeof p.params.options != "function" && p.params.options.length > 0 && (p.table.render = (e) => {
5428
+ let t = p.params.options.find((t) => t.value === e[p.key]);
5419
5429
  if (t) return t.label;
5420
- }), d.input === "upload" && !d.table.render && (d.table.render = function(e) {
5421
- return f(tp, { value: e[d.key] }, { default: () => null });
5422
- }), o += Number(d.table.width || 140);
5423
- let p = {
5424
- input: d.input,
5425
- title: d.label,
5426
- key: d.key,
5427
- params: d.params,
5428
- form: d.form,
5430
+ }), p.input === "upload" && !p.table.render && (p.table.render = function(e) {
5431
+ return f(tp, { value: e[p.key] }, { default: () => null });
5432
+ }), s += Number(p.table.width || 140), console.log(o, p);
5433
+ let m = {
5434
+ input: p.input,
5435
+ title: p.label,
5436
+ key: p.key,
5437
+ params: p.params,
5438
+ form: p.form,
5429
5439
  ellipsisComponent: "performant-ellipsis",
5430
- ...d.table,
5431
- width: Number(d.table.width || 140),
5432
- ellipsis: d.table.ellipsis ? {
5440
+ ...p.table,
5441
+ width: Number(p.table.width || 140),
5442
+ ellipsis: p.table.ellipsis ? {
5433
5443
  tooltip: !0,
5434
- "line-clamp": d.table.clamp ?? 0
5444
+ "line-clamp": p.table.clamp ?? 0
5435
5445
  } : !1,
5436
- render: d.table.render ? await Ap(d.key, d.table.render, i) : void 0,
5437
- show: K.isMobile ? d.table.mobile ?? !1 : d.table.show ?? !0,
5438
- pin: !!d.table.fixed,
5439
- fixTemp: d.table.fixed
5446
+ render: p.table.render ? await Ap(p.key, p.table.render, i) : void 0,
5447
+ show: K.isMobile ? p.table.mobile ?? !1 : o ? p.form.expand.show ?? !0 : p.table.show ?? !0,
5448
+ pin: !!p.table.fixed,
5449
+ fixTemp: p.table.fixed
5440
5450
  };
5441
- if (p.resizable && (p.minWidth = 80), t) if (!p.form.edit.show) p = null;
5451
+ if (m.resizable && (m.minWidth = 80), t) if (!m.form.edit.show) m = null;
5442
5452
  else {
5443
- if (p.ellipsis = !1, p.resizable = !0, K.isMobile && (p.show = d.table.mobile), d.table.show && (n === 0 && (p.show = d.form.create.show), n === 1 && (p.show = d.form.edit.show), n === 2 && (p.show = d.form.show)), d.form.rule?.required && typeof d.form.rule.validator == "string") {
5444
- delete d.form.rule.message;
5445
- let e = d.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5446
- d.form.rule.validator === "" ? d.form.rule.validator = (e, t) => r()[e.index].delete || t ? !0 : Error(d.form.rule.message) : d.form.rule.validator = (e, n) => r()[e.index].delete ? !0 : t(e, n, e.index, () => r());
5453
+ 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)), p.form.rule?.required && typeof p.form.rule.validator == "string") {
5454
+ delete p.form.rule.message;
5455
+ let e = p.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5456
+ 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());
5447
5457
  }
5448
- p.render = function(e, t) {
5458
+ m.render = function(e, t) {
5449
5459
  return f(ge, {
5450
5460
  showLabel: !1,
5451
5461
  showFeedback: !1,
5452
- path: `child[${t}].${d.key}`,
5453
- rule: d.form.rule?.required ? {
5454
- ...d.form.rule,
5462
+ path: `child[${t}].${p.key}`,
5463
+ rule: p.form.rule?.required ? {
5464
+ ...p.form.rule,
5455
5465
  index: t
5456
5466
  } : void 0
5457
5467
  }, { default: () => f(If, {
5458
- item: d,
5468
+ item: p,
5459
5469
  formValue: e,
5460
5470
  status: n,
5461
5471
  itemIndex: t
5462
5472
  }) });
5463
5473
  };
5464
5474
  }
5465
- if (p && d.input !== "divider" && d.input !== "subTable" && u.push(p), d.input !== "divider" && d.input !== "switch" && d.input !== "subTable" && d.input !== "upload" && d.search.show) {
5466
- if (d.search.title && (d.label = d.search.title), d.search.source) if (d.input = "select", d.params.type = d.search.type, d.params.valueKey = d.search.valueKey, d.params.valueKey = d.search.valueKey, d.search.source === "from-up") d.params.options = d.params.options;
5467
- else if (d.params.immediately || d.search.defaultValue) {
5468
- let { sourceData: e, n: t } = await Pp(d.search.source);
5469
- if (e && Array.isArray(e)) if (d.sourceFn) {
5470
- let t = d.sourceFn, n = Function("sourceData", t);
5471
- d.params.options = n(e);
5472
- } else d.params.options = jp(d, e, t);
5473
- } else d.params._async = !0, d.params._fetch = !1, d.params._asyncFn = async () => {
5474
- let { sourceData: e, n: t } = await Pp(d.search.source);
5475
- if (e && Array.isArray(e)) if (d.sourceFn) {
5476
- let t = d.sourceFn;
5475
+ if (m && p.input !== "divider" && p.input !== "subTable" && d.push(m), p.input !== "divider" && p.input !== "switch" && p.input !== "subTable" && p.input !== "upload" && p.search.show) {
5476
+ 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;
5477
+ else if (p.params.immediately || p.search.defaultValue) {
5478
+ let { sourceData: e, n: t } = await Pp(p.search.source);
5479
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5480
+ let t = p.sourceFn, n = Function("sourceData", t);
5481
+ p.params.options = n(e);
5482
+ } else p.params.options = jp(p, e, t);
5483
+ } else p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5484
+ let { sourceData: e, n: t } = await Pp(p.search.source);
5485
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5486
+ let t = p.sourceFn;
5477
5487
  return Function("sourceData", t)(e);
5478
- } else return jp(d, e, t);
5488
+ } else return jp(p, e, t);
5479
5489
  };
5480
- if (d.search.multiple && (d.params.multiple = !0, d.search.defaultValue && (d.search.defaultValue = Op(d.search.defaultValue))), d.search.show) {
5481
- let e = H(d);
5490
+ if (p.search.multiple && (p.params.multiple = !0, p.search.defaultValue && (p.search.defaultValue = Op(p.search.defaultValue))), p.search.show) {
5491
+ let e = H(p);
5482
5492
  e.params._async && (e.params._search = !0, e.params._asyncFn = async () => {
5483
5493
  let { sourceData: t, n } = await Pp(e.source || e.search.source);
5484
5494
  if (t && Array.isArray(t)) if (e.sourceFn) {
5485
5495
  let n = e.sourceFn;
5486
5496
  return Function("sourceData", n)(t);
5487
5497
  } else return jp(e, t, n);
5488
- }), s.push({
5498
+ }), c.push({
5489
5499
  input: e.input,
5490
5500
  label: e.label,
5491
5501
  key: e.key,
@@ -5501,35 +5511,35 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1) {
5501
5511
  });
5502
5512
  }
5503
5513
  }
5504
- d.input === "subTable" && d.params.link && !d.params.quest && (c.push(d.params.link), d.params.expandable && l.push({
5505
- key: d.key,
5506
- link: d.params.link
5514
+ p.input === "subTable" && p.params.link && !p.params.quest && (l.push(p.params.link), p.params.expandable && u.push({
5515
+ key: p.key,
5516
+ link: p.params.link
5507
5517
  }));
5508
5518
  }
5509
- let h = [];
5510
- if (m.length > 0) {
5511
- for (let e of m) {
5519
+ let g = [];
5520
+ if (h.length > 0) {
5521
+ for (let e of h) {
5512
5522
  if (typeof e == "string") {
5513
- let t = u.find((t) => t.key === e);
5514
- t && h.push(t);
5523
+ let t = d.find((t) => t.key === e);
5524
+ t && g.push(t);
5515
5525
  }
5516
5526
  if (typeof e == "object") {
5517
5527
  let t = e.children, n = [];
5518
5528
  for (let e of t) {
5519
- let t = u.find((t) => t.key === e);
5529
+ let t = d.find((t) => t.key === e);
5520
5530
  t && n.push(t);
5521
5531
  }
5522
- e.children = n, h.push(e);
5532
+ e.children = n, g.push(e);
5523
5533
  }
5524
5534
  }
5525
- u = h;
5535
+ d = g;
5526
5536
  }
5527
5537
  return {
5528
- tableColumns: u,
5529
- search: s,
5530
- subTableIds: c,
5531
- subTableExpand: l,
5532
- tableWidth: o
5538
+ tableColumns: d,
5539
+ search: c,
5540
+ subTableIds: l,
5541
+ subTableExpand: u,
5542
+ tableWidth: s
5533
5543
  };
5534
5544
  }
5535
5545
  //#endregion
@@ -5628,7 +5638,7 @@ var Kp = /*#__PURE__*/ U(Wp, [["render", Gp]]), qp = d({
5628
5638
  let t = w(!0), n = w([]), r = w([]), i = w(0);
5629
5639
  return y(() => {
5630
5640
  Fp(e.linkId).then(async (e) => {
5631
- let { tableColumns: r, tableWidth: a } = await Up(Lp(rt.parse(e.viewJson).table), !0, 2);
5641
+ let { tableColumns: r, tableWidth: a } = await Up(Lp(rt.parse(e.viewJson).table), !0, 2, () => {}, {}, !1, !0);
5632
5642
  n.value = r.map((e) => ({
5633
5643
  ...e,
5634
5644
  sorter: !1,
@@ -8502,7 +8512,7 @@ function qh(e, t, n) {
8502
8512
  }
8503
8513
  //#endregion
8504
8514
  //#region package.json
8505
- var Jh = "0.1.65", Yh;
8515
+ var Jh = "0.1.66", Yh;
8506
8516
  async function Xh() {
8507
8517
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
8508
8518
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },