ls-pro-common 3.0.57 → 3.0.59

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.
@@ -59,7 +59,7 @@ function ImageSelector(prop) {
59
59
  _prop$allowClear = prop.allowClear,
60
60
  allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
61
61
  _prop$title = prop.title,
62
- title = _prop$title === void 0 ? "选择图标" : _prop$title,
62
+ title = _prop$title === void 0 ? '选择图标' : _prop$title,
63
63
  _prop$modalWidth = prop.modalWidth,
64
64
  modalWidth = _prop$modalWidth === void 0 ? '600px' : _prop$modalWidth,
65
65
  name = prop.name,
@@ -71,7 +71,7 @@ function ImageSelector(prop) {
71
71
  _prop$isInput = prop.isInput,
72
72
  isInput = _prop$isInput === void 0 ? true : _prop$isInput,
73
73
  _prop$desc = prop.desc,
74
- desc = _prop$desc === void 0 ? '支持 png | jpg | gif 格式图片' : _prop$desc,
74
+ desc = _prop$desc === void 0 ? '支持 png | jpg | gif | svg 格式图片' : _prop$desc,
75
75
  _prop$imageClass = prop.imageClass,
76
76
  imageClass = _prop$imageClass === void 0 ? '' : _prop$imageClass,
77
77
  _prop$maxCount = prop.maxCount,
@@ -151,7 +151,7 @@ function ImageSelector(prop) {
151
151
  var _formRef$current, _formRef$current$getF;
152
152
  var val = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current)) || {};
153
153
  var url = val === null || val === void 0 ? void 0 : val[name];
154
- if (!url) {
154
+ if (!url && (formRef === null || formRef === void 0 ? void 0 : formRef.current) && name) {
155
155
  var _formRef$current2, _formRef$current2$get;
156
156
  url = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2, name);
157
157
  }
@@ -187,6 +187,9 @@ function ImageSelector(prop) {
187
187
  //@ts-ignore
188
188
  val[name] = img;
189
189
  formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, val);
190
+ if (prop.afterSelect) {
191
+ prop.afterSelect(img);
192
+ }
190
193
  }
191
194
  } else {
192
195
  var _result$flag2;
@@ -244,6 +247,9 @@ function ImageSelector(prop) {
244
247
  formRef.current.setFieldsValue(val);
245
248
  setImgUrl(selectedUrl.join(','));
246
249
  setVisible(false);
250
+ if (prop.afterSelect) {
251
+ prop.afterSelect(selectedUrl.join(','));
252
+ }
247
253
  };
248
254
  var clearValue = function clearValue(e) {
249
255
  if (!e || !e.target.value) {
@@ -252,6 +258,9 @@ function ImageSelector(prop) {
252
258
  var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$get = _formRef$current6.getFieldsValue) === null || _formRef$current6$get === void 0 ? void 0 : _formRef$current6$get.call(_formRef$current6)) || {};
253
259
  formValue[name] = '';
254
260
  formRef.current.setFieldsValue(_objectSpread({}, formValue));
261
+ if (prop.afterSelect) {
262
+ prop.afterSelect('');
263
+ }
255
264
  }
256
265
  };
257
266
  var win = top || window;
@@ -281,7 +290,21 @@ function ImageSelector(prop) {
281
290
  allowClear: allowClear,
282
291
  ref: inputRef,
283
292
  onChange: clearValue
284
- })) : /*#__PURE__*/React.createElement("div", {
293
+ })) : prop.uploadRender ? /*#__PURE__*/React.createElement(_Upload, {
294
+ beforeUpload: beforeUpload,
295
+ onChange: function onChange(info) {
296
+ return onUpload(info, true);
297
+ },
298
+ action: uploadImgApi,
299
+ showUploadList: false,
300
+ name: "file",
301
+ maxCount: 1,
302
+ multiple: false,
303
+ headers: {
304
+ token: localStorage.getItem('token') || ''
305
+ },
306
+ accept: ".png,.gif,.jpg,.jpeg,.bmp,.svg"
307
+ }, prop.uploadRender(imgUrl)) : /*#__PURE__*/React.createElement("div", {
285
308
  className: "image-selector"
286
309
  }, /*#__PURE__*/React.createElement(_Upload, {
287
310
  beforeUpload: beforeUpload,
@@ -296,7 +319,7 @@ function ImageSelector(prop) {
296
319
  headers: {
297
320
  token: localStorage.getItem('token') || ''
298
321
  },
299
- accept: ".png,.gif,.jpg,.jpeg,.bmp"
322
+ accept: ".png,.gif,.jpg,.jpeg,.bmp,.svg"
300
323
  }, imgUrl ? /*#__PURE__*/React.createElement("div", {
301
324
  className: "img-wrapper"
302
325
  }, /*#__PURE__*/React.createElement("img", {
@@ -365,7 +388,7 @@ function ImageSelector(prop) {
365
388
  headers: {
366
389
  token: localStorage.getItem('token') || ''
367
390
  },
368
- accept: ".png,.gif,.jpg,.jpeg,.bmp"
391
+ accept: ".png,.gif,.jpg,.jpeg,.bmp,.svg"
369
392
  }, /*#__PURE__*/React.createElement(_Button, {
370
393
  icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
371
394
  }, "\u4E0A\u4F20\u65B0\u56FE"))), /*#__PURE__*/React.createElement(_Button, {
@@ -412,6 +435,9 @@ function ImageSelector(prop) {
412
435
  setImgUrl(o.url);
413
436
  setSelectedUrl([o.url]);
414
437
  setVisible(false);
438
+ if (prop.afterSelect) {
439
+ prop.afterSelect(o.url);
440
+ }
415
441
  },
416
442
  onClick: function onClick() {
417
443
  toggleSelectImage(o.url);
@@ -14,8 +14,6 @@
14
14
  max-width: min-content !important;
15
15
  }
16
16
 
17
-
18
-
19
17
  .ant-input-has-value:hover {
20
18
  .ant-input-clear-icon {
21
19
  visibility: visible;
@@ -61,16 +59,15 @@
61
59
  }
62
60
  }
63
61
 
64
-
65
62
  .ant-btn {
66
63
  height: 32px;
64
+ color: var(--ant-primary-color);
67
65
  background-color: var(--ant-primary-1);
68
66
  border-color: transparent;
69
- color: var(--ant-primary-color);
70
67
  border-radius: 4px;
71
68
 
72
69
  &.ant-btn-lg {
73
- height: 40px
70
+ height: 40px;
74
71
  }
75
72
 
76
73
  &.ant-btn-sm {
@@ -79,114 +76,113 @@
79
76
 
80
77
  &:hover,
81
78
  &:focus {
79
+ color: var(--ant-primary-color);
82
80
  background-color: var(--ant-primary-2);
83
81
  border-color: transparent;
84
- color: var(--ant-primary-color);
85
82
  }
86
83
 
87
84
  &:active {
85
+ color: var(--ant-primary-color);
88
86
  background-color: var(--ant-primary-3);
89
87
  border-color: transparent;
90
- color: var(--ant-primary-color);
91
88
  }
92
89
 
93
90
  &[disabled],
94
91
  &[disabled]:hover,
95
92
  &[disabled]:focus,
96
93
  &[disabled]:active {
97
- background-color: #EAEEF2;
94
+ color: #d9d9d9;
95
+ background-color: #eaeef2;
98
96
  border-color: transparent;
99
- color: #D9D9D9;
100
97
  }
101
98
  }
102
99
 
103
100
  .ant-btn-primary {
101
+ color: #fff;
104
102
  background-color: var(--ant-primary-color);
105
103
  border-color: transparent;
106
- color: #fff;
107
104
 
108
105
  &:hover,
109
106
  &:focus {
107
+ color: #fff;
110
108
  background-color: var(--ant-primary-color-hover);
111
109
  border-color: transparent;
112
- color: #fff;
113
110
  }
114
111
 
115
112
  &:active {
113
+ color: #fff;
116
114
  background-color: var(--ant-primary-color-active);
117
115
  border-color: transparent;
118
- color: #fff;
119
116
  }
120
117
 
121
118
  &[disabled],
122
119
  &[disabled]:hover,
123
120
  &[disabled]:focus,
124
121
  &[disabled]:active {
122
+ color: #fff;
125
123
  background-color: var(--ant-primary-color-outline);
126
124
  border-color: transparent;
127
- color: #fff;
128
125
  }
129
126
  }
130
127
 
131
128
  .ant-btn-dashed,
132
129
  .ant-btn-gray {
133
- background-color: #F1F4F6;
134
- color: #1B1F2A;
130
+ color: #1b1f2a;
131
+ background-color: #f1f4f6;
135
132
 
136
133
  &:hover,
137
134
  &:focus {
138
- background-color: #D2D6DD;
139
- color: #1B1F2A;
135
+ color: #1b1f2a;
136
+ background-color: #d2d6dd;
140
137
  }
141
138
 
142
139
  &:active {
143
- background-color: #B5BBC5;
144
- color: #1B1F2A;
140
+ color: #1b1f2a;
141
+ background-color: #b5bbc5;
145
142
  }
146
143
 
147
144
  &[disabled],
148
145
  &[disabled]:hover,
149
146
  &[disabled]:focus,
150
147
  &[disabled]:active {
151
- background-color: #F1F4F6;
152
148
  color: #818999;
149
+ background-color: #f1f4f6;
153
150
  }
154
151
  }
155
152
 
156
-
157
153
  .ant-btn-dangerous {
158
- background-color: #FFCCC7;
154
+ color: #f5222d;
155
+ background-color: #ffccc7;
159
156
  border-color: transparent;
160
- color: #F5222D;
161
157
 
162
158
  &:hover,
163
159
  &:focus {
164
- background-color: #FFF1F0;
160
+ color: #f5222d;
161
+ background-color: #fff1f0;
165
162
  border-color: transparent;
166
- color: #F5222D;
167
163
  }
168
164
 
169
165
  &:active {
170
- background-color: #FFA39E;
166
+ color: #f5222d;
167
+ background-color: #ffa39e;
171
168
  border-color: transparent;
172
- color: #F5222D;
173
169
  }
174
170
 
175
171
  &[disabled],
176
172
  &[disabled]:hover,
177
173
  &[disabled]:focus,
178
174
  &[disabled]:active {
179
- background-color: #FFCCC7;
175
+ color: #ffa39e;
176
+ background-color: #ffccc7;
180
177
  border-color: transparent;
181
- color: #FFA39E;
182
178
  }
183
179
  }
184
180
 
185
181
  .ant-btn-link {
182
+ padding: 4px 8px;
183
+ color: var(--ant-primary-color);
186
184
  background-color: transparent;
187
185
  border-color: transparent;
188
- color: var(--ant-primary-color);
189
- padding: 4px 8px;
190
186
 
191
187
  &[disabled],
192
188
  &[disabled]:hover,
@@ -212,15 +208,15 @@
212
208
  &[disabled]:hover,
213
209
  &[disabled]:focus,
214
210
  &[disabled]:active {
215
- color: #A7B5CC;
211
+ color: #a7b5cc;
216
212
  }
217
213
  }
218
214
 
219
215
  .ant-btn-text {
216
+ padding: 4px 8px;
217
+ color: #8c8c8c;
220
218
  background-color: transparent;
221
219
  border-color: transparent;
222
- color: #8C8C8C;
223
- padding: 4px 8px;
224
220
 
225
221
  &[disabled],
226
222
  &[disabled]:hover,
@@ -231,7 +227,6 @@
231
227
  &:active {
232
228
  background-color: transparent;
233
229
  border-color: transparent;
234
-
235
230
  }
236
231
 
237
232
  &:hover,
@@ -253,7 +248,6 @@
253
248
  animation-fill-mode: none !important;
254
249
  }
255
250
 
256
-
257
251
  .ant-descriptions-item-label {
258
252
  color: #8c8c8c !important;
259
253
 
@@ -283,18 +277,18 @@
283
277
  }
284
278
  }
285
279
 
286
- .ant-table-filter-dropdown .ant-checkbox-wrapper+span,
287
- .ant-table-filter-dropdown-submenu .ant-checkbox-wrapper+span {
280
+ .ant-table-filter-dropdown .ant-checkbox-wrapper + span,
281
+ .ant-table-filter-dropdown-submenu .ant-checkbox-wrapper + span {
288
282
  display: inline-block;
283
+ width: 200px;
289
284
  overflow: hidden;
290
285
  text-overflow: ellipsis;
291
- width: 200px;
292
286
  }
293
287
 
294
288
  // 以下为调整字体大小及行高
295
289
 
296
290
  .ant-picker:not(.ant-picker-large, .ant-picker-sm),
297
- .ant-input:not(.ant-input-lg, .ant-input-sm) .ant-form-item-label>label,
291
+ .ant-input:not(.ant-input-lg, .ant-input-sm) .ant-form-item-label > label,
298
292
  .ant-form:not(.ant-form-large, .ant-form-sm) .ant-form-item,
299
293
  .ant-input:not(.ant-input-lg, .ant-input-sm),
300
294
  .ant-input-number:not(.ant-input-number-lg, .ant-input-number-sm),
@@ -306,7 +300,7 @@
306
300
 
307
301
  .ant-btn:not(.ant-btn-lg, .ant-btn-sm),
308
302
  .ant-select-single:not(.ant-select-customize-input) .ant-select-selector,
309
- .ant-input:not(.ant-input-lg, .ant-input-sm) .ant-form-item-label>label {
303
+ .ant-input:not(.ant-input-lg, .ant-input-sm) .ant-form-item-label > label {
310
304
  height: 28px !important;
311
305
  min-height: 28px !important;
312
306
  }
@@ -319,8 +313,12 @@
319
313
  margin-bottom: 12px !important;
320
314
  }
321
315
 
322
- .ant-select-single:not(.ant-select-lg, .ant-select-sm) .ant-select-selector .ant-select-selection-item,
323
- .ant-select-single:not(.ant-select-lg, .ant-select-sm) .ant-select-selector .ant-select-selection-placeholder {
316
+ .ant-select-single:not(.ant-select-lg, .ant-select-sm)
317
+ .ant-select-selector
318
+ .ant-select-selection-item,
319
+ .ant-select-single:not(.ant-select-lg, .ant-select-sm)
320
+ .ant-select-selector
321
+ .ant-select-selection-placeholder {
324
322
  line-height: 26px !important;
325
323
  }
326
324
 
@@ -340,7 +338,6 @@
340
338
  padding-bottom: 2px !important;
341
339
  }
342
340
 
343
-
344
341
  .ant-picker-range:not(.ant-picker-large, .ant-picker-sm) {
345
342
  padding: 2px 4px !important;
346
343
 
@@ -356,12 +353,12 @@
356
353
  right: 3px !important;
357
354
  }
358
355
 
359
- .ant-picker-input>input {
356
+ .ant-picker-input > input {
360
357
  letter-spacing: -0.8px !important;
361
358
  }
362
359
  }
363
360
 
364
- .ant-table-filter-dropdown .ant-dropdown-menu-item .ant-checkbox+span {
361
+ .ant-table-filter-dropdown .ant-dropdown-menu-item .ant-checkbox + span {
365
362
  width: 230px;
366
363
  }
367
364
 
@@ -379,31 +376,31 @@
379
376
  max-width: 200px;
380
377
 
381
378
  ul {
382
- height: 0;
383
379
  flex: auto;
384
- list-style: none;
385
- overflow: auto;
380
+ height: 0;
386
381
  margin: 0;
387
382
  padding: 8px;
383
+ overflow: auto;
384
+ list-style: none;
388
385
  border-inline-end: 1px solid rgba(5, 5, 5, 0.06);
389
386
 
390
387
  li {
388
+ margin-top: 8px;
391
389
  overflow: hidden;
392
390
  white-space: nowrap;
393
391
  text-overflow: ellipsis;
394
392
  border-radius: 4px;
395
- padding-inline: 8px;
396
- padding-block: 1px;
397
393
  cursor: pointer;
398
394
  transition: all 0.3s;
399
- margin-top: 8px;
395
+ padding-inline: 8px;
396
+ padding-block: 1px;
400
397
  }
401
398
  }
402
399
  }
403
400
  }
404
401
 
405
402
  .ant-table td.ant-table-cell {
406
- color: #5b5b5b
403
+ color: #5b5b5b;
407
404
  }
408
405
 
409
406
  .ant-pro-form-query-filter.ant-form-vertical {
@@ -417,26 +414,27 @@
417
414
  height: 28px;
418
415
  }
419
416
 
420
- .ant-input-group.ant-input-group-compact>*:first-child {
417
+ .ant-input-group.ant-input-group-compact > *:first-child {
421
418
  border-radius: 0 !important;
422
419
  border-top-left-radius: 4px !important;
423
420
  border-bottom-left-radius: 4px !important;
424
421
  }
425
422
 
426
- .ant-input-group.ant-input-group-compact>*:last-child {
423
+ .ant-input-group.ant-input-group-compact > *:last-child {
427
424
  border-radius: 0 !important;
428
- border-top-left-radius: 4px !important;
429
- border-bottom-left-radius: 4px !important;
425
+ border-top-right-radius: 4px !important;
426
+ border-bottom-right-radius: 4px !important;
427
+ }
428
+ .ant-input-group > .ant-input:not(:first-child):not(:last-child) {
429
+ line-height: 1.5;
430
430
  }
431
-
432
431
  }
433
432
 
434
- .ant-input-number-group>.ant-input-number:not(:first-child):not(:last-child) {
433
+ .ant-input-number-group > .ant-input-number:not(:first-child):not(:last-child) {
435
434
  border-radius: 0 !important;
436
435
  }
437
436
 
438
437
  .ant-pro-table {
439
-
440
438
  .ant-table:not(.ant-table-has-fix-right),
441
439
  .ant-table.ant-table-empty {
442
440
  .ant-table-container {
@@ -453,4 +451,4 @@
453
451
  }
454
452
  }
455
453
  }
456
- }
454
+ }
@@ -1 +1,2 @@
1
+ /** 用于在useEffect, useCallback, useMemo等hooks中不传依赖时获取最新的值 */
1
2
  export default function (initVal: any): any[];
@@ -1,17 +1,18 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { useState, useRef } from "react";
2
+ import { useState, useRef } from 'react';
3
+ /** 用于在useEffect, useCallback, useMemo等hooks中不传依赖时获取最新的值 */
3
4
  export default function (initVal) {
4
5
  var _useState = useState(initVal),
5
6
  _useState2 = _slicedToArray(_useState, 2),
6
7
  state = _useState2[0],
7
8
  setState = _useState2[1];
8
9
  var ref = useRef(initVal);
9
- var shangeState = function shangeState(newVal) {
10
+ var changeState = function changeState(newVal) {
10
11
  ref.current = newVal;
11
12
  setState(newVal);
12
13
  };
13
14
  var getState = function getState() {
14
15
  return ref.current;
15
16
  };
16
- return [state, shangeState, getState];
17
+ return [state, changeState, getState];
17
18
  }