@pisell/materials 1.0.403 → 1.0.405

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.
@@ -139,7 +139,10 @@ var BasicTable = function BasicTable(props) {
139
139
  defaultExpandAllRows: true
140
140
  }
141
141
  })), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) || pagination !== null && pagination !== void 0 && pagination.showPagination && total > 10 ? /*#__PURE__*/React.createElement(Form.Item, {
142
- name: "pagination"
142
+ name: "pagination",
143
+ style: {
144
+ margin: 0
145
+ }
143
146
  }, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
144
147
  showTotal: _showTotal,
145
148
  total: total
@@ -150,7 +150,7 @@ var AutoSizerContent = function AutoSizerContent(props) {
150
150
  isShowPagination: isShowPagination
151
151
  });
152
152
  var debouncedScroll = useDebounce(scroll, {
153
- wait: 500
153
+ wait: 200
154
154
  });
155
155
  var basicTable = useMemo(function () {
156
156
  return /*#__PURE__*/React.createElement(BasicTable, _extends({
@@ -6,6 +6,7 @@ import { Form } from 'antd';
6
6
  import GridViewTable from "../Table";
7
7
  import Gallery from "../Gallery";
8
8
  import { stringify } from "../Table/utils";
9
+ import { useDebounce, useMemoizedFn } from 'ahooks';
9
10
  var View = function View(props) {
10
11
  var dataSource = props.dataSource,
11
12
  columns = props.columns,
@@ -30,21 +31,27 @@ var View = function View(props) {
30
31
  form: form,
31
32
  preserve: true
32
33
  });
34
+ var debouncedFilter = useDebounce(filter, {
35
+ wait: 200
36
+ });
37
+ var memoOnDataSourceChange = useMemoizedFn(function (v) {
38
+ return onDataSourceChange === null || onDataSourceChange === void 0 ? void 0 : onDataSourceChange(v);
39
+ });
33
40
  var memoContent = useMemo(function () {
34
41
  return /*#__PURE__*/React.createElement(React.Fragment, null, viewMode === 'grid' && /*#__PURE__*/React.createElement(GridViewTable, {
35
42
  tableProps: other,
36
43
  filter: filter,
37
44
  setTableSetting: setTableSetting,
38
- onDataSourceChange: onDataSourceChange
45
+ onDataSourceChange: memoOnDataSourceChange
39
46
  }), viewMode === 'gallery' && /*#__PURE__*/React.createElement(Gallery, {
40
47
  loading: other === null || other === void 0 ? void 0 : other.loading,
41
48
  gallery: gallery,
42
49
  pagination: other.pagination,
43
50
  filter: filter,
44
51
  rowKey: other.rowKey,
45
- onDataSourceChange: onDataSourceChange
52
+ onDataSourceChange: memoOnDataSourceChange
46
53
  }));
47
- }, [viewMode, stringify(other), filter, onDataSourceChange, gallery]);
54
+ }, [viewMode, stringify(other), debouncedFilter, memoOnDataSourceChange, gallery]);
48
55
  return memoContent;
49
56
  };
50
57
  export default View;
@@ -10,7 +10,7 @@ var useGenScroll = function useGenScroll(params) {
10
10
  x: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.x) || columns.reduce(function (p, c) {
11
11
  return p + (c.width || 250);
12
12
  }, 0) || 2000,
13
- y: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - (isShowPagination ? 50 + 24 : 0), 100),
13
+ y: (propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.y) || Math.max(wrapHeight - 48 - (isShowPagination ? 50 + 24 : 24), 100),
14
14
  scrollToFirstRowOnChange: propsScroll === null || propsScroll === void 0 ? void 0 : propsScroll.scrollToFirstRowOnChange
15
15
  };
16
16
  }
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useMemo } from "react";
8
8
  import { isArr } from "@pisell/utils";
9
9
  import { Form } from "antd";
10
- import { filterDataSource, groupDataSource, sortDataSource } from "../Table/utils";
10
+ import { filterDataSource, groupDataSource, sortDataSource, stringify } from "../Table/utils";
11
11
  var defaultObj = {};
12
12
  var useTransDataSource = function useTransDataSource(params) {
13
13
  var form = params.form,
@@ -69,7 +69,7 @@ var useTransDataSource = function useTransDataSource(params) {
69
69
  return filter === null || filter === void 0 ? void 0 : filter.list.filter(function (item) {
70
70
  return item.localFilter;
71
71
  });
72
- }, [filter]);
72
+ }, [stringify(filter)]);
73
73
  var dataSource = useMemo(function () {
74
74
  // 如果不是本地分页,则直接返回默认数据
75
75
  if (!localPagination) {
@@ -76,7 +76,7 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
76
76
  var _ref = useSize(wrapRef) || {},
77
77
  width = _ref.width;
78
78
  var debouncedWidth = useDebounce(width, {
79
- wait: 500
79
+ wait: 100
80
80
  });
81
81
  var utils = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
82
82
  var tableId = useMemo(function () {
@@ -134,7 +134,6 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
134
134
  }, [currentSettingHash, tableId]);
135
135
  useEffect(function () {
136
136
  if (debouncedWidth) {
137
- console.log('modal.dispatch', 'setTableWidth');
138
137
  modal.dispatch({
139
138
  type: 'setTableWidth',
140
139
  payload: debouncedWidth || {}
@@ -147,7 +147,7 @@ var BasicTable = (props) => {
147
147
  defaultExpandAllRows: true
148
148
  }
149
149
  }
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" }, /* @__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(
151
151
  import_Pagination.FormPagination,
152
152
  {
153
153
  ...pagination,
@@ -173,7 +173,7 @@ var AutoSizerContent = (props) => {
173
173
  columns,
174
174
  isShowPagination
175
175
  });
176
- const debouncedScroll = (0, import_ahooks.useDebounce)(scroll, { wait: 500 });
176
+ const debouncedScroll = (0, import_ahooks.useDebounce)(scroll, { wait: 200 });
177
177
  const basicTable = (0, import_react.useMemo)(() => {
178
178
  return /* @__PURE__ */ import_react.default.createElement(
179
179
  import_BasicTable.default,
@@ -37,6 +37,7 @@ var import_antd = require("antd");
37
37
  var import_Table = __toESM(require("../Table"));
38
38
  var import_Gallery = __toESM(require("../Gallery"));
39
39
  var import_utils = require("../Table/utils");
40
+ var import_ahooks = require("ahooks");
40
41
  var View = (props) => {
41
42
  const {
42
43
  dataSource,
@@ -63,6 +64,10 @@ var View = (props) => {
63
64
  form,
64
65
  preserve: true
65
66
  });
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
+ );
66
71
  const memoContent = (0, import_react.useMemo)(() => {
67
72
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, viewMode === "grid" && /* @__PURE__ */ import_react.default.createElement(
68
73
  import_Table.default,
@@ -70,7 +75,7 @@ var View = (props) => {
70
75
  tableProps: other,
71
76
  filter,
72
77
  setTableSetting,
73
- onDataSourceChange
78
+ onDataSourceChange: memoOnDataSourceChange
74
79
  }
75
80
  ), viewMode === "gallery" && /* @__PURE__ */ import_react.default.createElement(
76
81
  import_Gallery.default,
@@ -80,10 +85,10 @@ var View = (props) => {
80
85
  pagination: other.pagination,
81
86
  filter,
82
87
  rowKey: other.rowKey,
83
- onDataSourceChange
88
+ onDataSourceChange: memoOnDataSourceChange
84
89
  }
85
90
  ));
86
- }, [viewMode, (0, import_utils.stringify)(other), filter, onDataSourceChange, gallery]);
91
+ }, [viewMode, (0, import_utils.stringify)(other), debouncedFilter, memoOnDataSourceChange, gallery]);
87
92
  return memoContent;
88
93
  };
89
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
  }
@@ -61,7 +61,7 @@ var useTransDataSource = (params) => {
61
61
  return [];
62
62
  }
63
63
  return filter == null ? void 0 : filter.list.filter((item) => item.localFilter);
64
- }, [filter]);
64
+ }, [(0, import_utils2.stringify)(filter)]);
65
65
  const dataSource = (0, import_react.useMemo)(() => {
66
66
  if (!localPagination) {
67
67
  return pDataSource;
@@ -89,7 +89,7 @@ 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: 500 });
92
+ const debouncedWidth = (0, import_ahooks.useDebounce)(width, { wait: 100 });
93
93
  const utils = (_a = context == null ? void 0 : context.appHelper) == null ? void 0 : _a.utils;
94
94
  const tableId = (0, import_react.useMemo)(() => {
95
95
  if (props.__designMode === "design") {
@@ -145,7 +145,6 @@ var GridView = (0, import_model.Provider)(
145
145
  }, [currentSettingHash, tableId]);
146
146
  (0, import_react.useEffect)(() => {
147
147
  if (debouncedWidth) {
148
- console.log("modal.dispatch", "setTableWidth");
149
148
  modal.dispatch({
150
149
  type: "setTableWidth",
151
150
  payload: debouncedWidth || {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.403",
3
+ "version": "1.0.405",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -64,9 +64,9 @@
64
64
  "react-virtualized-auto-sizer": "^1.0.20",
65
65
  "crypto-js": "^4.2.0",
66
66
  "@zxing/library": "0.21.2",
67
- "@pisell/utils": "1.0.39",
67
+ "@pisell/utils": "1.0.40",
68
68
  "@pisell/icon": "0.0.10",
69
- "@pisell/date-picker": "1.0.106"
69
+ "@pisell/date-picker": "1.0.107"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "react": "^18.0.0",