@pisell/materials 6.0.1 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/es/components/dataSourceComponents/fields/Upload/BaseUpload.js +61 -32
- package/es/components/dataSourceComponents/fields/Upload/index.less +1 -0
- package/lib/components/dataSourceComponents/fields/Upload/BaseUpload.js +51 -26
- package/lib/components/dataSourceComponents/fields/Upload/index.less +1 -0
- package/package.json +3 -3
|
@@ -25,7 +25,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
25
25
|
import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
26
26
|
import { PlusOutlined } from '@ant-design/icons';
|
|
27
27
|
import { Upload, Image } from 'antd';
|
|
28
|
-
import { useDebounceFn } from 'ahooks';
|
|
28
|
+
import { useDebounceFn, useMemoizedFn } from 'ahooks';
|
|
29
29
|
import { isBoolean } from '@pisell/utils';
|
|
30
30
|
import IconFont from "../../../iconfont";
|
|
31
31
|
import PisellModal from "../../../pisellModal";
|
|
@@ -419,6 +419,36 @@ var BaseUpload = function BaseUpload(props) {
|
|
|
419
419
|
onClick: handleGlobeIconClick
|
|
420
420
|
}));
|
|
421
421
|
}, [restProps.disabled, handleGlobeIconClick]);
|
|
422
|
+
var itemRender = useMemoizedFn(function (originNode, file) {
|
|
423
|
+
var _useState13 = useState(''),
|
|
424
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
425
|
+
itemUrl = _useState14[0],
|
|
426
|
+
setItemUrl = _useState14[1];
|
|
427
|
+
useEffect(function () {
|
|
428
|
+
getItemUrl(file).then(setItemUrl);
|
|
429
|
+
}, [file]);
|
|
430
|
+
var newNode = /*#__PURE__*/React.cloneElement(originNode, {
|
|
431
|
+
children: React.Children.map(originNode.props.children, function (child) {
|
|
432
|
+
if ((child === null || child === void 0 ? void 0 : child.type) === 'a') {
|
|
433
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
434
|
+
children: React.Children.map(child.props.children, function (grandChild) {
|
|
435
|
+
if ((grandChild === null || grandChild === void 0 ? void 0 : grandChild.type) === 'img') {
|
|
436
|
+
return /*#__PURE__*/React.cloneElement(grandChild, {
|
|
437
|
+
src: itemUrl,
|
|
438
|
+
onError: function onError() {
|
|
439
|
+
return handleImageError(file);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
return grandChild;
|
|
444
|
+
})
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return child;
|
|
448
|
+
})
|
|
449
|
+
});
|
|
450
|
+
return newNode;
|
|
451
|
+
});
|
|
422
452
|
var uploadProps = _objectSpread(_objectSpread({}, restProps), {}, {
|
|
423
453
|
multiple: multiple,
|
|
424
454
|
showUploadList: {
|
|
@@ -457,38 +487,37 @@ var BaseUpload = function BaseUpload(props) {
|
|
|
457
487
|
},
|
|
458
488
|
headers: getHeaders === null || getHeaders === void 0 ? void 0 : getHeaders(),
|
|
459
489
|
beforeUpload: beforeUpload,
|
|
460
|
-
className: 'pisell-data-source-upload'
|
|
461
|
-
itemRender:
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
return newNode;
|
|
490
|
-
}
|
|
490
|
+
className: 'pisell-data-source-upload'
|
|
491
|
+
// itemRender: (originNode: React.ReactElement, file: UploadFile) => {
|
|
492
|
+
// const [itemUrl, setItemUrl] = useState<string>('');
|
|
493
|
+
|
|
494
|
+
// useEffect(() => {
|
|
495
|
+
// getItemUrl(file).then(setItemUrl);
|
|
496
|
+
// }, [file]);
|
|
497
|
+
|
|
498
|
+
// const newNode = React.cloneElement(originNode, {
|
|
499
|
+
// children: React.Children.map(originNode.props.children, child => {
|
|
500
|
+
// if (child?.type === 'a') {
|
|
501
|
+
// return React.cloneElement(child, {
|
|
502
|
+
// children: React.Children.map(child.props.children, grandChild => {
|
|
503
|
+
// if (grandChild?.type === 'img') {
|
|
504
|
+
// return React.cloneElement(grandChild, {
|
|
505
|
+
// src: itemUrl,
|
|
506
|
+
// onError: () => handleImageError(file)
|
|
507
|
+
// });
|
|
508
|
+
// }
|
|
509
|
+
// return grandChild;
|
|
510
|
+
// })
|
|
511
|
+
// });
|
|
512
|
+
// }
|
|
513
|
+
// return child;
|
|
514
|
+
// })
|
|
515
|
+
// });
|
|
516
|
+
|
|
517
|
+
// return newNode;
|
|
518
|
+
// }
|
|
491
519
|
});
|
|
520
|
+
|
|
492
521
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(PisellUpload, _extends({}, uploadProps, {
|
|
493
522
|
fileList: fileList
|
|
494
523
|
}), fileList.length >= calcMaxCount ? null : renderUploadButton(!!enableMultilingual)), /*#__PURE__*/React.createElement(PisellModal, {
|
|
@@ -378,6 +378,31 @@ var BaseUpload = (props) => {
|
|
|
378
378
|
),
|
|
379
379
|
[restProps.disabled, handleGlobeIconClick]
|
|
380
380
|
);
|
|
381
|
+
const itemRender = (0, import_ahooks.useMemoizedFn)((originNode, file) => {
|
|
382
|
+
const [itemUrl, setItemUrl] = (0, import_react.useState)("");
|
|
383
|
+
(0, import_react.useEffect)(() => {
|
|
384
|
+
getItemUrl(file).then(setItemUrl);
|
|
385
|
+
}, [file]);
|
|
386
|
+
const newNode = import_react.default.cloneElement(originNode, {
|
|
387
|
+
children: import_react.default.Children.map(originNode.props.children, (child) => {
|
|
388
|
+
if ((child == null ? void 0 : child.type) === "a") {
|
|
389
|
+
return import_react.default.cloneElement(child, {
|
|
390
|
+
children: import_react.default.Children.map(child.props.children, (grandChild) => {
|
|
391
|
+
if ((grandChild == null ? void 0 : grandChild.type) === "img") {
|
|
392
|
+
return import_react.default.cloneElement(grandChild, {
|
|
393
|
+
src: itemUrl,
|
|
394
|
+
onError: () => handleImageError(file)
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
return grandChild;
|
|
398
|
+
})
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
return child;
|
|
402
|
+
})
|
|
403
|
+
});
|
|
404
|
+
return newNode;
|
|
405
|
+
});
|
|
381
406
|
const uploadProps = {
|
|
382
407
|
...restProps,
|
|
383
408
|
multiple,
|
|
@@ -412,32 +437,32 @@ var BaseUpload = (props) => {
|
|
|
412
437
|
}),
|
|
413
438
|
headers: getHeaders == null ? void 0 : getHeaders(),
|
|
414
439
|
beforeUpload,
|
|
415
|
-
className: "pisell-data-source-upload"
|
|
416
|
-
itemRender: (originNode, file) => {
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
}
|
|
440
|
+
className: "pisell-data-source-upload"
|
|
441
|
+
// itemRender: (originNode: React.ReactElement, file: UploadFile) => {
|
|
442
|
+
// const [itemUrl, setItemUrl] = useState<string>('');
|
|
443
|
+
// useEffect(() => {
|
|
444
|
+
// getItemUrl(file).then(setItemUrl);
|
|
445
|
+
// }, [file]);
|
|
446
|
+
// const newNode = React.cloneElement(originNode, {
|
|
447
|
+
// children: React.Children.map(originNode.props.children, child => {
|
|
448
|
+
// if (child?.type === 'a') {
|
|
449
|
+
// return React.cloneElement(child, {
|
|
450
|
+
// children: React.Children.map(child.props.children, grandChild => {
|
|
451
|
+
// if (grandChild?.type === 'img') {
|
|
452
|
+
// return React.cloneElement(grandChild, {
|
|
453
|
+
// src: itemUrl,
|
|
454
|
+
// onError: () => handleImageError(file)
|
|
455
|
+
// });
|
|
456
|
+
// }
|
|
457
|
+
// return grandChild;
|
|
458
|
+
// })
|
|
459
|
+
// });
|
|
460
|
+
// }
|
|
461
|
+
// return child;
|
|
462
|
+
// })
|
|
463
|
+
// });
|
|
464
|
+
// return newNode;
|
|
465
|
+
// }
|
|
441
466
|
};
|
|
442
467
|
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_pisellUpload.default, { ...uploadProps, fileList }, fileList.length >= calcMaxCount ? null : renderUploadButton(!!enableMultilingual)), /* @__PURE__ */ import_react.default.createElement(
|
|
443
468
|
import_pisellModal.default,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pisell/materials",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"module": "./es/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
66
66
|
"crypto-js": "^4.2.0",
|
|
67
67
|
"@zxing/library": "0.21.2",
|
|
68
|
-
"@pisell/utils": "1.0.42",
|
|
69
68
|
"@pisell/date-picker": "1.0.100",
|
|
70
|
-
"@pisell/icon": "0.0.11"
|
|
69
|
+
"@pisell/icon": "0.0.11",
|
|
70
|
+
"@pisell/utils": "1.0.42"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"react": "^18.0.0",
|