@para-ui/core 4.0.33 → 4.0.37

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 (150) hide show
  1. package/Anchor/anchorMenu/index.d.ts +16 -0
  2. package/Anchor/index.d.ts +4 -0
  3. package/Anchor/index.js +394 -0
  4. package/Anchor/lang/en_US.d.ts +4 -0
  5. package/Anchor/lang/index.d.ts +9 -0
  6. package/Anchor/lang/zh_CN.d.ts +4 -0
  7. package/Anchor/type.d.ts +42 -0
  8. package/Argv/batchEdit/index.d.ts +18 -0
  9. package/Argv/dataGenerator/config.d.ts +16 -0
  10. package/Argv/dataGenerator/index.d.ts +24 -0
  11. package/Argv/index.d.ts +36 -0
  12. package/Argv/index.js +738 -0
  13. package/Argv/lang/en_US.d.ts +15 -0
  14. package/Argv/lang/index.d.ts +31 -0
  15. package/Argv/lang/zh_CN.d.ts +15 -0
  16. package/AutoBox/index.js +1 -1
  17. package/AutoButton/index.js +1 -1
  18. package/AutoTips/index.js +1 -1
  19. package/Breadcrumbs/index.js +1 -1
  20. package/Button/index.d.ts +2 -2
  21. package/Button/index.js +4 -4
  22. package/ButtonGroup/index.d.ts +4 -0
  23. package/ButtonGroup/index.js +53 -37
  24. package/Card/index.js +3 -3
  25. package/Carousel/index.js +1 -1
  26. package/Cascader/index.js +6 -7
  27. package/Checkbox/index.js +1 -1
  28. package/CheckboxGroup/index.js +1 -1
  29. package/ComboSelect/index.js +7 -8
  30. package/CopyText/index.js +1 -1
  31. package/CycleSelector/index.js +2 -5
  32. package/DatePicker/index.js +2 -5
  33. package/Descriptions/index.js +1 -1
  34. package/Desktop/index.js +1 -1
  35. package/DragVerify/index.js +1 -1
  36. package/Drawer/index.js +1 -1
  37. package/DynamicMultiBox/index.js +7 -8
  38. package/Form/index.js +7 -8
  39. package/FormItem/index.js +7 -8
  40. package/FunctionModal/index.js +3 -3
  41. package/Help/index.js +1 -1
  42. package/Image/index.js +3 -4
  43. package/InputCode/index.js +1 -1
  44. package/InputLang/index.js +1 -1
  45. package/InputNumber/index.js +1 -1
  46. package/Label/index.js +1 -1
  47. package/Menu/index.js +1 -1
  48. package/Modal/index.js +1 -1
  49. package/MultiBox/index.js +1 -1
  50. package/OperateBtn/index.js +1 -1
  51. package/PageHeader/index.js +1 -1
  52. package/Pagination/index.js +1 -1
  53. package/PopConfirm/index.js +1 -1
  54. package/PopMenu/index.js +1 -1
  55. package/Popover/index.js +1 -1
  56. package/Progress/index.js +1 -1
  57. package/Querying/index.js +4 -4
  58. package/QuickReply/index.js +2 -2
  59. package/README.md +24 -0
  60. package/Radio/index.js +1 -1
  61. package/RadioGroup/index.js +1 -1
  62. package/RangeInput/index.js +1 -1
  63. package/Search/index.js +1 -1
  64. package/Select/index.js +1 -1
  65. package/SelectInput/index.js +1 -1
  66. package/Selector/index.js +276 -322
  67. package/Selector/interface.d.ts +2 -1
  68. package/SelectorPicker/index.js +5 -5
  69. package/SingleBox/index.js +3 -3
  70. package/Slider/index.js +1 -1
  71. package/SortBox/index.js +1 -1
  72. package/Stepper/index.js +2 -2
  73. package/Switch/index.js +3 -3
  74. package/Table/index.js +424 -489
  75. package/Tabs/index.js +3 -3
  76. package/Tag/index.js +54 -83
  77. package/TextEditor/index.js +1 -1
  78. package/TextField/index.js +1 -1
  79. package/TimePicker/index.js +2 -5
  80. package/Timeline/index.js +21 -15
  81. package/Title/index.js +1 -1
  82. package/ToggleButton/ToggleButtonGroup.d.ts +4 -2
  83. package/ToggleButton/index.d.ts +4 -3
  84. package/ToggleButton/index.js +28 -13
  85. package/Tooltip/index.js +1 -1
  86. package/Transfer/index.js +1 -1
  87. package/Tree/index.js +6 -7
  88. package/Upload/index.js +83 -28
  89. package/Upload/interface.d.ts +4 -0
  90. package/Upload/util.d.ts +32 -0
  91. package/Utils/index.d.ts +7 -0
  92. package/Utils/index.js +10 -1
  93. package/Utils/type.d.ts +1 -0
  94. package/_verture/{Portal-edd94cac.js → Portal-42560ff0.js} +1 -2
  95. package/_verture/{defineProperty-6f62bb2a.js → defineProperty-f0e15205.js} +10 -2
  96. package/_verture/{index-8752ccab.js → index-086e9a6d.js} +4 -5
  97. package/_verture/{index-567b5779.js → index-5f0bfdcf.js} +3 -4
  98. package/_verture/{index-94e24006.js → index-8ac46bd9.js} +1 -1
  99. package/_verture/{modalContext-10f0c5aa.js → modalContext-205db1f4.js} +1 -1
  100. package/_verture/{tslib.es6-55ed4bd2.js → tslib.es6-f43aa41d.js} +1 -1
  101. package/index.d.ts +4 -0
  102. package/index.js +26 -22
  103. package/locale/en-US.d.ts +17 -0
  104. package/locale/index.d.ts +34 -0
  105. package/locale/index.js +34 -0
  106. package/locale/zh-CN.d.ts +17 -0
  107. package/package.json +8 -5
  108. package/umd/Anchor.js +43 -0
  109. package/umd/Argv.js +43 -0
  110. package/umd/AutoButton.js +1 -1
  111. package/umd/Button.js +1 -1
  112. package/umd/ButtonGroup.js +5 -5
  113. package/umd/ComboSelect.js +2 -2
  114. package/umd/CopyText.js +3 -3
  115. package/umd/CycleSelector.js +3 -3
  116. package/umd/DatePicker.js +1 -1
  117. package/umd/Descriptions.js +1 -1
  118. package/umd/Desktop.js +3 -3
  119. package/umd/Drawer.js +1 -1
  120. package/umd/DynamicMultiBox.js +3 -3
  121. package/umd/Form.js +2 -2
  122. package/umd/FormItem.js +3 -3
  123. package/umd/FunctionModal.js +1 -1
  124. package/umd/InputCode.js +3 -3
  125. package/umd/InputLang.js +3 -3
  126. package/umd/Message.js +15 -16
  127. package/umd/Modal.js +1 -1
  128. package/umd/MultiBox.js +3 -3
  129. package/umd/OperateBtn.js +1 -1
  130. package/umd/PageHeader.js +1 -1
  131. package/umd/Pagination.js +3 -3
  132. package/umd/PopConfirm.js +1 -1
  133. package/umd/QuickReply.js +3 -3
  134. package/umd/Search.js +3 -3
  135. package/umd/Selector.js +4 -4
  136. package/umd/SelectorPicker.js +6 -6
  137. package/umd/SingleBox.js +3 -3
  138. package/umd/Table.js +2 -2
  139. package/umd/Tabs.js +1 -1
  140. package/umd/TextField.js +2 -2
  141. package/umd/TimePicker.js +1 -1
  142. package/umd/ToggleButton.js +6 -6
  143. package/umd/Transfer.js +2 -2
  144. package/umd/Upload.js +2 -2
  145. package/umd/Utils.js +1 -1
  146. package/umd/locale.js +1 -1
  147. package/_verture/typeof-adeedc13.js +0 -11
  148. /package/_verture/{index-c8cb6751.js → index-0f5ee6f7.js} +0 -0
  149. /package/_verture/{index-e229330e.js → index-4c5d6cd7.js} +0 -0
  150. /package/_verture/{typeof-4646b22c.js → typeof-6ec38efd.js} +0 -0
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { AnchorItem, AnchorMap } from '../type';
3
+ import './index.scss';
4
+ interface IProps {
5
+ data: AnchorItem;
6
+ currentAnchorId?: string;
7
+ handleClick?: (id: string) => void;
8
+ level?: number;
9
+ isTree?: boolean;
10
+ anchorMap?: AnchorMap;
11
+ setAnchorMap?: (map: AnchorMap) => void;
12
+ customPrefixIcon?: React.ReactNode;
13
+ onlyOneLevel?: boolean;
14
+ }
15
+ declare const AnchorMenu: (props: IProps) => import("react/jsx-runtime").JSX.Element;
16
+ export default AnchorMenu;
@@ -0,0 +1,4 @@
1
+ import { AnchorProps } from './type';
2
+ import './index.scss';
3
+ declare const Anchor: (props: AnchorProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default Anchor;
@@ -0,0 +1,394 @@
1
+ import { _ as __awaiter } from '../_verture/tslib.es6-f43aa41d.js';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useEffect, useMemo, createElement, useState, useRef } from 'react';
4
+ import clsx from 'clsx';
5
+ import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
6
+ import Down from '@para-ui/icons/Down';
7
+ import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
8
+ import AutoTips from '../AutoTips/index.js';
9
+ import ToRight from '@para-ui/icons/ToRight';
10
+ import ToLeft from '@para-ui/icons/ToLeft';
11
+ import PreviewOpen from '@para-ui/icons/PreviewOpen';
12
+ import { Search } from '../Search/index.js';
13
+ import { u as useFormatMessage } from '../_verture/useFormatMessage-1fc7c957.js';
14
+ import { throttle, debounce } from '@paraview/lib';
15
+ import '../Tooltip/index.js';
16
+ import 'rc-tooltip';
17
+ import 'rc-tooltip/lib/placements';
18
+ import '@para-ui/icons/Forbid';
19
+ import '../TextField/index.js';
20
+ import '../Label/index.js';
21
+ import '../Help/index.js';
22
+ import '@para-ui/icons/Help';
23
+ import '@para-ui/icons/PreviewClose';
24
+ import '@para-ui/icons/CloseCircleF';
25
+ import '../Loading/index.js';
26
+ import '@para-ui/icons/LoadingF';
27
+ import '../HelperText/index.js';
28
+ import '../_verture/useGlobalProps-4ae1a007.js';
29
+ import '../_verture/index-ca413216.js';
30
+ import '../_verture/index-bde7aabe.js';
31
+ import 'rc-dropdown';
32
+ import '../_verture/usePopupContainer-635f66f4.js';
33
+ import 'dayjs';
34
+ import '@para-ui/icons/Search';
35
+
36
+ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.anchor-menu-item {\n width: 100%;\n height: 30px;\n display: flex;\n align-items: center;\n font-size: 14px;\n font-weight: 400;\n padding: 0 4px;\n}\n.anchor-menu-item:hover {\n background: rgb(247, 248, 250);\n}\n.anchor-menu-item.active {\n color: rgb(46, 101, 230);\n}\n.anchor-menu-item.active .icon-point {\n background: rgb(46, 101, 230);\n}\n.anchor-menu-item.expanded .icon-down {\n transform: rotate(0deg);\n}\n.anchor-menu-item .indent {\n padding-left: 10px;\n}\n.anchor-menu-item .item-content {\n width: 100%;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n flex: 1 1;\n overflow: hidden;\n}\n.anchor-menu-item .item-content .title {\n overflow: hidden;\n height: 20px;\n line-height: 20px;\n cursor: pointer;\n flex: 1 1;\n white-space: nowrap;\n height: 30px;\n display: flex;\n align-items: center;\n}\n.anchor-menu-item .icon {\n flex-shrink: 0;\n font-size: 14px;\n width: 14px;\n height: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.anchor-menu-item .btn-down {\n height: 30px;\n padding-right: 6px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n.anchor-menu-item .btn-down.none {\n cursor: none;\n}\n.anchor-menu-item .icon-down {\n transform: rotate(-90deg);\n transition: 0.3s;\n color: rgb(29, 33, 38);\n cursor: pointer;\n}\n.anchor-menu-item .icon-down svg {\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.anchor-menu-item .icon-point {\n width: 4px;\n height: 4px;\n background: rgb(161, 168, 179);\n border-radius: 50%;\n}";
37
+ styleInject(css_248z$1);
38
+
39
+ const AnchorMenu = props => {
40
+ var _a, _b;
41
+ const {
42
+ data,
43
+ currentAnchorId,
44
+ handleClick,
45
+ level = 0,
46
+ isTree = false,
47
+ anchorMap = {},
48
+ setAnchorMap,
49
+ customPrefixIcon,
50
+ onlyOneLevel
51
+ } = props;
52
+ const {
53
+ id
54
+ } = data;
55
+ const isActive = String(id) === String(currentAnchorId);
56
+ useEffect(() => {}, []);
57
+ const indentMemo = useMemo(() => {
58
+ // 通过level控制缩进,生成多个div
59
+ const result = [];
60
+ for (let i = 0; i < level; i++) {
61
+ result.push(jsx("div", {
62
+ className: "indent"
63
+ }, i));
64
+ }
65
+ return result;
66
+ }, [level]);
67
+ const handleExpanded = (event, id) => {
68
+ // 防止冒泡
69
+ event.stopPropagation();
70
+ const map = anchorMap[id];
71
+ map.expanded = !map.expanded;
72
+ setAnchorMap === null || setAnchorMap === void 0 ? void 0 : setAnchorMap(Object.assign({}, anchorMap));
73
+ };
74
+ const contentMemo = useMemo(() => {
75
+ const {
76
+ name,
77
+ id
78
+ } = data;
79
+ const hasChildren = data.children && data.children.length > 0;
80
+ const icon = isTree ? hasChildren ? jsx("div", Object.assign({
81
+ className: "btn-down",
82
+ onClick: e => handleExpanded(e, id)
83
+ }, {
84
+ children: jsx("div", Object.assign({
85
+ className: "icon icon-down"
86
+ }, {
87
+ children: jsx(Down, {})
88
+ }))
89
+ })) : jsx("div", {
90
+ className: "icon mr-6"
91
+ }) : customPrefixIcon ? customPrefixIcon : jsx(Point, {});
92
+ return jsxs("div", Object.assign({
93
+ className: "item-content",
94
+ onClick: e => {}
95
+ }, {
96
+ children: [icon, jsx("div", Object.assign({
97
+ className: "title",
98
+ onClick: () => handleClick === null || handleClick === void 0 ? void 0 : handleClick(id)
99
+ }, {
100
+ children: jsx(AutoTips, {
101
+ children: name || ''
102
+ })
103
+ }))]
104
+ }));
105
+ }, [data, anchorMap, handleExpanded, handleClick, customPrefixIcon, isTree]);
106
+ return jsxs(Fragment, {
107
+ children: [jsxs("div", Object.assign({
108
+ className: clsx("anchor-menu-item", {
109
+ ["active"]: isActive,
110
+ ["expanded"]: (_a = anchorMap === null || anchorMap === void 0 ? void 0 : anchorMap[id]) === null || _a === void 0 ? void 0 : _a.expanded
111
+ })
112
+ }, {
113
+ children: [indentMemo, contentMemo]
114
+ })), data.children && ((_b = anchorMap === null || anchorMap === void 0 ? void 0 : anchorMap[id]) === null || _b === void 0 ? void 0 : _b.expanded) && !onlyOneLevel && data.children.map(item => {
115
+ return /*#__PURE__*/createElement(AnchorMenu, Object.assign({}, props, {
116
+ data: item,
117
+ key: item === null || item === void 0 ? void 0 : item.id,
118
+ level: level + 1
119
+ }));
120
+ })]
121
+ });
122
+ };
123
+ // logo 点
124
+ const Point = () => {
125
+ return jsx("div", Object.assign({
126
+ className: "icon mr-6"
127
+ }, {
128
+ children: jsx("div", {
129
+ className: "icon-point"
130
+ })
131
+ }));
132
+ };
133
+
134
+ var en = {
135
+ pleaseEnter: 'Please enter'
136
+ };
137
+
138
+ var zh = {
139
+ pleaseEnter: '请输入'
140
+ };
141
+
142
+ var localeJson = {
143
+ zh,
144
+ en
145
+ };
146
+
147
+ var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-anchor {\n position: relative;\n width: 100%;\n height: 100%;\n}\n.paraui-v4-anchor .anchor-menu-list {\n position: absolute;\n top: 0;\n right: 10px;\n width: 140px;\n transition: width 0.3s;\n}\n.paraui-v4-anchor .anchor-scroll {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n scroll-behavior: smooth;\n padding-right: 160px;\n transition: padding 0.3s;\n}\n.paraui-v4-anchor .anchor-menu-title {\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: nowrap;\n padding: 0 4px;\n}\n.paraui-v4-anchor .anchor-menu-title .title {\n font-size: 14px;\n font-weight: 600;\n color: rgb(29, 33, 38);\n white-space: nowrap;\n}\n.paraui-v4-anchor .collapse-icon-area {\n transition: unset;\n position: absolute;\n right: 10px;\n top: 0;\n width: 30px;\n height: 30px;\n background: rgb(46, 101, 230);\n border-radius: 2px;\n box-shadow: 1px 1px 10px 0px rgba(212, 218, 227, 0.4);\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.paraui-v4-anchor .collapse-icon-area svg {\n color: rgb(255, 255, 255);\n}\n.paraui-v4-anchor .opera-area {\n display: flex;\n color: rgb(161, 168, 179);\n}\n.paraui-v4-anchor .opera-area svg {\n color: rgb(161, 168, 179);\n cursor: pointer;\n}\n.paraui-v4-anchor .opera-area .split-line {\n width: 1px;\n height: 12px;\n background-color: rgb(212, 218, 227);\n margin: 0 8px;\n}\n.paraui-v4-anchor .opera-area > div {\n display: flex;\n align-items: center;\n}\n.paraui-v4-anchor.paraui-v4-anchor-left .anchor-menu-list {\n left: 10px;\n}\n.paraui-v4-anchor.paraui-v4-anchor-left .collapse-icon-area {\n left: 10px;\n}\n.paraui-v4-anchor.paraui-v4-anchor-left .anchor-scroll {\n padding-left: 160px;\n}\n.paraui-v4-anchor .mr-6 {\n margin-right: 6px;\n}";
148
+ styleInject(css_248z);
149
+
150
+ const Anchor = props => {
151
+ const {
152
+ style,
153
+ className,
154
+ title = '',
155
+ scrollId = "".concat($prefixCls, "-anchor-scroll-id"),
156
+ list = [],
157
+ listClassName,
158
+ scrollClassName,
159
+ placement = 'right',
160
+ allExpanded = true,
161
+ search = false,
162
+ customPrefixIcon,
163
+ listWidth
164
+ } = props;
165
+ const intl = useFormatMessage('Anchor', localeJson);
166
+ const [currentAnchorId, setCurrentAnchorId] = useState(''); // 当前锚点id
167
+ // 判断list中是否存在children,切换不同的样式
168
+ const [isTree, setIsTree] = useState(false);
169
+ const [anchorMap, setAnchorMap] = useState({});
170
+ // 目录折叠状态
171
+ const [collapse, setCollapse] = useState(false);
172
+ const [searchValue, setSearchValue] = useState('');
173
+ const [searchResult, setSearchResult] = useState(null);
174
+ const constData = useRef({
175
+ currentAnchorId: '',
176
+ anchorList: list,
177
+ anchorMap: {},
178
+ searchValue: '',
179
+ scrolling: false
180
+ });
181
+ const scrollPadding = collapse ? '50px' : listWidth ? "".concat(listWidth + 20, "px") : '160px';
182
+ useEffect(() => {
183
+ constData.current.anchorList = list;
184
+ // 初始化list数据为map,方便查找。 增加是否展开的字段、增加父节点id
185
+ const anchorMap = {};
186
+ let isT = false;
187
+ const formatList = function (list) {
188
+ let parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
189
+ list.forEach(item => {
190
+ if ((item === null || item === void 0 ? void 0 : item.expanded) === undefined || (item === null || item === void 0 ? void 0 : item.expanded) === null) {
191
+ item.expanded = false;
192
+ }
193
+ if (parentId) {
194
+ item.parentId = parentId;
195
+ }
196
+ anchorMap[item.id] = item;
197
+ if (item.children) {
198
+ isT = true;
199
+ formatList(item.children, item.id);
200
+ }
201
+ });
202
+ };
203
+ formatList(list);
204
+ setIsTree(isT);
205
+ constData.current.anchorMap = anchorMap;
206
+ setAnchorMap(anchorMap);
207
+ }, [list]);
208
+ // 监听滚动事件,获取当前页面的锚点
209
+ useEffect(() => {
210
+ const anchorView = document.getElementById(scrollId);
211
+ const handleScroll = throttle(() => __awaiter(void 0, void 0, void 0, function* () {
212
+ if (constData.current.scrolling) return;
213
+ const anchors = (anchorView === null || anchorView === void 0 ? void 0 : anchorView.querySelectorAll('[id]')) || [];
214
+ const anchorArray = Array.from(anchors);
215
+ const anchorArrayWithOffsetTop = anchorArray.map(item => {
216
+ return {
217
+ id: item.id,
218
+ offsetTop: item.offsetTop - ((anchorView === null || anchorView === void 0 ? void 0 : anchorView.offsetTop) || 0)
219
+ };
220
+ });
221
+ // 记录最大的offsetTop id 当滚动到最底部时,锚点定位到最后一个
222
+ let maxOffsetTop = 0;
223
+ let maxOffsetTopId = '';
224
+ const cAnchor = anchorArrayWithOffsetTop.find(item => {
225
+ if (maxOffsetTop < item.offsetTop) {
226
+ maxOffsetTop = item.offsetTop;
227
+ maxOffsetTopId = item.id;
228
+ }
229
+ return item.offsetTop >= ((anchorView === null || anchorView === void 0 ? void 0 : anchorView.scrollTop) || 0);
230
+ });
231
+ if ((cAnchor === null || cAnchor === void 0 ? void 0 : cAnchor.id) !== constData.current.currentAnchorId) {
232
+ let cAnchorId = (cAnchor === null || cAnchor === void 0 ? void 0 : cAnchor.id) || '';
233
+ if ((anchorView === null || anchorView === void 0 ? void 0 : anchorView.scrollTop) && !(cAnchor === null || cAnchor === void 0 ? void 0 : cAnchor.id)) cAnchorId = maxOffsetTopId;
234
+ setCurrentAnchorId(cAnchorId);
235
+ }
236
+ }), 300);
237
+ // 监听滚动
238
+ handleScroll();
239
+ anchorView === null || anchorView === void 0 ? void 0 : anchorView.addEventListener('scroll', handleScroll, {
240
+ passive: true
241
+ });
242
+ return () => {
243
+ anchorView === null || anchorView === void 0 ? void 0 : anchorView.addEventListener('scroll', handleScroll);
244
+ };
245
+ }, []);
246
+ const handleClick = id => {
247
+ const anchorView = document.getElementById(scrollId);
248
+ const anchors = (anchorView === null || anchorView === void 0 ? void 0 : anchorView.querySelectorAll('[id]')) || [];
249
+ const index = Array.from(anchors).findIndex(item => {
250
+ return String(item.id) === String(id);
251
+ });
252
+ const anchorElement = anchors[index];
253
+ if (anchorElement) {
254
+ setCurrentAnchorId(id);
255
+ constData.current.currentAnchorId = id;
256
+ constData.current.scrolling = true;
257
+ setTimeout(() => {
258
+ constData.current.scrolling = false;
259
+ }, 1000);
260
+ anchorView === null || anchorView === void 0 ? void 0 : anchorView.scrollTo({
261
+ top: (anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.offsetTop) || 0 - ((anchorView === null || anchorView === void 0 ? void 0 : anchorView.offsetTop) || 0),
262
+ behavior: 'smooth'
263
+ });
264
+ }
265
+ };
266
+ const handleExpandAll = () => {
267
+ // anchorMap 每一项的expanded都设置为true
268
+ Object.keys(anchorMap).forEach(key => {
269
+ anchorMap[key].expanded = true;
270
+ });
271
+ setAnchorMap(Object.assign({}, anchorMap));
272
+ };
273
+ /**
274
+ * @desc 搜索 - 防抖
275
+ */
276
+ const onSearch = useMemo(() => debounce(() => __awaiter(void 0, void 0, void 0, function* () {
277
+ const val = constData.current.searchValue;
278
+ if (!val) {
279
+ setSearchResult(null);
280
+ return;
281
+ }
282
+ const anchorList = constData.current.anchorList || [];
283
+ const result = [];
284
+ const searchList = function (list) {
285
+ list.forEach(item => {
286
+ var _a;
287
+ if (((_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.indexOf(val)) > -1) {
288
+ result.push(item);
289
+ }
290
+ if (item.children) {
291
+ searchList(item.children, item.id);
292
+ }
293
+ });
294
+ };
295
+ searchList(anchorList);
296
+ setSearchResult(result);
297
+ }), 200), []);
298
+ const titleMemo = useMemo(() => {
299
+ if (!title) return null;
300
+ return jsxs(Fragment, {
301
+ children: [jsxs("div", Object.assign({
302
+ className: "anchor-menu-title"
303
+ }, {
304
+ children: [jsx("div", Object.assign({
305
+ className: "title"
306
+ }, {
307
+ children: title
308
+ })), jsxs("div", Object.assign({
309
+ className: "opera-area"
310
+ }, {
311
+ children: [isTree && allExpanded && jsxs(Fragment, {
312
+ children: [jsx(PreviewOpen, {
313
+ onClick: handleExpandAll
314
+ }), jsx("div", {
315
+ className: "split-line"
316
+ })]
317
+ }), jsx("div", Object.assign({
318
+ onClick: () => setCollapse(true)
319
+ }, {
320
+ children: placement === 'left' ? jsx(ToLeft, {}) : jsx(ToRight, {})
321
+ }))]
322
+ }))]
323
+ })), search && jsx(Search, {
324
+ size: 'small',
325
+ value: searchValue,
326
+ onChange: val => {
327
+ setSearchValue(val);
328
+ constData.current.searchValue = val;
329
+ onSearch();
330
+ },
331
+ onClickRightIcon: onSearch,
332
+ onEnter: onSearch,
333
+ onClear: () => {
334
+ setSearchValue('');
335
+ constData.current.searchValue = '';
336
+ setSearchResult(null);
337
+ },
338
+ placeholder: intl('pleaseEnter'),
339
+ style: {
340
+ padding: '0 4px',
341
+ marginBottom: '6px'
342
+ }
343
+ })]
344
+ });
345
+ }, [title, isTree, searchValue, handleExpandAll, onSearch]);
346
+ const AnchorListMemo = useMemo(() => {
347
+ if (!(list === null || list === void 0 ? void 0 : list.length)) return null;
348
+ if (collapse) return jsx("div", Object.assign({
349
+ className: "collapse-icon-area",
350
+ onClick: () => setCollapse(false)
351
+ }, {
352
+ children: placement === 'left' ? jsx(ToRight, {}) : jsx(ToLeft, {})
353
+ }));
354
+ const anchorList = searchResult ? searchResult : list;
355
+ return jsxs("div", Object.assign({
356
+ className: clsx("anchor-menu-list", listClassName),
357
+ style: {
358
+ width: listWidth ? "".concat(listWidth, "px") : '140px'
359
+ }
360
+ }, {
361
+ children: [titleMemo, anchorList.map((item, index) => {
362
+ return jsx(AnchorMenu, {
363
+ data: item,
364
+ currentAnchorId: currentAnchorId,
365
+ handleClick: handleClick,
366
+ isTree: searchResult ? false : isTree,
367
+ anchorMap: anchorMap,
368
+ setAnchorMap: setAnchorMap,
369
+ customPrefixIcon: customPrefixIcon,
370
+ onlyOneLevel: searchResult ? true : false
371
+ }, item === null || item === void 0 ? void 0 : item.id);
372
+ })]
373
+ }));
374
+ }, [list, currentAnchorId, listClassName, handleClick, isTree, titleMemo, anchorMap, customPrefixIcon, collapse, searchResult]);
375
+ return jsxs("div", Object.assign({
376
+ className: clsx("".concat($prefixCls, "-anchor"), className, {
377
+ ["".concat($prefixCls, "-anchor-").concat(placement)]: placement
378
+ }),
379
+ style: style
380
+ }, {
381
+ children: [placement === 'left' && AnchorListMemo, jsx("div", Object.assign({
382
+ id: scrollId,
383
+ className: clsx("anchor-scroll", scrollClassName),
384
+ style: {
385
+ paddingLeft: placement === 'left' ? scrollPadding : '0',
386
+ paddingRight: placement === 'right' ? scrollPadding : '0'
387
+ }
388
+ }, {
389
+ children: props.children
390
+ })), placement === 'right' && AnchorListMemo]
391
+ }));
392
+ };
393
+
394
+ export { Anchor as default };
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ pleaseEnter: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ zh: {
3
+ pleaseEnter: string;
4
+ };
5
+ en: {
6
+ pleaseEnter: string;
7
+ };
8
+ };
9
+ export default _default;
@@ -0,0 +1,4 @@
1
+ declare const _default: {
2
+ pleaseEnter: string;
3
+ };
4
+ export default _default;
@@ -0,0 +1,42 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface AnchorMap {
3
+ [key: string]: AnchorItem;
4
+ }
5
+ export interface AnchorItem {
6
+ /** 锚点名称 */
7
+ name: string;
8
+ /** 锚点Id */
9
+ id: string;
10
+ children?: AnchorItem[];
11
+ parentId?: string;
12
+ expanded?: boolean;
13
+ }
14
+ export interface AnchorProps {
15
+ /** 数据源 */
16
+ list: AnchorItem[];
17
+ /** 样式 */
18
+ style?: React.CSSProperties;
19
+ /** 类名 */
20
+ className?: string;
21
+ /** 标题 */
22
+ title?: string;
23
+ /** 滚动盒子Id */
24
+ scrollId?: string;
25
+ /** 子元素 */
26
+ children?: ReactNode;
27
+ /** 锚点列表类名 */
28
+ listClassName?: string;
29
+ /** 内容类名 */
30
+ scrollClassName?: string;
31
+ /** 位置 */
32
+ placement?: 'left' | 'right';
33
+ /** 默认展示的锚点 */
34
+ /** 自定义前缀符号 */
35
+ customPrefixIcon?: ReactNode;
36
+ /** 全部展开功能是否开启 */
37
+ allExpanded?: boolean;
38
+ /** 是否带目录搜索 */
39
+ search?: boolean;
40
+ /** 菜单宽度 */
41
+ listWidth?: number;
42
+ }
@@ -0,0 +1,18 @@
1
+ import { IObject } from '../../Utils/type';
2
+ import './index.scss';
3
+ interface IProps {
4
+ /** class */
5
+ className?: string;
6
+ /** 源数据 */
7
+ sourceData?: IObject[];
8
+ /** 校验数据 */
9
+ checkData?: (data: IObject[]) => boolean;
10
+ /** 点击确定回调 */
11
+ onFinish?: (val: IObject[]) => void;
12
+ /** 数据转json 自定义函数 */
13
+ dataToJson?: (data: IObject[]) => string;
14
+ /** json转数据 */
15
+ jsonToData?: (json: string) => IObject[];
16
+ }
17
+ declare const BatchEdit: (props: IProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default BatchEdit;
@@ -0,0 +1,16 @@
1
+ export declare const dataTypeSelectList: {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ export type IDataType = 'string' | 'number' | 'boolean' | 'object';
6
+ export type IGeneratorData = string | number | boolean | object;
7
+ export declare const defaultInputValueMapping: {
8
+ string: string;
9
+ number: number;
10
+ boolean: boolean;
11
+ object: string;
12
+ };
13
+ export declare const booleanSelectList: {
14
+ label: string;
15
+ value: boolean;
16
+ }[];
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { IDataType, IGeneratorData } from './config';
3
+ import './index.scss';
4
+ export interface IDataGeneratorValue {
5
+ dataType: IDataType;
6
+ data: string | number | boolean;
7
+ }
8
+ interface IProps {
9
+ defaultValue?: IDataGeneratorValue;
10
+ value?: IDataGeneratorValue;
11
+ disabled?: boolean;
12
+ onChange?: (val: IDataGeneratorValue) => void;
13
+ /** 是否显示错误 */
14
+ error?: boolean;
15
+ /** 错误提示 */
16
+ helperText?: ReactNode;
17
+ /** 输入框提示 */
18
+ placeholderTextField?: ReactNode;
19
+ }
20
+ declare const DataGenerator: (props: IProps) => import("react/jsx-runtime").JSX.Element;
21
+ export default DataGenerator;
22
+ export declare const checkGeneratorData: (data: IDataGeneratorValue) => boolean;
23
+ export declare const formatGeneratorToData: (data: IDataGeneratorValue) => IGeneratorData;
24
+ export declare const formatDataToGenerator: (data: IGeneratorData) => IDataGeneratorValue;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { IDataGeneratorValue } from './dataGenerator';
3
+ import { LabelProps } from '../Label';
4
+ import { IObject } from '../Utils/type';
5
+ import './index.scss';
6
+ export interface IArgvItem {
7
+ key: string;
8
+ data: IDataGeneratorValue;
9
+ }
10
+ export interface ArgvProps {
11
+ /** 样式 */
12
+ style?: React.CSSProperties;
13
+ /** 类名 */
14
+ className?: string;
15
+ /** 禁用 */
16
+ disabled?: boolean;
17
+ /** 默认值 不受控 */
18
+ defaultValue?: IObject;
19
+ /** label */
20
+ label?: LabelProps['label'];
21
+ /** 改变值 */
22
+ onChange?: (val: IObject) => void;
23
+ /** 格式化的列表 */
24
+ list?: IArgvItem[];
25
+ /** 改变值 */
26
+ onListChange?: (val: IArgvItem[]) => void;
27
+ /** label属性 */
28
+ labelProps?: LabelProps;
29
+ /** 错误 */
30
+ errors?: Record<string, string>[];
31
+ }
32
+ declare const Argv: (props: ArgvProps) => import("react/jsx-runtime").JSX.Element;
33
+ export default Argv;
34
+ export declare const formatObjectToData: (data: IObject) => IArgvItem[];
35
+ export declare const formatDataToObject: (data: IArgvItem[]) => IObject;
36
+ export declare const checkArgvData: (data: IArgvItem[], intl: Function) => Record<string, any>;