@nocobase/client 1.7.13 → 1.7.15

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
@@ -58,7 +58,7 @@ import * as ahooks from "ahooks";
58
58
  import { useSetState, useRequest as useRequest$1, useBoolean, useUpdate, useMemoizedFn, useDeepCompareEffect, useEventListener, useLocalStorageState, useCreation, useDebounce } from "ahooks";
59
59
  import * as antd from "antd";
60
60
  import { notification, ConfigProvider, theme, message, Result, Button, Space as Space$1, Radio as Radio$1, Input as Input$3, Tag, Spin, App, Popover, Menu as Menu$1, Modal, Typography, Tooltip, Skeleton, Table as Table$3, Select as Select$1, DatePicker as DatePicker$1, Cascader as Cascader$1, Slider, Switch, Card, Empty, Collapse, Badge, Tree as Tree$2, Dropdown, Alert, Image, InputNumber as InputNumber$1, Drawer as Drawer$1, Divider as Divider$1, QRCode, Tabs as Tabs$1, TreeSelect as TreeSelect$2, Upload as Upload$1, Progress, AutoComplete as AutoComplete$1, Checkbox as Checkbox$1, ColorPicker as ColorPicker$1, List as List$1, Col, Flex, Pagination as Pagination$1, TimePicker as TimePicker$1, Row, Popconfirm, Layout as Layout$1 } from "antd";
61
- import _, { filter, capitalize, cloneDeep as cloneDeep$1, set, every, some, findIndex, isArray, isFunction, get, isObject as isObject$1, isEmpty as isEmpty$1, isString, omit, last, first, isEqual, concat, clone, debounce, castArray, uniqBy, differenceBy, unionBy, isBoolean, groupBy, toString, uniq as uniq$2, pick as pick$1 } from "lodash";
61
+ import _, { filter, capitalize, cloneDeep as cloneDeep$1, set, every, some, findIndex, isArray, isFunction, get, isObject as isObject$1, isEmpty as isEmpty$1, isString, omit, last, first, isEqual, concat, clone, debounce, castArray, uniqBy, differenceBy, unionBy, cloneDeepWith, isBoolean, groupBy, toString, uniq as uniq$2, pick as pick$1 } from "lodash";
62
62
  import template from "lodash/template";
63
63
  import React, { createContext, useContext, useMemo, Fragment, useCallback, useEffect, memo, useState, useRef, Suspense, createElement, isValidElement, lazy as lazy$1, useDeferredValue, useLayoutEffect, startTransition, forwardRef, useImperativeHandle, createRef } from "react";
64
64
  import * as ReactRouterDom from "react-router-dom";
@@ -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.13", 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.15", 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.13", 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.13",
8736
- "@nocobase/sdk": "1.7.13",
8737
- "@nocobase/utils": "1.7.13",
8735
+ "@nocobase/evaluators": "1.7.15",
8736
+ "@nocobase/sdk": "1.7.15",
8737
+ "@nocobase/utils": "1.7.15",
8738
8738
  ahooks: "^3.7.2",
8739
8739
  antd: "5.24.2",
8740
8740
  "antd-style": "3.7.1",
@@ -9500,7 +9500,7 @@ function useSatisfiedActionValues({
9500
9500
  schema: o,
9501
9501
  form: r
9502
9502
  }) {
9503
- const [a, i] = useState({}), l = useFieldSchema(), c = useVariables$1(), u = useLocalVariables$1({ currentForm: { values: e } }), d = o != null ? o : l, p = n != null ? n : d[LinkageRuleDataKeyMap[t]], m = useApp(), h = useCallback(() => {
9503
+ const [a, i] = useState({}), l = useFieldSchema(), c = useVariables$1(), u = useLocalVariables$1({ currentForm: { values: e } }), d = o != null ? o : l, p = n != null ? n : d[LinkageRuleDataKeyMap[t]] || (d == null ? void 0 : d.parent[LinkageRuleDataKeyMap[t]]), m = useApp(), h = useCallback(() => {
9504
9504
  p && e && getSatisfiedValueMap({ rules: p, variables: c, localVariables: u }, m.jsonLogic).then((g) => {
9505
9505
  isEmpty$1(g) ? i({}) : i(g);
9506
9506
  }).catch((g) => {
@@ -9518,7 +9518,7 @@ function useSatisfiedActionValues({
9518
9518
  r.removeEffects(g);
9519
9519
  };
9520
9520
  }
9521
- }, [r, h]), { valueMap: a };
9521
+ }, [r, h, e]), { valueMap: a };
9522
9522
  }
9523
9523
  const GetStyleRules = React.memo(({ record: e, schema: t, onStyleChange: n }) => {
9524
9524
  const { valueMap: o } = useSatisfiedActionValues({ formValues: e, category: "style", schema: t });
@@ -9582,9 +9582,13 @@ const mergeFilter = (e, t = "$and") => {
9582
9582
  "$dateBetween",
9583
9583
  "$in",
9584
9584
  "$notIn"
9585
- ].includes(t[i]) || a != null && a.type)
9585
+ ].includes(t[i]))
9586
9586
  return !0;
9587
9587
  const l = n(`${o}.${i}`);
9588
+ if (["datetime", "datetimeNoTz", "date", "unixTimestamp", "createdAt", "updatedAt"].includes(
9589
+ l == null ? void 0 : l.interface
9590
+ ))
9591
+ return !0;
9588
9592
  if (l != null && l.target) {
9589
9593
  if (Array.isArray(a))
9590
9594
  return !0;
@@ -18132,6 +18136,14 @@ function useCreateFormBlockDecoratorProps(e) {
18132
18136
  function useCreateFormBlockProps() {
18133
18137
  return useFormBlockProps$1();
18134
18138
  }
18139
+ function useDataFormItemProps() {
18140
+ const e = useCollectionRecordData(), { form: t } = useFormBlockContext(), n = useSubFormValue(), { valueMap: o } = useSatisfiedActionValues({
18141
+ category: "style",
18142
+ formValues: (n == null ? void 0 : n.formValue) || (t == null ? void 0 : t.values) || e,
18143
+ form: t
18144
+ });
18145
+ return { wrapperStyle: o };
18146
+ }
18135
18147
  function useEditFormBlockDecoratorProps(e) {
18136
18148
  const t = useFormBlockParams(e);
18137
18149
  let n;
@@ -18148,14 +18160,16 @@ function useFormBlockParams(e) {
18148
18160
  function useEditFormBlockProps() {
18149
18161
  return useFormBlockProps$1();
18150
18162
  }
18151
- function useDataFormItemProps() {
18152
- const e = useCollectionRecordData(), { form: t } = useFormBlockContext(), n = useSubFormValue(), { valueMap: o } = useSatisfiedActionValues({
18153
- category: "style",
18154
- formValues: (n == null ? void 0 : n.formValue) || (t == null ? void 0 : t.values) || e,
18155
- form: t
18156
- });
18157
- return { wrapperStyle: o };
18158
- }
18163
+ const useGridCardActionBarProps$1 = () => {
18164
+ const e = useFieldSchema(), { designable: t } = useDesignable();
18165
+ return {
18166
+ style: {
18167
+ marginBottom: "var(--nb-spacing)"
18168
+ },
18169
+ // In non-configuration mode, when there are no buttons, ActionBar doesn't need to be displayed
18170
+ hidden: !t && _.isEmpty(e.properties)
18171
+ };
18172
+ };
18159
18173
  function useGridCardBlockParams(e) {
18160
18174
  const { params: t } = e, { filter: n, parseVariableLoading: o } = useParsedFilter({
18161
18175
  filterOption: t == null ? void 0 : t.filter
@@ -19159,7 +19173,8 @@ const useTableSelectorParams = () => useContext(TableSelectorParamsContext), Tab
19159
19173
  useGridCardBlockItemProps,
19160
19174
  useGridCardBlockProps,
19161
19175
  useFormItemProps,
19162
- useDataFormItemProps
19176
+ useDataFormItemProps,
19177
+ useGridCardActionBarProps: useGridCardActionBarProps$1
19163
19178
  }),
19164
19179
  children: e.children
19165
19180
  }
@@ -19218,7 +19233,8 @@ class BlockSchemaComponentPlugin extends Plugin {
19218
19233
  useGridCardBlockProps,
19219
19234
  useGridCardBlockItemProps,
19220
19235
  useFormItemProps,
19221
- useDataFormItemProps
19236
+ useDataFormItemProps,
19237
+ useGridCardActionBarProps: useGridCardActionBarProps$1
19222
19238
  }));
19223
19239
  }
19224
19240
  }
@@ -22630,17 +22646,15 @@ function HTMLEncode(e) {
22630
22646
  }
22631
22647
  const ReadPretty$c = () => null;
22632
22648
  ReadPretty$c.Input = (e) => {
22633
- const t = usePrefixCls$1("description-input", e), n = useCompile(), o = useMemo(() => Array.isArray(e.value) ? e.value.join(",") : e.value && typeof e.value == "object" ? JSON.stringify(e.value) : n(e.value), [e.value]);
22649
+ const t = usePrefixCls$1("description-input", e), n = useCompile(), o = useMemo(() => Array.isArray(e.value) ? e.value.join(",") : e.value && typeof e.value == "object" ? JSON.stringify(e.value) : n(e.value), [e.value]), r = e.ellipsis ? { display: "flex", alignItems: "center" } : {};
22634
22650
  return /* @__PURE__ */ jsxs(
22635
22651
  "div",
22636
22652
  {
22637
22653
  className: cls(t, e.className),
22638
- style: x({
22639
- display: "flex",
22640
- alignItems: "center",
22654
+ style: x(P(x({}, r), {
22641
22655
  overflowWrap: "break-word",
22642
22656
  whiteSpace: "normal"
22643
- }, e.style),
22657
+ }), e.style),
22644
22658
  children: [
22645
22659
  n(e.addonBefore),
22646
22660
  n(e.prefix),
@@ -28725,7 +28739,7 @@ function useCollectValuesToSubmit() {
28725
28739
  const B = f[D], N = a(D);
28726
28740
  if (isVariable$1(B)) {
28727
28741
  const { value: $ } = (yield p == null ? void 0 : p.parseVariable(B, m)) || {};
28728
- $ != null && (S[D] = transformVariableValue($, { targetCollectionField: N }));
28742
+ S[D] = transformVariableValue($, { targetCollectionField: N });
28729
28743
  } else
28730
28744
  B !== "" && (S[D] = B);
28731
28745
  }));
@@ -28814,7 +28828,7 @@ const useCreateActionProps = () => {
28814
28828
  const Y = R[H], J = d(H);
28815
28829
  if (isVariable$1(Y)) {
28816
28830
  const { value: K } = (yield C == null ? void 0 : C.parseVariable(Y, b)) || {};
28817
- K && (O[H] = transformVariableValue(K, { targetCollectionField: J }));
28831
+ O[H] = transformVariableValue(K, { targetCollectionField: J });
28818
28832
  } else
28819
28833
  Y !== "" && (O[H] = Y);
28820
28834
  }));
@@ -28963,7 +28977,7 @@ const useCreateActionProps = () => {
28963
28977
  const q = b[M], E = m(M);
28964
28978
  if (isVariable$1(q)) {
28965
28979
  const { value: V } = (yield u == null ? void 0 : u.parseVariable(q, d)) || {};
28966
- V && (B[M] = transformVariableValue(V, { targetCollectionField: E }));
28980
+ B[M] = transformVariableValue(V, { targetCollectionField: E });
28967
28981
  } else
28968
28982
  q !== "" && (B[M] = q);
28969
28983
  }));
@@ -29006,7 +29020,7 @@ const useCreateActionProps = () => {
29006
29020
  const V = R[E], G = C(E);
29007
29021
  if (isVariable$1(V)) {
29008
29022
  const { value: U } = (yield g == null ? void 0 : g.parseVariable(V, b)) || {};
29009
- U && (j[E] = transformVariableValue(U, { targetCollectionField: G }));
29023
+ j[E] = transformVariableValue(U, { targetCollectionField: G });
29010
29024
  } else
29011
29025
  V !== "" && (j[E] = V);
29012
29026
  }));
@@ -29119,7 +29133,7 @@ const useCreateActionProps = () => {
29119
29133
  const H = T[U], Y = d(U);
29120
29134
  if (isVariable$1(H)) {
29121
29135
  const { value: J } = (yield b == null ? void 0 : b.parseVariable(H, S)) || {};
29122
- J && (k[U] = transformVariableValue(J, { targetCollectionField: Y }));
29136
+ k[U] = transformVariableValue(J, { targetCollectionField: Y });
29123
29137
  } else
29124
29138
  H !== "" && (k[U] = H);
29125
29139
  }));
@@ -30841,9 +30855,9 @@ const DragHandler = (e) => {
30841
30855
  collectionName: C,
30842
30856
  dataSource: b,
30843
30857
  defaultValue: S
30844
- } = useParentPopupVariableContext(), { datetimeCtx: y } = useDatetimeVariableContext(), { currentFormCtx: v } = useCurrentFormContext({ form: e == null ? void 0 : e.currentForm }), { name: F } = useCollection_deprecated(), I = useContextVariable();
30845
- let { name: T } = useBlockCollection();
30846
- return e != null && e.collectionName && (T = e.collectionName), useMemo(() => [
30858
+ } = useParentPopupVariableContext(), { urlSearchParamsCtx: y, shouldDisplay: v } = useURLSearchParamsVariable(), { datetimeCtx: F } = useDatetimeVariableContext(), { currentFormCtx: I } = useCurrentFormContext({ form: e == null ? void 0 : e.currentForm }), { name: T } = useCollection_deprecated(), R = useContextVariable();
30859
+ let { name: D } = useBlockCollection();
30860
+ return e != null && e.collectionName && (D = e.collectionName), useMemo(() => [
30847
30861
  /**
30848
30862
  * @deprecated
30849
30863
  * 兼容老版本
@@ -30858,9 +30872,9 @@ const DragHandler = (e) => {
30858
30872
  * 兼容旧版本的以数据表名称命名的变量,新版本已更名为 `$nForm`
30859
30873
  */
30860
30874
  {
30861
- name: T,
30862
- ctx: v || i,
30863
- collectionName: T
30875
+ name: D,
30876
+ ctx: I || i,
30877
+ collectionName: D
30864
30878
  },
30865
30879
  /**
30866
30880
  * @deprecated
@@ -30868,8 +30882,8 @@ const DragHandler = (e) => {
30868
30882
  */
30869
30883
  {
30870
30884
  name: "$form",
30871
- ctx: v,
30872
- collectionName: T
30885
+ ctx: I,
30886
+ collectionName: D
30873
30887
  },
30874
30888
  {
30875
30889
  name: "$nRecord",
@@ -30899,12 +30913,12 @@ const DragHandler = (e) => {
30899
30913
  },
30900
30914
  {
30901
30915
  name: "$nForm",
30902
- ctx: v,
30903
- collectionName: T
30916
+ ctx: I,
30917
+ collectionName: D
30904
30918
  },
30905
30919
  {
30906
30920
  name: "$nDate",
30907
- ctx: y
30921
+ ctx: F
30908
30922
  },
30909
30923
  /**
30910
30924
  * @deprecated
@@ -30912,24 +30926,28 @@ const DragHandler = (e) => {
30912
30926
  */
30913
30927
  {
30914
30928
  name: "$date",
30915
- ctx: y
30929
+ ctx: F
30916
30930
  },
30917
- I,
30931
+ R,
30918
30932
  a && {
30919
30933
  name: "$iteration",
30920
30934
  ctx: r,
30921
- collectionName: F
30935
+ collectionName: T
30922
30936
  },
30923
30937
  n && {
30924
30938
  name: "$nParentIteration",
30925
30939
  ctx: t,
30926
30940
  collectionName: o
30941
+ },
30942
+ v && {
30943
+ name: "$nURLSearchParams",
30944
+ ctx: y
30927
30945
  }
30928
30946
  ].filter(Boolean), [
30929
30947
  i,
30930
30948
  l,
30931
- T,
30932
- v,
30949
+ D,
30950
+ I,
30933
30951
  c,
30934
30952
  u,
30935
30953
  d,
@@ -30937,16 +30955,17 @@ const DragHandler = (e) => {
30937
30955
  f,
30938
30956
  m,
30939
30957
  h,
30940
- y,
30958
+ F,
30941
30959
  a,
30942
30960
  r,
30943
- F,
30961
+ T,
30944
30962
  g,
30945
30963
  S,
30946
30964
  n,
30947
30965
  t,
30948
30966
  o,
30949
- I
30967
+ R,
30968
+ y
30950
30969
  ]);
30951
30970
  }, useLocalVariables$1 = useLocalVariables, useVariables = () => useContext(VariablesContext), useVariables$1 = useVariables, isSubFormOrSubTableField = (e) => {
30952
30971
  for (; e; ) {
@@ -39529,7 +39548,7 @@ const ActionBarContext = React.createContext({
39529
39548
  })
39530
39549
  );
39531
39550
  }, ActionBar = withDynamicSchemaProps(
39532
- (e) => /* @__PURE__ */ jsx(InternalActionBar, x({}, e)),
39551
+ (e) => e.hidden ? null : /* @__PURE__ */ jsx(InternalActionBar, x({}, e)),
39533
39552
  { displayName: "ActionBar" }
39534
39553
  ), useGetAriaLabelOfPopover = () => {
39535
39554
  const e = useFieldSchema(), t = e["x-component"], n = typeof t == "string" ? t : (t == null ? void 0 : t.displayName) || (t == null ? void 0 : t.name), o = useCompile();
@@ -44595,7 +44614,10 @@ const AssignedFieldInner = (e) => {
44595
44614
  ), S = useCallback(
44596
44615
  (v) => {
44597
44616
  const F = v.find((T) => T.value === "$nForm"), I = o(h);
44598
- return !(I != null && I.length) && F && (F.children = formatVariableScop(m)), cloneDeep$1(v);
44617
+ return !(I != null && I.length) && F && (F.children = formatVariableScop(m)), cloneDeepWith(v, (T) => {
44618
+ if (isValidElement(T))
44619
+ return T;
44620
+ });
44599
44621
  },
44600
44622
  [m, h]
44601
44623
  ), y = useCallback(
@@ -45403,8 +45425,11 @@ const useColumnsDeepMemoized = (e) => {
45403
45425
  return /* @__PURE__ */ jsx("td", P(x({}, c), { className: cls(e.className, cellClass), style: d, children: l || n || o ? e.children : /* @__PURE__ */ jsx("div", { style: p }) }));
45404
45426
  }, displayNone = { display: "none" }, BodyCellComponent = (n) => {
45405
45427
  var o = n, { columnHidden: e } = o, t = W(o, ["columnHidden"]);
45406
- const { designable: r } = useDesignable();
45407
- return e ? /* @__PURE__ */ jsx("td", { style: r ? columnOpacityStyle : columnHiddenStyle, children: r ? t.children : /* @__PURE__ */ jsx("span", { style: displayNone, children: t.children }) }) : /* @__PURE__ */ jsx(InternalBodyCellComponent, x({}, t));
45428
+ const { designable: r } = useDesignable(), a = useCollection();
45429
+ return e ? /* @__PURE__ */ jsx("td", { style: r ? columnOpacityStyle : columnHiddenStyle, children: r ? t.children : /* @__PURE__ */ jsx("span", { style: displayNone, children: t.children }) }) : /* @__PURE__ */ jsxs(SubFormProvider, { value: { value: t == null ? void 0 : t.record, collection: a, fieldSchema: t.schema }, children: [
45430
+ /* @__PURE__ */ jsx(InternalBodyCellComponent, x({}, t)),
45431
+ " "
45432
+ ] });
45408
45433
  }, InternalNocoBaseTable = React.memo(
45409
45434
  (e) => {
45410
45435
  const b = e, {
@@ -63442,11 +63467,7 @@ const createGridCardBlockUISchema = (e) => {
63442
63467
  type: "void",
63443
63468
  "x-initializer": "gridCard:configureActions",
63444
63469
  "x-component": "ActionBar",
63445
- "x-component-props": {
63446
- style: {
63447
- marginBottom: "var(--nb-spacing)"
63448
- }
63449
- }
63470
+ "x-use-component-props": "useGridCardActionBarProps"
63450
63471
  },
63451
63472
  list: {
63452
63473
  type: "array",
@@ -0,0 +1,14 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+ export declare const useGridCardActionBarProps: () => {
10
+ style: {
11
+ marginBottom: string;
12
+ };
13
+ hidden: boolean;
14
+ };