@para-ui/core 4.0.32 → 4.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/Anchor/anchorMenu/index.d.ts +16 -0
  2. package/Anchor/index.d.ts +4 -0
  3. package/Anchor/index.js +394 -0
  4. package/Anchor/lang/en_US.d.ts +4 -0
  5. package/Anchor/lang/index.d.ts +9 -0
  6. package/Anchor/lang/zh_CN.d.ts +4 -0
  7. package/Anchor/type.d.ts +42 -0
  8. package/Argv/batchEdit/index.d.ts +18 -0
  9. package/Argv/dataGenerator/config.d.ts +16 -0
  10. package/Argv/dataGenerator/index.d.ts +24 -0
  11. package/Argv/index.d.ts +36 -0
  12. package/Argv/index.js +738 -0
  13. package/Argv/lang/en_US.d.ts +15 -0
  14. package/Argv/lang/index.d.ts +31 -0
  15. package/Argv/lang/zh_CN.d.ts +15 -0
  16. package/AutoBox/index.js +1 -1
  17. package/AutoButton/index.js +3 -3
  18. package/AutoTips/index.js +1 -1
  19. package/Breadcrumbs/index.js +1 -1
  20. package/Button/index.d.ts +2 -2
  21. package/Button/index.js +4 -4
  22. package/ButtonGroup/index.d.ts +4 -0
  23. package/ButtonGroup/index.js +53 -37
  24. package/Card/index.js +1 -1
  25. package/Carousel/index.js +1 -1
  26. package/Cascader/index.js +3 -3
  27. package/Checkbox/index.js +1 -1
  28. package/CheckboxGroup/index.js +1 -1
  29. package/CollapseLayout/index.js +1 -1
  30. package/ComboSelect/index.js +7 -4
  31. package/CopyText/index.js +1 -1
  32. package/CycleSelector/index.js +1 -1
  33. package/DatePicker/index.js +1 -1
  34. package/Descriptions/index.js +1 -1
  35. package/Desktop/index.js +1 -1
  36. package/DragVerify/index.js +1 -1
  37. package/Drawer/index.js +1 -1
  38. package/DynamicMultiBox/index.js +5 -5
  39. package/Form/index.js +7 -4
  40. package/FormItem/index.js +7 -4
  41. package/FunctionModal/index.js +3 -3
  42. package/Help/index.js +1 -1
  43. package/Image/index.js +1 -1
  44. package/InputCode/index.js +1 -1
  45. package/InputLang/index.js +1 -1
  46. package/InputNumber/index.js +1 -1
  47. package/Label/index.js +1 -1
  48. package/Menu/index.js +1 -1
  49. package/Modal/index.js +1 -1
  50. package/MultiBox/index.js +1 -1
  51. package/OperateBtn/index.js +1 -1
  52. package/PageHeader/index.js +1 -1
  53. package/Pagination/index.js +1 -1
  54. package/PopConfirm/index.js +1 -1
  55. package/PopMenu/index.js +1 -1
  56. package/Popover/index.js +1 -1
  57. package/Progress/index.js +1 -1
  58. package/QuickReply/index.js +1 -1
  59. package/README.md +29 -0
  60. package/Radio/index.js +1 -1
  61. package/RadioGroup/index.js +1 -1
  62. package/RangeInput/index.js +1 -1
  63. package/Search/index.js +1 -1
  64. package/Select/index.js +1 -1
  65. package/SelectInput/index.js +1 -1
  66. package/Selector/index.js +53 -41
  67. package/Selector/interface.d.ts +2 -1
  68. package/SelectorPicker/index.js +1 -1
  69. package/SingleBox/index.js +1 -1
  70. package/Slider/index.js +1 -1
  71. package/SortBox/index.d.ts +0 -2
  72. package/SortBox/index.js +9 -9
  73. package/Stepper/index.js +1 -1
  74. package/Switch/index.js +1 -1
  75. package/Table/index.js +555 -499
  76. package/Table/interface.d.ts +9 -1
  77. package/Table/lang/en_US.d.ts +1 -0
  78. package/Table/lang/index.d.ts +2 -0
  79. package/Table/lang/zh_CN.d.ts +1 -0
  80. package/Table/tableBodyElement/index.d.ts +5 -0
  81. package/Table/tableBodyInterface.d.ts +4 -0
  82. package/Table/tableHeadInterface.d.ts +2 -0
  83. package/Tabs/index.js +1 -1
  84. package/Tag/index.js +1 -1
  85. package/TextEditor/index.js +4 -4
  86. package/TextField/index.js +1 -1
  87. package/TimePicker/index.js +1 -1
  88. package/Timeline/index.js +21 -14
  89. package/Title/index.js +1 -1
  90. package/ToggleButton/ToggleButtonGroup.d.ts +4 -2
  91. package/ToggleButton/index.d.ts +4 -3
  92. package/ToggleButton/index.js +51 -37
  93. package/Tooltip/index.js +1 -1
  94. package/Transfer/index.js +1 -1
  95. package/Tree/index.js +3 -3
  96. package/Upload/index.js +79 -23
  97. package/Upload/interface.d.ts +4 -0
  98. package/Upload/util.d.ts +32 -0
  99. package/Utils/index.d.ts +7 -0
  100. package/Utils/index.js +10 -1
  101. package/Utils/type.d.ts +1 -0
  102. package/_verture/{index-519d0a1f.js → index-086e9a6d.js} +1 -1
  103. package/_verture/{index-44152845.js → index-5f0bfdcf.js} +1 -1
  104. package/_verture/{modalContext-10f0c5aa.js → modalContext-205db1f4.js} +1 -1
  105. package/_verture/{tslib.es6-55ed4bd2.js → tslib.es6-f43aa41d.js} +1 -1
  106. package/index.d.ts +4 -0
  107. package/index.js +21 -16
  108. package/locale/en-US.d.ts +18 -0
  109. package/locale/index.d.ts +36 -0
  110. package/locale/index.js +38 -2
  111. package/locale/zh-CN.d.ts +18 -0
  112. package/package.json +6 -4
  113. package/umd/Anchor.js +43 -0
  114. package/umd/Argv.js +43 -0
  115. package/umd/AutoButton.js +5 -5
  116. package/umd/Button.js +1 -1
  117. package/umd/ButtonGroup.js +5 -5
  118. package/umd/CollapseLayout.js +1 -1
  119. package/umd/ComboSelect.js +19 -7
  120. package/umd/CopyText.js +3 -3
  121. package/umd/CycleSelector.js +3 -3
  122. package/umd/DatePicker.js +1 -1
  123. package/umd/Descriptions.js +1 -1
  124. package/umd/Desktop.js +3 -3
  125. package/umd/Drawer.js +1 -1
  126. package/umd/DynamicMultiBox.js +6 -6
  127. package/umd/Form.js +19 -7
  128. package/umd/FormItem.js +19 -7
  129. package/umd/FunctionModal.js +1 -1
  130. package/umd/InputCode.js +3 -3
  131. package/umd/InputLang.js +3 -3
  132. package/umd/Message.js +15 -16
  133. package/umd/Modal.js +1 -1
  134. package/umd/MultiBox.js +3 -3
  135. package/umd/OperateBtn.js +1 -1
  136. package/umd/PageHeader.js +1 -1
  137. package/umd/Pagination.js +3 -3
  138. package/umd/PopConfirm.js +1 -1
  139. package/umd/QuickReply.js +3 -3
  140. package/umd/Search.js +3 -3
  141. package/umd/Selector.js +4 -4
  142. package/umd/SelectorPicker.js +6 -6
  143. package/umd/SingleBox.js +3 -3
  144. package/umd/SortBox.js +1 -1
  145. package/umd/Table.js +19 -7
  146. package/umd/Tabs.js +1 -1
  147. package/umd/TextField.js +2 -2
  148. package/umd/TimePicker.js +1 -1
  149. package/umd/ToggleButton.js +6 -6
  150. package/umd/Transfer.js +2 -2
  151. package/umd/Upload.js +2 -2
  152. package/umd/Utils.js +1 -1
  153. package/umd/locale.js +1 -1
  154. /package/_verture/{index-b037486c.js → index-4c5d6cd7.js} +0 -0
package/Upload/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as __awaiter, _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
1
+ import { _ as __awaiter, a as __rest } from '../_verture/tslib.es6-f43aa41d.js';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef, useMemo, useEffect, memo, forwardRef, useCallback, useImperativeHandle } from 'react';
4
4
  import RcUpload from 'rc-upload';
@@ -21,6 +21,7 @@ import AutoTips from '../AutoTips/index.js';
21
21
  import Image$1 from '../Image/index.js';
22
22
  import OperateBtn from '../OperateBtn/index.js';
23
23
  import { $ as $prefixCls, a as $rcPrefixCls } from '../_verture/constant-5317fc89.js';
24
+ import { UUID } from '@paraview/lib';
24
25
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
25
26
  import Forbid from '@para-ui/icons/Forbid';
26
27
  import { Button } from '../Button/index.js';
@@ -35,7 +36,6 @@ import { Modal } from '../Modal/index.js';
35
36
  import '../_verture/typeof-6ec38efd.js';
36
37
  import 'rc-tooltip';
37
38
  import 'rc-tooltip/lib/placements';
38
- import '@paraview/lib';
39
39
  import '../_verture/Portal-42560ff0.js';
40
40
  import 'react-dom';
41
41
  import 'rc-dialog';
@@ -88,6 +88,62 @@ var isImageUrl = function isImageUrl(file) {
88
88
  }
89
89
  return true;
90
90
  };
91
+ /**
92
+ * 默认文件添加isDefault标示
93
+ * @param defaultFile
94
+ */
95
+ var composeDefaultFile = function composeDefaultFile(defaultFile) {
96
+ if (defaultFile) {
97
+ var newDefaultFile = Object.assign({}, defaultFile);
98
+ newDefaultFile.isDefault = true;
99
+ if (!newDefaultFile.uid) newDefaultFile.uid = UUID();
100
+ return Object.assign({}, newDefaultFile);
101
+ }
102
+ };
103
+ /**
104
+ * 组装默认文件,若存在defaultFileList,则defaultFile不生效
105
+ * @param defaultFileList
106
+ * @param defaultFile
107
+ */
108
+ var composeDefaultFileList = function composeDefaultFileList(defaultFileList, defaultFile) {
109
+ var newDefaultFile = composeDefaultFile(defaultFile);
110
+ if (defaultFileList === null || defaultFileList === void 0 ? void 0 : defaultFileList.length) return defaultFileList;
111
+ if (newDefaultFile) {
112
+ return [newDefaultFile];
113
+ }
114
+ return [];
115
+ };
116
+ /**
117
+ * 处理上传文件列表
118
+ * @param maxAllowed
119
+ * @param uploadedFiles
120
+ * @param initialDefaultFile
121
+ */
122
+ var processUploadFiles = function processUploadFiles(maxAllowed, uploadedFiles, initialDefaultFile) {
123
+ var newUploadedFiles = _toConsumableArray(uploadedFiles);
124
+ // 如果最大允许数量为1,则只保留最后一个文件
125
+ if (maxAllowed === 1) {
126
+ newUploadedFiles = newUploadedFiles.slice(-1);
127
+ } else if (maxAllowed) {
128
+ // 如果指定了最大数量,则截取前 maxAllowed 个文件
129
+ newUploadedFiles = newUploadedFiles.slice(0, maxAllowed);
130
+ }
131
+ //
132
+ // 组合或创建一个新的默认文件
133
+ var newDefaultFile = composeDefaultFile(initialDefaultFile);
134
+ // 如果有新的默认文件并且上传文件列表中有元素
135
+ if (newDefaultFile && newUploadedFiles.length) {
136
+ // 过滤掉所有标记为默认的文件
137
+ newUploadedFiles = newUploadedFiles.filter(function (file) {
138
+ return !file.isDefault;
139
+ });
140
+ }
141
+ // 如果过滤后上传文件列表为空且存在新默认文件,则添加到列表
142
+ if (!newUploadedFiles.length && newDefaultFile) {
143
+ newUploadedFiles = newUploadedFiles.concat(newDefaultFile);
144
+ }
145
+ return _toConsumableArray(newUploadedFiles);
146
+ };
91
147
 
92
148
  var css_248z$4 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/11 下午3:08\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-upload-list-text .upload-list-item {\n margin-top: 10px;\n position: relative;\n}\n.paraui-v4-upload-list-text .upload-list-item-info {\n display: flex;\n align-items: center;\n line-height: 30px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n border-radius: 4px;\n transition: background-color 0.3s;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text {\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 440px;\n height: 30px;\n background-color: rgb(247, 248, 250);\n border-radius: 4px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item {\n display: flex;\n align-items: center;\n flex: 1;\n padding-left: 10px;\n max-width: 76%;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name {\n margin-left: 8px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name {\n color: rgb(29, 33, 38);\n text-decoration: none;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item .upload-list-text-name:hover {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error {\n color: rgb(244, 66, 66);\n cursor: pointer;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error .upload-list-text-name,\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-text-item-error .upload-list-text-name:hover {\n color: rgb(244, 66, 66);\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon {\n line-height: 0;\n opacity: 1;\n transition: opacity 0.3s;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-fileicon svg {\n color: inherit;\n font-size: 18px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg {\n font-size: 18px;\n}\n.paraui-v4-upload-list-text .upload-list-item-info .upload-list-text .upload-list-actions svg:hover {\n background-color: rgb(234, 236, 241);\n border-radius: 2px;\n}\n.paraui-v4-upload-list-text .upload-list-item .upload-list-actions {\n margin-left: auto;\n margin-right: 10px;\n}\n.paraui-v4-upload-list-text .upload-list-item .upload-list-actions > span {\n display: flex;\n align-items: center;\n}\n.paraui-v4-upload-list-picture {\n display: inline-flex;\n align-items: center;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-error {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: rgb(247, 248, 250);\n border: 1px dashed rgb(246, 103, 103);\n border-radius: 4px;\n color: rgb(246, 103, 103);\n}\n.paraui-v4-upload-list-picture .upload-list-picture-error > svg {\n font-size: 30px;\n color: rgb(244, 66, 66);\n margin-bottom: 6px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-error-name {\n font-size: 14px;\n color: rgb(244, 66, 66);\n padding: 0 10px;\n width: 100%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item {\n position: relative;\n display: inline-block;\n width: 100px;\n height: 100px;\n margin-right: 16px;\n border-radius: 4px;\n cursor: default;\n overflow: hidden;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item::before {\n content: \" \";\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background-color: rgba(29, 33, 38, 0.9);\n border-radius: 4px;\n opacity: 0;\n transition: 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item img {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-file {\n font-size: 100px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filea {\n fill: none;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-fileb {\n opacity: 0.4;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filec {\n fill: #2e65e6;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filed {\n fill: #5783eb;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filee {\n fill: #ffb900;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-filef {\n fill: #fff;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-picture-name {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n padding: 0 10px;\n font-size: 12px;\n line-height: 24px;\n text-align: center;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n background-color: rgba(29, 33, 38, 0.9);\n border-radius: 0 0 4px 4px;\n color: rgb(255, 255, 255);\n transition: 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-actions {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n opacity: 0;\n line-height: 0;\n cursor: pointer;\n transition: 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-actions svg {\n color: rgb(255, 255, 255);\n transition: all 0.3s;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item .upload-list-actions svg:hover {\n background-color: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly)::before {\n opacity: 1;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-actions {\n opacity: 1;\n}\n.paraui-v4-upload-list-picture .upload-list-picture-item:hover:not(.upload-list-picture-item-readonly) .upload-list-picture-name {\n opacity: 0;\n}\n\n.paraui-v4-upload-drag .paraui-v4-upload-list-text .upload-list-item-info .upload-list-text {\n width: 590px;\n}";
93
149
  styleInject(css_248z$4);
@@ -283,7 +339,7 @@ var UploadList = function UploadList(props) {
283
339
  icon: previewIcon || jsx(PreviewOpen, {}),
284
340
  key: 'view'
285
341
  });
286
- if (showRemoveIcon && !readonly) list.push({
342
+ if (showRemoveIcon && !readonly && !file.isDefault) list.push({
287
343
  icon: removeIcon || jsx(Delete, {}),
288
344
  key: 'delete'
289
345
  });
@@ -315,7 +371,7 @@ var UploadList = function UploadList(props) {
315
371
  showNum: 2
316
372
  }, operateBtnProps(file, actions)));
317
373
  if (listType === 'picture-card') return pictureCardAction(file);
318
- return !readonly && jsx("div", Object.assign({
374
+ return !readonly && !file.isDefault && jsx("div", Object.assign({
319
375
  className: 'upload-list-actions'
320
376
  }, {
321
377
  children: showRemoveIcon && jsx("span", Object.assign({
@@ -631,9 +687,10 @@ var ImageUpload = function ImageUpload(props) {
631
687
  disabledTooltip = props.disabledTooltip,
632
688
  removeErrorTip = props.removeErrorTip,
633
689
  avatarProps = props.avatarProps,
634
- restProps = __rest(props, ["className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "stash", "uploading", "loading", "showLoading", "defaultImage", "readonly", "onPreview", "actionRender", "operateBtnProps", "disabledTooltip", "removeErrorTip", "avatarProps"]);
690
+ defaultFile = props.defaultFile,
691
+ restProps = __rest(props, ["className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "stash", "uploading", "loading", "showLoading", "defaultImage", "readonly", "onPreview", "actionRender", "operateBtnProps", "disabledTooltip", "removeErrorTip", "avatarProps", "defaultFile"]);
635
692
  var intl = useFormatMessage('Upload', localeJson);
636
- var _useState = useState(defaultFileList),
693
+ var _useState = useState(composeDefaultFileList(defaultFileList, defaultFile)),
637
694
  _useState2 = _slicedToArray(_useState, 2),
638
695
  uploadFileList = _useState2[0],
639
696
  setUploadFileList = _useState2[1]; //文件列表
@@ -845,11 +902,7 @@ var ImageUpload = function ImageUpload(props) {
845
902
  case 16:
846
903
  return _context2.abrupt("return");
847
904
  case 17:
848
- if (maxCount === 1) {
849
- cloneList = cloneList.slice(-1);
850
- } else if (maxCount) {
851
- cloneList = cloneList.slice(0, maxCount);
852
- }
905
+ cloneList = processUploadFiles(maxCount, cloneList, defaultFile);
853
906
  onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
854
907
  setUploadFileList(cloneList);
855
908
  case 20:
@@ -932,10 +985,13 @@ var ImageUpload = function ImageUpload(props) {
932
985
  }, leaveDelay);
933
986
  };
934
987
  useEffect(function () {
935
- if (fileList) {
988
+ var newDefaultFile = composeDefaultFile(defaultFile);
989
+ if (newDefaultFile && !(fileList === null || fileList === void 0 ? void 0 : fileList.length)) {
990
+ setUploadFileList([newDefaultFile]);
991
+ } else if (fileList) {
936
992
  setUploadFileList(_toConsumableArray(fileList));
937
993
  }
938
- }, [fileList]);
994
+ }, [fileList, defaultFile]);
939
995
  //渲染上传列表
940
996
  var renderUploadList = function renderUploadList() {
941
997
  return showUploadList && jsx(UploadList, {
@@ -1641,11 +1697,12 @@ const InternalUpload = props => {
1641
1697
  operateBtnProps,
1642
1698
  actionRender,
1643
1699
  onPreview,
1644
- removeErrorTip
1700
+ removeErrorTip,
1701
+ defaultFile
1645
1702
  } = props,
1646
- restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "loading", "dragArea", "disabledTooltip", "operateBtnProps", "actionRender", "onPreview", "removeErrorTip"]);
1703
+ restProps = __rest(props, ["type", "className", "style", "onStart", "onSuccess", "onError", "onProgress", "onRemove", "beforeUpload", "onChange", "onDrop", "defaultFileList", "fileList", "showUploadList", "maxCount", "children", "itemRender", "showUploadError", "size", "stash", "uploading", "showLoading", "loading", "dragArea", "disabledTooltip", "operateBtnProps", "actionRender", "onPreview", "removeErrorTip", "defaultFile"]);
1647
1704
  const intl = useFormatMessage('Upload', localeJson);
1648
- const [uploadFileList, setUploadFileList] = useState(defaultFileList); //文件列表
1705
+ const [uploadFileList, setUploadFileList] = useState(composeDefaultFileList(defaultFileList, defaultFile)); //文件列表
1649
1706
  const [showLoading, setShowLoading] = useState(false); //upload loading
1650
1707
  const [errTip, setErrTip] = useState(false); //upload error tip
1651
1708
  const {
@@ -1719,11 +1776,7 @@ const InternalUpload = props => {
1719
1776
  const onInternalChange = changedFileList => {
1720
1777
  let cloneList = [...changedFileList];
1721
1778
  // Cut to match count
1722
- if (maxCount === 1) {
1723
- cloneList = cloneList.slice(-1);
1724
- } else if (maxCount) {
1725
- cloneList = cloneList.slice(0, maxCount);
1726
- }
1779
+ cloneList = processUploadFiles(maxCount, cloneList, defaultFile);
1727
1780
  onChange === null || onChange === void 0 ? void 0 : onChange(cloneList);
1728
1781
  setUploadFileList(cloneList);
1729
1782
  };
@@ -1796,10 +1849,13 @@ const InternalUpload = props => {
1796
1849
  }, leaveDelay);
1797
1850
  };
1798
1851
  useEffect(() => {
1799
- if (fileList) {
1852
+ const newDefaultFile = composeDefaultFile(defaultFile);
1853
+ if (newDefaultFile && !(fileList === null || fileList === void 0 ? void 0 : fileList.length)) {
1854
+ setUploadFileList([newDefaultFile]);
1855
+ } else if (fileList) {
1800
1856
  setUploadFileList([...fileList]);
1801
1857
  }
1802
- }, [fileList]);
1858
+ }, [fileList, defaultFile]);
1803
1859
  useEffect(() => {
1804
1860
  setShowLoading(loading);
1805
1861
  }, [loading]);
@@ -32,6 +32,8 @@ export interface UploadFile<T = any> {
32
32
  status?: 'error' | 'done' | 'removed';
33
33
  /** 响应 */
34
34
  response?: string;
35
+ /** 默认文件 */
36
+ isDefault?: boolean;
35
37
  }
36
38
  export interface IShowUploadList {
37
39
  /** 是否显示删除图标 */
@@ -163,6 +165,8 @@ export interface UploadProps<T = any> {
163
165
  * 是否移除错误提示弹窗,默认不移除
164
166
  */
165
167
  removeErrorTip?: boolean;
168
+ /** 默认文件 */
169
+ defaultFile?: UploadFile<T>;
166
170
  }
167
171
  interface IActions {
168
172
  onRemove: () => void;
package/Upload/util.d.ts CHANGED
@@ -5,3 +5,35 @@
5
5
  */
6
6
  import { UploadFile } from "./interface";
7
7
  export declare const isImageUrl: (file: UploadFile) => boolean;
8
+ /**
9
+ * 默认文件添加isDefault标示
10
+ * @param defaultFile
11
+ */
12
+ export declare const composeDefaultFile: (defaultFile?: UploadFile) => {
13
+ uid: string;
14
+ name: string;
15
+ type?: string | undefined;
16
+ size?: number | undefined;
17
+ lastModified?: number | undefined;
18
+ lastModifiedDate?: Date | undefined;
19
+ url?: string | undefined;
20
+ dataUrl?: string | undefined;
21
+ thumbUrl?: string | undefined;
22
+ originFileObj?: import("./interface").RcFile | undefined;
23
+ status?: "error" | "done" | "removed" | undefined;
24
+ response?: string | undefined;
25
+ isDefault?: boolean | undefined;
26
+ } | undefined;
27
+ /**
28
+ * 组装默认文件,若存在defaultFileList,则defaultFile不生效
29
+ * @param defaultFileList
30
+ * @param defaultFile
31
+ */
32
+ export declare const composeDefaultFileList: (defaultFileList: UploadFile[], defaultFile?: UploadFile) => UploadFile<any>[];
33
+ /**
34
+ * 处理上传文件列表
35
+ * @param maxAllowed
36
+ * @param uploadedFiles
37
+ * @param initialDefaultFile
38
+ */
39
+ export declare const processUploadFiles: (maxAllowed: number | undefined, uploadedFiles: UploadFile[], initialDefaultFile?: UploadFile) => UploadFile<any>[];
package/Utils/index.d.ts CHANGED
@@ -8,7 +8,14 @@ interface DateYYYYMMddHHMM {
8
8
  }
9
9
  export declare const getDateYYYYMMddHHMM: (str: string) => DateYYYYMMddHHMM;
10
10
  export declare const pixelReplacement: (str: number | string) => string;
11
+ /**
12
+ * @desc 判断是否为对象
13
+ * @param val
14
+ * @return boolean
15
+ * */
16
+ export declare const isObject: (val: any) => boolean;
11
17
  declare const _default: {
18
+ isObject: (val: any) => boolean;
12
19
  getDateYYYYMMddHHMM: (str: string) => DateYYYYMMddHHMM;
13
20
  pixelReplacement: (str: string | number) => string;
14
21
  };
package/Utils/index.js CHANGED
@@ -21,9 +21,18 @@ const pixelReplacement = str => {
21
21
  }
22
22
  return str;
23
23
  };
24
+ /**
25
+ * @desc 判断是否为对象
26
+ * @param val
27
+ * @return boolean
28
+ * */
29
+ const isObject = val => {
30
+ return Object.prototype.toString.call(val) === '[object Object]';
31
+ };
24
32
  var index = {
33
+ isObject,
25
34
  getDateYYYYMMddHHMM,
26
35
  pixelReplacement
27
36
  };
28
37
 
29
- export { index as default, getDateYYYYMMddHHMM, pixelReplacement };
38
+ export { index as default, getDateYYYYMMddHHMM, isObject, pixelReplacement };
@@ -0,0 +1 @@
1
+ export type IObject = Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { _ as __rest } from './tslib.es6-55ed4bd2.js';
1
+ import { a as __rest } from './tslib.es6-f43aa41d.js';
2
2
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
3
  import { c as clsx, _ as _objectSpread2, r as reactIs, s as supportRef, u as useComposeRef, w as warning, a as _extends, b as _objectWithoutProperties, d as wrapperRaf, e as useEvent$2, f as useLayoutEffect$3, g as composeRef, K as KeyCode, h as fillRef, P as Portal, i as warningOnce, j as useMergedState$2, k as canUseDom$1, l as useMemo$1, n as noteOnce } from './Portal-42560ff0.js';
4
4
  import { _ as _toConsumableArray, a as _iterableToArray } from './toConsumableArray-c7a8028f.js';
@@ -2,7 +2,7 @@ import { _ as _toConsumableArray } from './toConsumableArray-c7a8028f.js';
2
2
  import { _ as _typeof, a as _defineProperty } from './defineProperty-f0e15205.js';
3
3
  import { _ as _slicedToArray } from './slicedToArray-75fa4188.js';
4
4
  import { r as regenerator } from './index-8ac46bd9.js';
5
- import { _ as __rest, a as __awaiter } from './tslib.es6-55ed4bd2.js';
5
+ import { a as __rest, _ as __awaiter } from './tslib.es6-f43aa41d.js';
6
6
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
7
  import React__default, { isValidElement, cloneElement, useRef, useState, useImperativeHandle, useEffect, useMemo } from 'react';
8
8
  import RcTree from 'rc-tree';
@@ -1,4 +1,4 @@
1
- import { a as __awaiter } from './tslib.es6-55ed4bd2.js';
1
+ import { _ as __awaiter } from './tslib.es6-f43aa41d.js';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import React__default from 'react';
4
4
  import { Modal } from '../Modal/index.js';
@@ -35,4 +35,4 @@ function __awaiter(thisArg, _arguments, P, generator) {
35
35
  });
36
36
  }
37
37
 
38
- export { __rest as _, __awaiter as a };
38
+ export { __awaiter as _, __rest as a };
package/index.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ export { default as Anchor } from './Anchor';
2
+ export * from './Anchor';
3
+ export { default as Argv } from './Argv';
4
+ export * from './Argv';
1
5
  export { default as AutoBox } from './AutoBox';
2
6
  export * from './AutoBox';
3
7
  export { default as AutoButton } from './AutoButton';
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ export { default as Anchor } from './Anchor/index.js';
2
+ export { default as Argv, checkArgvData, formatDataToObject, formatObjectToData } from './Argv/index.js';
1
3
  export { AutoBox } from './AutoBox/index.js';
2
4
  export { AutoButton } from './AutoButton/index.js';
3
5
  export { default as AutoTips, AutoTipsMultiline } from './AutoTips/index.js';
@@ -7,7 +9,7 @@ export { Button } from './Button/index.js';
7
9
  export { ButtonGroup } from './ButtonGroup/index.js';
8
10
  export { Card } from './Card/index.js';
9
11
  export { Carousel } from './Carousel/index.js';
10
- export { C as Cascader } from './_verture/index-519d0a1f.js';
12
+ export { C as Cascader } from './_verture/index-086e9a6d.js';
11
13
  export { Checkbox } from './Checkbox/index.js';
12
14
  export { CheckboxGroup } from './CheckboxGroup/index.js';
13
15
  export { Collapse } from './Collapse/index.js';
@@ -28,8 +30,8 @@ export { D as Dropdown } from './_verture/index-bde7aabe.js';
28
30
  export { default as DynamicMultiBox } from './DynamicMultiBox/index.js';
29
31
  export { default as Empty } from './Empty/index.js';
30
32
  export { default as Form } from './Form/index.js';
31
- export { F as FormItem } from './_verture/index-b037486c.js';
32
- export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-10f0c5aa.js';
33
+ export { F as FormItem } from './_verture/index-4c5d6cd7.js';
34
+ export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-205db1f4.js';
33
35
  export { G as GlobalContext, c as changeConfirmLocale, g as getConfirmLocale } from './_verture/index-ca413216.js';
34
36
  export { default as Help } from './Help/index.js';
35
37
  export { default as HelperText } from './HelperText/index.js';
@@ -81,25 +83,30 @@ export { Title } from './Title/index.js';
81
83
  export { ToggleButton, ToggleButtonGroup } from './ToggleButton/index.js';
82
84
  export { Tooltip } from './Tooltip/index.js';
83
85
  export { SSortablejs, Transfer } from './Transfer/index.js';
84
- export { T as Tree } from './_verture/index-44152845.js';
86
+ export { T as Tree } from './_verture/index-5f0bfdcf.js';
85
87
  export { default as Upload } from './Upload/index.js';
86
- export { default as Utils, getDateYYYYMMddHHMM, pixelReplacement } from './Utils/index.js';
88
+ export { default as Utils, getDateYYYYMMddHHMM, isObject, pixelReplacement } from './Utils/index.js';
87
89
  export { default as locale } from './locale/index.js';
90
+ import './_verture/tslib.es6-f43aa41d.js';
88
91
  import 'react/jsx-runtime';
89
92
  import 'react';
90
- import 'react-dom';
91
- import '@paraview/lib';
93
+ import 'clsx';
92
94
  import './_verture/constant-5317fc89.js';
93
- import '@para-ui/icons/More';
95
+ import '@para-ui/icons/Down';
94
96
  import './_verture/style-inject.es-300983ab.js';
95
- import './_verture/tslib.es6-55ed4bd2.js';
96
- import '@para-ui/icons/MoreVert';
97
- import 'clsx';
97
+ import '@para-ui/icons/ToRight';
98
+ import '@para-ui/icons/ToLeft';
99
+ import '@para-ui/icons/PreviewOpen';
98
100
  import './_verture/useFormatMessage-1fc7c957.js';
101
+ import '@paraview/lib';
102
+ import '@para-ui/icons/ExpandPart';
103
+ import '@para-ui/icons/Delete';
104
+ import '@para-ui/icons/PlusCircleF';
105
+ import 'react-dom';
106
+ import '@para-ui/icons/More';
107
+ import '@para-ui/icons/MoreVert';
99
108
  import '@para-ui/icons/Return';
100
109
  import '@para-ui/icons/LoadingF';
101
- import '@para-ui/icons/Down';
102
- import '@para-ui/icons/Forbid';
103
110
  import 'react-slick';
104
111
  import '@para-ui/icons/RightCircleF';
105
112
  import '@para-ui/icons/LeftCircleF';
@@ -143,8 +150,6 @@ import 'rc-drawer';
143
150
  import 'rc-dropdown';
144
151
  import './_verture/usePopupContainer-635f66f4.js';
145
152
  import '@para-ui/icons/Panel';
146
- import '@para-ui/icons/PlusCircleF';
147
- import '@para-ui/icons/Delete';
148
153
  import '@para-ui/icons/Drag';
149
154
  import './_verture/index-0f5ee6f7.js';
150
155
  import './_verture/sortable.esm-76fe46a4.js';
@@ -158,7 +163,6 @@ import '@para-ui/icons/TurnRight';
158
163
  import '@para-ui/icons/TurnLeft';
159
164
  import '@para-ui/icons/MinusCircle';
160
165
  import '@para-ui/icons/PlusCircle';
161
- import '@para-ui/icons/PreviewOpen';
162
166
  import '@para-ui/icons/Internet';
163
167
  import 'rc-input-number';
164
168
  import '@para-ui/icons/Up';
@@ -197,6 +201,7 @@ import '@wangeditor/editor';
197
201
  import '@para-ui/icons/PreviewClose';
198
202
  import 'rc-tooltip';
199
203
  import 'rc-tooltip/lib/placements';
204
+ import '@para-ui/icons/Forbid';
200
205
  import 'rc-tree';
201
206
  import '@para-ui/icons/Document';
202
207
  import '@para-ui/icons/EditFile';
package/locale/en-US.d.ts CHANGED
@@ -1,4 +1,21 @@
1
1
  declare const _default: {
2
+ Anchor: {
3
+ pleaseEnter: string;
4
+ };
5
+ Argv: {
6
+ environmentVariable: string;
7
+ pleaseEnterKey: string;
8
+ pleaseEnterValue: string;
9
+ add: string;
10
+ batchEdit: string;
11
+ ok: string;
12
+ formatErrorJson: string;
13
+ formatErrorArrayJson: string;
14
+ pleaseEnter: string;
15
+ pleaseSelect: string;
16
+ formatError: string;
17
+ required: string;
18
+ };
2
19
  AutoButton: {
3
20
  more: string;
4
21
  };
@@ -251,6 +268,7 @@ declare const _default: {
251
268
  refresh: string;
252
269
  selectNum: string;
253
270
  selectAll: string;
271
+ dragSort: string;
254
272
  };
255
273
  Tabs: {
256
274
  confirmDelete: string;
package/locale/index.d.ts CHANGED
@@ -1,5 +1,22 @@
1
1
  declare const _default: {
2
2
  enUS: {
3
+ Anchor: {
4
+ pleaseEnter: string;
5
+ };
6
+ Argv: {
7
+ environmentVariable: string;
8
+ pleaseEnterKey: string;
9
+ pleaseEnterValue: string;
10
+ add: string;
11
+ batchEdit: string;
12
+ ok: string;
13
+ formatErrorJson: string;
14
+ formatErrorArrayJson: string;
15
+ pleaseEnter: string;
16
+ pleaseSelect: string;
17
+ formatError: string;
18
+ required: string;
19
+ };
3
20
  AutoButton: {
4
21
  more: string;
5
22
  };
@@ -252,6 +269,7 @@ declare const _default: {
252
269
  refresh: string;
253
270
  selectNum: string;
254
271
  selectAll: string;
272
+ dragSort: string;
255
273
  };
256
274
  Tabs: {
257
275
  confirmDelete: string;
@@ -288,6 +306,23 @@ declare const _default: {
288
306
  };
289
307
  };
290
308
  zhCN: {
309
+ Anchor: {
310
+ pleaseEnter: string;
311
+ };
312
+ Argv: {
313
+ environmentVariable: string;
314
+ pleaseEnterKey: string;
315
+ pleaseEnterValue: string;
316
+ add: string;
317
+ batchEdit: string;
318
+ ok: string;
319
+ formatErrorJson: string;
320
+ formatErrorArrayJson: string;
321
+ pleaseEnter: string;
322
+ pleaseSelect: string;
323
+ formatError: string;
324
+ required: string;
325
+ };
291
326
  AutoButton: {
292
327
  more: string;
293
328
  };
@@ -540,6 +575,7 @@ declare const _default: {
540
575
  refresh: string;
541
576
  selectNum: string;
542
577
  selectAll: string;
578
+ dragSort: string;
543
579
  };
544
580
  Tabs: {
545
581
  confirmDelete: string;
package/locale/index.js CHANGED
@@ -1,4 +1,21 @@
1
1
  var enUS = {
2
+ "Anchor": {
3
+ "pleaseEnter": "Please enter"
4
+ },
5
+ "Argv": {
6
+ "environmentVariable": "Environment Variable",
7
+ "pleaseEnterKey": "Please enter key",
8
+ "pleaseEnterValue": "Please enter value",
9
+ "add": "Add",
10
+ "batchEdit": "Batch Edit",
11
+ "ok": "OK",
12
+ "formatErrorJson": "Format error, please enter valid JSON",
13
+ "formatErrorArrayJson": "Format error, please enter a valid JSON array",
14
+ "pleaseEnter": "Please enter",
15
+ "pleaseSelect": "Please select",
16
+ "formatError": "Format error",
17
+ "required": "Required, cannot be empty"
18
+ },
2
19
  "AutoButton": {
3
20
  "more": "More"
4
21
  },
@@ -250,7 +267,8 @@ var enUS = {
250
267
  "loadMore": "Load more",
251
268
  "refresh": "Refresh",
252
269
  "selectNum": "Selected {num} items",
253
- "selectAll": "Select All"
270
+ "selectAll": "Select All",
271
+ "dragSort": "Drag Sort"
254
272
  },
255
273
  "Tabs": {
256
274
  "confirmDelete": "Are you sure delete?"
@@ -288,6 +306,23 @@ var enUS = {
288
306
  };
289
307
 
290
308
  var zhCN = {
309
+ "Anchor": {
310
+ "pleaseEnter": "请输入"
311
+ },
312
+ "Argv": {
313
+ "environmentVariable": "环境变量",
314
+ "pleaseEnterKey": "请输入key",
315
+ "pleaseEnterValue": "请输入value",
316
+ "add": "新增",
317
+ "batchEdit": "批量编辑",
318
+ "ok": "确定",
319
+ "formatErrorJson": "格式有误,请输入正确的JSON",
320
+ "formatErrorArrayJson": "格式有误,请输入正确的JSON数组",
321
+ "pleaseEnter": "请输入",
322
+ "pleaseSelect": "请选择",
323
+ "formatError": "格式错误",
324
+ "required": "必填项,不能为空"
325
+ },
291
326
  "AutoButton": {
292
327
  "more": "更多"
293
328
  },
@@ -539,7 +574,8 @@ var zhCN = {
539
574
  "loadMore": "加载更多",
540
575
  "refresh": "刷新",
541
576
  "selectNum": "已选{num}项",
542
- "selectAll": "全选"
577
+ "selectAll": "全选",
578
+ "dragSort": "拖动排序"
543
579
  },
544
580
  "Tabs": {
545
581
  "confirmDelete": "确定删除吗?"
package/locale/zh-CN.d.ts CHANGED
@@ -1,4 +1,21 @@
1
1
  declare const _default: {
2
+ Anchor: {
3
+ pleaseEnter: string;
4
+ };
5
+ Argv: {
6
+ environmentVariable: string;
7
+ pleaseEnterKey: string;
8
+ pleaseEnterValue: string;
9
+ add: string;
10
+ batchEdit: string;
11
+ ok: string;
12
+ formatErrorJson: string;
13
+ formatErrorArrayJson: string;
14
+ pleaseEnter: string;
15
+ pleaseSelect: string;
16
+ formatError: string;
17
+ required: string;
18
+ };
2
19
  AutoButton: {
3
20
  more: string;
4
21
  };
@@ -251,6 +268,7 @@ declare const _default: {
251
268
  refresh: string;
252
269
  selectNum: string;
253
270
  selectAll: string;
271
+ dragSort: string;
254
272
  };
255
273
  Tabs: {
256
274
  confirmDelete: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@para-ui/core",
3
3
  "private": false,
4
- "version": "4.0.32",
4
+ "version": "4.0.37",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
7
7
  "description": "Powered by Para FED",
@@ -28,11 +28,12 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@monaco-editor/react": "^4.6.0",
31
- "@paraview/lib": "^2.0.3",
31
+ "@paraview/lib": "^3.0.4",
32
32
  "@wangeditor/editor": "^5.1.15",
33
33
  "@wangeditor/editor-for-react": "^1.0.5",
34
34
  "clsx": "1.1.1",
35
35
  "dayjs": "^1.11.3",
36
+ "marked": "^14.1.2",
36
37
  "monaco-editor": "^0.44.0",
37
38
  "prettier": "^2.6.0",
38
39
  "rc-cascader": "^3.8.0",
@@ -41,6 +42,7 @@
41
42
  "rc-dialog": "8.9.0",
42
43
  "rc-drawer": "6.1.3",
43
44
  "rc-dropdown": "3.6.2",
45
+ "rc-image": "^7.5.1",
44
46
  "rc-input-number": "7.3.4",
45
47
  "rc-motion": "2.4.4",
46
48
  "rc-notification": "4.5.7",
@@ -63,8 +65,7 @@
63
65
  "react-sortablejs": "6.1.0",
64
66
  "react-transition-group": "4.4.2",
65
67
  "sortablejs": "^1.15.0",
66
- "sucrase": "^3.34.0",
67
- "rc-image": "^7.5.1"
68
+ "sucrase": "^3.34.0"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@babel/core": "^7.18.6",
@@ -126,6 +127,7 @@
126
127
  "postcss": "^8.4.13",
127
128
  "postcss-import": "^14.1.0",
128
129
  "prettier": "^2.6.0",
130
+ "raw-loader": "^4.0.2",
129
131
  "rc-select": "14.8.0",
130
132
  "rc-trigger": "^5.3.4",
131
133
  "react-app-polyfill": "^3.0.0",