@nocobase/client 1.3.52 → 1.3.53

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.
@@ -8,7 +8,6 @@
8
8
  */
9
9
  export * from './checkbox';
10
10
  export * from './checkboxGroup';
11
- export * from './chinaRegion';
12
11
  export * from './collection';
13
12
  export * from './color';
14
13
  export * from './createdAt';
@@ -69,7 +69,7 @@ export interface CollectionFieldDefaultInitializerItem {
69
69
  schema: ISchema;
70
70
  }
71
71
  export interface CollectionFieldGetInitializerItemResult {
72
- find?: (schema: Schema, key: string, action: string) => any;
72
+ find?: (schema: Schema, key: string, action: string, name?: string) => any;
73
73
  remove?: (schema: Schema, cb: (schema: Schema, stopProps: Record<string, any>) => void) => void;
74
74
  }
75
75
  export interface CommonCollectionFieldsProps {
package/es/index.d.ts CHANGED
@@ -24,7 +24,6 @@ export * from './appInfo';
24
24
  export * from './application';
25
25
  export * from './async-data-provider';
26
26
  export * from './block-provider';
27
- export * from './china-region';
28
27
  export * from './collection-manager';
29
28
  export * from './common';
30
29
  export * from './css-variable';
package/es/index.mjs CHANGED
@@ -54,7 +54,7 @@ export * from "@emotion/css";
54
54
  import jsxRuntime, { jsx, Fragment, jsxs } from "react/jsx-runtime";
55
55
  import * as formilyReact from "@formily/react";
56
56
  import { SchemaOptionsContext, SchemaExpressionScopeContext, Schema, useField, useFieldSchema, useExpressionScope, useForm, Observer, observer as observer$1, connect, SchemaComponentsContext, ExpressionScope, FormProvider as FormProvider$1, RecursionField, mapProps, mapReadPretty, FormContext, useFormEffects, FieldContext, ObjectField, ArrayField, createSchemaField, SchemaContext } from "@formily/react";
57
- import _, { filter, get, uniqBy, every, some, findIndex, set as set$1, concat, isObject as isObject$1, isString, isEmpty as isEmpty$1, isEqual, cloneDeep as cloneDeep$1, last, clone, debounce, castArray, differenceBy, unionBy, omit as omit$1, isBoolean, uniq as uniq$2, pick as pick$1 } from "lodash";
57
+ import _, { filter, get, uniqBy, every, some, findIndex, set as set$1, concat, isObject as isObject$1, isString, isEmpty as isEmpty$1, isEqual, cloneDeep as cloneDeep$1, last, clone, debounce, castArray, differenceBy, unionBy, omit as omit$1, isFunction as isFunction$1, isBoolean, uniq as uniq$2, pick as pick$1 } from "lodash";
58
58
  import React, { createContext, useContext, useCallback, useRef, useEffect, isValidElement, useMemo, useState, memo, createElement, Fragment as Fragment$1, useLayoutEffect, forwardRef, useImperativeHandle, useTransition, createRef } from "react";
59
59
  import * as ReactRouterDom from "react-router-dom";
60
60
  import { useNavigate, useLocation, Outlet, useHref, UNSAFE_RouteContext, UNSAFE_LocationContext, useRoutes, HashRouter, BrowserRouter, MemoryRouter, useParams, Link as Link$1, Navigate, NavLink, useSearchParams, useOutletContext, useMatch, Router } from "react-router-dom";
@@ -763,6 +763,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
763
763
  get useColumnSchema() {
764
764
  return useColumnSchema$1;
765
765
  },
766
+ get useCurrentPopupContext() {
767
+ return useCurrentPopupContext;
768
+ },
766
769
  get useDatePickerContext() {
767
770
  return useDatePickerContext;
768
771
  },
@@ -1146,12 +1149,6 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1146
1149
  get CheckboxGroupFieldInterface() {
1147
1150
  return CheckboxGroupFieldInterface;
1148
1151
  },
1149
- get ChinaRegionFieldInterface() {
1150
- return ChinaRegionFieldInterface;
1151
- },
1152
- get ChinaRegionProvider() {
1153
- return ChinaRegionProvider;
1154
- },
1155
1152
  get ClearCollectionFieldContext() {
1156
1153
  return ClearCollectionFieldContext;
1157
1154
  },
@@ -3141,6 +3138,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3141
3138
  get useCurrentDocumentTitle() {
3142
3139
  return useCurrentDocumentTitle;
3143
3140
  },
3141
+ get useCurrentPopupContext() {
3142
+ return useCurrentPopupContext;
3143
+ },
3144
3144
  get useCurrentRoleVariable() {
3145
3145
  return useCurrentRoleVariable;
3146
3146
  },
@@ -4140,7 +4140,7 @@ function addAppVersion(e, t) {
4140
4140
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
4141
4141
  }), e;
4142
4142
  }
4143
- const name = "@nocobase/client", version$1 = "1.3.52", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4143
+ const name = "@nocobase/client", version$1 = "1.3.53", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4144
4144
  "@ahooksjs/use-url-state": "3.5.1",
4145
4145
  "@ant-design/cssinjs": "^1.11.1",
4146
4146
  "@ant-design/icons": "^5.1.4",
@@ -4161,9 +4161,9 @@ const name = "@nocobase/client", version$1 = "1.3.52", license = "AGPL-3.0", mai
4161
4161
  "@formily/reactive-react": "^2.2.27",
4162
4162
  "@formily/shared": "^2.2.27",
4163
4163
  "@formily/validator": "^2.2.27",
4164
- "@nocobase/evaluators": "1.3.52",
4165
- "@nocobase/sdk": "1.3.52",
4166
- "@nocobase/utils": "1.3.52",
4164
+ "@nocobase/evaluators": "1.3.53",
4165
+ "@nocobase/sdk": "1.3.53",
4166
+ "@nocobase/utils": "1.3.53",
4167
4167
  ahooks: "^3.7.2",
4168
4168
  antd: "5.12.8",
4169
4169
  "antd-style": "3.7.1",
@@ -10377,10 +10377,10 @@ const BlockTemplateContext = createContext({ componentNamePrefix: "" }), BlockTe
10377
10377
  }
10378
10378
  }), (n = e.values) == null || delete n[t.name];
10379
10379
  };
10380
- }, findTableColumn = (e, t, o, n = 0) => e.reduceProperties((r, i) => {
10381
- if (i[t] === o)
10380
+ }, findTableColumn = (e, t, o, n) => e.reduceProperties((r, i) => {
10381
+ if (i[t] === o && (!n || i.name === n))
10382
10382
  return i;
10383
- const a = i.reduceProperties((l, c) => c[t] === o ? c : l);
10383
+ const a = i.reduceProperties((l, c) => c[t] === o && (!n || c.name === n) ? c : l);
10384
10384
  return a || r;
10385
10385
  }), quickEditField$1 = [
10386
10386
  "attachment",
@@ -14454,7 +14454,7 @@ const useTableSelectorParams = () => useContext(TableSelectorParamsContext), Tab
14454
14454
  return useEffect(() => {
14455
14455
  var k, T, D, $, V, O, N, R, B, j, w, M, q, L, E;
14456
14456
  if (!((k = t == null ? void 0 : t.service) != null && k.loading)) {
14457
- const K = (D = (T = t == null ? void 0 : t.service) == null ? void 0 : T.data) == null ? void 0 : D.data.map((U) => _.omit(U, i == null ? void 0 : i.foreignKey));
14457
+ const K = (D = (T = t == null ? void 0 : t.service) == null ? void 0 : T.data) == null ? void 0 : D.data.map((U) => U);
14458
14458
  e.value = K, ($ = e == null ? void 0 : e.setInitialValue) == null || $.call(e, K), e.data = e.data || {}, e.data.selectedRowKeys = (O = (V = t == null ? void 0 : t.field) == null ? void 0 : V.data) == null ? void 0 : O.selectedRowKeys, e.componentProps.pagination = e.componentProps.pagination || {}, e.componentProps.pagination.pageSize = (B = (R = (N = t == null ? void 0 : t.service) == null ? void 0 : N.data) == null ? void 0 : R.meta) == null ? void 0 : B.pageSize, e.componentProps.pagination.total = (M = (w = (j = t == null ? void 0 : t.service) == null ? void 0 : j.data) == null ? void 0 : w.meta) == null ? void 0 : M.count, e.componentProps.pagination.current = (E = (L = (q = t == null ? void 0 : t.service) == null ? void 0 : q.data) == null ? void 0 : L.meta) == null ? void 0 : E.page;
14459
14459
  }
14460
14460
  }, [
@@ -35579,9 +35579,6 @@ const ButtonLinkList = (e) => {
35579
35579
  border: none !important;
35580
35580
  background: none;
35581
35581
  }
35582
- .ant-checkbox-wrapper {
35583
- margin-left: 8px;
35584
- }
35585
35582
  .ant-table {
35586
35583
  margin: 0px !important;
35587
35584
  }
@@ -35593,6 +35590,7 @@ const ButtonLinkList = (e) => {
35593
35590
  `,
35594
35591
  layout: "vertical",
35595
35592
  bordered: !1,
35593
+ feedbackLayout: "popover",
35596
35594
  children: /* @__PURE__ */ jsx(
35597
35595
  SchemaOptionsContext.Provider,
35598
35596
  {
@@ -37629,21 +37627,21 @@ const blockDeleteSettings = new SchemaSettings({
37629
37627
  "changeOnSelectLast",
37630
37628
  "changeOnSelect",
37631
37629
  "maxLevel"
37632
- ]), m = h(h({}, defaultFieldNames), e.fieldNames), g = l(e), { loading: x, run: f } = a(
37630
+ ]), m = h(h({}, defaultFieldNames), e.fieldNames), g = isFunction$1(l) ? l(e) : [], { loading: x, run: f } = isFunction$1(l) ? a(
37633
37631
  {
37634
37632
  onSuccess(y) {
37635
37633
  t.dataSource = (y == null ? void 0 : y.data) || [];
37636
37634
  }
37637
37635
  },
37638
37636
  e
37639
- ), C = () => toArr$3(o).map((y) => typeof y == "object" ? y[m.value] : y), S = (y, P) => /* @__PURE__ */ jsx(Space$1, { split: "/", children: y.map((A, k) => {
37637
+ ) : {}, C = () => toArr$3(o).map((y) => typeof y == "object" ? y[m.value] : y), S = (y, P) => /* @__PURE__ */ jsx(Space$1, { split: "/", children: y.map((A, k) => {
37640
37638
  if (P[k])
37641
37639
  return /* @__PURE__ */ jsx("span", { children: A }, k);
37642
37640
  const T = toArr$3(o).filter(Boolean).find((D) => D[m.value] === A);
37643
37641
  return /* @__PURE__ */ jsx("span", { children: (T == null ? void 0 : T[m.label]) || A }, k);
37644
37642
  }) }), b = (y) => {
37645
37643
  var P;
37646
- y && !((P = t.dataSource) != null && P.length) && f();
37644
+ y && !((P = t.dataSource) != null && P.length) && (f == null || f());
37647
37645
  };
37648
37646
  return /* @__PURE__ */ jsx(
37649
37647
  Cascader$1,
@@ -47449,80 +47447,6 @@ class CheckboxGroupFieldInterface extends CollectionFieldInterface {
47449
47447
  ["Table", "Kanban"].includes(n) && (o["x-component-props"] = o["x-component-props"] || {}, o["x-component-props"].ellipsis = !0);
47450
47448
  }
47451
47449
  }
47452
- class ChinaRegionFieldInterface extends CollectionFieldInterface {
47453
- constructor() {
47454
- super(...arguments);
47455
- I(this, "name", "chinaRegion");
47456
- I(this, "type", "object");
47457
- I(this, "group", "choices");
47458
- I(this, "order", 7);
47459
- I(this, "title", '{{t("China region")}}');
47460
- I(this, "isAssociation", !0);
47461
- I(this, "default", {
47462
- interface: "chinaRegion",
47463
- type: "belongsToMany",
47464
- target: "chinaRegions",
47465
- targetKey: "code",
47466
- sortBy: "level",
47467
- uiSchema: {
47468
- type: "array",
47469
- "x-component": "Cascader",
47470
- "x-component-props": {
47471
- useDataSource: "{{ useChinaRegionDataSource }}",
47472
- useLoadData: "{{ useChinaRegionLoadData }}",
47473
- changeOnSelectLast: !1,
47474
- labelInValue: !0,
47475
- maxLevel: 3,
47476
- fieldNames: {
47477
- label: "name",
47478
- value: "code",
47479
- children: "children"
47480
- }
47481
- }
47482
- }
47483
- });
47484
- I(this, "availableTypes", ["belongsToMany"]);
47485
- I(this, "properties", F(h({}, defaultProps), {
47486
- "uiSchema.x-component-props.maxLevel": {
47487
- type: "number",
47488
- "x-component": "Radio.Group",
47489
- "x-decorator": "FormItem",
47490
- title: '{{t("Select level")}}',
47491
- default: 3,
47492
- enum: [
47493
- { value: 1, label: '{{t("Province")}}' },
47494
- { value: 2, label: '{{t("City")}}' },
47495
- { value: 3, label: '{{t("Area")}}' },
47496
- { value: 4, label: '{{t("Street")}}', disabled: !0 },
47497
- { value: 5, label: '{{t("Village")}}', disabled: !0 }
47498
- ]
47499
- },
47500
- "uiSchema.x-component-props.changeOnSelectLast": {
47501
- type: "boolean",
47502
- "x-component": "Checkbox",
47503
- "x-content": '{{t("Must select to the last level")}}',
47504
- "x-decorator": "FormItem"
47505
- }
47506
- }));
47507
- I(this, "filterable", {
47508
- children: [
47509
- {
47510
- name: "name",
47511
- title: '{{t("Province/city/area name")}}',
47512
- operators: string,
47513
- schema: {
47514
- title: '{{t("Province/city/area name")}}',
47515
- type: "string",
47516
- "x-component": "Input"
47517
- }
47518
- }
47519
- ]
47520
- });
47521
- }
47522
- initialize(o) {
47523
- o.through || (o.through = `t_${uid()}`), o.foreignKey || (o.foreignKey = `f_${uid()}`), o.otherKey || (o.otherKey = `f_${uid()}`), o.sourceKey || (o.sourceKey = "id"), o.targetKey || (o.targetKey = "id");
47524
- }
47525
- }
47526
47450
  class CollectionSelectFieldInterface extends CollectionFieldInterface {
47527
47451
  constructor() {
47528
47452
  super(...arguments);
@@ -51193,7 +51117,6 @@ class CollectionPlugin extends Plugin {
51193
51117
  this.dataSourceManager.addFieldInterfaces([
51194
51118
  CheckboxFieldInterface,
51195
51119
  CheckboxGroupFieldInterface,
51196
- ChinaRegionFieldInterface,
51197
51120
  CollectionSelectFieldInterface,
51198
51121
  ColorFieldInterface,
51199
51122
  CreatedAtFieldInterface,
@@ -54245,48 +54168,7 @@ class AntdConfigPlugin extends Plugin {
54245
54168
  });
54246
54169
  }
54247
54170
  }
54248
- const useChinaRegionDataSource = (e) => {
54249
- const o = useField().componentProps.maxLevel;
54250
- return useRequest(
54251
- {
54252
- resource: "chinaRegions",
54253
- action: "list",
54254
- params: {
54255
- sort: "code",
54256
- paginate: !1,
54257
- filter: {
54258
- level: 1
54259
- }
54260
- }
54261
- },
54262
- F(h({}, e), {
54263
- onSuccess(n) {
54264
- var r;
54265
- e == null || e.onSuccess({
54266
- data: ((r = n == null ? void 0 : n.data) == null ? void 0 : r.map((i) => (o !== 1 && (i.isLeaf = !1), i))) || []
54267
- });
54268
- }
54269
- })
54270
- );
54271
- }, useChinaRegionLoadData = () => {
54272
- const e = useAPIClient(), t = useField(), o = t.componentProps.maxLevel;
54273
- return (n) => {
54274
- var i;
54275
- const r = n[n.length - 1];
54276
- ((i = r == null ? void 0 : r.children) == null ? void 0 : i.length) > 0 || (r.loading = !0, e.resource("chinaRegions").list({
54277
- sort: "code",
54278
- paginate: !1,
54279
- filter: {
54280
- parentCode: r.code
54281
- }
54282
- }).then(({ data: a }) => {
54283
- var l;
54284
- r.loading = !1, r.children = ((l = a == null ? void 0 : a.data) == null ? void 0 : l.map((c) => (o > c.level && (c.isLeaf = !1), c))) || [], t.dataSource = [...t.dataSource];
54285
- }).catch((a) => {
54286
- error(a);
54287
- }));
54288
- };
54289
- }, ChinaRegionProvider = (e) => /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { useChinaRegionDataSource, useChinaRegionLoadData }, children: e.children }), PinnedPluginListContext = createContext({ items: {} });
54171
+ const PinnedPluginListContext = createContext({ items: {} });
54290
54172
  PinnedPluginListContext.displayName = "PinnedPluginListContext";
54291
54173
  const PinnedPluginListProvider = (e) => {
54292
54174
  const { children: t, items: o } = e, n = useContext(PinnedPluginListContext);
@@ -59289,8 +59171,6 @@ export {
59289
59171
  Checkbox,
59290
59172
  CheckboxFieldInterface,
59291
59173
  CheckboxGroupFieldInterface,
59292
- ChinaRegionFieldInterface,
59293
- ChinaRegionProvider,
59294
59174
  ClearCollectionFieldContext,
59295
59175
  Collection,
59296
59176
  CollectionCategoriesContext,
@@ -59954,6 +59834,7 @@ export {
59954
59834
  useCreateTableBlock,
59955
59835
  useCurrentAppInfo,
59956
59836
  useCurrentDocumentTitle,
59837
+ useCurrentPopupContext,
59957
59838
  useCurrentRoleVariable,
59958
59839
  useCurrentRoles,
59959
59840
  useCurrentSchema,
@@ -11,7 +11,7 @@ export * from './FixedBlock';
11
11
  export * from './FixedBlockDesignerItem';
12
12
  export * from './Page';
13
13
  export * from './Page.Settings';
14
- export { PagePopups } from './PagePopups';
14
+ export { PagePopups, useCurrentPopupContext } from './PagePopups';
15
15
  export { getStoredPopupContext, storePopupContext } from './pagePopupUtils';
16
16
  export * from './PageTab.Settings';
17
17
  export { PopupSettingsProvider, usePopupSettings } from './PopupSettingsProvider';
@@ -82,7 +82,7 @@ export declare const gridRowColWrap: (schema: ISchema) => {
82
82
  export declare const removeTableColumn: (schema: any, cb: any) => void;
83
83
  export declare const removeGridFormItem: (schema: any, cb: any) => void;
84
84
  export declare const useRemoveGridFormItem: () => (schema: any, cb: any) => void;
85
- export declare const findTableColumn: (schema: Schema, key: string, action: string, deepth?: number) => unknown;
85
+ export declare const findTableColumn: (schema: Schema, key: string, action: string, name: string) => unknown;
86
86
  export declare function useTableColumnInitializerFields(): SchemaInitializerItemType[];
87
87
  export declare function useAssociatedTableColumnInitializerFields(): SchemaInitializerItemType[];
88
88
  export declare function useInheritsTableColumnInitializerFields(): {