@nocobase/client 2.0.29 → 2.0.30
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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { FlowModel } from '@nocobase/flow-engine';
|
|
10
|
+
import type { HookAPI } from 'antd/es/modal/useModal';
|
|
11
|
+
type PopupBeforeClosePayload = {
|
|
12
|
+
result?: any;
|
|
13
|
+
force?: boolean;
|
|
14
|
+
ignoredDirtyFormModelUids?: string[];
|
|
15
|
+
};
|
|
16
|
+
type PopupViewLike = {
|
|
17
|
+
beforeClose?: (payload: PopupBeforeClosePayload) => Promise<boolean | void> | boolean | void;
|
|
18
|
+
};
|
|
19
|
+
export declare function bindPopupSubTableBeforeClose({ view, model, modal, t, }: {
|
|
20
|
+
view: PopupViewLike;
|
|
21
|
+
model?: FlowModel | null;
|
|
22
|
+
modal: Pick<HookAPI, 'confirm'>;
|
|
23
|
+
t: (key: string) => string;
|
|
24
|
+
}): () => void;
|
|
25
|
+
export {};
|
package/es/index.mjs
CHANGED
|
@@ -9964,7 +9964,7 @@ function addAppVersion(e, t) {
|
|
|
9964
9964
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9965
9965
|
}), e;
|
|
9966
9966
|
}
|
|
9967
|
-
const name = "@nocobase/client", version = "2.0.
|
|
9967
|
+
const name = "@nocobase/client", version = "2.0.30", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9968
9968
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9969
9969
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9970
9970
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9987,10 +9987,10 @@ const name = "@nocobase/client", version = "2.0.29", license = "Apache-2.0", mai
|
|
|
9987
9987
|
"@formily/reactive-react": "^2.2.27",
|
|
9988
9988
|
"@formily/shared": "^2.2.27",
|
|
9989
9989
|
"@formily/validator": "^2.2.27",
|
|
9990
|
-
"@nocobase/evaluators": "2.0.
|
|
9991
|
-
"@nocobase/flow-engine": "2.0.
|
|
9992
|
-
"@nocobase/sdk": "2.0.
|
|
9993
|
-
"@nocobase/utils": "2.0.
|
|
9990
|
+
"@nocobase/evaluators": "2.0.30",
|
|
9991
|
+
"@nocobase/flow-engine": "2.0.30",
|
|
9992
|
+
"@nocobase/sdk": "2.0.30",
|
|
9993
|
+
"@nocobase/utils": "2.0.30",
|
|
9994
9994
|
"@tanstack/react-table": "^8.21.3",
|
|
9995
9995
|
"@types/tabulator-tables": "^6.2.6",
|
|
9996
9996
|
"acorn-jsx": "^5.3.2",
|
|
@@ -30630,7 +30630,7 @@ const useStyles$a = genStyleHook("nb-markdown", (e, { isDarkTheme: t }) => {
|
|
|
30630
30630
|
}, t ? i : r)
|
|
30631
30631
|
};
|
|
30632
30632
|
}), parseMarkdown$1 = _.memoize((e) => L(void 0, null, function* () {
|
|
30633
|
-
return e && (yield import("./md-
|
|
30633
|
+
return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
|
|
30634
30634
|
}));
|
|
30635
30635
|
function useParseMarkdown$1(e) {
|
|
30636
30636
|
const [t, o] = useState(""), [n, r] = useState(!0);
|
|
@@ -72043,7 +72043,7 @@ BlockGridModel.registerFlow({
|
|
|
72043
72043
|
}
|
|
72044
72044
|
});
|
|
72045
72045
|
const parseMarkdown = _.memoize((e) => L(void 0, null, function* () {
|
|
72046
|
-
return e && (yield import("./md-
|
|
72046
|
+
return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
|
|
72047
72047
|
}));
|
|
72048
72048
|
function useParseMarkdown(e) {
|
|
72049
72049
|
const [t, o] = useState(""), [n, r] = useState(!0);
|
|
@@ -86387,6 +86387,66 @@ EditableItemModel.bindModelToInterface("CascadeSelectListFieldModel", ["m2m", "o
|
|
|
86387
86387
|
isDefault: !0,
|
|
86388
86388
|
order: 60
|
|
86389
86389
|
});
|
|
86390
|
+
const POPUP_BEFORE_CLOSE_NEXT = Symbol("popupBeforeCloseNext");
|
|
86391
|
+
function visitModelTree(e, t) {
|
|
86392
|
+
const o = e ? [e] : [], n = /* @__PURE__ */ new Set();
|
|
86393
|
+
for (; o.length; ) {
|
|
86394
|
+
const r = o.pop();
|
|
86395
|
+
!(r != null && r.uid) || n.has(r.uid) || (n.add(r.uid), t(r), Object.values(r.subModels || {}).forEach((i) => {
|
|
86396
|
+
Array.isArray(i) ? o.push(...i) : i && typeof i == "object" && o.push(i);
|
|
86397
|
+
}));
|
|
86398
|
+
}
|
|
86399
|
+
}
|
|
86400
|
+
function unlinkBeforeClose(e, t) {
|
|
86401
|
+
let o, n = e.beforeClose;
|
|
86402
|
+
for (; n; ) {
|
|
86403
|
+
if (n === t) {
|
|
86404
|
+
o ? o[POPUP_BEFORE_CLOSE_NEXT] = n[POPUP_BEFORE_CLOSE_NEXT] : e.beforeClose = n[POPUP_BEFORE_CLOSE_NEXT];
|
|
86405
|
+
break;
|
|
86406
|
+
}
|
|
86407
|
+
if (!(POPUP_BEFORE_CLOSE_NEXT in n))
|
|
86408
|
+
break;
|
|
86409
|
+
o = n, n = n[POPUP_BEFORE_CLOSE_NEXT];
|
|
86410
|
+
}
|
|
86411
|
+
}
|
|
86412
|
+
function bindPopupSubTableBeforeClose({
|
|
86413
|
+
view: e,
|
|
86414
|
+
model: t,
|
|
86415
|
+
modal: o,
|
|
86416
|
+
t: n
|
|
86417
|
+
}) {
|
|
86418
|
+
const r = (l = []) => {
|
|
86419
|
+
const c = [], u = l.length ? new Set(l) : null;
|
|
86420
|
+
return visitModelTree(t, (d) => {
|
|
86421
|
+
var p, m;
|
|
86422
|
+
d.uid && ((m = (p = d.getUserModifiedFields) == null ? void 0 : p.call(d)) != null && m.size) && !(u != null && u.has(d.uid)) && c.push(d.uid);
|
|
86423
|
+
}), c;
|
|
86424
|
+
}, i = (l) => {
|
|
86425
|
+
if (!l.length)
|
|
86426
|
+
return;
|
|
86427
|
+
const c = new Set(l);
|
|
86428
|
+
visitModelTree(t, (u) => {
|
|
86429
|
+
var d;
|
|
86430
|
+
u.uid && c.has(u.uid) && ((d = u.resetUserModifiedFields) == null || d.call(u));
|
|
86431
|
+
});
|
|
86432
|
+
}, a = (l) => L(this, null, function* () {
|
|
86433
|
+
const c = l.force ? [] : r(l.ignoredDirtyFormModelUids);
|
|
86434
|
+
if (c.length && !(yield o.confirm({
|
|
86435
|
+
title: n("Unsaved changes"),
|
|
86436
|
+
content: n("Are you sure you don't want to save?"),
|
|
86437
|
+
okText: n("Confirm"),
|
|
86438
|
+
cancelText: n("Cancel")
|
|
86439
|
+
})))
|
|
86440
|
+
return !1;
|
|
86441
|
+
const u = a[POPUP_BEFORE_CLOSE_NEXT], d = c.length ? Array.from(/* @__PURE__ */ new Set([...l.ignoredDirtyFormModelUids || [], ...c])) : l.ignoredDirtyFormModelUids;
|
|
86442
|
+
return (yield u == null ? void 0 : u(A(x({}, l), {
|
|
86443
|
+
ignoredDirtyFormModelUids: d
|
|
86444
|
+
}))) !== !1 ? (c.length && i(c), !0) : !1;
|
|
86445
|
+
});
|
|
86446
|
+
return a[POPUP_BEFORE_CLOSE_NEXT] = e.beforeClose, e.beforeClose = a, () => {
|
|
86447
|
+
unlinkBeforeClose(e, a);
|
|
86448
|
+
};
|
|
86449
|
+
}
|
|
86390
86450
|
function FieldWithoutPermissionPlaceholder({ targetModel: e, children: t }) {
|
|
86391
86451
|
const o = e.context.t, n = e, r = n.context.collectionField.collection, i = r.dataSource, a = n.context.collectionField.name, l = useMemo(() => {
|
|
86392
86452
|
const d = `${o(i.displayName || i.key)} > `, p = r ? `${o(r.title) || r.name || r.tableName} > ` : "";
|
|
@@ -86416,7 +86476,15 @@ function RemoteModelRenderer({ options: e, fieldModel: t }) {
|
|
|
86416
86476
|
refreshDeps: [o, e]
|
|
86417
86477
|
}
|
|
86418
86478
|
);
|
|
86419
|
-
return
|
|
86479
|
+
return useEffect(() => {
|
|
86480
|
+
if (n != null && n.uid)
|
|
86481
|
+
return bindPopupSubTableBeforeClose({
|
|
86482
|
+
view: o.view,
|
|
86483
|
+
model: n,
|
|
86484
|
+
modal: o.modal,
|
|
86485
|
+
t: o.t
|
|
86486
|
+
});
|
|
86487
|
+
}, [o, n]), r || !(n != null && n.uid) ? /* @__PURE__ */ jsx(SkeletonFallback, { style: { margin: 16 } }) : /* @__PURE__ */ jsx(FlowModelRenderer, { model: n, fallback: /* @__PURE__ */ jsx(SkeletonFallback, { style: { margin: 16 } }) });
|
|
86420
86488
|
}
|
|
86421
86489
|
function EditFormContent({ model: e, scene: t = "update" }) {
|
|
86422
86490
|
const o = useFlowContext(), { Header: n, type: r } = o.view;
|
|
@@ -87775,17 +87843,18 @@ PopupSubTableFormSubmitActionModel.registerFlow({
|
|
|
87775
87843
|
save: {
|
|
87776
87844
|
handler(e, t) {
|
|
87777
87845
|
return L(this, null, function* () {
|
|
87846
|
+
var d;
|
|
87778
87847
|
const o = e.blockModel, n = o.context.associationModel, r = n.context.resource, a = o.resource.getUpdateAssociationValues(), l = n.context.collectionField.name, c = r.getUpdateAssociationValues(), u = matchPath(c, l);
|
|
87779
87848
|
try {
|
|
87780
|
-
const
|
|
87781
|
-
Array.isArray(
|
|
87782
|
-
const
|
|
87849
|
+
const p = e != null && e.flowSettingsEnabled ? getValidationNamePathsExcludingHiddenModels(o) : null;
|
|
87850
|
+
Array.isArray(p) ? p.length && (yield o.form.validateFields(p)) : yield o.form.validateFields();
|
|
87851
|
+
const m = o.form.getFieldsValue(!0), h = omitHiddenModelValuesFromSubmit(m, o);
|
|
87783
87852
|
n.dispatchEvent("updateRow", {
|
|
87784
|
-
updatedRecord:
|
|
87853
|
+
updatedRecord: h
|
|
87785
87854
|
});
|
|
87786
|
-
const
|
|
87787
|
-
r.addUpdateAssociationValues(
|
|
87788
|
-
} catch (
|
|
87855
|
+
const g = a.map((f) => `${u}.${f}`);
|
|
87856
|
+
r.addUpdateAssociationValues(g), (d = o.resetUserModifiedFields) == null || d.call(o);
|
|
87857
|
+
} catch (p) {
|
|
87789
87858
|
return;
|
|
87790
87859
|
}
|
|
87791
87860
|
e.view && e.view.close();
|
|
@@ -95737,47 +95806,64 @@ const models = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
95737
95806
|
transformNestedData,
|
|
95738
95807
|
transformRowsToSingleColumn
|
|
95739
95808
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
95740
|
-
function collectDirtyFormModelUids(e) {
|
|
95809
|
+
function collectDirtyFormModelUids(e, t = []) {
|
|
95741
95810
|
if (!e)
|
|
95742
95811
|
return [];
|
|
95743
|
-
const
|
|
95744
|
-
var
|
|
95745
|
-
if (!(
|
|
95812
|
+
const o = /* @__PURE__ */ new Set(), n = [], r = t.length ? new Set(t) : null, i = (a) => {
|
|
95813
|
+
var c;
|
|
95814
|
+
if (!(a != null && a.uid) || o.has(a.uid))
|
|
95746
95815
|
return;
|
|
95747
|
-
|
|
95748
|
-
const
|
|
95749
|
-
|
|
95750
|
-
_.castArray(
|
|
95751
|
-
|
|
95816
|
+
o.add(a.uid);
|
|
95817
|
+
const l = (c = a.getUserModifiedFields) == null ? void 0 : c.call(a);
|
|
95818
|
+
l != null && l.size && !(r != null && r.has(a.uid)) && n.push(a.uid), Object.values(a.subModels || {}).forEach((u) => {
|
|
95819
|
+
_.castArray(u).forEach((d) => {
|
|
95820
|
+
d && typeof d == "object" && i(d);
|
|
95752
95821
|
});
|
|
95753
95822
|
});
|
|
95754
95823
|
};
|
|
95755
|
-
return
|
|
95824
|
+
return i(e), n;
|
|
95756
95825
|
}
|
|
95757
|
-
function createBeforeCloseDirtyState(e) {
|
|
95758
|
-
const
|
|
95826
|
+
function createBeforeCloseDirtyState(e, t = []) {
|
|
95827
|
+
const o = collectDirtyFormModelUids(e, t);
|
|
95759
95828
|
return {
|
|
95760
|
-
hasDirtyForms:
|
|
95761
|
-
formModelUids:
|
|
95829
|
+
hasDirtyForms: o.length > 0,
|
|
95830
|
+
formModelUids: o
|
|
95762
95831
|
};
|
|
95763
95832
|
}
|
|
95833
|
+
function resetDirtyFormModels(e, t = []) {
|
|
95834
|
+
if (!e || !t.length)
|
|
95835
|
+
return;
|
|
95836
|
+
const o = /* @__PURE__ */ new Set(), n = new Set(t), r = (i) => {
|
|
95837
|
+
var a;
|
|
95838
|
+
!(i != null && i.uid) || o.has(i.uid) || (o.add(i.uid), n.has(i.uid) && ((a = i.resetUserModifiedFields) == null || a.call(i)), Object.values(i.subModels || {}).forEach((l) => {
|
|
95839
|
+
_.castArray(l).forEach((c) => {
|
|
95840
|
+
c && typeof c == "object" && r(c);
|
|
95841
|
+
});
|
|
95842
|
+
}));
|
|
95843
|
+
};
|
|
95844
|
+
r(e);
|
|
95845
|
+
}
|
|
95764
95846
|
function createViewBeforeCloseHandler(e) {
|
|
95765
|
-
return (
|
|
95847
|
+
return (r) => L(this, [r], function* ({
|
|
95848
|
+
result: t,
|
|
95849
|
+
force: o,
|
|
95850
|
+
ignoredDirtyFormModelUids: n
|
|
95851
|
+
}) {
|
|
95766
95852
|
if (o)
|
|
95767
95853
|
return !0;
|
|
95768
|
-
const
|
|
95769
|
-
let
|
|
95770
|
-
const
|
|
95854
|
+
const i = createBeforeCloseDirtyState(e, n);
|
|
95855
|
+
let a = !1;
|
|
95856
|
+
const l = yield e.dispatchEvent("close", {
|
|
95771
95857
|
result: t,
|
|
95772
95858
|
force: !1,
|
|
95773
|
-
dirty:
|
|
95859
|
+
dirty: i,
|
|
95774
95860
|
controller: {
|
|
95775
95861
|
prevent() {
|
|
95776
|
-
|
|
95862
|
+
a = !0;
|
|
95777
95863
|
}
|
|
95778
95864
|
}
|
|
95779
|
-
}),
|
|
95780
|
-
return
|
|
95865
|
+
}), c = (l == null ? void 0 : l.__abortedByExitAll) === !0 || (Array.isArray(l) ? l.some((d) => d instanceof FlowExitAllException) : !1), u = !a && !c;
|
|
95866
|
+
return u && i.hasDirtyForms && resetDirtyFormModels(e, i.formModelUids), u;
|
|
95781
95867
|
});
|
|
95782
95868
|
}
|
|
95783
95869
|
const openView = defineAction({
|