wargerm 0.2.29 → 0.2.33

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