@nocobase/client 1.7.12 → 1.7.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.
Files changed (3) hide show
  1. package/es/index.mjs +82 -53
  2. package/lib/index.js +93 -87
  3. package/package.json +5 -5
package/es/index.mjs CHANGED
@@ -8711,7 +8711,7 @@ function addAppVersion(e, t) {
8711
8711
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
8712
8712
  }), e;
8713
8713
  }
8714
- const name = "@nocobase/client", version = "1.7.12", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8714
+ const name = "@nocobase/client", version = "1.7.13", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8715
8715
  "@ahooksjs/use-url-state": "3.5.1",
8716
8716
  "@ant-design/cssinjs": "^1.11.1",
8717
8717
  "@ant-design/icons": "^5.6.1",
@@ -8732,9 +8732,9 @@ const name = "@nocobase/client", version = "1.7.12", license = "AGPL-3.0", main
8732
8732
  "@formily/reactive-react": "^2.2.27",
8733
8733
  "@formily/shared": "^2.2.27",
8734
8734
  "@formily/validator": "^2.2.27",
8735
- "@nocobase/evaluators": "1.7.12",
8736
- "@nocobase/sdk": "1.7.12",
8737
- "@nocobase/utils": "1.7.12",
8735
+ "@nocobase/evaluators": "1.7.13",
8736
+ "@nocobase/sdk": "1.7.13",
8737
+ "@nocobase/utils": "1.7.13",
8738
8738
  ahooks: "^3.7.2",
8739
8739
  antd: "5.24.2",
8740
8740
  "antd-style": "3.7.1",
@@ -16382,7 +16382,8 @@ const BlockTemplateContext = createContext({ componentNamePrefix: "" }), BlockTe
16382
16382
  "polygon",
16383
16383
  "circle",
16384
16384
  "point",
16385
- "lineString"
16385
+ "lineString",
16386
+ "vditor"
16386
16387
  ];
16387
16388
  function useTableColumnInitializerFields() {
16388
16389
  const { name: e, currentFields: t = [] } = useCollection_deprecated(), { getInterface: n, getCollection: o } = useCollectionManager_deprecated(), a = useFieldSchema()["x-component"] === "AssociationField.SubTable", i = useForm(), l = a ? i.readPretty : !0;
@@ -24559,7 +24560,6 @@ const useAllAccessDesktopRoutes = () => useContext(AllAccessDesktopRoutesContext
24559
24560
  padding: 0px 50px;
24560
24561
  }
24561
24562
  `, className1$1 = css`
24562
- width: 168px;
24563
24563
  height: var(--nb-header-height);
24564
24564
  margin-right: 4px;
24565
24565
  display: inline-flex;
@@ -24567,6 +24567,13 @@ const useAllAccessDesktopRoutes = () => useContext(AllAccessDesktopRoutesContext
24567
24567
  color: #fff;
24568
24568
  padding: 0;
24569
24569
  align-items: center;
24570
+ `, className1WithFixedWidth = css`
24571
+ ${className1$1}
24572
+ width: 168px;
24573
+ `, className1WithAutoWidth = css`
24574
+ ${className1$1}
24575
+ width: auto;
24576
+ min-width: 168px;
24570
24577
  `, className2 = css`
24571
24578
  object-fit: contain;
24572
24579
  width: 100%;
@@ -24606,9 +24613,9 @@ const LayoutContent = () => {
24606
24613
  /* @__PURE__ */ jsx(ShowTipWhenNoPages, {})
24607
24614
  ] }) });
24608
24615
  }, NocoBaseLogo = () => {
24609
- var r, a, i, l, c, u, d, p;
24610
- const e = useSystemSettings(), { token: t } = useToken(), n = useMemo(() => ({ fontSize: t.fontSizeHeading3 }), [t.fontSizeHeading3]), o = (i = (a = (r = e == null ? void 0 : e.data) == null ? void 0 : r.data) == null ? void 0 : a.logo) != null && i.url ? /* @__PURE__ */ jsx("img", { className: className2, src: (u = (c = (l = e == null ? void 0 : e.data) == null ? void 0 : l.data) == null ? void 0 : c.logo) == null ? void 0 : u.url }) : /* @__PURE__ */ jsx("span", { style: n, className: className3, children: (p = (d = e == null ? void 0 : e.data) == null ? void 0 : d.data) == null ? void 0 : p.title });
24611
- return /* @__PURE__ */ jsx("div", { className: className1$1, children: e != null && e.loading ? null : o });
24616
+ var a, i, l, c, u, d, p, m;
24617
+ const e = useSystemSettings(), { token: t } = useToken(), n = useMemo(() => ({ fontSize: t.fontSizeHeading3 }), [t.fontSizeHeading3]), o = (l = (i = (a = e == null ? void 0 : e.data) == null ? void 0 : a.data) == null ? void 0 : i.logo) == null ? void 0 : l.url, r = o ? /* @__PURE__ */ jsx("img", { className: className2, src: (d = (u = (c = e == null ? void 0 : e.data) == null ? void 0 : c.data) == null ? void 0 : u.logo) == null ? void 0 : d.url }) : /* @__PURE__ */ jsx("span", { style: n, className: className3, children: (m = (p = e == null ? void 0 : e.data) == null ? void 0 : p.data) == null ? void 0 : m.title });
24618
+ return /* @__PURE__ */ jsx("div", { className: o ? className1WithFixedWidth : className1WithAutoWidth, children: e != null && e.loading ? null : r });
24612
24619
  }, MenuSchemaToolbarWithContainer = () => {
24613
24620
  const e = useRef(null), [t, n] = React.useState(null);
24614
24621
  return useEffect(() => {
@@ -34087,14 +34094,14 @@ const expendableActionSettings = new SchemaSettings({
34087
34094
  options: d,
34088
34095
  value: ((h = l["x-component-props"]) == null ? void 0 : h.component) || ((g = d[0]) == null ? void 0 : g.value),
34089
34096
  onChange(f) {
34090
- var S;
34091
- const C = d.find((y) => y.value === f), b = x({
34097
+ var y;
34098
+ const C = d.find((v) => v.value === f), b = ((y = C == null ? void 0 : C.useProps) == null ? void 0 : y.call(C)) || {}, S = x(x({
34092
34099
  component: f
34093
- }, ((S = C == null ? void 0 : C.useProps) == null ? void 0 : S.call(C)) || {});
34094
- _.set(l, "x-component-props", b), t.componentProps = b, c.emit("patch", {
34100
+ }, b), f === o.uiSchema["x-component"] ? o.uiSchema["x-component-props"] : {});
34101
+ _.set(l, "x-component-props", S), t.componentProps = S, c.emit("patch", {
34095
34102
  schema: {
34096
34103
  "x-uid": l["x-uid"],
34097
- "x-component-props": b
34104
+ "x-component-props": S
34098
34105
  }
34099
34106
  });
34100
34107
  }
@@ -44472,76 +44479,95 @@ const defaultModeToComponent = {
44472
44479
  return /* @__PURE__ */ jsx(AssociationFieldModeContext.Provider, { value: a, children: e.children });
44473
44480
  }, useAssociationFieldModeContext = () => React.useContext(AssociationFieldModeContext), AssociationFieldProvider = observer$1(
44474
44481
  (e) => {
44475
- var f, C, b;
44476
- const t = useField(), n = useCollectionManager(), o = useFieldSchema(), r = useAPIClient();
44482
+ var S, y, v;
44483
+ const t = useField(), n = useCollectionManager(), o = useFieldSchema(), r = useAPIClient(), a = useSchemaOptionsContext(), i = useRef(null);
44477
44484
  useSchemaComponentContext();
44478
- const a = ((f = o["x-component-props"]) == null ? void 0 : f.multiple) !== !1, i = ((C = o["x-component-props"]) == null ? void 0 : C.allowDissociate) !== !1, l = useMemo(
44485
+ const l = ((S = o["x-component-props"]) == null ? void 0 : S.multiple) !== !1, c = ((y = o["x-component-props"]) == null ? void 0 : y.allowDissociate) !== !1, u = useMemo(
44479
44486
  () => n.getCollectionField(o["x-collection-field"]),
44480
44487
  // eslint-disable-next-line react-hooks/exhaustive-deps
44481
44488
  [o["x-collection-field"], o.name]
44482
- ), c = useMemo(
44489
+ ), d = useMemo(
44483
44490
  () => {
44484
- var S;
44485
- return ((S = n.getCollection(l == null ? void 0 : l.target)) == null ? void 0 : S.template) === "file";
44491
+ var F;
44492
+ return ((F = n.getCollection(u == null ? void 0 : u.target)) == null ? void 0 : F.template) === "file";
44486
44493
  },
44487
44494
  // eslint-disable-next-line react-hooks/exhaustive-deps
44488
44495
  [o["x-collection-field"]]
44489
- ), u = useMemo(
44496
+ ), p = useMemo(
44490
44497
  () => {
44491
- var S;
44492
- return ((S = o["x-component-props"]) == null ? void 0 : S.mode) || (c ? "FileManager" : "Select");
44498
+ var F;
44499
+ return ((F = o["x-component-props"]) == null ? void 0 : F.mode) || (d ? "FileManager" : "Select");
44493
44500
  },
44494
44501
  // eslint-disable-next-line react-hooks/exhaustive-deps
44495
- [(b = o["x-component-props"]) == null ? void 0 : b.mode]
44496
- ), [d, p] = useState(!t.readPretty), { loading: m, run: h } = useRequest(
44502
+ [(v = o["x-component-props"]) == null ? void 0 : v.mode]
44503
+ ), [m, h] = useState(!t.readPretty), { loading: g, run: f } = useRequest(
44497
44504
  () => {
44498
- var v;
44499
- const S = l.targetKey;
44500
- if (!o.default || !["Picker", "Select"].includes(u) || !_.isObject(o.default))
44505
+ var T;
44506
+ const F = u.targetKey;
44507
+ if (!o.default || !["Picker", "Select"].includes(p) || !_.isObject(o.default))
44501
44508
  return Promise.reject(null);
44502
- const y = Array.isArray(o.default) ? o.default.map((F) => F[S]) : o.default[S];
44503
- return _.isUndefined(y) || _.isNil(y) || _.isNaN(y) ? Promise.reject(null) : r.request({
44504
- resource: l.target,
44505
- action: Array.isArray(y) ? "list" : "get",
44506
- headers: getDataSourceHeaders((v = n == null ? void 0 : n.dataSource) == null ? void 0 : v.key),
44509
+ const I = Array.isArray(o.default) ? o.default.map((R) => R[F]) : o.default[F];
44510
+ return _.isUndefined(I) || _.isNil(I) || _.isNaN(I) ? Promise.reject(null) : r.request({
44511
+ resource: u.target,
44512
+ action: Array.isArray(I) ? "list" : "get",
44513
+ headers: getDataSourceHeaders((T = n == null ? void 0 : n.dataSource) == null ? void 0 : T.key),
44507
44514
  params: {
44508
44515
  filter: {
44509
- [S]: y
44516
+ [F]: I
44510
44517
  }
44511
44518
  }
44512
44519
  });
44513
44520
  },
44514
44521
  {
44515
44522
  manual: !0,
44516
- onSuccess(S) {
44517
- var y;
44518
- t.initialValue = (y = S == null ? void 0 : S.data) == null ? void 0 : y.data;
44523
+ onSuccess(F) {
44524
+ var I;
44525
+ t.initialValue = (I = F == null ? void 0 : F.data) == null ? void 0 : I.data;
44519
44526
  }
44520
44527
  }
44521
- ), { active: g } = useKeepAlive();
44522
- return useEffect(() => {
44523
- var S;
44524
- if (g) {
44525
- if (p(!0), !l) {
44526
- p(!1);
44528
+ ), { active: C } = useKeepAlive();
44529
+ if (useEffect(() => {
44530
+ var F;
44531
+ if (C) {
44532
+ if (h(!0), !u) {
44533
+ h(!1);
44527
44534
  return;
44528
44535
  }
44529
- if (["Picker", "Select"].includes(u) && o.default && h(), t.value && t.form.__template && ["Nester", "SubTable", "PopoverNester"].includes(u) && (["belongsTo", "hasOne"].includes(l.type) ? ((S = t.value) != null && S[l.targetKey] && delete t.value[l.targetKey], t.value = x(x({}, t.initialValue), t.value)) : ["belongsToMany", "hasMany"].includes(l.type) && Array.isArray(t.value) && (t.value = t.value.map((y) => {
44530
- var v;
44531
- return delete y[l.targetKey], x(x({}, (v = t.initialValue) == null ? void 0 : v[0]), y);
44536
+ if (["Picker", "Select"].includes(p) && o.default && f(), t.value && t.form.__template && ["Nester", "SubTable", "PopoverNester"].includes(p) && (["belongsTo", "hasOne"].includes(u.type) ? ((F = t.value) != null && F[u.targetKey] && delete t.value[u.targetKey], t.value = x(x({}, t.initialValue), t.value)) : ["belongsToMany", "hasMany"].includes(u.type) && Array.isArray(t.value) && (t.value = t.value.map((I) => {
44537
+ var T;
44538
+ return delete I[u.targetKey], x(x({}, (T = t.initialValue) == null ? void 0 : T[0]), I);
44532
44539
  }))), t.value !== null && t.value !== void 0) {
44533
- ["Nester", "PopoverNester"].includes(u) && Array.isArray(t.value) && t.value.length === 0 && ["belongsToMany", "hasMany", "belongsToArray"].includes(l.type) && (t.value = [markRecordAsNew({})]), p(!1);
44540
+ ["Nester", "PopoverNester"].includes(p) && Array.isArray(t.value) && t.value.length === 0 && ["belongsToMany", "hasMany", "belongsToArray"].includes(u.type) && (t.value = [markRecordAsNew({})]), h(!1);
44534
44541
  return;
44535
44542
  }
44536
- ["Nester"].includes(u) && (["belongsTo", "hasOne"].includes(l.type) ? t.value = {} : ["belongsToMany", "hasMany", "belongsToArray"].includes(l.type) && (t.value = [markRecordAsNew({})])), u === "SubTable" && (t.value = []), p(!1);
44543
+ ["Nester"].includes(p) && (["belongsTo", "hasOne"].includes(u.type) ? t.value = {} : ["belongsToMany", "hasMany", "belongsToArray"].includes(u.type) && (t.value = [markRecordAsNew({})])), p === "SubTable" && (t.value = []), h(!1);
44537
44544
  }
44538
- }, [u, l, t, g]), d || m ? null : l ? /* @__PURE__ */ jsx(
44545
+ }, [p, u, t, C]), m || g)
44546
+ return null;
44547
+ const b = P(x({}, a.components), {
44548
+ FormItem: (F) => /* @__PURE__ */ jsx(
44549
+ FormItem,
44550
+ P(x({}, F), {
44551
+ getPopupContainer: (I) => i.current || document.body
44552
+ })
44553
+ )
44554
+ });
44555
+ return u ? /* @__PURE__ */ jsx("div", { ref: i, children: /* @__PURE__ */ jsx(
44539
44556
  AssociationFieldContext.Provider,
44540
44557
  {
44541
- value: { options: l, field: t, fieldSchema: o, allowMultiple: a, allowDissociate: i, currentMode: u },
44542
- children: e.children
44558
+ value: { options: u, field: t, fieldSchema: o, allowMultiple: l, allowDissociate: c, currentMode: p },
44559
+ children: /* @__PURE__ */ jsx(
44560
+ SchemaOptionsContext.Provider,
44561
+ {
44562
+ value: {
44563
+ components: b,
44564
+ scope: a.scope
44565
+ },
44566
+ children: e.children
44567
+ }
44568
+ )
44543
44569
  }
44544
- ) : null;
44570
+ ) }) : null;
44545
44571
  },
44546
44572
  { displayName: "AssociationFieldProvider" }
44547
44573
  ), InternalField = (e) => {
@@ -58023,7 +58049,10 @@ class InheritanceCollectionMixin extends Collection {
58023
58049
  return l > 0 && (r.splice(l), r.forEach((u) => {
58024
58050
  const d = this.collectionManager.getCollection(u);
58025
58051
  c = c.concat(d.getCurrentFields());
58026
- })), this.parentCollectionFields[n] = i.filter((u) => c.find((p) => p.name === u.name).collectionName !== this.name), this.parentCollectionFields[n];
58052
+ })), this.parentCollectionFields[n] = i.filter((u) => {
58053
+ const d = c.find((p) => p.name === u.name);
58054
+ return (d == null ? void 0 : d.collectionName) !== this.name;
58055
+ }), this.parentCollectionFields[n];
58027
58056
  }
58028
58057
  getAllCollectionsInheritChain() {
58029
58058
  if (this.allCollectionsInheritChain)