@nocobase/client 2.0.0-alpha.5 → 2.0.0-alpha.6
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
CHANGED
|
@@ -92,7 +92,7 @@ import { TinyColor } from "@ctrl/tinycolor";
|
|
|
92
92
|
import * as i18next from "i18next";
|
|
93
93
|
import i18next__default from "i18next";
|
|
94
94
|
import * as antIcons from "@ant-design/icons";
|
|
95
|
-
import antIcons__default, { LoadingOutlined, createFromIconfontCN, RightOutlined, QuestionCircleOutlined, MenuOutlined, CloseOutlined, CloseCircleOutlined, PlusOutlined, DragOutlined, CopyOutlined, LeftOutlined, FileImageOutlined, ScanOutlined, CloseCircleFilled, ExclamationCircleFilled, UserOutlined, HighlightOutlined, EllipsisOutlined, ArrowLeftOutlined, DownOutlined, DownloadOutlined, UndoOutlined, RedoOutlined, InboxOutlined, DeleteOutlined, CheckOutlined, EditOutlined, ZoomInOutlined, EyeInvisibleOutlined, EyeOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined, VerticalAlignMiddleOutlined, RightSquareOutlined, SyncOutlined, ApiOutlined, SettingOutlined, ReadOutlined, ReloadOutlined, ArrowUpOutlined, ArrowDownOutlined, LockOutlined, UploadOutlined, SwapOutlined, RotateLeftOutlined, RotateRightOutlined, ZoomOutOutlined, ThunderboltOutlined, SearchOutlined, TableOutlined, FormOutlined, ProfileOutlined, AppstoreOutlined, OrderedListOutlined, LineOutlined, DisconnectOutlined, TranslationOutlined } from "@ant-design/icons";
|
|
95
|
+
import antIcons__default, { LoadingOutlined, createFromIconfontCN, RightOutlined, QuestionCircleOutlined, MenuOutlined, CloseOutlined, CloseCircleOutlined, PlusOutlined, DragOutlined, CopyOutlined, LeftOutlined, FileImageOutlined, ScanOutlined, CloseCircleFilled, ExclamationCircleFilled, UserOutlined, HighlightOutlined, EllipsisOutlined, ArrowLeftOutlined, DownOutlined, DownloadOutlined, UndoOutlined, RedoOutlined, InboxOutlined, DeleteOutlined, CheckOutlined, EditOutlined, ZoomInOutlined, EyeInvisibleOutlined, EyeOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined, VerticalAlignMiddleOutlined, RightSquareOutlined, SyncOutlined, ApiOutlined, SettingOutlined, ReadOutlined, ReloadOutlined, ArrowUpOutlined, ArrowDownOutlined, LockOutlined, ExclamationCircleOutlined, UploadOutlined, SwapOutlined, RotateLeftOutlined, RotateRightOutlined, ZoomOutOutlined, ThunderboltOutlined, SearchOutlined, TableOutlined, FormOutlined, ProfileOutlined, AppstoreOutlined, OrderedListOutlined, LineOutlined, DisconnectOutlined, TranslationOutlined } from "@ant-design/icons";
|
|
96
96
|
import * as ReactRouter from "react-router";
|
|
97
97
|
import { matchRoutes } from "react-router";
|
|
98
98
|
import omit$1 from "lodash/omit";
|
|
@@ -9556,7 +9556,7 @@ function addAppVersion(e, t) {
|
|
|
9556
9556
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
9557
9557
|
}), e;
|
|
9558
9558
|
}
|
|
9559
|
-
const name = "@nocobase/client", version = "2.0.0-alpha.
|
|
9559
|
+
const name = "@nocobase/client", version = "2.0.0-alpha.6", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
9560
9560
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
9561
9561
|
"@ant-design/cssinjs": "^1.11.1",
|
|
9562
9562
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -9579,10 +9579,10 @@ const name = "@nocobase/client", version = "2.0.0-alpha.5", license = "AGPL-3.0"
|
|
|
9579
9579
|
"@formily/reactive-react": "^2.2.27",
|
|
9580
9580
|
"@formily/shared": "^2.2.27",
|
|
9581
9581
|
"@formily/validator": "^2.2.27",
|
|
9582
|
-
"@nocobase/evaluators": "2.0.0-alpha.
|
|
9583
|
-
"@nocobase/flow-engine": "2.0.0-alpha.
|
|
9584
|
-
"@nocobase/sdk": "2.0.0-alpha.
|
|
9585
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
9582
|
+
"@nocobase/evaluators": "2.0.0-alpha.6",
|
|
9583
|
+
"@nocobase/flow-engine": "2.0.0-alpha.6",
|
|
9584
|
+
"@nocobase/sdk": "2.0.0-alpha.6",
|
|
9585
|
+
"@nocobase/utils": "2.0.0-alpha.6",
|
|
9586
9586
|
"@tanstack/react-table": "^8.21.3",
|
|
9587
9587
|
"@types/tabulator-tables": "^6.2.6",
|
|
9588
9588
|
ahooks: "^3.7.2",
|
|
@@ -67751,12 +67751,12 @@ const CodeEditor = (e) => {
|
|
|
67751
67751
|
}, titleField = defineAction({
|
|
67752
67752
|
name: "titleField",
|
|
67753
67753
|
title: tval$1("Label field"),
|
|
67754
|
-
uiSchema: (e) => e.collectionField.isAssociationField() ? {
|
|
67754
|
+
uiSchema: (e) => !e.collectionField || !e.collectionField.isAssociationField() ? null : {
|
|
67755
67755
|
label: {
|
|
67756
67756
|
"x-component": SelectOptions$1,
|
|
67757
67757
|
"x-decorator": "FormItem"
|
|
67758
67758
|
}
|
|
67759
|
-
}
|
|
67759
|
+
},
|
|
67760
67760
|
defaultParams: (e) => {
|
|
67761
67761
|
var o;
|
|
67762
67762
|
const t = e.model.context.collectionField.targetCollectionTitleFieldName;
|
|
@@ -68614,9 +68614,12 @@ DetailsItemModel.registerFlow({
|
|
|
68614
68614
|
}
|
|
68615
68615
|
}
|
|
68616
68616
|
}),
|
|
68617
|
-
defaultParams: (e) =>
|
|
68618
|
-
|
|
68619
|
-
|
|
68617
|
+
defaultParams: (e) => {
|
|
68618
|
+
var t;
|
|
68619
|
+
return {
|
|
68620
|
+
title: (t = e.collectionField) == null ? void 0 : t.title
|
|
68621
|
+
};
|
|
68622
|
+
},
|
|
68620
68623
|
handler(e, t) {
|
|
68621
68624
|
e.model.setProps({ label: t.title });
|
|
68622
68625
|
}
|
|
@@ -68736,16 +68739,18 @@ const displayFieldComponent = defineAction({
|
|
|
68736
68739
|
title: escapeT("Field component"),
|
|
68737
68740
|
uiSchema: (e) => {
|
|
68738
68741
|
const { titleField: t } = e.model.props;
|
|
68739
|
-
return e.model.constructor.getBindingsByField(e, e.collectionField).length === 1 && !t ? null : {
|
|
68742
|
+
return e.collectionField ? e.model.constructor.getBindingsByField(e, e.collectionField).length === 1 && !t ? null : {
|
|
68740
68743
|
use: {
|
|
68741
68744
|
type: "string",
|
|
68742
68745
|
"x-component": "Select",
|
|
68743
68746
|
"x-decorator": "FormItem",
|
|
68744
68747
|
enum: buildAssociationOptions(e, e.model.constructor, t)
|
|
68745
68748
|
}
|
|
68746
|
-
};
|
|
68749
|
+
} : void 0;
|
|
68747
68750
|
},
|
|
68748
68751
|
beforeParamsSave: (e, t, o) => E(void 0, null, function* () {
|
|
68752
|
+
if (!e.collectionField)
|
|
68753
|
+
return;
|
|
68749
68754
|
const n = e.model.constructor.getBindingsByField(e, e.collectionField), { titleField: r } = e.model.props;
|
|
68750
68755
|
let i = [];
|
|
68751
68756
|
r && (i = e.model.constructor.getBindingsByField(
|
|
@@ -68783,8 +68788,8 @@ const displayFieldComponent = defineAction({
|
|
|
68783
68788
|
name: "fieldComponent",
|
|
68784
68789
|
uiSchema: (e) => {
|
|
68785
68790
|
if (e.model.getProps().pattern === "readPretty") {
|
|
68786
|
-
const { titleField: t } = e.model.props;
|
|
68787
|
-
return
|
|
68791
|
+
const { titleField: t } = e.model.props, o = e.model.constructor.getBindingsByField(e, e.collectionField);
|
|
68792
|
+
return !o || o.length === 1 && !t ? null : {
|
|
68788
68793
|
use: {
|
|
68789
68794
|
type: "string",
|
|
68790
68795
|
"x-component": "Select",
|
|
@@ -68794,7 +68799,7 @@ const displayFieldComponent = defineAction({
|
|
|
68794
68799
|
};
|
|
68795
68800
|
} else {
|
|
68796
68801
|
const t = e.model.constructor.getBindingsByField(e, e.collectionField);
|
|
68797
|
-
return t.length === 1 ? null : {
|
|
68802
|
+
return !t || t.length === 1 ? null : {
|
|
68798
68803
|
use: {
|
|
68799
68804
|
type: "string",
|
|
68800
68805
|
"x-component": "Select",
|
|
@@ -68848,38 +68853,42 @@ const displayFieldComponent = defineAction({
|
|
|
68848
68853
|
handler(e, t) {
|
|
68849
68854
|
return E(this, null, function* () {
|
|
68850
68855
|
var n, r;
|
|
68851
|
-
|
|
68856
|
+
const o = yield e.aclCheck({
|
|
68852
68857
|
dataSourceKey: (n = e.model.context.dataSource) == null ? void 0 : n.key,
|
|
68853
68858
|
resourceName: e.model.context.resourceName,
|
|
68854
68859
|
actionName: e.model.context.actionName,
|
|
68855
68860
|
fields: ((r = e.model.context) == null ? void 0 : r.collectionField) && [e.model.context.collectionField.name]
|
|
68856
|
-
})
|
|
68861
|
+
});
|
|
68862
|
+
e.fieldPath && !e.collectionField && (e.model.fieldDeleted = !0, e.model.hidden = !0, e.exitAll()), o || (e.model.hidden = !0, e.exitAll());
|
|
68857
68863
|
});
|
|
68858
68864
|
}
|
|
68859
68865
|
}), pattern = defineAction({
|
|
68860
68866
|
name: "pattern",
|
|
68861
68867
|
title: escapeT("Display mode"),
|
|
68862
|
-
uiSchema: (e) =>
|
|
68863
|
-
|
|
68864
|
-
|
|
68865
|
-
|
|
68866
|
-
|
|
68867
|
-
|
|
68868
|
-
|
|
68869
|
-
|
|
68870
|
-
|
|
68871
|
-
|
|
68872
|
-
|
|
68873
|
-
|
|
68874
|
-
|
|
68875
|
-
|
|
68876
|
-
|
|
68877
|
-
|
|
68868
|
+
uiSchema: (e) => {
|
|
68869
|
+
if (e.model.collectionField)
|
|
68870
|
+
return {
|
|
68871
|
+
pattern: {
|
|
68872
|
+
"x-component": "Select",
|
|
68873
|
+
"x-decorator": "FormItem",
|
|
68874
|
+
enum: [
|
|
68875
|
+
{
|
|
68876
|
+
value: "editable",
|
|
68877
|
+
label: escapeT("Editable")
|
|
68878
|
+
},
|
|
68879
|
+
{
|
|
68880
|
+
value: "disabled",
|
|
68881
|
+
label: escapeT("Disabled")
|
|
68882
|
+
},
|
|
68883
|
+
{
|
|
68884
|
+
value: "readPretty",
|
|
68885
|
+
label: escapeT("Display only")
|
|
68886
|
+
}
|
|
68887
|
+
],
|
|
68888
|
+
"x-disabled": e.model.collectionField.inputable === !1
|
|
68878
68889
|
}
|
|
68879
|
-
|
|
68880
|
-
|
|
68881
|
-
}
|
|
68882
|
-
}),
|
|
68890
|
+
};
|
|
68891
|
+
},
|
|
68883
68892
|
defaultParams: (e) => ({
|
|
68884
68893
|
pattern: e.model.collectionField.inputable === !1 || e.model.context.parentDisabled || e.model.props.disabled || e.model.collectionField.readonly ? "disabled" : "editable"
|
|
68885
68894
|
}),
|
|
@@ -68926,6 +68935,8 @@ const validation = defineAction({
|
|
|
68926
68935
|
title: escapeT("Validation"),
|
|
68927
68936
|
name: "validation",
|
|
68928
68937
|
uiSchema: (e) => {
|
|
68938
|
+
if (!e.model.collectionField)
|
|
68939
|
+
return;
|
|
68929
68940
|
const t = e.app.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(
|
|
68930
68941
|
e.model.collectionField.interface
|
|
68931
68942
|
);
|
|
@@ -70172,7 +70183,7 @@ RecordSelectFieldModel.registerFlow({
|
|
|
70172
70183
|
allowMultiple: {
|
|
70173
70184
|
title: escapeT("Allow multiple"),
|
|
70174
70185
|
uiSchema(e) {
|
|
70175
|
-
return ["belongsToMany", "hasMany", "belongsToArray"].includes(e.
|
|
70186
|
+
return e.collectionField && ["belongsToMany", "hasMany", "belongsToArray"].includes(e.collectionField.type) ? {
|
|
70176
70187
|
allowMultiple: {
|
|
70177
70188
|
"x-component": "Switch",
|
|
70178
70189
|
type: "boolean",
|
|
@@ -70182,9 +70193,7 @@ RecordSelectFieldModel.registerFlow({
|
|
|
70182
70193
|
},
|
|
70183
70194
|
defaultParams(e) {
|
|
70184
70195
|
return {
|
|
70185
|
-
allowMultiple: ["belongsToMany", "hasMany", "belongsToArray"].includes(
|
|
70186
|
-
e.model.context.collectionField.type
|
|
70187
|
-
)
|
|
70196
|
+
allowMultiple: e.collectionField && ["belongsToMany", "hasMany", "belongsToArray"].includes(e.model.context.collectionField.type)
|
|
70188
70197
|
};
|
|
70189
70198
|
},
|
|
70190
70199
|
handler(e, t) {
|
|
@@ -71801,7 +71810,7 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
71801
71810
|
return createDefaultCollectionBlockTitle({ blockLabel: o, dsName: n, dsCount: r, collectionTitle: i });
|
|
71802
71811
|
}
|
|
71803
71812
|
addAppends(o, n = !1) {
|
|
71804
|
-
if (o)
|
|
71813
|
+
if (console.log(o), !!o)
|
|
71805
71814
|
if (o.includes(".")) {
|
|
71806
71815
|
const [r, i] = o.split("."), l = this.context.dataSourceManager.getCollectionField(
|
|
71807
71816
|
`${this.collection.dataSourceKey}.${this.collection.name}.${r}`
|
|
@@ -71815,7 +71824,7 @@ class CollectionBlockModel extends DataBlockModel {
|
|
|
71815
71824
|
);
|
|
71816
71825
|
if (!r)
|
|
71817
71826
|
return;
|
|
71818
|
-
r.isAssociationField() && (this.resource.addAppends(r.name), n && this.resource.refresh());
|
|
71827
|
+
r.isAssociationField() && (console.log(r.name), this.resource.addAppends(r.name), n && this.resource.refresh());
|
|
71819
71828
|
}
|
|
71820
71829
|
}
|
|
71821
71830
|
}
|
|
@@ -72953,11 +72962,15 @@ FormItemModel.registerFlow({
|
|
|
72953
72962
|
}
|
|
72954
72963
|
}
|
|
72955
72964
|
}),
|
|
72956
|
-
defaultParams: (e) =>
|
|
72957
|
-
|
|
72958
|
-
|
|
72965
|
+
defaultParams: (e) => {
|
|
72966
|
+
var t;
|
|
72967
|
+
return {
|
|
72968
|
+
label: (t = e.collectionField) == null ? void 0 : t.title
|
|
72969
|
+
};
|
|
72970
|
+
},
|
|
72959
72971
|
handler(e, t) {
|
|
72960
|
-
|
|
72972
|
+
var o;
|
|
72973
|
+
e.model.setProps({ label: t.label || ((o = e.collectionField) == null ? void 0 : o.title) });
|
|
72961
72974
|
}
|
|
72962
72975
|
},
|
|
72963
72976
|
aclCheck: {
|
|
@@ -73071,12 +73084,12 @@ FormItemModel.registerFlow({
|
|
|
73071
73084
|
fieldNames: {
|
|
73072
73085
|
use: "titleField",
|
|
73073
73086
|
uiSchema: (e) => E(void 0, null, function* () {
|
|
73074
|
-
return e.collectionField.isAssociationField() && e.model.getProps().titleField ? {
|
|
73087
|
+
return e.collectionField ? e.collectionField.isAssociationField() && e.model.getProps().titleField ? {
|
|
73075
73088
|
label: {
|
|
73076
73089
|
"x-component": SelectOptions$1,
|
|
73077
73090
|
"x-decorator": "FormItem"
|
|
73078
73091
|
}
|
|
73079
|
-
} : null;
|
|
73092
|
+
} : null : void 0;
|
|
73080
73093
|
}),
|
|
73081
73094
|
beforeParamsSave: (e, t, o) => E(void 0, null, function* () {
|
|
73082
73095
|
if (!(e.collectionField.isAssociationField() && e.model.props.titleField))
|
|
@@ -76317,9 +76330,20 @@ TableBlockModel.define({
|
|
|
76317
76330
|
},
|
|
76318
76331
|
sort: 300
|
|
76319
76332
|
});
|
|
76333
|
+
function FieldDeletePlaceholder() {
|
|
76334
|
+
const { t: e } = useTranslation(), t = useFlowModel(), o = t.context.blockModel, n = o.collection.dataSource, r = o.collection, i = t.fieldPath, a = useMemo(() => {
|
|
76335
|
+
const c = `${e(n.displayName || n.key)} > `, u = r ? `${e(r.title) || r.name || r.tableName} > ` : "";
|
|
76336
|
+
return `${c}${u}${i}`;
|
|
76337
|
+
}, []), l = e('The {{type}} "{{name}}" may have been deleted. Please remove this {{blockType}}.', {
|
|
76338
|
+
type: e("Field"),
|
|
76339
|
+
name: a,
|
|
76340
|
+
blockType: e("Field")
|
|
76341
|
+
}).replaceAll(">", ">");
|
|
76342
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: l, children: /* @__PURE__ */ jsx(ExclamationCircleOutlined, { style: { opacity: "0.45" } }) });
|
|
76343
|
+
}
|
|
76320
76344
|
const Re = class Re extends DisplayItemModel {
|
|
76321
76345
|
renderHiddenInConfig() {
|
|
76322
|
-
return /* @__PURE__ */ jsx(Tooltip, { title: this.context.t("该字段已被隐藏,你无法查看(该内容仅在激活 UI Editor 时显示)。"), children: /* @__PURE__ */ jsx(LockOutlined, { style: { opacity: "0.45" } }) });
|
|
76346
|
+
return this.fieldDeleted ? /* @__PURE__ */ jsx(FieldDeletePlaceholder, {}) : /* @__PURE__ */ jsx(Tooltip, { title: this.context.t("该字段已被隐藏,你无法查看(该内容仅在激活 UI Editor 时显示)。"), children: /* @__PURE__ */ jsx(LockOutlined, { style: { opacity: "0.45" } }) });
|
|
76323
76347
|
}
|
|
76324
76348
|
afterAddAsSubModel() {
|
|
76325
76349
|
return E(this, null, function* () {
|
|
@@ -76528,6 +76552,8 @@ TableColumnModel.registerFlow({
|
|
|
76528
76552
|
quickEdit: {
|
|
76529
76553
|
title: escapeT("Enable quick edit"),
|
|
76530
76554
|
uiSchema: (e) => {
|
|
76555
|
+
if (!e.model.collectionField)
|
|
76556
|
+
return;
|
|
76531
76557
|
const t = e.model.context.blockModel.collection.name, o = e.model.collectionField.collectionName;
|
|
76532
76558
|
if (t === o)
|
|
76533
76559
|
return {
|
|
@@ -80688,15 +80714,18 @@ ClickableFieldModel.registerFlow({
|
|
|
80688
80714
|
steps: {
|
|
80689
80715
|
displayStyle: {
|
|
80690
80716
|
title: escapeT("Display style"),
|
|
80691
|
-
uiSchema: (e) =>
|
|
80692
|
-
|
|
80693
|
-
|
|
80694
|
-
|
|
80695
|
-
|
|
80696
|
-
|
|
80697
|
-
|
|
80698
|
-
|
|
80699
|
-
|
|
80717
|
+
uiSchema: (e) => {
|
|
80718
|
+
var t;
|
|
80719
|
+
return ["select", "multipleSelect", "radioGroup", "checkboxGroup"].includes((t = e.collectionField) == null ? void 0 : t.interface) ? null : {
|
|
80720
|
+
displayStyle: {
|
|
80721
|
+
"x-component": "Radio.Group",
|
|
80722
|
+
"x-decorator": "FormItem",
|
|
80723
|
+
enum: [
|
|
80724
|
+
{ label: escapeT("Tag"), value: "tag" },
|
|
80725
|
+
{ label: escapeT("Text"), value: "text" }
|
|
80726
|
+
]
|
|
80727
|
+
}
|
|
80728
|
+
};
|
|
80700
80729
|
},
|
|
80701
80730
|
defaultParams: {
|
|
80702
80731
|
displayStyle: "text"
|