@nocobase/client 2.0.43 → 2.0.44

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.
@@ -21,7 +21,9 @@ export declare class TableColumnModel extends DisplayItemModel {
21
21
  afterAddAsSubModel(): Promise<void>;
22
22
  renderHiddenInConfig(): React.ReactNode | undefined;
23
23
  static defineChildren(ctx: FlowModelContext): any;
24
- getColumnProps(): TableColumnProps;
24
+ getColumnProps(): TableColumnProps & {
25
+ sortField?: string;
26
+ };
25
27
  onInit(options: any): void;
26
28
  renderItem(): any;
27
29
  }
@@ -0,0 +1,32 @@
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
+ type AssociationTitleFieldModel = {
10
+ fieldPath?: string;
11
+ props?: {
12
+ dataIndex?: string;
13
+ titleField?: string;
14
+ };
15
+ collectionField?: {
16
+ name?: string;
17
+ targetCollectionTitleFieldName?: string;
18
+ isAssociationField?: () => boolean;
19
+ };
20
+ getStepParams?: (flowKey: string, stepKey: string) => {
21
+ label?: string;
22
+ } | undefined;
23
+ };
24
+ export declare function getSavedAssociationTitleField(model: AssociationTitleFieldModel): string;
25
+ export declare function getTableColumnSortField(model: AssociationTitleFieldModel): string;
26
+ export declare function resolveTableSorterField(sorter: {
27
+ field?: string;
28
+ column?: {
29
+ sortField?: string;
30
+ };
31
+ }): string;
32
+ export {};
package/es/index.mjs CHANGED
@@ -9979,7 +9979,7 @@ function addAppVersion(e, t) {
9979
9979
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
9980
9980
  }), e;
9981
9981
  }
9982
- const name = "@nocobase/client", version = "2.0.43", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9982
+ const name = "@nocobase/client", version = "2.0.44", license = "Apache-2.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
9983
9983
  "@ahooksjs/use-url-state": "3.5.1",
9984
9984
  "@ant-design/cssinjs": "^1.11.1",
9985
9985
  "@ant-design/icons": "^5.6.1",
@@ -10002,10 +10002,10 @@ const name = "@nocobase/client", version = "2.0.43", license = "Apache-2.0", mai
10002
10002
  "@formily/reactive-react": "^2.2.27",
10003
10003
  "@formily/shared": "^2.2.27",
10004
10004
  "@formily/validator": "^2.2.27",
10005
- "@nocobase/evaluators": "2.0.43",
10006
- "@nocobase/flow-engine": "2.0.43",
10007
- "@nocobase/sdk": "2.0.43",
10008
- "@nocobase/utils": "2.0.43",
10005
+ "@nocobase/evaluators": "2.0.44",
10006
+ "@nocobase/flow-engine": "2.0.44",
10007
+ "@nocobase/sdk": "2.0.44",
10008
+ "@nocobase/utils": "2.0.44",
10009
10009
  "@tanstack/react-table": "^8.21.3",
10010
10010
  "@types/tabulator-tables": "^6.2.6",
10011
10011
  "acorn-jsx": "^5.3.2",
@@ -30647,7 +30647,7 @@ const useStyles$a = genStyleHook("nb-markdown", (e, { isDarkTheme: t }) => {
30647
30647
  }, t ? i : r)
30648
30648
  };
30649
30649
  }), parseMarkdown$1 = _.memoize((e) => L(void 0, null, function* () {
30650
- return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
30650
+ return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
30651
30651
  }));
30652
30652
  function useParseMarkdown$1(e) {
30653
30653
  const [t, o] = useState(""), [n, r] = useState(!0);
@@ -72079,7 +72079,7 @@ BlockGridModel.registerFlow({
72079
72079
  }
72080
72080
  });
72081
72081
  const parseMarkdown = _.memoize((e) => L(void 0, null, function* () {
72082
- return e && (yield import("./md-BbvRKckr.mjs")).default.render(e);
72082
+ return e && (yield import("./md-oH2RssNY.mjs")).default.render(e);
72083
72083
  }));
72084
72084
  function useParseMarkdown(e) {
72085
72085
  const [t, o] = useState(""), [n, r] = useState(!0);
@@ -83945,6 +83945,22 @@ const useBlockHeight = ({ heightMode: e, tableAreaRef: t, deps: o = [] }) => {
83945
83945
  return u.observe(a), l && u.observe(l), c && u.observe(c), () => u.disconnect();
83946
83946
  }, [i, t, ...o]), n;
83947
83947
  };
83948
+ function getSavedAssociationTitleField(e) {
83949
+ var t, o, n;
83950
+ return ((o = (t = e.getStepParams) == null ? void 0 : t.call(e, "tableColumnSettings", "fieldNames")) == null ? void 0 : o.label) || ((n = e.props) == null ? void 0 : n.titleField);
83951
+ }
83952
+ function getTableColumnSortField(e) {
83953
+ var r, i, a, l;
83954
+ const t = e.fieldPath || ((r = e.collectionField) == null ? void 0 : r.name) || ((i = e.props) == null ? void 0 : i.dataIndex);
83955
+ if (!((l = (a = e.collectionField) == null ? void 0 : a.isAssociationField) != null && l.call(a)))
83956
+ return t;
83957
+ const o = e.collectionField.name || e.fieldPath, n = getSavedAssociationTitleField(e) || e.collectionField.targetCollectionTitleFieldName;
83958
+ return !o || !n ? t : `${o}.${n}`;
83959
+ }
83960
+ function resolveTableSorterField(e) {
83961
+ var t;
83962
+ return ((t = e == null ? void 0 : e.column) == null ? void 0 : t.sortField) || (e == null ? void 0 : e.field);
83963
+ }
83948
83964
  function FieldDeletePlaceholder(e) {
83949
83965
  const { t } = useTranslation(), o = useFlowModel(), n = o.context.blockModel, r = (e == null ? void 0 : e.collection) || n.collection, i = r.dataSource, a = o.props.title || o.fieldPath, l = useMemo(() => {
83950
83966
  const u = `${t(i.displayName || i.key)} > `, d = r ? `${t(r.title) || r.name || r.tableName} > ` : "";
@@ -83997,12 +84013,7 @@ const CustomWidth = ({ setOpen: e, t, handleChange: o, defaultValue: n }) => {
83997
84013
  ] })
83998
84014
  }
83999
84015
  );
84000
- };
84001
- function getSavedAssociationTitleField(e) {
84002
- var t, o, n;
84003
- return ((o = (t = e.getStepParams) == null ? void 0 : t.call(e, "tableColumnSettings", "fieldNames")) == null ? void 0 : o.label) || ((n = e.props) == null ? void 0 : n.titleField);
84004
- }
84005
- const Ze = class Ze extends DisplayItemModel {
84016
+ }, Ze = class Ze extends DisplayItemModel {
84006
84017
  afterAddAsSubModel() {
84007
84018
  return L(this, null, function* () {
84008
84019
  yield $e(Ze.prototype, this, "afterAddAsSubModel").call(this), yield this.dispatchEvent("beforeRender");
@@ -84082,6 +84093,7 @@ const Ze = class Ze extends DisplayItemModel {
84082
84093
  }
84083
84094
  ) }), o = this.render();
84084
84095
  return I(x({}, this.props), {
84096
+ sortField: getTableColumnSortField(this),
84085
84097
  ellipsis: !0,
84086
84098
  title: this.props.tooltip ? /* @__PURE__ */ jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: 4 }, children: [
84087
84099
  t,
@@ -84280,7 +84292,8 @@ TableColumnModel.registerFlow({
84280
84292
  title: tExpr("Sortable"),
84281
84293
  uiMode: { type: "switch", key: "sorter" },
84282
84294
  hideInSettings: (e) => L(void 0, null, function* () {
84283
- return !e.model.collectionField.getInterfaceOptions().sortable || e.associationModel;
84295
+ var o, n;
84296
+ return !e.model.collectionField.getInterfaceOptions().sortable || ((n = (o = e.collectionField) == null ? void 0 : o.isAssociationField) == null ? void 0 : n.call(o)) || !!e.model.associationPathName || e.associationModel;
84284
84297
  }),
84285
84298
  defaultParams: {
84286
84299
  sorter: !1
@@ -92482,10 +92495,10 @@ const HighPerformanceTable = React.memo(
92482
92495
  renderCell: t.renderCell
92483
92496
  }, t.rowSelectionProps), [t, m]), y = useCallback(
92484
92497
  (D, T, w) => L(void 0, null, function* () {
92485
- const B = t.props.globalSort, $ = t.resource.getSort(), j = $ != null && $.length ? $ : B, O = w.order ? w.order === "ascend" ? [w.field] : [`-${w.field}`] : j;
92486
- if (w && t.resource.setSort(O), t.resource.getPageSize() !== D.pageSize ? t.resource.setPage(1) : t.resource.setPage(D.current), t.resource.loading = !0, t.resource.setPageSize(D.pageSize), yield t.resource.refresh(), c) {
92487
- const V = extractIds(t.resource.getData());
92488
- F(V);
92498
+ const B = t.props.globalSort, $ = t.resource.getSort(), j = $ != null && $.length ? $ : B, O = resolveTableSorterField(w), V = w.order && O ? w.order === "ascend" ? [O] : [`-${O}`] : j;
92499
+ if (w && t.resource.setSort(V), t.resource.getPageSize() !== D.pageSize ? t.resource.setPage(1) : t.resource.setPage(D.current), t.resource.loading = !0, t.resource.setPageSize(D.pageSize), yield t.resource.refresh(), c) {
92500
+ const z = extractIds(t.resource.getData());
92501
+ F(z);
92489
92502
  }
92490
92503
  }),
92491
92504
  [t, c]