zmdms-webui 1.5.7 → 1.5.9

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.
@@ -400,6 +400,10 @@ interface ITableProps<RecordType> extends Omit<TableProps<RecordType>, "columns"
400
400
  differences?: number[] | ((record: any, index: number) => boolean);
401
401
  isMarginTop?: boolean;
402
402
  isMarginBottom?: boolean;
403
+ /**
404
+ * 新增或删除行配置
405
+ */
406
+ AddAndDelProps?: IColumnsTypeProp<RecordType>;
403
407
  }
404
408
  interface IFields {
405
409
  /**
@@ -38,7 +38,7 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
38
38
  // completed: 实现从execl复制到表格中的功能
39
39
  var Table = function (props) {
40
40
  // console.log("表格渲染");
41
- var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll"]);
41
+ var className = props.className, _a = props.bordered, bordered = _a === void 0 ? true : _a, _b = props.pagination, pagination = _b === void 0 ? false : _b, isFlex = props.isFlex; props.tablePreferences; var dynamicKey = props.dynamicKey, dynamicVersion = props.dynamicVersion, isRemeberFilter = props.isRemeberFilter, _c = props.isOrderUpdateData, isOrderUpdateData = _c === void 0 ? true : _c, hiddenDynamicIcon = props.hiddenDynamicIcon, _columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, hiddenAddBtnHandle = props.hiddenAddBtnHandle, _d = props.isTheadTitleAdd, isTheadTitleAdd = _d === void 0 ? true : _d, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, delPopTitle = props.delPopTitle, hiddenDelBtnHandle = props.hiddenDelBtnHandle, _e = props.isDelAll, isDelAll = _e === void 0 ? true : _e, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _f = props.summaryFixed, summaryFixed = _f === void 0 ? true : _f, isInnerPagination = props.isInnerPagination, _g = props.innerPaginationPageSize, innerPaginationPageSize = _g === void 0 ? 30 : _g, _h = props.innerPaginationPosition, innerPaginationPosition = _h === void 0 ? INNER_TABLE_PAGINATION_POSITION : _h, _j = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _j === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _j, innerPaginationConfig = props.innerPaginationConfig, tableRefHandle = props.tableRefHandle, tableName = props.tableName, serviceOrder = props.serviceOrder, differences = props.differences, virtualKey = props.virtualKey, _k = props.isResizableColumn, isResizableColumn = _k === void 0 ? true : _k, _l = props.isResizableTitleEllipsis, isResizableTitleEllipsis = _l === void 0 ? true : _l, _m = props.isRealTimeValidate, isRealTimeValidate = _m === void 0 ? true : _m, isMarginTop = props.isMarginTop, isMarginBottom = props.isMarginBottom, scroll = props.scroll, AddAndDelProps = props.AddAndDelProps, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "dynamicVersion", "isRemeberFilter", "isOrderUpdateData", "hiddenDynamicIcon", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "hiddenAddBtnHandle", "isTheadTitleAdd", "addMode", "addCallback", "isDel", "delPopTitle", "hiddenDelBtnHandle", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "innerPaginationConfig", "tableRefHandle", "tableName", "serviceOrder", "differences", "virtualKey", "isResizableColumn", "isResizableTitleEllipsis", "isRealTimeValidate", "isMarginTop", "isMarginBottom", "scroll", "AddAndDelProps"]);
42
42
  var classes = classNames("ztxk-table", className, {
43
43
  "ztxk-table--flex": isFlex,
44
44
  });
@@ -145,6 +145,7 @@ var Table = function (props) {
145
145
  hiddenAddBtnHandleRef: hiddenAddBtnHandleRef,
146
146
  rowKey: props.rowKey,
147
147
  filterConfigRef: filterConfigRef,
148
+ AddAndDelProps: AddAndDelProps,
148
149
  }).newColumns;
149
150
  // 内部表格总结栏
150
151
  var getSummaryHandle = useSummary(summaryConfig, newColumns, {
@@ -21,7 +21,7 @@ import ModalComponent from '../modal/modal.js';
21
21
  function useColumns(columns, options) {
22
22
  var _this = this;
23
23
  var _a, _b;
24
- var dynamicKey = options.dynamicKey, isRemeberFilter = options.isRemeberFilter, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSource = options.dataSource, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isTheadTitleAdd = options.isTheadTitleAdd, isDel = options.isDel, delPopTitle = options.delPopTitle, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isResizableTitleEllipsis = options.isResizableTitleEllipsis, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef, hiddenAddBtnHandleRef = options.hiddenAddBtnHandleRef, rowKey = options.rowKey, filterConfigRef = options.filterConfigRef;
24
+ var dynamicKey = options.dynamicKey, isRemeberFilter = options.isRemeberFilter, hiddenDynamicIcon = options.hiddenDynamicIcon, currentDynamicList = options.currentDynamicList, dataSource = options.dataSource, dataSourceRef = options.dataSourceRef, onEditableSave = options.onEditableSave, isEdit = options.isEdit, isAdd = options.isAdd, isTheadTitleAdd = options.isTheadTitleAdd, isDel = options.isDel, delPopTitle = options.delPopTitle, dynamicSettingRef = options.dynamicSettingRef, onCurrentListChange = options.onCurrentListChange, onAddAndDel = options.onAddAndDel, getRefreshScuCell = options.getRefreshScuCell, isDelAll = options.isDelAll, currentPage = options.currentPage, onTableChange = options.onTableChange, order = options.order, setOrder = options.setOrder, customSortHandle = options.customSortHandle, isResizableColumn = options.isResizableColumn, isResizableTitleEllipsis = options.isResizableTitleEllipsis, isRealTimeValidate = options.isRealTimeValidate, hiddenDelBtnHandleRef = options.hiddenDelBtnHandleRef, hiddenAddBtnHandleRef = options.hiddenAddBtnHandleRef, rowKey = options.rowKey, filterConfigRef = options.filterConfigRef, AddAndDelProps = options.AddAndDelProps;
25
25
  var newColumns = getTableColumns(columns, currentDynamicList).columns;
26
26
  // 表头过滤的一些配置(获取表头过滤的input的输入框的引用)
27
27
  var searchValueInputRef = useRef(null);
@@ -363,11 +363,7 @@ function useColumns(columns, options) {
363
363
  (!(dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) || ((_b = dataSourceRef === null || dataSourceRef === void 0 ? void 0 : dataSourceRef.current) === null || _b === void 0 ? void 0 : _b.length) === 0);
364
364
  // 如果配置了增减行
365
365
  if (isAdd || isDel) {
366
- var newColumn = {
367
- title: function () { return (jsxs(Fragment, { children: [showTitleDelIcon_1 ? (jsx(ColumnDelAll, { onAddAndDel: onAddAndDel })) : null, showTitleAddIcon_1 ? jsx(ColumnAdd, { onAddAndDel: onAddAndDel }) : null] })); },
368
- width: 42,
369
- fixed: "left",
370
- align: "center",
366
+ var newColumn = __assign({ title: function () { return (jsxs(Fragment, { children: [showTitleDelIcon_1 ? (jsx(ColumnDelAll, { onAddAndDel: onAddAndDel })) : null, showTitleAddIcon_1 ? jsx(ColumnAdd, { onAddAndDel: onAddAndDel }) : null] })); }, width: 42, fixed: "left", align: "center",
371
367
  // 这里需要配置scu吗?TODO:
372
368
  render: function (text, record, index) {
373
369
  var hiddenDel = (hiddenDelBtnHandleRef === null || hiddenDelBtnHandleRef === void 0 ? void 0 : hiddenDelBtnHandleRef.current)
@@ -377,8 +373,7 @@ function useColumns(columns, options) {
377
373
  ? !(hiddenAddBtnHandleRef === null || hiddenAddBtnHandleRef === void 0 ? void 0 : hiddenAddBtnHandleRef.current(record, index))
378
374
  : isAdd;
379
375
  return (jsx(ColumnAddDel, { isAdd: hiddenAdd, isDel: hiddenDel, index: index, delPopTitle: delPopTitle, onAddAndDel: onAddAndDel }));
380
- },
381
- };
376
+ } }, AddAndDelProps);
382
377
  myNewColumns.unshift(newColumn);
383
378
  }
384
379
  // 如果配置了动态列配置
@@ -253,7 +253,8 @@ var UploadList = function (props, ref) {
253
253
  return {
254
254
  /** 当前的附件列表数据 */
255
255
  getData: function () {
256
- var successFileList = innerFileList.filter(function (item) { return item.status === "done"; });
256
+ // 如果数据中没有status字段,那么认为也是成功的
257
+ var successFileList = innerFileList.filter(function (item) { return !item.status || item.status === "done"; });
257
258
  var errorFileList = innerFileList.filter(function (item) { return item.status === "error"; });
258
259
  return {
259
260
  fileList: innerFileList,
@@ -261,6 +262,50 @@ var UploadList = function (props, ref) {
261
262
  errorFileList: errorFileList,
262
263
  };
263
264
  },
265
+ /** 内部验证方法 */
266
+ validate: function (options) { return __awaiter(void 0, void 0, void 0, function () {
267
+ var _a, title, isError, i, fileItem, status_1;
268
+ return __generator(this, function (_b) {
269
+ switch (_b.label) {
270
+ case 0:
271
+ _a = options || {}, title = _a.title, isError = _a.isError;
272
+ if (!Array.isArray(innerFileList)) return [3 /*break*/, 6];
273
+ i = 0;
274
+ _b.label = 1;
275
+ case 1:
276
+ if (!(i < innerFileList.length)) return [3 /*break*/, 6];
277
+ fileItem = innerFileList[i];
278
+ status_1 = fileItem.status || "done";
279
+ if (!(status_1 !== "done" && status_1 !== "error")) return [3 /*break*/, 3];
280
+ return [4 /*yield*/, Promise.reject({
281
+ errorFields: [
282
+ {
283
+ errors: "".concat(title || "", " \u7B2C").concat(i + 1, "\u4E2A\u9644\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D\uFF0C\u8BF7\u7A0D\u7B49..."),
284
+ },
285
+ ],
286
+ })];
287
+ case 2:
288
+ _b.sent();
289
+ _b.label = 3;
290
+ case 3:
291
+ if (!(isError && status_1 === "error")) return [3 /*break*/, 5];
292
+ return [4 /*yield*/, Promise.reject({
293
+ errorFields: [
294
+ {
295
+ errors: "".concat(title || "", " \u7B2C").concat(i + 1, "\u4E2A\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5"),
296
+ },
297
+ ],
298
+ })];
299
+ case 4:
300
+ _b.sent();
301
+ _b.label = 5;
302
+ case 5:
303
+ i++;
304
+ return [3 /*break*/, 1];
305
+ case 6: return [2 /*return*/];
306
+ }
307
+ });
308
+ }); },
264
309
  };
265
310
  });
266
311
  return (jsxs("div", __assign({ className: classes, ref: imgCropModalRef }, { children: [isPreview ? null : (jsxs(Fragment, { children: [isImage ? (jsx(ImgCrop, __assign({ rotationSlider: true, showReset: true, quality: 0.8, modalClassName: "ztxk-upload-imgcrop", modalProps: { getContainer: function () { return imgCropModalRef.current; } }, aspect: imgWidth / imgHeight }, imgCropProps, { children: renderChildren }))) : (renderChildren), showTip ? (jsxs("span", __assign({ className: "ztxk-upload--tips" }, { children: ["(\u5355\u4E2A\u9644\u4EF6\u6700\u5927\u652F\u6301", maxSizeStr, ")"] }))) : ("")] })), isDelete && !isPreview && showTable ? (jsx(Popconfirm, __assign({ title: "\u662F\u5426\u5220\u9664\u9009\u4E2D\u9644\u4EF6\uFF1F", cancelText: "\u5426", okText: "\u662F", onConfirm: function () { return onBatchDeleteHandle(); } }, { children: jsx(ButtonCom, __assign({ type: "primary" }, { children: "\u6279\u91CF\u5220\u9664" })) }))) : null, isDownload && showTable ? (jsx(Dropdown, __assign({ menu: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",