@nocobase/client 1.4.15 → 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.15", 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.15", 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.15",
4321
- "@nocobase/sdk": "1.4.15",
4322
- "@nocobase/utils": "1.4.15",
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,
@@ -37229,7 +37229,7 @@ const InternalNesterCss = css`
37229
37229
  ] });
37230
37230
  },
37231
37231
  { displayName: "InternalPicker" }
37232
- ), toValue$3 = (e, t) => e == null ? t : e;
37232
+ ), toValue$4 = (e, t) => e == null ? t : e;
37233
37233
  function isObject(e) {
37234
37234
  return typeof e == "object" && e !== null;
37235
37235
  }
@@ -37254,7 +37254,7 @@ const RenderRecord = React.memo(
37254
37254
  const [f, C] = useState(!0), [S, b] = useState([]);
37255
37255
  return useEffect(() => {
37256
37256
  const y = toArr$3(h).map((v, I, w) => {
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$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(
37258
37258
  (v == null ? void 0 : v.__collection) || (r == null ? void 0 : r.target),
37259
37259
  (e == null ? void 0 : e.label) || "label"
37260
37260
  ), z = getLabelFormatValue$1(o(B), D, !0);
@@ -37964,10 +37964,10 @@ const CreateRecordAction$1 = forwardRef(InternalCreateRecordAction), initializer
37964
37964
  ) }, "add") });
37965
37965
  },
37966
37966
  { displayName: "ToManyNester" }
37967
- ), toValue$2 = (e, t) => e == null ? t : e, ButtonTabList = (e) => {
37967
+ ), toValue$3 = (e, t) => e == null ? t : e, ButtonTabList = (e) => {
37968
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();
37969
37969
  return /* @__PURE__ */ jsx(Fragment, { children: toArr$3(e.value).map((b, y, v) => {
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$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]);
37971
37971
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
37972
37972
  /* @__PURE__ */ jsx("span", { children: d ? A : o !== !1 ? /* @__PURE__ */ jsx(
37973
37973
  "a",
@@ -42493,22 +42493,22 @@ const useStyles$3 = createStyles(({ token: e }) => ({
42493
42493
  ] });
42494
42494
  },
42495
42495
  mapReadPretty((e) => e.value ? /* @__PURE__ */ jsx("div", { children: "********" }) : /* @__PURE__ */ jsx("div", {}))
42496
- ), 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(
42497
42497
  (e) => {
42498
- 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]);
42499
42499
  return /* @__PURE__ */ jsx(
42500
42500
  InputNumber$1,
42501
42501
  F(x({}, e), {
42502
42502
  addonAfter: "%",
42503
42503
  value: n,
42504
42504
  onChange: (r) => {
42505
- o && o(toValue$1(r, (i) => i / 100));
42505
+ o && o(toValue$2(r, (i) => i / 100));
42506
42506
  }
42507
42507
  })
42508
42508
  );
42509
42509
  },
42510
42510
  mapReadPretty((e) => {
42511
- 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]);
42512
42512
  return /* @__PURE__ */ jsx(ReadPretty$2, F(x({}, e), { value: t }));
42513
42513
  })
42514
42514
  ), Preview = connect((e) => {
@@ -42770,14 +42770,14 @@ const useTableSelectorProps = () => {
42770
42770
  function isShowFilePicker(e) {
42771
42771
  return (e == null ? void 0 : e["x-component"]) === "Preview";
42772
42772
  }
42773
- const toValue = (e, t) => e == null ? t : e, ReadPrettyRecordPicker = observer$1(
42773
+ const toValue$1 = (e, t) => e == null ? t : e, ReadPrettyRecordPicker = observer$1(
42774
42774
  (e) => {
42775
42775
  var v, I;
42776
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();
42777
42777
  if (isShowFilePicker(h))
42778
42778
  return u ? /* @__PURE__ */ jsx(Preview, x({}, e)) : null;
42779
42779
  const S = () => toArr$3(e.value).map((w, k, A) => {
42780
- 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);
42781
42781
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
42782
42782
  /* @__PURE__ */ jsx("span", { className: "test-record-picker-read-pretty-item", children: g || f ? B : /* @__PURE__ */ jsx(
42783
42783
  "a",
@@ -44826,15 +44826,20 @@ const ReadPretty = observer$1(
44826
44826
  })
44827
44827
  ),
44828
44828
  mapReadPretty(ReadPretty)
44829
- ), 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(
44830
44835
  (e) => {
44831
- 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]);
44832
44837
  return /* @__PURE__ */ jsx(
44833
44838
  DatePicker,
44834
44839
  F(x({}, e), {
44835
- value: t,
44836
- onChange: (n) => {
44837
- o && o(n);
44840
+ value: r,
44841
+ onChange: (i) => {
44842
+ o && o(i);
44838
44843
  }
44839
44844
  })
44840
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 {};