@pisell/materials 1.0.407 → 1.0.409

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.
Files changed (149) hide show
  1. package/build/lowcode/assets-daily.json +13 -13
  2. package/build/lowcode/assets-dev.json +4 -4
  3. package/build/lowcode/assets-prod.json +13 -13
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +142 -142
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +59 -16
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +62 -19
  11. package/es/components/browserSelect/chevron-down.png +0 -0
  12. package/es/components/browserSelect/index.d.ts +15 -0
  13. package/es/components/browserSelect/index.js +36 -0
  14. package/es/components/browserSelect/index.less +18 -0
  15. package/es/components/date-picker/constants.d.ts +39 -0
  16. package/es/components/date-picker/constants.js +76 -0
  17. package/es/components/date-picker/datePickerCpt.d.ts +8 -0
  18. package/es/components/date-picker/datePickerCpt.js +370 -0
  19. package/es/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
  20. package/es/components/date-picker/hooks/useMediaQuery.js +28 -0
  21. package/es/components/date-picker/index.js +2 -2
  22. package/es/components/date-picker/index.less +1880 -0
  23. package/es/components/drag-sort-tree/index.d.ts +0 -1
  24. package/es/components/drag-sort-tree/index.js +2 -1
  25. package/es/components/page/index.js +4 -2
  26. package/es/components/picker-view/index.d.ts +2 -0
  27. package/es/components/picker-view/index.js +2 -0
  28. package/es/components/pisell-config-provider/index.js +2 -0
  29. package/es/components/pisellModal/components/functions/index.d.ts +23 -5
  30. package/es/components/pisellModal/components/functions/index.js +7 -2
  31. package/es/components/pisellModal/index.d.ts +20 -5
  32. package/es/components/pisellTags/index.d.ts +13 -0
  33. package/es/components/pisellTags/index.js +83 -0
  34. package/es/components/pisellTags/index.less +17 -0
  35. package/es/components/pisellTags/utils.d.ts +1 -0
  36. package/es/components/pisellTags/utils.js +89 -0
  37. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
  38. package/es/components/table/Actions/component/ExportImport/components/ExportFile/index.js +33 -48
  39. package/es/components/table/Actions/component/ExportImport/components/ExportTable/function.js +9 -9
  40. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
  41. package/es/components/table/Actions/component/ExportImport/components/ImportLog/index.js +28 -43
  42. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
  43. package/es/components/table/Actions/component/ExportImport/components/ImportTable/index.js +45 -44
  44. package/es/components/table/Actions/component/ExportImport/index.d.ts +3 -3
  45. package/es/components/table/Actions/component/ExportImport/index.js +34 -25
  46. package/es/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
  47. package/es/components/table/Actions/component/ExportImport/utils/index.js +11 -0
  48. package/es/components/table/BasicTable/index.js +5 -3
  49. package/es/components/table/Gallery/index.js +2 -1
  50. package/es/components/table/Table/fields/rangePicker/Edit/index.js +13 -11
  51. package/es/components/table/Table/index.d.ts +2 -2
  52. package/es/components/table/Table/index.js +68 -42
  53. package/es/components/table/Table/index.less +3 -0
  54. package/es/components/table/Table/utils.d.ts +14 -2
  55. package/es/components/table/Table/utils.js +6 -2
  56. package/es/components/table/View/index.d.ts +2 -2
  57. package/es/components/table/View/index.js +27 -16
  58. package/es/components/table/hooks/useGenScroll.js +1 -1
  59. package/es/components/table/hooks/useTableSetting.js +29 -7
  60. package/es/components/table/hooks/useTransDataSource.d.ts +1 -0
  61. package/es/components/table/hooks/useTransDataSource.js +8 -6
  62. package/es/components/table/index.js +7 -5
  63. package/es/components/table/index.less +9 -0
  64. package/es/components/table/serve.d.ts +3 -1
  65. package/es/components/table/serve.js +71 -9
  66. package/es/components/table/types.d.ts +17 -4
  67. package/es/index.d.ts +3 -1
  68. package/es/index.js +3 -1
  69. package/es/locales/en-US.d.ts +12 -0
  70. package/es/locales/en-US.js +13 -0
  71. package/es/locales/zh-CN.d.ts +12 -0
  72. package/es/locales/zh-CN.js +13 -0
  73. package/es/locales/zh-TW.d.ts +12 -0
  74. package/es/locales/zh-TW.js +13 -0
  75. package/lib/components/browserSelect/chevron-down.png +0 -0
  76. package/lib/components/browserSelect/index.d.ts +15 -0
  77. package/lib/components/browserSelect/index.js +59 -0
  78. package/lib/components/browserSelect/index.less +18 -0
  79. package/lib/components/date-picker/constants.d.ts +39 -0
  80. package/lib/components/date-picker/constants.js +78 -0
  81. package/lib/components/date-picker/datePickerCpt.d.ts +8 -0
  82. package/lib/components/date-picker/datePickerCpt.js +403 -0
  83. package/lib/components/date-picker/hooks/useMediaQuery.d.ts +2 -0
  84. package/lib/components/date-picker/hooks/useMediaQuery.js +43 -0
  85. package/lib/components/date-picker/index.js +2 -2
  86. package/lib/components/date-picker/index.less +1880 -0
  87. package/lib/components/drag-sort-tree/index.d.ts +0 -1
  88. package/lib/components/drag-sort-tree/index.js +0 -1
  89. package/lib/components/page/index.js +3 -2
  90. package/lib/components/picker-view/index.d.ts +2 -0
  91. package/lib/components/picker-view/index.js +36 -0
  92. package/lib/components/pisell-config-provider/index.js +2 -0
  93. package/lib/components/pisellModal/components/functions/index.d.ts +23 -5
  94. package/lib/components/pisellModal/components/functions/index.js +13 -7
  95. package/lib/components/pisellModal/index.d.ts +20 -5
  96. package/lib/components/pisellTags/index.d.ts +13 -0
  97. package/lib/components/pisellTags/index.js +113 -0
  98. package/lib/components/pisellTags/index.less +17 -0
  99. package/lib/components/pisellTags/utils.d.ts +1 -0
  100. package/lib/components/pisellTags/utils.js +86 -0
  101. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.d.ts +3 -3
  102. package/lib/components/table/Actions/component/ExportImport/components/ExportFile/index.js +9 -22
  103. package/lib/components/table/Actions/component/ExportImport/components/ExportTable/function.js +3 -8
  104. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.d.ts +3 -3
  105. package/lib/components/table/Actions/component/ExportImport/components/ImportLog/index.js +9 -22
  106. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.d.ts +3 -3
  107. package/lib/components/table/Actions/component/ExportImport/components/ImportTable/index.js +5 -8
  108. package/lib/components/table/Actions/component/ExportImport/index.d.ts +3 -3
  109. package/lib/components/table/Actions/component/ExportImport/index.js +15 -8
  110. package/lib/components/table/Actions/component/ExportImport/utils/index.d.ts +9 -0
  111. package/lib/components/table/Actions/component/ExportImport/utils/index.js +31 -0
  112. package/lib/components/table/BasicTable/index.js +2 -3
  113. package/lib/components/table/Gallery/index.js +2 -1
  114. package/lib/components/table/Table/fields/rangePicker/Edit/index.js +1 -9
  115. package/lib/components/table/Table/index.d.ts +2 -2
  116. package/lib/components/table/Table/index.js +61 -34
  117. package/lib/components/table/Table/index.less +3 -0
  118. package/lib/components/table/Table/utils.d.ts +14 -2
  119. package/lib/components/table/Table/utils.js +7 -1
  120. package/lib/components/table/View/index.d.ts +2 -2
  121. package/lib/components/table/View/index.js +28 -19
  122. package/lib/components/table/hooks/useGenScroll.js +1 -1
  123. package/lib/components/table/hooks/useTableSetting.js +26 -11
  124. package/lib/components/table/hooks/useTransDataSource.d.ts +1 -0
  125. package/lib/components/table/hooks/useTransDataSource.js +6 -5
  126. package/lib/components/table/index.js +4 -4
  127. package/lib/components/table/index.less +9 -0
  128. package/lib/components/table/serve.d.ts +3 -1
  129. package/lib/components/table/serve.js +38 -6
  130. package/lib/components/table/types.d.ts +17 -4
  131. package/lib/index.d.ts +3 -1
  132. package/lib/index.js +6 -0
  133. package/lib/locales/en-US.d.ts +12 -0
  134. package/lib/locales/en-US.js +13 -0
  135. package/lib/locales/zh-CN.d.ts +12 -0
  136. package/lib/locales/zh-CN.js +13 -0
  137. package/lib/locales/zh-TW.d.ts +12 -0
  138. package/lib/locales/zh-TW.js +13 -0
  139. package/lowcode/table/meta.ts +26 -18
  140. package/lowcode/table/snippets.ts +2 -3
  141. package/package.json +3 -3
  142. package/dist/umd/materials.min.css +0 -1
  143. package/dist/umd/materials.min.js +0 -1
  144. package/dist/umd/static/DotsSix.57d66266.svg +0 -1
  145. package/dist/umd/static/arrow-left.e542294f.svg +0 -1
  146. package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
  147. package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
  148. package/dist/umd/static/help-circle.31c9be40.svg +0 -1
  149. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
@@ -46,7 +46,7 @@ var import_index = require("./index.less");
46
46
  var loadingKey = import_status.defaultOptions.importValue;
47
47
  var ImportTable = (props) => {
48
48
  const { onChange, exportImport, errorStatus } = props;
49
- const { formId, formCode, templateFileUrl } = exportImport;
49
+ const { templateFileUrl, apiUrl, otherParams } = exportImport;
50
50
  const [file, setFile] = (0, import_react.useState)(null);
51
51
  const context = (0, import_useEngineContext.default)();
52
52
  import_utils.request.setRequest(context.appHelper.utils.request);
@@ -55,13 +55,10 @@ var ImportTable = (props) => {
55
55
  (0, import_download.default)(templateFileUrl);
56
56
  } else {
57
57
  import_antd.message.loading({ content: "Loading...", key: loadingKey });
58
- const params = {};
59
- if (formId) {
60
- params.form_id = formId;
61
- }
62
- if (formCode) {
63
- params.code = formCode;
64
- }
58
+ const params = {
59
+ url: apiUrl == null ? void 0 : apiUrl.template,
60
+ ...otherParams
61
+ };
65
62
  let { data } = await (0, import_serve.importTemplate)(params);
66
63
  (0, import_download.default)(data == null ? void 0 : data.url);
67
64
  }
@@ -1,6 +1,6 @@
1
- import React from "react";
2
- import { ExportImportType } from "../../../types";
3
- import "./index.less";
1
+ import React from 'react';
2
+ import { ExportImportType } from '../../../types';
3
+ import './index.less';
4
4
  declare type ExportImportProps = {
5
5
  exportImport: ExportImportType;
6
6
  };
@@ -68,19 +68,23 @@ var ExportImport = ({ exportImport }) => {
68
68
  const context = (0, import_useEngineContext.default)();
69
69
  import_utils.request.setRequest(context.appHelper.utils.request);
70
70
  const _items = (0, import_react.useMemo)(() => {
71
- const result = Object.entries(import_status.exportImportOptions).map(([key, value2]) => {
71
+ var _a;
72
+ const result = (_a = Object.entries(import_status.exportImportOptions).map(([key, value2]) => {
73
+ var _a2;
74
+ if (Array.isArray(exportImport == null ? void 0 : exportImport.hiddenKeys) && ((_a2 = exportImport == null ? void 0 : exportImport.hiddenKeys) == null ? void 0 : _a2.includes(key))) {
75
+ return;
76
+ }
72
77
  return {
73
78
  key,
74
79
  label: value2
75
80
  };
76
- });
81
+ })) == null ? void 0 : _a.filter(Boolean);
77
82
  return result;
78
- }, []);
83
+ }, [exportImport == null ? void 0 : exportImport.hiddenKeys]);
79
84
  const Content = (0, import_react.useMemo)(() => {
80
- if (!value)
81
- return null;
82
- return Com[value];
83
- }, [value]);
85
+ const _value = value || import_status.defaultOptions.importValue;
86
+ return Com[_value];
87
+ }, [value, import_status.defaultOptions.importValue]);
84
88
  const _footer = (0, import_react.useMemo)(() => {
85
89
  const types = import_status.defaultOptions.footerHintTypes;
86
90
  if (types.includes(value)) {
@@ -138,7 +142,7 @@ var ExportImport = ({ exportImport }) => {
138
142
  }
139
143
  });
140
144
  const onOk = async () => {
141
- const { formId, formCode } = exportImport;
145
+ const { apiUrl, otherParams } = exportImport;
142
146
  if (value === import_status.defaultOptions.exportValue) {
143
147
  const _params = {
144
148
  type,
@@ -152,12 +156,15 @@ var ExportImport = ({ exportImport }) => {
152
156
  } else if (value === import_status.defaultOptions.importValue) {
153
157
  const formData = new FormData();
154
158
  formData.append("file", file);
159
+ const formId = otherParams == null ? void 0 : otherParams.form_id;
160
+ const formCode = otherParams == null ? void 0 : otherParams.code;
155
161
  if (formId) {
156
162
  formData.append("form_id", formId);
157
163
  }
158
164
  if (formCode) {
159
165
  formData.append("code", formCode);
160
166
  }
167
+ formData.append("url", (apiUrl == null ? void 0 : apiUrl.export) || "");
161
168
  if (formData) {
162
169
  import_antd.message.loading({ content: "Loading...", key: value });
163
170
  _batchImport.run(formData);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @title: 格式化导出导入接口地址
3
+ * @description:
4
+ * @param {string} url
5
+ * @return {*}
6
+ * @Author: WangHan
7
+ * @Date: 2024-09-05 11:39
8
+ */
9
+ export declare const formatApiUrl: (url: string) => string;
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/table/Actions/component/ExportImport/utils/index.ts
20
+ var utils_exports = {};
21
+ __export(utils_exports, {
22
+ formatApiUrl: () => formatApiUrl
23
+ });
24
+ module.exports = __toCommonJS(utils_exports);
25
+ var formatApiUrl = (url) => {
26
+ return url || "/shop/form/data";
27
+ };
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ formatApiUrl
31
+ });
@@ -93,7 +93,6 @@ var BasicTable = (props) => {
93
93
  sort,
94
94
  other.columns
95
95
  ]);
96
- console.log(pagination, "wh8888");
97
96
  const total = (0, import_react.useMemo)(() => {
98
97
  if (localPagination) {
99
98
  return (_dataSource == null ? void 0 : _dataSource.total) || 0;
@@ -115,7 +114,7 @@ var BasicTable = (props) => {
115
114
  type: "setCurrentDataSource",
116
115
  payload: (_dataSource == null ? void 0 : _dataSource.list) || []
117
116
  });
118
- }, [_dataSource == null ? void 0 : _dataSource.list]);
117
+ }, [JSON.stringify(_dataSource == null ? void 0 : _dataSource.list)]);
119
118
  return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
120
119
  import_antd.Table,
121
120
  {
@@ -148,7 +147,7 @@ var BasicTable = (props) => {
148
147
  defaultExpandAllRows: true
149
148
  }
150
149
  }
151
- ), total > ((pagination == null ? void 0 : pagination.pageSize) || ((_a = pagination == null ? void 0 : pagination.pageSizeOptions) == null ? void 0 : _a[0]) || 10) || (pagination == null ? void 0 : pagination.showPagination) && total > 10 ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "pagination" }, /* @__PURE__ */ import_react.default.createElement(
150
+ ), total > ((pagination == null ? void 0 : pagination.pageSize) || ((_a = pagination == null ? void 0 : pagination.pageSizeOptions) == null ? void 0 : _a[0]) || 10) || (pagination == null ? void 0 : pagination.showPagination) && total > 10 ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "pagination", style: { margin: 0 } }, /* @__PURE__ */ import_react.default.createElement(
152
151
  import_Pagination.FormPagination,
153
152
  {
154
153
  ...pagination,
@@ -71,7 +71,8 @@ var Gallery = (props) => {
71
71
  form,
72
72
  localPagination: !!(pagination == null ? void 0 : pagination.localPagination),
73
73
  rowKey,
74
- filter
74
+ filter,
75
+ currentView: "gallery"
75
76
  });
76
77
  (0, import_react.useEffect)(() => {
77
78
  onDataSourceChange == null ? void 0 : onDataSourceChange(dataSource);
@@ -94,20 +94,12 @@ var Edit = (props, ref) => {
94
94
  value: [(0, import_dayjs.default)().add(-90, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
95
95
  }
96
96
  ];
97
- const _showTime = (0, import_react.useMemo)(() => {
98
- if ((0, import_utils.isBoolean)(showTime)) {
99
- return showTime;
100
- } else if (typeof showTime === "object") {
101
- return showTime;
102
- }
103
- return true;
104
- }, [showTime]);
105
97
  return /* @__PURE__ */ import_react.default.createElement(
106
98
  RangePicker,
107
99
  {
108
100
  ...others,
109
101
  format,
110
- showTime: _showTime,
102
+ showTime,
111
103
  presets: presets || rangePresets,
112
104
  ref,
113
105
  value: dayjsVal,
@@ -1,4 +1,4 @@
1
- import React from "react";
2
- import "./index.less";
1
+ import React from 'react';
2
+ import './index.less';
3
3
  declare const _default: React.NamedExoticComponent<any>;
4
4
  export default _default;
@@ -52,13 +52,11 @@ var GridViewTable = ({
52
52
  setTableSetting,
53
53
  onDataSourceChange
54
54
  }) => {
55
- var _a, _b, _c, _d, _e, _f;
56
- const responsive = (0, import_hooks.useResponsive)();
55
+ var _a, _b;
57
56
  const { state, dispatch } = (0, import_hooks.useSharedState)(import_model.Context);
58
57
  const form = import_antd.Form.useFormInstance();
59
58
  const column_setting = import_antd.Form.useWatch("column_setting", { form, preserve: true }) || [];
60
59
  const tableWrapRef = (0, import_react.useRef)(null);
61
- const { height } = (0, import_ahooks.useSize)(tableWrapRef) || {};
62
60
  const { dataSource: defaultDataSource, originDataSource } = state;
63
61
  const handleSave = (0, import_ahooks.useMemoizedFn)((row) => {
64
62
  const newData = [...defaultDataSource];
@@ -96,7 +94,8 @@ var GridViewTable = ({
96
94
  form,
97
95
  localPagination: !!((_b = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _b.localPagination),
98
96
  rowKey: tableProps.rowKey,
99
- filter
97
+ filter,
98
+ currentView: "table"
100
99
  });
101
100
  (0, import_react.useEffect)(() => {
102
101
  dispatch({
@@ -110,25 +109,6 @@ var GridViewTable = ({
110
109
  const components = (0, import_useGenTableComponents.default)({
111
110
  form
112
111
  });
113
- const isShowPagination = (0, import_react.useMemo)(() => {
114
- var _a2, _b2, _c2, _d2;
115
- let total = ((_a2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a2.total) || (dataSource == null ? void 0 : dataSource.length) || 0;
116
- if ((_b2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _b2.localPagination) {
117
- total = (dataSource == null ? void 0 : dataSource.length) || 0;
118
- }
119
- return total > (((_d2 = (_c2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c2.pageSizeOptions) == null ? void 0 : _d2[0]) || 10);
120
- }, [
121
- (_c = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c.localPagination,
122
- (_d = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _d.total,
123
- dataSource.length,
124
- (_f = (_e = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _e.pageSizeOptions) == null ? void 0 : _f[0]
125
- ]);
126
- const scroll = (0, import_useGenScroll.default)({
127
- wrapHeight: height || 500,
128
- scroll: tableProps.scroll,
129
- columns,
130
- isShowPagination
131
- });
132
112
  const showTotal = (0, import_react.useCallback)(
133
113
  (total, range, pageSize) => {
134
114
  let start = range[0] - 1;
@@ -149,26 +129,73 @@ var GridViewTable = ({
149
129
  ...tableProps.pagination,
150
130
  showTotal
151
131
  };
152
- }, [responsive, tableProps.pagination]);
132
+ }, [tableProps.pagination]);
153
133
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-table-wrap", ref: tableWrapRef }, /* @__PURE__ */ import_react.default.createElement(
154
- import_SortRow.default,
134
+ AutoSizerContent,
155
135
  {
156
- rowKey: tableProps.rowKey,
157
- onSortChange: tableProps.onSortChange
158
- },
159
- /* @__PURE__ */ import_react.default.createElement(
136
+ tableWrapRef,
137
+ dataSource,
138
+ tableProps,
139
+ columns,
140
+ paginationConfig: _paginationConfig,
141
+ components
142
+ }
143
+ ));
144
+ };
145
+ var AutoSizerContent = (props) => {
146
+ var _a, _b, _c, _d;
147
+ const {
148
+ tableProps,
149
+ dataSource,
150
+ paginationConfig: paginationConfig2,
151
+ columns,
152
+ components,
153
+ tableWrapRef
154
+ } = props;
155
+ const { height } = (0, import_ahooks.useSize)(tableWrapRef) || {};
156
+ const debouncedHeight = (0, import_ahooks.useDebounce)(height, { wait: 500 });
157
+ const isShowPagination = (0, import_react.useMemo)(() => {
158
+ var _a2, _b2, _c2, _d2, _e, _f;
159
+ let total = ((_a2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a2.total) || (dataSource == null ? void 0 : dataSource.length) || 0;
160
+ if ((_b2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _b2.localPagination) {
161
+ total = (dataSource == null ? void 0 : dataSource.length) || 0;
162
+ }
163
+ return total > (((_c2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c2.pageSize) || ((_e = (_d2 = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _d2.pageSizeOptions) == null ? void 0 : _e[0]) || 10) || ((_f = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _f.showPagination) && total > 10;
164
+ }, [
165
+ (_a = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a.localPagination,
166
+ (_b = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _b.total,
167
+ dataSource.length,
168
+ (_d = (_c = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _c.pageSizeOptions) == null ? void 0 : _d[0]
169
+ ]);
170
+ const scroll = (0, import_useGenScroll.default)({
171
+ wrapHeight: debouncedHeight || 500,
172
+ scroll: tableProps.scroll,
173
+ columns,
174
+ isShowPagination
175
+ });
176
+ const debouncedScroll = (0, import_ahooks.useDebounce)(scroll, { wait: 200 });
177
+ const basicTable = (0, import_react.useMemo)(() => {
178
+ return /* @__PURE__ */ import_react.default.createElement(
160
179
  import_BasicTable.default,
161
180
  {
162
- key: scroll == null ? void 0 : scroll.y,
181
+ key: debouncedScroll,
163
182
  dataSource,
164
183
  columns,
165
184
  className: "grid-view-table",
166
185
  components,
167
186
  ...tableProps,
168
- scroll,
169
- pagination: _paginationConfig
187
+ scroll: debouncedScroll,
188
+ pagination: paginationConfig2
170
189
  }
171
- )
172
- ));
190
+ );
191
+ }, [
192
+ debouncedScroll,
193
+ dataSource,
194
+ columns,
195
+ components,
196
+ paginationConfig2,
197
+ tableProps
198
+ ]);
199
+ return /* @__PURE__ */ import_react.default.createElement(import_SortRow.default, { rowKey: tableProps.rowKey, onSortChange: tableProps.onSortChange }, basicTable);
173
200
  };
174
201
  var Table_default = (0, import_react.memo)(GridViewTable);
@@ -29,4 +29,7 @@
29
29
 
30
30
  .materials-grid-table-wrap {
31
31
  flex: 1;
32
+ // 使用overflow hidden 计算 materials-grid-table-wrap高度时不会动态变更
33
+ overflow: hidden;
34
+ padding-bottom: 24px;
32
35
  }
@@ -81,7 +81,10 @@ export declare const setTableSettingToLocalStorage: ({ tableId, tableSettingObj,
81
81
  }>;
82
82
  currentViewMode: ModeType;
83
83
  currentSettingHash: string;
84
- }) => void;
84
+ }) => {
85
+ key: string;
86
+ value: Record<string, any>;
87
+ } | undefined;
85
88
  export declare const clearTableSettingToLocalStorage: (tableId?: string) => void;
86
89
  /**
87
90
  * 从本地存储中获取表格设置, 全部配置
@@ -112,7 +115,16 @@ export declare const setFormValuesToLocalStorage: ({ tableId, allValues, keys, c
112
115
  keys?: string[] | undefined;
113
116
  currentViewMode: ModeType;
114
117
  currentSettingHash: string;
115
- }) => void;
118
+ }) => {
119
+ key: string;
120
+ value: Record<string, any>;
121
+ } | undefined;
122
+ /**
123
+ * 获取表格键值
124
+ * @param tableId 表格ID
125
+ * @returns 返回格式化后的表格键值
126
+ */
127
+ export declare const getTableKey: (tableId: string) => string;
116
128
  /**
117
129
  * 合并筛选设置
118
130
  * @param list 列表数据
@@ -36,6 +36,7 @@ __export(utils_exports, {
36
36
  getHash: () => getHash,
37
37
  getIdByRowKey: () => getIdByRowKey,
38
38
  getSettingKeyArrByMode: () => getSettingKeyArrByMode,
39
+ getTableKey: () => getTableKey,
39
40
  getTableSettingByCurrentViewMode: () => getTableSettingByCurrentViewMode,
40
41
  getTableSettingFromLocalStorage: () => getTableSettingFromLocalStorage,
41
42
  groupDataSource: () => groupDataSource,
@@ -270,6 +271,10 @@ var setTableSettingToLocalStorage = ({
270
271
  }
271
272
  };
272
273
  localStorage.setItem(getTableKey(tableId), JSON.stringify(newData));
274
+ return {
275
+ key: getTableKey(tableId),
276
+ value: newData
277
+ };
273
278
  };
274
279
  var clearTableSettingToLocalStorage = (tableId) => {
275
280
  if (!tableId)
@@ -306,7 +311,7 @@ var setFormValuesToLocalStorage = ({
306
311
  keys == null ? void 0 : keys.forEach((key) => {
307
312
  obj[key] = allValues == null ? void 0 : allValues[key];
308
313
  });
309
- setTableSettingToLocalStorage({
314
+ return setTableSettingToLocalStorage({
310
315
  tableId,
311
316
  tableSettingObj: obj,
312
317
  currentViewMode,
@@ -460,6 +465,7 @@ var stringify = (obj) => {
460
465
  getHash,
461
466
  getIdByRowKey,
462
467
  getSettingKeyArrByMode,
468
+ getTableKey,
463
469
  getTableSettingByCurrentViewMode,
464
470
  getTableSettingFromLocalStorage,
465
471
  groupDataSource,
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { GridViewProps } from "../types";
1
+ import React from 'react';
2
+ import { GridViewProps } from '../types';
3
3
  declare const View: (props: GridViewProps & {
4
4
  setTableSetting: (values: Record<string, any>) => void;
5
5
  }) => React.JSX.Element;
@@ -36,6 +36,8 @@ var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_Table = __toESM(require("../Table"));
38
38
  var import_Gallery = __toESM(require("../Gallery"));
39
+ var import_utils = require("../Table/utils");
40
+ var import_ahooks = require("ahooks");
39
41
  var View = (props) => {
40
42
  const {
41
43
  dataSource,
@@ -62,24 +64,31 @@ var View = (props) => {
62
64
  form,
63
65
  preserve: true
64
66
  });
65
- return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, viewMode === "grid" && /* @__PURE__ */ import_react.default.createElement(
66
- import_Table.default,
67
- {
68
- tableProps: other,
69
- filter,
70
- setTableSetting,
71
- onDataSourceChange
72
- }
73
- ), viewMode === "gallery" && /* @__PURE__ */ import_react.default.createElement(
74
- import_Gallery.default,
75
- {
76
- loading: other == null ? void 0 : other.loading,
77
- gallery,
78
- pagination: other.pagination,
79
- filter,
80
- rowKey: other.rowKey,
81
- onDataSourceChange
82
- }
83
- ));
67
+ const debouncedFilter = (0, import_ahooks.useDebounce)(filter, { wait: 200 });
68
+ const memoOnDataSourceChange = (0, import_ahooks.useMemoizedFn)(
69
+ (v) => onDataSourceChange == null ? void 0 : onDataSourceChange(v)
70
+ );
71
+ const memoContent = (0, import_react.useMemo)(() => {
72
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, viewMode === "grid" && /* @__PURE__ */ import_react.default.createElement(
73
+ import_Table.default,
74
+ {
75
+ tableProps: other,
76
+ filter,
77
+ setTableSetting,
78
+ onDataSourceChange: memoOnDataSourceChange
79
+ }
80
+ ), viewMode === "gallery" && /* @__PURE__ */ import_react.default.createElement(
81
+ import_Gallery.default,
82
+ {
83
+ loading: other == null ? void 0 : other.loading,
84
+ gallery,
85
+ pagination: other.pagination,
86
+ filter,
87
+ rowKey: other.rowKey,
88
+ onDataSourceChange: memoOnDataSourceChange
89
+ }
90
+ ));
91
+ }, [viewMode, (0, import_utils.stringify)(other), debouncedFilter, memoOnDataSourceChange, gallery]);
92
+ return memoContent;
84
93
  };
85
94
  var View_default = View;
@@ -31,7 +31,7 @@ var useGenScroll = (params) => {
31
31
  x: (propsScroll == null ? void 0 : propsScroll.x) || columns.reduce((p, c) => {
32
32
  return p + (c.width || 250);
33
33
  }, 0) || 2e3,
34
- y: (propsScroll == null ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - (isShowPagination ? 50 + 24 : 0), 100),
34
+ y: (propsScroll == null ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - (isShowPagination ? 50 + 24 : 24), 100),
35
35
  scrollToFirstRowOnChange: propsScroll == null ? void 0 : propsScroll.scrollToFirstRowOnChange
36
36
  };
37
37
  }
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/components/table/hooks/useTableSetting.ts
@@ -24,7 +34,10 @@ __export(useTableSetting_exports, {
24
34
  module.exports = __toCommonJS(useTableSetting_exports);
25
35
  var import_react = require("react");
26
36
  var import_utils = require("../Table/utils");
37
+ var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
38
+ var import_ahooks = require("ahooks");
27
39
  var useTableSetting = (params) => {
40
+ var _a;
28
41
  const {
29
42
  tableId,
30
43
  filter,
@@ -38,27 +51,29 @@ var useTableSetting = (params) => {
38
51
  currentSettingHash,
39
52
  exportImport
40
53
  } = params;
54
+ const context = (0, import_useEngineContext.default)();
55
+ const { isTerminal, interaction } = ((_a = context.appHelper) == null ? void 0 : _a.utils) || {};
41
56
  const columnsMap = (0, import_react.useMemo)(() => {
42
57
  return new Map(propsColumns.map((item) => [item.key, item]));
43
58
  }, [propsColumns]);
44
59
  const columns = (0, import_react.useMemo)(() => {
45
- var _a;
60
+ var _a2;
46
61
  if (currentViewMode === "grid") {
47
62
  return propsColumns;
48
63
  } else if (currentViewMode === "gallery") {
49
- return (((_a = gallery == null ? void 0 : gallery.content) == null ? void 0 : _a.fields) || []).filter((item) => item.show).map((item) => columnsMap.get(item.columnKey)).filter(Boolean);
64
+ return (((_a2 = gallery == null ? void 0 : gallery.content) == null ? void 0 : _a2.fields) || []).filter((item) => item.show).map((item) => columnsMap.get(item.columnKey)).filter(Boolean);
50
65
  }
51
66
  return propsColumns;
52
67
  }, [propsColumns, currentViewMode, gallery, columnsMap]);
53
68
  const { list, quickFilterMaxLength, sortButtonShow } = filter || {};
54
69
  const defaultGalleryCoverSetting = (0, import_react.useMemo)(() => {
55
- var _a, _b;
70
+ var _a2, _b;
56
71
  return {
57
- coverObjectFit: (_a = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a.objectFit,
72
+ coverObjectFit: (_a2 = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a2.objectFit,
58
73
  coverField: (_b = columns.find(
59
74
  (column) => {
60
- var _a2, _b2;
61
- return column.key === ((_b2 = (_a2 = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a2.fields) == null ? void 0 : _b2[0]);
75
+ var _a3, _b2;
76
+ return column.key === ((_b2 = (_a3 = gallery == null ? void 0 : gallery.cover) == null ? void 0 : _a3.fields) == null ? void 0 : _b2[0]);
62
77
  }
63
78
  )) == null ? void 0 : _b.dataIndex,
64
79
  compactMode: "default",
@@ -102,7 +117,7 @@ var useTableSetting = (params) => {
102
117
  );
103
118
  const mergedSetting = { ...allSetting, ...currentViewModeSetting };
104
119
  localStorageSettingKeyArr.forEach((item) => {
105
- var _a, _b, _c, _d;
120
+ var _a2, _b, _c, _d;
106
121
  if (item === "view_mode") {
107
122
  setting[item] = view.multiple ? (mergedSetting == null ? void 0 : mergedSetting[item]) || view.defaultViewMode : view.defaultViewMode;
108
123
  } else if (item === "filter_setting") {
@@ -123,7 +138,7 @@ var useTableSetting = (params) => {
123
138
  setting[item] = {
124
139
  ...mergedSetting == null ? void 0 : mergedSetting[item],
125
140
  // 本地没有默认封面效果时取配置中的
126
- coverObjectFit: ((_a = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _a.coverObjectFit) || defaultGalleryCoverSetting.coverObjectFit,
141
+ coverObjectFit: ((_a2 = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _a2.coverObjectFit) || defaultGalleryCoverSetting.coverObjectFit,
127
142
  coverField: ((_b = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _b.coverField) || defaultGalleryCoverSetting.coverField,
128
143
  compactMode: ((_c = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _c.compactMode) || defaultGalleryCoverSetting.compactMode,
129
144
  isShowLabel: ((_d = mergedSetting == null ? void 0 : mergedSetting[item]) == null ? void 0 : _d.isShowLabel) ?? defaultGalleryCoverSetting.isShowLabel
@@ -185,15 +200,15 @@ var useTableSetting = (params) => {
185
200
  quickFilterMaxLength,
186
201
  sortButtonShow
187
202
  ]);
188
- const setTableSetting = (values) => {
189
- (0, import_utils.setFormValuesToLocalStorage)({
203
+ const setTableSetting = (0, import_ahooks.useMemoizedFn)((values) => {
204
+ const result = (0, import_utils.setFormValuesToLocalStorage)({
190
205
  tableId,
191
206
  allValues: values,
192
207
  keys: localStorageSettingKeyArr,
193
208
  currentViewMode,
194
209
  currentSettingHash
195
210
  });
196
- };
211
+ });
197
212
  const tableSetting = (0, import_react.useMemo)(() => {
198
213
  return {
199
214
  ...tableLocalSetting,
@@ -6,6 +6,7 @@ declare type UseTransDataSourceParams = {
6
6
  dataSource: Record<string, any>[];
7
7
  rowKey: string | ((params: any) => string);
8
8
  filter: FilterType;
9
+ currentView: 'gallery' | 'table';
9
10
  };
10
11
  declare const useTransDataSource: (params: UseTransDataSourceParams) => Record<string, any>[];
11
12
  export default useTransDataSource;
@@ -33,7 +33,8 @@ var useTransDataSource = (params) => {
33
33
  localPagination,
34
34
  dataSource: pDataSource,
35
35
  rowKey,
36
- filter
36
+ filter,
37
+ currentView
37
38
  } = params;
38
39
  const sort = import_antd.Form.useWatch("order_by", { form, preserve: true });
39
40
  const group = import_antd.Form.useWatch("group_by", { form, preserve: true });
@@ -60,7 +61,7 @@ var useTransDataSource = (params) => {
60
61
  return [];
61
62
  }
62
63
  return filter == null ? void 0 : filter.list.filter((item) => item.localFilter);
63
- }, [filter]);
64
+ }, [(0, import_utils2.stringify)(filter)]);
64
65
  const dataSource = (0, import_react.useMemo)(() => {
65
66
  if (!localPagination) {
66
67
  return pDataSource;
@@ -72,7 +73,7 @@ var useTransDataSource = (params) => {
72
73
  if (sortObj) {
73
74
  newDataSource = (0, import_utils2.sortDataSource)(newDataSource, sortObj);
74
75
  }
75
- if (groupDetail) {
76
+ if (groupDetail && currentView === "table") {
76
77
  newDataSource = (0, import_utils2.groupDataSource)(newDataSource, groupDetail, rowKey);
77
78
  }
78
79
  return newDataSource;
@@ -82,9 +83,9 @@ var useTransDataSource = (params) => {
82
83
  sortObj,
83
84
  groupDetail,
84
85
  filterLocalArr,
85
- filters
86
+ filters,
87
+ currentView
86
88
  ]);
87
- console.log("dataSourcedataSource", dataSource);
88
89
  return dataSource;
89
90
  };
90
91
  var useTransDataSource_default = useTransDataSource;