@pisell/materials 1.0.11 → 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.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +7 -7
- package/es/components/MultipleContainersSortList/index.d.ts +2 -1
- package/es/components/MultipleContainersSortList/index.js +10 -2
- package/es/components/MultipleContainersSortList/index.less +6 -0
- package/es/components/{table/Pagination → Pagination}/index.d.ts +3 -1
- package/es/components/Pagination/index.js +142 -0
- package/{lib/components/table → es/components}/Pagination/index.less +69 -11
- package/es/components/config-provider/index.d.ts +6 -2
- package/es/components/config-provider/index.js +10 -11
- package/es/components/page/index.d.ts +6 -0
- package/es/components/page/index.js +85 -0
- package/es/components/table/Actions/Filter/Dropdown/index.js +9 -2
- package/es/components/table/Actions/Filter/Dropdown/index.less +3 -1
- package/es/components/table/Actions/index.less +1 -1
- package/es/components/table/BasicTable/index.d.ts +4 -0
- package/es/components/table/BasicTable/index.js +71 -0
- package/es/components/table/Table/AddFieldModal/index.less +1 -1
- package/es/components/table/Table/fields/date/Show/index.js +3 -1
- package/es/components/table/Table/index.js +14 -7
- package/es/components/table/index.js +6 -5
- package/es/hooks/index.d.ts +2 -1
- package/es/hooks/index.js +2 -1
- package/es/hooks/useResponsive.d.ts +4 -0
- package/es/hooks/useResponsive.js +95 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/lib/components/MultipleContainersSortList/index.d.ts +2 -1
- package/lib/components/MultipleContainersSortList/index.js +15 -3
- package/lib/components/MultipleContainersSortList/index.less +6 -0
- package/lib/components/{table/Pagination → Pagination}/index.d.ts +3 -1
- package/lib/components/{table/Pagination → Pagination}/index.js +61 -4
- package/{es/components/table → lib/components}/Pagination/index.less +69 -11
- package/lib/components/config-provider/index.d.ts +6 -2
- package/lib/components/page/index.d.ts +6 -0
- package/lib/components/page/index.js +122 -0
- package/lib/components/table/Actions/Filter/Dropdown/index.js +6 -1
- package/lib/components/table/Actions/Filter/Dropdown/index.less +3 -1
- package/lib/components/table/Actions/index.less +1 -1
- package/lib/components/table/BasicTable/index.d.ts +4 -0
- package/lib/components/table/BasicTable/index.js +74 -0
- package/lib/components/table/Table/AddFieldModal/index.less +1 -1
- package/lib/components/table/Table/fields/date/Show/index.js +13 -1
- package/lib/components/table/Table/index.js +15 -8
- package/lib/components/table/index.js +6 -1
- package/lib/hooks/index.d.ts +2 -1
- package/lib/hooks/index.js +3 -0
- package/lib/hooks/useResponsive.d.ts +4 -0
- package/lib/hooks/useResponsive.js +104 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +29 -0
- package/lowcode/config-provider/meta.ts +113 -109
- package/lowcode/page/meta.ts +44 -0
- package/package.json +3 -2
- package/es/components/table/Pagination/index.js +0 -43
|
@@ -11,20 +11,21 @@ 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 { useSharedState } from "../../../hooks";
|
|
15
|
-
import { Table } from "antd";
|
|
14
|
+
import { useSharedState, useResponsive } from "../../../hooks";
|
|
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 "
|
|
25
|
+
import { paginationConfig } from "../../Pagination";
|
|
26
26
|
var GridViewTable = function GridViewTable(_ref) {
|
|
27
27
|
var tableProps = _ref.tableProps;
|
|
28
|
+
var responsive = useResponsive();
|
|
28
29
|
var _useSharedState = useSharedState(Context),
|
|
29
30
|
state = _useSharedState.state,
|
|
30
31
|
dispatch = _useSharedState.dispatch;
|
|
@@ -91,9 +92,17 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
91
92
|
var _current = start / tableProps.pagination.pageSize + 1;
|
|
92
93
|
return "Page ".concat(_current, " of ").concat(Math.ceil(total / tableProps.pagination.pageSize));
|
|
93
94
|
}, [tableProps.pagination.pageSize]);
|
|
95
|
+
var _paginationConfig = useMemo(function () {
|
|
96
|
+
if (tableProps.pagination === false) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return _objectSpread(_objectSpread(_objectSpread({}, paginationConfig), tableProps.pagination), {}, {
|
|
100
|
+
showTotal: showTotal
|
|
101
|
+
});
|
|
102
|
+
}, [responsive, tableProps.pagination]);
|
|
94
103
|
return /*#__PURE__*/React.createElement("div", {
|
|
95
104
|
className: "materials-grid-table-wrap"
|
|
96
|
-
}, /*#__PURE__*/React.createElement(SortRow, null, /*#__PURE__*/React.createElement(
|
|
105
|
+
}, /*#__PURE__*/React.createElement(SortRow, null, /*#__PURE__*/React.createElement(BasicTable, _extends({
|
|
97
106
|
dataSource: dataSource,
|
|
98
107
|
columns: columns,
|
|
99
108
|
className: "grid-view-table",
|
|
@@ -111,9 +120,7 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
111
120
|
scroll: {
|
|
112
121
|
x: "max-content"
|
|
113
122
|
},
|
|
114
|
-
pagination:
|
|
115
|
-
showTotal: showTotal
|
|
116
|
-
})
|
|
123
|
+
pagination: _paginationConfig
|
|
117
124
|
}))));
|
|
118
125
|
};
|
|
119
126
|
export default GridViewTable;
|
|
@@ -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,
|
package/es/hooks/index.d.ts
CHANGED
package/es/hooks/index.js
CHANGED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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; } }
|
|
4
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
8
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
9
|
+
import { isBrowser } from "../utils";
|
|
10
|
+
var subscribers = new Set();
|
|
11
|
+
var info;
|
|
12
|
+
var responsiveConfig = {
|
|
13
|
+
phone: 0,
|
|
14
|
+
ipad: 700,
|
|
15
|
+
pc: 1080
|
|
16
|
+
};
|
|
17
|
+
function handleResize() {
|
|
18
|
+
var oldInfo = info;
|
|
19
|
+
calculate();
|
|
20
|
+
if (oldInfo === info) return;
|
|
21
|
+
var _iterator = _createForOfIteratorHelper(subscribers),
|
|
22
|
+
_step;
|
|
23
|
+
try {
|
|
24
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
25
|
+
var subscriber = _step.value;
|
|
26
|
+
subscriber();
|
|
27
|
+
}
|
|
28
|
+
} catch (err) {
|
|
29
|
+
_iterator.e(err);
|
|
30
|
+
} finally {
|
|
31
|
+
_iterator.f();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
var listening = false;
|
|
35
|
+
function calculate() {
|
|
36
|
+
var width = window.innerWidth;
|
|
37
|
+
var newInfo = {};
|
|
38
|
+
var shouldUpdate = false;
|
|
39
|
+
for (var _i = 0, _Object$keys = Object.keys(responsiveConfig); _i < _Object$keys.length; _i++) {
|
|
40
|
+
var key = _Object$keys[_i];
|
|
41
|
+
newInfo[key] = width >= responsiveConfig[key];
|
|
42
|
+
if (newInfo[key] !== info[key]) {
|
|
43
|
+
shouldUpdate = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (shouldUpdate) {
|
|
47
|
+
info = newInfo;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export function configResponsive(config) {
|
|
51
|
+
responsiveConfig = config;
|
|
52
|
+
if (info) calculate();
|
|
53
|
+
}
|
|
54
|
+
export default function useResponsive() {
|
|
55
|
+
if (isBrowser && !listening) {
|
|
56
|
+
info = {};
|
|
57
|
+
calculate();
|
|
58
|
+
window.addEventListener('resize', handleResize);
|
|
59
|
+
listening = true;
|
|
60
|
+
}
|
|
61
|
+
var _useState = useState(info),
|
|
62
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
63
|
+
state = _useState2[0],
|
|
64
|
+
setState = _useState2[1];
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (!isBrowser) return;
|
|
67
|
+
|
|
68
|
+
// In React 18's StrictMode, useEffect perform twice, resize listener is remove, so handleResize is never perform.
|
|
69
|
+
// https://github.com/alibaba/hooks/issues/1910
|
|
70
|
+
if (!listening) {
|
|
71
|
+
window.addEventListener('resize', handleResize);
|
|
72
|
+
}
|
|
73
|
+
var subscriber = function subscriber() {
|
|
74
|
+
setState(info);
|
|
75
|
+
};
|
|
76
|
+
subscribers.add(subscriber);
|
|
77
|
+
return function () {
|
|
78
|
+
subscribers.delete(subscriber);
|
|
79
|
+
if (subscribers.size === 0) {
|
|
80
|
+
window.removeEventListener('resize', handleResize);
|
|
81
|
+
listening = false;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}, []);
|
|
85
|
+
var current = useMemo(function () {
|
|
86
|
+
if (state !== null && state !== void 0 && state.pc) {
|
|
87
|
+
return 'pc';
|
|
88
|
+
}
|
|
89
|
+
if (state !== null && state !== void 0 && state.ipad) {
|
|
90
|
+
return 'ipad';
|
|
91
|
+
}
|
|
92
|
+
return 'phone';
|
|
93
|
+
}, [state]);
|
|
94
|
+
return current;
|
|
95
|
+
}
|
package/es/index.d.ts
CHANGED
|
@@ -61,3 +61,4 @@ export { default as Select } from './components/select';
|
|
|
61
61
|
export { default as Cascader } from './components/cascader';
|
|
62
62
|
export { default as AutoComplete } from './components/auto-complete';
|
|
63
63
|
export { default as Div } from './components/div';
|
|
64
|
+
export { default as Page } from './components/page';
|
package/es/index.js
CHANGED
|
@@ -85,4 +85,5 @@ export { default as Input } from "./components/input";
|
|
|
85
85
|
export { default as Select } from "./components/select";
|
|
86
86
|
export { default as Cascader } from "./components/cascader";
|
|
87
87
|
export { default as AutoComplete } from "./components/auto-complete";
|
|
88
|
-
export { default as Div } from "./components/div";
|
|
88
|
+
export { default as Div } from "./components/div";
|
|
89
|
+
export { default as Page } from "./components/page";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isBrowser: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var isBrowser = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
@@ -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[
|
|
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
|
-
|
|
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
|
};
|
|
@@ -5,7 +5,9 @@ export declare const paginationConfig: {
|
|
|
5
5
|
className: string;
|
|
6
6
|
defaultCurrent: number;
|
|
7
7
|
showTotal: (total: number, range: [number, number]) => string;
|
|
8
|
-
itemRender: (page: number, type: "page" | "
|
|
8
|
+
itemRender: (page: number, type: "page" | "prev" | "next" | "jump-prev" | "jump-next", element: React.ReactNode) => React.ReactNode;
|
|
9
|
+
responsive: boolean;
|
|
10
|
+
size: string;
|
|
9
11
|
};
|
|
10
12
|
declare const Pagination: (props: PaginationProps) => JSX.Element | null;
|
|
11
13
|
export default Pagination;
|
|
@@ -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/
|
|
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") {
|
|
@@ -51,16 +52,72 @@ var paginationConfig = {
|
|
|
51
52
|
className: "materials-grid-paginator",
|
|
52
53
|
defaultCurrent: 1,
|
|
53
54
|
showTotal: (total, range) => `Page ${range[0]} of ${range[1]}`,
|
|
54
|
-
itemRender
|
|
55
|
+
itemRender,
|
|
56
|
+
responsive: true,
|
|
57
|
+
size: "small"
|
|
55
58
|
};
|
|
56
59
|
var Pagination = (props) => {
|
|
57
|
-
|
|
60
|
+
const responsive = (0, import_hooks.useResponsive)();
|
|
58
61
|
const show = (0, import_react.useMemo)(() => {
|
|
59
62
|
return Object.keys(props).length;
|
|
60
63
|
}, [props]);
|
|
61
|
-
|
|
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;
|
|
62
75
|
};
|
|
63
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
|
+
};
|
|
64
121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
65
122
|
0 && (module.exports = {
|
|
66
123
|
paginationConfig
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
padding: 0 20px;
|
|
13
13
|
margin: 0 !important;
|
|
14
14
|
|
|
15
|
-
.
|
|
15
|
+
.pisell-lowcode-pagination-total-text {
|
|
16
16
|
margin-right: auto;
|
|
17
17
|
color: var(--gray-500, #667085);
|
|
18
18
|
/* Text sm/Medium */
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
/* 142.857% */
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.pisell-lowcode-pagination-item {
|
|
27
27
|
position: relative;
|
|
28
28
|
border: none;
|
|
29
29
|
margin: 0;
|
|
@@ -32,37 +32,37 @@
|
|
|
32
32
|
border-right: 0;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
.
|
|
35
|
+
.pisell-lowcode-pagination-jump-prev {
|
|
36
36
|
border: 1px solid #D0D5DD;
|
|
37
37
|
margin: 0;
|
|
38
38
|
border-radius: 0;
|
|
39
39
|
border-right: none;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.pisell-lowcode-pagination-jump-next {
|
|
43
43
|
border: 1px solid #D0D5DD;
|
|
44
44
|
margin: 0;
|
|
45
45
|
border-radius: 0;
|
|
46
46
|
border-right: none;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
.
|
|
49
|
+
.pisell-lowcode-pagination-item-link:hover {
|
|
50
50
|
font-weight: 450 !important;
|
|
51
51
|
color: rgba(0, 0, 0, 0.88) !important;
|
|
52
52
|
|
|
53
|
-
.
|
|
53
|
+
.pisell-lowcode-pagination-item-link-icon {
|
|
54
54
|
font-weight: 450 !important;
|
|
55
55
|
color: rgba(0, 0, 0, 0.88) !important;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.
|
|
59
|
+
.pisell-lowcode-pagination-disabled {}
|
|
60
60
|
|
|
61
|
-
.
|
|
61
|
+
.pisell-lowcode-pagination-item-active:hover {
|
|
62
62
|
border-color: #D0D5DD !important;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
.
|
|
65
|
+
.pisell-lowcode-pagination-item-active {
|
|
66
66
|
a {
|
|
67
67
|
font-weight: 450 !important;
|
|
68
68
|
color: rgba(0, 0, 0, 0.88) !important;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
background-color: rgba(0, 0, 0, 0.06);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.
|
|
75
|
+
.pisell-lowcode-pagination-prev {
|
|
76
76
|
display: flex;
|
|
77
77
|
align-items: center;
|
|
78
78
|
justify-content: center;
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
.
|
|
87
|
+
.pisell-lowcode-pagination-next {
|
|
88
88
|
display: flex;
|
|
89
89
|
align-items: center;
|
|
90
90
|
justify-content: center;
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { ConfigProviderProps as OriginalConfigProviderProps } from "antd/es/config-provider";
|
|
3
|
+
import "dayjs/locale/zh-cn";
|
|
4
|
+
export interface ConfigProviderProps extends OriginalConfigProviderProps {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
declare const ConfigProvider: (props: ConfigProviderProps) => JSX.Element;
|
|
4
8
|
export default ConfigProvider;
|