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