@bit-sun/business-component 1.1.2 → 1.1.6

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.
@@ -0,0 +1,3397 @@
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 } 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
+ function updateCSS(css, key) {
1269
+ var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1270
+ var container = getContainer(option); // Get real parent
1271
+
1272
+ if (!containerCache.has(container)) {
1273
+ var placeholderStyle = injectCSS('', option);
1274
+ var parentNode = placeholderStyle.parentNode;
1275
+ containerCache.set(container, parentNode);
1276
+ parentNode.removeChild(placeholderStyle);
1277
+ }
1278
+
1279
+ var existNode = Array.from(containerCache.get(container).children).find(function (node) {
1280
+ return node.tagName === 'STYLE' && node[MARK_KEY] === key;
1281
+ });
1282
+
1283
+ if (existNode) {
1284
+ var _option$csp3, _option$csp4;
1285
+
1286
+ 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)) {
1287
+ var _option$csp5;
1288
+
1289
+ existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
1290
+ }
1291
+
1292
+ if (existNode.innerHTML !== css) {
1293
+ existNode.innerHTML = css;
1294
+ }
1295
+
1296
+ return existNode;
1297
+ }
1298
+
1299
+ var newNode = injectCSS(css, option);
1300
+ newNode[MARK_KEY] = key;
1301
+ return newNode;
1302
+ }
1303
+
1304
+ function warning$1(valid, message) {
1305
+ warningOnce(valid, "[@ant-design/icons] ".concat(message));
1306
+ }
1307
+ function isIconDefinition(target) {
1308
+ return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
1309
+ }
1310
+ function normalizeAttrs() {
1311
+ var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1312
+ return Object.keys(attrs).reduce(function (acc, key) {
1313
+ var val = attrs[key];
1314
+
1315
+ switch (key) {
1316
+ case 'class':
1317
+ acc.className = val;
1318
+ delete acc.class;
1319
+ break;
1320
+
1321
+ default:
1322
+ acc[key] = val;
1323
+ }
1324
+
1325
+ return acc;
1326
+ }, {});
1327
+ }
1328
+ function generate$1(node, key, rootProps) {
1329
+ if (!rootProps) {
1330
+ return /*#__PURE__*/React.createElement(node.tag, _objectSpread2$1({
1331
+ key: key
1332
+ }, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
1333
+ return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1334
+ }));
1335
+ }
1336
+
1337
+ return /*#__PURE__*/React.createElement(node.tag, _objectSpread2$1(_objectSpread2$1({
1338
+ key: key
1339
+ }, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
1340
+ return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
1341
+ }));
1342
+ }
1343
+ function getSecondaryColor(primaryColor) {
1344
+ // choose the second color
1345
+ return generate(primaryColor)[0];
1346
+ }
1347
+ function normalizeTwoToneColors(twoToneColor) {
1348
+ if (!twoToneColor) {
1349
+ return [];
1350
+ }
1351
+
1352
+ return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
1353
+ } // These props make sure that the SVG behaviours like general text.
1354
+ 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";
1355
+ var useInsertStyles = function useInsertStyles() {
1356
+ var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
1357
+
1358
+ var _useContext = useContext(IconContext),
1359
+ csp = _useContext.csp;
1360
+
1361
+ useEffect(function () {
1362
+ updateCSS(styleStr, '@ant-design-icons', {
1363
+ prepend: true,
1364
+ csp: csp
1365
+ });
1366
+ }, []);
1367
+ };
1368
+
1369
+ var _excluded = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
1370
+ var twoToneColorPalette = {
1371
+ primaryColor: '#333',
1372
+ secondaryColor: '#E6E6E6',
1373
+ calculated: false
1374
+ };
1375
+
1376
+ function setTwoToneColors(_ref) {
1377
+ var primaryColor = _ref.primaryColor,
1378
+ secondaryColor = _ref.secondaryColor;
1379
+ twoToneColorPalette.primaryColor = primaryColor;
1380
+ twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
1381
+ twoToneColorPalette.calculated = !!secondaryColor;
1382
+ }
1383
+
1384
+ function getTwoToneColors() {
1385
+ return _objectSpread2$1({}, twoToneColorPalette);
1386
+ }
1387
+
1388
+ var IconBase = function IconBase(props) {
1389
+ var icon = props.icon,
1390
+ className = props.className,
1391
+ onClick = props.onClick,
1392
+ style = props.style,
1393
+ primaryColor = props.primaryColor,
1394
+ secondaryColor = props.secondaryColor,
1395
+ restProps = _objectWithoutProperties$1(props, _excluded);
1396
+
1397
+ var colors = twoToneColorPalette;
1398
+
1399
+ if (primaryColor) {
1400
+ colors = {
1401
+ primaryColor: primaryColor,
1402
+ secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
1403
+ };
1404
+ }
1405
+
1406
+ useInsertStyles();
1407
+ warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
1408
+
1409
+ if (!isIconDefinition(icon)) {
1410
+ return null;
1411
+ }
1412
+
1413
+ var target = icon;
1414
+
1415
+ if (target && typeof target.icon === 'function') {
1416
+ target = _objectSpread2$1(_objectSpread2$1({}, target), {}, {
1417
+ icon: target.icon(colors.primaryColor, colors.secondaryColor)
1418
+ });
1419
+ }
1420
+
1421
+ return generate$1(target.icon, "svg-".concat(target.name), _objectSpread2$1({
1422
+ className: className,
1423
+ onClick: onClick,
1424
+ style: style,
1425
+ 'data-icon': target.name,
1426
+ width: '1em',
1427
+ height: '1em',
1428
+ fill: 'currentColor',
1429
+ 'aria-hidden': 'true'
1430
+ }, restProps));
1431
+ };
1432
+
1433
+ IconBase.displayName = 'IconReact';
1434
+ IconBase.getTwoToneColors = getTwoToneColors;
1435
+ IconBase.setTwoToneColors = setTwoToneColors;
1436
+
1437
+ function setTwoToneColor(twoToneColor) {
1438
+ var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1439
+ _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
1440
+ primaryColor = _normalizeTwoToneColo2[0],
1441
+ secondaryColor = _normalizeTwoToneColo2[1];
1442
+
1443
+ return IconBase.setTwoToneColors({
1444
+ primaryColor: primaryColor,
1445
+ secondaryColor: secondaryColor
1446
+ });
1447
+ }
1448
+ function getTwoToneColor() {
1449
+ var colors = IconBase.getTwoToneColors();
1450
+
1451
+ if (!colors.calculated) {
1452
+ return colors.primaryColor;
1453
+ }
1454
+
1455
+ return [colors.primaryColor, colors.secondaryColor];
1456
+ }
1457
+
1458
+ var _excluded$1 = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
1459
+ // should move it to antd main repo?
1460
+
1461
+ setTwoToneColor('#1890ff');
1462
+ var Icon = /*#__PURE__*/forwardRef(function (props, ref) {
1463
+ var _classNames;
1464
+
1465
+ var className = props.className,
1466
+ icon = props.icon,
1467
+ spin = props.spin,
1468
+ rotate = props.rotate,
1469
+ tabIndex = props.tabIndex,
1470
+ onClick = props.onClick,
1471
+ twoToneColor = props.twoToneColor,
1472
+ restProps = _objectWithoutProperties$1(props, _excluded$1);
1473
+
1474
+ var _React$useContext = useContext(IconContext),
1475
+ _React$useContext$pre = _React$useContext.prefixCls,
1476
+ prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
1477
+
1478
+ 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);
1479
+ var iconTabIndex = tabIndex;
1480
+
1481
+ if (iconTabIndex === undefined && onClick) {
1482
+ iconTabIndex = -1;
1483
+ }
1484
+
1485
+ var svgStyle = rotate ? {
1486
+ msTransform: "rotate(".concat(rotate, "deg)"),
1487
+ transform: "rotate(".concat(rotate, "deg)")
1488
+ } : undefined;
1489
+
1490
+ var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
1491
+ _normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
1492
+ primaryColor = _normalizeTwoToneColo2[0],
1493
+ secondaryColor = _normalizeTwoToneColo2[1];
1494
+
1495
+ return /*#__PURE__*/createElement("span", _objectSpread2$1(_objectSpread2$1({
1496
+ role: "img",
1497
+ "aria-label": icon.name
1498
+ }, restProps), {}, {
1499
+ ref: ref,
1500
+ tabIndex: iconTabIndex,
1501
+ onClick: onClick,
1502
+ className: classString
1503
+ }), /*#__PURE__*/createElement(IconBase, {
1504
+ icon: icon,
1505
+ primaryColor: primaryColor,
1506
+ secondaryColor: secondaryColor,
1507
+ style: svgStyle
1508
+ }));
1509
+ });
1510
+ Icon.displayName = 'AntdIcon';
1511
+ Icon.getTwoToneColor = getTwoToneColor;
1512
+ Icon.setTwoToneColor = setTwoToneColor;
1513
+
1514
+ // This icon file is generated automatically.
1515
+ 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" };
1516
+
1517
+ var CaretLeftOutlined$1 = function CaretLeftOutlined$1(props, ref) {
1518
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1519
+ ref: ref,
1520
+ icon: CaretLeftOutlined
1521
+ }));
1522
+ };
1523
+
1524
+ CaretLeftOutlined$1.displayName = 'CaretLeftOutlined';
1525
+ var CaretLeftOutlined$2 = /*#__PURE__*/forwardRef(CaretLeftOutlined$1);
1526
+
1527
+ // This icon file is generated automatically.
1528
+ 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" };
1529
+
1530
+ var CopyOutlined$1 = function CopyOutlined$1(props, ref) {
1531
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1532
+ ref: ref,
1533
+ icon: CopyOutlined
1534
+ }));
1535
+ };
1536
+
1537
+ CopyOutlined$1.displayName = 'CopyOutlined';
1538
+ var CopyOutlined$2 = /*#__PURE__*/forwardRef(CopyOutlined$1);
1539
+
1540
+ // This icon file is generated automatically.
1541
+ 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" };
1542
+
1543
+ var DownOutlined$1 = function DownOutlined$1(props, ref) {
1544
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1545
+ ref: ref,
1546
+ icon: DownOutlined
1547
+ }));
1548
+ };
1549
+
1550
+ DownOutlined$1.displayName = 'DownOutlined';
1551
+ var DownOutlined$2 = /*#__PURE__*/forwardRef(DownOutlined$1);
1552
+
1553
+ // This icon file is generated automatically.
1554
+ 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" };
1555
+
1556
+ var ExclamationCircleOutlined$1 = function ExclamationCircleOutlined$1(props, ref) {
1557
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1558
+ ref: ref,
1559
+ icon: ExclamationCircleOutlined
1560
+ }));
1561
+ };
1562
+
1563
+ ExclamationCircleOutlined$1.displayName = 'ExclamationCircleOutlined';
1564
+ var ExclamationCircleOutlined$2 = /*#__PURE__*/forwardRef(ExclamationCircleOutlined$1);
1565
+
1566
+ // This icon file is generated automatically.
1567
+ 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" };
1568
+
1569
+ var ProfileTwoTone$1 = function ProfileTwoTone$1(props, ref) {
1570
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1571
+ ref: ref,
1572
+ icon: ProfileTwoTone
1573
+ }));
1574
+ };
1575
+
1576
+ ProfileTwoTone$1.displayName = 'ProfileTwoTone';
1577
+ var ProfileTwoTone$2 = /*#__PURE__*/forwardRef(ProfileTwoTone$1);
1578
+
1579
+ // This icon file is generated automatically.
1580
+ 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" };
1581
+
1582
+ var SearchOutlined$1 = function SearchOutlined$1(props, ref) {
1583
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1584
+ ref: ref,
1585
+ icon: SearchOutlined
1586
+ }));
1587
+ };
1588
+
1589
+ SearchOutlined$1.displayName = 'SearchOutlined';
1590
+ var SearchOutlined$2 = /*#__PURE__*/forwardRef(SearchOutlined$1);
1591
+
1592
+ // This icon file is generated automatically.
1593
+ 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" };
1594
+
1595
+ var UnorderedListOutlined$1 = function UnorderedListOutlined$1(props, ref) {
1596
+ return /*#__PURE__*/createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
1597
+ ref: ref,
1598
+ icon: UnorderedListOutlined
1599
+ }));
1600
+ };
1601
+
1602
+ UnorderedListOutlined$1.displayName = 'UnorderedListOutlined';
1603
+ var UnorderedListOutlined$2 = /*#__PURE__*/forwardRef(UnorderedListOutlined$1);
1604
+
1605
+ function styleInject(css, ref) {
1606
+ if ( ref === void 0 ) ref = {};
1607
+ var insertAt = ref.insertAt;
1608
+
1609
+ if (!css || typeof document === 'undefined') { return; }
1610
+
1611
+ var head = document.head || document.getElementsByTagName('head')[0];
1612
+ var style = document.createElement('style');
1613
+ style.type = 'text/css';
1614
+
1615
+ if (insertAt === 'top') {
1616
+ if (head.firstChild) {
1617
+ head.insertBefore(style, head.firstChild);
1618
+ } else {
1619
+ head.appendChild(style);
1620
+ }
1621
+ } else {
1622
+ head.appendChild(style);
1623
+ }
1624
+
1625
+ if (style.styleSheet) {
1626
+ style.styleSheet.cssText = css;
1627
+ } else {
1628
+ style.appendChild(document.createTextNode(css));
1629
+ }
1630
+ }
1631
+
1632
+ 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";
1633
+ styleInject(css_248z);
1634
+
1635
+ var _excluded$2 = ["flag", "checkResults"],
1636
+ _excluded2 = ["flag", "checkResults"];
1637
+ var luckysheet = window.luckysheet;
1638
+ var itemsTemp = []; // const mapping = [
1639
+ // { "key": "skuCode", "name": "SKU编码", "rule": "skuCode" },
1640
+ // { "key": "quantity", "name": "数量", "rule": "quantity" },
1641
+ // { "key": "price", "name": "单价", "rule": "price" }
1642
+ // ]
1643
+
1644
+ var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例']]); // for dnd
1645
+
1646
+
1647
+ var reorder = function reorder(list, startIndex, endIndex) {
1648
+ var result = Array.from(list);
1649
+
1650
+ var _result$splice = result.splice(startIndex, 1),
1651
+ _result$splice2 = _slicedToArray(_result$splice, 1),
1652
+ removed = _result$splice2[0];
1653
+
1654
+ result.splice(endIndex, 0, removed);
1655
+ return result;
1656
+ };
1657
+
1658
+ var grid = 8;
1659
+
1660
+ var getItemStyle = function getItemStyle(isDragging, draggableStyle) {
1661
+ return _objectSpread2({
1662
+ // some basic styles to make the items look a bit nicer
1663
+ userSelect: 'none',
1664
+ padding: "4px",
1665
+ margin: "4px"
1666
+ }, draggableStyle);
1667
+ };
1668
+
1669
+ var getListStyle = function getListStyle(isDraggingOver) {
1670
+ return {
1671
+ background: isDraggingOver ? '#fff' : '#fff',
1672
+ display: 'flex',
1673
+ padding: grid,
1674
+ overflow: 'auto'
1675
+ };
1676
+ };
1677
+
1678
+ var filterLetters = function filterLetters(i) {
1679
+ if (i >= 0 && i <= 25) {
1680
+ return String.fromCharCode(65 + i);
1681
+ } else {
1682
+ return undefined;
1683
+ }
1684
+ };
1685
+
1686
+ var DataValidation = /*#__PURE__*/function (_React$Component) {
1687
+ _inherits(DataValidation, _React$Component);
1688
+
1689
+ var _super = _createSuper(DataValidation);
1690
+
1691
+ function DataValidation(props) {
1692
+ var _this;
1693
+
1694
+ _classCallCheck(this, DataValidation);
1695
+
1696
+ _this = _super.call(this, props);
1697
+
1698
+ _this.getCount = function () {
1699
+ var resultData = _this.state.resultData;
1700
+ return {
1701
+ total: resultData.length,
1702
+ error: resultData.filter(function (item) {
1703
+ return !item.flag;
1704
+ }).length
1705
+ };
1706
+ };
1707
+
1708
+ _this.setConfig = function (data) {
1709
+ var _ref;
1710
+
1711
+ var items = _this.state.items;
1712
+ return {
1713
+ container: 'luckysheet',
1714
+ showtoolbar: false,
1715
+ hook: {
1716
+ columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
1717
+ if (columnAbc.name) {
1718
+ var charCode = columnAbc.name.charCodeAt();
1719
+
1720
+ if (charCode - 65 <= items.length) {
1721
+ columnAbc.name = itemsTemp[charCode - 65] ? itemsTemp[charCode - 65].content : '校验结果';
1722
+ } else {
1723
+ columnAbc.name = '';
1724
+ }
1725
+ }
1726
+ },
1727
+ cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
1728
+ if (cell) {
1729
+ cell.fs = 10;
1730
+
1731
+ if (typeof cell.v === 'string') {
1732
+ cell.m = cell.v = cell.m.trim();
1733
+ }
1734
+
1735
+ if (typeof cell.v === 'number') {
1736
+ cell.v = cell.v.toString();
1737
+ cell.m = cell.v;
1738
+ }
1739
+ } // console.log(postion);
1740
+
1741
+ },
1742
+ cellAllRenderBefore: function cellAllRenderBefore(data, sheetFile, ctx) {
1743
+ sheetFile.config.borderInfo = []; // console.info(data,sheetFile,ctx)
1744
+ }
1745
+ },
1746
+ // showtoolbarConfig: {
1747
+ // undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
1748
+ // paintFormat: false, //格式刷
1749
+ // currencyFormat: false, //货币格式
1750
+ // percentageFormat: false, //百分比格式
1751
+ // numberDecrease: false, // '减少小数位数'
1752
+ // numberIncrease: false, // '增加小数位数
1753
+ // moreFormats: false, // '更多格式'
1754
+ // font: true, // '字体'
1755
+ // fontSize: true, // '字号大小'
1756
+ // },
1757
+ data: [(_ref = {
1758
+ name: 'Cell',
1759
+ color: '',
1760
+ index: 0,
1761
+ status: 1,
1762
+ order: 0,
1763
+ hide: 0,
1764
+ row: 36,
1765
+ column: 18,
1766
+ defaultRowHeight: 20,
1767
+ defaultColWidth: 120,
1768
+ config: {},
1769
+ // celldata:
1770
+ // data && data.length !== 0 ? data : _.flattenDeep(Array.from({ length: 100 }).map((a, b) => Array.from({ length: 100 }).map((c, d) => ({
1771
+ // "r": b,
1772
+ // "c": d,
1773
+ // "v": { "ct": { "fa": "@", "t": "s" }, }
1774
+ // }))))
1775
+ // ,
1776
+ celldata: data && data.length !== 0 ? data : _.flattenDeep(Array.from({
1777
+ length: 100
1778
+ }).map(function (a, b) {
1779
+ return Array.from({
1780
+ length: 100
1781
+ }).map(function (c, d) {
1782
+ return {
1783
+ "r": b,
1784
+ "c": d,
1785
+ "v": {
1786
+ "ct": {
1787
+ "fa": "@",
1788
+ "t": "s"
1789
+ }
1790
+ }
1791
+ };
1792
+ });
1793
+ })),
1794
+ scrollLeft: 0,
1795
+ // "scrollTop": 315, //上下滚动条位置
1796
+ luckysheet_select_save: [],
1797
+ calcChain: [],
1798
+ isPivotTable: false,
1799
+ pivotTable: {},
1800
+ filter_select: {},
1801
+ filter: null,
1802
+ luckysheet_alternateformat_save: [],
1803
+ luckysheet_alternateformat_save_modelCustom: [],
1804
+ luckysheet_conditionformat_save: {},
1805
+ frozen: {},
1806
+ chart: [],
1807
+ zoomRatio: 1,
1808
+ image: [],
1809
+ showGridLines: 1,
1810
+ dataVerification: {}
1811
+ }, _defineProperty(_ref, "luckysheet_alternateformat_save", [{
1812
+ cellrange: {
1813
+ //单元格范围
1814
+ row: [0, 1000],
1815
+ column: [0, 18]
1816
+ },
1817
+ format: {
1818
+ head: {
1819
+ //页眉颜色
1820
+ fc: '#6aa84f',
1821
+ bc: '#ffffff'
1822
+ },
1823
+ one: {
1824
+ //第一种颜色
1825
+ bc: '#ffffff'
1826
+ },
1827
+ two: {
1828
+ //第二种颜色
1829
+ bc: '#f2f4f5'
1830
+ },
1831
+ foot: {
1832
+ //页脚颜色
1833
+ fc: '#000',
1834
+ bc: '#a5efcc'
1835
+ }
1836
+ },
1837
+ hasRowHeader: false,
1838
+ hasRowFooter: false //含有页脚
1839
+
1840
+ }]), _defineProperty(_ref, "luckysheet_alternateformat_save_modelCustom", [{
1841
+ head: {
1842
+ //页眉颜色
1843
+ fc: '#6aa84f',
1844
+ bc: '#ffffff'
1845
+ },
1846
+ one: {
1847
+ //第一种颜色
1848
+ fc: '#000',
1849
+ bc: '#ffffff'
1850
+ },
1851
+ two: {
1852
+ //第二种颜色
1853
+ fc: '#000',
1854
+ bc: '#e5fbee'
1855
+ },
1856
+ foot: {
1857
+ //页脚颜色
1858
+ fc: '#000',
1859
+ bc: '#a5efcc'
1860
+ }
1861
+ }]), _ref)],
1862
+ cellRightClickConfig: {
1863
+ copy: false,
1864
+ copyAs: false,
1865
+ paste: false,
1866
+ insertRow: false,
1867
+ insertColumn: false,
1868
+ // deleteRow: false, // 删除选中行
1869
+ // deleteColumn: false, // 删除选中列
1870
+ deleteCell: false,
1871
+ hideRow: false,
1872
+ hideColumn: false,
1873
+ rowHeight: false,
1874
+ columnWidth: false,
1875
+ clear: false,
1876
+ matrix: false,
1877
+ sort: false,
1878
+ filter: false,
1879
+ chart: false,
1880
+ image: false,
1881
+ link: false,
1882
+ data: false,
1883
+ cellFormat: false // 设置单元格格式
1884
+
1885
+ },
1886
+ showsheetbar: false,
1887
+ optionstate: false,
1888
+ showstatisticBarConfig: {
1889
+ count: false,
1890
+ view: false,
1891
+ zoom: false // 缩放
1892
+
1893
+ },
1894
+ column: 10,
1895
+ columnHeaderHeight: 30,
1896
+ lang: 'zh',
1897
+ defaultFontSize: '10',
1898
+ frozen: {
1899
+ type: 'rangeBoth',
1900
+ range: {
1901
+ row_focus: 1,
1902
+ column_focus: 1
1903
+ }
1904
+ }
1905
+ };
1906
+ };
1907
+
1908
+ _this.getValidateData = function () {
1909
+ var resultData = _this.state.resultData;
1910
+ return {
1911
+ successData: resultData.filter(function (item) {
1912
+ return item.flag;
1913
+ }).map(function (_ref2) {
1914
+ var flag = _ref2.flag,
1915
+ checkResults = _ref2.checkResults,
1916
+ item = _objectWithoutProperties(_ref2, _excluded$2);
1917
+
1918
+ return item;
1919
+ }),
1920
+ failData: resultData.filter(function (item) {
1921
+ return !item.flag;
1922
+ }).map(function (_ref3) {
1923
+ var flag = _ref3.flag,
1924
+ checkResults = _ref3.checkResults,
1925
+ item = _objectWithoutProperties(_ref3, _excluded2);
1926
+
1927
+ return item;
1928
+ })
1929
+ };
1930
+ };
1931
+
1932
+ _this.getData = function () {
1933
+ console.time();
1934
+ var sheetData = luckysheet.getSheetData();
1935
+ var data = sheetData.filter(function (item) {
1936
+ return item[0];
1937
+ }).map(function (item) {
1938
+ var obj = {};
1939
+ item.slice(0, itemsTemp.length).map(function (innerItem, index) {
1940
+ obj[_this.state.items[index].code] = innerItem && innerItem.v;
1941
+ });
1942
+ return obj;
1943
+ });
1944
+ return data;
1945
+ };
1946
+
1947
+ _this.resetData = function () {
1948
+ var _this$props = _this.props,
1949
+ validDataUrl = _this$props.validDataUrl,
1950
+ updateData = _this$props.updateData,
1951
+ columns = _this$props.columns;
1952
+
1953
+ var resultData = _this.getData().filter(function (d) {
1954
+ return _.compact(Object.values(d)).length;
1955
+ });
1956
+
1957
+ axios.post(validDataUrl, {
1958
+ columns: columns,
1959
+ data: resultData
1960
+ }).then(function (result) {
1961
+ result = result.data;
1962
+
1963
+ if (result.status !== '0') {
1964
+ message.error(result.msg);
1965
+ return;
1966
+ }
1967
+
1968
+ var items = _this.state.items;
1969
+ var validIndex = items.length;
1970
+ var res = result.data;
1971
+ var sheetData = luckysheet.getSheetData();
1972
+ sheetData.map(function (item, index) {
1973
+ if (!res[index]) return item;
1974
+
1975
+ if (res[index].flag) {
1976
+ item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
1977
+ v: '通过',
1978
+ m: '通过',
1979
+ fc: 'green' //字体颜色为 "#990000"
1980
+
1981
+ });
1982
+ } else {
1983
+ item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
1984
+ v: res[index].checkResults,
1985
+ m: res[index].checkResults,
1986
+ fc: 'red' //字体颜色为 "#990000"
1987
+
1988
+ });
1989
+ }
1990
+
1991
+ item[validIndex].ct = {
1992
+ fa: 'General',
1993
+ t: 'g'
1994
+ };
1995
+ }); // sheetData.map((item, index) => {
1996
+ // luckysheet.setCellValue(index + 1, 4, 345)
1997
+ // })
1998
+
1999
+ luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2000
+
2001
+ _this.setState({
2002
+ data: luckysheet.transToCellData(sheetData),
2003
+ errorListCheck: false,
2004
+ resultData: res
2005
+ });
2006
+
2007
+ console.log(setExportData);
2008
+ setExportData([123123]);
2009
+ }).catch(function (err) {});
2010
+ };
2011
+
2012
+ _this.filterData = function (type) {
2013
+ var _this$state = _this.state,
2014
+ showErrorData = _this$state.showErrorData,
2015
+ data = _this$state.data,
2016
+ resultData = _this$state.resultData;
2017
+ var sheetData = luckysheet.transToData(data).filter(function (item, index) {
2018
+ if (type === 'all') {
2019
+ return false;
2020
+ }
2021
+
2022
+ if (type === 'error') {
2023
+ return item[itemsTemp.length] && item[itemsTemp.length].v === '通过';
2024
+ }
2025
+ });
2026
+ luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2027
+
2028
+ _this.setState({
2029
+ data: luckysheet.transToCellData(sheetData),
2030
+ errorListCheck: false,
2031
+ resultData: type === 'all' ? [] : resultData.filter(function (item) {
2032
+ return item.flag;
2033
+ })
2034
+ });
2035
+ };
2036
+
2037
+ _this.toggleData = function () {
2038
+ var _this$state2 = _this.state,
2039
+ showErrorData = _this$state2.showErrorData,
2040
+ data = _this$state2.data;
2041
+
2042
+ if (showErrorData) {
2043
+ luckysheet.create(_this.setConfig(data));
2044
+ } else {
2045
+ var sheetData = luckysheet.getSheetData();
2046
+ sheetData = sheetData.filter(function (item, index) {
2047
+ return !item[itemsTemp.length] || item[itemsTemp.length].v !== '通过';
2048
+ });
2049
+ luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
2050
+ }
2051
+
2052
+ _this.setState({
2053
+ showErrorData: !showErrorData
2054
+ });
2055
+ };
2056
+
2057
+ _this.onChange = function (e) {
2058
+ _this.setState({
2059
+ radioValue: e.target.value
2060
+ });
2061
+
2062
+ _this.toggleData();
2063
+ };
2064
+
2065
+ _this.errorChange = function (e) {
2066
+ _this.toggleData();
2067
+
2068
+ _this.setState({
2069
+ errorListCheck: e.target.checked
2070
+ });
2071
+ };
2072
+
2073
+ _this.menuList = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
2074
+ key: "1",
2075
+ className: "sheet_table-menu_item_text"
2076
+ }, /*#__PURE__*/React.createElement("a", {
2077
+ onClick: function onClick() {
2078
+ return _this.filterData('all');
2079
+ }
2080
+ }, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
2081
+ key: "2",
2082
+ className: "sheet_table-menu_item_text"
2083
+ }, /*#__PURE__*/React.createElement("a", {
2084
+ onClick: function onClick() {
2085
+ return _this.filterData('error');
2086
+ }
2087
+ }, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
2088
+ _this.leftMenu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
2089
+ key: "3",
2090
+ className: "sheet_table-menu_item_text"
2091
+ }, /*#__PURE__*/React.createElement("span", {
2092
+ className: "sheet_table_text"
2093
+ }, "\u8BF7\u62D6\u52A8\u5B57\u6BB5\u6765\u5BF9\u5E94\u5217")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DragDropContext, {
2094
+ onDragEnd: function onDragEnd(e) {
2095
+ return _this.onDragEnd(e);
2096
+ }
2097
+ }, /*#__PURE__*/React.createElement(Droppable, {
2098
+ droppableId: "droppable",
2099
+ direction: "vertical"
2100
+ }, function (provided, snapshot) {
2101
+ return /*#__PURE__*/React.createElement("div", _objectSpread2({
2102
+ ref: provided.innerRef,
2103
+ style: _objectSpread2(_objectSpread2({}, getListStyle(snapshot.isDraggingOver)), {}, {
2104
+ flexDirection: 'column'
2105
+ })
2106
+ }, provided.droppableProps), _this.state.items.map(function (item, index) {
2107
+ return /*#__PURE__*/React.createElement(Draggable, {
2108
+ key: item.id,
2109
+ draggableId: item.id,
2110
+ index: index
2111
+ }, function (provided, snapshot) {
2112
+ return /*#__PURE__*/React.createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
2113
+ ref: provided.innerRef
2114
+ }, provided.draggableProps), provided.dragHandleProps), {}, {
2115
+ style: getItemStyle(snapshot.isDragging, provided.draggableProps.style)
2116
+ }), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, filterLetters(index), " \u5217 "), /*#__PURE__*/React.createElement(Space, {
2117
+ className: "sheet_table_dnd_text"
2118
+ }, /*#__PURE__*/React.createElement(UnorderedListOutlined$2, null), item.content)));
2119
+ });
2120
+ }), provided.placeholder);
2121
+ }))));
2122
+
2123
+ _this.props.onRef(_assertThisInitialized(_this));
2124
+
2125
+ itemsTemp = props.columns.map(function (item, index) {
2126
+ if (!mapping.get(item)) throw Error("".concat(item, " is not in DataValidation component, please fix this error"));
2127
+ return {
2128
+ id: "item-0".concat(index),
2129
+ content: mapping.get(item),
2130
+ code: item,
2131
+ "ct": {
2132
+ "fa": "General",
2133
+ "t": "s" //格式类型为数字类型
2134
+
2135
+ }
2136
+ };
2137
+ });
2138
+ _this.state = {
2139
+ showErrorData: false,
2140
+ data: [],
2141
+ items: _toConsumableArray(itemsTemp),
2142
+ resultData: [],
2143
+ errorListCheck: false
2144
+ };
2145
+ return _this;
2146
+ }
2147
+
2148
+ _createClass(DataValidation, [{
2149
+ key: "onDragEnd",
2150
+ value: function onDragEnd(result) {
2151
+ // dropped outside the list
2152
+ if (!result.destination) {
2153
+ return;
2154
+ }
2155
+
2156
+ var items = reorder(this.state.items, result.source.index, result.destination.index);
2157
+ this.setState({
2158
+ items: items
2159
+ });
2160
+ itemsTemp = items;
2161
+ luckysheet.refresh();
2162
+ }
2163
+ }, {
2164
+ key: "componentDidMount",
2165
+ value: function componentDidMount() {
2166
+ luckysheet.create(this.setConfig([]));
2167
+ }
2168
+ }, {
2169
+ key: "componentWillUnmount",
2170
+ value: function componentWillUnmount() {
2171
+ // luckysheet.create(this.setConfig([]));
2172
+ luckysheet.destroy();
2173
+ }
2174
+ }, {
2175
+ key: "render",
2176
+ value: function render() {
2177
+ var errorListCheck = this.state.errorListCheck;
2178
+ var title = this.props.title;
2179
+ var totalSummary = this.getCount();
2180
+ var luckyCss = {
2181
+ margin: '0px',
2182
+ padding: '0px',
2183
+ position: 'absolute',
2184
+ width: '100%',
2185
+ height: '100%',
2186
+ left: '0px',
2187
+ top: '0px'
2188
+ };
2189
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2190
+ className: "sheet_table_top"
2191
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React.createElement(Dropdown, {
2192
+ trigger: ['click'],
2193
+ overlay: this.leftMenu,
2194
+ placement: "bottomLeft"
2195
+ }, /*#__PURE__*/React.createElement("a", null, /*#__PURE__*/React.createElement(ProfileTwoTone$2, null))), /*#__PURE__*/React.createElement(Tooltip, {
2196
+ 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"))
2197
+ }, /*#__PURE__*/React.createElement(ExclamationCircleOutlined$2, null))), /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Dropdown, {
2198
+ trigger: ['click'],
2199
+ overlay: this.menuList,
2200
+ placement: "bottomRight"
2201
+ }, /*#__PURE__*/React.createElement(Button, null, "\u6E05\u7A7A", /*#__PURE__*/React.createElement(DownOutlined$2, null))), /*#__PURE__*/React.createElement(Button, {
2202
+ type: "primary",
2203
+ onClick: this.resetData
2204
+ }, "\u8BC6\u522B"))), /*#__PURE__*/React.createElement("div", {
2205
+ style: {
2206
+ position: 'relative',
2207
+ height: '400px'
2208
+ }
2209
+ }, /*#__PURE__*/React.createElement("div", {
2210
+ id: "luckysheet",
2211
+ style: luckyCss
2212
+ })), /*#__PURE__*/React.createElement("div", {
2213
+ className: "sheet_table_footer"
2214
+ }, /*#__PURE__*/React.createElement("span", {
2215
+ className: "sheet_table_footer_l"
2216
+ }, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E, \u5176\u4E2D\u9519\u8BEF ", totalSummary.error, " \u9879"), /*#__PURE__*/React.createElement(Space, {
2217
+ className: "sheet_table_footer_r"
2218
+ }, /*#__PURE__*/React.createElement(Checkbox, {
2219
+ checked: errorListCheck,
2220
+ onClick: this.errorChange
2221
+ }), "\u4EC5\u5C55\u793A\u9519\u8BEF\u6570\u636E")));
2222
+ }
2223
+ }]);
2224
+
2225
+ return DataValidation;
2226
+ }(React.Component);
2227
+
2228
+ 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";
2229
+ styleInject(css_248z$1);
2230
+
2231
+ var QueryMutipleInput = function QueryMutipleInput(_ref) {
2232
+ var onValueChange = _ref.onValueChange;
2233
+
2234
+ var _useState = useState(false),
2235
+ _useState2 = _slicedToArray(_useState, 2),
2236
+ isModalVisible = _useState2[0],
2237
+ setIsModalVisible = _useState2[1];
2238
+
2239
+ var _useState3 = useState(''),
2240
+ _useState4 = _slicedToArray(_useState3, 2),
2241
+ value = _useState4[0],
2242
+ setValue = _useState4[1];
2243
+
2244
+ var _useState5 = useState(''),
2245
+ _useState6 = _slicedToArray(_useState5, 2),
2246
+ popvalue = _useState6[0],
2247
+ setPopValue = _useState6[1];
2248
+
2249
+ var _useDebounceFn = useDebounceFn(function () {
2250
+ formaData(value);
2251
+ }, {
2252
+ wait: 1000
2253
+ }),
2254
+ run = _useDebounceFn.run;
2255
+
2256
+ useEffect(function () {
2257
+ setPopValue(value);
2258
+ onValueChange(value);
2259
+ }, [value]);
2260
+
2261
+ var showModal = function showModal() {
2262
+ setIsModalVisible(true);
2263
+ };
2264
+
2265
+ var handleOk = function handleOk() {
2266
+ formaData(popvalue);
2267
+ setIsModalVisible(false);
2268
+ };
2269
+
2270
+ var formaData = function formaData(value) {
2271
+ var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
2272
+ return item;
2273
+ }).join(',');
2274
+ setValue(formatValue);
2275
+ };
2276
+
2277
+ var handleCancel = function handleCancel() {
2278
+ setIsModalVisible(false);
2279
+ };
2280
+
2281
+ var outerChange = function outerChange(e) {
2282
+ setValue(e.target.value);
2283
+ run();
2284
+ };
2285
+
2286
+ var onChange = function onChange(e) {
2287
+ setPopValue(e.target.value);
2288
+ };
2289
+
2290
+ return /*#__PURE__*/React.createElement("div", {
2291
+ className: 'query_input'
2292
+ }, /*#__PURE__*/React.createElement("div", {
2293
+ className: "query_input_show"
2294
+ }, /*#__PURE__*/React.createElement(Input, {
2295
+ value: value,
2296
+ onChange: outerChange,
2297
+ onBlur: function onBlur(e) {
2298
+ formaData(e.target.value);
2299
+ },
2300
+ onPaste: function onPaste(e) {
2301
+ formaData(e.clipboardData.getData('text'));
2302
+ e.preventDefault();
2303
+ },
2304
+ style: {
2305
+ width: 'calc(100% - 30px)'
2306
+ },
2307
+ placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
2308
+ }), /*#__PURE__*/React.createElement(Button, {
2309
+ style: {
2310
+ width: '30px',
2311
+ padding: '2px',
2312
+ height: 'auto'
2313
+ },
2314
+ onClick: showModal,
2315
+ type: "primary"
2316
+ }, "...")), /*#__PURE__*/React.createElement(Modal, {
2317
+ width: 600,
2318
+ title: "\u591A\u503C\u5F55\u5165",
2319
+ visible: isModalVisible,
2320
+ onOk: handleOk,
2321
+ onCancel: handleCancel,
2322
+ footer: [/*#__PURE__*/React.createElement(Button, {
2323
+ key: "back",
2324
+ onClick: handleCancel
2325
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
2326
+ key: "submit",
2327
+ type: "primary",
2328
+ onClick: handleOk
2329
+ }, "\u5F55\u5165")]
2330
+ }, /*#__PURE__*/React.createElement("div", {
2331
+ className: 'query_input_wrapper'
2332
+ }, /*#__PURE__*/React.createElement("div", {
2333
+ className: 'query_input_wrapper_left'
2334
+ }, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React.createElement("div", {
2335
+ className: 'query_input_wrapper_right'
2336
+ }, /*#__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", {
2337
+ className: 'query_input_textArea'
2338
+ }, /*#__PURE__*/React.createElement(Input.TextArea, {
2339
+ value: popvalue,
2340
+ onChange: onChange,
2341
+ rows: 6,
2342
+ showCount: true
2343
+ }))))));
2344
+ };
2345
+
2346
+ function ToCDB(str) {
2347
+ var tmp = '';
2348
+
2349
+ for (var i = 0; i < str.length; i++) {
2350
+ if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
2351
+ tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
2352
+ } else {
2353
+ tmp += String.fromCharCode(str.charCodeAt(i));
2354
+ }
2355
+ }
2356
+
2357
+ return tmp;
2358
+ }
2359
+
2360
+ /*
2361
+ * @Description:
2362
+ * @Author: rodchen
2363
+ * @Date: 2022-01-14 14:12:01
2364
+ * @LastEditTime: 2022-01-14 17:17:26
2365
+ * @LastEditors: rodchen
2366
+ */
2367
+ var index = (function (storageKeyString) {
2368
+ var seconds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2369
+ var tipsCallFunction = arguments.length > 2 ? arguments[2] : undefined;
2370
+ if (typeof seconds !== 'number') throw new Error('seconds should be number');
2371
+ var cacheValue = getStorageVale(storageKeyString);
2372
+
2373
+ if (document.hidden !== undefined) {
2374
+ document.addEventListener('visibilitychange', function () {
2375
+ if (!document.hidden) {
2376
+ var currentValue = getStorageVale(storageKeyString);
2377
+
2378
+ if (currentValue !== cacheValue) {
2379
+ if (tipsCallFunction && typeof tipsCallFunction === 'function') {
2380
+ tipsCallFunction();
2381
+ } else {
2382
+ window.alert('检测新用户登录,当前页面会在2s之后刷新!');
2383
+ }
2384
+
2385
+ setTimeout(function () {
2386
+ window.location.reload();
2387
+ }, seconds * 1000);
2388
+ }
2389
+ }
2390
+ });
2391
+ }
2392
+ });
2393
+
2394
+ function getStorageVale(storageKeyString) {
2395
+ var _storageKeyString$spl = storageKeyString.split('.'),
2396
+ _storageKeyString$spl2 = _toArray(_storageKeyString$spl),
2397
+ localstorage = _storageKeyString$spl2[0],
2398
+ restKeyArrays = _storageKeyString$spl2.slice(1);
2399
+
2400
+ var localStorageInfo = window.localStorage.getItem(localstorage);
2401
+ if (!restKeyArrays.length) return localStorageInfo;
2402
+ var returnVal = JSON.parse(localStorageInfo || '{}');
2403
+
2404
+ for (var i = 0; i < restKeyArrays.length; i++) {
2405
+ returnVal = returnVal[restKeyArrays[i]];
2406
+ if (!returnVal) return '';
2407
+
2408
+ if (typeof returnVal === 'string') {
2409
+ return returnVal;
2410
+ }
2411
+ }
2412
+
2413
+ return "";
2414
+ }
2415
+
2416
+ 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";
2417
+ styleInject(css_248z$2);
2418
+
2419
+ var Option = Select.Option;
2420
+
2421
+ var SearchSelect = function SearchSelect(props) {
2422
+ var value = props.value,
2423
+ onChange = props.onChange,
2424
+ _props$selectProps = props.selectProps,
2425
+ selectProps = _props$selectProps === void 0 ? {} : _props$selectProps,
2426
+ _props$modalTableProp = props.modalTableProps,
2427
+ modalTableProps = _props$modalTableProp === void 0 ? {} : _props$modalTableProp,
2428
+ _props$labelInValue = props.labelInValue,
2429
+ labelInValue = _props$labelInValue === void 0 ? false : _props$labelInValue,
2430
+ requestConfig = props.requestConfig,
2431
+ ctx = props.ctx;
2432
+ var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
2433
+
2434
+ var initVal = value || (selectMode ? [] : null);
2435
+ var pageSize = 100; // 下拉框默认分页 条数
2436
+
2437
+ var tableInitPageSize = 10; // 弹框默认分页 条数
2438
+
2439
+ var currentPage = 1;
2440
+ var selectParamsKey = (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.filter) || 'qp-codeAndName-like';
2441
+
2442
+ var currentSelectProps = _objectSpread2(_objectSpread2({}, selectProps), {}, {
2443
+ // 以下属性不可更改----设计配置项
2444
+ showSearch: false,
2445
+ filterOption: false,
2446
+ allowClear: true,
2447
+ listHeight: 160,
2448
+ optionLabelProp: "label",
2449
+ autoClearSearchValue: false
2450
+ });
2451
+
2452
+ var _useState = useState([]),
2453
+ _useState2 = _slicedToArray(_useState, 2),
2454
+ items = _useState2[0],
2455
+ setItems = _useState2[1];
2456
+
2457
+ var _useState3 = useState(1),
2458
+ _useState4 = _slicedToArray(_useState3, 2),
2459
+ scrollPage = _useState4[0],
2460
+ setScrollPage = _useState4[1];
2461
+
2462
+ var _useState5 = useState(0),
2463
+ _useState6 = _slicedToArray(_useState5, 2),
2464
+ itemsTotal = _useState6[0],
2465
+ setItemsTotal = _useState6[1];
2466
+
2467
+ var _useState7 = useState(false),
2468
+ _useState8 = _slicedToArray(_useState7, 2),
2469
+ fetching = _useState8[0],
2470
+ setFetching = _useState8[1];
2471
+
2472
+ var _useState9 = useState(''),
2473
+ _useState10 = _slicedToArray(_useState9, 2),
2474
+ searchValue = _useState10[0],
2475
+ setSearchValue = _useState10[1];
2476
+
2477
+ var _useState11 = useState(false),
2478
+ _useState12 = _slicedToArray(_useState11, 2),
2479
+ isModalVisible = _useState12[0],
2480
+ setIsModalVisible = _useState12[1];
2481
+
2482
+ var _useState13 = useState(initVal),
2483
+ _useState14 = _slicedToArray(_useState13, 2),
2484
+ popvalue = _useState14[0],
2485
+ setPopValue = _useState14[1];
2486
+
2487
+ var _useDebounceFn = useDebounceFn(function () {
2488
+ // 防抖函数 待定
2489
+ getData(_defineProperty({}, selectParamsKey, searchValue));
2490
+ }, {
2491
+ wait: 1000
2492
+ }),
2493
+ run = _useDebounceFn.run;
2494
+
2495
+ var _Form$useForm = Form.useForm(),
2496
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
2497
+ form = _Form$useForm2[0];
2498
+
2499
+ var _useState15 = useState(true),
2500
+ _useState16 = _slicedToArray(_useState15, 2),
2501
+ caretLeftFlag = _useState16[0],
2502
+ setCaretLeftFlag = _useState16[1];
2503
+
2504
+ var _useState17 = useState([]),
2505
+ _useState18 = _slicedToArray(_useState17, 2),
2506
+ tableData = _useState18[0],
2507
+ setTableData = _useState18[1];
2508
+
2509
+ var _useState19 = useState({
2510
+ showQuickJumper: true,
2511
+ total: 0,
2512
+ current: 1,
2513
+ pageSize: tableInitPageSize
2514
+ }),
2515
+ _useState20 = _slicedToArray(_useState19, 2),
2516
+ tablePagination = _useState20[0],
2517
+ setTablePagination = _useState20[1];
2518
+
2519
+ var _useState21 = useState([]),
2520
+ _useState22 = _slicedToArray(_useState21, 2),
2521
+ selectedRowKeys = _useState22[0],
2522
+ setSelectedRowKeys = _useState22[1];
2523
+
2524
+ var _useState23 = useState([]),
2525
+ _useState24 = _slicedToArray(_useState23, 2),
2526
+ selectedRows = _useState24[0],
2527
+ setSelectedRows = _useState24[1];
2528
+
2529
+ var _useState25 = useState([]),
2530
+ _useState26 = _slicedToArray(_useState25, 2),
2531
+ doubleArr = _useState26[0],
2532
+ setDoubleArr = _useState26[1]; // 存放双数组的数组
2533
+
2534
+
2535
+ var _useState27 = useState([]),
2536
+ _useState28 = _slicedToArray(_useState27, 2),
2537
+ filterRows = _useState28[0],
2538
+ setFilterRows = _useState28[1]; // 存放拼接后的一维数组的变量
2539
+
2540
+
2541
+ var _useState29 = useState(false),
2542
+ _useState30 = _slicedToArray(_useState29, 2),
2543
+ checkedAll = _useState30[0],
2544
+ setCheckedAll = _useState30[1];
2545
+
2546
+ var _useState31 = useState(false),
2547
+ _useState32 = _slicedToArray(_useState31, 2),
2548
+ indeterminate = _useState32[0],
2549
+ setIndeterminate = _useState32[1]; // 获取数据源 (type: 1下拉框 2弹框 不传值默认为下拉框)
2550
+
2551
+
2552
+ var getData = function getData() {
2553
+ var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2554
+ var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2555
+ if (!requestConfig) return;
2556
+ var url = requestConfig.url,
2557
+ otherParams = requestConfig.otherParams,
2558
+ isMap = requestConfig.isMap;
2559
+ setFetching(true); // 处理dependence参数
2560
+
2561
+ var fixedParam = {};
2562
+
2563
+ if (requestConfig.fixedparameter && requestConfig.fieldValToParam && ctx) {
2564
+ requestConfig.fixedparameter.forEach(function (item, index) {
2565
+ var fixedParamVal = ctx.form.getFieldValue(requestConfig.fieldValToParam[index]);
2566
+
2567
+ if (fixedParamVal) {
2568
+ fixedParam[item] = fixedParamVal;
2569
+ }
2570
+ });
2571
+ }
2572
+
2573
+ var queryParams = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
2574
+ pageSize: pageSize,
2575
+ currentPage: currentPage
2576
+ }, otherParams), fixedParam), params), {}, {
2577
+ sorter: 'desc-createTime'
2578
+ });
2579
+
2580
+ axios.get("".concat(url, "?").concat(stringify(queryParams))).then(function (result) {
2581
+ setFetching(false);
2582
+ result = result.data;
2583
+
2584
+ if (result.status !== '0') {
2585
+ message.error(result.msg);
2586
+ return;
2587
+ }
2588
+
2589
+ var res = result.data;
2590
+ var source = [];
2591
+
2592
+ if (isMap) {
2593
+ source = Object.keys(res).map(function (d, i) {
2594
+ return {
2595
+ text: Object.values(res)[i],
2596
+ value: d
2597
+ };
2598
+ });
2599
+ } else {
2600
+ var keys = res.list ? 'list' : 'items';
2601
+ source = res ? res[keys] ? res[keys].map(function (item) {
2602
+ return _objectSpread2(_objectSpread2({}, item), {}, {
2603
+ text: requestConfig.splicing ? "".concat(item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingValueField], "-").concat(item[requestConfig.mappingTextField]) : item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingTextField],
2604
+ value: item[requestConfig.mappingValueField]
2605
+ });
2606
+ }) : Array.isArray(res) && (res === null || res === void 0 ? void 0 : res.map(function (item) {
2607
+ return _objectSpread2(_objectSpread2({}, item), {}, {
2608
+ text: requestConfig.splicing ? "".concat(item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingValueField], "-").concat(item[requestConfig.mappingTextField]) : item[requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.mappingTextField],
2609
+ value: item[requestConfig.mappingValueField]
2610
+ });
2611
+ })) : [];
2612
+ }
2613
+
2614
+ source = Array.isArray(source) ? source : [];
2615
+
2616
+ if (type === 1) {
2617
+ var _ctx$form;
2618
+
2619
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource('supplierCode', source);
2620
+ setItems(source);
2621
+ setItemsTotal(Number(res === null || res === void 0 ? void 0 : res.total));
2622
+ } else {
2623
+ setTableData(source);
2624
+ setTablePagination(_objectSpread2(_objectSpread2({}, tablePagination), {}, {
2625
+ total: Number(res === null || res === void 0 ? void 0 : res.total),
2626
+ pageSize: Number(res === null || res === void 0 ? void 0 : res.size),
2627
+ current: Number(res === null || res === void 0 ? void 0 : res.page)
2628
+ }));
2629
+ }
2630
+ }).catch(function (err) {
2631
+ setFetching(false);
2632
+ });
2633
+ };
2634
+
2635
+ var SelectScroll = function SelectScroll(e) {
2636
+ e.persist();
2637
+ var target = e.target;
2638
+ var totalPage = Math.ceil(itemsTotal / pageSize); // 判断是否滑动到底部
2639
+
2640
+ var isTouchGround = target.scrollTop + target.offsetHeight === target.scrollHeight; // 判断数据是否还没有加载到了最后一页
2641
+
2642
+ var canPageAdd = scrollPage < totalPage;
2643
+
2644
+ if (isTouchGround && canPageAdd) {
2645
+ var nextScrollPage = scrollPage + 1;
2646
+ setScrollPage(nextScrollPage);
2647
+ getData({
2648
+ currentPage: nextScrollPage
2649
+ }); // 调用api方法
2650
+ }
2651
+ };
2652
+
2653
+ useEffect(function () {
2654
+ getData();
2655
+ }, []);
2656
+ useEffect(function () {
2657
+ if (value) {
2658
+ setPopValue(value);
2659
+ onChange(value);
2660
+ }
2661
+ }, [value]);
2662
+
2663
+ var showModal = function showModal() {
2664
+ getData({
2665
+ pageSize: tableInitPageSize,
2666
+ currentPage: 1
2667
+ }, 2);
2668
+ setIsModalVisible(true); // 回显
2669
+
2670
+ if (value) {
2671
+ if (selectMode) {
2672
+ setSelectedRowKeys(labelInValue ? value.map(function (i) {
2673
+ return i.key;
2674
+ }) : value);
2675
+ setSelectedRows(labelInValue ? value.map(function (i) {
2676
+ return {
2677
+ value: i.key,
2678
+ text: i.label
2679
+ };
2680
+ }) : value.map(function (i) {
2681
+ return {
2682
+ value: i
2683
+ };
2684
+ }));
2685
+ setPopValue(labelInValue ? value.map(function (i) {
2686
+ return {
2687
+ value: i.key,
2688
+ text: i.label
2689
+ };
2690
+ }) : value.map(function (i) {
2691
+ return {
2692
+ value: i
2693
+ };
2694
+ }));
2695
+ setIndeterminate(!!value.length && value.length < itemsTotal);
2696
+ setCheckedAll(value.length === itemsTotal);
2697
+ } else {
2698
+ setSelectedRowKeys(labelInValue ? [value.key] : [value]);
2699
+ setSelectedRows(labelInValue ? [{
2700
+ value: value.key,
2701
+ text: value.label
2702
+ }] : [{
2703
+ value: value.key
2704
+ }]);
2705
+ setPopValue(labelInValue ? [{
2706
+ value: value.key,
2707
+ text: value.label
2708
+ }] : [{
2709
+ value: value.key
2710
+ }]);
2711
+ }
2712
+ }
2713
+ };
2714
+
2715
+ var handleOk = function handleOk() {
2716
+ if (popvalue === null || popvalue === void 0 ? void 0 : popvalue.length) {
2717
+ formaData(popvalue);
2718
+ }
2719
+
2720
+ setIsModalVisible(false);
2721
+ };
2722
+
2723
+ var formaData = function formaData(value) {
2724
+ if (labelInValue) {
2725
+ var formatResult = value.map(function (i) {
2726
+ return {
2727
+ key: i.code,
2728
+ label: i.name,
2729
+ value: i.code
2730
+ };
2731
+ });
2732
+ onChange(selectMode ? formatResult : formatResult[0]);
2733
+ } else {
2734
+ var _formatResult = selectMode ? value.map(function (i) {
2735
+ return i.value;
2736
+ }) : _.get(value[0], 'value');
2737
+
2738
+ onChange(_formatResult);
2739
+ }
2740
+ };
2741
+
2742
+ var handleCancel = function handleCancel() {
2743
+ setIsModalVisible(false);
2744
+ };
2745
+
2746
+ var onSearchChange = function onSearchChange(e) {
2747
+ setSearchValue(e.target.value);
2748
+ run();
2749
+ };
2750
+
2751
+ var onSearchBlur = function onSearchBlur() {
2752
+ setSearchValue('');
2753
+ run();
2754
+ };
2755
+
2756
+ var onSearchTable = function onSearchTable() {
2757
+ var params = form.getFieldsValue();
2758
+ getData(_objectSpread2(_objectSpread2({}, params), {}, {
2759
+ pageSize: tableInitPageSize
2760
+ }), 2);
2761
+ };
2762
+
2763
+ var onResetTable = function onResetTable() {
2764
+ form.resetFields();
2765
+ handleTableChange({
2766
+ pageSize: tableInitPageSize,
2767
+ currentPage: 1
2768
+ });
2769
+ };
2770
+
2771
+ var handleTableChange = function handleTableChange(pagination) {
2772
+ getData({
2773
+ pageSize: pagination.pageSize,
2774
+ currentPage: pagination.current
2775
+ }, 2);
2776
+ };
2777
+
2778
+ var onChangeCheckAll = function onChangeCheckAll(e) {
2779
+ if (e.target.checked) {
2780
+ // 如果下拉框有所有数据就处理选中所有,如果没有 就默认查出所有数据
2781
+ if (items.length === itemsTotal) {
2782
+ var currentItemsData = JSON.parse(JSON.stringify(items));
2783
+ setSelectedRowKeys(currentItemsData.map(function (i) {
2784
+ return i.value;
2785
+ }));
2786
+ setSelectedRows(currentItemsData);
2787
+ setPopValue(currentItemsData);
2788
+ }
2789
+ } else {
2790
+ setSelectedRowKeys([]);
2791
+ setSelectedRows([]);
2792
+ setPopValue([]);
2793
+ }
2794
+
2795
+ setIndeterminate(false);
2796
+ setCheckedAll(e.target.checked);
2797
+ };
2798
+
2799
+ var LightHeightOption = function LightHeightOption(props) {
2800
+ var filterTxt = props.filterTxt,
2801
+ text = props.text;
2802
+
2803
+ var heightLightTxt = function heightLightTxt(txt, heightTxt) {
2804
+ if (heightTxt === '') {
2805
+ return txt;
2806
+ } // 前面filterOption 不区分大小写,这里用i
2807
+
2808
+
2809
+ var regexp = new RegExp(heightTxt, 'gi');
2810
+ return txt.replace(regexp, "<span style=\"color:red\">".concat(heightTxt, "</span>"));
2811
+ };
2812
+
2813
+ return /*#__PURE__*/React.createElement("div", {
2814
+ ref: function ref(nodeElement) {
2815
+ if (nodeElement) {
2816
+ nodeElement.innerHTML = heightLightTxt(text, filterTxt);
2817
+ }
2818
+ }
2819
+ });
2820
+ }; // 扁平化二维数组的方法
2821
+
2822
+
2823
+ var mapRows = function mapRows(params) {
2824
+ var res = [];
2825
+
2826
+ for (var i = 0; i < params.length; i++) {
2827
+ if (Array.isArray(params[i])) {
2828
+ // 去重
2829
+ res = _.uniqBy(res.concat(mapRows(params[i])), 'value');
2830
+ } else {
2831
+ res.push(params[i]); // 去重
2832
+
2833
+ res = _.uniqBy(res, 'value');
2834
+ }
2835
+ }
2836
+
2837
+ return res.filter(Boolean); //去掉undefined的情况
2838
+ };
2839
+
2840
+ var onChangeSelectedKeys = function onChangeSelectedKeys(selectKeys, selectRows) {
2841
+ var nowPage = tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.current;
2842
+ var filterRows = [];
2843
+ var sksResult = [];
2844
+
2845
+ if (selectMode) {
2846
+ // 处理多选分页累计选中
2847
+ // 勾选生成二维数组
2848
+ doubleArr[nowPage ? nowPage - 1 : 0] = selectRows; // console.log(doubleArr)
2849
+
2850
+ setDoubleArr(doubleArr); // 这块扁平化成为一位数组
2851
+
2852
+ filterRows = mapRows(doubleArr); // console.log(filterRows)
2853
+
2854
+ setFilterRows(filterRows);
2855
+ sksResult = filterRows.map(function (i) {
2856
+ return i.value;
2857
+ });
2858
+ } else {
2859
+ // 处理单选
2860
+ filterRows = selectRows;
2861
+ sksResult = selectRows.map(function (i) {
2862
+ return i.value;
2863
+ });
2864
+ }
2865
+
2866
+ setSelectedRowKeys(sksResult);
2867
+ setSelectedRows(filterRows);
2868
+ setPopValue(filterRows);
2869
+ setIndeterminate(!!filterRows.length && filterRows.length < (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2870
+ setCheckedAll(filterRows.length === (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total));
2871
+ };
2872
+
2873
+ var rowSelection = {
2874
+ type: selectMode ? 'checkbox' : 'radio',
2875
+ selectedRowKeys: selectedRowKeys,
2876
+ onChange: function onChange(sks, srs) {
2877
+ onChangeSelectedKeys(sks, srs);
2878
+ }
2879
+ };
2880
+
2881
+ var onDoubleClickSelect = function onDoubleClickSelect(e, record) {
2882
+ if (!selectMode) {
2883
+ var srs = [JSON.parse(JSON.stringify(record))];
2884
+ var sks = srs.map(function (i) {
2885
+ return i.value;
2886
+ });
2887
+ onChangeSelectedKeys(sks, srs);
2888
+ }
2889
+ };
2890
+
2891
+ var themeColor = {
2892
+ color: '#1890ff'
2893
+ };
2894
+
2895
+ var formItem = function formItem(list) {
2896
+ if (isModalVisible && (list === null || list === void 0 ? void 0 : list.length)) {
2897
+ return list.map(function (i) {
2898
+ var _i$field, _i$field3;
2899
+
2900
+ 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') {
2901
+ var _i$field2, _i$initialSource;
2902
+
2903
+ return /*#__PURE__*/React.createElement(Form.Item, {
2904
+ name: i.name,
2905
+ label: i.label,
2906
+ key: i.name
2907
+ }, /*#__PURE__*/React.createElement(Select, _objectSpread2({
2908
+ style: {
2909
+ width: '100%'
2910
+ },
2911
+ placeholder: "\u8BF7\u9009\u62E9"
2912
+ }, 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) {
2913
+ return /*#__PURE__*/React.createElement(Option, {
2914
+ value: m.value,
2915
+ key: m.value
2916
+ }, m.text);
2917
+ }))));
2918
+ } // 默认type是input
2919
+
2920
+
2921
+ return /*#__PURE__*/React.createElement(Form.Item, {
2922
+ name: i.name,
2923
+ label: i.label,
2924
+ key: i.name
2925
+ }, /*#__PURE__*/React.createElement(Input, _objectSpread2({
2926
+ style: {
2927
+ width: '100%'
2928
+ },
2929
+ placeholder: "\u8BF7\u8F93\u5165",
2930
+ allowClear: true,
2931
+ maxLength: 100
2932
+ }, i === null || i === void 0 ? void 0 : (_i$field3 = i.field) === null || _i$field3 === void 0 ? void 0 : _i$field3.props)));
2933
+ });
2934
+ } else {
2935
+ return null;
2936
+ }
2937
+ };
2938
+
2939
+ return /*#__PURE__*/React.createElement("div", {
2940
+ className: 'search_select'
2941
+ }, /*#__PURE__*/React.createElement("div", {
2942
+ className: "search_select_show",
2943
+ id: 'search_select_div'
2944
+ }, /*#__PURE__*/React.createElement(Select, _objectSpread2(_objectSpread2({
2945
+ virtual: true,
2946
+ labelInValue: labelInValue,
2947
+ value: value,
2948
+ onChange: onChange,
2949
+ dropdownRender: function dropdownRender(menu) {
2950
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
2951
+ value: searchValue,
2952
+ style: {
2953
+ width: '98%',
2954
+ marginLeft: '1%'
2955
+ },
2956
+ placeholder: "\u8BF7\u8F93\u5165",
2957
+ onChange: function onChange(e) {
2958
+ return onSearchChange(e);
2959
+ },
2960
+ onBlur: onSearchBlur,
2961
+ onKeyDown: function onKeyDown(e) {
2962
+ // 阻止多选的冒泡
2963
+ e.stopPropagation();
2964
+ }
2965
+ }), /*#__PURE__*/React.createElement(Divider, {
2966
+ style: {
2967
+ margin: '8px 0'
2968
+ }
2969
+ }), menu);
2970
+ },
2971
+ notFoundContent: fetching ? /*#__PURE__*/React.createElement(Spin, {
2972
+ size: "small"
2973
+ }) : /*#__PURE__*/React.createElement("div", {
2974
+ style: {
2975
+ textAlign: 'center'
2976
+ }
2977
+ }, /*#__PURE__*/React.createElement("div", {
2978
+ style: {
2979
+ marginBottom: 16
2980
+ }
2981
+ }, /*#__PURE__*/React.createElement(CopyOutlined$2, {
2982
+ style: {
2983
+ fontSize: '50px'
2984
+ }
2985
+ })), /*#__PURE__*/React.createElement("div", null, "\u65E0\u5339\u914D\u7ED3\u679C\uFF0C\u8BF7\u66F4\u6362\u5176\u4ED6\u5185\u5BB9\u518D\u8BD5")),
2986
+ onPopupScroll: SelectScroll
2987
+ }, currentSelectProps), {}, {
2988
+ getPopupContainer: function getPopupContainer() {
2989
+ return document.getElementById('search_select_div');
2990
+ },
2991
+ style: {
2992
+ width: 'calc(100% - 30px)'
2993
+ },
2994
+ placeholder: "\u8BF7\u9009\u62E9"
2995
+ }), items.map(function (item) {
2996
+ return /*#__PURE__*/React.createElement(Option, {
2997
+ key: item.value,
2998
+ label: item.text
2999
+ }, LightHeightOption({
3000
+ text: "".concat(item.value, " ").concat(item.text),
3001
+ filterTxt: searchValue
3002
+ }));
3003
+ })), /*#__PURE__*/React.createElement(Button, {
3004
+ style: {
3005
+ width: '30px',
3006
+ padding: '2px',
3007
+ height: 'auto'
3008
+ },
3009
+ onClick: showModal,
3010
+ type: "primary"
3011
+ }, /*#__PURE__*/React.createElement(SearchOutlined$2, null))), /*#__PURE__*/React.createElement(Modal, {
3012
+ width: '80%',
3013
+ title: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalTableTitle,
3014
+ visible: isModalVisible,
3015
+ onOk: handleOk,
3016
+ onCancel: handleCancel,
3017
+ footer: [/*#__PURE__*/React.createElement(Button, {
3018
+ key: "back",
3019
+ onClick: handleCancel
3020
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
3021
+ key: "submit",
3022
+ type: "primary",
3023
+ onClick: handleOk,
3024
+ disabled: (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
3025
+ }, "\u786E\u5B9A")]
3026
+ }, /*#__PURE__*/React.createElement("div", {
3027
+ className: 'search_select_wrapper'
3028
+ }, /*#__PURE__*/React.createElement("div", {
3029
+ className: 'search_select_wrapper_click_flag',
3030
+ onClick: function onClick() {
3031
+ return setCaretLeftFlag(!caretLeftFlag);
3032
+ }
3033
+ }, /*#__PURE__*/React.createElement(CaretLeftOutlined$2, {
3034
+ className: caretLeftFlag ? 'search_select_wrapper_click_flag_arrow' : 'search_select_wrapper_click_flag_arrow_1'
3035
+ })), /*#__PURE__*/React.createElement("div", {
3036
+ className: caretLeftFlag ? 'search_select_wrapper_left' : 'search_select_wrapper_left1'
3037
+ }, /*#__PURE__*/React.createElement("div", {
3038
+ className: 'select_list_columns'
3039
+ }, /*#__PURE__*/React.createElement("div", {
3040
+ className: 'select_list_columns_tips'
3041
+ }, "\u641C\u7D22"), /*#__PURE__*/React.createElement("div", {
3042
+ className: 'select_list_columns_formItems'
3043
+ }, /*#__PURE__*/React.createElement(Form, {
3044
+ form: form,
3045
+ layout: 'vertical',
3046
+ key: 'modalForm'
3047
+ }, formItem(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableSearchForm)))), /*#__PURE__*/React.createElement("div", {
3048
+ className: 'select_list_searchButton'
3049
+ }, /*#__PURE__*/React.createElement(Button, {
3050
+ key: 'reset',
3051
+ className: 'select_list_button_space',
3052
+ onClick: onResetTable
3053
+ }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
3054
+ key: 'search',
3055
+ type: "primary",
3056
+ onClick: onSearchTable
3057
+ }, "\u67E5\u8BE2"))), /*#__PURE__*/React.createElement("div", {
3058
+ className: caretLeftFlag ? 'search_select_wrapper_right' : 'search_select_wrapper_right1'
3059
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
3060
+ className: 'select_list_selectTips'
3061
+ }, /*#__PURE__*/React.createElement("div", {
3062
+ style: {
3063
+ marginLeft: 8
3064
+ }
3065
+ }, "\u641C\u7D22\u7ED3\u679C\u5171", /*#__PURE__*/React.createElement("span", {
3066
+ style: themeColor
3067
+ }, (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", {
3068
+ style: themeColor
3069
+ }, (selectedRowKeys === null || selectedRowKeys === void 0 ? void 0 : selectedRowKeys.length) || 0), "\u9879") : ''), /*#__PURE__*/React.createElement("div", {
3070
+ style: {
3071
+ color: 'rgba(127, 127, 127, 0.6470588235294118)'
3072
+ }
3073
+ }, selectMode ? '勾选后点击确定按钮完成选择' : '双击数据行或单击按钮完成选择')), /*#__PURE__*/React.createElement(Table, {
3074
+ size: 'small',
3075
+ rowSelection: rowSelection,
3076
+ columns: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns,
3077
+ dataSource: tableData,
3078
+ pagination: tablePagination,
3079
+ onChange: handleTableChange,
3080
+ rowKey: 'code',
3081
+ scroll: {
3082
+ x: modalTableProps.overScrollX || 'max-content',
3083
+ y: modalTableProps.overScrollY || null
3084
+ },
3085
+ onRow: function onRow(record) {
3086
+ return {
3087
+ onDoubleClick: function onDoubleClick(event) {
3088
+ return onDoubleClickSelect(event, record);
3089
+ }
3090
+ };
3091
+ }
3092
+ }), selectMode ? /*#__PURE__*/React.createElement("div", {
3093
+ className: 'select_list_selectAll'
3094
+ }, /*#__PURE__*/React.createElement(Checkbox, {
3095
+ indeterminate: indeterminate,
3096
+ checked: checkedAll,
3097
+ onChange: onChangeCheckAll
3098
+ }), " \u5168\u9009\u6240\u6709\u9875\u9762") : '')))));
3099
+ };
3100
+
3101
+ var getDicData = function getDicData(dicCode) {
3102
+ var dicData = {};
3103
+
3104
+ {
3105
+ var storageDic = localStorage.getItem('dicData') ? JSON.parse(localStorage.getItem('dicData') || '{}') : {};
3106
+ dicData = storageDic[dicCode];
3107
+ }
3108
+
3109
+ if (!dicData || !dicData.length) ;
3110
+
3111
+ return dicData;
3112
+ };
3113
+
3114
+ var getDictionarySource = function getDictionarySource(dicCode) {
3115
+ var needConvertInterger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3116
+ var dicData = getDicData(dicCode);
3117
+
3118
+ try {
3119
+ if (needConvertInterger) {
3120
+ dicData = dicData.map(function (item) {
3121
+ return _objectSpread2(_objectSpread2({}, item), {}, {
3122
+ value: parseFloat(item.value)
3123
+ });
3124
+ });
3125
+ }
3126
+ } catch (e) {}
3127
+
3128
+ return dicData;
3129
+ };
3130
+
3131
+ var getDictionaryTextByValue = function getDictionaryTextByValue(dicCode, value) {
3132
+ var dicData = getDicData(dicCode);
3133
+ if (value === undefined) return '';
3134
+ var dicItemArray = dicData === null || dicData === void 0 ? void 0 : dicData.filter(function (item) {
3135
+ return item.value === value.toString();
3136
+ });
3137
+
3138
+ if (!(dicItemArray === null || dicItemArray === void 0 ? void 0 : dicItemArray.length)) {
3139
+ // throw new Error(`当前${dicCode}字典值合没有${value}的数据`)
3140
+ return value;
3141
+ }
3142
+
3143
+ return dicItemArray[0].text;
3144
+ };
3145
+
3146
+ var loadSelectSource = function loadSelectSource(url, params) {
3147
+ return new Promise(function (resolve, reject) {
3148
+ axios.get("".concat(url, "?").concat(stringify(params))).then(function (result) {
3149
+ result = result.data;
3150
+
3151
+ if (result.status !== '0') {
3152
+ message.error(result.msg);
3153
+ return;
3154
+ }
3155
+
3156
+ resolve(result);
3157
+ }).catch(function (err) {
3158
+ reject(err);
3159
+ });
3160
+ });
3161
+ };
3162
+
3163
+ function commonFun(type) {
3164
+ // 默认type === 'supplier' 供应商选择器
3165
+ var requestConfig = {
3166
+ url: "/bop/api/supplier",
3167
+ filter: 'qp-codeAndName-like',
3168
+ otherParams: {},
3169
+ mappingTextField: 'name',
3170
+ mappingValueField: 'code'
3171
+ };
3172
+ /*
3173
+ * 处理 格式化下拉框数据源
3174
+ * reData 必传 promise返回响应的数据 格式为[{},{},{},...] Promise.all第一个参数数组有多少个数组长度就是多少,其中每个对象为每次请求的结果数据
3175
+ * 每个结果数据格式为{ status: '0', msg: 'success', data: { items: [], total: 1, size: 1, page: 1 }, traceId: 'baba..'}
3176
+ * position 必传 为获取Promise.all请求结果的位置
3177
+ * changePosition 必传 为搜索表单Form中需要更改数据源的Item项的位置
3178
+ * changeSearchForm 必传 为搜索表单Form数据
3179
+ * */
3180
+
3181
+ var formatSource = function formatSource(reData, position, changePosition, changeSearchForm) {
3182
+ var _reData$position, _reData$position$data;
3183
+
3184
+ var data = reData && ((_reData$position = reData[position]) === null || _reData$position === void 0 ? void 0 : (_reData$position$data = _reData$position.data) === null || _reData$position$data === void 0 ? void 0 : _reData$position$data.items) || [];
3185
+ var formatData = (data === null || data === void 0 ? void 0 : data.length) ? data.map(function (v) {
3186
+ return {
3187
+ text: v.name,
3188
+ value: v.code
3189
+ };
3190
+ }) : [];
3191
+ changeSearchForm[changePosition] = _objectSpread2(_objectSpread2({}, changeSearchForm[changePosition]), {}, {
3192
+ initialSource: formatData
3193
+ });
3194
+ };
3195
+
3196
+ var tableSearchForm = [];
3197
+
3198
+ if (type === 'supplier') {
3199
+ tableSearchForm = [{
3200
+ name: 'qp-name-like',
3201
+ label: '客户名称'
3202
+ }, {
3203
+ name: 'qp-code-like',
3204
+ label: '客户编码'
3205
+ }, {
3206
+ name: 'qp-conglomerateCode-in',
3207
+ type: 'select',
3208
+ label: '归属集团',
3209
+ field: {
3210
+ type: 'select',
3211
+ props: {
3212
+ mode: 'multiple',
3213
+ notFoundContent: '暂无数据',
3214
+ allowClear: true,
3215
+ showSearch: true,
3216
+ showArrow: true,
3217
+ maxTagCount: 1,
3218
+ optionFilterProp: 'children',
3219
+ filterOption: function filterOption(input, option) {
3220
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3221
+ }
3222
+ }
3223
+ } // remoteSource: {
3224
+ // init: true, // 初始请求数据源
3225
+ // url: '/bop/api/company',
3226
+ // params: {
3227
+ // pageSize: 5000,
3228
+ // currentPage: 1,
3229
+ // 'qp-companyType-eq': '30',
3230
+ // },
3231
+ // converter({ data }: any) {
3232
+ // if (data?.items == undefined || data?.items?.length == 0) {
3233
+ // return [];
3234
+ // }
3235
+ // return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
3236
+ // },
3237
+ // },
3238
+ // initialSource: [{ text: '英伦宝贝儿童用品有限公司', value: 'A0001' }]
3239
+
3240
+ }, {
3241
+ name: 'qp-accountingCode-in',
3242
+ type: 'select',
3243
+ label: '归属核算主体',
3244
+ field: {
3245
+ type: 'select',
3246
+ props: {
3247
+ mode: 'multiple',
3248
+ notFoundContent: '暂无数据',
3249
+ allowClear: true,
3250
+ showSearch: true,
3251
+ showArrow: true,
3252
+ maxTagCount: 1,
3253
+ optionFilterProp: 'children',
3254
+ filterOption: function filterOption(input, option) {
3255
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3256
+ }
3257
+ }
3258
+ } // remoteSource: {
3259
+ // init: true, // 初始请求数据源
3260
+ // url: `/bop/api/accountingSubject`,
3261
+ // params: {
3262
+ // pageSize: 5000,
3263
+ // currentPage: 1,
3264
+ // },
3265
+ // converter({ data }: any ) {
3266
+ // if (data?.items == undefined || data?.items?.length == 0) {
3267
+ // return [];
3268
+ // }
3269
+ // return data?.items.map((v: any) => ({ text: v.name, value: v.code }));
3270
+ // },
3271
+ // },
3272
+ // initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
3273
+
3274
+ }, {
3275
+ name: 'qp-companyCode-in',
3276
+ type: 'select',
3277
+ label: '归属法人公司',
3278
+ field: {
3279
+ type: 'select',
3280
+ props: {
3281
+ mode: 'multiple',
3282
+ notFoundContent: '暂无数据',
3283
+ allowClear: true,
3284
+ showSearch: true,
3285
+ showArrow: true,
3286
+ maxTagCount: 1,
3287
+ optionFilterProp: 'children',
3288
+ filterOption: function filterOption(input, option) {
3289
+ return option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
3290
+ }
3291
+ }
3292
+ } // remoteSource: {
3293
+ // init: true, // 初始请求数据源
3294
+ // url: '/bop/api/company',
3295
+ // params: {
3296
+ // pageSize: 5000,
3297
+ // currentPage: 1,
3298
+ // 'qp-companyType-eq': '20',
3299
+ // },
3300
+ // converter: ({ data }: any) => {
3301
+ // return data.items
3302
+ // ? data.items.map((item: any) => {
3303
+ // return {
3304
+ // text: item.name,
3305
+ // value: item.code,
3306
+ // };
3307
+ // })
3308
+ // : [];
3309
+ // },
3310
+ // },
3311
+ // initialSource: [{ text: '上海哲雄母婴用品有限公司', value: 'F002' }, { text: '上海英伦宝贝儿童用品有限公司', value: 'F001' }]
3312
+
3313
+ }, {
3314
+ name: 'qp-sharingType-eq',
3315
+ type: 'select',
3316
+ label: '共享类型',
3317
+ initialSource: getDictionarySource('UC000013')
3318
+ }];
3319
+ Promise.all([loadSelectSource('/bop/api/company', {
3320
+ pageSize: 5000,
3321
+ currentPage: 1,
3322
+ 'qp-companyType-eq': '30'
3323
+ }), loadSelectSource('/bop/api/accountingSubject', {
3324
+ pageSize: 5000,
3325
+ currentPage: 1
3326
+ }), loadSelectSource('/bop/api/company', {
3327
+ pageSize: 5000,
3328
+ currentPage: 1,
3329
+ 'qp-companyType-eq': '20'
3330
+ })]).then(function (x) {
3331
+ formatSource(x, 0, 2, tableSearchForm);
3332
+ formatSource(x, 1, 3, tableSearchForm);
3333
+ formatSource(x, 2, 4, tableSearchForm);
3334
+ });
3335
+ }
3336
+
3337
+ var modalTableProps = {
3338
+ modalTableTitle: '选择供应商',
3339
+ tableSearchForm: tableSearchForm,
3340
+ tableColumns: [{
3341
+ title: '客户编码',
3342
+ dataIndex: 'code'
3343
+ }, {
3344
+ title: '客户名称',
3345
+ dataIndex: 'name'
3346
+ }, {
3347
+ title: '归属集团',
3348
+ dataIndex: 'conglomerateName'
3349
+ }, {
3350
+ title: '归属法人公司',
3351
+ dataIndex: 'legalCompanyName'
3352
+ }, {
3353
+ title: '归属核算主体',
3354
+ dataIndex: 'accountingName'
3355
+ }, {
3356
+ title: '共享类型',
3357
+ dataIndex: 'sharingType',
3358
+ render: function render(text) {
3359
+ return getDictionaryTextByValue('UC000013', text);
3360
+ }
3361
+ }]
3362
+ }; // 商品选择器
3363
+
3364
+ return {
3365
+ modalTableProps: modalTableProps,
3366
+ requestConfig: requestConfig
3367
+ };
3368
+ }
3369
+
3370
+ var BusinessSearchSelect = function BusinessSearchSelect(props) {
3371
+ var businessType = (props === null || props === void 0 ? void 0 : props.SelectBusinessType) || 'supplier';
3372
+
3373
+ var _commonFun = commonFun(businessType),
3374
+ requestConfig = _commonFun.requestConfig,
3375
+ modalTableProps = _commonFun.modalTableProps;
3376
+
3377
+ var currentProps = _objectSpread2(_objectSpread2({
3378
+ requestConfig: requestConfig
3379
+ }, props), {}, {
3380
+ modalTableProps: modalTableProps
3381
+ });
3382
+
3383
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(SearchSelect, _objectSpread2({}, currentProps)));
3384
+ };
3385
+
3386
+ /*
3387
+ * @Description:
3388
+ * @Author: rodchen
3389
+ * @Date: 2021-11-30 22:59:39
3390
+ * @LastEditTime: 2022-01-14 16:10:27
3391
+ * @LastEditors: rodchen
3392
+ */
3393
+
3394
+ var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
3395
+ axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
3396
+
3397
+ export { BusinessSearchSelect, index as CheckOneUser, DataValidation, QueryMutipleInput, SearchSelect };