@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
@@ -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
  };
@@ -85,11 +82,12 @@ var GridViewTable = function GridViewTable(_ref) {
85
82
  form: form,
86
83
  localPagination: !!(tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio2 = tableProps.pagination) !== null && _tableProps$paginatio2 !== void 0 && _tableProps$paginatio2.localPagination),
87
84
  rowKey: tableProps.rowKey,
88
- filter: filter
85
+ filter: filter,
86
+ currentView: 'table'
89
87
  });
90
88
  useEffect(function () {
91
89
  dispatch({
92
- type: "setOriginResultDataSource",
90
+ type: 'setOriginResultDataSource',
93
91
  payload: dataSource || []
94
92
  });
95
93
  }, [dataSource]);
@@ -99,24 +97,10 @@ var GridViewTable = function GridViewTable(_ref) {
99
97
  var components = useGenTableComponents({
100
98
  form: form
101
99
  });
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
100
  var showTotal = useCallback(function (total, range, pageSize) {
117
101
  var start = range[0] - 1;
118
102
  var _current = start / pageSize + 1;
119
- return getText("table-pagination-total")(_current, Math.ceil(total / pageSize));
103
+ return getText('table-pagination-total')(_current, Math.ceil(total / pageSize));
120
104
  }, []);
121
105
  var _paginationConfig = useMemo(function () {
122
106
  if (tableProps.pagination === false) {
@@ -125,22 +109,64 @@ var GridViewTable = function GridViewTable(_ref) {
125
109
  return _objectSpread(_objectSpread(_objectSpread({}, paginationConfig), tableProps.pagination), {}, {
126
110
  showTotal: showTotal
127
111
  });
128
- }, [responsive, tableProps.pagination]);
112
+ }, [tableProps.pagination]);
129
113
  return /*#__PURE__*/React.createElement("div", {
130
- className: "materials-grid-table-wrap",
114
+ className: 'materials-grid-table-wrap',
131
115
  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,
116
+ }, /*#__PURE__*/React.createElement(AutoSizerContent, {
117
+ tableWrapRef: tableWrapRef,
137
118
  dataSource: dataSource,
119
+ tableProps: tableProps,
138
120
  columns: columns,
139
- className: "grid-view-table",
121
+ paginationConfig: _paginationConfig,
140
122
  components: components
141
- }, tableProps, {
142
- scroll: scroll,
143
- pagination: _paginationConfig
144
- }))));
123
+ }));
124
+ };
125
+ var AutoSizerContent = function AutoSizerContent(props) {
126
+ var _tableProps$paginatio9, _tableProps$paginatio10, _tableProps$paginatio11, _tableProps$paginatio12;
127
+ var tableProps = props.tableProps,
128
+ dataSource = props.dataSource,
129
+ paginationConfig = props.paginationConfig,
130
+ columns = props.columns,
131
+ components = props.components,
132
+ tableWrapRef = props.tableWrapRef;
133
+ var _ref3 = useSize(tableWrapRef) || {},
134
+ height = _ref3.height;
135
+ var debouncedHeight = useDebounce(height, {
136
+ wait: 500
137
+ });
138
+ var isShowPagination = useMemo(function () {
139
+ var _tableProps$paginatio3, _tableProps$paginatio4, _tableProps$paginatio5, _tableProps$paginatio6, _tableProps$paginatio7, _tableProps$paginatio8;
140
+ 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;
141
+ if (tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio4 = tableProps.pagination) !== null && _tableProps$paginatio4 !== void 0 && _tableProps$paginatio4.localPagination) {
142
+ total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.length) || 0;
143
+ }
144
+ 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;
145
+ }, [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]]);
146
+ var scroll = useGenScroll({
147
+ wrapHeight: debouncedHeight || 500,
148
+ scroll: tableProps.scroll,
149
+ columns: columns,
150
+ isShowPagination: isShowPagination
151
+ });
152
+ var debouncedScroll = useDebounce(scroll, {
153
+ wait: 200
154
+ });
155
+ var basicTable = useMemo(function () {
156
+ return /*#__PURE__*/React.createElement(BasicTable, _extends({
157
+ key: debouncedScroll,
158
+ dataSource: dataSource,
159
+ columns: columns,
160
+ className: 'grid-view-table',
161
+ components: components
162
+ }, tableProps, {
163
+ scroll: debouncedScroll,
164
+ pagination: paginationConfig
165
+ }));
166
+ }, [debouncedScroll, dataSource, columns, components, paginationConfig, tableProps]);
167
+ return /*#__PURE__*/React.createElement(SortRow, {
168
+ rowKey: tableProps.rowKey,
169
+ onSortChange: tableProps.onSortChange
170
+ }, basicTable);
145
171
  };
146
172
  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
  }
@@ -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 列表数据
@@ -271,6 +271,10 @@ export var setTableSettingToLocalStorage = function setTableSettingToLocalStorag
271
271
  currentSettingHash: currentSettingHash
272
272
  }, currentViewMode, _objectSpread(_objectSpread({}, newData[currentViewMode] || {}), itemSetting)));
273
273
  localStorage.setItem(getTableKey(tableId), JSON.stringify(newData));
274
+ return {
275
+ key: getTableKey(tableId),
276
+ value: newData
277
+ };
274
278
  };
275
279
  export var clearTableSettingToLocalStorage = function clearTableSettingToLocalStorage(tableId) {
276
280
  if (!tableId) return;
@@ -327,7 +331,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
327
331
  keys === null || keys === void 0 ? void 0 : keys.forEach(function (key) {
328
332
  obj[key] = allValues === null || allValues === void 0 ? void 0 : allValues[key];
329
333
  });
330
- setTableSettingToLocalStorage({
334
+ return setTableSettingToLocalStorage({
331
335
  tableId: tableId,
332
336
  tableSettingObj: obj,
333
337
  currentViewMode: currentViewMode,
@@ -340,7 +344,7 @@ export var setFormValuesToLocalStorage = function setFormValuesToLocalStorage(_r
340
344
  * @param tableId 表格ID
341
345
  * @returns 返回格式化后的表格键值
342
346
  */
343
- var getTableKey = function getTableKey(tableId) {
347
+ export var getTableKey = function getTableKey(tableId) {
344
348
  return "".concat(tableKeyPrefix, "-").concat(tableId);
345
349
  };
346
350
 
@@ -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,7 +6,10 @@ 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 useEngineContext from "../../../hooks/useEngineContext";
10
+ import { useMemoizedFn } from "ahooks";
9
11
  var useTableSetting = function useTableSetting(params) {
12
+ var _context$appHelper;
10
13
  var tableId = params.tableId,
11
14
  filter = params.filter,
12
15
  columnSetting = params.columnSetting,
@@ -18,6 +21,10 @@ var useTableSetting = function useTableSetting(params) {
18
21
  gallery = params.gallery,
19
22
  currentSettingHash = params.currentSettingHash,
20
23
  exportImport = params.exportImport;
24
+ var context = useEngineContext();
25
+ var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {},
26
+ isTerminal = _ref.isTerminal,
27
+ interaction = _ref.interaction;
21
28
  var columnsMap = useMemo(function () {
22
29
  return new Map(propsColumns.map(function (item) {
23
30
  return [item.key, item];
@@ -38,10 +45,10 @@ var useTableSetting = function useTableSetting(params) {
38
45
  }
39
46
  return propsColumns;
40
47
  }, [propsColumns, currentViewMode, gallery, columnsMap]);
41
- var _ref = filter || {},
42
- list = _ref.list,
43
- quickFilterMaxLength = _ref.quickFilterMaxLength,
44
- sortButtonShow = _ref.sortButtonShow;
48
+ var _ref2 = filter || {},
49
+ list = _ref2.list,
50
+ quickFilterMaxLength = _ref2.quickFilterMaxLength,
51
+ sortButtonShow = _ref2.sortButtonShow;
45
52
  var defaultGalleryCoverSetting = useMemo(function () {
46
53
  var _gallery$cover, _columns$find;
47
54
  return {
@@ -156,15 +163,30 @@ var useTableSetting = function useTableSetting(params) {
156
163
  * 更新 tableSetting
157
164
  * @param values
158
165
  */
159
- var setTableSetting = function setTableSetting(values) {
160
- setFormValuesToLocalStorage({
166
+ var setTableSetting = useMemoizedFn(function (values) {
167
+ var result = setFormValuesToLocalStorage({
161
168
  tableId: tableId,
162
169
  allValues: values,
163
170
  keys: localStorageSettingKeyArr,
164
171
  currentViewMode: currentViewMode,
165
172
  currentSettingHash: currentSettingHash
166
173
  });
167
- };
174
+ /*
175
+ if (isTerminal?.() && result) {
176
+ interaction?.utils?.postMessageToApp?.({
177
+ module: "global",
178
+ key: "local_storage",
179
+ data: {
180
+ type: "set",
181
+ value: {
182
+ [result.key]: result.value
183
+ },
184
+ },
185
+ })
186
+ }
187
+ */
188
+ });
189
+
168
190
  var tableSetting = useMemo(function () {
169
191
  return _objectSpread(_objectSpread({}, tableLocalSetting), defaultTableSetting);
170
192
  }, [tableLocalSetting, defaultTableSetting]);
@@ -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;
@@ -7,14 +7,15 @@ 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,
14
14
  localPagination = params.localPagination,
15
15
  pDataSource = params.dataSource,
16
16
  rowKey = params.rowKey,
17
- filter = params.filter;
17
+ filter = params.filter,
18
+ currentView = params.currentView;
18
19
  var sort = Form.useWatch("order_by", {
19
20
  form: form,
20
21
  preserve: true
@@ -68,7 +69,7 @@ var useTransDataSource = function useTransDataSource(params) {
68
69
  return filter === null || filter === void 0 ? void 0 : filter.list.filter(function (item) {
69
70
  return item.localFilter;
70
71
  });
71
- }, [filter]);
72
+ }, [stringify(filter)]);
72
73
  var dataSource = useMemo(function () {
73
74
  // 如果不是本地分页,则直接返回默认数据
74
75
  if (!localPagination) {
@@ -81,12 +82,13 @@ var useTransDataSource = function useTransDataSource(params) {
81
82
  if (sortObj) {
82
83
  newDataSource = sortDataSource(newDataSource, sortObj);
83
84
  }
84
- if (groupDetail) {
85
+
86
+ // 在table视图时进行group分组
87
+ if (groupDetail && currentView === 'table') {
85
88
  newDataSource = groupDataSource(newDataSource, groupDetail, rowKey);
86
89
  }
87
90
  return newDataSource;
88
- }, [pDataSource, localPagination, sortObj, groupDetail, filterLocalArr, filters]);
89
- console.log('dataSourcedataSource', dataSource);
91
+ }, [pDataSource, localPagination, sortObj, groupDetail, filterLocalArr, filters, currentView]);
90
92
  return dataSource;
91
93
  };
92
94
  export default useTransDataSource;
@@ -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;
@@ -3,9 +3,11 @@ declare type exportParams = {
3
3
  file_name?: string;
4
4
  form_id?: string | number;
5
5
  code?: string;
6
+ url?: string;
6
7
  };
7
8
  export declare const exportData: (params: exportParams) => Promise<any>;
8
9
  export declare const batchImport: (params: any) => Promise<any>;
9
10
  export declare const importTemplate: (params: exportParams) => Promise<any>;
10
- export declare const historyData: (params: any) => Promise<any>;
11
+ export declare const getExportFile: (params: any) => Promise<any>;
12
+ export declare const getImportLog: (params: any) => Promise<any>;
11
13
  export {};