@pointcloud/pcloud-components 0.1.32 → 0.1.34

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 (81) hide show
  1. package/README.md +39 -31
  2. package/dist/esm/AdvancedFilter/FormFilter.d.ts +4 -4
  3. package/dist/esm/AdvancedFilter/index.d.ts +5 -5
  4. package/dist/esm/AdvancedFilter/interface.d.ts +101 -101
  5. package/dist/esm/AnimatedScrollList/index.d.ts +7 -7
  6. package/dist/esm/AnimatedScrollList/interface.d.ts +71 -71
  7. package/dist/esm/AspectRatio/index.d.ts +9 -9
  8. package/dist/esm/AuthComponent/index.d.ts +3 -3
  9. package/dist/esm/AuthComponent/interface.d.ts +24 -24
  10. package/dist/esm/CRUD/config.d.ts +2 -0
  11. package/dist/esm/CRUD/config.js +21 -0
  12. package/dist/esm/CRUD/index.d.ts +98 -0
  13. package/dist/esm/CRUD/index.js +669 -0
  14. package/dist/esm/CRUD/index.less +140 -0
  15. package/dist/esm/CRUD/toolbar.d.ts +16 -0
  16. package/dist/esm/CRUD/toolbar.js +249 -0
  17. package/dist/esm/ColorPicker/index.d.ts +17 -18
  18. package/dist/esm/ColorPicker/interface.d.ts +164 -164
  19. package/dist/esm/ConfigProvider/index.d.ts +6 -6
  20. package/dist/esm/ConfigProvider/index.js +7 -13
  21. package/dist/esm/ConfigProvider/interface.d.ts +9 -9
  22. package/dist/esm/ContextMenu/index.d.ts +28 -28
  23. package/dist/esm/DCascader/index.d.ts +24 -24
  24. package/dist/esm/DForm/DItem/index.d.ts +5 -5
  25. package/dist/esm/DForm/DItem/itemType.d.ts +123 -119
  26. package/dist/esm/DForm/DItem/itemsRender.d.ts +47 -45
  27. package/dist/esm/DForm/DItem/itemsRender.js +6 -0
  28. package/dist/esm/DForm/helper.d.ts +8 -8
  29. package/dist/esm/DForm/index.d.ts +29 -29
  30. package/dist/esm/DInput/index.d.ts +19 -19
  31. package/dist/esm/DModal/index.d.ts +19 -18
  32. package/dist/esm/DModal/index.js +11 -9
  33. package/dist/esm/DModal/interface.d.ts +8 -14
  34. package/dist/esm/DRangePicker/index.d.ts +7 -0
  35. package/dist/esm/DRangePicker/index.js +24 -0
  36. package/dist/esm/DRangePicker/index.less +30 -0
  37. package/dist/esm/DRangePicker/interface.d.ts +5 -0
  38. package/dist/esm/DRangePicker/interface.js +1 -0
  39. package/dist/esm/DSelect/index.d.ts +24 -24
  40. package/dist/esm/DTable/index.d.ts +62 -46
  41. package/dist/esm/DTable/index.js +43 -13
  42. package/dist/esm/DTreeSelect/index.d.ts +16 -16
  43. package/dist/esm/DUpload/helper.d.ts +107 -107
  44. package/dist/esm/DUpload/index.d.ts +55 -55
  45. package/dist/esm/ErrorBoundary/index.d.ts +5 -6
  46. package/dist/esm/IPAddress/index.d.ts +20 -20
  47. package/dist/esm/IconFont/index.d.ts +17 -17
  48. package/dist/esm/InfiniteScrollList/index.d.ts +63 -63
  49. package/dist/esm/LabelValue/index.d.ts +16 -16
  50. package/dist/esm/LabelValue/interface.d.ts +39 -39
  51. package/dist/esm/Loading/hooks/useLoading.d.ts +6 -6
  52. package/dist/esm/Loading/index.d.ts +10 -10
  53. package/dist/esm/Loading/interface.d.ts +23 -23
  54. package/dist/esm/Loading/loading.d.ts +9 -8
  55. package/dist/esm/Loading/loading.js +48 -23
  56. package/dist/esm/Loading/styles/index.less +37 -25
  57. package/dist/esm/LoginForm/defaultConfig.d.ts +4 -4
  58. package/dist/esm/LoginForm/index.d.ts +21 -21
  59. package/dist/esm/ModalForm/index.d.ts +13 -11
  60. package/dist/esm/ModalForm/index.js +76 -7
  61. package/dist/esm/NoData/index.d.ts +4 -5
  62. package/dist/esm/NoData/interface.d.ts +13 -13
  63. package/dist/esm/OrgTree/index.d.ts +5 -5
  64. package/dist/esm/OrgTree/interface.d.ts +41 -41
  65. package/dist/esm/PictureCard/index.d.ts +16 -16
  66. package/dist/esm/RCropper/handler.d.ts +16 -16
  67. package/dist/esm/RCropper/index.d.ts +4 -4
  68. package/dist/esm/RCropper/interface.d.ts +70 -70
  69. package/dist/esm/RCropper/svgIcons.d.ts +28 -28
  70. package/dist/esm/RCropper/toolbar.d.ts +5 -5
  71. package/dist/esm/RndDrag/index.d.ts +5 -6
  72. package/dist/esm/ScrollNumber/index.d.ts +7 -8
  73. package/dist/esm/SignaturePad/index.d.ts +32 -32
  74. package/dist/esm/TypewriterText/index.d.ts +5 -5
  75. package/dist/esm/TypewriterText/interface.d.ts +42 -42
  76. package/dist/esm/WordCloud/index.d.ts +10 -11
  77. package/dist/esm/index.d.ts +66 -62
  78. package/dist/esm/index.js +3 -1
  79. package/dist/umd/pcloud-components.min.css +1 -1
  80. package/dist/umd/pcloud-components.min.js +1 -1
  81. package/package.json +15 -5
@@ -0,0 +1,140 @@
1
+ @import '../commonStyle/index.less';
2
+
3
+ .@{prefix}-crud {
4
+ height: 100%;
5
+ display: flex;
6
+ flex-direction: column;
7
+
8
+ &.fullscreen {
9
+ position: fixed;
10
+ inset: 0;
11
+ z-index: 10000;
12
+ padding: 10px;
13
+ background-color: #fff;
14
+ }
15
+
16
+ &-action-tool-bar {
17
+ display: flex;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ &-action-bar,
24
+ &-tool-bar {
25
+ display: flex;
26
+ justify-content: flex-start;
27
+ align-items: center;
28
+ gap: 8px;
29
+ }
30
+
31
+ .tool-icon {
32
+ cursor: pointer;
33
+ padding: 5px;
34
+ border: 1px solid #e3e3e3;
35
+ border-radius: 50%;
36
+ font-size: 15px;
37
+
38
+ &:hover {
39
+ border-color: #2e4dd9;
40
+ color: #2e4dd9;
41
+ }
42
+
43
+ &.rotating {
44
+ animation: rotating 0.5s linear;
45
+ }
46
+ }
47
+
48
+ // column setting popup
49
+ .column-setting-popup {
50
+ .ant-popover-title {
51
+ padding-right: 10px;
52
+ padding-left: 10px;
53
+ }
54
+
55
+ .ant-popover-inner-content {
56
+ width: 100%;
57
+ padding: 8px 0 4px;
58
+ }
59
+
60
+ .column-setting-title {
61
+ display: flex;
62
+ justify-content: space-between;
63
+ align-items: center;
64
+ }
65
+
66
+ .column-setting-list {
67
+ display: flex;
68
+ flex-direction: column;
69
+ max-height: 300px;
70
+ overflow-y: auto;
71
+ margin-bottom: 0;
72
+ padding-inline-start: 0;
73
+ list-style: none;
74
+ padding: 5px 0;
75
+ }
76
+
77
+ .column-setting-list::-webkit-scrollbar {
78
+ width: 5px;
79
+ }
80
+
81
+ .column-setting-list::-webkit-scrollbar-track {
82
+ border-radius: 3px;
83
+ }
84
+
85
+ .column-setting-list::-webkit-scrollbar-thumb {
86
+ width: 5px;
87
+ border-radius: 3px;
88
+ background: #8b8b8b;
89
+ }
90
+
91
+ .column-setting-item {
92
+ display: flex;
93
+ align-items: center;
94
+ padding: 8px 10px;
95
+ user-select: none;
96
+ border-radius: 4px;
97
+ margin-bottom: 2px;
98
+ min-height: 32px;
99
+
100
+ &:hover {
101
+ background-color: #f5f5f5;
102
+ }
103
+ }
104
+
105
+ .column-drag-handle {
106
+ cursor: move;
107
+ margin-right: 8px;
108
+ display: flex;
109
+ align-items: center;
110
+ color: #666;
111
+ }
112
+
113
+ .column-setting-footer {
114
+ display: flex;
115
+ justify-content: flex-end;
116
+ padding-top: 4px;
117
+ border-top: 1px solid #f0f0f0;
118
+ }
119
+ }
120
+
121
+ &-table {
122
+ flex: 1;
123
+ }
124
+
125
+ &-modalform-view {
126
+ .ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
127
+ display: none;
128
+ }
129
+ }
130
+
131
+ @keyframes rotating {
132
+ from {
133
+ transform: rotate(0deg);
134
+ }
135
+
136
+ to {
137
+ transform: rotate(360deg);
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import type { CheckboxValueType } from 'antd/es/checkbox/Group';
3
+ import type { DColumnType } from '../DTable';
4
+ export interface ToolbarProps {
5
+ className?: string;
6
+ fullScreen?: boolean;
7
+ columns?: DColumnType[];
8
+ onActions?: {
9
+ setFullScreen?: (fullScreen: boolean) => void;
10
+ handleRefresh?: () => void;
11
+ onColumnSettingChanged?: (checkedList: CheckboxValueType[], sortedColumns?: DColumnType[]) => void;
12
+ };
13
+ }
14
+ declare function Toolbar({ className, fullScreen, columns, onActions }: ToolbarProps): import("react/jsx-runtime").JSX.Element;
15
+ declare const _default: import("react").MemoExoticComponent<typeof Toolbar>;
16
+ export default _default;
@@ -0,0 +1,249 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import { memo, useState, useRef, useEffect, useMemo } from 'react';
5
+ import classNames from 'classnames';
6
+ import { Popover, Checkbox, Button } from 'antd';
7
+ import { ReloadOutlined, FullscreenOutlined, FullscreenExitOutlined, BarsOutlined, HolderOutlined } from '@ant-design/icons';
8
+ import Sortable from 'sortablejs';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
+ function Toolbar(_ref) {
13
+ var className = _ref.className,
14
+ fullScreen = _ref.fullScreen,
15
+ _ref$columns = _ref.columns,
16
+ columns = _ref$columns === void 0 ? [] : _ref$columns,
17
+ onActions = _ref.onActions;
18
+ var timer = useRef(null);
19
+ var sortableInstance = useRef(null);
20
+ var sortableContainer = useRef(null);
21
+ var containerNode = useRef(null);
22
+ var _useState = useState(false),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ columnSettingVisible = _useState2[0],
25
+ setColumnSettingVisible = _useState2[1];
26
+ var _useState3 = useState(false),
27
+ _useState4 = _slicedToArray(_useState3, 2),
28
+ rotating = _useState4[0],
29
+ setRotating = _useState4[1];
30
+ var reloadIconClass = useMemo(function () {
31
+ return classNames('tool-icon', {
32
+ rotating: rotating
33
+ });
34
+ }, [rotating]);
35
+ var checkedValues = useMemo(function () {
36
+ return columns === null || columns === void 0 ? void 0 : columns.map(function (item) {
37
+ return item.title;
38
+ }).filter(function (title) {
39
+ return title !== undefined;
40
+ });
41
+ }, [columns]);
42
+ var _useState5 = useState({
43
+ sortedColumns: columns,
44
+ checkedList: checkedValues
45
+ }),
46
+ _useState6 = _slicedToArray(_useState5, 2),
47
+ columnSetting = _useState6[0],
48
+ setColumnSetting = _useState6[1];
49
+ var _ref2 = onActions || {},
50
+ setFullScreen = _ref2.setFullScreen,
51
+ handleRefresh = _ref2.handleRefresh;
52
+ var handleFullScreen = function handleFullScreen() {
53
+ var newFullscreen = !fullScreen;
54
+ setFullScreen === null || setFullScreen === void 0 || setFullScreen(newFullscreen);
55
+ };
56
+ var handleReload = function handleReload() {
57
+ setRotating(true);
58
+ handleRefresh === null || handleRefresh === void 0 || handleRefresh();
59
+ if (timer.current) clearTimeout(timer.current);
60
+ timer.current = window.setTimeout(function () {
61
+ setRotating(false);
62
+ }, 500);
63
+ };
64
+ var handleConfirm = function handleConfirm() {
65
+ var _onActions$onColumnSe;
66
+ setColumnSettingVisible(false);
67
+ onActions === null || onActions === void 0 || (_onActions$onColumnSe = onActions.onColumnSettingChanged) === null || _onActions$onColumnSe === void 0 || _onActions$onColumnSe.call(onActions, columnSetting.checkedList, columnSetting.sortedColumns);
68
+ };
69
+ var handleReset = function handleReset() {
70
+ setColumnSetting({
71
+ sortedColumns: columns,
72
+ checkedList: checkedValues
73
+ });
74
+ };
75
+ var onCheckAllChange = function onCheckAllChange(e) {
76
+ var checked = e.target.checked;
77
+ if (checked) {
78
+ // 全选所有列标题
79
+ var allValues = columns.map(function (item) {
80
+ return item.title;
81
+ }).filter(function (title) {
82
+ return title !== undefined;
83
+ });
84
+ setColumnSetting(function (prev) {
85
+ return _objectSpread(_objectSpread({}, prev), {}, {
86
+ checkedList: allValues
87
+ });
88
+ });
89
+ } else {
90
+ // 取消全选
91
+ setColumnSetting(function (prev) {
92
+ return _objectSpread(_objectSpread({}, prev), {}, {
93
+ checkedList: []
94
+ });
95
+ });
96
+ }
97
+ };
98
+ useEffect(function () {
99
+ return function () {
100
+ if (timer.current) clearTimeout(timer.current);
101
+ };
102
+ }, []);
103
+ useEffect(function () {
104
+ if (columnSettingVisible && !sortableInstance.current && sortableContainer.current) {
105
+ sortableInstance.current = Sortable.create(sortableContainer.current, {
106
+ animation: 150,
107
+ handle: '.column-drag-handle',
108
+ draggable: '.column-setting-item',
109
+ direction: 'vertical',
110
+ onEnd: function onEnd(_ref3) {
111
+ var oldIndex = _ref3.oldIndex,
112
+ newIndex = _ref3.newIndex;
113
+ if (oldIndex !== undefined && newIndex !== undefined && oldIndex !== newIndex) {
114
+ // 更新临时列顺序
115
+ var newColumns = _toConsumableArray(columnSetting.sortedColumns);
116
+ newColumns.splice(newIndex, 0, newColumns.splice(oldIndex, 1)[0]);
117
+ setColumnSetting(function (prev) {
118
+ return _objectSpread(_objectSpread({}, prev), {}, {
119
+ sortedColumns: newColumns
120
+ });
121
+ });
122
+ }
123
+ }
124
+ });
125
+ } else if (!columnSettingVisible && sortableInstance.current) {
126
+ sortableInstance.current.destroy();
127
+ sortableInstance.current = null;
128
+ }
129
+ return function () {
130
+ if (sortableInstance.current) {
131
+ sortableInstance.current.destroy();
132
+ sortableInstance.current = null;
133
+ }
134
+ };
135
+ }, [columns, columnSettingVisible, columnSetting.sortedColumns]);
136
+ var indeterminate = useMemo(function () {
137
+ return !!columnSetting.checkedList.length && columnSetting.checkedList.length < columns.length;
138
+ }, [columnSetting.checkedList, columns.length]);
139
+ var checkAll = useMemo(function () {
140
+ return columnSetting.checkedList.length === columns.length;
141
+ }, [columnSetting.checkedList, columns.length]);
142
+ var popoverContent = useMemo(function () {
143
+ var _columnSetting$sorted;
144
+ return /*#__PURE__*/_jsxs(_Fragment, {
145
+ children: [/*#__PURE__*/_jsx("ul", {
146
+ ref: sortableContainer,
147
+ className: "column-setting-list",
148
+ children: (_columnSetting$sorted = columnSetting.sortedColumns) === null || _columnSetting$sorted === void 0 ? void 0 : _columnSetting$sorted.map(function (item) {
149
+ var isChecked = columnSetting.checkedList.includes(item === null || item === void 0 ? void 0 : item.title);
150
+ return /*#__PURE__*/_jsxs("li", {
151
+ className: "column-setting-item",
152
+ children: [/*#__PURE__*/_jsx("div", {
153
+ className: "column-drag-handle",
154
+ children: /*#__PURE__*/_jsx(HolderOutlined, {})
155
+ }), /*#__PURE__*/_jsx(Checkbox, {
156
+ checked: isChecked,
157
+ onChange: function onChange(e) {
158
+ var newCheckedList = e.target.checked ? [].concat(_toConsumableArray(columnSetting.checkedList), [item === null || item === void 0 ? void 0 : item.title]).filter(function (title) {
159
+ return title !== undefined;
160
+ }) : columnSetting.checkedList.filter(function (title) {
161
+ return title !== (item === null || item === void 0 ? void 0 : item.title);
162
+ });
163
+ setColumnSetting(function (prev) {
164
+ return _objectSpread(_objectSpread({}, prev), {}, {
165
+ checkedList: newCheckedList
166
+ });
167
+ });
168
+ },
169
+ value: item === null || item === void 0 ? void 0 : item.title,
170
+ children: item === null || item === void 0 ? void 0 : item.title
171
+ })]
172
+ }, (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.dataIndex));
173
+ })
174
+ }), /*#__PURE__*/_jsxs("div", {
175
+ className: "column-setting-footer",
176
+ children: [/*#__PURE__*/_jsx(Button, {
177
+ type: "link",
178
+ style: {
179
+ color: 'inherit'
180
+ },
181
+ onClick: function onClick() {
182
+ return setColumnSettingVisible(false);
183
+ },
184
+ children: "\u53D6\u6D88"
185
+ }), /*#__PURE__*/_jsx(Button, {
186
+ type: "link",
187
+ onClick: handleConfirm,
188
+ children: "\u786E\u5B9A"
189
+ })]
190
+ })]
191
+ });
192
+ }, [columnSetting.sortedColumns, columnSetting.checkedList, handleConfirm]);
193
+
194
+ // 使用useMemo优化Popover标题,避免不必要的重渲染
195
+ var popoverTitle = useMemo(function () {
196
+ return /*#__PURE__*/_jsxs("div", {
197
+ className: "column-setting-title",
198
+ children: [/*#__PURE__*/_jsx(Checkbox, {
199
+ indeterminate: indeterminate,
200
+ onChange: onCheckAllChange,
201
+ checked: checkAll,
202
+ children: "\u5168\u9009"
203
+ }), /*#__PURE__*/_jsx(Button, {
204
+ type: "link",
205
+ size: "small",
206
+ onClick: handleReset,
207
+ children: "\u91CD\u7F6E"
208
+ })]
209
+ });
210
+ }, [indeterminate, onCheckAllChange, checkAll, handleReset]);
211
+ return /*#__PURE__*/_jsxs("div", {
212
+ className: className,
213
+ ref: containerNode,
214
+ children: [/*#__PURE__*/_jsx(ReloadOutlined, {
215
+ className: reloadIconClass,
216
+ title: "\u5237\u65B0",
217
+ onClick: handleReload
218
+ }), fullScreen ? /*#__PURE__*/_jsx(FullscreenExitOutlined, {
219
+ className: "tool-icon",
220
+ title: "\u53D6\u6D88\u5168\u5C4F",
221
+ onClick: handleFullScreen
222
+ }) : /*#__PURE__*/_jsx(FullscreenOutlined, {
223
+ className: "tool-icon",
224
+ title: "\u5168\u5C4F",
225
+ onClick: handleFullScreen
226
+ }), /*#__PURE__*/_jsx(Popover, {
227
+ open: columnSettingVisible,
228
+ title: popoverTitle,
229
+ trigger: "click",
230
+ placement: "bottomRight",
231
+ onOpenChange: function onOpenChange(open) {
232
+ return setColumnSettingVisible(open);
233
+ },
234
+ getPopupContainer: function getPopupContainer(triggerNode) {
235
+ return triggerNode.parentElement;
236
+ },
237
+ overlayClassName: "column-setting-popup",
238
+ content: popoverContent,
239
+ children: /*#__PURE__*/_jsx(BarsOutlined, {
240
+ className: "tool-icon",
241
+ title: "\u5217\u8BBE\u7F6E",
242
+ onClick: function onClick() {
243
+ return setColumnSettingVisible(true);
244
+ }
245
+ })
246
+ })]
247
+ });
248
+ }
249
+ export default /*#__PURE__*/memo(Toolbar);
@@ -1,18 +1,17 @@
1
- /// <reference types="react" />
2
- import { ColorPickerProps, TwitterPickerProps, HuePickerProps, AlphaPickerProps, BlockPickerProps, ChromePickerProps, CompactPickerProps, CirclePickerProps, SliderPickerProps } from './interface';
3
- import './index.less';
4
- declare const ColorPicker: {
5
- (props: ColorPickerProps): JSX.Element;
6
- PSPicker(props: ColorPickerProps & {
7
- title?: string;
8
- }): JSX.Element;
9
- SliderPicker(props: SliderPickerProps): JSX.Element;
10
- AlphaPicker(props: AlphaPickerProps): JSX.Element;
11
- BlockPicker(props: BlockPickerProps): JSX.Element;
12
- ChromePicker(props: ChromePickerProps): JSX.Element;
13
- CirclePicker(props: CirclePickerProps): JSX.Element;
14
- CompactPicker(props: CompactPickerProps): JSX.Element;
15
- HuePicker(props: HuePickerProps): JSX.Element;
16
- TwitterPicker(props: TwitterPickerProps): JSX.Element;
17
- };
18
- export default ColorPicker;
1
+ import { ColorPickerProps, TwitterPickerProps, HuePickerProps, AlphaPickerProps, BlockPickerProps, ChromePickerProps, CompactPickerProps, CirclePickerProps, SliderPickerProps } from './interface';
2
+ import './index.less';
3
+ declare const ColorPicker: {
4
+ (props: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
5
+ PSPicker(props: ColorPickerProps & {
6
+ title?: string;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ SliderPicker(props: SliderPickerProps): import("react/jsx-runtime").JSX.Element;
9
+ AlphaPicker(props: AlphaPickerProps): import("react/jsx-runtime").JSX.Element;
10
+ BlockPicker(props: BlockPickerProps): import("react/jsx-runtime").JSX.Element;
11
+ ChromePicker(props: ChromePickerProps): import("react/jsx-runtime").JSX.Element;
12
+ CirclePicker(props: CirclePickerProps): import("react/jsx-runtime").JSX.Element;
13
+ CompactPicker(props: CompactPickerProps): import("react/jsx-runtime").JSX.Element;
14
+ HuePicker(props: HuePickerProps): import("react/jsx-runtime").JSX.Element;
15
+ TwitterPicker(props: TwitterPickerProps): import("react/jsx-runtime").JSX.Element;
16
+ };
17
+ export default ColorPicker;