@para-ui/core 3.0.83 → 3.0.85

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.
package/Transfer/index.js CHANGED
@@ -15,6 +15,7 @@ import SearchIcon from '@para-ui/icons/Search';
15
15
  import AutoTips from '../AutoTips/index.js';
16
16
  import Drag from '@para-ui/icons/Drag';
17
17
  import { S as Sortable } from '../_verture/sortable.esm-49896035.js';
18
+ import { d as debounce } from '../_verture/utils-c9b9a157.js';
18
19
  import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
19
20
  import '../_verture/unsupportedIterableToArray-cb478f24.js';
20
21
  import '../_verture/typeof-498dd2b1.js';
@@ -40,6 +41,7 @@ import '@para-ui/icons/CloseCircle';
40
41
  import '../Loading/index.js';
41
42
  import '../HelperText/index.js';
42
43
  import '../_verture/useGlobalProps-1b846a65.js';
44
+ import '../_verture/defineProperty-62acccfc.js';
43
45
 
44
46
  var en = {
45
47
  left: 'Left',
@@ -107,7 +109,7 @@ var Box = function Box(props) {
107
109
  rightIcon = props.rightIcon,
108
110
  style = props.style,
109
111
  customKey = props.customKey;
110
- var intl = useFormatMessage('Transfer', localeJson);
112
+ var intl = useFormatMessage("Transfer", localeJson);
111
113
  var _useState = useState([]),
112
114
  _useState2 = _slicedToArray(_useState, 2),
113
115
  checkCount = _useState2[0],
@@ -132,11 +134,11 @@ var Box = function Box(props) {
132
134
  setCheckCount(arr);
133
135
  }, [data]);
134
136
  useEffect(function () {
135
- if (direction == 'right') {
137
+ if (direction == "right") {
136
138
  new Sortable(ref.current, {
137
139
  animation: 180,
138
- ghostClass: 'blue-background-class',
139
- handle: '.handle',
140
+ ghostClass: "blue-background-class",
141
+ handle: ".handle",
140
142
  onEnd: function onEnd(evt) {
141
143
  onEndSort === null || onEndSort === void 0 ? void 0 : onEndSort(evt.oldIndex, evt.newIndex);
142
144
  }
@@ -149,8 +151,18 @@ var Box = function Box(props) {
149
151
  }, function (e, index, item) {
150
152
  if (item === null || item === void 0 ? void 0 : item.disabled) return;
151
153
  onchange(e, true, index, direction, false);
152
- onMove(direction === "right" ? 'left' : 'right');
154
+ onMove(direction === "right" ? "left" : "right");
153
155
  });
156
+ var itemStyle = function itemStyle(data) {
157
+ var stlye = {};
158
+ if (data === null || data === void 0 ? void 0 : data.tagColor) {
159
+ stlye.borderLeft = "4px solid ".concat(data.tagColor);
160
+ }
161
+ if (data === null || data === void 0 ? void 0 : data.hide) {
162
+ stlye.display = "none";
163
+ }
164
+ return stlye;
165
+ };
154
166
  return jsxs("div", Object.assign({
155
167
  className: "box",
156
168
  style: style
@@ -162,7 +174,7 @@ var Box = function Box(props) {
162
174
  })), jsx(Search, {
163
175
  btnType: "inside",
164
176
  placeholder: intl({
165
- id: 'searchPlaceholder'
177
+ id: "searchPlaceholder"
166
178
  }),
167
179
  showBtn: false,
168
180
  rightIcon: jsx(SearchIcon, {}),
@@ -175,7 +187,7 @@ var Box = function Box(props) {
175
187
  },
176
188
  onEnter: function onEnter(event) {
177
189
  var _a;
178
- var val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
190
+ var val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || "";
179
191
  onSearch(val, direction);
180
192
  },
181
193
  allowClear: false
@@ -184,56 +196,53 @@ var Box = function Box(props) {
184
196
  ref: ref
185
197
  }, {
186
198
  children: data.map(function (item, index) {
187
- if (item === null || item === void 0 ? void 0 : item.hide) return null;
188
199
  return jsxs("div", Object.assign({
189
- className: clsx('item', (item === null || item === void 0 ? void 0 : item.disabled) && 'item-disabled', (item === null || item === void 0 ? void 0 : item.checked) && 'item-checked', fluctuationPosition === index && 'item-fluctuation', fluctuationOrther === index && 'item-fluctuationOrther'),
190
- style: (item === null || item === void 0 ? void 0 : item.tagColor) ? {
191
- borderLeft: "4px solid ".concat(item.tagColor)
192
- } : undefined,
200
+ className: clsx("item", (item === null || item === void 0 ? void 0 : item.disabled) && "item-disabled", (item === null || item === void 0 ? void 0 : item.checked) && "item-checked", fluctuationPosition === index && "item-fluctuation", fluctuationOrther === index && "item-fluctuationOrther"),
201
+ style: itemStyle(item),
193
202
  onClick: function onClick(e) {
194
203
  handler(e, index, item);
195
204
  }
196
205
  }, {
197
206
  children: [jsx("div", Object.assign({
198
- className: 'item-label'
207
+ className: "item-label"
199
208
  }, {
200
209
  children: jsx(AutoTips, {
201
210
  children: (item === null || item === void 0 ? void 0 : item.name) || item[item[customKey]]
202
211
  })
203
212
  })), rightIcon ? jsx("div", Object.assign({
204
- className: 'right-icon'
213
+ className: "right-icon"
205
214
  }, {
206
215
  children: rightIcon(item)
207
- })) : null, direction === 'right' ? jsx("div", Object.assign({
208
- className: 'handle'
216
+ })) : null, direction === "right" ? jsx("div", Object.assign({
217
+ className: "handle"
209
218
  }, {
210
219
  children: jsx(Drag, {})
211
220
  })) : null]
212
221
  }), item[item[customKey]] || item.name);
213
222
  })
214
223
  })), jsxs("div", Object.assign({
215
- className: 'footer'
224
+ className: "footer"
216
225
  }, {
217
226
  children: [jsx(Button, Object.assign({
218
227
  variant: "text",
219
- className: "".concat(checkCount.length === data.length - disabledCount && data.length > 0 ? 'btn-on' : ''),
228
+ className: "".concat(checkCount.length === data.length - disabledCount && data.length > 0 ? "btn-on" : ""),
220
229
  onClick: function onClick() {
221
230
  queryAll(checkCount.length !== data.length - disabledCount, direction);
222
231
  }
223
232
  }, {
224
233
  children: intl({
225
- id: 'allCheck'
234
+ id: "allCheck"
226
235
  })
227
236
  })), jsx(Button, Object.assign({
228
237
  variant: "text",
229
- className: "".concat(checkCount.length === 0 || checkCount.length === data.length - disabledCount ? 'btn-off' : ''),
238
+ className: "".concat(checkCount.length === 0 || checkCount.length === data.length - disabledCount ? "btn-off" : ""),
230
239
  disabled: checkCount.length === 0 || checkCount.length === data.length - disabledCount,
231
240
  onClick: function onClick() {
232
241
  inverse(direction);
233
242
  }
234
243
  }, {
235
244
  children: intl({
236
- id: 'inVertCheck'
245
+ id: "inVertCheck"
237
246
  })
238
247
  })), jsxs("div", Object.assign({
239
248
  className: "count"
@@ -250,23 +259,23 @@ styleInject(css_248z);
250
259
 
251
260
  var Transfer = function Transfer(props) {
252
261
  var _a, _b, _c, _d;
253
- var intl = useFormatMessage('Transfer', localeJson);
262
+ var intl = useFormatMessage("Transfer", localeJson);
254
263
  var _props$data = props.data,
255
264
  data = _props$data === void 0 ? [] : _props$data,
256
265
  value = props.value,
257
266
  _props$customKey = props.customKey,
258
- customKey = _props$customKey === void 0 ? 'key' : _props$customKey,
267
+ customKey = _props$customKey === void 0 ? "key" : _props$customKey,
259
268
  onChange = props.onChange,
260
269
  _props$titles = props.titles,
261
270
  titles = _props$titles === void 0 ? [intl({
262
- id: 'left'
271
+ id: "left"
263
272
  }), intl({
264
- id: 'right'
273
+ id: "right"
265
274
  })] : _props$titles,
266
275
  className = props.className,
267
276
  _props$style = props.style,
268
277
  style = _props$style === void 0 ? {
269
- width: '298px'
278
+ width: "298px"
270
279
  } : _props$style,
271
280
  onSort = props.onSort,
272
281
  _props$trim = props.trim,
@@ -309,7 +318,7 @@ var Transfer = function Transfer(props) {
309
318
  animationsLock = _useState16[0],
310
319
  setAnimationLock = _useState16[1];
311
320
  var onchange = useCallback(function (e, bol, index, direction, multiple) {
312
- if (direction === 'left') {
321
+ if (direction === "left") {
313
322
  !multiple && leftData.forEach(function (item) {
314
323
  return item.checked = false;
315
324
  });
@@ -324,7 +333,7 @@ var Transfer = function Transfer(props) {
324
333
  }
325
334
  }, [leftData, rightData]);
326
335
  var queryAll = useCallback(function (checked, direction) {
327
- if (direction === 'left') {
336
+ if (direction === "left") {
328
337
  leftData.forEach(function (item) {
329
338
  if (!item.disabled && !item.hide) item.checked = checked;
330
339
  });
@@ -337,7 +346,7 @@ var Transfer = function Transfer(props) {
337
346
  }
338
347
  }, [leftData, rightData]);
339
348
  var inverse = useCallback(function (direction) {
340
- if (direction === 'left') {
349
+ if (direction === "left") {
341
350
  leftData.forEach(function (item) {
342
351
  if (!item.disabled && !item.hide) item.checked = !item.checked;
343
352
  });
@@ -351,7 +360,7 @@ var Transfer = function Transfer(props) {
351
360
  }, [leftData, rightData]);
352
361
  var onMove = function onMove(direction) {
353
362
  var newData = [];
354
- if (direction === 'left') {
363
+ if (direction === "left") {
355
364
  newData = _toConsumableArray(rightData);
356
365
  newData.forEach(function (item) {
357
366
  if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
@@ -381,7 +390,7 @@ var Transfer = function Transfer(props) {
381
390
  // 上下移动
382
391
  var fluctuation = function fluctuation(direction) {
383
392
  setAnimationLock(true);
384
- if (direction == 'up') {
393
+ if (direction == "up") {
385
394
  // setFluctuationPosition(rightCount[0] - 1)
386
395
  // setFluctuationOrther(rightCount[0])
387
396
  // setTimeout(() => {
@@ -424,13 +433,13 @@ var Transfer = function Transfer(props) {
424
433
  }
425
434
  };
426
435
 
427
- var onSearch = function onSearch(e, direction) {
436
+ var onSearch = debounce(function (e, direction) {
428
437
  var str = trim ? e.toUpperCase().trim() : e.toUpperCase();
429
- if (direction === 'left') {
438
+ if (direction === "left") {
430
439
  leftData.forEach(function (item) {
431
440
  item.hide = false;
432
- var name = (item.name || '').toUpperCase();
433
- var description = (item.description || '').toUpperCase();
441
+ var name = (item.name || "").toUpperCase();
442
+ var description = (item.description || "").toUpperCase();
434
443
  if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
435
444
  item.hide = true;
436
445
  }
@@ -439,15 +448,15 @@ var Transfer = function Transfer(props) {
439
448
  } else {
440
449
  rightData.filter(function (item) {
441
450
  item.hide = false;
442
- var name = (item.name || '').toUpperCase();
443
- var description = (item.description || '').toUpperCase();
451
+ var name = (item.name || "").toUpperCase();
452
+ var description = (item.description || "").toUpperCase();
444
453
  if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
445
454
  item.hide = true;
446
455
  }
447
456
  });
448
457
  setRightData(_toConsumableArray(rightData));
449
458
  }
450
- };
459
+ }, 500);
451
460
  var onEndSort = useCallback(function (oldIndex, newIndex) {
452
461
  setRightData(function (pre) {
453
462
  pre.splice.apply(pre, [newIndex, 0].concat(_toConsumableArray(pre.splice(oldIndex, 1))));
@@ -522,15 +531,15 @@ var Transfer = function Transfer(props) {
522
531
  className: "moveBtn"
523
532
  }, {
524
533
  children: [jsx(Button.IconButton, Object.assign({
525
- className: 'btn btn-right',
526
- variant: 'outlined',
534
+ className: "btn btn-right",
535
+ variant: "outlined",
527
536
  disabled: leftCount.length <= 0,
528
537
  toolTipTitle: leftCount.length <= 0 ? intl({
529
- id: 'rightBtnTips'
530
- }) : '',
538
+ id: "rightBtnTips"
539
+ }) : "",
531
540
  TooltipProps: {
532
541
  arrow: false,
533
- placement: 'bottomRight'
542
+ placement: "bottomRight"
534
543
  },
535
544
  onClick: function onClick() {
536
545
  onMove("right");
@@ -538,50 +547,50 @@ var Transfer = function Transfer(props) {
538
547
  }, {
539
548
  children: jsx(Right, {})
540
549
  })), jsx(Button.IconButton, Object.assign({
541
- className: 'btn btn-left',
542
- variant: 'outlined',
550
+ className: "btn btn-left",
551
+ variant: "outlined",
543
552
  disabled: rightCount.length <= 0 || ((_a = rightData[0]) === null || _a === void 0 ? void 0 : _a.checked) || animationsLock,
544
553
  toolTipTitle: rightCount.length <= 0 || ((_b = rightData[0]) === null || _b === void 0 ? void 0 : _b.checked) ? intl({
545
- id: 'leftBtnTips'
546
- }) : '',
554
+ id: "leftBtnTips"
555
+ }) : "",
547
556
  TooltipProps: {
548
557
  arrow: false,
549
- placement: 'bottomRight'
558
+ placement: "bottomRight"
550
559
  },
551
560
  onClick: function onClick() {
552
- fluctuation('up');
561
+ fluctuation("up");
553
562
  }
554
563
  }, {
555
564
  children: jsx(ExpandLess, {})
556
565
  })), jsx(Button.IconButton, Object.assign({
557
- className: 'btn btn-left',
558
- variant: 'outlined',
566
+ className: "btn btn-left",
567
+ variant: "outlined",
559
568
  disabled: rightCount.length <= 0 || ((_c = rightData[rightData.length - 1]) === null || _c === void 0 ? void 0 : _c.checked) || animationsLock,
560
569
  toolTipTitle: rightCount.length <= 0 || ((_d = rightData[rightData.length - 1]) === null || _d === void 0 ? void 0 : _d.checked) ? intl({
561
- id: 'leftBtnTips'
562
- }) : '',
570
+ id: "leftBtnTips"
571
+ }) : "",
563
572
  TooltipProps: {
564
573
  arrow: false,
565
- placement: 'bottomRight'
574
+ placement: "bottomRight"
566
575
  },
567
576
  onClick: function onClick() {
568
- fluctuation('down');
577
+ fluctuation("down");
569
578
  }
570
579
  }, {
571
580
  children: jsx(Down, {})
572
581
  })), jsx(Button.IconButton, Object.assign({
573
- className: 'btn btn-left',
574
- variant: 'outlined',
582
+ className: "btn btn-left",
583
+ variant: "outlined",
575
584
  disabled: rightCount.length <= 0,
576
585
  toolTipTitle: rightCount.length <= 0 ? intl({
577
- id: 'leftBtnTips'
578
- }) : '',
586
+ id: "leftBtnTips"
587
+ }) : "",
579
588
  TooltipProps: {
580
589
  arrow: false,
581
- placement: 'bottomRight'
590
+ placement: "bottomRight"
582
591
  },
583
592
  onClick: function onClick() {
584
- onMove('left');
593
+ onMove("left");
585
594
  }
586
595
  }, {
587
596
  children: jsx(NavigateBefore, {})
@@ -0,0 +1,77 @@
1
+ import { _ as _defineProperty } from './defineProperty-62acccfc.js';
2
+
3
+ //获取替换字段
4
+ var getReplaceField = function getReplaceField(mode, repl, tableP, treeP) {
5
+ var t = {};
6
+ if (mode === "tree") t = treeP === null || treeP === void 0 ? void 0 : treeP.replaceFields;else t = tableP === null || tableP === void 0 ? void 0 : tableP.replaceFields;
7
+ return Object.assign(Object.assign({}, repl), t);
8
+ };
9
+ //to array
10
+ var toArray = function toArray(list) {
11
+ if (!list) return [];
12
+ return Array.isArray(list) ? list : JSON.stringify(list) === "{}" ? [] : [list];
13
+ };
14
+ var isRemoteLoad = function isRemoteLoad(mode, props) {
15
+ if (mode === "table") {
16
+ return !(props && Array.isArray(props.data));
17
+ }
18
+ return !(props && Array.isArray(props.treeData));
19
+ };
20
+ var getOverlaySize = function getOverlaySize(mode) {
21
+ var isRemoteLoad = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
22
+ var maxHeight = arguments.length > 2 ? arguments[2] : undefined;
23
+ var height = arguments.length > 3 ? arguments[3] : undefined;
24
+ var _a;
25
+ var screenH = 720;
26
+ var treeOverlay = "".concat(maxHeight || 254, "px");
27
+ var listOverlay = "".concat(maxHeight || 232, "px");
28
+ // let largeScreenH = 880;
29
+ var largeTreeOverlayH = "".concat(maxHeight || 338, "px");
30
+ var largeListOverlayH = "".concat(maxHeight || 304, "px");
31
+ var clientH = document.documentElement.clientHeight;
32
+ var fixHeight = height !== undefined ? "height" : "maxHeight";
33
+ if (mode === "tree") {
34
+ //tree
35
+ if (clientH <= screenH) {
36
+ //小屏幕
37
+ return isRemoteLoad ? {
38
+ height: treeOverlay
39
+ } : _defineProperty({}, fixHeight, treeOverlay);
40
+ }
41
+ //大屏幕
42
+ return isRemoteLoad ? {
43
+ height: largeTreeOverlayH
44
+ } : _defineProperty({}, fixHeight, largeTreeOverlayH);
45
+ } else if (mode === "list") {
46
+ //list
47
+ if (clientH <= screenH) {
48
+ return isRemoteLoad ? {
49
+ height: listOverlay
50
+ } : _defineProperty({}, fixHeight, listOverlay);
51
+ }
52
+ return isRemoteLoad ? {
53
+ height: largeListOverlayH
54
+ } : _defineProperty({}, fixHeight, largeListOverlayH);
55
+ } else {
56
+ //table
57
+ return {
58
+ height: "".concat((_a = maxHeight !== null && maxHeight !== void 0 ? maxHeight : height) !== null && _a !== void 0 ? _a : 360, "px")
59
+ };
60
+ }
61
+ };
62
+ // 实现一个防抖函数,debounce接受一个函数func和delay时间作为参数,返回一个防抖函数。使用泛型T保证返回防抖函数的类型与原func一致
63
+ function debounce(func, delay) {
64
+ var timer;
65
+ return function () {
66
+ var _this = this;
67
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
68
+ args[_key] = arguments[_key];
69
+ }
70
+ if (timer) clearTimeout(timer);
71
+ timer = setTimeout(function () {
72
+ func.apply(_this, args);
73
+ }, delay);
74
+ };
75
+ }
76
+
77
+ export { getOverlaySize as a, debounce as d, getReplaceField as g, isRemoteLoad as i, toArray as t };
package/index.js CHANGED
@@ -22,7 +22,7 @@ export { D as Dropdown } from './_verture/index-77f9e0fb.js';
22
22
  export { default as DynamicMultiBox } from './DynamicMultiBox/index.js';
23
23
  export { default as Empty } from './Empty/index.js';
24
24
  export { default as Form } from './Form/index.js';
25
- export { F as FormItem } from './_verture/index-04c6e510.js';
25
+ export { F as FormItem } from './_verture/index-c23dc3b0.js';
26
26
  export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-20780c9a.js';
27
27
  export { default as GlobalContext, changeConfirmLocale, getConfirmLocale } from './GlobalContext/index.js';
28
28
  export { default as Help } from './Help/index.js';
@@ -105,6 +105,7 @@ import '@para-ui/icons/DoubleRight';
105
105
  import '@para-ui/icons/Search';
106
106
  import '@para-ui/icons/Close';
107
107
  import '@para-ui/icons/CloseCircle';
108
+ import './_verture/utils-c9b9a157.js';
108
109
  import './_verture/useGlobalProps-1b846a65.js';
109
110
  import 'rc-picker/es/generate/dayjs';
110
111
  import 'rc-picker';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@para-ui/core",
3
3
  "private": false,
4
- "version": "3.0.83",
4
+ "version": "3.0.85",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
7
7
  "description": "Powered by Para FED",