@nocobase/client 1.8.18 → 1.8.20

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 +40 -30
  2. package/lib/index.js +10 -10
  3. package/package.json +5 -5
package/es/index.mjs CHANGED
@@ -8771,7 +8771,7 @@ function addAppVersion(e, t) {
8771
8771
  addAppVersion((o = e.properties) == null ? void 0 : o[n], t);
8772
8772
  }), e;
8773
8773
  }
8774
- const name = "@nocobase/client", version = "1.8.18", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8774
+ const name = "@nocobase/client", version = "1.8.20", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
8775
8775
  "@ahooksjs/use-url-state": "3.5.1",
8776
8776
  "@ant-design/cssinjs": "^1.11.1",
8777
8777
  "@ant-design/icons": "^5.6.1",
@@ -8792,9 +8792,9 @@ const name = "@nocobase/client", version = "1.8.18", license = "AGPL-3.0", main
8792
8792
  "@formily/reactive-react": "^2.2.27",
8793
8793
  "@formily/shared": "^2.2.27",
8794
8794
  "@formily/validator": "^2.2.27",
8795
- "@nocobase/evaluators": "1.8.18",
8796
- "@nocobase/sdk": "1.8.18",
8797
- "@nocobase/utils": "1.8.18",
8795
+ "@nocobase/evaluators": "1.8.20",
8796
+ "@nocobase/sdk": "1.8.20",
8797
+ "@nocobase/utils": "1.8.20",
8798
8798
  ahooks: "^3.7.2",
8799
8799
  antd: "5.24.2",
8800
8800
  "antd-style": "3.7.1",
@@ -22514,8 +22514,8 @@ const HeightMode = {
22514
22514
  );
22515
22515
  return useEventListener("resize", r), { height: o, width: e, tableSizeRefCallback: a };
22516
22516
  }, hasActionContainerInParentChain = (e) => {
22517
- var t;
22518
- return e ? e["x-component"] === "Action.Container" ? ((t = e == null ? void 0 : e.parent["x-component-props"]) == null ? void 0 : t.openMode) !== "page" : hasActionContainerInParentChain(e.parent) : null;
22517
+ var t, n;
22518
+ return e ? e["x-component"] === "Action.Container" ? ((n = (t = e == null ? void 0 : e.parent) == null ? void 0 : t["x-component-props"]) == null ? void 0 : n.openMode) !== "page" : hasActionContainerInParentChain(e.parent) : null;
22519
22519
  }, useFieldModeOptions = (e) => {
22520
22520
  var g;
22521
22521
  const { t } = useTranslation(), { getCollectionJoinField: n, getCollection: o } = useCollectionManager_deprecated(), r = useFieldSchema(), a = (e == null ? void 0 : e.fieldSchema) || r, i = useField(), l = useForm(), c = (a == null ? void 0 : a["x-read-pretty"]) || i.readPretty || l.readPretty, u = e == null ? void 0 : e.fieldSchema, { getField: d } = useCollection_deprecated(), p = (e == null ? void 0 : e.collectionField) || d(a.name) || n(a["x-collection-field"]), { label: m } = ((g = a["x-component-props"]) == null ? void 0 : g.fieldNames) || {};
@@ -23681,7 +23681,7 @@ function RawTextArea(e) {
23681
23681
  children: [
23682
23682
  /* @__PURE__ */ jsx(o, P(x({}, l), { ref: t })),
23683
23683
  /* @__PURE__ */ jsx(
23684
- Button.Group,
23684
+ Space$1.Compact,
23685
23685
  {
23686
23686
  className: css`
23687
23687
  position: absolute;
@@ -29208,7 +29208,7 @@ const BlockItemCardContext = createContext({}), BlockItemCard = React.forwardRef
29208
29208
  }
29209
29209
  }
29210
29210
  )
29211
- ] }), b = /* @__PURE__ */ jsx(BlockItemCardContext.Provider, { value: { titleHeight: d }, children: /* @__PURE__ */ jsx(Card, P(x({ ref: n, bordered: !1, style: u }, c), { title: C, children: e })) });
29211
+ ] }), b = /* @__PURE__ */ jsx(BlockItemCardContext.Provider, { value: { titleHeight: d }, children: /* @__PURE__ */ jsx(Card, P(x({ ref: n, variant: "borderless", style: u }, c), { title: C, children: e })) });
29212
29212
  return f ? /* @__PURE__ */ jsx(BlockLinkageRuleProvider, { children: b }) : b;
29213
29213
  });
29214
29214
  BlockItemCard.displayName = "BlockItemCard";
@@ -30671,8 +30671,8 @@ const SortableProvider = (e) => {
30671
30671
  }, i), {
30672
30672
  className: cx("nb-sortable-designer", e.className),
30673
30673
  ref: p,
30674
- style: m,
30675
- setNodeRef: p
30674
+ style: m
30675
+ // setNodeRef,
30676
30676
  }),
30677
30677
  r
30678
30678
  );
@@ -40251,12 +40251,12 @@ const RenderButtonInner = observer$1(
40251
40251
  (Y, G) => {
40252
40252
  var J = Y, { component: V = p || Button, icon: E, onlyIcon: z, children: H } = J, U = W(J, ["component", "icon", "onlyIcon", "children"]);
40253
40253
  return /* @__PURE__ */ jsxs(V, P(x({ ref: G }, U), { children: [
40254
- z ? /* @__PURE__ */ jsx(Tooltip, { title: U.title, children: /* @__PURE__ */ jsx("span", { style: { padding: 3 }, children: E && typeof E == "string" ? /* @__PURE__ */ jsx(Icon, { type: E }) : E }) }) : /* @__PURE__ */ jsx("span", { style: { paddingRight: 3 }, children: E && typeof E == "string" ? /* @__PURE__ */ jsx(Icon, { type: E }) : E }),
40255
- z ? H[1] : H
40254
+ v ? /* @__PURE__ */ jsx(Tooltip, { title: U.title, children: /* @__PURE__ */ jsx("span", { style: { padding: 3 }, children: E && typeof E == "string" ? /* @__PURE__ */ jsx(Icon, { type: E }) : E }) }) : /* @__PURE__ */ jsx("span", { style: { paddingRight: 3 }, children: E && typeof E == "string" ? /* @__PURE__ */ jsx(Icon, { type: E }) : E }),
40255
+ v ? H[1] : H
40256
40256
  ] }));
40257
40257
  }
40258
40258
  ),
40259
- [v]
40259
+ [v, p]
40260
40260
  );
40261
40261
  if (!t && ((M = n == null ? void 0 : n.data) != null && M.hidden || !o))
40262
40262
  return null;
@@ -40277,7 +40277,6 @@ const RenderButtonInner = observer$1(
40277
40277
  className: cls(m, h, g, "nb-action"),
40278
40278
  type: f === "danger" ? void 0 : f,
40279
40279
  title: typeof B == "string" ? B : null,
40280
- onlyIcon: v,
40281
40280
  children: [
40282
40281
  !v && B && /* @__PURE__ */ jsx("span", { className: r ? "nb-action-title" : null, style: j, children: B }),
40283
40282
  /* @__PURE__ */ jsx(C, x({}, b))
@@ -40526,7 +40525,15 @@ const ReadPrettyInternal = observer$1(
40526
40525
  const l = x(x({}, defaultFieldNames$1), e.fieldNames), c = a.dataSource || e.options || (i == null ? void 0 : i.uiSchema.enum) || [], u = getCurrentOptions(a.value, c, l);
40527
40526
  if (!isValid(e.value) && !u.length || isArrayField(a) && ((p = a == null ? void 0 : a.value) == null ? void 0 : p.length) === 0)
40528
40527
  return;
40529
- const d = a.value !== null && u.map((m, h) => /* @__PURE__ */ jsx(Tag, { color: m[l.color], icon: m.icon, children: m[l.label] }, h));
40528
+ const d = a.value !== null && u.map((m, h) => /* @__PURE__ */ jsx(
40529
+ Tag,
40530
+ {
40531
+ color: m[l.color],
40532
+ icon: typeof m.icon == "string" ? /* @__PURE__ */ jsx(Icon, { type: m.icon }) : m.icon,
40533
+ children: m[l.label]
40534
+ },
40535
+ h
40536
+ ));
40530
40537
  r(d), n(!1);
40531
40538
  }, [
40532
40539
  i == null ? void 0 : i.uiSchema.enum,
@@ -43629,9 +43636,13 @@ function matchMimetype(e, t) {
43629
43636
  }
43630
43637
  const toArr$1 = (e) => isValid(e) ? Object.keys(e).length === 0 ? [] : toArr$3(e) : [], testOpts = (e, t) => t && isArr(t.include) ? t.include.some((n) => e.test(n)) : t && isArr(t.exclude) ? !t.exclude.some((n) => e.test(n)) : !0;
43631
43638
  function getThumbnailPlaceholderURL(e, t = {}) {
43632
- for (let n = 0; n < UPLOAD_PLACEHOLDER.length; n++)
43633
- if (UPLOAD_PLACEHOLDER[n].ext.test(e.extname || e.filename || e.url || e.name))
43639
+ for (let n = 0; n < UPLOAD_PLACEHOLDER.length; n++) {
43640
+ const o = e.url ? new URL(
43641
+ e.url.startsWith("http://") || e.url.startsWith("https://") ? e.url : `${location.origin}/${e.url.replace(/^\//, "")}`
43642
+ ) : { pathname: e.filename };
43643
+ if (UPLOAD_PLACEHOLDER[n].ext.test(e.extname || e.filename || o.pathname || e.name))
43634
43644
  return testOpts(UPLOAD_PLACEHOLDER[n].ext, t) ? UPLOAD_PLACEHOLDER[n].icon || UNKNOWN_FILE_ICON : e.name;
43645
+ }
43635
43646
  return UNKNOWN_FILE_ICON;
43636
43647
  }
43637
43648
  function getResponseMessage({ error: e, response: t }) {
@@ -45713,11 +45724,13 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
45713
45724
  useAclCheck
45714
45725
  }, Symbol.toStringTag, { value: "Module" })), CreateRecordAction = observer$1(
45715
45726
  (e) => {
45716
- const t = useField(), n = useFieldSchema(), o = useActionContext(), { getCollection: r } = useCollectionManager_deprecated(), a = useInsertSchema$1("AddNewer"), { options: i } = useAssociationFieldContext(), [l, c] = useState(!1), u = r(i == null ? void 0 : i.target), [d, p] = useState(u == null ? void 0 : u.name), [m, h] = useState(u == null ? void 0 : u.dataSource), [g, f] = useState(!1), C = (b) => {
45717
- a(schema$1.AddNewer), c(!0), p(b.name), h(b.dataSource);
45727
+ const t = useField(), n = useFieldSchema(), o = useActionContext(), { getCollection: r } = useCollectionManager_deprecated(), a = useInsertSchema$1("AddNewer"), { options: i } = useAssociationFieldContext(), [l, c] = useState(!1), u = r(i == null ? void 0 : i.target), [d, p] = useState(u == null ? void 0 : u.name), [m, h] = useState(u == null ? void 0 : u.dataSource), [g, f] = useState(!1), C = useMemo(() => n.reduceProperties((y, S) => S["x-component"] === "AssociationField.AddNewer" ? (Object.keys(S.parent.properties).forEach((v) => {
45728
+ v !== S.name && S.parent.removeProperty(v);
45729
+ }), S.parent) : y), [n]), b = (y) => {
45730
+ a(schema$1.AddNewer), c(!0), p(y.name), h(y.dataSource);
45718
45731
  };
45719
45732
  return /* @__PURE__ */ jsxs(CollectionProvider_deprecated, { name: i == null ? void 0 : i.target, children: [
45720
- /* @__PURE__ */ jsx(CreateAction, P(x({}, e), { onClick: (b) => C(b) })),
45733
+ /* @__PURE__ */ jsx(CreateAction, P(x({}, e), { onClick: (y) => b(y) })),
45721
45734
  /* @__PURE__ */ jsx(
45722
45735
  ActionContextProvider,
45723
45736
  {
@@ -45727,15 +45740,7 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
45727
45740
  formValueChanged: g,
45728
45741
  setFormValueChanged: f
45729
45742
  }),
45730
- children: /* @__PURE__ */ jsx(CollectionProvider_deprecated, { name: d, dataSource: m, children: /* @__PURE__ */ jsx(TabsContextProvider, { children: /* @__PURE__ */ jsx(
45731
- NocoBaseRecursionField,
45732
- {
45733
- onlyRenderProperties: !0,
45734
- basePath: t.address,
45735
- schema: n,
45736
- filterProperties: (b) => b["x-component"] === "AssociationField.AddNewer"
45737
- }
45738
- ) }) })
45743
+ children: /* @__PURE__ */ jsx(CollectionProvider_deprecated, { name: d, dataSource: m, children: /* @__PURE__ */ jsx(TabsContextProvider, { children: /* @__PURE__ */ jsx(NocoBaseRecursionField, { basePath: t.address, schema: C }) }) })
45739
45744
  }
45740
45745
  )
45741
45746
  ] });
@@ -49408,7 +49413,9 @@ const NanoIDInput = Object.assign(
49408
49413
  return /* @__PURE__ */ jsx(Upload.ReadPretty, P(x({}, e), { value: t }));
49409
49414
  }), Editable = observer$1(
49410
49415
  (e) => {
49411
- const t = useField(), n = useRef(null), o = useFieldSchema(), r = t.value, { token: a } = useToken(), i = {
49416
+ const t = useField(), n = useRef(null), o = useFieldSchema(), r = t.value, { token: a } = useToken();
49417
+ o.required = t.required;
49418
+ const i = {
49412
49419
  name: o.name,
49413
49420
  "x-collection-field": o["x-collection-field"],
49414
49421
  "x-component": "CollectionField",
@@ -49435,6 +49442,9 @@ const NanoIDInput = Object.assign(
49435
49442
  display: none;
49436
49443
  }
49437
49444
  `,
49445
+ onOpenChange: (d) => {
49446
+ d && t.validate();
49447
+ },
49438
49448
  children: /* @__PURE__ */ jsx(
49439
49449
  "div",
49440
49450
  {