seeder-resources-view 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.esm.js +412 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +411 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/style/resources.less +3 -0
package/dist/index.js
CHANGED
|
@@ -62,6 +62,396 @@ function _toPropertyKey(t) {
|
|
|
62
62
|
return "symbol" == typeof i ? i : i + "";
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
69
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
70
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
71
|
+
* Released under MIT license <https://lodash.com/license>
|
|
72
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
73
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
var lodash_debounce;
|
|
77
|
+
var hasRequiredLodash_debounce;
|
|
78
|
+
|
|
79
|
+
function requireLodash_debounce () {
|
|
80
|
+
if (hasRequiredLodash_debounce) return lodash_debounce;
|
|
81
|
+
hasRequiredLodash_debounce = 1;
|
|
82
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
83
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
84
|
+
|
|
85
|
+
/** Used as references for various `Number` constants. */
|
|
86
|
+
var NAN = 0 / 0;
|
|
87
|
+
|
|
88
|
+
/** `Object#toString` result references. */
|
|
89
|
+
var symbolTag = '[object Symbol]';
|
|
90
|
+
|
|
91
|
+
/** Used to match leading and trailing whitespace. */
|
|
92
|
+
var reTrim = /^\s+|\s+$/g;
|
|
93
|
+
|
|
94
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
95
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
96
|
+
|
|
97
|
+
/** Used to detect binary string values. */
|
|
98
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
99
|
+
|
|
100
|
+
/** Used to detect octal string values. */
|
|
101
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
102
|
+
|
|
103
|
+
/** Built-in method references without a dependency on `root`. */
|
|
104
|
+
var freeParseInt = parseInt;
|
|
105
|
+
|
|
106
|
+
/** Detect free variable `global` from Node.js. */
|
|
107
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
108
|
+
|
|
109
|
+
/** Detect free variable `self`. */
|
|
110
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
111
|
+
|
|
112
|
+
/** Used as a reference to the global object. */
|
|
113
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
114
|
+
|
|
115
|
+
/** Used for built-in method references. */
|
|
116
|
+
var objectProto = Object.prototype;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Used to resolve the
|
|
120
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
121
|
+
* of values.
|
|
122
|
+
*/
|
|
123
|
+
var objectToString = objectProto.toString;
|
|
124
|
+
|
|
125
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
126
|
+
var nativeMax = Math.max,
|
|
127
|
+
nativeMin = Math.min;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
131
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
132
|
+
*
|
|
133
|
+
* @static
|
|
134
|
+
* @memberOf _
|
|
135
|
+
* @since 2.4.0
|
|
136
|
+
* @category Date
|
|
137
|
+
* @returns {number} Returns the timestamp.
|
|
138
|
+
* @example
|
|
139
|
+
*
|
|
140
|
+
* _.defer(function(stamp) {
|
|
141
|
+
* console.log(_.now() - stamp);
|
|
142
|
+
* }, _.now());
|
|
143
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
144
|
+
*/
|
|
145
|
+
var now = function() {
|
|
146
|
+
return root.Date.now();
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
151
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
152
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
153
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
154
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
155
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
156
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
157
|
+
* calls to the debounced function return the result of the last `func`
|
|
158
|
+
* invocation.
|
|
159
|
+
*
|
|
160
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
161
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
162
|
+
* is invoked more than once during the `wait` timeout.
|
|
163
|
+
*
|
|
164
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
165
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
166
|
+
*
|
|
167
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
168
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
169
|
+
*
|
|
170
|
+
* @static
|
|
171
|
+
* @memberOf _
|
|
172
|
+
* @since 0.1.0
|
|
173
|
+
* @category Function
|
|
174
|
+
* @param {Function} func The function to debounce.
|
|
175
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
176
|
+
* @param {Object} [options={}] The options object.
|
|
177
|
+
* @param {boolean} [options.leading=false]
|
|
178
|
+
* Specify invoking on the leading edge of the timeout.
|
|
179
|
+
* @param {number} [options.maxWait]
|
|
180
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
181
|
+
* @param {boolean} [options.trailing=true]
|
|
182
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
183
|
+
* @returns {Function} Returns the new debounced function.
|
|
184
|
+
* @example
|
|
185
|
+
*
|
|
186
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
187
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
188
|
+
*
|
|
189
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
190
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
191
|
+
* 'leading': true,
|
|
192
|
+
* 'trailing': false
|
|
193
|
+
* }));
|
|
194
|
+
*
|
|
195
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
196
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
197
|
+
* var source = new EventSource('/stream');
|
|
198
|
+
* jQuery(source).on('message', debounced);
|
|
199
|
+
*
|
|
200
|
+
* // Cancel the trailing debounced invocation.
|
|
201
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
202
|
+
*/
|
|
203
|
+
function debounce(func, wait, options) {
|
|
204
|
+
var lastArgs,
|
|
205
|
+
lastThis,
|
|
206
|
+
maxWait,
|
|
207
|
+
result,
|
|
208
|
+
timerId,
|
|
209
|
+
lastCallTime,
|
|
210
|
+
lastInvokeTime = 0,
|
|
211
|
+
leading = false,
|
|
212
|
+
maxing = false,
|
|
213
|
+
trailing = true;
|
|
214
|
+
|
|
215
|
+
if (typeof func != 'function') {
|
|
216
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
217
|
+
}
|
|
218
|
+
wait = toNumber(wait) || 0;
|
|
219
|
+
if (isObject(options)) {
|
|
220
|
+
leading = !!options.leading;
|
|
221
|
+
maxing = 'maxWait' in options;
|
|
222
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
223
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function invokeFunc(time) {
|
|
227
|
+
var args = lastArgs,
|
|
228
|
+
thisArg = lastThis;
|
|
229
|
+
|
|
230
|
+
lastArgs = lastThis = undefined;
|
|
231
|
+
lastInvokeTime = time;
|
|
232
|
+
result = func.apply(thisArg, args);
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function leadingEdge(time) {
|
|
237
|
+
// Reset any `maxWait` timer.
|
|
238
|
+
lastInvokeTime = time;
|
|
239
|
+
// Start the timer for the trailing edge.
|
|
240
|
+
timerId = setTimeout(timerExpired, wait);
|
|
241
|
+
// Invoke the leading edge.
|
|
242
|
+
return leading ? invokeFunc(time) : result;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function remainingWait(time) {
|
|
246
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
247
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
248
|
+
result = wait - timeSinceLastCall;
|
|
249
|
+
|
|
250
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function shouldInvoke(time) {
|
|
254
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
255
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
256
|
+
|
|
257
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
258
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
259
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
260
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
261
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function timerExpired() {
|
|
265
|
+
var time = now();
|
|
266
|
+
if (shouldInvoke(time)) {
|
|
267
|
+
return trailingEdge(time);
|
|
268
|
+
}
|
|
269
|
+
// Restart the timer.
|
|
270
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function trailingEdge(time) {
|
|
274
|
+
timerId = undefined;
|
|
275
|
+
|
|
276
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
277
|
+
// debounced at least once.
|
|
278
|
+
if (trailing && lastArgs) {
|
|
279
|
+
return invokeFunc(time);
|
|
280
|
+
}
|
|
281
|
+
lastArgs = lastThis = undefined;
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function cancel() {
|
|
286
|
+
if (timerId !== undefined) {
|
|
287
|
+
clearTimeout(timerId);
|
|
288
|
+
}
|
|
289
|
+
lastInvokeTime = 0;
|
|
290
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function flush() {
|
|
294
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function debounced() {
|
|
298
|
+
var time = now(),
|
|
299
|
+
isInvoking = shouldInvoke(time);
|
|
300
|
+
|
|
301
|
+
lastArgs = arguments;
|
|
302
|
+
lastThis = this;
|
|
303
|
+
lastCallTime = time;
|
|
304
|
+
|
|
305
|
+
if (isInvoking) {
|
|
306
|
+
if (timerId === undefined) {
|
|
307
|
+
return leadingEdge(lastCallTime);
|
|
308
|
+
}
|
|
309
|
+
if (maxing) {
|
|
310
|
+
// Handle invocations in a tight loop.
|
|
311
|
+
timerId = setTimeout(timerExpired, wait);
|
|
312
|
+
return invokeFunc(lastCallTime);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (timerId === undefined) {
|
|
316
|
+
timerId = setTimeout(timerExpired, wait);
|
|
317
|
+
}
|
|
318
|
+
return result;
|
|
319
|
+
}
|
|
320
|
+
debounced.cancel = cancel;
|
|
321
|
+
debounced.flush = flush;
|
|
322
|
+
return debounced;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Checks if `value` is the
|
|
327
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
328
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
329
|
+
*
|
|
330
|
+
* @static
|
|
331
|
+
* @memberOf _
|
|
332
|
+
* @since 0.1.0
|
|
333
|
+
* @category Lang
|
|
334
|
+
* @param {*} value The value to check.
|
|
335
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
336
|
+
* @example
|
|
337
|
+
*
|
|
338
|
+
* _.isObject({});
|
|
339
|
+
* // => true
|
|
340
|
+
*
|
|
341
|
+
* _.isObject([1, 2, 3]);
|
|
342
|
+
* // => true
|
|
343
|
+
*
|
|
344
|
+
* _.isObject(_.noop);
|
|
345
|
+
* // => true
|
|
346
|
+
*
|
|
347
|
+
* _.isObject(null);
|
|
348
|
+
* // => false
|
|
349
|
+
*/
|
|
350
|
+
function isObject(value) {
|
|
351
|
+
var type = typeof value;
|
|
352
|
+
return !!value && (type == 'object' || type == 'function');
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
357
|
+
* and has a `typeof` result of "object".
|
|
358
|
+
*
|
|
359
|
+
* @static
|
|
360
|
+
* @memberOf _
|
|
361
|
+
* @since 4.0.0
|
|
362
|
+
* @category Lang
|
|
363
|
+
* @param {*} value The value to check.
|
|
364
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
365
|
+
* @example
|
|
366
|
+
*
|
|
367
|
+
* _.isObjectLike({});
|
|
368
|
+
* // => true
|
|
369
|
+
*
|
|
370
|
+
* _.isObjectLike([1, 2, 3]);
|
|
371
|
+
* // => true
|
|
372
|
+
*
|
|
373
|
+
* _.isObjectLike(_.noop);
|
|
374
|
+
* // => false
|
|
375
|
+
*
|
|
376
|
+
* _.isObjectLike(null);
|
|
377
|
+
* // => false
|
|
378
|
+
*/
|
|
379
|
+
function isObjectLike(value) {
|
|
380
|
+
return !!value && typeof value == 'object';
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
385
|
+
*
|
|
386
|
+
* @static
|
|
387
|
+
* @memberOf _
|
|
388
|
+
* @since 4.0.0
|
|
389
|
+
* @category Lang
|
|
390
|
+
* @param {*} value The value to check.
|
|
391
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
392
|
+
* @example
|
|
393
|
+
*
|
|
394
|
+
* _.isSymbol(Symbol.iterator);
|
|
395
|
+
* // => true
|
|
396
|
+
*
|
|
397
|
+
* _.isSymbol('abc');
|
|
398
|
+
* // => false
|
|
399
|
+
*/
|
|
400
|
+
function isSymbol(value) {
|
|
401
|
+
return typeof value == 'symbol' ||
|
|
402
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Converts `value` to a number.
|
|
407
|
+
*
|
|
408
|
+
* @static
|
|
409
|
+
* @memberOf _
|
|
410
|
+
* @since 4.0.0
|
|
411
|
+
* @category Lang
|
|
412
|
+
* @param {*} value The value to process.
|
|
413
|
+
* @returns {number} Returns the number.
|
|
414
|
+
* @example
|
|
415
|
+
*
|
|
416
|
+
* _.toNumber(3.2);
|
|
417
|
+
* // => 3.2
|
|
418
|
+
*
|
|
419
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
420
|
+
* // => 5e-324
|
|
421
|
+
*
|
|
422
|
+
* _.toNumber(Infinity);
|
|
423
|
+
* // => Infinity
|
|
424
|
+
*
|
|
425
|
+
* _.toNumber('3.2');
|
|
426
|
+
* // => 3.2
|
|
427
|
+
*/
|
|
428
|
+
function toNumber(value) {
|
|
429
|
+
if (typeof value == 'number') {
|
|
430
|
+
return value;
|
|
431
|
+
}
|
|
432
|
+
if (isSymbol(value)) {
|
|
433
|
+
return NAN;
|
|
434
|
+
}
|
|
435
|
+
if (isObject(value)) {
|
|
436
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
437
|
+
value = isObject(other) ? (other + '') : other;
|
|
438
|
+
}
|
|
439
|
+
if (typeof value != 'string') {
|
|
440
|
+
return value === 0 ? value : +value;
|
|
441
|
+
}
|
|
442
|
+
value = value.replace(reTrim, '');
|
|
443
|
+
var isBinary = reIsBinary.test(value);
|
|
444
|
+
return (isBinary || reIsOctal.test(value))
|
|
445
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
446
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
lodash_debounce = debounce;
|
|
450
|
+
return lodash_debounce;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
var lodash_debounceExports = requireLodash_debounce();
|
|
454
|
+
|
|
65
455
|
const BASE_MENU_ITEMS = [{
|
|
66
456
|
label: 'Download',
|
|
67
457
|
key: 'download',
|
|
@@ -214,7 +604,6 @@ const SelectFolderPathModal = _ref => {
|
|
|
214
604
|
const [form] = antd.Form.useForm();
|
|
215
605
|
const [options, setOptions] = react.useState([]);
|
|
216
606
|
const [internalLoading, setInternalLoading] = react.useState(false);
|
|
217
|
-
const [selectedPath, setSelectedPath] = react.useState([]);
|
|
218
607
|
const loading = externalLoading || internalLoading;
|
|
219
608
|
|
|
220
609
|
// 将 directoryTree 转换为 Cascader 需要的 options 格式
|
|
@@ -287,7 +676,6 @@ const SelectFolderPathModal = _ref => {
|
|
|
287
676
|
}, [form, options, getSelectedNodes, onOk, showFullPath]);
|
|
288
677
|
const handleAfterClose = react.useCallback(() => {
|
|
289
678
|
form.resetFields();
|
|
290
|
-
setSelectedPath([]);
|
|
291
679
|
}, [form]);
|
|
292
680
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
|
|
293
681
|
title: title,
|
|
@@ -298,13 +686,11 @@ const SelectFolderPathModal = _ref => {
|
|
|
298
686
|
destroyOnHidden: true,
|
|
299
687
|
footer: [/*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
300
688
|
onClick: onClose,
|
|
301
|
-
disabled: batchLoading,
|
|
302
689
|
children: cancelText
|
|
303
690
|
}, "cancel"), /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
304
691
|
type: "primary",
|
|
305
692
|
onClick: handleOk,
|
|
306
693
|
loading: batchLoading,
|
|
307
|
-
disabled: disabled || selectedPath.length === 0,
|
|
308
694
|
children: okText
|
|
309
695
|
}, "submit")],
|
|
310
696
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Spin, {
|
|
@@ -928,7 +1314,7 @@ const ResourcesView = _ref => {
|
|
|
928
1314
|
renderGridHeader,
|
|
929
1315
|
acceptFileTypes = "video/*,.mxf,application/mxf,video/mxf",
|
|
930
1316
|
uploadTimeout = 60 * 60 * 1000,
|
|
931
|
-
searchPlaceholder = "Search
|
|
1317
|
+
searchPlaceholder = "Search ..."
|
|
932
1318
|
} = _ref;
|
|
933
1319
|
const {
|
|
934
1320
|
message,
|
|
@@ -973,12 +1359,24 @@ const ResourcesView = _ref => {
|
|
|
973
1359
|
const [checkAll, setCheckAll] = react.useState(false);
|
|
974
1360
|
const [batchLoading, setBatchLoading] = react.useState(false);
|
|
975
1361
|
const [keyword, setKeyword] = react.useState('');
|
|
1362
|
+
const [debouncedKeyword, setDebouncedKeyword] = react.useState('');
|
|
1363
|
+
|
|
1364
|
+
// 创建防抖函数(延迟 300ms)
|
|
1365
|
+
const debouncedSearch = react.useMemo(() => lodash_debounceExports.debounce(searchValue => {
|
|
1366
|
+
setDebouncedKeyword(searchValue);
|
|
1367
|
+
}, 300), []);
|
|
1368
|
+
|
|
1369
|
+
// 监听 keyword 变化并触发防抖
|
|
1370
|
+
react.useEffect(() => {
|
|
1371
|
+
debouncedSearch(keyword);
|
|
1372
|
+
return () => debouncedSearch.cancel(); // 组件卸载时取消防抖
|
|
1373
|
+
}, [keyword, debouncedSearch]);
|
|
976
1374
|
|
|
977
1375
|
// 过滤内容
|
|
978
1376
|
const filteredContents = react.useMemo(() => {
|
|
979
|
-
if (!
|
|
980
|
-
return contents.filter(item => item.name.toLowerCase().includes(
|
|
981
|
-
}, [contents,
|
|
1377
|
+
if (!debouncedKeyword) return contents;
|
|
1378
|
+
return contents.filter(item => item.name.toLowerCase().includes(debouncedKeyword.toLowerCase()));
|
|
1379
|
+
}, [contents, debouncedKeyword]);
|
|
982
1380
|
|
|
983
1381
|
// 在组件卸载时取消上传
|
|
984
1382
|
react.useEffect(() => {
|
|
@@ -1175,7 +1573,7 @@ const ResourcesView = _ref => {
|
|
|
1175
1573
|
setCheckAll(checked);
|
|
1176
1574
|
};
|
|
1177
1575
|
|
|
1178
|
-
//
|
|
1576
|
+
// 搜索框变化处理
|
|
1179
1577
|
const handleSearchChange = e => {
|
|
1180
1578
|
setKeyword(e.target.value);
|
|
1181
1579
|
};
|
|
@@ -1205,11 +1603,12 @@ const ResourcesView = _ref => {
|
|
|
1205
1603
|
justify: "center",
|
|
1206
1604
|
align: "center",
|
|
1207
1605
|
className: "search-bar",
|
|
1208
|
-
children: [mergedFeatures.search && /*#__PURE__*/jsxRuntime.jsx(
|
|
1209
|
-
type: "text",
|
|
1210
|
-
placeholder: searchPlaceholder,
|
|
1606
|
+
children: [mergedFeatures.search && /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
|
|
1211
1607
|
value: keyword,
|
|
1212
1608
|
onChange: handleSearchChange,
|
|
1609
|
+
placeholder: searchPlaceholder,
|
|
1610
|
+
prefix: /*#__PURE__*/jsxRuntime.jsx(icons.SearchOutlined, {}),
|
|
1611
|
+
allowClear: true,
|
|
1213
1612
|
className: "search-input"
|
|
1214
1613
|
}), mergedFeatures.upload && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1215
1614
|
children: [/*#__PURE__*/jsxRuntime.jsx(icons.CloudUploadOutlined, {
|