@nocobase/client 1.9.0-beta.11 → 1.9.0-beta.13
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/block-provider/hooks/index.d.ts +2 -1
- package/es/index.mjs +94 -67
- package/es/schema-component/antd/upload/shared.d.ts +1 -1
- package/lib/index.js +56 -56
- package/lib/locale/zh-CN.js +0 -38
- package/package.json +5 -5
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
+
import { Form } from '@formily/core';
|
|
9
10
|
import { ChangeEvent } from 'react';
|
|
10
11
|
import { NavigateFunction } from 'react-router-dom';
|
|
11
12
|
import { CollectionOptions } from '../../collection-manager';
|
|
@@ -26,7 +27,7 @@ export declare function getFormValues({ filterByTk, field, form, fieldNames, get
|
|
|
26
27
|
resource: any;
|
|
27
28
|
actionFields: any[];
|
|
28
29
|
}): any;
|
|
29
|
-
export declare function useCollectValuesToSubmit(): () => Promise<any>;
|
|
30
|
+
export declare function useCollectValuesToSubmit(f?: Form): () => Promise<any>;
|
|
30
31
|
export declare const useCreateActionProps: () => {
|
|
31
32
|
onClick(): Promise<void>;
|
|
32
33
|
};
|
package/es/index.mjs
CHANGED
|
@@ -8850,7 +8850,7 @@ function addAppVersion(e, t) {
|
|
|
8850
8850
|
addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
|
|
8851
8851
|
}), e;
|
|
8852
8852
|
}
|
|
8853
|
-
const name = "@nocobase/client", version = "1.9.0-beta.
|
|
8853
|
+
const name = "@nocobase/client", version = "1.9.0-beta.13", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
8854
8854
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
8855
8855
|
"@ant-design/cssinjs": "^1.11.1",
|
|
8856
8856
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -8871,9 +8871,9 @@ const name = "@nocobase/client", version = "1.9.0-beta.11", license = "AGPL-3.0"
|
|
|
8871
8871
|
"@formily/reactive-react": "^2.2.27",
|
|
8872
8872
|
"@formily/shared": "^2.2.27",
|
|
8873
8873
|
"@formily/validator": "^2.2.27",
|
|
8874
|
-
"@nocobase/evaluators": "1.9.0-beta.
|
|
8875
|
-
"@nocobase/sdk": "1.9.0-beta.
|
|
8876
|
-
"@nocobase/utils": "1.9.0-beta.
|
|
8874
|
+
"@nocobase/evaluators": "1.9.0-beta.13",
|
|
8875
|
+
"@nocobase/sdk": "1.9.0-beta.13",
|
|
8876
|
+
"@nocobase/utils": "1.9.0-beta.13",
|
|
8877
8877
|
ahooks: "^3.7.2",
|
|
8878
8878
|
antd: "5.24.2",
|
|
8879
8879
|
"antd-style": "3.7.1",
|
|
@@ -29456,46 +29456,46 @@ function getFormValues({
|
|
|
29456
29456
|
}
|
|
29457
29457
|
return getFilteredFormValues(n);
|
|
29458
29458
|
}
|
|
29459
|
-
function useCollectValuesToSubmit() {
|
|
29460
|
-
const
|
|
29459
|
+
function useCollectValuesToSubmit(e) {
|
|
29460
|
+
const t = useForm(), n = e != null ? e : t, o = useFilterByTk(), { field: r, resource: a } = useBlockRequestContext(), { fields: i, getField: l, getTreeParentField: c, name: u } = useCollection_deprecated(), d = i.map((b) => b.name), { fieldSchema: p } = useActionContext(), { getActiveFieldsName: m } = useFormActiveFields() || {}, h = useVariables$1(), g = useLocalVariables$1({ currentForm: n }), f = useFieldSchema(), C = useTreeParentRecord();
|
|
29461
29461
|
return useCallback(() => q(this, null, function* () {
|
|
29462
|
-
var
|
|
29463
|
-
const { assignedValues:
|
|
29464
|
-
filterByTk:
|
|
29465
|
-
field:
|
|
29466
|
-
form:
|
|
29467
|
-
fieldNames:
|
|
29468
|
-
getField:
|
|
29469
|
-
resource:
|
|
29470
|
-
actionFields: (
|
|
29471
|
-
}),
|
|
29472
|
-
const
|
|
29473
|
-
if (isVariable$1(
|
|
29474
|
-
const { value:
|
|
29475
|
-
|
|
29462
|
+
var R, T, D, B;
|
|
29463
|
+
const { assignedValues: b = {}, overwriteValues: S } = (R = f == null ? void 0 : f["x-action-settings"]) != null ? R : {}, y = getFormValues({
|
|
29464
|
+
filterByTk: o,
|
|
29465
|
+
field: r,
|
|
29466
|
+
form: n,
|
|
29467
|
+
fieldNames: d,
|
|
29468
|
+
getField: l,
|
|
29469
|
+
resource: a,
|
|
29470
|
+
actionFields: (m == null ? void 0 : m("form")) || []
|
|
29471
|
+
}), v = {}, I = Object.keys(b).map((N) => q(this, null, function* () {
|
|
29472
|
+
const M = b[N], j = l(N);
|
|
29473
|
+
if (isVariable$1(M)) {
|
|
29474
|
+
const { value: w } = (yield h == null ? void 0 : h.parseVariable(M, g)) || {};
|
|
29475
|
+
v[N] = transformVariableValue(w, { targetCollectionField: j });
|
|
29476
29476
|
} else
|
|
29477
|
-
|
|
29477
|
+
M !== "" && (v[N] = M);
|
|
29478
29478
|
}));
|
|
29479
|
-
if (yield Promise.all(
|
|
29480
|
-
const
|
|
29481
|
-
|
|
29479
|
+
if (yield Promise.all(I), (T = p == null ? void 0 : p["x-component-props"]) == null ? void 0 : T.addChild) {
|
|
29480
|
+
const N = c();
|
|
29481
|
+
y[(D = N == null ? void 0 : N.name) != null ? D : "parent"] = C, y[(B = N == null ? void 0 : N.foreignKey) != null ? B : "parentId"] = C == null ? void 0 : C.id;
|
|
29482
29482
|
}
|
|
29483
|
-
return x(x(x({},
|
|
29483
|
+
return x(x(x({}, y), S), v);
|
|
29484
29484
|
}), [
|
|
29485
|
-
|
|
29486
|
-
|
|
29487
|
-
c,
|
|
29488
|
-
u,
|
|
29489
|
-
t,
|
|
29490
|
-
e,
|
|
29485
|
+
f,
|
|
29486
|
+
r,
|
|
29491
29487
|
d,
|
|
29492
|
-
|
|
29493
|
-
|
|
29488
|
+
p,
|
|
29489
|
+
o,
|
|
29490
|
+
n,
|
|
29494
29491
|
m,
|
|
29495
29492
|
l,
|
|
29496
|
-
|
|
29493
|
+
c,
|
|
29497
29494
|
g,
|
|
29498
|
-
|
|
29495
|
+
u,
|
|
29496
|
+
a,
|
|
29497
|
+
C,
|
|
29498
|
+
h
|
|
29499
29499
|
]);
|
|
29500
29500
|
}
|
|
29501
29501
|
const useCreateActionProps = () => {
|
|
@@ -31089,7 +31089,7 @@ const DragHandler = (e) => {
|
|
|
31089
31089
|
open: i,
|
|
31090
31090
|
onDropdownVisibleChange: l
|
|
31091
31091
|
}, e), {
|
|
31092
|
-
allowClear: !
|
|
31092
|
+
allowClear: !1,
|
|
31093
31093
|
style: {
|
|
31094
31094
|
width: "100%",
|
|
31095
31095
|
minWidth: 100,
|
|
@@ -31909,7 +31909,7 @@ const useParseDefaultValue = () => {
|
|
|
31909
31909
|
const j = transformVariableValue(B, {
|
|
31910
31910
|
targetCollectionField: D
|
|
31911
31911
|
});
|
|
31912
|
-
j == null || j === "" ? e.mounted && (e.setInitialValue(void 0), e.setValue(void 0)) : p() ? h === 0 && m(j) : e.setInitialValue(j), e.loading = !1;
|
|
31912
|
+
j == null || j === "" ? e.mounted && (e.setInitialValue(void 0), e.setValue(void 0)) : p() ? h === 0 && m(j) : (e.setInitialValue(j), e.setValue(j)), e.loading = !1;
|
|
31913
31913
|
} else
|
|
31914
31914
|
!/\{\{.+\}\}/g.test(t.default) && e.setInitialValue && e.setInitialValue(t.default);
|
|
31915
31915
|
}), v = _.debounce(y, DEBOUNCE_WAIT);
|
|
@@ -43189,7 +43189,7 @@ const className1 = css`
|
|
|
43189
43189
|
onClick: () => q(void 0, null, function* () {
|
|
43190
43190
|
const I = yield FormDialog(
|
|
43191
43191
|
o("Add tab"),
|
|
43192
|
-
() => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: p.scope, components: x({}, p.components), children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(
|
|
43192
|
+
() => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: p.scope, components: x({}, p.components), children: /* @__PURE__ */ jsx(FormLayout, { layout: "vertical", children: /* @__PURE__ */ jsx(zIndexContext.Provider, { value: ICON_POPUP_Z_INDEX, children: /* @__PURE__ */ jsx(
|
|
43193
43193
|
SchemaComponent,
|
|
43194
43194
|
{
|
|
43195
43195
|
schema: {
|
|
@@ -43208,7 +43208,7 @@ const className1 = css`
|
|
|
43208
43208
|
}
|
|
43209
43209
|
}
|
|
43210
43210
|
}
|
|
43211
|
-
) }) }),
|
|
43211
|
+
) }) }) }),
|
|
43212
43212
|
m
|
|
43213
43213
|
).open({
|
|
43214
43214
|
initialValues: {}
|
|
@@ -44034,9 +44034,18 @@ function validate(e, t) {
|
|
|
44034
44034
|
function useBeforeUpload(e) {
|
|
44035
44035
|
const { t } = useTranslation();
|
|
44036
44036
|
return useCallback(
|
|
44037
|
-
(n) => {
|
|
44038
|
-
|
|
44039
|
-
|
|
44037
|
+
(n, o) => {
|
|
44038
|
+
var i, l;
|
|
44039
|
+
let r = n;
|
|
44040
|
+
if (!n.type) {
|
|
44041
|
+
const c = (l = (i = n.name) == null ? void 0 : i.match(/\.[^.]+$/)) == null ? void 0 : l[0];
|
|
44042
|
+
c && (r = new File([n], n.name, {
|
|
44043
|
+
type: mime.getType(c) || "application/octet-stream",
|
|
44044
|
+
lastModified: n.lastModified
|
|
44045
|
+
}));
|
|
44046
|
+
}
|
|
44047
|
+
const a = validate(r, e);
|
|
44048
|
+
return a ? (r.status = "error", r.response = t(a)) : r.status === "error" && (delete r.status, delete r.response), a ? !1 : r;
|
|
44040
44049
|
},
|
|
44041
44050
|
[e]
|
|
44042
44051
|
);
|
|
@@ -44151,38 +44160,56 @@ attachmentFileTypes.add({
|
|
|
44151
44160
|
return e.preview ? e.preview : e.url ? e.url : e.originFileObj ? URL.createObjectURL(e.originFileObj) : null;
|
|
44152
44161
|
},
|
|
44153
44162
|
Previewer({ index: e, list: t, onSwitchIndex: n }) {
|
|
44154
|
-
var
|
|
44155
|
-
const [o, r] = useState(0), a = useCallback(
|
|
44156
|
-
(
|
|
44157
|
-
|
|
44158
|
-
|
|
44159
|
-
|
|
44163
|
+
var p, m, h, g;
|
|
44164
|
+
const [o, r] = useState(0), a = useRef(!1), i = () => document.querySelector(".ril-image-current"), l = useCallback((f, C) => {
|
|
44165
|
+
if (!f)
|
|
44166
|
+
return;
|
|
44167
|
+
const b = f.style.transform || "", y = `${b.replace(/rotate\([^)]*\)/g, "").trim()} rotate(${(C % 360 + 360) % 360}deg)`.trim();
|
|
44168
|
+
b !== y && (a.current = !0, f.style.transform = y, f.style.transformOrigin = "center center", setTimeout(() => {
|
|
44169
|
+
a.current = !1;
|
|
44170
|
+
}, 0));
|
|
44171
|
+
}, []), c = useCallback(
|
|
44172
|
+
(f) => {
|
|
44173
|
+
f.preventDefault();
|
|
44174
|
+
const C = t[e];
|
|
44175
|
+
saveAs(C.url, `${C.title}${C.extname}`);
|
|
44160
44176
|
},
|
|
44161
44177
|
[e, t]
|
|
44162
|
-
),
|
|
44163
|
-
r((
|
|
44164
|
-
}, []),
|
|
44165
|
-
r((
|
|
44178
|
+
), u = useCallback(() => {
|
|
44179
|
+
r((f) => (f - 90) % 360);
|
|
44180
|
+
}, []), d = useCallback(() => {
|
|
44181
|
+
r((f) => (f + 90) % 360);
|
|
44166
44182
|
}, []);
|
|
44167
44183
|
return useEffect(() => {
|
|
44168
|
-
|
|
44169
|
-
|
|
44184
|
+
l(i(), o);
|
|
44185
|
+
}, [o, l]), useEffect(() => {
|
|
44186
|
+
const f = i();
|
|
44187
|
+
if (!f)
|
|
44170
44188
|
return;
|
|
44171
|
-
|
|
44172
|
-
const
|
|
44173
|
-
|
|
44174
|
-
|
|
44189
|
+
l(f, o);
|
|
44190
|
+
const C = new MutationObserver((b) => {
|
|
44191
|
+
a.current || b.some((S) => S.attributeName === "style") && l(f, o);
|
|
44192
|
+
});
|
|
44193
|
+
return C.observe(f, { attributes: !0, attributeFilter: ["style"] }), () => C.disconnect();
|
|
44194
|
+
}, [l, o, e]), /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
44175
44195
|
/* @__PURE__ */ jsx(LightBoxGlobalStyle, {}),
|
|
44176
44196
|
/* @__PURE__ */ jsx(
|
|
44177
44197
|
LightBox,
|
|
44178
44198
|
{
|
|
44179
|
-
mainSrc: (
|
|
44180
|
-
nextSrc: (
|
|
44181
|
-
prevSrc: (
|
|
44199
|
+
mainSrc: (p = t[e]) == null ? void 0 : p.url,
|
|
44200
|
+
nextSrc: (m = t[(e + 1) % t.length]) == null ? void 0 : m.url,
|
|
44201
|
+
prevSrc: (h = t[(e + t.length - 1) % t.length]) == null ? void 0 : h.url,
|
|
44182
44202
|
onCloseRequest: () => n(null),
|
|
44183
|
-
onMovePrevRequest: () =>
|
|
44184
|
-
|
|
44185
|
-
|
|
44203
|
+
onMovePrevRequest: () => {
|
|
44204
|
+
r(0), n((e + t.length - 1) % t.length);
|
|
44205
|
+
},
|
|
44206
|
+
onMoveNextRequest: () => {
|
|
44207
|
+
r(0), n((e + 1) % t.length);
|
|
44208
|
+
},
|
|
44209
|
+
onAfterOpen: () => {
|
|
44210
|
+
l(i(), o);
|
|
44211
|
+
},
|
|
44212
|
+
imageTitle: (g = t[e]) == null ? void 0 : g.title,
|
|
44186
44213
|
toolbarButtons: [
|
|
44187
44214
|
/* @__PURE__ */ jsx(
|
|
44188
44215
|
"button",
|
|
@@ -44192,7 +44219,7 @@ attachmentFileTypes.add({
|
|
|
44192
44219
|
title: "Download",
|
|
44193
44220
|
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
44194
44221
|
style: { fontSize: 22, background: "none", lineHeight: 1 },
|
|
44195
|
-
onClick:
|
|
44222
|
+
onClick: c,
|
|
44196
44223
|
children: /* @__PURE__ */ jsx(DownloadOutlined, {})
|
|
44197
44224
|
},
|
|
44198
44225
|
"preview-img"
|
|
@@ -44203,7 +44230,7 @@ attachmentFileTypes.add({
|
|
|
44203
44230
|
type: "button",
|
|
44204
44231
|
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
44205
44232
|
style: { fontSize: 22, background: "none", lineHeight: 1 },
|
|
44206
|
-
onClick:
|
|
44233
|
+
onClick: u,
|
|
44207
44234
|
children: /* @__PURE__ */ jsx(UndoOutlined, {})
|
|
44208
44235
|
},
|
|
44209
44236
|
"rotate-left"
|
|
@@ -44214,7 +44241,7 @@ attachmentFileTypes.add({
|
|
|
44214
44241
|
type: "button",
|
|
44215
44242
|
className: "ril-zoom-in ril__toolbarItemChild ril__builtinButton",
|
|
44216
44243
|
style: { fontSize: 22, background: "none", lineHeight: 1 },
|
|
44217
|
-
onClick:
|
|
44244
|
+
onClick: d,
|
|
44218
44245
|
children: /* @__PURE__ */ jsx(RedoOutlined, {})
|
|
44219
44246
|
},
|
|
44220
44247
|
"rotate-right"
|
|
@@ -87,4 +87,4 @@ export declare function toValueItem(data: any): any;
|
|
|
87
87
|
export declare const toItem: (file: any) => any;
|
|
88
88
|
export declare const toFileList: (fileList: any) => any[];
|
|
89
89
|
export declare function validate(file: any, rules: Record<string, any>): string;
|
|
90
|
-
export declare function useBeforeUpload(rules: any): (file: any) =>
|
|
90
|
+
export declare function useBeforeUpload(rules: any): (file: any, fileList: any) => any;
|