@nocobase/client 1.4.14 → 1.4.16

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
@@ -4295,7 +4295,7 @@ function addAppVersion(e, t) {
4295
4295
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
4296
4296
  }), e;
4297
4297
  }
4298
- const name = "@nocobase/client", version$1 = "1.4.14", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4298
+ const name = "@nocobase/client", version$1 = "1.4.16", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
4299
4299
  "@ahooksjs/use-url-state": "3.5.1",
4300
4300
  "@ant-design/cssinjs": "^1.11.1",
4301
4301
  "@ant-design/icons": "^5.1.4",
@@ -4317,9 +4317,9 @@ const name = "@nocobase/client", version$1 = "1.4.14", license = "AGPL-3.0", mai
4317
4317
  "@formily/reactive-react": "^2.2.27",
4318
4318
  "@formily/shared": "^2.2.27",
4319
4319
  "@formily/validator": "^2.2.27",
4320
- "@nocobase/evaluators": "1.4.14",
4321
- "@nocobase/sdk": "1.4.14",
4322
- "@nocobase/utils": "1.4.14",
4320
+ "@nocobase/evaluators": "1.4.16",
4321
+ "@nocobase/sdk": "1.4.16",
4322
+ "@nocobase/utils": "1.4.16",
4323
4323
  ahooks: "^3.7.2",
4324
4324
  antd: "5.12.8",
4325
4325
  "antd-style": "3.7.1",
@@ -14487,7 +14487,7 @@ const useFormItemInitializerFields = (e) => {
14487
14487
  });
14488
14488
  }, useAssociatedFormItemInitializerFields = (e) => {
14489
14489
  var m;
14490
- const { name: t, fields: o } = useCollection_deprecated(), { getInterface: n, getCollectionFields: r, getCollection: i } = useCollectionManager_deprecated(), a = useForm(), { t: l } = useTranslation(), { readPretty: c = a.readPretty, block: u = "Form" } = e || {}, d = u === "Form" ? ["m2o"] : ["o2o", "oho", "obo", "m2o"];
14490
+ const { name: t, fields: o } = useCollection_deprecated(), { getInterface: n, getCollectionFields: r, getCollection: i } = useCollectionManager_deprecated(), a = useForm(), { t: l } = useTranslation(), { readPretty: c = a.readPretty, block: u = "Form" } = e || {}, d = u === "Form" ? ["m2o", "obo", "oho"] : ["o2o", "oho", "obo", "m2o"];
14491
14491
  return (m = o == null ? void 0 : o.filter((h) => d.includes(h.interface))) == null ? void 0 : m.map((h) => getGroupItemForForm({
14492
14492
  getCollectionFields: r,
14493
14493
  field: h,
@@ -20678,7 +20678,8 @@ const DynamicComponent$1 = (e) => {
20678
20678
  onChange: (f) => {
20679
20679
  d(f);
20680
20680
  },
20681
- placeholder: r("Select field")
20681
+ placeholder: r("Select field"),
20682
+ treeNodeFilterProp: "title"
20682
20683
  }
20683
20684
  ),
20684
20685
  /* @__PURE__ */ jsx(
@@ -37228,7 +37229,7 @@ const InternalNesterCss = css`
37228
37229
  ] });
37229
37230
  },
37230
37231
  { displayName: "InternalPicker" }
37231
- ), toValue$3 = (e, t) => e == null ? t : e;
37232
+ ), toValue$4 = (e, t) => e == null ? t : e;
37232
37233
  function isObject(e) {
37233
37234
  return typeof e == "object" && e !== null;
37234
37235
  }
@@ -37253,7 +37254,7 @@ const RenderRecord = React.memo(
37253
37254
  const [f, C] = useState(!0), [S, b] = useState([]);
37254
37255
  return useEffect(() => {
37255
37256
  const y = toArr$3(h).map((v, I, w) => {
37256
- const k = v == null ? void 0 : v[(e == null ? void 0 : e.label) || "label"], A = t ? transformNestedData(v).map((O) => O == null ? void 0 : O[(e == null ? void 0 : e.label) || "label"]).join(" / ") : isObject(k) ? JSON.stringify(k) : k, D = toValue$3(o(A), "N/A"), B = n(
37257
+ const k = v == null ? void 0 : v[(e == null ? void 0 : e.label) || "label"], A = t ? transformNestedData(v).map((O) => O == null ? void 0 : O[(e == null ? void 0 : e.label) || "label"]).join(" / ") : isObject(k) ? JSON.stringify(k) : k, D = toValue$4(o(A), "N/A"), B = n(
37257
37258
  (v == null ? void 0 : v.__collection) || (r == null ? void 0 : r.target),
37258
37259
  (e == null ? void 0 : e.label) || "label"
37259
37260
  ), z = getLabelFormatValue$1(o(B), D, !0);
@@ -37963,10 +37964,10 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
37963
37964
  ) }, "add") });
37964
37965
  },
37965
37966
  { displayName: "ToManyNester" }
37966
- ), toValue$2 = (e, t) => e == null ? t : e, ButtonTabList = (e) => {
37967
+ ), toValue$3 = (e, t) => e == null ? t : e, ButtonTabList = (e) => {
37967
37968
  const t = useFieldSchema(), { enableLink: o, tagColorField: n } = t["x-component-props"], r = useFieldNames$1({ fieldNames: e.fieldNames }), i = useInsertSchema("Viewer"), { options: a } = useAssociationFieldContext(), l = useCompile(), { designable: c } = useDesignable(), u = useLabelUiSchema$1(a, (r == null ? void 0 : r.label) || "label"), { snapshot: d } = useActionContext(), p = useRef(), { getCollection: m } = useCollectionManager_deprecated(), h = m(a == null ? void 0 : a.target), g = (h == null ? void 0 : h.template) === "tree", { openPopup: f } = usePopupUtils(), C = useCollectionRecordData();
37968
37969
  return /* @__PURE__ */ jsx(Fragment, { children: toArr$3(e.value).map((b, y, v) => {
37969
- const I = b == null ? void 0 : b[(r == null ? void 0 : r.label) || "label"], w = g ? transformNestedData(b).map((D) => D == null ? void 0 : D[(r == null ? void 0 : r.label) || "label"]).join(" / ") : isObject(I) ? JSON.stringify(I) : I, k = toValue$2(l(w), "N/A"), A = getTabFormatValue(l(u), k, b[n]);
37970
+ const I = b == null ? void 0 : b[(r == null ? void 0 : r.label) || "label"], w = g ? transformNestedData(b).map((D) => D == null ? void 0 : D[(r == null ? void 0 : r.label) || "label"]).join(" / ") : isObject(I) ? JSON.stringify(I) : I, k = toValue$3(l(w), "N/A"), A = getTabFormatValue(l(u), k, b[n]);
37970
37971
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
37971
37972
  /* @__PURE__ */ jsx("span", { children: d ? A : o !== !1 ? /* @__PURE__ */ jsx(
37972
37973
  "a",
@@ -42492,22 +42493,22 @@ const useStyles$3 = createStyles(({ token: e }) => ({
42492
42493
  ] });
42493
42494
  },
42494
42495
  mapReadPretty((e) => e.value ? /* @__PURE__ */ jsx("div", { children: "********" }) : /* @__PURE__ */ jsx("div", {}))
42495
- ), isNumberLike = (e) => isNum$1(e) || /^-?\d+(\.\d+)?$/.test(e), toValue$1 = (e, t) => isNumberLike(e) ? math.round(t(e), 9) : null, Percent = connect(
42496
+ ), isNumberLike = (e) => isNum$1(e) || /^-?\d+(\.\d+)?$/.test(e), toValue$2 = (e, t) => isNumberLike(e) ? math.round(t(e), 9) : null, Percent = connect(
42496
42497
  (e) => {
42497
- const { value: t, onChange: o } = e, n = useMemo(() => toValue$1(t, (r) => r * 100), [t]);
42498
+ const { value: t, onChange: o } = e, n = useMemo(() => toValue$2(t, (r) => r * 100), [t]);
42498
42499
  return /* @__PURE__ */ jsx(
42499
42500
  InputNumber$1,
42500
42501
  F(x({}, e), {
42501
42502
  addonAfter: "%",
42502
42503
  value: n,
42503
42504
  onChange: (r) => {
42504
- o && o(toValue$1(r, (i) => i / 100));
42505
+ o && o(toValue$2(r, (i) => i / 100));
42505
42506
  }
42506
42507
  })
42507
42508
  );
42508
42509
  },
42509
42510
  mapReadPretty((e) => {
42510
- const t = useMemo(() => toValue$1(e.value, (o) => o * 100), [e.value]);
42511
+ const t = useMemo(() => toValue$2(e.value, (o) => o * 100), [e.value]);
42511
42512
  return /* @__PURE__ */ jsx(ReadPretty$2, F(x({}, e), { value: t }));
42512
42513
  })
42513
42514
  ), Preview = connect((e) => {
@@ -42769,14 +42770,14 @@ const useTableSelectorProps = () => {
42769
42770
  function isShowFilePicker(e) {
42770
42771
  return (e == null ? void 0 : e["x-component"]) === "Preview";
42771
42772
  }
42772
- const toValue = (e, t) => e == null ? t : e, ReadPrettyRecordPicker = observer$1(
42773
+ const toValue$1 = (e, t) => e == null ? t : e, ReadPrettyRecordPicker = observer$1(
42773
42774
  (e) => {
42774
42775
  var v, I;
42775
42776
  const { ellipsis: t } = e, o = useFieldSchema(), n = useRecord(), r = useCollectionManager(), i = useFieldNames(e), [a, l] = useState(!1), c = useCollection(), u = (c == null ? void 0 : c.getField(o.name)) || (r == null ? void 0 : r.getCollectionField(o == null ? void 0 : o["x-collection-field"])), [d, p] = useState({}), m = useCompile(), h = useLabelUiSchema(u, (i == null ? void 0 : i.label) || "label"), { snapshot: g } = useActionContext(), f = ((v = o["x-component-props"]) == null ? void 0 : v.mode) === "tags", C = useRef();
42776
42777
  if (isShowFilePicker(h))
42777
42778
  return u ? /* @__PURE__ */ jsx(Preview, x({}, e)) : null;
42778
42779
  const S = () => toArr$3(e.value).map((w, k, A) => {
42779
- const D = toValue(m(w == null ? void 0 : w[(i == null ? void 0 : i.label) || "label"]), "N/A"), B = getLabelFormatValue(h, D, !0);
42780
+ const D = toValue$1(m(w == null ? void 0 : w[(i == null ? void 0 : i.label) || "label"]), "N/A"), B = getLabelFormatValue(h, D, !0);
42780
42781
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
42781
42782
  /* @__PURE__ */ jsx("span", { className: "test-record-picker-read-pretty-item", children: g || f ? B : /* @__PURE__ */ jsx(
42782
42783
  "a",
@@ -44825,15 +44826,20 @@ const ReadPretty = observer$1(
44825
44826
  })
44826
44827
  ),
44827
44828
  mapReadPretty(ReadPretty)
44828
- ), UnixTimestamp = connect(
44829
+ ), toValue = (e, t) => e ? convertTimestampToDate(e, t) : null;
44830
+ function convertTimestampToDate(e, t = "second") {
44831
+ const o = t === "second" ? e * 1e3 : e, n = new Date(o);
44832
+ return isNaN(n.getTime()) ? "Invalid timestamp" : n.toUTCString();
44833
+ }
44834
+ const UnixTimestamp = connect(
44829
44835
  (e) => {
44830
- const { value: t, onChange: o } = e;
44836
+ const { value: t, onChange: o, accuracy: n } = e, r = useMemo(() => typeof t == "number" ? toValue(t, n) : t, [t]);
44831
44837
  return /* @__PURE__ */ jsx(
44832
44838
  DatePicker,
44833
44839
  F(x({}, e), {
44834
- value: t,
44835
- onChange: (n) => {
44836
- o && o(n);
44840
+ value: r,
44841
+ onChange: (i) => {
44842
+ o && o(i);
44837
44843
  }
44838
44844
  })
44839
44845
  );
@@ -10,6 +10,7 @@ import React from 'react';
10
10
  interface UnixTimestampProps {
11
11
  value?: any;
12
12
  onChange?: (value: number) => void;
13
+ accuracy?: 'millisecond' | 'second';
13
14
  }
14
15
  export declare const UnixTimestamp: React.ForwardRefExoticComponent<Partial<UnixTimestampProps> & React.RefAttributes<unknown>>;
15
16
  export {};