@nocobase/client 2.0.28 → 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.28", 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",
|
|
@@ -24650,7 +24650,7 @@ function parseValue(e, t = {}) {
|
|
|
24650
24650
|
if (o === "string") {
|
|
24651
24651
|
const r = e.match(JT_VALUE_RE);
|
|
24652
24652
|
if (r)
|
|
24653
|
-
return r[1].split(".");
|
|
24653
|
+
return r[1].trim().split(".");
|
|
24654
24654
|
if (t.stringToDate && !Number.isNaN(Date.parse(e)))
|
|
24655
24655
|
return "date";
|
|
24656
24656
|
}
|
|
@@ -25262,7 +25262,7 @@ function useVariablesFromValue(e, t = ["{{", "}}"]) {
|
|
|
25262
25262
|
if (!(e != null && e.trim()))
|
|
25263
25263
|
return [];
|
|
25264
25264
|
const n = new RegExp(`${t[0]}\\s*([^{}]+)\\s*${t[1]}`, "g"), r = e.match(n);
|
|
25265
|
-
return (i = r == null ? void 0 : r.map((a) => a.replace(n, "$1"))) != null ? i : [];
|
|
25265
|
+
return (i = r == null ? void 0 : r.map((a) => a.replace(n, "$1").trim())) != null ? i : [];
|
|
25266
25266
|
}, [e, o]);
|
|
25267
25267
|
}
|
|
25268
25268
|
function TextArea(e) {
|
|
@@ -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);
|
|
@@ -73144,6 +73144,16 @@ const TABS_DESIGN_MODE_ROOT_CLASS_NAME = css`
|
|
|
73144
73144
|
> .ant-tabs-nav .ant-tabs-tab {
|
|
73145
73145
|
min-width: 54px;
|
|
73146
73146
|
}
|
|
73147
|
+
|
|
73148
|
+
> .ant-tabs-nav .ant-tabs-tab .ant-tabs-tab-btn {
|
|
73149
|
+
display: block;
|
|
73150
|
+
width: 100%;
|
|
73151
|
+
}
|
|
73152
|
+
|
|
73153
|
+
> .ant-tabs-nav .ant-tabs-tab .ant-tabs-tab-btn > [data-has-float-menu='true'] {
|
|
73154
|
+
display: block;
|
|
73155
|
+
width: 100%;
|
|
73156
|
+
}
|
|
73147
73157
|
`;
|
|
73148
73158
|
class PageModel extends FlowModel {
|
|
73149
73159
|
constructor() {
|
|
@@ -86377,6 +86387,66 @@ EditableItemModel.bindModelToInterface("CascadeSelectListFieldModel", ["m2m", "o
|
|
|
86377
86387
|
isDefault: !0,
|
|
86378
86388
|
order: 60
|
|
86379
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
|
+
}
|
|
86380
86450
|
function FieldWithoutPermissionPlaceholder({ targetModel: e, children: t }) {
|
|
86381
86451
|
const o = e.context.t, n = e, r = n.context.collectionField.collection, i = r.dataSource, a = n.context.collectionField.name, l = useMemo(() => {
|
|
86382
86452
|
const d = `${o(i.displayName || i.key)} > `, p = r ? `${o(r.title) || r.name || r.tableName} > ` : "";
|
|
@@ -86406,7 +86476,15 @@ function RemoteModelRenderer({ options: e, fieldModel: t }) {
|
|
|
86406
86476
|
refreshDeps: [o, e]
|
|
86407
86477
|
}
|
|
86408
86478
|
);
|
|
86409
|
-
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 } }) });
|
|
86410
86488
|
}
|
|
86411
86489
|
function EditFormContent({ model: e, scene: t = "update" }) {
|
|
86412
86490
|
const o = useFlowContext(), { Header: n, type: r } = o.view;
|
|
@@ -87765,17 +87843,18 @@ PopupSubTableFormSubmitActionModel.registerFlow({
|
|
|
87765
87843
|
save: {
|
|
87766
87844
|
handler(e, t) {
|
|
87767
87845
|
return L(this, null, function* () {
|
|
87846
|
+
var d;
|
|
87768
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);
|
|
87769
87848
|
try {
|
|
87770
|
-
const
|
|
87771
|
-
Array.isArray(
|
|
87772
|
-
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);
|
|
87773
87852
|
n.dispatchEvent("updateRow", {
|
|
87774
|
-
updatedRecord:
|
|
87853
|
+
updatedRecord: h
|
|
87775
87854
|
});
|
|
87776
|
-
const
|
|
87777
|
-
r.addUpdateAssociationValues(
|
|
87778
|
-
} catch (
|
|
87855
|
+
const g = a.map((f) => `${u}.${f}`);
|
|
87856
|
+
r.addUpdateAssociationValues(g), (d = o.resetUserModifiedFields) == null || d.call(o);
|
|
87857
|
+
} catch (p) {
|
|
87779
87858
|
return;
|
|
87780
87859
|
}
|
|
87781
87860
|
e.view && e.view.close();
|
|
@@ -95443,7 +95522,7 @@ DisplayItemModel.bindModelToInterface("DisplayPercentFieldModel", ["percent"], {
|
|
|
95443
95522
|
});
|
|
95444
95523
|
class DisplayTextFieldModel extends ClickableFieldModel {
|
|
95445
95524
|
t(t) {
|
|
95446
|
-
return t !=
|
|
95525
|
+
return typeof t != "string" ? t : t.startsWith("{{") && t.endsWith("}}") ? this.translate(t) : t;
|
|
95447
95526
|
}
|
|
95448
95527
|
renderComponent(t, o) {
|
|
95449
95528
|
const { prefix: n, suffix: r, overflowMode: i } = this.props;
|
|
@@ -95727,47 +95806,64 @@ const models = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
95727
95806
|
transformNestedData,
|
|
95728
95807
|
transformRowsToSingleColumn
|
|
95729
95808
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
95730
|
-
function collectDirtyFormModelUids(e) {
|
|
95809
|
+
function collectDirtyFormModelUids(e, t = []) {
|
|
95731
95810
|
if (!e)
|
|
95732
95811
|
return [];
|
|
95733
|
-
const
|
|
95734
|
-
var
|
|
95735
|
-
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))
|
|
95736
95815
|
return;
|
|
95737
|
-
|
|
95738
|
-
const
|
|
95739
|
-
|
|
95740
|
-
_.castArray(
|
|
95741
|
-
|
|
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);
|
|
95742
95821
|
});
|
|
95743
95822
|
});
|
|
95744
95823
|
};
|
|
95745
|
-
return
|
|
95824
|
+
return i(e), n;
|
|
95746
95825
|
}
|
|
95747
|
-
function createBeforeCloseDirtyState(e) {
|
|
95748
|
-
const
|
|
95826
|
+
function createBeforeCloseDirtyState(e, t = []) {
|
|
95827
|
+
const o = collectDirtyFormModelUids(e, t);
|
|
95749
95828
|
return {
|
|
95750
|
-
hasDirtyForms:
|
|
95751
|
-
formModelUids:
|
|
95829
|
+
hasDirtyForms: o.length > 0,
|
|
95830
|
+
formModelUids: o
|
|
95752
95831
|
};
|
|
95753
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
|
+
}
|
|
95754
95846
|
function createViewBeforeCloseHandler(e) {
|
|
95755
|
-
return (
|
|
95847
|
+
return (r) => L(this, [r], function* ({
|
|
95848
|
+
result: t,
|
|
95849
|
+
force: o,
|
|
95850
|
+
ignoredDirtyFormModelUids: n
|
|
95851
|
+
}) {
|
|
95756
95852
|
if (o)
|
|
95757
95853
|
return !0;
|
|
95758
|
-
const
|
|
95759
|
-
let
|
|
95760
|
-
const
|
|
95854
|
+
const i = createBeforeCloseDirtyState(e, n);
|
|
95855
|
+
let a = !1;
|
|
95856
|
+
const l = yield e.dispatchEvent("close", {
|
|
95761
95857
|
result: t,
|
|
95762
95858
|
force: !1,
|
|
95763
|
-
dirty:
|
|
95859
|
+
dirty: i,
|
|
95764
95860
|
controller: {
|
|
95765
95861
|
prevent() {
|
|
95766
|
-
|
|
95862
|
+
a = !0;
|
|
95767
95863
|
}
|
|
95768
95864
|
}
|
|
95769
|
-
}),
|
|
95770
|
-
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;
|
|
95771
95867
|
});
|
|
95772
95868
|
}
|
|
95773
95869
|
const openView = defineAction({
|