@unizhen/ui 0.1.68 → 0.1.70

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
@@ -2349,15 +2349,15 @@ function vd(e, t) {
2349
2349
  return n === "" || e.toLowerCase().includes(n) || _d(e).includes(n);
2350
2350
  }
2351
2351
  function yd(e, t) {
2352
- let n = new Map(e.map((e) => [e.key, e])), r = new Map(t.map((e) => [e.key, e])), i = r.get("action") || n.get("action"), a = t.filter((e) => e.key !== "action").map((e) => ({
2353
- ...n.get(e.key) || {},
2354
- ...e
2355
- })), o = e.filter((e) => !r.has(e.key) && e.key !== "action");
2356
- return [
2357
- ...a,
2358
- ...o.map((e) => ({ ...e })),
2359
- ...i ? [{ ...i }] : []
2360
- ];
2352
+ e.forEach((e) => {
2353
+ let n = t.find((t) => t.key === e.key);
2354
+ n && (e.hide = n.hide, e.show = n.show, e.width = n.width);
2355
+ });
2356
+ let n = new Map(t.map((e, t) => [e.key, t])), r = (e) => e.type === "expand" ? -2 : e.key === "index" ? -1 : e.key === "action" ? 2 ** 53 - 1 : n.has(e.key) ? n.get(e.key) : 2 ** 53 - 1 - 1;
2357
+ return e.map((e, t) => ({
2358
+ item: e,
2359
+ index: t
2360
+ })).sort((e, t) => r(e.item) - r(t.item) || e.index - t.index).map(({ item: e }) => e);
2361
2361
  }
2362
2362
  //#endregion
2363
2363
  //#region components/fetch.ts
@@ -4580,7 +4580,8 @@ var fp = /*#__PURE__*/ U(op, [["render", dp]]), pp = d({
4580
4580
  key: e.key,
4581
4581
  value: t,
4582
4582
  range: !1,
4583
- fuzzy: e.search.fuzzy
4583
+ fuzzy: e.search.fuzzy,
4584
+ child: e.search.child
4584
4585
  };
4585
4586
  (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);
4586
4587
  }
@@ -4838,7 +4839,8 @@ var vp = /*#__PURE__*/ U(pp, [["render", _p]]), yp = d({
4838
4839
  key: e.key,
4839
4840
  value: t,
4840
4841
  range: !1,
4841
- fuzzy: e.search.fuzzy
4842
+ fuzzy: e.search.fuzzy,
4843
+ child: e.search.child
4842
4844
  };
4843
4845
  (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), c.push(n);
4844
4846
  }
@@ -5109,6 +5111,7 @@ var Ip = (e) => e.map((e) => {
5109
5111
  e: (e.search.title || "").replace(/\s*/g, ""),
5110
5112
  l: (e.search.labelKeys || "").replace(/\s*/g, ""),
5111
5113
  a: (e.search.valueKey || "").replace(/\s*/g, ""),
5114
+ d: (e.search.child || "").replace(/\s*/g, ""),
5112
5115
  m: +!!e.search.multiple,
5113
5116
  t: +!!e.search.tab,
5114
5117
  p: e.search.span
@@ -5181,6 +5184,7 @@ var Ip = (e) => e.map((e) => {
5181
5184
  title: e.c.e,
5182
5185
  labelKeys: e.c.l,
5183
5186
  valueKey: e.c.a,
5187
+ child: e.c.d,
5184
5188
  multiple: !!e.c.m,
5185
5189
  tab: !!e.c.t,
5186
5190
  span: e.c.p
@@ -5391,7 +5395,11 @@ function Hp(e, t, n, r) {
5391
5395
  });
5392
5396
  }
5393
5397
  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 = [];
5398
+ let s = 0, c = [], l = [], u = {
5399
+ key: "",
5400
+ link: "",
5401
+ merge: ""
5402
+ }, d = [], p = H(e), m = [], h = [];
5395
5403
  for (let e of p) e.input === "group" ? (m.push(...e.params.children), h.push({
5396
5404
  title: e.label,
5397
5405
  key: e.key,
@@ -5442,7 +5450,7 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5442
5450
  };
5443
5451
  if (m.resizable && (m.minWidth = 80), t) if (!m.form.edit.show) m = null;
5444
5452
  else {
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") {
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)), o && (p.form.rule.validator = () => !0), o === !1 && p.form.rule?.required && typeof p.form.rule.validator == "string") {
5446
5454
  delete p.form.rule.message;
5447
5455
  let e = p.form.rule.validator, t = Function("rule", "value", "index", "formValues", e);
5448
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());
@@ -5503,9 +5511,10 @@ async function Up(e, t = !1, n = 0, r = () => {}, i = {}, a = !1, o = !1) {
5503
5511
  });
5504
5512
  }
5505
5513
  }
5506
- p.input === "subTable" && p.params.link && !p.params.quest && (l.push(p.params.link), p.params.expandable && u.push({
5514
+ p.input === "subTable" && p.params.link && !p.params.quest && (l.push(p.params.link), p.params.expandable && (u = {
5507
5515
  key: p.key,
5508
- link: p.params.link
5516
+ link: p.params.link,
5517
+ merge: p.params.merge
5509
5518
  }));
5510
5519
  }
5511
5520
  let g = [];
@@ -5617,19 +5626,26 @@ var Kp = /*#__PURE__*/ U(Wp, [["render", Gp]]), qp = d({
5617
5626
  NForm: he
5618
5627
  },
5619
5628
  props: {
5620
- linkId: {
5629
+ data: {
5621
5630
  required: !0,
5622
- type: String
5631
+ type: Object,
5632
+ default: () => {}
5623
5633
  },
5624
5634
  value: {
5625
- type: Array,
5626
- default: () => []
5635
+ type: Object,
5636
+ default: () => {}
5627
5637
  }
5628
5638
  },
5629
5639
  setup(e) {
5630
5640
  let t = w(!0), n = w([]), r = w([]), i = w(0);
5631
- return y(() => {
5632
- Fp(e.linkId).then(async (e) => {
5641
+ return y(async () => {
5642
+ if (e.data.merge) try {
5643
+ let t = e.data.merge, n = Function("formValue", "mainFormValue", "POST", t);
5644
+ r.value = await n(e.value[`sub_${e.data.key}`], { value: () => e.value }, Z);
5645
+ } catch (e) {
5646
+ q(e);
5647
+ }
5648
+ Fp(e.data.link).then(async (e) => {
5633
5649
  let { tableColumns: r } = await Up(Lp(rt.parse(e.viewJson).table), !0, 2, () => {}, {}, !1, !0), a = 0, o = r.map((e) => ({
5634
5650
  ...e,
5635
5651
  sorter: !1,
@@ -5644,7 +5660,7 @@ var Kp = /*#__PURE__*/ U(Wp, [["render", Gp]]), qp = d({
5644
5660
  }), {
5645
5661
  loading: t,
5646
5662
  columns: n,
5647
- tableData: r,
5663
+ columnsData: r,
5648
5664
  tableScrollX: i
5649
5665
  };
5650
5666
  }
@@ -5652,29 +5668,26 @@ var Kp = /*#__PURE__*/ U(Wp, [["render", Gp]]), qp = d({
5652
5668
  //#endregion
5653
5669
  //#region components/table/expand.vue
5654
5670
  function Jp(e, t, r, i, a, o) {
5655
- let s = D("NDataTable"), c = D("NForm");
5656
- return x(), n(c, { class: "uz-table-expand" }, {
5657
- default: N(() => [l(s, {
5658
- columns: e.columns,
5659
- data: e.value,
5660
- pagination: !1,
5661
- loading: e.loading,
5662
- "scroll-x": e.tableScrollX,
5663
- "min-height": 120,
5664
- "scrollbar-props": {
5665
- size: 8,
5666
- trigger: "none"
5667
- },
5668
- size: "small",
5669
- remote: ""
5670
- }, null, 8, [
5671
- "columns",
5672
- "data",
5673
- "loading",
5674
- "scroll-x"
5675
- ])]),
5676
- _: 1
5677
- });
5671
+ let s = D("NDataTable");
5672
+ return x(), n(s, {
5673
+ columns: e.columns,
5674
+ data: e.columnsData,
5675
+ pagination: !1,
5676
+ loading: e.loading,
5677
+ "scroll-x": e.tableScrollX,
5678
+ "min-height": 102,
5679
+ "scrollbar-props": {
5680
+ size: 8,
5681
+ trigger: "none"
5682
+ },
5683
+ size: "small",
5684
+ remote: ""
5685
+ }, null, 8, [
5686
+ "columns",
5687
+ "data",
5688
+ "loading",
5689
+ "scroll-x"
5690
+ ]);
5678
5691
  }
5679
5692
  var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
5680
5693
  name: "UzTable",
@@ -6101,8 +6114,8 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6101
6114
  }
6102
6115
  }, Se = async () => {
6103
6116
  I.value = !1, Np();
6104
- let { tableColumns: t, search: n, subTableIds: r, subTableExpand: i } = await Up(A.value, e.child, 0, () => ({}), ie), s = 0;
6105
- !c.value && F.value.index && (t.unshift({
6117
+ let { tableColumns: t, search: n, subTableIds: r, subTableExpand: i } = await Up(A.value, e.child, 0, () => ({}), ie);
6118
+ !c.value && F.value.index && t.unshift({
6106
6119
  title: "#",
6107
6120
  key: "index",
6108
6121
  align: "center",
@@ -6117,7 +6130,7 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6117
6130
  return (e - 1) * n + (t + 1);
6118
6131
  } });
6119
6132
  }
6120
- }), s += 60), !c.value && (e.selection || F.value.selection !== 0) && (t.unshift({
6133
+ }), !c.value && (e.selection || F.value.selection !== 0) && t.unshift({
6121
6134
  type: "selection",
6122
6135
  fixed: "left",
6123
6136
  width: 60,
@@ -6125,8 +6138,8 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6125
6138
  show: !0,
6126
6139
  multiple: e.selection === 2 || F.value.selection === 2,
6127
6140
  options: ["all", "none"]
6128
- }), s += 60);
6129
- let l = e.id || a.params.id;
6141
+ });
6142
+ let s = e.id || a.params.id;
6130
6143
  if (!c.value && F.value.commonTime && t.push(..._e()), e.enableAction === !0 && M.value && M.value.length > 0) {
6131
6144
  let e = H(M.value);
6132
6145
  for (let t of e) t.type === "group" ? t.children.forEach((e) => {
@@ -6137,41 +6150,45 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6137
6150
  key: "action",
6138
6151
  align: "center",
6139
6152
  fixed: "right",
6140
- width: F.value.actionWidth,
6141
6153
  resizable: !1,
6142
6154
  checked: !0,
6143
6155
  show: !0,
6144
6156
  hide: !0,
6157
+ width: Number(typeof F.value.actionWidth == "string" ? F.value.actionWidth.replace("px", "") : F.value.actionWidth),
6145
6158
  render(t) {
6146
6159
  return Wd({
6147
6160
  buttons: e,
6148
6161
  rowData: t,
6149
6162
  callback: R,
6150
- tableId: l
6163
+ tableId: s
6151
6164
  });
6152
6165
  }
6153
6166
  };
6154
- s += Number(typeof F.value.actionWidth == "string" ? F.value.actionWidth.replace("px", "") : F.value.actionWidth), t.push(n);
6167
+ t.push(n);
6155
6168
  }
6156
- let u = t;
6157
- if (l) {
6158
- let e = Y(`tables_filter_${l}`, !1);
6169
+ let l = t;
6170
+ if (s) {
6171
+ let e = Y(`tables_filter_${s}`, !1);
6159
6172
  if (e) try {
6160
- let n = await Id(l);
6161
- n && (e = JSON.parse(n), u = yd(t, e));
6173
+ let n = await Id(s);
6174
+ n && (e = JSON.parse(n), l = yd(t, e));
6162
6175
  } catch {}
6163
6176
  }
6164
- i && i[0] && (u.unshift({
6177
+ i.link && l.unshift({
6165
6178
  type: "expand",
6166
6179
  show: !0,
6167
6180
  hide: !0,
6181
+ width: 40,
6182
+ fixed: "left",
6168
6183
  renderExpand: (e) => f(Yp, {
6169
- linkId: i[0].link,
6170
- value: e[`sub_${i[0].key}`]
6184
+ data: i,
6185
+ value: e
6171
6186
  })
6172
- }), s += 40), u.forEach((e) => {
6173
- s += Number(e.width);
6174
- }), C.value = u, ee.value = n, E.value = s;
6187
+ });
6188
+ let u = 0;
6189
+ l.forEach((e) => {
6190
+ e.show && (u += Number(e.width || 140));
6191
+ }), C.value = l, ee.value = n, E.value = u;
6175
6192
  }, Ce = (e) => typeof e == "number" ? `${e}px` : e, we = () => {
6176
6193
  if (e.height) {
6177
6194
  let t = Ce(e.height);
@@ -6180,14 +6197,19 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6180
6197
  }
6181
6198
  }, Te = (t) => {
6182
6199
  let n = e.id || a.params.id;
6183
- n && (J(`tables_filter_${n}`, t), Ld({
6184
- table_id: n,
6185
- data: JSON.stringify(t)
6186
- }).catch(() => null));
6200
+ if (n) {
6201
+ let e = 0;
6202
+ C.value.forEach((t) => {
6203
+ t.show && (e += Number(t.width || 140));
6204
+ }), E.value = e, J(`tables_filter_${n}`, t.filter((e) => e.key)), Ld({
6205
+ table_id: n,
6206
+ data: JSON.stringify(t)
6207
+ }).catch(() => null);
6208
+ }
6187
6209
  }, { run: Ee } = Tp(Te), { run: De } = Tp((e, t) => {
6188
6210
  let n = [];
6189
6211
  C.value.forEach((r) => {
6190
- (r.key !== "action" || r.type !== "expand") && n.push({
6212
+ r.key !== "action" && r.key !== "index" && r.type !== "expand" && n.push({
6191
6213
  key: r.key,
6192
6214
  show: r.show,
6193
6215
  hide: r.hide,
@@ -6198,7 +6220,7 @@ var Yp = /*#__PURE__*/ U(qp, [["render", Jp]]), Xp = d({
6198
6220
  }), B = () => {
6199
6221
  let e = [];
6200
6222
  C.value.forEach((t) => {
6201
- (t.key !== "action" || t.type !== "expand") && e.push({
6223
+ t.key !== "action" && t.key !== "index" && t.type !== "expand" && e.push({
6202
6224
  key: t.key,
6203
6225
  show: t.show,
6204
6226
  hide: t.hide,
@@ -6619,6 +6641,7 @@ function am(t, s, u, d, f, p) {
6619
6641
  trigger: "hover"
6620
6642
  },
6621
6643
  "onUpdate:checkedRowKeys": t.handleCheckRowKeys,
6644
+ "sticky-expanded-rows": "",
6622
6645
  remote: ""
6623
6646
  }, null, 8, [
6624
6647
  "columns",
@@ -8506,7 +8529,7 @@ function qh(e, t, n) {
8506
8529
  }
8507
8530
  //#endregion
8508
8531
  //#region package.json
8509
- var Jh = "0.1.68", Yh;
8532
+ var Jh = "0.1.70", Yh;
8510
8533
  async function Xh() {
8511
8534
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
8512
8535
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.68",
3
+ "version": "0.1.70",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },