@pisell/materials 1.0.12 → 1.0.13

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 (38) 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 +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +7 -7
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +5 -5
  11. package/es/components/MultipleContainersSortList/index.d.ts +2 -1
  12. package/es/components/MultipleContainersSortList/index.js +10 -2
  13. package/es/components/MultipleContainersSortList/index.less +6 -0
  14. package/es/components/Pagination/index.js +142 -0
  15. package/{lib/components/table → es/components}/Pagination/index.less +58 -0
  16. package/es/components/table/Actions/Filter/Dropdown/index.js +9 -2
  17. package/es/components/table/Actions/Filter/Dropdown/index.less +2 -0
  18. package/es/components/table/BasicTable/index.d.ts +4 -0
  19. package/es/components/table/BasicTable/index.js +71 -0
  20. package/es/components/table/Table/fields/date/Show/index.js +3 -1
  21. package/es/components/table/Table/index.js +3 -8
  22. package/es/components/table/index.js +6 -5
  23. package/lib/components/MultipleContainersSortList/index.d.ts +2 -1
  24. package/lib/components/MultipleContainersSortList/index.js +15 -3
  25. package/lib/components/MultipleContainersSortList/index.less +6 -0
  26. package/lib/components/{table/Pagination → Pagination}/index.js +58 -3
  27. package/{es/components/table → lib/components}/Pagination/index.less +58 -0
  28. package/lib/components/table/Actions/Filter/Dropdown/index.js +6 -1
  29. package/lib/components/table/Actions/Filter/Dropdown/index.less +2 -0
  30. package/lib/components/table/BasicTable/index.d.ts +4 -0
  31. package/lib/components/table/BasicTable/index.js +74 -0
  32. package/lib/components/table/Table/fields/date/Show/index.js +13 -1
  33. package/lib/components/table/Table/index.js +3 -9
  34. package/lib/components/table/index.js +6 -1
  35. package/package.json +3 -2
  36. package/es/components/table/Pagination/index.js +0 -45
  37. /package/es/components/{table/Pagination → Pagination}/index.d.ts +0 -0
  38. /package/lib/components/{table/Pagination → Pagination}/index.d.ts +0 -0
@@ -1,12 +1,13 @@
1
1
  import React from "react";
2
2
  import { SortableItemProps } from "../DragSortList";
3
+ import "./index.less";
3
4
  declare type IdType = string | number;
4
5
  export interface MultipleContainersSortListProps<T> {
5
6
  list: Record<string, T[]>;
6
7
  vertical?: boolean;
7
8
  wrapStyle?: React.CSSProperties;
8
9
  onChange: (val: Record<string, T[]>) => void;
9
- renderContainer?: DefaultRenderContainerProps['renderContainer'];
10
+ renderContainer?: DefaultRenderContainerProps["renderContainer"];
10
11
  rowKey: IdType | ((val: T) => IdType);
11
12
  children: SortableItemProps<T>["children"];
12
13
  }
@@ -19,7 +19,9 @@ import { SortableContext, arrayMove, verticalListSortingStrategy, useSortable }
19
19
  import { isFunction } from "@pisell/utils";
20
20
  import React, { useCallback, useEffect, useState } from "react";
21
21
  import { SortableItem } from "../DragSortList";
22
+ import "./index.less";
22
23
  export var TRASH_ID = "void";
24
+ var maxLength = 3;
23
25
  var DefaultRenderContainer = function DefaultRenderContainer(props) {
24
26
  var id = props.id,
25
27
  children = props.children,
@@ -103,6 +105,10 @@ var MultipleContainersSortList = function MultipleContainersSortList(props) {
103
105
  var newList = _objectSpread(_objectSpread({}, list), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, activeContainer, list[activeContainer].filter(function (item) {
104
106
  return getRowKey(item) !== active.id;
105
107
  })), _defineProperty(_objectSpread2, overContainer, [].concat(_toConsumableArray(list[overContainer].slice(0, newIndex)), [list[activeContainer][activeIndex]], _toConsumableArray(list[overContainer].slice(newIndex, list[overContainer].length)))), _objectSpread2));
108
+ if (overContainer === "quickFilter" && newList[overContainer].length > maxLength) {
109
+ var _objectSpread3;
110
+ newList = _objectSpread(_objectSpread({}, newList), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, overContainer, newList[overContainer].slice(0, maxLength)), _defineProperty(_objectSpread3, activeContainer, [].concat(_toConsumableArray(newList[overContainer].slice(maxLength)), _toConsumableArray(newList[activeContainer]))), _objectSpread3));
111
+ }
106
112
  onChange === null || onChange === void 0 ? void 0 : onChange(newList);
107
113
  }
108
114
  };
@@ -143,14 +149,16 @@ var MultipleContainersSortList = function MultipleContainersSortList(props) {
143
149
  return getRowKey(item);
144
150
  }),
145
151
  strategy: verticalListSortingStrategy
146
- }, list[container].map(function (item, index) {
152
+ }, list[container].length ? list[container].map(function (item, index) {
147
153
  return /*#__PURE__*/React.createElement(SortableItem, {
148
154
  key: getRowKey(item),
149
155
  id: getRowKey(item),
150
156
  item: item,
151
157
  index: index
152
158
  }, children);
153
- })));
159
+ }) : /*#__PURE__*/React.createElement("span", {
160
+ className: "materials-sort-list-empty"
161
+ }, "No filter options available.")));
154
162
  })));
155
163
  };
156
164
  export default MultipleContainersSortList;
@@ -0,0 +1,6 @@
1
+ .materials-sort-list-empty {
2
+ display: block;
3
+ color: #5a5a5a;
4
+ text-align: center;
5
+ padding-top: 22px;
6
+ }
@@ -0,0 +1,142 @@
1
+ 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); }
2
+ import React, { useMemo } from "react";
3
+ import { ArrowLeft, ArrowRight } from "@pisell/icon";
4
+ import { Pagination as OriginPagination } from "antd";
5
+ import classNames from "classnames";
6
+ import { useResponsive } from "../../hooks";
7
+ import "./index.less";
8
+
9
+ /**
10
+ * @title: 自定义渲染
11
+ * @description:
12
+ * @return {*}
13
+ * @Author: zhiwei.Wang
14
+ * @Date: 2023-07-20 17:01
15
+ */
16
+ var itemRender = function itemRender(_, type, originalElement) {
17
+ if (type === "prev") {
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ className: classNames("paginator-page-btn", "left")
20
+ }, /*#__PURE__*/React.createElement(ArrowLeft, {
21
+ className: "paginator-page-btn-left-icon"
22
+ }), /*#__PURE__*/React.createElement("span", {
23
+ className: "paginator-page-btn-text"
24
+ }, "Previous"));
25
+ }
26
+ if (type === "next") {
27
+ return /*#__PURE__*/React.createElement("div", {
28
+ className: classNames("paginator-page-btn", "right")
29
+ }, /*#__PURE__*/React.createElement("span", {
30
+ className: "paginator-page-btn-text"
31
+ }, "Next"), /*#__PURE__*/React.createElement(ArrowRight, {
32
+ className: "paginator-page-btn-right-icon"
33
+ }));
34
+ }
35
+ return originalElement;
36
+ };
37
+
38
+ // 分页配置
39
+ export var paginationConfig = {
40
+ className: "materials-grid-paginator",
41
+ defaultCurrent: 1,
42
+ showTotal: function showTotal(total, range) {
43
+ return "Page ".concat(range[0], " of ").concat(range[1]);
44
+ },
45
+ itemRender: itemRender,
46
+ responsive: true,
47
+ size: "small"
48
+ };
49
+ var Pagination = function Pagination(props) {
50
+ var responsive = useResponsive();
51
+ var show = useMemo(function () {
52
+ return Object.keys(props).length;
53
+ }, [props]);
54
+ var content = useMemo(function () {
55
+ if (!show) {
56
+ return null;
57
+ }
58
+ var Com = OriginPagination;
59
+
60
+ // 移动端使用简单分页
61
+ if (responsive === "phone") {
62
+ Com = MiniPagination;
63
+ }
64
+ return /*#__PURE__*/React.createElement(Com, _extends({}, paginationConfig, props));
65
+ }, [show, paginationConfig, props, responsive]);
66
+ return content;
67
+ };
68
+ export default Pagination;
69
+ var MiniPagination = function MiniPagination(props) {
70
+ var _props$current = props.current,
71
+ current = _props$current === void 0 ? 1 : _props$current,
72
+ _props$pageSize = props.pageSize,
73
+ pageSize = _props$pageSize === void 0 ? 10 : _props$pageSize,
74
+ _props$total = props.total,
75
+ total = _props$total === void 0 ? 0 : _props$total;
76
+
77
+ // 最大翻页
78
+ var MAX = useMemo(function () {
79
+ return Math.ceil(total / pageSize);
80
+ }, [total, pageSize]);
81
+
82
+ // 最小翻页
83
+ var MIN = useMemo(function () {
84
+ return 1;
85
+ }, []);
86
+
87
+ /**
88
+ * @title: 翻页回调
89
+ * @description:
90
+ * @param {*} type
91
+ * @return {*}
92
+ * @Author: zhiwei.Wang
93
+ * @Date: 2023-07-20 17:02
94
+ */
95
+ var onChange = function onChange(type) {
96
+ var currentPage = current;
97
+ if (type === "prev") {
98
+ currentPage = current - 1;
99
+ }
100
+ if (type === "next") {
101
+ currentPage = current + 1;
102
+ }
103
+ props.onChange && props.onChange(currentPage, pageSize || 10);
104
+ };
105
+ return /*#__PURE__*/React.createElement("div", {
106
+ className: "materials-grid-paginator materials-grid-paginator-mini"
107
+ }, /*#__PURE__*/React.createElement("div", {
108
+ className: "pisell-lowcode-pagination-prev",
109
+ onClick: function onClick() {
110
+ if (current <= MIN) {
111
+ return;
112
+ }
113
+ onChange("prev");
114
+ }
115
+ }, /*#__PURE__*/React.createElement("div", {
116
+ className: classNames("paginator-page-btn", "left")
117
+ }, /*#__PURE__*/React.createElement(ArrowLeft, {
118
+ className: "paginator-page-btn-left-icon"
119
+ }))), /*#__PURE__*/React.createElement("div", {
120
+ className: "materials-grid-paginator-center"
121
+ }, /*#__PURE__*/React.createElement("span", {
122
+ className: "materials-grid-paginator-center-text"
123
+ }, "Page"), /*#__PURE__*/React.createElement("span", {
124
+ className: "materials-grid-paginator-center-value"
125
+ }, current), /*#__PURE__*/React.createElement("span", {
126
+ className: "materials-grid-paginator-center-text"
127
+ }, "of"), /*#__PURE__*/React.createElement("span", {
128
+ className: "materials-grid-paginator-center-value"
129
+ }, MAX)), /*#__PURE__*/React.createElement("div", {
130
+ className: "pisell-lowcode-pagination-next",
131
+ onClick: function onClick() {
132
+ if (current >= MAX) {
133
+ return;
134
+ }
135
+ onChange("next");
136
+ }
137
+ }, /*#__PURE__*/React.createElement("div", {
138
+ className: classNames("paginator-page-btn", "right")
139
+ }, /*#__PURE__*/React.createElement(ArrowRight, {
140
+ className: "paginator-page-btn-right-icon"
141
+ }))));
142
+ };
@@ -148,4 +148,62 @@
148
148
  transform: rotate(180deg);
149
149
  }
150
150
  }
151
+ }
152
+
153
+ .materials-grid-paginator-mini {
154
+ display: flex;
155
+ justify-content: space-between;
156
+ align-items: center;
157
+ overflow: hidden;
158
+ height: 50px;
159
+ width: 100%;
160
+ background-color: #fff;
161
+ border-radius: 0 0 8px 8px;
162
+ border: 1px solid #f0f0f0;
163
+ border-top: none;
164
+ padding: 0 20px;
165
+ margin: 0 !important;
166
+
167
+ .paginator-page-btn {
168
+ padding: 8px;
169
+
170
+ }
171
+
172
+ .materials-grid-paginator-center {
173
+ display: flex;
174
+ align-items: center;
175
+ justify-content: center;
176
+ gap: 4px;
177
+
178
+ .materials-grid-paginator-center-text {
179
+ color: var(--gray-700, #344054);
180
+ font-size: 14px;
181
+ font-style: normal;
182
+ font-weight: 400;
183
+ }
184
+
185
+ .materials-grid-paginator-center-value {
186
+ color: var(--gray-700, #344054);
187
+ font-size: 14px;
188
+ font-style: normal;
189
+ font-weight: 500;
190
+ }
191
+ }
192
+
193
+ .pisell-lowcode-pagination-prev,
194
+ .pisell-lowcode-pagination-next {
195
+ margin: 0;
196
+ border-radius: 8px;
197
+ border: 1px solid #D0D5DD;
198
+
199
+ .paginator-page-btn-left-icon {
200
+ margin-right: 0;
201
+ }
202
+
203
+ .paginator-page-btn-right-icon {
204
+ margin-left: 0;
205
+ }
206
+
207
+ }
208
+
151
209
  }
@@ -6,10 +6,15 @@ import "./index.less";
6
6
  import FilterItem from "../FilterItem";
7
7
  import { useSharedState } from "../../../../../hooks";
8
8
  import { Context } from "../../../model";
9
+ import { Tooltip } from "antd";
9
10
  var titleMap = {
10
11
  quickFilter: "Quick Filter",
11
12
  otherFilter: "Filter"
12
13
  };
14
+ var tooltipMap = {
15
+ quickFilter: "Enable quick filtering directly on the page for convenient filtering operations, with a maximum of three filters allowed.\n",
16
+ otherFilter: "Select filter criteria in the list to perform filtering operations and display corresponding results."
17
+ };
13
18
  var DragItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
19
  var attributes = props.attributes,
15
20
  listeners = props.listeners,
@@ -58,9 +63,11 @@ var Dropdown = function Dropdown(props) {
58
63
  className: "filter-dropdown-container-title-wrap"
59
64
  }, /*#__PURE__*/React.createElement("span", {
60
65
  className: "filter-dropdown-container-title"
61
- }, titleMap[id]), /*#__PURE__*/React.createElement(HelpCircle, {
66
+ }, titleMap[id]), /*#__PURE__*/React.createElement(Tooltip, {
67
+ title: tooltipMap[id]
68
+ }, /*#__PURE__*/React.createElement(HelpCircle, {
62
69
  className: "filter-dropdown-container-icon-help"
63
- })), /*#__PURE__*/React.createElement("div", {
70
+ }))), /*#__PURE__*/React.createElement("div", {
64
71
  ref: ref,
65
72
  className: "filter-dropdown-container-filter-wrap"
66
73
  }, children));
@@ -1,5 +1,7 @@
1
1
  .filter-dropdown-wrap {
2
2
  width: 400px;
3
+ max-width: calc(100vw - 24px);
4
+ min-width: 250px;
3
5
  padding: 4px;
4
6
  max-height: 400px;
5
7
  display: flex;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TableProps } from "antd";
3
+ declare const BasicTable: (props: TableProps<any>) => JSX.Element;
4
+ export default BasicTable;
@@ -0,0 +1,71 @@
1
+ var _excluded = ["dataSource", "pagination"];
2
+ 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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ 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; }
7
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
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
+ 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 { Table } from "antd";
12
+ import React, { useState, useMemo } from "react";
13
+ import Pagination from "../../Pagination";
14
+ var BasicTable = function BasicTable(props) {
15
+ var dataSource = props.dataSource,
16
+ pagination = props.pagination,
17
+ other = _objectWithoutProperties(props, _excluded);
18
+ var _useState = useState(1),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ currentPage = _useState2[0],
21
+ setCurrentPage = _useState2[1];
22
+ var _useState3 = useState(10),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ pageSize = _useState4[0],
25
+ setPageSize = _useState4[1];
26
+
27
+ // 分割数据源
28
+ var _dataSource = useMemo(function () {
29
+ var list = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.list) || [];
30
+ var total = (dataSource === null || dataSource === void 0 ? void 0 : dataSource.total) || 0;
31
+ if (Array.isArray(dataSource)) {
32
+ list = dataSource;
33
+ total = list.length;
34
+ }
35
+ list = list.slice((currentPage - 1) * pageSize, currentPage * pageSize);
36
+ return {
37
+ list: list,
38
+ total: total
39
+ };
40
+ }, [dataSource, currentPage, pageSize]);
41
+
42
+ // 总数
43
+ var total = useMemo(function () {
44
+ return (pagination === null || pagination === void 0 ? void 0 : pagination.total) || (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.total) || 0;
45
+ }, [dataSource, pagination]);
46
+
47
+ /**
48
+ * @title: 翻页回调
49
+ * @description:
50
+ * @param {number} page
51
+ * @param {number} pageSize
52
+ * @return {*}
53
+ * @Author: zhiwei.Wang
54
+ * @Date: 2023-07-20 17:01
55
+ */
56
+ var onPaginationChange = function onPaginationChange(page, pageSize) {
57
+ setCurrentPage(page);
58
+ setPageSize(pageSize);
59
+ };
60
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({}, other, {
61
+ pagination: false,
62
+ dataSource: _dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list
63
+ })), /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
64
+ current: currentPage,
65
+ pageSize: pageSize,
66
+ onShowSizeChange: onPaginationChange,
67
+ onChange: onPaginationChange,
68
+ total: total
69
+ })));
70
+ };
71
+ export default BasicTable;
@@ -1,6 +1,8 @@
1
1
  var _excluded = ["title", "editable", "dataIndex", "field_type", "record", "handleSave"];
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 { formatDate } from "@pisell/utils";
4
6
  var Show = function Show(props) {
5
7
  var title = props.title,
6
8
  editable = props.editable,
@@ -11,6 +13,6 @@ var Show = function Show(props) {
11
13
  restProps = _objectWithoutProperties(props, _excluded);
12
14
  return /*#__PURE__*/React.createElement("div", {
13
15
  className: ""
14
- }, record[dataIndex]);
16
+ }, formatDate(record[dataIndex]));
15
17
  };
16
18
  export default Show;
@@ -12,17 +12,17 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
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
14
  import { useSharedState, useResponsive } from "../../../hooks";
15
- import { Table } from "antd";
16
15
  // import { Access } from '@umijs/max';
17
16
  import React, { useCallback, useMemo } from "react";
18
17
  import { useMemoizedFn } from "ahooks";
19
18
  import { Context } from "../model";
20
19
  // import AddFieldModal from "./AddFieldModal";
21
20
  import "./index.less";
21
+ import BasicTable from "../BasicTable";
22
22
  import SortRow from "./tableConfig/SortRow";
23
23
  import Body from "./tableConfig/body";
24
24
  import Header from "./tableConfig/header";
25
- import { paginationConfig } from "../Pagination";
25
+ import { paginationConfig } from "../../Pagination";
26
26
  var GridViewTable = function GridViewTable(_ref) {
27
27
  var tableProps = _ref.tableProps;
28
28
  var responsive = useResponsive();
@@ -96,18 +96,13 @@ var GridViewTable = function GridViewTable(_ref) {
96
96
  if (tableProps.pagination === false) {
97
97
  return false;
98
98
  }
99
- if (responsive === "phone") {
100
- return _objectSpread(_objectSpread({}, tableProps.pagination), {}, {
101
- size: "small"
102
- });
103
- }
104
99
  return _objectSpread(_objectSpread(_objectSpread({}, paginationConfig), tableProps.pagination), {}, {
105
100
  showTotal: showTotal
106
101
  });
107
102
  }, [responsive, tableProps.pagination]);
108
103
  return /*#__PURE__*/React.createElement("div", {
109
104
  className: "materials-grid-table-wrap"
110
- }, /*#__PURE__*/React.createElement(SortRow, null, /*#__PURE__*/React.createElement(Table, _extends({
105
+ }, /*#__PURE__*/React.createElement(SortRow, null, /*#__PURE__*/React.createElement(BasicTable, _extends({
111
106
  dataSource: dataSource,
112
107
  columns: columns,
113
108
  className: "grid-view-table",
@@ -45,14 +45,15 @@ var GridView = Provider(function (props) {
45
45
  });
46
46
  }, [dataSource]);
47
47
  useEffect(function () {
48
+ var _filter$list, _filter$list$slice, _filter$list2, _filter$list2$slice;
48
49
  modal.dispatch({
49
50
  type: "setQuickFilter",
50
- payload: filter.list
51
+ payload: (filter === null || filter === void 0 ? void 0 : (_filter$list = filter.list) === null || _filter$list === void 0 ? void 0 : (_filter$list$slice = _filter$list.slice) === null || _filter$list$slice === void 0 ? void 0 : _filter$list$slice.call(_filter$list, 0, 3)) || []
52
+ });
53
+ modal.dispatch({
54
+ type: "setOtherFilter",
55
+ payload: (filter === null || filter === void 0 ? void 0 : (_filter$list2 = filter.list) === null || _filter$list2 === void 0 ? void 0 : (_filter$list2$slice = _filter$list2.slice) === null || _filter$list2$slice === void 0 ? void 0 : _filter$list2$slice.call(_filter$list2, 3)) || []
51
56
  });
52
- // modal.dispatch({
53
- // type: "setOtherFilter",
54
- // payload: filter,
55
- // });
56
57
  }, [filter]);
57
58
  return /*#__PURE__*/React.createElement(Form, {
58
59
  form: form,
@@ -1,12 +1,13 @@
1
1
  import React from "react";
2
2
  import { SortableItemProps } from "../DragSortList";
3
+ import "./index.less";
3
4
  declare type IdType = string | number;
4
5
  export interface MultipleContainersSortListProps<T> {
5
6
  list: Record<string, T[]>;
6
7
  vertical?: boolean;
7
8
  wrapStyle?: React.CSSProperties;
8
9
  onChange: (val: Record<string, T[]>) => void;
9
- renderContainer?: DefaultRenderContainerProps['renderContainer'];
10
+ renderContainer?: DefaultRenderContainerProps["renderContainer"];
10
11
  rowKey: IdType | ((val: T) => IdType);
11
12
  children: SortableItemProps<T>["children"];
12
13
  }
@@ -38,7 +38,9 @@ var import_sortable = require("@dnd-kit/sortable");
38
38
  var import_utils = require("@pisell/utils");
39
39
  var import_react = __toESM(require("react"));
40
40
  var import_DragSortList = require("../DragSortList");
41
+ var import_index = require("./index.less");
41
42
  var TRASH_ID = "void";
43
+ var maxLength = 3;
42
44
  var DefaultRenderContainer = (props) => {
43
45
  const { id, children, renderContainer } = props;
44
46
  const { setNodeRef } = (0, import_sortable.useSortable)({
@@ -106,7 +108,7 @@ var MultipleContainersSortList = (props) => {
106
108
  const modifier = isBelowOverItem ? 1 : 0;
107
109
  newIndex = overIndex >= 0 ? overIndex + modifier : overItems.length + 1;
108
110
  }
109
- const newList = {
111
+ let newList = {
110
112
  ...list,
111
113
  [activeContainer]: list[activeContainer].filter(
112
114
  (item) => getRowKey(item) !== active.id
@@ -117,6 +119,16 @@ var MultipleContainersSortList = (props) => {
117
119
  ...list[overContainer].slice(newIndex, list[overContainer].length)
118
120
  ]
119
121
  };
122
+ if (overContainer === "quickFilter" && newList[overContainer].length > maxLength) {
123
+ newList = {
124
+ ...newList,
125
+ [overContainer]: newList[overContainer].slice(0, maxLength),
126
+ [activeContainer]: [
127
+ ...newList[overContainer].slice(maxLength),
128
+ ...newList[activeContainer]
129
+ ]
130
+ };
131
+ }
120
132
  onChange == null ? void 0 : onChange(newList);
121
133
  }
122
134
  };
@@ -160,7 +172,7 @@ var MultipleContainersSortList = (props) => {
160
172
  items: list[container].map((item) => getRowKey(item)),
161
173
  strategy: import_sortable.verticalListSortingStrategy
162
174
  },
163
- list[container].map((item, index) => /* @__PURE__ */ import_react.default.createElement(
175
+ list[container].length ? list[container].map((item, index) => /* @__PURE__ */ import_react.default.createElement(
164
176
  import_DragSortList.SortableItem,
165
177
  {
166
178
  key: getRowKey(item),
@@ -169,7 +181,7 @@ var MultipleContainersSortList = (props) => {
169
181
  index
170
182
  },
171
183
  children
172
- ))
184
+ )) : /* @__PURE__ */ import_react.default.createElement("span", { className: "materials-sort-list-empty" }, "No filter options available.")
173
185
  )
174
186
  ))));
175
187
  };
@@ -0,0 +1,6 @@
1
+ .materials-sort-list-empty {
2
+ display: block;
3
+ color: #5a5a5a;
4
+ text-align: center;
5
+ padding-top: 22px;
6
+ }
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
 
29
- // src/components/table/Pagination/index.tsx
29
+ // src/components/Pagination/index.tsx
30
30
  var Pagination_exports = {};
31
31
  __export(Pagination_exports, {
32
32
  default: () => Pagination_default,
@@ -37,6 +37,7 @@ var import_react = __toESM(require("react"));
37
37
  var import_icon = require("@pisell/icon");
38
38
  var import_antd = require("antd");
39
39
  var import_classnames = __toESM(require("classnames"));
40
+ var import_hooks = require("../../hooks");
40
41
  var import_index = require("./index.less");
41
42
  var itemRender = (_, type, originalElement) => {
42
43
  if (type === "prev") {
@@ -56,13 +57,67 @@ var paginationConfig = {
56
57
  size: "small"
57
58
  };
58
59
  var Pagination = (props) => {
59
- console.log(props);
60
+ const responsive = (0, import_hooks.useResponsive)();
60
61
  const show = (0, import_react.useMemo)(() => {
61
62
  return Object.keys(props).length;
62
63
  }, [props]);
63
- return show ? /* @__PURE__ */ import_react.default.createElement(import_antd.Pagination, { ...paginationConfig, ...props }) : null;
64
+ const content = (0, import_react.useMemo)(() => {
65
+ if (!show) {
66
+ return null;
67
+ }
68
+ let Com = import_antd.Pagination;
69
+ if (responsive === "phone") {
70
+ Com = MiniPagination;
71
+ }
72
+ return /* @__PURE__ */ import_react.default.createElement(Com, { ...paginationConfig, ...props });
73
+ }, [show, paginationConfig, props, responsive]);
74
+ return content;
64
75
  };
65
76
  var Pagination_default = Pagination;
77
+ var MiniPagination = (props) => {
78
+ const { current = 1, pageSize = 10, total = 0 } = props;
79
+ const MAX = (0, import_react.useMemo)(() => {
80
+ return Math.ceil(total / pageSize);
81
+ }, [total, pageSize]);
82
+ const MIN = (0, import_react.useMemo)(() => {
83
+ return 1;
84
+ }, []);
85
+ const onChange = (type) => {
86
+ let currentPage = current;
87
+ if (type === "prev") {
88
+ currentPage = current - 1;
89
+ }
90
+ if (type === "next") {
91
+ currentPage = current + 1;
92
+ }
93
+ props.onChange && props.onChange(currentPage, pageSize || 10);
94
+ };
95
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-paginator materials-grid-paginator-mini" }, /* @__PURE__ */ import_react.default.createElement(
96
+ "div",
97
+ {
98
+ className: "pisell-lowcode-pagination-prev",
99
+ onClick: () => {
100
+ if (current <= MIN) {
101
+ return;
102
+ }
103
+ onChange("prev");
104
+ }
105
+ },
106
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("paginator-page-btn", "left") }, /* @__PURE__ */ import_react.default.createElement(import_icon.ArrowLeft, { className: "paginator-page-btn-left-icon" }))
107
+ ), /* @__PURE__ */ import_react.default.createElement("div", { className: "materials-grid-paginator-center" }, /* @__PURE__ */ import_react.default.createElement("span", { className: "materials-grid-paginator-center-text" }, "Page"), /* @__PURE__ */ import_react.default.createElement("span", { className: "materials-grid-paginator-center-value" }, current), /* @__PURE__ */ import_react.default.createElement("span", { className: "materials-grid-paginator-center-text" }, "of"), /* @__PURE__ */ import_react.default.createElement("span", { className: "materials-grid-paginator-center-value" }, MAX)), /* @__PURE__ */ import_react.default.createElement(
108
+ "div",
109
+ {
110
+ className: "pisell-lowcode-pagination-next",
111
+ onClick: () => {
112
+ if (current >= MAX) {
113
+ return;
114
+ }
115
+ onChange("next");
116
+ }
117
+ },
118
+ /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("paginator-page-btn", "right") }, /* @__PURE__ */ import_react.default.createElement(import_icon.ArrowRight, { className: "paginator-page-btn-right-icon" }))
119
+ ));
120
+ };
66
121
  // Annotate the CommonJS export names for ESM import in node:
67
122
  0 && (module.exports = {
68
123
  paginationConfig