ztxkui 3.2.7 → 3.2.10

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.
@@ -143,24 +143,27 @@ function UploadDemo() {
143
143
  }, []);
144
144
  var checkHandle = function () { return __awaiter(_this, void 0, void 0, function () {
145
145
  var err_1, errorFields;
146
- var _a, _b;
147
- return __generator(this, function (_c) {
148
- switch (_c.label) {
146
+ var _a, _b, _c, _d;
147
+ return __generator(this, function (_e) {
148
+ switch (_e.label) {
149
149
  case 0:
150
- _c.trys.push([0, 2, , 3]);
150
+ _e.trys.push([0, 3, , 4]);
151
151
  return [4 /*yield*/, ((_b = (_a = upload.current) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.call(_a, { title: '测试下面的', isError: true }))];
152
152
  case 1:
153
- _c.sent();
154
- return [3 /*break*/, 3];
153
+ _e.sent();
154
+ return [4 /*yield*/, ((_d = (_c = tableHandleRef.current) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.call(_c))];
155
155
  case 2:
156
- err_1 = _c.sent();
156
+ _e.sent();
157
+ return [3 /*break*/, 4];
158
+ case 3:
159
+ err_1 = _e.sent();
157
160
  console.log(err_1);
158
161
  errorFields = err_1.errorFields;
159
162
  if (errorFields) {
160
163
  console.log(errorFields[0].errors + '');
161
164
  }
162
165
  return [2 /*return*/];
163
- case 3: return [2 /*return*/];
166
+ case 4: return [2 /*return*/];
164
167
  }
165
168
  });
166
169
  }); };
@@ -171,6 +174,7 @@ function UploadDemo() {
171
174
  console.log('请传入特殊值');
172
175
  return UploadSingle.LIST_IGNORE;
173
176
  };
177
+ var tableHandleRef = useRef();
174
178
  return (React.createElement("div", null,
175
179
  React.createElement(UploadSingle, { action: "http://192.168.0.83:8888/api/zmdms-resource/oss/endpoint/put-file-attach", data: {
176
180
  system: '2',
@@ -193,7 +197,9 @@ function UploadDemo() {
193
197
  system: '2',
194
198
  }, apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", originFileList: fileList, callback: uploadCallbackFn, onDeleteCallback: function (index, file) {
195
199
  console.log(index, file);
196
- }, upload: upload, rowSelection: "checkbox", uploadTableRef: uploadTableRef }),
200
+ }, upload: upload, rowSelection: "checkbox", uploadTableRef: uploadTableRef, tableRestProps: {
201
+ tableHandleRef: tableHandleRef,
202
+ } }),
197
203
  React.createElement(Upload, { maxSize: 200 * 1024, ztAccept: ['.jpg', '.jpeg', '.png', '.bmp', '.gif'], listType: "picture-card", method: "post", headers: {
198
204
  'Zmdms-Auth': token,
199
205
  }, showUploadList: {
@@ -123,6 +123,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
123
123
  * 每页多少条
124
124
  */
125
125
  currentSize?: number;
126
+ /**
127
+ * 是否需要选中复制到剪切板
128
+ */
129
+ isCopy?: boolean;
126
130
  }
127
131
  /**
128
132
  * 增强下拉框功能组件
@@ -139,6 +143,6 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
139
143
  * { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
140
144
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
141
145
  */
142
- declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, ...restProps }: IProps<VT>): JSX.Element;
146
+ declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, ...restProps }: IProps<VT>): JSX.Element;
143
147
  declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
144
148
  export default _default;
@@ -99,7 +99,7 @@ function textContent(children) {
99
99
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
100
100
  */
101
101
  function EnhanceSelect(_a) {
102
- var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 30000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize"]);
102
+ var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 30000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy"]);
103
103
  var currentClick = useRef(true);
104
104
  // 下拉数据源
105
105
  var _k = useFetchState([]), selectList = _k[0], setSelectList = _k[1];
@@ -587,7 +587,7 @@ function EnhanceSelect(_a) {
587
587
  // 选中时
588
588
  var onSelectHandle = function (value, obj) {
589
589
  // console.log('选中数据事件');
590
- if (restProps.mode !== 'multiple') {
590
+ if (restProps.mode !== 'multiple' && isCopy) {
591
591
  var text = textContent(obj.children);
592
592
  var textarea = document.createElement('textarea');
593
593
  textarea.setAttribute('readonly', 'readonly');
@@ -30,6 +30,7 @@ interface IProps {
30
30
  /**是否显示selection */
31
31
  rowSelection?: TableRowSelection<any> | 'checkbox' | 'radio';
32
32
  uploadTableRef?: any;
33
+ tableRestProps?: any;
33
34
  }
34
35
  declare const _default: React.NamedExoticComponent<IProps>;
35
36
  export default _default;
@@ -69,7 +69,7 @@ import { divide, round, times } from 'number-precision';
69
69
  import { downloadFileCallBack, downloadPublicFile, previewFile, } from 'ztxkutils/dist/fileOperation';
70
70
  import { transformFileSize } from 'ztxkutils/dist/tools';
71
71
  var UploadTable = function (_a) {
72
- var fileList = _a.fileList, action = _a.action, headers = _a.headers, authToken = _a.authToken, method = _a.method, apiBaseUrl = _a.apiBaseUrl, uploadUser = _a.uploadUser, _b = _a.fileBaseUrl, fileBaseUrl = _b === void 0 ? '' : _b, onDelete = _a.onDelete, onUpload = _a.onUpload, showDeleteBtn = _a.showDeleteBtn, isAutoDelete = _a.isAutoDelete, onDownLoadCallbackBefore = _a.onDownLoadCallbackBefore, showDownloadBtn = _a.showDownloadBtn, onDownLoadCallbackAfter = _a.onDownLoadCallbackAfter, onPreviewCallbackBefore = _a.onPreviewCallbackBefore, showPreviewBtn = _a.showPreviewBtn, isPublic = _a.isPublic, data = _a.data, _c = _a.startColumns, startColumns = _c === void 0 ? [] : _c, _d = _a.otherColumns, otherColumns = _d === void 0 ? [] : _d, showUploadBtn = _a.showUploadBtn, rowSelection = _a.rowSelection, uploadTableRef = _a.uploadTableRef;
72
+ var fileList = _a.fileList, action = _a.action, headers = _a.headers, authToken = _a.authToken, method = _a.method, apiBaseUrl = _a.apiBaseUrl, uploadUser = _a.uploadUser, _b = _a.fileBaseUrl, fileBaseUrl = _b === void 0 ? '' : _b, onDelete = _a.onDelete, onUpload = _a.onUpload, showDeleteBtn = _a.showDeleteBtn, isAutoDelete = _a.isAutoDelete, onDownLoadCallbackBefore = _a.onDownLoadCallbackBefore, showDownloadBtn = _a.showDownloadBtn, onDownLoadCallbackAfter = _a.onDownLoadCallbackAfter, onPreviewCallbackBefore = _a.onPreviewCallbackBefore, showPreviewBtn = _a.showPreviewBtn, isPublic = _a.isPublic, data = _a.data, _c = _a.startColumns, startColumns = _c === void 0 ? [] : _c, _d = _a.otherColumns, otherColumns = _d === void 0 ? [] : _d, showUploadBtn = _a.showUploadBtn, rowSelection = _a.rowSelection, uploadTableRef = _a.uploadTableRef, tableRestProps = _a.tableRestProps;
73
73
  var _e = useState([]), dataSource = _e[0], setDataSource = _e[1];
74
74
  var _f = useState(false), loading = _f[0], setLoading = _f[1];
75
75
  var _g = useState(), selectedRows = _g[0], setSelectedRows = _g[1];
@@ -415,6 +415,6 @@ var UploadTable = function (_a) {
415
415
  }
416
416
  : rowSelection;
417
417
  }, [rowSelection]);
418
- return (React.createElement(Table, { columns: columns, dataSource: dataSource, rowKey: "id", loading: loading, rowSelection: myRowSelection }));
418
+ return (React.createElement(Table, __assign({ columns: columns, dataSource: dataSource, rowKey: "id", loading: loading, rowSelection: myRowSelection }, tableRestProps)));
419
419
  };
420
420
  export default memo(UploadTable);
@@ -67,6 +67,8 @@ export interface IProps extends UploadProps {
67
67
  rowSelection?: TableRowSelection<any> | 'checkbox' | 'radio';
68
68
  /**组件提供给外部调用的一些方法 */
69
69
  uploadTableRef?: any;
70
+ /**表格方法 */
71
+ tableRestProps?: any;
70
72
  }
71
73
  declare const Upload: React.FC<IProps>;
72
74
  export default Upload;
@@ -81,7 +81,7 @@ var _accept = [
81
81
  ];
82
82
  var statusArr = ['error', 'success', 'done', 'uploading', 'removed'];
83
83
  var Upload = function (props) {
84
- var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef"]);
84
+ var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, tableRestProps = props.tableRestProps, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef", "tableRestProps"]);
85
85
  var _j = useState(originFileList || []), fileList = _j[0], setFileList = _j[1];
86
86
  var _k = useState('20M'), maxSizeTransStr = _k[0], setMaxSizeTransStr = _k[1];
87
87
  useEffect(function () {
@@ -307,6 +307,6 @@ var Upload = function (props) {
307
307
  ? ztShowTipText
308
308
  : 'PDF、Word、Excel、Txt、JPG、PNG、BMP、GIF、RAR、ZIP',
309
309
  ")")))),
310
- showTable && (React.createElement(UploadTable, { fileList: fileList, action: fileAction, apiBaseUrl: apiBaseUrl, fileBaseUrl: fileBaseUrl, headers: headers, method: method, uploadUser: uploadUser, onDelete: onDeleteHandle, onUpload: onUploadHandle, showDeleteBtn: showDeleteBtn, onDownLoadCallbackBefore: onDownLoadCallbackBefore, showDownloadBtn: showDownloadBtn, onDownLoadCallbackAfter: onDownLoadCallbackAfter, showPreviewBtn: showPreviewBtn, onPreviewCallbackBefore: onPreviewCallbackBefore, isAutoDelete: isAutoDelete, authToken: authToken, isPublic: isPublic, data: data, startColumns: startColumns, otherColumns: otherColumns, showUploadBtn: showUploadBtn, rowSelection: rowSelection, uploadTableRef: uploadTableRef }))));
310
+ showTable && (React.createElement(UploadTable, { fileList: fileList, action: fileAction, apiBaseUrl: apiBaseUrl, fileBaseUrl: fileBaseUrl, headers: headers, method: method, uploadUser: uploadUser, onDelete: onDeleteHandle, onUpload: onUploadHandle, showDeleteBtn: showDeleteBtn, onDownLoadCallbackBefore: onDownLoadCallbackBefore, showDownloadBtn: showDownloadBtn, onDownLoadCallbackAfter: onDownLoadCallbackAfter, showPreviewBtn: showPreviewBtn, onPreviewCallbackBefore: onPreviewCallbackBefore, isAutoDelete: isAutoDelete, authToken: authToken, isPublic: isPublic, data: data, startColumns: startColumns, otherColumns: otherColumns, showUploadBtn: showUploadBtn, rowSelection: rowSelection, uploadTableRef: uploadTableRef, tableRestProps: tableRestProps }))));
311
311
  };
312
312
  export default Upload;
@@ -36,13 +36,13 @@ var Container = function (_a) {
36
36
  if (!loading) {
37
37
  return;
38
38
  }
39
- var timeout = setTimeout(function () {
39
+ var timeout = setInterval(function () {
40
40
  setCountdown(function (pre) { return pre + 1; });
41
41
  }, 1000);
42
42
  return function () {
43
- timeout && clearTimeout(timeout);
43
+ timeout && clearInterval(timeout);
44
44
  };
45
- }, [countdown, loading]);
45
+ }, [loading]);
46
46
  return (React.createElement("div", __assign({ className: classes }, restProps, { ref: containerRef }),
47
47
  loading && (React.createElement("div", { className: "zt-container__loading" },
48
48
  React.createElement(Spin, __assign({ size: "large", spinning: loading, tip: "" + countdown }, spinProps)))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "3.2.7",
3
+ "version": "3.2.10",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",