@nocobase/client 1.2.9-alpha → 1.2.11-alpha

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.
@@ -113,6 +113,7 @@ export declare class Collection {
113
113
  get isThrough(): boolean;
114
114
  get autoCreate(): boolean;
115
115
  get resource(): string;
116
+ setOption(key: string, value: any): this;
116
117
  getOptions(): CollectionOptions;
117
118
  getOption<K extends keyof CollectionOptions>(key: K): CollectionOptions[K];
118
119
  /**
package/es/index.mjs CHANGED
@@ -3801,6 +3801,9 @@ class Collection {
3801
3801
  get resource() {
3802
3802
  return this.options.resource;
3803
3803
  }
3804
+ setOption(t, o) {
3805
+ return this.options[t] = o, this;
3806
+ }
3804
3807
  getOptions() {
3805
3808
  return this.options;
3806
3809
  }
@@ -3926,7 +3929,7 @@ function addAppVersion(e, t) {
3926
3929
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
3927
3930
  }), e;
3928
3931
  }
3929
- const name = "@nocobase/client", version$1 = "1.2.9-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3932
+ const name = "@nocobase/client", version$1 = "1.2.11-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3930
3933
  "@ahooksjs/use-url-state": "3.5.1",
3931
3934
  "@ant-design/cssinjs": "^1.11.1",
3932
3935
  "@ant-design/icons": "^5.1.4",
@@ -3947,9 +3950,9 @@ const name = "@nocobase/client", version$1 = "1.2.9-alpha", license = "AGPL-3.0"
3947
3950
  "@formily/reactive-react": "^2.2.27",
3948
3951
  "@formily/shared": "^2.2.27",
3949
3952
  "@formily/validator": "^2.2.27",
3950
- "@nocobase/evaluators": "1.2.9-alpha",
3951
- "@nocobase/sdk": "1.2.9-alpha",
3952
- "@nocobase/utils": "1.2.9-alpha",
3953
+ "@nocobase/evaluators": "1.2.11-alpha",
3954
+ "@nocobase/sdk": "1.2.11-alpha",
3955
+ "@nocobase/utils": "1.2.11-alpha",
3953
3956
  ahooks: "^3.7.2",
3954
3957
  antd: "^5.12.8",
3955
3958
  "antd-style": "3.4.5",
@@ -10626,22 +10629,28 @@ function useServiceOptions$1(e) {
10626
10629
  const T = yield u(mergeFilter([F || ((D = o == null ? void 0 : o.params) == null ? void 0 : D.filter)]));
10627
10630
  m(T);
10628
10631
  }), k = _.debounce(I, DEBOUNCE_WAIT);
10629
- return I(), reaction(() => flatten(F, {
10630
- breakOn({ key: D }) {
10631
- return D.startsWith("$") && D !== "$and" && D !== "$or";
10632
- },
10633
- transformValue(D) {
10634
- if (!isVariable(D))
10635
- return D;
10636
- const $ = getVariableName(D), q = d($);
10637
- return getValuesByPath(
10638
- {
10639
- [$]: (q == null ? void 0 : q.ctx) || {}
10640
- },
10641
- getPath(D)
10642
- );
10632
+ return I(), reaction(
10633
+ () => flatten(F, {
10634
+ breakOn({ key: D }) {
10635
+ return D.startsWith("$") && D !== "$and" && D !== "$or";
10636
+ },
10637
+ transformValue(D) {
10638
+ if (!isVariable(D))
10639
+ return D;
10640
+ const $ = getVariableName(D), q = d($);
10641
+ return getValuesByPath(
10642
+ {
10643
+ [$]: (q == null ? void 0 : q.ctx) || {}
10644
+ },
10645
+ getPath(D)
10646
+ );
10647
+ }
10648
+ }),
10649
+ k,
10650
+ {
10651
+ equals: _.isEqual
10643
10652
  }
10644
- }), k);
10653
+ );
10645
10654
  }, [
10646
10655
  (b = (S = (C = i.componentProps) == null ? void 0 : C.service) == null ? void 0 : S.params) == null ? void 0 : b.filter,
10647
10656
  r,
@@ -10971,23 +10980,29 @@ function useParsedFilter({ filterOption: e }) {
10971
10980
  });
10972
10981
  l();
10973
10982
  const c = _.debounce(l, DEBOUNCE_WAIT);
10974
- reaction(() => flatten(e, {
10975
- breakOn({ key: d }) {
10976
- return d.startsWith("$") && d !== "$and" && d !== "$or";
10977
- },
10978
- transformValue(d) {
10979
- if (!isVariable(d))
10980
- return d;
10981
- const p = getVariableName(d), m = o(p);
10982
- return getValuesByPath(
10983
- {
10984
- [p]: (m == null ? void 0 : m.ctx) || {}
10985
- },
10986
- getPath(d)
10987
- );
10983
+ reaction(
10984
+ () => flatten(e, {
10985
+ breakOn({ key: d }) {
10986
+ return d.startsWith("$") && d !== "$and" && d !== "$or";
10987
+ },
10988
+ transformValue(d) {
10989
+ if (!isVariable(d))
10990
+ return d;
10991
+ const p = getVariableName(d), m = o(p);
10992
+ return getValuesByPath(
10993
+ {
10994
+ [p]: (m == null ? void 0 : m.ctx) || {}
10995
+ },
10996
+ getPath(d)
10997
+ );
10998
+ }
10999
+ }),
11000
+ c,
11001
+ {
11002
+ equals: _.isEqual
10988
11003
  }
10989
- }), c);
10990
- }, [JSON.stringify(e), i]), {
11004
+ );
11005
+ }, [JSON.stringify(e)]), {
10991
11006
  /** 数据范围的筛选参数 */
10992
11007
  filter: n,
10993
11008
  /** 表示是否正在解析筛选参数中的变量 */
@@ -13103,7 +13118,10 @@ const useParseDefaultValue = () => {
13103
13118
  const F = { [S]: (b == null ? void 0 : b.ctx) || {} }, I = getPath(t.default), k = getValuesByPath(F, I);
13104
13119
  return k === void 0 ? Math.random() : k;
13105
13120
  },
13106
- () => C({ forceUpdate: !0 })
13121
+ () => C({ forceUpdate: !0 }),
13122
+ {
13123
+ equals: _.isEqual
13124
+ }
13107
13125
  )) : console.error(`useParseDefaultValue: can not find variable ${S}`);
13108
13126
  } else
13109
13127
  e.value == null && (c || u) && e.setValue(t.default);
@@ -29786,7 +29804,7 @@ const useFormBlockHeight = () => {
29786
29804
  return [A, w, M].map((E) => JSON.stringify(E)).join(",");
29787
29805
  },
29788
29806
  getSubscriber(x, S, m, r, i),
29789
- { fireImmediately: !0 }
29807
+ { fireImmediately: !0, equals: _.isEqual }
29790
29808
  )
29791
29809
  );
29792
29810
  });
@@ -35678,40 +35696,71 @@ const InternalGridCardBlockProvider = (e) => {
35678
35696
  GridCard.Item = GridCardItem;
35679
35697
  GridCard.Designer = GridCardDesigner;
35680
35698
  GridCard.Decorator = GridCardBlockProvider;
35699
+ const { Search } = Input$3, useStyle = (e) => createStyles(({ css: t }) => ({
35700
+ popoverContent: t`
35701
+ width: 26em;
35702
+ ${!e && "max-"}height: 20em;
35703
+ overflow-y: auto;
35704
+ `
35705
+ }))();
35681
35706
  function IconField(e) {
35682
- const t = useFormLayout(), { value: o, onChange: n, disabled: r } = e, [i, a] = useState(!1), { t: l } = useTranslation();
35707
+ const { fontSizeHeading3: t } = theme.useToken().token, o = [...icons.keys()], n = useFormLayout(), { value: r, onChange: i, disabled: a, iconSize: l = t, searchable: c = !0 } = e, [u, d] = useState(!1), [p, m] = useState(o), { t: h } = useTranslation(), { styles: x } = useStyle(c), f = debounce((C) => {
35708
+ var b;
35709
+ const S = (b = C == null ? void 0 : C.trim()) != null ? b : "";
35710
+ m(
35711
+ S.length ? o.filter((y) => y.split(" ").some((F) => F.includes(S))) : o
35712
+ );
35713
+ }, 250);
35683
35714
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(Space$1.Compact, { children: [
35684
35715
  /* @__PURE__ */ jsx(
35685
35716
  StablePopover,
35686
35717
  {
35687
35718
  placement: "bottom",
35688
- open: i,
35689
- onOpenChange: (c) => {
35690
- r || a(c);
35719
+ open: u,
35720
+ onOpenChange: (C) => {
35721
+ a || d(C);
35691
35722
  },
35692
- content: /* @__PURE__ */ jsx("div", { style: { width: "26em", maxHeight: "20em", overflowY: "auto" }, children: [...icons.keys()].map((c) => /* @__PURE__ */ jsx(
35723
+ content: /* @__PURE__ */ jsx("div", { className: x.popoverContent, children: p.length === 0 ? /* @__PURE__ */ jsx(Empty, { image: Empty.PRESENTED_IMAGE_SIMPLE }) : p.map((C) => /* @__PURE__ */ jsx(
35693
35724
  "span",
35694
35725
  {
35695
- style: { fontSize: 18, marginRight: 10, cursor: "pointer" },
35726
+ title: C.replace(/outlined|filled|twotone$/i, ""),
35727
+ style: { fontSize: l, marginRight: 10, cursor: "pointer" },
35696
35728
  onClick: () => {
35697
- n(c), a(!1);
35729
+ i(C), d(!1);
35698
35730
  },
35699
- children: /* @__PURE__ */ jsx(Icon, { type: c })
35731
+ children: /* @__PURE__ */ jsx(Icon, { type: C })
35700
35732
  },
35701
- c
35733
+ C
35702
35734
  )) }),
35703
- title: l("Icon"),
35735
+ title: /* @__PURE__ */ jsxs("div", { children: [
35736
+ /* @__PURE__ */ jsx("div", { children: h("Icon") }),
35737
+ c && /* @__PURE__ */ jsx(
35738
+ Search,
35739
+ {
35740
+ style: { marginTop: 8 },
35741
+ role: "search",
35742
+ name: "icon-search",
35743
+ placeholder: h("Search"),
35744
+ allowClear: !0,
35745
+ onSearch: f,
35746
+ onChange: (C) => {
35747
+ var S;
35748
+ return f((S = C.target) == null ? void 0 : S.value);
35749
+ }
35750
+ }
35751
+ )
35752
+ ] }),
35704
35753
  trigger: "click",
35705
- children: /* @__PURE__ */ jsx(Button, { size: t.size, disabled: r, children: hasIcon(o) ? /* @__PURE__ */ jsx(Icon, { type: o }) : l("Select icon") })
35754
+ children: /* @__PURE__ */ jsx(Button, { size: n.size, disabled: a, children: hasIcon(r) ? /* @__PURE__ */ jsx(Icon, { type: r }) : h("Select icon") })
35706
35755
  }
35707
35756
  ),
35708
- o && !r && /* @__PURE__ */ jsx(
35757
+ r && !a && /* @__PURE__ */ jsx(
35709
35758
  Button,
35710
35759
  {
35711
- size: t.size,
35760
+ size: n.size,
35712
35761
  icon: /* @__PURE__ */ jsx(CloseOutlined, {}),
35713
- onClick: (c) => {
35714
- n(null);
35762
+ onClick: (C) => {
35763
+ i(null);
35715
35764
  }
35716
35765
  }
35717
35766
  )
@@ -48409,9 +48458,9 @@ class ViewCollectionTemplate extends CollectionTemplate {
48409
48458
  }
48410
48459
  },
48411
48460
  filterTargetKey: {
48412
- title: '{{ t("Filter target key")}}',
48461
+ title: '{{ t("Record unique key")}}',
48413
48462
  type: "single",
48414
- description: '{{t( "Filter data based on the specific field, with the requirement that the field value must be unique.")}}',
48463
+ description: '{{t( "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.")}}',
48415
48464
  "x-decorator": "FormItem",
48416
48465
  "x-component": "Select",
48417
48466
  "x-reactions": ["{{useAsyncDataSource(loadFilterTargetKeys)}}"]
@@ -48486,9 +48535,9 @@ class SqlCollectionTemplate extends CollectionTemplate {
48486
48535
  }
48487
48536
  }, getConfigurableProperties("category")), {
48488
48537
  filterTargetKey: {
48489
- title: '{{ t("Filter target key")}}',
48538
+ title: '{{ t("Record unique key")}}',
48490
48539
  type: "single",
48491
- description: '{{t( "Filter data based on the specific field, with the requirement that the field value must be unique.")}}',
48540
+ description: '{{t( "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.")}}',
48492
48541
  "x-decorator": "FormItem",
48493
48542
  "x-component": "Select",
48494
48543
  "x-reactions": ["{{useAsyncDataSource(loadFilterTargetKeys)}}"]
@@ -12,6 +12,8 @@ export interface IconPickerProps {
12
12
  onChange?: (value: string) => void;
13
13
  disabled?: boolean;
14
14
  suffix?: React.ReactNode;
15
+ iconSize?: number;
16
+ searchable?: boolean;
15
17
  }
16
18
  export declare const IconPicker: React.ForwardRefExoticComponent<Partial<IconPickerProps> & React.RefAttributes<unknown>>;
17
19
  export default IconPicker;