@nocobase/client 1.9.38 → 1.9.40

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.
package/es/index.mjs CHANGED
@@ -53,7 +53,7 @@ import { css, cx } from "@emotion/css";
53
53
  export * from "@emotion/css";
54
54
  import jsxRuntime, { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
55
55
  import * as formilyReact from "@formily/react";
56
- import { Observer, SchemaOptionsContext, SchemaComponentsContext, ExpressionScope, Schema, connect, mapProps, useField, useExpressionScope, useFieldSchema, SchemaExpressionScopeContext, observer as observer$1, FormContext, FormProvider as FormProvider$1, useForm, mapReadPretty, FieldContext, ObjectField, ArrayField, RecursionField, SchemaContext, VoidField, Field, createSchemaField } from "@formily/react";
56
+ import { Observer, SchemaOptionsContext, SchemaComponentsContext, ExpressionScope, Schema, connect, mapProps, useField, useExpressionScope, useFieldSchema, SchemaExpressionScopeContext, observer as observer$1, FormContext, FormProvider as FormProvider$1, useForm, mapReadPretty, FieldContext, ObjectField, ArrayField, RecursionField, SchemaContext, VoidField, Field, createSchemaField, useFormEffects } from "@formily/react";
57
57
  import * as ahooks from "ahooks";
58
58
  import { useSetState, useRequest as useRequest$1, useBoolean, useUpdate, useMemoizedFn, useDeepCompareEffect, useEventListener, useLocalStorageState, useCreation, useDebounce } from "ahooks";
59
59
  import * as antd from "antd";
@@ -97,7 +97,7 @@ import { matchRoutes } from "react-router";
97
97
  import omit$1 from "lodash/omit";
98
98
  import qs from "qs";
99
99
  import * as formilyCore from "@formily/core";
100
- import { createForm, onFormValuesChange, onFieldValueChange, onFieldChange, isArrayField, onFormInputChange, onFieldInit, onFieldInputValueChange, onFormSubmitSuccess, registerValidateFormats, registerValidateRules as registerValidateRules$1 } from "@formily/core";
100
+ import { createForm, onFormValuesChange, onFieldValueChange, onFieldChange, isArrayField, onFormInputChange, onFieldInit, onFieldInputValueChange, onFormReset, onFormSubmitSuccess, registerValidateFormats, registerValidateRules as registerValidateRules$1 } from "@formily/core";
101
101
  import dayjs from "dayjs";
102
102
  import flat, { unflatten } from "flat";
103
103
  import * as nocobaseEvaluators from "@nocobase/evaluators/client";
@@ -2785,6 +2785,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2785
2785
  get VariablePopupRecordProvider() {
2786
2786
  return VariablePopupRecordProvider;
2787
2787
  },
2788
+ get VariableScope() {
2789
+ return VariableScope;
2790
+ },
2788
2791
  get VariableScopeProvider() {
2789
2792
  return VariableScopeProvider;
2790
2793
  },
@@ -8855,7 +8858,7 @@ function addAppVersion(e, t) {
8855
8858
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
8856
8859
  }), e;
8857
8860
  }
8858
- const name = "@nocobase/client", version = "1.9.38", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8861
+ const name = "@nocobase/client", version = "1.9.40", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8859
8862
  "@ahooksjs/use-url-state": "3.5.1",
8860
8863
  "@ant-design/cssinjs": "^1.11.1",
8861
8864
  "@ant-design/icons": "^5.6.1",
@@ -8876,9 +8879,9 @@ const name = "@nocobase/client", version = "1.9.38", license = "AGPL-3.0", main
8876
8879
  "@formily/reactive-react": "^2.2.27",
8877
8880
  "@formily/shared": "^2.2.27",
8878
8881
  "@formily/validator": "^2.2.27",
8879
- "@nocobase/evaluators": "1.9.38",
8880
- "@nocobase/sdk": "1.9.38",
8881
- "@nocobase/utils": "1.9.38",
8882
+ "@nocobase/evaluators": "1.9.40",
8883
+ "@nocobase/sdk": "1.9.40",
8884
+ "@nocobase/utils": "1.9.40",
8882
8885
  ahooks: "^3.7.2",
8883
8886
  antd: "5.24.2",
8884
8887
  "antd-mobile": "^5.41.1",
@@ -21796,7 +21799,7 @@ const SchemaSettingsProvider = (e) => {
21796
21799
  a(C);
21797
21800
  });
21798
21801
  }, h = () => {
21799
- d(!0);
21802
+ d(!0), a(!0);
21800
21803
  };
21801
21804
  if (!u)
21802
21805
  return /* @__PURE__ */ jsx("div", { onMouseEnter: h, "data-testid": e["data-testid"], children: typeof t == "string" ? /* @__PURE__ */ jsx("span", { children: t }) : t });
@@ -45261,7 +45264,7 @@ const InternalFileManager = (e) => {
45261
45264
  var C, b;
45262
45265
  (C = a.values) != null && C[i.name] || (n && n.values.select_array && !((b = a.values) != null && b[i.name]) ? (n.setValuesIn("select_array", void 0), setTimeout(() => {
45263
45266
  n.setValuesIn("select_array", [{}]);
45264
- })) : n.reset());
45267
+ })) : n.setValuesIn(i.name, null));
45265
45268
  }, [(f = a.values) == null ? void 0 : f[i.name]]);
45266
45269
  const g = {
45267
45270
  type: "object",
@@ -45328,6 +45331,9 @@ const InternalFileManager = (e) => {
45328
45331
  schema: P(x({}, i), {
45329
45332
  default: u,
45330
45333
  title: "",
45334
+ "x-decorator-props": {
45335
+ feedbackLayout: "none"
45336
+ },
45331
45337
  "x-component": AssociationCascadeSelect,
45332
45338
  "x-component-props": x({}, e)
45333
45339
  })
@@ -46314,51 +46320,52 @@ function FinallyButton(h) {
46314
46320
  form: p,
46315
46321
  designable: m
46316
46322
  } = g;
46317
- var v, I, F, w, T, D;
46318
- const { getCollection: b } = useCollectionManager_deprecated(), S = useACLActionParamsContext(), y = useMemo(() => {
46319
- var M;
46320
- const B = m && (((M = d == null ? void 0 : d.data) == null ? void 0 : M.hidden) || !S);
46323
+ var I, F, w, T, D, B, N, M;
46324
+ const { getCollection: b } = useCollectionManager_deprecated(), S = useACLActionParamsContext(), y = (p == null ? void 0 : p.disabled) || ((I = d == null ? void 0 : d.data) == null ? void 0 : I.disabled) || ((F = d == null ? void 0 : d.componentProps) == null ? void 0 : F.disabled) || (r == null ? void 0 : r.disabled), v = useMemo(() => {
46325
+ var O;
46326
+ const j = m && (((O = d == null ? void 0 : d.data) == null ? void 0 : O.hidden) || !S);
46321
46327
  return {
46322
- opacity: a !== "link" && B ? 0.1 : 1
46328
+ opacity: a !== "link" && j ? 0.1 : 1
46323
46329
  };
46324
- }, [m, (v = d == null ? void 0 : d.data) == null ? void 0 : v.hidden, S, a]);
46330
+ }, [m, (w = d == null ? void 0 : d.data) == null ? void 0 : w.hidden, S, a]);
46325
46331
  return (e == null ? void 0 : e.length) > 0 ? t ? /* @__PURE__ */ jsx(
46326
46332
  Button,
46327
46333
  {
46328
46334
  "aria-label": r["aria-label"],
46329
46335
  type: a,
46330
- disabled: d.disabled,
46336
+ disabled: y,
46331
46337
  danger: r.danger,
46332
46338
  icon: u,
46333
- onClick: (B) => {
46334
- const N = getLinkageCollection(t, p, d), M = e.find((R) => R.name === N) ? N : c.name, j = b(M);
46335
- l == null || l(j);
46339
+ onClick: (j) => {
46340
+ const R = getLinkageCollection(t, p, d), O = e.find((A) => A.name === R) ? R : c.name, $ = b(O);
46341
+ l == null || l($);
46336
46342
  },
46337
46343
  style: x({
46338
- display: !m && ((I = d == null ? void 0 : d.data) == null ? void 0 : I.hidden) && "none",
46339
- opacity: m && ((F = d == null ? void 0 : d.data) == null ? void 0 : F.hidden) && 0.1
46340
- }, y),
46344
+ display: !m && ((T = d == null ? void 0 : d.data) == null ? void 0 : T.hidden) && "none",
46345
+ opacity: m && ((D = d == null ? void 0 : d.data) == null ? void 0 : D.hidden) && 0.1
46346
+ }, v),
46341
46347
  children: r.children
46342
46348
  }
46343
46349
  ) : n === void 0 || n ? /* @__PURE__ */ jsxs(
46344
46350
  Dropdown.Button,
46345
46351
  {
46346
46352
  "aria-label": r["aria-label"],
46353
+ disabled: y,
46347
46354
  danger: r.danger,
46348
46355
  type: a,
46349
46356
  icon: /* @__PURE__ */ jsx(DownOutlined, {}),
46350
- style: x(x({}, r == null ? void 0 : r.style), y),
46351
- buttonsRender: ([B, N]) => [
46352
- React.cloneElement(B, {
46357
+ style: x(x({}, r == null ? void 0 : r.style), v),
46358
+ buttonsRender: ([j, R]) => [
46359
+ React.cloneElement(j, {
46353
46360
  style: r == null ? void 0 : r.style
46354
46361
  }),
46355
- React.cloneElement(N, {
46362
+ React.cloneElement(R, {
46356
46363
  loading: !1,
46357
46364
  style: P(x({}, r == null ? void 0 : r.style), { justifyContent: "center" })
46358
46365
  })
46359
46366
  ],
46360
46367
  menu: i,
46361
- onClick: (B) => {
46368
+ onClick: (j) => {
46362
46369
  l == null || l(c);
46363
46370
  },
46364
46371
  children: [
@@ -46366,14 +46373,15 @@ function FinallyButton(h) {
46366
46373
  r.children
46367
46374
  ]
46368
46375
  }
46369
- ) : /* @__PURE__ */ jsx(Dropdown, { menu: i, children: /* @__PURE__ */ jsxs(
46376
+ ) : /* @__PURE__ */ jsx(Dropdown, { menu: i, disabled: y, children: /* @__PURE__ */ jsxs(
46370
46377
  Button,
46371
46378
  {
46372
46379
  "aria-label": r["aria-label"],
46380
+ disabled: y,
46373
46381
  icon: u,
46374
46382
  type: a,
46375
46383
  danger: r.danger,
46376
- style: x(x({}, r == null ? void 0 : r.style), y),
46384
+ style: x(x({}, r == null ? void 0 : r.style), v),
46377
46385
  children: [
46378
46386
  r.children,
46379
46387
  " ",
@@ -46385,17 +46393,17 @@ function FinallyButton(h) {
46385
46393
  P(x({}, r), {
46386
46394
  "aria-label": r["aria-label"],
46387
46395
  type: a,
46388
- disabled: d.disabled,
46396
+ disabled: y,
46389
46397
  danger: r.danger,
46390
46398
  icon: u,
46391
- onClick: (B) => {
46399
+ onClick: (j) => {
46392
46400
  l == null || l(c);
46393
46401
  },
46394
46402
  style: x(P(x({}, r == null ? void 0 : r.style), {
46395
- display: !m && ((w = d == null ? void 0 : d.data) != null && w.hidden) ? "none" : "inline-block",
46396
- opacity: m && ((T = d == null ? void 0 : d.data) == null ? void 0 : T.hidden) && 0.1
46397
- }), y),
46398
- children: o ? (D = r == null ? void 0 : r.children) == null ? void 0 : D[1] : r == null ? void 0 : r.children
46403
+ display: !m && ((B = d == null ? void 0 : d.data) != null && B.hidden) ? "none" : "inline-block",
46404
+ opacity: m && ((N = d == null ? void 0 : d.data) == null ? void 0 : N.hidden) && 0.1
46405
+ }), v),
46406
+ children: o ? (M = r == null ? void 0 : r.children) == null ? void 0 : M[1] : r == null ? void 0 : r.children
46399
46407
  })
46400
46408
  );
46401
46409
  }
@@ -50397,19 +50405,26 @@ const NanoIDInput = Object.assign(
50397
50405
  connect(
50398
50406
  Input$3,
50399
50407
  mapProps((e, t) => {
50400
- const { size: n, customAlphabet: o } = useCollectionField() || { size: 21 }, { t: r } = useTranslation(), a = useForm(), { isInFilterFormBlock: i } = useFlag();
50401
- function l(c) {
50402
- if ((c == null ? void 0 : c.length) !== n)
50403
- return r("Field value size is") + ` ${n || 21}`;
50404
- for (let u = 0; u < c.length; u++)
50405
- if ((o == null ? void 0 : o.indexOf(c[u])) === -1)
50406
- return r("Field value do not meet the requirements");
50408
+ const { size: n, customAlphabet: o, autoFill: r } = useCollectionField() || { size: 21 }, { t: a } = useTranslation(), i = useForm(), { isInFilterFormBlock: l } = useFlag();
50409
+ function c(u) {
50410
+ if ((u == null ? void 0 : u.length) !== n)
50411
+ return a("Field value size is") + ` ${n || 21}`;
50412
+ for (let d = 0; d < u.length; d++)
50413
+ if ((o == null ? void 0 : o.indexOf(u[d])) === -1)
50414
+ return a("Field value do not meet the requirements");
50407
50415
  }
50408
50416
  return useEffect(() => {
50409
- !t.initialValue && o && !i && t.setInitialValue(customAlphabet(o, n)()), a.setFieldState(t.props.name, (c) => {
50410
- c.validator = l;
50417
+ !t.initialValue && o && !l && t.setInitialValue(customAlphabet(o, n)()), i.setFieldState(t.props.name, (u) => {
50418
+ u.validator = c;
50419
+ });
50420
+ }, [l]), useFormEffects(() => {
50421
+ onFormReset(() => {
50422
+ if (!o || l || r === !1)
50423
+ return;
50424
+ const u = customAlphabet(o, n)();
50425
+ t.setInitialValue(u), t.setValue(u);
50411
50426
  });
50412
- }, [i]), P(x({}, e), {
50427
+ }), P(x({}, e), {
50413
50428
  suffix: /* @__PURE__ */ jsx("span", { children: t != null && t.loading || t != null && t.validating ? /* @__PURE__ */ jsx(LoadingOutlined, {}) : e.suffix })
50414
50429
  });
50415
50430
  }),
@@ -70497,6 +70512,7 @@ export {
70497
70512
  Variable,
70498
70513
  VariableInput,
70499
70514
  VariablePopupRecordProvider,
70515
+ VariableScope,
70500
70516
  VariableScopeProvider,
70501
70517
  VariablesContext,
70502
70518
  VariablesProvider$1 as VariablesProvider,
@@ -16,4 +16,4 @@ export * from './utils/isVariable';
16
16
  export * from './utils/transformVariableValue';
17
17
  export * from './constants';
18
18
  export type { VariablesContextType } from './types';
19
- export { useVariableScopeInfo } from './VariableScope';
19
+ export { VariableScope, useVariableScopeInfo } from './VariableScope';