@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
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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
|
+
};
|
|
@@ -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;
|
|
@@ -2,23 +2,22 @@ var _excluded = ["locale"];
|
|
|
2
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
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
import React from
|
|
6
|
-
import { ConfigProvider as OriginalConfigProvider } from
|
|
7
|
-
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { ConfigProvider as OriginalConfigProvider } from "antd";
|
|
8
7
|
// 由于 antd 组件的默认文案是英文,所以需要修改为中文
|
|
9
|
-
import dayjs from
|
|
10
|
-
import
|
|
11
|
-
import zhCN from
|
|
8
|
+
import dayjs from "dayjs";
|
|
9
|
+
import "dayjs/locale/zh-cn";
|
|
10
|
+
import zhCN from "antd/locale/zh_CN";
|
|
12
11
|
var ConfigProvider = function ConfigProvider(props) {
|
|
13
12
|
var locale = props.locale,
|
|
14
13
|
rest = _objectWithoutProperties(props, _excluded);
|
|
15
14
|
var localeData = locale;
|
|
16
|
-
if (typeof locale ===
|
|
17
|
-
if (locale.toLowerCase() ===
|
|
18
|
-
dayjs.locale(
|
|
15
|
+
if (typeof locale === "string") {
|
|
16
|
+
if (locale.toLowerCase() === "zh-cn") {
|
|
17
|
+
dayjs.locale("zh-cn");
|
|
19
18
|
localeData = zhCN;
|
|
20
|
-
} else if (locale.toLowerCase() ===
|
|
21
|
-
dayjs.locale(
|
|
19
|
+
} else if (locale.toLowerCase() === "en-us") {
|
|
20
|
+
dayjs.locale("en");
|
|
22
21
|
// 默认为英文
|
|
23
22
|
localeData = undefined;
|
|
24
23
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 from "react";
|
|
3
|
+
import ConfigProvider from "../config-provider";
|
|
4
|
+
var theme = {
|
|
5
|
+
components: {
|
|
6
|
+
Table: {
|
|
7
|
+
colorFillContent: "rgba(0, 0, 0, 0.06)",
|
|
8
|
+
colorFillSecondary: "rgba(0, 0, 0, 0.06)",
|
|
9
|
+
colorBorderSecondary: "#EAECF0",
|
|
10
|
+
colorFillAlter: "rgba(0, 0, 0, 0.02)"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
token: {
|
|
14
|
+
colorPrimary: "#7F56D9",
|
|
15
|
+
colorPrimaryBg: "#F9F5FF",
|
|
16
|
+
colorPrimaryBgHover: "#F4EBFF",
|
|
17
|
+
colorPrimaryBorder: "#E9D7FE",
|
|
18
|
+
colorPrimaryBorderHover: "#D6BBFB",
|
|
19
|
+
colorPrimaryHover: "#6941C6",
|
|
20
|
+
colorPrimaryActive: "#53389E",
|
|
21
|
+
colorPrimaryTextHover: "#53389E",
|
|
22
|
+
colorPrimaryText: "#6941C6",
|
|
23
|
+
colorPrimaryTextActive: "#42307D",
|
|
24
|
+
colorSuccess: "#079455",
|
|
25
|
+
colorSuccessBg: "#ECFDF3",
|
|
26
|
+
colorSuccessBgHover: "#DCFAE6",
|
|
27
|
+
colorSuccessBorder: "#ABEFC6",
|
|
28
|
+
colorSuccessBorderHover: "#75E0A7",
|
|
29
|
+
colorSuccessHover: "#067647",
|
|
30
|
+
colorSuccessText: "#067647",
|
|
31
|
+
colorSuccessActive: "#085D3A",
|
|
32
|
+
colorSuccessTextHover: "#085D3A",
|
|
33
|
+
colorSuccessTextActive: "#074D31",
|
|
34
|
+
colorWarning: "#dc6803",
|
|
35
|
+
colorWarningBg: "#FFFAEB",
|
|
36
|
+
colorWarningBgHover: "#FEF0C7",
|
|
37
|
+
colorWarningBorder: "#FEDF89",
|
|
38
|
+
colorWarningBorderHover: "#FEC84B",
|
|
39
|
+
colorWarningHover: "#B54708",
|
|
40
|
+
colorWarningText: "#B54708",
|
|
41
|
+
colorWarningActive: "#93370D",
|
|
42
|
+
colorWarningTextHover: "#93370D",
|
|
43
|
+
colorWarningTextActive: "#7A2E0E",
|
|
44
|
+
colorError: "#d92d20",
|
|
45
|
+
colorErrorBg: "#FEF3F2",
|
|
46
|
+
colorErrorBgHover: "#FEE4E2",
|
|
47
|
+
colorErrorBorder: "#FECDCA",
|
|
48
|
+
colorErrorBorderHover: "#FDA29B",
|
|
49
|
+
colorErrorHover: "#B42318",
|
|
50
|
+
colorErrorText: "#B42318",
|
|
51
|
+
colorErrorActive: "#912018",
|
|
52
|
+
colorErrorTextHover: "#912018",
|
|
53
|
+
colorErrorTextActive: "#7A271A",
|
|
54
|
+
colorInfo: "#1570ef",
|
|
55
|
+
colorInfoBg: "#EFF8FF",
|
|
56
|
+
colorInfoBgHover: "#D1E9FF",
|
|
57
|
+
colorInfoBorder: "#B2DDFF",
|
|
58
|
+
colorInfoBorderHover: "#84CAFF",
|
|
59
|
+
colorInfoHover: "#175CD3",
|
|
60
|
+
colorInfoText: "#175CD3",
|
|
61
|
+
colorInfoActive: "#1849A9",
|
|
62
|
+
colorInfoTextHover: "#1849A9",
|
|
63
|
+
colorInfoTextActive: "#194185",
|
|
64
|
+
colorText: "#101828",
|
|
65
|
+
colorTextSecondary: "#475467",
|
|
66
|
+
colorTextTertiary: "#667085",
|
|
67
|
+
colorTextQuaternary: "#D0D5DD",
|
|
68
|
+
colorBorder: "#D0D5DD",
|
|
69
|
+
colorBorderSecondary: "#EAECF0",
|
|
70
|
+
colorFill: "#D0D5DD",
|
|
71
|
+
colorFillSecondary: "#EAECF0",
|
|
72
|
+
colorFillTertiary: "#F2F4F7",
|
|
73
|
+
colorFillQuaternary: "#F9FAFB",
|
|
74
|
+
colorBgLayout: "#F2F4F7",
|
|
75
|
+
colorBgSpotlight: "#101828",
|
|
76
|
+
colorBgMask: "rgba(0, 0, 0, 0.5)"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var Page = function Page(props) {
|
|
80
|
+
return /*#__PURE__*/React.createElement(ConfigProvider, _extends({}, props, {
|
|
81
|
+
prefixCls: props.prefixCls || "pisell-lowcode",
|
|
82
|
+
theme: props.theme || theme
|
|
83
|
+
}));
|
|
84
|
+
};
|
|
85
|
+
export default Page;
|
|
@@ -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(
|
|
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;
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
color: #98A2B3;
|
|
24
26
|
cursor: pointer;
|
|
25
27
|
}
|
|
26
|
-
.
|
|
28
|
+
.pisell-lowcode-form-item {
|
|
27
29
|
margin-bottom: 0;
|
|
28
30
|
}
|
|
29
31
|
.filter-dropdown-drag-item-right {
|
|
@@ -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;
|