@nocobase/client 1.4.16 → 1.4.17

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 +54 -51
  2. package/lib/index.js +92 -92
  3. package/package.json +6 -6
package/es/index.mjs CHANGED
@@ -4295,7 +4295,7 @@ function addAppVersion(e, t) {
4295
4295
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
4296
4296
  }), e;
4297
4297
  }
4298
- const name = "@nocobase/client", version$1 = "1.4.16", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4298
+ const name = "@nocobase/client", version$1 = "1.4.17", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4299
4299
  "@ahooksjs/use-url-state": "3.5.1",
4300
4300
  "@ant-design/cssinjs": "^1.11.1",
4301
4301
  "@ant-design/icons": "^5.1.4",
@@ -4317,9 +4317,9 @@ const name = "@nocobase/client", version$1 = "1.4.16", license = "AGPL-3.0", mai
4317
4317
  "@formily/reactive-react": "^2.2.27",
4318
4318
  "@formily/shared": "^2.2.27",
4319
4319
  "@formily/validator": "^2.2.27",
4320
- "@nocobase/evaluators": "1.4.16",
4321
- "@nocobase/sdk": "1.4.16",
4322
- "@nocobase/utils": "1.4.16",
4320
+ "@nocobase/evaluators": "1.4.17",
4321
+ "@nocobase/sdk": "1.4.17",
4322
+ "@nocobase/utils": "1.4.17",
4323
4323
  ahooks: "^3.7.2",
4324
4324
  antd: "5.12.8",
4325
4325
  "antd-style": "3.7.1",
@@ -4349,7 +4349,7 @@ const name = "@nocobase/client", version$1 = "1.4.16", license = "AGPL-3.0", mai
4349
4349
  "react-i18next": "^11.15.1",
4350
4350
  "react-iframe": "~1.8.5",
4351
4351
  "react-image-lightbox": "^5.1.4",
4352
- "react-intersection-observer": "9.13.0",
4352
+ "react-intersection-observer": "9.14.0",
4353
4353
  "react-js-cron": "^3.1.0",
4354
4354
  "react-quill": "^2.0.0",
4355
4355
  "react-router-dom": "^6.11.2",
@@ -9529,8 +9529,8 @@ const SearchFields = ({ value: e, onChange: t, name: o }) => {
9529
9529
  }, [e]), useEffect(() => {
9530
9530
  var h;
9531
9531
  const p = () => {
9532
- var g, f, C;
9533
- ((g = document.activeElement) == null ? void 0 : g.id) !== a.current.input.id && getPrefixAndCompare((f = document.activeElement) == null ? void 0 : f.id, a.current.input.id) && ((C = a.current) == null || C.focus());
9532
+ var g, f;
9533
+ a.current && ((g = document.activeElement) == null ? void 0 : g.id) !== a.current.input.id && getPrefixAndCompare((f = document.activeElement) == null ? void 0 : f.id, a.current.input.id) && a.current.focus();
9534
9534
  }, m = new IntersectionObserver((g) => {
9535
9535
  g.some((f) => f.isIntersecting) && p();
9536
9536
  });
@@ -9564,46 +9564,45 @@ const SearchFields = ({ value: e, onChange: t, name: o }) => {
9564
9564
  ),
9565
9565
  /* @__PURE__ */ jsx(Divider$1, { style: { margin: 0 } })
9566
9566
  ] });
9567
- }, useMenuSearch$1 = (e) => {
9568
- var p;
9569
- const { children: t, showType: o, hideSearch: n, name: r } = e, i = ((p = t == null ? void 0 : t.concat) == null ? void 0 : p.call(t)) || [], [a, l] = useState(null), c = useCompile(), u = useMemo(() => {
9570
- if (!a || a === "")
9571
- return i;
9572
- const m = a.toLocaleLowerCase();
9573
- return i.filter((h) => (h.title || h.label) && String(c(h.title || h.label)).toLocaleLowerCase().includes(m));
9574
- }, [a, i]), d = useMemo(() => {
9575
- const m = [];
9576
- try {
9577
- !n && (i.length > 10 || a) && m.push(x({
9578
- key: `search-${uid()}`,
9579
- Component: () => /* @__PURE__ */ jsx(SearchFields, { name: r, value: a, onChange: (h) => l(h) }),
9580
- onClick({ domEvent: h }) {
9581
- h.stopPropagation();
9582
- }
9583
- }, o ? { isMenuType: !0 } : {})), u.length > 0 ? u.forEach((h) => {
9584
- if (["subMenu", "itemGroup"].includes(h.type)) {
9585
- const g = h.children ? (
9586
- // eslint-disable-next-line react-hooks/rules-of-hooks
9587
- useMenuSearch$1({
9588
- children: h.children,
9589
- showType: o,
9590
- hideSearch: n,
9591
- name: h.name
9592
- })
9593
- ) : [];
9594
- m.push(F(x({}, h), { children: g }));
9567
+ };
9568
+ let currentName = null;
9569
+ const useMenuSearch$1 = (e) => {
9570
+ const { children: t, showType: o, hideSearch: n, name: r } = e, i = useCompile(), [a, l] = useState(null), c = (p, m) => {
9571
+ if (!a || a === "" || currentName && currentName !== m)
9572
+ return p;
9573
+ const h = a.toLocaleLowerCase();
9574
+ return p.filter((g) => (g.title || g.label) && String(i(g.title || g.label)).toLocaleLowerCase().includes(h));
9575
+ }, u = (p, m, h = /* @__PURE__ */ new Set()) => {
9576
+ var f;
9577
+ const g = [];
9578
+ return !n && (p.length > 10 || a) && !["subMenu", "itemGroup"].includes((f = p[0]) == null ? void 0 : f.type) && g.push(x({
9579
+ key: `search-${uid()}`,
9580
+ Component: () => /* @__PURE__ */ jsx(
9581
+ SearchFields,
9582
+ {
9583
+ name: m,
9584
+ value: !currentName || currentName === m ? a : "",
9585
+ onChange: (C) => {
9586
+ currentName = m, l(C);
9587
+ }
9588
+ }
9589
+ ),
9590
+ onClick({ domEvent: C }) {
9591
+ C.stopPropagation();
9592
+ }
9593
+ }, o ? { isMenuType: !0 } : {})), p.forEach((C) => {
9594
+ if (!h.has(C))
9595
+ if (h.add(C), ["subMenu", "itemGroup"].includes(C.type)) {
9596
+ const S = !currentName || currentName === C.name ? c(C.children.concat(), C.name) : C.children, b = u(S, C.name, h);
9597
+ g.push(F(x({}, C), { children: b }));
9595
9598
  } else
9596
- m.push(h);
9597
- }) : m.push(x({
9598
- key: "empty",
9599
- style: { height: 150 },
9600
- Component: () => /* @__PURE__ */ jsx("div", { onClick: (h) => h.stopPropagation(), children: /* @__PURE__ */ jsx(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE }) })
9601
- }, o ? { isMenuType: !0 } : {}));
9602
- } catch (h) {
9603
- m.push(...u);
9604
- }
9605
- return m;
9606
- }, [n, u, a, o]);
9599
+ g.push(C);
9600
+ }), p.length === 0 && g.push(x({
9601
+ key: "empty",
9602
+ style: { height: 150 },
9603
+ Component: () => /* @__PURE__ */ jsx("div", { onClick: (C) => C.stopPropagation(), children: /* @__PURE__ */ jsx(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE }) })
9604
+ }, o ? { isMenuType: !0 } : {})), g;
9605
+ }, d = u(c((t == null ? void 0 : t.concat()) || [], r), r);
9607
9606
  return t ? d : void 0;
9608
9607
  }, SchemaInitializerItemGroup = ({
9609
9608
  children: e,
@@ -11756,15 +11755,17 @@ const InternalTableBlockProvider = (e) => {
11756
11755
  return { params: o, parseVariableLoading: n };
11757
11756
  }, TableBlockProvider = withDynamicSchemaProps((e) => {
11758
11757
  const t = e.resource || e.association, o = useFieldSchema(), { getCollection: n, getCollectionField: r } = useCollectionManager_deprecated(e.dataSource), i = n(e.collection, e.dataSource), { treeTable: a, pagingMode: l } = (o == null ? void 0 : o["x-decorator-props"]) || {}, { params: c, parseVariableLoading: u } = useTableBlockParamsCompat(e);
11759
- let d = "children";
11758
+ let d = "__nochildren__";
11760
11759
  if (a)
11761
- if (t != null && t.includes(".")) {
11760
+ if (d = "children", t != null && t.includes(".")) {
11762
11761
  const m = r(t);
11763
11762
  m != null && m.treeChildren && (d = m.name), c.tree = !0;
11764
11763
  } else {
11765
11764
  const m = i == null ? void 0 : i.fields.find((h) => h.treeChildren);
11766
11765
  m && (d = m.name), c.tree = !0;
11767
11766
  }
11767
+ else
11768
+ d = "__nochildren__";
11768
11769
  const p = useMemo(() => createForm(), [a]);
11769
11770
  return u ? null : /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { treeTable: a }, children: /* @__PURE__ */ jsx(FormContext.Provider, { value: p, children: /* @__PURE__ */ jsx(BlockProvider, F(x({ name: e.name || "table" }, e), { params: c, runWhenParamsChanged: !0, children: /* @__PURE__ */ jsx(InternalTableBlockProvider, F(x({}, e), { childrenColumnName: d, params: c })) })) }) });
11770
11771
  }), useTableBlockContext = () => useContext(TableBlockContext), ActionContext = createContext({});
@@ -19582,7 +19583,9 @@ const findOption$1 = (e = [], t) => {
19582
19583
  return new Promise((h) => {
19583
19584
  setTimeout(() => {
19584
19585
  const g = getChildren(
19585
- a(p).filter((f) => ["hasOne", "hasMany", "belongsTo", "belongsToMany"].includes(f.type)),
19586
+ a(p).filter((f) => ["hasOne", "hasMany", "belongsTo", "belongsToMany", "belongsToArray"].includes(
19587
+ f.type
19588
+ )),
19586
19589
  {
19587
19590
  schema: e,
19588
19591
  depth: d.depth + 1,
@@ -22511,7 +22514,7 @@ const getActionContext = (e) => {
22511
22514
  k != null && k.target && (u = p(
22512
22515
  `${k.target}.${((L = (N = n["x-component-props"]) == null ? void 0 : N.fieldNames) == null ? void 0 : L.label) || "id"}`
22513
22516
  ));
22514
- const D = (k == null ? void 0 : k.interface) === "m2o" && findParentFieldSchema(n), B = D && p(D == null ? void 0 : D["x-collection-field"]), z = useTableBlockContext(), O = (k == null ? void 0 : k.interface) === "m2m" || (B == null ? void 0 : B.type) === "hasMany" && (k == null ? void 0 : k.interface) === "m2o", j = useCallback(
22517
+ const D = (k == null ? void 0 : k.interface) === "m2o" && findParentFieldSchema(n), B = D && p(D == null ? void 0 : D["x-collection-field"]), z = useTableBlockContext(), O = (k == null ? void 0 : k.interface) === "m2m" || (k == null ? void 0 : k.interface) === "mbm" || (B == null ? void 0 : B.type) === "hasMany" && (k == null ? void 0 : k.interface) === "m2o", j = useCallback(
22515
22518
  (q) => {
22516
22519
  const V = q.find((G) => G.value === "$nForm"), U = m(w);
22517
22520
  return !(U != null && U.length) && V && (V.children = formatVariableScop(y())), q;
@@ -38103,7 +38106,7 @@ const useColumnsDeepMemoized = (e) => {
38103
38106
  return spliceArrayState(n, {
38104
38107
  startIndex: w,
38105
38108
  deleteCount: k
38106
- }), n.value.splice(w, k), n.setInitialValue(n.value), n.onInput(n.value);
38109
+ }), n.value.splice(w, k), n.setInitialValue([...n.value]), n.onInput(n.value);
38107
38110
  }),
38108
38111
  children: /* @__PURE__ */ jsx(CloseOutlined, { style: { cursor: "pointer", color: "gray" } })
38109
38112
  }