@para-ui/core 4.0.0-rc.3 → 4.0.0-rc.5
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/AutoBox/index.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +18 -17
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +89 -117
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +7 -9
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +242 -330
- package/ComboSelect/utils.d.ts +0 -5
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +22 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +82 -97
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +219 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +66 -74
- package/FormItem/index.js +14 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +105 -114
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +62 -79
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +52 -59
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +35 -44
- package/Select/index.js +323 -364
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +905 -796
- package/SelectorPicker/index.js +111 -133
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +25 -26
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +767 -963
- package/Tabs/index.js +102 -102
- package/Tag/index.js +115 -162
- package/TextEditor/index.js +81 -103
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +27 -28
- package/Timeline/index.js +67 -58
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +53 -52
- package/Tooltip/index.js +79 -82
- package/Transfer/index.js +160 -203
- package/Tree/index.js +7 -12
- package/Upload/index.js +527 -759
- package/Upload/interface.d.ts +5 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-f48d5ce6.js → index-0ced30f7.js} +1128 -1080
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-56601c94.js → index-ef1235fb.js} +125 -134
- package/_verture/{index-de8f4428.js → index-f186b5e8.js} +315 -399
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/{utils-06d86594.js → utils-46e99c9a.js} +34 -26
- package/index.js +21 -22
- package/locale/index.js +10 -10
- package/package.json +1 -1
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-232d890b.js +0 -327
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/toConsumableArray-8f4c9589.js +0 -19
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// 实现 get 方法
|
|
2
|
+
// 支持对象和数组/支持默认值/支持路径/支持字符串模版变量/支持jsx/支持.运算符和[]运算符
|
|
3
|
+
const get = (obj, path, defaultValue) => {
|
|
4
|
+
const pathArr = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
|
5
|
+
let result = obj;
|
|
6
|
+
for (const p of pathArr) {
|
|
7
|
+
result = Object(result)[p];
|
|
8
|
+
if (result === undefined) {
|
|
9
|
+
return defaultValue;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* 替换字符串模版变量
|
|
16
|
+
* @param str
|
|
17
|
+
* @param vars
|
|
18
|
+
*/
|
|
19
|
+
const replaceStrTemplateVars = (str, vars) => {
|
|
20
|
+
if (!vars) return str;
|
|
21
|
+
str = str.replace(/\"/g, '\\"');
|
|
22
|
+
// 模版字符串正则
|
|
23
|
+
const strTemplateReg = /({[^{}]+})/g;
|
|
24
|
+
const parts = str.split(strTemplateReg);
|
|
25
|
+
return parts.map(part => {
|
|
26
|
+
if (part.match(strTemplateReg)) {
|
|
27
|
+
const key = part.replace(/({|})/g, '');
|
|
28
|
+
const val = get(vars, key);
|
|
29
|
+
return val === undefined ? key : val;
|
|
30
|
+
}
|
|
31
|
+
return part;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* 国际化获取方法
|
|
36
|
+
* @param ops 国际化取值key参数
|
|
37
|
+
* @param i18nData 国际化数据对象
|
|
38
|
+
* @param params 国际化字符变量对象
|
|
39
|
+
* @param lang 指定国际化语言
|
|
40
|
+
* @param defI18nData 默认国际化数据对象
|
|
41
|
+
*/
|
|
42
|
+
const i18nIntl = props => {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
const {
|
|
45
|
+
ops,
|
|
46
|
+
i18nData,
|
|
47
|
+
lang,
|
|
48
|
+
params,
|
|
49
|
+
defI18nData
|
|
50
|
+
} = props;
|
|
51
|
+
let text, key;
|
|
52
|
+
if (typeof ops === 'string') {
|
|
53
|
+
key = ops;
|
|
54
|
+
} else if (typeof ops === 'object') {
|
|
55
|
+
if (typeof ops.id !== 'string') return 'i18n intl object "id" is missing';
|
|
56
|
+
key = ops.id;
|
|
57
|
+
}
|
|
58
|
+
if (key !== undefined) {
|
|
59
|
+
text = (_a = i18nData[lang]) === null || _a === void 0 ? void 0 : _a[key];
|
|
60
|
+
if (text === undefined && defI18nData) {
|
|
61
|
+
// 尝试从默认国际化数据获取
|
|
62
|
+
text = (_b = defI18nData[lang]) === null || _b === void 0 ? void 0 : _b[key];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (typeof text !== 'string') return "{".concat(key, "}");
|
|
66
|
+
return replaceStrTemplateVars(text, params);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { i18nIntl as i };
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { _ as _toConsumableArray } from './toConsumableArray-8f4c9589.js';
|
|
2
|
-
import { _ as _slicedToArray } from './slicedToArray-a8206399.js';
|
|
3
|
-
import { r as regenerator } from './index-232d890b.js';
|
|
4
1
|
import { a as __awaiter } from './tslib.es6-55ed4bd2.js';
|
|
5
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
6
3
|
import React__default from 'react';
|
|
@@ -58,7 +55,7 @@ var FDialog = function FDialog(props) {
|
|
|
58
55
|
/**
|
|
59
56
|
* 创建模态框的上下文
|
|
60
57
|
*/
|
|
61
|
-
|
|
58
|
+
const FunctionModalContext = /*#__PURE__*/React__default.createContext(Promise.reject);
|
|
62
59
|
/**
|
|
63
60
|
* 弹出框组件
|
|
64
61
|
* @param context 主体内容
|
|
@@ -66,41 +63,38 @@ var FunctionModalContext = /*#__PURE__*/React__default.createContext(Promise.rej
|
|
|
66
63
|
* @param hideClose 隐藏右上角关闭图标 boolean 默认 false
|
|
67
64
|
* @param checkFunction 检查方法,返回 boolean 值,true则关闭弹窗,false反之
|
|
68
65
|
**/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
var setState;
|
|
66
|
+
const useModal = () => React__default.useContext(FunctionModalContext);
|
|
67
|
+
let setState;
|
|
73
68
|
/**
|
|
74
69
|
* 函数弹窗组件Provider
|
|
75
70
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
71
|
+
const FunctionModalProvider = _ref => {
|
|
72
|
+
let {
|
|
73
|
+
children
|
|
74
|
+
} = _ref;
|
|
78
75
|
// 模态框组 配置
|
|
79
|
-
|
|
80
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
81
|
-
confirmationState = _React$useState2[0],
|
|
82
|
-
setConfirmationState = _React$useState2[1];
|
|
76
|
+
const [confirmationState, setConfirmationState] = React__default.useState([]);
|
|
83
77
|
// 传出设置模态框数组hook,用于关闭所有弹窗
|
|
84
|
-
setState =
|
|
78
|
+
setState = () => {
|
|
85
79
|
setConfirmationState([]);
|
|
86
80
|
awaitingPromiseRef.current = [];
|
|
87
81
|
};
|
|
88
82
|
// 存储每个模态框的 promise 方法
|
|
89
|
-
|
|
83
|
+
const awaitingPromiseRef = React__default.useRef([]);
|
|
90
84
|
/**
|
|
91
85
|
* 模态框初始化方法
|
|
92
86
|
* @param options 模态框配置
|
|
93
87
|
* @return 返回一个promise 用于外部判断弹窗状态
|
|
94
88
|
*/
|
|
95
|
-
|
|
96
|
-
setConfirmationState(
|
|
89
|
+
const openConfirmation = options => {
|
|
90
|
+
setConfirmationState(pre => {
|
|
97
91
|
pre.push(options);
|
|
98
|
-
return
|
|
92
|
+
return [...pre];
|
|
99
93
|
});
|
|
100
|
-
return new Promise(
|
|
94
|
+
return new Promise((resolve, reject) => {
|
|
101
95
|
awaitingPromiseRef.current.push({
|
|
102
|
-
resolve
|
|
103
|
-
reject
|
|
96
|
+
resolve,
|
|
97
|
+
reject
|
|
104
98
|
});
|
|
105
99
|
});
|
|
106
100
|
};
|
|
@@ -109,7 +103,7 @@ var FunctionModalProvider = function FunctionModalProvider(_ref) {
|
|
|
109
103
|
* @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
|
|
110
104
|
* @description 关闭后会清空相关配置
|
|
111
105
|
*/
|
|
112
|
-
|
|
106
|
+
const handleClose = idx => {
|
|
113
107
|
// 是否有禁用取消停止功能的配置
|
|
114
108
|
if (confirmationState[idx] && !confirmationState[idx].disCatchOnCancel && awaitingPromiseRef.current[idx]) {
|
|
115
109
|
awaitingPromiseRef.current[idx].resolve(false);
|
|
@@ -123,51 +117,29 @@ var FunctionModalProvider = function FunctionModalProvider(_ref) {
|
|
|
123
117
|
* 模态框确定触发的方法
|
|
124
118
|
* @param idx 模态框在模态框数组里的下标,用于拿到对应的配置 和 promise
|
|
125
119
|
*/
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
_context.next = 5;
|
|
139
|
-
return checkFuc();
|
|
140
|
-
case 5:
|
|
141
|
-
jude = _context.sent;
|
|
142
|
-
case 6:
|
|
143
|
-
if (jude) {
|
|
144
|
-
_context.next = 8;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
return _context.abrupt("return");
|
|
148
|
-
case 8:
|
|
149
|
-
hideDialog(idx);
|
|
150
|
-
pRef = awaitingPromiseRef.current[idx];
|
|
151
|
-
deleteOption(idx, pRef);
|
|
152
|
-
case 11:
|
|
153
|
-
case "end":
|
|
154
|
-
return _context.stop();
|
|
155
|
-
}
|
|
156
|
-
}, _callee);
|
|
157
|
-
}));
|
|
158
|
-
};
|
|
120
|
+
const handleSubmit = idx => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
const checkFuc = confirmationState && confirmationState[idx] && confirmationState[idx].checkFunction;
|
|
122
|
+
let jude = true;
|
|
123
|
+
// 判断是否有检查方法,如果有则先执行检查方法
|
|
124
|
+
if (checkFuc) jude = yield checkFuc();
|
|
125
|
+
//根据是否有检查方法 或 检查方法的返回值判断是否关闭弹窗
|
|
126
|
+
if (!jude) return;
|
|
127
|
+
hideDialog(idx);
|
|
128
|
+
const pRef = awaitingPromiseRef.current[idx];
|
|
129
|
+
deleteOption(idx, pRef);
|
|
130
|
+
});
|
|
159
131
|
/**
|
|
160
132
|
* 删除模态框配置,promise 执行成功操作
|
|
161
133
|
* @param pRef 模态框的promise
|
|
162
134
|
* @param idx 模态框在模态框组里的下标
|
|
163
135
|
*/
|
|
164
|
-
|
|
165
|
-
setTimeout(
|
|
136
|
+
const deleteOption = (idx, pRef) => {
|
|
137
|
+
setTimeout(() => {
|
|
166
138
|
pRef && pRef.resolve(true);
|
|
167
|
-
setConfirmationState(
|
|
139
|
+
setConfirmationState(pre => {
|
|
168
140
|
pre.splice(idx, 1);
|
|
169
141
|
awaitingPromiseRef.current.splice(idx, 1);
|
|
170
|
-
return
|
|
142
|
+
return [...pre];
|
|
171
143
|
});
|
|
172
144
|
}, 200);
|
|
173
145
|
};
|
|
@@ -176,15 +148,15 @@ var FunctionModalProvider = function FunctionModalProvider(_ref) {
|
|
|
176
148
|
* @param idx 模态框在模态框数组里的下标
|
|
177
149
|
* @desc 解决异步导致的闪烁问题
|
|
178
150
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
151
|
+
const hideDialog = idx => {
|
|
152
|
+
const dialogEl = document.querySelectorAll('.function-modal .MuiDialog-container')[idx];
|
|
181
153
|
if (dialogEl) dialogEl.style.opacity = '0';
|
|
182
154
|
};
|
|
183
155
|
return jsxs(Fragment, {
|
|
184
156
|
children: [jsx(FunctionModalContext.Provider, {
|
|
185
157
|
value: openConfirmation,
|
|
186
158
|
children: children
|
|
187
|
-
}), confirmationState && confirmationState.map(
|
|
159
|
+
}), confirmationState && confirmationState.map((option, idx) => {
|
|
188
160
|
return jsx(FDialog, Object.assign({
|
|
189
161
|
listIndex: idx,
|
|
190
162
|
open: Boolean(option),
|
|
@@ -194,7 +166,7 @@ var FunctionModalProvider = function FunctionModalProvider(_ref) {
|
|
|
194
166
|
})]
|
|
195
167
|
});
|
|
196
168
|
};
|
|
197
|
-
|
|
169
|
+
const useClose = () => {
|
|
198
170
|
return setState;
|
|
199
171
|
};
|
|
200
172
|
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
8
|
+
if (!o) return;
|
|
9
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
10
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
11
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
12
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
13
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
14
|
+
}
|
|
2
15
|
|
|
3
16
|
function _arrayWithHoles(arr) {
|
|
4
17
|
if (Array.isArray(arr)) return arr;
|
|
@@ -40,4 +53,4 @@ function _slicedToArray(arr, i) {
|
|
|
40
53
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
41
54
|
}
|
|
42
55
|
|
|
43
|
-
export {
|
|
56
|
+
export { _arrayLikeToArray as _, _unsupportedIterableToArray as a, _slicedToArray as b, _arrayWithHoles as c, _nonIterableRest as d };
|
|
@@ -6,14 +6,15 @@ import GlobalContext from '@para-ui/core/GlobalContext';
|
|
|
6
6
|
* @date 2022/3/15 4:03 PM
|
|
7
7
|
* @description 国际化钩子
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
intlFormat
|
|
9
|
+
const useFormatMessage = (comName, defI18nData) => {
|
|
10
|
+
const {
|
|
11
|
+
intlFormat
|
|
12
|
+
} = React__default.useContext(GlobalContext);
|
|
12
13
|
defI18nData.zh_CN = defI18nData.zh;
|
|
13
14
|
defI18nData['zh-CN'] = defI18nData.zh;
|
|
14
15
|
defI18nData.en_US = defI18nData.en;
|
|
15
16
|
defI18nData['en-US'] = defI18nData.en;
|
|
16
|
-
|
|
17
|
+
const intl = intlFormat && intlFormat(comName, defI18nData);
|
|
17
18
|
return intl;
|
|
18
19
|
};
|
|
19
20
|
|
|
@@ -2,9 +2,10 @@ import React__default from 'react';
|
|
|
2
2
|
import GlobalContext from '@para-ui/core/GlobalContext';
|
|
3
3
|
|
|
4
4
|
function useGlobalProps(comProps, comName) {
|
|
5
|
-
|
|
6
|
-
componentsProps
|
|
7
|
-
|
|
5
|
+
const {
|
|
6
|
+
componentsProps
|
|
7
|
+
} = React__default.useContext(GlobalContext);
|
|
8
|
+
const globalProps = componentsProps && componentsProps[comName];
|
|
8
9
|
return Object.assign(Object.assign({}, globalProps), comProps);
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -7,17 +7,18 @@ import React__default from 'react';
|
|
|
7
7
|
*/
|
|
8
8
|
//判断是否滚动元素
|
|
9
9
|
function isOverflowElement(element) {
|
|
10
|
-
|
|
11
|
-
overflow
|
|
12
|
-
overflowX
|
|
13
|
-
overflowY
|
|
10
|
+
const {
|
|
11
|
+
overflow,
|
|
12
|
+
overflowX,
|
|
13
|
+
overflowY
|
|
14
|
+
} = window.getComputedStyle(element);
|
|
14
15
|
return /auto|scroll|overlay/.test(overflow + overflowY + overflowX);
|
|
15
16
|
}
|
|
16
17
|
//最近的祖先滚动元素
|
|
17
18
|
function getNearestOverflowAncestor(node) {
|
|
18
19
|
var _a, _b;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const parentNode = node.parentNode || node.ownerDocument;
|
|
21
|
+
const nodeName = ((_a = parentNode === null || parentNode === void 0 ? void 0 : parentNode.nodeName) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
21
22
|
if (['html', 'body', '#document'].includes(nodeName)) {
|
|
22
23
|
return (_b = node === null || node === void 0 ? void 0 : node.ownerDocument) === null || _b === void 0 ? void 0 : _b.body;
|
|
23
24
|
}
|
|
@@ -28,24 +29,24 @@ function getNearestOverflowAncestor(node) {
|
|
|
28
29
|
}
|
|
29
30
|
//渲染容器
|
|
30
31
|
function usePopupContainer(wrapRef, customizeContainer) {
|
|
31
|
-
|
|
32
|
+
const popupRef = React__default.useRef();
|
|
32
33
|
//浮层渲染容器
|
|
33
|
-
|
|
34
|
+
const getPopupContainer = triggerNode => {
|
|
34
35
|
var _a, _b, _c, _d;
|
|
35
|
-
|
|
36
|
+
let container;
|
|
36
37
|
if (!customizeContainer) {
|
|
37
|
-
|
|
38
|
+
const rootNode = (_b = (_a = wrapRef.current) === null || _a === void 0 ? void 0 : _a.getRootDomNode) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
38
39
|
if (rootNode) {
|
|
39
40
|
container = getNearestOverflowAncestor(rootNode);
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const scrollHeight = container.scrollHeight;
|
|
42
|
+
const clientHeight = container.clientHeight;
|
|
42
43
|
if (scrollHeight <= clientHeight) {
|
|
43
44
|
container = document.body;
|
|
44
45
|
}
|
|
45
46
|
} else {
|
|
46
47
|
container = document.body;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
const nodeName = (_c = container.nodeName) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
49
50
|
if (nodeName !== 'body') {
|
|
50
51
|
if (((_d = window.getComputedStyle(container)) === null || _d === void 0 ? void 0 : _d.position) === 'static') {
|
|
51
52
|
container.style.position = 'relative';
|
|
@@ -57,8 +58,8 @@ function usePopupContainer(wrapRef, customizeContainer) {
|
|
|
57
58
|
}
|
|
58
59
|
return container;
|
|
59
60
|
};
|
|
60
|
-
React__default.useEffect(
|
|
61
|
-
return
|
|
61
|
+
React__default.useEffect(() => {
|
|
62
|
+
return () => {
|
|
62
63
|
if (popupRef.current) popupRef.current.style.position = '';
|
|
63
64
|
};
|
|
64
65
|
}, []);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
function getTransitionProps(props, options) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
style =
|
|
2
|
+
const {
|
|
3
|
+
timeout,
|
|
4
|
+
style = {}
|
|
5
|
+
} = props;
|
|
5
6
|
return {
|
|
6
7
|
duration: style.transitionDuration || typeof timeout === 'number' ? timeout : timeout[options.mode] || 0,
|
|
7
8
|
delay: style.transitionDelay
|
|
@@ -11,7 +12,7 @@ function getAutoHeightDuration(height) {
|
|
|
11
12
|
if (!height) {
|
|
12
13
|
return 0;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
const constant = height / 36;
|
|
15
16
|
return Math.round((4 + 15 * Math.pow(constant, 0.25) + constant / 5) * 10);
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -1,72 +1,80 @@
|
|
|
1
|
-
import { _ as _defineProperty } from './defineProperty-1d116156.js';
|
|
2
|
-
|
|
3
1
|
//获取替换字段
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
const getReplaceField = (mode, repl, tableP, treeP) => {
|
|
3
|
+
let t = {};
|
|
6
4
|
if (mode === 'tree') t = treeP === null || treeP === void 0 ? void 0 : treeP.replaceFields;else t = tableP === null || tableP === void 0 ? void 0 : tableP.replaceFields;
|
|
7
5
|
return Object.assign(Object.assign({}, repl), t);
|
|
8
6
|
};
|
|
9
7
|
//to array
|
|
10
|
-
|
|
8
|
+
const toArray = list => {
|
|
11
9
|
if (!list) return [];
|
|
12
10
|
return Array.isArray(list) ? list : JSON.stringify(list) === '{}' ? [] : [list];
|
|
13
11
|
};
|
|
14
|
-
|
|
12
|
+
const isRemoteLoad = (mode, props) => {
|
|
15
13
|
if (mode === 'table') {
|
|
16
14
|
return !(props && Array.isArray(props.data));
|
|
17
15
|
}
|
|
18
16
|
return !(props && Array.isArray(props.treeData));
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const getOverlaySize = function (mode) {
|
|
19
|
+
let isRemoteLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
20
|
+
let maxHeight = arguments.length > 2 ? arguments[2] : undefined;
|
|
21
|
+
let height = arguments.length > 3 ? arguments[3] : undefined;
|
|
24
22
|
var _a;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const screenH = 720;
|
|
24
|
+
const treeOverlay = "".concat(maxHeight || 254, "px");
|
|
25
|
+
const listOverlay = "".concat(maxHeight || 232, "px");
|
|
28
26
|
// let largeScreenH = 880;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const largeTreeOverlayH = "".concat(maxHeight || 338, "px");
|
|
28
|
+
const largeListOverlayH = "".concat(maxHeight || 304, "px");
|
|
29
|
+
const clientH = document.documentElement.clientHeight;
|
|
30
|
+
const fixHeight = height !== undefined ? 'height' : 'maxHeight';
|
|
33
31
|
if (mode === 'tree') {
|
|
34
32
|
//tree
|
|
35
33
|
if (clientH <= screenH) {
|
|
36
34
|
//小屏幕
|
|
37
35
|
return isRemoteLoad ? {
|
|
38
36
|
height: treeOverlay
|
|
39
|
-
} :
|
|
37
|
+
} : {
|
|
38
|
+
[fixHeight]: treeOverlay
|
|
39
|
+
};
|
|
40
40
|
}
|
|
41
41
|
//大屏幕
|
|
42
42
|
return isRemoteLoad ? {
|
|
43
43
|
height: largeTreeOverlayH
|
|
44
|
-
} :
|
|
44
|
+
} : {
|
|
45
|
+
[fixHeight]: largeTreeOverlayH
|
|
46
|
+
};
|
|
45
47
|
} else if (mode === 'list') {
|
|
46
48
|
//list
|
|
47
49
|
if (clientH <= screenH) {
|
|
48
|
-
return isRemoteLoad ?
|
|
50
|
+
return isRemoteLoad ? {
|
|
51
|
+
[fixHeight]: listOverlay
|
|
52
|
+
} : {
|
|
53
|
+
[fixHeight]: listOverlay
|
|
54
|
+
};
|
|
49
55
|
}
|
|
50
|
-
return isRemoteLoad ?
|
|
56
|
+
return isRemoteLoad ? {
|
|
57
|
+
[fixHeight]: largeListOverlayH
|
|
58
|
+
} : {
|
|
59
|
+
[fixHeight]: largeListOverlayH
|
|
60
|
+
};
|
|
51
61
|
} else {
|
|
52
62
|
//table
|
|
53
63
|
return {
|
|
54
|
-
width: '900px',
|
|
55
64
|
height: "".concat((_a = maxHeight !== null && maxHeight !== void 0 ? maxHeight : height) !== null && _a !== void 0 ? _a : 380, "px")
|
|
56
65
|
};
|
|
57
66
|
}
|
|
58
67
|
};
|
|
59
68
|
// 实现一个防抖函数,debounce接受一个函数func和delay时间作为参数,返回一个防抖函数。使用泛型T保证返回防抖函数的类型与原func一致
|
|
60
69
|
function debounce(func, delay) {
|
|
61
|
-
|
|
70
|
+
let timer;
|
|
62
71
|
return function () {
|
|
63
|
-
var _this = this;
|
|
64
72
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
65
73
|
args[_key] = arguments[_key];
|
|
66
74
|
}
|
|
67
75
|
if (timer) clearTimeout(timer);
|
|
68
|
-
timer = setTimeout(
|
|
69
|
-
func.apply(
|
|
76
|
+
timer = setTimeout(() => {
|
|
77
|
+
func.apply(this, args);
|
|
70
78
|
}, delay);
|
|
71
79
|
};
|
|
72
80
|
}
|
package/index.js
CHANGED
|
@@ -5,13 +5,13 @@ export { Breadcrumbs } from './Breadcrumbs/index.js';
|
|
|
5
5
|
export { Button } from './Button/index.js';
|
|
6
6
|
export { ButtonGroup } from './ButtonGroup/index.js';
|
|
7
7
|
export { Carousel } from './Carousel/index.js';
|
|
8
|
-
export { C as Cascader } from './_verture/index-
|
|
8
|
+
export { C as Cascader } from './_verture/index-0ced30f7.js';
|
|
9
9
|
export { Checkbox } from './Checkbox/index.js';
|
|
10
10
|
export { CheckboxGroup } from './CheckboxGroup/index.js';
|
|
11
11
|
export { Collapse } from './Collapse/index.js';
|
|
12
12
|
export { default as CollapseBox } from './CollapseBox/index.js';
|
|
13
13
|
export { default as CollapseLayout } from './CollapseLayout/index.js';
|
|
14
|
-
export { C as ChromePicker, S as ColorPicker, a as CompactPicker, b as SwatchesPicker } from './_verture/index-
|
|
14
|
+
export { C as ChromePicker, S as ColorPicker, a as CompactPicker, b as SwatchesPicker } from './_verture/index-775ad32d.js';
|
|
15
15
|
export { ComboSelect } from './ComboSelect/index.js';
|
|
16
16
|
export { Container } from './Container/index.js';
|
|
17
17
|
export { default as CopyText } from './CopyText/index.js';
|
|
@@ -20,12 +20,12 @@ export { default as Descriptions } from './Descriptions/index.js';
|
|
|
20
20
|
export { Desktop } from './Desktop/index.js';
|
|
21
21
|
export { DragVerify } from './DragVerify/index.js';
|
|
22
22
|
export { Drawer } from './Drawer/index.js';
|
|
23
|
-
export { D as Dropdown } from './_verture/index-
|
|
23
|
+
export { D as Dropdown } from './_verture/index-da9097d3.js';
|
|
24
24
|
export { default as DynamicMultiBox } from './DynamicMultiBox/index.js';
|
|
25
25
|
export { default as Empty } from './Empty/index.js';
|
|
26
26
|
export { default as Form } from './Form/index.js';
|
|
27
|
-
export { F as FormItem } from './_verture/index-
|
|
28
|
-
export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-
|
|
27
|
+
export { F as FormItem } from './_verture/index-ef1235fb.js';
|
|
28
|
+
export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-5df08980.js';
|
|
29
29
|
export { default as GlobalContext, changeConfirmLocale, getConfirmLocale } from './GlobalContext/index.js';
|
|
30
30
|
export { default as Help } from './Help/index.js';
|
|
31
31
|
export { default as HelperText } from './HelperText/index.js';
|
|
@@ -70,32 +70,30 @@ export { Title } from './Title/index.js';
|
|
|
70
70
|
export { ToggleButton, ToggleButtonGroup } from './ToggleButton/index.js';
|
|
71
71
|
export { Tooltip } from './Tooltip/index.js';
|
|
72
72
|
export { SSortablejs, Transfer } from './Transfer/index.js';
|
|
73
|
-
export { T as Tree } from './_verture/index-
|
|
73
|
+
export { T as Tree } from './_verture/index-f186b5e8.js';
|
|
74
74
|
export { default as Upload } from './Upload/index.js';
|
|
75
75
|
export { default as locale } from './locale/index.js';
|
|
76
|
-
import './_verture/slicedToArray-a8206399.js';
|
|
77
|
-
import './_verture/unsupportedIterableToArray-cb478f24.js';
|
|
78
76
|
import 'react/jsx-runtime';
|
|
79
77
|
import 'react';
|
|
80
78
|
import 'react-dom';
|
|
81
79
|
import '@paraview/lib';
|
|
82
|
-
import './_verture/constant-
|
|
80
|
+
import './_verture/constant-5317fc89.js';
|
|
83
81
|
import '@para-ui/icons/More';
|
|
84
82
|
import './_verture/style-inject.es-300983ab.js';
|
|
85
|
-
import './_verture/typeof-adeedc13.js';
|
|
86
83
|
import 'clsx';
|
|
87
|
-
import './_verture/toConsumableArray-8f4c9589.js';
|
|
88
84
|
import '@para-ui/icons/Return';
|
|
89
|
-
import './_verture/useFormatMessage-
|
|
85
|
+
import './_verture/useFormatMessage-eb13cf56.js';
|
|
90
86
|
import '@para-ui/core/GlobalContext';
|
|
91
87
|
import './_verture/tslib.es6-55ed4bd2.js';
|
|
92
88
|
import '@para-ui/icons/LoadingF';
|
|
93
89
|
import '@para-ui/icons/Down';
|
|
94
90
|
import '@para-ui/icons/Forbid';
|
|
95
|
-
import './_verture/defineProperty-1d116156.js';
|
|
96
91
|
import 'react-slick';
|
|
97
92
|
import '@para-ui/icons/RightCircleF';
|
|
98
93
|
import '@para-ui/icons/LeftCircleF';
|
|
94
|
+
import './_verture/slicedToArray-8223a2ef.js';
|
|
95
|
+
import './_verture/defineProperty-1d116156.js';
|
|
96
|
+
import './_verture/typeof-adeedc13.js';
|
|
99
97
|
import 'rc-motion';
|
|
100
98
|
import './_verture/typeof-c310ee4a.js';
|
|
101
99
|
import 'rc-tree/lib/utils/conductUtil';
|
|
@@ -105,15 +103,14 @@ import 'rc-tree/lib/utils/treeUtil';
|
|
|
105
103
|
import '@para-ui/icons';
|
|
106
104
|
import 'rc-collapse';
|
|
107
105
|
import 'react-transition-group';
|
|
108
|
-
import './_verture/util-
|
|
109
|
-
import '@para-ui/icons/
|
|
110
|
-
import '@para-ui/icons/
|
|
106
|
+
import './_verture/util-82646c4f.js';
|
|
107
|
+
import '@para-ui/icons/LeftTriangleF';
|
|
108
|
+
import '@para-ui/icons/RightTriangleF';
|
|
111
109
|
import 'react-color';
|
|
112
|
-
import './_verture/index-232d890b.js';
|
|
113
110
|
import '@para-ui/icons/Search';
|
|
114
111
|
import '@para-ui/icons/Close';
|
|
115
|
-
import './_verture/utils-
|
|
116
|
-
import './_verture/useGlobalProps-
|
|
112
|
+
import './_verture/utils-46e99c9a.js';
|
|
113
|
+
import './_verture/useGlobalProps-1e416658.js';
|
|
117
114
|
import '@para-ui/icons/Copy';
|
|
118
115
|
import '@para-ui/icons/CheckS';
|
|
119
116
|
import 'rc-picker/es/generate/dayjs';
|
|
@@ -124,11 +121,12 @@ import 'rc-picker/lib/locale/en_US';
|
|
|
124
121
|
import 'rc-picker/lib/locale/zh_CN';
|
|
125
122
|
import '@para-ui/icons/SortRight';
|
|
126
123
|
import '@para-ui/icons/Left';
|
|
124
|
+
import '@para-ui/icons/DoubleRight';
|
|
127
125
|
import '@para-ui/icons/Check';
|
|
128
126
|
import '@para-ui/icons/Refresh';
|
|
129
127
|
import 'rc-drawer';
|
|
130
128
|
import 'rc-dropdown';
|
|
131
|
-
import './_verture/usePopupContainer-
|
|
129
|
+
import './_verture/usePopupContainer-635f66f4.js';
|
|
132
130
|
import 'dayjs';
|
|
133
131
|
import '@para-ui/icons/Panel';
|
|
134
132
|
import '@para-ui/icons/PlusCircleF';
|
|
@@ -137,8 +135,8 @@ import '@para-ui/icons/Drag';
|
|
|
137
135
|
import './_verture/sortable.esm-49896035.js';
|
|
138
136
|
import '@para-ui/icons/LinkGroup';
|
|
139
137
|
import '@para-ui/icons/UploadFile';
|
|
140
|
-
import './_verture/intl-
|
|
141
|
-
import './_verture/index-
|
|
138
|
+
import './_verture/intl-f2f27722.js';
|
|
139
|
+
import './_verture/index-c568f272.js';
|
|
142
140
|
import '@para-ui/icons/Help';
|
|
143
141
|
import '@para-ui/icons/Internet';
|
|
144
142
|
import 'rc-input-number';
|
|
@@ -150,6 +148,7 @@ import '@para-ui/icons/CheckCircleF';
|
|
|
150
148
|
import 'rc-dialog';
|
|
151
149
|
import 'rc-notification';
|
|
152
150
|
import 'rc-pagination';
|
|
151
|
+
import '@para-ui/icons/DoubleLeft';
|
|
153
152
|
import '@para-ui/icons/WarningCircle';
|
|
154
153
|
import 'rc-progress';
|
|
155
154
|
import 'rc-slider';
|