@nocobase/client 1.9.30 → 1.9.32
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 +40 -30
- package/lib/index.js +58 -58
- package/package.json +5 -5
package/es/index.mjs
CHANGED
|
@@ -113,7 +113,7 @@ import { loadableResource } from "react-imported-component";
|
|
|
113
113
|
import ProLayout, { RouteContext, PageHeader } from "@ant-design/pro-layout";
|
|
114
114
|
import * as antdStyle from "antd-style";
|
|
115
115
|
import { createStyles, createGlobalStyle, useAntdToken } from "antd-style";
|
|
116
|
-
import { createStyles as
|
|
116
|
+
import { createStyles as wn } from "antd-style";
|
|
117
117
|
import * as dndKitCore from "@dnd-kit/core";
|
|
118
118
|
import { DndContext as DndContext$1, rectIntersection, DragOverlay, useDroppable, useDndContext, useDndMonitor, useDraggable } from "@dnd-kit/core";
|
|
119
119
|
import * as dndKitSortable from "@dnd-kit/sortable";
|
|
@@ -152,7 +152,6 @@ import useUploadStyle from "antd/es/upload/style";
|
|
|
152
152
|
import filesize from "filesize";
|
|
153
153
|
import LightBox from "react-image-lightbox";
|
|
154
154
|
import "react-image-lightbox/style.css";
|
|
155
|
-
import { renderToString } from "react-dom/server";
|
|
156
155
|
import sanitizeHTML from "sanitize-html";
|
|
157
156
|
import { Popup } from "antd-mobile";
|
|
158
157
|
import { CloseOutline } from "antd-mobile-icons";
|
|
@@ -6694,7 +6693,7 @@ const InternalFormBlockProvider = (e) => {
|
|
|
6694
6693
|
e = e.parent;
|
|
6695
6694
|
}
|
|
6696
6695
|
return null;
|
|
6697
|
-
}, REGEX_OF_VARIABLE = /^\s*\{\{\s*([\p{L}0-9_$-.]+?)\s*\}\}\s*$/u, REGEX_OF_VARIABLE_IN_EXPRESSION = /\{\{\s*([a-zA-Z0-9_$-.]+?)\s*\}\}/g, isVariable$1 = (e) => !(typeof e != "string" || !e.match(REGEX_OF_VARIABLE)), getVariablesFromExpression = (e) => {
|
|
6696
|
+
}, NAMESPACE_UI_SCHEMA = "ui-schema-storage", REGEX_OF_VARIABLE = /^\s*\{\{\s*([\p{L}0-9_$-.]+?)\s*\}\}\s*$/u, REGEX_OF_VARIABLE_IN_EXPRESSION = /\{\{\s*([a-zA-Z0-9_$-.]+?)\s*\}\}/g, isVariable$1 = (e) => !(typeof e != "string" || !e.match(REGEX_OF_VARIABLE)), getVariablesFromExpression = (e) => {
|
|
6698
6697
|
const t = e.match(REGEX_OF_VARIABLE_IN_EXPRESSION);
|
|
6699
6698
|
return t || [];
|
|
6700
6699
|
}, transformVariableValue = (e, t) => {
|
|
@@ -6857,7 +6856,7 @@ function withParams(e, t) {
|
|
|
6857
6856
|
function inferPickerType(e, t) {
|
|
6858
6857
|
return /^\d{4}$/.test(e) ? "year" : /^\d{4}-\d{2}$/.test(e) ? "month" : /^\d{4}Q[1-4]$/.test(e) ? "quarter" : /^\d{4}-\d{2}-\d{2}$/.test(e) ? "date" : t || "date";
|
|
6859
6858
|
}
|
|
6860
|
-
const
|
|
6859
|
+
const parseVariables = (e, t) => {
|
|
6861
6860
|
var r;
|
|
6862
6861
|
const n = /{{(.*?)}}/, o = (r = e == null ? void 0 : e.match) == null ? void 0 : r.call(e, n);
|
|
6863
6862
|
if (o) {
|
|
@@ -6905,8 +6904,8 @@ const parseVariableValue = (e, t, n) => q(void 0, null, function* () {
|
|
|
6905
6904
|
variableNameOfLeftCondition: o,
|
|
6906
6905
|
conditionType: r
|
|
6907
6906
|
}, a) {
|
|
6908
|
-
const c = Object.keys(e)[0] || "$and", u = e[c], d = yield Promise.all(
|
|
6909
|
-
u.map(
|
|
6907
|
+
const c = Object.keys(e)[0] || "$and", u = e[c] || [], d = yield Promise.all(
|
|
6908
|
+
u.filter(Boolean).map(
|
|
6910
6909
|
(p) => processCondition(p, t, n, o, r, a)
|
|
6911
6910
|
)
|
|
6912
6911
|
);
|
|
@@ -7016,7 +7015,7 @@ function getFieldValuesInCondition({ linkageRules: e, formValues: t }) {
|
|
|
7016
7015
|
return e.map((n) => {
|
|
7017
7016
|
const o = (r) => {
|
|
7018
7017
|
const a = Object.keys(r)[0] || "$and";
|
|
7019
|
-
return r[a].map((l) => {
|
|
7018
|
+
return (r[a] || []).filter(Boolean).map((l) => {
|
|
7020
7019
|
if ("$and" in l || "$or" in l)
|
|
7021
7020
|
return o(l);
|
|
7022
7021
|
const c = getTargetField$1(l).join(".");
|
|
@@ -8857,7 +8856,7 @@ function addAppVersion(e, t) {
|
|
|
8857
8856
|
addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
|
|
8858
8857
|
}), e;
|
|
8859
8858
|
}
|
|
8860
|
-
const name = "@nocobase/client", version = "1.9.
|
|
8859
|
+
const name = "@nocobase/client", version = "1.9.32", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
8861
8860
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
8862
8861
|
"@ant-design/cssinjs": "^1.11.1",
|
|
8863
8862
|
"@ant-design/icons": "^5.6.1",
|
|
@@ -8878,9 +8877,9 @@ const name = "@nocobase/client", version = "1.9.30", license = "AGPL-3.0", main
|
|
|
8878
8877
|
"@formily/reactive-react": "^2.2.27",
|
|
8879
8878
|
"@formily/shared": "^2.2.27",
|
|
8880
8879
|
"@formily/validator": "^2.2.27",
|
|
8881
|
-
"@nocobase/evaluators": "1.9.
|
|
8882
|
-
"@nocobase/sdk": "1.9.
|
|
8883
|
-
"@nocobase/utils": "1.9.
|
|
8880
|
+
"@nocobase/evaluators": "1.9.32",
|
|
8881
|
+
"@nocobase/sdk": "1.9.32",
|
|
8882
|
+
"@nocobase/utils": "1.9.32",
|
|
8884
8883
|
ahooks: "^3.7.2",
|
|
8885
8884
|
antd: "5.24.2",
|
|
8886
8885
|
"antd-mobile": "^5.41.1",
|
|
@@ -23975,9 +23974,12 @@ function createOptionsValueLabelMap(e, t = defaultFieldNames$2) {
|
|
|
23975
23974
|
n.set(`${o[t.value]}.${r}`, [o[t.label], ...a]);
|
|
23976
23975
|
return n;
|
|
23977
23976
|
}
|
|
23977
|
+
function reactNodeToPlainText(e) {
|
|
23978
|
+
return e == null || typeof e == "boolean" ? "" : typeof e == "string" || typeof e == "number" ? `${e}` : Array.isArray(e) ? e.map(reactNodeToPlainText).join("") : isValidElement(e) ? reactNodeToPlainText(e.props.children) : "";
|
|
23979
|
+
}
|
|
23978
23980
|
function createVariableTagHTML(e, t) {
|
|
23979
23981
|
let n = t.get(e);
|
|
23980
|
-
return n && (n = n.map((o) => isReactElement(o) || isValidElement(o) ?
|
|
23982
|
+
return n && (n = n.map((o) => isReactElement(o) || isValidElement(o) ? reactNodeToPlainText(o) : o)), `<span class="ant-tag ant-tag-blue" contentEditable="false" data-variable="${e}">${n ? n.join(" / ") : "..."}</span>`;
|
|
23981
23983
|
}
|
|
23982
23984
|
function getSingleEndRange(e, t, n) {
|
|
23983
23985
|
var o, r, a, i, l, c, u;
|
|
@@ -30392,7 +30394,7 @@ const getAppends = ({
|
|
|
30392
30394
|
if (c["x-linkage-rules"] && !isSubMode(c)) {
|
|
30393
30395
|
const b = (y) => {
|
|
30394
30396
|
const v = Object.keys(y)[0] || "$and";
|
|
30395
|
-
y[v].forEach((F) => {
|
|
30397
|
+
(y[v] || []).filter(Boolean).forEach((F) => {
|
|
30396
30398
|
if ("$and" in F || "$or" in F)
|
|
30397
30399
|
return b(F);
|
|
30398
30400
|
const w = getTargetField(F);
|
|
@@ -31671,34 +31673,42 @@ const DragHandler = (e) => {
|
|
|
31671
31673
|
"title-field"
|
|
31672
31674
|
) : null;
|
|
31673
31675
|
}, isDisplayField = (e) => e.includes("."), useLazyLoadDisplayAssociationFieldsOfForm = () => {
|
|
31674
|
-
var
|
|
31676
|
+
var y;
|
|
31675
31677
|
const { name: e } = useCollection_deprecated(), { getCollectionJoinField: t, getCollection: n } = useCollectionManager_deprecated(), o = useForm(), r = useFieldSchema(), a = useVariables$1(), i = useField(), { formValue: l } = useSubFormValue(), { isInSubForm: c, isInSubTable: u } = useFlag() || {}, { getAssociationAppends: d } = useAssociationNames(), p = r.name.toString(), m = useRef(null), h = useRef(null);
|
|
31676
31678
|
m.current == null && isDisplayField(p) && (m.current = t(`${e}.${p}`)), h.current == null && isDisplayField(p) && (h.current = t(`${e}.${p.split(".")[0]}`));
|
|
31677
|
-
const g = useMemo(() => !isDisplayField(p) || !a || e === "fields" || !m.current, [p, a, e, m.current]), f = g ? {} : untracked(() => _.cloneDeep(c || u ? l : o.values)), C = isDisplayField(p) && h.current ? _.get(f, `${p.split(".")[0]}.${((
|
|
31679
|
+
const g = useMemo(() => !isDisplayField(p) || !a || e === "fields" || !m.current, [p, a, e, m.current]), f = g ? {} : untracked(() => _.cloneDeep(c || u ? l : o.values)), C = isDisplayField(p) && h.current ? _.get(f, `${p.split(".")[0]}.${((y = h.current) == null ? void 0 : y.targetKey) || "id"}`) : void 0, b = useRef(C);
|
|
31680
|
+
_.isEqual(b.current, C) || (b.current = C);
|
|
31681
|
+
const S = b.current;
|
|
31678
31682
|
useEffect(() => {
|
|
31679
|
-
var
|
|
31683
|
+
var T;
|
|
31680
31684
|
if (g || _.isEmpty(f))
|
|
31681
31685
|
return;
|
|
31682
|
-
const
|
|
31686
|
+
const v = {
|
|
31683
31687
|
name: "$nForm",
|
|
31684
31688
|
ctx: f,
|
|
31685
31689
|
collectionName: e
|
|
31686
|
-
},
|
|
31687
|
-
if (
|
|
31690
|
+
}, I = `{{ $nForm.${p} }}`;
|
|
31691
|
+
if (S == null)
|
|
31688
31692
|
return;
|
|
31689
|
-
const { appends:
|
|
31690
|
-
a.parseVariable(
|
|
31693
|
+
const { appends: F } = d(), w = n((T = m.current) == null ? void 0 : T.collectionName);
|
|
31694
|
+
a.parseVariable(I, v, { appends: F }).then(({ value: D }) => {
|
|
31691
31695
|
nextTick(() => {
|
|
31692
|
-
const
|
|
31693
|
-
|
|
31694
|
-
|
|
31695
|
-
|
|
31696
|
-
|
|
31696
|
+
const B = transformVariableValue(D, { targetCollectionField: m.current });
|
|
31697
|
+
if (B == null)
|
|
31698
|
+
i.value != null && (i.value = null);
|
|
31699
|
+
else {
|
|
31700
|
+
if (_.isEqual(i.value, B))
|
|
31701
|
+
return;
|
|
31702
|
+
i.setValue(B), i.componentProps = P(x({}, i.componentProps), {
|
|
31703
|
+
readOnlySubmit: !0,
|
|
31704
|
+
filterTargetKey: (w == null ? void 0 : w.filterTargetKey) || "id"
|
|
31705
|
+
});
|
|
31706
|
+
}
|
|
31697
31707
|
});
|
|
31698
|
-
}).catch((
|
|
31699
|
-
console.error(
|
|
31708
|
+
}).catch((D) => {
|
|
31709
|
+
console.error(D);
|
|
31700
31710
|
});
|
|
31701
|
-
}, [
|
|
31711
|
+
}, [S, g]);
|
|
31702
31712
|
}, useContextVariable = () => {
|
|
31703
31713
|
var p, m;
|
|
31704
31714
|
let e;
|
|
@@ -70468,7 +70478,7 @@ export {
|
|
|
70468
70478
|
createReadPrettyFormBlockSchema,
|
|
70469
70479
|
createRouterManager,
|
|
70470
70480
|
createSelectSchemaSettingsItem,
|
|
70471
|
-
|
|
70481
|
+
wn as createStyles,
|
|
70472
70482
|
createSwitchSettingsItem,
|
|
70473
70483
|
createTableBlockSchema,
|
|
70474
70484
|
createTableBlockUISchema,
|