@nocobase/client 2.0.6 → 2.0.8

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.
@@ -18,4 +18,3 @@ export declare class DefaultToolsManager implements ToolsManager {
18
18
  registerTools(name: string, options: ToolsOptions): void;
19
19
  }
20
20
  export * from './types';
21
- export * from './hooks';
package/es/index.mjs CHANGED
@@ -3362,12 +3362,6 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3362
3362
  get TimePicker() {
3363
3363
  return TimePicker;
3364
3364
  },
3365
- get ToolsContext() {
3366
- return ToolsContext;
3367
- },
3368
- get ToolsProvider() {
3369
- return ToolsProvider;
3370
- },
3371
3365
  get TreeSelect() {
3372
3366
  return TreeSelect;
3373
3367
  },
@@ -5135,9 +5129,6 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5135
5129
  get useToken() {
5136
5130
  return useToken;
5137
5131
  },
5138
- get useTools() {
5139
- return useTools;
5140
- },
5141
5132
  get useUIConfigurationPermissions() {
5142
5133
  return useUIConfigurationPermissions;
5143
5134
  },
@@ -9957,7 +9948,7 @@ function addAppVersion(e, t) {
9957
9948
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
9958
9949
  }), e;
9959
9950
  }
9960
- const name = "@nocobase/client", version = "2.0.6", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9951
+ const name = "@nocobase/client", version = "2.0.8", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9961
9952
  "@ahooksjs/use-url-state": "3.5.1",
9962
9953
  "@ant-design/cssinjs": "^1.11.1",
9963
9954
  "@ant-design/icons": "^5.6.1",
@@ -9980,10 +9971,10 @@ const name = "@nocobase/client", version = "2.0.6", license = "Apache-2.0", main
9980
9971
  "@formily/reactive-react": "^2.2.27",
9981
9972
  "@formily/shared": "^2.2.27",
9982
9973
  "@formily/validator": "^2.2.27",
9983
- "@nocobase/evaluators": "2.0.6",
9984
- "@nocobase/flow-engine": "2.0.6",
9985
- "@nocobase/sdk": "2.0.6",
9986
- "@nocobase/utils": "2.0.6",
9974
+ "@nocobase/evaluators": "2.0.8",
9975
+ "@nocobase/flow-engine": "2.0.8",
9976
+ "@nocobase/sdk": "2.0.8",
9977
+ "@nocobase/utils": "2.0.8",
9987
9978
  "@tanstack/react-table": "^8.21.3",
9988
9979
  "@types/tabulator-tables": "^6.2.6",
9989
9980
  "acorn-jsx": "^5.3.2",
@@ -29463,38 +29454,6 @@ class RouteRepository {
29463
29454
  }
29464
29455
  }
29465
29456
  }
29466
- const ToolsContext = createContext(null), ToolsProvider = ({ toolsManager: e, children: t }) => {
29467
- const [o, n] = useState([]), [r, i] = useState(!0), [a, l] = useState(null), c = () => V(void 0, null, function* () {
29468
- i(!0), l(null);
29469
- try {
29470
- const u = yield e.listTools();
29471
- n(u);
29472
- } catch (u) {
29473
- l(u);
29474
- } finally {
29475
- i(!1);
29476
- }
29477
- });
29478
- return useEffect(() => {
29479
- c();
29480
- }, []), /* @__PURE__ */ jsx(
29481
- ToolsContext.Provider,
29482
- {
29483
- value: {
29484
- tools: o,
29485
- loading: r,
29486
- error: a,
29487
- refresh: c
29488
- },
29489
- children: t
29490
- }
29491
- );
29492
- }, useTools = () => {
29493
- const e = useContext(ToolsContext);
29494
- if (!e)
29495
- throw new Error("useTools must be used within a ToolsProvider");
29496
- return e;
29497
- };
29498
29457
  class DefaultToolsManager {
29499
29458
  constructor(t, o = new Registry$1()) {
29500
29459
  this.app = t, this.tools = o;
@@ -89105,6 +89064,23 @@ const getAssociationTargetCollection = (e, t, o) => {
89105
89064
  return !m || typeof m != "object" ? m : typeof (m == null ? void 0 : m[r]) != "undefined" ? m[r] : typeof (m == null ? void 0 : m.id) != "undefined" ? m.id : typeof (m == null ? void 0 : m.value) != "undefined" ? m.value : m;
89106
89065
  };
89107
89066
  return Array.isArray(e) ? e.map(i) : i(e);
89067
+ }, buildVirtualFilterCollectionField = (e, t) => {
89068
+ var a, l, c;
89069
+ if (!t)
89070
+ return;
89071
+ const o = (t == null ? void 0 : t.title) || (t == null ? void 0 : t.name), n = t == null ? void 0 : t.interface, r = n ? (
89072
+ // @ts-ignore
89073
+ (c = (l = (a = e == null ? void 0 : e.dataSourceManager) == null ? void 0 : a.collectionFieldInterfaceManager) == null ? void 0 : l.getFieldInterface) == null ? void 0 : c.call(l, n)
89074
+ ) : void 0;
89075
+ return A(x({}, t), {
89076
+ title: o,
89077
+ uiSchema: A(x({}, (t == null ? void 0 : t.uiSchema) || {}), {
89078
+ title: o
89079
+ }),
89080
+ filterable: (t == null ? void 0 : t.filterable) || (r == null ? void 0 : r.filterable),
89081
+ isAssociationField: typeof (t == null ? void 0 : t.isAssociationField) == "function" ? t.isAssociationField : () => !!(t != null && t.target),
89082
+ getComponentProps: typeof (t == null ? void 0 : t.getComponentProps) == "function" ? t.getComponentProps : () => ({})
89083
+ });
89108
89084
  }, buildFilterFormFieldItem = ({
89109
89085
  model: e,
89110
89086
  collection: t,
@@ -89330,7 +89306,14 @@ class FilterFormItemModel extends FilterableItemModel {
89330
89306
  return Array.isArray(n) && n.find((a) => a.value === o) || null;
89331
89307
  }
89332
89308
  onInit(o) {
89309
+ var r;
89333
89310
  super.onInit(o), this.debouncedDoFilter = debounce(this.doFilter.bind(this), 300);
89311
+ const n = (r = this.getStepParams("filterFormItemSettings", "init")) == null ? void 0 : r.filterField;
89312
+ n && this.context.defineProperty("filterField", {
89313
+ value: A(x({}, n), {
89314
+ title: (n == null ? void 0 : n.title) || (n == null ? void 0 : n.name)
89315
+ })
89316
+ });
89334
89317
  }
89335
89318
  onMount() {
89336
89319
  super.onMount(), this.mounted = !0;
@@ -89407,8 +89390,8 @@ FilterFormItemModel.registerFlow({
89407
89390
  "x-component": "Input",
89408
89391
  "x-decorator": "FormItem",
89409
89392
  "x-reactions": (t) => {
89410
- var r, i;
89411
- const o = e.model, n = ((r = o.collectionField) == null ? void 0 : r.title) || ((i = e.filterField) == null ? void 0 : i.title);
89393
+ var r, i, a;
89394
+ const o = e.model, n = ((r = o.collectionField) == null ? void 0 : r.title) || ((i = e.filterField) == null ? void 0 : i.title) || ((a = e.filterField) == null ? void 0 : a.name) || o.fieldPath;
89412
89395
  t.decoratorProps = A(x({}, t.decoratorProps), {
89413
89396
  extra: o.context.t("Original field title: ") + n
89414
89397
  });
@@ -89416,14 +89399,15 @@ FilterFormItemModel.registerFlow({
89416
89399
  }
89417
89400
  }),
89418
89401
  defaultParams: (e) => {
89419
- var t, o;
89402
+ var t, o, n;
89420
89403
  return {
89421
- label: ((t = e.collectionField) == null ? void 0 : t.title) || ((o = e.filterField) == null ? void 0 : o.title)
89404
+ label: ((t = e.collectionField) == null ? void 0 : t.title) || ((o = e.filterField) == null ? void 0 : o.title) || ((n = e.filterField) == null ? void 0 : n.name)
89422
89405
  };
89423
89406
  },
89424
89407
  handler(e, t) {
89425
- var o;
89426
- t.label && t.label === ((o = e.collectionField) == null ? void 0 : o.title) ? e.model.setProps({ label: t.label }) : e.model.setProps({ label: e.t(t.label, { ns: "lm-flow-engine" }) });
89408
+ var n, r, i;
89409
+ const o = ((n = e.collectionField) == null ? void 0 : n.title) || ((r = e.filterField) == null ? void 0 : r.title) || ((i = e.filterField) == null ? void 0 : i.name);
89410
+ t.label && t.label === o ? e.model.setProps({ label: t.label }) : e.model.setProps({ label: e.t(t.label, { ns: "lm-flow-engine" }) });
89427
89411
  }
89428
89412
  },
89429
89413
  // aclCheck: {
@@ -89432,21 +89416,32 @@ FilterFormItemModel.registerFlow({
89432
89416
  init: {
89433
89417
  handler(e, t) {
89434
89418
  return V(this, null, function* () {
89435
- var n;
89436
- const o = e.model.collectionField;
89437
- if (o != null && o.getComponentProps) {
89438
- const i = o.getComponentProps(), l = ((n = e.model.subModels) == null ? void 0 : n.field) instanceof RecordSelectFieldModel, r = i || {}, { rules: c, required: u, multiple: d, allowMultiple: p, maxCount: m } = r, h = ee(r, ["rules", "required", "multiple", "allowMultiple", "maxCount"]);
89439
- e.model.setProps(A(x({}, l ? h : A(x({}, h), { multiple: d, allowMultiple: p, maxCount: m })), {
89419
+ var a, l, c, u, d;
89420
+ const o = t.filterField ? A(x({}, t.filterField), {
89421
+ title: ((a = t.filterField) == null ? void 0 : a.title) || ((l = t.filterField) == null ? void 0 : l.name)
89422
+ }) : t.filterField;
89423
+ e.model.context.defineProperty("filterField", {
89424
+ value: o
89425
+ }), e.model.setProps({
89426
+ name: `${e.model.fieldPath}_${e.model.uid}`
89427
+ // 确保每个字段的名称唯一
89428
+ });
89429
+ let n = e.model.collectionField;
89430
+ const r = ((u = (c = e.model).getFieldSettingsInitParams) == null ? void 0 : u.call(c)) || {};
89431
+ if (!!!// @ts-ignore
89432
+ (r != null && r.dataSourceKey && (r != null && r.collectionName)) && !n && o) {
89433
+ const m = buildVirtualFilterCollectionField(e, o);
89434
+ m && (e.model.context.defineProperty("collectionField", {
89435
+ value: m
89436
+ }), n = m);
89437
+ }
89438
+ if (n != null && n.getComponentProps) {
89439
+ const m = n.getComponentProps(), g = ((d = e.model.subModels) == null ? void 0 : d.field) instanceof RecordSelectFieldModel, p = m || {}, { rules: f, required: y, multiple: b, allowMultiple: S, maxCount: C } = p, F = ee(p, ["rules", "required", "multiple", "allowMultiple", "maxCount"]);
89440
+ e.model.setProps(A(x({}, g ? F : A(x({}, F), { multiple: b, allowMultiple: S, maxCount: C })), {
89440
89441
  rules: void 0,
89441
89442
  required: void 0
89442
89443
  }));
89443
89444
  }
89444
- e.model.setProps({
89445
- name: `${e.model.fieldPath}_${e.model.uid}`
89446
- // 确保每个字段的名称唯一
89447
- }), e.model.context.defineProperty("filterField", {
89448
- value: t.filterField
89449
- });
89450
89445
  });
89451
89446
  }
89452
89447
  },
@@ -91354,6 +91349,7 @@ const HighPerformanceTable = React.memo(
91354
91349
  return /* @__PURE__ */ jsx(
91355
91350
  MemoizedTable,
91356
91351
  {
91352
+ summary: t.props.summary,
91357
91353
  components: D,
91358
91354
  tableLayout: "fixed",
91359
91355
  size: o,
@@ -107595,8 +107591,6 @@ export {
107595
107591
  TimeFieldInterface,
107596
107592
  TimeFieldModel,
107597
107593
  TimePicker,
107598
- ToolsContext,
107599
- ToolsProvider,
107600
107594
  TreeSelect,
107601
107595
  UUIDFieldInterface,
107602
107596
  UnSupportFields,
@@ -108186,7 +108180,6 @@ export {
108186
108180
  useTemplateBlockContext,
108187
108181
  useTitleFieldOptions,
108188
108182
  useToken,
108189
- useTools,
108190
108183
  useUIConfigurationPermissions,
108191
108184
  useURLAndHTMLSchema,
108192
108185
  useURLSearchParamsCtx,