@unizhen/ui 0.1.20 → 0.1.21

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.
@@ -98,7 +98,7 @@ export declare const fnOptionSimplify: (option: ITableOptions) => {
98
98
  r: string;
99
99
  };
100
100
  export declare const fnOptionReduction: (simplify?: ObjectKey) => ITableOptions;
101
- export declare function fnPrepareFormData(items: IUzFormItems, formData?: ObjectKey | any[], formValues?: () => ObjectKey): Promise<{
101
+ export declare function fnPrepareFormData(items: IUzFormItems, formData?: ObjectKey | any[], formValues?: () => ObjectKey, childTable?: boolean): Promise<{
102
102
  form: ObjectKey;
103
103
  formDefaultValue: ObjectKey;
104
104
  fillingDefaultValue: ObjectKey;
package/lib/ui.js CHANGED
@@ -5219,11 +5219,11 @@ var bp = (e) => e.map((e) => {
5219
5219
  summary: e.r
5220
5220
  }), Object.assign({}, dp, H(t));
5221
5221
  };
5222
- function Ep(e, t, n) {
5223
- return new Promise(async (r, i) => {
5224
- let a = [], o = {}, s = {}, c = {}, l = [], u = [], d = H(e), f = [];
5225
- for (let e of d) e.input === "group" ? f.push(...e.params.children) : f.push(e);
5226
- for (let e of f) {
5222
+ function Ep(e, t, n, r) {
5223
+ return new Promise(async (i, a) => {
5224
+ let o = [], s = {}, c = {}, l = {}, u = [], d = [], f = H(e), p = [];
5225
+ for (let e of f) e.input === "group" ? p.push(...e.params.children) : p.push(e);
5226
+ for (let e of p) {
5227
5227
  if (e.source && (e.input === "select" || e.input === "cascader")) {
5228
5228
  let n = [];
5229
5229
  if (t && !Array.isArray(t) && t[e.key]) {
@@ -5253,7 +5253,7 @@ function Ep(e, t, n) {
5253
5253
  value: "loading",
5254
5254
  disabled: !0
5255
5255
  }];
5256
- if (e.params.immediately) {
5256
+ if (e.params.immediately || r) {
5257
5257
  let { sourceData: t, n: r } = await vp(e.source);
5258
5258
  if (t && Array.isArray(t)) if (e.sourceFn) {
5259
5259
  let r = e.sourceFn;
@@ -5268,17 +5268,17 @@ function Ep(e, t, n) {
5268
5268
  };
5269
5269
  if (e.params.options = n, e.form.backfill && t) if (Array.isArray(t)) t.forEach((t, r) => {
5270
5270
  let i = n.find((n) => n.value === t[e.key]);
5271
- i && (l[r] || (l[r] = {}), l[r][e.key] = i.params);
5271
+ i && (u[r] || (u[r] = {}), u[r][e.key] = i.params);
5272
5272
  });
5273
5273
  else {
5274
5274
  let r = n.find((n) => n.value === t[e.key]);
5275
- r && (s[e.key] = r.params);
5275
+ r && (c[e.key] = r.params);
5276
5276
  }
5277
5277
  }
5278
5278
  if (e.input === "filling") try {
5279
5279
  Array.isArray(t) ? t.forEach((t, n) => {
5280
- u[n] || (u[n] = {}), l[n] && l[n][e.params.parentKey] && l[n][e.params.parentKey][e.key] ? (u[n][e.key] = l[n][e.params.parentKey][e.key], l[n][e.params.parentKey][`${e.key}Str`] && (u[n][`${e.key}Str`] = l[n][e.params.parentKey][`${e.key}Str`])) : (u[n][e.key] = t[e.key] || null, u[n][`${e.key}Str`] = t[`${e.key}Str`] || null);
5281
- }) : s[e.params.parentKey] && s[e.params.parentKey][e.key] ? (c[e.key] = s[e.params.parentKey][e.key], s[e.params.parentKey][`${e.key}Str`] && (c[`${e.key}Str`] = s[e.params.parentKey][`${e.key}Str`])) : (c[e.key] = null, c[`${e.key}Str`] = null);
5280
+ d[n] || (d[n] = {}), u[n] && u[n][e.params.parentKey] && u[n][e.params.parentKey][e.key] ? (d[n][e.key] = u[n][e.params.parentKey][e.key], u[n][e.params.parentKey][`${e.key}Str`] && (d[n][`${e.key}Str`] = u[n][e.params.parentKey][`${e.key}Str`])) : (d[n][e.key] = t[e.key] || null, d[n][`${e.key}Str`] = t[`${e.key}Str`] || null);
5281
+ }) : c[e.params.parentKey] && c[e.params.parentKey][e.key] ? (l[e.key] = c[e.params.parentKey][e.key], c[e.params.parentKey][`${e.key}Str`] && (l[`${e.key}Str`] = c[e.params.parentKey][`${e.key}Str`])) : (l[e.key] = null, l[`${e.key}Str`] = null);
5282
5282
  } catch (e) {
5283
5283
  q(e);
5284
5284
  }
@@ -5300,7 +5300,7 @@ function Ep(e, t, n) {
5300
5300
  }
5301
5301
  if (e.input === "subTable" && e.params.link) {
5302
5302
  let t = await yp(e.params.link).catch(() => {
5303
- i();
5303
+ a();
5304
5304
  });
5305
5305
  if (t) try {
5306
5306
  let n = nt.parse(t.viewJson);
@@ -5309,10 +5309,10 @@ function Ep(e, t, n) {
5309
5309
  r.forEach((e) => {
5310
5310
  e.table.sorter = !1;
5311
5311
  });
5312
- let a = r.filter((e) => e.input === "subTable");
5313
- if (a) for await (let e of a) {
5312
+ let i = r.filter((e) => e.input === "subTable");
5313
+ if (i) for await (let e of i) {
5314
5314
  let t = await yp(e.params.link).catch(() => {
5315
- i();
5315
+ a();
5316
5316
  });
5317
5317
  if (t) try {
5318
5318
  let n = nt.parse(t.viewJson), r = xp(n.table);
@@ -5320,17 +5320,17 @@ function Ep(e, t, n) {
5320
5320
  e.table.sorter = !1;
5321
5321
  }), e.params.columns = r, e.params.actions = n.action;
5322
5322
  } catch (e) {
5323
- i(e);
5323
+ a(e);
5324
5324
  return;
5325
5325
  }
5326
5326
  }
5327
5327
  e.params.columns = r, e.params.actions = n.action;
5328
5328
  } catch (e) {
5329
- i(e);
5329
+ a(e);
5330
5330
  return;
5331
5331
  }
5332
5332
  }
5333
- a.push({
5333
+ o.push({
5334
5334
  input: e.input,
5335
5335
  label: e.label,
5336
5336
  key: e.key,
@@ -5339,13 +5339,13 @@ function Ep(e, t, n) {
5339
5339
  params: e.params,
5340
5340
  form: e.form,
5341
5341
  _suffix: e._suffix
5342
- }), e.input === "date" || e.input === "number" || e.input === "time" ? o[e.key] = Number(e.form.defaultValue) || 0 : o[e.key] = e.form.defaultValue;
5342
+ }), e.input === "date" || e.input === "number" || e.input === "time" ? s[e.key] = Number(e.form.defaultValue) || 0 : s[e.key] = e.form.defaultValue;
5343
5343
  }
5344
- r({
5345
- form: a,
5346
- formDefaultValue: o,
5347
- fillingDefaultValue: c,
5348
- fillingDefaultArray: u
5344
+ i({
5345
+ form: o,
5346
+ formDefaultValue: s,
5347
+ fillingDefaultValue: l,
5348
+ fillingDefaultArray: d
5349
5349
  });
5350
5350
  });
5351
5351
  }
@@ -6480,7 +6480,7 @@ var Bp = /* @__PURE__ */ U(jp, [["render", zp]]), Vp = d({
6480
6480
  emits: ["update:value"],
6481
6481
  setup(e, { emit: t, expose: n }) {
6482
6482
  let r = p("emitSuffix"), i = p("modules"), a = p("mainFormValue"), { t: o } = Xe(), s = T(), c = T(), l = T(), u = T(!1), d = T(!0), m = T([]), h = T({ child: [] }), _ = T(""), v = T({}), b = T([]), x = T(void 0), S = async (t, n) => {
6483
- let { formDefaultValue: r, fillingDefaultArray: i } = await Ep(H(n ?? e.item.params.columns), t);
6483
+ let { formDefaultValue: r, fillingDefaultArray: i } = await Ep(H(n ?? e.item.params.columns), t, void 0, !0);
6484
6484
  return v.value = r, i;
6485
6485
  }, C = async (t) => {
6486
6486
  if (u.value) return;
@@ -7917,7 +7917,7 @@ function Qm(e, t, n) {
7917
7917
  }
7918
7918
  //#endregion
7919
7919
  //#region package.json
7920
- var $m = "0.1.20", eh;
7920
+ var $m = "0.1.21", eh;
7921
7921
  async function th() {
7922
7922
  let e = await fetch(`${window.location.protocol}//${window.location.host}`, {
7923
7923
  method: "HEAD",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unizhen/ui",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "author": {
5
5
  "name": "Donovan"
6
6
  },