@bit-sun/business-component 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +16 -0
- package/.fatherrc.ts +4 -0
- package/.prettierignore +7 -0
- package/.prettierrc +11 -0
- package/.umirc.ts +28 -0
- package/README.md +27 -0
- package/dist/SheetTable/index.d.ts +141 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +2102 -0
- package/dist/index.js +2111 -0
- package/docs/index.md +21 -0
- package/package.json +49 -0
- package/src/SheetTable/index.less +63 -0
- package/src/SheetTable/index.md +32 -0
- package/src/SheetTable/index.tsx +599 -0
- package/src/index.ts +9 -0
- package/tsconfig.json +29 -0
- package/typings.d.ts +2 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
var reactBeautifulDnd = require('react-beautiful-dnd');
|
|
8
|
+
require('antd/dist/antd.css');
|
|
9
|
+
var classNames = require('classnames');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
15
|
+
|
|
16
|
+
function ownKeys(object, enumerableOnly) {
|
|
17
|
+
var keys = Object.keys(object);
|
|
18
|
+
|
|
19
|
+
if (Object.getOwnPropertySymbols) {
|
|
20
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
21
|
+
|
|
22
|
+
if (enumerableOnly) {
|
|
23
|
+
symbols = symbols.filter(function (sym) {
|
|
24
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
keys.push.apply(keys, symbols);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _objectSpread2(target) {
|
|
35
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
36
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
37
|
+
|
|
38
|
+
if (i % 2) {
|
|
39
|
+
ownKeys(Object(source), true).forEach(function (key) {
|
|
40
|
+
_defineProperty(target, key, source[key]);
|
|
41
|
+
});
|
|
42
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
43
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
44
|
+
} else {
|
|
45
|
+
ownKeys(Object(source)).forEach(function (key) {
|
|
46
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function _classCallCheck(instance, Constructor) {
|
|
55
|
+
if (!(instance instanceof Constructor)) {
|
|
56
|
+
throw new TypeError("Cannot call a class as a function");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function _defineProperties(target, props) {
|
|
61
|
+
for (var i = 0; i < props.length; i++) {
|
|
62
|
+
var descriptor = props[i];
|
|
63
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
64
|
+
descriptor.configurable = true;
|
|
65
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
66
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
71
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
72
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
73
|
+
return Constructor;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function _defineProperty(obj, key, value) {
|
|
77
|
+
if (key in obj) {
|
|
78
|
+
Object.defineProperty(obj, key, {
|
|
79
|
+
value: value,
|
|
80
|
+
enumerable: true,
|
|
81
|
+
configurable: true,
|
|
82
|
+
writable: true
|
|
83
|
+
});
|
|
84
|
+
} else {
|
|
85
|
+
obj[key] = value;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return obj;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function _inherits(subClass, superClass) {
|
|
92
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
93
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
97
|
+
constructor: {
|
|
98
|
+
value: subClass,
|
|
99
|
+
writable: true,
|
|
100
|
+
configurable: true
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function _getPrototypeOf(o) {
|
|
107
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
108
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
109
|
+
};
|
|
110
|
+
return _getPrototypeOf(o);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function _setPrototypeOf(o, p) {
|
|
114
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
115
|
+
o.__proto__ = p;
|
|
116
|
+
return o;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return _setPrototypeOf(o, p);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function _isNativeReflectConstruct() {
|
|
123
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
124
|
+
if (Reflect.construct.sham) return false;
|
|
125
|
+
if (typeof Proxy === "function") return true;
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
129
|
+
return true;
|
|
130
|
+
} catch (e) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function _assertThisInitialized(self) {
|
|
136
|
+
if (self === void 0) {
|
|
137
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return self;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function _possibleConstructorReturn(self, call) {
|
|
144
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
145
|
+
return call;
|
|
146
|
+
} else if (call !== void 0) {
|
|
147
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return _assertThisInitialized(self);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function _createSuper(Derived) {
|
|
154
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
155
|
+
|
|
156
|
+
return function _createSuperInternal() {
|
|
157
|
+
var Super = _getPrototypeOf(Derived),
|
|
158
|
+
result;
|
|
159
|
+
|
|
160
|
+
if (hasNativeReflectConstruct) {
|
|
161
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
162
|
+
|
|
163
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
164
|
+
} else {
|
|
165
|
+
result = Super.apply(this, arguments);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return _possibleConstructorReturn(this, result);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function _readOnlyError(name) {
|
|
173
|
+
throw new TypeError("\"" + name + "\" is read-only");
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function _slicedToArray(arr, i) {
|
|
177
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function _toConsumableArray(arr) {
|
|
181
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function _arrayWithoutHoles(arr) {
|
|
185
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function _arrayWithHoles(arr) {
|
|
189
|
+
if (Array.isArray(arr)) return arr;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function _iterableToArray(iter) {
|
|
193
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function _iterableToArrayLimit(arr, i) {
|
|
197
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
198
|
+
|
|
199
|
+
if (_i == null) return;
|
|
200
|
+
var _arr = [];
|
|
201
|
+
var _n = true;
|
|
202
|
+
var _d = false;
|
|
203
|
+
|
|
204
|
+
var _s, _e;
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
208
|
+
_arr.push(_s.value);
|
|
209
|
+
|
|
210
|
+
if (i && _arr.length === i) break;
|
|
211
|
+
}
|
|
212
|
+
} catch (err) {
|
|
213
|
+
_d = true;
|
|
214
|
+
_e = err;
|
|
215
|
+
} finally {
|
|
216
|
+
try {
|
|
217
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
218
|
+
} finally {
|
|
219
|
+
if (_d) throw _e;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return _arr;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
227
|
+
if (!o) return;
|
|
228
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
229
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
230
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
231
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
232
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function _arrayLikeToArray(arr, len) {
|
|
236
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
237
|
+
|
|
238
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
239
|
+
|
|
240
|
+
return arr2;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function _nonIterableSpread() {
|
|
244
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function _nonIterableRest() {
|
|
248
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
var IconContext = /*#__PURE__*/React.createContext({});
|
|
252
|
+
|
|
253
|
+
function _defineProperty$1(obj, key, value) {
|
|
254
|
+
if (key in obj) {
|
|
255
|
+
Object.defineProperty(obj, key, {
|
|
256
|
+
value: value,
|
|
257
|
+
enumerable: true,
|
|
258
|
+
configurable: true,
|
|
259
|
+
writable: true
|
|
260
|
+
});
|
|
261
|
+
} else {
|
|
262
|
+
obj[key] = value;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return obj;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
269
|
+
var keys = Object.keys(object);
|
|
270
|
+
|
|
271
|
+
if (Object.getOwnPropertySymbols) {
|
|
272
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
273
|
+
|
|
274
|
+
if (enumerableOnly) {
|
|
275
|
+
symbols = symbols.filter(function (sym) {
|
|
276
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
keys.push.apply(keys, symbols);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return keys;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function _objectSpread2$1(target) {
|
|
287
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
288
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
289
|
+
|
|
290
|
+
if (i % 2) {
|
|
291
|
+
ownKeys$1(Object(source), true).forEach(function (key) {
|
|
292
|
+
_defineProperty$1(target, key, source[key]);
|
|
293
|
+
});
|
|
294
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
295
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
296
|
+
} else {
|
|
297
|
+
ownKeys$1(Object(source)).forEach(function (key) {
|
|
298
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return target;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function _arrayWithHoles$1(arr) {
|
|
307
|
+
if (Array.isArray(arr)) return arr;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function _iterableToArrayLimit$1(arr, i) {
|
|
311
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
312
|
+
|
|
313
|
+
if (_i == null) return;
|
|
314
|
+
var _arr = [];
|
|
315
|
+
var _n = true;
|
|
316
|
+
var _d = false;
|
|
317
|
+
|
|
318
|
+
var _s, _e;
|
|
319
|
+
|
|
320
|
+
try {
|
|
321
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
322
|
+
_arr.push(_s.value);
|
|
323
|
+
|
|
324
|
+
if (i && _arr.length === i) break;
|
|
325
|
+
}
|
|
326
|
+
} catch (err) {
|
|
327
|
+
_d = true;
|
|
328
|
+
_e = err;
|
|
329
|
+
} finally {
|
|
330
|
+
try {
|
|
331
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
332
|
+
} finally {
|
|
333
|
+
if (_d) throw _e;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return _arr;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function _arrayLikeToArray$1(arr, len) {
|
|
341
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
342
|
+
|
|
343
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
344
|
+
arr2[i] = arr[i];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
return arr2;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function _unsupportedIterableToArray$1(o, minLen) {
|
|
351
|
+
if (!o) return;
|
|
352
|
+
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
|
353
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
354
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
355
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
356
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function _nonIterableRest$1() {
|
|
360
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function _slicedToArray$1(arr, i) {
|
|
364
|
+
return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
368
|
+
if (source == null) return {};
|
|
369
|
+
var target = {};
|
|
370
|
+
var sourceKeys = Object.keys(source);
|
|
371
|
+
var key, i;
|
|
372
|
+
|
|
373
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
374
|
+
key = sourceKeys[i];
|
|
375
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
376
|
+
target[key] = source[key];
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return target;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function _objectWithoutProperties(source, excluded) {
|
|
383
|
+
if (source == null) return {};
|
|
384
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
385
|
+
var key, i;
|
|
386
|
+
|
|
387
|
+
if (Object.getOwnPropertySymbols) {
|
|
388
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
389
|
+
|
|
390
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
391
|
+
key = sourceSymbolKeys[i];
|
|
392
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
393
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
394
|
+
target[key] = source[key];
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return target;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function _typeof(obj) {
|
|
402
|
+
"@babel/helpers - typeof";
|
|
403
|
+
|
|
404
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
405
|
+
_typeof = function _typeof(obj) {
|
|
406
|
+
return typeof obj;
|
|
407
|
+
};
|
|
408
|
+
} else {
|
|
409
|
+
_typeof = function _typeof(obj) {
|
|
410
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return _typeof(obj);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Take input from [0, n] and return it as [0, 1]
|
|
419
|
+
* @hidden
|
|
420
|
+
*/
|
|
421
|
+
function bound01(n, max) {
|
|
422
|
+
if (isOnePointZero(n)) {
|
|
423
|
+
n = '100%';
|
|
424
|
+
}
|
|
425
|
+
var isPercent = isPercentage(n);
|
|
426
|
+
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
427
|
+
// Automatically convert percentage into number
|
|
428
|
+
if (isPercent) {
|
|
429
|
+
n = parseInt(String(n * max), 10) / 100;
|
|
430
|
+
}
|
|
431
|
+
// Handle floating point rounding errors
|
|
432
|
+
if (Math.abs(n - max) < 0.000001) {
|
|
433
|
+
return 1;
|
|
434
|
+
}
|
|
435
|
+
// Convert into [0, 1] range if it isn't already
|
|
436
|
+
if (max === 360) {
|
|
437
|
+
// If n is a hue given in degrees,
|
|
438
|
+
// wrap around out-of-range values into [0, 360] range
|
|
439
|
+
// then convert into [0, 1].
|
|
440
|
+
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
// If n not a hue given in degrees
|
|
444
|
+
// Convert into [0, 1] range if it isn't already.
|
|
445
|
+
n = (n % max) / parseFloat(String(max));
|
|
446
|
+
}
|
|
447
|
+
return n;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
451
|
+
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
452
|
+
* @hidden
|
|
453
|
+
*/
|
|
454
|
+
function isOnePointZero(n) {
|
|
455
|
+
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Check to see if string passed in is a percentage
|
|
459
|
+
* @hidden
|
|
460
|
+
*/
|
|
461
|
+
function isPercentage(n) {
|
|
462
|
+
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
466
|
+
* @hidden
|
|
467
|
+
*/
|
|
468
|
+
function boundAlpha(a) {
|
|
469
|
+
a = parseFloat(a);
|
|
470
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
471
|
+
a = 1;
|
|
472
|
+
}
|
|
473
|
+
return a;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Replace a decimal with it's percentage value
|
|
477
|
+
* @hidden
|
|
478
|
+
*/
|
|
479
|
+
function convertToPercentage(n) {
|
|
480
|
+
if (n <= 1) {
|
|
481
|
+
return Number(n) * 100 + "%";
|
|
482
|
+
}
|
|
483
|
+
return n;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Force a hex value to have 2 characters
|
|
487
|
+
* @hidden
|
|
488
|
+
*/
|
|
489
|
+
function pad2(c) {
|
|
490
|
+
return c.length === 1 ? '0' + c : String(c);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
494
|
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
495
|
+
/**
|
|
496
|
+
* Handle bounds / percentage checking to conform to CSS color spec
|
|
497
|
+
* <http://www.w3.org/TR/css3-color/>
|
|
498
|
+
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
499
|
+
* *Returns:* { r, g, b } in [0, 255]
|
|
500
|
+
*/
|
|
501
|
+
function rgbToRgb(r, g, b) {
|
|
502
|
+
return {
|
|
503
|
+
r: bound01(r, 255) * 255,
|
|
504
|
+
g: bound01(g, 255) * 255,
|
|
505
|
+
b: bound01(b, 255) * 255,
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
function hue2rgb(p, q, t) {
|
|
509
|
+
if (t < 0) {
|
|
510
|
+
t += 1;
|
|
511
|
+
}
|
|
512
|
+
if (t > 1) {
|
|
513
|
+
t -= 1;
|
|
514
|
+
}
|
|
515
|
+
if (t < 1 / 6) {
|
|
516
|
+
return p + (q - p) * (6 * t);
|
|
517
|
+
}
|
|
518
|
+
if (t < 1 / 2) {
|
|
519
|
+
return q;
|
|
520
|
+
}
|
|
521
|
+
if (t < 2 / 3) {
|
|
522
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
523
|
+
}
|
|
524
|
+
return p;
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Converts an HSL color value to RGB.
|
|
528
|
+
*
|
|
529
|
+
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
530
|
+
* *Returns:* { r, g, b } in the set [0, 255]
|
|
531
|
+
*/
|
|
532
|
+
function hslToRgb(h, s, l) {
|
|
533
|
+
var r;
|
|
534
|
+
var g;
|
|
535
|
+
var b;
|
|
536
|
+
h = bound01(h, 360);
|
|
537
|
+
s = bound01(s, 100);
|
|
538
|
+
l = bound01(l, 100);
|
|
539
|
+
if (s === 0) {
|
|
540
|
+
// achromatic
|
|
541
|
+
g = l;
|
|
542
|
+
b = l;
|
|
543
|
+
r = l;
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
547
|
+
var p = 2 * l - q;
|
|
548
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
549
|
+
g = hue2rgb(p, q, h);
|
|
550
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
551
|
+
}
|
|
552
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Converts an RGB color value to HSV
|
|
556
|
+
*
|
|
557
|
+
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
558
|
+
* *Returns:* { h, s, v } in [0,1]
|
|
559
|
+
*/
|
|
560
|
+
function rgbToHsv(r, g, b) {
|
|
561
|
+
r = bound01(r, 255);
|
|
562
|
+
g = bound01(g, 255);
|
|
563
|
+
b = bound01(b, 255);
|
|
564
|
+
var max = Math.max(r, g, b);
|
|
565
|
+
var min = Math.min(r, g, b);
|
|
566
|
+
var h = 0;
|
|
567
|
+
var v = max;
|
|
568
|
+
var d = max - min;
|
|
569
|
+
var s = max === 0 ? 0 : d / max;
|
|
570
|
+
if (max === min) {
|
|
571
|
+
h = 0; // achromatic
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
switch (max) {
|
|
575
|
+
case r:
|
|
576
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
577
|
+
break;
|
|
578
|
+
case g:
|
|
579
|
+
h = (b - r) / d + 2;
|
|
580
|
+
break;
|
|
581
|
+
case b:
|
|
582
|
+
h = (r - g) / d + 4;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
h /= 6;
|
|
586
|
+
}
|
|
587
|
+
return { h: h, s: s, v: v };
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Converts an HSV color value to RGB.
|
|
591
|
+
*
|
|
592
|
+
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
593
|
+
* *Returns:* { r, g, b } in the set [0, 255]
|
|
594
|
+
*/
|
|
595
|
+
function hsvToRgb(h, s, v) {
|
|
596
|
+
h = bound01(h, 360) * 6;
|
|
597
|
+
s = bound01(s, 100);
|
|
598
|
+
v = bound01(v, 100);
|
|
599
|
+
var i = Math.floor(h);
|
|
600
|
+
var f = h - i;
|
|
601
|
+
var p = v * (1 - s);
|
|
602
|
+
var q = v * (1 - f * s);
|
|
603
|
+
var t = v * (1 - (1 - f) * s);
|
|
604
|
+
var mod = i % 6;
|
|
605
|
+
var r = [v, q, p, p, t, v][mod];
|
|
606
|
+
var g = [t, v, v, q, p, p][mod];
|
|
607
|
+
var b = [p, p, t, v, v, q][mod];
|
|
608
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
609
|
+
}
|
|
610
|
+
/**
|
|
611
|
+
* Converts an RGB color to hex
|
|
612
|
+
*
|
|
613
|
+
* Assumes r, g, and b are contained in the set [0, 255]
|
|
614
|
+
* Returns a 3 or 6 character hex
|
|
615
|
+
*/
|
|
616
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
617
|
+
var hex = [
|
|
618
|
+
pad2(Math.round(r).toString(16)),
|
|
619
|
+
pad2(Math.round(g).toString(16)),
|
|
620
|
+
pad2(Math.round(b).toString(16)),
|
|
621
|
+
];
|
|
622
|
+
// Return a 3 character hex if possible
|
|
623
|
+
if (allow3Char &&
|
|
624
|
+
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
625
|
+
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
626
|
+
hex[2].startsWith(hex[2].charAt(1))) {
|
|
627
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
628
|
+
}
|
|
629
|
+
return hex.join('');
|
|
630
|
+
}
|
|
631
|
+
/** Converts a hex value to a decimal */
|
|
632
|
+
function convertHexToDecimal(h) {
|
|
633
|
+
return parseIntFromHex(h) / 255;
|
|
634
|
+
}
|
|
635
|
+
/** Parse a base-16 hex value into a base-10 integer */
|
|
636
|
+
function parseIntFromHex(val) {
|
|
637
|
+
return parseInt(val, 16);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
641
|
+
/**
|
|
642
|
+
* @hidden
|
|
643
|
+
*/
|
|
644
|
+
var names = {
|
|
645
|
+
aliceblue: '#f0f8ff',
|
|
646
|
+
antiquewhite: '#faebd7',
|
|
647
|
+
aqua: '#00ffff',
|
|
648
|
+
aquamarine: '#7fffd4',
|
|
649
|
+
azure: '#f0ffff',
|
|
650
|
+
beige: '#f5f5dc',
|
|
651
|
+
bisque: '#ffe4c4',
|
|
652
|
+
black: '#000000',
|
|
653
|
+
blanchedalmond: '#ffebcd',
|
|
654
|
+
blue: '#0000ff',
|
|
655
|
+
blueviolet: '#8a2be2',
|
|
656
|
+
brown: '#a52a2a',
|
|
657
|
+
burlywood: '#deb887',
|
|
658
|
+
cadetblue: '#5f9ea0',
|
|
659
|
+
chartreuse: '#7fff00',
|
|
660
|
+
chocolate: '#d2691e',
|
|
661
|
+
coral: '#ff7f50',
|
|
662
|
+
cornflowerblue: '#6495ed',
|
|
663
|
+
cornsilk: '#fff8dc',
|
|
664
|
+
crimson: '#dc143c',
|
|
665
|
+
cyan: '#00ffff',
|
|
666
|
+
darkblue: '#00008b',
|
|
667
|
+
darkcyan: '#008b8b',
|
|
668
|
+
darkgoldenrod: '#b8860b',
|
|
669
|
+
darkgray: '#a9a9a9',
|
|
670
|
+
darkgreen: '#006400',
|
|
671
|
+
darkgrey: '#a9a9a9',
|
|
672
|
+
darkkhaki: '#bdb76b',
|
|
673
|
+
darkmagenta: '#8b008b',
|
|
674
|
+
darkolivegreen: '#556b2f',
|
|
675
|
+
darkorange: '#ff8c00',
|
|
676
|
+
darkorchid: '#9932cc',
|
|
677
|
+
darkred: '#8b0000',
|
|
678
|
+
darksalmon: '#e9967a',
|
|
679
|
+
darkseagreen: '#8fbc8f',
|
|
680
|
+
darkslateblue: '#483d8b',
|
|
681
|
+
darkslategray: '#2f4f4f',
|
|
682
|
+
darkslategrey: '#2f4f4f',
|
|
683
|
+
darkturquoise: '#00ced1',
|
|
684
|
+
darkviolet: '#9400d3',
|
|
685
|
+
deeppink: '#ff1493',
|
|
686
|
+
deepskyblue: '#00bfff',
|
|
687
|
+
dimgray: '#696969',
|
|
688
|
+
dimgrey: '#696969',
|
|
689
|
+
dodgerblue: '#1e90ff',
|
|
690
|
+
firebrick: '#b22222',
|
|
691
|
+
floralwhite: '#fffaf0',
|
|
692
|
+
forestgreen: '#228b22',
|
|
693
|
+
fuchsia: '#ff00ff',
|
|
694
|
+
gainsboro: '#dcdcdc',
|
|
695
|
+
ghostwhite: '#f8f8ff',
|
|
696
|
+
goldenrod: '#daa520',
|
|
697
|
+
gold: '#ffd700',
|
|
698
|
+
gray: '#808080',
|
|
699
|
+
green: '#008000',
|
|
700
|
+
greenyellow: '#adff2f',
|
|
701
|
+
grey: '#808080',
|
|
702
|
+
honeydew: '#f0fff0',
|
|
703
|
+
hotpink: '#ff69b4',
|
|
704
|
+
indianred: '#cd5c5c',
|
|
705
|
+
indigo: '#4b0082',
|
|
706
|
+
ivory: '#fffff0',
|
|
707
|
+
khaki: '#f0e68c',
|
|
708
|
+
lavenderblush: '#fff0f5',
|
|
709
|
+
lavender: '#e6e6fa',
|
|
710
|
+
lawngreen: '#7cfc00',
|
|
711
|
+
lemonchiffon: '#fffacd',
|
|
712
|
+
lightblue: '#add8e6',
|
|
713
|
+
lightcoral: '#f08080',
|
|
714
|
+
lightcyan: '#e0ffff',
|
|
715
|
+
lightgoldenrodyellow: '#fafad2',
|
|
716
|
+
lightgray: '#d3d3d3',
|
|
717
|
+
lightgreen: '#90ee90',
|
|
718
|
+
lightgrey: '#d3d3d3',
|
|
719
|
+
lightpink: '#ffb6c1',
|
|
720
|
+
lightsalmon: '#ffa07a',
|
|
721
|
+
lightseagreen: '#20b2aa',
|
|
722
|
+
lightskyblue: '#87cefa',
|
|
723
|
+
lightslategray: '#778899',
|
|
724
|
+
lightslategrey: '#778899',
|
|
725
|
+
lightsteelblue: '#b0c4de',
|
|
726
|
+
lightyellow: '#ffffe0',
|
|
727
|
+
lime: '#00ff00',
|
|
728
|
+
limegreen: '#32cd32',
|
|
729
|
+
linen: '#faf0e6',
|
|
730
|
+
magenta: '#ff00ff',
|
|
731
|
+
maroon: '#800000',
|
|
732
|
+
mediumaquamarine: '#66cdaa',
|
|
733
|
+
mediumblue: '#0000cd',
|
|
734
|
+
mediumorchid: '#ba55d3',
|
|
735
|
+
mediumpurple: '#9370db',
|
|
736
|
+
mediumseagreen: '#3cb371',
|
|
737
|
+
mediumslateblue: '#7b68ee',
|
|
738
|
+
mediumspringgreen: '#00fa9a',
|
|
739
|
+
mediumturquoise: '#48d1cc',
|
|
740
|
+
mediumvioletred: '#c71585',
|
|
741
|
+
midnightblue: '#191970',
|
|
742
|
+
mintcream: '#f5fffa',
|
|
743
|
+
mistyrose: '#ffe4e1',
|
|
744
|
+
moccasin: '#ffe4b5',
|
|
745
|
+
navajowhite: '#ffdead',
|
|
746
|
+
navy: '#000080',
|
|
747
|
+
oldlace: '#fdf5e6',
|
|
748
|
+
olive: '#808000',
|
|
749
|
+
olivedrab: '#6b8e23',
|
|
750
|
+
orange: '#ffa500',
|
|
751
|
+
orangered: '#ff4500',
|
|
752
|
+
orchid: '#da70d6',
|
|
753
|
+
palegoldenrod: '#eee8aa',
|
|
754
|
+
palegreen: '#98fb98',
|
|
755
|
+
paleturquoise: '#afeeee',
|
|
756
|
+
palevioletred: '#db7093',
|
|
757
|
+
papayawhip: '#ffefd5',
|
|
758
|
+
peachpuff: '#ffdab9',
|
|
759
|
+
peru: '#cd853f',
|
|
760
|
+
pink: '#ffc0cb',
|
|
761
|
+
plum: '#dda0dd',
|
|
762
|
+
powderblue: '#b0e0e6',
|
|
763
|
+
purple: '#800080',
|
|
764
|
+
rebeccapurple: '#663399',
|
|
765
|
+
red: '#ff0000',
|
|
766
|
+
rosybrown: '#bc8f8f',
|
|
767
|
+
royalblue: '#4169e1',
|
|
768
|
+
saddlebrown: '#8b4513',
|
|
769
|
+
salmon: '#fa8072',
|
|
770
|
+
sandybrown: '#f4a460',
|
|
771
|
+
seagreen: '#2e8b57',
|
|
772
|
+
seashell: '#fff5ee',
|
|
773
|
+
sienna: '#a0522d',
|
|
774
|
+
silver: '#c0c0c0',
|
|
775
|
+
skyblue: '#87ceeb',
|
|
776
|
+
slateblue: '#6a5acd',
|
|
777
|
+
slategray: '#708090',
|
|
778
|
+
slategrey: '#708090',
|
|
779
|
+
snow: '#fffafa',
|
|
780
|
+
springgreen: '#00ff7f',
|
|
781
|
+
steelblue: '#4682b4',
|
|
782
|
+
tan: '#d2b48c',
|
|
783
|
+
teal: '#008080',
|
|
784
|
+
thistle: '#d8bfd8',
|
|
785
|
+
tomato: '#ff6347',
|
|
786
|
+
turquoise: '#40e0d0',
|
|
787
|
+
violet: '#ee82ee',
|
|
788
|
+
wheat: '#f5deb3',
|
|
789
|
+
white: '#ffffff',
|
|
790
|
+
whitesmoke: '#f5f5f5',
|
|
791
|
+
yellow: '#ffff00',
|
|
792
|
+
yellowgreen: '#9acd32',
|
|
793
|
+
};
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* Given a string or object, convert that input to RGB
|
|
797
|
+
*
|
|
798
|
+
* Possible string inputs:
|
|
799
|
+
* ```
|
|
800
|
+
* "red"
|
|
801
|
+
* "#f00" or "f00"
|
|
802
|
+
* "#ff0000" or "ff0000"
|
|
803
|
+
* "#ff000000" or "ff000000"
|
|
804
|
+
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
805
|
+
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
806
|
+
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
807
|
+
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
808
|
+
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
809
|
+
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
810
|
+
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
811
|
+
* ```
|
|
812
|
+
*/
|
|
813
|
+
function inputToRGB(color) {
|
|
814
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
815
|
+
var a = 1;
|
|
816
|
+
var s = null;
|
|
817
|
+
var v = null;
|
|
818
|
+
var l = null;
|
|
819
|
+
var ok = false;
|
|
820
|
+
var format = false;
|
|
821
|
+
if (typeof color === 'string') {
|
|
822
|
+
color = stringInputToObject(color);
|
|
823
|
+
}
|
|
824
|
+
if (typeof color === 'object') {
|
|
825
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
826
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
827
|
+
ok = true;
|
|
828
|
+
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
829
|
+
}
|
|
830
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
831
|
+
s = convertToPercentage(color.s);
|
|
832
|
+
v = convertToPercentage(color.v);
|
|
833
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
834
|
+
ok = true;
|
|
835
|
+
format = 'hsv';
|
|
836
|
+
}
|
|
837
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
838
|
+
s = convertToPercentage(color.s);
|
|
839
|
+
l = convertToPercentage(color.l);
|
|
840
|
+
rgb = hslToRgb(color.h, s, l);
|
|
841
|
+
ok = true;
|
|
842
|
+
format = 'hsl';
|
|
843
|
+
}
|
|
844
|
+
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
845
|
+
a = color.a;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
a = boundAlpha(a);
|
|
849
|
+
return {
|
|
850
|
+
ok: ok,
|
|
851
|
+
format: color.format || format,
|
|
852
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
853
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
854
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
855
|
+
a: a,
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
// <http://www.w3.org/TR/css3-values/#integers>
|
|
859
|
+
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
860
|
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
861
|
+
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
862
|
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
863
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
864
|
+
// Actual matching.
|
|
865
|
+
// Parentheses and commas are optional, but not required.
|
|
866
|
+
// Whitespace can take the place of commas or opening paren
|
|
867
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
868
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
869
|
+
var matchers = {
|
|
870
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
871
|
+
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
872
|
+
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
873
|
+
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
874
|
+
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
875
|
+
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
876
|
+
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
877
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
878
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
879
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
880
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
881
|
+
};
|
|
882
|
+
/**
|
|
883
|
+
* Permissive string parsing. Take in a number of formats, and output an object
|
|
884
|
+
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
885
|
+
*/
|
|
886
|
+
function stringInputToObject(color) {
|
|
887
|
+
color = color.trim().toLowerCase();
|
|
888
|
+
if (color.length === 0) {
|
|
889
|
+
return false;
|
|
890
|
+
}
|
|
891
|
+
var named = false;
|
|
892
|
+
if (names[color]) {
|
|
893
|
+
color = names[color];
|
|
894
|
+
named = true;
|
|
895
|
+
}
|
|
896
|
+
else if (color === 'transparent') {
|
|
897
|
+
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
898
|
+
}
|
|
899
|
+
// Try to match string input using regular expressions.
|
|
900
|
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
901
|
+
// Just return an object and let the conversion functions handle that.
|
|
902
|
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
903
|
+
var match = matchers.rgb.exec(color);
|
|
904
|
+
if (match) {
|
|
905
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
906
|
+
}
|
|
907
|
+
match = matchers.rgba.exec(color);
|
|
908
|
+
if (match) {
|
|
909
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
910
|
+
}
|
|
911
|
+
match = matchers.hsl.exec(color);
|
|
912
|
+
if (match) {
|
|
913
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
914
|
+
}
|
|
915
|
+
match = matchers.hsla.exec(color);
|
|
916
|
+
if (match) {
|
|
917
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
918
|
+
}
|
|
919
|
+
match = matchers.hsv.exec(color);
|
|
920
|
+
if (match) {
|
|
921
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
922
|
+
}
|
|
923
|
+
match = matchers.hsva.exec(color);
|
|
924
|
+
if (match) {
|
|
925
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
926
|
+
}
|
|
927
|
+
match = matchers.hex8.exec(color);
|
|
928
|
+
if (match) {
|
|
929
|
+
return {
|
|
930
|
+
r: parseIntFromHex(match[1]),
|
|
931
|
+
g: parseIntFromHex(match[2]),
|
|
932
|
+
b: parseIntFromHex(match[3]),
|
|
933
|
+
a: convertHexToDecimal(match[4]),
|
|
934
|
+
format: named ? 'name' : 'hex8',
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
match = matchers.hex6.exec(color);
|
|
938
|
+
if (match) {
|
|
939
|
+
return {
|
|
940
|
+
r: parseIntFromHex(match[1]),
|
|
941
|
+
g: parseIntFromHex(match[2]),
|
|
942
|
+
b: parseIntFromHex(match[3]),
|
|
943
|
+
format: named ? 'name' : 'hex',
|
|
944
|
+
};
|
|
945
|
+
}
|
|
946
|
+
match = matchers.hex4.exec(color);
|
|
947
|
+
if (match) {
|
|
948
|
+
return {
|
|
949
|
+
r: parseIntFromHex(match[1] + match[1]),
|
|
950
|
+
g: parseIntFromHex(match[2] + match[2]),
|
|
951
|
+
b: parseIntFromHex(match[3] + match[3]),
|
|
952
|
+
a: convertHexToDecimal(match[4] + match[4]),
|
|
953
|
+
format: named ? 'name' : 'hex8',
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
match = matchers.hex3.exec(color);
|
|
957
|
+
if (match) {
|
|
958
|
+
return {
|
|
959
|
+
r: parseIntFromHex(match[1] + match[1]),
|
|
960
|
+
g: parseIntFromHex(match[2] + match[2]),
|
|
961
|
+
b: parseIntFromHex(match[3] + match[3]),
|
|
962
|
+
format: named ? 'name' : 'hex',
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Check to see if it looks like a CSS unit
|
|
969
|
+
* (see `matchers` above for definition).
|
|
970
|
+
*/
|
|
971
|
+
function isValidCSSUnit(color) {
|
|
972
|
+
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
var hueStep = 2; // 色相阶梯
|
|
976
|
+
|
|
977
|
+
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
978
|
+
|
|
979
|
+
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
980
|
+
|
|
981
|
+
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
982
|
+
|
|
983
|
+
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
984
|
+
|
|
985
|
+
var lightColorCount = 5; // 浅色数量,主色上
|
|
986
|
+
|
|
987
|
+
var darkColorCount = 4; // 深色数量,主色下
|
|
988
|
+
// 暗色主题颜色映射关系表
|
|
989
|
+
|
|
990
|
+
var darkColorMap = [{
|
|
991
|
+
index: 7,
|
|
992
|
+
opacity: 0.15
|
|
993
|
+
}, {
|
|
994
|
+
index: 6,
|
|
995
|
+
opacity: 0.25
|
|
996
|
+
}, {
|
|
997
|
+
index: 5,
|
|
998
|
+
opacity: 0.3
|
|
999
|
+
}, {
|
|
1000
|
+
index: 5,
|
|
1001
|
+
opacity: 0.45
|
|
1002
|
+
}, {
|
|
1003
|
+
index: 5,
|
|
1004
|
+
opacity: 0.65
|
|
1005
|
+
}, {
|
|
1006
|
+
index: 5,
|
|
1007
|
+
opacity: 0.85
|
|
1008
|
+
}, {
|
|
1009
|
+
index: 4,
|
|
1010
|
+
opacity: 0.9
|
|
1011
|
+
}, {
|
|
1012
|
+
index: 3,
|
|
1013
|
+
opacity: 0.95
|
|
1014
|
+
}, {
|
|
1015
|
+
index: 2,
|
|
1016
|
+
opacity: 0.97
|
|
1017
|
+
}, {
|
|
1018
|
+
index: 1,
|
|
1019
|
+
opacity: 0.98
|
|
1020
|
+
}]; // Wrapper function ported from TinyColor.prototype.toHsv
|
|
1021
|
+
// Keep it here because of `hsv.h * 360`
|
|
1022
|
+
|
|
1023
|
+
function toHsv(_ref) {
|
|
1024
|
+
var r = _ref.r,
|
|
1025
|
+
g = _ref.g,
|
|
1026
|
+
b = _ref.b;
|
|
1027
|
+
var hsv = rgbToHsv(r, g, b);
|
|
1028
|
+
return {
|
|
1029
|
+
h: hsv.h * 360,
|
|
1030
|
+
s: hsv.s,
|
|
1031
|
+
v: hsv.v
|
|
1032
|
+
};
|
|
1033
|
+
} // Wrapper function ported from TinyColor.prototype.toHexString
|
|
1034
|
+
// Keep it here because of the prefix `#`
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
function toHex(_ref2) {
|
|
1038
|
+
var r = _ref2.r,
|
|
1039
|
+
g = _ref2.g,
|
|
1040
|
+
b = _ref2.b;
|
|
1041
|
+
return "#".concat(rgbToHex(r, g, b, false));
|
|
1042
|
+
} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
|
|
1043
|
+
// Amount in range [0, 1]
|
|
1044
|
+
// Assume color1 & color2 has no alpha, since the following src code did so.
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
function mix(rgb1, rgb2, amount) {
|
|
1048
|
+
var p = amount / 100;
|
|
1049
|
+
var rgb = {
|
|
1050
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
1051
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
1052
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b
|
|
1053
|
+
};
|
|
1054
|
+
return rgb;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
function getHue(hsv, i, light) {
|
|
1058
|
+
var hue; // 根据色相不同,色相转向不同
|
|
1059
|
+
|
|
1060
|
+
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
1061
|
+
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
1062
|
+
} else {
|
|
1063
|
+
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
if (hue < 0) {
|
|
1067
|
+
hue += 360;
|
|
1068
|
+
} else if (hue >= 360) {
|
|
1069
|
+
hue -= 360;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return hue;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function getSaturation(hsv, i, light) {
|
|
1076
|
+
// grey color don't change saturation
|
|
1077
|
+
if (hsv.h === 0 && hsv.s === 0) {
|
|
1078
|
+
return hsv.s;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
var saturation;
|
|
1082
|
+
|
|
1083
|
+
if (light) {
|
|
1084
|
+
saturation = hsv.s - saturationStep * i;
|
|
1085
|
+
} else if (i === darkColorCount) {
|
|
1086
|
+
saturation = hsv.s + saturationStep;
|
|
1087
|
+
} else {
|
|
1088
|
+
saturation = hsv.s + saturationStep2 * i;
|
|
1089
|
+
} // 边界值修正
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
if (saturation > 1) {
|
|
1093
|
+
saturation = 1;
|
|
1094
|
+
} // 第一格的 s 限制在 0.06-0.1 之间
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
if (light && i === lightColorCount && saturation > 0.1) {
|
|
1098
|
+
saturation = 0.1;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
if (saturation < 0.06) {
|
|
1102
|
+
saturation = 0.06;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
return Number(saturation.toFixed(2));
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
function getValue(hsv, i, light) {
|
|
1109
|
+
var value;
|
|
1110
|
+
|
|
1111
|
+
if (light) {
|
|
1112
|
+
value = hsv.v + brightnessStep1 * i;
|
|
1113
|
+
} else {
|
|
1114
|
+
value = hsv.v - brightnessStep2 * i;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
if (value > 1) {
|
|
1118
|
+
value = 1;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
return Number(value.toFixed(2));
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
function generate(color) {
|
|
1125
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1126
|
+
var patterns = [];
|
|
1127
|
+
var pColor = inputToRGB(color);
|
|
1128
|
+
|
|
1129
|
+
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
1130
|
+
var hsv = toHsv(pColor);
|
|
1131
|
+
var colorString = toHex(inputToRGB({
|
|
1132
|
+
h: getHue(hsv, i, true),
|
|
1133
|
+
s: getSaturation(hsv, i, true),
|
|
1134
|
+
v: getValue(hsv, i, true)
|
|
1135
|
+
}));
|
|
1136
|
+
patterns.push(colorString);
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
patterns.push(toHex(pColor));
|
|
1140
|
+
|
|
1141
|
+
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
1142
|
+
var _hsv = toHsv(pColor);
|
|
1143
|
+
|
|
1144
|
+
var _colorString = toHex(inputToRGB({
|
|
1145
|
+
h: getHue(_hsv, _i),
|
|
1146
|
+
s: getSaturation(_hsv, _i),
|
|
1147
|
+
v: getValue(_hsv, _i)
|
|
1148
|
+
}));
|
|
1149
|
+
|
|
1150
|
+
patterns.push(_colorString);
|
|
1151
|
+
} // dark theme patterns
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
if (opts.theme === 'dark') {
|
|
1155
|
+
return darkColorMap.map(function (_ref3) {
|
|
1156
|
+
var index = _ref3.index,
|
|
1157
|
+
opacity = _ref3.opacity;
|
|
1158
|
+
var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
|
|
1159
|
+
return darkColorString;
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
return patterns;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
var presetPrimaryColors = {
|
|
1167
|
+
red: '#F5222D',
|
|
1168
|
+
volcano: '#FA541C',
|
|
1169
|
+
orange: '#FA8C16',
|
|
1170
|
+
gold: '#FAAD14',
|
|
1171
|
+
yellow: '#FADB14',
|
|
1172
|
+
lime: '#A0D911',
|
|
1173
|
+
green: '#52C41A',
|
|
1174
|
+
cyan: '#13C2C2',
|
|
1175
|
+
blue: '#1890FF',
|
|
1176
|
+
geekblue: '#2F54EB',
|
|
1177
|
+
purple: '#722ED1',
|
|
1178
|
+
magenta: '#EB2F96',
|
|
1179
|
+
grey: '#666666'
|
|
1180
|
+
};
|
|
1181
|
+
var presetPalettes = {};
|
|
1182
|
+
var presetDarkPalettes = {};
|
|
1183
|
+
Object.keys(presetPrimaryColors).forEach(function (key) {
|
|
1184
|
+
presetPalettes[key] = generate(presetPrimaryColors[key]);
|
|
1185
|
+
presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
|
|
1186
|
+
|
|
1187
|
+
presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
|
|
1188
|
+
theme: 'dark',
|
|
1189
|
+
backgroundColor: '#141414'
|
|
1190
|
+
});
|
|
1191
|
+
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
/* eslint-disable no-console */
|
|
1195
|
+
var warned = {};
|
|
1196
|
+
function warning(valid, message) {
|
|
1197
|
+
// Support uglify
|
|
1198
|
+
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
1199
|
+
console.error("Warning: ".concat(message));
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
function call(method, valid, message) {
|
|
1203
|
+
if (!valid && !warned[message]) {
|
|
1204
|
+
method(false, message);
|
|
1205
|
+
warned[message] = true;
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function warningOnce(valid, message) {
|
|
1209
|
+
call(warning, valid, message);
|
|
1210
|
+
}
|
|
1211
|
+
/* eslint-enable */
|
|
1212
|
+
|
|
1213
|
+
function canUseDom() {
|
|
1214
|
+
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
var MARK_KEY = "rc-util-key";
|
|
1218
|
+
|
|
1219
|
+
function getContainer(option) {
|
|
1220
|
+
if (option.attachTo) {
|
|
1221
|
+
return option.attachTo;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
var head = document.querySelector('head');
|
|
1225
|
+
return head || document.body;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
function injectCSS(css) {
|
|
1229
|
+
var _option$csp;
|
|
1230
|
+
|
|
1231
|
+
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1232
|
+
|
|
1233
|
+
if (!canUseDom()) {
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
var styleNode = document.createElement('style');
|
|
1238
|
+
|
|
1239
|
+
if ((_option$csp = option.csp) === null || _option$csp === void 0 ? void 0 : _option$csp.nonce) {
|
|
1240
|
+
var _option$csp2;
|
|
1241
|
+
|
|
1242
|
+
styleNode.nonce = (_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
styleNode.innerHTML = css;
|
|
1246
|
+
var container = getContainer(option);
|
|
1247
|
+
var firstChild = container.firstChild;
|
|
1248
|
+
|
|
1249
|
+
if (option.prepend && container.prepend) {
|
|
1250
|
+
// Use `prepend` first
|
|
1251
|
+
container.prepend(styleNode);
|
|
1252
|
+
} else if (option.prepend && firstChild) {
|
|
1253
|
+
// Fallback to `insertBefore` like IE not support `prepend`
|
|
1254
|
+
container.insertBefore(styleNode, firstChild);
|
|
1255
|
+
} else {
|
|
1256
|
+
container.appendChild(styleNode);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
return styleNode;
|
|
1260
|
+
}
|
|
1261
|
+
var containerCache = new Map();
|
|
1262
|
+
function updateCSS(css, key) {
|
|
1263
|
+
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1264
|
+
var container = getContainer(option); // Get real parent
|
|
1265
|
+
|
|
1266
|
+
if (!containerCache.has(container)) {
|
|
1267
|
+
var placeholderStyle = injectCSS('', option);
|
|
1268
|
+
var parentNode = placeholderStyle.parentNode;
|
|
1269
|
+
containerCache.set(container, parentNode);
|
|
1270
|
+
parentNode.removeChild(placeholderStyle);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
var existNode = Array.from(containerCache.get(container).children).find(function (node) {
|
|
1274
|
+
return node.tagName === 'STYLE' && node[MARK_KEY] === key;
|
|
1275
|
+
});
|
|
1276
|
+
|
|
1277
|
+
if (existNode) {
|
|
1278
|
+
var _option$csp3, _option$csp4;
|
|
1279
|
+
|
|
1280
|
+
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)) {
|
|
1281
|
+
var _option$csp5;
|
|
1282
|
+
|
|
1283
|
+
existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
if (existNode.innerHTML !== css) {
|
|
1287
|
+
existNode.innerHTML = css;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
return existNode;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
var newNode = injectCSS(css, option);
|
|
1294
|
+
newNode[MARK_KEY] = key;
|
|
1295
|
+
return newNode;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
function warning$1(valid, message) {
|
|
1299
|
+
warningOnce(valid, "[@ant-design/icons] ".concat(message));
|
|
1300
|
+
}
|
|
1301
|
+
function isIconDefinition(target) {
|
|
1302
|
+
return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
|
|
1303
|
+
}
|
|
1304
|
+
function normalizeAttrs() {
|
|
1305
|
+
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1306
|
+
return Object.keys(attrs).reduce(function (acc, key) {
|
|
1307
|
+
var val = attrs[key];
|
|
1308
|
+
|
|
1309
|
+
switch (key) {
|
|
1310
|
+
case 'class':
|
|
1311
|
+
acc.className = val;
|
|
1312
|
+
delete acc.class;
|
|
1313
|
+
break;
|
|
1314
|
+
|
|
1315
|
+
default:
|
|
1316
|
+
acc[key] = val;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
return acc;
|
|
1320
|
+
}, {});
|
|
1321
|
+
}
|
|
1322
|
+
function generate$1(node, key, rootProps) {
|
|
1323
|
+
if (!rootProps) {
|
|
1324
|
+
return /*#__PURE__*/React__default['default'].createElement(node.tag, _objectSpread2$1({
|
|
1325
|
+
key: key
|
|
1326
|
+
}, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
|
|
1327
|
+
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1328
|
+
}));
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
return /*#__PURE__*/React__default['default'].createElement(node.tag, _objectSpread2$1(_objectSpread2$1({
|
|
1332
|
+
key: key
|
|
1333
|
+
}, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
|
|
1334
|
+
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1335
|
+
}));
|
|
1336
|
+
}
|
|
1337
|
+
function getSecondaryColor(primaryColor) {
|
|
1338
|
+
// choose the second color
|
|
1339
|
+
return generate(primaryColor)[0];
|
|
1340
|
+
}
|
|
1341
|
+
function normalizeTwoToneColors(twoToneColor) {
|
|
1342
|
+
if (!twoToneColor) {
|
|
1343
|
+
return [];
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
1347
|
+
} // These props make sure that the SVG behaviours like general text.
|
|
1348
|
+
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";
|
|
1349
|
+
var useInsertStyles = function useInsertStyles() {
|
|
1350
|
+
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
|
1351
|
+
|
|
1352
|
+
var _useContext = React.useContext(IconContext),
|
|
1353
|
+
csp = _useContext.csp;
|
|
1354
|
+
|
|
1355
|
+
React.useEffect(function () {
|
|
1356
|
+
updateCSS(styleStr, '@ant-design-icons', {
|
|
1357
|
+
prepend: true,
|
|
1358
|
+
csp: csp
|
|
1359
|
+
});
|
|
1360
|
+
}, []);
|
|
1361
|
+
};
|
|
1362
|
+
|
|
1363
|
+
var _excluded = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
|
|
1364
|
+
var twoToneColorPalette = {
|
|
1365
|
+
primaryColor: '#333',
|
|
1366
|
+
secondaryColor: '#E6E6E6',
|
|
1367
|
+
calculated: false
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
function setTwoToneColors(_ref) {
|
|
1371
|
+
var primaryColor = _ref.primaryColor,
|
|
1372
|
+
secondaryColor = _ref.secondaryColor;
|
|
1373
|
+
twoToneColorPalette.primaryColor = primaryColor;
|
|
1374
|
+
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
1375
|
+
twoToneColorPalette.calculated = !!secondaryColor;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
function getTwoToneColors() {
|
|
1379
|
+
return _objectSpread2$1({}, twoToneColorPalette);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
var IconBase = function IconBase(props) {
|
|
1383
|
+
var icon = props.icon,
|
|
1384
|
+
className = props.className,
|
|
1385
|
+
onClick = props.onClick,
|
|
1386
|
+
style = props.style,
|
|
1387
|
+
primaryColor = props.primaryColor,
|
|
1388
|
+
secondaryColor = props.secondaryColor,
|
|
1389
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
1390
|
+
|
|
1391
|
+
var colors = twoToneColorPalette;
|
|
1392
|
+
|
|
1393
|
+
if (primaryColor) {
|
|
1394
|
+
colors = {
|
|
1395
|
+
primaryColor: primaryColor,
|
|
1396
|
+
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
useInsertStyles();
|
|
1401
|
+
warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
1402
|
+
|
|
1403
|
+
if (!isIconDefinition(icon)) {
|
|
1404
|
+
return null;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
var target = icon;
|
|
1408
|
+
|
|
1409
|
+
if (target && typeof target.icon === 'function') {
|
|
1410
|
+
target = _objectSpread2$1(_objectSpread2$1({}, target), {}, {
|
|
1411
|
+
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
return generate$1(target.icon, "svg-".concat(target.name), _objectSpread2$1({
|
|
1416
|
+
className: className,
|
|
1417
|
+
onClick: onClick,
|
|
1418
|
+
style: style,
|
|
1419
|
+
'data-icon': target.name,
|
|
1420
|
+
width: '1em',
|
|
1421
|
+
height: '1em',
|
|
1422
|
+
fill: 'currentColor',
|
|
1423
|
+
'aria-hidden': 'true'
|
|
1424
|
+
}, restProps));
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
IconBase.displayName = 'IconReact';
|
|
1428
|
+
IconBase.getTwoToneColors = getTwoToneColors;
|
|
1429
|
+
IconBase.setTwoToneColors = setTwoToneColors;
|
|
1430
|
+
|
|
1431
|
+
function setTwoToneColor(twoToneColor) {
|
|
1432
|
+
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1433
|
+
_normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
|
|
1434
|
+
primaryColor = _normalizeTwoToneColo2[0],
|
|
1435
|
+
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1436
|
+
|
|
1437
|
+
return IconBase.setTwoToneColors({
|
|
1438
|
+
primaryColor: primaryColor,
|
|
1439
|
+
secondaryColor: secondaryColor
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
function getTwoToneColor() {
|
|
1443
|
+
var colors = IconBase.getTwoToneColors();
|
|
1444
|
+
|
|
1445
|
+
if (!colors.calculated) {
|
|
1446
|
+
return colors.primaryColor;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
return [colors.primaryColor, colors.secondaryColor];
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
var _excluded$1 = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
|
|
1453
|
+
// should move it to antd main repo?
|
|
1454
|
+
|
|
1455
|
+
setTwoToneColor('#1890ff');
|
|
1456
|
+
var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1457
|
+
var _classNames;
|
|
1458
|
+
|
|
1459
|
+
var className = props.className,
|
|
1460
|
+
icon = props.icon,
|
|
1461
|
+
spin = props.spin,
|
|
1462
|
+
rotate = props.rotate,
|
|
1463
|
+
tabIndex = props.tabIndex,
|
|
1464
|
+
onClick = props.onClick,
|
|
1465
|
+
twoToneColor = props.twoToneColor,
|
|
1466
|
+
restProps = _objectWithoutProperties(props, _excluded$1);
|
|
1467
|
+
|
|
1468
|
+
var _React$useContext = React.useContext(IconContext),
|
|
1469
|
+
_React$useContext$pre = _React$useContext.prefixCls,
|
|
1470
|
+
prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
|
|
1471
|
+
|
|
1472
|
+
var classString = classNames__default['default'](prefixCls, (_classNames = {}, _defineProperty$1(_classNames, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _defineProperty$1(_classNames, "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), _classNames), className);
|
|
1473
|
+
var iconTabIndex = tabIndex;
|
|
1474
|
+
|
|
1475
|
+
if (iconTabIndex === undefined && onClick) {
|
|
1476
|
+
iconTabIndex = -1;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
var svgStyle = rotate ? {
|
|
1480
|
+
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
1481
|
+
transform: "rotate(".concat(rotate, "deg)")
|
|
1482
|
+
} : undefined;
|
|
1483
|
+
|
|
1484
|
+
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1485
|
+
_normalizeTwoToneColo2 = _slicedToArray$1(_normalizeTwoToneColo, 2),
|
|
1486
|
+
primaryColor = _normalizeTwoToneColo2[0],
|
|
1487
|
+
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1488
|
+
|
|
1489
|
+
return /*#__PURE__*/React.createElement("span", _objectSpread2$1(_objectSpread2$1({
|
|
1490
|
+
role: "img",
|
|
1491
|
+
"aria-label": icon.name
|
|
1492
|
+
}, restProps), {}, {
|
|
1493
|
+
ref: ref,
|
|
1494
|
+
tabIndex: iconTabIndex,
|
|
1495
|
+
onClick: onClick,
|
|
1496
|
+
className: classString
|
|
1497
|
+
}), /*#__PURE__*/React.createElement(IconBase, {
|
|
1498
|
+
icon: icon,
|
|
1499
|
+
primaryColor: primaryColor,
|
|
1500
|
+
secondaryColor: secondaryColor,
|
|
1501
|
+
style: svgStyle
|
|
1502
|
+
}));
|
|
1503
|
+
});
|
|
1504
|
+
Icon.displayName = 'AntdIcon';
|
|
1505
|
+
Icon.getTwoToneColor = getTwoToneColor;
|
|
1506
|
+
Icon.setTwoToneColor = setTwoToneColor;
|
|
1507
|
+
|
|
1508
|
+
// This icon file is generated automatically.
|
|
1509
|
+
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" };
|
|
1510
|
+
|
|
1511
|
+
var DownOutlined$1 = function DownOutlined$1(props, ref) {
|
|
1512
|
+
return /*#__PURE__*/React.createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
|
|
1513
|
+
ref: ref,
|
|
1514
|
+
icon: DownOutlined
|
|
1515
|
+
}));
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
DownOutlined$1.displayName = 'DownOutlined';
|
|
1519
|
+
var DownOutlined$2 = /*#__PURE__*/React.forwardRef(DownOutlined$1);
|
|
1520
|
+
|
|
1521
|
+
// This icon file is generated automatically.
|
|
1522
|
+
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" };
|
|
1523
|
+
|
|
1524
|
+
var ExclamationCircleOutlined$1 = function ExclamationCircleOutlined$1(props, ref) {
|
|
1525
|
+
return /*#__PURE__*/React.createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
|
|
1526
|
+
ref: ref,
|
|
1527
|
+
icon: ExclamationCircleOutlined
|
|
1528
|
+
}));
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
ExclamationCircleOutlined$1.displayName = 'ExclamationCircleOutlined';
|
|
1532
|
+
var ExclamationCircleOutlined$2 = /*#__PURE__*/React.forwardRef(ExclamationCircleOutlined$1);
|
|
1533
|
+
|
|
1534
|
+
// This icon file is generated automatically.
|
|
1535
|
+
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" };
|
|
1536
|
+
|
|
1537
|
+
var ProfileTwoTone$1 = function ProfileTwoTone$1(props, ref) {
|
|
1538
|
+
return /*#__PURE__*/React.createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
|
|
1539
|
+
ref: ref,
|
|
1540
|
+
icon: ProfileTwoTone
|
|
1541
|
+
}));
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
ProfileTwoTone$1.displayName = 'ProfileTwoTone';
|
|
1545
|
+
var ProfileTwoTone$2 = /*#__PURE__*/React.forwardRef(ProfileTwoTone$1);
|
|
1546
|
+
|
|
1547
|
+
// This icon file is generated automatically.
|
|
1548
|
+
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" };
|
|
1549
|
+
|
|
1550
|
+
var UnorderedListOutlined$1 = function UnorderedListOutlined$1(props, ref) {
|
|
1551
|
+
return /*#__PURE__*/React.createElement(Icon, _objectSpread2$1(_objectSpread2$1({}, props), {}, {
|
|
1552
|
+
ref: ref,
|
|
1553
|
+
icon: UnorderedListOutlined
|
|
1554
|
+
}));
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
UnorderedListOutlined$1.displayName = 'UnorderedListOutlined';
|
|
1558
|
+
var UnorderedListOutlined$2 = /*#__PURE__*/React.forwardRef(UnorderedListOutlined$1);
|
|
1559
|
+
|
|
1560
|
+
function styleInject(css, ref) {
|
|
1561
|
+
if ( ref === void 0 ) ref = {};
|
|
1562
|
+
var insertAt = ref.insertAt;
|
|
1563
|
+
|
|
1564
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
1565
|
+
|
|
1566
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
1567
|
+
var style = document.createElement('style');
|
|
1568
|
+
style.type = 'text/css';
|
|
1569
|
+
|
|
1570
|
+
if (insertAt === 'top') {
|
|
1571
|
+
if (head.firstChild) {
|
|
1572
|
+
head.insertBefore(style, head.firstChild);
|
|
1573
|
+
} else {
|
|
1574
|
+
head.appendChild(style);
|
|
1575
|
+
}
|
|
1576
|
+
} else {
|
|
1577
|
+
head.appendChild(style);
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
if (style.styleSheet) {
|
|
1581
|
+
style.styleSheet.cssText = css;
|
|
1582
|
+
} else {
|
|
1583
|
+
style.appendChild(document.createTextNode(css));
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
|
|
1587
|
+
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";
|
|
1588
|
+
styleInject(css_248z);
|
|
1589
|
+
|
|
1590
|
+
var luckysheet = window.luckysheet;
|
|
1591
|
+
var itemsTemp = []; // for dnd
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
var reorder = function reorder(list, startIndex, endIndex) {
|
|
1595
|
+
var result = Array.from(list);
|
|
1596
|
+
|
|
1597
|
+
var _result$splice = result.splice(startIndex, 1),
|
|
1598
|
+
_result$splice2 = _slicedToArray(_result$splice, 1),
|
|
1599
|
+
removed = _result$splice2[0];
|
|
1600
|
+
|
|
1601
|
+
result.splice(endIndex, 0, removed);
|
|
1602
|
+
return result;
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
var grid = 8;
|
|
1606
|
+
|
|
1607
|
+
var getItemStyle = function getItemStyle(isDragging, draggableStyle) {
|
|
1608
|
+
return _objectSpread2({
|
|
1609
|
+
// some basic styles to make the items look a bit nicer
|
|
1610
|
+
userSelect: 'none',
|
|
1611
|
+
padding: "4px",
|
|
1612
|
+
margin: "4px"
|
|
1613
|
+
}, draggableStyle);
|
|
1614
|
+
};
|
|
1615
|
+
|
|
1616
|
+
var getListStyle = function getListStyle(isDraggingOver) {
|
|
1617
|
+
return {
|
|
1618
|
+
background: isDraggingOver ? '#fff' : '#fff',
|
|
1619
|
+
display: 'flex',
|
|
1620
|
+
padding: grid,
|
|
1621
|
+
overflow: 'auto'
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
var filterLetters = function filterLetters(i) {
|
|
1626
|
+
if (i >= 0 && i <= 25) {
|
|
1627
|
+
return String.fromCharCode(65 + i);
|
|
1628
|
+
} else {
|
|
1629
|
+
return undefined;
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
var Luckysheet = /*#__PURE__*/function (_React$Component) {
|
|
1634
|
+
_inherits(Luckysheet, _React$Component);
|
|
1635
|
+
|
|
1636
|
+
var _super = _createSuper(Luckysheet);
|
|
1637
|
+
|
|
1638
|
+
function Luckysheet(props) {
|
|
1639
|
+
var _this;
|
|
1640
|
+
|
|
1641
|
+
_classCallCheck(this, Luckysheet);
|
|
1642
|
+
|
|
1643
|
+
_this = _super.call(this, props);
|
|
1644
|
+
|
|
1645
|
+
_this.getCount = function () {
|
|
1646
|
+
try {
|
|
1647
|
+
var items = _this.state.items;
|
|
1648
|
+
var data = luckysheet.getSheetData();
|
|
1649
|
+
var validIndex = items.length;
|
|
1650
|
+
|
|
1651
|
+
if (data[0] && data[0][validIndex]) {
|
|
1652
|
+
return {
|
|
1653
|
+
total: data.filter(function (item) {
|
|
1654
|
+
return item[validIndex];
|
|
1655
|
+
}).length,
|
|
1656
|
+
error: data.filter(function (item) {
|
|
1657
|
+
return item[validIndex] && item[validIndex].v !== '通过';
|
|
1658
|
+
}).length
|
|
1659
|
+
};
|
|
1660
|
+
} else {
|
|
1661
|
+
return {
|
|
1662
|
+
total: 0,
|
|
1663
|
+
error: 0
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
} catch (e) {
|
|
1667
|
+
return {
|
|
1668
|
+
total: 0,
|
|
1669
|
+
error: 0
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1674
|
+
_this.setConfig = function (data) {
|
|
1675
|
+
var _ref;
|
|
1676
|
+
|
|
1677
|
+
var items = _this.state.items;
|
|
1678
|
+
return {
|
|
1679
|
+
container: 'luckysheet',
|
|
1680
|
+
showtoolbar: false,
|
|
1681
|
+
hook: {
|
|
1682
|
+
columnTitleCellRenderBefore: function columnTitleCellRenderBefore(columnAbc, postion, ctx) {
|
|
1683
|
+
if (columnAbc.name) {
|
|
1684
|
+
var charCode = columnAbc.name.charCodeAt();
|
|
1685
|
+
|
|
1686
|
+
if (charCode - 65 <= items.length) {
|
|
1687
|
+
columnAbc.name = itemsTemp[charCode - 65] ? itemsTemp[charCode - 65].content : '校验结果';
|
|
1688
|
+
} else {
|
|
1689
|
+
columnAbc.name = '';
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
},
|
|
1693
|
+
cellRenderAfter: function cellRenderAfter(cell, postion, sheetFile, ctx) {
|
|
1694
|
+
if (cell) {
|
|
1695
|
+
cell.fs = 10;
|
|
1696
|
+
} // console.log(postion);
|
|
1697
|
+
|
|
1698
|
+
},
|
|
1699
|
+
cellAllRenderBefore: function cellAllRenderBefore(data, sheetFile, ctx) {
|
|
1700
|
+
sheetFile.config.borderInfo = []; // console.info(data,sheetFile,ctx)
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
// showtoolbarConfig: {
|
|
1704
|
+
// undoRedo: true, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏
|
|
1705
|
+
// paintFormat: false, //格式刷
|
|
1706
|
+
// currencyFormat: false, //货币格式
|
|
1707
|
+
// percentageFormat: false, //百分比格式
|
|
1708
|
+
// numberDecrease: false, // '减少小数位数'
|
|
1709
|
+
// numberIncrease: false, // '增加小数位数
|
|
1710
|
+
// moreFormats: false, // '更多格式'
|
|
1711
|
+
// font: true, // '字体'
|
|
1712
|
+
// fontSize: true, // '字号大小'
|
|
1713
|
+
// },
|
|
1714
|
+
data: [(_ref = {
|
|
1715
|
+
name: 'Cell',
|
|
1716
|
+
color: '',
|
|
1717
|
+
index: 0,
|
|
1718
|
+
status: 1,
|
|
1719
|
+
order: 0,
|
|
1720
|
+
hide: 0,
|
|
1721
|
+
row: 36,
|
|
1722
|
+
column: 18,
|
|
1723
|
+
defaultRowHeight: 20,
|
|
1724
|
+
defaultColWidth: 120,
|
|
1725
|
+
config: {},
|
|
1726
|
+
celldata: data,
|
|
1727
|
+
scrollLeft: 0,
|
|
1728
|
+
// "scrollTop": 315, //上下滚动条位置
|
|
1729
|
+
luckysheet_select_save: [],
|
|
1730
|
+
calcChain: [],
|
|
1731
|
+
isPivotTable: false,
|
|
1732
|
+
pivotTable: {},
|
|
1733
|
+
filter_select: {},
|
|
1734
|
+
filter: null,
|
|
1735
|
+
luckysheet_alternateformat_save: [],
|
|
1736
|
+
luckysheet_alternateformat_save_modelCustom: [],
|
|
1737
|
+
luckysheet_conditionformat_save: {},
|
|
1738
|
+
frozen: {},
|
|
1739
|
+
chart: [],
|
|
1740
|
+
zoomRatio: 1,
|
|
1741
|
+
image: [],
|
|
1742
|
+
showGridLines: 1,
|
|
1743
|
+
dataVerification: {}
|
|
1744
|
+
}, _defineProperty(_ref, "luckysheet_alternateformat_save", [{
|
|
1745
|
+
cellrange: {
|
|
1746
|
+
//单元格范围
|
|
1747
|
+
row: [0, 1000],
|
|
1748
|
+
column: [0, 18]
|
|
1749
|
+
},
|
|
1750
|
+
format: {
|
|
1751
|
+
head: {
|
|
1752
|
+
//页眉颜色
|
|
1753
|
+
fc: '#6aa84f',
|
|
1754
|
+
bc: '#ffffff'
|
|
1755
|
+
},
|
|
1756
|
+
one: {
|
|
1757
|
+
//第一种颜色
|
|
1758
|
+
bc: '#ffffff'
|
|
1759
|
+
},
|
|
1760
|
+
two: {
|
|
1761
|
+
//第二种颜色
|
|
1762
|
+
bc: '#f2f4f5'
|
|
1763
|
+
},
|
|
1764
|
+
foot: {
|
|
1765
|
+
//页脚颜色
|
|
1766
|
+
fc: '#000',
|
|
1767
|
+
bc: '#a5efcc'
|
|
1768
|
+
}
|
|
1769
|
+
},
|
|
1770
|
+
hasRowHeader: false,
|
|
1771
|
+
hasRowFooter: false //含有页脚
|
|
1772
|
+
|
|
1773
|
+
}]), _defineProperty(_ref, "luckysheet_alternateformat_save_modelCustom", [{
|
|
1774
|
+
head: {
|
|
1775
|
+
//页眉颜色
|
|
1776
|
+
fc: '#6aa84f',
|
|
1777
|
+
bc: '#ffffff'
|
|
1778
|
+
},
|
|
1779
|
+
one: {
|
|
1780
|
+
//第一种颜色
|
|
1781
|
+
fc: '#000',
|
|
1782
|
+
bc: '#ffffff'
|
|
1783
|
+
},
|
|
1784
|
+
two: {
|
|
1785
|
+
//第二种颜色
|
|
1786
|
+
fc: '#000',
|
|
1787
|
+
bc: '#e5fbee'
|
|
1788
|
+
},
|
|
1789
|
+
foot: {
|
|
1790
|
+
//页脚颜色
|
|
1791
|
+
fc: '#000',
|
|
1792
|
+
bc: '#a5efcc'
|
|
1793
|
+
}
|
|
1794
|
+
}]), _ref)],
|
|
1795
|
+
cellRightClickConfig: {
|
|
1796
|
+
copy: false,
|
|
1797
|
+
copyAs: false,
|
|
1798
|
+
paste: false,
|
|
1799
|
+
insertRow: false,
|
|
1800
|
+
insertColumn: false,
|
|
1801
|
+
// deleteRow: false, // 删除选中行
|
|
1802
|
+
// deleteColumn: false, // 删除选中列
|
|
1803
|
+
deleteCell: false,
|
|
1804
|
+
hideRow: false,
|
|
1805
|
+
hideColumn: false,
|
|
1806
|
+
rowHeight: false,
|
|
1807
|
+
columnWidth: false,
|
|
1808
|
+
clear: false,
|
|
1809
|
+
matrix: false,
|
|
1810
|
+
sort: false,
|
|
1811
|
+
filter: false,
|
|
1812
|
+
chart: false,
|
|
1813
|
+
image: false,
|
|
1814
|
+
link: false,
|
|
1815
|
+
data: false,
|
|
1816
|
+
cellFormat: false // 设置单元格格式
|
|
1817
|
+
|
|
1818
|
+
},
|
|
1819
|
+
showsheetbar: false,
|
|
1820
|
+
optionstate: false,
|
|
1821
|
+
showstatisticBarConfig: {
|
|
1822
|
+
count: false,
|
|
1823
|
+
view: false,
|
|
1824
|
+
zoom: false // 缩放
|
|
1825
|
+
|
|
1826
|
+
},
|
|
1827
|
+
column: 10,
|
|
1828
|
+
columnHeaderHeight: 30,
|
|
1829
|
+
lang: 'zh',
|
|
1830
|
+
defaultFontSize: '10',
|
|
1831
|
+
frozen: {
|
|
1832
|
+
type: 'rangeBoth',
|
|
1833
|
+
range: {
|
|
1834
|
+
row_focus: 1,
|
|
1835
|
+
column_focus: 1
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
};
|
|
1839
|
+
};
|
|
1840
|
+
|
|
1841
|
+
_this.getData = function () {
|
|
1842
|
+
console.time();
|
|
1843
|
+
var sheetData = luckysheet.getSheetData();
|
|
1844
|
+
var data = sheetData.filter(function (item) {
|
|
1845
|
+
return item[0];
|
|
1846
|
+
}).map(function (item) {
|
|
1847
|
+
var obj = {};
|
|
1848
|
+
item.slice(0, itemsTemp.length).map(function (innerItem, index) {
|
|
1849
|
+
obj[_this.state.items[index].code] = innerItem && innerItem.v;
|
|
1850
|
+
});
|
|
1851
|
+
return obj;
|
|
1852
|
+
});
|
|
1853
|
+
return data;
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
_this.resetData = function () {
|
|
1857
|
+
var _this$props = _this.props,
|
|
1858
|
+
validDataFunction = _this$props.validDataFunction,
|
|
1859
|
+
updateData = _this$props.updateData;
|
|
1860
|
+
|
|
1861
|
+
var resultData = _this.getData();
|
|
1862
|
+
|
|
1863
|
+
new Promise(function (resolve, reject) {
|
|
1864
|
+
validDataFunction(resultData, resolve);
|
|
1865
|
+
}).then(function (res) {
|
|
1866
|
+
var items = _this.state.items;
|
|
1867
|
+
var validIndex = items.length;
|
|
1868
|
+
var sheetData = luckysheet.getSheetData();
|
|
1869
|
+
sheetData.map(function (item, index) {
|
|
1870
|
+
if (!res[index]) return item;
|
|
1871
|
+
|
|
1872
|
+
if (res[index].flag) {
|
|
1873
|
+
item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
|
|
1874
|
+
v: '通过',
|
|
1875
|
+
m: '通过',
|
|
1876
|
+
fc: 'green' //字体颜色为 "#990000"
|
|
1877
|
+
|
|
1878
|
+
});
|
|
1879
|
+
} else {
|
|
1880
|
+
item[validIndex] = _objectSpread2(_objectSpread2({}, item[validIndex]), {}, {
|
|
1881
|
+
v: res[index].checkResults,
|
|
1882
|
+
m: res[index].checkResults,
|
|
1883
|
+
fc: 'red' //字体颜色为 "#990000"
|
|
1884
|
+
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
item[validIndex].ct = {
|
|
1889
|
+
fa: 'General',
|
|
1890
|
+
t: 'g'
|
|
1891
|
+
};
|
|
1892
|
+
}); // sheetData.map((item, index) => {
|
|
1893
|
+
// luckysheet.setCellValue(index + 1, 4, 345)
|
|
1894
|
+
// })
|
|
1895
|
+
|
|
1896
|
+
luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
1897
|
+
|
|
1898
|
+
_this.setState({
|
|
1899
|
+
data: luckysheet.transToCellData(sheetData),
|
|
1900
|
+
errorListCheck: false
|
|
1901
|
+
});
|
|
1902
|
+
|
|
1903
|
+
_this.getData(), _readOnlyError("updateData");
|
|
1904
|
+
debugger;
|
|
1905
|
+
});
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
_this.filterData = function (type) {
|
|
1909
|
+
var _this$state = _this.state,
|
|
1910
|
+
showErrorData = _this$state.showErrorData,
|
|
1911
|
+
data = _this$state.data;
|
|
1912
|
+
var sheetData = luckysheet.transToData(data).filter(function (item, index) {
|
|
1913
|
+
if (type === 'all') {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
if (type === 'error') {
|
|
1918
|
+
return item[itemsTemp.length] && item[itemsTemp.length].v === '通过';
|
|
1919
|
+
}
|
|
1920
|
+
});
|
|
1921
|
+
luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
1922
|
+
exportData = _this.getData();
|
|
1923
|
+
|
|
1924
|
+
_this.setState({
|
|
1925
|
+
data: luckysheet.transToCellData(sheetData),
|
|
1926
|
+
errorListCheck: false
|
|
1927
|
+
});
|
|
1928
|
+
};
|
|
1929
|
+
|
|
1930
|
+
_this.toggleData = function () {
|
|
1931
|
+
var _this$state2 = _this.state,
|
|
1932
|
+
showErrorData = _this$state2.showErrorData,
|
|
1933
|
+
data = _this$state2.data;
|
|
1934
|
+
|
|
1935
|
+
if (showErrorData) {
|
|
1936
|
+
luckysheet.create(_this.setConfig(data));
|
|
1937
|
+
} else {
|
|
1938
|
+
var sheetData = luckysheet.getSheetData();
|
|
1939
|
+
sheetData = sheetData.filter(function (item, index) {
|
|
1940
|
+
return !item[itemsTemp.length] || item[itemsTemp.length].v !== '通过';
|
|
1941
|
+
});
|
|
1942
|
+
luckysheet.create(_this.setConfig(luckysheet.transToCellData(sheetData)));
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
_this.setState({
|
|
1946
|
+
showErrorData: !showErrorData
|
|
1947
|
+
});
|
|
1948
|
+
};
|
|
1949
|
+
|
|
1950
|
+
_this.onChange = function (e) {
|
|
1951
|
+
_this.setState({
|
|
1952
|
+
radioValue: e.target.value
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
_this.toggleData();
|
|
1956
|
+
};
|
|
1957
|
+
|
|
1958
|
+
_this.errorChange = function (e) {
|
|
1959
|
+
_this.toggleData();
|
|
1960
|
+
|
|
1961
|
+
_this.setState({
|
|
1962
|
+
errorListCheck: e.target.checked
|
|
1963
|
+
});
|
|
1964
|
+
};
|
|
1965
|
+
|
|
1966
|
+
_this.menuList = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
1967
|
+
className: "sheet_table-menu_item_text"
|
|
1968
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1969
|
+
onClick: function onClick() {
|
|
1970
|
+
return _this.filterData('all');
|
|
1971
|
+
}
|
|
1972
|
+
}, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
1973
|
+
className: "sheet_table-menu_item_text"
|
|
1974
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
1975
|
+
onClick: function onClick() {
|
|
1976
|
+
return _this.filterData('error');
|
|
1977
|
+
}
|
|
1978
|
+
}, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
|
|
1979
|
+
_this.leftMenu = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
1980
|
+
className: "sheet_table-menu_item_text"
|
|
1981
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
1982
|
+
className: "sheet_table_text"
|
|
1983
|
+
}, "\u8BF7\u62D6\u52A8\u5B57\u6BB5\u6765\u5BF9\u5E94\u5217")), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null), /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(reactBeautifulDnd.DragDropContext, {
|
|
1984
|
+
onDragEnd: function onDragEnd(e) {
|
|
1985
|
+
return _this.onDragEnd(e);
|
|
1986
|
+
}
|
|
1987
|
+
}, /*#__PURE__*/React__default['default'].createElement(reactBeautifulDnd.Droppable, {
|
|
1988
|
+
droppableId: "droppable",
|
|
1989
|
+
direction: "vertical"
|
|
1990
|
+
}, function (provided, snapshot) {
|
|
1991
|
+
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2({
|
|
1992
|
+
ref: provided.innerRef,
|
|
1993
|
+
style: _objectSpread2(_objectSpread2({}, getListStyle(snapshot.isDraggingOver)), {}, {
|
|
1994
|
+
flexDirection: 'column'
|
|
1995
|
+
})
|
|
1996
|
+
}, provided.droppableProps), _this.state.items.map(function (item, index) {
|
|
1997
|
+
return /*#__PURE__*/React__default['default'].createElement(reactBeautifulDnd.Draggable, {
|
|
1998
|
+
key: item.id,
|
|
1999
|
+
draggableId: item.id,
|
|
2000
|
+
index: index
|
|
2001
|
+
}, function (provided, snapshot) {
|
|
2002
|
+
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
2003
|
+
ref: provided.innerRef
|
|
2004
|
+
}, provided.draggableProps), provided.dragHandleProps), {}, {
|
|
2005
|
+
style: getItemStyle(snapshot.isDragging, provided.draggableProps.style)
|
|
2006
|
+
}), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement("span", null, filterLetters(index), " \u5217 "), /*#__PURE__*/React__default['default'].createElement(antd.Space, {
|
|
2007
|
+
className: "sheet_table_dnd_text"
|
|
2008
|
+
}, /*#__PURE__*/React__default['default'].createElement(UnorderedListOutlined$2, null), item.content)));
|
|
2009
|
+
});
|
|
2010
|
+
}), provided.placeholder);
|
|
2011
|
+
}))));
|
|
2012
|
+
itemsTemp = props.columns.map(function (item, index) {
|
|
2013
|
+
return {
|
|
2014
|
+
id: "item-0".concat(index),
|
|
2015
|
+
content: item[0],
|
|
2016
|
+
code: item[1]
|
|
2017
|
+
};
|
|
2018
|
+
});
|
|
2019
|
+
_this.state = {
|
|
2020
|
+
showErrorData: false,
|
|
2021
|
+
data: [],
|
|
2022
|
+
items: _toConsumableArray(itemsTemp),
|
|
2023
|
+
resultData: [],
|
|
2024
|
+
errorListCheck: false
|
|
2025
|
+
};
|
|
2026
|
+
return _this;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
_createClass(Luckysheet, [{
|
|
2030
|
+
key: "onDragEnd",
|
|
2031
|
+
value: function onDragEnd(result) {
|
|
2032
|
+
// dropped outside the list
|
|
2033
|
+
if (!result.destination) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
var items = reorder(this.state.items, result.source.index, result.destination.index);
|
|
2038
|
+
this.setState({
|
|
2039
|
+
items: items
|
|
2040
|
+
});
|
|
2041
|
+
itemsTemp = items;
|
|
2042
|
+
luckysheet.refresh();
|
|
2043
|
+
}
|
|
2044
|
+
}, {
|
|
2045
|
+
key: "componentDidMount",
|
|
2046
|
+
value: function componentDidMount() {
|
|
2047
|
+
luckysheet.create(this.setConfig([]));
|
|
2048
|
+
}
|
|
2049
|
+
}, {
|
|
2050
|
+
key: "componentWillUnmount",
|
|
2051
|
+
value: function componentWillUnmount() {
|
|
2052
|
+
// luckysheet.create(this.setConfig([]));
|
|
2053
|
+
luckysheet.destroy();
|
|
2054
|
+
}
|
|
2055
|
+
}, {
|
|
2056
|
+
key: "render",
|
|
2057
|
+
value: function render() {
|
|
2058
|
+
var errorListCheck = this.state.errorListCheck;
|
|
2059
|
+
var title = this.props.title;
|
|
2060
|
+
var totalSummary = this.getCount();
|
|
2061
|
+
var luckyCss = {
|
|
2062
|
+
margin: '0px',
|
|
2063
|
+
padding: '0px',
|
|
2064
|
+
position: 'absolute',
|
|
2065
|
+
width: '100%',
|
|
2066
|
+
height: '100%',
|
|
2067
|
+
left: '0px',
|
|
2068
|
+
top: '0px'
|
|
2069
|
+
};
|
|
2070
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Card, {
|
|
2071
|
+
title: /*#__PURE__*/React__default['default'].createElement(antd.Space, null, title, /*#__PURE__*/React__default['default'].createElement(antd.Tooltip, {
|
|
2072
|
+
title: /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u4F7F\u7528\u6307\u5357\uFF1A"), /*#__PURE__*/React__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].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__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].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__default['default'].createElement("br", null), /*#__PURE__*/React__default['default'].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"))
|
|
2073
|
+
}, /*#__PURE__*/React__default['default'].createElement(ExclamationCircleOutlined$2, null)))
|
|
2074
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2075
|
+
className: "sheet_table_top"
|
|
2076
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement("span", null, "\u6392\u5E8F\u5217"), /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
2077
|
+
trigger: ['click'],
|
|
2078
|
+
overlay: this.leftMenu,
|
|
2079
|
+
placement: "bottomLeft"
|
|
2080
|
+
}, /*#__PURE__*/React__default['default'].createElement("a", null, /*#__PURE__*/React__default['default'].createElement(ProfileTwoTone$2, null)))), /*#__PURE__*/React__default['default'].createElement(antd.Space, null, /*#__PURE__*/React__default['default'].createElement(antd.Dropdown, {
|
|
2081
|
+
trigger: ['click'],
|
|
2082
|
+
overlay: this.menuList,
|
|
2083
|
+
placement: "bottomRight"
|
|
2084
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Button, null, "\u6E05\u7A7A", /*#__PURE__*/React__default['default'].createElement(DownOutlined$2, null))), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
2085
|
+
type: "primary",
|
|
2086
|
+
onClick: this.resetData
|
|
2087
|
+
}, "\u8BC6\u522B"))), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2088
|
+
style: {
|
|
2089
|
+
position: 'relative',
|
|
2090
|
+
height: '400px'
|
|
2091
|
+
}
|
|
2092
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2093
|
+
id: "luckysheet",
|
|
2094
|
+
style: luckyCss
|
|
2095
|
+
})), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2096
|
+
className: "sheet_table_footer"
|
|
2097
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2098
|
+
className: "sheet_table_footer_l"
|
|
2099
|
+
}, "\u5171 ", totalSummary.total, " \u6761\u6570\u636E, \u5176\u4E2D\u9519\u8BEF ", totalSummary.error, " \u9879"), /*#__PURE__*/React__default['default'].createElement(antd.Space, {
|
|
2100
|
+
className: "sheet_table_footer_r"
|
|
2101
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
|
|
2102
|
+
checked: errorListCheck,
|
|
2103
|
+
onClick: this.errorChange
|
|
2104
|
+
}), "\u4EC5\u5C55\u793A\u9519\u8BEF\u6570\u636E")));
|
|
2105
|
+
}
|
|
2106
|
+
}]);
|
|
2107
|
+
|
|
2108
|
+
return Luckysheet;
|
|
2109
|
+
}(React__default['default'].Component);
|
|
2110
|
+
|
|
2111
|
+
exports.SheetTable = Luckysheet;
|