zmdms-webui 0.0.6 → 0.0.8

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.
@@ -1,7 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import { FormItemProps, FormInstance } from 'antd/lib/form';
3
3
 
4
- type IWidth = "half" | "double" | "all" | "halfAll";
4
+ type IWidth = "half" | "double" | "all" | "halfAll" | number;
5
5
  interface IFormItem extends FormItemProps {
6
6
  isDisplay?: boolean | string;
7
7
  isRequired?: boolean | string;
@@ -100,9 +100,12 @@ var FormItem = function (props) {
100
100
  // }
101
101
  // }
102
102
  function getWidthNum(width) {
103
+ if (typeof width === "number") {
104
+ return width;
105
+ }
103
106
  switch (width) {
104
107
  case "half":
105
- return 12;
108
+ return 4;
106
109
  case "all":
107
110
  return 24;
108
111
  case "double":
@@ -4,6 +4,11 @@ import { Modal } from 'antd';
4
4
 
5
5
  interface IModalProps extends ModalProps {
6
6
  defaultOpen?: boolean;
7
+ defaultTitle?: string;
8
+ defaultConfirmMsg?: string;
9
+ defaultConfirmOkText?: string;
10
+ defaultType?: string;
11
+ confirmOnOk?: (type?: string) => Promise<any>;
7
12
  }
8
13
  interface IModalComponent extends React__default.ForwardRefExoticComponent<IModalProps & React__default.RefAttributes<unknown>> {
9
14
  info: typeof Modal.info;
@@ -11,6 +16,7 @@ interface IModalComponent extends React__default.ForwardRefExoticComponent<IModa
11
16
  error: typeof Modal.error;
12
17
  warning: typeof Modal.warning;
13
18
  confirm: typeof Modal.confirm;
19
+ destroyAll: typeof Modal.destroyAll;
14
20
  }
15
21
 
16
22
  export { IModalComponent, IModalProps };
@@ -5,15 +5,33 @@ import { Modal as Modal$1 } from 'antd';
5
5
  import classNames from '../node_modules/classnames/index.js';
6
6
 
7
7
  var Modal = function (_a, ref) {
8
- var className = _a.className, defaultOpen = _a.defaultOpen, resetProps = __rest(_a, ["className", "defaultOpen"]);
8
+ var className = _a.className, defaultOpen = _a.defaultOpen, defaultTitle = _a.defaultTitle, defaultConfirmMsg = _a.defaultConfirmMsg, defaultConfirmOkText = _a.defaultConfirmOkText, defaultType = _a.defaultType, confirmOnOk = _a.confirmOnOk, resetProps = __rest(_a, ["className", "defaultOpen", "defaultTitle", "defaultConfirmMsg", "defaultConfirmOkText", "defaultType", "confirmOnOk"]);
9
9
  var classes = classNames("ztxk-modal", className);
10
10
  var _b = useState(defaultOpen), open = _b[0], setOpen = _b[1];
11
+ var _c = useState(defaultTitle), title = _c[0], setTitle = _c[1];
12
+ var _d = useState(defaultConfirmMsg), confirmMsg = _d[0], setConfirmMsg = _d[1];
13
+ var _e = useState(defaultConfirmOkText), confirmOkText = _e[0], setConfirmOkText = _e[1];
14
+ var _f = useState(defaultType), type = _f[0], setType = _f[1];
11
15
  var close = useCallback(function () {
12
16
  setOpen(false);
13
17
  }, []);
14
18
  useImperativeHandle(ref, function () {
15
19
  return {
16
- open: function () {
20
+ open: function (options) {
21
+ // 如果有默认参数 那么设置
22
+ // 一般用于 新增、修改用于同一个编辑框时使用
23
+ if (options === null || options === void 0 ? void 0 : options.title) {
24
+ setTitle(options.title);
25
+ }
26
+ if (options === null || options === void 0 ? void 0 : options.confirmMsg) {
27
+ setConfirmMsg(options.confirmMsg);
28
+ }
29
+ if (options === null || options === void 0 ? void 0 : options.confirmOkText) {
30
+ setConfirmOkText(options.confirmOkText);
31
+ }
32
+ if (options === null || options === void 0 ? void 0 : options.type) {
33
+ setType(options.type);
34
+ }
17
35
  setOpen(true);
18
36
  },
19
37
  close: function () {
@@ -21,7 +39,22 @@ var Modal = function (_a, ref) {
21
39
  },
22
40
  };
23
41
  });
24
- return (jsx(Modal$1, __assign({ open: open, onCancel: close, className: classes }, resetProps)));
42
+ var onOkHandle = useCallback(function () {
43
+ if (confirmMsg) {
44
+ Modal$1.confirm({
45
+ title: confirmMsg,
46
+ okText: confirmOkText ? confirmOkText : "确认保存",
47
+ onOk: confirmOnOk
48
+ ? function () {
49
+ return confirmOnOk(type).then(function () {
50
+ setOpen(false);
51
+ });
52
+ }
53
+ : undefined,
54
+ });
55
+ }
56
+ }, [confirmMsg, confirmOkText, confirmOnOk, type]);
57
+ return (jsx(Modal$1, __assign({ open: open, onCancel: close, className: classes, okText: "\u4FDD\u5B58", onOk: onOkHandle, width: "70%", title: title }, resetProps)));
25
58
  };
26
59
  var ModalComponent = forwardRef(Modal);
27
60
  ModalComponent.displayName = "ZTXK_WEBUI_ModalComponent";
@@ -29,6 +62,7 @@ ModalComponent.info = Modal$1.info;
29
62
  ModalComponent.success = Modal$1.success;
30
63
  ModalComponent.error = Modal$1.error;
31
64
  ModalComponent.warning = Modal$1.warning;
32
- ModalComponent.confirm = Modal$1.confirm;
65
+ ModalComponent.confirm = Modal$1.confirm;
66
+ ModalComponent.destroyAll = Modal$1.destroyAll;
33
67
 
34
68
  export { ModalComponent as default };
@@ -137,6 +137,7 @@ function useAddAndDelChange(dataSourceRef, onTableChange, options) {
137
137
  rowKey,
138
138
  refreshScuCell,
139
139
  isAddAndDelAuto,
140
+ currentPage,
140
141
  ]);
141
142
  return onAddAndDel;
142
143
  }
@@ -26,9 +26,11 @@ import { DndProvider } from '../node_modules/react-dnd/dist/core/DndProvider.js'
26
26
  // TODO: 实现可拖拽行
27
27
  // TODO: 实现可编辑功能
28
28
  var Table = function (props) {
29
- console.log("表格渲染");
29
+ // console.log("表格渲染");
30
30
  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, columns = props.columns, dataSource = props.dataSource, onTableChange = props.onTableChange, isEdit = props.isEdit, isMove = props.isMove, isAdd = props.isAdd, addMode = props.addMode, addCallback = props.addCallback, isDel = props.isDel, _c = props.isDelAll, isDelAll = _c === void 0 ? true : _c, isAddAndDelAuto = props.isAddAndDelAuto, summaryConfig = props.summaryConfig, _d = props.summaryFixed, summaryFixed = _d === void 0 ? true : _d, isInnerPagination = props.isInnerPagination, _e = props.innerPaginationPageSize, innerPaginationPageSize = _e === void 0 ? 30 : _e, _f = props.innerPaginationPosition, innerPaginationPosition = _f === void 0 ? INNER_TABLE_PAGINATION_POSITION : _f, _g = props.innerPaginationPageSizeOptions, innerPaginationPageSizeOptions = _g === void 0 ? INNER_TABLE_PAGINATION_PAGESIZEOPTIONS : _g, tableRefHandle = props.tableRefHandle, tableName = props.tableName, resetProps = __rest(props, ["className", "bordered", "pagination", "isFlex", "tablePreferences", "dynamicKey", "columns", "dataSource", "onTableChange", "isEdit", "isMove", "isAdd", "addMode", "addCallback", "isDel", "isDelAll", "isAddAndDelAuto", "summaryConfig", "summaryFixed", "isInnerPagination", "innerPaginationPageSize", "innerPaginationPosition", "innerPaginationPageSizeOptions", "tableRefHandle", "tableName"]);
31
- var classes = classNames("ztxk-table", className);
31
+ var classes = classNames("ztxk-table", className, {
32
+ "ztxk-table--flex": isFlex,
33
+ });
32
34
  // 将表格数据 在 Ref中 存储一份
33
35
  var dataSourceRef = useRef();
34
36
  useEffect(function () {