@nocobase/client 2.0.11 → 2.0.12
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/flow/models/actions/AddChildActionModel.d.ts +1 -0
- package/es/flow/models/actions/BulkDeleteActionModel.d.ts +1 -0
- package/es/flow/models/base/ActionGroupModel.d.ts +8 -0
- package/es/flow/models/base/CollectionBlockModel.d.ts +7 -0
- package/es/flow/models/base/PageModel/RootPageModel.d.ts +8 -0
- package/es/flow/models/blocks/form/CreateFormModel.d.ts +1 -0
- package/es/flow/models/blocks/form/EditFormModel.d.ts +1 -0
- package/es/flow/utils/actionCapability.d.ts +60 -0
- package/es/index.mjs +219 -127
- package/es/schema-settings/VariableInput/hooks/useParentIterationVariable.d.ts +3 -3
- package/lib/index.js +12 -16
- package/package.json +6 -6
package/es/index.mjs
CHANGED
|
@@ -9949,7 +9949,7 @@ function addAppVersion(e, t) {
|
|
|
9949
9949
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9950
9950
|
}), e;
|
|
9951
9951
|
}
|
|
9952
|
-
const name = "@nocobase/client", version = "2.0.
|
|
9952
|
+
const name = "@nocobase/client", version = "2.0.12", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9953
9953
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9954
9954
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9955
9955
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9972,10 +9972,10 @@ const name = "@nocobase/client", version = "2.0.11", license = "Apache-2.0", mai
|
|
|
9972
9972
|
"@formily/reactive-react": "^2.2.27",
|
|
9973
9973
|
"@formily/shared": "^2.2.27",
|
|
9974
9974
|
"@formily/validator": "^2.2.27",
|
|
9975
|
-
"@nocobase/evaluators": "2.0.
|
|
9976
|
-
"@nocobase/flow-engine": "2.0.
|
|
9977
|
-
"@nocobase/sdk": "2.0.
|
|
9978
|
-
"@nocobase/utils": "2.0.
|
|
9975
|
+
"@nocobase/evaluators": "2.0.12",
|
|
9976
|
+
"@nocobase/flow-engine": "2.0.12",
|
|
9977
|
+
"@nocobase/sdk": "2.0.12",
|
|
9978
|
+
"@nocobase/utils": "2.0.12",
|
|
9979
9979
|
"@tanstack/react-table": "^8.21.3",
|
|
9980
9980
|
"@types/tabulator-tables": "^6.2.6",
|
|
9981
9981
|
"acorn-jsx": "^5.3.2",
|
|
@@ -12612,22 +12612,22 @@ function FormDialog(e, t, o, n) {
|
|
|
12612
12612
|
), u = (p = !0, m, h) => {
|
|
12613
12613
|
const { form: g } = r;
|
|
12614
12614
|
return g ? /* @__PURE__ */ jsx(GlobalThemeProvider, { theme: n, children: /* @__PURE__ */ jsx(Observer, { children: () => {
|
|
12615
|
-
|
|
12615
|
+
var P;
|
|
12616
|
+
const { token: f } = useToken$1(), y = useMemo(() => document.body, []), b = Number(l == null ? void 0 : l.zIndex), S = f.zIndexPopupBase + 1e3, C = Number.isFinite(b) && b > 0 ? Math.max(S, b) : S;
|
|
12616
12617
|
return /* @__PURE__ */ jsx(
|
|
12617
12618
|
Modal,
|
|
12618
|
-
A(x({
|
|
12619
|
-
zIndex:
|
|
12620
|
-
getContainer: y
|
|
12621
|
-
}, l), {
|
|
12619
|
+
A(x({}, l), {
|
|
12620
|
+
zIndex: C,
|
|
12621
|
+
getContainer: (P = l == null ? void 0 : l.getContainer) != null ? P : y,
|
|
12622
12622
|
open: p,
|
|
12623
12623
|
confirmLoading: g.submitting,
|
|
12624
|
-
onCancel: (
|
|
12625
|
-
var
|
|
12626
|
-
((
|
|
12624
|
+
onCancel: (F) => {
|
|
12625
|
+
var v;
|
|
12626
|
+
((v = l == null ? void 0 : l.onCancel) == null ? void 0 : v.call(l, F)) !== !1 && (h == null || h());
|
|
12627
12627
|
},
|
|
12628
|
-
onOk: (
|
|
12629
|
-
var
|
|
12630
|
-
((
|
|
12628
|
+
onOk: (F) => L(this, null, function* () {
|
|
12629
|
+
var v;
|
|
12630
|
+
((v = l == null ? void 0 : l.onOk) == null ? void 0 : v.call(l, F)) !== !1 && (m == null || m());
|
|
12631
12631
|
}),
|
|
12632
12632
|
children: /* @__PURE__ */ jsx(FormProvider$1, { form: g, children: /* @__PURE__ */ jsx(c, {}) })
|
|
12633
12633
|
})
|
|
@@ -14974,15 +14974,31 @@ const useDateVariable = ({ operator: e, schema: t, noDisabled: o }) => {
|
|
|
14974
14974
|
/** 变量的配置项 */
|
|
14975
14975
|
currentObjectSettings: u
|
|
14976
14976
|
};
|
|
14977
|
+
}, ParentCollectionContext = createContext(null);
|
|
14978
|
+
ParentCollectionContext.displayName = "ParentCollectionContext";
|
|
14979
|
+
const ParentCollectionProvider = (e) => {
|
|
14980
|
+
const t = useCollection();
|
|
14981
|
+
return /* @__PURE__ */ jsx(ParentCollectionContext.Provider, { value: t, children: e.children });
|
|
14982
|
+
}, useParentCollection = () => useContext(ParentCollectionContext), AssociationProvider = (e) => {
|
|
14983
|
+
const { name: t, children: o } = e, r = useCollectionManager().getCollectionName(t);
|
|
14984
|
+
return r ? /* @__PURE__ */ jsx(CollectionProvider, { name: String(t).split(".")[0], children: /* @__PURE__ */ jsx(ParentCollectionProvider, { children: /* @__PURE__ */ jsx(CollectionFieldProvider, { name: t, children: /* @__PURE__ */ jsx(CollectionProvider, { name: r, children: o }) }) }) }) : /* @__PURE__ */ jsx(CollectionDeletedPlaceholder, { type: "Collection", name: t });
|
|
14985
|
+
}, useAssociationName = () => {
|
|
14986
|
+
const e = useCollectionField();
|
|
14987
|
+
return e != null && e.target ? `${e.collectionName}.${e.name}` : null;
|
|
14988
|
+
}, getResolvedParent = (e, t) => {
|
|
14989
|
+
let o = e;
|
|
14990
|
+
for (; o != null && o.parent && o.value === t; )
|
|
14991
|
+
o = o.parent;
|
|
14992
|
+
return o;
|
|
14977
14993
|
}, useParentObjectContext = () => {
|
|
14978
|
-
const { parent: e } = useSubFormValue(),
|
|
14994
|
+
const { parent: e, formValue: t } = useSubFormValue(), o = useCollectionParentRecordData(), n = useParentCollection(), r = getResolvedParent(e, t), i = r == null ? void 0 : r.value, a = _.isEmpty(i) && !_.isEmpty(o) ? o : i, l = (r == null ? void 0 : r.collection) || n, { isInSubForm: c, isInSubTable: u } = useFlag() || {};
|
|
14979
14995
|
return {
|
|
14980
14996
|
/** 是否显示变量 */
|
|
14981
|
-
shouldDisplayParentObject: (
|
|
14997
|
+
shouldDisplayParentObject: (c || u) && !!l,
|
|
14982
14998
|
/** 变量的值 */
|
|
14983
|
-
parentObjectCtx:
|
|
14984
|
-
collectionName:
|
|
14985
|
-
dataSource:
|
|
14999
|
+
parentObjectCtx: a,
|
|
15000
|
+
collectionName: l == null ? void 0 : l.name,
|
|
15001
|
+
dataSource: l == null ? void 0 : l.dataSource
|
|
14986
15002
|
};
|
|
14987
15003
|
}, useParentObjectVariable = ({
|
|
14988
15004
|
collectionField: e,
|
|
@@ -15045,17 +15061,6 @@ const useDateVariable = ({ operator: e, schema: t, noDisabled: o }) => {
|
|
|
15045
15061
|
dataSource: r,
|
|
15046
15062
|
defaultValue: i
|
|
15047
15063
|
};
|
|
15048
|
-
}, ParentCollectionContext = createContext(null);
|
|
15049
|
-
ParentCollectionContext.displayName = "ParentCollectionContext";
|
|
15050
|
-
const ParentCollectionProvider = (e) => {
|
|
15051
|
-
const t = useCollection();
|
|
15052
|
-
return /* @__PURE__ */ jsx(ParentCollectionContext.Provider, { value: t, children: e.children });
|
|
15053
|
-
}, useParentCollection = () => useContext(ParentCollectionContext), AssociationProvider = (e) => {
|
|
15054
|
-
const { name: t, children: o } = e, r = useCollectionManager().getCollectionName(t);
|
|
15055
|
-
return r ? /* @__PURE__ */ jsx(CollectionProvider, { name: String(t).split(".")[0], children: /* @__PURE__ */ jsx(ParentCollectionProvider, { children: /* @__PURE__ */ jsx(CollectionFieldProvider, { name: t, children: /* @__PURE__ */ jsx(CollectionProvider, { name: r, children: o }) }) }) }) : /* @__PURE__ */ jsx(CollectionDeletedPlaceholder, { type: "Collection", name: t });
|
|
15056
|
-
}, useAssociationName = () => {
|
|
15057
|
-
const e = useCollectionField();
|
|
15058
|
-
return e != null && e.target ? `${e.collectionName}.${e.name}` : null;
|
|
15059
15064
|
}, useCurrentParentRecordContext = () => {
|
|
15060
15065
|
var c, u;
|
|
15061
15066
|
const e = useCollectionRecord(), { name: t, dataSource: o } = useParentCollection() || {}, n = useCollection(), { isInSubForm: r, isInSubTable: i } = useFlag() || {}, a = t ? o : n == null ? void 0 : n.dataSource, l = useCollectionField();
|
|
@@ -23234,7 +23239,7 @@ const SchemaSettingsSwitchItem = (e) => {
|
|
|
23234
23239
|
"modalTip",
|
|
23235
23240
|
"components",
|
|
23236
23241
|
"scope"
|
|
23237
|
-
]), [m, h] = useState(!1), [g, f] = useState(e.uid), { t: y } = useTranslation(), b = useFieldSchema(), S = useContext(SchemaSettingsContext), { dn: C } = useSchemaSettings(), P = useCompile(), F = useAPIClient(), v = useFormActiveFields(), k = useZIndexContext(), I = getZIndex("modal", k + 10, 0), D = useMemo(
|
|
23242
|
+
]), [m, h] = useState(!1), [g, f] = useState(e.uid), { t: y } = useTranslation(), b = useFieldSchema(), S = useContext(SchemaSettingsContext), { dn: C } = useSchemaSettings(), P = useCompile(), F = useAPIClient(), v = useFormActiveFields(), k = useZIndexContext(), I = Math.max(getZIndex("modal", k + 10, 0), ICON_POPUP_Z_INDEX + 200), D = useMemo(
|
|
23238
23243
|
() => createForm({
|
|
23239
23244
|
initialValues: cloneDeep$1(r),
|
|
23240
23245
|
values: cloneDeep$1(r)
|
|
@@ -23332,7 +23337,12 @@ const SchemaSettingsModalItem = (e) => {
|
|
|
23332
23337
|
onClick: () => L(void 0, null, function* () {
|
|
23333
23338
|
const H = l ? yield l() : c, X = _.isFunction(e.schema) ? e.schema() : e.schema;
|
|
23334
23339
|
FormDialog(
|
|
23335
|
-
{
|
|
23340
|
+
{
|
|
23341
|
+
title: X.title || o,
|
|
23342
|
+
width: u,
|
|
23343
|
+
rootClassName: m,
|
|
23344
|
+
getContainer: () => document.body
|
|
23345
|
+
},
|
|
23336
23346
|
() => /* @__PURE__ */ jsx(VariableScopeContext$1.Provider, { value: O, children: /* @__PURE__ */ jsx(SchemaComponentContext.Provider, { value: j, children: /* @__PURE__ */ jsx(AllDataBlocksContext.Provider, { value: N, children: /* @__PURE__ */ jsx(p, { children: /* @__PURE__ */ jsx(CollectOperators, { defaultOperators: T(), children: /* @__PURE__ */ jsx(VariablesContext.Provider, { value: B, children: /* @__PURE__ */ jsx(BlockContext.Provider, { value: M, children: /* @__PURE__ */ jsx(
|
|
23337
23347
|
VariablePopupRecordProvider,
|
|
23338
23348
|
{
|
|
@@ -30524,7 +30534,7 @@ const useStyles$a = genStyleHook("nb-markdown", (e, { isDarkTheme: t }) => {
|
|
|
30524
30534
|
}, t ? i : r)
|
|
30525
30535
|
};
|
|
30526
30536
|
}), parseMarkdown$1 = _.memoize((e) => L(void 0, null, function* () {
|
|
30527
|
-
return e && (yield import("./md-
|
|
30537
|
+
return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
|
|
30528
30538
|
}));
|
|
30529
30539
|
function useParseMarkdown$1(e) {
|
|
30530
30540
|
const [t, o] = useState(""), [n, r] = useState(!0);
|
|
@@ -70601,6 +70611,39 @@ ActionModel.registerEvents({
|
|
|
70601
70611
|
handler: commonConditionHandler
|
|
70602
70612
|
}
|
|
70603
70613
|
});
|
|
70614
|
+
const VIEW_ACTION_ALIASES = {
|
|
70615
|
+
view: "get"
|
|
70616
|
+
}, normalizeCapabilityActionName = (e) => e ? VIEW_ACTION_ALIASES[e] || e : null, getExplicitCapabilityNames = (e, t) => {
|
|
70617
|
+
for (const o of t) {
|
|
70618
|
+
if (!(o in e))
|
|
70619
|
+
continue;
|
|
70620
|
+
const n = e[o];
|
|
70621
|
+
return n == null ? null : (Array.isArray(n) ? n : [n]).map((r) => normalizeCapabilityActionName(r)).filter(Boolean);
|
|
70622
|
+
}
|
|
70623
|
+
}, isCapabilitySupported = (e, t) => {
|
|
70624
|
+
const o = normalizeCapabilityActionName(t);
|
|
70625
|
+
if (!o || !(e != null && e.options))
|
|
70626
|
+
return !0;
|
|
70627
|
+
const { availableActions: n, unavailableActions: r } = e.options;
|
|
70628
|
+
return Array.isArray(n) ? n.includes(o) : Array.isArray(r) ? !r.includes(o) : !0;
|
|
70629
|
+
}, areCapabilitiesSupported = (e, t) => t != null && t.length ? t.every((o) => isCapabilitySupported(e, o)) : !0, getActionCapabilityNamesFromModelClass = (e) => {
|
|
70630
|
+
var n;
|
|
70631
|
+
const t = getExplicitCapabilityNames(e, ["capabilityActionNames", "capabilityActionName"]);
|
|
70632
|
+
if (t !== void 0)
|
|
70633
|
+
return t;
|
|
70634
|
+
const o = (n = e == null ? void 0 : e.prototype) == null ? void 0 : n.getAclActionName;
|
|
70635
|
+
if (typeof o != "function")
|
|
70636
|
+
return null;
|
|
70637
|
+
try {
|
|
70638
|
+
const r = o.call({}), i = normalizeCapabilityActionName(r);
|
|
70639
|
+
return i ? [i] : null;
|
|
70640
|
+
} catch (r) {
|
|
70641
|
+
return null;
|
|
70642
|
+
}
|
|
70643
|
+
}, getBlockCapabilityNamesFromModelClass = (e) => {
|
|
70644
|
+
const t = getExplicitCapabilityNames(e, ["blockCapabilityActionNames", "blockCapabilityActionName"]);
|
|
70645
|
+
return t != null ? t : null;
|
|
70646
|
+
};
|
|
70604
70647
|
class ActionGroupModel extends FlowModel {
|
|
70605
70648
|
static getAllParentClasses() {
|
|
70606
70649
|
const t = [];
|
|
@@ -70625,11 +70668,26 @@ class ActionGroupModel extends FlowModel {
|
|
|
70625
70668
|
for (const [o, n] of Object.entries(t))
|
|
70626
70669
|
Object.defineProperty(n, "name", { value: o }), this.currentModels.set(o, n);
|
|
70627
70670
|
}
|
|
70671
|
+
/**
|
|
70672
|
+
* 判断动作模型在当前数据表上下文下是否应显示在 v2 的“添加动作”菜单中。
|
|
70673
|
+
*
|
|
70674
|
+
* @param ModelClass 动作模型类
|
|
70675
|
+
* @param ctx Flow 上下文
|
|
70676
|
+
* @returns 是否显示
|
|
70677
|
+
*/
|
|
70678
|
+
static isActionModelVisible(t, o) {
|
|
70679
|
+
var i;
|
|
70680
|
+
const n = o.collection || ((i = o.blockModel) == null ? void 0 : i.collection), r = getActionCapabilityNamesFromModelClass(t);
|
|
70681
|
+
return areCapabilitiesSupported(n, r);
|
|
70682
|
+
}
|
|
70628
70683
|
static defineChildren(t) {
|
|
70629
70684
|
return L(this, null, function* () {
|
|
70630
|
-
const o = this.baseClass ? yield buildSubModelItems(this.baseClass)(t) : [], n = [], r = o.filter((i) =>
|
|
70685
|
+
const o = this.baseClass ? yield buildSubModelItems(this.baseClass)(t) : [], n = [], r = o.filter((i) => {
|
|
70686
|
+
const a = t.engine.getModelClass(i.useModel);
|
|
70687
|
+
return this.isActionModelVisible(a, t) ? this.scene ? a._isScene(this.scene) : !0 : !1;
|
|
70688
|
+
});
|
|
70631
70689
|
for (const [i, a] of this.models) {
|
|
70632
|
-
if (r.find((u) => u.useModel === a.name))
|
|
70690
|
+
if (!this.isActionModelVisible(a, t) || r.find((u) => u.useModel === a.name))
|
|
70633
70691
|
continue;
|
|
70634
70692
|
const c = yield buildSubModelItem(a, t);
|
|
70635
70693
|
c && n.push(c);
|
|
@@ -71774,7 +71832,7 @@ BlockGridModel.registerFlow({
|
|
|
71774
71832
|
}
|
|
71775
71833
|
});
|
|
71776
71834
|
const parseMarkdown = _.memoize((e) => L(void 0, null, function* () {
|
|
71777
|
-
return e && (yield import("./md-
|
|
71835
|
+
return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
|
|
71778
71836
|
}));
|
|
71779
71837
|
function useParseMarkdown(e) {
|
|
71780
71838
|
const [t, o] = useState(""), [n, r] = useState(!0);
|
|
@@ -72484,6 +72542,18 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72484
72542
|
static filterCollection(o) {
|
|
72485
72543
|
return !!o.filterTargetKey;
|
|
72486
72544
|
}
|
|
72545
|
+
/**
|
|
72546
|
+
* 判断当前区块模型在 collection 选择菜单中是否应该展示指定数据表。
|
|
72547
|
+
*
|
|
72548
|
+
* @param collection 数据表
|
|
72549
|
+
* @returns 是否显示
|
|
72550
|
+
*/
|
|
72551
|
+
static isCollectionAvailable(o) {
|
|
72552
|
+
if (!o)
|
|
72553
|
+
return !1;
|
|
72554
|
+
const n = getBlockCapabilityNamesFromModelClass(this);
|
|
72555
|
+
return areCapabilitiesSupported(o, n);
|
|
72556
|
+
}
|
|
72487
72557
|
/**
|
|
72488
72558
|
* 定义子菜单选项
|
|
72489
72559
|
*/
|
|
@@ -72504,7 +72574,7 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72504
72574
|
searchable: !0,
|
|
72505
72575
|
searchPlaceholder: tExpr("Search"),
|
|
72506
72576
|
children: (h) => m.getCollections().map((g) => {
|
|
72507
|
-
if (!this.filterCollection(g))
|
|
72577
|
+
if (!this.filterCollection(g) || !this.isCollectionAvailable(g))
|
|
72508
72578
|
return null;
|
|
72509
72579
|
const f = {
|
|
72510
72580
|
dataSourceKey: g.dataSourceKey,
|
|
@@ -72532,25 +72602,24 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72532
72602
|
collectionName: a
|
|
72533
72603
|
// filterByTk: '{{ctx.view.inputArgs.filterByTk}}',
|
|
72534
72604
|
};
|
|
72535
|
-
|
|
72536
|
-
|
|
72537
|
-
|
|
72538
|
-
|
|
72539
|
-
|
|
72540
|
-
|
|
72541
|
-
|
|
72542
|
-
|
|
72543
|
-
|
|
72544
|
-
|
|
72605
|
+
l && (m.associationName = l, m.sourceId = "{{ctx.view.inputArgs.sourceId}}");
|
|
72606
|
+
const h = o.dataSourceManager.getCollection(i, a), g = [];
|
|
72607
|
+
return this.isCollectionAvailable(h) && g.push({
|
|
72608
|
+
key: r("current-collection"),
|
|
72609
|
+
label: "Current collection",
|
|
72610
|
+
useModel: this.name,
|
|
72611
|
+
createModelOptions: n({
|
|
72612
|
+
stepParams: {
|
|
72613
|
+
resourceSettings: {
|
|
72614
|
+
init: m
|
|
72545
72615
|
}
|
|
72546
|
-
}
|
|
72547
|
-
}
|
|
72548
|
-
|
|
72549
|
-
|
|
72550
|
-
|
|
72551
|
-
|
|
72552
|
-
|
|
72553
|
-
];
|
|
72616
|
+
}
|
|
72617
|
+
})
|
|
72618
|
+
}), g.push({
|
|
72619
|
+
key: r("others-collections"),
|
|
72620
|
+
label: "Other collections",
|
|
72621
|
+
children: d(o)
|
|
72622
|
+
}), g;
|
|
72554
72623
|
}
|
|
72555
72624
|
if (this._isScene("new")) {
|
|
72556
72625
|
const m = {
|
|
@@ -72559,42 +72628,40 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72559
72628
|
// filterByTk: '{{ctx.view.inputArgs.filterByTk}}',
|
|
72560
72629
|
};
|
|
72561
72630
|
l && (m.associationName = l, m.sourceId = "{{ctx.view.inputArgs.sourceId}}");
|
|
72562
|
-
const h = [
|
|
72563
|
-
|
|
72564
|
-
|
|
72565
|
-
|
|
72566
|
-
|
|
72567
|
-
|
|
72568
|
-
|
|
72569
|
-
|
|
72570
|
-
|
|
72571
|
-
}
|
|
72631
|
+
const h = [], g = o.dataSourceManager.getCollection(i, a);
|
|
72632
|
+
return this.isCollectionAvailable(g) && h.push({
|
|
72633
|
+
key: r("current-collection"),
|
|
72634
|
+
label: "Current collection",
|
|
72635
|
+
useModel: this.name,
|
|
72636
|
+
createModelOptions: n({
|
|
72637
|
+
stepParams: {
|
|
72638
|
+
resourceSettings: {
|
|
72639
|
+
init: m
|
|
72572
72640
|
}
|
|
72573
|
-
}
|
|
72574
|
-
}
|
|
72575
|
-
|
|
72576
|
-
return typeof c != "undefined" && c !== null && h.push({
|
|
72641
|
+
}
|
|
72642
|
+
})
|
|
72643
|
+
}), typeof c != "undefined" && c !== null && h.push({
|
|
72577
72644
|
key: r("associated"),
|
|
72578
72645
|
label: "Associated records",
|
|
72579
|
-
children: () => o.dataSourceManager.getCollection(i, a).getAssociationFields(this._getScene()).map((
|
|
72580
|
-
if (!
|
|
72646
|
+
children: () => o.dataSourceManager.getCollection(i, a).getAssociationFields(this._getScene()).map((y) => {
|
|
72647
|
+
if (!y.targetCollection || y.type === "belongsToArray" || !this.filterCollection(y.targetCollection) || !this.isCollectionAvailable(y.targetCollection))
|
|
72581
72648
|
return null;
|
|
72582
|
-
let
|
|
72583
|
-
|
|
72584
|
-
const
|
|
72649
|
+
let b = `{{ctx.popup.record.${y.sourceKey || y.collection.filterTargetKey}}}`;
|
|
72650
|
+
y.sourceKey === y.collection.filterTargetKey && (b = "{{ctx.view.inputArgs.filterByTk}}");
|
|
72651
|
+
const S = {
|
|
72585
72652
|
dataSourceKey: i,
|
|
72586
|
-
collectionName:
|
|
72587
|
-
associationName:
|
|
72588
|
-
sourceId:
|
|
72653
|
+
collectionName: y.target,
|
|
72654
|
+
associationName: y.resourceName,
|
|
72655
|
+
sourceId: b
|
|
72589
72656
|
};
|
|
72590
72657
|
return {
|
|
72591
|
-
key: r(`associated-${
|
|
72592
|
-
label:
|
|
72658
|
+
key: r(`associated-${y.name}`),
|
|
72659
|
+
label: y.title,
|
|
72593
72660
|
useModel: this.name,
|
|
72594
72661
|
createModelOptions: n({
|
|
72595
72662
|
stepParams: {
|
|
72596
72663
|
resourceSettings: {
|
|
72597
|
-
init:
|
|
72664
|
+
init: S
|
|
72598
72665
|
}
|
|
72599
72666
|
}
|
|
72600
72667
|
})
|
|
@@ -72611,7 +72678,7 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72611
72678
|
key: r("associated"),
|
|
72612
72679
|
label: "Associated records",
|
|
72613
72680
|
children: () => o.dataSourceManager.getCollection(i, a).getAssociationFields(this._getScene()).map((h) => {
|
|
72614
|
-
if (!h.targetCollection || h.type === "belongsToArray" || !this.filterCollection(h.targetCollection))
|
|
72681
|
+
if (!h.targetCollection || h.type === "belongsToArray" || !this.filterCollection(h.targetCollection) || !this.isCollectionAvailable(h.targetCollection))
|
|
72615
72682
|
return null;
|
|
72616
72683
|
let g = `{{ctx.popup.record.${h.sourceKey || h.collection.filterTargetKey}}}`;
|
|
72617
72684
|
h.sourceKey === h.collection.filterTargetKey && (g = "{{ctx.view.inputArgs.filterByTk}}");
|
|
@@ -72643,7 +72710,7 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
72643
72710
|
];
|
|
72644
72711
|
if (this._isScene("one")) {
|
|
72645
72712
|
const m = o.dataSourceManager.getCollection(i, a);
|
|
72646
|
-
if (!m || !this.filterCollection(m))
|
|
72713
|
+
if (!m || !this.filterCollection(m) || !this.isCollectionAvailable(m))
|
|
72647
72714
|
return p;
|
|
72648
72715
|
const h = {
|
|
72649
72716
|
dataSourceKey: i,
|
|
@@ -72861,11 +72928,7 @@ class FieldModel extends FlowModel {
|
|
|
72861
72928
|
class FilterBlockModel extends BlockModel {
|
|
72862
72929
|
}
|
|
72863
72930
|
FilterBlockModel.define({ hide: !0, label: "Filter blocks" });
|
|
72864
|
-
const
|
|
72865
|
-
> .ant-tabs-nav .ant-tabs-nav-list {
|
|
72866
|
-
padding-inline-start: var(--nb-flow-page-tabs-nav-padding-inline-start, 16px);
|
|
72867
|
-
}
|
|
72868
|
-
`, TABS_DESIGN_MODE_ROOT_CLASS_NAME = css`
|
|
72931
|
+
const TABS_DESIGN_MODE_ROOT_CLASS_NAME = css`
|
|
72869
72932
|
> .ant-tabs-nav .ant-tabs-tab {
|
|
72870
72933
|
min-width: 54px;
|
|
72871
72934
|
}
|
|
@@ -73032,14 +73095,25 @@ class PageModel extends FlowModel {
|
|
|
73032
73095
|
}
|
|
73033
73096
|
renderTabs() {
|
|
73034
73097
|
var a, l, c, u, d;
|
|
73035
|
-
const o = (l = (a = this.context.themeToken) == null ? void 0 : a.paddingLG) != null ? l : 16, n =
|
|
73036
|
-
|
|
73037
|
-
|
|
73098
|
+
const o = (l = (a = this.context.themeToken) == null ? void 0 : a.paddingLG) != null ? l : 16, n = this.context.flowSettingsEnabled ? TABS_DESIGN_MODE_ROOT_CLASS_NAME : void 0, r = this.tabBarExtraContent.left !== void 0 ? this.tabBarExtraContent.left : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { display: "inline-block", width: o, height: 1 } }), i = this.tabBarExtraContent.right !== void 0 ? this.tabBarExtraContent.right : /* @__PURE__ */ jsx(
|
|
73099
|
+
AddSubModelButton,
|
|
73100
|
+
{
|
|
73101
|
+
model: this,
|
|
73102
|
+
subModelKey: "tabs",
|
|
73103
|
+
items: [
|
|
73104
|
+
{
|
|
73105
|
+
key: "blank",
|
|
73106
|
+
label: this.context.t("Blank tab"),
|
|
73107
|
+
createModelOptions: this.createPageTabModelOptions
|
|
73108
|
+
}
|
|
73109
|
+
],
|
|
73110
|
+
children: /* @__PURE__ */ jsx(FlowSettingsButton, { icon: /* @__PURE__ */ jsx(PlusOutlined, {}), children: this.context.t("Add tab") })
|
|
73111
|
+
}
|
|
73112
|
+
);
|
|
73038
73113
|
return /* @__PURE__ */ jsx(DndProvider, { onDragEnd: this.handleDragEnd.bind(this), children: /* @__PURE__ */ jsx(
|
|
73039
73114
|
Tabs$1,
|
|
73040
73115
|
{
|
|
73041
|
-
|
|
73042
|
-
rootClassName: r,
|
|
73116
|
+
className: n,
|
|
73043
73117
|
activeKey: (u = (c = this.context.view) == null ? void 0 : c.navigation) != null && u.viewParams ? this.context.view.navigation.viewParams.tabUid || ((d = this.getFirstTab()) == null ? void 0 : d.uid) : this.props.tabActiveKey,
|
|
73044
73118
|
tabBarStyle: this.props.tabBarStyle,
|
|
73045
73119
|
items: this.mapTabs(),
|
|
@@ -73049,23 +73123,10 @@ class PageModel extends FlowModel {
|
|
|
73049
73123
|
tabUid: p
|
|
73050
73124
|
}), this.invokeTabModelLifecycleMethod(p, "onActive"), this.invokeTabModelLifecycleMethod(this.props.tabActiveKey, "onInactive"), this.setProps("tabActiveKey", p);
|
|
73051
73125
|
},
|
|
73052
|
-
tabBarExtraContent:
|
|
73053
|
-
|
|
73054
|
-
|
|
73055
|
-
|
|
73056
|
-
model: this,
|
|
73057
|
-
subModelKey: "tabs",
|
|
73058
|
-
items: [
|
|
73059
|
-
{
|
|
73060
|
-
key: "blank",
|
|
73061
|
-
label: this.context.t("Blank tab"),
|
|
73062
|
-
createModelOptions: this.createPageTabModelOptions
|
|
73063
|
-
}
|
|
73064
|
-
],
|
|
73065
|
-
children: /* @__PURE__ */ jsx(FlowSettingsButton, { icon: /* @__PURE__ */ jsx(PlusOutlined, {}), children: this.context.t("Add tab") })
|
|
73066
|
-
}
|
|
73067
|
-
)
|
|
73068
|
-
}, this.tabBarExtraContent)
|
|
73126
|
+
tabBarExtraContent: {
|
|
73127
|
+
left: r,
|
|
73128
|
+
right: i
|
|
73129
|
+
}
|
|
73069
73130
|
}
|
|
73070
73131
|
) });
|
|
73071
73132
|
}
|
|
@@ -73181,20 +73242,22 @@ class ChildPageModel extends PageModel {
|
|
|
73181
73242
|
}
|
|
73182
73243
|
}
|
|
73183
73244
|
const BackButtonUsedInSubPage = () => {
|
|
73184
|
-
|
|
73245
|
+
var i;
|
|
73246
|
+
const e = useFlowContext(), t = e.themeToken, o = 32, n = (i = t == null ? void 0 : t.paddingLG) != null ? i : 16, r = useMemo(() => ({
|
|
73185
73247
|
width: "auto",
|
|
73186
73248
|
height: "auto",
|
|
73187
73249
|
lineHeight: 1,
|
|
73188
73250
|
padding: t.paddingXS,
|
|
73251
|
+
marginLeft: t.paddingLG,
|
|
73189
73252
|
marginRight: o - t.paddingXS
|
|
73190
|
-
}), [t.paddingXS]);
|
|
73191
|
-
return e.view.type !== "embed" ?
|
|
73253
|
+
}), [t.paddingLG, t.paddingXS]);
|
|
73254
|
+
return e.view.type !== "embed" ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { display: "inline-block", width: n, height: 1 } }) : /* @__PURE__ */ jsx(
|
|
73192
73255
|
Button,
|
|
73193
73256
|
{
|
|
73194
73257
|
"aria-label": "back-button",
|
|
73195
73258
|
type: "text",
|
|
73196
73259
|
icon: /* @__PURE__ */ jsx(ArrowLeftOutlined, {}),
|
|
73197
|
-
style:
|
|
73260
|
+
style: r,
|
|
73198
73261
|
onClick: e.view.close
|
|
73199
73262
|
}
|
|
73200
73263
|
);
|
|
@@ -73639,6 +73702,12 @@ function PageTabChildrenRenderer({ ctx: e, options: t }) {
|
|
|
73639
73702
|
), r = e != null && e.isMobileLayout ? 8 : e == null ? void 0 : e.themeToken.marginBlock;
|
|
73640
73703
|
return n || !(o != null && o.uid) ? /* @__PURE__ */ jsx(SkeletonFallback, { style: { margin: r } }) : /* @__PURE__ */ jsx(FlowModelRenderer, { model: o, fallback: /* @__PURE__ */ jsx(SkeletonFallback, { style: { margin: r } }) });
|
|
73641
73704
|
}
|
|
73705
|
+
function normalizePersistedRoute(e) {
|
|
73706
|
+
if (Array.isArray(e))
|
|
73707
|
+
return e.find((t) => !!t && typeof t == "object");
|
|
73708
|
+
if (e && typeof e == "object")
|
|
73709
|
+
return e;
|
|
73710
|
+
}
|
|
73642
73711
|
class BasePageTabModel extends FlowModel {
|
|
73643
73712
|
onInit(t) {
|
|
73644
73713
|
super.onInit(t), this.context.defineProperty("tabActive", {
|
|
@@ -73743,9 +73812,8 @@ class RootPageTabModel extends BasePageTabModel {
|
|
|
73743
73812
|
}
|
|
73744
73813
|
save() {
|
|
73745
73814
|
return L(this, null, function* () {
|
|
73746
|
-
var
|
|
73747
|
-
const t = this.serialize(), o = (
|
|
73748
|
-
yield this.context.api.request({
|
|
73815
|
+
var i, a, l, c, u;
|
|
73816
|
+
const t = this.serialize(), o = (l = (a = (i = this.stepParams) == null ? void 0 : i.pageTabSettings) == null ? void 0 : a.tab) == null ? void 0 : l.documentTitle, n = yield this.context.api.request({
|
|
73749
73817
|
method: "post",
|
|
73750
73818
|
url: "desktopRoutes:updateOrCreate",
|
|
73751
73819
|
params: {
|
|
@@ -73759,7 +73827,10 @@ class RootPageTabModel extends BasePageTabModel {
|
|
|
73759
73827
|
documentTitle: o
|
|
73760
73828
|
}
|
|
73761
73829
|
})
|
|
73762
|
-
});
|
|
73830
|
+
}), r = normalizePersistedRoute((c = n == null ? void 0 : n.data) == null ? void 0 : c.data);
|
|
73831
|
+
r && this.setProps("route", A(x(x({}, this.props.route), r), {
|
|
73832
|
+
options: x(x({}, (u = this.props.route) == null ? void 0 : u.options), r.options)
|
|
73833
|
+
}));
|
|
73763
73834
|
});
|
|
73764
73835
|
}
|
|
73765
73836
|
destroy() {
|
|
@@ -73804,6 +73875,20 @@ class RootPageModel extends PageModel {
|
|
|
73804
73875
|
super(...arguments);
|
|
73805
73876
|
R(this, "mounted", !1);
|
|
73806
73877
|
}
|
|
73878
|
+
/**
|
|
73879
|
+
* 新建 tab 在首次保存完成前,前端 route 里可能还没有数据库 id。
|
|
73880
|
+
* 拖拽前兜底触发一次保存,确保 move 接口拿到真实主键。
|
|
73881
|
+
*
|
|
73882
|
+
* @param model - 当前参与拖拽的 tab model
|
|
73883
|
+
* @returns 可用于排序接口的 route id
|
|
73884
|
+
*/
|
|
73885
|
+
ensurePersistedRouteId(o) {
|
|
73886
|
+
return L(this, null, function* () {
|
|
73887
|
+
var r, i, a, l;
|
|
73888
|
+
const n = (i = (r = o == null ? void 0 : o.props) == null ? void 0 : r.route) == null ? void 0 : i.id;
|
|
73889
|
+
return n != null ? n : (typeof (o == null ? void 0 : o.save) == "function" && (yield o.save()), (l = (a = o == null ? void 0 : o.props) == null ? void 0 : a.route) == null ? void 0 : l.id);
|
|
73890
|
+
});
|
|
73891
|
+
}
|
|
73807
73892
|
onMount() {
|
|
73808
73893
|
super.onMount(), reaction$1(
|
|
73809
73894
|
() => this.context.pageActive.value,
|
|
@@ -73837,14 +73922,20 @@ class RootPageModel extends PageModel {
|
|
|
73837
73922
|
}
|
|
73838
73923
|
handleDragEnd(o) {
|
|
73839
73924
|
return L(this, null, function* () {
|
|
73840
|
-
var
|
|
73841
|
-
const n = this.flowEngine.getModel((
|
|
73842
|
-
!n || !r ||
|
|
73925
|
+
var l, c;
|
|
73926
|
+
const n = this.flowEngine.getModel((l = o.active) == null ? void 0 : l.id), r = this.flowEngine.getModel((c = o.over) == null ? void 0 : c.id);
|
|
73927
|
+
if (!n || !r || n.uid === r.uid)
|
|
73928
|
+
return;
|
|
73929
|
+
const [i, a] = yield Promise.all([
|
|
73930
|
+
this.ensurePersistedRouteId(n),
|
|
73931
|
+
this.ensurePersistedRouteId(r)
|
|
73932
|
+
]);
|
|
73933
|
+
i == null || a == null || (yield this.context.api.request({
|
|
73843
73934
|
url: "desktopRoutes:move",
|
|
73844
73935
|
method: "post",
|
|
73845
73936
|
params: {
|
|
73846
|
-
sourceId:
|
|
73847
|
-
targetId:
|
|
73937
|
+
sourceId: i,
|
|
73938
|
+
targetId: a,
|
|
73848
73939
|
sortField: "sort"
|
|
73849
73940
|
}
|
|
73850
73941
|
}), this.flowEngine.moveModel(n.uid, r.uid, { persist: !1 }));
|
|
@@ -75086,7 +75177,7 @@ class BulkDeleteActionModel extends ActionModel {
|
|
|
75086
75177
|
return "destroy";
|
|
75087
75178
|
}
|
|
75088
75179
|
}
|
|
75089
|
-
R(BulkDeleteActionModel, "scene", ActionSceneEnum.collection);
|
|
75180
|
+
R(BulkDeleteActionModel, "scene", ActionSceneEnum.collection), R(BulkDeleteActionModel, "capabilityActionName", "destroyMany");
|
|
75090
75181
|
BulkDeleteActionModel.define({
|
|
75091
75182
|
label: tExpr("Delete")
|
|
75092
75183
|
});
|
|
@@ -76164,6 +76255,7 @@ class AddChildActionModel extends PopupActionModel {
|
|
|
76164
76255
|
});
|
|
76165
76256
|
}
|
|
76166
76257
|
}
|
|
76258
|
+
R(AddChildActionModel, "capabilityActionName", null);
|
|
76167
76259
|
AddChildActionModel.registerFlow({
|
|
76168
76260
|
key: "addChildSettingsInit",
|
|
76169
76261
|
steps: {
|
|
@@ -79441,7 +79533,7 @@ class EditFormModel extends FormBlockModel {
|
|
|
79441
79533
|
);
|
|
79442
79534
|
}
|
|
79443
79535
|
}
|
|
79444
|
-
R(EditFormModel, "scene", BlockSceneEnum.oam);
|
|
79536
|
+
R(EditFormModel, "scene", BlockSceneEnum.oam), R(EditFormModel, "blockCapabilityActionName", "update");
|
|
79445
79537
|
EditFormModel.registerFlow({
|
|
79446
79538
|
key: "formSettings",
|
|
79447
79539
|
title: tExpr("Edit form settings"),
|
|
@@ -81797,7 +81889,7 @@ class CreateFormModel extends FormBlockModel {
|
|
|
81797
81889
|
);
|
|
81798
81890
|
}
|
|
81799
81891
|
}
|
|
81800
|
-
R(CreateFormModel, "scene", BlockSceneEnum.new);
|
|
81892
|
+
R(CreateFormModel, "scene", BlockSceneEnum.new), R(CreateFormModel, "blockCapabilityActionName", "create");
|
|
81801
81893
|
CreateFormModel.registerFlow({
|
|
81802
81894
|
key: "formSettings",
|
|
81803
81895
|
title: tExpr("Form settings"),
|
|
@@ -13,8 +13,8 @@ export declare const useParentObjectContext: () => {
|
|
|
13
13
|
shouldDisplayParentObject: boolean;
|
|
14
14
|
/** 变量的值 */
|
|
15
15
|
parentObjectCtx: any;
|
|
16
|
-
collectionName:
|
|
17
|
-
dataSource:
|
|
16
|
+
collectionName: any;
|
|
17
|
+
dataSource: any;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* 变量:`上级对象`
|
|
@@ -34,5 +34,5 @@ export declare const useParentObjectVariable: ({ collectionField, schema, noDisa
|
|
|
34
34
|
shouldDisplayParentObject: boolean;
|
|
35
35
|
/** 变量的值 */
|
|
36
36
|
parentObjectCtx: any;
|
|
37
|
-
collectionName:
|
|
37
|
+
collectionName: any;
|
|
38
38
|
};
|