@bit-sun/business-component 1.1.21 → 1.1.24

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/src/components/Business/CommodityEntry/index.md +69 -0
  3. package/src/components/Business/CommodityEntry/index.tsx +75 -0
  4. package/src/components/Business/SearchSelect/BusinessUtils.ts +888 -0
  5. package/src/components/Business/SearchSelect/common.ts +34 -0
  6. package/src/components/Business/SearchSelect/index.md +906 -0
  7. package/src/components/{SearchSelect/business/BusinessSearchSelect.tsx → Business/SearchSelect/index.tsx} +3 -2
  8. package/src/components/Business/SearchSelect/utils.ts +71 -0
  9. package/src/components/{DataValidation → Functional/DataValidation}/index.less +0 -0
  10. package/src/components/{DataValidation → Functional/DataValidation}/index.md +3 -3
  11. package/src/components/{DataValidation → Functional/DataValidation}/index.tsx +1 -1
  12. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.less +0 -0
  13. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.md +3 -3
  14. package/src/components/{QueryMutipleInput → Functional/QueryMutipleInput}/index.tsx +0 -0
  15. package/src/components/{SearchSelect → Functional/SearchSelect}/index.less +0 -0
  16. package/src/components/{SearchSelect → Functional/SearchSelect}/index.md +14 -11
  17. package/src/components/{SearchSelect → Functional/SearchSelect}/index.tsx +226 -106
  18. package/src/index.ts +5 -4
  19. package/dist/components/DataValidation/index.d.ts +0 -144
  20. package/dist/components/QueryMutipleInput/index.d.ts +0 -5
  21. package/dist/components/SearchSelect/business/BusinessSearchSelect.d.ts +0 -2
  22. package/dist/components/SearchSelect/business/BusinessUtils.d.ts +0 -22
  23. package/dist/components/SearchSelect/index.d.ts +0 -3
  24. package/dist/index.d.ts +0 -5
  25. package/dist/index.esm.js +0 -3723
  26. package/dist/index.js +0 -3738
  27. package/dist/utils/CheckOneUser/index.d.ts +0 -2
  28. package/src/components/SearchSelect/business/BusinessUtils.ts +0 -464
  29. package/src/components/SearchSelect/business/index.md +0 -181
package/dist/index.esm.js DELETED
@@ -1,3723 +0,0 @@
1
- import axios from 'axios';
2
- import React, { createContext, useContext, useEffect, forwardRef, createElement, useState } from 'react';
3
- import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal, Select, Form, Divider, Spin, Table, TreeSelect } from 'antd';
4
- import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
5
- import classNames from 'classnames';
6
- import _ from 'loadsh';
7
- import { useDebounceFn } from 'ahooks';
8
- import { stringify } from 'querystring';
9
-
10
- function ownKeys(object, enumerableOnly) {
11
- var keys = Object.keys(object);
12
-
13
- if (Object.getOwnPropertySymbols) {
14
- var symbols = Object.getOwnPropertySymbols(object);
15
- enumerableOnly && (symbols = symbols.filter(function (sym) {
16
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
17
- })), keys.push.apply(keys, symbols);
18
- }
19
-
20
- return keys;
21
- }
22
-
23
- function _objectSpread2(target) {
24
- for (var i = 1; i < arguments.length; i++) {
25
- var source = null != arguments[i] ? arguments[i] : {};
26
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
27
- _defineProperty(target, key, source[key]);
28
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
29
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
30
- });
31
- }
32
-
33
- return target;
34
- }
35
-
36
- function _classCallCheck(instance, Constructor) {
37
- if (!(instance instanceof Constructor)) {
38
- throw new TypeError("Cannot call a class as a function");
39
- }
40
- }
41
-
42
- function _defineProperties(target, props) {
43
- for (var i = 0; i < props.length; i++) {
44
- var descriptor = props[i];
45
- descriptor.enumerable = descriptor.enumerable || false;
46
- descriptor.configurable = true;
47
- if ("value" in descriptor) descriptor.writable = true;
48
- Object.defineProperty(target, descriptor.key, descriptor);
49
- }
50
- }
51
-
52
- function _createClass(Constructor, protoProps, staticProps) {
53
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54
- if (staticProps) _defineProperties(Constructor, staticProps);
55
- Object.defineProperty(Constructor, "prototype", {
56
- writable: false
57
- });
58
- return Constructor;
59
- }
60
-
61
- function _defineProperty(obj, key, value) {
62
- if (key in obj) {
63
- Object.defineProperty(obj, key, {
64
- value: value,
65
- enumerable: true,
66
- configurable: true,
67
- writable: true
68
- });
69
- } else {
70
- obj[key] = value;
71
- }
72
-
73
- return obj;
74
- }
75
-
76
- function _inherits(subClass, superClass) {
77
- if (typeof superClass !== "function" && superClass !== null) {
78
- throw new TypeError("Super expression must either be null or a function");
79
- }
80
-
81
- subClass.prototype = Object.create(superClass && superClass.prototype, {
82
- constructor: {
83
- value: subClass,
84
- writable: true,
85
- configurable: true
86
- }
87
- });
88
- Object.defineProperty(subClass, "prototype", {
89
- writable: false
90
- });
91
- if (superClass) _setPrototypeOf(subClass, superClass);
92
- }
93
-
94
- function _getPrototypeOf(o) {
95
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
96
- return o.__proto__ || Object.getPrototypeOf(o);
97
- };
98
- return _getPrototypeOf(o);
99
- }
100
-
101
- function _setPrototypeOf(o, p) {
102
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
103
- o.__proto__ = p;
104
- return o;
105
- };
106
-
107
- return _setPrototypeOf(o, p);
108
- }
109
-
110
- function _isNativeReflectConstruct() {
111
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
112
- if (Reflect.construct.sham) return false;
113
- if (typeof Proxy === "function") return true;
114
-
115
- try {
116
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
117
- return true;
118
- } catch (e) {
119
- return false;
120
- }
121
- }
122
-
123
- function _objectWithoutPropertiesLoose(source, excluded) {
124
- if (source == null) return {};
125
- var target = {};
126
- var sourceKeys = Object.keys(source);
127
- var key, i;
128
-
129
- for (i = 0; i < sourceKeys.length; i++) {
130
- key = sourceKeys[i];
131
- if (excluded.indexOf(key) >= 0) continue;
132
- target[key] = source[key];
133
- }
134
-
135
- return target;
136
- }
137
-
138
- function _objectWithoutProperties(source, excluded) {
139
- if (source == null) return {};
140
-
141
- var target = _objectWithoutPropertiesLoose(source, excluded);
142
-
143
- var key, i;
144
-
145
- if (Object.getOwnPropertySymbols) {
146
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
147
-
148
- for (i = 0; i < sourceSymbolKeys.length; i++) {
149
- key = sourceSymbolKeys[i];
150
- if (excluded.indexOf(key) >= 0) continue;
151
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
152
- target[key] = source[key];
153
- }
154
- }
155
-
156
- return target;
157
- }
158
-
159
- function _assertThisInitialized(self) {
160
- if (self === void 0) {
161
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
162
- }
163
-
164
- return self;
165
- }
166
-
167
- function _possibleConstructorReturn(self, call) {
168
- if (call && (typeof call === "object" || typeof call === "function")) {
169
- return call;
170
- } else if (call !== void 0) {
171
- throw new TypeError("Derived constructors may only return object or undefined");
172
- }
173
-
174
- return _assertThisInitialized(self);
175
- }
176
-
177
- function _createSuper(Derived) {
178
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
179
-
180
- return function _createSuperInternal() {
181
- var Super = _getPrototypeOf(Derived),
182
- result;
183
-
184
- if (hasNativeReflectConstruct) {
185
- var NewTarget = _getPrototypeOf(this).constructor;
186
-
187
- result = Reflect.construct(Super, arguments, NewTarget);
188
- } else {
189
- result = Super.apply(this, arguments);
190
- }
191
-
192
- return _possibleConstructorReturn(this, result);
193
- };
194
- }
195
-
196
- function _slicedToArray(arr, i) {
197
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
198
- }
199
-
200
- function _toArray(arr) {
201
- return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
202
- }
203
-
204
- function _toConsumableArray(arr) {
205
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
206
- }
207
-
208
- function _arrayWithoutHoles(arr) {
209
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
210
- }
211
-
212
- function _arrayWithHoles(arr) {
213
- if (Array.isArray(arr)) return arr;
214
- }
215
-
216
- function _iterableToArray(iter) {
217
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
218
- }
219
-
220
- function _iterableToArrayLimit(arr, i) {
221
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
222
-
223
- if (_i == null) return;
224
- var _arr = [];
225
- var _n = true;
226
- var _d = false;
227
-
228
- var _s, _e;
229
-
230
- try {
231
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
232
- _arr.push(_s.value);
233
-
234
- if (i && _arr.length === i) break;
235
- }
236
- } catch (err) {
237
- _d = true;
238
- _e = err;
239
- } finally {
240
- try {
241
- if (!_n && _i["return"] != null) _i["return"]();
242
- } finally {
243
- if (_d) throw _e;
244
- }
245
- }
246
-
247
- return _arr;
248
- }
249
-
250
- function _unsupportedIterableToArray(o, minLen) {
251
- if (!o) return;
252
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
253
- var n = Object.prototype.toString.call(o).slice(8, -1);
254
- if (n === "Object" && o.constructor) n = o.constructor.name;
255
- if (n === "Map" || n === "Set") return Array.from(o);
256
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
257
- }
258
-
259
- function _arrayLikeToArray(arr, len) {
260
- if (len == null || len > arr.length) len = arr.length;
261
-
262
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
263
-
264
- return arr2;
265
- }
266
-
267
- function _nonIterableSpread() {
268
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
269
- }
270
-
271
- function _nonIterableRest() {
272
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
273
- }
274
-
275
- var IconContext = /*#__PURE__*/createContext({});
276
-
277
- function _defineProperty$1(obj, key, value) {
278
- if (key in obj) {
279
- Object.defineProperty(obj, key, {
280
- value: value,
281
- enumerable: true,
282
- configurable: true,
283
- writable: true
284
- });
285
- } else {
286
- obj[key] = value;
287
- }
288
-
289
- return obj;
290
- }
291
-
292
- function ownKeys$1(object, enumerableOnly) {
293
- var keys = Object.keys(object);
294
-
295
- if (Object.getOwnPropertySymbols) {
296
- var symbols = Object.getOwnPropertySymbols(object);
297
- enumerableOnly && (symbols = symbols.filter(function (sym) {
298
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
299
- })), keys.push.apply(keys, symbols);
300
- }
301
-
302
- return keys;
303
- }
304
-
305
- function _objectSpread2$1(target) {
306
- for (var i = 1; i < arguments.length; i++) {
307
- var source = null != arguments[i] ? arguments[i] : {};
308
- i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
309
- _defineProperty$1(target, key, source[key]);
310
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
311
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
312
- });
313
- }
314
-
315
- return target;
316
- }
317
-
318
- function _arrayWithHoles$1(arr) {
319
- if (Array.isArray(arr)) return arr;
320
- }
321
-
322
- function _iterableToArrayLimit$1(arr, i) {
323
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
324
-
325
- if (_i == null) return;
326
- var _arr = [];
327
- var _n = true;
328
- var _d = false;
329
-
330
- var _s, _e;
331
-
332
- try {
333
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
334
- _arr.push(_s.value);
335
-
336
- if (i && _arr.length === i) break;
337
- }
338
- } catch (err) {
339
- _d = true;
340
- _e = err;
341
- } finally {
342
- try {
343
- if (!_n && _i["return"] != null) _i["return"]();
344
- } finally {
345
- if (_d) throw _e;
346
- }
347
- }
348
-
349
- return _arr;
350
- }
351
-
352
- function _arrayLikeToArray$1(arr, len) {
353
- if (len == null || len > arr.length) len = arr.length;
354
-
355
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
356
- arr2[i] = arr[i];
357
- }
358
-
359
- return arr2;
360
- }
361
-
362
- function _unsupportedIterableToArray$1(o, minLen) {
363
- if (!o) return;
364
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
365
- var n = Object.prototype.toString.call(o).slice(8, -1);
366
- if (n === "Object" && o.constructor) n = o.constructor.name;
367
- if (n === "Map" || n === "Set") return Array.from(o);
368
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
369
- }
370
-
371
- function _nonIterableRest$1() {
372
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
373
- }
374
-
375
- function _slicedToArray$1(arr, i) {
376
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
377
- }
378
-
379
- function _objectWithoutPropertiesLoose$1(source, excluded) {
380
- if (source == null) return {};
381
- var target = {};
382
- var sourceKeys = Object.keys(source);
383
- var key, i;
384
-
385
- for (i = 0; i < sourceKeys.length; i++) {
386
- key = sourceKeys[i];
387
- if (excluded.indexOf(key) >= 0) continue;
388
- target[key] = source[key];
389
- }
390
-
391
- return target;
392
- }
393
-
394
- function _objectWithoutProperties$1(source, excluded) {
395
- if (source == null) return {};
396
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
397
- var key, i;
398
-
399
- if (Object.getOwnPropertySymbols) {
400
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
401
-
402
- for (i = 0; i < sourceSymbolKeys.length; i++) {
403
- key = sourceSymbolKeys[i];
404
- if (excluded.indexOf(key) >= 0) continue;
405
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
406
- target[key] = source[key];
407
- }
408
- }
409
-
410
- return target;
411
- }
412
-
413
- function _typeof(obj) {
414
- "@babel/helpers - typeof";
415
-
416
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
417
- return typeof obj;
418
- } : function (obj) {
419
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
420
- }, _typeof(obj);
421
- }
422
-
423
- /**
424
- * Take input from [0, n] and return it as [0, 1]
425
- * @hidden
426
- */
427
- function bound01(n, max) {
428
- if (isOnePointZero(n)) {
429
- n = '100%';
430
- }
431
- var isPercent = isPercentage(n);
432
- n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
433
- // Automatically convert percentage into number
434
- if (isPercent) {
435
- n = parseInt(String(n * max), 10) / 100;
436
- }
437
- // Handle floating point rounding errors
438
- if (Math.abs(n - max) < 0.000001) {
439
- return 1;
440
- }
441
- // Convert into [0, 1] range if it isn't already
442
- if (max === 360) {
443
- // If n is a hue given in degrees,
444
- // wrap around out-of-range values into [0, 360] range
445
- // then convert into [0, 1].
446
- n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
447
- }
448
- else {
449
- // If n not a hue given in degrees
450
- // Convert into [0, 1] range if it isn't already.
451
- n = (n % max) / parseFloat(String(max));
452
- }
453
- return n;
454
- }
455
- /**
456
- * Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
457
- * <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
458
- * @hidden
459
- */
460
- function isOnePointZero(n) {
461
- return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
462
- }
463
- /**
464
- * Check to see if string passed in is a percentage
465
- * @hidden
466
- */
467
- function isPercentage(n) {
468
- return typeof n === 'string' && n.indexOf('%') !== -1;
469
- }
470
- /**
471
- * Return a valid alpha value [0,1] with all invalid values being set to 1
472
- * @hidden
473
- */
474
- function boundAlpha(a) {
475
- a = parseFloat(a);
476
- if (isNaN(a) || a < 0 || a > 1) {
477
- a = 1;
478
- }
479
- return a;
480
- }
481
- /**
482
- * Replace a decimal with it's percentage value
483
- * @hidden
484
- */
485
- function convertToPercentage(n) {
486
- if (n <= 1) {
487
- return Number(n) * 100 + "%";
488
- }
489
- return n;
490
- }
491
- /**
492
- * Force a hex value to have 2 characters
493
- * @hidden
494
- */
495
- function pad2(c) {
496
- return c.length === 1 ? '0' + c : String(c);
497
- }
498
-
499
- // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
500
- // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
501
- /**
502
- * Handle bounds / percentage checking to conform to CSS color spec
503
- * <http://www.w3.org/TR/css3-color/>
504
- * *Assumes:* r, g, b in [0, 255] or [0, 1]
505
- * *Returns:* { r, g, b } in [0, 255]
506
- */
507
- function rgbToRgb(r, g, b) {
508
- return {
509
- r: bound01(r, 255) * 255,
510
- g: bound01(g, 255) * 255,
511
- b: bound01(b, 255) * 255,
512
- };
513
- }
514
- function hue2rgb(p, q, t) {
515
- if (t < 0) {
516
- t += 1;
517
- }
518
- if (t > 1) {
519
- t -= 1;
520
- }
521
- if (t < 1 / 6) {
522
- return p + (q - p) * (6 * t);
523
- }
524
- if (t < 1 / 2) {
525
- return q;
526
- }
527
- if (t < 2 / 3) {
528
- return p + (q - p) * (2 / 3 - t) * 6;
529
- }
530
- return p;
531
- }
532
- /**
533
- * Converts an HSL color value to RGB.
534
- *
535
- * *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
536
- * *Returns:* { r, g, b } in the set [0, 255]
537
- */
538
- function hslToRgb(h, s, l) {
539
- var r;
540
- var g;
541
- var b;
542
- h = bound01(h, 360);
543
- s = bound01(s, 100);
544
- l = bound01(l, 100);
545
- if (s === 0) {
546
- // achromatic
547
- g = l;
548
- b = l;
549
- r = l;
550
- }
551
- else {
552
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
553
- var p = 2 * l - q;
554
- r = hue2rgb(p, q, h + 1 / 3);
555
- g = hue2rgb(p, q, h);
556
- b = hue2rgb(p, q, h - 1 / 3);
557
- }
558
- return { r: r * 255, g: g * 255, b: b * 255 };
559
- }
560
- /**
561
- * Converts an RGB color value to HSV
562
- *
563
- * *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
564
- * *Returns:* { h, s, v } in [0,1]
565
- */
566
- function rgbToHsv(r, g, b) {
567
- r = bound01(r, 255);
568
- g = bound01(g, 255);
569
- b = bound01(b, 255);
570
- var max = Math.max(r, g, b);
571
- var min = Math.min(r, g, b);
572
- var h = 0;
573
- var v = max;
574
- var d = max - min;
575
- var s = max === 0 ? 0 : d / max;
576
- if (max === min) {
577
- h = 0; // achromatic
578
- }
579
- else {
580
- switch (max) {
581
- case r:
582
- h = (g - b) / d + (g < b ? 6 : 0);
583
- break;
584
- case g:
585
- h = (b - r) / d + 2;
586
- break;
587
- case b:
588
- h = (r - g) / d + 4;
589
- break;
590
- }
591
- h /= 6;
592
- }
593
- return { h: h, s: s, v: v };
594
- }
595
- /**
596
- * Converts an HSV color value to RGB.
597
- *
598
- * *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
599
- * *Returns:* { r, g, b } in the set [0, 255]
600
- */
601
- function hsvToRgb(h, s, v) {
602
- h = bound01(h, 360) * 6;
603
- s = bound01(s, 100);
604
- v = bound01(v, 100);
605
- var i = Math.floor(h);
606
- var f = h - i;
607
- var p = v * (1 - s);
608
- var q = v * (1 - f * s);
609
- var t = v * (1 - (1 - f) * s);
610
- var mod = i % 6;
611
- var r = [v, q, p, p, t, v][mod];
612
- var g = [t, v, v, q, p, p][mod];
613
- var b = [p, p, t, v, v, q][mod];
614
- return { r: r * 255, g: g * 255, b: b * 255 };
615
- }
616
- /**
617
- * Converts an RGB color to hex
618
- *
619
- * Assumes r, g, and b are contained in the set [0, 255]
620
- * Returns a 3 or 6 character hex
621
- */
622
- function rgbToHex(r, g, b, allow3Char) {
623
- var hex = [
624
- pad2(Math.round(r).toString(16)),
625
- pad2(Math.round(g).toString(16)),
626
- pad2(Math.round(b).toString(16)),
627
- ];
628
- // Return a 3 character hex if possible
629
- if (allow3Char &&
630
- hex[0].startsWith(hex[0].charAt(1)) &&
631
- hex[1].startsWith(hex[1].charAt(1)) &&
632
- hex[2].startsWith(hex[2].charAt(1))) {
633
- return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
634
- }
635
- return hex.join('');
636
- }
637
- /** Converts a hex value to a decimal */
638
- function convertHexToDecimal(h) {
639
- return parseIntFromHex(h) / 255;
640
- }
641
- /** Parse a base-16 hex value into a base-10 integer */
642
- function parseIntFromHex(val) {
643
- return parseInt(val, 16);
644
- }
645
-
646
- // https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
647
- /**
648
- * @hidden
649
- */
650
- var names = {
651
- aliceblue: '#f0f8ff',
652
- antiquewhite: '#faebd7',
653
- aqua: '#00ffff',
654
- aquamarine: '#7fffd4',
655
- azure: '#f0ffff',
656
- beige: '#f5f5dc',
657
- bisque: '#ffe4c4',
658
- black: '#000000',
659
- blanchedalmond: '#ffebcd',
660
- blue: '#0000ff',
661
- blueviolet: '#8a2be2',
662
- brown: '#a52a2a',
663
- burlywood: '#deb887',
664
- cadetblue: '#5f9ea0',
665
- chartreuse: '#7fff00',
666
- chocolate: '#d2691e',
667
- coral: '#ff7f50',
668
- cornflowerblue: '#6495ed',
669
- cornsilk: '#fff8dc',
670
- crimson: '#dc143c',
671
- cyan: '#00ffff',
672
- darkblue: '#00008b',
673
- darkcyan: '#008b8b',
674
- darkgoldenrod: '#b8860b',
675
- darkgray: '#a9a9a9',
676
- darkgreen: '#006400',
677
- darkgrey: '#a9a9a9',
678
- darkkhaki: '#bdb76b',
679
- darkmagenta: '#8b008b',
680
- darkolivegreen: '#556b2f',
681
- darkorange: '#ff8c00',
682
- darkorchid: '#9932cc',
683
- darkred: '#8b0000',
684
- darksalmon: '#e9967a',
685
- darkseagreen: '#8fbc8f',
686
- darkslateblue: '#483d8b',
687
- darkslategray: '#2f4f4f',
688
- darkslategrey: '#2f4f4f',
689
- darkturquoise: '#00ced1',
690
- darkviolet: '#9400d3',
691
- deeppink: '#ff1493',
692
- deepskyblue: '#00bfff',
693
- dimgray: '#696969',
694
- dimgrey: '#696969',
695
- dodgerblue: '#1e90ff',
696
- firebrick: '#b22222',
697
- floralwhite: '#fffaf0',
698
- forestgreen: '#228b22',
699
- fuchsia: '#ff00ff',
700
- gainsboro: '#dcdcdc',
701
- ghostwhite: '#f8f8ff',
702
- goldenrod: '#daa520',
703
- gold: '#ffd700',
704
- gray: '#808080',
705
- green: '#008000',
706
- greenyellow: '#adff2f',
707
- grey: '#808080',
708
- honeydew: '#f0fff0',
709
- hotpink: '#ff69b4',
710
- indianred: '#cd5c5c',
711
- indigo: '#4b0082',
712
- ivory: '#fffff0',
713
- khaki: '#f0e68c',
714
- lavenderblush: '#fff0f5',
715
- lavender: '#e6e6fa',
716
- lawngreen: '#7cfc00',
717
- lemonchiffon: '#fffacd',
718
- lightblue: '#add8e6',
719
- lightcoral: '#f08080',
720
- lightcyan: '#e0ffff',
721
- lightgoldenrodyellow: '#fafad2',
722
- lightgray: '#d3d3d3',
723
- lightgreen: '#90ee90',
724
- lightgrey: '#d3d3d3',
725
- lightpink: '#ffb6c1',
726
- lightsalmon: '#ffa07a',
727
- lightseagreen: '#20b2aa',
728
- lightskyblue: '#87cefa',
729
- lightslategray: '#778899',
730
- lightslategrey: '#778899',
731
- lightsteelblue: '#b0c4de',
732
- lightyellow: '#ffffe0',
733
- lime: '#00ff00',
734
- limegreen: '#32cd32',
735
- linen: '#faf0e6',
736
- magenta: '#ff00ff',
737
- maroon: '#800000',
738
- mediumaquamarine: '#66cdaa',
739
- mediumblue: '#0000cd',
740
- mediumorchid: '#ba55d3',
741
- mediumpurple: '#9370db',
742
- mediumseagreen: '#3cb371',
743
- mediumslateblue: '#7b68ee',
744
- mediumspringgreen: '#00fa9a',
745
- mediumturquoise: '#48d1cc',
746
- mediumvioletred: '#c71585',
747
- midnightblue: '#191970',
748
- mintcream: '#f5fffa',
749
- mistyrose: '#ffe4e1',
750
- moccasin: '#ffe4b5',
751
- navajowhite: '#ffdead',
752
- navy: '#000080',
753
- oldlace: '#fdf5e6',
754
- olive: '#808000',
755
- olivedrab: '#6b8e23',
756
- orange: '#ffa500',
757
- orangered: '#ff4500',
758
- orchid: '#da70d6',
759
- palegoldenrod: '#eee8aa',
760
- palegreen: '#98fb98',
761
- paleturquoise: '#afeeee',
762
- palevioletred: '#db7093',
763
- papayawhip: '#ffefd5',
764
- peachpuff: '#ffdab9',
765
- peru: '#cd853f',
766
- pink: '#ffc0cb',
767
- plum: '#dda0dd',
768
- powderblue: '#b0e0e6',
769
- purple: '#800080',
770
- rebeccapurple: '#663399',
771
- red: '#ff0000',
772
- rosybrown: '#bc8f8f',
773
- royalblue: '#4169e1',
774
- saddlebrown: '#8b4513',
775
- salmon: '#fa8072',
776
- sandybrown: '#f4a460',
777
- seagreen: '#2e8b57',
778
- seashell: '#fff5ee',
779
- sienna: '#a0522d',
780
- silver: '#c0c0c0',
781
- skyblue: '#87ceeb',
782
- slateblue: '#6a5acd',
783
- slategray: '#708090',
784
- slategrey: '#708090',
785
- snow: '#fffafa',
786
- springgreen: '#00ff7f',
787
- steelblue: '#4682b4',
788
- tan: '#d2b48c',
789
- teal: '#008080',
790
- thistle: '#d8bfd8',
791
- tomato: '#ff6347',
792
- turquoise: '#40e0d0',
793
- violet: '#ee82ee',
794
- wheat: '#f5deb3',
795
- white: '#ffffff',
796
- whitesmoke: '#f5f5f5',
797
- yellow: '#ffff00',
798
- yellowgreen: '#9acd32',
799
- };
800
-
801
- /**
802
- * Given a string or object, convert that input to RGB
803
- *
804
- * Possible string inputs:
805
- * ```
806
- * "red"
807
- * "#f00" or "f00"
808
- * "#ff0000" or "ff0000"
809
- * "#ff000000" or "ff000000"
810
- * "rgb 255 0 0" or "rgb (255, 0, 0)"
811
- * "rgb 1.0 0 0" or "rgb (1, 0, 0)"
812
- * "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
813
- * "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
814
- * "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
815
- * "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
816
- * "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
817
- * ```
818
- */
819
- function inputToRGB(color) {
820
- var rgb = { r: 0, g: 0, b: 0 };
821
- var a = 1;
822
- var s = null;
823
- var v = null;
824
- var l = null;
825
- var ok = false;
826
- var format = false;
827
- if (typeof color === 'string') {
828
- color = stringInputToObject(color);
829
- }
830
- if (typeof color === 'object') {
831
- if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
832
- rgb = rgbToRgb(color.r, color.g, color.b);
833
- ok = true;
834
- format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
835
- }
836
- else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
837
- s = convertToPercentage(color.s);
838
- v = convertToPercentage(color.v);
839
- rgb = hsvToRgb(color.h, s, v);
840
- ok = true;
841
- format = 'hsv';
842
- }
843
- else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
844
- s = convertToPercentage(color.s);
845
- l = convertToPercentage(color.l);
846
- rgb = hslToRgb(color.h, s, l);
847
- ok = true;
848
- format = 'hsl';
849
- }
850
- if (Object.prototype.hasOwnProperty.call(color, 'a')) {
851
- a = color.a;
852
- }
853
- }
854
- a = boundAlpha(a);
855
- return {
856
- ok: ok,
857
- format: color.format || format,
858
- r: Math.min(255, Math.max(rgb.r, 0)),
859
- g: Math.min(255, Math.max(rgb.g, 0)),
860
- b: Math.min(255, Math.max(rgb.b, 0)),
861
- a: a,
862
- };
863
- }
864
- // <http://www.w3.org/TR/css3-values/#integers>
865
- var CSS_INTEGER = '[-\\+]?\\d+%?';
866
- // <http://www.w3.org/TR/css3-values/#number-value>
867
- var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
868
- // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
869
- var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
870
- // Actual matching.
871
- // Parentheses and commas are optional, but not required.
872
- // Whitespace can take the place of commas or opening paren
873
- var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
874
- var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
875
- var matchers = {
876
- CSS_UNIT: new RegExp(CSS_UNIT),
877
- rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
878
- rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
879
- hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
880
- hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
881
- hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
882
- hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
883
- hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
884
- hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
885
- hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
886
- hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
887
- };
888
- /**
889
- * Permissive string parsing. Take in a number of formats, and output an object
890
- * based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
891
- */
892
- function stringInputToObject(color) {
893
- color = color.trim().toLowerCase();
894
- if (color.length === 0) {
895
- return false;
896
- }
897
- var named = false;
898
- if (names[color]) {
899
- color = names[color];
900
- named = true;
901
- }
902
- else if (color === 'transparent') {
903
- return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
904
- }
905
- // Try to match string input using regular expressions.
906
- // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
907
- // Just return an object and let the conversion functions handle that.
908
- // This way the result will be the same whether the tinycolor is initialized with string or object.
909
- var match = matchers.rgb.exec(color);
910
- if (match) {
911
- return { r: match[1], g: match[2], b: match[3] };
912
- }
913
- match = matchers.rgba.exec(color);
914
- if (match) {
915
- return { r: match[1], g: match[2], b: match[3], a: match[4] };
916
- }
917
- match = matchers.hsl.exec(color);
918
- if (match) {
919
- return { h: match[1], s: match[2], l: match[3] };
920
- }
921
- match = matchers.hsla.exec(color);
922
- if (match) {
923
- return { h: match[1], s: match[2], l: match[3], a: match[4] };
924
- }
925
- match = matchers.hsv.exec(color);
926
- if (match) {
927
- return { h: match[1], s: match[2], v: match[3] };
928
- }
929
- match = matchers.hsva.exec(color);
930
- if (match) {
931
- return { h: match[1], s: match[2], v: match[3], a: match[4] };
932
- }
933
- match = matchers.hex8.exec(color);
934
- if (match) {
935
- return {
936
- r: parseIntFromHex(match[1]),
937
- g: parseIntFromHex(match[2]),
938
- b: parseIntFromHex(match[3]),
939
- a: convertHexToDecimal(match[4]),
940
- format: named ? 'name' : 'hex8',
941
- };
942
- }
943
- match = matchers.hex6.exec(color);
944
- if (match) {
945
- return {
946
- r: parseIntFromHex(match[1]),
947
- g: parseIntFromHex(match[2]),
948
- b: parseIntFromHex(match[3]),
949
- format: named ? 'name' : 'hex',
950
- };
951
- }
952
- match = matchers.hex4.exec(color);
953
- if (match) {
954
- return {
955
- r: parseIntFromHex(match[1] + match[1]),
956
- g: parseIntFromHex(match[2] + match[2]),
957
- b: parseIntFromHex(match[3] + match[3]),
958
- a: convertHexToDecimal(match[4] + match[4]),
959
- format: named ? 'name' : 'hex8',
960
- };
961
- }
962
- match = matchers.hex3.exec(color);
963
- if (match) {
964
- return {
965
- r: parseIntFromHex(match[1] + match[1]),
966
- g: parseIntFromHex(match[2] + match[2]),
967
- b: parseIntFromHex(match[3] + match[3]),
968
- format: named ? 'name' : 'hex',
969
- };
970
- }
971
- return false;
972
- }
973
- /**
974
- * Check to see if it looks like a CSS unit
975
- * (see `matchers` above for definition).
976
- */
977
- function isValidCSSUnit(color) {
978
- return Boolean(matchers.CSS_UNIT.exec(String(color)));
979
- }
980
-
981
- var hueStep = 2; // 色相阶梯
982
-
983
- var saturationStep = 0.16; // 饱和度阶梯,浅色部分
984
-
985
- var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
986
-
987
- var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
988
-
989
- var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
990
-
991
- var lightColorCount = 5; // 浅色数量,主色上
992
-
993
- var darkColorCount = 4; // 深色数量,主色下
994
- // 暗色主题颜色映射关系表
995
-
996
- var darkColorMap = [{
997
- index: 7,
998
- opacity: 0.15
999
- }, {
1000
- index: 6,
1001
- opacity: 0.25
1002
- }, {
1003
- index: 5,
1004
- opacity: 0.3
1005
- }, {
1006
- index: 5,
1007
- opacity: 0.45
1008
- }, {
1009
- index: 5,
1010
- opacity: 0.65
1011
- }, {
1012
- index: 5,
1013
- opacity: 0.85
1014
- }, {
1015
- index: 4,
1016
- opacity: 0.9
1017
- }, {
1018
- index: 3,
1019
- opacity: 0.95
1020
- }, {
1021
- index: 2,
1022
- opacity: 0.97
1023
- }, {
1024
- index: 1,
1025
- opacity: 0.98
1026
- }]; // Wrapper function ported from TinyColor.prototype.toHsv
1027
- // Keep it here because of `hsv.h * 360`
1028
-
1029
- function toHsv(_ref) {
1030
- var r = _ref.r,
1031
- g = _ref.g,
1032
- b = _ref.b;
1033
- var hsv = rgbToHsv(r, g, b);
1034
- return {
1035
- h: hsv.h * 360,
1036
- s: hsv.s,
1037
- v: hsv.v
1038
- };
1039
- } // Wrapper function ported from TinyColor.prototype.toHexString
1040
- // Keep it here because of the prefix `#`
1041
-
1042
-
1043
- function toHex(_ref2) {
1044
- var r = _ref2.r,
1045
- g = _ref2.g,
1046
- b = _ref2.b;
1047
- return "#".concat(rgbToHex(r, g, b, false));
1048
- } // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
1049
- // Amount in range [0, 1]
1050
- // Assume color1 & color2 has no alpha, since the following src code did so.
1051
-
1052
-
1053
- function mix(rgb1, rgb2, amount) {
1054
- var p = amount / 100;
1055
- var rgb = {
1056
- r: (rgb2.r - rgb1.r) * p + rgb1.r,
1057
- g: (rgb2.g - rgb1.g) * p + rgb1.g,
1058
- b: (rgb2.b - rgb1.b) * p + rgb1.b
1059
- };
1060
- return rgb;
1061
- }
1062
-
1063
- function getHue(hsv, i, light) {
1064
- var hue; // 根据色相不同,色相转向不同
1065
-
1066
- if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
1067
- hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
1068
- } else {
1069
- hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
1070
- }
1071
-
1072
- if (hue < 0) {
1073
- hue += 360;
1074
- } else if (hue >= 360) {
1075
- hue -= 360;
1076
- }
1077
-
1078
- return hue;
1079
- }
1080
-
1081
- function getSaturation(hsv, i, light) {
1082
- // grey color don't change saturation
1083
- if (hsv.h === 0 && hsv.s === 0) {
1084
- return hsv.s;
1085
- }
1086
-
1087
- var saturation;
1088
-
1089
- if (light) {
1090
- saturation = hsv.s - saturationStep * i;
1091
- } else if (i === darkColorCount) {
1092
- saturation = hsv.s + saturationStep;
1093
- } else {
1094
- saturation = hsv.s + saturationStep2 * i;
1095
- } // 边界值修正
1096
-
1097
-
1098
- if (saturation > 1) {
1099
- saturation = 1;
1100
- } // 第一格的 s 限制在 0.06-0.1 之间
1101
-
1102
-
1103
- if (light && i === lightColorCount && saturation > 0.1) {
1104
- saturation = 0.1;
1105
- }
1106
-
1107
- if (saturation < 0.06) {
1108
- saturation = 0.06;
1109
- }
1110
-
1111
- return Number(saturation.toFixed(2));
1112
- }
1113
-
1114
- function getValue(hsv, i, light) {
1115
- var value;
1116
-
1117
- if (light) {
1118
- value = hsv.v + brightnessStep1 * i;
1119
- } else {
1120
- value = hsv.v - brightnessStep2 * i;
1121
- }
1122
-
1123
- if (value > 1) {
1124
- value = 1;
1125
- }
1126
-
1127
- return Number(value.toFixed(2));
1128
- }
1129
-
1130
- function generate(color) {
1131
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1132
- var patterns = [];
1133
- var pColor = inputToRGB(color);
1134
-
1135
- for (var i = lightColorCount; i > 0; i -= 1) {
1136
- var hsv = toHsv(pColor);
1137
- var colorString = toHex(inputToRGB({
1138
- h: getHue(hsv, i, true),
1139
- s: getSaturation(hsv, i, true),
1140
- v: getValue(hsv, i, true)
1141
- }));
1142
- patterns.push(colorString);
1143
- }
1144
-
1145
- patterns.push(toHex(pColor));
1146
-
1147
- for (var _i = 1; _i <= darkColorCount; _i += 1) {
1148
- var _hsv = toHsv(pColor);
1149
-
1150
- var _colorString = toHex(inputToRGB({
1151
- h: getHue(_hsv, _i),
1152
- s: getSaturation(_hsv, _i),
1153
- v: getValue(_hsv, _i)
1154
- }));
1155
-
1156
- patterns.push(_colorString);
1157
- } // dark theme patterns
1158
-
1159
-
1160
- if (opts.theme === 'dark') {
1161
- return darkColorMap.map(function (_ref3) {
1162
- var index = _ref3.index,
1163
- opacity = _ref3.opacity;
1164
- var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
1165
- return darkColorString;
1166
- });
1167
- }
1168
-
1169
- return patterns;
1170
- }
1171
-
1172
- var presetPrimaryColors = {
1173
- red: '#F5222D',
1174
- volcano: '#FA541C',
1175
- orange: '#FA8C16',
1176
- gold: '#FAAD14',
1177
- yellow: '#FADB14',
1178
- lime: '#A0D911',
1179
- green: '#52C41A',
1180
- cyan: '#13C2C2',
1181
- blue: '#1890FF',
1182
- geekblue: '#2F54EB',
1183
- purple: '#722ED1',
1184
- magenta: '#EB2F96',
1185
- grey: '#666666'
1186
- };
1187
- var presetPalettes = {};
1188
- var presetDarkPalettes = {};
1189
- Object.keys(presetPrimaryColors).forEach(function (key) {
1190
- presetPalettes[key] = generate(presetPrimaryColors[key]);
1191
- presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
1192
-
1193
- presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
1194
- theme: 'dark',
1195
- backgroundColor: '#141414'
1196
- });
1197
- presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
1198
- });
1199
-
1200
- /* eslint-disable no-console */
1201
- var warned = {};
1202
- function warning(valid, message) {
1203
- // Support uglify
1204
- if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
1205
- console.error("Warning: ".concat(message));
1206
- }
1207
- }
1208
- function call(method, valid, message) {
1209
- if (!valid && !warned[message]) {
1210
- method(false, message);
1211
- warned[message] = true;
1212
- }
1213
- }
1214
- function warningOnce(valid, message) {
1215
- call(warning, valid, message);
1216
- }
1217
- /* eslint-enable */
1218
-
1219
- function canUseDom() {
1220
- return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1221
- }
1222
-
1223
- var MARK_KEY = "rc-util-key";
1224
-
1225
- function getContainer(option) {
1226
- if (option.attachTo) {
1227
- return option.attachTo;
1228
- }
1229
-
1230
- var head = document.querySelector('head');
1231
- return head || document.body;
1232
- }
1233
-
1234
- function injectCSS(css) {
1235
- var _option$csp;
1236
-
1237
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1238
-
1239
- if (!canUseDom()) {
1240
- return null;
1241
- }
1242
-
1243
- var styleNode = document.createElement('style');
1244
-
1245
- if ((_option$csp = option.csp) === null || _option$csp === void 0 ? void 0 : _option$csp.nonce) {
1246
- var _option$csp2;
1247
-
1248
- styleNode.nonce = (_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce;
1249
- }
1250
-
1251
- styleNode.innerHTML = css;
1252
- var container = getContainer(option);
1253
- var firstChild = container.firstChild;
1254
-
1255
- if (option.prepend && container.prepend) {
1256
- // Use `prepend` first
1257
- container.prepend(styleNode);
1258
- } else if (option.prepend && firstChild) {
1259
- // Fallback to `insertBefore` like IE not support `prepend`
1260
- container.insertBefore(styleNode, firstChild);
1261
- } else {
1262
- container.appendChild(styleNode);
1263
- }
1264
-
1265
- return styleNode;
1266
- }
1267
- var containerCache = new Map();
1268
-
1269
- function findExistNode(key) {
1270
- var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1271
- var container = getContainer(option);
1272
- return Array.from(containerCache.get(container).children).find(function (node) {
1273
- return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1274
- });
1275
- }
1276
- function updateCSS(css, key) {
1277
- var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1278
- var container = getContainer(option); // Get real parent
1279
-
1280
- if (!containerCache.has(container)) {
1281
- var placeholderStyle = injectCSS('', option);
1282
- var parentNode = placeholderStyle.parentNode;
1283
- containerCache.set(container, parentNode);
1284
- parentNode.removeChild(placeholderStyle);
1285
- }
1286
-
1287
- var existNode = findExistNode(key, option);
1288
-
1289
- if (existNode) {
1290
- var _option$csp3, _option$csp4;
1291
-
1292
- if (((_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce) && existNode.nonce !== ((_option$csp4 = option.csp) === null || _option$csp4 === void 0 ? void 0 : _option$csp4.nonce)) {
1293
- var _option$csp5;
1294
-
1295
- existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
1296
- }
1297
-
1298
- if (existNode.innerHTML !== css) {
1299
- existNode.innerHTML = css;
1300
- }
1301
-
1302
- return existNode;
1303
- }
1304
-
1305
- var newNode = injectCSS(css, option);
1306
- newNode[MARK_KEY] = key;
1307
- return newNode;
1308
- }
1309
-
1310
- function warning$1(valid, message) {
1311
- warningOnce(valid, "[@ant-design/icons] ".concat(message));
1312
- }
1313
- function isIconDefinition(target) {
1314
- return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
1315
- }
1316
- function normalizeAttrs() {
1317
- var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1318
- return Object.keys(attrs).reduce(function (acc, key) {
1319
- var val = attrs[key];
1320
-
1321
- switch (key) {
1322
- case 'class':
1323
- acc.className = val;
1324
- delete acc.class;
1325
- break;
1326
-
1327
- default:
1328
- acc[key] = val;
1329
- }
1330
-
1331
- return acc;
1332
- }, {});
1333
- }
1334
- function generate$1(node, key, rootProps) {
1335
- if (!rootProps) {
1336
- return /*#__PURE__*/React.createElement(node.tag, _objectSpread2$1({
1337
- key: key
1338
- }, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
1339
- return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1340
- }));
1341
- }
1342
-
1343
- return /*#__PURE__*/React.createElement(node.tag, _objectSpread2$1(_objectSpread2$1({
1344
- key: key
1345
- }, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
1346
- return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1347
- }));
1348
- }
1349
- function getSecondaryColor(primaryColor) {
1350
- // choose the second color
1351
- return generate(primaryColor)[0];
1352
- }
1353
- function normalizeTwoToneColors(twoToneColor) {
1354
- if (!twoToneColor) {
1355
- return [];
1356
- }
1357
-
1358
- return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
1359
- } // These props make sure that the SVG behaviours like general text.
1360
- var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
1361
- var useInsertStyles = function useInsertStyles() {
1362
- var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
1363
-
1364
- var _useContext = useContext(IconContext),
1365
- csp = _useContext.csp;
1366
-
1367
- useEffect(function () {
1368
- updateCSS(styleStr, '@ant-design-icons', {
1369
- prepend: true,
1370
- csp: csp
1371
- });
1372
- }, []);
1373
- };
1374
-
1375
- var _excluded = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
1376
- var twoToneColorPalette = {
1377
- primaryColor: '#333',
1378
- secondaryColor: '#E6E6E6',
1379
- calculated: false
1380
- };
1381
-
1382
- function setTwoToneColors(_ref) {
1383
- var primaryColor = _ref.primaryColor,
1384
- secondaryColor = _ref.secondaryColor;
1385
- twoToneColorPalette.primaryColor = primaryColor;
1386
- twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
1387
- twoToneColorPalette.calculated = !!secondaryColor;
1388
- }
1389
-
1390
- function getTwoToneColors() {
1391
- return _objectSpread2$1({}, twoToneColorPalette);
1392
- }
1393
-
1394
- var IconBase = function IconBase(props) {
1395
- var icon = props.icon,
1396
- className = props.className,
1397
- onClick = props.onClick,
1398
- style = props.style,
1399
- primaryColor = props.primaryColor,
1400
- secondaryColor = props.secondaryColor,
1401
- restProps = _objectWithoutProperties$1(props, _excluded);
1402
-
1403
- var colors = twoToneColorPalette;
1404
-
1405
- if (primaryColor) {
1406
- colors = {
1407
- primaryColor: primaryColor,
1408
- secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
1409
- };
1410
- }
1411
-
1412
- useInsertStyles();
1413
- warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
1414
-
1415
- if (!isIconDefinition(icon)) {
1416
- return null;
1417
- }
1418
-
1419
- var target = icon;
1420
-
1421
- if (target && typeof target.icon === 'function') {
1422
- target = _objectSpread2$1(_objectSpread2$1({}, target), {}, {
1423
- icon: target.icon(colors.primaryColor, colors.secondaryColor)
1424
- });
1425
- }
1426
-
1427
- return generate$1(target.icon, "svg-".concat(target.name), _objectSpread2$1({
1428
- className: className,
1429
- onClick: onClick,
1430
- style: style,
1431
- 'data-icon': target.name,
1432
- width: '1em',
1433
- height: '1em',
1434
- fill: 'currentColor',
1435
- 'aria-hidden': 'true'
1436
- }, restProps));
1437
- };
1438
-
1439
- IconBase.displayName = 'IconReact';
1440
- IconBase.getTwoToneColors = getTwoToneColors;
1441
- IconBase.setTwoToneColors = setTwoToneColors;
1442
-
1443
- function setTwoToneColor(twoToneColor) {
1444
- var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1445
- _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
1446
- primaryColor = _normalizeTwoToneColo2[0],
1447
- secondaryColor = _normalizeTwoToneColo2[1];
1448
-
1449
- return IconBase.setTwoToneColors({
1450
- primaryColor: primaryColor,
1451
- secondaryColor: secondaryColor
1452
- });
1453
- }
1454
- function getTwoToneColor() {
1455
- var colors = IconBase.getTwoToneColors();
1456
-
1457
- if (!colors.calculated) {
1458
- return colors.primaryColor;
1459
- }
1460
-
1461
- return [colors.primaryColor, colors.secondaryColor];
1462
- }
1463
-
1464
- var _excluded$1 = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
1465
- // should move it to antd main repo?
1466
-
1467
- setTwoToneColor('#1890ff');
1468
- var Icon = /*#__PURE__*/forwardRef(function (props, ref) {
1469
- var _classNames;
1470
-
1471
- var className = props.className,
1472
- icon = props.icon,
1473
- spin = props.spin,
1474
- rotate = props.rotate,
1475
- tabIndex = props.tabIndex,
1476
- onClick = props.onClick,
1477
- twoToneColor = props.twoToneColor,
1478
- restProps = _objectWithoutProperties$1(props, _excluded$1);
1479
-
1480
- var _React$useContext = useContext(IconContext),
1481
- _React$useContext$pre = _React$useContext.prefixCls,
1482
- prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
1483
-
1484
- var classString = classNames(prefixCls, (_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _defineProperty$1(_classNames, "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), _classNames), className);
1485
- var iconTabIndex = tabIndex;
1486
-
1487
- if (iconTabIndex === undefined && onClick) {
1488
- iconTabIndex = -1;
1489
- }
1490
-
1491
- var svgStyle = rotate ? {
1492
- msTransform: "rotate(".concat(rotate, "deg)"),
1493
- transform: "rotate(".concat(rotate, "deg)")
1494
- } : undefined;
1495
-
1496
- var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1497
- _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
1498
- primaryColor = _normalizeTwoToneColo2[0],
1499
- secondaryColor = _normalizeTwoToneColo2[1];
1500
-
1501
- return /*#__PURE__*/createElement("span", _objectSpread2$1(_objectSpread2$1({
1502
- role: "img",
1503
- "aria-label": icon.name
1504
- }, restProps), {}, {
1505
- ref: ref,
1506
- tabIndex: iconTabIndex,
1507
- onClick: onClick,
1508
- className: classString
1509
- }), /*#__PURE__*/createElement(IconBase, {
1510
- icon: icon,
1511
- primaryColor: primaryColor,
1512
- secondaryColor: secondaryColor,
1513
- style: svgStyle
1514
- }));
1515
- });
1516
- Icon.displayName = 'AntdIcon';
1517
- Icon.getTwoToneColor = getTwoToneColor;
1518
- Icon.setTwoToneColor = setTwoToneColor;
1519
-
1520
- // This icon file is generated automatically.
1521
- var CaretLeftOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M689 165.1L308.2 493.5c-10.9 9.4-10.9 27.5 0 37L689 858.9c14.2 12.2 35 1.2 35-18.5V183.6c0-19.7-20.8-30.7-35-18.5z" } }] }, "name": "caret-left", "theme": "outlined" };
1522
-
1523
- var CaretLeftOutlined$1 = function CaretLeftOutlined$1(props, ref) {
1524
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1525
- ref: ref,
1526
- icon: CaretLeftOutlined
1527
- }));
1528
- };
1529
-
1530
- CaretLeftOutlined$1.displayName = 'CaretLeftOutlined';
1531
- var CaretLeftOutlined$2 = /*#__PURE__*/forwardRef(CaretLeftOutlined$1);
1532
-
1533
- // This icon file is generated automatically.
1534
- var CopyOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z" } }] }, "name": "copy", "theme": "outlined" };
1535
-
1536
- var CopyOutlined$1 = function CopyOutlined$1(props, ref) {
1537
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1538
- ref: ref,
1539
- icon: CopyOutlined
1540
- }));
1541
- };
1542
-
1543
- CopyOutlined$1.displayName = 'CopyOutlined';
1544
- var CopyOutlined$2 = /*#__PURE__*/forwardRef(CopyOutlined$1);
1545
-
1546
- // This icon file is generated automatically.
1547
- var DownOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, "name": "down", "theme": "outlined" };
1548
-
1549
- var DownOutlined$1 = function DownOutlined$1(props, ref) {
1550
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1551
- ref: ref,
1552
- icon: DownOutlined
1553
- }));
1554
- };
1555
-
1556
- DownOutlined$1.displayName = 'DownOutlined';
1557
- var DownOutlined$2 = /*#__PURE__*/forwardRef(DownOutlined$1);
1558
-
1559
- // This icon file is generated automatically.
1560
- var ExclamationCircleOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z" } }, { "tag": "path", "attrs": { "d": "M464 688a48 48 0 1096 0 48 48 0 10-96 0zm24-112h48c4.4 0 8-3.6 8-8V296c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8z" } }] }, "name": "exclamation-circle", "theme": "outlined" };
1561
-
1562
- var ExclamationCircleOutlined$1 = function ExclamationCircleOutlined$1(props, ref) {
1563
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1564
- ref: ref,
1565
- icon: ExclamationCircleOutlined
1566
- }));
1567
- };
1568
-
1569
- ExclamationCircleOutlined$1.displayName = 'ExclamationCircleOutlined';
1570
- var ExclamationCircleOutlined$2 = /*#__PURE__*/forwardRef(ExclamationCircleOutlined$1);
1571
-
1572
- // This icon file is generated automatically.
1573
- var ProfileTwoTone = { "icon": function render(primaryColor, secondaryColor) { return { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z", "fill": primaryColor } }, { "tag": "path", "attrs": { "d": "M184 840h656V184H184v656zm300-496c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zm0 144c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zm0 144c0-4.4 3.6-8 8-8h184c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H492c-4.4 0-8-3.6-8-8v-48zM380 328c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm0 144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40zm0 144c22.1 0 40 17.9 40 40s-17.9 40-40 40-40-17.9-40-40 17.9-40 40-40z", "fill": secondaryColor } }, { "tag": "path", "attrs": { "d": "M340 656a40 40 0 1080 0 40 40 0 10-80 0zm0-144a40 40 0 1080 0 40 40 0 10-80 0zm0-144a40 40 0 1080 0 40 40 0 10-80 0zm152 320h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0-144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zm0-144h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H492c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z", "fill": primaryColor } }] }; }, "name": "profile", "theme": "twotone" };
1574
-
1575
- var ProfileTwoTone$1 = function ProfileTwoTone$1(props, ref) {
1576
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1577
- ref: ref,
1578
- icon: ProfileTwoTone
1579
- }));
1580
- };
1581
-
1582
- ProfileTwoTone$1.displayName = 'ProfileTwoTone';
1583
- var ProfileTwoTone$2 = /*#__PURE__*/forwardRef(ProfileTwoTone$1);
1584
-
1585
- // This icon file is generated automatically.
1586
- var SearchOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.6 854.5L649.9 594.8C690.2 542.7 712 479 712 412c0-80.2-31.3-155.4-87.9-212.1-56.6-56.7-132-87.9-212.1-87.9s-155.5 31.3-212.1 87.9C143.2 256.5 112 331.8 112 412c0 80.1 31.3 155.5 87.9 212.1C256.5 680.8 331.8 712 412 712c67 0 130.6-21.8 182.7-62l259.7 259.6a8.2 8.2 0 0011.6 0l43.6-43.5a8.2 8.2 0 000-11.6zM570.4 570.4C528 612.7 471.8 636 412 636s-116-23.3-158.4-65.6C211.3 528 188 471.8 188 412s23.3-116.1 65.6-158.4C296 211.3 352.2 188 412 188s116.1 23.2 158.4 65.6S636 352.2 636 412s-23.3 116.1-65.6 158.4z" } }] }, "name": "search", "theme": "outlined" };
1587
-
1588
- var SearchOutlined$1 = function SearchOutlined$1(props, ref) {
1589
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1590
- ref: ref,
1591
- icon: SearchOutlined
1592
- }));
1593
- };
1594
-
1595
- SearchOutlined$1.displayName = 'SearchOutlined';
1596
- var SearchOutlined$2 = /*#__PURE__*/forwardRef(SearchOutlined$1);
1597
-
1598
- // This icon file is generated automatically.
1599
- var UnorderedListOutlined = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0zm0 284a56 56 0 10112 0 56 56 0 10-112 0z" } }] }, "name": "unordered-list", "theme": "outlined" };
1600
-
1601
- var UnorderedListOutlined$1 = function UnorderedListOutlined$1(props, ref) {
1602
- return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1603
- ref: ref,
1604
- icon: UnorderedListOutlined
1605
- }));
1606
- };
1607
-
1608
- UnorderedListOutlined$1.displayName = 'UnorderedListOutlined';
1609
- var UnorderedListOutlined$2 = /*#__PURE__*/forwardRef(UnorderedListOutlined$1);
1610
-
1611
- function styleInject(css, ref) {
1612
- if ( ref === void 0 ) ref = {};
1613
- var insertAt = ref.insertAt;
1614
-
1615
- if (!css || typeof document === 'undefined') { return; }
1616
-
1617
- var head = document.head || document.getElementsByTagName('head')[0];
1618
- var style = document.createElement('style');
1619
- style.type = 'text/css';
1620
-
1621
- if (insertAt === 'top') {
1622
- if (head.firstChild) {
1623
- head.insertBefore(style, head.firstChild);
1624
- } else {
1625
- head.appendChild(style);
1626
- }
1627
- } else {
1628
- head.appendChild(style);
1629
- }
1630
-
1631
- if (style.styleSheet) {
1632
- style.styleSheet.cssText = css;
1633
- } else {
1634
- style.appendChild(document.createTextNode(css));
1635
- }
1636
- }
1637
-
1638
- var css_248z = ".luckysheet {\n overflow: hidden;\n}\n.luckysheet .luckysheet-work-area.luckysheet-noselected-text {\n display: none;\n}\n.sheet_table_top {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_top .menu_item_text {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.sheet_table_footer {\n height: 50px;\n background: #f2f2f2;\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0 20px;\n border: 1px solid #d8d8d8;\n}\n.sheet_table_text {\n color: #8f8f8f;\n}\n.sheet_table_dnd_text {\n background: #f2f2f2;\n border: 1px solid #d8d8d8;\n display: inline-block;\n width: 100px;\n height: 30px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n";
1639
- styleInject(css_248z);
1640
-
1641
- var _excluded$2 = ["flag", "checkResults"],
1642
- _excluded2 = ["flag", "checkResults"];
1643
- var luckysheet = window.luckysheet;
1644
- var itemsTemp = []; // const mapping = [
1645
- // { "key": "skuCode", "name": "SKU编码", "rule": "skuCode" },
1646
- // { "key": "quantity", "name": "数量", "rule": "quantity" },
1647
- // { "key": "price", "name": "单价", "rule": "price" }
1648
- // ]
1649
-
1650
- var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例'], ['lotNumberCode', '批号']]); // for dnd
1651
-
1652
-
1653
- var reorder = function reorder(list, startIndex, endIndex) {
1654
- var result = Array.from(list);
1655
-
1656
- var _result$splice = result.splice(startIndex, 1),
1657
- _result$splice2 = _slicedToArray(_result$splice, 1),
1658
- removed = _result$splice2[0];
1659
-
1660
- result.splice(endIndex, 0, removed);
1661
- return result;
1662
- };
1663
-
1664
- var grid = 8;
1665
-
1666
- var getItemStyle = function getItemStyle(isDragging, draggableStyle) {
1667
- return _objectSpread2({
1668
- // some basic styles to make the items look a bit nicer
1669
- userSelect: 'none',
1670
- padding: "4px",
1671
- margin: "4px"
1672
- }, draggableStyle);
1673
- };
1674
-
1675
- var getListStyle = function getListStyle(isDraggingOver) {
1676
- return {
1677
- background: isDraggingOver ? '#fff' : '#fff',
1678
- display: 'flex',
1679
- padding: grid,
1680
- overflow: 'auto'
1681
- };
1682
- };
1683
-
1684
- var filterLetters = function filterLetters(i) {
1685
- if (i >= 0 && i <= 25) {
1686
- return String.fromCharCode(65 + i);
1687
- } else {
1688
- return undefined;
1689
- }
1690
- };
1691
-
1692
- var DataValidation = /*#__PURE__*/function (_React$Component) {
1693
- _inherits(DataValidation, _React$Component);
1694
-
1695
- var _super = _createSuper(DataValidation);
1696
-
1697
- function DataValidation(props) {
1698
- var _this;
1699
-
1700
- _classCallCheck(this, DataValidation);
1701
-
1702
- _this = _super.call(this, props);
1703
-
1704
- _this.getCount = function () {
1705
- var resultData = _this.state.resultData;
1706
- return {
1707
- total: resultData.length,
1708
- error: resultData.filter(function (item) {
1709
- return !item.flag;
1710
- }).length
1711
- };
1712
- };
1713
-
1714
- _this.setConfig = function (data) {
1715
- var _ref;
1716
-
1717
- var items = _this.state.items;
1718
- return {
1719
- container: 'luckysheet',
1720
- showtoolbar: false,
1721
- hook: {
1722
- columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
1723
- if (columnAbc.name) {
1724
- var charCode = columnAbc.name.charCodeAt();
1725
-
1726
- if (charCode - 65 <= items.length) {
1727
- columnAbc.name = itemsTemp[charCode - 65] ? itemsTemp[charCode - 65].content : '校验结果';
1728
- } else {
1729
- columnAbc.name = '';
1730
- }
1731
- }
1732
- },
1733
- cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
1734
- if (cell) {
1735
- cell.fs = 10;
1736
-
1737
- if (typeof cell.v === 'string') {
1738
- cell.m = cell.v = cell.m.trim();
1739
- }
1740
-
1741
- if (cell && cell.m && cell.m.indexOf('E+') !== -1) {
1742
- cell.v = cell.v.toString();
1743
- cell.m = cell.v;
1744
- }
1745
-
1746
- if (typeof cell.v === 'number') {
1747
- cell.v = cell.m;
1748
- }
1749
- } // console.log(postion);
1750
-
1751
- },
1752
- cellAllRenderBefore: function cellAllRenderBefore(data, sheetFile, ctx) {
1753
- sheetFile.config.borderInfo = []; // console.info(data,sheetFile,ctx)
1754
- }
1755
- },
1756
- // showtoolbarConfig: {
1757
- // undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
1758
- // paintFormat: false, //格式刷
1759
- // currencyFormat: false, //货币格式
1760
- // percentageFormat: false, //百分比格式
1761
- // numberDecrease: false, // '减少小数位数'
1762
- // numberIncrease: false, // '增加小数位数
1763
- // moreFormats: false, // '更多格式'
1764
- // font: true, // '字体'
1765
- // fontSize: true, // '字号大小'
1766
- // },
1767
- data: [(_ref = {
1768
- name: 'Cell',
1769
- color: '',
1770
- index: 0,
1771
- status: 1,
1772
- order: 0,
1773
- hide: 0,
1774
- row: 36,
1775
- column: 18,
1776
- defaultRowHeight: 20,
1777
- defaultColWidth: 120,
1778
- config: {},
1779
- // celldata:
1780
- // data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
1781
- // "r": b,
1782
- // "c": d,
1783
- // "v": { "ct": { "fa": "@", "t": "s" }, }
1784
- // }))))
1785
- // ,
1786
- celldata: data && data.length !== 0 ? data : _.flattenDeep(Array.from({
1787
- length: 100
1788
- }).map(function (a, b) {
1789
- return Array.from({
1790
- length: 100
1791
- }).map(function (c, d) {
1792
- return {
1793
- "r": b,
1794
- "c": d,
1795
- "v": {
1796
- "ct": {
1797
- "fa": "@",
1798
- "t": "s"
1799
- }
1800
- }
1801
- };
1802
- });
1803
- })),
1804
- scrollLeft: 0,
1805
- // "scrollTop": 315, //上下滚动条位置
1806
- luckysheet_select_save: [],
1807
- calcChain: [],
1808
- isPivotTable: false,
1809
- pivotTable: {},
1810
- filter_select: {},
1811
- filter: null,
1812
- luckysheet_alternateformat_save: [],
1813
- luckysheet_alternateformat_save_modelCustom: [],
1814
- luckysheet_conditionformat_save: {},
1815
- frozen: {},
1816
- chart: [],
1817
- zoomRatio: 1,
1818
- image: [],
1819
- showGridLines: 1,
1820
- dataVerification: {}
1821
- }, _defineProperty(_ref, "luckysheet_alternateformat_save", [{
1822
- cellrange: {
1823
- //单元格范围
1824
- row: [0, 1000],
1825
- column: [0, 18]
1826
- },
1827
- format: {
1828
- head: {
1829
- //页眉颜色
1830
- fc: '#6aa84f',
1831
- bc: '#ffffff'
1832
- },
1833
- one: {
1834
- //第一种颜色
1835
- bc: '#ffffff'
1836
- },
1837
- two: {
1838
- //第二种颜色
1839
- bc: '#f2f4f5'
1840
- },
1841
- foot: {
1842
- //页脚颜色
1843
- fc: '#000',
1844
- bc: '#a5efcc'
1845
- }
1846
- },
1847
- hasRowHeader: false,
1848
- hasRowFooter: false //含有页脚
1849
-
1850
- }]), _defineProperty(_ref, "luckysheet_alternateformat_save_modelCustom", [{
1851
- head: {
1852
- //页眉颜色
1853
- fc: '#6aa84f',
1854
- bc: '#ffffff'
1855
- },
1856
- one: {
1857
- //第一种颜色
1858
- fc: '#000',
1859
- bc: '#ffffff'
1860
- },
1861
- two: {
1862
- //第二种颜色
1863
- fc: '#000',
1864
- bc: '#e5fbee'
1865
- },
1866
- foot: {
1867
- //页脚颜色
1868
- fc: '#000',
1869
- bc: '#a5efcc'
1870
- }
1871
- }]), _ref)],
1872
- cellRightClickConfig: {
1873
- copy: false,
1874
- copyAs: false,
1875
- paste: false,
1876
- insertRow: false,
1877
- insertColumn: false,
1878
- // deleteRow: false, // 删除选中行
1879
- // deleteColumn: false, // 删除选中列
1880
- deleteCell: false,
1881
- hideRow: false,
1882
- hideColumn: false,
1883
- rowHeight: false,
1884
- columnWidth: false,
1885
- clear: false,
1886
- matrix: false,
1887
- sort: false,
1888
- filter: false,
1889
- chart: false,
1890
- image: false,
1891
- link: false,
1892
- data: false,
1893
- cellFormat: false // 设置单元格格式
1894
-
1895
- },
1896
- showsheetbar: false,
1897
- optionstate: false,
1898
- showstatisticBarConfig: {
1899
- count: false,
1900
- view: false,
1901
- zoom: false // 缩放
1902
-
1903
- },
1904
- column: 10,
1905
- columnHeaderHeight: 30,
1906
- lang: 'zh',
1907
- defaultFontSize: '10',
1908
- frozen: {
1909
- type: 'rangeBoth',
1910
- range: {
1911
- row_focus: 1,
1912
- column_focus: 1
1913
- }
1914
- }
1915
- };
1916
- };
1917
-
1918
- _this.getValidateData = function () {
1919
- var resultData = _this.state.resultData;
1920
- return {
1921
- successData: resultData.filter(function (item) {
1922
- return item.flag;
1923
- }).map(function (_ref2) {
1924
- var flag = _ref2.flag,
1925
- checkResults = _ref2.checkResults,
1926
- item = _objectWithoutProperties(_ref2, _excluded$2);
1927
-
1928
- return item;
1929
- }),
1930
- failData: resultData.filter(function (item) {
1931
- return !item.flag;
1932
- }).map(function (_ref3) {
1933
- var flag = _ref3.flag,
1934
- checkResults = _ref3.checkResults,
1935
- item = _objectWithoutProperties(_ref3, _excluded2);
1936
-
1937
- return item;
1938
- })
1939
- };
1940
- };
1941
-
1942
- _this.getData = function () {
1943
- console.time();
1944
- var sheetData = luckysheet.getSheetData();
1945
- var data = sheetData.filter(function (item) {
1946
- return item[0];
1947
- }).map(function (item) {
1948
- var obj = {};
1949
- item.slice(0, itemsTemp.length).map(function (innerItem, index) {
1950
- obj[_this.state.items[index].code] = innerItem && (innerItem.v === innerItem.m ? innerItem.v : innerItem.m);
1951
- });
1952
- return obj;
1953
- });
1954
- return data;
1955
- };
1956
-
1957
- _this.resetData = function () {
1958
- var _this$props = _this.props,
1959
- validDataUrl = _this$props.validDataUrl,
1960
- updateData = _this$props.updateData,
1961
- columns = _this$props.columns;
1962
-
1963
- var resultData = _this.getData().filter(function (d) {
1964
- return _.compact(Object.values(d)).length;
1965
- });
1966
-
1967
- axios.post(validDataUrl, {
1968
- columns: columns,
1969
- data: resultData
1970
- }).then(function (result) {
1971
- result = result.data;
1972
-
1973
- if (result.status !== '0') {
1974
- message.error(result.msg);
1975
- return;
1976
- }
1977
-
1978
- var items = _this.state.items;
1979
- var validIndex = items.length;
1980
- var res = result.data;
1981
- var sheetData = luckysheet.getSheetData();
1982
- sheetData.map(function (item, index) {
1983
- if (!res[index]) return item;
1984
-
1985
- var changeVMIndex = _this.props.columns.findIndex(function (i) {
1986
- return i === 'skuCode';
1987
- });
1988
-
1989
- if (_this.props.columns.find(function (i) {
1990
- return i === 'skuCode';
1991
- }) && item[changeVMIndex].v !== res[index].skuCode) {
1992
- item[changeVMIndex].v = res[index].skuCode;
1993
- item[changeVMIndex].m = res[index].skuCode;
1994
- }
1995
-
1996
- if (res[index].flag) {
1997
- item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
1998
- v: '通过',
1999
- m: '通过',
2000
- fc: 'green' //字体颜色为 "#990000"
2001
-
2002
- });
2003
- } else {
2004
- item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
2005
- v: res[index].checkResults,
2006
- m: res[index].checkResults,
2007
- fc: 'red' //字体颜色为 "#990000"
2008
-
2009
- });
2010
- }
2011
-
2012
- item[validIndex].ct = {
2013
- fa: 'General',
2014
- t: 'g'
2015
- };
2016
- }); // sheetData.map((item, index) => {
2017
- // luckysheet.setCellValue(index + 1, 4, 345)
2018
- // })
2019
-
2020
- luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2021
-
2022
- _this.setState({
2023
- data: luckysheet.transToCellData(sheetData),
2024
- errorListCheck: false,
2025
- resultData: res
2026
- });
2027
-
2028
- console.log(setExportData);
2029
- setExportData([123123]);
2030
- }).catch(function (err) {});
2031
- };
2032
-
2033
- _this.filterData = function (type) {
2034
- var _this$state = _this.state,
2035
- showErrorData = _this$state.showErrorData,
2036
- data = _this$state.data,
2037
- resultData = _this$state.resultData;
2038
- var sheetData = luckysheet.transToData(data).filter(function (item, index) {
2039
- if (type === 'all') {
2040
- return false;
2041
- }
2042
-
2043
- if (type === 'error') {
2044
- return item[itemsTemp.length] && item[itemsTemp.length].v === '通过';
2045
- }
2046
- });
2047
- luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2048
-
2049
- _this.setState({
2050
- data: luckysheet.transToCellData(sheetData),
2051
- errorListCheck: false,
2052
- resultData: type === 'all' ? [] : resultData.filter(function (item) {
2053
- return item.flag;
2054
- })
2055
- });
2056
- };
2057
-
2058
- _this.toggleData = function () {
2059
- var _this$state2 = _this.state,
2060
- showErrorData = _this$state2.showErrorData,
2061
- data = _this$state2.data;
2062
-
2063
- if (showErrorData) {
2064
- luckysheet.create(_this.setConfig(data));
2065
- } else {
2066
- var sheetData = luckysheet.getSheetData();
2067
- sheetData = sheetData.filter(function (item, index) {
2068
- return !item[itemsTemp.length] || item[itemsTemp.length].v !== '通过';
2069
- });
2070
- luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2071
- }
2072
-
2073
- _this.setState({
2074
- showErrorData: !showErrorData
2075
- });
2076
- };
2077
-
2078
- _this.onChange = function (e) {
2079
- _this.setState({
2080
- radioValue: e.target.value
2081
- });
2082
-
2083
- _this.toggleData();
2084
- };
2085
-
2086
- _this.errorChange = function (e) {
2087
- _this.toggleData();
2088
-
2089
- _this.setState({
2090
- errorListCheck: e.target.checked
2091
- });
2092
- };
2093
-
2094
- _this.menuList = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
2095
- key: "1",
2096
- className: "sheet_table-menu_item_text"
2097
- }, /*#__PURE__*/React.createElement("a", {
2098
- onClick: function onClick() {
2099
- return _this.filterData('all');
2100
- }
2101
- }, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
2102
- key: "2",
2103
- className: "sheet_table-menu_item_text"
2104
- }, /*#__PURE__*/React.createElement("a", {
2105
- onClick: function onClick() {
2106
- return _this.filterData('error');
2107
- }
2108
- }, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
2109
- _this.leftMenu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
2110
- key: "3",
2111
- className: "sheet_table-menu_item_text"
2112
- }, /*#__PURE__*/React.createElement("span", {
2113
- className: "sheet_table_text"
2114
- }, "\u8BF7\u62D6\u52A8\u5B57\u6BB5\u6765\u5BF9\u5E94\u5217")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DragDropContext, {
2115
- onDragEnd: function onDragEnd(e) {
2116
- return _this.onDragEnd(e);
2117
- }
2118
- }, /*#__PURE__*/React.createElement(Droppable, {
2119
- droppableId: "droppable",
2120
- direction: "vertical"
2121
- }, function (provided, snapshot) {
2122
- return /*#__PURE__*/React.createElement("div", _objectSpread2({
2123
- ref: provided.innerRef,
2124
- style: _objectSpread2(_objectSpread2({}, getListStyle(snapshot.isDraggingOver)), {}, {
2125
- flexDirection: 'column'
2126
- })
2127
- }, provided.droppableProps), _this.state.items.map(function (item, index) {
2128
- return /*#__PURE__*/React.createElement(Draggable, {
2129
- key: item.id,
2130
- draggableId: item.id,
2131
- index: index
2132
- }, function (provided, snapshot) {
2133
- return /*#__PURE__*/React.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
2134
- ref: provided.innerRef
2135
- }, provided.draggableProps), provided.dragHandleProps), {}, {
2136
- style: getItemStyle(snapshot.isDragging, provided.draggableProps.style)
2137
- }), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, filterLetters(index), " \u5217 "), /*#__PURE__*/React.createElement(Space, {
2138
- className: "sheet_table_dnd_text"
2139
- }, /*#__PURE__*/React.createElement(UnorderedListOutlined$2, null), item.content)));
2140
- });
2141
- }), provided.placeholder);
2142
- }))));
2143
-
2144
- _this.props.onRef(_assertThisInitialized(_this));
2145
-
2146
- itemsTemp = props.columns.map(function (item, index) {
2147
- if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
2148
- return {
2149
- id: "item-0".concat(index),
2150
- content: mapping.get(item),
2151
- code: item,
2152
- "ct": {
2153
- "fa": "General",
2154
- "t": "s" //格式类型为数字类型
2155
-
2156
- }
2157
- };
2158
- });
2159
- _this.state = {
2160
- showErrorData: false,
2161
- data: [],
2162
- items: _toConsumableArray(itemsTemp),
2163
- resultData: [],
2164
- errorListCheck: false
2165
- };
2166
- return _this;
2167
- }
2168
-
2169
- _createClass(DataValidation, [{
2170
- key: "onDragEnd",
2171
- value: function onDragEnd(result) {
2172
- // dropped outside the list
2173
- if (!result.destination) {
2174
- return;
2175
- }
2176
-
2177
- var items = reorder(this.state.items, result.source.index, result.destination.index);
2178
- this.setState({
2179
- items: items
2180
- });
2181
- itemsTemp = items;
2182
- luckysheet.refresh();
2183
- }
2184
- }, {
2185
- key: "componentDidMount",
2186
- value: function componentDidMount() {
2187
- luckysheet.create(this.setConfig([]));
2188
- }
2189
- }, {
2190
- key: "componentWillUnmount",
2191
- value: function componentWillUnmount() {
2192
- // luckysheet.create(this.setConfig([]));
2193
- luckysheet.destroy();
2194
- }
2195
- }, {
2196
- key: "render",
2197
- value: function render() {
2198
- var errorListCheck = this.state.errorListCheck;
2199
- var title = this.props.title;
2200
- var totalSummary = this.getCount();
2201
- var luckyCss = {
2202
- margin: '0px',
2203
- padding: '0px',
2204
- position: 'absolute',
2205
- width: '100%',
2206
- height: '100%',
2207
- left: '0px',
2208
- top: '0px'
2209
- };
2210
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2211
- className: "sheet_table_top"
2212
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React.createElement(Dropdown, {
2213
- trigger: ['click'],
2214
- overlay: this.leftMenu,
2215
- placement: "bottomLeft"
2216
- }, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(ProfileTwoTone$2, null))), /*#__PURE__*/React.createElement(Tooltip, {
2217
- title: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "1\u3001\u62D6\u52A8\u6570\u636E\u9879\uFF0C\u4EE5\u9002\u914D\u6E90\u6570\u636E\u7684\u987A\u5E8F\uFF0C\u5982\u60A8Excel\u4E2D\u6570\u636E\u6392\u5E8F\u4F9D\u6B21\u4E3A\u7F16\u7801\u3001\u4EF7\u683C\u548C\u6570\u91CF\uFF0C\u5219\u60A8\u4E5F\u53EF\u4EE5\u5C06\u6570\u636E\u9879\u7684\u987A\u5E8F\u8C03\u6574\u4E3A\u4E00\u81F4"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "2\u3001\u590D\u5236\u6587\u4EF6\u6570\u636E\uFF08\u591A\u5217\u4E00\u8D77\uFF09\uFF0C\u5728\u6587\u672C\u6846\u5185\u8FDB\u884C\u7C98\u8D34"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("span", null, "3\u3001\u70B9\u51FB\u8BC6\u522B\u6309\u94AE\u8FDB\u884C\u6570\u636E\u6821\u9A8C\uFF0C\u5982\u5168\u90E8\u6B63\u786E\uFF0C\u5219\u70B9\u51FB\u5F55\u5165\u6309\u94AE\u53EF\u5F55\u5165\u6570\u636E\uFF0C\u5982\u5B58\u5728\u9519\u8BEF\u6570\u636E\uFF0C\u5219\u9700\u4FEE\u6539\u540E\u518D\u8FDB\u884C\u5F55\u5165"))
2218
- }, /*#__PURE__*/React.createElement(ExclamationCircleOutlined$2, null))), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Dropdown, {
2219
- trigger: ['click'],
2220
- overlay: this.menuList,
2221
- placement: "bottomRight"
2222
- }, /*#__PURE__*/React.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React.createElement(DownOutlined$2, null))), /*#__PURE__*/React.createElement(Button, {
2223
- type: "primary",
2224
- onClick: this.resetData
2225
- }, "\u8BC6\u522B"))), /*#__PURE__*/React.createElement("div", {
2226
- style: {
2227
- position: 'relative',
2228
- height: '400px'
2229
- }
2230
- }, /*#__PURE__*/React.createElement("div", {
2231
- id: "luckysheet",
2232
- style: luckyCss
2233
- })), /*#__PURE__*/React.createElement("div", {
2234
- className: "sheet_table_footer"
2235
- }, /*#__PURE__*/React.createElement("span", {
2236
- className: "sheet_table_footer_l"
2237
- }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E, \u5176\u4E2D\u9519\u8BEF ", totalSummary.error, " \u9879"), /*#__PURE__*/React.createElement(Space, {
2238
- className: "sheet_table_footer_r"
2239
- }, /*#__PURE__*/React.createElement(Checkbox, {
2240
- checked: errorListCheck,
2241
- onClick: this.errorChange
2242
- }), "\u4EC5\u5C55\u793A\u9519\u8BEF\u6570\u636E")));
2243
- }
2244
- }]);
2245
-
2246
- return DataValidation;
2247
- }(React.Component);
2248
-
2249
- var css_248z$1 = ".query_input_show {\n display: flex;\n}\n.query_input_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.query_input_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.query_input_wrapper {\n display: flex;\n}\n.query_input_wrapper_left {\n width: 100px;\n}\n.query_input_wrapper_right {\n color: #9e9e9e;\n}\n.query_input_textArea {\n margin-top: 15px;\n}\n";
2250
- styleInject(css_248z$1);
2251
-
2252
- var QueryMutipleInput = function QueryMutipleInput(_ref) {
2253
- var onValueChange = _ref.onValueChange;
2254
-
2255
- var _useState = useState(false),
2256
- _useState2 = _slicedToArray(_useState, 2),
2257
- isModalVisible = _useState2[0],
2258
- setIsModalVisible = _useState2[1];
2259
-
2260
- var _useState3 = useState(''),
2261
- _useState4 = _slicedToArray(_useState3, 2),
2262
- value = _useState4[0],
2263
- setValue = _useState4[1];
2264
-
2265
- var _useState5 = useState(''),
2266
- _useState6 = _slicedToArray(_useState5, 2),
2267
- popvalue = _useState6[0],
2268
- setPopValue = _useState6[1];
2269
-
2270
- var _useDebounceFn = useDebounceFn(function () {
2271
- formaData(value);
2272
- }, {
2273
- wait: 1000
2274
- }),
2275
- run = _useDebounceFn.run;
2276
-
2277
- useEffect(function () {
2278
- setPopValue(value);
2279
- onValueChange(value);
2280
- }, [value]);
2281
-
2282
- var showModal = function showModal() {
2283
- setIsModalVisible(true);
2284
- };
2285
-
2286
- var handleOk = function handleOk() {
2287
- formaData(popvalue);
2288
- setIsModalVisible(false);
2289
- };
2290
-
2291
- var formaData = function formaData(value) {
2292
- var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2293
- return item;
2294
- }).join(',');
2295
- setValue(formatValue);
2296
- };
2297
-
2298
- var handleCancel = function handleCancel() {
2299
- setIsModalVisible(false);
2300
- };
2301
-
2302
- var outerChange = function outerChange(e) {
2303
- setValue(e.target.value);
2304
- run();
2305
- };
2306
-
2307
- var onChange = function onChange(e) {
2308
- setPopValue(e.target.value);
2309
- };
2310
-
2311
- return /*#__PURE__*/React.createElement("div", {
2312
- className: 'query_input'
2313
- }, /*#__PURE__*/React.createElement("div", {
2314
- className: "query_input_show"
2315
- }, /*#__PURE__*/React.createElement(Input, {
2316
- value: value,
2317
- onChange: outerChange,
2318
- onBlur: function onBlur(e) {
2319
- formaData(e.target.value);
2320
- },
2321
- onPaste: function onPaste(e) {
2322
- formaData(e.clipboardData.getData('text'));
2323
- e.preventDefault();
2324
- },
2325
- style: {
2326
- width: 'calc(100% - 30px)'
2327
- },
2328
- placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2329
- }), /*#__PURE__*/React.createElement(Button, {
2330
- style: {
2331
- width: '30px',
2332
- padding: '2px',
2333
- height: 'auto'
2334
- },
2335
- onClick: showModal,
2336
- type: "primary"
2337
- }, "...")), /*#__PURE__*/React.createElement(Modal, {
2338
- width: 600,
2339
- title: "\u591A\u503C\u5F55\u5165",
2340
- visible: isModalVisible,
2341
- onOk: handleOk,
2342
- onCancel: handleCancel,
2343
- footer: [/*#__PURE__*/React.createElement(Button, {
2344
- key: "back",
2345
- onClick: handleCancel
2346
- }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
2347
- key: "submit",
2348
- type: "primary",
2349
- onClick: handleOk
2350
- }, "\u5F55\u5165")]
2351
- }, /*#__PURE__*/React.createElement("div", {
2352
- className: 'query_input_wrapper'
2353
- }, /*#__PURE__*/React.createElement("div", {
2354
- className: 'query_input_wrapper_left'
2355
- }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React.createElement("div", {
2356
- className: 'query_input_wrapper_right'
2357
- }, /*#__PURE__*/React.createElement("div", null, "\u5982\u9700\u540C\u65F6\u4F7F\u7528\u591A\u4E2A\u503C\u8FDB\u884C\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u9017\u53F7\u3001\u5206\u53F7\u3001\u7A7A\u683C\u6216\u6362\u884C\u8FDB\u884C\u503C\u7684\u5206\u9694\uFF0C\u4E2D\u82F1\u6587\u683C\u5F0F\u7684\u7B26\u53F7\u5747\u652F\u6301"), /*#__PURE__*/React.createElement("div", {
2358
- className: 'query_input_textArea'
2359
- }, /*#__PURE__*/React.createElement(Input.TextArea, {
2360
- value: popvalue,
2361
- onChange: onChange,
2362
- rows: 6,
2363
- showCount: true
2364
- }))))));
2365
- };
2366
-
2367
- function ToCDB(str) {
2368
- var tmp = '';
2369
-
2370
- for (var i = 0; i < str.length; i++) {
2371
- if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
2372
- tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
2373
- } else {
2374
- tmp += String.fromCharCode(str.charCodeAt(i));
2375
- }
2376
- }
2377
-
2378
- return tmp;
2379
- }
2380
-
2381
- /*
2382
- * @Description:
2383
- * @Author: rodchen
2384
- * @Date: 2022-01-14 14:12:01
2385
- * @LastEditTime: 2022-01-14 17:17:26
2386
- * @LastEditors: rodchen
2387
- */
2388
- var index = (function (storageKeyString) {
2389
- var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2390
- var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
2391
- if (typeof seconds !== 'number') throw new Error('seconds should be number');
2392
- var cacheValue = getStorageVale(storageKeyString);
2393
-
2394
- if (document.hidden !== undefined) {
2395
- document.addEventListener('visibilitychange', function () {
2396
- if (!document.hidden) {
2397
- var currentValue = getStorageVale(storageKeyString);
2398
-
2399
- if (currentValue !== cacheValue) {
2400
- if (tipsCallFunction && typeof tipsCallFunction === 'function') {
2401
- tipsCallFunction();
2402
- } else {
2403
- window.alert('检测新用户登录,当前页面会在2s之后刷新!');
2404
- }
2405
-
2406
- setTimeout(function () {
2407
- window.location.reload();
2408
- }, seconds * 1000);
2409
- }
2410
- }
2411
- });
2412
- }
2413
- });
2414
-
2415
- function getStorageVale(storageKeyString) {
2416
- var _storageKeyString$spl = storageKeyString.split('.'),
2417
- _storageKeyString$spl2 = _toArray(_storageKeyString$spl),
2418
- localstorage = _storageKeyString$spl2[0],
2419
- restKeyArrays = _storageKeyString$spl2.slice(1);
2420
-
2421
- var localStorageInfo = window.localStorage.getItem(localstorage);
2422
- if (!restKeyArrays.length) return localStorageInfo;
2423
- var returnVal = JSON.parse(localStorageInfo || '{}');
2424
-
2425
- for (var i = 0; i < restKeyArrays.length; i++) {
2426
- returnVal = returnVal[restKeyArrays[i]];
2427
- if (!returnVal) return '';
2428
-
2429
- if (typeof returnVal === 'string') {
2430
- return returnVal;
2431
- }
2432
- }
2433
-
2434
- return "";
2435
- }
2436
-
2437
- var css_248z$2 = ".search_select_show {\n display: flex;\n}\n.search_select_expand_button {\n position: relative;\n width: 30px;\n color: #ffffff;\n cursor: pointer;\n}\n.search_select_expand_button span {\n position: absolute;\n height: 20px;\n line-height: 14px;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n}\n.search_select_wrapper {\n position: relative;\n display: flex;\n min-height: 60vh;\n max-height: 60vh;\n overflow: hidden;\n font-size: 14px;\n}\n.search_select_wrapper_click_flag {\n position: absolute;\n z-index: 10;\n}\n.search_select_wrapper_click_flag_arrow {\n transform: rotate(0deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_click_flag_arrow_1 {\n transform: rotate(-180deg);\n transition: transform 0.5s;\n}\n.search_select_wrapper_left {\n width: 28%;\n overflow-y: hidden;\n transition: all 0.3s;\n margin-left: 20px;\n}\n.search_select_wrapper_left1 {\n width: 0;\n height: 0;\n transition: all 0.3s;\n display: none;\n}\n.search_select_wrapper_right {\n width: 70%;\n margin-left: 1%;\n}\n.search_select_wrapper_right1 {\n width: 100%;\n margin-left: 20px;\n}\n.search_select_wrapper_right,\n.search_select_wrapper_right1 {\n overflow-x: auto;\n}\n.search_select_wrapper .select_list_columns {\n width: 100%;\n height: calc(60vh - 60px);\n overflow-y: auto;\n border: 1px solid #d8d8d8;\n}\n.search_select_wrapper .select_list_columns_tips {\n background: #eee;\n padding: 6px 20px;\n margin-bottom: 10px;\n}\n.search_select_wrapper .select_list_columns_formItems {\n padding: 0 20px;\n}\n.search_select_wrapper .select_list_searchButton {\n display: flex;\n margin: 10px 0px;\n justify-content: flex-end;\n}\n.search_select_wrapper .select_list_button_space {\n margin-right: 10px;\n}\n.search_select_wrapper .select_list_selectTips {\n display: flex;\n justify-content: space-between;\n height: 34px;\n line-height: 32px;\n background-color: #eee;\n margin-bottom: 10px;\n padding: 0 12px;\n}\n.search_select_wrapper .select_list_selectAll {\n position: relative;\n top: -40px;\n left: 20px;\n width: 160px;\n}\n";
2438
- styleInject(css_248z$2);
2439
-
2440
- var Option = Select.Option;
2441
-
2442
- var SearchSelect = function SearchSelect(props) {
2443
- var value = props.value,
2444
- onChange = props.onChange,
2445
- _props$selectProps = props.selectProps,
2446
- selectProps = _props$selectProps === void 0 ? {} : _props$selectProps,
2447
- _props$modalTableProp = props.modalTableProps,
2448
- modalTableProps = _props$modalTableProp === void 0 ? {} : _props$modalTableProp,
2449
- _props$labelInValue = props.labelInValue,
2450
- labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
2451
- requestConfig = props.requestConfig,
2452
- ctx = props.ctx,
2453
- sourceName = props.sourceName;
2454
-
2455
- var _ref = requestConfig || {},
2456
- url = _ref.url,
2457
- otherParams = _ref.otherParams,
2458
- isMap = _ref.isMap,
2459
- fixedparameter = _ref.fixedparameter,
2460
- fieldValToParam = _ref.fieldValToParam,
2461
- _ref$mappingTextField = _ref.mappingTextField,
2462
- mappingTextField = _ref$mappingTextField === void 0 ? 'name' : _ref$mappingTextField,
2463
- mappingTextShowKeyField = _ref.mappingTextShowKeyField,
2464
- _ref$mappingValueFiel = _ref.mappingValueField,
2465
- mappingValueField = _ref$mappingValueFiel === void 0 ? 'code' : _ref$mappingValueFiel;
2466
-
2467
- var resultSourceKey = sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || 'supplierCode';
2468
- var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
2469
-
2470
- var initVal = value || (selectMode ? [] : null);
2471
- var pageSize = 100; // 下拉框默认分页 条数
2472
-
2473
- var tableInitPageSize = 10; // 弹框默认分页 条数
2474
-
2475
- var currentPage = 1;
2476
- var selectParamsKey = (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.filter) || 'qp-codeAndName-like';
2477
-
2478
- var currentSelectProps = _objectSpread2(_objectSpread2({}, selectProps), {}, {
2479
- // 以下属性不可更改----设计配置项
2480
- showSearch: false,
2481
- filterOption: false,
2482
- allowClear: true,
2483
- listHeight: 160,
2484
- optionLabelProp: "label",
2485
- autoClearSearchValue: false
2486
- });
2487
-
2488
- var _useState = useState([]),
2489
- _useState2 = _slicedToArray(_useState, 2),
2490
- items = _useState2[0],
2491
- setItems = _useState2[1];
2492
-
2493
- var _useState3 = useState(1),
2494
- _useState4 = _slicedToArray(_useState3, 2),
2495
- scrollPage = _useState4[0],
2496
- setScrollPage = _useState4[1];
2497
-
2498
- var _useState5 = useState(0),
2499
- _useState6 = _slicedToArray(_useState5, 2),
2500
- itemsTotal = _useState6[0],
2501
- setItemsTotal = _useState6[1];
2502
-
2503
- var _useState7 = useState(false),
2504
- _useState8 = _slicedToArray(_useState7, 2),
2505
- fetching = _useState8[0],
2506
- setFetching = _useState8[1];
2507
-
2508
- var _useState9 = useState(''),
2509
- _useState10 = _slicedToArray(_useState9, 2),
2510
- searchValue = _useState10[0],
2511
- setSearchValue = _useState10[1];
2512
-
2513
- var _useState11 = useState(false),
2514
- _useState12 = _slicedToArray(_useState11, 2),
2515
- isModalVisible = _useState12[0],
2516
- setIsModalVisible = _useState12[1];
2517
-
2518
- var _useState13 = useState(initVal),
2519
- _useState14 = _slicedToArray(_useState13, 2),
2520
- popvalue = _useState14[0],
2521
- setPopValue = _useState14[1];
2522
-
2523
- var _useState15 = useState(sourceName),
2524
- _useState16 = _slicedToArray(_useState15, 2),
2525
- uniqueValue = _useState16[0],
2526
- setUniqueValue = _useState16[1];
2527
-
2528
- var _useDebounceFn = useDebounceFn(function (v) {
2529
- // 优化搜索参数 支持传多个
2530
- var searchParams = {};
2531
-
2532
- if (typeof selectParamsKey === 'string') {
2533
- searchParams = _defineProperty({}, selectParamsKey, v ? initVal : searchValue);
2534
- }
2535
-
2536
- if (Array.isArray(selectParamsKey)) {
2537
- selectParamsKey.forEach(function (i) {
2538
- searchParams = _objectSpread2(_objectSpread2({}, searchParams), {}, _defineProperty({}, i, searchValue));
2539
- });
2540
- } // 防抖函数 待定
2541
-
2542
-
2543
- // 防抖函数 待定
2544
- getData(searchParams);
2545
- }, {
2546
- wait: 1000
2547
- }),
2548
- run = _useDebounceFn.run;
2549
-
2550
- var _Form$useForm = Form.useForm(),
2551
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
2552
- form = _Form$useForm2[0];
2553
-
2554
- var _useState17 = useState(true),
2555
- _useState18 = _slicedToArray(_useState17, 2),
2556
- caretLeftFlag = _useState18[0],
2557
- setCaretLeftFlag = _useState18[1];
2558
-
2559
- var _useState19 = useState([]),
2560
- _useState20 = _slicedToArray(_useState19, 2),
2561
- tableData = _useState20[0],
2562
- setTableData = _useState20[1];
2563
-
2564
- var _useState21 = useState({
2565
- showQuickJumper: true,
2566
- total: 0,
2567
- current: 1,
2568
- pageSize: tableInitPageSize
2569
- }),
2570
- _useState22 = _slicedToArray(_useState21, 2),
2571
- tablePagination = _useState22[0],
2572
- setTablePagination = _useState22[1];
2573
-
2574
- var _useState23 = useState([]),
2575
- _useState24 = _slicedToArray(_useState23, 2),
2576
- selectedRowKeys = _useState24[0],
2577
- setSelectedRowKeys = _useState24[1];
2578
-
2579
- var _useState25 = useState([]),
2580
- _useState26 = _slicedToArray(_useState25, 2),
2581
- doubleArr = _useState26[0],
2582
- setDoubleArr = _useState26[1]; // 存放双数组的数组
2583
-
2584
-
2585
- var _useState27 = useState(false),
2586
- _useState28 = _slicedToArray(_useState27, 2),
2587
- checkedAll = _useState28[0],
2588
- setCheckedAll = _useState28[1];
2589
-
2590
- var _useState29 = useState(false),
2591
- _useState30 = _slicedToArray(_useState29, 2),
2592
- indeterminate = _useState30[0],
2593
- setIndeterminate = _useState30[1];
2594
-
2595
- var _useState31 = useState({}),
2596
- _useState32 = _slicedToArray(_useState31, 2),
2597
- tableFormParams = _useState32[0],
2598
- setTableFormParams = _useState32[1]; // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
2599
-
2600
-
2601
- var getData = function getData() {
2602
- var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2603
- var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2604
- if (!requestConfig) return;
2605
- setFetching(true); // 处理dependence参数
2606
-
2607
- var fixedParam = {};
2608
-
2609
- if (fixedparameter && fieldValToParam && ctx) {
2610
- fixedparameter.forEach(function (item, index) {
2611
- var fixedParamVal = ctx.form.getFieldValue(fieldValToParam[index]);
2612
-
2613
- if (fixedParamVal) {
2614
- fixedParam[item] = fixedParamVal;
2615
- }
2616
- });
2617
- }
2618
-
2619
- var queryParams = _objectSpread2(_objectSpread2(_objectSpread2({
2620
- pageSize: pageSize,
2621
- currentPage: currentPage
2622
- }, otherParams), fixedParam), params);
2623
-
2624
- axios.get("".concat(url, "?").concat(stringify(queryParams))).then(function (result) {
2625
- setFetching(false);
2626
- result = result.data;
2627
-
2628
- if (result.status !== '0') {
2629
- message.error(result.msg);
2630
- return;
2631
- }
2632
-
2633
- var res = result.data;
2634
- var source = [];
2635
-
2636
- if (isMap) {
2637
- source = Object.keys(res).map(function (d, i) {
2638
- return {
2639
- text: Object.values(res)[i],
2640
- value: d
2641
- };
2642
- });
2643
- } else {
2644
- var keys = res.list ? 'list' : 'items';
2645
- source = res ? res[keys] ? res[keys].map(function (item) {
2646
- return _objectSpread2(_objectSpread2({}, item), {}, {
2647
- text: item[mappingTextField],
2648
- textShowKey: item[mappingTextShowKeyField || mappingValueField],
2649
- value: item[mappingValueField]
2650
- });
2651
- }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2652
- return _objectSpread2(_objectSpread2({}, item), {}, {
2653
- text: item[mappingTextField],
2654
- textShowKey: item[mappingTextShowKeyField || mappingValueField],
2655
- value: item[mappingValueField]
2656
- });
2657
- })) : [];
2658
- }
2659
-
2660
- source = Array.isArray(source) ? source : [];
2661
-
2662
- if (type === 1) {
2663
- var _ctx$form;
2664
-
2665
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
2666
- setItems(source);
2667
- setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
2668
- } else {
2669
- setTableData(source);
2670
- setTablePagination(_objectSpread2(_objectSpread2({}, tablePagination), {}, {
2671
- total: Number(res === null || res === void 0 ? void 0 : res.total),
2672
- pageSize: Number(res === null || res === void 0 ? void 0 : res.size),
2673
- current: Number(res === null || res === void 0 ? void 0 : res.page)
2674
- }));
2675
- }
2676
- }).catch(function (err) {
2677
- setFetching(false);
2678
- });
2679
- };
2680
-
2681
- var SelectScroll = function SelectScroll(e) {
2682
- e.persist();
2683
- var target = e.target;
2684
- var totalPage = Math.ceil(itemsTotal / pageSize); // 判断是否滑动到底部
2685
-
2686
- var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // 判断数据是否还没有加载到了最后一页
2687
-
2688
- var canPageAdd = scrollPage < totalPage;
2689
-
2690
- if (isTouchGround && canPageAdd) {
2691
- var nextScrollPage = scrollPage + 1;
2692
- setScrollPage(nextScrollPage);
2693
- getData({
2694
- currentPage: nextScrollPage
2695
- }); // 调用api方法
2696
- }
2697
- };
2698
-
2699
- useEffect(function () {
2700
- run('init');
2701
- }, []);
2702
- useEffect(function () {
2703
- if (value) {
2704
- setPopValue(value);
2705
- onChange(value);
2706
- }
2707
- }, [value]);
2708
- useEffect(function () {
2709
- makeUniqueValue();
2710
- }, [sourceName]);
2711
-
2712
- var showModal = function showModal() {
2713
- getData({
2714
- pageSize: tableInitPageSize,
2715
- currentPage: 1
2716
- }, 2);
2717
- setIsModalVisible(true); // 回显
2718
-
2719
- if (value) {
2720
- if (selectMode) {
2721
- setSelectedRowKeys(labelInValue ? value.map(function (i) {
2722
- return i.key;
2723
- }) : value);
2724
- setPopValue(labelInValue ? value.map(function (i) {
2725
- return {
2726
- value: i.key,
2727
- text: i.label
2728
- };
2729
- }) : value.map(function (i) {
2730
- return {
2731
- value: i
2732
- };
2733
- }));
2734
- setIndeterminate(!!value.length && value.length < itemsTotal);
2735
- setCheckedAll(value.length === itemsTotal); // 需清空数据
2736
-
2737
- if (!value.length) {
2738
- setDoubleArr([]);
2739
- }
2740
- } else {
2741
- setSelectedRowKeys(labelInValue ? [value.key] : [value]);
2742
- setPopValue(labelInValue ? [{
2743
- value: value.key,
2744
- text: value.label
2745
- }] : [{
2746
- value: value
2747
- }]);
2748
- }
2749
- }
2750
- };
2751
-
2752
- var handleOk = function handleOk() {
2753
- if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
2754
- var _ctx$form2;
2755
-
2756
- formaData(popvalue); // 解决选择最后1页的sku,返回后,不显示名称问题
2757
-
2758
- var source = _.uniqBy(items.concat(popvalue), 'value');
2759
-
2760
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
2761
- setItems(source);
2762
- }
2763
-
2764
- handleCancel();
2765
- };
2766
-
2767
- var formaData = function formaData(value) {
2768
- if (labelInValue) {
2769
- var formatResult = value.map(function (i) {
2770
- return {
2771
- key: i.code,
2772
- label: i.name,
2773
- value: i.code
2774
- };
2775
- });
2776
- onChange(selectMode ? formatResult : formatResult[0]);
2777
- } else {
2778
- var _formatResult = selectMode ? value.map(function (i) {
2779
- return i.value;
2780
- }) : _.get(value[0], 'value');
2781
-
2782
- onChange(_formatResult);
2783
- }
2784
- };
2785
-
2786
- var handleCancel = function handleCancel() {
2787
- form.resetFields();
2788
- setTableFormParams({});
2789
- setIsModalVisible(false);
2790
- };
2791
-
2792
- var onSearchChange = function onSearchChange(e) {
2793
- setSearchValue(e.target.value);
2794
- run();
2795
- };
2796
-
2797
- var onSearchBlur = function onSearchBlur() {
2798
- setSearchValue('');
2799
- run();
2800
- };
2801
-
2802
- var onSearchTable = function onSearchTable() {
2803
- var params = form.getFieldsValue();
2804
- setTableFormParams(params);
2805
- getData(_objectSpread2(_objectSpread2({}, params), {}, {
2806
- pageSize: tableInitPageSize
2807
- }), 2);
2808
- };
2809
-
2810
- var onResetTable = function onResetTable() {
2811
- form.resetFields();
2812
- setTableFormParams({});
2813
- handleTableChange({
2814
- pageSize: tableInitPageSize,
2815
- currentPage: 1
2816
- });
2817
- };
2818
-
2819
- var handleTableChange = function handleTableChange(pagination) {
2820
- getData(_objectSpread2(_objectSpread2({}, tableFormParams), {}, {
2821
- pageSize: pagination.pageSize,
2822
- currentPage: pagination.current
2823
- }), 2);
2824
- };
2825
-
2826
- var onChangeCheckAll = function onChangeCheckAll(e) {
2827
- if (e.target.checked) {
2828
- // 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
2829
- if (items.length === itemsTotal) {
2830
- var currentItemsData = JSON.parse(JSON.stringify(items));
2831
- setSelectedRowKeys(currentItemsData.map(function (i) {
2832
- return i.value;
2833
- }));
2834
- setPopValue(currentItemsData);
2835
- }
2836
- } else {
2837
- setSelectedRowKeys([]);
2838
- setPopValue([]);
2839
- setDoubleArr([]);
2840
- }
2841
-
2842
- setIndeterminate(false);
2843
- setCheckedAll(e.target.checked);
2844
- };
2845
-
2846
- var LightHeightOption = function LightHeightOption(props) {
2847
- var filterTxt = props.filterTxt,
2848
- text = props.text;
2849
-
2850
- var heightLightTxt = function heightLightTxt(txt, heightTxt) {
2851
- if (heightTxt === '') {
2852
- return txt;
2853
- } // 前面filterOption 不区分大小写,这里用i
2854
-
2855
-
2856
- var regexp = new RegExp(heightTxt, 'gi');
2857
- return txt.replace(regexp, "<span style=\"color:red\">".concat(heightTxt, "</span>"));
2858
- };
2859
-
2860
- return /*#__PURE__*/React.createElement("div", {
2861
- ref: function ref(nodeElement) {
2862
- if (nodeElement) {
2863
- nodeElement.innerHTML = heightLightTxt(text, filterTxt);
2864
- }
2865
- }
2866
- });
2867
- }; // 扁平化二维数组的方法
2868
-
2869
-
2870
- var mapRows = function mapRows(params) {
2871
- var res = [];
2872
-
2873
- for (var i = 0; i < params.length; i++) {
2874
- if (Array.isArray(params[i])) {
2875
- // 去重
2876
- res = _.uniqBy(res.concat(mapRows(params[i])), 'value');
2877
- } else {
2878
- res.push(params[i]); // 去重
2879
-
2880
- res = _.uniqBy(res, 'value');
2881
- }
2882
- }
2883
-
2884
- return res.filter(Boolean); //去掉undefined的情况
2885
- };
2886
-
2887
- var onChangeSelectedKeys = function onChangeSelectedKeys(selectKeys, selectRows) {
2888
- var nowPage = tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.current;
2889
- var filterRows = []; // 存放拼接后的一维数组的变量
2890
-
2891
- var sksResult = [];
2892
-
2893
- if (selectMode) {
2894
- // 处理多选分页累计选中
2895
- // 勾选生成二维数组
2896
- doubleArr[nowPage ? nowPage - 1 : 0] = selectRows; // console.log(doubleArr)
2897
-
2898
- setDoubleArr(doubleArr); // 这块扁平化成为一位数组
2899
-
2900
- filterRows = mapRows(doubleArr); // console.log(filterRows)
2901
-
2902
- sksResult = filterRows.map(function (i) {
2903
- return i.value;
2904
- });
2905
- } else {
2906
- // 处理单选
2907
- filterRows = selectRows;
2908
- sksResult = selectRows.map(function (i) {
2909
- return i.value;
2910
- });
2911
- }
2912
-
2913
- setSelectedRowKeys(sksResult);
2914
- setPopValue(filterRows);
2915
- setIndeterminate(!!filterRows.length && filterRows.length < (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2916
- setCheckedAll(filterRows.length === (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2917
- }; // 生成唯一值
2918
-
2919
-
2920
- var makeUniqueValue = function makeUniqueValue() {
2921
- var generateUnitKey = ((1 + Math.random()) * 0x10000 | 0).toString(16);
2922
- setUniqueValue(generateUnitKey);
2923
- return generateUnitKey;
2924
- };
2925
-
2926
- var rowSelection = {
2927
- type: selectMode ? 'checkbox' : 'radio',
2928
- selectedRowKeys: selectedRowKeys,
2929
- onChange: function onChange(sks, srs) {
2930
- onChangeSelectedKeys(sks, srs);
2931
- }
2932
- };
2933
-
2934
- var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
2935
- if (!selectMode) {
2936
- var srs = [JSON.parse(JSON.stringify(record))];
2937
- var sks = srs.map(function (i) {
2938
- return i.value;
2939
- });
2940
- onChangeSelectedKeys(sks, srs);
2941
- }
2942
- };
2943
-
2944
- var themeColor = {
2945
- color: '#1890ff'
2946
- };
2947
-
2948
- var formItem = function formItem(list) {
2949
- if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
2950
- return list.map(function (i) {
2951
- var _i$field, _i$field3, _i$field5;
2952
-
2953
- if ((i === null || i === void 0 ? void 0 : i.type) === 'select' || (i === null || i === void 0 ? void 0 : (_i$field = i.field) === null || _i$field === void 0 ? void 0 : _i$field.type) === 'select') {
2954
- var _i$field2, _i$initialSource;
2955
-
2956
- return /*#__PURE__*/React.createElement(Form.Item, {
2957
- name: i.name,
2958
- label: i.label,
2959
- key: i.name
2960
- }, /*#__PURE__*/React.createElement(Select, _objectSpread2({
2961
- style: {
2962
- width: '100%'
2963
- },
2964
- placeholder: "\u8BF7\u9009\u62E9"
2965
- }, i === null || i === void 0 ? void 0 : (_i$field2 = i.field) === null || _i$field2 === void 0 ? void 0 : _i$field2.props), (i === null || i === void 0 ? void 0 : (_i$initialSource = i.initialSource) === null || _i$initialSource === void 0 ? void 0 : _i$initialSource.length) && (i === null || i === void 0 ? void 0 : i.initialSource.map(function (m) {
2966
- return /*#__PURE__*/React.createElement(Option, {
2967
- value: m.value,
2968
- key: m.value
2969
- }, m.text);
2970
- }))));
2971
- }
2972
-
2973
- if ((i === null || i === void 0 ? void 0 : i.type) === 'treeSelect' || (i === null || i === void 0 ? void 0 : (_i$field3 = i.field) === null || _i$field3 === void 0 ? void 0 : _i$field3.type) === 'treeSelect') {
2974
- var _i$field4;
2975
-
2976
- return /*#__PURE__*/React.createElement(Form.Item, {
2977
- name: i.name,
2978
- label: i.label,
2979
- key: i.name
2980
- }, /*#__PURE__*/React.createElement(TreeSelect, _objectSpread2({
2981
- style: {
2982
- width: '100%'
2983
- },
2984
- placeholder: "\u8BF7\u9009\u62E9"
2985
- }, i === null || i === void 0 ? void 0 : (_i$field4 = i.field) === null || _i$field4 === void 0 ? void 0 : _i$field4.props)));
2986
- } // 默认type是input
2987
-
2988
-
2989
- return /*#__PURE__*/React.createElement(Form.Item, {
2990
- name: i.name,
2991
- label: i.label,
2992
- key: i.name
2993
- }, /*#__PURE__*/React.createElement(Input, _objectSpread2({
2994
- style: {
2995
- width: '100%'
2996
- },
2997
- placeholder: "\u8BF7\u8F93\u5165",
2998
- allowClear: true,
2999
- maxLength: 100
3000
- }, i === null || i === void 0 ? void 0 : (_i$field5 = i.field) === null || _i$field5 === void 0 ? void 0 : _i$field5.props)));
3001
- });
3002
- } else {
3003
- return null;
3004
- }
3005
- };
3006
-
3007
- return /*#__PURE__*/React.createElement("div", {
3008
- className: 'search_select'
3009
- }, /*#__PURE__*/React.createElement("div", {
3010
- className: "search_select_show",
3011
- id: "search_select_div_".concat(uniqueValue)
3012
- }, /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
3013
- virtual: true,
3014
- labelInValue: labelInValue,
3015
- value: value,
3016
- onChange: onChange,
3017
- dropdownRender: function dropdownRender(menu) {
3018
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
3019
- value: searchValue,
3020
- style: {
3021
- width: '98%',
3022
- marginLeft: '1%'
3023
- },
3024
- placeholder: "\u8BF7\u8F93\u5165",
3025
- onChange: function onChange(e) {
3026
- return onSearchChange(e);
3027
- },
3028
- onBlur: onSearchBlur,
3029
- onKeyDown: function onKeyDown(e) {
3030
- // 阻止多选的冒泡
3031
- e.stopPropagation();
3032
- }
3033
- }), /*#__PURE__*/React.createElement(Divider, {
3034
- style: {
3035
- margin: '8px 0'
3036
- }
3037
- }), menu);
3038
- },
3039
- notFoundContent: fetching ? /*#__PURE__*/React.createElement(Spin, {
3040
- size: "small"
3041
- }) : /*#__PURE__*/React.createElement("div", {
3042
- style: {
3043
- textAlign: 'center'
3044
- }
3045
- }, /*#__PURE__*/React.createElement("div", {
3046
- style: {
3047
- marginBottom: 16
3048
- }
3049
- }, /*#__PURE__*/React.createElement(CopyOutlined$2, {
3050
- style: {
3051
- fontSize: '50px'
3052
- }
3053
- })), /*#__PURE__*/React.createElement("div", null, "\u65E0\u5339\u914D\u7ED3\u679C\uFF0C\u8BF7\u66F4\u6362\u5176\u4ED6\u5185\u5BB9\u518D\u8BD5")),
3054
- onPopupScroll: SelectScroll
3055
- }, currentSelectProps), {}, {
3056
- getPopupContainer: function getPopupContainer() {
3057
- return document.getElementById("search_select_div_".concat(uniqueValue));
3058
- },
3059
- style: {
3060
- width: 'calc(100% - 30px)'
3061
- },
3062
- placeholder: "\u8BF7\u9009\u62E9"
3063
- }), items.map(function (item) {
3064
- return /*#__PURE__*/React.createElement(Option, {
3065
- key: item.value,
3066
- label: item.text
3067
- }, LightHeightOption({
3068
- text: "".concat(item.textShowKey, " ").concat(item.text),
3069
- filterTxt: searchValue
3070
- }));
3071
- })), /*#__PURE__*/React.createElement(Button, {
3072
- style: {
3073
- width: '30px',
3074
- padding: '2px',
3075
- height: 'auto'
3076
- },
3077
- onClick: showModal,
3078
- type: "primary"
3079
- }, /*#__PURE__*/React.createElement(SearchOutlined$2, null))), /*#__PURE__*/React.createElement(Modal, {
3080
- width: '80%',
3081
- title: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalTableTitle,
3082
- visible: isModalVisible,
3083
- onOk: handleOk,
3084
- onCancel: handleCancel,
3085
- footer: [/*#__PURE__*/React.createElement(Button, {
3086
- key: "back",
3087
- onClick: handleCancel
3088
- }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
3089
- key: "submit",
3090
- type: "primary",
3091
- onClick: handleOk,
3092
- disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
3093
- }, "\u786E\u5B9A")]
3094
- }, /*#__PURE__*/React.createElement("div", {
3095
- className: 'search_select_wrapper'
3096
- }, /*#__PURE__*/React.createElement("div", {
3097
- className: 'search_select_wrapper_click_flag',
3098
- onClick: function onClick() {
3099
- return setCaretLeftFlag(!caretLeftFlag);
3100
- }
3101
- }, /*#__PURE__*/React.createElement(CaretLeftOutlined$2, {
3102
- className: caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'
3103
- })), /*#__PURE__*/React.createElement("div", {
3104
- className: caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'
3105
- }, /*#__PURE__*/React.createElement("div", {
3106
- className: 'select_list_columns'
3107
- }, /*#__PURE__*/React.createElement("div", {
3108
- className: 'select_list_columns_tips'
3109
- }, "\u641C\u7D22"), /*#__PURE__*/React.createElement("div", {
3110
- className: 'select_list_columns_formItems'
3111
- }, /*#__PURE__*/React.createElement(Form, {
3112
- form: form,
3113
- layout: 'vertical',
3114
- key: 'modalForm'
3115
- }, formItem(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableSearchForm)))), /*#__PURE__*/React.createElement("div", {
3116
- className: 'select_list_searchButton'
3117
- }, /*#__PURE__*/React.createElement(Button, {
3118
- key: 'reset',
3119
- className: 'select_list_button_space',
3120
- onClick: onResetTable
3121
- }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
3122
- key: 'search',
3123
- type: "primary",
3124
- onClick: onSearchTable
3125
- }, "\u67E5\u8BE2"))), /*#__PURE__*/React.createElement("div", {
3126
- className: caretLeftFlag ? 'search_select_wrapper_right' : 'search_select_wrapper_right1'
3127
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
3128
- className: 'select_list_selectTips'
3129
- }, /*#__PURE__*/React.createElement("div", {
3130
- style: {
3131
- marginLeft: 8
3132
- }
3133
- }, "\u641C\u7D22\u7ED3\u679C\u5171", /*#__PURE__*/React.createElement("span", {
3134
- style: themeColor
3135
- }, (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total) || 0), "\u9879", selectMode ? /*#__PURE__*/React.createElement("span", null, "\uFF0C \u672C\u6B21\u5DF2\u9009", /*#__PURE__*/React.createElement("span", {
3136
- style: themeColor
3137
- }, (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || 0), "\u9879") : ''), /*#__PURE__*/React.createElement("div", {
3138
- style: {
3139
- color: 'rgba(127, 127, 127, 0.6470588235294118)'
3140
- }
3141
- }, selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或点击单选图标完成选择')), /*#__PURE__*/React.createElement(Table, {
3142
- size: 'small',
3143
- rowSelection: rowSelection,
3144
- columns: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns,
3145
- dataSource: tableData,
3146
- pagination: tablePagination,
3147
- onChange: handleTableChange,
3148
- rowKey: mappingValueField,
3149
- scroll: {
3150
- x: modalTableProps.overScrollX || 'max-content',
3151
- y: modalTableProps.overScrollY || null
3152
- },
3153
- onRow: function onRow(record) {
3154
- return {
3155
- onDoubleClick: function onDoubleClick(event) {
3156
- return onDoubleClickSelect(event, record);
3157
- }
3158
- };
3159
- }
3160
- }), selectMode ? /*#__PURE__*/React.createElement("div", {
3161
- className: 'select_list_selectAll'
3162
- }, /*#__PURE__*/React.createElement(Checkbox, {
3163
- indeterminate: indeterminate,
3164
- checked: checkedAll,
3165
- onChange: onChangeCheckAll
3166
- }), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
3167
- };
3168
-
3169
- var getDicData = function getDicData(dicCode) {
3170
- var dicData = {};
3171
-
3172
- {
3173
- var storageDic = localStorage.getItem('dicData') ? JSON.parse(localStorage.getItem('dicData') || '{}') : {};
3174
- dicData = storageDic[dicCode];
3175
- }
3176
-
3177
- if (!dicData || !dicData.length) ;
3178
-
3179
- return dicData;
3180
- };
3181
-
3182
- var getDictionarySource = function getDictionarySource(dicCode) {
3183
- var needConvertInterger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3184
- var dicData = getDicData(dicCode);
3185
-
3186
- try {
3187
- if (needConvertInterger) {
3188
- dicData = dicData.map(function (item) {
3189
- return _objectSpread2(_objectSpread2({}, item), {}, {
3190
- value: parseFloat(item.value)
3191
- });
3192
- });
3193
- }
3194
- } catch (e) {}
3195
-
3196
- return dicData;
3197
- };
3198
-
3199
- var getDictionaryTextByValue = function getDictionaryTextByValue(dicCode, value) {
3200
- var dicData = getDicData(dicCode);
3201
- if (value === undefined) return '';
3202
- var dicItemArray = dicData === null || dicData === void 0 ? void 0 : dicData.filter(function (item) {
3203
- return item.value === value.toString();
3204
- });
3205
-
3206
- if (!(dicItemArray === null || dicItemArray === void 0 ? void 0 : dicItemArray.length)) {
3207
- // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
3208
- return value;
3209
- }
3210
-
3211
- return dicItemArray[0].text;
3212
- };
3213
-
3214
- var loadSelectSource = function loadSelectSource(url, params) {
3215
- return new Promise(function (resolve, reject) {
3216
- axios.get("".concat(url, "?").concat(stringify(params))).then(function (result) {
3217
- result = result.data;
3218
-
3219
- if (result.status !== '0') {
3220
- message.error(result.msg);
3221
- return;
3222
- }
3223
-
3224
- resolve(result);
3225
- }).catch(function (err) {
3226
- reject(err);
3227
- });
3228
- });
3229
- };
3230
-
3231
- function commonFun(type, prefixUrl) {
3232
- // 默认type === 'supplier' 供应商选择器
3233
- var requestConfig = {
3234
- url: "".concat(prefixUrl.selectPrefix, "/supplier"),
3235
- filter: 'qp-nameAndCode-like',
3236
- otherParams: {
3237
- sorter: 'desc-id'
3238
- } // 默认参数
3239
-
3240
- };
3241
- /*
3242
- * 处理 格式化下拉框数据源
3243
- * reData 必传 promise返回响应的数据 格式为[{},{},{},...] Promise.all第一个参数数组有多少个数组长度就是多少,其中每个对象为每次请求的结果数据
3244
- * 每个结果数据格式为{ status: '0', msg: 'success', data: { items: [], total: 1, size: 1, page: 1 }, traceId: 'baba..'}
3245
- * position 必传 为获取Promise.all请求结果的位置
3246
- * changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
3247
- * changeSearchForm 必传 为搜索表单Form数据
3248
- * */
3249
-
3250
- var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
3251
- var _reData$position;
3252
-
3253
- var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['code', 'name'];
3254
- var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : _reData$position.data);
3255
- var list = Array.isArray(data) ? data : (data === null || data === void 0 ? void 0 : data.items) || (data === null || data === void 0 ? void 0 : data.list) || [];
3256
- var formatData = (list === null || list === void 0 ? void 0 : list.length) ? list.map(function (v) {
3257
- return {
3258
- text: v[resKeyValue[1]],
3259
- value: v[resKeyValue[0]]
3260
- };
3261
- }) : [];
3262
- changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
3263
- initialSource: formatData
3264
- });
3265
- }; // 格式化树选择器数据源
3266
-
3267
-
3268
- var mapSearchTree = function mapSearchTree(treeDataItem, resKeyValue) {
3269
- var haveChildren = Array.isArray(treeDataItem.children) && treeDataItem.children.length > 0;
3270
- return {
3271
- title: treeDataItem[resKeyValue[1]],
3272
- key: treeDataItem[resKeyValue[0]],
3273
- parentId: treeDataItem.parent,
3274
- data: _objectSpread2({}, treeDataItem),
3275
- isLeaf: !haveChildren,
3276
- disabled: haveChildren,
3277
- children: haveChildren ? treeDataItem.children.map(function (i) {
3278
- return mapSearchTree(i, resKeyValue);
3279
- }) : []
3280
- };
3281
- };
3282
-
3283
- var formatTreeDataSource = function formatTreeDataSource(reData, position, changePosition, changeSearchForm) {
3284
- var _reData$position2;
3285
-
3286
- var resKeyValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ['id', 'name'];
3287
- var data = reData && ((_reData$position2 = reData[position]) === null || _reData$position2 === void 0 ? void 0 : _reData$position2.data);
3288
- var formatData = data && Array.isArray(data) && data.length && data.map(function (ites) {
3289
- return mapSearchTree(ites, resKeyValue);
3290
- }) || [];
3291
- changeSearchForm[changePosition].field.props.treeData = formatData;
3292
- };
3293
-
3294
- var tableSearchForm = [];
3295
-
3296
- if (type === 'supplier') {
3297
- tableSearchForm = [{
3298
- name: 'qp-name-like',
3299
- label: '客户名称'
3300
- }, {
3301
- name: 'qp-code-like',
3302
- label: '客户编码'
3303
- }, {
3304
- name: 'qp-conglomerateCode-in',
3305
- type: 'select',
3306
- label: '归属集团',
3307
- field: {
3308
- type: 'select',
3309
- props: {
3310
- mode: 'multiple',
3311
- notFoundContent: '暂无数据',
3312
- allowClear: true,
3313
- showSearch: true,
3314
- showArrow: true,
3315
- maxTagCount: 1,
3316
- optionFilterProp: 'children',
3317
- filterOption: function filterOption(input, option) {
3318
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3319
- }
3320
- }
3321
- }
3322
- }, {
3323
- name: 'qp-accountingCode-in',
3324
- type: 'select',
3325
- label: '归属核算主体',
3326
- field: {
3327
- type: 'select',
3328
- props: {
3329
- mode: 'multiple',
3330
- notFoundContent: '暂无数据',
3331
- allowClear: true,
3332
- showSearch: true,
3333
- showArrow: true,
3334
- maxTagCount: 1,
3335
- optionFilterProp: 'children',
3336
- filterOption: function filterOption(input, option) {
3337
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3338
- }
3339
- }
3340
- }
3341
- }, {
3342
- name: 'qp-companyCode-in',
3343
- type: 'select',
3344
- label: '归属法人公司',
3345
- field: {
3346
- type: 'select',
3347
- props: {
3348
- mode: 'multiple',
3349
- notFoundContent: '暂无数据',
3350
- allowClear: true,
3351
- showSearch: true,
3352
- showArrow: true,
3353
- maxTagCount: 1,
3354
- optionFilterProp: 'children',
3355
- filterOption: function filterOption(input, option) {
3356
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3357
- }
3358
- }
3359
- }
3360
- }, {
3361
- name: 'qp-sharingType-eq',
3362
- type: 'select',
3363
- label: '共享类型',
3364
- initialSource: getDictionarySource('UC000013')
3365
- }];
3366
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
3367
- pageSize: 5000,
3368
- currentPage: 1,
3369
- 'qp-companyType-eq': '30'
3370
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/accountingSubject"), {
3371
- pageSize: 5000,
3372
- currentPage: 1
3373
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
3374
- pageSize: 5000,
3375
- currentPage: 1,
3376
- 'qp-companyType-eq': '20'
3377
- })]).then(function (x) {
3378
- formatSource(x, 0, 2, tableSearchForm);
3379
- formatSource(x, 1, 3, tableSearchForm);
3380
- formatSource(x, 2, 4, tableSearchForm);
3381
- });
3382
- }
3383
-
3384
- var modalTableProps = {
3385
- modalTableTitle: '选择供应商',
3386
- tableSearchForm: tableSearchForm,
3387
- tableColumns: [{
3388
- title: '客户编码',
3389
- dataIndex: 'code'
3390
- }, {
3391
- title: '客户名称',
3392
- dataIndex: 'name'
3393
- }, {
3394
- title: '归属集团',
3395
- dataIndex: 'conglomerateName'
3396
- }, {
3397
- title: '归属法人公司',
3398
- dataIndex: 'legalCompanyName'
3399
- }, {
3400
- title: '归属核算主体',
3401
- dataIndex: 'accountingName'
3402
- }, {
3403
- title: '共享类型',
3404
- dataIndex: 'sharingType',
3405
- render: function render(text) {
3406
- return getDictionaryTextByValue('UC000013', text);
3407
- }
3408
- }]
3409
- }; // 商品选择器
3410
-
3411
- if (type === 'skuCommodity') {
3412
- requestConfig = {
3413
- url: "".concat(prefixUrl.selectPrefix, "/sku"),
3414
- filter: 'qp-nameAndCode-like',
3415
- mappingTextField: 'name',
3416
- mappingValueField: 'skuCode',
3417
- otherParams: {
3418
- 'qp-approveStatus-eq': 2,
3419
- sorter: 'desc-id'
3420
- },
3421
- sourceName: 'skuCode'
3422
- };
3423
- tableSearchForm = [{
3424
- name: 'qp-name-like',
3425
- label: 'SKU名称'
3426
- }, {
3427
- name: 'qp-skuCode-like',
3428
- label: 'SKU编码'
3429
- }, {
3430
- name: 'qp-barCode-like',
3431
- label: '条形码'
3432
- }, {
3433
- name: 'qp-itemName-like',
3434
- label: '所属SPU名称'
3435
- }, {
3436
- name: 'qp-itemCode-like',
3437
- label: '所属SPU编码'
3438
- }, {
3439
- name: 'qp-brandId-in',
3440
- type: 'select',
3441
- label: '品牌',
3442
- field: {
3443
- type: 'select',
3444
- props: {
3445
- mode: 'multiple',
3446
- notFoundContent: '暂无数据',
3447
- allowClear: true,
3448
- showSearch: true,
3449
- showArrow: true,
3450
- maxTagCount: 1,
3451
- optionFilterProp: 'children',
3452
- filterOption: function filterOption(input, option) {
3453
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3454
- }
3455
- }
3456
- }
3457
- }, {
3458
- name: 'qp-categoryId-in',
3459
- type: 'treeSelect',
3460
- label: '类目',
3461
- field: {
3462
- type: 'treeSelect',
3463
- props: {
3464
- treeData: [],
3465
- treeCheckable: true,
3466
- showSearch: true,
3467
- allowClear: true,
3468
- showArrow: true,
3469
- treeNodeFilterProp: 'title',
3470
- treeDefaultExpandAll: true,
3471
- maxTagCount: 1,
3472
- placeholder: '请选择',
3473
- style: {
3474
- width: '100%'
3475
- },
3476
- dropdownStyle: {
3477
- maxHeight: 400,
3478
- maxWidth: 100,
3479
- overflow: 'auto'
3480
- }
3481
- }
3482
- }
3483
- }, {
3484
- name: 'qp-classId-in',
3485
- type: 'select',
3486
- label: '品类',
3487
- field: {
3488
- type: 'select',
3489
- props: {
3490
- mode: 'multiple',
3491
- notFoundContent: '暂无数据',
3492
- allowClear: true,
3493
- showSearch: true,
3494
- showArrow: true,
3495
- maxTagCount: 1,
3496
- optionFilterProp: 'children',
3497
- filterOption: function filterOption(input, option) {
3498
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3499
- }
3500
- }
3501
- }
3502
- }];
3503
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/brand/queryBrandList"), {
3504
- pageSize: 5000,
3505
- currentPage: 1
3506
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/category/queryCategoryTree"), {
3507
- pageSize: 5000,
3508
- currentPage: 1
3509
- }), loadSelectSource("".concat(prefixUrl.formSelectFix, "/class/withProperty"), {
3510
- pageSize: 5000,
3511
- currentPage: 1
3512
- })]).then(function (x) {
3513
- formatSource(x, 0, 5, tableSearchForm, ['id', 'name']);
3514
- formatTreeDataSource(x, 1, 6, tableSearchForm);
3515
- formatSource(x, 2, 7, tableSearchForm, ['id', 'name']);
3516
- });
3517
- modalTableProps = {
3518
- modalTableTitle: '选择SKU',
3519
- tableSearchForm: tableSearchForm,
3520
- tableColumns: [{
3521
- title: 'SKU编码',
3522
- dataIndex: 'skuCode'
3523
- }, {
3524
- title: 'SKU名称',
3525
- dataIndex: 'name'
3526
- }, {
3527
- title: '所属SPU',
3528
- dataIndex: 'itemName'
3529
- }, {
3530
- title: '规格',
3531
- dataIndex: 'skuSpec'
3532
- }, {
3533
- title: '类目',
3534
- dataIndex: 'categoryName'
3535
- }, {
3536
- title: '品类',
3537
- dataIndex: 'className'
3538
- }, {
3539
- title: '品牌',
3540
- dataIndex: 'brandName'
3541
- }, {
3542
- title: '条形码',
3543
- dataIndex: 'barCode'
3544
- }]
3545
- };
3546
- } // 仓库选择器
3547
-
3548
-
3549
- if (type === 'physicalWarehouse') {
3550
- requestConfig = {
3551
- url: "".concat(prefixUrl.selectPrefix, "/physicalWarehouse"),
3552
- filter: 'qp-nameAndCode-like',
3553
- mappingTextField: 'physicalWarehouseName',
3554
- mappingTextShowKeyField: 'physicalWarehouseCode',
3555
- mappingValueField: 'id',
3556
- otherParams: {
3557
- sorter: 'desc-id'
3558
- },
3559
- sourceName: 'warehouseIds'
3560
- };
3561
- tableSearchForm = [{
3562
- name: 'qp-physicalWarehouseName-like',
3563
- label: '物理仓名称'
3564
- }, {
3565
- name: 'qp-physicalWarehouseCode-like',
3566
- label: '物理仓编码'
3567
- }, {
3568
- name: 'qp-physicalWarehouseType-eq',
3569
- type: 'select',
3570
- label: '物理仓类型',
3571
- initialSource: getDictionarySource('SC00002')
3572
- }, {
3573
- name: 'qp-companyCode-eq',
3574
- type: 'select',
3575
- label: '所属公司',
3576
- field: {
3577
- type: 'select',
3578
- props: {
3579
- mode: 'multiple',
3580
- notFoundContent: '暂无数据',
3581
- allowClear: true,
3582
- showSearch: true,
3583
- showArrow: true,
3584
- maxTagCount: 1,
3585
- optionFilterProp: 'children',
3586
- filterOption: function filterOption(input, option) {
3587
- return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3588
- }
3589
- }
3590
- }
3591
- }, {
3592
- name: 'qp-isEnable-eq',
3593
- type: 'select',
3594
- label: '物理仓状态',
3595
- initialSource: getDictionarySource('SC00001')
3596
- }];
3597
- Promise.all([loadSelectSource("".concat(prefixUrl.formSelectFix, "/company"), {
3598
- pageSize: 5000,
3599
- currentPage: 1,
3600
- 'qp-companyType-eq': 20
3601
- })]).then(function (x) {
3602
- formatSource(x, 0, 3, tableSearchForm);
3603
- });
3604
- modalTableProps = {
3605
- modalTableTitle: '选择物理仓',
3606
- tableSearchForm: tableSearchForm,
3607
- tableColumns: [{
3608
- title: '物理仓编码',
3609
- dataIndex: 'physicalWarehouseCode'
3610
- }, {
3611
- title: '物理仓名称',
3612
- dataIndex: 'physicalWarehouseName'
3613
- }, {
3614
- title: '物理仓类型',
3615
- dataIndex: 'physicalWarehouseType',
3616
- render: function render(text) {
3617
- return getDictionaryTextByValue('SC00002', text);
3618
- }
3619
- }, {
3620
- title: '物理仓状态',
3621
- dataIndex: 'isEnable',
3622
- render: function render(text) {
3623
- return getDictionaryTextByValue('SC00001', text);
3624
- }
3625
- }, {
3626
- title: '所属公司',
3627
- dataIndex: 'companyName'
3628
- }]
3629
- };
3630
- }
3631
-
3632
- if (type === 'realWarehouse') {
3633
- requestConfig = {
3634
- url: "".concat(prefixUrl.selectPrefix, "/realWarehouse"),
3635
- filter: 'qp-nameAndCode-like',
3636
- mappingTextField: 'realWarehouseName',
3637
- mappingTextShowKeyField: 'realWarehouseCode',
3638
- mappingValueField: 'id',
3639
- otherParams: {
3640
- sorter: 'desc-id'
3641
- },
3642
- sourceName: 'warehouseIds'
3643
- };
3644
- tableSearchForm = [{
3645
- name: 'qp-realWarehouseName-like',
3646
- label: '逻辑仓名称'
3647
- }, {
3648
- name: 'qp-realWarehouseCode-like',
3649
- label: '逻辑仓编码'
3650
- }, {
3651
- name: 'qp-realWarehouseType-eq',
3652
- type: 'select',
3653
- label: '逻辑仓类型',
3654
- initialSource: getDictionarySource('SC00004')
3655
- }, {
3656
- name: 'qp-isEnable-eq',
3657
- type: 'select',
3658
- label: '逻辑仓状态',
3659
- initialSource: getDictionarySource('SC00001')
3660
- }];
3661
- modalTableProps = {
3662
- modalTableTitle: '选择逻辑仓',
3663
- tableSearchForm: tableSearchForm,
3664
- tableColumns: [{
3665
- title: '逻辑仓编码',
3666
- dataIndex: 'realWarehouseCode'
3667
- }, {
3668
- title: '逻辑仓名称',
3669
- dataIndex: 'realWarehouseName'
3670
- }, {
3671
- title: '逻辑仓类型',
3672
- dataIndex: 'realWarehouseType',
3673
- render: function render(text) {
3674
- return getDictionaryTextByValue('SC00004', text);
3675
- }
3676
- }, {
3677
- title: '逻辑仓状态',
3678
- dataIndex: 'isEnable',
3679
- render: function render(text) {
3680
- return getDictionaryTextByValue('SC00001', text);
3681
- }
3682
- }]
3683
- };
3684
- }
3685
-
3686
- return {
3687
- modalTableProps: modalTableProps,
3688
- requestConfig: requestConfig
3689
- };
3690
- }
3691
-
3692
- var BusinessSearchSelect = function BusinessSearchSelect(props) {
3693
- var businessType = (props === null || props === void 0 ? void 0 : props.selectBusinessType) || 'supplier';
3694
- var prefixUrl = (props === null || props === void 0 ? void 0 : props.prefixUrl) || {
3695
- selectPrefix: '/bop/api',
3696
- formSelectFix: '/bop/api'
3697
- };
3698
-
3699
- var _commonFun = commonFun(businessType, prefixUrl),
3700
- requestConfig = _commonFun.requestConfig,
3701
- modalTableProps = _commonFun.modalTableProps;
3702
-
3703
- var currentProps = _objectSpread2(_objectSpread2({
3704
- requestConfig: requestConfig
3705
- }, props), {}, {
3706
- modalTableProps: modalTableProps
3707
- });
3708
-
3709
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SearchSelect, _objectSpread2({}, currentProps)));
3710
- };
3711
-
3712
- /*
3713
- * @Description:
3714
- * @Author: rodchen
3715
- * @Date: 2021-11-30 22:59:39
3716
- * @LastEditTime: 2022-01-14 16:10:27
3717
- * @LastEditors: rodchen
3718
- */
3719
-
3720
- var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
3721
- axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
3722
-
3723
- export { BusinessSearchSelect, index as CheckOneUser, DataValidation, QueryMutipleInput, SearchSelect };