ls-pro-common 1.0.76 → 1.0.77

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.
@@ -36,6 +36,7 @@ export declare type DtlLyaoutProps = Record<string, any> & {
36
36
  statusField?: string;
37
37
  /** 审核状态值 */
38
38
  auditStatus?: number;
39
+ isView?: boolean;
39
40
  };
40
41
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
41
42
  export default DtlLayout;
@@ -23,7 +23,9 @@ function DtlLayout(props) {
23
23
  btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
24
24
  btnStatus = props.btnStatus,
25
25
  statusField = props.statusField,
26
- auditStatus = props.auditStatus;
26
+ auditStatus = props.auditStatus,
27
+ _props$isView = props.isView,
28
+ isView = _props$isView === void 0 ? false : _props$isView;
27
29
 
28
30
  var _usePermission = usePermission(),
29
31
  checkRight = _usePermission.checkRight;
@@ -43,7 +45,8 @@ function DtlLayout(props) {
43
45
  };
44
46
 
45
47
  var btnDisabled = function btnDisabled(btnKey) {
46
- // 优先处理自定义的状态
48
+ if (isView) return true; // 优先处理自定义的状态
49
+
47
50
  if (btnStatus && typeof btnStatus(btnKey) === 'boolean') {
48
51
  return btnStatus(btnKey) || false;
49
52
  }
@@ -62,7 +65,7 @@ function DtlLayout(props) {
62
65
  // ]
63
66
  var b = []; // 有新增或更改权限且未审核,开放出保存按钮
64
67
 
65
- if ((checkRight(2) || checkRight(4)) && !isAudit()) {
68
+ if ((checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
66
69
  b.unshift( /*#__PURE__*/React.createElement(_Button, {
67
70
  key: "btnSave",
68
71
  onClick: function onClick() {
@@ -80,7 +83,7 @@ function DtlLayout(props) {
80
83
  } // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
81
84
 
82
85
 
83
- if (props.onAudit && checkRight(64) && !isAudit()) {
86
+ if (props.onAudit && checkRight(64) && !isAudit() && !isView) {
84
87
  b.unshift( /*#__PURE__*/React.createElement(_Button, {
85
88
  key: "btnAudit",
86
89
  disabled: btnDisabled('btnAudit'),
@@ -81,13 +81,13 @@ function IconSelector(prop) {
81
81
 
82
82
  try {
83
83
  if (!inputRef.current) return;
84
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
84
+ var el = inputRef.current.input.parentNode;
85
85
  if (!el) return;
86
86
 
87
87
  if (icon) {
88
- el.classList.remove('ant-input-clear-icon-hidden');
88
+ el.classList.add('ant-input-has-value');
89
89
  } else {
90
- el.classList.add('ant-input-clear-icon-hidden');
90
+ el.classList.remove('ant-input-has-value');
91
91
  }
92
92
  } catch (e) {}
93
93
  }, [icon]);
@@ -241,13 +241,13 @@ function ImageSelector(prop) {
241
241
 
242
242
  try {
243
243
  if (!inputRef.current) return;
244
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
244
+ var el = inputRef.current.input.parentNode;
245
245
  if (!el) return;
246
246
 
247
247
  if (imgUrl) {
248
- el.classList.remove('ant-input-clear-icon-hidden');
248
+ el.classList.add('ant-input-has-value');
249
249
  } else {
250
- el.classList.add('ant-input-clear-icon-hidden');
250
+ el.classList.remove('ant-input-has-value');
251
251
  }
252
252
  } catch (e) {}
253
253
  }, [imgUrl]);
@@ -186,6 +186,8 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
186
186
  if (!textName && formValue[name]) {
187
187
  formValue[textNameProp] = formValue[name];
188
188
  formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue(_objectSpread({}, formValue));
189
+ } else if (textName && formValue[textName]) {
190
+ setText(formValue[textName]);
189
191
  }
190
192
  }, []); // 处理返回数据
191
193
 
@@ -343,18 +345,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
343
345
  }, "\u786E\u8BA4")];
344
346
  },
345
347
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
346
- }, tableConfig));
348
+ }, tableConfig)); // 处理有值时,可清空
349
+
347
350
  useEffect(function () {
348
351
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
349
352
 
350
353
  try {
351
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
354
+ var el = inputRef.current.input.parentNode;
352
355
  if (!el) return;
353
356
 
354
357
  if (text) {
355
- el.classList.remove('ant-input-clear-icon-hidden');
358
+ el.classList.add('ant-input-has-value');
356
359
  } else {
357
- el.classList.add('ant-input-clear-icon-hidden');
360
+ el.classList.remove('ant-input-has-value');
358
361
  }
359
362
  } catch (e) {}
360
363
  }, [text, rest, fieldProps]);
@@ -305,4 +305,10 @@ a:hover {
305
305
  max-height: calc(100vh - 180px);
306
306
  overflow-y: auto;
307
307
  }
308
+ }
309
+
310
+ .ant-input-has-value:hover{
311
+ .ant-input-clear-icon{
312
+ visibility: visible;
313
+ }
308
314
  }
package/es/http/index.js CHANGED
@@ -91,7 +91,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
91
91
  reLogin();
92
92
  } else if (noMsg !== '1') {
93
93
  if (faultCode) {
94
- httpError(retMsg, requestId, faultCode, options.url);
94
+ httpError(retMsg, retCode, faultCode, options.url);
95
95
  } else {
96
96
  showError(retMsg + options.url);
97
97
  }
@@ -131,7 +131,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
131
131
  reLogin();
132
132
  } else {
133
133
  if (_faultCode) {
134
- httpError(_retMsg, _requestId, _faultCode, options.url);
134
+ httpError(_retMsg, _retCode, _faultCode, options.url);
135
135
  } else {
136
136
  showError(_retMsg);
137
137
  }
@@ -104,7 +104,7 @@ export declare const showAlert: (text: React.ReactDOM, title?: string, type?: 'e
104
104
  destroy: () => void;
105
105
  update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
106
106
  };
107
- export declare const httpError: (retMsg?: string | undefined, requestId?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
107
+ export declare const httpError: (retMsg?: string | undefined, retCode?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
108
108
  export declare const exitAlert: () => void;
109
109
  /** @name 显示确认 */
110
110
  export declare const showConfirm: (text: string, title?: string) => Promise<unknown>;
package/es/utils/index.js CHANGED
@@ -264,8 +264,8 @@ export var showAlert = function showAlert(text) {
264
264
  content: text
265
265
  });
266
266
  };
267
- export var httpError = function httpError(retMsg, requestId, faultCode, url) {
268
- var msg = /*#__PURE__*/React.createElement(React.Fragment, null, retMsg, /*#__PURE__*/React.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/React.createElement("b", null, faultCode));
267
+ export var httpError = function httpError(retMsg, retCode, faultCode, url) {
268
+ var msg = /*#__PURE__*/React.createElement(React.Fragment, null, "\u9519\u8BEF\u539F\u56E0:", /*#__PURE__*/React.createElement("b", null, retMsg), /*#__PURE__*/React.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/React.createElement("b", null, retCode), /*#__PURE__*/React.createElement("br", null), "\u6545\u969C\u7801:", /*#__PURE__*/React.createElement("b", null, faultCode));
269
269
  showAlert(msg, '请求接口出错', 'error');
270
270
  };
271
271
  export var exitAlert = function exitAlert() {
@@ -36,6 +36,7 @@ export declare type DtlLyaoutProps = Record<string, any> & {
36
36
  statusField?: string;
37
37
  /** 审核状态值 */
38
38
  auditStatus?: number;
39
+ isView?: boolean;
39
40
  };
40
41
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
41
42
  export default DtlLayout;
@@ -40,7 +40,9 @@ function DtlLayout(props) {
40
40
  btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
41
41
  btnStatus = props.btnStatus,
42
42
  statusField = props.statusField,
43
- auditStatus = props.auditStatus;
43
+ auditStatus = props.auditStatus,
44
+ _props$isView = props.isView,
45
+ isView = _props$isView === void 0 ? false : _props$isView;
44
46
 
45
47
  var _usePermission = (0, _usePermission2.default)(),
46
48
  checkRight = _usePermission.checkRight;
@@ -60,7 +62,8 @@ function DtlLayout(props) {
60
62
  };
61
63
 
62
64
  var btnDisabled = function btnDisabled(btnKey) {
63
- // 优先处理自定义的状态
65
+ if (isView) return true; // 优先处理自定义的状态
66
+
64
67
  if (btnStatus && typeof btnStatus(btnKey) === 'boolean') {
65
68
  return btnStatus(btnKey) || false;
66
69
  }
@@ -79,7 +82,7 @@ function DtlLayout(props) {
79
82
  // ]
80
83
  var b = []; // 有新增或更改权限且未审核,开放出保存按钮
81
84
 
82
- if ((checkRight(2) || checkRight(4)) && !isAudit()) {
85
+ if ((checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
83
86
  b.unshift( /*#__PURE__*/_react.default.createElement(_button.default, {
84
87
  key: "btnSave",
85
88
  onClick: function onClick() {
@@ -97,7 +100,7 @@ function DtlLayout(props) {
97
100
  } // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
98
101
 
99
102
 
100
- if (props.onAudit && checkRight(64) && !isAudit()) {
103
+ if (props.onAudit && checkRight(64) && !isAudit() && !isView) {
101
104
  b.unshift( /*#__PURE__*/_react.default.createElement(_button.default, {
102
105
  key: "btnAudit",
103
106
  disabled: btnDisabled('btnAudit'),
@@ -104,13 +104,13 @@ function IconSelector(prop) {
104
104
 
105
105
  try {
106
106
  if (!inputRef.current) return;
107
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
107
+ var el = inputRef.current.input.parentNode;
108
108
  if (!el) return;
109
109
 
110
110
  if (icon) {
111
- el.classList.remove('ant-input-clear-icon-hidden');
111
+ el.classList.add('ant-input-has-value');
112
112
  } else {
113
- el.classList.add('ant-input-clear-icon-hidden');
113
+ el.classList.remove('ant-input-has-value');
114
114
  }
115
115
  } catch (e) {}
116
116
  }, [icon]);
@@ -271,13 +271,13 @@ function ImageSelector(prop) {
271
271
 
272
272
  try {
273
273
  if (!inputRef.current) return;
274
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
274
+ var el = inputRef.current.input.parentNode;
275
275
  if (!el) return;
276
276
 
277
277
  if (imgUrl) {
278
- el.classList.remove('ant-input-clear-icon-hidden');
278
+ el.classList.add('ant-input-has-value');
279
279
  } else {
280
- el.classList.add('ant-input-clear-icon-hidden');
280
+ el.classList.remove('ant-input-has-value');
281
281
  }
282
282
  } catch (e) {}
283
283
  }, [imgUrl]);
@@ -214,6 +214,8 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
214
214
  if (!textName && formValue[name]) {
215
215
  formValue[textNameProp] = formValue[name];
216
216
  formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
217
+ } else if (textName && formValue[textName]) {
218
+ setText(formValue[textName]);
217
219
  }
218
220
  }, []); // 处理返回数据
219
221
 
@@ -372,19 +374,20 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
372
374
  }, "\u786E\u8BA4")];
373
375
  },
374
376
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
375
- }, tableConfig));
377
+ }, tableConfig)); // 处理有值时,可清空
378
+
376
379
 
377
380
  (0, _react.useEffect)(function () {
378
381
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
379
382
 
380
383
  try {
381
- var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
384
+ var el = inputRef.current.input.parentNode;
382
385
  if (!el) return;
383
386
 
384
387
  if (text) {
385
- el.classList.remove('ant-input-clear-icon-hidden');
388
+ el.classList.add('ant-input-has-value');
386
389
  } else {
387
- el.classList.add('ant-input-clear-icon-hidden');
390
+ el.classList.remove('ant-input-has-value');
388
391
  }
389
392
  } catch (e) {}
390
393
  }, [text, rest, fieldProps]);
@@ -305,4 +305,10 @@ a:hover {
305
305
  max-height: calc(100vh - 180px);
306
306
  overflow-y: auto;
307
307
  }
308
+ }
309
+
310
+ .ant-input-has-value:hover{
311
+ .ant-input-clear-icon{
312
+ visibility: visible;
313
+ }
308
314
  }
package/lib/http/index.js CHANGED
@@ -110,7 +110,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
110
110
  (0, _utils.reLogin)();
111
111
  } else if (noMsg !== '1') {
112
112
  if (faultCode) {
113
- (0, _utils.httpError)(retMsg, requestId, faultCode, options.url);
113
+ (0, _utils.httpError)(retMsg, retCode, faultCode, options.url);
114
114
  } else {
115
115
  (0, _utils.showError)(retMsg + options.url);
116
116
  }
@@ -150,7 +150,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
150
150
  (0, _utils.reLogin)();
151
151
  } else {
152
152
  if (_faultCode) {
153
- (0, _utils.httpError)(_retMsg, _requestId, _faultCode, options.url);
153
+ (0, _utils.httpError)(_retMsg, _retCode, _faultCode, options.url);
154
154
  } else {
155
155
  (0, _utils.showError)(_retMsg);
156
156
  }
@@ -104,7 +104,7 @@ export declare const showAlert: (text: React.ReactDOM, title?: string, type?: 'e
104
104
  destroy: () => void;
105
105
  update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
106
106
  };
107
- export declare const httpError: (retMsg?: string | undefined, requestId?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
107
+ export declare const httpError: (retMsg?: string | undefined, retCode?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
108
108
  export declare const exitAlert: () => void;
109
109
  /** @name 显示确认 */
110
110
  export declare const showConfirm: (text: string, title?: string) => Promise<unknown>;
@@ -370,8 +370,8 @@ var showAlert = function showAlert(text) {
370
370
 
371
371
  exports.showAlert = showAlert;
372
372
 
373
- var httpError = function httpError(retMsg, requestId, faultCode, url) {
374
- var msg = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, retMsg, /*#__PURE__*/_react.default.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/_react.default.createElement("b", null, faultCode));
373
+ var httpError = function httpError(retMsg, retCode, faultCode, url) {
374
+ var msg = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "\u9519\u8BEF\u539F\u56E0:", /*#__PURE__*/_react.default.createElement("b", null, retMsg), /*#__PURE__*/_react.default.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/_react.default.createElement("b", null, retCode), /*#__PURE__*/_react.default.createElement("br", null), "\u6545\u969C\u7801:", /*#__PURE__*/_react.default.createElement("b", null, faultCode));
375
375
 
376
376
  showAlert(msg, '请求接口出错', 'error');
377
377
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.76",
3
+ "version": "1.0.77",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@ant-design/icons": "^4.3.0",
30
- "ls-pro-table": "2.62.56",
30
+ "ls-pro-table": "2.62.57",
31
31
  "ls-pro-form": "1.52.33",
32
32
  "@babel/runtime": "^7.16.3",
33
33
  "classnames": "^2.2.6",