@nocobase/client 1.7.0 → 1.7.1
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/block-provider/TemplateBlockProvider.d.ts +0 -2
- package/es/index.mjs +48 -61
- package/lib/index.js +6 -6
- package/package.json +5 -5
|
@@ -13,8 +13,6 @@ import { FC } from 'react';
|
|
|
13
13
|
export declare const useTemplateBlockContext: () => {
|
|
14
14
|
templateFinished?: boolean;
|
|
15
15
|
onTemplateSuccess?: Function;
|
|
16
|
-
isBlockTemplate?: () => boolean;
|
|
17
|
-
setIsBlockTemplate?: (value: boolean) => void;
|
|
18
16
|
};
|
|
19
17
|
declare const TemplateBlockProvider: FC<{
|
|
20
18
|
onTemplateLoaded?: () => void;
|
package/es/index.mjs
CHANGED
|
@@ -6459,26 +6459,13 @@ const TreeRecordContext = createContext(null), TreeRecordProvider = ({ children:
|
|
|
6459
6459
|
return e == null ? void 0 : e.parent;
|
|
6460
6460
|
}, TemplateBlockContext = createContext({});
|
|
6461
6461
|
TemplateBlockContext.displayName = "TemplateBlockContext";
|
|
6462
|
-
const useTemplateBlockContext = () => useContext(TemplateBlockContext),
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
const o = Object.keys(e.properties || {});
|
|
6466
|
-
for (const n of o) {
|
|
6467
|
-
const r = e.properties[n];
|
|
6468
|
-
if (r["x-component"] === "BlockTemplate" || _isBlockTemplate(r, t + 1))
|
|
6469
|
-
return !0;
|
|
6470
|
-
}
|
|
6471
|
-
return !1;
|
|
6472
|
-
}, TemplateBlockProvider = ({ onTemplateLoaded: e, children: t }) => {
|
|
6473
|
-
const o = useFieldSchema(), [n, r] = useState(!1), a = useCallback(() => {
|
|
6474
|
-
r(!0), setTimeout(() => {
|
|
6462
|
+
const useTemplateBlockContext = () => useContext(TemplateBlockContext), TemplateBlockProvider = ({ onTemplateLoaded: e, children: t }) => {
|
|
6463
|
+
const [o, n] = useState(!1), r = useCallback(() => {
|
|
6464
|
+
n(!0), setTimeout(() => {
|
|
6475
6465
|
e == null || e();
|
|
6476
6466
|
});
|
|
6477
|
-
}, [e]),
|
|
6478
|
-
|
|
6479
|
-
[a, n, i]
|
|
6480
|
-
);
|
|
6481
|
-
return /* @__PURE__ */ jsx(TemplateBlockContext.Provider, { value: l, children: t });
|
|
6467
|
+
}, [e]), a = useMemo(() => ({ templateFinished: o, onTemplateSuccess: r }), [r, o]);
|
|
6468
|
+
return /* @__PURE__ */ jsx(TemplateBlockContext.Provider, { value: a, children: t });
|
|
6482
6469
|
}, FormActiveFieldsContext = createContext(null), FormActiveFieldsProvider = ({
|
|
6483
6470
|
children: e,
|
|
6484
6471
|
name: t,
|
|
@@ -8398,7 +8385,7 @@ function addAppVersion(e, t) {
|
|
|
8398
8385
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
8399
8386
|
}), e;
|
|
8400
8387
|
}
|
|
8401
|
-
const name = "@nocobase/client", version = "1.7.
|
|
8388
|
+
const name = "@nocobase/client", version = "1.7.1", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
8402
8389
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
8403
8390
|
"@ant-design/cssinjs": "^1.11.1",
|
|
8404
8391
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -8419,9 +8406,9 @@ const name = "@nocobase/client", version = "1.7.0", license = "AGPL-3.0", main =
|
|
|
8419
8406
|
"@formily/reactive-react": "^2.2.27",
|
|
8420
8407
|
"@formily/shared": "^2.2.27",
|
|
8421
8408
|
"@formily/validator": "^2.2.27",
|
|
8422
|
-
"@nocobase/evaluators": "1.7.
|
|
8423
|
-
"@nocobase/sdk": "1.7.
|
|
8424
|
-
"@nocobase/utils": "1.7.
|
|
8409
|
+
"@nocobase/evaluators": "1.7.1",
|
|
8410
|
+
"@nocobase/sdk": "1.7.1",
|
|
8411
|
+
"@nocobase/utils": "1.7.1",
|
|
8425
8412
|
ahooks: "^3.7.2",
|
|
8426
8413
|
antd: "5.24.2",
|
|
8427
8414
|
"antd-style": "3.7.1",
|
|
@@ -18049,7 +18036,7 @@ const InternalDetailsBlockProvider = (e) => {
|
|
|
18049
18036
|
resource: i,
|
|
18050
18037
|
formBlockRef: d
|
|
18051
18038
|
}), [t, n, r, i, l]);
|
|
18052
|
-
return n.loaded = !0, /* @__PURE__ */ jsx(CurrentRecordContextProvider, { recordData: u, collectionName: a == null ? void 0 : a.name, children: /* @__PURE__ */ jsx(DetailsBlockContext.Provider, { value: p, children: /* @__PURE__ */ jsx("div", { ref: d, children: /* @__PURE__ */ jsx(RecordProvider, { isNew: !1, record: u, parent: c == null ? void 0 : c.data, children: e.children }) }) }) });
|
|
18039
|
+
return l.loading && !n.loaded ? /* @__PURE__ */ jsx(Spin, {}) : (n.loaded = !0, /* @__PURE__ */ jsx(CurrentRecordContextProvider, { recordData: u, collectionName: a == null ? void 0 : a.name, children: /* @__PURE__ */ jsx(DetailsBlockContext.Provider, { value: p, children: /* @__PURE__ */ jsx("div", { ref: d, children: /* @__PURE__ */ jsx(RecordProvider, { isNew: !1, record: u, parent: c == null ? void 0 : c.data, children: e.children }) }) }) }));
|
|
18053
18040
|
}, useCompatDetailsBlockParams = (e) => {
|
|
18054
18041
|
const t = useFieldSchema();
|
|
18055
18042
|
let o, n = !1;
|
|
@@ -28002,8 +27989,8 @@ BlockRequestLoadingContext.displayName = "BlockRequestLoadingContext";
|
|
|
28002
27989
|
const BlockRequestDataContext = createContext(null);
|
|
28003
27990
|
BlockRequestDataContext.displayName = "BlockRequestDataContext";
|
|
28004
27991
|
function useRecordRequest(e) {
|
|
28005
|
-
const t = useDataLoadingMode(), o = useDataBlockResource(), { action: n, params: r = {}, record: a, requestService: i, requestOptions: l, sourceId: c, association: u, parentRecord: d } = e, p = useAPIClient(), m = useDataBlockProps(), h = useDataSourceHeaders(m.dataSource), g = useSourceKey(u), [f, C] = useMemo(() => [JSON.stringify(r), JSON.stringify(a)], [r, a]),
|
|
28006
|
-
var
|
|
27992
|
+
const t = useDataLoadingMode(), o = useDataBlockResource(), { action: n, params: r = {}, record: a, requestService: i, requestOptions: l, sourceId: c, association: u, parentRecord: d } = e, p = useAPIClient(), m = useDataBlockProps(), h = useDataSourceHeaders(m.dataSource), g = useSourceKey(u), [f, C] = useMemo(() => [JSON.stringify(r), JSON.stringify(a)], [r, a]), b = (v) => {
|
|
27993
|
+
var T;
|
|
28007
27994
|
if (a)
|
|
28008
27995
|
return Promise.resolve({ data: a });
|
|
28009
27996
|
if (!n)
|
|
@@ -28012,19 +27999,19 @@ function useRecordRequest(e) {
|
|
|
28012
27999
|
return console.warn(
|
|
28013
28000
|
'[nocobase]: The "filterByTk" parameter is missing in the "DataBlockRequestProvider" component'
|
|
28014
28001
|
);
|
|
28015
|
-
const
|
|
28016
|
-
return (
|
|
28017
|
-
}
|
|
28018
|
-
return useRequest((...
|
|
28019
|
-
const [
|
|
28020
|
-
|
|
28002
|
+
const F = r.filterByTk === void 0 ? _.omit(r, "filterByTk") : r, I = x(x({}, F), v);
|
|
28003
|
+
return (T = o[n]) == null ? void 0 : T.call(o, I).then((R) => R.data);
|
|
28004
|
+
};
|
|
28005
|
+
return useRequest((...v) => q(this, null, function* () {
|
|
28006
|
+
const [F, I] = yield Promise.all([
|
|
28007
|
+
(i || b)(...v),
|
|
28021
28008
|
requestParentRecordData({ sourceId: c, association: u, parentRecord: d, api: p, headers: h, sourceKey: g })
|
|
28022
28009
|
]);
|
|
28023
|
-
return
|
|
28010
|
+
return F && (F.parentRecord = I == null ? void 0 : I.data), F;
|
|
28024
28011
|
}), P(x({}, l), {
|
|
28025
28012
|
manual: t === "manual",
|
|
28026
28013
|
ready: !!n,
|
|
28027
|
-
refreshDeps: [n, f, C, o, u, d, c
|
|
28014
|
+
refreshDeps: [n, f, C, o, u, d, c]
|
|
28028
28015
|
}));
|
|
28029
28016
|
}
|
|
28030
28017
|
function requestParentRecordData(i) {
|
|
@@ -40174,40 +40161,40 @@ const useFormBlockHeight = () => {
|
|
|
40174
40161
|
o["x-linkage-rules"] && (t = o["x-linkage-rules"]);
|
|
40175
40162
|
}), t;
|
|
40176
40163
|
}, WithForm = (e) => {
|
|
40177
|
-
var
|
|
40178
|
-
const { form: t } = e, o = useFieldSchema(), { setFormValueChanged: n } = useActionContext(), r = useVariables$1(), a = useLocalVariables$1({ currentForm: t }), { templateFinished: i } = useTemplateBlockContext(), { loading: l
|
|
40164
|
+
var p, m;
|
|
40165
|
+
const { form: t } = e, o = useFieldSchema(), { setFormValueChanged: n } = useActionContext(), r = useVariables$1(), a = useLocalVariables$1({ currentForm: t }), { templateFinished: i } = useTemplateBlockContext(), { loading: l } = useDataBlockRequest() || {}, c = useApp(), u = ((m = getLinkageRules(o) || ((p = o.parent) == null ? void 0 : p["x-linkage-rules"])) == null ? void 0 : m.filter((h) => !h.disabled)) || [], { confirmBeforeClose: d = !0 } = useDataBlockProps() || {};
|
|
40179
40166
|
return useEffect(() => {
|
|
40180
|
-
const
|
|
40181
|
-
return t.addEffects(
|
|
40167
|
+
const h = uid();
|
|
40168
|
+
return t.addEffects(h, () => {
|
|
40182
40169
|
onFormInputChange(() => {
|
|
40183
|
-
n == null || n(
|
|
40170
|
+
n == null || n(d);
|
|
40184
40171
|
});
|
|
40185
40172
|
}), e.disabled && (t.disabled = e.disabled), () => {
|
|
40186
|
-
t.removeEffects(
|
|
40173
|
+
t.removeEffects(h);
|
|
40187
40174
|
};
|
|
40188
|
-
}, [t, e.disabled, n,
|
|
40189
|
-
if (l
|
|
40175
|
+
}, [t, e.disabled, n, d]), useEffect(() => {
|
|
40176
|
+
if (l)
|
|
40190
40177
|
return;
|
|
40191
|
-
const
|
|
40178
|
+
const h = uid(), g = [];
|
|
40192
40179
|
return setTimeout(() => {
|
|
40193
|
-
t.addEffects(
|
|
40194
|
-
forEachLinkageRule(
|
|
40195
|
-
var
|
|
40196
|
-
if ((
|
|
40197
|
-
const
|
|
40198
|
-
onFieldInit(`*(${
|
|
40199
|
-
|
|
40180
|
+
t.addEffects(h, () => {
|
|
40181
|
+
forEachLinkageRule(u, (f, C) => {
|
|
40182
|
+
var b;
|
|
40183
|
+
if ((b = f.targetFields) != null && b.length) {
|
|
40184
|
+
const S = f.targetFields.join(",");
|
|
40185
|
+
onFieldInit(`*(${S})`, (y, v) => {
|
|
40186
|
+
g.push(
|
|
40200
40187
|
bindLinkageRulesToFiled(
|
|
40201
40188
|
{
|
|
40202
|
-
field:
|
|
40203
|
-
linkageRules:
|
|
40204
|
-
formValues:
|
|
40189
|
+
field: y,
|
|
40190
|
+
linkageRules: u,
|
|
40191
|
+
formValues: v.values,
|
|
40205
40192
|
localVariables: a,
|
|
40206
|
-
action:
|
|
40207
|
-
rule:
|
|
40193
|
+
action: f,
|
|
40194
|
+
rule: C,
|
|
40208
40195
|
variables: r
|
|
40209
40196
|
},
|
|
40210
|
-
|
|
40197
|
+
c.jsonLogic
|
|
40211
40198
|
)
|
|
40212
40199
|
);
|
|
40213
40200
|
});
|
|
@@ -40215,11 +40202,11 @@ const useFormBlockHeight = () => {
|
|
|
40215
40202
|
});
|
|
40216
40203
|
});
|
|
40217
40204
|
}), () => {
|
|
40218
|
-
t.removeEffects(
|
|
40219
|
-
|
|
40205
|
+
t.removeEffects(h), g.forEach((f) => {
|
|
40206
|
+
f();
|
|
40220
40207
|
});
|
|
40221
40208
|
};
|
|
40222
|
-
}, [
|
|
40209
|
+
}, [u, i, l]), o["x-decorator"] === "FormV2" ? /* @__PURE__ */ jsx(FormDecorator, x({}, e)) : /* @__PURE__ */ jsx(FormComponent, x({}, e));
|
|
40223
40210
|
}, WithoutForm = (e) => {
|
|
40224
40211
|
const t = useFieldSchema(), { setFormValueChanged: o } = useActionContext(), { confirmBeforeClose: n = !0 } = useDataBlockProps() || {}, r = useMemo(
|
|
40225
40212
|
() => createForm({
|
|
@@ -47082,10 +47069,10 @@ const CronSetInternal = (e) => {
|
|
|
47082
47069
|
return /* @__PURE__ */ jsx(EllipsisWithTooltip, { ellipsis: !0, children: t && (l ? o(l) : /* @__PURE__ */ jsx(Cron.ReadPretty, x({}, e))) });
|
|
47083
47070
|
}, CronSet = connect(CronSetInternal, mapReadPretty(ReadPretty$3)), Details = withDynamicSchemaProps(
|
|
47084
47071
|
withSkeletonComponent((e) => {
|
|
47085
|
-
const
|
|
47086
|
-
return
|
|
47072
|
+
const t = useDataBlockRequestData(), o = useFieldSchema();
|
|
47073
|
+
return _.isEmpty(t == null ? void 0 : t.data) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
47087
47074
|
/* @__PURE__ */ jsx(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE }),
|
|
47088
|
-
/* @__PURE__ */ jsx(NocoBaseRecursionField, { schema:
|
|
47075
|
+
/* @__PURE__ */ jsx(NocoBaseRecursionField, { schema: o.properties.pagination, name: "pagination" })
|
|
47089
47076
|
] }) : /* @__PURE__ */ jsx("div", { className: "nb-details", children: /* @__PURE__ */ jsx(FormWithDataTemplates, x({}, e)) });
|
|
47090
47077
|
}),
|
|
47091
47078
|
{ displayName: "NocoBaseDetails" }
|