@nocobase/client 1.6.11 → 1.6.13

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.
@@ -14,4 +14,4 @@ export interface SelectWithTitleProps {
14
14
  fieldNames?: any;
15
15
  onChange?: (...args: any[]) => void;
16
16
  }
17
- export declare function SelectWithTitle({ title, defaultValue, onChange, options, fieldNames }: SelectWithTitleProps): React.JSX.Element;
17
+ export declare function SelectWithTitle({ title, defaultValue, onChange, options, fieldNames, ...others }: SelectWithTitleProps): React.JSX.Element;
package/es/index.mjs CHANGED
@@ -7470,26 +7470,39 @@ function replaceVariables(n, r) {
7470
7470
  };
7471
7471
  });
7472
7472
  }
7473
- function SelectWithTitle({ title: e, defaultValue: t, onChange: o, options: n, fieldNames: r }) {
7474
- const [i, a] = useState(!1), l = useRef(null);
7473
+ function SelectWithTitle(a) {
7474
+ var l = a, {
7475
+ title: e,
7476
+ defaultValue: t,
7477
+ onChange: o,
7478
+ options: n,
7479
+ fieldNames: r
7480
+ } = l, i = Y(l, [
7481
+ "title",
7482
+ "defaultValue",
7483
+ "onChange",
7484
+ "options",
7485
+ "fieldNames"
7486
+ ]);
7487
+ const [c, u] = useState(!1), d = useRef(null);
7475
7488
  return /* @__PURE__ */ jsxs(
7476
7489
  "div",
7477
7490
  {
7478
7491
  style: { alignItems: "center", display: "flex", justifyContent: "space-between" },
7479
- onClick: (c) => {
7480
- c.stopPropagation(), a((u) => !u);
7492
+ onClick: (p) => {
7493
+ p.stopPropagation(), u((m) => !m);
7481
7494
  },
7482
7495
  onMouseLeave: () => {
7483
- l.current = setTimeout(() => {
7484
- a(!1);
7496
+ d.current = setTimeout(() => {
7497
+ u(!1);
7485
7498
  }, 200);
7486
7499
  },
7487
7500
  children: [
7488
7501
  e,
7489
7502
  /* @__PURE__ */ jsx(
7490
7503
  Select$1,
7491
- {
7492
- open: i,
7504
+ P(x({}, i), {
7505
+ open: c,
7493
7506
  "data-testid": `select-${e}`,
7494
7507
  popupMatchSelectWidth: !1,
7495
7508
  bordered: !1,
@@ -7500,9 +7513,9 @@ function SelectWithTitle({ title: e, defaultValue: t, onChange: o, options: n, f
7500
7513
  options: n,
7501
7514
  style: { textAlign: "right", minWidth: 100 },
7502
7515
  onMouseEnter: () => {
7503
- clearTimeout(l.current);
7516
+ clearTimeout(d.current);
7504
7517
  }
7505
- }
7518
+ })
7506
7519
  )
7507
7520
  ]
7508
7521
  }
@@ -9168,7 +9181,7 @@ function addAppVersion(e, t) {
9168
9181
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
9169
9182
  }), e;
9170
9183
  }
9171
- const name = "@nocobase/client", version = "1.6.11", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9184
+ const name = "@nocobase/client", version = "1.6.13", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9172
9185
  "@ahooksjs/use-url-state": "3.5.1",
9173
9186
  "@ant-design/cssinjs": "^1.11.1",
9174
9187
  "@ant-design/icons": "^5.6.1",
@@ -9190,9 +9203,9 @@ const name = "@nocobase/client", version = "1.6.11", license = "AGPL-3.0", main
9190
9203
  "@formily/reactive-react": "^2.2.27",
9191
9204
  "@formily/shared": "^2.2.27",
9192
9205
  "@formily/validator": "^2.2.27",
9193
- "@nocobase/evaluators": "1.6.11",
9194
- "@nocobase/sdk": "1.6.11",
9195
- "@nocobase/utils": "1.6.11",
9206
+ "@nocobase/evaluators": "1.6.13",
9207
+ "@nocobase/sdk": "1.6.13",
9208
+ "@nocobase/utils": "1.6.13",
9196
9209
  ahooks: "^3.7.2",
9197
9210
  antd: "5.12.8",
9198
9211
  "antd-style": "3.7.1",
@@ -15272,7 +15285,7 @@ const wrapRowSchema = (e) => {
15272
15285
  schema: e
15273
15286
  })), Grid = observer$1(
15274
15287
  (e) => {
15275
- const { distributed: t, showDivider: o = !0 } = e, n = useRef(null), r = useField(), i = useFieldSchema(), { render: a } = useSchemaInitializerRender(i["x-initializer"], i["x-initializer-props"]), l = useCallback((S) => a(S), []), c = r.address.toString(), u = useRowProperties(), { setPrintContent: d } = useFormBlockContext(), { componentCls: p, hashId: m } = useStyles$g(), h = t === void 0 ? (i == null ? void 0 : i.parent["x-component"]) === "Page" || (i == null ? void 0 : i.parent["x-component"]) === "Tabs.TabPane" : t;
15288
+ const { distributed: t, showDivider: o = !0 } = e, n = useRef(null), r = useField(), i = useFieldSchema(), { render: a } = useSchemaInitializerRender(i["x-initializer"], i["x-initializer-props"]), l = useCallback((b) => a(b), []), c = r.address.toString(), u = useRowProperties(), { setPrintContent: d } = useFormBlockContext(), { componentCls: p, hashId: m } = useStyles$g(), h = t === void 0 ? (i == null ? void 0 : i.parent["x-component"]) === "Page" || (i == null ? void 0 : i.parent["x-component"]) === "Tabs.TabPane" : t;
15276
15289
  useEffect(() => {
15277
15290
  n.current && (d == null || d(n.current));
15278
15291
  }, [d]);
@@ -15282,10 +15295,10 @@ const wrapRowSchema = (e) => {
15282
15295
  renderSchemaInitializer: a,
15283
15296
  InitializerComponent: l,
15284
15297
  showDivider: o
15285
- }), [i, a, l, o]), f = useRefreshFieldSchema(), C = useRefreshComponent(), b = useCallback(() => {
15286
- f == null || f(), C == null || C();
15287
- }, [C, f]);
15288
- return /* @__PURE__ */ jsx(RefreshComponentProvider, { refresh: b, children: /* @__PURE__ */ jsx(FilterBlockProvider, { children: /* @__PURE__ */ jsx(GridContext.Provider, { value: g, children: /* @__PURE__ */ jsx("div", { className: cls("nb-grid-container"), children: /* @__PURE__ */ jsx("div", { className: cls(`nb-grid ${p} ${m}`), ref: n, children: /* @__PURE__ */ jsxs("div", { className: "nb-grid-warp", children: [
15298
+ }), [i, a, l, o]), f = useRefreshFieldSchema(), C = useCallback(() => {
15299
+ f == null || f();
15300
+ }, [f]);
15301
+ return /* @__PURE__ */ jsx(RefreshComponentProvider, { refresh: C, children: /* @__PURE__ */ jsx(FilterBlockProvider, { children: /* @__PURE__ */ jsx(GridContext.Provider, { value: g, children: /* @__PURE__ */ jsx("div", { className: cls("nb-grid-container"), children: /* @__PURE__ */ jsx("div", { className: cls(`nb-grid ${p} ${m}`), ref: n, children: /* @__PURE__ */ jsxs("div", { className: "nb-grid-warp", children: [
15289
15302
  /* @__PURE__ */ jsxs(DndWrapper, { dndContext: e.dndContext, children: [
15290
15303
  o ? /* @__PURE__ */ jsx(
15291
15304
  RowDivider,
@@ -15296,18 +15309,18 @@ const wrapRowSchema = (e) => {
15296
15309
  data: getRowDividerData(i, "afterBegin")
15297
15310
  }
15298
15311
  ) : null,
15299
- u.map((S, y) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
15300
- h ? /* @__PURE__ */ jsx(SchemaComponent, { name: S.name, schema: S, distributed: !0 }) : /* @__PURE__ */ jsx(NocoBaseRecursionField, { name: S.name, schema: S, isUseFormilyField: !0 }),
15312
+ u.map((b, S) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
15313
+ h ? /* @__PURE__ */ jsx(SchemaComponent, { name: b.name, schema: b, distributed: !0 }) : /* @__PURE__ */ jsx(NocoBaseRecursionField, { name: b.name, schema: b, isUseFormilyField: !0 }),
15301
15314
  o ? /* @__PURE__ */ jsx(
15302
15315
  RowDivider,
15303
15316
  {
15304
15317
  rows: u,
15305
- index: y,
15306
- id: `${c}_${y + 1}`,
15307
- data: getRowDividerData(S, "afterEnd")
15318
+ index: S,
15319
+ id: `${c}_${S + 1}`,
15320
+ data: getRowDividerData(b, "afterEnd")
15308
15321
  }
15309
15322
  ) : null
15310
- ] }, y))
15323
+ ] }, S))
15311
15324
  ] }),
15312
15325
  a()
15313
15326
  ] }) }) }) }) }) });
@@ -21460,8 +21473,8 @@ const findGridSchema = (e) => e.reduceProperties((t, o) => {
21460
21473
  }
21461
21474
  );
21462
21475
  }, SchemaSettingsSelectItem = (e) => {
21463
- const a = e, { title: t, options: o, value: n, onChange: r } = a, i = Y(a, ["title", "options", "value", "onChange"]);
21464
- return /* @__PURE__ */ jsx(SchemaSettingsItem, P(x({ title: t }, i), { children: /* @__PURE__ */ jsx(SelectWithTitle, { title: t, defaultValue: n, onChange: r, options: o }) }));
21476
+ const l = e, { title: t, options: o, value: n, onChange: r, optionRender: i } = l, a = Y(l, ["title", "options", "value", "onChange", "optionRender"]);
21477
+ return /* @__PURE__ */ jsx(SchemaSettingsItem, P(x({ title: t }, a), { children: /* @__PURE__ */ jsx(SelectWithTitle, { title: t, defaultValue: n, onChange: r, options: o, optionRender: i }) }));
21465
21478
  }, SchemaSettingsCascaderItem = (e) => {
21466
21479
  const a = e, { title: t, options: o, value: n, onChange: r } = a, i = Y(a, ["title", "options", "value", "onChange"]);
21467
21480
  return /* @__PURE__ */ jsx(SchemaSettingsItem, P(x({ title: t }, i), { children: /* @__PURE__ */ jsxs("div", { style: { alignItems: "center", display: "flex", justifyContent: "space-between" }, children: [
@@ -36597,7 +36610,7 @@ const useBuiltInVariables = () => {
36597
36610
  delete requested[e];
36598
36611
  }, uniq = (e) => !Array.isArray(e) || !_.isObject(e[0]) ? e : _.uniqBy(e, (t) => "id" in t ? t.id : JSON.stringify(t)), VariablesContext = createContext(null);
36599
36612
  VariablesContext.displayName = "VariablesContext";
36600
- const variablesStore = {}, getFieldPath = (e, t) => {
36613
+ const variablesStore = {}, getFieldPath$1 = (e, t) => {
36601
36614
  let o, n;
36602
36615
  return {
36603
36616
  fieldPath: e.split(".").map((a) => t[a] ? (o = t[a].dataSource, n = t[a], t[a].collectionName) : a).join("."),
@@ -36612,9 +36625,9 @@ const variablesStore = {}, getFieldPath = (e, t) => {
36612
36625
  var R, M;
36613
36626
  const y = C.split("."), v = y[0], F = mergeVariableToCollectionNameWithLocalVariables(variablesStore, b);
36614
36627
  let I = mergeCtxWithLocalVariables(o.current, b);
36615
- const { fieldPath: w, dataSource: k, variableOption: D } = getFieldPath(v, F);
36628
+ const { fieldPath: w, dataSource: k, variableOption: D } = getFieldPath$1(v, F);
36616
36629
  let N = w;
36617
- const { fieldPath: j } = getFieldPath(C, F), O = y.length === 1 ? D == null ? void 0 : D.collectionName : (R = r(j, k)) == null ? void 0 : R.target;
36630
+ const { fieldPath: j } = getFieldPath$1(C, F), O = y.length === 1 ? D == null ? void 0 : D.collectionName : (R = r(j, k)) == null ? void 0 : R.target;
36618
36631
  if (!(v in I))
36619
36632
  throw new Error(`VariablesProvider: ${v} is not found`);
36620
36633
  for (let $ = 0; $ < y.length; $++) {
@@ -36624,7 +36637,7 @@ const variablesStore = {}, getFieldPath = (e, t) => {
36624
36637
  dataSource: k,
36625
36638
  collectionName: O
36626
36639
  };
36627
- const T = y[$], z = y.slice(0, $ + 1).join("."), { fieldPath: L } = getFieldPath(z, F), E = r(L, k), q = (M = i(N, k)) == null ? void 0 : M.getPrimaryKey();
36640
+ const T = y[$], z = y.slice(0, $ + 1).join("."), { fieldPath: L } = getFieldPath$1(z, F), E = r(L, k), q = (M = i(N, k)) == null ? void 0 : M.getPrimaryKey();
36628
36641
  if (Array.isArray(I)) {
36629
36642
  const G = I.map((U) => {
36630
36643
  if (!(S != null && S.doNotRequest) && shouldToRequest(U == null ? void 0 : U[T]) && (U == null ? void 0 : U[q]) != null && E != null && E.target) {
@@ -36719,7 +36732,7 @@ const variablesStore = {}, getFieldPath = (e, t) => {
36719
36732
  const S = mergeVariableToCollectionNameWithLocalVariables(
36720
36733
  variablesStore,
36721
36734
  b
36722
- ), y = getPath(C), { fieldPath: v, dataSource: F } = getFieldPath(y, S);
36735
+ ), y = getPath(C), { fieldPath: v, dataSource: F } = getFieldPath$1(y, S);
36723
36736
  let I = r(v, F);
36724
36737
  return !I && !y.includes(".") && (I = {
36725
36738
  target: (w = S[y]) == null ? void 0 : w.collectionName
@@ -48504,7 +48517,12 @@ const AppendsTreeSelect = (e) => {
48504
48517
  const l = /\{\{\$[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*\.(\w+)\.id\}\}/, c = (p = (d = (u = i == null ? void 0 : i.value) == null ? void 0 : u.match) == null ? void 0 : d.call(u, l)) == null ? void 0 : p[1];
48505
48518
  c && n.push(c);
48506
48519
  }), n;
48507
- }, InternalAssociationSelect$1 = observer$1(
48520
+ };
48521
+ function getFieldPath(e) {
48522
+ const t = e.lastIndexOf(".");
48523
+ return t === -1 ? e : e.slice(0, t);
48524
+ }
48525
+ const InternalAssociationSelect$1 = observer$1(
48508
48526
  (e) => {
48509
48527
  var w;
48510
48528
  const I = e, { objectValue: t = !0, addMode: o } = I, n = Y(I, ["objectValue", "addMode"]), r = useField(), i = useFieldSchema(), a = useServiceOptions$1((i == null ? void 0 : i["x-component-props"]) || e), { options: l } = useAssociationFieldContext(), c = isVariable$1(e.value) ? void 0 : e.value, u = Array.isArray(c) ? c.filter(Boolean) : c, [d, p] = useState(u), m = (w = i["x-component-props"]) == null ? void 0 : w.addMode, { t: h } = useTranslation(), { multiple: g } = e, f = useForm(), b = useAPIClient().resource(l.target), S = useCollectionRecordData(), y = useContext(SchemaComponentContext);
@@ -48515,8 +48533,9 @@ const AppendsTreeSelect = (e) => {
48515
48533
  const k = uid();
48516
48534
  return f.addEffects(k, () => {
48517
48535
  onFieldInputValueChange("*", (D) => {
48518
- var j, O, B, R, M;
48519
- (filterAnalyses((B = (O = (j = r.componentProps) == null ? void 0 : j.service) == null ? void 0 : O.params) == null ? void 0 : B.filter) || []).includes((R = D == null ? void 0 : D.props) == null ? void 0 : R.name) && r.value && isEqual(D == null ? void 0 : D.indexes, r == null ? void 0 : r.indexes) && ((M = D == null ? void 0 : D.props) == null ? void 0 : M.name) !== r.props.name && (r.setValue(null), p(null));
48536
+ var B, R, M, $, T, z;
48537
+ const N = filterAnalyses((M = (R = (B = r.componentProps) == null ? void 0 : B.service) == null ? void 0 : R.params) == null ? void 0 : M.filter) || [], j = getFieldPath(D.address.entire), O = getFieldPath(r.address.entire);
48538
+ N.includes(($ = D == null ? void 0 : D.props) == null ? void 0 : $.name) && r.value && isEqual(D == null ? void 0 : D.indexes, r == null ? void 0 : r.indexes) && ((T = D == null ? void 0 : D.props) == null ? void 0 : T.name) !== r.props.name && (!((z = r == null ? void 0 : r.indexes) != null && z.length) || isEqual(j, O)) && (r.setValue(null), p(null));
48520
48539
  });
48521
48540
  }), () => {
48522
48541
  f.removeEffects(k);
@@ -72,6 +72,9 @@ export interface SchemaSettingsRemoveProps {
72
72
  export declare const SchemaSettingsRemove: FC<SchemaSettingsRemoveProps>;
73
73
  export interface SchemaSettingsSelectItemProps extends Omit<SchemaSettingsItemProps, 'onChange' | 'onClick'>, Omit<SelectWithTitleProps, 'title' | 'defaultValue'> {
74
74
  value?: SelectWithTitleProps['defaultValue'];
75
+ optionRender?: (option: any, info: {
76
+ index: number;
77
+ }) => React.ReactNode;
75
78
  }
76
79
  export declare const SchemaSettingsSelectItem: FC<SchemaSettingsSelectItemProps>;
77
80
  export type SchemaSettingsCascaderItemProps = CascaderProps<any> & Omit<MenuItemProps, 'title'> & {