@nocobase/client 0.20.0-alpha.15 → 0.20.0-alpha.16

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.
@@ -26,9 +26,6 @@ export interface SchemaSettingItemItemType extends SchemaSettingsItemCommon<Sche
26
26
  export interface SchemaSettingItemGroupType extends SchemaSettingsItemCommon<SchemaSettingsSubMenuProps> {
27
27
  type: 'itemGroup';
28
28
  }
29
- export interface SchemaSettingItemSubMenuType extends SchemaSettingsItemCommon<SchemaSettingsSubMenuProps> {
30
- type: 'subMenu';
31
- }
32
29
  export interface SchemaSettingItemDividerProps extends SchemaSettingsItemCommon {
33
30
  type: 'divider';
34
31
  }
@@ -53,10 +50,13 @@ export type SchemaSettingItemModalType = SchemaSettingsItemCommon<SchemaSettings
53
50
  export type SchemaSettingItemActionModalType = SchemaSettingsItemCommon<SchemaSettingsSelectItemProps> & {
54
51
  type: 'actionModal';
55
52
  };
53
+ export interface SchemaSettingItemSubMenuType extends SchemaSettingsItemCommon<SchemaSettingsSubMenuProps> {
54
+ type: 'subMenu';
55
+ }
56
56
  export interface SchemaSettingItemComponentType<T = {}> extends SchemaSettingsItemCommon<T> {
57
57
  Component: string | ComponentType<T>;
58
58
  }
59
- export type SchemaSettingItemAllBuiltType = SchemaSettingItemDividerProps | SchemaSettingItemRemoveType | SchemaSettingItemActionModalType | SchemaSettingItemSwitchType | SchemaSettingItemPopupType | SchemaSettingItemCascaderType | SchemaSettingItemModalType | SchemaSettingItemItemType | SchemaSettingItemSelectType | SchemaSettingItemGroupType;
59
+ export type SchemaSettingItemAllBuiltType = SchemaSettingItemDividerProps | SchemaSettingItemRemoveType | SchemaSettingItemActionModalType | SchemaSettingItemSwitchType | SchemaSettingItemPopupType | SchemaSettingItemCascaderType | SchemaSettingItemModalType | SchemaSettingItemItemType | SchemaSettingItemSelectType | SchemaSettingItemSubMenuType | SchemaSettingItemGroupType;
60
60
  export type SchemaSettingsItemType = SchemaSettingItemComponentType | SchemaSettingItemAllBuiltType;
61
61
  export type SchemaSettingsItemTypeWithoutName = Omit<SchemaSettingItemComponentType, 'name'> | Omit<SchemaSettingItemAllBuiltType, 'name'>;
62
62
  export {};
package/es/index.mjs CHANGED
@@ -5383,15 +5383,15 @@ const SchemaInitializerSubMenuContext = React.createContext({}), SchemaInitializ
5383
5383
  }, r)
5384
5384
  ) });
5385
5385
  }, SchemaInitializerSubMenu = (e) => {
5386
- const d = e, { children: t, title: n, name: o = uid(), onOpenChange: r, icon: i } = d, a = H(d, ["children", "title", "name", "onOpenChange", "icon"]), l = useCompile(), c = useSchemaInitializerMenuItems(t, o), u = useMemo(() => [
5386
+ const p = e, { children: t, title: n, name: o = uid(), onOpenChange: r, icon: i } = p, a = H(p, ["children", "title", "name", "onOpenChange", "icon"]), l = useCompile(), c = t == null ? void 0 : t.filter((m) => m.useVisible ? m.useVisible() : !0), u = useSchemaInitializerMenuItems(c, o), d = useMemo(() => [
5387
5387
  v(x({}, a), {
5388
5388
  key: o,
5389
5389
  label: l(n),
5390
5390
  icon: typeof i == "string" ? /* @__PURE__ */ jsx(antIcons__default, { type: i }) : i,
5391
- children: c
5391
+ children: u
5392
5392
  })
5393
- ], [c, l, i, o, a, n]);
5394
- return /* @__PURE__ */ jsx(SchemaInitializerMenu, { onOpenChange: r, items: u });
5393
+ ], [u, l, i, o, a, n]);
5394
+ return /* @__PURE__ */ jsx(SchemaInitializerMenu, { onOpenChange: r, items: d });
5395
5395
  }, SchemaInitializerSubMenuInternal = () => {
5396
5396
  const e = useSchemaInitializerItem();
5397
5397
  return /* @__PURE__ */ jsx(SchemaInitializerSubMenu, x({}, e));
@@ -7770,10 +7770,12 @@ const useSchemaToolbarRender = (e) => {
7770
7770
  onSubmit: ({ sort: y }) => {
7771
7771
  var S;
7772
7772
  const b = y.map((I) => I.direction === "desc" ? `-${I.field}` : I.field);
7773
- _.set(n.componentProps, "service.params.sort", b), (S = t == null ? void 0 : t.onSubmitCallBack) == null || S.call(t, b), c["x-component-props"] = n.componentProps, o.emit("patch", {
7773
+ n.query(new RegExp(`[0-9]+\\.${c.name}$`)).forEach((I) => {
7774
+ _.set(I, "componentProps.service.params.sort", b);
7775
+ }), _.set(c, "x-component-props.service.params.sort", b), (S = t == null ? void 0 : t.onSubmitCallBack) == null || S.call(t, b), o.emit("patch", {
7774
7776
  schema: {
7775
7777
  "x-uid": c["x-uid"],
7776
- "x-component-props": n.componentProps
7778
+ "x-component-props": c["x-component-props"]
7777
7779
  }
7778
7780
  });
7779
7781
  }
@@ -8553,7 +8555,7 @@ const useCollectionManager_deprecated = (e) => {
8553
8555
  if (!R)
8554
8556
  return [];
8555
8557
  const w = (V = p(q)) == null ? void 0 : V.getCollection(R);
8556
- return w == null ? void 0 : w.getChildrenCollections(B);
8558
+ return (w == null ? void 0 : w.getChildrenCollections(B)) || [];
8557
8559
  },
8558
8560
  [t, p]
8559
8561
  ), k = useCallback(
@@ -16549,9 +16551,9 @@ function useSchemaSettingsRender(e, t) {
16549
16551
  const n = useApp(), o = useMemo(() => n.schemaSettingsManager.get(e), [n.schemaSettingsManager, e]), r = React.useRef({});
16550
16552
  return e ? o ? {
16551
16553
  exists: !0,
16552
- render: (i) => {
16553
- const a = JSON.stringify(t) || "{}";
16554
- return r.current[a] ? r.current[a] : r.current[a] = React.createElement(SchemaSettingsWrapper, x(x(x({}, o.options), t), i));
16554
+ render: (i = {}) => {
16555
+ const a = JSON.stringify(i);
16556
+ return a && r.current[a] ? r.current[a] : r.current[a] = React.createElement(SchemaSettingsWrapper, x(x(x({}, o.options), t), i));
16555
16557
  }
16556
16558
  } : (console.error(`[nocobase]: SchemaSettings "${e}" not found`), {
16557
16559
  exists: !1,
@@ -38813,7 +38815,7 @@ const useCurrentAppInfo = () => useContext(CurrentAppInfoContext), CurrentAppInf
38813
38815
  }),
38814
38816
  onChange: (S, I) => {
38815
38817
  var k;
38816
- (k = e == null ? void 0 : e.onChange) == null || k.call(e, S), y(I.label);
38818
+ (k = e == null ? void 0 : e.onChange) == null || k.call(e, S), y(I.label || S);
38817
38819
  }
38818
38820
  }
38819
38821
  ) });
@@ -38821,15 +38823,15 @@ const useCurrentAppInfo = () => useContext(CurrentAppInfoContext), CurrentAppInf
38821
38823
  { displayName: "ForeignKey" }
38822
38824
  ), ThroughCollection = observer$1(
38823
38825
  (e) => {
38824
- const { disabled: t } = e, n = useCompile(), { getCollections: o } = useCollectionManager_deprecated(), [r, i] = useState([]), a = useField(), c = useRecord()[a.props.name], [u, d] = useState(c || a.initialValue), p = () => o().filter((h) => !(h.autoCreate && h.isThrough)).map((h) => ({
38825
- label: n(h.title),
38826
- value: h.name
38826
+ const { disabled: t } = e, n = useCompile(), { getCollections: o } = useCollectionManager_deprecated(), [r, i] = useState([]), a = useField(), c = useRecord()[a.props.name], [u, d] = useState(c || a.initialValue), p = () => o().filter((g) => !(g.autoCreate && g.isThrough)).map((g) => ({
38827
+ label: n(g.title),
38828
+ value: g.name
38827
38829
  }));
38828
38830
  return useEffect(() => {
38829
- const m = p();
38830
- if (i(m), c) {
38831
- const h = m.find((g) => g.value === c);
38832
- d((h == null ? void 0 : h.label) || c);
38831
+ const h = p();
38832
+ if (i(h), c) {
38833
+ const g = h.find((f) => f.value === c);
38834
+ d((g == null ? void 0 : g.label) || c);
38833
38835
  }
38834
38836
  }, []), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
38835
38837
  AutoComplete$1,
@@ -38839,9 +38841,18 @@ const useCurrentAppInfo = () => useContext(CurrentAppInfoContext), CurrentAppInf
38839
38841
  popupMatchSelectWidth: !1,
38840
38842
  value: u,
38841
38843
  options: r,
38842
- onChange: (m, h) => {
38843
- var g;
38844
- (g = e == null ? void 0 : e.onChange) == null || g.call(e, m), d(h.label);
38844
+ onSearch: (h) => {
38845
+ if (h) {
38846
+ const g = r.filter((f) => f.label.toLowerCase().includes(h.toLowerCase()));
38847
+ i(g);
38848
+ } else {
38849
+ const g = p();
38850
+ i(g);
38851
+ }
38852
+ },
38853
+ onChange: (h, g) => {
38854
+ var f;
38855
+ (f = e == null ? void 0 : e.onChange) == null || f.call(e, h), d(g.label || h);
38845
38856
  }
38846
38857
  }
38847
38858
  ) });
@@ -45771,7 +45782,7 @@ const useBlockContext = () => useContext(BlockContext), BlockProvider = (e) => {
45771
45782
  const e = useFilterByTk(), t = useRecord(), { fields: n } = useCollection_deprecated(), o = useFieldSchema(), { getCollectionJoinField: r } = useCollectionManager_deprecated(), i = r((u = o == null ? void 0 : o["x-decorator-props"]) == null ? void 0 : u.resource), a = n.filter((d) => ["boolean", "date", "integer", "radio", "sort", "string", "time", "uid", "uuid"].includes(d.type)).map((d) => d.name), l = Object.keys(t).filter((d) => a.includes(d)).reduce((d, p) => (d[p] = t[p], d), {}), c = {
45772
45783
  filterByTk: e
45773
45784
  };
45774
- return t.__collection && i && !["oho", "m2o", "obo"].includes(i.interface) && (c.targetCollection = t.__collection), e || (c.filter = l), c;
45785
+ return t.__collection && i && !["oho", "m2o", "obo"].includes(i.interface) && (c.targetCollection = t.__collection), !e && Object.keys(l).length > 0 && (c.filter = l), c;
45775
45786
  }, RecordLink = (e) => {
45776
45787
  const t = useField(), n = useRecord(), l = e, { title: o, to: r } = l, i = H(l, ["title", "to"]), a = template(r || "");
45777
45788
  return /* @__PURE__ */ jsx(Link$1, v(x({}, i), { to: a({ record: n || {} }), children: t.title }));
@@ -51581,7 +51592,7 @@ const SelectActionInitializer = (e) => {
51581
51592
  "x-component": "Action"
51582
51593
  };
51583
51594
  },
51584
- visible: useVisibleCollection
51595
+ useVisible: useVisibleCollection
51585
51596
  },
51586
51597
  {
51587
51598
  name: "customRequest",
@@ -51659,7 +51670,7 @@ const SelectActionInitializer = (e) => {
51659
51670
  "x-component": "Action"
51660
51671
  };
51661
51672
  },
51662
- visible: useVisibleCollection
51673
+ useVisible: useVisibleCollection
51663
51674
  },
51664
51675
  {
51665
51676
  name: "customRequest",