ls-pro-common 3.0.50 → 3.0.52

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,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ProFormInstance } from 'ls-pro-form';
3
+ import { ButtonProps } from 'antd';
3
4
  import './common.less';
4
5
  export declare type DtlLyaoutProps = Record<string, any> & {
5
6
  /** 返回方法 */
@@ -39,6 +40,9 @@ export declare type DtlLyaoutProps = Record<string, any> & {
39
40
  /** 审核状态值 */
40
41
  auditStatus?: number;
41
42
  isView?: boolean;
43
+ saveBtnProps?: ButtonProps;
44
+ backBtnProps?: ButtonProps;
45
+ auditBtnProps?: ButtonProps;
42
46
  };
43
47
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
44
48
  export default DtlLayout;
@@ -2,6 +2,7 @@ import "antd/es/space/style";
2
2
  import _Space from "antd/es/space";
3
3
  import "antd/es/button/style";
4
4
  import _Button from "antd/es/button";
5
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
6
  import React, { useMemo } from 'react';
6
7
  import classNames from 'classnames';
7
8
  import { SaveOutlined, AuditOutlined } from '@ant-design/icons';
@@ -52,18 +53,18 @@ function DtlLayout(props) {
52
53
  return isAudit();
53
54
  };
54
55
  var btns = useMemo(function () {
55
- var back = /*#__PURE__*/React.createElement(_Button, {
56
+ var back = /*#__PURE__*/React.createElement(_Button, _extends({
56
57
  key: "btnBack",
57
58
  onClick: function onClick() {
58
59
  return props.onExit(false);
59
60
  },
60
61
  className: "ant-btn-gray",
61
62
  icon: /*#__PURE__*/React.createElement(IconBack, null)
62
- }, btnExitText);
63
+ }, props.backBtnProps), btnExitText);
63
64
  var btnList = [back];
64
65
  // 有新增或更改权限且未审核,开放出保存按钮
65
66
  if (btnSaveText && (checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
66
- btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
67
+ btnList.unshift( /*#__PURE__*/React.createElement(_Button, _extends({
67
68
  key: "btnSave",
68
69
  onClick: function onClick() {
69
70
  var _formRef$current;
@@ -74,11 +75,11 @@ function DtlLayout(props) {
74
75
  },
75
76
  disabled: btnDisabled('btnSave'),
76
77
  icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
77
- }, btnSaveText));
78
+ }, props.saveBtnProps), btnSaveText));
78
79
  }
79
80
  // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
80
81
  if (btnAuditText && props.onAudit && checkRight(64) && !isAudit() && !isView) {
81
- btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
82
+ btnList.unshift( /*#__PURE__*/React.createElement(_Button, _extends({
82
83
  key: "btnAudit",
83
84
  disabled: btnDisabled('btnAudit'),
84
85
  onClick: function onClick() {
@@ -86,7 +87,7 @@ function DtlLayout(props) {
86
87
  props.onAudit();
87
88
  },
88
89
  icon: /*#__PURE__*/React.createElement(AuditOutlined, null)
89
- }, btnAuditText));
90
+ }, props.auditBtnProps), btnAuditText));
90
91
  }
91
92
  // 如果用户直接返回空,还是需要把返回按钮加上。
92
93
  if (props.renderButton) {
@@ -334,6 +334,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
334
334
  var _formRef$current15, _formRef$current15$se;
335
335
  formRef === null || formRef === void 0 ? void 0 : (_formRef$current15 = formRef.current) === null || _formRef$current15 === void 0 ? void 0 : (_formRef$current15$se = _formRef$current15.setFieldsValue) === null || _formRef$current15$se === void 0 ? void 0 : _formRef$current15$se.call(_formRef$current15, _objectSpread({}, formValue));
336
336
  }
337
+ if (onSelectChange) {
338
+ try {
339
+ onSelectChange(null, formRef);
340
+ } catch (e) {}
341
+ }
337
342
  }
338
343
  };
339
344
  useEffect(function () {
@@ -404,4 +404,53 @@
404
404
 
405
405
  .ant-table td.ant-table-cell {
406
406
  color: #5b5b5b
407
+ }
408
+
409
+ .ant-pro-form-query-filter.ant-form-vertical {
410
+ .ant-form-item-label {
411
+ padding: 0;
412
+ }
413
+ }
414
+
415
+ .ant-pro-form-query-filter {
416
+ .ant-input-number-input {
417
+ height: 28px;
418
+ }
419
+
420
+ .ant-input-group.ant-input-group-compact>*:first-child {
421
+ border-radius: 0 !important;
422
+ border-top-left-radius: 4px !important;
423
+ border-bottom-left-radius: 4px !important;
424
+ }
425
+
426
+ .ant-input-group.ant-input-group-compact>*:last-child {
427
+ border-radius: 0 !important;
428
+ border-top-left-radius: 4px !important;
429
+ border-bottom-left-radius: 4px !important;
430
+ }
431
+
432
+ }
433
+
434
+ .ant-input-number-group>.ant-input-number:not(:first-child):not(:last-child) {
435
+ border-radius: 0 !important;
436
+ }
437
+
438
+ .ant-pro-table {
439
+
440
+ .ant-table:not(.ant-table-has-fix-right),
441
+ .ant-table.ant-table-empty {
442
+ .ant-table-container {
443
+ .ant-table-body {
444
+ overflow: auto !important;
445
+ }
446
+ }
447
+ }
448
+
449
+ .ant-table.ant-table-has-fix-right:not(.ant-table-empty) {
450
+ .ant-table-container {
451
+ .ant-table-body {
452
+ overflow: scroll !important;
453
+ }
454
+ }
455
+ }
407
456
  }
@@ -124,16 +124,21 @@ function useDtl(dtlParam) {
124
124
  return _context.abrupt("return", false);
125
125
  case 23:
126
126
  if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
127
- _context.next = 28;
127
+ _context.next = 29;
128
128
  break;
129
129
  }
130
130
  showSuccess(result.flag.retMsg || '操作成功');
131
- Object.assign(masterObject, result.data);
131
+ if (result.data) {
132
+ Object.assign(masterObject, result.data);
133
+ }
134
+ if (!masterObject.id && result.id) {
135
+ masterObject.id = result.id;
136
+ }
132
137
  setEditItem({});
133
138
  return _context.abrupt("return", true);
134
- case 28:
135
- return _context.abrupt("return", false);
136
139
  case 29:
140
+ return _context.abrupt("return", false);
141
+ case 30:
137
142
  case "end":
138
143
  return _context.stop();
139
144
  }
@@ -302,7 +307,7 @@ function useDtl(dtlParam) {
302
307
  return _context3.abrupt("return", false);
303
308
  case 13:
304
309
  if (!ids) {
305
- ids = [masterObject[mstKeyField]];
310
+ ids = [masterObject.id || masterObject[mstKeyField]]; //优先取id为主键,除非表中无id
306
311
  }
307
312
  _context3.next = 16;
308
313
  return mstService.remove(ids);
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { ProFormInstance } from 'ls-pro-form';
3
+ import { ButtonProps } from 'antd';
3
4
  import './common.less';
4
5
  export declare type DtlLyaoutProps = Record<string, any> & {
5
6
  /** 返回方法 */
@@ -39,6 +40,9 @@ export declare type DtlLyaoutProps = Record<string, any> & {
39
40
  /** 审核状态值 */
40
41
  auditStatus?: number;
41
42
  isView?: boolean;
43
+ saveBtnProps?: ButtonProps;
44
+ backBtnProps?: ButtonProps;
45
+ auditBtnProps?: ButtonProps;
42
46
  };
43
47
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
44
48
  export default DtlLayout;
@@ -2,6 +2,7 @@ import "antd/es/space/style";
2
2
  import _Space from "antd/es/space";
3
3
  import "antd/es/button/style";
4
4
  import _Button from "antd/es/button";
5
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
6
  import React, { useMemo } from 'react';
6
7
  import classNames from 'classnames';
7
8
  import { SaveOutlined, AuditOutlined } from '@ant-design/icons';
@@ -52,18 +53,18 @@ function DtlLayout(props) {
52
53
  return isAudit();
53
54
  };
54
55
  var btns = useMemo(function () {
55
- var back = /*#__PURE__*/React.createElement(_Button, {
56
+ var back = /*#__PURE__*/React.createElement(_Button, _extends({
56
57
  key: "btnBack",
57
58
  onClick: function onClick() {
58
59
  return props.onExit(false);
59
60
  },
60
61
  className: "ant-btn-gray",
61
62
  icon: /*#__PURE__*/React.createElement(IconBack, null)
62
- }, btnExitText);
63
+ }, props.backBtnProps), btnExitText);
63
64
  var btnList = [back];
64
65
  // 有新增或更改权限且未审核,开放出保存按钮
65
66
  if (btnSaveText && (checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
66
- btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
67
+ btnList.unshift( /*#__PURE__*/React.createElement(_Button, _extends({
67
68
  key: "btnSave",
68
69
  onClick: function onClick() {
69
70
  var _formRef$current;
@@ -74,11 +75,11 @@ function DtlLayout(props) {
74
75
  },
75
76
  disabled: btnDisabled('btnSave'),
76
77
  icon: /*#__PURE__*/React.createElement(SaveOutlined, null)
77
- }, btnSaveText));
78
+ }, props.saveBtnProps), btnSaveText));
78
79
  }
79
80
  // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
80
81
  if (btnAuditText && props.onAudit && checkRight(64) && !isAudit() && !isView) {
81
- btnList.unshift( /*#__PURE__*/React.createElement(_Button, {
82
+ btnList.unshift( /*#__PURE__*/React.createElement(_Button, _extends({
82
83
  key: "btnAudit",
83
84
  disabled: btnDisabled('btnAudit'),
84
85
  onClick: function onClick() {
@@ -86,7 +87,7 @@ function DtlLayout(props) {
86
87
  props.onAudit();
87
88
  },
88
89
  icon: /*#__PURE__*/React.createElement(AuditOutlined, null)
89
- }, btnAuditText));
90
+ }, props.auditBtnProps), btnAuditText));
90
91
  }
91
92
  // 如果用户直接返回空,还是需要把返回按钮加上。
92
93
  if (props.renderButton) {
@@ -334,6 +334,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
334
334
  var _formRef$current15, _formRef$current15$se;
335
335
  formRef === null || formRef === void 0 ? void 0 : (_formRef$current15 = formRef.current) === null || _formRef$current15 === void 0 ? void 0 : (_formRef$current15$se = _formRef$current15.setFieldsValue) === null || _formRef$current15$se === void 0 ? void 0 : _formRef$current15$se.call(_formRef$current15, _objectSpread({}, formValue));
336
336
  }
337
+ if (onSelectChange) {
338
+ try {
339
+ onSelectChange(null, formRef);
340
+ } catch (e) {}
341
+ }
337
342
  }
338
343
  };
339
344
  useEffect(function () {
@@ -404,4 +404,53 @@
404
404
 
405
405
  .ant-table td.ant-table-cell {
406
406
  color: #5b5b5b
407
+ }
408
+
409
+ .ant-pro-form-query-filter.ant-form-vertical {
410
+ .ant-form-item-label {
411
+ padding: 0;
412
+ }
413
+ }
414
+
415
+ .ant-pro-form-query-filter {
416
+ .ant-input-number-input {
417
+ height: 28px;
418
+ }
419
+
420
+ .ant-input-group.ant-input-group-compact>*:first-child {
421
+ border-radius: 0 !important;
422
+ border-top-left-radius: 4px !important;
423
+ border-bottom-left-radius: 4px !important;
424
+ }
425
+
426
+ .ant-input-group.ant-input-group-compact>*:last-child {
427
+ border-radius: 0 !important;
428
+ border-top-left-radius: 4px !important;
429
+ border-bottom-left-radius: 4px !important;
430
+ }
431
+
432
+ }
433
+
434
+ .ant-input-number-group>.ant-input-number:not(:first-child):not(:last-child) {
435
+ border-radius: 0 !important;
436
+ }
437
+
438
+ .ant-pro-table {
439
+
440
+ .ant-table:not(.ant-table-has-fix-right),
441
+ .ant-table.ant-table-empty {
442
+ .ant-table-container {
443
+ .ant-table-body {
444
+ overflow: auto !important;
445
+ }
446
+ }
447
+ }
448
+
449
+ .ant-table.ant-table-has-fix-right:not(.ant-table-empty) {
450
+ .ant-table-container {
451
+ .ant-table-body {
452
+ overflow: scroll !important;
453
+ }
454
+ }
455
+ }
407
456
  }
@@ -124,16 +124,21 @@ function useDtl(dtlParam) {
124
124
  return _context.abrupt("return", false);
125
125
  case 23:
126
126
  if (!((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0')) {
127
- _context.next = 28;
127
+ _context.next = 29;
128
128
  break;
129
129
  }
130
130
  showSuccess(result.flag.retMsg || '操作成功');
131
- Object.assign(masterObject, result.data);
131
+ if (result.data) {
132
+ Object.assign(masterObject, result.data);
133
+ }
134
+ if (!masterObject.id && result.id) {
135
+ masterObject.id = result.id;
136
+ }
132
137
  setEditItem({});
133
138
  return _context.abrupt("return", true);
134
- case 28:
135
- return _context.abrupt("return", false);
136
139
  case 29:
140
+ return _context.abrupt("return", false);
141
+ case 30:
137
142
  case "end":
138
143
  return _context.stop();
139
144
  }
@@ -302,7 +307,7 @@ function useDtl(dtlParam) {
302
307
  return _context3.abrupt("return", false);
303
308
  case 13:
304
309
  if (!ids) {
305
- ids = [masterObject[mstKeyField]];
310
+ ids = [masterObject.id || masterObject[mstKeyField]]; //优先取id为主键,除非表中无id
306
311
  }
307
312
  _context3.next = 16;
308
313
  return mstService.remove(ids);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.50",
3
+ "version": "3.0.52",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
@@ -21,8 +21,8 @@
21
21
  ],
22
22
  "dependencies": {
23
23
  "@ant-design/icons": "^4.3.0",
24
- "ls-pro-table": "^3.0.34",
25
- "ls-pro-form": "^3.0.12",
24
+ "ls-pro-table": "^3.0.36",
25
+ "ls-pro-form": "^3.0.14",
26
26
  "ls-pro-field": "^3.0.6",
27
27
  "ls-pro-descriptions": "^3.0.1",
28
28
  "ls-pro-card": "^3.0.3",