@pisell/materials 2.2.21 → 2.2.23

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 (39) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +1 -1
  6. package/build/lowcode/preview.js +4 -4
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +15 -15
  11. package/es/components/table/Actions/index.js +1 -1
  12. package/es/components/table/Actions/index.less +4 -1
  13. package/es/components/table/BasicTable/index.js +5 -3
  14. package/es/components/table/Table/index.d.ts +2 -2
  15. package/es/components/table/Table/index.js +66 -41
  16. package/es/components/table/Table/index.less +3 -0
  17. package/es/components/table/Table/utils.d.ts +1 -1
  18. package/es/components/table/View/index.d.ts +2 -2
  19. package/es/components/table/View/index.js +27 -16
  20. package/es/components/table/hooks/useGenScroll.js +1 -1
  21. package/es/components/table/hooks/useTableSetting.js +3 -2
  22. package/es/components/table/hooks/useTransDataSource.js +2 -2
  23. package/es/components/table/index.js +7 -5
  24. package/es/components/table/index.less +9 -0
  25. package/lib/components/table/Actions/index.js +1 -1
  26. package/lib/components/table/Actions/index.less +4 -1
  27. package/lib/components/table/BasicTable/index.js +2 -3
  28. package/lib/components/table/Table/index.d.ts +2 -2
  29. package/lib/components/table/Table/index.js +59 -33
  30. package/lib/components/table/Table/index.less +3 -0
  31. package/lib/components/table/Table/utils.d.ts +1 -1
  32. package/lib/components/table/View/index.d.ts +2 -2
  33. package/lib/components/table/View/index.js +28 -19
  34. package/lib/components/table/hooks/useGenScroll.js +1 -1
  35. package/lib/components/table/hooks/useTableSetting.js +3 -2
  36. package/lib/components/table/hooks/useTransDataSource.js +1 -1
  37. package/lib/components/table/index.js +4 -4
  38. package/lib/components/table/index.less +9 -0
  39. package/package.json +3 -3
@@ -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
  }
@@ -24,6 +24,7 @@ __export(useTableSetting_exports, {
24
24
  module.exports = __toCommonJS(useTableSetting_exports);
25
25
  var import_react = require("react");
26
26
  var import_utils = require("../Table/utils");
27
+ var import_ahooks = require("ahooks");
27
28
  var useTableSetting = (params) => {
28
29
  const {
29
30
  tableId,
@@ -185,7 +186,7 @@ var useTableSetting = (params) => {
185
186
  quickFilterMaxLength,
186
187
  sortButtonShow
187
188
  ]);
188
- const setTableSetting = (values) => {
189
+ const setTableSetting = (0, import_ahooks.useMemoizedFn)((values) => {
189
190
  (0, import_utils.setFormValuesToLocalStorage)({
190
191
  tableId,
191
192
  allValues: values,
@@ -193,7 +194,7 @@ var useTableSetting = (params) => {
193
194
  currentViewMode,
194
195
  currentSettingHash
195
196
  });
196
- };
197
+ });
197
198
  const tableSetting = (0, import_react.useMemo)(() => {
198
199
  return {
199
200
  ...tableLocalSetting,
@@ -60,7 +60,7 @@ var useTransDataSource = (params) => {
60
60
  return [];
61
61
  }
62
62
  return filter == null ? void 0 : filter.list.filter((item) => item.localFilter);
63
- }, [filter]);
63
+ }, [(0, import_utils2.stringify)(filter)]);
64
64
  const dataSource = (0, import_react.useMemo)(() => {
65
65
  if (!localPagination) {
66
66
  return pDataSource;
@@ -89,9 +89,9 @@ var GridView = (0, import_model.Provider)(
89
89
  const filterDefaultRef = (0, import_react.useRef)({});
90
90
  const initialValuesRef = (0, import_react.useRef)({});
91
91
  const { width } = (0, import_ahooks.useSize)(wrapRef) || {};
92
+ const debouncedWidth = (0, import_ahooks.useDebounce)(width, { wait: 100 });
92
93
  const utils = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils;
93
94
  const tableId = (0, import_react.useMemo)(() => {
94
- console.log(props, "wh");
95
95
  if (props.__designMode === "design") {
96
96
  return "designMode-mock-table-id";
97
97
  }
@@ -144,13 +144,13 @@ var GridView = (0, import_model.Provider)(
144
144
  }
145
145
  }, [currentSettingHash, tableId]);
146
146
  (0, import_react.useEffect)(() => {
147
- if (width) {
147
+ if (debouncedWidth) {
148
148
  modal.dispatch({
149
149
  type: "setTableWidth",
150
- payload: width || {}
150
+ payload: debouncedWidth || {}
151
151
  });
152
152
  }
153
- }, [width]);
153
+ }, [debouncedWidth]);
154
154
  const { setTableSetting, tableSetting } = (0, import_useTableSetting.default)({
155
155
  tableId,
156
156
  filter,
@@ -9,6 +9,15 @@
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
 
12
+ .pisell-lowcode-table-body {
13
+ overscroll-behavior: none;
14
+ }
15
+ .pisell-lowcode-table-placeholder {
16
+ .cell-provider {
17
+ display: block;
18
+ }
19
+ }
20
+
12
21
  .pisell-lowcode-table-thead {
13
22
  .pisell-lowcode-table-cell {
14
23
  padding: 0 14px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "2.2.21",
3
+ "version": "2.2.23",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -64,8 +64,8 @@
64
64
  "crypto-js": "^4.2.0",
65
65
  "@zxing/library": "0.21.2",
66
66
  "@pisell/utils": "2.0.1",
67
- "@pisell/date-picker": "1.0.100",
68
- "@pisell/icon": "0.0.11"
67
+ "@pisell/icon": "0.0.11",
68
+ "@pisell/date-picker": "1.0.100"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": "^18.0.0",