@pisell/materials 2.2.20 → 2.2.22

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 (40) 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 +12 -12
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +15 -15
  11. package/es/components/page/index.js +4 -2
  12. package/es/components/table/BasicTable/index.js +5 -3
  13. package/es/components/table/Table/fields/rangePicker/Edit/index.js +13 -11
  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/page/index.js +3 -2
  26. package/lib/components/table/BasicTable/index.js +2 -3
  27. package/lib/components/table/Table/fields/rangePicker/Edit/index.js +1 -9
  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/lowcode/page/meta.ts +1 -0
  40. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["children", "style", "locale"];
2
+ var _excluded = ["children", "style", "className", "locale"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -47,6 +47,7 @@ var Page = function Page(props) {
47
47
  var _context$appHelper, _context$engine, _context$engine$props, _localeDateMap;
48
48
  var children = props.children,
49
49
  style = props.style,
50
+ className = props.className,
50
51
  propsLocale = props.locale,
51
52
  others = _objectWithoutProperties(props, _excluded);
52
53
  var context = useEngineContext();
@@ -252,7 +253,8 @@ var Page = function Page(props) {
252
253
  }, /*#__PURE__*/React.createElement("div", {
253
254
  style: _objectSpread(_objectSpread({}, style), {}, {
254
255
  '--theme-color': themeColor || '#7F56D9'
255
- })
256
+ }),
257
+ className: className
256
258
  }, children)))))));
257
259
  };
258
260
  export default Page;
@@ -84,7 +84,6 @@ var BasicTable = function BasicTable(props) {
84
84
  total: _total
85
85
  };
86
86
  }, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
87
- console.log(pagination, 'wh8888');
88
87
 
89
88
  // 总数
90
89
  var total = useMemo(function () {
@@ -110,7 +109,7 @@ var BasicTable = function BasicTable(props) {
110
109
  type: 'setCurrentDataSource',
111
110
  payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
112
111
  });
113
- }, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
112
+ }, [JSON.stringify(_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list)]);
114
113
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
115
114
  key: defaultExpandedRowKeys.join('-')
116
115
  }, other, {
@@ -140,7 +139,10 @@ var BasicTable = function BasicTable(props) {
140
139
  defaultExpandAllRows: true
141
140
  }
142
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, {
143
- name: "pagination"
142
+ name: "pagination",
143
+ style: {
144
+ margin: 0
145
+ }
144
146
  }, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
145
147
  showTotal: _showTotal,
146
148
  total: total
@@ -1,3 +1,4 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1
2
  var _excluded = ["value", "onChange", "onPressEnter", "onBlur", "style", "bordered", "presets", "showTime", "format"];
2
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -5,10 +6,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
6
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
7
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
- import { isArr, isBoolean, isString } from "@pisell/utils";
11
+ import { isArr, isString } from "@pisell/utils";
12
12
  import dayjs from "dayjs";
13
13
  import React, { forwardRef, useMemo } from "react";
14
14
  import DatePicker from "../../../../../date-picker";
@@ -64,17 +64,19 @@ var Edit = function Edit(props, ref) {
64
64
  label: getText("table-action-range-picker-presets-last-90-day"),
65
65
  value: [dayjs().add(-90, "d").startOf("day"), dayjs().endOf("day")]
66
66
  }];
67
- var _showTime = useMemo(function () {
68
- if (isBoolean(showTime)) {
69
- return showTime;
70
- } else if (_typeof(showTime) === "object") {
71
- return showTime;
72
- }
73
- return true;
74
- }, [showTime]);
67
+
68
+ // const _showTime = useMemo(() => {
69
+ // if (isBoolean(showTime)) {
70
+ // return showTime;
71
+ // } else if (typeof showTime === "object") {
72
+ // return showTime;
73
+ // }
74
+ // return true;
75
+ // }, [showTime]);
76
+
75
77
  return /*#__PURE__*/React.createElement(RangePicker, _extends({}, others, {
76
78
  format: format,
77
- showTime: _showTime,
79
+ showTime: showTime,
78
80
  presets: presets || rangePresets,
79
81
  ref: ref,
80
82
  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;
@@ -11,10 +11,10 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
11
11
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
12
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
13
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
- import React, { memo, useCallback, useEffect, useMemo, useRef } from "react";
15
- import { Form } from "antd";
14
+ import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
15
+ import { Form } from 'antd';
16
16
  // import { Access } from '@umijs/max';
17
- import { useMemoizedFn, useSize } from "ahooks";
17
+ import { useDebounce, useMemoizedFn, useSize } from 'ahooks';
18
18
  import { Context } from "../model";
19
19
  // import AddFieldModal from "./AddFieldModal";
20
20
  import BasicTable from "../BasicTable";
@@ -25,26 +25,23 @@ import useTransDataSource from "../hooks/useTransDataSource";
25
25
  import useTransColumns from "../hooks/useTransColumns";
26
26
  import useGenTableComponents from "../hooks/useGenTableComponents";
27
27
  import useGenScroll from "../hooks/useGenScroll";
28
- import { useSharedState, useResponsive } from "../../../hooks";
28
+ import { useSharedState } from "../../../hooks";
29
29
  import "./index.less";
30
30
  var GridViewTable = function GridViewTable(_ref) {
31
- var _tableProps$paginatio, _tableProps$paginatio2, _tableProps$paginatio7, _tableProps$paginatio8, _tableProps$paginatio9, _tableProps$paginatio10;
31
+ var _tableProps$paginatio, _tableProps$paginatio2;
32
32
  var tableProps = _ref.tableProps,
33
33
  filter = _ref.filter,
34
34
  setTableSetting = _ref.setTableSetting,
35
35
  onDataSourceChange = _ref.onDataSourceChange;
36
- var responsive = useResponsive();
37
36
  var _useSharedState = useSharedState(Context),
38
37
  state = _useSharedState.state,
39
38
  dispatch = _useSharedState.dispatch;
40
39
  var form = Form.useFormInstance();
41
- var column_setting = Form.useWatch("column_setting", {
40
+ var column_setting = Form.useWatch('column_setting', {
42
41
  form: form,
43
42
  preserve: true
44
43
  }) || [];
45
44
  var tableWrapRef = useRef(null);
46
- var _ref2 = useSize(tableWrapRef) || {},
47
- height = _ref2.height;
48
45
  var defaultDataSource = state.dataSource,
49
46
  originDataSource = state.originDataSource;
50
47
  var handleSave = useMemoizedFn(function (row) {
@@ -55,18 +52,18 @@ var GridViewTable = function GridViewTable(_ref) {
55
52
  var item = newData[index];
56
53
  newData.splice(index, 1, _objectSpread(_objectSpread({}, item), row));
57
54
  dispatch({
58
- type: "setDataSource",
55
+ type: 'setDataSource',
59
56
  payload: newData
60
57
  });
61
58
  });
62
59
  var handleResize = function handleResize(index) {
63
- return function (e, _ref3) {
64
- var size = _ref3.size;
60
+ return function (e, _ref2) {
61
+ var size = _ref2.size;
65
62
  var nextColumns = _toConsumableArray(columns);
66
63
  nextColumns[index] = _objectSpread(_objectSpread({}, nextColumns[index]), {}, {
67
64
  width: size.width
68
65
  });
69
- form.setFieldValue("column_setting", nextColumns);
66
+ form.setFieldValue('column_setting', nextColumns);
70
67
  setTableSetting(form.getFieldsValue());
71
68
  };
72
69
  };
@@ -89,7 +86,7 @@ var GridViewTable = function GridViewTable(_ref) {
89
86
  });
90
87
  useEffect(function () {
91
88
  dispatch({
92
- type: "setOriginResultDataSource",
89
+ type: 'setOriginResultDataSource',
93
90
  payload: dataSource || []
94
91
  });
95
92
  }, [dataSource]);
@@ -99,24 +96,10 @@ var GridViewTable = function GridViewTable(_ref) {
99
96
  var components = useGenTableComponents({
100
97
  form: form
101
98
  });
102
- var isShowPagination = useMemo(function () {
103
- var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6;
104
- var total = (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio3 = tableProps.pagination) === null || _tableProps$paginatio3 === void 0 ? void 0 : _tableProps$paginatio3.total) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
105
- if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
106
- total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
107
- }
108
- return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : (_tableProps$paginatio6 = _tableProps$paginatio5.pageSizeOptions) === null || _tableProps$paginatio6 === void 0 ? void 0 : _tableProps$paginatio6[0]) || 10);
109
- }, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio7 = tableProps.pagination) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : (_tableProps$paginatio10 = _tableProps$paginatio9.pageSizeOptions) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10[0]]);
110
- var scroll = useGenScroll({
111
- wrapHeight: height || 500,
112
- scroll: tableProps.scroll,
113
- columns: columns,
114
- isShowPagination: isShowPagination
115
- });
116
99
  var showTotal = useCallback(function (total, range, pageSize) {
117
100
  var start = range[0] - 1;
118
101
  var _current = start / pageSize + 1;
119
- return getText("table-pagination-total")(_current, Math.ceil(total / pageSize));
102
+ return getText('table-pagination-total')(_current, Math.ceil(total / pageSize));
120
103
  }, []);
121
104
  var _paginationConfig = useMemo(function () {
122
105
  if (tableProps.pagination === false) {
@@ -125,22 +108,64 @@ var GridViewTable = function GridViewTable(_ref) {
125
108
  return _objectSpread(_objectSpread(_objectSpread({}, paginationConfig), tableProps.pagination), {}, {
126
109
  showTotal: showTotal
127
110
  });
128
- }, [responsive, tableProps.pagination]);
111
+ }, [tableProps.pagination]);
129
112
  return /*#__PURE__*/React.createElement("div", {
130
- className: "materials-grid-table-wrap",
113
+ className: 'materials-grid-table-wrap',
131
114
  ref: tableWrapRef
132
- }, /*#__PURE__*/React.createElement(SortRow, {
133
- rowKey: tableProps.rowKey,
134
- onSortChange: tableProps.onSortChange
135
- }, /*#__PURE__*/React.createElement(BasicTable, _extends({
136
- key: scroll === null || scroll === void 0 ? void 0 : scroll.y,
115
+ }, /*#__PURE__*/React.createElement(AutoSizerContent, {
116
+ tableWrapRef: tableWrapRef,
137
117
  dataSource: dataSource,
118
+ tableProps: tableProps,
138
119
  columns: columns,
139
- className: "grid-view-table",
120
+ paginationConfig: _paginationConfig,
140
121
  components: components
141
- }, tableProps, {
142
- scroll: scroll,
143
- pagination: _paginationConfig
144
- }))));
122
+ }));
123
+ };
124
+ var AutoSizerContent = function AutoSizerContent(props) {
125
+ var _tableProps$paginatio9, _tableProps$paginatio10, _tableProps$paginatio11, _tableProps$paginatio12;
126
+ var tableProps = props.tableProps,
127
+ dataSource = props.dataSource,
128
+ paginationConfig = props.paginationConfig,
129
+ columns = props.columns,
130
+ components = props.components,
131
+ tableWrapRef = props.tableWrapRef;
132
+ var _ref3 = useSize(tableWrapRef) || {},
133
+ height = _ref3.height;
134
+ var debouncedHeight = useDebounce(height, {
135
+ wait: 500
136
+ });
137
+ var isShowPagination = useMemo(function () {
138
+ var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6, _tableProps$paginatio7, _tableProps$paginatio8;
139
+ var total = (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio3 = tableProps.pagination) === null || _tableProps$paginatio3 === void 0 ? void 0 : _tableProps$paginatio3.total) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
140
+ if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
141
+ total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
142
+ }
143
+ return total > ((tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio5 = tableProps.pagination) === null || _tableProps$paginatio5 === void 0 ? void 0 : _tableProps$paginatio5.pageSize) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio6 = tableProps.pagination) === null || _tableProps$paginatio6 === void 0 ? void 0 : (_tableProps$paginatio7 = _tableProps$paginatio6.pageSizeOptions) === null || _tableProps$paginatio7 === void 0 ? void 0 : _tableProps$paginatio7[0]) || 10) || (tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio8 = tableProps.pagination) === null || _tableProps$paginatio8 === void 0 ? void 0 : _tableProps$paginatio8.showPagination) && total > 10;
144
+ }, [tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio9 = tableProps.pagination) === null || _tableProps$paginatio9 === void 0 ? void 0 : _tableProps$paginatio9.localPagination, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio10 = tableProps.pagination) === null || _tableProps$paginatio10 === void 0 ? void 0 : _tableProps$paginatio10.total, dataSource.length, tableProps === null || tableProps === void 0 ? void 0 : (_tableProps$paginatio11 = tableProps.pagination) === null || _tableProps$paginatio11 === void 0 ? void 0 : (_tableProps$paginatio12 = _tableProps$paginatio11.pageSizeOptions) === null || _tableProps$paginatio12 === void 0 ? void 0 : _tableProps$paginatio12[0]]);
145
+ var scroll = useGenScroll({
146
+ wrapHeight: debouncedHeight || 500,
147
+ scroll: tableProps.scroll,
148
+ columns: columns,
149
+ isShowPagination: isShowPagination
150
+ });
151
+ var debouncedScroll = useDebounce(scroll, {
152
+ wait: 200
153
+ });
154
+ var basicTable = useMemo(function () {
155
+ return /*#__PURE__*/React.createElement(BasicTable, _extends({
156
+ key: debouncedScroll,
157
+ dataSource: dataSource,
158
+ columns: columns,
159
+ className: 'grid-view-table',
160
+ components: components
161
+ }, tableProps, {
162
+ scroll: debouncedScroll,
163
+ pagination: paginationConfig
164
+ }));
165
+ }, [debouncedScroll, dataSource, columns, components, paginationConfig, tableProps]);
166
+ return /*#__PURE__*/React.createElement(SortRow, {
167
+ rowKey: tableProps.rowKey,
168
+ onSortChange: tableProps.onSortChange
169
+ }, basicTable);
145
170
  };
146
171
  export default /*#__PURE__*/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
  }
@@ -155,7 +155,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
155
155
  sort?: SortType | undefined;
156
156
  mode: "" | "localStorage" | "remote";
157
157
  currentViewMode: ModeType;
158
- }) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
158
+ }) => ("filter_setting" | "column_setting" | "gallery_setting" | "view_mode" | "group_by" | "order_by")[];
159
159
  export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
160
160
  export declare const stringify: (obj: Record<string, any>) => string;
161
161
  export {};
@@ -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;
@@ -1,10 +1,12 @@
1
1
  var _excluded = ["dataSource", "columns", "dispatch", "style", "filter", "sort", "buttons", "actionButtons", "title", "summary", "onValuesChange", "columnSetting", "dataSourceGroup", "view", "gallery", "setTableSetting", "onDataSourceChange"];
2
2
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3
3
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
4
- import React from "react";
5
- import { Form } from "antd";
4
+ import React, { useMemo } from 'react';
5
+ import { Form } from 'antd';
6
6
  import GridViewTable from "../Table";
7
7
  import Gallery from "../Gallery";
8
+ import { stringify } from "../Table/utils";
9
+ import { useDebounce, useMemoizedFn } from 'ahooks';
8
10
  var View = function View(props) {
9
11
  var dataSource = props.dataSource,
10
12
  columns = props.columns,
@@ -25,22 +27,31 @@ var View = function View(props) {
25
27
  onDataSourceChange = props.onDataSourceChange,
26
28
  other = _objectWithoutProperties(props, _excluded);
27
29
  var form = Form.useFormInstance();
28
- var viewMode = Form.useWatch("view_mode", {
30
+ var viewMode = Form.useWatch('view_mode', {
29
31
  form: form,
30
32
  preserve: true
31
33
  });
32
- return /*#__PURE__*/React.createElement(React.Fragment, null, viewMode === "grid" && /*#__PURE__*/React.createElement(GridViewTable, {
33
- tableProps: other,
34
- filter: filter,
35
- setTableSetting: setTableSetting,
36
- onDataSourceChange: onDataSourceChange
37
- }), viewMode === "gallery" && /*#__PURE__*/React.createElement(Gallery, {
38
- loading: other === null || other === void 0 ? void 0 : other.loading,
39
- gallery: gallery,
40
- pagination: other.pagination,
41
- filter: filter,
42
- rowKey: other.rowKey,
43
- onDataSourceChange: onDataSourceChange
44
- }));
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
+ });
40
+ var memoContent = useMemo(function () {
41
+ return /*#__PURE__*/React.createElement(React.Fragment, null, viewMode === 'grid' && /*#__PURE__*/React.createElement(GridViewTable, {
42
+ tableProps: other,
43
+ filter: filter,
44
+ setTableSetting: setTableSetting,
45
+ onDataSourceChange: memoOnDataSourceChange
46
+ }), viewMode === 'gallery' && /*#__PURE__*/React.createElement(Gallery, {
47
+ loading: other === null || other === void 0 ? void 0 : other.loading,
48
+ gallery: gallery,
49
+ pagination: other.pagination,
50
+ filter: filter,
51
+ rowKey: other.rowKey,
52
+ onDataSourceChange: memoOnDataSourceChange
53
+ }));
54
+ }, [viewMode, stringify(other), debouncedFilter, memoOnDataSourceChange, gallery]);
55
+ return memoContent;
45
56
  };
46
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
  }
@@ -6,6 +6,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
6
6
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import { useMemo } from "react";
8
8
  import { getSettingKeyArrByMode, getTableSettingByCurrentViewMode, getTableSettingFromLocalStorage, mergeColumnSetting, mergeFilterSetting, setFormValuesToLocalStorage } from "../Table/utils";
9
+ import { useMemoizedFn } from "ahooks";
9
10
  var useTableSetting = function useTableSetting(params) {
10
11
  var tableId = params.tableId,
11
12
  filter = params.filter,
@@ -156,7 +157,7 @@ var useTableSetting = function useTableSetting(params) {
156
157
  * 更新 tableSetting
157
158
  * @param values
158
159
  */
159
- var setTableSetting = function setTableSetting(values) {
160
+ var setTableSetting = useMemoizedFn(function (values) {
160
161
  setFormValuesToLocalStorage({
161
162
  tableId: tableId,
162
163
  allValues: values,
@@ -164,7 +165,7 @@ var useTableSetting = function useTableSetting(params) {
164
165
  currentViewMode: currentViewMode,
165
166
  currentSettingHash: currentSettingHash
166
167
  });
167
- };
168
+ });
168
169
  var tableSetting = useMemo(function () {
169
170
  return _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
170
171
  }, [tableLocalSetting, defaultTableSetting]);
@@ -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,
@@ -68,7 +68,7 @@ var useTransDataSource = function useTransDataSource(params) {
68
68
  return filter === null || filter === void 0 ? void 0 : filter.list.filter(function (item) {
69
69
  return item.localFilter;
70
70
  });
71
- }, [filter]);
71
+ }, [stringify(filter)]);
72
72
  var dataSource = useMemo(function () {
73
73
  // 如果不是本地分页,则直接返回默认数据
74
74
  if (!localPagination) {
@@ -14,7 +14,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
14
14
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
- import { useSize } from 'ahooks';
17
+ import { useDebounce, useSize } from 'ahooks';
18
18
  import { Form } from 'antd';
19
19
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
20
20
  import { useSharedState } from "../../hooks";
@@ -75,9 +75,11 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
75
75
  var initialValuesRef = useRef({});
76
76
  var _ref = useSize(wrapRef) || {},
77
77
  width = _ref.width;
78
+ var debouncedWidth = useDebounce(width, {
79
+ wait: 100
80
+ });
78
81
  var utils = context === null || context === void 0 ? void 0 : (_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils;
79
82
  var tableId = useMemo(function () {
80
- console.log(props, 'wh');
81
83
  if (props.__designMode === 'design') {
82
84
  return 'designMode-mock-table-id';
83
85
  }
@@ -131,13 +133,13 @@ var GridView = Provider( /*#__PURE__*/forwardRef(function (props, ref) {
131
133
  }
132
134
  }, [currentSettingHash, tableId]);
133
135
  useEffect(function () {
134
- if (width) {
136
+ if (debouncedWidth) {
135
137
  modal.dispatch({
136
138
  type: 'setTableWidth',
137
- payload: width || {}
139
+ payload: debouncedWidth || {}
138
140
  });
139
141
  }
140
- }, [width]);
142
+ }, [debouncedWidth]);
141
143
  var _useTableSetting = useTableSetting({
142
144
  tableId: tableId,
143
145
  filter: 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;
@@ -69,7 +69,7 @@ var localeDateMap = {
69
69
  };
70
70
  var Page = (props) => {
71
71
  var _a, _b, _c, _d;
72
- const { children, style, locale: propsLocale, ...others } = props;
72
+ const { children, style, className, locale: propsLocale, ...others } = props;
73
73
  const context = (0, import_useEngineContext.default)();
74
74
  const { platform, themeColor } = ((_a = context.appHelper) == null ? void 0 : _a.constants) || {};
75
75
  const locale = propsLocale || ((_c = (_b = context == null ? void 0 : context.engine) == null ? void 0 : _b.props) == null ? void 0 : _c.locale) || "en";
@@ -271,7 +271,8 @@ var Page = (props) => {
271
271
  /* @__PURE__ */ import_react.default.createElement(import_date_picker.ThemeProvider, { theme: datePickerTheme }, /* @__PURE__ */ import_react.default.createElement(import_date_picker.LocaleProvider, { value: { locale } }, /* @__PURE__ */ import_react.default.createElement(import_pisell_config_provider.default, { locale }, /* @__PURE__ */ import_react.default.createElement(
272
272
  "div",
273
273
  {
274
- style: { ...style, "--theme-color": themeColor || "#7F56D9" }
274
+ style: { ...style, "--theme-color": themeColor || "#7F56D9" },
275
+ className
275
276
  },
276
277
  children
277
278
  ))))
@@ -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,
@@ -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;