@nocobase/client 1.9.45 → 1.9.47

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.
@@ -0,0 +1,11 @@
1
+ export function getOperators(): {
2
+ is_logic(logic: any): boolean;
3
+ truthy(value: any): boolean;
4
+ getOperator(logic: any): string;
5
+ getValues(logic: any): any;
6
+ apply(logic: any, data: any): any;
7
+ uses_data(logic: any): any[];
8
+ addOperation(name: any, code: any): void;
9
+ rmOperation(name: any): void;
10
+ rule_like(rule: any, pattern: any): any;
11
+ };
package/es/index.mjs CHANGED
@@ -8858,7 +8858,7 @@ function addAppVersion(e, t) {
8858
8858
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
8859
8859
  }), e;
8860
8860
  }
8861
- const name = "@nocobase/client", version = "1.9.45", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8861
+ const name = "@nocobase/client", version = "1.9.47", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8862
8862
  "@ahooksjs/use-url-state": "3.5.1",
8863
8863
  "@ant-design/cssinjs": "^1.11.1",
8864
8864
  "@ant-design/icons": "^5.6.1",
@@ -8879,9 +8879,9 @@ const name = "@nocobase/client", version = "1.9.45", license = "AGPL-3.0", main
8879
8879
  "@formily/reactive-react": "^2.2.27",
8880
8880
  "@formily/shared": "^2.2.27",
8881
8881
  "@formily/validator": "^2.2.27",
8882
- "@nocobase/evaluators": "1.9.45",
8883
- "@nocobase/sdk": "1.9.45",
8884
- "@nocobase/utils": "1.9.45",
8882
+ "@nocobase/evaluators": "1.9.47",
8883
+ "@nocobase/sdk": "1.9.47",
8884
+ "@nocobase/utils": "1.9.47",
8885
8885
  ahooks: "^3.7.2",
8886
8886
  antd: "5.24.2",
8887
8887
  "antd-mobile": "^5.41.1",
@@ -18031,6 +18031,7 @@ const useStyles$g = genStyleHook("nb-schema-toolbar", (e) => {
18031
18031
  border: "2px solid var(--colorBorderSettingsHover)",
18032
18032
  background: "var(--colorBgSettingsHover)",
18033
18033
  pointerEvents: "none",
18034
+ transitionDelay: "0.1s",
18034
18035
  "&.nb-in-template": {
18035
18036
  background: "var(--colorTemplateBgSettingsHover)"
18036
18037
  },
@@ -21781,20 +21782,15 @@ const SchemaSettingsProvider = (e) => {
21781
21782
  );
21782
21783
  return /* @__PURE__ */ jsx(SchemaSettingsContext.Provider, { value: i, children: t });
21783
21784
  }, InternalSchemaSettingsDropdown = React.memo((e) => {
21784
- const f = e, { title: t, dn: n } = f, o = W(f, ["title", "dn"]), [r, a] = useState(!1), { Component: i, getMenuItems: l } = useMenuItem(), c = useNiceDropdownMaxHeight([r]), [u, d] = useState(!1), p = useContext(SchemaToolbarVisibleContext);
21785
+ const g = e, { title: t, dn: n } = g, o = W(g, ["title", "dn"]), [r, a] = useState(!1), { Component: i, getMenuItems: l } = useMenuItem(), c = useNiceDropdownMaxHeight([r]), [u, d] = useState(!1), p = useContext(SchemaToolbarVisibleContext);
21785
21786
  useEffect(() => {
21786
21787
  p && d(!1);
21787
21788
  }, [p]);
21788
- const m = (C, b) => {
21789
- (b.source === "trigger" || C) && startTransition(() => {
21790
- a(C);
21789
+ const m = (f, C) => {
21790
+ (C.source === "trigger" || f) && startTransition(() => {
21791
+ a(f);
21791
21792
  });
21792
- }, h = () => {
21793
- d(!0), a(!0);
21794
- };
21795
- if (!u)
21796
- return /* @__PURE__ */ jsx("div", { onMouseEnter: h, "data-testid": e["data-testid"], children: typeof t == "string" ? /* @__PURE__ */ jsx("span", { children: t }) : t });
21797
- const g = l(() => e.children);
21793
+ }, h = l(() => e.children);
21798
21794
  return /* @__PURE__ */ jsxs(SchemaSettingsProvider, P(x({ visible: r, setVisible: a, dn: n }, o), { children: [
21799
21795
  /* @__PURE__ */ jsx(i, {}),
21800
21796
  /* @__PURE__ */ jsx(
@@ -21809,7 +21805,7 @@ const SchemaSettingsProvider = (e) => {
21809
21805
  }
21810
21806
  `,
21811
21807
  menu: {
21812
- items: g,
21808
+ items: h,
21813
21809
  "data-testid": "schema-settings-menu",
21814
21810
  style: { maxHeight: c, overflowY: "auto" }
21815
21811
  },
@@ -22779,7 +22775,7 @@ const HeightMode = {
22779
22775
  { label: t("Sub-form(Popover)"), value: "PopoverNester" }
22780
22776
  ];
22781
22777
  }
22782
- }, [t, p == null ? void 0 : p.interface, m]) || []).filter(Boolean);
22778
+ }, [t, p == null ? void 0 : p.interface, m, c, u]) || []).filter(Boolean);
22783
22779
  }, jsonCss = css`
22784
22780
  font-size: 80%;
22785
22781
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
@@ -31694,11 +31690,16 @@ const DragHandler = (e) => {
31694
31690
  const { appends: F } = d(), w = n((T = m.current) == null ? void 0 : T.collectionName);
31695
31691
  a.parseVariable(I, v, { appends: F }).then(({ value: D }) => {
31696
31692
  nextTick(() => {
31697
- const B = transformVariableValue(D, { targetCollectionField: m.current });
31693
+ const B = normalizeDisplayAssociationFieldValue(
31694
+ transformVariableValue(D, { targetCollectionField: m.current })
31695
+ );
31698
31696
  if (B == null)
31699
31697
  i.value != null && (i.value = null);
31700
31698
  else {
31701
- if (_.isEqual(i.value, B))
31699
+ const N = normalizeDisplayAssociationFieldValue(
31700
+ transformVariableValue(i.value, { targetCollectionField: m.current })
31701
+ );
31702
+ if (_.isEqual(N, B))
31702
31703
  return;
31703
31704
  i.setValue(B), i.componentProps = P(x({}, i.componentProps), {
31704
31705
  readOnlySubmit: !0,
@@ -31710,7 +31711,29 @@ const DragHandler = (e) => {
31710
31711
  console.error(D);
31711
31712
  });
31712
31713
  }, [S, g]);
31713
- }, useContextVariable = () => {
31714
+ };
31715
+ function normalizeDisplayAssociationFieldValue(e) {
31716
+ return untracked(() => {
31717
+ const t = toJS(e);
31718
+ return removeCircularReferences(t);
31719
+ });
31720
+ }
31721
+ function removeCircularReferences(e, t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakSet()) {
31722
+ if (e == null || typeof e != "object" || !Array.isArray(e) && (!_.isPlainObject(e) || Object.getPrototypeOf(e) === null))
31723
+ return e;
31724
+ if (n.has(e))
31725
+ return;
31726
+ if (t.has(e))
31727
+ return t.get(e);
31728
+ const o = Array.isArray(e) ? [] : {};
31729
+ return t.set(e, o), n.add(e), Array.isArray(e) ? e.forEach((r, a) => {
31730
+ o[a] = removeCircularReferences(r, t, n);
31731
+ }) : Object.keys(e).forEach((r) => {
31732
+ const a = removeCircularReferences(e[r], t, n);
31733
+ a !== void 0 && (o[r] = a);
31734
+ }), n.delete(e), o;
31735
+ }
31736
+ const useContextVariable = () => {
31714
31737
  var p, m;
31715
31738
  let e;
31716
31739
  const { isPopupVisibleControlledByURL: t } = usePopupSettings(), { params: n } = useCurrentPopupContext(), o = useCollection(), r = useDataBlockRequestData(), a = useTableBlockContextBasicValue() || {};
@@ -44643,7 +44666,11 @@ function AttachmentList(e) {
44643
44666
  [l]
44644
44667
  ), m = useCallback(
44645
44668
  (h) => {
44646
- r(n ? o.filter((g) => g.id !== h.id) : null);
44669
+ if (n) {
44670
+ const g = o.filter((f) => f.id !== h.id);
44671
+ g.length === 0 ? r(null) : r(g);
44672
+ } else
44673
+ r(null);
44647
44674
  },
44648
44675
  [n, r, o]
44649
44676
  );
@@ -14,3 +14,29 @@
14
14
  */
15
15
  declare const useLazyLoadDisplayAssociationFieldsOfForm: () => void;
16
16
  export default useLazyLoadDisplayAssociationFieldsOfForm;
17
+ /**
18
+ * Remove circular references from an object while preserving shared references.
19
+ *
20
+ * This function distinguishes between:
21
+ * - Circular references: Objects that reference themselves in the recursion path (removed)
22
+ * - Shared references: Objects that appear multiple times but aren't circular (preserved)
23
+ *
24
+ * @param value - The value to process
25
+ * @param seen - WeakMap cache of processed objects
26
+ * @param path - WeakSet tracking current recursion path
27
+ * @returns The processed value with circular references removed
28
+ *
29
+ * @example
30
+ * // Shared reference (preserved)
31
+ * const shared = { name: "shared" };
32
+ * removeCircularReferences({ a: shared, b: shared });
33
+ * // Returns: { a: { name: "shared" }, b: { name: "shared" } }
34
+ *
35
+ * @example
36
+ * // Circular reference (removed)
37
+ * const circular = { name: "circular" };
38
+ * circular.self = circular;
39
+ * removeCircularReferences(circular);
40
+ * // Returns: { name: "circular" }
41
+ */
42
+ export declare function removeCircularReferences(value: any, seen?: WeakMap<object, any>, path?: WeakSet<object>): any;