@nocobase/client 0.20.0-alpha.7 → 0.20.0-alpha.8

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/es/index.mjs CHANGED
@@ -5958,8 +5958,9 @@ function flatData$2(e) {
5958
5958
  return t;
5959
5959
  }
5960
5960
  function isSubMode(e) {
5961
- var t;
5962
- return ["Nester", "SubTable", "PopoverNester"].includes((t = e["x-component-props"]) == null ? void 0 : t.mode);
5961
+ var n, o;
5962
+ const t = ((n = e["x-component-props"]) == null ? void 0 : n.mode) || ((o = e.componentProps) == null ? void 0 : o.mode);
5963
+ return ["Nester", "SubTable", "PopoverNester"].includes(t);
5963
5964
  }
5964
5965
  const key = Symbol("isNewRecord"), isNewRecord = (e) => !!(e != null && e[key]), markRecordAsNew = (e) => {
5965
5966
  if (!isObject$1(e))
@@ -20330,15 +20331,15 @@ const useCreateActionProps = () => {
20330
20331
  updateAssociationValues: h
20331
20332
  });
20332
20333
  if (a == null || a(!1), u.data.loading = !1, u.data.data = D, (j = (I = i == null ? void 0 : i.service) == null ? void 0 : I.refresh) == null || j.call(I), !(b != null && b.successMessage)) {
20333
- message.success(m("Saved successfully")), yield n.reset(void 0, { forceClear: !0 });
20334
+ message.success(m("Saved successfully")), yield resetFormCorrectly(n);
20334
20335
  return;
20335
20336
  }
20336
20337
  b != null && b.manualClose ? p.success({
20337
20338
  title: d(b == null ? void 0 : b.successMessage),
20338
20339
  onOk: () => O(this, null, function* () {
20339
- yield n.reset(void 0, { forceClear: !0 }), b != null && b.redirecting && (b != null && b.redirectTo) && (isURL(b.redirectTo) ? window.location.href = b.redirectTo : l(b.redirectTo));
20340
+ yield resetFormCorrectly(n), b != null && b.redirecting && (b != null && b.redirectTo) && (isURL(b.redirectTo) ? window.location.href = b.redirectTo : l(b.redirectTo));
20340
20341
  })
20341
- }) : (message.success(d(b == null ? void 0 : b.successMessage)), yield n.reset(void 0, { forceClear: !0 }), b != null && b.redirecting && (b != null && b.redirectTo) && (isURL(b.redirectTo) ? window.location.href = b.redirectTo : l(b.redirectTo)));
20342
+ }) : (message.success(d(b == null ? void 0 : b.successMessage)), yield resetFormCorrectly(n), b != null && b.redirecting && (b != null && b.redirectTo) && (isURL(b.redirectTo) ? window.location.href = b.redirectTo : l(b.redirectTo)));
20342
20343
  } catch (D) {
20343
20344
  u.data.loading = !1;
20344
20345
  }
@@ -20964,6 +20965,15 @@ function getTargetField(e) {
20964
20965
  });
20965
20966
  return n.slice(0, o);
20966
20967
  }
20968
+ function resetFormCorrectly(e) {
20969
+ return O(this, null, function* () {
20970
+ untracked(() => {
20971
+ Object.keys(e.fields).forEach((t) => {
20972
+ isSubMode(e.fields[t]) && (e.fields[t].initialValue = null);
20973
+ });
20974
+ }), yield e.reset();
20975
+ });
20976
+ }
20967
20977
  const useSyncFromForm = (e, t, n) => {
20968
20978
  const { getCollectionJoinField: o, getCollectionFields: r } = useCollectionManager_deprecated(), i = ArrayBase.useArray(), a = ArrayBase.useIndex(), l = ArrayBase.useRecord(), c = useCompile(), { t: u } = useTranslation(), d = useForm(), p = /* @__PURE__ */ ((f) => (C, { exclude: S = [], depth: y = 0, maxDepth: b, prefix: P = "", disabled: A = !1 }, k) => {
20969
20979
  const w = `${C}-${S.join(",")}-${y}-${b}-${P}`, I = f.get(w);
@@ -29653,7 +29663,7 @@ const initializerComponents = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Obje
29653
29663
  border-right: 1px solid rgba(0, 0, 0, 0.06);
29654
29664
  `,
29655
29665
  onClick: () => {
29656
- n.value = n.value || [], n.value.push(markRecordAsNew({})), n.onInput(n.value);
29666
+ n.value = n.value || [], n.value.push(markRecordAsNew({}));
29657
29667
  },
29658
29668
  children: r("Add new")
29659
29669
  }
@@ -1,4 +1,4 @@
1
- import { ISchema, Schema } from '@formily/react';
1
+ import { ISchema } from '@formily/react';
2
2
  export declare const useLabelUiSchemaV2: () => (collectionName: string, label: string) => ISchema;
3
3
  export declare const useLabelUiSchema: (collectionName: string, label: string) => ISchema;
4
4
  export declare const getDatePickerLabels: (props: any) => string;
@@ -9,4 +9,4 @@ export declare function isShowFilePicker(labelUiSchema: any): boolean;
9
9
  /**
10
10
  * 当前字段的模式是否是 `子表格` 或者 `子表单`
11
11
  */
12
- export declare function isSubMode(fieldSchema: Schema): boolean;
12
+ export declare function isSubMode(field: any): boolean;