crud-page-react 0.0.1 → 0.0.2
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/dist/index.esm.js +17 -1496
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +38 -1535
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,1492 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import React__default, { createContext, useContext, useEffect, useState, useRef, useCallback } from 'react';
|
|
2
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
3
|
import { DatePicker, Form, Row, Col, Space, Button, Input, Switch, Radio, Select, InputNumber, Tooltip, Popconfirm, Table, message, Tag, Modal, Divider, Card, Checkbox, Typography } from 'antd';
|
|
4
|
+
import { SearchOutlined, ReloadOutlined, EyeOutlined, EditOutlined, DeleteOutlined, CopyOutlined, FormOutlined, CodeOutlined, PlusOutlined } from '@ant-design/icons';
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
7
7
|
|
|
8
|
-
var IconContext = /*#__PURE__*/createContext({});
|
|
9
|
-
|
|
10
|
-
function _extends() {
|
|
11
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
12
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
13
|
-
var t = arguments[e];
|
|
14
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
15
|
-
}
|
|
16
|
-
return n;
|
|
17
|
-
}, _extends.apply(null, arguments);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _arrayWithHoles(r) {
|
|
21
|
-
if (Array.isArray(r)) return r;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _iterableToArrayLimit(r, l) {
|
|
25
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
26
|
-
if (null != t) {
|
|
27
|
-
var e,
|
|
28
|
-
n,
|
|
29
|
-
i,
|
|
30
|
-
u,
|
|
31
|
-
a = [],
|
|
32
|
-
f = true,
|
|
33
|
-
o = false;
|
|
34
|
-
try {
|
|
35
|
-
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
36
|
-
} catch (r) {
|
|
37
|
-
o = true, n = r;
|
|
38
|
-
} finally {
|
|
39
|
-
try {
|
|
40
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
41
|
-
} finally {
|
|
42
|
-
if (o) throw n;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return a;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function _arrayLikeToArray(r, a) {
|
|
50
|
-
(null == a || a > r.length) && (a = r.length);
|
|
51
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
52
|
-
return n;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function _unsupportedIterableToArray(r, a) {
|
|
56
|
-
if (r) {
|
|
57
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
58
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
59
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function _nonIterableRest() {
|
|
64
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function _slicedToArray(r, e) {
|
|
68
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function _typeof(o) {
|
|
72
|
-
"@babel/helpers - typeof";
|
|
73
|
-
|
|
74
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
75
|
-
return typeof o;
|
|
76
|
-
} : function (o) {
|
|
77
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
78
|
-
}, _typeof(o);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function toPrimitive(t, r) {
|
|
82
|
-
if ("object" != _typeof(t) || !t) return t;
|
|
83
|
-
var e = t[Symbol.toPrimitive];
|
|
84
|
-
if (void 0 !== e) {
|
|
85
|
-
var i = e.call(t, r);
|
|
86
|
-
if ("object" != _typeof(i)) return i;
|
|
87
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
88
|
-
}
|
|
89
|
-
return ("string" === r ? String : Number)(t);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function toPropertyKey(t) {
|
|
93
|
-
var i = toPrimitive(t, "string");
|
|
94
|
-
return "symbol" == _typeof(i) ? i : i + "";
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function _defineProperty(e, r, t) {
|
|
98
|
-
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
99
|
-
value: t,
|
|
100
|
-
enumerable: true,
|
|
101
|
-
configurable: true,
|
|
102
|
-
writable: true
|
|
103
|
-
}) : e[r] = t, e;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
107
|
-
if (null == r) return {};
|
|
108
|
-
var t = {};
|
|
109
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
110
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
111
|
-
t[n] = r[n];
|
|
112
|
-
}
|
|
113
|
-
return t;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function _objectWithoutProperties(e, t) {
|
|
117
|
-
if (null == e) return {};
|
|
118
|
-
var o,
|
|
119
|
-
r,
|
|
120
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
121
|
-
if (Object.getOwnPropertySymbols) {
|
|
122
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
123
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
124
|
-
}
|
|
125
|
-
return i;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function getDefaultExportFromCjs (x) {
|
|
129
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
var classnames = {exports: {}};
|
|
133
|
-
|
|
134
|
-
/*!
|
|
135
|
-
Copyright (c) 2018 Jed Watson.
|
|
136
|
-
Licensed under the MIT License (MIT), see
|
|
137
|
-
http://jedwatson.github.io/classnames
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
(function (module) {
|
|
141
|
-
/* global define */
|
|
142
|
-
|
|
143
|
-
(function () {
|
|
144
|
-
|
|
145
|
-
var hasOwn = {}.hasOwnProperty;
|
|
146
|
-
|
|
147
|
-
function classNames () {
|
|
148
|
-
var classes = '';
|
|
149
|
-
|
|
150
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
151
|
-
var arg = arguments[i];
|
|
152
|
-
if (arg) {
|
|
153
|
-
classes = appendClass(classes, parseValue(arg));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return classes;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function parseValue (arg) {
|
|
161
|
-
if (typeof arg === 'string' || typeof arg === 'number') {
|
|
162
|
-
return arg;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (typeof arg !== 'object') {
|
|
166
|
-
return '';
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (Array.isArray(arg)) {
|
|
170
|
-
return classNames.apply(null, arg);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
174
|
-
return arg.toString();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
var classes = '';
|
|
178
|
-
|
|
179
|
-
for (var key in arg) {
|
|
180
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
181
|
-
classes = appendClass(classes, key);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return classes;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function appendClass (value, newClass) {
|
|
189
|
-
if (!newClass) {
|
|
190
|
-
return value;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (value) {
|
|
194
|
-
return value + ' ' + newClass;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return value + newClass;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (module.exports) {
|
|
201
|
-
classNames.default = classNames;
|
|
202
|
-
module.exports = classNames;
|
|
203
|
-
} else {
|
|
204
|
-
window.classNames = classNames;
|
|
205
|
-
}
|
|
206
|
-
}());
|
|
207
|
-
} (classnames));
|
|
208
|
-
|
|
209
|
-
var classnamesExports = classnames.exports;
|
|
210
|
-
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
211
|
-
|
|
212
|
-
const round = Math.round;
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Support format, alpha unit will check the % mark:
|
|
216
|
-
* - rgba(102, 204, 255, .5) -> [102, 204, 255, 0.5]
|
|
217
|
-
* - rgb(102 204 255 / .5) -> [102, 204, 255, 0.5]
|
|
218
|
-
* - rgb(100%, 50%, 0% / 50%) -> [255, 128, 0, 0.5]
|
|
219
|
-
* - hsl(270, 60, 40, .5) -> [270, 60, 40, 0.5]
|
|
220
|
-
* - hsl(270deg 60% 40% / 50%) -> [270, 60, 40, 0.5]
|
|
221
|
-
*
|
|
222
|
-
* When `base` is provided, the percentage value will be divided by `base`.
|
|
223
|
-
*/
|
|
224
|
-
function splitColorStr(str, parseNum) {
|
|
225
|
-
const match = str
|
|
226
|
-
// Remove str before `(`
|
|
227
|
-
.replace(/^[^(]*\((.*)/, '$1')
|
|
228
|
-
// Remove str after `)`
|
|
229
|
-
.replace(/\).*/, '').match(/\d*\.?\d+%?/g) || [];
|
|
230
|
-
const numList = match.map(item => parseFloat(item));
|
|
231
|
-
for (let i = 0; i < 3; i += 1) {
|
|
232
|
-
numList[i] = parseNum(numList[i] || 0, match[i] || '', i);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// For alpha. 50% should be 0.5
|
|
236
|
-
if (match[3]) {
|
|
237
|
-
numList[3] = match[3].includes('%') ? numList[3] / 100 : numList[3];
|
|
238
|
-
} else {
|
|
239
|
-
// By default, alpha is 1
|
|
240
|
-
numList[3] = 1;
|
|
241
|
-
}
|
|
242
|
-
return numList;
|
|
243
|
-
}
|
|
244
|
-
const parseHSVorHSL = (num, _, index) => index === 0 ? num : num / 100;
|
|
245
|
-
|
|
246
|
-
/** round and limit number to integer between 0-255 */
|
|
247
|
-
function limitRange(value, max) {
|
|
248
|
-
const mergedMax = max || 255;
|
|
249
|
-
if (value > mergedMax) {
|
|
250
|
-
return mergedMax;
|
|
251
|
-
}
|
|
252
|
-
if (value < 0) {
|
|
253
|
-
return 0;
|
|
254
|
-
}
|
|
255
|
-
return value;
|
|
256
|
-
}
|
|
257
|
-
class FastColor {
|
|
258
|
-
constructor(input) {
|
|
259
|
-
/**
|
|
260
|
-
* All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor.
|
|
261
|
-
*/
|
|
262
|
-
_defineProperty(this, "isValid", true);
|
|
263
|
-
/**
|
|
264
|
-
* Red, R in RGB
|
|
265
|
-
*/
|
|
266
|
-
_defineProperty(this, "r", 0);
|
|
267
|
-
/**
|
|
268
|
-
* Green, G in RGB
|
|
269
|
-
*/
|
|
270
|
-
_defineProperty(this, "g", 0);
|
|
271
|
-
/**
|
|
272
|
-
* Blue, B in RGB
|
|
273
|
-
*/
|
|
274
|
-
_defineProperty(this, "b", 0);
|
|
275
|
-
/**
|
|
276
|
-
* Alpha/Opacity, A in RGBA/HSLA
|
|
277
|
-
*/
|
|
278
|
-
_defineProperty(this, "a", 1);
|
|
279
|
-
// HSV privates
|
|
280
|
-
_defineProperty(this, "_h", void 0);
|
|
281
|
-
_defineProperty(this, "_s", void 0);
|
|
282
|
-
_defineProperty(this, "_l", void 0);
|
|
283
|
-
_defineProperty(this, "_v", void 0);
|
|
284
|
-
// intermediate variables to calculate HSL/HSV
|
|
285
|
-
_defineProperty(this, "_max", void 0);
|
|
286
|
-
_defineProperty(this, "_min", void 0);
|
|
287
|
-
_defineProperty(this, "_brightness", void 0);
|
|
288
|
-
/**
|
|
289
|
-
* Always check 3 char in the object to determine the format.
|
|
290
|
-
* We not use function in check to save bundle size.
|
|
291
|
-
* e.g. 'rgb' -> { r: 0, g: 0, b: 0 }.
|
|
292
|
-
*/
|
|
293
|
-
function matchFormat(str) {
|
|
294
|
-
return str[0] in input && str[1] in input && str[2] in input;
|
|
295
|
-
}
|
|
296
|
-
if (!input) ; else if (typeof input === 'string') {
|
|
297
|
-
const trimStr = input.trim();
|
|
298
|
-
function matchPrefix(prefix) {
|
|
299
|
-
return trimStr.startsWith(prefix);
|
|
300
|
-
}
|
|
301
|
-
if (/^#?[A-F\d]{3,8}$/i.test(trimStr)) {
|
|
302
|
-
this.fromHexString(trimStr);
|
|
303
|
-
} else if (matchPrefix('rgb')) {
|
|
304
|
-
this.fromRgbString(trimStr);
|
|
305
|
-
} else if (matchPrefix('hsl')) {
|
|
306
|
-
this.fromHslString(trimStr);
|
|
307
|
-
} else if (matchPrefix('hsv') || matchPrefix('hsb')) {
|
|
308
|
-
this.fromHsvString(trimStr);
|
|
309
|
-
}
|
|
310
|
-
} else if (input instanceof FastColor) {
|
|
311
|
-
this.r = input.r;
|
|
312
|
-
this.g = input.g;
|
|
313
|
-
this.b = input.b;
|
|
314
|
-
this.a = input.a;
|
|
315
|
-
this._h = input._h;
|
|
316
|
-
this._s = input._s;
|
|
317
|
-
this._l = input._l;
|
|
318
|
-
this._v = input._v;
|
|
319
|
-
} else if (matchFormat('rgb')) {
|
|
320
|
-
this.r = limitRange(input.r);
|
|
321
|
-
this.g = limitRange(input.g);
|
|
322
|
-
this.b = limitRange(input.b);
|
|
323
|
-
this.a = typeof input.a === 'number' ? limitRange(input.a, 1) : 1;
|
|
324
|
-
} else if (matchFormat('hsl')) {
|
|
325
|
-
this.fromHsl(input);
|
|
326
|
-
} else if (matchFormat('hsv')) {
|
|
327
|
-
this.fromHsv(input);
|
|
328
|
-
} else {
|
|
329
|
-
throw new Error('@ant-design/fast-color: unsupported input ' + JSON.stringify(input));
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// ======================= Setter =======================
|
|
334
|
-
|
|
335
|
-
setR(value) {
|
|
336
|
-
return this._sc('r', value);
|
|
337
|
-
}
|
|
338
|
-
setG(value) {
|
|
339
|
-
return this._sc('g', value);
|
|
340
|
-
}
|
|
341
|
-
setB(value) {
|
|
342
|
-
return this._sc('b', value);
|
|
343
|
-
}
|
|
344
|
-
setA(value) {
|
|
345
|
-
return this._sc('a', value, 1);
|
|
346
|
-
}
|
|
347
|
-
setHue(value) {
|
|
348
|
-
const hsv = this.toHsv();
|
|
349
|
-
hsv.h = value;
|
|
350
|
-
return this._c(hsv);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
// ======================= Getter =======================
|
|
354
|
-
/**
|
|
355
|
-
* Returns the perceived luminance of a color, from 0-1.
|
|
356
|
-
* @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
357
|
-
*/
|
|
358
|
-
getLuminance() {
|
|
359
|
-
function adjustGamma(raw) {
|
|
360
|
-
const val = raw / 255;
|
|
361
|
-
return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
|
|
362
|
-
}
|
|
363
|
-
const R = adjustGamma(this.r);
|
|
364
|
-
const G = adjustGamma(this.g);
|
|
365
|
-
const B = adjustGamma(this.b);
|
|
366
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
367
|
-
}
|
|
368
|
-
getHue() {
|
|
369
|
-
if (typeof this._h === 'undefined') {
|
|
370
|
-
const delta = this.getMax() - this.getMin();
|
|
371
|
-
if (delta === 0) {
|
|
372
|
-
this._h = 0;
|
|
373
|
-
} else {
|
|
374
|
-
this._h = round(60 * (this.r === this.getMax() ? (this.g - this.b) / delta + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / delta + 2 : (this.r - this.g) / delta + 4));
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return this._h;
|
|
378
|
-
}
|
|
379
|
-
getSaturation() {
|
|
380
|
-
if (typeof this._s === 'undefined') {
|
|
381
|
-
const delta = this.getMax() - this.getMin();
|
|
382
|
-
if (delta === 0) {
|
|
383
|
-
this._s = 0;
|
|
384
|
-
} else {
|
|
385
|
-
this._s = delta / this.getMax();
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return this._s;
|
|
389
|
-
}
|
|
390
|
-
getLightness() {
|
|
391
|
-
if (typeof this._l === 'undefined') {
|
|
392
|
-
this._l = (this.getMax() + this.getMin()) / 510;
|
|
393
|
-
}
|
|
394
|
-
return this._l;
|
|
395
|
-
}
|
|
396
|
-
getValue() {
|
|
397
|
-
if (typeof this._v === 'undefined') {
|
|
398
|
-
this._v = this.getMax() / 255;
|
|
399
|
-
}
|
|
400
|
-
return this._v;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Returns the perceived brightness of the color, from 0-255.
|
|
405
|
-
* Note: this is not the b of HSB
|
|
406
|
-
* @see http://www.w3.org/TR/AERT#color-contrast
|
|
407
|
-
*/
|
|
408
|
-
getBrightness() {
|
|
409
|
-
if (typeof this._brightness === 'undefined') {
|
|
410
|
-
this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1000;
|
|
411
|
-
}
|
|
412
|
-
return this._brightness;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// ======================== Func ========================
|
|
416
|
-
|
|
417
|
-
darken(amount = 10) {
|
|
418
|
-
const h = this.getHue();
|
|
419
|
-
const s = this.getSaturation();
|
|
420
|
-
let l = this.getLightness() - amount / 100;
|
|
421
|
-
if (l < 0) {
|
|
422
|
-
l = 0;
|
|
423
|
-
}
|
|
424
|
-
return this._c({
|
|
425
|
-
h,
|
|
426
|
-
s,
|
|
427
|
-
l,
|
|
428
|
-
a: this.a
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
lighten(amount = 10) {
|
|
432
|
-
const h = this.getHue();
|
|
433
|
-
const s = this.getSaturation();
|
|
434
|
-
let l = this.getLightness() + amount / 100;
|
|
435
|
-
if (l > 1) {
|
|
436
|
-
l = 1;
|
|
437
|
-
}
|
|
438
|
-
return this._c({
|
|
439
|
-
h,
|
|
440
|
-
s,
|
|
441
|
-
l,
|
|
442
|
-
a: this.a
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Mix the current color a given amount with another color, from 0 to 100.
|
|
448
|
-
* 0 means no mixing (return current color).
|
|
449
|
-
*/
|
|
450
|
-
mix(input, amount = 50) {
|
|
451
|
-
const color = this._c(input);
|
|
452
|
-
const p = amount / 100;
|
|
453
|
-
const calc = key => (color[key] - this[key]) * p + this[key];
|
|
454
|
-
const rgba = {
|
|
455
|
-
r: round(calc('r')),
|
|
456
|
-
g: round(calc('g')),
|
|
457
|
-
b: round(calc('b')),
|
|
458
|
-
a: round(calc('a') * 100) / 100
|
|
459
|
-
};
|
|
460
|
-
return this._c(rgba);
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Mix the color with pure white, from 0 to 100.
|
|
465
|
-
* Providing 0 will do nothing, providing 100 will always return white.
|
|
466
|
-
*/
|
|
467
|
-
tint(amount = 10) {
|
|
468
|
-
return this.mix({
|
|
469
|
-
r: 255,
|
|
470
|
-
g: 255,
|
|
471
|
-
b: 255,
|
|
472
|
-
a: 1
|
|
473
|
-
}, amount);
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Mix the color with pure black, from 0 to 100.
|
|
478
|
-
* Providing 0 will do nothing, providing 100 will always return black.
|
|
479
|
-
*/
|
|
480
|
-
shade(amount = 10) {
|
|
481
|
-
return this.mix({
|
|
482
|
-
r: 0,
|
|
483
|
-
g: 0,
|
|
484
|
-
b: 0,
|
|
485
|
-
a: 1
|
|
486
|
-
}, amount);
|
|
487
|
-
}
|
|
488
|
-
onBackground(background) {
|
|
489
|
-
const bg = this._c(background);
|
|
490
|
-
const alpha = this.a + bg.a * (1 - this.a);
|
|
491
|
-
const calc = key => {
|
|
492
|
-
return round((this[key] * this.a + bg[key] * bg.a * (1 - this.a)) / alpha);
|
|
493
|
-
};
|
|
494
|
-
return this._c({
|
|
495
|
-
r: calc('r'),
|
|
496
|
-
g: calc('g'),
|
|
497
|
-
b: calc('b'),
|
|
498
|
-
a: alpha
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// ======================= Status =======================
|
|
503
|
-
isDark() {
|
|
504
|
-
return this.getBrightness() < 128;
|
|
505
|
-
}
|
|
506
|
-
isLight() {
|
|
507
|
-
return this.getBrightness() >= 128;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
// ======================== MISC ========================
|
|
511
|
-
equals(other) {
|
|
512
|
-
return this.r === other.r && this.g === other.g && this.b === other.b && this.a === other.a;
|
|
513
|
-
}
|
|
514
|
-
clone() {
|
|
515
|
-
return this._c(this);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
// ======================= Format =======================
|
|
519
|
-
toHexString() {
|
|
520
|
-
let hex = '#';
|
|
521
|
-
const rHex = (this.r || 0).toString(16);
|
|
522
|
-
hex += rHex.length === 2 ? rHex : '0' + rHex;
|
|
523
|
-
const gHex = (this.g || 0).toString(16);
|
|
524
|
-
hex += gHex.length === 2 ? gHex : '0' + gHex;
|
|
525
|
-
const bHex = (this.b || 0).toString(16);
|
|
526
|
-
hex += bHex.length === 2 ? bHex : '0' + bHex;
|
|
527
|
-
if (typeof this.a === 'number' && this.a >= 0 && this.a < 1) {
|
|
528
|
-
const aHex = round(this.a * 255).toString(16);
|
|
529
|
-
hex += aHex.length === 2 ? aHex : '0' + aHex;
|
|
530
|
-
}
|
|
531
|
-
return hex;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
/** CSS support color pattern */
|
|
535
|
-
toHsl() {
|
|
536
|
-
return {
|
|
537
|
-
h: this.getHue(),
|
|
538
|
-
s: this.getSaturation(),
|
|
539
|
-
l: this.getLightness(),
|
|
540
|
-
a: this.a
|
|
541
|
-
};
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
/** CSS support color pattern */
|
|
545
|
-
toHslString() {
|
|
546
|
-
const h = this.getHue();
|
|
547
|
-
const s = round(this.getSaturation() * 100);
|
|
548
|
-
const l = round(this.getLightness() * 100);
|
|
549
|
-
return this.a !== 1 ? `hsla(${h},${s}%,${l}%,${this.a})` : `hsl(${h},${s}%,${l}%)`;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
/** Same as toHsb */
|
|
553
|
-
toHsv() {
|
|
554
|
-
return {
|
|
555
|
-
h: this.getHue(),
|
|
556
|
-
s: this.getSaturation(),
|
|
557
|
-
v: this.getValue(),
|
|
558
|
-
a: this.a
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
toRgb() {
|
|
562
|
-
return {
|
|
563
|
-
r: this.r,
|
|
564
|
-
g: this.g,
|
|
565
|
-
b: this.b,
|
|
566
|
-
a: this.a
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
toRgbString() {
|
|
570
|
-
return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
|
|
571
|
-
}
|
|
572
|
-
toString() {
|
|
573
|
-
return this.toRgbString();
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
// ====================== Privates ======================
|
|
577
|
-
/** Return a new FastColor object with one channel changed */
|
|
578
|
-
_sc(rgb, value, max) {
|
|
579
|
-
const clone = this.clone();
|
|
580
|
-
clone[rgb] = limitRange(value, max);
|
|
581
|
-
return clone;
|
|
582
|
-
}
|
|
583
|
-
_c(input) {
|
|
584
|
-
return new this.constructor(input);
|
|
585
|
-
}
|
|
586
|
-
getMax() {
|
|
587
|
-
if (typeof this._max === 'undefined') {
|
|
588
|
-
this._max = Math.max(this.r, this.g, this.b);
|
|
589
|
-
}
|
|
590
|
-
return this._max;
|
|
591
|
-
}
|
|
592
|
-
getMin() {
|
|
593
|
-
if (typeof this._min === 'undefined') {
|
|
594
|
-
this._min = Math.min(this.r, this.g, this.b);
|
|
595
|
-
}
|
|
596
|
-
return this._min;
|
|
597
|
-
}
|
|
598
|
-
fromHexString(trimStr) {
|
|
599
|
-
const withoutPrefix = trimStr.replace('#', '');
|
|
600
|
-
function connectNum(index1, index2) {
|
|
601
|
-
return parseInt(withoutPrefix[index1] + withoutPrefix[index2 || index1], 16);
|
|
602
|
-
}
|
|
603
|
-
if (withoutPrefix.length < 6) {
|
|
604
|
-
// #rgb or #rgba
|
|
605
|
-
this.r = connectNum(0);
|
|
606
|
-
this.g = connectNum(1);
|
|
607
|
-
this.b = connectNum(2);
|
|
608
|
-
this.a = withoutPrefix[3] ? connectNum(3) / 255 : 1;
|
|
609
|
-
} else {
|
|
610
|
-
// #rrggbb or #rrggbbaa
|
|
611
|
-
this.r = connectNum(0, 1);
|
|
612
|
-
this.g = connectNum(2, 3);
|
|
613
|
-
this.b = connectNum(4, 5);
|
|
614
|
-
this.a = withoutPrefix[6] ? connectNum(6, 7) / 255 : 1;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
fromHsl({
|
|
618
|
-
h,
|
|
619
|
-
s,
|
|
620
|
-
l,
|
|
621
|
-
a
|
|
622
|
-
}) {
|
|
623
|
-
this._h = h % 360;
|
|
624
|
-
this._s = s;
|
|
625
|
-
this._l = l;
|
|
626
|
-
this.a = typeof a === 'number' ? a : 1;
|
|
627
|
-
if (s <= 0) {
|
|
628
|
-
const rgb = round(l * 255);
|
|
629
|
-
this.r = rgb;
|
|
630
|
-
this.g = rgb;
|
|
631
|
-
this.b = rgb;
|
|
632
|
-
}
|
|
633
|
-
let r = 0,
|
|
634
|
-
g = 0,
|
|
635
|
-
b = 0;
|
|
636
|
-
const huePrime = h / 60;
|
|
637
|
-
const chroma = (1 - Math.abs(2 * l - 1)) * s;
|
|
638
|
-
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
639
|
-
if (huePrime >= 0 && huePrime < 1) {
|
|
640
|
-
r = chroma;
|
|
641
|
-
g = secondComponent;
|
|
642
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
|
643
|
-
r = secondComponent;
|
|
644
|
-
g = chroma;
|
|
645
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
|
646
|
-
g = chroma;
|
|
647
|
-
b = secondComponent;
|
|
648
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
|
649
|
-
g = secondComponent;
|
|
650
|
-
b = chroma;
|
|
651
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
|
652
|
-
r = secondComponent;
|
|
653
|
-
b = chroma;
|
|
654
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
|
655
|
-
r = chroma;
|
|
656
|
-
b = secondComponent;
|
|
657
|
-
}
|
|
658
|
-
const lightnessModification = l - chroma / 2;
|
|
659
|
-
this.r = round((r + lightnessModification) * 255);
|
|
660
|
-
this.g = round((g + lightnessModification) * 255);
|
|
661
|
-
this.b = round((b + lightnessModification) * 255);
|
|
662
|
-
}
|
|
663
|
-
fromHsv({
|
|
664
|
-
h,
|
|
665
|
-
s,
|
|
666
|
-
v,
|
|
667
|
-
a
|
|
668
|
-
}) {
|
|
669
|
-
this._h = h % 360;
|
|
670
|
-
this._s = s;
|
|
671
|
-
this._v = v;
|
|
672
|
-
this.a = typeof a === 'number' ? a : 1;
|
|
673
|
-
const vv = round(v * 255);
|
|
674
|
-
this.r = vv;
|
|
675
|
-
this.g = vv;
|
|
676
|
-
this.b = vv;
|
|
677
|
-
if (s <= 0) {
|
|
678
|
-
return;
|
|
679
|
-
}
|
|
680
|
-
const hh = h / 60;
|
|
681
|
-
const i = Math.floor(hh);
|
|
682
|
-
const ff = hh - i;
|
|
683
|
-
const p = round(v * (1.0 - s) * 255);
|
|
684
|
-
const q = round(v * (1.0 - s * ff) * 255);
|
|
685
|
-
const t = round(v * (1.0 - s * (1.0 - ff)) * 255);
|
|
686
|
-
switch (i) {
|
|
687
|
-
case 0:
|
|
688
|
-
this.g = t;
|
|
689
|
-
this.b = p;
|
|
690
|
-
break;
|
|
691
|
-
case 1:
|
|
692
|
-
this.r = q;
|
|
693
|
-
this.b = p;
|
|
694
|
-
break;
|
|
695
|
-
case 2:
|
|
696
|
-
this.r = p;
|
|
697
|
-
this.b = t;
|
|
698
|
-
break;
|
|
699
|
-
case 3:
|
|
700
|
-
this.r = p;
|
|
701
|
-
this.g = q;
|
|
702
|
-
break;
|
|
703
|
-
case 4:
|
|
704
|
-
this.r = t;
|
|
705
|
-
this.g = p;
|
|
706
|
-
break;
|
|
707
|
-
case 5:
|
|
708
|
-
default:
|
|
709
|
-
this.g = p;
|
|
710
|
-
this.b = q;
|
|
711
|
-
break;
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
fromHsvString(trimStr) {
|
|
715
|
-
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
716
|
-
this.fromHsv({
|
|
717
|
-
h: cells[0],
|
|
718
|
-
s: cells[1],
|
|
719
|
-
v: cells[2],
|
|
720
|
-
a: cells[3]
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
fromHslString(trimStr) {
|
|
724
|
-
const cells = splitColorStr(trimStr, parseHSVorHSL);
|
|
725
|
-
this.fromHsl({
|
|
726
|
-
h: cells[0],
|
|
727
|
-
s: cells[1],
|
|
728
|
-
l: cells[2],
|
|
729
|
-
a: cells[3]
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
fromRgbString(trimStr) {
|
|
733
|
-
const cells = splitColorStr(trimStr, (num, txt) =>
|
|
734
|
-
// Convert percentage to number. e.g. 50% -> 128
|
|
735
|
-
txt.includes('%') ? round(num / 100 * 255) : num);
|
|
736
|
-
this.r = cells[0];
|
|
737
|
-
this.g = cells[1];
|
|
738
|
-
this.b = cells[2];
|
|
739
|
-
this.a = cells[3];
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
var hueStep = 2; // 色相阶梯
|
|
744
|
-
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
745
|
-
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
746
|
-
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
747
|
-
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
748
|
-
var lightColorCount = 5; // 浅色数量,主色上
|
|
749
|
-
var darkColorCount = 4; // 深色数量,主色下
|
|
750
|
-
|
|
751
|
-
// 暗色主题颜色映射关系表
|
|
752
|
-
var darkColorMap = [{
|
|
753
|
-
index: 7,
|
|
754
|
-
amount: 15
|
|
755
|
-
}, {
|
|
756
|
-
index: 6,
|
|
757
|
-
amount: 25
|
|
758
|
-
}, {
|
|
759
|
-
index: 5,
|
|
760
|
-
amount: 30
|
|
761
|
-
}, {
|
|
762
|
-
index: 5,
|
|
763
|
-
amount: 45
|
|
764
|
-
}, {
|
|
765
|
-
index: 5,
|
|
766
|
-
amount: 65
|
|
767
|
-
}, {
|
|
768
|
-
index: 5,
|
|
769
|
-
amount: 85
|
|
770
|
-
}, {
|
|
771
|
-
index: 4,
|
|
772
|
-
amount: 90
|
|
773
|
-
}, {
|
|
774
|
-
index: 3,
|
|
775
|
-
amount: 95
|
|
776
|
-
}, {
|
|
777
|
-
index: 2,
|
|
778
|
-
amount: 97
|
|
779
|
-
}, {
|
|
780
|
-
index: 1,
|
|
781
|
-
amount: 98
|
|
782
|
-
}];
|
|
783
|
-
function getHue(hsv, i, light) {
|
|
784
|
-
var hue;
|
|
785
|
-
// 根据色相不同,色相转向不同
|
|
786
|
-
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
787
|
-
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
788
|
-
} else {
|
|
789
|
-
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
790
|
-
}
|
|
791
|
-
if (hue < 0) {
|
|
792
|
-
hue += 360;
|
|
793
|
-
} else if (hue >= 360) {
|
|
794
|
-
hue -= 360;
|
|
795
|
-
}
|
|
796
|
-
return hue;
|
|
797
|
-
}
|
|
798
|
-
function getSaturation(hsv, i, light) {
|
|
799
|
-
// grey color don't change saturation
|
|
800
|
-
if (hsv.h === 0 && hsv.s === 0) {
|
|
801
|
-
return hsv.s;
|
|
802
|
-
}
|
|
803
|
-
var saturation;
|
|
804
|
-
if (light) {
|
|
805
|
-
saturation = hsv.s - saturationStep * i;
|
|
806
|
-
} else if (i === darkColorCount) {
|
|
807
|
-
saturation = hsv.s + saturationStep;
|
|
808
|
-
} else {
|
|
809
|
-
saturation = hsv.s + saturationStep2 * i;
|
|
810
|
-
}
|
|
811
|
-
// 边界值修正
|
|
812
|
-
if (saturation > 1) {
|
|
813
|
-
saturation = 1;
|
|
814
|
-
}
|
|
815
|
-
// 第一格的 s 限制在 0.06-0.1 之间
|
|
816
|
-
if (light && i === lightColorCount && saturation > 0.1) {
|
|
817
|
-
saturation = 0.1;
|
|
818
|
-
}
|
|
819
|
-
if (saturation < 0.06) {
|
|
820
|
-
saturation = 0.06;
|
|
821
|
-
}
|
|
822
|
-
return Math.round(saturation * 100) / 100;
|
|
823
|
-
}
|
|
824
|
-
function getValue(hsv, i, light) {
|
|
825
|
-
var value;
|
|
826
|
-
if (light) {
|
|
827
|
-
value = hsv.v + brightnessStep1 * i;
|
|
828
|
-
} else {
|
|
829
|
-
value = hsv.v - brightnessStep2 * i;
|
|
830
|
-
}
|
|
831
|
-
// Clamp value between 0 and 1
|
|
832
|
-
value = Math.max(0, Math.min(1, value));
|
|
833
|
-
return Math.round(value * 100) / 100;
|
|
834
|
-
}
|
|
835
|
-
function generate$1(color) {
|
|
836
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
837
|
-
var patterns = [];
|
|
838
|
-
var pColor = new FastColor(color);
|
|
839
|
-
var hsv = pColor.toHsv();
|
|
840
|
-
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
841
|
-
var c = new FastColor({
|
|
842
|
-
h: getHue(hsv, i, true),
|
|
843
|
-
s: getSaturation(hsv, i, true),
|
|
844
|
-
v: getValue(hsv, i, true)
|
|
845
|
-
});
|
|
846
|
-
patterns.push(c);
|
|
847
|
-
}
|
|
848
|
-
patterns.push(pColor);
|
|
849
|
-
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
850
|
-
var _c = new FastColor({
|
|
851
|
-
h: getHue(hsv, _i),
|
|
852
|
-
s: getSaturation(hsv, _i),
|
|
853
|
-
v: getValue(hsv, _i)
|
|
854
|
-
});
|
|
855
|
-
patterns.push(_c);
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
// dark theme patterns
|
|
859
|
-
if (opts.theme === 'dark') {
|
|
860
|
-
return darkColorMap.map(function (_ref) {
|
|
861
|
-
var index = _ref.index,
|
|
862
|
-
amount = _ref.amount;
|
|
863
|
-
return new FastColor(opts.backgroundColor || '#141414').mix(patterns[index], amount).toHexString();
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
return patterns.map(function (c) {
|
|
867
|
-
return c.toHexString();
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
// Generated by script. Do NOT modify!
|
|
872
|
-
|
|
873
|
-
var blue = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
|
|
874
|
-
blue.primary = blue[5];
|
|
875
|
-
|
|
876
|
-
function ownKeys(e, r) {
|
|
877
|
-
var t = Object.keys(e);
|
|
878
|
-
if (Object.getOwnPropertySymbols) {
|
|
879
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
880
|
-
r && (o = o.filter(function (r) {
|
|
881
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
882
|
-
})), t.push.apply(t, o);
|
|
883
|
-
}
|
|
884
|
-
return t;
|
|
885
|
-
}
|
|
886
|
-
function _objectSpread2(e) {
|
|
887
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
888
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
889
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
890
|
-
_defineProperty(e, r, t[r]);
|
|
891
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
892
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
893
|
-
});
|
|
894
|
-
}
|
|
895
|
-
return e;
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
function canUseDom() {
|
|
899
|
-
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
function contains(root, n) {
|
|
903
|
-
if (!root) {
|
|
904
|
-
return false;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
// Use native if support
|
|
908
|
-
if (root.contains) {
|
|
909
|
-
return root.contains(n);
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
// `document.contains` not support with IE11
|
|
913
|
-
var node = n;
|
|
914
|
-
while (node) {
|
|
915
|
-
if (node === root) {
|
|
916
|
-
return true;
|
|
917
|
-
}
|
|
918
|
-
node = node.parentNode;
|
|
919
|
-
}
|
|
920
|
-
return false;
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
var APPEND_ORDER = 'data-rc-order';
|
|
924
|
-
var APPEND_PRIORITY = 'data-rc-priority';
|
|
925
|
-
var MARK_KEY = "rc-util-key";
|
|
926
|
-
var containerCache = new Map();
|
|
927
|
-
function getMark() {
|
|
928
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
929
|
-
mark = _ref.mark;
|
|
930
|
-
if (mark) {
|
|
931
|
-
return mark.startsWith('data-') ? mark : "data-".concat(mark);
|
|
932
|
-
}
|
|
933
|
-
return MARK_KEY;
|
|
934
|
-
}
|
|
935
|
-
function getContainer(option) {
|
|
936
|
-
if (option.attachTo) {
|
|
937
|
-
return option.attachTo;
|
|
938
|
-
}
|
|
939
|
-
var head = document.querySelector('head');
|
|
940
|
-
return head || document.body;
|
|
941
|
-
}
|
|
942
|
-
function getOrder(prepend) {
|
|
943
|
-
if (prepend === 'queue') {
|
|
944
|
-
return 'prependQueue';
|
|
945
|
-
}
|
|
946
|
-
return prepend ? 'prepend' : 'append';
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* Find style which inject by rc-util
|
|
951
|
-
*/
|
|
952
|
-
function findStyles(container) {
|
|
953
|
-
return Array.from((containerCache.get(container) || container).children).filter(function (node) {
|
|
954
|
-
return node.tagName === 'STYLE';
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
function injectCSS(css) {
|
|
958
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
959
|
-
if (!canUseDom()) {
|
|
960
|
-
return null;
|
|
961
|
-
}
|
|
962
|
-
var csp = option.csp,
|
|
963
|
-
prepend = option.prepend,
|
|
964
|
-
_option$priority = option.priority,
|
|
965
|
-
priority = _option$priority === void 0 ? 0 : _option$priority;
|
|
966
|
-
var mergedOrder = getOrder(prepend);
|
|
967
|
-
var isPrependQueue = mergedOrder === 'prependQueue';
|
|
968
|
-
var styleNode = document.createElement('style');
|
|
969
|
-
styleNode.setAttribute(APPEND_ORDER, mergedOrder);
|
|
970
|
-
if (isPrependQueue && priority) {
|
|
971
|
-
styleNode.setAttribute(APPEND_PRIORITY, "".concat(priority));
|
|
972
|
-
}
|
|
973
|
-
if (csp !== null && csp !== void 0 && csp.nonce) {
|
|
974
|
-
styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;
|
|
975
|
-
}
|
|
976
|
-
styleNode.innerHTML = css;
|
|
977
|
-
var container = getContainer(option);
|
|
978
|
-
var firstChild = container.firstChild;
|
|
979
|
-
if (prepend) {
|
|
980
|
-
// If is queue `prepend`, it will prepend first style and then append rest style
|
|
981
|
-
if (isPrependQueue) {
|
|
982
|
-
var existStyle = (option.styles || findStyles(container)).filter(function (node) {
|
|
983
|
-
// Ignore style which not injected by rc-util with prepend
|
|
984
|
-
if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {
|
|
985
|
-
return false;
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
// Ignore style which priority less then new style
|
|
989
|
-
var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);
|
|
990
|
-
return priority >= nodePriority;
|
|
991
|
-
});
|
|
992
|
-
if (existStyle.length) {
|
|
993
|
-
container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);
|
|
994
|
-
return styleNode;
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
// Use `insertBefore` as `prepend`
|
|
999
|
-
container.insertBefore(styleNode, firstChild);
|
|
1000
|
-
} else {
|
|
1001
|
-
container.appendChild(styleNode);
|
|
1002
|
-
}
|
|
1003
|
-
return styleNode;
|
|
1004
|
-
}
|
|
1005
|
-
function findExistNode(key) {
|
|
1006
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1007
|
-
var container = getContainer(option);
|
|
1008
|
-
return (option.styles || findStyles(container)).find(function (node) {
|
|
1009
|
-
return node.getAttribute(getMark(option)) === key;
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
/**
|
|
1014
|
-
* qiankun will inject `appendChild` to insert into other
|
|
1015
|
-
*/
|
|
1016
|
-
function syncRealContainer(container, option) {
|
|
1017
|
-
var cachedRealContainer = containerCache.get(container);
|
|
1018
|
-
|
|
1019
|
-
// Find real container when not cached or cached container removed
|
|
1020
|
-
if (!cachedRealContainer || !contains(document, cachedRealContainer)) {
|
|
1021
|
-
var placeholderStyle = injectCSS('', option);
|
|
1022
|
-
var parentNode = placeholderStyle.parentNode;
|
|
1023
|
-
containerCache.set(container, parentNode);
|
|
1024
|
-
container.removeChild(placeholderStyle);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
function updateCSS(css, key) {
|
|
1028
|
-
var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1029
|
-
var container = getContainer(originOption);
|
|
1030
|
-
var styles = findStyles(container);
|
|
1031
|
-
var option = _objectSpread2(_objectSpread2({}, originOption), {}, {
|
|
1032
|
-
styles: styles
|
|
1033
|
-
});
|
|
1034
|
-
|
|
1035
|
-
// Sync real parent
|
|
1036
|
-
syncRealContainer(container, option);
|
|
1037
|
-
var existNode = findExistNode(key, option);
|
|
1038
|
-
if (existNode) {
|
|
1039
|
-
var _option$csp, _option$csp2;
|
|
1040
|
-
if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {
|
|
1041
|
-
var _option$csp3;
|
|
1042
|
-
existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;
|
|
1043
|
-
}
|
|
1044
|
-
if (existNode.innerHTML !== css) {
|
|
1045
|
-
existNode.innerHTML = css;
|
|
1046
|
-
}
|
|
1047
|
-
return existNode;
|
|
1048
|
-
}
|
|
1049
|
-
var newNode = injectCSS(css, option);
|
|
1050
|
-
newNode.setAttribute(getMark(option), key);
|
|
1051
|
-
return newNode;
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
function getRoot(ele) {
|
|
1055
|
-
var _ele$getRootNode;
|
|
1056
|
-
return ele === null || ele === void 0 || (_ele$getRootNode = ele.getRootNode) === null || _ele$getRootNode === void 0 ? void 0 : _ele$getRootNode.call(ele);
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Check if is in shadowRoot
|
|
1061
|
-
*/
|
|
1062
|
-
function inShadow(ele) {
|
|
1063
|
-
return getRoot(ele) instanceof ShadowRoot;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* Return shadowRoot if possible
|
|
1068
|
-
*/
|
|
1069
|
-
function getShadowRoot(ele) {
|
|
1070
|
-
return inShadow(ele) ? getRoot(ele) : null;
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
/* eslint-disable no-console */
|
|
1074
|
-
var warned = {};
|
|
1075
|
-
var preWarningFns = [];
|
|
1076
|
-
|
|
1077
|
-
/**
|
|
1078
|
-
* Pre warning enable you to parse content before console.error.
|
|
1079
|
-
* Modify to null will prevent warning.
|
|
1080
|
-
*/
|
|
1081
|
-
var preMessage = function preMessage(fn) {
|
|
1082
|
-
preWarningFns.push(fn);
|
|
1083
|
-
};
|
|
1084
|
-
|
|
1085
|
-
/**
|
|
1086
|
-
* Warning if condition not match.
|
|
1087
|
-
* @param valid Condition
|
|
1088
|
-
* @param message Warning message
|
|
1089
|
-
* @example
|
|
1090
|
-
* ```js
|
|
1091
|
-
* warning(false, 'some error'); // print some error
|
|
1092
|
-
* warning(true, 'some error'); // print nothing
|
|
1093
|
-
* warning(1 === 2, 'some error'); // print some error
|
|
1094
|
-
* ```
|
|
1095
|
-
*/
|
|
1096
|
-
function warning$1(valid, message) {
|
|
1097
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
1098
|
-
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
1099
|
-
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'warning');
|
|
1100
|
-
}, message);
|
|
1101
|
-
if (finalMessage) {
|
|
1102
|
-
console.error("Warning: ".concat(finalMessage));
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
/** @see Similar to {@link warning} */
|
|
1108
|
-
function note(valid, message) {
|
|
1109
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
1110
|
-
var finalMessage = preWarningFns.reduce(function (msg, preMessageFn) {
|
|
1111
|
-
return preMessageFn(msg !== null && msg !== void 0 ? msg : '', 'note');
|
|
1112
|
-
}, message);
|
|
1113
|
-
if (finalMessage) {
|
|
1114
|
-
console.warn("Note: ".concat(finalMessage));
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
function resetWarned() {
|
|
1119
|
-
warned = {};
|
|
1120
|
-
}
|
|
1121
|
-
function call(method, valid, message) {
|
|
1122
|
-
if (!valid && !warned[message]) {
|
|
1123
|
-
method(false, message);
|
|
1124
|
-
warned[message] = true;
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
1129
|
-
function warningOnce(valid, message) {
|
|
1130
|
-
call(warning$1, valid, message);
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
/** @see Same as {@link warning}, but only warn once for the same message */
|
|
1134
|
-
function noteOnce(valid, message) {
|
|
1135
|
-
call(note, valid, message);
|
|
1136
|
-
}
|
|
1137
|
-
warningOnce.preMessage = preMessage;
|
|
1138
|
-
warningOnce.resetWarned = resetWarned;
|
|
1139
|
-
warningOnce.noteOnce = noteOnce;
|
|
1140
|
-
|
|
1141
|
-
function camelCase(input) {
|
|
1142
|
-
return input.replace(/-(.)/g, function (match, g) {
|
|
1143
|
-
return g.toUpperCase();
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
function warning(valid, message) {
|
|
1147
|
-
warningOnce(valid, "[@ant-design/icons] ".concat(message));
|
|
1148
|
-
}
|
|
1149
|
-
function isIconDefinition(target) {
|
|
1150
|
-
return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
|
|
1151
|
-
}
|
|
1152
|
-
function normalizeAttrs() {
|
|
1153
|
-
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1154
|
-
return Object.keys(attrs).reduce(function (acc, key) {
|
|
1155
|
-
var val = attrs[key];
|
|
1156
|
-
switch (key) {
|
|
1157
|
-
case 'class':
|
|
1158
|
-
acc.className = val;
|
|
1159
|
-
delete acc.class;
|
|
1160
|
-
break;
|
|
1161
|
-
default:
|
|
1162
|
-
delete acc[key];
|
|
1163
|
-
acc[camelCase(key)] = val;
|
|
1164
|
-
}
|
|
1165
|
-
return acc;
|
|
1166
|
-
}, {});
|
|
1167
|
-
}
|
|
1168
|
-
function generate(node, key, rootProps) {
|
|
1169
|
-
if (!rootProps) {
|
|
1170
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2({
|
|
1171
|
-
key: key
|
|
1172
|
-
}, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
|
|
1173
|
-
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1174
|
-
}));
|
|
1175
|
-
}
|
|
1176
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2(_objectSpread2({
|
|
1177
|
-
key: key
|
|
1178
|
-
}, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
|
|
1179
|
-
return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1180
|
-
}));
|
|
1181
|
-
}
|
|
1182
|
-
function getSecondaryColor(primaryColor) {
|
|
1183
|
-
// choose the second color
|
|
1184
|
-
return generate$1(primaryColor)[0];
|
|
1185
|
-
}
|
|
1186
|
-
function normalizeTwoToneColors(twoToneColor) {
|
|
1187
|
-
if (!twoToneColor) {
|
|
1188
|
-
return [];
|
|
1189
|
-
}
|
|
1190
|
-
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
1191
|
-
}
|
|
1192
|
-
var iconStyles = "\n.anticon {\n display: inline-flex;\n align-items: center;\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";
|
|
1193
|
-
var useInsertStyles = function useInsertStyles(eleRef) {
|
|
1194
|
-
var _useContext = useContext(IconContext),
|
|
1195
|
-
csp = _useContext.csp,
|
|
1196
|
-
prefixCls = _useContext.prefixCls,
|
|
1197
|
-
layer = _useContext.layer;
|
|
1198
|
-
var mergedStyleStr = iconStyles;
|
|
1199
|
-
if (prefixCls) {
|
|
1200
|
-
mergedStyleStr = mergedStyleStr.replace(/anticon/g, prefixCls);
|
|
1201
|
-
}
|
|
1202
|
-
if (layer) {
|
|
1203
|
-
mergedStyleStr = "@layer ".concat(layer, " {\n").concat(mergedStyleStr, "\n}");
|
|
1204
|
-
}
|
|
1205
|
-
useEffect(function () {
|
|
1206
|
-
var ele = eleRef.current;
|
|
1207
|
-
var shadowRoot = getShadowRoot(ele);
|
|
1208
|
-
updateCSS(mergedStyleStr, '@ant-design-icons', {
|
|
1209
|
-
prepend: !layer,
|
|
1210
|
-
csp: csp,
|
|
1211
|
-
attachTo: shadowRoot
|
|
1212
|
-
});
|
|
1213
|
-
}, []);
|
|
1214
|
-
};
|
|
1215
|
-
|
|
1216
|
-
var _excluded$1 = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
|
|
1217
|
-
var twoToneColorPalette = {
|
|
1218
|
-
primaryColor: '#333',
|
|
1219
|
-
secondaryColor: '#E6E6E6',
|
|
1220
|
-
calculated: false
|
|
1221
|
-
};
|
|
1222
|
-
function setTwoToneColors(_ref) {
|
|
1223
|
-
var primaryColor = _ref.primaryColor,
|
|
1224
|
-
secondaryColor = _ref.secondaryColor;
|
|
1225
|
-
twoToneColorPalette.primaryColor = primaryColor;
|
|
1226
|
-
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
1227
|
-
twoToneColorPalette.calculated = !!secondaryColor;
|
|
1228
|
-
}
|
|
1229
|
-
function getTwoToneColors() {
|
|
1230
|
-
return _objectSpread2({}, twoToneColorPalette);
|
|
1231
|
-
}
|
|
1232
|
-
var IconBase = function IconBase(props) {
|
|
1233
|
-
var icon = props.icon,
|
|
1234
|
-
className = props.className,
|
|
1235
|
-
onClick = props.onClick,
|
|
1236
|
-
style = props.style,
|
|
1237
|
-
primaryColor = props.primaryColor,
|
|
1238
|
-
secondaryColor = props.secondaryColor,
|
|
1239
|
-
restProps = _objectWithoutProperties(props, _excluded$1);
|
|
1240
|
-
var svgRef = React.useRef();
|
|
1241
|
-
var colors = twoToneColorPalette;
|
|
1242
|
-
if (primaryColor) {
|
|
1243
|
-
colors = {
|
|
1244
|
-
primaryColor: primaryColor,
|
|
1245
|
-
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
1246
|
-
};
|
|
1247
|
-
}
|
|
1248
|
-
useInsertStyles(svgRef);
|
|
1249
|
-
warning(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
1250
|
-
if (!isIconDefinition(icon)) {
|
|
1251
|
-
return null;
|
|
1252
|
-
}
|
|
1253
|
-
var target = icon;
|
|
1254
|
-
if (target && typeof target.icon === 'function') {
|
|
1255
|
-
target = _objectSpread2(_objectSpread2({}, target), {}, {
|
|
1256
|
-
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
1257
|
-
});
|
|
1258
|
-
}
|
|
1259
|
-
return generate(target.icon, "svg-".concat(target.name), _objectSpread2(_objectSpread2({
|
|
1260
|
-
className: className,
|
|
1261
|
-
onClick: onClick,
|
|
1262
|
-
style: style,
|
|
1263
|
-
'data-icon': target.name,
|
|
1264
|
-
width: '1em',
|
|
1265
|
-
height: '1em',
|
|
1266
|
-
fill: 'currentColor',
|
|
1267
|
-
'aria-hidden': 'true'
|
|
1268
|
-
}, restProps), {}, {
|
|
1269
|
-
ref: svgRef
|
|
1270
|
-
}));
|
|
1271
|
-
};
|
|
1272
|
-
IconBase.displayName = 'IconReact';
|
|
1273
|
-
IconBase.getTwoToneColors = getTwoToneColors;
|
|
1274
|
-
IconBase.setTwoToneColors = setTwoToneColors;
|
|
1275
|
-
|
|
1276
|
-
function setTwoToneColor(twoToneColor) {
|
|
1277
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1278
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1279
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1280
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1281
|
-
return IconBase.setTwoToneColors({
|
|
1282
|
-
primaryColor: primaryColor,
|
|
1283
|
-
secondaryColor: secondaryColor
|
|
1284
|
-
});
|
|
1285
|
-
}
|
|
1286
|
-
function getTwoToneColor() {
|
|
1287
|
-
var colors = IconBase.getTwoToneColors();
|
|
1288
|
-
if (!colors.calculated) {
|
|
1289
|
-
return colors.primaryColor;
|
|
1290
|
-
}
|
|
1291
|
-
return [colors.primaryColor, colors.secondaryColor];
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
var _excluded = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
|
|
1295
|
-
// Initial setting
|
|
1296
|
-
// should move it to antd main repo?
|
|
1297
|
-
setTwoToneColor(blue.primary);
|
|
1298
|
-
|
|
1299
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34757#issuecomment-488848720
|
|
1300
|
-
|
|
1301
|
-
var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1302
|
-
var className = props.className,
|
|
1303
|
-
icon = props.icon,
|
|
1304
|
-
spin = props.spin,
|
|
1305
|
-
rotate = props.rotate,
|
|
1306
|
-
tabIndex = props.tabIndex,
|
|
1307
|
-
onClick = props.onClick,
|
|
1308
|
-
twoToneColor = props.twoToneColor,
|
|
1309
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
1310
|
-
var _React$useContext = React.useContext(IconContext),
|
|
1311
|
-
_React$useContext$pre = _React$useContext.prefixCls,
|
|
1312
|
-
prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre,
|
|
1313
|
-
rootClassName = _React$useContext.rootClassName;
|
|
1314
|
-
var classString = classNames(rootClassName, prefixCls, _defineProperty(_defineProperty({}, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), className);
|
|
1315
|
-
var iconTabIndex = tabIndex;
|
|
1316
|
-
if (iconTabIndex === undefined && onClick) {
|
|
1317
|
-
iconTabIndex = -1;
|
|
1318
|
-
}
|
|
1319
|
-
var svgStyle = rotate ? {
|
|
1320
|
-
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
1321
|
-
transform: "rotate(".concat(rotate, "deg)")
|
|
1322
|
-
} : undefined;
|
|
1323
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1324
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1325
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1326
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1327
|
-
return /*#__PURE__*/React.createElement("span", _extends({
|
|
1328
|
-
role: "img",
|
|
1329
|
-
"aria-label": icon.name
|
|
1330
|
-
}, restProps, {
|
|
1331
|
-
ref: ref,
|
|
1332
|
-
tabIndex: iconTabIndex,
|
|
1333
|
-
onClick: onClick,
|
|
1334
|
-
className: classString
|
|
1335
|
-
}), /*#__PURE__*/React.createElement(IconBase, {
|
|
1336
|
-
icon: icon,
|
|
1337
|
-
primaryColor: primaryColor,
|
|
1338
|
-
secondaryColor: secondaryColor,
|
|
1339
|
-
style: svgStyle
|
|
1340
|
-
}));
|
|
1341
|
-
});
|
|
1342
|
-
Icon.displayName = 'AntdIcon';
|
|
1343
|
-
Icon.getTwoToneColor = getTwoToneColor;
|
|
1344
|
-
Icon.setTwoToneColor = setTwoToneColor;
|
|
1345
|
-
|
|
1346
|
-
// This icon file is generated automatically.
|
|
1347
|
-
var CodeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 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" } }] }, "name": "code", "theme": "outlined" };
|
|
1348
|
-
|
|
1349
|
-
var CodeOutlined = function CodeOutlined(props, ref) {
|
|
1350
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1351
|
-
ref: ref,
|
|
1352
|
-
icon: CodeOutlined$1
|
|
1353
|
-
}));
|
|
1354
|
-
};
|
|
1355
|
-
|
|
1356
|
-
/** */
|
|
1357
|
-
var RefIcon$8 = /*#__PURE__*/React.forwardRef(CodeOutlined);
|
|
1358
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1359
|
-
RefIcon$8.displayName = 'CodeOutlined';
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
// This icon file is generated automatically.
|
|
1363
|
-
var CopyOutlined$1 = { "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" };
|
|
1364
|
-
|
|
1365
|
-
var CopyOutlined = function CopyOutlined(props, ref) {
|
|
1366
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1367
|
-
ref: ref,
|
|
1368
|
-
icon: CopyOutlined$1
|
|
1369
|
-
}));
|
|
1370
|
-
};
|
|
1371
|
-
|
|
1372
|
-
/** */
|
|
1373
|
-
var RefIcon$7 = /*#__PURE__*/React.forwardRef(CopyOutlined);
|
|
1374
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1375
|
-
RefIcon$7.displayName = 'CopyOutlined';
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
// This icon file is generated automatically.
|
|
1379
|
-
var DeleteOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z" } }] }, "name": "delete", "theme": "outlined" };
|
|
1380
|
-
|
|
1381
|
-
var DeleteOutlined = function DeleteOutlined(props, ref) {
|
|
1382
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1383
|
-
ref: ref,
|
|
1384
|
-
icon: DeleteOutlined$1
|
|
1385
|
-
}));
|
|
1386
|
-
};
|
|
1387
|
-
|
|
1388
|
-
/** */
|
|
1389
|
-
var RefIcon$6 = /*#__PURE__*/React.forwardRef(DeleteOutlined);
|
|
1390
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1391
|
-
RefIcon$6.displayName = 'DeleteOutlined';
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
// This icon file is generated automatically.
|
|
1395
|
-
var EditOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z" } }] }, "name": "edit", "theme": "outlined" };
|
|
1396
|
-
|
|
1397
|
-
var EditOutlined = function EditOutlined(props, ref) {
|
|
1398
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1399
|
-
ref: ref,
|
|
1400
|
-
icon: EditOutlined$1
|
|
1401
|
-
}));
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
/** */
|
|
1405
|
-
var RefIcon$5 = /*#__PURE__*/React.forwardRef(EditOutlined);
|
|
1406
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1407
|
-
RefIcon$5.displayName = 'EditOutlined';
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
// This icon file is generated automatically.
|
|
1411
|
-
var EyeOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M942.2 486.2C847.4 286.5 704.1 186 512 186c-192.2 0-335.4 100.5-430.2 300.3a60.3 60.3 0 000 51.5C176.6 737.5 319.9 838 512 838c192.2 0 335.4-100.5 430.2-300.3 7.7-16.2 7.7-35 0-51.5zM512 766c-161.3 0-279.4-81.8-362.7-254C232.6 339.8 350.7 258 512 258c161.3 0 279.4 81.8 362.7 254C791.5 684.2 673.4 766 512 766zm-4-430c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm0 288c-61.9 0-112-50.1-112-112s50.1-112 112-112 112 50.1 112 112-50.1 112-112 112z" } }] }, "name": "eye", "theme": "outlined" };
|
|
1412
|
-
|
|
1413
|
-
var EyeOutlined = function EyeOutlined(props, ref) {
|
|
1414
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1415
|
-
ref: ref,
|
|
1416
|
-
icon: EyeOutlined$1
|
|
1417
|
-
}));
|
|
1418
|
-
};
|
|
1419
|
-
|
|
1420
|
-
/** */
|
|
1421
|
-
var RefIcon$4 = /*#__PURE__*/React.forwardRef(EyeOutlined);
|
|
1422
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1423
|
-
RefIcon$4.displayName = 'EyeOutlined';
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
// This icon file is generated automatically.
|
|
1427
|
-
var FormOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M904 512h-56c-4.4 0-8 3.6-8 8v320H184V184h320c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V520c0-4.4-3.6-8-8-8z" } }, { "tag": "path", "attrs": { "d": "M355.9 534.9L354 653.8c-.1 8.9 7.1 16.2 16 16.2h.4l118-2.9c2-.1 4-.9 5.4-2.3l415.9-415c3.1-3.1 3.1-8.2 0-11.3L785.4 114.3c-1.6-1.6-3.6-2.3-5.7-2.3s-4.1.8-5.7 2.3l-415.8 415a8.3 8.3 0 00-2.3 5.6zm63.5 23.6L779.7 199l45.2 45.1-360.5 359.7-45.7 1.1.7-46.4z" } }] }, "name": "form", "theme": "outlined" };
|
|
1428
|
-
|
|
1429
|
-
var FormOutlined = function FormOutlined(props, ref) {
|
|
1430
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1431
|
-
ref: ref,
|
|
1432
|
-
icon: FormOutlined$1
|
|
1433
|
-
}));
|
|
1434
|
-
};
|
|
1435
|
-
|
|
1436
|
-
/** */
|
|
1437
|
-
var RefIcon$3 = /*#__PURE__*/React.forwardRef(FormOutlined);
|
|
1438
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1439
|
-
RefIcon$3.displayName = 'FormOutlined';
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
// This icon file is generated automatically.
|
|
1443
|
-
var PlusOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z" } }, { "tag": "path", "attrs": { "d": "M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z" } }] }, "name": "plus", "theme": "outlined" };
|
|
1444
|
-
|
|
1445
|
-
var PlusOutlined = function PlusOutlined(props, ref) {
|
|
1446
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1447
|
-
ref: ref,
|
|
1448
|
-
icon: PlusOutlined$1
|
|
1449
|
-
}));
|
|
1450
|
-
};
|
|
1451
|
-
|
|
1452
|
-
/** */
|
|
1453
|
-
var RefIcon$2 = /*#__PURE__*/React.forwardRef(PlusOutlined);
|
|
1454
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1455
|
-
RefIcon$2.displayName = 'PlusOutlined';
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
// This icon file is generated automatically.
|
|
1459
|
-
var ReloadOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "64 64 896 896", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z" } }] }, "name": "reload", "theme": "outlined" };
|
|
1460
|
-
|
|
1461
|
-
var ReloadOutlined = function ReloadOutlined(props, ref) {
|
|
1462
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1463
|
-
ref: ref,
|
|
1464
|
-
icon: ReloadOutlined$1
|
|
1465
|
-
}));
|
|
1466
|
-
};
|
|
1467
|
-
|
|
1468
|
-
/** */
|
|
1469
|
-
var RefIcon$1 = /*#__PURE__*/React.forwardRef(ReloadOutlined);
|
|
1470
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1471
|
-
RefIcon$1.displayName = 'ReloadOutlined';
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
// This icon file is generated automatically.
|
|
1475
|
-
var SearchOutlined$1 = { "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" };
|
|
1476
|
-
|
|
1477
|
-
var SearchOutlined = function SearchOutlined(props, ref) {
|
|
1478
|
-
return /*#__PURE__*/React.createElement(Icon, _extends({}, props, {
|
|
1479
|
-
ref: ref,
|
|
1480
|
-
icon: SearchOutlined$1
|
|
1481
|
-
}));
|
|
1482
|
-
};
|
|
1483
|
-
|
|
1484
|
-
/** */
|
|
1485
|
-
var RefIcon = /*#__PURE__*/React.forwardRef(SearchOutlined);
|
|
1486
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1487
|
-
RefIcon.displayName = 'SearchOutlined';
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
8
|
/* ─── 工具函数 ──────────────────────────────────────── */
|
|
1491
9
|
/**
|
|
1492
10
|
* 根据数据类型推导默认 UI 组件
|
|
@@ -1618,7 +136,7 @@ function DynamicFilter({ schema, onSearch, onReset }) {
|
|
|
1618
136
|
// inputNumber 数字范围:name 不放在 Form.Item 上,由内部子 Form.Item 承载
|
|
1619
137
|
const isNumberRange = widget === 'inputNumber' && (cfg === null || cfg === void 0 ? void 0 : cfg.range);
|
|
1620
138
|
return (jsx(Col, Object.assign({}, colSpan, { children: jsx(Form.Item, { label: field.label, name: isNumberRange ? undefined : field.key, valuePropName: widget === 'switch' ? 'checked' : 'value', children: renderFilterInput(field, cfg) }) }), field.key));
|
|
1621
|
-
}), jsx(Col, Object.assign({}, colSpan, { children: jsx(Form.Item, { label: " ", children: jsxs(Space, { children: [jsx(Button, { type: "primary", htmlType: "submit", icon: jsx(
|
|
139
|
+
}), jsx(Col, Object.assign({}, colSpan, { children: jsx(Form.Item, { label: " ", children: jsxs(Space, { children: [jsx(Button, { type: "primary", htmlType: "submit", icon: jsx(SearchOutlined, {}), children: "\u641C\u7D22" }), jsx(Button, { onClick: handleReset, icon: jsx(ReloadOutlined, {}), children: "\u91CD\u7F6E" }), filterFields.length > 4 && (jsx(Button, { type: "link", onClick: () => setExpanded(!expanded), children: expanded ? '收起' : '展开' }))] }) }) }))] }) }));
|
|
1622
140
|
}
|
|
1623
141
|
|
|
1624
142
|
function getTableConfig(field) {
|
|
@@ -1732,16 +250,16 @@ function DynamicTable({ schema, data, loading, pagination, onView, onEdit, onDel
|
|
|
1732
250
|
return (jsxs(Space, { size: 4, children: [((_a = schema.actions) !== null && _a !== void 0 ? _a : []).map((action) => {
|
|
1733
251
|
var _a, _b, _c;
|
|
1734
252
|
if (action.type === 'view') {
|
|
1735
|
-
return (jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", icon: jsx(
|
|
253
|
+
return (jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", icon: jsx(EyeOutlined, {}), onClick: () => onView(record) }) }, action.key));
|
|
1736
254
|
}
|
|
1737
255
|
if (action.type === 'edit') {
|
|
1738
|
-
return (jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", icon: jsx(
|
|
256
|
+
return (jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", icon: jsx(EditOutlined, {}), onClick: () => onEdit(record) }) }, action.key));
|
|
1739
257
|
}
|
|
1740
258
|
if (action.type === 'delete') {
|
|
1741
|
-
return (jsx(Popconfirm, { title: (_b = (_a = action.confirm) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '确定删除?', description: (_c = action.confirm) === null || _c === void 0 ? void 0 : _c.content, onConfirm: () => onDelete(record), okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88", okButtonProps: { danger: true }, children: jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", danger: true, icon: jsx(
|
|
259
|
+
return (jsx(Popconfirm, { title: (_b = (_a = action.confirm) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '确定删除?', description: (_c = action.confirm) === null || _c === void 0 ? void 0 : _c.content, onConfirm: () => onDelete(record), okText: "\u786E\u5B9A", cancelText: "\u53D6\u6D88", okButtonProps: { danger: true }, children: jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", danger: true, icon: jsx(DeleteOutlined, {}) }) }) }, action.key));
|
|
1742
260
|
}
|
|
1743
261
|
return (jsx(Tooltip, { title: action.label, children: jsx(Button, { type: "link", size: "small", onClick: () => onCustomAction === null || onCustomAction === void 0 ? void 0 : onCustomAction(action.key, record), children: action.label }) }, action.key));
|
|
1744
|
-
}), jsx(Tooltip, { title: "\u590D\u5236 JSON", children: jsx(Button, { type: "link", size: "small", icon: jsx(
|
|
262
|
+
}), jsx(Tooltip, { title: "\u590D\u5236 JSON", children: jsx(Button, { type: "link", size: "small", icon: jsx(CopyOutlined, {}), onClick: () => copyJson(record) }) })] }));
|
|
1745
263
|
},
|
|
1746
264
|
});
|
|
1747
265
|
return (jsx(Table, { rowKey: (_c = schema.rowKey) !== null && _c !== void 0 ? _c : 'id', columns: columns, dataSource: data, loading: loading, scroll: { x: 'max-content' }, pagination: {
|
|
@@ -2063,11 +581,11 @@ function renderFormInput(field, cfg, disabled) {
|
|
|
2063
581
|
? [{
|
|
2064
582
|
title: '',
|
|
2065
583
|
width: 50,
|
|
2066
|
-
render: (_, record) => (jsx(Button, { type: "text", danger: true, icon: jsx(
|
|
584
|
+
render: (_, record) => (jsx(Button, { type: "text", danger: true, icon: jsx(DeleteOutlined, {}), onClick: () => remove(record.name) })),
|
|
2067
585
|
}]
|
|
2068
586
|
: []),
|
|
2069
587
|
];
|
|
2070
|
-
return (jsxs("div", { children: [jsx(Table, { size: "small", dataSource: listFields.map((f) => (Object.assign(Object.assign({}, f), { _key: f.key }))), rowKey: "_key", columns: columns, pagination: false, style: { marginBottom: 8 } }), !disabled && (jsx(Button, { type: "dashed", icon: jsx(
|
|
588
|
+
return (jsxs("div", { children: [jsx(Table, { size: "small", dataSource: listFields.map((f) => (Object.assign(Object.assign({}, f), { _key: f.key }))), rowKey: "_key", columns: columns, pagination: false, style: { marginBottom: 8 } }), !disabled && (jsx(Button, { type: "dashed", icon: jsx(PlusOutlined, {}), onClick: () => add({}), block: true, children: "\u6DFB\u52A0\u4E00\u884C" }))] }));
|
|
2071
589
|
} }));
|
|
2072
590
|
}
|
|
2073
591
|
default:
|
|
@@ -2196,7 +714,10 @@ function DynamicForm({ schema, mode, visible, initialValues, onSubmit, onCancel,
|
|
|
2196
714
|
if (mode === 'create') {
|
|
2197
715
|
// 新增模式:清空表单并确保没有残留数据
|
|
2198
716
|
form.resetFields();
|
|
2199
|
-
|
|
717
|
+
// 延迟一下确保resetFields完成
|
|
718
|
+
setTimeout(() => {
|
|
719
|
+
form.setFieldsValue({});
|
|
720
|
+
}, 0);
|
|
2200
721
|
}
|
|
2201
722
|
else {
|
|
2202
723
|
// 编辑/查看模式设置初始值
|
|
@@ -2204,7 +725,7 @@ function DynamicForm({ schema, mode, visible, initialValues, onSubmit, onCancel,
|
|
|
2204
725
|
form.setFieldsValue(normalized);
|
|
2205
726
|
}
|
|
2206
727
|
}
|
|
2207
|
-
}, [visible, mode, initialValues]);
|
|
728
|
+
}, [visible, mode, initialValues, form, formFields]);
|
|
2208
729
|
const switchToRaw = () => {
|
|
2209
730
|
// getFieldsValue(true) 返回 store 全量数据(含 id 等非 Form.Item 字段)
|
|
2210
731
|
const rawValues = disabled
|
|
@@ -2284,8 +805,8 @@ function DynamicForm({ schema, mode, visible, initialValues, onSubmit, onCancel,
|
|
|
2284
805
|
.then(() => void message.success('已复制 JSON'))
|
|
2285
806
|
.catch(() => void message.error('复制失败'));
|
|
2286
807
|
};
|
|
2287
|
-
const modalTitle = (jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', paddingRight: 32 }, children: [jsx("span", { children: titleMap[mode] }), jsx(Space, { size: 8, children: jsx(Button, { size: "small", type: "text", icon: rawJsonMode ? jsx(
|
|
2288
|
-
return (jsxs(Modal, { title: modalTitle, open: visible, onOk: handleOk, onCancel: onCancel, okText: disabled ? '关闭' : '确认', cancelText: "\u53D6\u6D88", cancelButtonProps: disabled ? { style: { display: 'none' } } : {}, width: 720, destroyOnClose: true, children: [jsx("div", { style: { display: rawJsonMode ? 'none' : undefined }, children: jsx(Form, { form: form, layout: "vertical", initialValues:
|
|
808
|
+
const modalTitle = (jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', paddingRight: 32 }, children: [jsx("span", { children: titleMap[mode] }), jsx(Space, { size: 8, children: jsx(Button, { size: "small", type: "text", icon: rawJsonMode ? jsx(FormOutlined, {}) : jsx(CodeOutlined, {}), onClick: rawJsonMode ? switchToForm : switchToRaw, children: rawJsonMode ? '表单视图' : 'Raw JSON' }) })] }));
|
|
809
|
+
return (jsxs(Modal, { title: modalTitle, open: visible, onOk: handleOk, onCancel: onCancel, okText: disabled ? '关闭' : '确认', cancelText: "\u53D6\u6D88", cancelButtonProps: disabled ? { style: { display: 'none' } } : {}, width: 720, destroyOnClose: true, children: [jsx("div", { style: { display: rawJsonMode ? 'none' : undefined }, children: jsx(Form, { form: form, layout: "vertical", initialValues: {}, children: renderFieldGroups() }) }), rawJsonMode && (jsxs("div", { children: [jsx(Input.TextArea, { value: rawJsonText, onChange: disabled ? undefined : (e) => { setRawJsonText(e.target.value); setRawJsonError(''); }, readOnly: disabled, rows: 20, style: { fontFamily: 'monospace', fontSize: 12, resize: 'vertical' }, status: rawJsonError ? 'error' : undefined }), rawJsonError && (jsx("div", { style: { color: '#ff4d4f', fontSize: 12, marginTop: 4 }, children: rawJsonError })), !disabled && (jsx("div", { style: { marginTop: 8, textAlign: 'right' }, children: jsx(Button, { size: "small", icon: jsx(CodeOutlined, {}), onClick: copyRawJson, children: "\u590D\u5236 JSON" }) }))] }))] }));
|
|
2289
810
|
}
|
|
2290
811
|
|
|
2291
812
|
const { Title } = Typography;
|
|
@@ -2475,7 +996,7 @@ const CrudPage = ({ schema, initialData = [], apiRequest: customApiRequest }) =>
|
|
|
2475
996
|
request, modalState.mode, schema.api, rowKey,
|
|
2476
997
|
fetchList, localFilter, filterParams, page, pageSize, messageApi,
|
|
2477
998
|
]);
|
|
2478
|
-
return (jsxs("div", { style: { padding: 24, background: '#f5f6fa', minHeight: '100vh' }, children: [contextHolder, jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }, children: [jsx(Title, { level: 4, style: { margin: 0 }, children: schema.title }), schema.api.create && (jsx(Button, { type: "primary", icon: jsx(
|
|
999
|
+
return (jsxs("div", { style: { padding: 24, background: '#f5f6fa', minHeight: '100vh' }, children: [contextHolder, jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 16 }, children: [jsx(Title, { level: 4, style: { margin: 0 }, children: schema.title }), schema.api.create && (jsx(Button, { type: "primary", icon: jsx(PlusOutlined, {}), onClick: () => setModalState({ open: true, mode: 'create', record: undefined }), children: schema.createButtonLabel || '新增' }))] }), jsx(DynamicFilter, { schema: schema, onSearch: handleSearch, onReset: () => handleSearch({}) }), jsx(DynamicTable, { schema: schema, data: data, loading: loading, pagination: {
|
|
2479
1000
|
current: page,
|
|
2480
1001
|
pageSize,
|
|
2481
1002
|
total,
|