@nocobase/client 0.14.0-alpha.3 → 0.14.0-alpha.5
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 +156 -57
- package/lib/index.js +6433 -6335
- package/package.json +5 -5
- package/lib/{md-99fb6564.js → md-3221ff9b-53bf4155.js} +4 -4
package/es/index.mjs
CHANGED
|
@@ -2032,6 +2032,19 @@ class APIClient extends APIClient$1 {
|
|
|
2032
2032
|
});
|
|
2033
2033
|
super.interceptors();
|
|
2034
2034
|
this.useNotificationMiddleware();
|
|
2035
|
+
this.axios.interceptors.response.use(
|
|
2036
|
+
(response) => {
|
|
2037
|
+
return response;
|
|
2038
|
+
},
|
|
2039
|
+
(error2) => {
|
|
2040
|
+
var _a, _b;
|
|
2041
|
+
const errs = ((_b = (_a = error2 == null ? void 0 : error2.response) == null ? void 0 : _a.data) == null ? void 0 : _b.errors) || [{ message: "Server error" }];
|
|
2042
|
+
if (errs.find((error22) => error22.code === "ROLE_NOT_FOUND_ERR")) {
|
|
2043
|
+
this.auth.setRole(null);
|
|
2044
|
+
}
|
|
2045
|
+
throw error2;
|
|
2046
|
+
}
|
|
2047
|
+
);
|
|
2035
2048
|
}
|
|
2036
2049
|
useNotificationMiddleware() {
|
|
2037
2050
|
this.axios.interceptors.response.use(
|
|
@@ -2267,7 +2280,7 @@ const useSaveCurrentUserValues$1 = () => {
|
|
|
2267
2280
|
run() {
|
|
2268
2281
|
return __async(this, null, function* () {
|
|
2269
2282
|
yield form.submit();
|
|
2270
|
-
yield api.resource("
|
|
2283
|
+
yield api.resource("auth").changePassword({
|
|
2271
2284
|
values: form.values
|
|
2272
2285
|
});
|
|
2273
2286
|
yield form.reset();
|
|
@@ -6041,6 +6054,7 @@ const DuplicateAction = observer((props) => {
|
|
|
6041
6054
|
) : /* @__PURE__ */ jsx(
|
|
6042
6055
|
Button,
|
|
6043
6056
|
__spreadProps(__spreadValues({
|
|
6057
|
+
"data-testid": "duplicate-action",
|
|
6044
6058
|
disabled,
|
|
6045
6059
|
style: {
|
|
6046
6060
|
opacity: designable && ((_b = field == null ? void 0 : field.data) == null ? void 0 : _b.hidden) && 0.1
|
|
@@ -9840,12 +9854,26 @@ function useIsShowMultipleSwitch() {
|
|
|
9840
9854
|
return !field.readPretty && fieldSchema["x-component"] !== "TableField" && hasMultiple && fieldMode !== "SubTable";
|
|
9841
9855
|
};
|
|
9842
9856
|
}
|
|
9857
|
+
const getTestId = (schema3) => {
|
|
9858
|
+
var _a;
|
|
9859
|
+
const resource = (_a = schema3 == null ? void 0 : schema3["x-decorator-props"]) == null ? void 0 : _a["resource"];
|
|
9860
|
+
if (resource) {
|
|
9861
|
+
return `${resource}-resource`;
|
|
9862
|
+
}
|
|
9863
|
+
const field = schema3["x-collection-field"];
|
|
9864
|
+
if (field) {
|
|
9865
|
+
return `${field}-field`;
|
|
9866
|
+
}
|
|
9867
|
+
return `${schema3.name}-item`;
|
|
9868
|
+
};
|
|
9843
9869
|
const BlockItem = (props) => {
|
|
9844
9870
|
const { className, children } = useProps(props);
|
|
9845
9871
|
const Designer4 = useDesigner();
|
|
9872
|
+
const schema3 = useFieldSchema();
|
|
9846
9873
|
return /* @__PURE__ */ jsxs(
|
|
9847
9874
|
SortableItem,
|
|
9848
9875
|
{
|
|
9876
|
+
"data-testid": getTestId(schema3),
|
|
9849
9877
|
className: cls(
|
|
9850
9878
|
"nb-block-item",
|
|
9851
9879
|
className,
|
|
@@ -10130,7 +10158,7 @@ const useFilterableFields = (collectionName) => {
|
|
|
10130
10158
|
return false;
|
|
10131
10159
|
}
|
|
10132
10160
|
const fieldInterface = getInterface(field.interface);
|
|
10133
|
-
if (!fieldInterface.filterable) {
|
|
10161
|
+
if (!(fieldInterface == null ? void 0 : fieldInterface.filterable)) {
|
|
10134
10162
|
return false;
|
|
10135
10163
|
}
|
|
10136
10164
|
return true;
|
|
@@ -10243,6 +10271,7 @@ const DesignableSwitch = () => {
|
|
|
10243
10271
|
return /* @__PURE__ */ jsx(Tooltip$1, { title: t("UI Editor"), children: /* @__PURE__ */ jsx(
|
|
10244
10272
|
Button,
|
|
10245
10273
|
{
|
|
10274
|
+
"data-testid": "ui-editor-button",
|
|
10246
10275
|
icon: /* @__PURE__ */ jsx(HighlightOutlined, {}),
|
|
10247
10276
|
title: t("UI Editor"),
|
|
10248
10277
|
style,
|
|
@@ -10921,7 +10950,7 @@ const useGetFilterFieldOptions = () => {
|
|
|
10921
10950
|
return;
|
|
10922
10951
|
}
|
|
10923
10952
|
const fieldInterface = getInterface(field.interface);
|
|
10924
|
-
if (!fieldInterface.filterable) {
|
|
10953
|
+
if (!(fieldInterface == null ? void 0 : fieldInterface.filterable)) {
|
|
10925
10954
|
return;
|
|
10926
10955
|
}
|
|
10927
10956
|
const { nested, children, operators: operators2 } = fieldInterface.filterable;
|
|
@@ -10978,7 +11007,7 @@ const useFilterFieldOptions = (fields2) => {
|
|
|
10978
11007
|
return;
|
|
10979
11008
|
}
|
|
10980
11009
|
const fieldInterface = getInterface(field.interface);
|
|
10981
|
-
if (!fieldInterface.filterable) {
|
|
11010
|
+
if (!(fieldInterface == null ? void 0 : fieldInterface.filterable)) {
|
|
10982
11011
|
return;
|
|
10983
11012
|
}
|
|
10984
11013
|
const { nested, children, operators: operators2 } = fieldInterface.filterable;
|
|
@@ -13219,8 +13248,9 @@ const TableColumnDesigner$1 = (props) => {
|
|
|
13219
13248
|
title: t("Field component"),
|
|
13220
13249
|
options: readOnlyMode === "read-pretty" ? [
|
|
13221
13250
|
{ label: t("Title"), value: "Select" },
|
|
13251
|
+
isFileField && { label: t("File manager"), value: "FileManager" },
|
|
13222
13252
|
{ label: t("Tag"), value: "Tag" }
|
|
13223
|
-
] : fieldModeOptions,
|
|
13253
|
+
].filter(Boolean) : fieldModeOptions,
|
|
13224
13254
|
value: fieldMode,
|
|
13225
13255
|
onChange: (mode) => {
|
|
13226
13256
|
const schema3 = {
|
|
@@ -15788,7 +15818,7 @@ const useVariableTypes = (currentCollection, excludes = []) => {
|
|
|
15788
15818
|
return;
|
|
15789
15819
|
}
|
|
15790
15820
|
const fieldInterface = getInterface(field.interface);
|
|
15791
|
-
if (!fieldInterface.filterable) {
|
|
15821
|
+
if (!(fieldInterface == null ? void 0 : fieldInterface.filterable)) {
|
|
15792
15822
|
return;
|
|
15793
15823
|
}
|
|
15794
15824
|
const { nested, children } = fieldInterface.filterable;
|
|
@@ -18375,6 +18405,7 @@ const useEnsureOperatorsValid = () => {
|
|
|
18375
18405
|
const EditOperator = () => {
|
|
18376
18406
|
const compile2 = useCompile();
|
|
18377
18407
|
const fieldSchema = useFieldSchema();
|
|
18408
|
+
const field = useField();
|
|
18378
18409
|
const { t } = useTranslation();
|
|
18379
18410
|
const { dn } = useDesignable();
|
|
18380
18411
|
const operatorList = useOperatorList();
|
|
@@ -18389,11 +18420,38 @@ const EditOperator = () => {
|
|
|
18389
18420
|
value: storedOperators[fieldSchema.name],
|
|
18390
18421
|
options: compile2(operatorList),
|
|
18391
18422
|
onChange: (v) => {
|
|
18423
|
+
var _a, _b;
|
|
18392
18424
|
storedOperators[fieldSchema.name] = v;
|
|
18425
|
+
const operator = operatorList.find((item) => item.value === v);
|
|
18393
18426
|
const schema3 = {
|
|
18394
18427
|
["x-uid"]: uid2,
|
|
18395
18428
|
["x-filter-operators"]: storedOperators
|
|
18396
18429
|
};
|
|
18430
|
+
if ((_a = operator == null ? void 0 : operator.schema) == null ? void 0 : _a["x-component"]) {
|
|
18431
|
+
_.set(fieldSchema, "x-component-props.component", operator.schema["x-component"]);
|
|
18432
|
+
_.set(field, "componentProps.component", operator.schema["x-component"]);
|
|
18433
|
+
field.reset();
|
|
18434
|
+
dn.emit("patch", {
|
|
18435
|
+
schema: {
|
|
18436
|
+
["x-uid"]: fieldSchema["x-uid"],
|
|
18437
|
+
["x-component-props"]: {
|
|
18438
|
+
component: operator.schema["x-component"]
|
|
18439
|
+
}
|
|
18440
|
+
}
|
|
18441
|
+
});
|
|
18442
|
+
} else if ((_b = fieldSchema["x-component-props"]) == null ? void 0 : _b.component) {
|
|
18443
|
+
_.set(fieldSchema, "x-component-props.component", null);
|
|
18444
|
+
_.set(field, "componentProps.component", null);
|
|
18445
|
+
field.reset();
|
|
18446
|
+
dn.emit("patch", {
|
|
18447
|
+
schema: {
|
|
18448
|
+
["x-uid"]: fieldSchema["x-uid"],
|
|
18449
|
+
["x-component-props"]: {
|
|
18450
|
+
component: null
|
|
18451
|
+
}
|
|
18452
|
+
}
|
|
18453
|
+
});
|
|
18454
|
+
}
|
|
18397
18455
|
dn.emit("patch", {
|
|
18398
18456
|
schema: schema3
|
|
18399
18457
|
});
|
|
@@ -18490,6 +18548,9 @@ const transformToFilter = (values, fieldSchema, getCollectionJoinField, collecti
|
|
|
18490
18548
|
const { operators: operators2 } = findFilterOperators(fieldSchema);
|
|
18491
18549
|
values = flatten(values, {
|
|
18492
18550
|
breakOn({ value, path }) {
|
|
18551
|
+
if (operators2[path] === "$dateBetween") {
|
|
18552
|
+
return true;
|
|
18553
|
+
}
|
|
18493
18554
|
const collectionField = getCollectionJoinField(`${collectionName}.${path}`);
|
|
18494
18555
|
if (collectionField == null ? void 0 : collectionField.target) {
|
|
18495
18556
|
if (Array.isArray(value)) {
|
|
@@ -22342,7 +22403,9 @@ const Action = observer(
|
|
|
22342
22403
|
}
|
|
22343
22404
|
return /* @__PURE__ */ jsxs(
|
|
22344
22405
|
SortableItem,
|
|
22345
|
-
__spreadProps(__spreadValues({
|
|
22406
|
+
__spreadProps(__spreadValues({
|
|
22407
|
+
"data-testid": `${fieldSchema["x-action"] || fieldSchema.name}-action`
|
|
22408
|
+
}, others), {
|
|
22346
22409
|
loading: (_b2 = field == null ? void 0 : field.data) == null ? void 0 : _b2.loading,
|
|
22347
22410
|
icon: icon2 ? /* @__PURE__ */ jsx(Icon, { type: icon2 }) : null,
|
|
22348
22411
|
disabled,
|
|
@@ -32450,9 +32513,13 @@ const ReadPrettyInternalViewer = observer(
|
|
|
32450
32513
|
);
|
|
32451
32514
|
const useTableSelectorProps$1 = () => {
|
|
32452
32515
|
const field = useField();
|
|
32453
|
-
const {
|
|
32454
|
-
|
|
32455
|
-
|
|
32516
|
+
const {
|
|
32517
|
+
multiple,
|
|
32518
|
+
options = [],
|
|
32519
|
+
setSelectedRows,
|
|
32520
|
+
selectedRows: rcSelectRows = [],
|
|
32521
|
+
onChange
|
|
32522
|
+
} = useContext(RecordPickerContext);
|
|
32456
32523
|
const _a = useTableSelectorProps$3(), { onRowSelectionChange, rowKey = "id" } = _a, others = __objRest(_a, ["onRowSelectionChange", "rowKey"]);
|
|
32457
32524
|
const { setVisible } = useActionContext();
|
|
32458
32525
|
return __spreadProps(__spreadValues({}, others), {
|
|
@@ -32600,14 +32667,15 @@ const InternalFileManager = (props) => {
|
|
|
32600
32667
|
] });
|
|
32601
32668
|
};
|
|
32602
32669
|
const FileManageReadPretty = connect((props) => {
|
|
32603
|
-
const field = useField();
|
|
32604
32670
|
const fieldNames = useFieldNames$1(props);
|
|
32671
|
+
const fieldSchema = useFieldSchema();
|
|
32605
32672
|
const { getField } = useCollection();
|
|
32606
|
-
const
|
|
32673
|
+
const { getCollectionJoinField } = useCollectionManager();
|
|
32674
|
+
const collectionField = getField(fieldSchema.name) || getCollectionJoinField(fieldSchema["x-collection-field"]);
|
|
32607
32675
|
const labelUiSchema = useLabelUiSchema$1(collectionField == null ? void 0 : collectionField.target, (fieldNames == null ? void 0 : fieldNames.label) || "label");
|
|
32608
32676
|
const showFilePicker = isShowFilePicker$1(labelUiSchema);
|
|
32609
32677
|
if (showFilePicker) {
|
|
32610
|
-
return collectionField ? /* @__PURE__ */ jsx(Preview, __spreadProps(__spreadValues({}, props), { fieldNames })) : null;
|
|
32678
|
+
return /* @__PURE__ */ jsx(EllipsisWithTooltip, { ellipsis: true, children: collectionField ? /* @__PURE__ */ jsx(Preview, __spreadProps(__spreadValues({}, props), { fieldNames })) : null });
|
|
32611
32679
|
} else {
|
|
32612
32680
|
return /* @__PURE__ */ jsx(ReadPrettyInternalViewer, __spreadValues({}, props));
|
|
32613
32681
|
}
|
|
@@ -32620,33 +32688,34 @@ const InternalNester = observer(
|
|
|
32620
32688
|
const insertNester = useInsertSchema("Nester");
|
|
32621
32689
|
const { options: collectionField } = useAssociationFieldContext();
|
|
32622
32690
|
const showTitle = (_b = (_a = fieldSchema["x-decorator-props"]) == null ? void 0 : _a.showTitle) != null ? _b : true;
|
|
32691
|
+
const { actionName } = useACLActionParamsContext();
|
|
32623
32692
|
useEffect(() => {
|
|
32624
32693
|
insertNester(schema$1.Nester);
|
|
32625
32694
|
}, []);
|
|
32626
|
-
return /* @__PURE__ */ jsx(CollectionProvider, { name: collectionField.target, children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
|
|
32695
|
+
return /* @__PURE__ */ jsx(CollectionProvider, { name: collectionField.target, children: /* @__PURE__ */ jsx(ACLCollectionProvider, { actionPath: `${collectionField.target}:${actionName}`, children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
|
|
32627
32696
|
"div",
|
|
32628
32697
|
{
|
|
32629
32698
|
className: cx(
|
|
32630
32699
|
css`
|
|
32631
|
-
|
|
32632
|
-
|
|
32633
|
-
|
|
32634
|
-
.ant-card-body {
|
|
32635
|
-
padding: 15px 20px 5px;
|
|
32636
|
-
}
|
|
32637
|
-
.ant-divider-horizontal {
|
|
32638
|
-
margin: 10px 0;
|
|
32639
|
-
}
|
|
32640
|
-
`,
|
|
32641
|
-
{
|
|
32642
|
-
[css`
|
|
32700
|
+
& .ant-formily-item-layout-vertical {
|
|
32701
|
+
margin-bottom: 10px;
|
|
32702
|
+
}
|
|
32643
32703
|
.ant-card-body {
|
|
32644
|
-
padding:
|
|
32704
|
+
padding: 15px 20px 5px;
|
|
32645
32705
|
}
|
|
32646
|
-
|
|
32647
|
-
|
|
32706
|
+
.ant-divider-horizontal {
|
|
32707
|
+
margin: 10px 0;
|
|
32648
32708
|
}
|
|
32649
|
-
|
|
32709
|
+
`,
|
|
32710
|
+
{
|
|
32711
|
+
[css`
|
|
32712
|
+
.ant-card-body {
|
|
32713
|
+
padding: 0px 20px 20px 0px;
|
|
32714
|
+
}
|
|
32715
|
+
> .ant-card-bordered {
|
|
32716
|
+
border: none;
|
|
32717
|
+
}
|
|
32718
|
+
`]: showTitle === false
|
|
32650
32719
|
}
|
|
32651
32720
|
),
|
|
32652
32721
|
children: /* @__PURE__ */ jsx(
|
|
@@ -32661,7 +32730,7 @@ const InternalNester = observer(
|
|
|
32661
32730
|
}
|
|
32662
32731
|
)
|
|
32663
32732
|
}
|
|
32664
|
-
) }) });
|
|
32733
|
+
) }) }) });
|
|
32665
32734
|
},
|
|
32666
32735
|
{ displayName: "InternalNester" }
|
|
32667
32736
|
);
|
|
@@ -32839,6 +32908,7 @@ const InternalSubTable = observer(
|
|
|
32839
32908
|
const fieldSchema = useFieldSchema();
|
|
32840
32909
|
const insert = useInsertSchema("SubTable");
|
|
32841
32910
|
const { options } = useAssociationFieldContext();
|
|
32911
|
+
const { actionName } = useACLActionParamsContext();
|
|
32842
32912
|
useEffect(() => {
|
|
32843
32913
|
insert(schema$1.SubTable);
|
|
32844
32914
|
field.required = fieldSchema["required"];
|
|
@@ -32848,23 +32918,23 @@ const InternalSubTable = observer(
|
|
|
32848
32918
|
"Radio.Group": Select,
|
|
32849
32919
|
"Checkbox.Group": (props) => /* @__PURE__ */ jsx(Select, __spreadValues({ multiple: true, mode: "multiple" }, props))
|
|
32850
32920
|
});
|
|
32851
|
-
return /* @__PURE__ */ jsx(CollectionProvider, { name: options.target, children: /* @__PURE__ */ jsx(
|
|
32921
|
+
return /* @__PURE__ */ jsx(CollectionProvider, { name: options.target, children: /* @__PURE__ */ jsx(ACLCollectionProvider, { actionPath: `${options.target}:${actionName}`, children: /* @__PURE__ */ jsx(
|
|
32852
32922
|
FormLayout,
|
|
32853
32923
|
{
|
|
32854
32924
|
className: css`
|
|
32855
|
-
|
|
32856
|
-
|
|
32857
|
-
|
|
32858
|
-
|
|
32859
|
-
|
|
32860
|
-
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
|
|
32864
|
-
|
|
32925
|
+
.ant-formily-item-bordered-none {
|
|
32926
|
+
.ant-input-number-group-addon {
|
|
32927
|
+
border: none !important;
|
|
32928
|
+
background: none;
|
|
32929
|
+
}
|
|
32930
|
+
.ant-checkbox-wrapper {
|
|
32931
|
+
margin-left: 8px;
|
|
32932
|
+
}
|
|
32933
|
+
.ant-table {
|
|
32934
|
+
margin: 0px !important;
|
|
32935
|
+
}
|
|
32865
32936
|
}
|
|
32866
|
-
|
|
32867
|
-
`,
|
|
32937
|
+
`,
|
|
32868
32938
|
layout: "vertical",
|
|
32869
32939
|
bordered: false,
|
|
32870
32940
|
children: /* @__PURE__ */ jsx(
|
|
@@ -32888,7 +32958,7 @@ const InternalSubTable = observer(
|
|
|
32888
32958
|
}
|
|
32889
32959
|
)
|
|
32890
32960
|
}
|
|
32891
|
-
) });
|
|
32961
|
+
) }) });
|
|
32892
32962
|
},
|
|
32893
32963
|
{ displayName: "InternalSubTable" }
|
|
32894
32964
|
);
|
|
@@ -33308,7 +33378,7 @@ const useTableColumns$1 = (props) => {
|
|
|
33308
33378
|
const { designable } = useDesignable();
|
|
33309
33379
|
const { exists, render: render2 } = useSchemaInitializer(schema3["x-initializer"]);
|
|
33310
33380
|
const columns = (_a = schema3.reduceProperties((buf, s2) => {
|
|
33311
|
-
if (isColumnComponent$2(s2) && schemaInWhitelist(Object.values(s2.properties || {}).pop()
|
|
33381
|
+
if (isColumnComponent$2(s2) && schemaInWhitelist(Object.values(s2.properties || {}).pop())) {
|
|
33312
33382
|
return buf.concat([s2]);
|
|
33313
33383
|
}
|
|
33314
33384
|
return buf;
|
|
@@ -43731,7 +43801,7 @@ const HeaderMenu = ({
|
|
|
43731
43801
|
key: "x-designer-button",
|
|
43732
43802
|
disabled: true,
|
|
43733
43803
|
style: { padding: "0 8px", order: 9999 },
|
|
43734
|
-
label: render2({ style: { background: "none" } }),
|
|
43804
|
+
label: render2({ "data-testid": "add-menu-item-button-in-header", style: { background: "none" } }),
|
|
43735
43805
|
notdelete: true
|
|
43736
43806
|
};
|
|
43737
43807
|
const result = getMenuItems(() => {
|
|
@@ -43811,6 +43881,7 @@ const SideMenu = ({
|
|
|
43811
43881
|
key: "x-designer-button",
|
|
43812
43882
|
disabled: true,
|
|
43813
43883
|
label: render2({
|
|
43884
|
+
"data-testid": "add-menu-item-button-in-side",
|
|
43814
43885
|
insert: (s2) => {
|
|
43815
43886
|
const dn = createDesignable({
|
|
43816
43887
|
t,
|
|
@@ -50874,7 +50945,7 @@ const number = {
|
|
|
50874
50945
|
}
|
|
50875
50946
|
}
|
|
50876
50947
|
},
|
|
50877
|
-
availableTypes: ["double"],
|
|
50948
|
+
availableTypes: ["double", "float"],
|
|
50878
50949
|
hasDefaultValue: true,
|
|
50879
50950
|
properties: __spreadProps(__spreadValues({}, defaultProps), {
|
|
50880
50951
|
unique,
|
|
@@ -53833,6 +53904,22 @@ const AddFieldAction = (props) => {
|
|
|
53833
53904
|
if (option.children.length === 0) {
|
|
53834
53905
|
return null;
|
|
53835
53906
|
}
|
|
53907
|
+
if (record.template === "view") {
|
|
53908
|
+
return {
|
|
53909
|
+
type: "group",
|
|
53910
|
+
label: compile2(option.label),
|
|
53911
|
+
title: compile2(option.label),
|
|
53912
|
+
key: option.label,
|
|
53913
|
+
children: option.children.filter((child) => ["m2o"].includes(child.name)).map((child) => {
|
|
53914
|
+
return {
|
|
53915
|
+
label: compile2(child.title),
|
|
53916
|
+
title: compile2(child.title),
|
|
53917
|
+
key: child.name,
|
|
53918
|
+
dataTargetScope: child.targetScope
|
|
53919
|
+
};
|
|
53920
|
+
})
|
|
53921
|
+
};
|
|
53922
|
+
}
|
|
53836
53923
|
return {
|
|
53837
53924
|
type: "group",
|
|
53838
53925
|
label: compile2(option.label),
|
|
@@ -53847,7 +53934,7 @@ const AddFieldAction = (props) => {
|
|
|
53847
53934
|
};
|
|
53848
53935
|
})
|
|
53849
53936
|
};
|
|
53850
|
-
});
|
|
53937
|
+
}).filter((v) => v.children.length);
|
|
53851
53938
|
}, [getFieldOptions]);
|
|
53852
53939
|
const menu = useMemo(() => {
|
|
53853
53940
|
return {
|
|
@@ -53867,7 +53954,7 @@ const AddFieldAction = (props) => {
|
|
|
53867
53954
|
items: items2
|
|
53868
53955
|
};
|
|
53869
53956
|
}, [getInterface, items2, record]);
|
|
53870
|
-
return
|
|
53957
|
+
return /* @__PURE__ */ jsx(RecordProvider, { record, children: /* @__PURE__ */ jsxs(ActionContextProvider, { value: { visible, setVisible }, children: [
|
|
53871
53958
|
/* @__PURE__ */ jsx(Dropdown, { getPopupContainer: getContainer, trigger, align, menu, children: children || /* @__PURE__ */ jsx(Button, { icon: /* @__PURE__ */ jsx(PlusOutlined, {}), type: "primary", children: t("Add field") }) }),
|
|
53872
53959
|
/* @__PURE__ */ jsx(
|
|
53873
53960
|
SchemaComponent,
|
|
@@ -55095,9 +55182,9 @@ const CollectionFields = () => {
|
|
|
55095
55182
|
groups2.pf.push(field2);
|
|
55096
55183
|
} else if (field2.interface) {
|
|
55097
55184
|
const conf = getInterface(field2.interface);
|
|
55098
|
-
if (conf.group === "systemInfo") {
|
|
55185
|
+
if ((conf == null ? void 0 : conf.group) === "systemInfo") {
|
|
55099
55186
|
groups2.system.push(field2);
|
|
55100
|
-
} else if (conf.group === "relation") {
|
|
55187
|
+
} else if ((conf == null ? void 0 : conf.group) === "relation") {
|
|
55101
55188
|
groups2.association.push(field2);
|
|
55102
55189
|
} else {
|
|
55103
55190
|
groups2.general.push(field2);
|
|
@@ -55172,7 +55259,6 @@ const CollectionFields = () => {
|
|
|
55172
55259
|
);
|
|
55173
55260
|
const addProps = { type: "primary", database };
|
|
55174
55261
|
const syncProps = { type: "primary" };
|
|
55175
|
-
console.log(dataSource2);
|
|
55176
55262
|
return /* @__PURE__ */ jsx(ResourceActionProvider, __spreadProps(__spreadValues({}, resourceActionProps), { children: /* @__PURE__ */ jsx(FormContext.Provider, { value: form, children: /* @__PURE__ */ jsxs(FieldContext.Provider, { value: f, children: [
|
|
55177
55263
|
/* @__PURE__ */ jsxs(
|
|
55178
55264
|
Space$1,
|
|
@@ -57086,7 +57172,7 @@ const useAssociation = (props) => {
|
|
|
57086
57172
|
};
|
|
57087
57173
|
const useResource = (props) => {
|
|
57088
57174
|
var _a;
|
|
57089
|
-
const { block, resource, useSourceId } = props;
|
|
57175
|
+
const { block, collection: collection2, resource, useSourceId } = props;
|
|
57090
57176
|
const record = useRecord();
|
|
57091
57177
|
const api = useAPIClient();
|
|
57092
57178
|
const { fieldSchema } = useActionContext();
|
|
@@ -57114,7 +57200,10 @@ const useResource = (props) => {
|
|
|
57114
57200
|
if (sourceId) {
|
|
57115
57201
|
return api.resource(resource, sourceId);
|
|
57116
57202
|
}
|
|
57117
|
-
|
|
57203
|
+
if (record[(association == null ? void 0 : association.sourceKey) || "id"]) {
|
|
57204
|
+
return api.resource(resource, record[(association == null ? void 0 : association.sourceKey) || "id"]);
|
|
57205
|
+
}
|
|
57206
|
+
return api.resource(collection2);
|
|
57118
57207
|
};
|
|
57119
57208
|
const useActionParams = (props) => {
|
|
57120
57209
|
const { useParams: useParams2 } = props;
|
|
@@ -57501,6 +57590,7 @@ const useResourceName = () => {
|
|
|
57501
57590
|
function useACLRoleContext() {
|
|
57502
57591
|
const { data, getActionAlias, inResources, getResourceActionParams, getStrategyActionParams } = useACLRolesCheck();
|
|
57503
57592
|
const allowedActions = useAllowedActions();
|
|
57593
|
+
const { getCollectionJoinField } = useCollectionManager();
|
|
57504
57594
|
const verifyScope = (actionName, recordPkValue) => {
|
|
57505
57595
|
const actionAlias = getActionAlias(actionName);
|
|
57506
57596
|
if (!Array.isArray(allowedActions == null ? void 0 : allowedActions[actionAlias])) {
|
|
@@ -57510,7 +57600,9 @@ function useACLRoleContext() {
|
|
|
57510
57600
|
};
|
|
57511
57601
|
return __spreadProps(__spreadValues({}, data), {
|
|
57512
57602
|
parseAction: (actionPath, options = {}) => {
|
|
57603
|
+
var _a;
|
|
57513
57604
|
const [resourceName, actionName] = actionPath.split(":");
|
|
57605
|
+
const targetResource = (resourceName == null ? void 0 : resourceName.includes(".")) && ((_a = getCollectionJoinField(resourceName)) == null ? void 0 : _a.target);
|
|
57514
57606
|
if (!getIgnoreScope(options)) {
|
|
57515
57607
|
const r = verifyScope(actionName, options.recordPkValue);
|
|
57516
57608
|
if (r !== null) {
|
|
@@ -57520,6 +57612,9 @@ function useACLRoleContext() {
|
|
|
57520
57612
|
if (data == null ? void 0 : data.allowAll) {
|
|
57521
57613
|
return {};
|
|
57522
57614
|
}
|
|
57615
|
+
if (inResources(targetResource)) {
|
|
57616
|
+
return getResourceActionParams(`${targetResource}:${actionName}`);
|
|
57617
|
+
}
|
|
57523
57618
|
if (inResources(resourceName)) {
|
|
57524
57619
|
return getResourceActionParams(actionPath);
|
|
57525
57620
|
}
|
|
@@ -57533,7 +57628,7 @@ const ACLCollectionProvider = (props) => {
|
|
|
57533
57628
|
if (allowAll) {
|
|
57534
57629
|
return props.children;
|
|
57535
57630
|
}
|
|
57536
|
-
const actionPath = schema3 == null ? void 0 : schema3["x-acl-action"];
|
|
57631
|
+
const actionPath = (schema3 == null ? void 0 : schema3["x-acl-action"]) || props.actionPath;
|
|
57537
57632
|
if (!actionPath) {
|
|
57538
57633
|
return props.children;
|
|
57539
57634
|
}
|
|
@@ -57541,6 +57636,8 @@ const ACLCollectionProvider = (props) => {
|
|
|
57541
57636
|
if (!params) {
|
|
57542
57637
|
return null;
|
|
57543
57638
|
}
|
|
57639
|
+
const [_2, actionName] = actionPath.split(":");
|
|
57640
|
+
params.actionName = actionName;
|
|
57544
57641
|
return /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: params, children: props.children });
|
|
57545
57642
|
};
|
|
57546
57643
|
const useACLActionParamsContext = () => {
|
|
@@ -57601,7 +57698,8 @@ const ACLCollectionFieldProvider = (props) => {
|
|
|
57601
57698
|
const field = useField();
|
|
57602
57699
|
const { allowAll } = useACLRoleContext();
|
|
57603
57700
|
const { whitelist } = useACLFieldWhitelist();
|
|
57604
|
-
const
|
|
57701
|
+
const [name] = fieldSchema.name.split(".");
|
|
57702
|
+
const allowed = !fieldSchema["x-acl-ignore"] && whitelist.length > 0 ? whitelist.includes(name) : true;
|
|
57605
57703
|
useEffect(() => {
|
|
57606
57704
|
if (!allowed) {
|
|
57607
57705
|
field.required = false;
|
|
@@ -59465,6 +59563,7 @@ const PluginManagerLink = () => {
|
|
|
59465
59563
|
return /* @__PURE__ */ jsx(Tooltip$1, { title: t("Plugin manager"), children: /* @__PURE__ */ jsx(
|
|
59466
59564
|
Button,
|
|
59467
59565
|
{
|
|
59566
|
+
"data-testid": "pm-button",
|
|
59468
59567
|
icon: /* @__PURE__ */ jsx(ApiOutlined, {}),
|
|
59469
59568
|
title: t("Plugin manager"),
|
|
59470
59569
|
onClick: () => {
|