@nocobase/client 1.0.1-alpha.3 → 1.2.1-alpha
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.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export * from './testUtils';
|
|
|
54
54
|
export * from './user';
|
|
55
55
|
export * from './variables';
|
|
56
56
|
export { withDynamicSchemaProps } from './hoc/withDynamicSchemaProps';
|
|
57
|
+
export { SchemaSettingsActionLinkItem } from './modules/actions/link/customizeLinkActionSettings';
|
|
57
58
|
export * from './modules/blocks/BlockSchemaToolbar';
|
|
58
59
|
export * from './modules/blocks/data-blocks/form';
|
|
59
60
|
export * from './modules/blocks/data-blocks/table';
|
package/es/index.mjs
CHANGED
|
@@ -1938,6 +1938,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1938
1938
|
get SchemaSettings() {
|
|
1939
1939
|
return SchemaSettings;
|
|
1940
1940
|
},
|
|
1941
|
+
get SchemaSettingsActionLinkItem() {
|
|
1942
|
+
return SchemaSettingsActionLinkItem;
|
|
1943
|
+
},
|
|
1941
1944
|
get SchemaSettingsActionModalItem() {
|
|
1942
1945
|
return SchemaSettingsActionModalItem;
|
|
1943
1946
|
},
|
|
@@ -3899,7 +3902,7 @@ function addAppVersion(e, t) {
|
|
|
3899
3902
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
3900
3903
|
}), e;
|
|
3901
3904
|
}
|
|
3902
|
-
const name = "@nocobase/client", version$1 = "1.
|
|
3905
|
+
const name = "@nocobase/client", version$1 = "1.2.1-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
3903
3906
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
3904
3907
|
"@ant-design/cssinjs": "^1.11.1",
|
|
3905
3908
|
"@ant-design/icons": "^5.1.4",
|
|
@@ -3920,9 +3923,9 @@ const name = "@nocobase/client", version$1 = "1.0.1-alpha.3", license = "AGPL-3.
|
|
|
3920
3923
|
"@formily/reactive-react": "^2.2.27",
|
|
3921
3924
|
"@formily/shared": "^2.2.27",
|
|
3922
3925
|
"@formily/validator": "^2.2.27",
|
|
3923
|
-
"@nocobase/evaluators": "1.
|
|
3924
|
-
"@nocobase/sdk": "1.
|
|
3925
|
-
"@nocobase/utils": "1.
|
|
3926
|
+
"@nocobase/evaluators": "1.2.1-alpha",
|
|
3927
|
+
"@nocobase/sdk": "1.2.1-alpha",
|
|
3928
|
+
"@nocobase/utils": "1.2.1-alpha",
|
|
3926
3929
|
ahooks: "^3.7.2",
|
|
3927
3930
|
antd: "^5.12.8",
|
|
3928
3931
|
"antd-style": "3.4.5",
|
|
@@ -3942,6 +3945,7 @@ const name = "@nocobase/client", version$1 = "1.0.1-alpha.3", license = "AGPL-3.
|
|
|
3942
3945
|
"markdown-it-highlightjs": "3.3.1",
|
|
3943
3946
|
mathjs: "^10.6.0",
|
|
3944
3947
|
mermaid: "9.4.3",
|
|
3948
|
+
"mime-match": "^1.0.2",
|
|
3945
3949
|
"react-beautiful-dnd": "^13.1.0",
|
|
3946
3950
|
"react-drag-listview": "^0.1.9",
|
|
3947
3951
|
"react-error-boundary": "^4.0.10",
|
|
@@ -17992,7 +17996,7 @@ const DynamicComponent$1 = (e) => {
|
|
|
17992
17996
|
});
|
|
17993
17997
|
},
|
|
17994
17998
|
[r, i, n]
|
|
17995
|
-
), C = useMemo(() => ({ minWidth: 460
|
|
17999
|
+
), C = useMemo(() => ({ minWidth: 460 }), []), S = useMemo(() => p(d, {
|
|
17996
18000
|
value: t == null ? void 0 : t.value
|
|
17997
18001
|
}), [p, t == null ? void 0 : t.value, d]), b = {
|
|
17998
18002
|
// 常量
|
|
@@ -18030,7 +18034,7 @@ const DynamicComponent$1 = (e) => {
|
|
|
18030
18034
|
value: i,
|
|
18031
18035
|
style: { width: 150 },
|
|
18032
18036
|
onChange: (y) => {
|
|
18033
|
-
|
|
18037
|
+
a(y), n({
|
|
18034
18038
|
mode: y
|
|
18035
18039
|
});
|
|
18036
18040
|
},
|
|
@@ -20615,7 +20619,7 @@ const createSubmitActionSettings = new SchemaSettings({
|
|
|
20615
20619
|
e.data = e.data || {}, e.display = "visible", e.disabled = !1, e.data.hidden = !1, e.componentProps.disabled = !1;
|
|
20616
20620
|
}, MenuGroup = (e) => e.children;
|
|
20617
20621
|
function ButtonEditor$1(e) {
|
|
20618
|
-
var a, l, c;
|
|
20622
|
+
var a, l, c, u;
|
|
20619
20623
|
const t = useField(), o = useFieldSchema(), { dn: n } = useDesignable(), { t: r } = useTranslation(), i = (e == null ? void 0 : e.isLink) || o["x-component"] === "Action.Link";
|
|
20620
20624
|
return /* @__PURE__ */ jsx(
|
|
20621
20625
|
SchemaSettingsModalItem,
|
|
@@ -20642,25 +20646,33 @@ function ButtonEditor$1(e) {
|
|
|
20642
20646
|
"x-visible": !i
|
|
20643
20647
|
// description: `原字段标题:${collectionField?.uiSchema?.title}`,
|
|
20644
20648
|
},
|
|
20649
|
+
iconColor: {
|
|
20650
|
+
title: r("Color"),
|
|
20651
|
+
required: !0,
|
|
20652
|
+
default: ((l = o == null ? void 0 : o["x-component-props"]) == null ? void 0 : l.iconColor) || "#1677FF",
|
|
20653
|
+
"x-hidden": !e.hasIconColor,
|
|
20654
|
+
"x-component": "ColorPicker",
|
|
20655
|
+
"x-decorator": "FormItem"
|
|
20656
|
+
},
|
|
20645
20657
|
type: {
|
|
20646
20658
|
"x-decorator": "FormItem",
|
|
20647
20659
|
"x-component": "Radio.Group",
|
|
20648
20660
|
title: r("Button background color"),
|
|
20649
|
-
default: (
|
|
20661
|
+
default: (c = o == null ? void 0 : o["x-component-props"]) != null && c.danger ? "danger" : ((u = o == null ? void 0 : o["x-component-props"]) == null ? void 0 : u.type) === "primary" ? "primary" : "default",
|
|
20650
20662
|
enum: [
|
|
20651
20663
|
{ value: "default", label: '{{t("Default")}}' },
|
|
20652
20664
|
{ value: "primary", label: '{{t("Highlight")}}' },
|
|
20653
20665
|
{ value: "danger", label: '{{t("Danger red")}}' }
|
|
20654
20666
|
],
|
|
20655
|
-
"x-visible": !i
|
|
20667
|
+
"x-visible": !e.hasIconColor && !i
|
|
20656
20668
|
}
|
|
20657
20669
|
}
|
|
20658
20670
|
},
|
|
20659
|
-
onSubmit: ({ title:
|
|
20660
|
-
o.title =
|
|
20671
|
+
onSubmit: ({ title: d, icon: p, type: m, iconColor: h }) => {
|
|
20672
|
+
o.title = d, t.title = d, t.componentProps.iconColor = h, t.componentProps.icon = p, t.componentProps.danger = m === "danger", t.componentProps.type = m || t.componentProps.type, o["x-component-props"] = o["x-component-props"] || {}, o["x-component-props"].iconColor = h, o["x-component-props"].icon = p, o["x-component-props"].danger = m === "danger", o["x-component-props"].type = m || t.componentProps.type, n.emit("patch", {
|
|
20661
20673
|
schema: {
|
|
20662
20674
|
"x-uid": o["x-uid"],
|
|
20663
|
-
title:
|
|
20675
|
+
title: d,
|
|
20664
20676
|
"x-component-props": g({}, o["x-component-props"])
|
|
20665
20677
|
}
|
|
20666
20678
|
}), n.refresh();
|
|
@@ -22053,13 +22065,13 @@ const useGetFilterOptions = () => {
|
|
|
22053
22065
|
}), d;
|
|
22054
22066
|
};
|
|
22055
22067
|
return a(e, 1);
|
|
22056
|
-
}, isEmpty = (e) => Array.isArray(e) && e.length === 0 || e && Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype, removeNullCondition = (e) => {
|
|
22057
|
-
const
|
|
22058
|
-
for (const
|
|
22059
|
-
const
|
|
22060
|
-
|
|
22068
|
+
}, isEmpty = (e) => Array.isArray(e) && e.length === 0 || e && Object.keys(e).length === 0 && Object.getPrototypeOf(e) === Object.prototype, removeNullCondition = (e, t = flat) => {
|
|
22069
|
+
const o = t(e || {}), n = {};
|
|
22070
|
+
for (const r in o) {
|
|
22071
|
+
const i = o[r];
|
|
22072
|
+
i != null && !isEmpty(i) && (n[r] = i);
|
|
22061
22073
|
}
|
|
22062
|
-
return
|
|
22074
|
+
return t.unflatten(n);
|
|
22063
22075
|
}, useFilterActionProps$1 = () => {
|
|
22064
22076
|
const { name: e } = useCollection_deprecated(), t = useFilterOptions(e), { service: o, props: n } = useBlockRequestContext();
|
|
22065
22077
|
return useFilterFieldProps({ options: t, service: o, params: n == null ? void 0 : n.params });
|
|
@@ -23483,45 +23495,47 @@ const useCreateActionProps = () => {
|
|
|
23483
23495
|
e = e.parent;
|
|
23484
23496
|
}
|
|
23485
23497
|
}, useDoFilter = () => {
|
|
23486
|
-
const e = useForm(), { getDataBlocks: t } = useFilterBlock(), { getCollectionJoinField: o } = useCollectionManager_deprecated(), { getOperators: n } = useOperators(), r = useFieldSchema(), { name: i } = useCollection(), { targets: a = [], uid: l } = useMemo(() => findFilterTargets(r), [r]), c = useCallback(
|
|
23487
|
-
(...
|
|
23498
|
+
const e = useForm(), { getDataBlocks: t } = useFilterBlock(), { getCollectionJoinField: o } = useCollectionManager_deprecated(), { getOperators: n } = useOperators(), r = useFieldSchema(), { name: i } = useCollection(), { targets: a = [], uid: l } = useMemo(() => findFilterTargets(r), [r]), c = useCallback(() => removeNullCondition(transformToFilter(e.values, n(), o, i)), [e.values, o, n, i]), u = useCallback(
|
|
23499
|
+
(...p) => V(void 0, [...p], function* ({ doNothingWhenFilterIsEmpty: d = !1 } = {}) {
|
|
23488
23500
|
try {
|
|
23489
23501
|
yield Promise.all(
|
|
23490
|
-
t().map((
|
|
23491
|
-
var
|
|
23492
|
-
if (!a.find((
|
|
23502
|
+
t().map((m) => V(void 0, null, function* () {
|
|
23503
|
+
var S, b, y;
|
|
23504
|
+
if (!a.find((v) => v.uid === m.uid))
|
|
23493
23505
|
return;
|
|
23494
|
-
const
|
|
23495
|
-
|
|
23496
|
-
|
|
23497
|
-
|
|
23498
|
-
|
|
23499
|
-
...Object.values(x).map((y) => removeNullCondition(y)),
|
|
23500
|
-
p.defaultFilter
|
|
23506
|
+
const x = ((S = m.service.params) == null ? void 0 : S[0]) || {}, f = ((y = (b = m.service.params) == null ? void 0 : b[1]) == null ? void 0 : y.filters) || {};
|
|
23507
|
+
f[l] = c();
|
|
23508
|
+
const C = mergeFilter([
|
|
23509
|
+
...Object.values(f).map((v) => removeNullCondition(v)),
|
|
23510
|
+
m.defaultFilter
|
|
23501
23511
|
]);
|
|
23502
|
-
if (!(
|
|
23503
|
-
return
|
|
23504
|
-
F(g({},
|
|
23512
|
+
if (!(d && _.isEmpty(f[l])))
|
|
23513
|
+
return m.dataLoadingMode === "manual" && _.isEmpty(f[l]) ? m.clearData() : m.doFilter(
|
|
23514
|
+
F(g({}, x), {
|
|
23505
23515
|
page: 1,
|
|
23506
|
-
filter:
|
|
23516
|
+
filter: C
|
|
23507
23517
|
}),
|
|
23508
|
-
{ filters:
|
|
23518
|
+
{ filters: f }
|
|
23509
23519
|
);
|
|
23510
23520
|
}))
|
|
23511
23521
|
);
|
|
23512
|
-
} catch (
|
|
23513
|
-
console.error(
|
|
23522
|
+
} catch (m) {
|
|
23523
|
+
console.error(m);
|
|
23514
23524
|
}
|
|
23515
23525
|
}),
|
|
23516
|
-
[
|
|
23526
|
+
[t, c, a, l]
|
|
23517
23527
|
);
|
|
23518
23528
|
return useEffect(() => {
|
|
23519
|
-
|
|
23529
|
+
u({ doNothingWhenFilterIsEmpty: !0 });
|
|
23520
23530
|
}, [t().length]), {
|
|
23521
23531
|
/**
|
|
23522
23532
|
* 用于执行筛选表单的筛选操作
|
|
23523
23533
|
*/
|
|
23524
|
-
doFilter:
|
|
23534
|
+
doFilter: u,
|
|
23535
|
+
/**
|
|
23536
|
+
* 根据当前表单的值获取 filter
|
|
23537
|
+
*/
|
|
23538
|
+
getFilterFromCurrentForm: c
|
|
23525
23539
|
};
|
|
23526
23540
|
}, useFilterBlockActionProps = () => {
|
|
23527
23541
|
const { doFilter: e } = useDoFilter(), t = useField();
|
|
@@ -23532,36 +23546,21 @@ const useCreateActionProps = () => {
|
|
|
23532
23546
|
});
|
|
23533
23547
|
}
|
|
23534
23548
|
};
|
|
23549
|
+
}, useDoReset = () => {
|
|
23550
|
+
const e = useForm(), t = useFieldSchema(), { getDataBlocks: o } = useFilterBlock(), { targets: n, uid: r } = findFilterTargets(t), { doFilter: i, getFilterFromCurrentForm: a } = useDoFilter();
|
|
23551
|
+
return {
|
|
23552
|
+
doReset: () => V(void 0, null, function* () {
|
|
23553
|
+
if (yield e.reset(), _.isEmpty(a()))
|
|
23554
|
+
return doReset({ getDataBlocks: o, targets: n, uid: r });
|
|
23555
|
+
yield i();
|
|
23556
|
+
})
|
|
23557
|
+
};
|
|
23535
23558
|
}, useResetBlockActionProps = () => {
|
|
23536
|
-
const e =
|
|
23537
|
-
return
|
|
23559
|
+
const e = useField(), { doReset: t } = useDoReset();
|
|
23560
|
+
return e.data = e.data || {}, {
|
|
23538
23561
|
onClick() {
|
|
23539
23562
|
return V(this, null, function* () {
|
|
23540
|
-
|
|
23541
|
-
e.reset(), t.data.loading = !0;
|
|
23542
|
-
try {
|
|
23543
|
-
yield Promise.all(
|
|
23544
|
-
n().map((l) => V(this, null, function* () {
|
|
23545
|
-
var m, h, x;
|
|
23546
|
-
if (!i.find((f) => f.uid === l.uid))
|
|
23547
|
-
return;
|
|
23548
|
-
if (l.dataLoadingMode === "manual")
|
|
23549
|
-
return l.clearData();
|
|
23550
|
-
const u = ((m = l.service.params) == null ? void 0 : m[0]) || {}, d = ((x = (h = l.service.params) == null ? void 0 : h[1]) == null ? void 0 : x.filters) || {};
|
|
23551
|
-
delete d[a];
|
|
23552
|
-
const p = mergeFilter([...Object.values(d), l.defaultFilter]);
|
|
23553
|
-
return l.doFilter(
|
|
23554
|
-
F(g({}, u), {
|
|
23555
|
-
page: 1,
|
|
23556
|
-
filter: p
|
|
23557
|
-
}),
|
|
23558
|
-
{ filters: d }
|
|
23559
|
-
);
|
|
23560
|
-
}))
|
|
23561
|
-
), t.data.loading = !1;
|
|
23562
|
-
} catch (l) {
|
|
23563
|
-
t.data.loading = !1;
|
|
23564
|
-
}
|
|
23563
|
+
e.data.loading = !0, yield t(), e.data.loading = !1;
|
|
23565
23564
|
});
|
|
23566
23565
|
}
|
|
23567
23566
|
};
|
|
@@ -24008,6 +24007,37 @@ const useCreateActionProps = () => {
|
|
|
24008
24007
|
labelKey: f
|
|
24009
24008
|
};
|
|
24010
24009
|
};
|
|
24010
|
+
function doReset(n) {
|
|
24011
|
+
return V(this, arguments, function* ({
|
|
24012
|
+
getDataBlocks: e,
|
|
24013
|
+
targets: t,
|
|
24014
|
+
uid: o
|
|
24015
|
+
}) {
|
|
24016
|
+
try {
|
|
24017
|
+
yield Promise.all(
|
|
24018
|
+
e().map((r) => V(this, null, function* () {
|
|
24019
|
+
var u, d, p;
|
|
24020
|
+
if (!t.find((m) => m.uid === r.uid))
|
|
24021
|
+
return;
|
|
24022
|
+
if (r.dataLoadingMode === "manual")
|
|
24023
|
+
return r.clearData();
|
|
24024
|
+
const a = ((u = r.service.params) == null ? void 0 : u[0]) || {}, l = ((p = (d = r.service.params) == null ? void 0 : d[1]) == null ? void 0 : p.filters) || {};
|
|
24025
|
+
delete l[o];
|
|
24026
|
+
const c = mergeFilter([...Object.values(l), r.defaultFilter]);
|
|
24027
|
+
return r.doFilter(
|
|
24028
|
+
F(g({}, a), {
|
|
24029
|
+
page: 1,
|
|
24030
|
+
filter: c
|
|
24031
|
+
}),
|
|
24032
|
+
{ filters: l }
|
|
24033
|
+
);
|
|
24034
|
+
}))
|
|
24035
|
+
);
|
|
24036
|
+
} catch (r) {
|
|
24037
|
+
console.error(r);
|
|
24038
|
+
}
|
|
24039
|
+
});
|
|
24040
|
+
}
|
|
24011
24041
|
function getAssociationPath(e) {
|
|
24012
24042
|
const t = e.lastIndexOf(".");
|
|
24013
24043
|
return t !== -1 ? e.substring(0, t) : e;
|
|
@@ -33550,7 +33580,7 @@ const useTableColumns$1 = (e) => {
|
|
|
33550
33580
|
const { setVisible: y } = useActionContext(), { selectedRows: v, setSelectedRows: I } = useContext(RecordPickerContext);
|
|
33551
33581
|
return {
|
|
33552
33582
|
onClick() {
|
|
33553
|
-
v.map((A) => o.value.push(
|
|
33583
|
+
v.map((A) => o.value.push(A)), o.onInput(o.value), I([]), y(!1);
|
|
33554
33584
|
}
|
|
33555
33585
|
};
|
|
33556
33586
|
}, b = () => {
|
|
@@ -56738,6 +56768,7 @@ export {
|
|
|
56738
56768
|
SchemaSettingItemContext,
|
|
56739
56769
|
SchemaSettingOpenModeSchemaItems,
|
|
56740
56770
|
SchemaSettings,
|
|
56771
|
+
SchemaSettingsActionLinkItem,
|
|
56741
56772
|
SchemaSettingsActionModalItem,
|
|
56742
56773
|
SchemaSettingsBlockHeightItem,
|
|
56743
56774
|
SchemaSettingsBlockTitleItem,
|
|
@@ -10,7 +10,7 @@ export declare const useGetFilterOptions: () => (collectionName: any, dataSource
|
|
|
10
10
|
export declare const useFilterOptions: (collectionName: string) => any[];
|
|
11
11
|
export declare const useGetFilterFieldOptions: () => (fields: any) => any[];
|
|
12
12
|
export declare const useFilterFieldOptions: (fields: any) => any[];
|
|
13
|
-
export declare const removeNullCondition: (filter: any) => any;
|
|
13
|
+
export declare const removeNullCondition: (filter: any, customFlat?: any) => any;
|
|
14
14
|
export declare const useFilterActionProps: () => {
|
|
15
15
|
options: any;
|
|
16
16
|
onSubmit(values: any): any;
|