ls-pro-common 1.0.19 → 1.0.22

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.
@@ -2,18 +2,33 @@ import React from 'react';
2
2
  import type { ProFormInstance } from 'ls-pro-form';
3
3
  import './common.less';
4
4
  export declare type DtlLyaoutProps = Record<string, any> & {
5
+ /** 返回方法 */
5
6
  onExit: (visible?: boolean) => void;
7
+ /** 保存方法 */
6
8
  onSave?: () => void;
9
+ /** 自定义按钮方法 */
7
10
  renderButton?: (defaultBtn: JSX.Element[]) => JSX.Element[];
11
+ /** 审核方法 */
12
+ onAudit?: () => void;
13
+ /** 保存按钮文本 */
8
14
  btnSaveText?: string;
15
+ /** 返回按钮文本 */
9
16
  btnExitText?: string;
17
+ /** 标题 */
10
18
  title?: string;
19
+ /** 主表对象 */
11
20
  masterObject?: any;
21
+ /** 主表主键字段 */
12
22
  keyField?: string;
23
+ /** body类 */
13
24
  bodyClass?: string;
25
+ /** header 类 */
14
26
  headerClass?: string;
27
+ /** body样式 */
15
28
  bodyStyle?: React.CSSProperties;
29
+ /** header样式 */
16
30
  headerStyle?: React.CSSProperties;
31
+ /** 表单ref */
17
32
  formRef?: React.MutableRefObject<ProFormInstance | undefined>;
18
33
  };
19
34
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
@@ -2,7 +2,7 @@ import "antd/es/button/style";
2
2
  import _Button from "antd/es/button";
3
3
  import React, { useMemo } from 'react';
4
4
  import classNames from 'classnames';
5
- import { ArrowLeftOutlined, SaveOutlined } from '@ant-design/icons';
5
+ import { ArrowLeftOutlined, SaveOutlined, CheckOutlined } from '@ant-design/icons';
6
6
  import './common.less';
7
7
 
8
8
  function DtlLayout(props) {
@@ -26,25 +26,36 @@ function DtlLayout(props) {
26
26
  if (!masterObject) return '';
27
27
  return masterObject[keyField] ? '编辑' : '新增';
28
28
  }, [title, masterObject, keyField]);
29
- var btns = [/*#__PURE__*/React.createElement(_Button, {
30
- key: "btnSave",
31
- onClick: function onClick() {
32
- var _formRef$current;
29
+ var btns = useMemo(function () {
30
+ var b = [/*#__PURE__*/React.createElement(_Button, {
31
+ key: "btnSave",
32
+ onClick: function onClick() {
33
+ var _formRef$current;
33
34
 
34
- if (props.onSave) {
35
- return props.onSave();
36
- }
35
+ if (props.onSave) {
36
+ return props.onSave();
37
+ }
37
38
 
38
- formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.submit();
39
- },
40
- icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
41
- }, " ", btnSaveText, " "), /*#__PURE__*/React.createElement(_Button, {
42
- key: "btnBack",
43
- onClick: function onClick() {
44
- return props.onExit(false);
45
- },
46
- icon: /*#__PURE__*/React.createElement(ArrowLeftOutlined, null)
47
- }, " ", btnExitText, " ")];
39
+ formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.submit();
40
+ },
41
+ icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
42
+ }, btnSaveText), /*#__PURE__*/React.createElement(_Button, {
43
+ key: "btnBack",
44
+ onClick: function onClick() {
45
+ return props.onExit(false);
46
+ },
47
+ icon: /*#__PURE__*/React.createElement(ArrowLeftOutlined, null)
48
+ }, btnExitText)];
49
+
50
+ if (props.onAudit) {
51
+ b.unshift( /*#__PURE__*/React.createElement(_Button, {
52
+ key: "btnAudit",
53
+ icon: /*#__PURE__*/React.createElement(CheckOutlined, null)
54
+ }, "\u5BA1\u6838"));
55
+ }
56
+
57
+ return b;
58
+ }, [props]);
48
59
  var buttons = renderButton ? renderButton(btns) : btns;
49
60
  return /*#__PURE__*/React.createElement("div", {
50
61
  className: "dtl-layout"
@@ -12,6 +12,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
12
12
  textField?: string;
13
13
  textName?: string;
14
14
  tableConfig?: any;
15
+ labelWidth?: number;
15
16
  onSelectChange?: (item: any) => void;
16
17
  };
17
18
  declare function InputTable(prop: InputTableProps): JSX.Element;
@@ -10,7 +10,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
11
11
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
- var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "textField", "onSelectChange"],
13
+ var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange"],
14
14
  _excluded2 = ["current", "pageSize"];
15
15
  import React from "react";
16
16
  import { useRef, useState, useEffect, useContext } from 'react';
@@ -54,6 +54,8 @@ function InputTable(prop) {
54
54
  readonly = _prop$readonly === void 0 ? true : _prop$readonly,
55
55
  multiple = prop.multiple,
56
56
  valueField = prop.valueField,
57
+ _prop$labelWidth = prop.labelWidth,
58
+ labelWidth = _prop$labelWidth === void 0 ? 70 : _prop$labelWidth,
57
59
  textField = prop.textField,
58
60
  onSelectChange = prop.onSelectChange,
59
61
  rest = _objectWithoutProperties(prop, _excluded);
@@ -118,7 +120,7 @@ function InputTable(prop) {
118
120
  manualRequest: false,
119
121
  actionRef: tableRef,
120
122
  search: {
121
- labelWidth: 70
123
+ labelWidth: labelWidth
122
124
  },
123
125
  options: {
124
126
  density: false,
@@ -128,7 +130,8 @@ function InputTable(prop) {
128
130
  form: {
129
131
  submitter: {
130
132
  resetButtonProps: false
131
- }
133
+ },
134
+ btnInline: true
132
135
  },
133
136
  height: 'full',
134
137
  rowSelection: {
@@ -15,17 +15,19 @@ declare function useDtl(dtlParam: DtlParamType): {
15
15
  selectedRows: any;
16
16
  showEdit: boolean;
17
17
  editItem: any;
18
- tableTools: JSX.Element[];
18
+ tableTools: (boolean | JSX.Element)[];
19
19
  setSelectedRows: import("react").Dispatch<any>;
20
20
  setShowEdit: import("react").Dispatch<import("react").SetStateAction<boolean>>;
21
21
  setEditItem: import("react").Dispatch<any>;
22
- onRemoveDtl: () => void;
22
+ onRemoveDtl: (rows?: any) => void;
23
23
  onSaveDtl: (formData: any) => Promise<boolean>;
24
24
  onLoadDtl: (params: Record<string, any>, sort: Record<string, any>, filter: Record<string, any>) => Promise<any>;
25
- onAddDtl: () => Promise<boolean>;
26
- onEditDtl: () => Promise<boolean>;
25
+ onAddDtl: (item?: any) => Promise<boolean>;
26
+ onEditDtl: (item?: any) => Promise<boolean>;
27
27
  onSaveMst: (values: any) => Promise<boolean>;
28
28
  onRemoveMst: () => Promise<boolean | undefined>;
29
29
  onExportDtl: (url: string, param: exportParam) => Promise<boolean>;
30
+ isAudit: () => boolean;
31
+ onAudit: () => Promise<void>;
30
32
  };
31
33
  export default useDtl;