@nocobase/client 0.20.0-alpha.6 → 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 +20 -10
- package/es/schema-component/antd/association-field/util.d.ts +2 -2
- package/lib/index.js +62 -62
- package/package.json +5 -5
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
|
|
5962
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -20923,7 +20924,7 @@ const useAssociationNames = (e) => {
|
|
|
20923
20924
|
b(A);
|
|
20924
20925
|
});
|
|
20925
20926
|
}
|
|
20926
|
-
const C = f && ((S = r(h.target)) == null ? void 0 : S.template) === "tree";
|
|
20927
|
+
const C = f && ((S = r(h.target, e)) == null ? void 0 : S.template) === "tree";
|
|
20927
20928
|
if (h && (f || g) && p["x-component"] !== "TableField") {
|
|
20928
20929
|
const b = !f && g ? getAssociationPath(p.name) : p.name, P = m === "" || !m ? b : m + "." + b;
|
|
20929
20930
|
if (C ? (n.add(P), n.add(`${P}.parent(recursively=true)`)) : n.add(P), ["Nester", "SubTable", "PopoverNester"].includes((y = p["x-component-props"]) == null ? void 0 : y.mode)) {
|
|
@@ -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({}))
|
|
29666
|
+
n.value = n.value || [], n.value.push(markRecordAsNew({}));
|
|
29657
29667
|
},
|
|
29658
29668
|
children: r("Add new")
|
|
29659
29669
|
}
|
|
@@ -39193,11 +39203,11 @@ const getSchema$4 = (e, t, n) => {
|
|
|
39193
39203
|
};
|
|
39194
39204
|
}), T = (N = R.fields.filter((E) => !["hasOne", "hasMany", "belongsToMany"].includes(E == null ? void 0 : E.type))) == null ? void 0 : N.map((E) => {
|
|
39195
39205
|
var V;
|
|
39196
|
-
return { value: E.name, key: E.name, label: l((V = E.uiSchema) == null ? void 0 : V.title) };
|
|
39206
|
+
return { value: E.name, key: E.name, label: l(((V = E.uiSchema) == null ? void 0 : V.title) || E.name) };
|
|
39197
39207
|
}).concat(z);
|
|
39198
39208
|
q.push({
|
|
39199
39209
|
value: B,
|
|
39200
|
-
label: l(R.title),
|
|
39210
|
+
label: l(R.title || R.name),
|
|
39201
39211
|
children: T
|
|
39202
39212
|
});
|
|
39203
39213
|
}), h(q);
|
|
@@ -39295,7 +39305,7 @@ const getSchema$4 = (e, t, n) => {
|
|
|
39295
39305
|
const N = b(T);
|
|
39296
39306
|
D(v(x({}, $), { interface: T, uiSchema: (E = N == null ? void 0 : N.default) == null ? void 0 : E.uiSchema }), R);
|
|
39297
39307
|
},
|
|
39298
|
-
children: z.map((T) => /* @__PURE__ */ jsx(Select$1.OptGroup, { label: w(T.label), children: T.children.map((N) => /* @__PURE__ */ jsx(Select$1.Option, { value: N.
|
|
39308
|
+
children: z.map((T) => /* @__PURE__ */ jsx(Select$1.OptGroup, { label: w(T.label), children: T.children.map((N) => /* @__PURE__ */ jsx(Select$1.Option, { value: N.name, children: w(N.label) }, N.value)) }, T.key))
|
|
39299
39309
|
}
|
|
39300
39310
|
);
|
|
39301
39311
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ISchema
|
|
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(
|
|
12
|
+
export declare function isSubMode(field: any): boolean;
|