zmdms-webui 1.0.8 → 1.1.0
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/dist/es/button/button.js +12 -4
- package/dist/es/node_modules/@babel/runtime/helpers/esm/createClass.js +2 -2
- package/dist/es/node_modules/@babel/runtime/helpers/esm/defineProperty.js +2 -2
- package/dist/es/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +5 -8
- package/dist/es/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +8 -8
- package/dist/es/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +5 -5
- package/dist/es/node_modules/antd-img-crop/dist/antd-img-crop.esm.js +64 -35
- package/dist/es/node_modules/classnames/index.js +45 -27
- package/dist/es/node_modules/rc-resize-observer/es/Collection.js +3 -2
- package/dist/es/node_modules/rc-resize-observer/es/SingleObserver/index.js +20 -8
- package/dist/es/node_modules/rc-resize-observer/es/utils/observerUtil.js +4 -1
- package/dist/es/node_modules/rc-util/es/Dom/dynamicCSS.js +9 -4
- package/dist/es/node_modules/rc-util/es/hooks/useMemo.js +12 -0
- package/dist/es/node_modules/rc-util/es/raf.js +6 -1
- package/dist/es/node_modules/rc-util/es/ref.js +16 -3
- package/dist/es/node_modules/rc-util/es/warning.js +18 -3
- package/dist/es/node_modules/react-easy-crop/index.module.js +10 -4
- package/dist/es/node_modules/react-is/cjs/react-is.development.js +80 -40
- package/dist/es/node_modules/react-is/cjs/react-is.production.min.js +7 -7
- package/dist/es/select/hooks.js +14 -7
- package/dist/es/select/interface.d.ts +8 -0
- package/dist/es/select/select.js +3 -1
- package/package.json +5 -3
package/dist/es/button/button.js
CHANGED
|
@@ -40,13 +40,21 @@ var Button = function (props) {
|
|
|
40
40
|
_a.sent();
|
|
41
41
|
_a.label = 3;
|
|
42
42
|
case 3:
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
// 防止onClick内部没有开启微任务
|
|
44
|
+
// 当连续点击三次按钮:创建了三个任务在队列中
|
|
45
|
+
// 如果点击事件中,有同步任务阻塞,但是没有异步任务,那么点击的三个任务还是会依次执行(导致重复点击)
|
|
46
|
+
// 此时执行完onClick后 再开启一个宏任务,可以先执行排队中的三个任务,这样 canClick还是false,不会重复执行点击事件
|
|
47
|
+
setTimeout(function () {
|
|
48
|
+
setLoading(false);
|
|
49
|
+
currentBtn.current.canClick = true;
|
|
50
|
+
});
|
|
45
51
|
return [3 /*break*/, 5];
|
|
46
52
|
case 4:
|
|
47
53
|
err_1 = _a.sent();
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
setLoading(false);
|
|
56
|
+
currentBtn.current.canClick = true;
|
|
57
|
+
});
|
|
50
58
|
throw err_1;
|
|
51
59
|
case 5: return [2 /*return*/];
|
|
52
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import toPropertyKey from './toPropertyKey.js';
|
|
2
2
|
|
|
3
3
|
function _defineProperties(target, props) {
|
|
4
4
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -6,7 +6,7 @@ function _defineProperties(target, props) {
|
|
|
6
6
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
7
7
|
descriptor.configurable = true;
|
|
8
8
|
if ("value" in descriptor) descriptor.writable = true;
|
|
9
|
-
Object.defineProperty(target,
|
|
9
|
+
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import toPropertyKey from './toPropertyKey.js';
|
|
2
2
|
|
|
3
3
|
function _defineProperty(obj, key, value) {
|
|
4
|
-
key =
|
|
4
|
+
key = toPropertyKey(key);
|
|
5
5
|
if (key in obj) {
|
|
6
6
|
Object.defineProperty(obj, key, {
|
|
7
7
|
value: value,
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
function _isNativeReflectConstruct() {
|
|
2
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
3
|
-
if (Reflect.construct.sham) return false;
|
|
4
|
-
if (typeof Proxy === "function") return true;
|
|
5
2
|
try {
|
|
6
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return
|
|
10
|
-
}
|
|
3
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
4
|
+
} catch (t) {}
|
|
5
|
+
return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {
|
|
6
|
+
return !!t;
|
|
7
|
+
})();
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
export { _isNativeReflectConstruct as default };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _typeof from './typeof.js';
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
if (
|
|
5
|
-
var
|
|
6
|
-
if (
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
3
|
+
function toPrimitive(t, r) {
|
|
4
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
5
|
+
var e = t[Symbol.toPrimitive];
|
|
6
|
+
if (void 0 !== e) {
|
|
7
|
+
var i = e.call(t, r || "default");
|
|
8
|
+
if ("object" != _typeof(i)) return i;
|
|
9
9
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10
10
|
}
|
|
11
|
-
return (
|
|
11
|
+
return ("string" === r ? String : Number)(t);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export {
|
|
14
|
+
export { toPrimitive as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _typeof from './typeof.js';
|
|
2
|
-
import
|
|
2
|
+
import toPrimitive from './toPrimitive.js';
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
var
|
|
6
|
-
return _typeof(
|
|
4
|
+
function toPropertyKey(t) {
|
|
5
|
+
var i = toPrimitive(t, "string");
|
|
6
|
+
return "symbol" == _typeof(i) ? i : String(i);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export {
|
|
9
|
+
export { toPropertyKey as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __awaiter, __rest } from '../../../_virtual/_tslib.js';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { version } from 'antd';
|
|
4
4
|
import AntModal from 'antd/es/modal';
|
|
@@ -176,71 +176,100 @@ const ImgCrop = forwardRef((props, cropperRef) => {
|
|
|
176
176
|
const [modalImage, setModalImage] = useState('');
|
|
177
177
|
const onCancel = useRef();
|
|
178
178
|
const onOk = useRef();
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return
|
|
179
|
+
const runBeforeUpload = useCallback(({ beforeUpload, file, resolve, reject, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
180
|
+
const rawFile = file;
|
|
181
|
+
if (typeof beforeUpload !== 'function') {
|
|
182
|
+
resolve(rawFile);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
// https://ant.design/components/upload-cn#api
|
|
187
|
+
// https://github.com/ant-design/ant-design/blob/master/components/upload/Upload.tsx#L152-L178
|
|
188
|
+
const result = yield beforeUpload(file, [file]);
|
|
189
|
+
if (result === false) {
|
|
190
|
+
resolve(false);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
resolve((result !== true && result) || rawFile);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
reject(err);
|
|
198
|
+
}
|
|
199
|
+
}), []);
|
|
200
|
+
const getNewBeforeUpload = useCallback((beforeUpload) => {
|
|
201
|
+
return ((file, fileList) => {
|
|
202
|
+
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
203
|
+
let processedFile = file;
|
|
184
204
|
if (typeof cb.current.beforeCrop === 'function') {
|
|
185
205
|
try {
|
|
186
206
|
const result = yield cb.current.beforeCrop(file, fileList);
|
|
207
|
+
if (result === false) {
|
|
208
|
+
return runBeforeUpload({ beforeUpload, file, resolve, reject }); // not open modal
|
|
209
|
+
}
|
|
187
210
|
if (result !== true) {
|
|
188
|
-
|
|
211
|
+
processedFile = result || file; // will open modal
|
|
189
212
|
}
|
|
190
213
|
}
|
|
191
214
|
catch (err) {
|
|
192
|
-
return resolve
|
|
215
|
+
return runBeforeUpload({ beforeUpload, file, resolve, reject }); // not open modal
|
|
193
216
|
}
|
|
194
217
|
}
|
|
195
|
-
//
|
|
218
|
+
// read file
|
|
196
219
|
const reader = new FileReader();
|
|
197
220
|
reader.addEventListener('load', () => {
|
|
198
221
|
if (typeof reader.result === 'string') {
|
|
199
222
|
setModalImage(reader.result); // open modal
|
|
200
223
|
}
|
|
201
224
|
});
|
|
202
|
-
reader.readAsDataURL(
|
|
225
|
+
reader.readAsDataURL(processedFile);
|
|
203
226
|
// on modal cancel
|
|
204
227
|
onCancel.current = () => {
|
|
205
228
|
var _a, _b;
|
|
206
229
|
setModalImage('');
|
|
207
230
|
easyCropRef.current.onReset();
|
|
208
|
-
|
|
209
|
-
(_b = (_a = cb.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a)
|
|
231
|
+
let hasResolveCalled = false;
|
|
232
|
+
(_b = (_a = cb.current).onModalCancel) === null || _b === void 0 ? void 0 : _b.call(_a, (LIST_IGNORE) => {
|
|
233
|
+
resolve(LIST_IGNORE);
|
|
234
|
+
hasResolveCalled = true;
|
|
235
|
+
});
|
|
236
|
+
if (!hasResolveCalled) {
|
|
237
|
+
resolve(AntUpload.LIST_IGNORE);
|
|
238
|
+
}
|
|
210
239
|
};
|
|
211
240
|
// on modal confirm
|
|
212
241
|
onOk.current = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
213
242
|
setModalImage('');
|
|
214
243
|
easyCropRef.current.onReset();
|
|
215
244
|
const canvas = getCropCanvas(event.target);
|
|
216
|
-
const { type, name, uid } =
|
|
245
|
+
const { type, name, uid } = processedFile;
|
|
217
246
|
canvas.toBlob((blob) => __awaiter(void 0, void 0, void 0, function* () {
|
|
218
|
-
var _a, _b, _c, _d, _e, _f;
|
|
219
247
|
const newFile = new File([blob], name, { type });
|
|
220
248
|
Object.assign(newFile, { uid });
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
resolve(err);
|
|
236
|
-
(_f = (_e = cb.current).onModalOk) === null || _f === void 0 ? void 0 : _f.call(_e, err);
|
|
237
|
-
}
|
|
249
|
+
runBeforeUpload({
|
|
250
|
+
beforeUpload,
|
|
251
|
+
file: newFile,
|
|
252
|
+
resolve: (file) => {
|
|
253
|
+
var _a, _b;
|
|
254
|
+
resolve(file);
|
|
255
|
+
(_b = (_a = cb.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, file);
|
|
256
|
+
},
|
|
257
|
+
reject: (err) => {
|
|
258
|
+
var _a, _b;
|
|
259
|
+
reject(err);
|
|
260
|
+
(_b = (_a = cb.current).onModalOk) === null || _b === void 0 ? void 0 : _b.call(_a, err);
|
|
261
|
+
},
|
|
262
|
+
});
|
|
238
263
|
}), type, quality);
|
|
239
264
|
});
|
|
240
265
|
}));
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
|
|
266
|
+
});
|
|
267
|
+
}, [getCropCanvas, quality, runBeforeUpload]);
|
|
268
|
+
const getNewUpload = useCallback((children) => {
|
|
269
|
+
const upload = Array.isArray(children) ? children[0] : children;
|
|
270
|
+
const _a = upload.props, { beforeUpload, accept } = _a, restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
|
|
271
|
+
return Object.assign(Object.assign({}, upload), { props: Object.assign(Object.assign({}, restUploadProps), { accept: accept || 'image/*', beforeUpload: getNewBeforeUpload(beforeUpload) }) });
|
|
272
|
+
}, [getNewBeforeUpload]);
|
|
244
273
|
/**
|
|
245
274
|
* modal
|
|
246
275
|
*/
|
|
@@ -259,7 +288,7 @@ const ImgCrop = forwardRef((props, cropperRef) => {
|
|
|
259
288
|
const isCN = lang === 'zh-CN';
|
|
260
289
|
const title = modalTitle || (isCN ? '编辑图片' : 'Edit image');
|
|
261
290
|
const resetBtnText = resetText || (isCN ? '重置' : 'Reset');
|
|
262
|
-
return (jsxs(Fragment, { children: [
|
|
291
|
+
return (jsxs(Fragment, { children: [getNewUpload(children), modalImage && (jsx(AntModal, Object.assign({}, modalProps, modalBaseProps, { [openProp]: true, title: title, onCancel: onCancel.current, onOk: onOk.current, wrapClassName: wrapClassName, maskClosable: false, destroyOnClose: true, children: jsx(EasyCrop$1, { ref: easyCropRef, cropperRef: cropperRef, zoomSlider: zoomSlider, rotationSlider: rotationSlider, aspectSlider: aspectSlider, showReset: showReset, resetBtnText: resetBtnText, modalImage: modalImage, aspect: aspect, minZoom: minZoom, maxZoom: maxZoom, cropShape: cropShape, showGrid: showGrid, cropperProps: cropperProps }) })))] }));
|
|
263
292
|
});
|
|
264
293
|
|
|
265
294
|
export { ImgCrop as default };
|
|
@@ -14,39 +14,57 @@ import { __module as classnames } from '../../_virtual/index.js';
|
|
|
14
14
|
|
|
15
15
|
var hasOwn = {}.hasOwnProperty;
|
|
16
16
|
|
|
17
|
-
function classNames() {
|
|
18
|
-
var classes =
|
|
17
|
+
function classNames () {
|
|
18
|
+
var classes = '';
|
|
19
19
|
|
|
20
20
|
for (var i = 0; i < arguments.length; i++) {
|
|
21
21
|
var arg = arguments[i];
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
var argType = typeof arg;
|
|
25
|
-
|
|
26
|
-
if (argType === 'string' || argType === 'number') {
|
|
27
|
-
classes.push(arg);
|
|
28
|
-
} else if (Array.isArray(arg)) {
|
|
29
|
-
if (arg.length) {
|
|
30
|
-
var inner = classNames.apply(null, arg);
|
|
31
|
-
if (inner) {
|
|
32
|
-
classes.push(inner);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
} else if (argType === 'object') {
|
|
36
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
37
|
-
classes.push(arg.toString());
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
for (var key in arg) {
|
|
42
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
43
|
-
classes.push(key);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
22
|
+
if (arg) {
|
|
23
|
+
classes = appendClass(classes, parseValue(arg));
|
|
46
24
|
}
|
|
47
25
|
}
|
|
48
26
|
|
|
49
|
-
return classes
|
|
27
|
+
return classes;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function parseValue (arg) {
|
|
31
|
+
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
32
|
+
return arg;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeof arg !== 'object') {
|
|
36
|
+
return '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (Array.isArray(arg)) {
|
|
40
|
+
return classNames.apply(null, arg);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
44
|
+
return arg.toString();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var classes = '';
|
|
48
|
+
|
|
49
|
+
for (var key in arg) {
|
|
50
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
51
|
+
classes = appendClass(classes, key);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return classes;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function appendClass (value, newClass) {
|
|
59
|
+
if (!newClass) {
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (value) {
|
|
64
|
+
return value + ' ' + newClass;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return value + newClass;
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
if (module.exports) {
|
|
@@ -20,12 +20,13 @@ function Collection(_ref) {
|
|
|
20
20
|
});
|
|
21
21
|
Promise.resolve().then(function () {
|
|
22
22
|
if (currentId === resizeIdRef.current) {
|
|
23
|
-
onBatchResize === null || onBatchResize === void 0
|
|
23
|
+
onBatchResize === null || onBatchResize === void 0 || onBatchResize(resizeInfosRef.current);
|
|
24
24
|
resizeInfosRef.current = [];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
|
|
27
28
|
// Continue bubbling if parent exist
|
|
28
|
-
onCollectionResize === null || onCollectionResize === void 0
|
|
29
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(size, element, data);
|
|
29
30
|
}, [onBatchResize, onCollectionResize]);
|
|
30
31
|
return /*#__PURE__*/React.createElement(CollectionContext.Provider, {
|
|
31
32
|
value: onResize
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _objectSpread2 from '../../../@babel/runtime/helpers/esm/objectSpread2.js';
|
|
2
|
-
import
|
|
3
|
-
import * as React from 'react';
|
|
2
|
+
import _typeof from '../../../@babel/runtime/helpers/esm/typeof.js';
|
|
4
3
|
import findDOMNode from '../../../rc-util/es/Dom/findDOMNode.js';
|
|
4
|
+
import { supportRef, useComposeRef } from '../../../rc-util/es/ref.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { CollectionContext } from '../Collection.js';
|
|
5
7
|
import { observe, unobserve } from '../utils/observerUtil.js';
|
|
6
8
|
import DomWrapper from './DomWrapper.js';
|
|
7
|
-
import { CollectionContext } from '../Collection.js';
|
|
8
9
|
|
|
9
10
|
function SingleObserver(props, ref) {
|
|
10
11
|
var children = props.children,
|
|
@@ -12,9 +13,11 @@ function SingleObserver(props, ref) {
|
|
|
12
13
|
var elementRef = React.useRef(null);
|
|
13
14
|
var wrapperRef = React.useRef(null);
|
|
14
15
|
var onCollectionResize = React.useContext(CollectionContext);
|
|
16
|
+
|
|
15
17
|
// =========================== Children ===========================
|
|
16
18
|
var isRenderProps = typeof children === 'function';
|
|
17
19
|
var mergedChildren = isRenderProps ? children(elementRef) : children;
|
|
20
|
+
|
|
18
21
|
// ============================= Size =============================
|
|
19
22
|
var sizeRef = React.useRef({
|
|
20
23
|
width: -1,
|
|
@@ -22,21 +25,25 @@ function SingleObserver(props, ref) {
|
|
|
22
25
|
offsetWidth: -1,
|
|
23
26
|
offsetHeight: -1
|
|
24
27
|
});
|
|
28
|
+
|
|
25
29
|
// ============================= Ref ==============================
|
|
26
30
|
var canRef = !isRenderProps && /*#__PURE__*/React.isValidElement(mergedChildren) && supportRef(mergedChildren);
|
|
27
31
|
var originRef = canRef ? mergedChildren.ref : null;
|
|
28
|
-
var mergedRef =
|
|
29
|
-
return composeRef(originRef, elementRef);
|
|
30
|
-
}, [originRef, elementRef]);
|
|
32
|
+
var mergedRef = useComposeRef(originRef, elementRef);
|
|
31
33
|
var getDom = function getDom() {
|
|
32
|
-
|
|
34
|
+
var _elementRef$current;
|
|
35
|
+
return findDOMNode(elementRef.current) || (
|
|
36
|
+
// Support `nativeElement` format
|
|
37
|
+
elementRef.current && _typeof(elementRef.current) === 'object' ? findDOMNode((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.nativeElement) : null) || findDOMNode(wrapperRef.current);
|
|
33
38
|
};
|
|
34
39
|
React.useImperativeHandle(ref, function () {
|
|
35
40
|
return getDom();
|
|
36
41
|
});
|
|
42
|
+
|
|
37
43
|
// =========================== Observe ============================
|
|
38
44
|
var propsRef = React.useRef(props);
|
|
39
45
|
propsRef.current = props;
|
|
46
|
+
|
|
40
47
|
// Handler
|
|
41
48
|
var onInternalResize = React.useCallback(function (target) {
|
|
42
49
|
var _propsRef$current = propsRef.current,
|
|
@@ -47,6 +54,7 @@ function SingleObserver(props, ref) {
|
|
|
47
54
|
height = _target$getBoundingCl.height;
|
|
48
55
|
var offsetWidth = target.offsetWidth,
|
|
49
56
|
offsetHeight = target.offsetHeight;
|
|
57
|
+
|
|
50
58
|
/**
|
|
51
59
|
* Resize observer trigger when content size changed.
|
|
52
60
|
* In most case we just care about element size,
|
|
@@ -62,6 +70,7 @@ function SingleObserver(props, ref) {
|
|
|
62
70
|
offsetHeight: offsetHeight
|
|
63
71
|
};
|
|
64
72
|
sizeRef.current = size;
|
|
73
|
+
|
|
65
74
|
// IE is strange, right?
|
|
66
75
|
var mergedOffsetWidth = offsetWidth === Math.round(width) ? width : offsetWidth;
|
|
67
76
|
var mergedOffsetHeight = offsetHeight === Math.round(height) ? height : offsetHeight;
|
|
@@ -69,8 +78,9 @@ function SingleObserver(props, ref) {
|
|
|
69
78
|
offsetWidth: mergedOffsetWidth,
|
|
70
79
|
offsetHeight: mergedOffsetHeight
|
|
71
80
|
});
|
|
81
|
+
|
|
72
82
|
// Let collection know what happened
|
|
73
|
-
onCollectionResize === null || onCollectionResize === void 0
|
|
83
|
+
onCollectionResize === null || onCollectionResize === void 0 || onCollectionResize(sizeInfo, target, data);
|
|
74
84
|
if (onResize) {
|
|
75
85
|
// defer the callback but not defer to next frame
|
|
76
86
|
Promise.resolve().then(function () {
|
|
@@ -79,6 +89,7 @@ function SingleObserver(props, ref) {
|
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
}, []);
|
|
92
|
+
|
|
82
93
|
// Dynamic observe
|
|
83
94
|
React.useEffect(function () {
|
|
84
95
|
var currentElement = getDom();
|
|
@@ -89,6 +100,7 @@ function SingleObserver(props, ref) {
|
|
|
89
100
|
return unobserve(currentElement, onInternalResize);
|
|
90
101
|
};
|
|
91
102
|
}, [elementRef.current, disabled]);
|
|
103
|
+
|
|
92
104
|
// ============================ Render ============================
|
|
93
105
|
return /*#__PURE__*/React.createElement(DomWrapper, {
|
|
94
106
|
ref: wrapperRef
|
|
@@ -6,16 +6,19 @@ function onResize(entities) {
|
|
|
6
6
|
entities.forEach(function (entity) {
|
|
7
7
|
var _elementListeners$get;
|
|
8
8
|
var target = entity.target;
|
|
9
|
-
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0
|
|
9
|
+
(_elementListeners$get = elementListeners.get(target)) === null || _elementListeners$get === void 0 || _elementListeners$get.forEach(function (listener) {
|
|
10
10
|
return listener(target);
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
+
|
|
14
15
|
// Note: ResizeObserver polyfill not support option to measure border-box resize
|
|
15
16
|
var resizeObserver = new index(onResize);
|
|
17
|
+
|
|
16
18
|
// Dev env only
|
|
17
19
|
process.env.NODE_ENV !== 'production' ? elementListeners : null; // eslint-disable-line
|
|
18
20
|
process.env.NODE_ENV !== 'production' ? onResize : null; // eslint-disable-line
|
|
21
|
+
|
|
19
22
|
// ============================== Observe ==============================
|
|
20
23
|
function observe(element, callback) {
|
|
21
24
|
if (!elementListeners.has(element)) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectSpread2 from '../../../@babel/runtime/helpers/esm/objectSpread2.js';
|
|
1
2
|
import canUseDom from './canUseDom.js';
|
|
2
3
|
import contains from './contains.js';
|
|
3
4
|
|
|
@@ -60,7 +61,7 @@ function injectCSS(css) {
|
|
|
60
61
|
if (prepend) {
|
|
61
62
|
// If is queue `prepend`, it will prepend first style and then append rest style
|
|
62
63
|
if (isPrependQueue) {
|
|
63
|
-
var existStyle = findStyles(container).filter(function (node) {
|
|
64
|
+
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
|
|
64
65
|
// Ignore style which not injected by rc-util with prepend
|
|
65
66
|
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
66
67
|
return false;
|
|
@@ -86,7 +87,7 @@ function injectCSS(css) {
|
|
|
86
87
|
function findExistNode(key) {
|
|
87
88
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
88
89
|
var container = getContainer(option);
|
|
89
|
-
return findStyles(container).find(function (node) {
|
|
90
|
+
return (option.styles || findStyles(container)).find(function (node) {
|
|
90
91
|
return node.getAttribute(getMark(option)) === key;
|
|
91
92
|
});
|
|
92
93
|
}
|
|
@@ -106,8 +107,12 @@ function syncRealContainer(container, option) {
|
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
109
|
function updateCSS(css, key) {
|
|
109
|
-
var
|
|
110
|
-
var container = getContainer(
|
|
110
|
+
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
111
|
+
var container = getContainer(originOption);
|
|
112
|
+
var styles = findStyles(container);
|
|
113
|
+
var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
|
|
114
|
+
styles: styles
|
|
115
|
+
});
|
|
111
116
|
|
|
112
117
|
// Sync real parent
|
|
113
118
|
syncRealContainer(container, option);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
function useMemo(getValue, condition, shouldUpdate) {
|
|
4
|
+
var cacheRef = React.useRef({});
|
|
5
|
+
if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
|
|
6
|
+
cacheRef.current.value = getValue();
|
|
7
|
+
cacheRef.current.condition = condition;
|
|
8
|
+
}
|
|
9
|
+
return cacheRef.current.value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { useMemo as default };
|
|
@@ -43,8 +43,13 @@ var wrapperRaf = function wrapperRaf(callback) {
|
|
|
43
43
|
};
|
|
44
44
|
wrapperRaf.cancel = function (id) {
|
|
45
45
|
var realId = rafIds.get(id);
|
|
46
|
-
cleanup(
|
|
46
|
+
cleanup(id);
|
|
47
47
|
return caf(realId);
|
|
48
48
|
};
|
|
49
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
50
|
+
wrapperRaf.ids = function () {
|
|
51
|
+
return rafIds;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
49
54
|
|
|
50
55
|
export { wrapperRaf as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _typeof from '../../@babel/runtime/helpers/esm/typeof.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import { r as reactIsExports } from '../../react-is/index.js';
|
|
4
|
+
import useMemo from './hooks/useMemo.js';
|
|
4
5
|
|
|
5
6
|
function fillRef(ref, node) {
|
|
6
7
|
if (typeof ref === 'function') {
|
|
@@ -29,21 +30,33 @@ function composeRef() {
|
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
function useComposeRef() {
|
|
34
|
+
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
35
|
+
refs[_key2] = arguments[_key2];
|
|
36
|
+
}
|
|
37
|
+
return useMemo(function () {
|
|
38
|
+
return composeRef.apply(void 0, refs);
|
|
39
|
+
}, refs, function (prev, next) {
|
|
40
|
+
return prev.length !== next.length || prev.every(function (ref, i) {
|
|
41
|
+
return ref !== next[i];
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
32
45
|
function supportRef(nodeOrComponent) {
|
|
33
46
|
var _type$prototype, _nodeOrComponent$prot;
|
|
34
47
|
var type = reactIsExports.isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;
|
|
35
48
|
|
|
36
49
|
// Function component node
|
|
37
|
-
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
|
|
50
|
+
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== reactIsExports.ForwardRef) {
|
|
38
51
|
return false;
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
// Class component
|
|
42
|
-
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render)) {
|
|
55
|
+
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== reactIsExports.ForwardRef) {
|
|
43
56
|
return false;
|
|
44
57
|
}
|
|
45
58
|
return true;
|
|
46
59
|
}
|
|
47
60
|
/* eslint-enable */
|
|
48
61
|
|
|
49
|
-
export { composeRef, fillRef, supportRef };
|
|
62
|
+
export { composeRef, fillRef, supportRef, useComposeRef };
|
|
@@ -9,8 +9,19 @@ var preWarningFns = [];
|
|
|
9
9
|
var preMessage = function preMessage(fn) {
|
|
10
10
|
preWarningFns.push(fn);
|
|
11
11
|
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Warning if condition not match.
|
|
15
|
+
* @param valid Condition
|
|
16
|
+
* @param message Warning message
|
|
17
|
+
* @example
|
|
18
|
+
* ```js
|
|
19
|
+
* warning(false, 'some error'); // print some error
|
|
20
|
+
* warning(true, 'some error'); // print nothing
|
|
21
|
+
* warning(1 === 2, 'some error'); // print some error
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
12
24
|
function warning(valid, message) {
|
|
13
|
-
// Support uglify
|
|
14
25
|
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
15
26
|
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
16
27
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
|
|
@@ -20,8 +31,9 @@ function warning(valid, message) {
|
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
}
|
|
34
|
+
|
|
35
|
+
/** @see Similar to {@link warning} */
|
|
23
36
|
function note(valid, message) {
|
|
24
|
-
// Support uglify
|
|
25
37
|
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
26
38
|
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
27
39
|
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
|
|
@@ -40,15 +52,18 @@ function call(method, valid, message) {
|
|
|
40
52
|
warned[message] = true;
|
|
41
53
|
}
|
|
42
54
|
}
|
|
55
|
+
|
|
56
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
43
57
|
function warningOnce(valid, message) {
|
|
44
58
|
call(warning, valid, message);
|
|
45
59
|
}
|
|
60
|
+
|
|
61
|
+
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
46
62
|
function noteOnce(valid, message) {
|
|
47
63
|
call(note, valid, message);
|
|
48
64
|
}
|
|
49
65
|
warningOnce.preMessage = preMessage;
|
|
50
66
|
warningOnce.resetWarned = resetWarned;
|
|
51
67
|
warningOnce.noteOnce = noteOnce;
|
|
52
|
-
/* eslint-enable */
|
|
53
68
|
|
|
54
69
|
export { call, warningOnce as default, note, noteOnce, preMessage, resetWarned, warning, warningOnce };
|
|
@@ -246,7 +246,8 @@ var Cropper = /** @class */function (_super) {
|
|
|
246
246
|
_this.resizeObserver = null;
|
|
247
247
|
_this.state = {
|
|
248
248
|
cropSize: null,
|
|
249
|
-
hasWheelJustStarted: false
|
|
249
|
+
hasWheelJustStarted: false,
|
|
250
|
+
mediaObjectFit: undefined
|
|
250
251
|
};
|
|
251
252
|
_this.initResizeObserver = function () {
|
|
252
253
|
if (typeof window.ResizeObserver === 'undefined' || !_this.containerRef) {
|
|
@@ -326,8 +327,7 @@ var Cropper = /** @class */function (_super) {
|
|
|
326
327
|
// However, for this to work, the container should not be rotated
|
|
327
328
|
var renderedMediaSize = void 0;
|
|
328
329
|
if (isMediaScaledDown) {
|
|
329
|
-
|
|
330
|
-
switch (objectFit) {
|
|
330
|
+
switch (_this.state.mediaObjectFit) {
|
|
331
331
|
default:
|
|
332
332
|
case 'contain':
|
|
333
333
|
renderedMediaSize = containerAspect > mediaAspect ? {
|
|
@@ -683,6 +683,12 @@ var Cropper = /** @class */function (_super) {
|
|
|
683
683
|
if (prevProps.video !== this.props.video) {
|
|
684
684
|
(_j = this.videoRef.current) === null || _j === void 0 ? void 0 : _j.load();
|
|
685
685
|
}
|
|
686
|
+
var objectFit = this.getObjectFit();
|
|
687
|
+
if (objectFit !== this.state.mediaObjectFit) {
|
|
688
|
+
this.setState({
|
|
689
|
+
mediaObjectFit: objectFit
|
|
690
|
+
}, this.computeSizes);
|
|
691
|
+
}
|
|
686
692
|
};
|
|
687
693
|
Cropper.prototype.getAspect = function () {
|
|
688
694
|
var _a = this.props,
|
|
@@ -759,7 +765,7 @@ var Cropper = /** @class */function (_super) {
|
|
|
759
765
|
containerClassName = _d.containerClassName,
|
|
760
766
|
cropAreaClassName = _d.cropAreaClassName,
|
|
761
767
|
mediaClassName = _d.mediaClassName;
|
|
762
|
-
var objectFit = this.
|
|
768
|
+
var objectFit = this.state.mediaObjectFit;
|
|
763
769
|
return React__default.createElement("div", {
|
|
764
770
|
onMouseDown: this.onMouseDown,
|
|
765
771
|
onTouchStart: this.onTouchStart,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __exports as reactIs_development } from '../../../_virtual/react-is.development.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
4
5
|
* react-is.development.js
|
|
5
6
|
*
|
|
6
7
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -15,38 +16,67 @@ function requireReactIs_development () {
|
|
|
15
16
|
if (hasRequiredReactIs_development) return reactIs_development;
|
|
16
17
|
hasRequiredReactIs_development = 1;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
19
|
if (process.env.NODE_ENV !== "production") {
|
|
21
20
|
(function() {
|
|
22
21
|
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
var
|
|
22
|
+
// ATTENTION
|
|
23
|
+
// When adding new symbols to this file,
|
|
24
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
25
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
26
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
27
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
28
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
29
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
30
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
31
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
32
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
33
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
34
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
35
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
36
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
37
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
38
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
39
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
40
|
+
|
|
41
|
+
// -----------------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
44
|
+
var enableCacheElement = false;
|
|
45
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
46
|
+
|
|
47
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
48
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
49
|
+
// issues in DEV builds.
|
|
50
|
+
|
|
51
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
52
|
+
|
|
53
|
+
var REACT_MODULE_REFERENCE;
|
|
54
|
+
|
|
55
|
+
{
|
|
56
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
57
|
+
}
|
|
46
58
|
|
|
47
59
|
function isValidElementType(type) {
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
61
|
+
return true;
|
|
62
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (typeof type === 'object' && type !== null) {
|
|
70
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
71
|
+
// types supported by any Flight configuration anywhere since
|
|
72
|
+
// we don't know which Flight build this will end up being used
|
|
73
|
+
// with.
|
|
74
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return false;
|
|
50
80
|
}
|
|
51
81
|
|
|
52
82
|
function typeOf(object) {
|
|
@@ -58,18 +88,18 @@ function requireReactIs_development () {
|
|
|
58
88
|
var type = object.type;
|
|
59
89
|
|
|
60
90
|
switch (type) {
|
|
61
|
-
case REACT_ASYNC_MODE_TYPE:
|
|
62
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
63
91
|
case REACT_FRAGMENT_TYPE:
|
|
64
92
|
case REACT_PROFILER_TYPE:
|
|
65
93
|
case REACT_STRICT_MODE_TYPE:
|
|
66
94
|
case REACT_SUSPENSE_TYPE:
|
|
95
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
67
96
|
return type;
|
|
68
97
|
|
|
69
98
|
default:
|
|
70
99
|
var $$typeofType = type && type.$$typeof;
|
|
71
100
|
|
|
72
101
|
switch ($$typeofType) {
|
|
102
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
73
103
|
case REACT_CONTEXT_TYPE:
|
|
74
104
|
case REACT_FORWARD_REF_TYPE:
|
|
75
105
|
case REACT_LAZY_TYPE:
|
|
@@ -89,10 +119,7 @@ function requireReactIs_development () {
|
|
|
89
119
|
}
|
|
90
120
|
|
|
91
121
|
return undefined;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
95
|
-
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
122
|
+
}
|
|
96
123
|
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
97
124
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
98
125
|
var Element = REACT_ELEMENT_TYPE;
|
|
@@ -104,21 +131,31 @@ function requireReactIs_development () {
|
|
|
104
131
|
var Profiler = REACT_PROFILER_TYPE;
|
|
105
132
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
106
133
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
107
|
-
var
|
|
134
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
135
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
136
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
108
137
|
|
|
109
138
|
function isAsyncMode(object) {
|
|
110
139
|
{
|
|
111
140
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
112
141
|
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
113
142
|
|
|
114
|
-
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React
|
|
143
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
115
144
|
}
|
|
116
145
|
}
|
|
117
146
|
|
|
118
|
-
return
|
|
147
|
+
return false;
|
|
119
148
|
}
|
|
120
149
|
function isConcurrentMode(object) {
|
|
121
|
-
|
|
150
|
+
{
|
|
151
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
152
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
153
|
+
|
|
154
|
+
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return false;
|
|
122
159
|
}
|
|
123
160
|
function isContextConsumer(object) {
|
|
124
161
|
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
@@ -153,9 +190,10 @@ function requireReactIs_development () {
|
|
|
153
190
|
function isSuspense(object) {
|
|
154
191
|
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
155
192
|
}
|
|
193
|
+
function isSuspenseList(object) {
|
|
194
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
195
|
+
}
|
|
156
196
|
|
|
157
|
-
reactIs_development.AsyncMode = AsyncMode;
|
|
158
|
-
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
159
197
|
reactIs_development.ContextConsumer = ContextConsumer;
|
|
160
198
|
reactIs_development.ContextProvider = ContextProvider;
|
|
161
199
|
reactIs_development.Element = Element;
|
|
@@ -167,6 +205,7 @@ function requireReactIs_development () {
|
|
|
167
205
|
reactIs_development.Profiler = Profiler;
|
|
168
206
|
reactIs_development.StrictMode = StrictMode;
|
|
169
207
|
reactIs_development.Suspense = Suspense;
|
|
208
|
+
reactIs_development.SuspenseList = SuspenseList;
|
|
170
209
|
reactIs_development.isAsyncMode = isAsyncMode;
|
|
171
210
|
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
172
211
|
reactIs_development.isContextConsumer = isContextConsumer;
|
|
@@ -180,6 +219,7 @@ function requireReactIs_development () {
|
|
|
180
219
|
reactIs_development.isProfiler = isProfiler;
|
|
181
220
|
reactIs_development.isStrictMode = isStrictMode;
|
|
182
221
|
reactIs_development.isSuspense = isSuspense;
|
|
222
|
+
reactIs_development.isSuspenseList = isSuspenseList;
|
|
183
223
|
reactIs_development.isValidElementType = isValidElementType;
|
|
184
224
|
reactIs_development.typeOf = typeOf;
|
|
185
225
|
})();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __exports as reactIs_production_min } from '../../../_virtual/react-is.production.min.js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @license React
|
|
4
5
|
* react-is.production.min.js
|
|
5
6
|
*
|
|
6
7
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -14,12 +15,11 @@ var hasRequiredReactIs_production_min;
|
|
|
14
15
|
function requireReactIs_production_min () {
|
|
15
16
|
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
16
17
|
hasRequiredReactIs_production_min = 1;
|
|
17
|
-
var b=
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
reactIs_production_min.
|
|
21
|
-
reactIs_production_min.
|
|
22
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
18
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
19
|
+
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
20
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
21
|
+
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
22
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
|
|
23
23
|
return reactIs_production_min;
|
|
24
24
|
}
|
|
25
25
|
|
package/dist/es/select/hooks.js
CHANGED
|
@@ -34,8 +34,12 @@ var concatHandle = function (arr1, _a) {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
function createRenderItem(item, options) {
|
|
37
|
-
var _a = options.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = options.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = options.joinKey, _c = options.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = options.lineFeedKey, _d = options.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d;
|
|
38
|
-
|
|
37
|
+
var _a = options.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = options.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = options.joinKey, _c = options.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = options.lineFeedKey, _d = options.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, createKey = options.createKey, createId = options.createId, index = options.index;
|
|
38
|
+
// 自定义id值
|
|
39
|
+
if (createId) {
|
|
40
|
+
item[dataKey] = createId(item, index);
|
|
41
|
+
}
|
|
42
|
+
var key = createKey ? createKey(item, index) : item[dataKey];
|
|
39
43
|
var value = item[dataKey];
|
|
40
44
|
var title = unescapeString(item[titleKey]);
|
|
41
45
|
// 处理拼接展示的数据
|
|
@@ -74,7 +78,7 @@ function createRenderItem(item, options) {
|
|
|
74
78
|
};
|
|
75
79
|
}
|
|
76
80
|
function useRenderChildren(props) {
|
|
77
|
-
var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, joinStr = props.joinStr, lineFeedKey = props.lineFeedKey, lineFeedStr = props.lineFeedStr, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues;
|
|
81
|
+
var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, joinStr = props.joinStr, lineFeedKey = props.lineFeedKey, lineFeedStr = props.lineFeedStr, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, createKey = props.createKey, createId = props.createId;
|
|
78
82
|
var resultList = useMemo(function () {
|
|
79
83
|
return concatHandle(list, {
|
|
80
84
|
arr2: defaultList,
|
|
@@ -99,6 +103,9 @@ function useRenderChildren(props) {
|
|
|
99
103
|
joinStr: joinStr,
|
|
100
104
|
lineFeedKey: lineFeedKey,
|
|
101
105
|
lineFeedStr: lineFeedStr,
|
|
106
|
+
createKey: createKey,
|
|
107
|
+
createId: createId,
|
|
108
|
+
index: index,
|
|
102
109
|
}), key = _a.key, value = _a.value, title = _a.title, joinTitleStr = _a.joinTitleStr, resultTitle = _a.resultTitle, linefeedTitle = _a.linefeedTitle;
|
|
103
110
|
// 处理是否禁用
|
|
104
111
|
var disabled = item === null || item === void 0 ? void 0 : item.disabled;
|
|
@@ -106,11 +113,11 @@ function useRenderChildren(props) {
|
|
|
106
113
|
disabledValues.includes(value)) {
|
|
107
114
|
disabled = true;
|
|
108
115
|
}
|
|
109
|
-
return (jsxs(MemoSelect.Option
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
return (jsxs(MemoSelect.Option, __assign({
|
|
117
|
+
// key={key}
|
|
118
|
+
value: value,
|
|
112
119
|
// 原本传入需要显示的title
|
|
113
|
-
oldTitle: title, joinTitle: joinTitleStr, title: resultTitle, disabled: disabled }, { children: [resultTitle, Array.isArray(linefeedTitle) && linefeedTitle.length > 0 ? (jsx("div", __assign({ className: "ztxk-select--feed-item" }, { children: linefeedTitle === null || linefeedTitle === void 0 ? void 0 : linefeedTitle.join(lineFeedStr) }))) : ("")] }), key));
|
|
120
|
+
oldTitle: title, joinTitle: joinTitleStr, title: resultTitle, disabled: disabled }, { children: [resultTitle, Array.isArray(linefeedTitle) && linefeedTitle.length > 0 ? (jsx("div", __assign({ className: "ztxk-select--feed-item" }, { children: linefeedTitle === null || linefeedTitle === void 0 ? void 0 : linefeedTitle.join(lineFeedStr) }))) : ("")] }), "".concat(key).concat(index)));
|
|
114
121
|
})] }));
|
|
115
122
|
}
|
|
116
123
|
return null;
|
|
@@ -11,6 +11,14 @@ interface ISelectProps extends SelectProps {
|
|
|
11
11
|
* 默认渲染的列表
|
|
12
12
|
*/
|
|
13
13
|
defaultList?: any[];
|
|
14
|
+
/**
|
|
15
|
+
* 遍历数据的key值
|
|
16
|
+
*/
|
|
17
|
+
createKey?: (data: any, index?: number) => string;
|
|
18
|
+
/**
|
|
19
|
+
* 自定义id键值
|
|
20
|
+
*/
|
|
21
|
+
createId?: (data: any, index?: number) => string;
|
|
14
22
|
/**
|
|
15
23
|
* data key
|
|
16
24
|
*/
|
package/dist/es/select/select.js
CHANGED
|
@@ -24,7 +24,7 @@ function textContent(children) {
|
|
|
24
24
|
return "";
|
|
25
25
|
}
|
|
26
26
|
var Select = function (props, ref) {
|
|
27
|
-
var list = props.list, defaultList = props.defaultList, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, _c = props.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = props.lineFeedKey, _d = props.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, _e = props.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _e === void 0 ? 100 : _e, onChange = props.onChange, onSearch = props.onSearch, isRemoteSearch = props.isRemoteSearch, dropdownButton = props.dropdownButton, dropdownRender = props.dropdownRender, resetProps = __rest(props, ["list", "defaultList", "dataKey", "titleKey", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "showAll", "children", "disabledValues", "dropdownMatchSelectWidth", "onChange", "onSearch", "isRemoteSearch", "dropdownButton", "dropdownRender"]);
|
|
27
|
+
var list = props.list, defaultList = props.defaultList, createKey = props.createKey, createId = props.createId, _a = props.dataKey, dataKey = _a === void 0 ? "id" : _a, _b = props.titleKey, titleKey = _b === void 0 ? "name" : _b, joinKey = props.joinKey, _c = props.joinStr, joinStr = _c === void 0 ? "-" : _c, lineFeedKey = props.lineFeedKey, _d = props.lineFeedStr, lineFeedStr = _d === void 0 ? "-" : _d, showAll = props.showAll, children = props.children, disabledValues = props.disabledValues, _e = props.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _e === void 0 ? 100 : _e, onChange = props.onChange, onSearch = props.onSearch, isRemoteSearch = props.isRemoteSearch, dropdownButton = props.dropdownButton, dropdownRender = props.dropdownRender, resetProps = __rest(props, ["list", "defaultList", "createKey", "createId", "dataKey", "titleKey", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "showAll", "children", "disabledValues", "dropdownMatchSelectWidth", "onChange", "onSearch", "isRemoteSearch", "dropdownButton", "dropdownRender"]);
|
|
28
28
|
// 记录当前选中项 只有当多选模式下 才需要用到这个选项
|
|
29
29
|
var _f = useRemeberCheckedValues(), parseCheckedValues = _f.parseCheckedValues, currentCheckedValuesRef = _f.currentCheckedValuesRef;
|
|
30
30
|
/**
|
|
@@ -44,6 +44,8 @@ var Select = function (props, ref) {
|
|
|
44
44
|
disabledValues: disabledValues,
|
|
45
45
|
value: resetProps.value,
|
|
46
46
|
mode: resetProps.mode,
|
|
47
|
+
createKey: createKey,
|
|
48
|
+
createId: createId,
|
|
47
49
|
}), renderChildren = _g.renderChildren, resultList = _g.resultList;
|
|
48
50
|
// 非change触发记录下选中项
|
|
49
51
|
var _h = useInitRemeberCheckedValues({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zmdms-webui",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -70,13 +70,15 @@
|
|
|
70
70
|
"@rollup/plugin-terser": "^0.4.0",
|
|
71
71
|
"@rollup/plugin-url": "^8.0.1",
|
|
72
72
|
"@storybook/addon-essentials": "^7.6.16",
|
|
73
|
-
"@storybook/addon-interactions": "^7.6.
|
|
73
|
+
"@storybook/addon-interactions": "^7.6.17",
|
|
74
74
|
"@storybook/addon-links": "^7.6.16",
|
|
75
75
|
"@storybook/addon-onboarding": "1.0.11",
|
|
76
76
|
"@storybook/blocks": "^7.6.16",
|
|
77
|
+
"@storybook/jest": "^0.2.3",
|
|
77
78
|
"@storybook/react": "^7.6.16",
|
|
78
79
|
"@storybook/react-webpack5": "^7.6.16",
|
|
79
80
|
"@storybook/test": "^7.6.16",
|
|
81
|
+
"@storybook/testing-library": "^0.2.2",
|
|
80
82
|
"@testing-library/jest-dom": "^5.16.5",
|
|
81
83
|
"@testing-library/react": "^13.4.0",
|
|
82
84
|
"@testing-library/user-event": "^13.5.0",
|
|
@@ -124,7 +126,7 @@
|
|
|
124
126
|
"storybook": "^7.6.16",
|
|
125
127
|
"typescript": "^4.9.5",
|
|
126
128
|
"web-vitals": "^2.1.4",
|
|
127
|
-
"zmdms-utils": "^0.0.
|
|
129
|
+
"zmdms-utils": "^0.0.62"
|
|
128
130
|
},
|
|
129
131
|
"resolutions": {
|
|
130
132
|
"rc-virtual-list": "3.11.3"
|