@unizhen/ui 0.1.65 → 0.1.67

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,10 +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
- }
5143
+ },
5144
+ p: { s: +!!e.form.expand.show }
5144
5145
  }
5145
5146
  };
5146
- }), Lp = (e) => !e[0] || e[0] && e[0].input ? e : e.map((e) => {
5147
+ }), Lp = (e) => !e[0] || e[0] && e[0].input ? e : (console.log(e), e.map((e) => {
5147
5148
  let t = {};
5148
5149
  return t.placeholder = e.p.z, e.i === "group" ? t.children = e.p.n : t.clearable = !!e.p.c, e.i === "input" && (e.p.t && (t.type = e.p.t), e.p.i && (t.minlength = e.p.i), e.p.a && (t.maxlength = e.p.a), e.p.r && (t.rows = e.p.r), e.p.e && (t.prefix = e.p.e), e.p.s && (t.suffix = e.p.s)), e.i === "auto" && (t.options = e.p.o, e.p.e && (t.prefix = e.p.e), e.p.s && (t.suffix = e.p.s)), e.i === "number" && (t.showButton = !!e.p.b, e.p.i && (t.min = e.p.i), e.p.a && (t.max = e.p.a), e.p.x && (t.minKey = e.p.x), e.p.y && (t.maxKey = e.p.y), e.p.t && (t.step = e.p.t), e.p.p && (t.precision = e.p.p), e.p.e && (t.prefix = e.p.e), e.p.s && (t.suffix = e.p.s)), e.i === "date" && (t.type = e.p.y, e.p.f && (t.format = e.p.f), e.p.d && (t.isDateDisabled = e.p.d), e.p.t && (t.timePickerProps = e.p.t)), e.i === "select" && (t.options = e.p.o, t.immediately = e.p.y, t.filterable = !!e.p.f, t.multiple = !!e.p.m, t.tag = !!e.p.t, t.labelKeys = e.p.l, t.valueKey = e.p.v, t.renderLabel = e.p.r, t.renderTag = e.p.g), e.i === "cascader" && (t.options = e.p.o, t.immediately = e.p.y, t.filterable = !!e.p.f, t.multiple = !!e.p.m), e.i === "checkbox" && (t.options = e.p.o), e.i === "time" && (t.format = e.p.f), e.i === "upload" && (t.small = !!e.p.s, t.accept = e.p.a, t.max = e.p.m), e.i === "switch" && (t.checked = e.p.h, t.unchecked = e.p.u), e.i === "divider" && (t.placement = e.p.p), e.i === "filling" && (t.parentKey = e.p.k), e.i === "subTable" && (t.init = !!e.p.i, t.quest = !!e.p.q, t.searchKey = e.p.k, t.link = e.p.l, t.columns = e.p.c, t.actions = e.p.a, t.addButton = !!e.p.b, t.draggable = !!e.p.g, t.childActions = !!e.p.h, t.showActions = !!e.p.n, t.showDelete = !!(e.p.d ?? !0), t.expandable = !!e.p.x, e.p.t && (t.optionsType = e.p.t), e.p.u && (t.optionsSource = e.p.u), e.p.o && (t.options = e.p.o), e.p.s && (t.summary = e.p.s), e.p.m && (t.merge = e.p.m), e.p.f && (t.deleteFn = e.p.f)), {
5149
5150
  input: e.i,
@@ -5211,10 +5212,11 @@ var Ip = (e) => e.map((e) => {
5211
5212
  disabled: !!e.f.e.d,
5212
5213
  readonly: !!e.f.e.r,
5213
5214
  show: !!e.f.e.s
5214
- }
5215
+ },
5216
+ expand: { show: e.f && e.f.p ? !!e.f.p.s : !0 }
5215
5217
  }
5216
5218
  };
5217
- }), Rp = (e) => ({
5219
+ })), Rp = (e) => ({
5218
5220
  f: e.fetch,
5219
5221
  o: e.when_drawer_open,
5220
5222
  b: e.when_before_save
@@ -5388,104 +5390,104 @@ function Hp(e, t, n, r) {
5388
5390
  });
5389
5391
  });
5390
5392
  }
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({
5393
+ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5394
+ let s = 0, c = [], l = [], u = [], d = [], p = H(e), m = [], h = [];
5395
+ for (let e of p) e.input === "group" ? (m.push(...e.params.children), h.push({
5394
5396
  title: e.label,
5395
5397
  key: e.key,
5396
5398
  ...e.table,
5397
5399
  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 = [{
5400
+ })) : (m.push(e), h.push(e.key));
5401
+ for await (let [e, p] of m.entries()) {
5402
+ 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) {
5403
+ let { sourceData: t, n } = await Pp(p.source, a && e === 0);
5404
+ if (t && Array.isArray(t)) if (p.sourceFn) {
5405
+ let e = p.sourceFn, n = Function("sourceData", e);
5406
+ p.params.options = n(t);
5407
+ } else p.params.options = jp(p, t, n);
5408
+ } else p.params.options = [{
5407
5409
  label: "加载中......",
5408
5410
  value: "loading",
5409
5411
  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;
5412
+ }], p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5413
+ let { sourceData: e, n: t } = await Pp(p.source);
5414
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5415
+ let t = p.sourceFn;
5414
5416
  return Function("sourceData", t)(e);
5415
- } else return jp(d, e, t);
5417
+ } else return jp(p, e, t);
5416
5418
  };
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]);
5419
+ !p.table.render && !p.source && p.input === "select" && typeof p.params.options != "function" && p.params.options.length > 0 && (p.table.render = (e) => {
5420
+ let t = p.params.options.find((t) => t.value === e[p.key]);
5419
5421
  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,
5422
+ }), p.input === "upload" && !p.table.render && (p.table.render = function(e) {
5423
+ return f(tp, { value: e[p.key] }, { default: () => null });
5424
+ }), s += Number(p.table.width || 140);
5425
+ let m = {
5426
+ input: p.input,
5427
+ title: p.label,
5428
+ key: p.key,
5429
+ params: p.params,
5430
+ form: p.form,
5429
5431
  ellipsisComponent: "performant-ellipsis",
5430
- ...d.table,
5431
- width: Number(d.table.width || 140),
5432
- ellipsis: d.table.ellipsis ? {
5432
+ ...p.table,
5433
+ width: Number(p.table.width || 140),
5434
+ ellipsis: p.table.ellipsis ? {
5433
5435
  tooltip: !0,
5434
- "line-clamp": d.table.clamp ?? 0
5436
+ "line-clamp": p.table.clamp ?? 0
5435
5437
  } : !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
5438
+ render: p.table.render ? await Ap(p.key, p.table.render, i) : void 0,
5439
+ show: K.isMobile ? p.table.mobile ?? !1 : p.table.show ?? !0,
5440
+ pin: !!p.table.fixed,
5441
+ fixTemp: p.table.fixed
5440
5442
  };
5441
- if (p.resizable && (p.minWidth = 80), t) if (!p.form.edit.show) p = null;
5443
+ if (m.resizable && (m.minWidth = 80), t) if (!m.form.edit.show) m = null;
5442
5444
  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());
5445
+ 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") {
5446
+ delete p.form.rule.message;
5447
+ let e = p.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5448
+ 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
5449
  }
5448
- p.render = function(e, t) {
5450
+ m.render = function(e, t) {
5449
5451
  return f(ge, {
5450
5452
  showLabel: !1,
5451
5453
  showFeedback: !1,
5452
- path: `child[${t}].${d.key}`,
5453
- rule: d.form.rule?.required ? {
5454
- ...d.form.rule,
5454
+ path: `child[${t}].${p.key}`,
5455
+ rule: p.form.rule?.required ? {
5456
+ ...p.form.rule,
5455
5457
  index: t
5456
5458
  } : void 0
5457
5459
  }, { default: () => f(If, {
5458
- item: d,
5460
+ item: p,
5459
5461
  formValue: e,
5460
5462
  status: n,
5461
5463
  itemIndex: t
5462
5464
  }) });
5463
5465
  };
5464
5466
  }
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;
5467
+ 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) {
5468
+ 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;
5469
+ else if (p.params.immediately || p.search.defaultValue) {
5470
+ let { sourceData: e, n: t } = await Pp(p.search.source);
5471
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5472
+ let t = p.sourceFn, n = Function("sourceData", t);
5473
+ p.params.options = n(e);
5474
+ } else p.params.options = jp(p, e, t);
5475
+ } else p.params._async = !0, p.params._fetch = !1, p.params._asyncFn = async () => {
5476
+ let { sourceData: e, n: t } = await Pp(p.search.source);
5477
+ if (e && Array.isArray(e)) if (p.sourceFn) {
5478
+ let t = p.sourceFn;
5477
5479
  return Function("sourceData", t)(e);
5478
- } else return jp(d, e, t);
5480
+ } else return jp(p, e, t);
5479
5481
  };
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);
5482
+ if (p.search.multiple && (p.params.multiple = !0, p.search.defaultValue && (p.search.defaultValue = Op(p.search.defaultValue))), p.search.show) {
5483
+ let e = H(p);
5482
5484
  e.params._async && (e.params._search = !0, e.params._asyncFn = async () => {
5483
5485
  let { sourceData: t, n } = await Pp(e.source || e.search.source);
5484
5486
  if (t && Array.isArray(t)) if (e.sourceFn) {
5485
5487
  let n = e.sourceFn;
5486
5488
  return Function("sourceData", n)(t);
5487
5489
  } else return jp(e, t, n);
5488
- }), s.push({
5490
+ }), c.push({
5489
5491
  input: e.input,
5490
5492
  label: e.label,
5491
5493
  key: e.key,
@@ -5501,35 +5503,35 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1) {
5501
5503
  });
5502
5504
  }
5503
5505
  }
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
5506
+ p.input === "subTable" && p.params.link && !p.params.quest && (l.push(p.params.link), p.params.expandable && u.push({
5507
+ key: p.key,
5508
+ link: p.params.link
5507
5509
  }));
5508
5510
  }
5509
- let h = [];
5510
- if (m.length > 0) {
5511
- for (let e of m) {
5511
+ let g = [];
5512
+ if (h.length > 0) {
5513
+ for (let e of h) {
5512
5514
  if (typeof e == "string") {
5513
- let t = u.find((t) => t.key === e);
5514
- t && h.push(t);
5515
+ let t = d.find((t) => t.key === e);
5516
+ t && g.push(t);
5515
5517
  }
5516
5518
  if (typeof e == "object") {
5517
5519
  let t = e.children, n = [];
5518
5520
  for (let e of t) {
5519
- let t = u.find((t) => t.key === e);
5521
+ let t = d.find((t) => t.key === e);
5520
5522
  t && n.push(t);
5521
5523
  }
5522
- e.children = n, h.push(e);
5524
+ e.children = n, g.push(e);
5523
5525
  }
5524
5526
  }
5525
- u = h;
5527
+ d = g;
5526
5528
  }
5527
5529
  return {
5528
- tableColumns: u,
5529
- search: s,
5530
- subTableIds: c,
5531
- subTableExpand: l,
5532
- tableWidth: o
5530
+ tableColumns: d,
5531
+ search: c,
5532
+ subTableIds: l,
5533
+ subTableExpand: u,
5534
+ tableWidth: s
5533
5535
  };
5534
5536
  }
5535
5537
  //#endregion
@@ -5628,12 +5630,12 @@ var Kp = /*#__PURE__*/ U(Wp, [["render", Gp]]), qp = d({
5628
5630
  let t = w(!0), n = w([]), r = w([]), i = w(0);
5629
5631
  return y(() => {
5630
5632
  Fp(e.linkId).then(async (e) => {
5631
- let { tableColumns: r, tableWidth: a } = await Up(Lp(rt.parse(e.viewJson).table), !0, 2);
5633
+ let { tableColumns: r, tableWidth: a } = await Up(Lp(rt.parse(e.viewJson).table), !0, 2, () => {}, {}, !1, !0);
5632
5634
  n.value = r.map((e) => ({
5633
5635
  ...e,
5634
5636
  sorter: !1,
5635
5637
  resizable: !1
5636
- })), i.value = a, t.value = !1;
5638
+ })).filter((e) => e.show), i.value = a, t.value = !1;
5637
5639
  }).catch((e) => {
5638
5640
  t.value = !1;
5639
5641
  });
@@ -8502,7 +8504,7 @@ function qh(e, t, n) {
8502
8504
  }
8503
8505
  //#endregion
8504
8506
  //#region package.json
8505
- var Jh = "0.1.65", Yh;
8507
+ var Jh = "0.1.67", Yh;
8506
8508
  async function Xh() {
8507
8509
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
8508
8510
  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.67",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },