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