wargerm 0.2.30 → 0.2.31
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.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +67 -763
- package/dist/index.js +66 -762
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -50,9 +50,6 @@ var _Breadcrumb = require('antd/es/breadcrumb');
|
|
50
50
|
var ReactDOM = require('react-dom');
|
51
51
|
require('antd/es/modal/style');
|
52
52
|
var _Modal = require('antd/es/modal');
|
53
|
-
require('antd/es/config-provider/style');
|
54
|
-
require('antd/es/config-provider');
|
55
|
-
require('antd/es/locale/zh_CN');
|
56
53
|
var ProTable = require('@ant-design/pro-table');
|
57
54
|
|
58
55
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -10341,742 +10338,13 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10341
10338
|
|
10342
10339
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10343
10340
|
|
10344
|
-
function _defineProperty$1(obj, key, value) {
|
10345
|
-
if (key in obj) {
|
10346
|
-
Object.defineProperty(obj, key, {
|
10347
|
-
value: value,
|
10348
|
-
enumerable: true,
|
10349
|
-
configurable: true,
|
10350
|
-
writable: true
|
10351
|
-
});
|
10352
|
-
} else {
|
10353
|
-
obj[key] = value;
|
10354
|
-
}
|
10355
|
-
|
10356
|
-
return obj;
|
10357
|
-
}
|
10358
|
-
|
10359
|
-
function ownKeys$1(object, enumerableOnly) {
|
10360
|
-
var keys = Object.keys(object);
|
10361
|
-
|
10362
|
-
if (Object.getOwnPropertySymbols) {
|
10363
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
10364
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
10365
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
10366
|
-
})), keys.push.apply(keys, symbols);
|
10367
|
-
}
|
10368
|
-
|
10369
|
-
return keys;
|
10370
|
-
}
|
10371
|
-
|
10372
|
-
function _objectSpread2$1(target) {
|
10373
|
-
for (var i = 1; i < arguments.length; i++) {
|
10374
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
10375
|
-
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
10376
|
-
_defineProperty$1(target, key, source[key]);
|
10377
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
10378
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
10379
|
-
});
|
10380
|
-
}
|
10381
|
-
|
10382
|
-
return target;
|
10383
|
-
}
|
10384
|
-
|
10385
|
-
function _arrayLikeToArray$1(arr, len) {
|
10386
|
-
if (len == null || len > arr.length) len = arr.length;
|
10387
|
-
|
10388
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
10389
|
-
arr2[i] = arr[i];
|
10390
|
-
}
|
10391
|
-
|
10392
|
-
return arr2;
|
10393
|
-
}
|
10394
|
-
|
10395
|
-
function _unsupportedIterableToArray$1(o, minLen) {
|
10396
|
-
if (!o) return;
|
10397
|
-
if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
|
10398
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
10399
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
10400
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
10401
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
|
10402
|
-
}
|
10403
|
-
|
10404
|
-
function _createForOfIteratorHelper$1(o, allowArrayLike) {
|
10405
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
10406
|
-
|
10407
|
-
if (!it) {
|
10408
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") {
|
10409
|
-
if (it) o = it;
|
10410
|
-
var i = 0;
|
10411
|
-
|
10412
|
-
var F = function F() {};
|
10413
|
-
|
10414
|
-
return {
|
10415
|
-
s: F,
|
10416
|
-
n: function n() {
|
10417
|
-
if (i >= o.length) return {
|
10418
|
-
done: true
|
10419
|
-
};
|
10420
|
-
return {
|
10421
|
-
done: false,
|
10422
|
-
value: o[i++]
|
10423
|
-
};
|
10424
|
-
},
|
10425
|
-
e: function e(_e) {
|
10426
|
-
throw _e;
|
10427
|
-
},
|
10428
|
-
f: F
|
10429
|
-
};
|
10430
|
-
}
|
10431
|
-
|
10432
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
10433
|
-
}
|
10434
|
-
|
10435
|
-
var normalCompletion = true,
|
10436
|
-
didErr = false,
|
10437
|
-
err;
|
10438
|
-
return {
|
10439
|
-
s: function s() {
|
10440
|
-
it = it.call(o);
|
10441
|
-
},
|
10442
|
-
n: function n() {
|
10443
|
-
var step = it.next();
|
10444
|
-
normalCompletion = step.done;
|
10445
|
-
return step;
|
10446
|
-
},
|
10447
|
-
e: function e(_e2) {
|
10448
|
-
didErr = true;
|
10449
|
-
err = _e2;
|
10450
|
-
},
|
10451
|
-
f: function f() {
|
10452
|
-
try {
|
10453
|
-
if (!normalCompletion && it["return"] != null) it["return"]();
|
10454
|
-
} finally {
|
10455
|
-
if (didErr) throw err;
|
10456
|
-
}
|
10457
|
-
}
|
10458
|
-
};
|
10459
|
-
}
|
10460
|
-
|
10461
|
-
/*! *****************************************************************************
|
10462
|
-
Copyright (c) Microsoft Corporation.
|
10463
|
-
|
10464
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
10465
|
-
purpose with or without fee is hereby granted.
|
10466
|
-
|
10467
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
10468
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
10469
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
10470
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
10471
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
10472
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
10473
|
-
PERFORMANCE OF THIS SOFTWARE.
|
10474
|
-
***************************************************************************** */
|
10475
|
-
|
10476
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
10477
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
10478
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
10479
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
10480
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
10481
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
10482
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
10483
|
-
});
|
10484
|
-
}
|
10485
|
-
|
10486
|
-
function __generator(thisArg, body) {
|
10487
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
10488
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
10489
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
10490
|
-
function step(op) {
|
10491
|
-
if (f) throw new TypeError("Generator is already executing.");
|
10492
|
-
while (_) try {
|
10493
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
10494
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
10495
|
-
switch (op[0]) {
|
10496
|
-
case 0: case 1: t = op; break;
|
10497
|
-
case 4: _.label++; return { value: op[1], done: false };
|
10498
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
10499
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
10500
|
-
default:
|
10501
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
10502
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
10503
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
10504
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
10505
|
-
if (t[2]) _.ops.pop();
|
10506
|
-
_.trys.pop(); continue;
|
10507
|
-
}
|
10508
|
-
op = body.call(thisArg, _);
|
10509
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
10510
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
10511
|
-
}
|
10512
|
-
}
|
10513
|
-
|
10514
|
-
var noop = function () { };
|
10515
|
-
// Using noop() as the undefined value as undefined can possibly be replaced
|
10516
|
-
// by something else. Prettier ignore and extra parentheses are necessary here
|
10517
|
-
// to ensure that tsc doesn't remove the __NOINLINE__ comment.
|
10518
|
-
// prettier-ignore
|
10519
|
-
var UNDEFINED = ( /*#__NOINLINE__*/noop());
|
10520
|
-
var OBJECT = Object;
|
10521
|
-
var isUndefined$1 = function (v) { return v === UNDEFINED; };
|
10522
|
-
var isFunction$1 = function (v) { return typeof v == 'function'; };
|
10523
|
-
var mergeObjects = function (a, b) { return OBJECT.assign({}, a, b); };
|
10524
|
-
var STR_UNDEFINED = 'undefined';
|
10525
|
-
var hasWindow = function () { return typeof window != STR_UNDEFINED; };
|
10526
|
-
var hasDocument = function () { return typeof document != STR_UNDEFINED; };
|
10527
|
-
|
10528
|
-
// use WeakMap to store the object->key mapping
|
10529
|
-
// so the objects can be garbage collected.
|
10530
|
-
// WeakMap uses a hashtable under the hood, so the lookup
|
10531
|
-
// complexity is almost O(1).
|
10532
|
-
var table = new WeakMap();
|
10533
|
-
// counter of the key
|
10534
|
-
var counter = 0;
|
10535
|
-
// A stable hash implementation that supports:
|
10536
|
-
// - Fast and ensures unique hash properties
|
10537
|
-
// - Handles unserializable values
|
10538
|
-
// - Handles object key ordering
|
10539
|
-
// - Generates short results
|
10540
|
-
//
|
10541
|
-
// This is not a serialization function, and the result is not guaranteed to be
|
10542
|
-
// parsible.
|
10543
|
-
var stableHash = function (arg) {
|
10544
|
-
var type = typeof arg;
|
10545
|
-
var constructor = arg && arg.constructor;
|
10546
|
-
var isDate = constructor == Date;
|
10547
|
-
var result;
|
10548
|
-
var index;
|
10549
|
-
if (OBJECT(arg) === arg && !isDate && constructor != RegExp) {
|
10550
|
-
// Object/function, not null/date/regexp. Use WeakMap to store the id first.
|
10551
|
-
// If it's already hashed, directly return the result.
|
10552
|
-
result = table.get(arg);
|
10553
|
-
if (result)
|
10554
|
-
return result;
|
10555
|
-
// Store the hash first for circular reference detection before entering the
|
10556
|
-
// recursive `stableHash` calls.
|
10557
|
-
// For other objects like set and map, we use this id directly as the hash.
|
10558
|
-
result = ++counter + '~';
|
10559
|
-
table.set(arg, result);
|
10560
|
-
if (constructor == Array) {
|
10561
|
-
// Array.
|
10562
|
-
result = '@';
|
10563
|
-
for (index = 0; index < arg.length; index++) {
|
10564
|
-
result += stableHash(arg[index]) + ',';
|
10565
|
-
}
|
10566
|
-
table.set(arg, result);
|
10567
|
-
}
|
10568
|
-
if (constructor == OBJECT) {
|
10569
|
-
// Object, sort keys.
|
10570
|
-
result = '#';
|
10571
|
-
var keys = OBJECT.keys(arg).sort();
|
10572
|
-
while (!isUndefined$1((index = keys.pop()))) {
|
10573
|
-
if (!isUndefined$1(arg[index])) {
|
10574
|
-
result += index + ':' + stableHash(arg[index]) + ',';
|
10575
|
-
}
|
10576
|
-
}
|
10577
|
-
table.set(arg, result);
|
10578
|
-
}
|
10579
|
-
}
|
10580
|
-
else {
|
10581
|
-
result = isDate
|
10582
|
-
? arg.toJSON()
|
10583
|
-
: type == 'symbol'
|
10584
|
-
? arg.toString()
|
10585
|
-
: type == 'string'
|
10586
|
-
? JSON.stringify(arg)
|
10587
|
-
: '' + arg;
|
10588
|
-
}
|
10589
|
-
return result;
|
10590
|
-
};
|
10591
|
-
|
10592
|
-
/**
|
10593
|
-
* Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
|
10594
|
-
* it's not reliable to detect if the browser is currently online or offline
|
10595
|
-
* based on `navigator.onLine`.
|
10596
|
-
* As a work around, we always assume it's online on first load, and change
|
10597
|
-
* the status upon `online` or `offline` events.
|
10598
|
-
*/
|
10599
|
-
var online = true;
|
10600
|
-
var isOnline = function () { return online; };
|
10601
|
-
var hasWin = hasWindow();
|
10602
|
-
var hasDoc = hasDocument();
|
10603
|
-
// For node and React Native, `add/removeEventListener` doesn't exist on window.
|
10604
|
-
var onWindowEvent = hasWin && window.addEventListener
|
10605
|
-
? window.addEventListener.bind(window)
|
10606
|
-
: noop;
|
10607
|
-
var onDocumentEvent = hasDoc ? document.addEventListener.bind(document) : noop;
|
10608
|
-
var offWindowEvent = hasWin && window.removeEventListener
|
10609
|
-
? window.removeEventListener.bind(window)
|
10610
|
-
: noop;
|
10611
|
-
var offDocumentEvent = hasDoc
|
10612
|
-
? document.removeEventListener.bind(document)
|
10613
|
-
: noop;
|
10614
|
-
var isVisible = function () {
|
10615
|
-
var visibilityState = hasDoc && document.visibilityState;
|
10616
|
-
if (!isUndefined$1(visibilityState)) {
|
10617
|
-
return visibilityState !== 'hidden';
|
10618
|
-
}
|
10619
|
-
return true;
|
10620
|
-
};
|
10621
|
-
var initFocus = function (cb) {
|
10622
|
-
// focus revalidate
|
10623
|
-
onDocumentEvent('visibilitychange', cb);
|
10624
|
-
onWindowEvent('focus', cb);
|
10625
|
-
return function () {
|
10626
|
-
offDocumentEvent('visibilitychange', cb);
|
10627
|
-
offWindowEvent('focus', cb);
|
10628
|
-
};
|
10629
|
-
};
|
10630
|
-
var initReconnect = function (cb) {
|
10631
|
-
// revalidate on reconnected
|
10632
|
-
var onOnline = function () {
|
10633
|
-
online = true;
|
10634
|
-
cb();
|
10635
|
-
};
|
10636
|
-
// nothing to revalidate, just update the status
|
10637
|
-
var onOffline = function () {
|
10638
|
-
online = false;
|
10639
|
-
};
|
10640
|
-
onWindowEvent('online', onOnline);
|
10641
|
-
onWindowEvent('offline', onOffline);
|
10642
|
-
return function () {
|
10643
|
-
offWindowEvent('online', onOnline);
|
10644
|
-
offWindowEvent('offline', onOffline);
|
10645
|
-
};
|
10646
|
-
};
|
10647
|
-
var preset = {
|
10648
|
-
isOnline: isOnline,
|
10649
|
-
isVisible: isVisible
|
10650
|
-
};
|
10651
|
-
var defaultConfigOptions = {
|
10652
|
-
initFocus: initFocus,
|
10653
|
-
initReconnect: initReconnect
|
10654
|
-
};
|
10655
|
-
|
10656
|
-
var IS_SERVER = !hasWindow() || 'Deno' in window;
|
10657
|
-
// React currently throws a warning when using useLayoutEffect on the server.
|
10658
|
-
// To get around it, we can conditionally useEffect on the server (no-op) and
|
10659
|
-
// useLayoutEffect in the browser.
|
10660
|
-
var useIsomorphicLayoutEffect = IS_SERVER ? React.useEffect : React.useLayoutEffect;
|
10661
|
-
// This assignment is to extend the Navigator type to use effectiveType.
|
10662
|
-
var navigatorConnection = typeof navigator !== 'undefined' &&
|
10663
|
-
navigator.connection;
|
10664
|
-
// Adjust the config based on slow connection status (<= 70Kbps).
|
10665
|
-
var slowConnection = !IS_SERVER &&
|
10666
|
-
navigatorConnection &&
|
10667
|
-
(['slow-2g', '2g'].includes(navigatorConnection.effectiveType) ||
|
10668
|
-
navigatorConnection.saveData);
|
10669
|
-
|
10670
|
-
var serialize = function (key) {
|
10671
|
-
if (isFunction$1(key)) {
|
10672
|
-
try {
|
10673
|
-
key = key();
|
10674
|
-
}
|
10675
|
-
catch (err) {
|
10676
|
-
// dependencies not ready
|
10677
|
-
key = '';
|
10678
|
-
}
|
10679
|
-
}
|
10680
|
-
var args = [].concat(key);
|
10681
|
-
// If key is not falsy, or not an empty array, hash it.
|
10682
|
-
key =
|
10683
|
-
typeof key == 'string'
|
10684
|
-
? key
|
10685
|
-
: (Array.isArray(key)
|
10686
|
-
? key.length
|
10687
|
-
: key)
|
10688
|
-
? stableHash(key)
|
10689
|
-
: '';
|
10690
|
-
var errorKey = key ? '$err$' + key : '';
|
10691
|
-
var isValidatingKey = key ? '$req$' + key : '';
|
10692
|
-
return [key, args, errorKey, isValidatingKey];
|
10693
|
-
};
|
10694
|
-
|
10695
|
-
// Global state used to deduplicate requests and store listeners
|
10696
|
-
var SWRGlobalState = new WeakMap();
|
10697
|
-
|
10698
|
-
var FOCUS_EVENT = 0;
|
10699
|
-
var RECONNECT_EVENT = 1;
|
10700
|
-
var MUTATE_EVENT = 2;
|
10701
|
-
|
10702
|
-
var broadcastState = function (cache, key, data, error, isValidating, revalidate) {
|
10703
|
-
var _a = SWRGlobalState.get(cache), EVENT_REVALIDATORS = _a[0], STATE_UPDATERS = _a[1], CONCURRENT_PROMISES = _a[4], CONCURRENT_PROMISES_TS = _a[5];
|
10704
|
-
var revalidators = EVENT_REVALIDATORS[key];
|
10705
|
-
var updaters = STATE_UPDATERS[key] || [];
|
10706
|
-
// Always update states of all hooks.
|
10707
|
-
for (var i = 0; i < updaters.length; ++i) {
|
10708
|
-
updaters[i](data, error, isValidating);
|
10709
|
-
}
|
10710
|
-
// If we also need to revalidate, only do it for the first hook.
|
10711
|
-
if (revalidate) {
|
10712
|
-
// Invalidate the key by deleting the concurrent request markers so new
|
10713
|
-
// requests will not be deduped.
|
10714
|
-
delete CONCURRENT_PROMISES[key];
|
10715
|
-
delete CONCURRENT_PROMISES_TS[key];
|
10716
|
-
if (revalidators && revalidators[0]) {
|
10717
|
-
return revalidators[0](MUTATE_EVENT).then(function () {
|
10718
|
-
return cache.get(key);
|
10719
|
-
});
|
10720
|
-
}
|
10721
|
-
}
|
10722
|
-
return cache.get(key);
|
10723
|
-
};
|
10724
|
-
|
10725
|
-
// Global timestamp.
|
10726
|
-
var __timestamp = 0;
|
10727
|
-
var getTimestamp = function () { return ++__timestamp; };
|
10728
|
-
|
10729
|
-
var internalMutate = function () {
|
10730
|
-
var args = [];
|
10731
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
10732
|
-
args[_i] = arguments[_i];
|
10733
|
-
}
|
10734
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
10735
|
-
var cache, _key, revalidate, _data, _a, key, keyErr, _b, MUTATION_TS, MUTATION_END_TS, data, error, beforeMutationTs, res;
|
10736
|
-
return __generator(this, function (_c) {
|
10737
|
-
switch (_c.label) {
|
10738
|
-
case 0:
|
10739
|
-
cache = args[0], _key = args[1];
|
10740
|
-
revalidate = args[3] !== false;
|
10741
|
-
_data = args[2];
|
10742
|
-
_a = serialize(_key), key = _a[0], keyErr = _a[2];
|
10743
|
-
if (!key)
|
10744
|
-
return [2 /*return*/];
|
10745
|
-
_b = SWRGlobalState.get(cache), MUTATION_TS = _b[2], MUTATION_END_TS = _b[3];
|
10746
|
-
// If there is no new data provided, revalidate the key with current state.
|
10747
|
-
if (args.length < 3) {
|
10748
|
-
// Revalidate and broadcast state.
|
10749
|
-
return [2 /*return*/, broadcastState(cache, key, cache.get(key), cache.get(keyErr), UNDEFINED, revalidate)];
|
10750
|
-
}
|
10751
|
-
beforeMutationTs = (MUTATION_TS[key] = getTimestamp());
|
10752
|
-
MUTATION_END_TS[key] = 0;
|
10753
|
-
if (isFunction$1(_data)) {
|
10754
|
-
// `_data` is a function, call it passing current cache value.
|
10755
|
-
try {
|
10756
|
-
_data = _data(cache.get(key));
|
10757
|
-
}
|
10758
|
-
catch (err) {
|
10759
|
-
// If it throws an error synchronously, we shouldn't update the cache.
|
10760
|
-
error = err;
|
10761
|
-
}
|
10762
|
-
}
|
10763
|
-
if (!(_data && isFunction$1(_data.then))) return [3 /*break*/, 2];
|
10764
|
-
return [4 /*yield*/, _data.catch(function (err) {
|
10765
|
-
error = err;
|
10766
|
-
})
|
10767
|
-
// Check if other mutations have occurred since we've started this mutation.
|
10768
|
-
// If there's a race we don't update cache or broadcast the change,
|
10769
|
-
// just return the data.
|
10770
|
-
];
|
10771
|
-
case 1:
|
10772
|
-
// This means that the mutation is async, we need to check timestamps to
|
10773
|
-
// avoid race conditions.
|
10774
|
-
data = _c.sent();
|
10775
|
-
// Check if other mutations have occurred since we've started this mutation.
|
10776
|
-
// If there's a race we don't update cache or broadcast the change,
|
10777
|
-
// just return the data.
|
10778
|
-
if (beforeMutationTs !== MUTATION_TS[key]) {
|
10779
|
-
if (error)
|
10780
|
-
throw error;
|
10781
|
-
return [2 /*return*/, data];
|
10782
|
-
}
|
10783
|
-
return [3 /*break*/, 3];
|
10784
|
-
case 2:
|
10785
|
-
data = _data;
|
10786
|
-
_c.label = 3;
|
10787
|
-
case 3:
|
10788
|
-
// Only update cached data if there's no error. Data can be `undefined` here.
|
10789
|
-
if (!error) {
|
10790
|
-
cache.set(key, data);
|
10791
|
-
}
|
10792
|
-
// Always update or reset the error.
|
10793
|
-
cache.set(keyErr, error);
|
10794
|
-
// Reset the timestamp to mark the mutation has ended.
|
10795
|
-
MUTATION_END_TS[key] = getTimestamp();
|
10796
|
-
return [4 /*yield*/, broadcastState(cache, key, data, error, UNDEFINED, revalidate)
|
10797
|
-
// Throw error or return data
|
10798
|
-
];
|
10799
|
-
case 4:
|
10800
|
-
res = _c.sent();
|
10801
|
-
// Throw error or return data
|
10802
|
-
if (error)
|
10803
|
-
throw error;
|
10804
|
-
return [2 /*return*/, res];
|
10805
|
-
}
|
10806
|
-
});
|
10807
|
-
});
|
10808
|
-
};
|
10809
|
-
|
10810
|
-
var revalidateAllKeys = function (revalidators, type) {
|
10811
|
-
for (var key in revalidators) {
|
10812
|
-
if (revalidators[key][0])
|
10813
|
-
revalidators[key][0](type);
|
10814
|
-
}
|
10815
|
-
};
|
10816
|
-
var initCache = function (provider, options) {
|
10817
|
-
// The global state for a specific provider will be used to deduplicate
|
10818
|
-
// requests and store listeners. As well as a mutate function that bound to
|
10819
|
-
// the cache.
|
10820
|
-
// Provider's global state might be already initialized. Let's try to get the
|
10821
|
-
// global state associated with the provider first.
|
10822
|
-
if (!SWRGlobalState.has(provider)) {
|
10823
|
-
var opts = mergeObjects(defaultConfigOptions, options);
|
10824
|
-
// If there's no global state bound to the provider, create a new one with the
|
10825
|
-
// new mutate function.
|
10826
|
-
var EVENT_REVALIDATORS = {};
|
10827
|
-
var mutate = internalMutate.bind(UNDEFINED, provider);
|
10828
|
-
var unmount = noop;
|
10829
|
-
// Update the state if it's new, or the provider has been extended.
|
10830
|
-
SWRGlobalState.set(provider, [
|
10831
|
-
EVENT_REVALIDATORS,
|
10832
|
-
{},
|
10833
|
-
{},
|
10834
|
-
{},
|
10835
|
-
{},
|
10836
|
-
{},
|
10837
|
-
mutate
|
10838
|
-
]);
|
10839
|
-
// This is a new provider, we need to initialize it and setup DOM events
|
10840
|
-
// listeners for `focus` and `reconnect` actions.
|
10841
|
-
if (!IS_SERVER) {
|
10842
|
-
var releaseFocus_1 = opts.initFocus(revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, FOCUS_EVENT));
|
10843
|
-
var releaseReconnect_1 = opts.initReconnect(revalidateAllKeys.bind(UNDEFINED, EVENT_REVALIDATORS, RECONNECT_EVENT));
|
10844
|
-
unmount = function () {
|
10845
|
-
releaseFocus_1 && releaseFocus_1();
|
10846
|
-
releaseReconnect_1 && releaseReconnect_1();
|
10847
|
-
// When un-mounting, we need to remove the cache provider from the state
|
10848
|
-
// storage too because it's a side-effect. Otherwise when re-mounting we
|
10849
|
-
// will not re-register those event listeners.
|
10850
|
-
SWRGlobalState.delete(provider);
|
10851
|
-
};
|
10852
|
-
}
|
10853
|
-
// We might want to inject an extra layer on top of `provider` in the future,
|
10854
|
-
// such as key serialization, auto GC, etc.
|
10855
|
-
// For now, it's just a `Map` interface without any modifications.
|
10856
|
-
return [provider, mutate, unmount];
|
10857
|
-
}
|
10858
|
-
return [provider, SWRGlobalState.get(provider)[6]];
|
10859
|
-
};
|
10860
|
-
|
10861
|
-
// error retry
|
10862
|
-
var onErrorRetry = function (_, __, config, revalidate, opts) {
|
10863
|
-
if (!preset.isVisible()) {
|
10864
|
-
// If it's hidden, stop. It will auto revalidate when refocusing.
|
10865
|
-
return;
|
10866
|
-
}
|
10867
|
-
var maxRetryCount = config.errorRetryCount;
|
10868
|
-
var currentRetryCount = opts.retryCount;
|
10869
|
-
// Exponential backoff
|
10870
|
-
var timeout = ~~((Math.random() + 0.5) *
|
10871
|
-
(1 << (currentRetryCount < 8 ? currentRetryCount : 8))) * config.errorRetryInterval;
|
10872
|
-
if (!isUndefined$1(maxRetryCount) && currentRetryCount > maxRetryCount) {
|
10873
|
-
return;
|
10874
|
-
}
|
10875
|
-
setTimeout(revalidate, timeout, opts);
|
10876
|
-
};
|
10877
|
-
// Default cache provider
|
10878
|
-
var _a = initCache(new Map()), cache = _a[0], mutate = _a[1];
|
10879
|
-
// Default config
|
10880
|
-
var defaultConfig = mergeObjects({
|
10881
|
-
// events
|
10882
|
-
onLoadingSlow: noop,
|
10883
|
-
onSuccess: noop,
|
10884
|
-
onError: noop,
|
10885
|
-
onErrorRetry: onErrorRetry,
|
10886
|
-
onDiscarded: noop,
|
10887
|
-
// switches
|
10888
|
-
revalidateOnFocus: true,
|
10889
|
-
revalidateOnReconnect: true,
|
10890
|
-
revalidateIfStale: true,
|
10891
|
-
shouldRetryOnError: true,
|
10892
|
-
// timeouts
|
10893
|
-
errorRetryInterval: slowConnection ? 10000 : 5000,
|
10894
|
-
focusThrottleInterval: 5 * 1000,
|
10895
|
-
dedupingInterval: 2 * 1000,
|
10896
|
-
loadingTimeout: slowConnection ? 5000 : 3000,
|
10897
|
-
// providers
|
10898
|
-
compare: function (currentData, newData) {
|
10899
|
-
return stableHash(currentData) == stableHash(newData);
|
10900
|
-
},
|
10901
|
-
isPaused: function () { return false; },
|
10902
|
-
cache: cache,
|
10903
|
-
mutate: mutate,
|
10904
|
-
fallback: {}
|
10905
|
-
},
|
10906
|
-
// use web preset by default
|
10907
|
-
preset);
|
10908
|
-
|
10909
|
-
var mergeConfigs$1 = function (a, b) {
|
10910
|
-
// Need to create a new object to avoid mutating the original here.
|
10911
|
-
var v = mergeObjects(a, b);
|
10912
|
-
// If two configs are provided, merge their `use` and `fallback` options.
|
10913
|
-
if (b) {
|
10914
|
-
var u1 = a.use, f1 = a.fallback;
|
10915
|
-
var u2 = b.use, f2 = b.fallback;
|
10916
|
-
if (u1 && u2) {
|
10917
|
-
v.use = u1.concat(u2);
|
10918
|
-
}
|
10919
|
-
if (f1 && f2) {
|
10920
|
-
v.fallback = mergeObjects(f1, f2);
|
10921
|
-
}
|
10922
|
-
}
|
10923
|
-
return v;
|
10924
|
-
};
|
10925
|
-
|
10926
|
-
var SWRConfigContext = React.createContext({});
|
10927
|
-
var SWRConfig$1 = function (props) {
|
10928
|
-
var value = props.value;
|
10929
|
-
// Extend parent context values and middleware.
|
10930
|
-
var extendedConfig = mergeConfigs$1(React.useContext(SWRConfigContext), value);
|
10931
|
-
// Should not use the inherited provider.
|
10932
|
-
var provider = value && value.provider;
|
10933
|
-
// Use a lazy initialized state to create the cache on first access.
|
10934
|
-
var cacheContext = React.useState(function () {
|
10935
|
-
return provider
|
10936
|
-
? initCache(provider(extendedConfig.cache || cache), value)
|
10937
|
-
: UNDEFINED;
|
10938
|
-
})[0];
|
10939
|
-
// Override the cache if a new provider is given.
|
10940
|
-
if (cacheContext) {
|
10941
|
-
extendedConfig.cache = cacheContext[0];
|
10942
|
-
extendedConfig.mutate = cacheContext[1];
|
10943
|
-
}
|
10944
|
-
// Unsubscribe events.
|
10945
|
-
useIsomorphicLayoutEffect(function () { return (cacheContext ? cacheContext[2] : UNDEFINED); }, []);
|
10946
|
-
return React.createElement(SWRConfigContext.Provider, mergeObjects(props, {
|
10947
|
-
value: extendedConfig
|
10948
|
-
}));
|
10949
|
-
};
|
10950
|
-
var SWRConfig = OBJECT.defineProperty(SWRConfig$1, 'default', {
|
10951
|
-
value: defaultConfig
|
10952
|
-
});
|
10953
|
-
|
10954
|
-
var zhCN = {
|
10955
|
-
moneySymbol: '¥',
|
10956
|
-
form: {
|
10957
|
-
lightFilter: {
|
10958
|
-
more: '更多筛选',
|
10959
|
-
clear: '清除',
|
10960
|
-
confirm: '确认',
|
10961
|
-
itemUnit: '项'
|
10962
|
-
}
|
10963
|
-
},
|
10964
|
-
tableForm: {
|
10965
|
-
search: '查询',
|
10966
|
-
reset: '重置',
|
10967
|
-
submit: '提交',
|
10968
|
-
collapsed: '展开',
|
10969
|
-
expand: '收起',
|
10970
|
-
inputPlaceholder: '请输入',
|
10971
|
-
selectPlaceholder: '请选择'
|
10972
|
-
},
|
10973
|
-
alert: {
|
10974
|
-
clear: '取消选择',
|
10975
|
-
selected: '已选择',
|
10976
|
-
item: '项'
|
10977
|
-
},
|
10978
|
-
pagination: {
|
10979
|
-
total: {
|
10980
|
-
range: '第',
|
10981
|
-
total: '条/总共',
|
10982
|
-
item: '条'
|
10983
|
-
}
|
10984
|
-
},
|
10985
|
-
tableToolBar: {
|
10986
|
-
leftPin: '固定在列首',
|
10987
|
-
rightPin: '固定在列尾',
|
10988
|
-
noPin: '不固定',
|
10989
|
-
leftFixedTitle: '固定在左侧',
|
10990
|
-
rightFixedTitle: '固定在右侧',
|
10991
|
-
noFixedTitle: '不固定',
|
10992
|
-
reset: '重置',
|
10993
|
-
columnDisplay: '列展示',
|
10994
|
-
columnSetting: '列设置',
|
10995
|
-
fullScreen: '全屏',
|
10996
|
-
exitFullScreen: '退出全屏',
|
10997
|
-
reload: '刷新',
|
10998
|
-
density: '密度',
|
10999
|
-
densityDefault: '正常',
|
11000
|
-
densityLarger: '默认',
|
11001
|
-
densityMiddle: '中等',
|
11002
|
-
densitySmall: '紧凑'
|
11003
|
-
},
|
11004
|
-
editableTable: {
|
11005
|
-
action: {
|
11006
|
-
save: '保存',
|
11007
|
-
cancel: '取消',
|
11008
|
-
delete: '删除'
|
11009
|
-
}
|
11010
|
-
},
|
11011
|
-
switch: {
|
11012
|
-
open: '打开',
|
11013
|
-
close: '关闭'
|
11014
|
-
},
|
11015
|
-
loginForm: {
|
11016
|
-
submitText: '登录'
|
11017
|
-
}
|
11018
|
-
};
|
11019
|
-
|
11020
|
-
function get$3(source, path, defaultValue) {
|
11021
|
-
// a[3].b -> a.3.b
|
11022
|
-
var paths = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
11023
|
-
var result = source;
|
11024
|
-
var message = defaultValue; // eslint-disable-next-line no-restricted-syntax
|
11025
|
-
|
11026
|
-
var _iterator = _createForOfIteratorHelper$1(paths),
|
11027
|
-
_step;
|
11028
|
-
|
11029
|
-
try {
|
11030
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
11031
|
-
var p = _step.value;
|
11032
|
-
message = Object(result)[p];
|
11033
|
-
result = Object(result)[p];
|
11034
|
-
|
11035
|
-
if (message === undefined) {
|
11036
|
-
return defaultValue;
|
11037
|
-
}
|
11038
|
-
}
|
11039
|
-
} catch (err) {
|
11040
|
-
_iterator.e(err);
|
11041
|
-
} finally {
|
11042
|
-
_iterator.f();
|
11043
|
-
}
|
11044
|
-
|
11045
|
-
return message;
|
11046
|
-
}
|
11047
|
-
/**
|
11048
|
-
* 创建一个操作函数
|
11049
|
-
*
|
11050
|
-
* @param locale
|
11051
|
-
* @param localeMap
|
11052
|
-
*/
|
11053
|
-
|
11054
|
-
|
11055
|
-
var createIntl = function createIntl(locale, localeMap) {
|
11056
|
-
return {
|
11057
|
-
getMessage: function getMessage(id, defaultMessage) {
|
11058
|
-
return get$3(localeMap, id, defaultMessage) || defaultMessage;
|
11059
|
-
},
|
11060
|
-
locale: locale
|
11061
|
-
};
|
11062
|
-
};
|
11063
|
-
var zhCNIntl = createIntl('zh_CN', zhCN);
|
11064
|
-
var ConfigContext = /*#__PURE__*/React__default['default'].createContext({
|
11065
|
-
intl: _objectSpread2$1(_objectSpread2$1({}, zhCNIntl), {}, {
|
11066
|
-
locale: 'default'
|
11067
|
-
}),
|
11068
|
-
valueTypeMap: {}
|
11069
|
-
});
|
11070
|
-
var ConfigConsumer = ConfigContext.Consumer,
|
11071
|
-
ConfigProvider = ConfigContext.Provider;
|
11072
|
-
|
11073
10341
|
var _excluded$g = ["columns", "extraColumns", "request", "modalFormSearch", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig"],
|
11074
10342
|
_excluded2$3 = ["actionMethod"];
|
11075
10343
|
|
11076
10344
|
var TabelCard = function TabelCard(props, ref) {
|
11077
10345
|
var columns = props.columns,
|
11078
10346
|
extraColumns = props.extraColumns,
|
11079
|
-
|
10347
|
+
_request = props.request,
|
11080
10348
|
modalFormSearch = props.modalFormSearch,
|
11081
10349
|
tableAction = props.tableAction,
|
11082
10350
|
renderTableBar = props.renderTableBar,
|
@@ -11100,6 +10368,11 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11100
10368
|
modalFormConfig = _useState4[0],
|
11101
10369
|
setModalFormConfig = _useState4[1];
|
11102
10370
|
|
10371
|
+
var _useState5 = React.useState({}),
|
10372
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
10373
|
+
formSearch = _useState6[0],
|
10374
|
+
setFormSearch = _useState6[1];
|
10375
|
+
|
11103
10376
|
React.useImperativeHandle(ref, function () {
|
11104
10377
|
return {
|
11105
10378
|
actionRef: actionRef.current,
|
@@ -11223,7 +10496,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11223
10496
|
extraAction: function extraAction(item, record, index) {
|
11224
10497
|
var _item$actionRender;
|
11225
10498
|
|
11226
|
-
return (_item$actionRender = item.actionRender) === null || _item$actionRender === void 0 ? void 0 : _item$actionRender.call(item, record, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
10499
|
+
return (_item$actionRender = item.actionRender) === null || _item$actionRender === void 0 ? void 0 : _item$actionRender.call(item, record, actionRef, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
11227
10500
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
11228
10501
|
while (1) {
|
11229
10502
|
switch (_context4.prev = _context4.next) {
|
@@ -11414,7 +10687,22 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11414
10687
|
}
|
11415
10688
|
});
|
11416
10689
|
}, [actionRef]);
|
11417
|
-
|
10690
|
+
|
10691
|
+
var onSubmit = function onSubmit(values) {
|
10692
|
+
var _actionRef$current7;
|
10693
|
+
|
10694
|
+
setFormSearch(values);
|
10695
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload();
|
10696
|
+
};
|
10697
|
+
|
10698
|
+
var onReset = function onReset() {
|
10699
|
+
var _actionRef$current8;
|
10700
|
+
|
10701
|
+
setFormSearch({});
|
10702
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload();
|
10703
|
+
};
|
10704
|
+
|
10705
|
+
var formSearchColumn = columns || [];
|
11418
10706
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ModalForm$1, _objectSpread2(_objectSpread2({
|
11419
10707
|
ref: formRef,
|
11420
10708
|
title: modalFormConfig.type || '新增',
|
@@ -11469,31 +10757,52 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11469
10757
|
|
11470
10758
|
return true;
|
11471
10759
|
})
|
11472
|
-
})), /*#__PURE__*/React__default['default'].createElement(
|
11473
|
-
|
11474
|
-
|
11475
|
-
|
11476
|
-
|
11477
|
-
|
11478
|
-
|
11479
|
-
renderFormItem: function renderFormItem(text, props) {
|
11480
|
-
return /*#__PURE__*/React__default['default'].createElement(Index$5, _objectSpread2({
|
11481
|
-
request: props.request,
|
11482
|
-
showSearch: true,
|
11483
|
-
placeholder: "\u8BF7\u9009\u62E9",
|
11484
|
-
allowClear: true
|
11485
|
-
}, props === null || props === void 0 ? void 0 : props.fieldProps));
|
11486
|
-
}
|
11487
|
-
}
|
10760
|
+
})), /*#__PURE__*/React__default['default'].createElement(WForm$1, {
|
10761
|
+
ref: ref,
|
10762
|
+
search: {
|
10763
|
+
labelWidth: 'auto',
|
10764
|
+
searchText: '查询',
|
10765
|
+
optionRender: function optionRender(searchConfig, formProps, dom) {
|
10766
|
+
return [].concat(_toConsumableArray(dom.reverse()), [tableBarDom]);
|
11488
10767
|
}
|
11489
|
-
}
|
11490
|
-
|
10768
|
+
},
|
10769
|
+
onSubmit: onSubmit,
|
10770
|
+
onReset: onReset,
|
10771
|
+
columns: formSearchColumn
|
10772
|
+
}), /*#__PURE__*/React__default['default'].createElement(ProTable__default['default'], _objectSpread2(_objectSpread2({
|
11491
10773
|
actionRef: actionRef,
|
11492
10774
|
rowKey: "id",
|
11493
10775
|
bordered: true,
|
11494
10776
|
options: false,
|
11495
|
-
toolBarRender: false
|
11496
|
-
|
10777
|
+
toolBarRender: false
|
10778
|
+
}, _request ? {
|
10779
|
+
request: function () {
|
10780
|
+
var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(params) {
|
10781
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
10782
|
+
while (1) {
|
10783
|
+
switch (_context7.prev = _context7.next) {
|
10784
|
+
case 0:
|
10785
|
+
_context7.next = 2;
|
10786
|
+
return _request(_objectSpread2(_objectSpread2({}, params), formSearch));
|
10787
|
+
|
10788
|
+
case 2:
|
10789
|
+
return _context7.abrupt("return", _context7.sent);
|
10790
|
+
|
10791
|
+
case 3:
|
10792
|
+
case "end":
|
10793
|
+
return _context7.stop();
|
10794
|
+
}
|
10795
|
+
}
|
10796
|
+
}, _callee7);
|
10797
|
+
}));
|
10798
|
+
|
10799
|
+
function request(_x7) {
|
10800
|
+
return _request2.apply(this, arguments);
|
10801
|
+
}
|
10802
|
+
|
10803
|
+
return request;
|
10804
|
+
}()
|
10805
|
+
} : {}), {}, {
|
11497
10806
|
columns: tableAction && (tableAction === null || tableAction === void 0 ? void 0 : tableAction.length) > 0 ? [].concat(_toConsumableArray(columns || []), [_objectSpread2({
|
11498
10807
|
title: '操作',
|
11499
10808
|
dataIndex: 'option',
|
@@ -11519,16 +10828,11 @@ var TabelCard = function TabelCard(props, ref) {
|
|
11519
10828
|
|
11520
10829
|
return obj;
|
11521
10830
|
}),
|
11522
|
-
search:
|
11523
|
-
labelWidth: 'auto',
|
11524
|
-
optionRender: function optionRender(searchConfig, formProps, dom) {
|
11525
|
-
return [].concat(_toConsumableArray(dom.reverse()), [tableBarDom]);
|
11526
|
-
}
|
11527
|
-
},
|
10831
|
+
search: false,
|
11528
10832
|
pagination: {
|
11529
10833
|
pageSize: 20
|
11530
10834
|
}
|
11531
|
-
}, extraProps)))
|
10835
|
+
}, extraProps)));
|
11532
10836
|
};
|
11533
10837
|
|
11534
10838
|
var index$1 = /*#__PURE__*/React__default['default'].forwardRef(TabelCard);
|