@nocobase/client 1.2.35-alpha → 1.2.37-alpha

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
@@ -2048,6 +2048,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2048
2048
  get SchemaSettingsNumberFormat() {
2049
2049
  return SchemaSettingsNumberFormat;
2050
2050
  },
2051
+ get SchemaSettingsPagingMode() {
2052
+ return SchemaSettingsPagingMode;
2053
+ },
2051
2054
  get SchemaSettingsPlugin() {
2052
2055
  return SchemaSettingsPlugin;
2053
2056
  },
@@ -3977,7 +3980,7 @@ function addAppVersion(e, t) {
3977
3980
  addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
3978
3981
  }), e;
3979
3982
  }
3980
- const name = "@nocobase/client", version$1 = "1.2.35-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3983
+ const name = "@nocobase/client", version$1 = "1.2.37-alpha", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
3981
3984
  "@ahooksjs/use-url-state": "3.5.1",
3982
3985
  "@ant-design/cssinjs": "^1.11.1",
3983
3986
  "@ant-design/icons": "^5.1.4",
@@ -3998,9 +4001,9 @@ const name = "@nocobase/client", version$1 = "1.2.35-alpha", license = "AGPL-3.0
3998
4001
  "@formily/reactive-react": "^2.2.27",
3999
4002
  "@formily/shared": "^2.2.27",
4000
4003
  "@formily/validator": "^2.2.27",
4001
- "@nocobase/evaluators": "1.2.35-alpha",
4002
- "@nocobase/sdk": "1.2.35-alpha",
4003
- "@nocobase/utils": "1.2.35-alpha",
4004
+ "@nocobase/evaluators": "1.2.37-alpha",
4005
+ "@nocobase/sdk": "1.2.37-alpha",
4006
+ "@nocobase/utils": "1.2.37-alpha",
4004
4007
  ahooks: "^3.7.2",
4005
4008
  antd: "^5.12.8",
4006
4009
  "antd-style": "3.4.5",
@@ -14529,6 +14532,38 @@ function createModalSettingsItem(e) {
14529
14532
  }
14530
14533
  };
14531
14534
  }
14535
+ function SchemaSettingsPagingMode() {
14536
+ const e = useField(), t = useFieldSchema(), { t: o } = useTranslation(), { dn: n } = useDesignable(), { service: r } = useTableBlockContext(), i = [
14537
+ {
14538
+ value: "default",
14539
+ label: o("Default")
14540
+ },
14541
+ {
14542
+ value: "simplePaginate",
14543
+ label: o("Simple Paginate")
14544
+ }
14545
+ ];
14546
+ return /* @__PURE__ */ jsx(
14547
+ SchemaSettingsSelectItem,
14548
+ {
14549
+ title: o("Paging mode"),
14550
+ options: i,
14551
+ value: e.decoratorProps.pagingMode || "default",
14552
+ onChange: (a) => {
14553
+ var c;
14554
+ t["x-decorator-props"].pagingMode = a;
14555
+ const l = g({}, (c = r.params) == null ? void 0 : c[0]);
14556
+ a === "simplePaginate" ? l.simplePaginate = !0 : delete l.simplePaginate, r.run({ params: l }), e.decoratorProps.pagingMode = a, n.emit("patch", {
14557
+ schema: {
14558
+ "x-uid": t["x-uid"],
14559
+ "x-decorator-props": t["x-decorator-props"]
14560
+ }
14561
+ }), n.refresh();
14562
+ }
14563
+ },
14564
+ "paging-mode"
14565
+ );
14566
+ }
14532
14567
  const tableBlockSettings = new SchemaSettings({
14533
14568
  name: "blockSettings:table",
14534
14569
  items: [
@@ -14644,6 +14679,10 @@ const tableBlockSettings = new SchemaSettings({
14644
14679
  };
14645
14680
  }
14646
14681
  },
14682
+ {
14683
+ name: "pagingMode",
14684
+ Component: SchemaSettingsPagingMode
14685
+ },
14647
14686
  {
14648
14687
  name: "ConnectDataBlocks",
14649
14688
  Component: SchemaSettingsConnectDataBlocks,
@@ -15368,18 +15407,19 @@ const InternalTableBlockProvider = (e) => {
15368
15407
  }
15369
15408
  return { params: o, parseVariableLoading: n };
15370
15409
  }, TableBlockProvider = withDynamicSchemaProps((e) => {
15371
- const t = e.resource || e.association, o = useFieldSchema(), { getCollection: n, getCollectionField: r } = useCollectionManager_deprecated(e.dataSource), i = n(e.collection, e.dataSource), { treeTable: a } = (o == null ? void 0 : o["x-decorator-props"]) || {}, { params: l, parseVariableLoading: c } = useTableBlockParamsCompat(e);
15372
- let u = "children";
15410
+ const t = e.resource || e.association, o = useFieldSchema(), { getCollection: n, getCollectionField: r } = useCollectionManager_deprecated(e.dataSource), i = n(e.collection, e.dataSource), { treeTable: a, pagingMode: l } = (o == null ? void 0 : o["x-decorator-props"]) || {}, { params: c, parseVariableLoading: u } = useTableBlockParamsCompat(e);
15411
+ let d = "children";
15373
15412
  if (a)
15374
15413
  if (t != null && t.includes(".")) {
15375
- const p = r(t);
15376
- p != null && p.treeChildren && (u = p.name), l.tree = !0;
15414
+ const m = r(t);
15415
+ m != null && m.treeChildren && (d = m.name), c.tree = !0;
15377
15416
  } else {
15378
- const p = i.fields.find((m) => m.treeChildren);
15379
- p && (u = p.name), l.tree = !0;
15417
+ const m = i.fields.find((h) => h.treeChildren);
15418
+ m && (d = m.name), c.tree = !0;
15380
15419
  }
15381
- const d = useMemo(() => createForm(), [a]);
15382
- return c ? null : /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { treeTable: a }, children: /* @__PURE__ */ jsx(FormContext.Provider, { value: d, children: /* @__PURE__ */ jsx(BlockProvider, F(g({ name: e.name || "table" }, e), { params: l, runWhenParamsChanged: !0, children: /* @__PURE__ */ jsx(InternalTableBlockProvider, F(g({}, e), { childrenColumnName: u, params: l })) })) }) });
15420
+ l === "simplePaginate" ? c.simplePaginate = !0 : c == null || delete c.simplePaginate;
15421
+ const p = useMemo(() => createForm(), [a]);
15422
+ return u ? null : /* @__PURE__ */ jsx(SchemaComponentOptions, { scope: { treeTable: a }, children: /* @__PURE__ */ jsx(FormContext.Provider, { value: p, children: /* @__PURE__ */ jsx(BlockProvider, F(g({ name: e.name || "table" }, e), { params: c, runWhenParamsChanged: !0, children: /* @__PURE__ */ jsx(InternalTableBlockProvider, F(g({}, e), { childrenColumnName: d, params: c })) })) }) });
15383
15423
  }), useTableBlockContext = () => useContext(TableBlockContext), useTableBlockProps = () => {
15384
15424
  var l, c, u, d, p, m, h, f, x, C;
15385
15425
  const e = useField(), t = useFieldSchema(), o = useTableBlockContext(), n = (u = (c = (l = t.parent) == null ? void 0 : l["x-decorator-props"]) == null ? void 0 : c.params) == null ? void 0 : u.sort, { getDataBlocks: r } = useFilterBlock(), i = (d = o == null ? void 0 : o.service) == null ? void 0 : d.loading, a = useMemo(() => {
@@ -15417,10 +15457,10 @@ const InternalTableBlockProvider = (e) => {
15417
15457
  onChange: useCallback(
15418
15458
  ({ current: S, pageSize: b }, y, v) => {
15419
15459
  var w, M, N;
15420
- const I = o.dragSort ? o.dragSortBy : v.order ? v.order === "ascend" ? [v.field] : [`-${v.field}`] : n || o.dragSortBy, A = b || ((N = (M = (w = t.parent) == null ? void 0 : w["x-decorator-props"]) == null ? void 0 : M.params) == null ? void 0 : N.pageSize), k = F(g({}, a == null ? void 0 : a[0]), { page: S || 1, pageSize: A });
15460
+ const I = v.order ? v.order === "ascend" ? [v.field] : [`-${v.field}`] : n || o.dragSortBy, A = b || ((N = (M = (w = t.parent) == null ? void 0 : w["x-decorator-props"]) == null ? void 0 : M.params) == null ? void 0 : N.pageSize), k = F(g({}, a == null ? void 0 : a[0]), { page: S || 1, pageSize: A });
15421
15461
  I && (k.sort = I), o.service.run(k);
15422
15462
  },
15423
- [n, a]
15463
+ [n, a, o.dragSort]
15424
15464
  ),
15425
15465
  onClickRow: useCallback(
15426
15466
  (S, b, y) => {
@@ -18402,7 +18442,7 @@ const DynamicComponent$1 = (e) => {
18402
18442
  collectionField: { uiSchema: o, collectionName: r },
18403
18443
  uiSchema: o,
18404
18444
  blockCollectionName: r
18405
- }), m = useMemo(() => ({ minWidth: 150, maxWidth: 430, marginLeft: 5 }), []), h = useCallback(
18445
+ }), m = useMemo(() => ({ minWidth: 150, maxWidth: 430 }), []), h = useCallback(
18406
18446
  (y) => {
18407
18447
  n({
18408
18448
  mode: i,
@@ -18420,15 +18460,28 @@ const DynamicComponent$1 = (e) => {
18420
18460
  });
18421
18461
  },
18422
18462
  [r, i, n]
18423
- ), C = useMemo(() => ({ minWidth: 460 }), []), S = useMemo(() => p(d, {
18463
+ ), C = useMemo(() => ({ minWidth: 460, borderRadius: 0 }), []), S = useMemo(() => p(d, {
18424
18464
  value: t == null ? void 0 : t.value
18425
18465
  }), [p, t == null ? void 0 : t.value, d]), b = {
18426
18466
  // 常量
18427
- constant: /* @__PURE__ */ jsx("div", { role: "button", "aria-label": "dynamic-component-linkage-rules", style: m, children: React.createElement(DynamicComponent$1, {
18428
- value: t == null ? void 0 : t.value,
18429
- schema: o,
18430
- onChange: h
18431
- }) }),
18467
+ constant: /* @__PURE__ */ jsx(
18468
+ "div",
18469
+ {
18470
+ role: "button",
18471
+ "aria-label": "dynamic-component-linkage-rules",
18472
+ style: m,
18473
+ className: css`
18474
+ .ant-input-affix-wrapper {
18475
+ border-radius: 0px;
18476
+ }
18477
+ `,
18478
+ children: React.createElement(DynamicComponent$1, {
18479
+ value: t == null ? void 0 : t.value,
18480
+ schema: o,
18481
+ onChange: h
18482
+ })
18483
+ }
18484
+ ),
18432
18485
  // 表达式
18433
18486
  express: /* @__PURE__ */ jsxs("div", { role: "button", "aria-label": "dynamic-component-linkage-rules", style: f, children: [
18434
18487
  /* @__PURE__ */ jsx(
@@ -18459,7 +18512,7 @@ const DynamicComponent$1 = (e) => {
18459
18512
  style: { width: 150 },
18460
18513
  onChange: (y) => {
18461
18514
  a(y), n({
18462
- mode: y
18515
+ mode: t == null ? void 0 : t.mode
18463
18516
  });
18464
18517
  },
18465
18518
  children: [
@@ -18469,7 +18522,7 @@ const DynamicComponent$1 = (e) => {
18469
18522
  ]
18470
18523
  }
18471
18524
  ),
18472
- b[i]
18525
+ b[(t == null ? void 0 : t.mode) || i]
18473
18526
  ] });
18474
18527
  }, findOption = (e = [], t) => {
18475
18528
  var r;
@@ -18707,7 +18760,7 @@ const useStyles$f = createStyles(() => ({
18707
18760
  return /* @__PURE__ */ jsx(
18708
18761
  Input$3.TextArea,
18709
18762
  {
18710
- value: r.title,
18763
+ value: r.title || n("Linkage rule"),
18711
18764
  defaultValue: n("Linkage rule"),
18712
18765
  onChange: (a) => {
18713
18766
  a.stopPropagation(), t.field.value.splice(o, 1, F(g({}, r), { title: a.target.value }));
@@ -34631,17 +34684,49 @@ const useColumnsDeepMemoized = (e) => {
34631
34684
  const n = e, { index: t } = n, o = K(n, ["index"]);
34632
34685
  return /* @__PURE__ */ jsx("div", F(g({ className: cls("nb-table-index"), style: { padding: "0 8px 0 16px" } }, o), { children: t }));
34633
34686
  }, usePaginationProps$1 = (e, t) => {
34634
- const { t: o } = useTranslation(), n = useMemo(
34687
+ const { t: o } = useTranslation(), n = useField(), { token: r } = useToken(), i = useMemo(
34635
34688
  () => g(g({}, e), t),
34636
34689
  [JSON.stringify(g(g({}, e), t))]
34637
- ), r = useCallback((a) => o("Total {{count}} items", { count: a }), [o]), i = useMemo(
34638
- () => g({
34639
- showTotal: r,
34690
+ ), { total: a, current: l, pageSize: c } = i || {}, u = useCallback(
34691
+ (p) => o("Total {{count}} items", { count: p }),
34692
+ [o, a]
34693
+ ), d = useMemo(() => {
34694
+ var p;
34695
+ return a ? g({
34696
+ showTotal: u,
34640
34697
  showSizeChanger: !0
34641
- }, n),
34642
- [n, o, r]
34643
- );
34644
- return t === !1 || !t && e === !1 || i.total <= i.pageSize ? !1 : i;
34698
+ }, i) : F(g({
34699
+ showTotal: !1,
34700
+ simple: !0,
34701
+ showTitle: !1,
34702
+ showSizeChanger: !0,
34703
+ hideOnSinglePage: !1
34704
+ }, i), {
34705
+ total: ((p = n.value) == null ? void 0 : p.length) < c ? c * l : c * l + 1,
34706
+ className: css`
34707
+ .ant-pagination-simple-pager {
34708
+ display: none !important;
34709
+ }
34710
+ `,
34711
+ itemRender: (m, h, f) => h === "prev" ? /* @__PURE__ */ jsxs(
34712
+ "div",
34713
+ {
34714
+ style: { display: "flex" },
34715
+ className: css`
34716
+ .ant-pagination-item-link {
34717
+ min-width: ${r.controlHeight}px;
34718
+ }
34719
+ `,
34720
+ children: [
34721
+ f,
34722
+ " ",
34723
+ /* @__PURE__ */ jsx("div", { style: { marginLeft: "7px" }, children: l })
34724
+ ]
34725
+ }
34726
+ ) : f
34727
+ });
34728
+ }, [i, o, u]);
34729
+ return t === !1 || !t && e === !1 || d.total <= d.pageSize ? !1 : d;
34645
34730
  }, headerClass = css`
34646
34731
  max-width: 300px;
34647
34732
  white-space: nowrap;
@@ -35010,7 +35095,7 @@ const useColumnsDeepMemoized = (e) => {
35010
35095
  const { setVisible: v } = useActionContext(), { selectedRows: I, setSelectedRows: A } = useContext(RecordPickerContext);
35011
35096
  return {
35012
35097
  onClick() {
35013
- I.map((k) => o.value.push(k)), o.onInput(o.value), A([]), v(!1);
35098
+ I.map((k) => o.value.push(k)), o.onInput(o.value), o.initialValue = o.value, A([]), v(!1);
35014
35099
  }
35015
35100
  };
35016
35101
  }, y = () => {
@@ -40509,6 +40594,7 @@ const TableActionColumnDesigner = (e) => {
40509
40594
  }
40510
40595
  }
40511
40596
  ),
40597
+ /* @__PURE__ */ jsx(SchemaSettingsPagingMode, {}),
40512
40598
  /* @__PURE__ */ jsx(SchemaSettingsConnectDataBlocks, { type: FilterBlockType.TABLE, emptyDescription: u("No blocks to connect") }),
40513
40599
  h && /* @__PURE__ */ jsx(SchemaSettingsDivider, {}),
40514
40600
  h && /* @__PURE__ */ jsx(SchemaSettingsTemplate, { componentName: "Table", collectionName: e, resourceName: m }),
@@ -57721,6 +57807,7 @@ export {
57721
57807
  SchemaSettingsManager,
57722
57808
  SchemaSettingsModalItem,
57723
57809
  SchemaSettingsNumberFormat,
57810
+ SchemaSettingsPagingMode,
57724
57811
  SchemaSettingsPlugin,
57725
57812
  SchemaSettingsPopupItem,
57726
57813
  SchemaSettingsProvider,
@@ -0,0 +1,10 @@
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
+ import React from 'react';
10
+ export declare function SchemaSettingsPagingMode(): React.JSX.Element;
@@ -20,6 +20,7 @@ export * from './SchemaSettingsSortingRule';
20
20
  export * from './SchemaSettingsTemplate';
21
21
  export * from './SchemaSettingsBlockHeightItem';
22
22
  export * from './setDefaultSortingRulesSchemaSettingsItem';
23
+ export * from './SchemaSettingsPagingMode';
23
24
  export * from './setTheDataScopeSchemaSettingsItem';
24
25
  export * from './hooks/useGetAriaLabelOfDesigner';
25
26
  export * from './hooks/useIsAllowToSetDefaultValue';