@nocobase/client 1.9.31 → 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.
Files changed (3) hide show
  1. package/es/index.mjs +34 -24
  2. package/lib/index.js +58 -58
  3. 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 Dn } from "antd-style";
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";
@@ -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.31", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
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.31", 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.31",
8882
- "@nocobase/sdk": "1.9.31",
8883
- "@nocobase/utils": "1.9.31",
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) ? renderToString(o) : o)), `<span class="ant-tag ant-tag-blue" contentEditable="false" data-variable="${e}">${n ? n.join(" / ") : "..."}</span>`;
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;
@@ -31671,34 +31673,42 @@ const DragHandler = (e) => {
31671
31673
  "title-field"
31672
31674
  ) : null;
31673
31675
  }, isDisplayField = (e) => e.includes("."), useLazyLoadDisplayAssociationFieldsOfForm = () => {
31674
- var b;
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]}.${((b = h.current) == null ? void 0 : b.targetKey) || "id"}`) : void 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 F;
31683
+ var T;
31680
31684
  if (g || _.isEmpty(f))
31681
31685
  return;
31682
- const S = {
31686
+ const v = {
31683
31687
  name: "$nForm",
31684
31688
  ctx: f,
31685
31689
  collectionName: e
31686
- }, y = `{{ $nForm.${p} }}`;
31687
- if (C == null)
31690
+ }, I = `{{ $nForm.${p} }}`;
31691
+ if (S == null)
31688
31692
  return;
31689
- const { appends: v } = d(), I = n((F = m.current) == null ? void 0 : F.collectionName);
31690
- a.parseVariable(y, S, { appends: v }).then(({ value: w }) => {
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 T = transformVariableValue(w, { targetCollectionField: m.current });
31693
- T == null ? i.value = null : (i.value = T, i.componentProps = P(x({}, i.componentProps), {
31694
- readOnlySubmit: !0,
31695
- filterTargetKey: (I == null ? void 0 : I.filterTargetKey) || "id"
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((w) => {
31699
- console.error(w);
31708
+ }).catch((D) => {
31709
+ console.error(D);
31700
31710
  });
31701
- }, [C, g]);
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
- Dn as createStyles,
70481
+ wn as createStyles,
70472
70482
  createSwitchSettingsItem,
70473
70483
  createTableBlockSchema,
70474
70484
  createTableBlockUISchema,