@xfe-repo/web-components 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +50 -0
- package/dist/index.d.mts +31 -2
- package/dist/index.d.ts +31 -2
- package/dist/index.js +736 -3
- package/dist/index.mjs +711 -2
- package/package.json +20 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _array_without_holes(arr) {
|
|
11
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
12
|
+
}
|
|
2
13
|
function _assert_this_initialized(self) {
|
|
3
14
|
if (self === void 0) {
|
|
4
15
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -24,6 +35,19 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
24
35
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
25
36
|
return Constructor;
|
|
26
37
|
}
|
|
38
|
+
function _define_property(obj, key, value) {
|
|
39
|
+
if (key in obj) {
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
27
51
|
function _get_prototype_of(o) {
|
|
28
52
|
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
29
53
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -43,6 +67,105 @@ function _inherits(subClass, superClass) {
|
|
|
43
67
|
});
|
|
44
68
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
45
69
|
}
|
|
70
|
+
function _iterable_to_array(iter) {
|
|
71
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
72
|
+
}
|
|
73
|
+
function _iterable_to_array_limit(arr, i) {
|
|
74
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
75
|
+
if (_i == null) return;
|
|
76
|
+
var _arr = [];
|
|
77
|
+
var _n = true;
|
|
78
|
+
var _d = false;
|
|
79
|
+
var _s, _e;
|
|
80
|
+
try {
|
|
81
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
82
|
+
_arr.push(_s.value);
|
|
83
|
+
if (i && _arr.length === i) break;
|
|
84
|
+
}
|
|
85
|
+
} catch (err) {
|
|
86
|
+
_d = true;
|
|
87
|
+
_e = err;
|
|
88
|
+
} finally{
|
|
89
|
+
try {
|
|
90
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
91
|
+
} finally{
|
|
92
|
+
if (_d) throw _e;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return _arr;
|
|
96
|
+
}
|
|
97
|
+
function _non_iterable_rest() {
|
|
98
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
99
|
+
}
|
|
100
|
+
function _non_iterable_spread() {
|
|
101
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
102
|
+
}
|
|
103
|
+
function _object_spread(target) {
|
|
104
|
+
for(var i = 1; i < arguments.length; i++){
|
|
105
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
106
|
+
var ownKeys = Object.keys(source);
|
|
107
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
108
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
109
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
ownKeys.forEach(function(key) {
|
|
113
|
+
_define_property(target, key, source[key]);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
118
|
+
function ownKeys(object, enumerableOnly) {
|
|
119
|
+
var keys = Object.keys(object);
|
|
120
|
+
if (Object.getOwnPropertySymbols) {
|
|
121
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
122
|
+
if (enumerableOnly) {
|
|
123
|
+
symbols = symbols.filter(function(sym) {
|
|
124
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
keys.push.apply(keys, symbols);
|
|
128
|
+
}
|
|
129
|
+
return keys;
|
|
130
|
+
}
|
|
131
|
+
function _object_spread_props(target, source) {
|
|
132
|
+
source = source != null ? source : {};
|
|
133
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
134
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
135
|
+
} else {
|
|
136
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
137
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return target;
|
|
141
|
+
}
|
|
142
|
+
function _object_without_properties(source, excluded) {
|
|
143
|
+
if (source == null) return {};
|
|
144
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
145
|
+
var key, i;
|
|
146
|
+
if (Object.getOwnPropertySymbols) {
|
|
147
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
148
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
149
|
+
key = sourceSymbolKeys[i];
|
|
150
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
151
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
152
|
+
target[key] = source[key];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return target;
|
|
156
|
+
}
|
|
157
|
+
function _object_without_properties_loose(source, excluded) {
|
|
158
|
+
if (source == null) return {};
|
|
159
|
+
var target = {};
|
|
160
|
+
var sourceKeys = Object.keys(source);
|
|
161
|
+
var key, i;
|
|
162
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
163
|
+
key = sourceKeys[i];
|
|
164
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
165
|
+
target[key] = source[key];
|
|
166
|
+
}
|
|
167
|
+
return target;
|
|
168
|
+
}
|
|
46
169
|
function _possible_constructor_return(self, call) {
|
|
47
170
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
48
171
|
return call;
|
|
@@ -56,10 +179,24 @@ function _set_prototype_of(o, p) {
|
|
|
56
179
|
};
|
|
57
180
|
return _set_prototype_of(o, p);
|
|
58
181
|
}
|
|
182
|
+
function _sliced_to_array(arr, i) {
|
|
183
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
184
|
+
}
|
|
185
|
+
function _to_consumable_array(arr) {
|
|
186
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
187
|
+
}
|
|
59
188
|
function _type_of(obj) {
|
|
60
189
|
"@swc/helpers - typeof";
|
|
61
190
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
62
191
|
}
|
|
192
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
193
|
+
if (!o) return;
|
|
194
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
195
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
196
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
197
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
198
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
199
|
+
}
|
|
63
200
|
function _is_native_reflect_construct() {
|
|
64
201
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
65
202
|
if (Reflect.construct.sham) return false;
|
|
@@ -84,9 +221,11 @@ function _create_super(Derived) {
|
|
|
84
221
|
return _possible_constructor_return(this, result);
|
|
85
222
|
};
|
|
86
223
|
}
|
|
224
|
+
var __create = Object.create;
|
|
87
225
|
var __defProp = Object.defineProperty;
|
|
88
226
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
89
227
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
228
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
90
229
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
91
230
|
var __export = function(target, all) {
|
|
92
231
|
for(var name in all)__defProp(target, name, {
|
|
@@ -125,6 +264,16 @@ var __copyProps = function(to, from, except, desc) {
|
|
|
125
264
|
}
|
|
126
265
|
return to;
|
|
127
266
|
};
|
|
267
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
268
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
269
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
270
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
271
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
272
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
273
|
+
value: mod,
|
|
274
|
+
enumerable: true
|
|
275
|
+
}) : target, mod);
|
|
276
|
+
};
|
|
128
277
|
var __toCommonJS = function(mod) {
|
|
129
278
|
return __copyProps(__defProp({}, "__esModule", {
|
|
130
279
|
value: true
|
|
@@ -134,7 +283,16 @@ var __toCommonJS = function(mod) {
|
|
|
134
283
|
var src_exports = {};
|
|
135
284
|
__export(src_exports, {
|
|
136
285
|
Loading: function() {
|
|
137
|
-
return
|
|
286
|
+
return Loading;
|
|
287
|
+
},
|
|
288
|
+
MultiWindow: function() {
|
|
289
|
+
return MultiWindow;
|
|
290
|
+
},
|
|
291
|
+
MultiWindowContents: function() {
|
|
292
|
+
return MultiWindowContents;
|
|
293
|
+
},
|
|
294
|
+
useMultiWindowContentsRef: function() {
|
|
295
|
+
return useMultiWindowContentsRef;
|
|
138
296
|
}
|
|
139
297
|
});
|
|
140
298
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -173,8 +331,583 @@ var Loading = /*#__PURE__*/ function(_import_react_PureComponent) {
|
|
|
173
331
|
]);
|
|
174
332
|
return Loading;
|
|
175
333
|
}(import_react.PureComponent);
|
|
176
|
-
|
|
334
|
+
// src/MultiWindow/MultiWindow.tsx
|
|
335
|
+
var import_react5 = require("react");
|
|
336
|
+
var import_web_micro = require("@xfe-repo/web-micro");
|
|
337
|
+
var import_tools = require("@xfe-repo/web-utils/tools");
|
|
338
|
+
var import_classnames = __toESM(require("classnames"));
|
|
339
|
+
// src/MultiWindow/MultiWindow.module.less
|
|
340
|
+
var MultiWindow_module_default = {
|
|
341
|
+
multi_window: "MultiWindow_module_multi_window",
|
|
342
|
+
tabs: "MultiWindow_module_tabs",
|
|
343
|
+
search_tabs: "MultiWindow_module_search_tabs",
|
|
344
|
+
operate: "MultiWindow_module_operate",
|
|
345
|
+
search: "MultiWindow_module_search",
|
|
346
|
+
input: "MultiWindow_module_input",
|
|
347
|
+
collection: "MultiWindow_module_collection"
|
|
348
|
+
};
|
|
349
|
+
// src/MultiWindow/MultiWindow.tsx
|
|
350
|
+
var import_antd4 = require("antd");
|
|
351
|
+
var import_icons2 = require("@ant-design/icons");
|
|
352
|
+
// src/MultiWindow/MultiWindowTabs.tsx
|
|
353
|
+
var import_react2 = __toESM(require("react"));
|
|
354
|
+
var import_antd2 = require("antd");
|
|
355
|
+
var import_core = require("@dnd-kit/core");
|
|
356
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
357
|
+
var import_modifiers = require("@dnd-kit/modifiers");
|
|
358
|
+
var import_utilities = require("@dnd-kit/utilities");
|
|
359
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
360
|
+
var import_react3 = require("react");
|
|
361
|
+
var MultiWindowTabs = (0, import_react2.memo)(function(props) {
|
|
362
|
+
var pathKey = props.pathKey, pagePaths = props.pagePaths, className = props.className, onChange = props.onChange, onClose = props.onClose, onSort = props.onSort, onCollectionChange = props.onCollectionChange, sortAutoActive = props.sortAutoActive;
|
|
363
|
+
var sensor = (0, import_core.useSensor)(import_core.PointerSensor, {
|
|
364
|
+
activationConstraint: {
|
|
365
|
+
distance: 10
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
var pagePathsHelperData = (0, import_react2.useMemo)(function() {
|
|
369
|
+
var keys = [];
|
|
370
|
+
var map = /* @__PURE__ */ new Map();
|
|
371
|
+
pagePaths.forEach(function(item) {
|
|
372
|
+
keys.push(item.key);
|
|
373
|
+
map.set(item.key, item);
|
|
374
|
+
});
|
|
375
|
+
return {
|
|
376
|
+
keys: keys,
|
|
377
|
+
map: map
|
|
378
|
+
};
|
|
379
|
+
}, [
|
|
380
|
+
pagePaths
|
|
381
|
+
]);
|
|
382
|
+
var handleEdit = (0, import_react2.useCallback)(function(targetKey, action) {
|
|
383
|
+
if (action === "add") {} else if (action === "remove") {
|
|
384
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(String(targetKey));
|
|
385
|
+
}
|
|
386
|
+
}, [
|
|
387
|
+
onClose
|
|
388
|
+
]);
|
|
389
|
+
var handleTabChange = (0, import_react2.useCallback)(function(activeKey) {
|
|
390
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(activeKey);
|
|
391
|
+
}, [
|
|
392
|
+
onChange
|
|
393
|
+
]);
|
|
394
|
+
var onDragStart = (0, import_react2.useCallback)(function(event) {
|
|
395
|
+
var active = event.active;
|
|
396
|
+
sortAutoActive && (onChange === null || onChange === void 0 ? void 0 : onChange(String(active.id)));
|
|
397
|
+
}, [
|
|
398
|
+
onChange,
|
|
399
|
+
sortAutoActive
|
|
400
|
+
]);
|
|
401
|
+
var onDragEnd = (0, import_react2.useCallback)(function(event) {
|
|
402
|
+
var active = event.active, over = event.over;
|
|
403
|
+
if (active.id === (over === null || over === void 0 ? void 0 : over.id)) return;
|
|
404
|
+
var oldIndex = pagePaths.findIndex(function(i) {
|
|
405
|
+
return i.key === active.id;
|
|
406
|
+
});
|
|
407
|
+
var newIndex = pagePaths.findIndex(function(i) {
|
|
408
|
+
return i.key === (over === null || over === void 0 ? void 0 : over.id);
|
|
409
|
+
});
|
|
410
|
+
var newPagePaths = (0, import_sortable.arrayMove)(pagePaths, oldIndex, newIndex);
|
|
411
|
+
onSort === null || onSort === void 0 ? void 0 : onSort(newPagePaths);
|
|
412
|
+
}, [
|
|
413
|
+
pagePaths,
|
|
414
|
+
onSort
|
|
415
|
+
]);
|
|
416
|
+
var renderTabBar = (0, import_react2.useCallback)(function(tabBarProps, DefaultTabBar) {
|
|
417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core.DndContext, {
|
|
418
|
+
sensors: [
|
|
419
|
+
sensor
|
|
420
|
+
],
|
|
421
|
+
onDragStart: onDragStart,
|
|
422
|
+
onDragEnd: onDragEnd,
|
|
423
|
+
collisionDetection: import_core.closestCenter,
|
|
424
|
+
modifiers: [
|
|
425
|
+
import_modifiers.restrictToHorizontalAxis
|
|
426
|
+
],
|
|
427
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_sortable.SortableContext, {
|
|
428
|
+
items: pagePathsHelperData.keys,
|
|
429
|
+
strategy: import_sortable.horizontalListSortingStrategy,
|
|
430
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DefaultTabBar, _object_spread_props(_object_spread({}, tabBarProps), {
|
|
431
|
+
children: function(node) {
|
|
432
|
+
return /* @__PURE__ */ (0, import_react3.createElement)(TabItem, _object_spread_props(_object_spread({}, node.props), {
|
|
433
|
+
key: node.key,
|
|
434
|
+
data: pagePathsHelperData.map.get(String(node.key)),
|
|
435
|
+
onCollectionChange: onCollectionChange,
|
|
436
|
+
isActivated: pathKey === String(node.key)
|
|
437
|
+
}), node);
|
|
438
|
+
}
|
|
439
|
+
}))
|
|
440
|
+
})
|
|
441
|
+
});
|
|
442
|
+
}, [
|
|
443
|
+
pagePathsHelperData,
|
|
444
|
+
onDragStart,
|
|
445
|
+
onDragEnd,
|
|
446
|
+
onCollectionChange,
|
|
447
|
+
sensor
|
|
448
|
+
]);
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Tabs, {
|
|
450
|
+
className: className,
|
|
451
|
+
activeKey: pathKey,
|
|
452
|
+
onChange: handleTabChange,
|
|
453
|
+
onEdit: handleEdit,
|
|
454
|
+
tabPosition: "top",
|
|
455
|
+
type: "editable-card",
|
|
456
|
+
items: pagePaths,
|
|
457
|
+
renderTabBar: renderTabBar,
|
|
458
|
+
hideAdd: true
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
var TabItem = (0, import_react2.memo)(function(props) {
|
|
462
|
+
var data = props.data, children = props.children, style = props.style, isActivated = props.isActivated, onCollectionChange = props.onCollectionChange;
|
|
463
|
+
var _ref = (0, import_sortable.useSortable)({
|
|
464
|
+
id: props["data-node-key"]
|
|
465
|
+
}), attributes = _ref.attributes, listeners = _ref.listeners, setNodeRef = _ref.setNodeRef, transform = _ref.transform, transition = _ref.transition, isDragging = _ref.isDragging;
|
|
466
|
+
var handleCollectionChange = (0, import_react2.useCallback)(function(collectionKey) {
|
|
467
|
+
if (!data) return;
|
|
468
|
+
onCollectionChange === null || onCollectionChange === void 0 ? void 0 : onCollectionChange(data.key, collectionKey);
|
|
469
|
+
}, [
|
|
470
|
+
data
|
|
471
|
+
]);
|
|
472
|
+
var collectionSelect = (0, import_react2.useMemo)(function() {
|
|
473
|
+
var _data_searchCollection;
|
|
474
|
+
if (!(data === null || data === void 0 ? void 0 : (_data_searchCollection = data.searchCollection) === null || _data_searchCollection === void 0 ? void 0 : _data_searchCollection.length)) return null;
|
|
475
|
+
if (!isActivated) {
|
|
476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Badge, {
|
|
477
|
+
className: MultiWindow_module_default.collection,
|
|
478
|
+
count: data.searchCollection.length,
|
|
479
|
+
color: "var(--ant-color-primary)",
|
|
480
|
+
size: "small"
|
|
481
|
+
}, data.key);
|
|
482
|
+
}
|
|
483
|
+
var options = data.searchCollection.map(function(item) {
|
|
484
|
+
return {
|
|
485
|
+
label: item,
|
|
486
|
+
value: item
|
|
487
|
+
};
|
|
488
|
+
});
|
|
489
|
+
var currentKey = data.searchCollection[0];
|
|
490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_antd2.Select, {
|
|
491
|
+
className: MultiWindow_module_default.collection,
|
|
492
|
+
options: options,
|
|
493
|
+
value: currentKey,
|
|
494
|
+
onChange: handleCollectionChange,
|
|
495
|
+
size: "small",
|
|
496
|
+
showSearch: true,
|
|
497
|
+
placeholder: "请选择"
|
|
498
|
+
}, data.key);
|
|
499
|
+
}, [
|
|
500
|
+
data,
|
|
501
|
+
isActivated
|
|
502
|
+
]);
|
|
503
|
+
var childrenWithCollectionSelect = (0, import_react2.useMemo)(function() {
|
|
504
|
+
var innerChildren = children.props.children;
|
|
505
|
+
if (!Array.isArray(innerChildren)) return innerChildren;
|
|
506
|
+
var newChildren = _to_consumable_array(innerChildren);
|
|
507
|
+
newChildren.splice(newChildren.length - 1, 0, collectionSelect);
|
|
508
|
+
return newChildren;
|
|
509
|
+
}, [
|
|
510
|
+
children,
|
|
511
|
+
collectionSelect
|
|
512
|
+
]);
|
|
513
|
+
return import_react2.default.cloneElement(children, _object_spread({
|
|
514
|
+
ref: setNodeRef,
|
|
515
|
+
style: _object_spread_props(_object_spread({}, style), {
|
|
516
|
+
transform: import_utilities.CSS.Translate.toString(transform && _object_spread_props(_object_spread({}, transform), {
|
|
517
|
+
scaleX: 1
|
|
518
|
+
})),
|
|
519
|
+
transition: transition,
|
|
520
|
+
zIndex: isDragging ? 1 : "auto",
|
|
521
|
+
cursor: "pointer"
|
|
522
|
+
}),
|
|
523
|
+
children: childrenWithCollectionSelect
|
|
524
|
+
}, attributes, listeners));
|
|
525
|
+
});
|
|
526
|
+
// src/MultiWindow/MultiWindowSearch.tsx
|
|
527
|
+
var import_react4 = require("react");
|
|
528
|
+
var import_antd3 = require("antd");
|
|
529
|
+
var import_icons = require("@ant-design/icons");
|
|
530
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
531
|
+
var Search = import_antd3.Input.Search;
|
|
532
|
+
var MultiWindowSearch = (0, import_react4.memo)(function(props) {
|
|
533
|
+
var onSearch = props.onSearch;
|
|
534
|
+
var _ref = _sliced_to_array((0, import_react4.useState)(false), 2), showSearch = _ref[0], setShowSearch = _ref[1];
|
|
535
|
+
var _ref1 = _sliced_to_array((0, import_react4.useState)(""), 2), searchValue = _ref1[0], setSearchValue = _ref1[1];
|
|
536
|
+
var shouldShowSearch = (0, import_react4.useMemo)(function() {
|
|
537
|
+
return showSearch || searchValue;
|
|
538
|
+
}, [
|
|
539
|
+
showSearch,
|
|
540
|
+
searchValue
|
|
541
|
+
]);
|
|
542
|
+
var handleShowSearch = (0, import_react4.useCallback)(function() {
|
|
543
|
+
setShowSearch(true);
|
|
544
|
+
}, []);
|
|
545
|
+
var handleHideSearch = (0, import_react4.useCallback)(function() {
|
|
546
|
+
setShowSearch(false);
|
|
547
|
+
}, []);
|
|
548
|
+
var handleSearch = (0, import_react4.useCallback)(function(value) {
|
|
549
|
+
setSearchValue(value);
|
|
550
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch(value);
|
|
551
|
+
}, [
|
|
552
|
+
onSearch
|
|
553
|
+
]);
|
|
554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", {
|
|
555
|
+
className: MultiWindow_module_default.search,
|
|
556
|
+
onMouseLeave: handleHideSearch,
|
|
557
|
+
onMouseEnter: handleShowSearch,
|
|
558
|
+
children: [
|
|
559
|
+
shouldShowSearch && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Search, {
|
|
560
|
+
className: MultiWindow_module_default.input,
|
|
561
|
+
placeholder: "标签/单号",
|
|
562
|
+
onSearch: handleSearch,
|
|
563
|
+
allowClear: true,
|
|
564
|
+
autoFocus: true
|
|
565
|
+
}),
|
|
566
|
+
!shouldShowSearch && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Tooltip, {
|
|
567
|
+
title: "搜索标签/单号",
|
|
568
|
+
color: "var(--ant-color-primary)",
|
|
569
|
+
mouseEnterDelay: 0.5,
|
|
570
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_antd3.Button, {
|
|
571
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_icons.SearchOutlined, {}),
|
|
572
|
+
type: "text"
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
// src/MultiWindow/MultiWindow.tsx
|
|
579
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
580
|
+
var MultiWindow = (0, import_react5.memo)(function(props) {
|
|
581
|
+
var routerPath = props.routerPath, collectionBlackList = props.collectionBlackList, contentRef = props.contentRef, appName = props.appName, theme = props.theme, className = props.className;
|
|
582
|
+
var sessionStoragePagePaths = (0, import_react5.useMemo)(function() {
|
|
583
|
+
var pagePaths2 = sessionStorage.getItem("pagePaths");
|
|
584
|
+
return pagePaths2 ? JSON.parse(pagePaths2) : [];
|
|
585
|
+
}, []);
|
|
586
|
+
var _ref = _sliced_to_array((0, import_react5.useState)(sessionStoragePagePaths), 2), pagePaths = _ref[0], setPagePaths = _ref[1];
|
|
587
|
+
var _ref1 = _sliced_to_array((0, import_react5.useState)([]), 2), searchPagePaths = _ref1[0], setSearchPagePaths = _ref1[1];
|
|
588
|
+
var currentStateRef = (0, import_react5.useRef)({
|
|
589
|
+
pagePaths: pagePaths,
|
|
590
|
+
fullPath: "",
|
|
591
|
+
pathKey: "",
|
|
592
|
+
collectionKey: "",
|
|
593
|
+
searchValue: ""
|
|
594
|
+
});
|
|
595
|
+
var isFromInternalNavigate = (0, import_react5.useRef)(false);
|
|
596
|
+
var handleUpdateSearchPagePaths = (0, import_react5.useCallback)(function() {
|
|
597
|
+
var searchValue2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
598
|
+
currentStateRef.current.searchValue = searchValue2;
|
|
599
|
+
if (!searchValue2) return setSearchPagePaths([]);
|
|
600
|
+
var _currentStateRef_current = currentStateRef.current, pagePaths2 = _currentStateRef_current.pagePaths;
|
|
601
|
+
var pagePathsCollection = pagePaths2.map(function(item) {
|
|
602
|
+
var searchCollection = item.searchCollection, key = item.key, label = item.label, other = _object_without_properties(item, [
|
|
603
|
+
"searchCollection",
|
|
604
|
+
"key",
|
|
605
|
+
"label"
|
|
606
|
+
]);
|
|
607
|
+
if (!(searchCollection === null || searchCollection === void 0 ? void 0 : searchCollection.length)) return item;
|
|
608
|
+
return searchCollection.sort().map(function(collection) {
|
|
609
|
+
return _object_spread_props(_object_spread({}, other), {
|
|
610
|
+
key: "".concat(key, "?").concat(collection),
|
|
611
|
+
fullPath: "".concat(key, "?").concat(collection),
|
|
612
|
+
label: "".concat(label, " (").concat(collection, ")")
|
|
613
|
+
});
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
var pagePathsFlat = pagePathsCollection.flat();
|
|
617
|
+
var searchResult = pagePathsFlat.filter(function(item) {
|
|
618
|
+
return item.label.toLowerCase().includes(searchValue2.toLowerCase());
|
|
619
|
+
});
|
|
620
|
+
if (!searchResult.length) {
|
|
621
|
+
var notFoundPagePath = {
|
|
622
|
+
label: "未找到匹配的标签",
|
|
623
|
+
key: "notFound",
|
|
624
|
+
fullPath: "/",
|
|
625
|
+
disabled: true,
|
|
626
|
+
closable: false
|
|
627
|
+
};
|
|
628
|
+
searchResult.push(notFoundPagePath);
|
|
629
|
+
}
|
|
630
|
+
setSearchPagePaths(searchResult);
|
|
631
|
+
}, []);
|
|
632
|
+
var handleUpdatePagePaths = (0, import_react5.useCallback)(function(newPagePaths) {
|
|
633
|
+
if (newPagePaths.length > 10) newPagePaths = newPagePaths.slice(newPagePaths.length - 10);
|
|
634
|
+
sessionStorage.setItem("pagePaths", JSON.stringify(newPagePaths));
|
|
635
|
+
currentStateRef.current.pagePaths = newPagePaths;
|
|
636
|
+
setPagePaths(newPagePaths);
|
|
637
|
+
if (currentStateRef === null || currentStateRef === void 0 ? void 0 : currentStateRef.current.searchValue) {
|
|
638
|
+
handleUpdateSearchPagePaths(currentStateRef.current.searchValue);
|
|
639
|
+
}
|
|
640
|
+
}, []);
|
|
641
|
+
var handleRouterUpdate = (0, import_react5.useCallback)(function(fullPath) {
|
|
642
|
+
var currentIsFromInternalRouter = isFromInternalNavigate.current;
|
|
643
|
+
isFromInternalNavigate.current = false;
|
|
644
|
+
if (currentStateRef.current.fullPath === fullPath) return;
|
|
645
|
+
var _fullPath_split = _sliced_to_array(fullPath.split("?"), 2), newPathKey = _fullPath_split[0], tmp = _fullPath_split[1], newPathSearch = tmp === void 0 ? "" : tmp;
|
|
646
|
+
if (!newPathKey || newPathKey === "/") return;
|
|
647
|
+
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, prev = _currentStateRef_current.pagePaths;
|
|
648
|
+
var newPagePaths = _to_consumable_array(prev);
|
|
649
|
+
var newPagePath = {
|
|
650
|
+
label: "加载中",
|
|
651
|
+
key: newPathKey,
|
|
652
|
+
fullPath: fullPath
|
|
653
|
+
};
|
|
654
|
+
var pagePathIndex = prev.findIndex(function(item) {
|
|
655
|
+
return item.key === newPathKey;
|
|
656
|
+
});
|
|
657
|
+
if (pagePathIndex !== -1) {
|
|
658
|
+
var prevPagePath = prev[pagePathIndex];
|
|
659
|
+
Object.assign(newPagePath, prevPagePath || {});
|
|
660
|
+
newPagePath.fullPath = fullPath;
|
|
661
|
+
newPagePaths.splice(pagePathIndex, 1);
|
|
662
|
+
}
|
|
663
|
+
var targetPagePathIndex = pagePathIndex === -1 ? newPagePaths.length : pagePathIndex;
|
|
664
|
+
if (!currentIsFromInternalRouter && pathKey2 !== newPathKey) {
|
|
665
|
+
var currentPathIndex = newPagePaths.findIndex(function(item) {
|
|
666
|
+
return item.key === pathKey2;
|
|
667
|
+
});
|
|
668
|
+
if (currentPathIndex !== -1) targetPagePathIndex = currentPathIndex + 1;
|
|
669
|
+
}
|
|
670
|
+
newPagePaths.splice(targetPagePathIndex, 0, newPagePath);
|
|
671
|
+
currentStateRef.current.pathKey = newPathKey;
|
|
672
|
+
currentStateRef.current.fullPath = fullPath;
|
|
673
|
+
currentStateRef.current.collectionKey = "";
|
|
674
|
+
var enableCollection = checkCanEnableCollection(newPathKey, collectionBlackList);
|
|
675
|
+
if (!enableCollection) {
|
|
676
|
+
newPagePath.searchCollection = [];
|
|
677
|
+
return handleUpdatePagePaths(newPagePaths);
|
|
678
|
+
}
|
|
679
|
+
var collection = newPagePath.searchCollection || [];
|
|
680
|
+
var queryJson = import_tools.queryString.parse(newPathSearch);
|
|
681
|
+
if (queryJson.ts) delete queryJson.ts;
|
|
682
|
+
var collectionKey2 = createSearchCollectionKey(newPathSearch);
|
|
683
|
+
if (!collectionKey2) return handleUpdatePagePaths(newPagePaths);
|
|
684
|
+
var queryIndex = collection.findIndex(function(item) {
|
|
685
|
+
return item === collectionKey2;
|
|
686
|
+
});
|
|
687
|
+
if (queryIndex !== -1) collection.splice(queryIndex, 1);
|
|
688
|
+
collection.unshift(collectionKey2);
|
|
689
|
+
if (collection.length > 10) collection.pop();
|
|
690
|
+
newPagePath.searchCollection = collection;
|
|
691
|
+
currentStateRef.current.collectionKey = "".concat(newPathKey, "?").concat(collectionKey2);
|
|
692
|
+
handleUpdatePagePaths(newPagePaths);
|
|
693
|
+
}, []);
|
|
694
|
+
(0, import_react5.useEffect)(function() {
|
|
695
|
+
handleRouterUpdate(routerPath);
|
|
696
|
+
}, [
|
|
697
|
+
routerPath
|
|
698
|
+
]);
|
|
699
|
+
(0, import_react5.useEffect)(function() {
|
|
700
|
+
var cancelCallback = import_web_micro.microApp.router.beforeEach(function(to) {
|
|
701
|
+
var fullPath = to.fullPath;
|
|
702
|
+
handleRouterUpdate(fullPath);
|
|
703
|
+
});
|
|
704
|
+
return function() {
|
|
705
|
+
cancelCallback();
|
|
706
|
+
};
|
|
707
|
+
}, []);
|
|
708
|
+
(0, import_react5.useEffect)(function() {
|
|
709
|
+
var titleEl = document.querySelector("title");
|
|
710
|
+
if (!titleEl) return;
|
|
711
|
+
var titleObserver = new MutationObserver(function(mutations) {
|
|
712
|
+
mutations.forEach(function(mutation) {
|
|
713
|
+
if (mutation.target !== titleEl) return;
|
|
714
|
+
var newTitle = mutation.target.textContent || void 0;
|
|
715
|
+
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey, pagePaths2 = _currentStateRef_current.pagePaths;
|
|
716
|
+
var targetPagePath = pagePaths2.find(function(item) {
|
|
717
|
+
return item.key === pathKey2;
|
|
718
|
+
});
|
|
719
|
+
var pageTitle = newTitle === null || newTitle === void 0 ? void 0 : newTitle.replace(" - ".concat(appName), "");
|
|
720
|
+
if (!targetPagePath || !pageTitle || pageTitle === appName) return;
|
|
721
|
+
targetPagePath.label = pageTitle;
|
|
722
|
+
handleUpdatePagePaths(_to_consumable_array(pagePaths2));
|
|
723
|
+
});
|
|
724
|
+
});
|
|
725
|
+
titleObserver.observe(titleEl, {
|
|
726
|
+
childList: true
|
|
727
|
+
});
|
|
728
|
+
return function() {
|
|
729
|
+
titleObserver.disconnect();
|
|
730
|
+
};
|
|
731
|
+
}, []);
|
|
732
|
+
var handleNavigateTo = (0, import_react5.useCallback)(function(fullPath) {
|
|
733
|
+
isFromInternalNavigate.current = true;
|
|
734
|
+
(0, import_web_micro.navigateToWithMicroApp)(fullPath, {
|
|
735
|
+
replace: true,
|
|
736
|
+
state: {
|
|
737
|
+
ts: Date.now()
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}, []);
|
|
741
|
+
var handleTabChange = (0, import_react5.useCallback)(function(pathKey2) {
|
|
742
|
+
var _pagePaths_find;
|
|
743
|
+
var fullPath = ((_pagePaths_find = pagePaths.find(function(item) {
|
|
744
|
+
return item.key === pathKey2;
|
|
745
|
+
})) === null || _pagePaths_find === void 0 ? void 0 : _pagePaths_find.fullPath) || pathKey2 || "/";
|
|
746
|
+
handleNavigateTo(fullPath);
|
|
747
|
+
}, [
|
|
748
|
+
pagePaths
|
|
749
|
+
]);
|
|
750
|
+
var handleCollectionChange = (0, import_react5.useCallback)(function(pathKey2, collectionKey2) {
|
|
751
|
+
var fullPath = "".concat(pathKey2, "?").concat(collectionKey2);
|
|
752
|
+
handleNavigateTo(fullPath);
|
|
753
|
+
}, []);
|
|
754
|
+
var handleRefreshCurrent = (0, import_react5.useCallback)(function() {
|
|
755
|
+
var _pagePaths_find;
|
|
756
|
+
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey;
|
|
757
|
+
var fullPath = ((_pagePaths_find = pagePaths.find(function(item) {
|
|
758
|
+
return item.key === pathKey2;
|
|
759
|
+
})) === null || _pagePaths_find === void 0 ? void 0 : _pagePaths_find.fullPath) || "/";
|
|
760
|
+
var timestamp = Date.now();
|
|
761
|
+
var pathHasSearch = fullPath.includes("?");
|
|
762
|
+
var pathHasTimestamp = fullPath.includes("ts=");
|
|
763
|
+
var fullPathWithTimestamp;
|
|
764
|
+
if (pathHasSearch) {
|
|
765
|
+
fullPathWithTimestamp = pathHasTimestamp ? fullPath.replace(/ts=\d+/, "ts=".concat(timestamp)) : "".concat(fullPath, "&ts=").concat(timestamp);
|
|
766
|
+
} else {
|
|
767
|
+
fullPathWithTimestamp = "".concat(fullPath, "?ts=").concat(timestamp);
|
|
768
|
+
}
|
|
769
|
+
handleNavigateTo(fullPathWithTimestamp);
|
|
770
|
+
}, [
|
|
771
|
+
pagePaths
|
|
772
|
+
]);
|
|
773
|
+
var handleClose = (0, import_react5.useCallback)(function(targetKey) {
|
|
774
|
+
var _contentRef_current, _newPagePaths_, _newPagePaths_index;
|
|
775
|
+
var index = pagePaths.findIndex(function(item) {
|
|
776
|
+
return item.key === targetKey;
|
|
777
|
+
});
|
|
778
|
+
if (index === -1) return;
|
|
779
|
+
var newPagePaths = _to_consumable_array(pagePaths);
|
|
780
|
+
newPagePaths.splice(index, 1);
|
|
781
|
+
handleUpdatePagePaths(newPagePaths);
|
|
782
|
+
contentRef === null || contentRef === void 0 ? void 0 : (_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.destroy(targetKey);
|
|
783
|
+
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey;
|
|
784
|
+
if (targetKey !== pathKey2) return;
|
|
785
|
+
var nextPathKey = ((_newPagePaths_ = newPagePaths[index - 1]) === null || _newPagePaths_ === void 0 ? void 0 : _newPagePaths_.key) || ((_newPagePaths_index = newPagePaths[index]) === null || _newPagePaths_index === void 0 ? void 0 : _newPagePaths_index.key) || "/";
|
|
786
|
+
handleTabChange(nextPathKey);
|
|
787
|
+
}, [
|
|
788
|
+
pagePaths
|
|
789
|
+
]);
|
|
790
|
+
var handleRemoveOther = (0, import_react5.useCallback)(function() {
|
|
791
|
+
var _contentRef_current;
|
|
792
|
+
var _currentStateRef_current = currentStateRef.current, pathKey2 = _currentStateRef_current.pathKey;
|
|
793
|
+
var newPagePaths = pagePaths.filter(function(item) {
|
|
794
|
+
return item.key === pathKey2;
|
|
795
|
+
});
|
|
796
|
+
handleUpdatePagePaths(newPagePaths);
|
|
797
|
+
contentRef === null || contentRef === void 0 ? void 0 : (_contentRef_current = contentRef.current) === null || _contentRef_current === void 0 ? void 0 : _contentRef_current.destroyOther(pathKey2);
|
|
798
|
+
}, [
|
|
799
|
+
pagePaths
|
|
800
|
+
]);
|
|
801
|
+
var handleSortPagePaths = (0, import_react5.useCallback)(function(newPagePaths) {
|
|
802
|
+
handleUpdatePagePaths(newPagePaths);
|
|
803
|
+
}, [
|
|
804
|
+
pagePaths
|
|
805
|
+
]);
|
|
806
|
+
var _currentStateRef_current = currentStateRef.current, pathKey = _currentStateRef_current.pathKey, collectionKey = _currentStateRef_current.collectionKey, searchValue = _currentStateRef_current.searchValue;
|
|
807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.ConfigProvider, {
|
|
808
|
+
theme: theme,
|
|
809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", {
|
|
810
|
+
className: (0, import_classnames.default)(MultiWindow_module_default.multi_window, className),
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MultiWindowTabs, {
|
|
813
|
+
className: (0, import_classnames.default)(MultiWindow_module_default.tabs, !!searchValue && MultiWindow_module_default.search_tabs),
|
|
814
|
+
pathKey: searchValue && collectionKey ? collectionKey : pathKey,
|
|
815
|
+
pagePaths: searchValue ? searchPagePaths : pagePaths,
|
|
816
|
+
onChange: handleTabChange,
|
|
817
|
+
onCollectionChange: handleCollectionChange,
|
|
818
|
+
onClose: handleClose,
|
|
819
|
+
onSort: handleSortPagePaths
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", {
|
|
822
|
+
className: MultiWindow_module_default.operate,
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MultiWindowSearch, {
|
|
825
|
+
onSearch: handleUpdateSearchPagePaths
|
|
826
|
+
}),
|
|
827
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Tooltip, {
|
|
828
|
+
title: "刷新当前页面",
|
|
829
|
+
color: "var(--ant-color-primary)",
|
|
830
|
+
mouseEnterDelay: 0.5,
|
|
831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Button, {
|
|
832
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.RedoOutlined, {}),
|
|
833
|
+
type: "text",
|
|
834
|
+
onClick: handleRefreshCurrent
|
|
835
|
+
})
|
|
836
|
+
}),
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Tooltip, {
|
|
838
|
+
title: "关闭其他页面",
|
|
839
|
+
color: "var(--ant-color-primary)",
|
|
840
|
+
mouseEnterDelay: 0.5,
|
|
841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Popconfirm, {
|
|
842
|
+
title: "关闭其他页面",
|
|
843
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.QuestionCircleOutlined, {
|
|
844
|
+
style: {
|
|
845
|
+
color: "red"
|
|
846
|
+
}
|
|
847
|
+
}),
|
|
848
|
+
okText: "确定",
|
|
849
|
+
cancelText: "取消",
|
|
850
|
+
onConfirm: handleRemoveOther,
|
|
851
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Button, {
|
|
852
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_icons2.CloseOutlined, {}),
|
|
853
|
+
type: "text"
|
|
854
|
+
})
|
|
855
|
+
})
|
|
856
|
+
})
|
|
857
|
+
]
|
|
858
|
+
})
|
|
859
|
+
]
|
|
860
|
+
})
|
|
861
|
+
});
|
|
862
|
+
});
|
|
863
|
+
var createSearchCollectionKey = function(search) {
|
|
864
|
+
var queryJson = import_tools.queryString.parse(search);
|
|
865
|
+
if (queryJson.ts) delete queryJson.ts;
|
|
866
|
+
return import_tools.queryString.stringify(queryJson, {
|
|
867
|
+
sort: function(itemLeft, itemRight) {
|
|
868
|
+
return itemLeft.localeCompare(itemRight);
|
|
869
|
+
}
|
|
870
|
+
});
|
|
871
|
+
};
|
|
872
|
+
var checkCanEnableCollection = function(path) {
|
|
873
|
+
var blackList = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
874
|
+
var _path_split_pop;
|
|
875
|
+
var isDetailPage = !!((_path_split_pop = path.split("/").pop()) === null || _path_split_pop === void 0 ? void 0 : _path_split_pop.toLowerCase().includes("detail"));
|
|
876
|
+
return isDetailPage && !blackList.some(function(item) {
|
|
877
|
+
return path.includes(item);
|
|
878
|
+
});
|
|
879
|
+
};
|
|
880
|
+
// src/MultiWindow/MultiWindowContents.tsx
|
|
881
|
+
var import_react6 = require("react");
|
|
882
|
+
var import_keepalive_for_react = __toESM(require("keepalive-for-react"));
|
|
883
|
+
var import_antd5 = require("antd");
|
|
884
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
885
|
+
var useMultiWindowContentsRef = import_keepalive_for_react.useKeepAliveRef;
|
|
886
|
+
var MultiWindowContents = (0, import_react6.memo)(function(props) {
|
|
887
|
+
var children = props.children, routerPath = props.routerPath, contentRef = props.contentRef;
|
|
888
|
+
var _ref = _sliced_to_array((0, import_react6.useMemo)(function() {
|
|
889
|
+
return routerPath.split("?");
|
|
890
|
+
}, [
|
|
891
|
+
routerPath
|
|
892
|
+
]), 1), tmp = _ref[0], pathKey = tmp === void 0 ? "" : tmp;
|
|
893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_keepalive_for_react.default, {
|
|
894
|
+
transition: true,
|
|
895
|
+
aliveRef: contentRef,
|
|
896
|
+
activeCacheKey: pathKey,
|
|
897
|
+
max: 10,
|
|
898
|
+
maxAliveTime: 60 * 60,
|
|
899
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react6.Suspense, {
|
|
900
|
+
fallback: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_antd5.Spin, {
|
|
901
|
+
spinning: true
|
|
902
|
+
}),
|
|
903
|
+
children: children
|
|
904
|
+
})
|
|
905
|
+
});
|
|
906
|
+
});
|
|
177
907
|
// Annotate the CommonJS export names for ESM import in node:
|
|
178
908
|
0 && (module.exports = {
|
|
179
|
-
Loading: Loading
|
|
909
|
+
Loading: Loading,
|
|
910
|
+
MultiWindow: MultiWindow,
|
|
911
|
+
MultiWindowContents: MultiWindowContents,
|
|
912
|
+
useMultiWindowContentsRef: useMultiWindowContentsRef
|
|
180
913
|
});
|