@nocobase/client 1.6.22 → 1.6.24

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
@@ -9194,7 +9194,7 @@ function addAppVersion(e, t) {
9194
9194
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
9195
9195
  }), e;
9196
9196
  }
9197
- const name = "@nocobase/client", version = "1.6.22", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9197
+ const name = "@nocobase/client", version = "1.6.24", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9198
9198
  "@ahooksjs/use-url-state": "3.5.1",
9199
9199
  "@ant-design/cssinjs": "^1.11.1",
9200
9200
  "@ant-design/icons": "^5.6.1",
@@ -9216,9 +9216,9 @@ const name = "@nocobase/client", version = "1.6.22", license = "AGPL-3.0", main
9216
9216
  "@formily/reactive-react": "^2.2.27",
9217
9217
  "@formily/shared": "^2.2.27",
9218
9218
  "@formily/validator": "^2.2.27",
9219
- "@nocobase/evaluators": "1.6.22",
9220
- "@nocobase/sdk": "1.6.22",
9221
- "@nocobase/utils": "1.6.22",
9219
+ "@nocobase/evaluators": "1.6.24",
9220
+ "@nocobase/sdk": "1.6.24",
9221
+ "@nocobase/utils": "1.6.24",
9222
9222
  ahooks: "^3.7.2",
9223
9223
  antd: "5.12.8",
9224
9224
  "antd-style": "3.7.1",
@@ -20623,7 +20623,7 @@ const DynamicComponent$1 = (e) => {
20623
20623
  c("Syntax references"),
20624
20624
  ":"
20625
20625
  ] }),
20626
- /* @__PURE__ */ jsx("a", { href: "https://formulajs.info/functions/", target: "_blank", rel: "noreferrer", children: "Formula.js" })
20626
+ /* @__PURE__ */ jsx("a", { href: "https://docs.nocobase.com/handbook/calculation-engines/formula", target: "_blank", rel: "noreferrer", children: "Formula.js" })
20627
20627
  ] })
20628
20628
  ] })
20629
20629
  }, v = (I) => i ? i.indexOf(I) > -1 : !0, F = [
@@ -27429,6 +27429,23 @@ function renderTemplate(e, t) {
27429
27429
  return get$1(t, r) || "";
27430
27430
  });
27431
27431
  }
27432
+ function getFilteredFormValues(e) {
27433
+ const t = _.cloneDeep(e.values), n = [];
27434
+ e.query("*").forEach((r) => {
27435
+ r && n.push(r);
27436
+ });
27437
+ const o = n.filter((r) => {
27438
+ var i;
27439
+ return (i = r == null ? void 0 : r.componentProps) == null ? void 0 : i.readOnlySubmit;
27440
+ }).map((r) => {
27441
+ var a;
27442
+ const i = ((a = r.path) == null ? void 0 : a.segments) || [];
27443
+ return i.length <= 1 ? i.join(".") : i.slice(0, -1).join(".");
27444
+ });
27445
+ for (const r of o)
27446
+ _.unset(t, r);
27447
+ return t;
27448
+ }
27432
27449
  function getFormValues({
27433
27450
  filterByTk: e,
27434
27451
  field: t,
@@ -27445,7 +27462,7 @@ function getFormValues({
27445
27462
  });
27446
27463
  return omit$1(x({}, n.values), l);
27447
27464
  }
27448
- return n.values;
27465
+ return getFilteredFormValues(n);
27449
27466
  }
27450
27467
  function useCollectValuesToSubmit() {
27451
27468
  const e = useForm(), t = useFilterByTk(), { field: n, resource: o } = useBlockRequestContext(), { fields: r, getField: i, getTreeParentField: a, name: l } = useCollection_deprecated(), c = r.map((f) => f.name), { fieldSchema: u } = useActionContext(), { getActiveFieldsName: d } = useFormActiveFields() || {}, p = useVariables$1(), m = useLocalVariables$1({ currentForm: e }), h = useFieldSchema(), g = useTreeParentRecord();
@@ -29376,7 +29393,9 @@ const DragHandler = (e) => {
29376
29393
  r.parseVariable(S, b, { appends: y }).then(({ value: v }) => {
29377
29394
  nextTick(() => {
29378
29395
  const F = transformVariableValue(v, { targetCollectionField: p.current });
29379
- _.isEmpty(F) && !_.isNumber(F) ? i.value = null : i.value = F;
29396
+ _.isEmpty(F) && !_.isNumber(F) ? i.value = null : (i.value = F, i.componentProps = P(x({}, i.componentProps), {
29397
+ readOnlySubmit: !0
29398
+ }));
29380
29399
  });
29381
29400
  }).catch((v) => {
29382
29401
  console.error(v);
@@ -36668,11 +36687,11 @@ const useBuiltInVariables = () => {
36668
36687
  }
36669
36688
  ], [t, e, o, a, r, i]) };
36670
36689
  }, filterEmptyValues = (e) => Array.isArray(e) ? e.filter((t) => t === 0 || t === !1 || t) : e, TYPE_TO_ACTION = {
36671
- hasMany: "list?pageSize=9999",
36690
+ hasMany: "list?paginate=false",
36672
36691
  belongsTo: "get",
36673
36692
  hasOne: "get",
36674
- belongsToMany: "list?pageSize=9999",
36675
- belongsToArray: "get"
36693
+ belongsToMany: "list?paginate=false",
36694
+ belongsToArray: "list?paginate=false"
36676
36695
  }, getAction = (e) => TYPE_TO_ACTION[e], requested = {}, hasRequested = (e) => !!requested[e], getRequested = (e) => requested[e], stashRequested = (e, t) => {
36677
36696
  requested[e] = t;
36678
36697
  }, clearRequested = (e) => {
@@ -37374,9 +37393,7 @@ const ActionLink = withDynamicSchemaProps(
37374
37393
  ]
37375
37394
  }
37376
37395
  ) });
37377
- return isBulkEditAction(o) && (ue = /* @__PURE__ */ jsx(TabsContextProvider, { children: ue })), $(
37378
- b ? /* @__PURE__ */ jsx(RecordProvider, { record: null, parent: N, children: /* @__PURE__ */ jsx(TreeRecordProvider, { parent: S, children: ue }) }) : ue
37379
- );
37396
+ return isBulkEditAction(o) && (ue = /* @__PURE__ */ jsx(TabsContextProvider, { children: ue })), $(b ? /* @__PURE__ */ jsx(TreeRecordProvider, { parent: S, children: ue }) : ue);
37380
37397
  });
37381
37398
  InternalAction.displayName = "InternalAction";
37382
37399
  Action.Popover = function e(t) {
@@ -41492,11 +41509,15 @@ function Uploader(n) {
41492
41509
  var o = n, { rules: e } = o, t = Y(o, ["rules"]);
41493
41510
  const { disabled: r, multiple: i, value: a, onChange: l, toValueItem: c = toValueItem } = t, [u, d] = useState([]), [p, m] = useState([]), { t: h } = useTranslation(), { componentCls: g } = useStyles$6(), f = useField(), C = useUploadProps(t), b = useBeforeUpload(e);
41494
41511
  useEffect(() => {
41495
- p.length ? f.setFeedback({
41496
- type: "error",
41497
- code: "ValidateError",
41498
- messages: [h("Incomplete uploading files need to be resolved")]
41499
- }) : f.setFeedback({});
41512
+ if (p.length) {
41513
+ const O = p.filter((j) => j.status === "error");
41514
+ f.setFeedback({
41515
+ type: "error",
41516
+ code: "ValidateError",
41517
+ messages: [O.length ? h("Some files are not uploaded correctly, please check.") : " "]
41518
+ });
41519
+ } else
41520
+ f.setFeedback({});
41500
41521
  }, [f, p, h]);
41501
41522
  const S = useCallback(
41502
41523
  (O) => {
@@ -45652,39 +45673,46 @@ const commonOptions$h = {
45652
45673
  }
45653
45674
  });
45654
45675
  }, AssociateActionProvider = (e) => {
45655
- const [t, n] = useState([]), o = useCollection(), { resource: r, service: i, block: a, __parent: l } = useBlockRequestContext(), c = useActionContext(), { isMobile: u } = useOpenModeContext() || {}, d = {
45676
+ const [t, n] = useState([]), o = useCollection(), { resource: r, block: i, __parent: a } = useBlockRequestContext(), l = useActionContext(), { isMobile: c } = useOpenModeContext() || {}, [u, d] = useState([]);
45677
+ useEffect(() => {
45678
+ var g;
45679
+ (g = r == null ? void 0 : r.list) == null || g.call(r).then((f) => {
45680
+ var C;
45681
+ d(((C = f.data) == null ? void 0 : C.data) || []);
45682
+ });
45683
+ }, [r]);
45684
+ const p = {
45656
45685
  size: "small",
45657
45686
  onChange: e == null ? void 0 : e.onChange,
45658
45687
  selectedRows: t,
45659
45688
  setSelectedRows: n
45660
- }, p = () => {
45661
- const { selectedRows: h } = useContext(RecordPickerContext), { setVisible: g, setSubmitted: f, setFormValueChanged: C } = useActionContext();
45689
+ }, m = () => {
45690
+ const { selectedRows: g } = useContext(RecordPickerContext), { setVisible: f, setSubmitted: C, setFormValueChanged: b } = useActionContext();
45662
45691
  return {
45663
- onClick(S, y) {
45692
+ onClick(y, v) {
45664
45693
  return V(this, null, function* () {
45665
- var v, F;
45694
+ var F, I;
45666
45695
  yield r.add({
45667
- values: h
45668
- }), y && (y == null || y()), g == null || g(!1), f == null || f(!0), a && a !== "TableField" && ((F = (v = l == null ? void 0 : l.service) == null ? void 0 : v.refresh) == null || F.call(v), g == null || g(!1), C == null || C(!1));
45696
+ values: g
45697
+ }), v && (v == null || v()), f == null || f(!1), C == null || C(!0), i && i !== "TableField" && ((I = (F = a == null ? void 0 : a.service) == null ? void 0 : F.refresh) == null || I.call(F), f == null || f(!1), b == null || b(!1));
45669
45698
  });
45670
45699
  }
45671
45700
  };
45672
- }, m = () => {
45673
- var g, f;
45674
- const h = (o == null ? void 0 : o.filterTargetKey) || "id";
45675
- if ((g = i.data) != null && g.data) {
45676
- const C = (f = i.data) == null ? void 0 : f.data.map((S) => S[h]).filter(Boolean);
45677
- return C.length ? { $and: [{ [`${h}.$ne`]: C }] } : {};
45701
+ }, h = () => {
45702
+ const g = (o == null ? void 0 : o.filterTargetKey) || "id";
45703
+ if (u) {
45704
+ const f = u.map((b) => b[g]).filter(Boolean);
45705
+ return f.length ? { $and: [{ [`${g}.$ne`]: f }] } : {};
45678
45706
  }
45679
45707
  return {};
45680
45708
  };
45681
45709
  return /* @__PURE__ */ jsx(
45682
45710
  ActionContextProvider,
45683
45711
  {
45684
- value: P(x({}, c), {
45685
- openMode: u ? "drawer" : c.openMode
45712
+ value: P(x({}, l), {
45713
+ openMode: c ? "drawer" : l.openMode
45686
45714
  }),
45687
- children: /* @__PURE__ */ jsx(RecordPickerProvider, P(x({}, d), { children: /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { useTableSelectorProps: useTableSelectorProps$2, usePickActionProps: p }, children: /* @__PURE__ */ jsx(TableSelectorParamsProvider, { params: { filter: m() }, children: e.children }) }) }))
45715
+ children: /* @__PURE__ */ jsx(RecordPickerProvider, P(x({}, p), { children: /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { useTableSelectorProps: useTableSelectorProps$2, usePickActionProps: m }, children: /* @__PURE__ */ jsx(TableSelectorParamsProvider, { params: { filter: h() }, children: e.children }) }) }))
45688
45716
  }
45689
45717
  );
45690
45718
  }, ParentCollectionFields$1 = () => {
@@ -48578,7 +48606,7 @@ const AppendsTreeSelect = (e) => {
48578
48606
  loadData: I
48579
48607
  }, u)
48580
48608
  );
48581
- }, removeIfKeyEmpty = (e, t) => !e || typeof e != "object" || !t || Array.isArray(e) || e[t] ? e : null, AssociationFieldAddNewer = (e) => {
48609
+ }, removeIfKeyEmpty = (e, t) => !e || typeof e != "object" || !t || Array.isArray(e) || e[t] ? e : void 0, AssociationFieldAddNewer = (e) => {
48582
48610
  const t = useContext(SchemaComponentContext);
48583
48611
  return /* @__PURE__ */ jsx(SchemaComponentContext.Provider, { value: P(x({}, t), { draggable: !0 }), children: /* @__PURE__ */ jsx(Action.Container, x({}, e)) });
48584
48612
  }, filterAnalyses = (e) => {
@@ -48603,9 +48631,9 @@ const InternalAssociationSelect$1 = observer$1(
48603
48631
  var O;
48604
48632
  const D = e, { objectValue: t = !0, addMode: n } = D, o = Y(D, ["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 = (O = i["x-component-props"]) == null ? void 0 : O.addMode, { t: h } = useTranslation(), { multiple: g } = e, f = useForm(), b = useAPIClient().resource(l.target), S = useCollectionRecordData(), y = useContext(SchemaComponentContext), { getCollection: v } = useCollectionManager_deprecated(), F = v(l.target), { filterTargetKey: I } = F;
48605
48633
  useEffect(() => {
48606
- const j = isVariable$1(r.value) ? void 0 : r.value, N = Array.isArray(j) ? j.filter(Boolean) : j;
48607
- p(N);
48608
- }, [r.value]), useEffect(() => {
48634
+ const j = isVariable$1(r.value) ? void 0 : r.value, N = Array.isArray(j) ? j.filter(Boolean) : j, B = removeIfKeyEmpty(N, I);
48635
+ p(B), isEqual(r.value, B) || (r.value = B);
48636
+ }, [r.value, I]), useEffect(() => {
48609
48637
  const j = uid();
48610
48638
  return f.addEffects(j, () => {
48611
48639
  onFieldInputValueChange("*", (N) => {
@@ -63210,13 +63238,13 @@ const ACLCollectionProvider = (e) => {
63210
63238
  }, ACLActionProvider = (e) => {
63211
63239
  const t = useCollection(), n = useRecordPkValue(), o = useResourceName(), { parseAction: r, uiButtonSchemasBlacklist: i } = useACLRoleContext(), a = useFieldSchema(), l = a["x-uid"];
63212
63240
  let c = a["x-acl-action"];
63213
- const u = ["create", "update", "destroy", "importXlsx", "export"];
63241
+ const u = ["create", "update", "destroy", "importXlsx", "export"], d = ["create", "update", "destroy", "importXlsx", "bulkDestroy", "bulkUpdate"];
63214
63242
  !c && o && a["x-action"] && u.includes(a["x-action"]) && (c = `${o}:${a["x-action"]}`), c && !(c != null && c.includes(":")) && (c = `${o}:${c}`);
63215
- const d = useMemo(
63243
+ const p = useMemo(
63216
63244
  () => c && r(c, { schema: a, recordPkValue: n }),
63217
63245
  [r, c, a, n]
63218
63246
  );
63219
- return i != null && i.includes(l) ? /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: !1, children: e.children }) : c ? o ? d ? u.includes(c) || u.includes(c == null ? void 0 : c.split(":")[1]) ? t && t.template !== "view" || t != null && t.writableView ? /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: d, children: e.children }) : null : /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: d, children: e.children }) : /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: d, children: e.children }) : /* @__PURE__ */ jsx(Fragment$1, { children: e.children }) : /* @__PURE__ */ jsx(Fragment$1, { children: e.children });
63247
+ return i != null && i.includes(l) ? /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: !1, children: e.children }) : c ? o ? p ? d.includes(c) || d.includes(c == null ? void 0 : c.split(":")[1]) ? t && t.template !== "view" || t != null && t.writableView ? /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: p, children: e.children }) : /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: !1, children: e.children }) : /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: p, children: e.children }) : /* @__PURE__ */ jsx(ACLActionParamsContext.Provider, { value: p, children: e.children }) : /* @__PURE__ */ jsx(Fragment$1, { children: e.children }) : /* @__PURE__ */ jsx(Fragment$1, { children: e.children });
63220
63248
  }, useACLFieldWhitelist = () => {
63221
63249
  const e = useContext(ACLActionParamsContext), t = useMemo(() => [].concat((e == null ? void 0 : e.whitelist) || []).concat((e == null ? void 0 : e.fields) || []).concat((e == null ? void 0 : e.appends) || []), [e == null ? void 0 : e.whitelist, e == null ? void 0 : e.fields, e == null ? void 0 : e.appends]);
63222
63250
  return {