@pdg/react-table 1.1.11 → 1.1.14
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.md +2 -6
- package/dist/index.esm.js +149 -724
- package/dist/index.js +146 -721
- package/package.json +53 -46
package/dist/index.js
CHANGED
|
@@ -6,9 +6,7 @@
|
|
|
6
6
|
style.innerHTML = css;
|
|
7
7
|
document.head.appendChild(style);
|
|
8
8
|
return css;
|
|
9
|
-
}insertStyle(".simplebar-track.simplebar-vertical{width:8px !important}.simplebar-track.simplebar-vertical .simplebar-scrollbar.simplebar-visible:before{opacity:.3 !important}.PTable .PTableHead .PTableHeadRow th{position:relative;transform:translateY(-100%)}.PTable.sticky-header .PTableHead .PTableHeadRow th{position:sticky;transform:none}");
|
|
10
|
-
|
|
11
|
-
function getDefaultExportFromCjs (x) {
|
|
9
|
+
}insertStyle(".simplebar-track.simplebar-vertical{width:8px !important}.simplebar-track.simplebar-vertical .simplebar-scrollbar.simplebar-visible:before{opacity:.3 !important}.PTable .PTableHead .PTableHeadRow th{position:relative;transform:translateY(-100%)}.PTable.sticky-header .PTableHead .PTableHeadRow th{position:sticky;transform:none}");function getDefaultExportFromCjs (x) {
|
|
12
10
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
13
11
|
}var classnames = {exports: {}};/*!
|
|
14
12
|
Copyright (c) 2018 Jed Watson.
|
|
@@ -157,7 +155,7 @@ var hasRequiredDayjs_min;
|
|
|
157
155
|
function requireDayjs_min () {
|
|
158
156
|
if (hasRequiredDayjs_min) return dayjs_min$1.exports;
|
|
159
157
|
hasRequiredDayjs_min = 1;
|
|
160
|
-
(function (module, exports) {
|
|
158
|
+
(function (module, exports$1) {
|
|
161
159
|
!function(t,e){module.exports=e();}(dayjs_min,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,true),this.parse(t),this.$x=this.$x||t.x||{},this[p]=true;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,false)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case "YY":return String(e.$y).slice(-2);case "YYYY":return b.s(e.$y,4,"0");case "M":return a+1;case "MM":return b.s(a+1,2,"0");case "MMM":return h(n.monthsShort,a,c,3);case "MMMM":return h(c,a);case "D":return e.$D;case "DD":return b.s(e.$D,2,"0");case "d":return String(e.$W);case "dd":return h(n.weekdaysMin,e.$W,o,2);case "ddd":return h(n.weekdaysShort,e.$W,o,3);case "dddd":return o[e.$W];case "H":return String(s);case "HH":return b.s(s,2,"0");case "h":return d(1);case "hh":return d(2);case "a":return $(s,u,true);case "A":return $(s,u,false);case "m":return String(u);case "mm":return b.s(u,2,"0");case "s":return String(e.$s);case "ss":return b.s(e.$s,2,"0");case "SSS":return b.s(e.$ms,3,"0");case "Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,true);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=true),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
162
160
|
} (dayjs_min$1));
|
|
163
161
|
return dayjs_min$1.exports;
|
|
@@ -346,709 +344,115 @@ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);const PInfoTa
|
|
|
346
344
|
* Render
|
|
347
345
|
* ******************************************************************************************************************/
|
|
348
346
|
return (React.createElement(material.Grid, { container: true, spacing: spacing, columnSpacing: columnSpacing, rowSpacing: rowSpacing, className: classNames('PInfoTable', className), style: style, sx: sx }, content));
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
458
|
-
* character of `string`.
|
|
459
|
-
*
|
|
460
|
-
* @private
|
|
461
|
-
* @param {string} string The string to inspect.
|
|
462
|
-
* @returns {number} Returns the index of the last non-whitespace character.
|
|
463
|
-
*/
|
|
464
|
-
function trimmedEndIndex(string) {
|
|
465
|
-
var index = string.length;
|
|
466
|
-
|
|
467
|
-
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
468
|
-
return index;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
_trimmedEndIndex = trimmedEndIndex;
|
|
472
|
-
return _trimmedEndIndex;
|
|
473
|
-
}var _baseTrim;
|
|
474
|
-
var hasRequired_baseTrim;
|
|
475
|
-
|
|
476
|
-
function require_baseTrim () {
|
|
477
|
-
if (hasRequired_baseTrim) return _baseTrim;
|
|
478
|
-
hasRequired_baseTrim = 1;
|
|
479
|
-
var trimmedEndIndex = require_trimmedEndIndex();
|
|
480
|
-
|
|
481
|
-
/** Used to match leading whitespace. */
|
|
482
|
-
var reTrimStart = /^\s+/;
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* The base implementation of `_.trim`.
|
|
486
|
-
*
|
|
487
|
-
* @private
|
|
488
|
-
* @param {string} string The string to trim.
|
|
489
|
-
* @returns {string} Returns the trimmed string.
|
|
490
|
-
*/
|
|
491
|
-
function baseTrim(string) {
|
|
492
|
-
return string
|
|
493
|
-
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
494
|
-
: string;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
_baseTrim = baseTrim;
|
|
498
|
-
return _baseTrim;
|
|
499
|
-
}var _Symbol;
|
|
500
|
-
var hasRequired_Symbol;
|
|
501
|
-
|
|
502
|
-
function require_Symbol () {
|
|
503
|
-
if (hasRequired_Symbol) return _Symbol;
|
|
504
|
-
hasRequired_Symbol = 1;
|
|
505
|
-
var root = require_root();
|
|
506
|
-
|
|
507
|
-
/** Built-in value references. */
|
|
508
|
-
var Symbol = root.Symbol;
|
|
509
|
-
|
|
510
|
-
_Symbol = Symbol;
|
|
511
|
-
return _Symbol;
|
|
512
|
-
}var _getRawTag;
|
|
513
|
-
var hasRequired_getRawTag;
|
|
514
|
-
|
|
515
|
-
function require_getRawTag () {
|
|
516
|
-
if (hasRequired_getRawTag) return _getRawTag;
|
|
517
|
-
hasRequired_getRawTag = 1;
|
|
518
|
-
var Symbol = require_Symbol();
|
|
519
|
-
|
|
520
|
-
/** Used for built-in method references. */
|
|
521
|
-
var objectProto = Object.prototype;
|
|
522
|
-
|
|
523
|
-
/** Used to check objects for own properties. */
|
|
524
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* Used to resolve the
|
|
528
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
529
|
-
* of values.
|
|
530
|
-
*/
|
|
531
|
-
var nativeObjectToString = objectProto.toString;
|
|
532
|
-
|
|
533
|
-
/** Built-in value references. */
|
|
534
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
535
|
-
|
|
536
|
-
/**
|
|
537
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
538
|
-
*
|
|
539
|
-
* @private
|
|
540
|
-
* @param {*} value The value to query.
|
|
541
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
542
|
-
*/
|
|
543
|
-
function getRawTag(value) {
|
|
544
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
545
|
-
tag = value[symToStringTag];
|
|
546
|
-
|
|
547
|
-
try {
|
|
548
|
-
value[symToStringTag] = undefined;
|
|
549
|
-
var unmasked = true;
|
|
550
|
-
} catch (e) {}
|
|
551
|
-
|
|
552
|
-
var result = nativeObjectToString.call(value);
|
|
553
|
-
if (unmasked) {
|
|
554
|
-
if (isOwn) {
|
|
555
|
-
value[symToStringTag] = tag;
|
|
556
|
-
} else {
|
|
557
|
-
delete value[symToStringTag];
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return result;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
_getRawTag = getRawTag;
|
|
564
|
-
return _getRawTag;
|
|
565
|
-
}/** Used for built-in method references. */
|
|
566
|
-
|
|
567
|
-
var _objectToString;
|
|
568
|
-
var hasRequired_objectToString;
|
|
569
|
-
|
|
570
|
-
function require_objectToString () {
|
|
571
|
-
if (hasRequired_objectToString) return _objectToString;
|
|
572
|
-
hasRequired_objectToString = 1;
|
|
573
|
-
var objectProto = Object.prototype;
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* Used to resolve the
|
|
577
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
578
|
-
* of values.
|
|
579
|
-
*/
|
|
580
|
-
var nativeObjectToString = objectProto.toString;
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
584
|
-
*
|
|
585
|
-
* @private
|
|
586
|
-
* @param {*} value The value to convert.
|
|
587
|
-
* @returns {string} Returns the converted string.
|
|
588
|
-
*/
|
|
589
|
-
function objectToString(value) {
|
|
590
|
-
return nativeObjectToString.call(value);
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
_objectToString = objectToString;
|
|
594
|
-
return _objectToString;
|
|
595
|
-
}var _baseGetTag;
|
|
596
|
-
var hasRequired_baseGetTag;
|
|
597
|
-
|
|
598
|
-
function require_baseGetTag () {
|
|
599
|
-
if (hasRequired_baseGetTag) return _baseGetTag;
|
|
600
|
-
hasRequired_baseGetTag = 1;
|
|
601
|
-
var Symbol = require_Symbol(),
|
|
602
|
-
getRawTag = require_getRawTag(),
|
|
603
|
-
objectToString = require_objectToString();
|
|
604
|
-
|
|
605
|
-
/** `Object#toString` result references. */
|
|
606
|
-
var nullTag = '[object Null]',
|
|
607
|
-
undefinedTag = '[object Undefined]';
|
|
608
|
-
|
|
609
|
-
/** Built-in value references. */
|
|
610
|
-
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
614
|
-
*
|
|
615
|
-
* @private
|
|
616
|
-
* @param {*} value The value to query.
|
|
617
|
-
* @returns {string} Returns the `toStringTag`.
|
|
618
|
-
*/
|
|
619
|
-
function baseGetTag(value) {
|
|
620
|
-
if (value == null) {
|
|
621
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
622
|
-
}
|
|
623
|
-
return (symToStringTag && symToStringTag in Object(value))
|
|
624
|
-
? getRawTag(value)
|
|
625
|
-
: objectToString(value);
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
_baseGetTag = baseGetTag;
|
|
629
|
-
return _baseGetTag;
|
|
347
|
+
};function debounce$2(func, debounceMs, { signal, edges } = {}) {
|
|
348
|
+
let pendingThis = undefined;
|
|
349
|
+
let pendingArgs = null;
|
|
350
|
+
const leading = edges != null && edges.includes('leading');
|
|
351
|
+
const trailing = edges == null || edges.includes('trailing');
|
|
352
|
+
const invoke = () => {
|
|
353
|
+
if (pendingArgs !== null) {
|
|
354
|
+
func.apply(pendingThis, pendingArgs);
|
|
355
|
+
pendingThis = undefined;
|
|
356
|
+
pendingArgs = null;
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const onTimerEnd = () => {
|
|
360
|
+
if (trailing) {
|
|
361
|
+
invoke();
|
|
362
|
+
}
|
|
363
|
+
cancel();
|
|
364
|
+
};
|
|
365
|
+
let timeoutId = null;
|
|
366
|
+
const schedule = () => {
|
|
367
|
+
if (timeoutId != null) {
|
|
368
|
+
clearTimeout(timeoutId);
|
|
369
|
+
}
|
|
370
|
+
timeoutId = setTimeout(() => {
|
|
371
|
+
timeoutId = null;
|
|
372
|
+
onTimerEnd();
|
|
373
|
+
}, debounceMs);
|
|
374
|
+
};
|
|
375
|
+
const cancelTimer = () => {
|
|
376
|
+
if (timeoutId !== null) {
|
|
377
|
+
clearTimeout(timeoutId);
|
|
378
|
+
timeoutId = null;
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const cancel = () => {
|
|
382
|
+
cancelTimer();
|
|
383
|
+
pendingThis = undefined;
|
|
384
|
+
pendingArgs = null;
|
|
385
|
+
};
|
|
386
|
+
const flush = () => {
|
|
387
|
+
invoke();
|
|
388
|
+
};
|
|
389
|
+
const debounced = function (...args) {
|
|
390
|
+
if (signal?.aborted) {
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
pendingThis = this;
|
|
394
|
+
pendingArgs = args;
|
|
395
|
+
const isFirstCall = timeoutId == null;
|
|
396
|
+
schedule();
|
|
397
|
+
if (leading && isFirstCall) {
|
|
398
|
+
invoke();
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
debounced.schedule = schedule;
|
|
402
|
+
debounced.cancel = cancel;
|
|
403
|
+
debounced.flush = flush;
|
|
404
|
+
signal?.addEventListener('abort', cancel, { once: true });
|
|
405
|
+
return debounced;
|
|
406
|
+
}function debounce$1(func, debounceMs = 0, options = {}) {
|
|
407
|
+
if (typeof options !== 'object') {
|
|
408
|
+
options = {};
|
|
409
|
+
}
|
|
410
|
+
const { leading = false, trailing = true, maxWait } = options;
|
|
411
|
+
const edges = Array(2);
|
|
412
|
+
if (leading) {
|
|
413
|
+
edges[0] = 'leading';
|
|
414
|
+
}
|
|
415
|
+
if (trailing) {
|
|
416
|
+
edges[1] = 'trailing';
|
|
417
|
+
}
|
|
418
|
+
let result = undefined;
|
|
419
|
+
let pendingAt = null;
|
|
420
|
+
const _debounced = debounce$2(function (...args) {
|
|
421
|
+
result = func.apply(this, args);
|
|
422
|
+
pendingAt = null;
|
|
423
|
+
}, debounceMs, { edges });
|
|
424
|
+
const debounced = function (...args) {
|
|
425
|
+
if (maxWait != null) {
|
|
426
|
+
if (pendingAt === null) {
|
|
427
|
+
pendingAt = Date.now();
|
|
428
|
+
}
|
|
429
|
+
if (Date.now() - pendingAt >= maxWait) {
|
|
430
|
+
result = func.apply(this, args);
|
|
431
|
+
pendingAt = Date.now();
|
|
432
|
+
_debounced.cancel();
|
|
433
|
+
_debounced.schedule();
|
|
434
|
+
return result;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
_debounced.apply(this, args);
|
|
438
|
+
return result;
|
|
439
|
+
};
|
|
440
|
+
const flush = () => {
|
|
441
|
+
_debounced.flush();
|
|
442
|
+
return result;
|
|
443
|
+
};
|
|
444
|
+
debounced.cancel = _debounced.cancel;
|
|
445
|
+
debounced.flush = flush;
|
|
446
|
+
return debounced;
|
|
447
|
+
}function throttle$1(func, throttleMs = 0, options = {}) {
|
|
448
|
+
const { leading = true, trailing = true } = options;
|
|
449
|
+
return debounce$1(func, throttleMs, {
|
|
450
|
+
leading,
|
|
451
|
+
maxWait: throttleMs,
|
|
452
|
+
trailing,
|
|
453
|
+
});
|
|
630
454
|
}/**
|
|
631
|
-
*
|
|
632
|
-
* and has a `typeof` result of "object".
|
|
633
|
-
*
|
|
634
|
-
* @static
|
|
635
|
-
* @memberOf _
|
|
636
|
-
* @since 4.0.0
|
|
637
|
-
* @category Lang
|
|
638
|
-
* @param {*} value The value to check.
|
|
639
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
640
|
-
* @example
|
|
641
|
-
*
|
|
642
|
-
* _.isObjectLike({});
|
|
643
|
-
* // => true
|
|
644
|
-
*
|
|
645
|
-
* _.isObjectLike([1, 2, 3]);
|
|
646
|
-
* // => true
|
|
647
|
-
*
|
|
648
|
-
* _.isObjectLike(_.noop);
|
|
649
|
-
* // => false
|
|
650
|
-
*
|
|
651
|
-
* _.isObjectLike(null);
|
|
652
|
-
* // => false
|
|
653
|
-
*/
|
|
654
|
-
|
|
655
|
-
var isObjectLike_1;
|
|
656
|
-
var hasRequiredIsObjectLike;
|
|
657
|
-
|
|
658
|
-
function requireIsObjectLike () {
|
|
659
|
-
if (hasRequiredIsObjectLike) return isObjectLike_1;
|
|
660
|
-
hasRequiredIsObjectLike = 1;
|
|
661
|
-
function isObjectLike(value) {
|
|
662
|
-
return value != null && typeof value == 'object';
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
isObjectLike_1 = isObjectLike;
|
|
666
|
-
return isObjectLike_1;
|
|
667
|
-
}var isSymbol_1;
|
|
668
|
-
var hasRequiredIsSymbol;
|
|
669
|
-
|
|
670
|
-
function requireIsSymbol () {
|
|
671
|
-
if (hasRequiredIsSymbol) return isSymbol_1;
|
|
672
|
-
hasRequiredIsSymbol = 1;
|
|
673
|
-
var baseGetTag = require_baseGetTag(),
|
|
674
|
-
isObjectLike = requireIsObjectLike();
|
|
675
|
-
|
|
676
|
-
/** `Object#toString` result references. */
|
|
677
|
-
var symbolTag = '[object Symbol]';
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
681
|
-
*
|
|
682
|
-
* @static
|
|
683
|
-
* @memberOf _
|
|
684
|
-
* @since 4.0.0
|
|
685
|
-
* @category Lang
|
|
686
|
-
* @param {*} value The value to check.
|
|
687
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
688
|
-
* @example
|
|
689
|
-
*
|
|
690
|
-
* _.isSymbol(Symbol.iterator);
|
|
691
|
-
* // => true
|
|
692
|
-
*
|
|
693
|
-
* _.isSymbol('abc');
|
|
694
|
-
* // => false
|
|
695
|
-
*/
|
|
696
|
-
function isSymbol(value) {
|
|
697
|
-
return typeof value == 'symbol' ||
|
|
698
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
isSymbol_1 = isSymbol;
|
|
702
|
-
return isSymbol_1;
|
|
703
|
-
}var toNumber_1;
|
|
704
|
-
var hasRequiredToNumber;
|
|
705
|
-
|
|
706
|
-
function requireToNumber () {
|
|
707
|
-
if (hasRequiredToNumber) return toNumber_1;
|
|
708
|
-
hasRequiredToNumber = 1;
|
|
709
|
-
var baseTrim = require_baseTrim(),
|
|
710
|
-
isObject = requireIsObject(),
|
|
711
|
-
isSymbol = requireIsSymbol();
|
|
712
|
-
|
|
713
|
-
/** Used as references for various `Number` constants. */
|
|
714
|
-
var NAN = 0 / 0;
|
|
715
|
-
|
|
716
|
-
/** Used to detect bad signed hexadecimal string values. */
|
|
717
|
-
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
718
|
-
|
|
719
|
-
/** Used to detect binary string values. */
|
|
720
|
-
var reIsBinary = /^0b[01]+$/i;
|
|
721
|
-
|
|
722
|
-
/** Used to detect octal string values. */
|
|
723
|
-
var reIsOctal = /^0o[0-7]+$/i;
|
|
724
|
-
|
|
725
|
-
/** Built-in method references without a dependency on `root`. */
|
|
726
|
-
var freeParseInt = parseInt;
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Converts `value` to a number.
|
|
730
|
-
*
|
|
731
|
-
* @static
|
|
732
|
-
* @memberOf _
|
|
733
|
-
* @since 4.0.0
|
|
734
|
-
* @category Lang
|
|
735
|
-
* @param {*} value The value to process.
|
|
736
|
-
* @returns {number} Returns the number.
|
|
737
|
-
* @example
|
|
738
|
-
*
|
|
739
|
-
* _.toNumber(3.2);
|
|
740
|
-
* // => 3.2
|
|
741
|
-
*
|
|
742
|
-
* _.toNumber(Number.MIN_VALUE);
|
|
743
|
-
* // => 5e-324
|
|
744
|
-
*
|
|
745
|
-
* _.toNumber(Infinity);
|
|
746
|
-
* // => Infinity
|
|
747
|
-
*
|
|
748
|
-
* _.toNumber('3.2');
|
|
749
|
-
* // => 3.2
|
|
750
|
-
*/
|
|
751
|
-
function toNumber(value) {
|
|
752
|
-
if (typeof value == 'number') {
|
|
753
|
-
return value;
|
|
754
|
-
}
|
|
755
|
-
if (isSymbol(value)) {
|
|
756
|
-
return NAN;
|
|
757
|
-
}
|
|
758
|
-
if (isObject(value)) {
|
|
759
|
-
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
760
|
-
value = isObject(other) ? (other + '') : other;
|
|
761
|
-
}
|
|
762
|
-
if (typeof value != 'string') {
|
|
763
|
-
return value === 0 ? value : +value;
|
|
764
|
-
}
|
|
765
|
-
value = baseTrim(value);
|
|
766
|
-
var isBinary = reIsBinary.test(value);
|
|
767
|
-
return (isBinary || reIsOctal.test(value))
|
|
768
|
-
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
769
|
-
: (reIsBadHex.test(value) ? NAN : +value);
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
toNumber_1 = toNumber;
|
|
773
|
-
return toNumber_1;
|
|
774
|
-
}var debounce_1;
|
|
775
|
-
var hasRequiredDebounce;
|
|
776
|
-
|
|
777
|
-
function requireDebounce () {
|
|
778
|
-
if (hasRequiredDebounce) return debounce_1;
|
|
779
|
-
hasRequiredDebounce = 1;
|
|
780
|
-
var isObject = requireIsObject(),
|
|
781
|
-
now = requireNow(),
|
|
782
|
-
toNumber = requireToNumber();
|
|
783
|
-
|
|
784
|
-
/** Error message constants. */
|
|
785
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
786
|
-
|
|
787
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
788
|
-
var nativeMax = Math.max,
|
|
789
|
-
nativeMin = Math.min;
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
793
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
794
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
795
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
796
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
797
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
798
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
799
|
-
* calls to the debounced function return the result of the last `func`
|
|
800
|
-
* invocation.
|
|
801
|
-
*
|
|
802
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
803
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
804
|
-
* is invoked more than once during the `wait` timeout.
|
|
805
|
-
*
|
|
806
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
807
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
808
|
-
*
|
|
809
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
810
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
811
|
-
*
|
|
812
|
-
* @static
|
|
813
|
-
* @memberOf _
|
|
814
|
-
* @since 0.1.0
|
|
815
|
-
* @category Function
|
|
816
|
-
* @param {Function} func The function to debounce.
|
|
817
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
818
|
-
* @param {Object} [options={}] The options object.
|
|
819
|
-
* @param {boolean} [options.leading=false]
|
|
820
|
-
* Specify invoking on the leading edge of the timeout.
|
|
821
|
-
* @param {number} [options.maxWait]
|
|
822
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
823
|
-
* @param {boolean} [options.trailing=true]
|
|
824
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
825
|
-
* @returns {Function} Returns the new debounced function.
|
|
826
|
-
* @example
|
|
827
|
-
*
|
|
828
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
829
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
830
|
-
*
|
|
831
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
832
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
833
|
-
* 'leading': true,
|
|
834
|
-
* 'trailing': false
|
|
835
|
-
* }));
|
|
836
|
-
*
|
|
837
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
838
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
839
|
-
* var source = new EventSource('/stream');
|
|
840
|
-
* jQuery(source).on('message', debounced);
|
|
841
|
-
*
|
|
842
|
-
* // Cancel the trailing debounced invocation.
|
|
843
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
844
|
-
*/
|
|
845
|
-
function debounce(func, wait, options) {
|
|
846
|
-
var lastArgs,
|
|
847
|
-
lastThis,
|
|
848
|
-
maxWait,
|
|
849
|
-
result,
|
|
850
|
-
timerId,
|
|
851
|
-
lastCallTime,
|
|
852
|
-
lastInvokeTime = 0,
|
|
853
|
-
leading = false,
|
|
854
|
-
maxing = false,
|
|
855
|
-
trailing = true;
|
|
856
|
-
|
|
857
|
-
if (typeof func != 'function') {
|
|
858
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
859
|
-
}
|
|
860
|
-
wait = toNumber(wait) || 0;
|
|
861
|
-
if (isObject(options)) {
|
|
862
|
-
leading = !!options.leading;
|
|
863
|
-
maxing = 'maxWait' in options;
|
|
864
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
865
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
function invokeFunc(time) {
|
|
869
|
-
var args = lastArgs,
|
|
870
|
-
thisArg = lastThis;
|
|
871
|
-
|
|
872
|
-
lastArgs = lastThis = undefined;
|
|
873
|
-
lastInvokeTime = time;
|
|
874
|
-
result = func.apply(thisArg, args);
|
|
875
|
-
return result;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function leadingEdge(time) {
|
|
879
|
-
// Reset any `maxWait` timer.
|
|
880
|
-
lastInvokeTime = time;
|
|
881
|
-
// Start the timer for the trailing edge.
|
|
882
|
-
timerId = setTimeout(timerExpired, wait);
|
|
883
|
-
// Invoke the leading edge.
|
|
884
|
-
return leading ? invokeFunc(time) : result;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
function remainingWait(time) {
|
|
888
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
889
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
890
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
891
|
-
|
|
892
|
-
return maxing
|
|
893
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
894
|
-
: timeWaiting;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
function shouldInvoke(time) {
|
|
898
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
899
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
900
|
-
|
|
901
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
902
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
903
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
904
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
905
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
function timerExpired() {
|
|
909
|
-
var time = now();
|
|
910
|
-
if (shouldInvoke(time)) {
|
|
911
|
-
return trailingEdge(time);
|
|
912
|
-
}
|
|
913
|
-
// Restart the timer.
|
|
914
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
function trailingEdge(time) {
|
|
918
|
-
timerId = undefined;
|
|
919
|
-
|
|
920
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
921
|
-
// debounced at least once.
|
|
922
|
-
if (trailing && lastArgs) {
|
|
923
|
-
return invokeFunc(time);
|
|
924
|
-
}
|
|
925
|
-
lastArgs = lastThis = undefined;
|
|
926
|
-
return result;
|
|
927
|
-
}
|
|
928
|
-
|
|
929
|
-
function cancel() {
|
|
930
|
-
if (timerId !== undefined) {
|
|
931
|
-
clearTimeout(timerId);
|
|
932
|
-
}
|
|
933
|
-
lastInvokeTime = 0;
|
|
934
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
function flush() {
|
|
938
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
function debounced() {
|
|
942
|
-
var time = now(),
|
|
943
|
-
isInvoking = shouldInvoke(time);
|
|
944
|
-
|
|
945
|
-
lastArgs = arguments;
|
|
946
|
-
lastThis = this;
|
|
947
|
-
lastCallTime = time;
|
|
948
|
-
|
|
949
|
-
if (isInvoking) {
|
|
950
|
-
if (timerId === undefined) {
|
|
951
|
-
return leadingEdge(lastCallTime);
|
|
952
|
-
}
|
|
953
|
-
if (maxing) {
|
|
954
|
-
// Handle invocations in a tight loop.
|
|
955
|
-
clearTimeout(timerId);
|
|
956
|
-
timerId = setTimeout(timerExpired, wait);
|
|
957
|
-
return invokeFunc(lastCallTime);
|
|
958
|
-
}
|
|
959
|
-
}
|
|
960
|
-
if (timerId === undefined) {
|
|
961
|
-
timerId = setTimeout(timerExpired, wait);
|
|
962
|
-
}
|
|
963
|
-
return result;
|
|
964
|
-
}
|
|
965
|
-
debounced.cancel = cancel;
|
|
966
|
-
debounced.flush = flush;
|
|
967
|
-
return debounced;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
debounce_1 = debounce;
|
|
971
|
-
return debounce_1;
|
|
972
|
-
}var debounceExports = requireDebounce();
|
|
973
|
-
var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);var throttle_1;
|
|
974
|
-
var hasRequiredThrottle;
|
|
975
|
-
|
|
976
|
-
function requireThrottle () {
|
|
977
|
-
if (hasRequiredThrottle) return throttle_1;
|
|
978
|
-
hasRequiredThrottle = 1;
|
|
979
|
-
var debounce = requireDebounce(),
|
|
980
|
-
isObject = requireIsObject();
|
|
981
|
-
|
|
982
|
-
/** Error message constants. */
|
|
983
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
984
|
-
|
|
985
|
-
/**
|
|
986
|
-
* Creates a throttled function that only invokes `func` at most once per
|
|
987
|
-
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
988
|
-
* method to cancel delayed `func` invocations and a `flush` method to
|
|
989
|
-
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
990
|
-
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
991
|
-
* timeout. The `func` is invoked with the last arguments provided to the
|
|
992
|
-
* throttled function. Subsequent calls to the throttled function return the
|
|
993
|
-
* result of the last `func` invocation.
|
|
994
|
-
*
|
|
995
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
996
|
-
* invoked on the trailing edge of the timeout only if the throttled function
|
|
997
|
-
* is invoked more than once during the `wait` timeout.
|
|
998
|
-
*
|
|
999
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
1000
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
1001
|
-
*
|
|
1002
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
1003
|
-
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
1004
|
-
*
|
|
1005
|
-
* @static
|
|
1006
|
-
* @memberOf _
|
|
1007
|
-
* @since 0.1.0
|
|
1008
|
-
* @category Function
|
|
1009
|
-
* @param {Function} func The function to throttle.
|
|
1010
|
-
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
1011
|
-
* @param {Object} [options={}] The options object.
|
|
1012
|
-
* @param {boolean} [options.leading=true]
|
|
1013
|
-
* Specify invoking on the leading edge of the timeout.
|
|
1014
|
-
* @param {boolean} [options.trailing=true]
|
|
1015
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
1016
|
-
* @returns {Function} Returns the new throttled function.
|
|
1017
|
-
* @example
|
|
1018
|
-
*
|
|
1019
|
-
* // Avoid excessively updating the position while scrolling.
|
|
1020
|
-
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
1021
|
-
*
|
|
1022
|
-
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
1023
|
-
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
1024
|
-
* jQuery(element).on('click', throttled);
|
|
1025
|
-
*
|
|
1026
|
-
* // Cancel the trailing throttled invocation.
|
|
1027
|
-
* jQuery(window).on('popstate', throttled.cancel);
|
|
1028
|
-
*/
|
|
1029
|
-
function throttle(func, wait, options) {
|
|
1030
|
-
var leading = true,
|
|
1031
|
-
trailing = true;
|
|
1032
|
-
|
|
1033
|
-
if (typeof func != 'function') {
|
|
1034
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1035
|
-
}
|
|
1036
|
-
if (isObject(options)) {
|
|
1037
|
-
leading = 'leading' in options ? !!options.leading : leading;
|
|
1038
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
1039
|
-
}
|
|
1040
|
-
return debounce(func, wait, {
|
|
1041
|
-
'leading': leading,
|
|
1042
|
-
'maxWait': wait,
|
|
1043
|
-
'trailing': trailing
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
throttle_1 = throttle;
|
|
1048
|
-
return throttle_1;
|
|
1049
|
-
}var throttleExports = requireThrottle();
|
|
1050
|
-
var throttle$1 = /*@__PURE__*/getDefaultExportFromCjs(throttleExports);/**
|
|
1051
|
-
* Wraps the resize callback with a lodash debounce / throttle based on the refresh mode
|
|
455
|
+
* Wraps the resize callback with a es-toolkit debounce / throttle based on the refresh mode
|
|
1052
456
|
*/
|
|
1053
457
|
const patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {
|
|
1054
458
|
switch (refreshMode) {
|
|
@@ -1145,7 +549,7 @@ const getDimensions = (entry, box) => {
|
|
|
1145
549
|
height: entry.contentRect.height,
|
|
1146
550
|
};
|
|
1147
551
|
};// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1148
|
-
function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 1000, refreshOptions, handleWidth = true, handleHeight = true, targetRef, observerOptions, onResize, } = {}) {
|
|
552
|
+
function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 1000, refreshOptions, handleWidth = true, handleHeight = true, targetRef, observerOptions, onResize, disableRerender = false, } = {}) {
|
|
1149
553
|
// If `skipOnMount` is enabled, skip the first resize event
|
|
1150
554
|
const skipResize = React.useRef(skipOnMount);
|
|
1151
555
|
// Wrap the `onResize` callback with a ref to avoid re-renders
|
|
@@ -1154,6 +558,10 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1154
558
|
width: undefined,
|
|
1155
559
|
height: undefined,
|
|
1156
560
|
});
|
|
561
|
+
const sizeRef = React.useRef({
|
|
562
|
+
width: undefined,
|
|
563
|
+
height: undefined,
|
|
564
|
+
});
|
|
1157
565
|
// Create a proxy ref to handle conditional rendering and dynamic ref changes of the target element
|
|
1158
566
|
const { refProxy, refElement } = useRefProxy(targetRef);
|
|
1159
567
|
const { box } = observerOptions || {};
|
|
@@ -1168,18 +576,31 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1168
576
|
const shouldSetSize = (prevSize, nextSize) => (handleWidth && prevSize.width !== nextSize.width) || (handleHeight && prevSize.height !== nextSize.height);
|
|
1169
577
|
entries.forEach((entry) => {
|
|
1170
578
|
const dimensions = getDimensions(entry, box);
|
|
1171
|
-
|
|
1172
|
-
if (
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
579
|
+
if (disableRerender) {
|
|
580
|
+
if (shouldSetSize(sizeRef.current, dimensions)) {
|
|
581
|
+
sizeRef.current.width = dimensions.width;
|
|
582
|
+
sizeRef.current.height = dimensions.height;
|
|
583
|
+
onResizeRef === null || onResizeRef === void 0 ? void 0 : onResizeRef({
|
|
584
|
+
width: dimensions.width,
|
|
585
|
+
height: dimensions.height,
|
|
586
|
+
entry,
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
setSize((prevSize) => {
|
|
592
|
+
if (!shouldSetSize(prevSize, dimensions))
|
|
593
|
+
return prevSize;
|
|
594
|
+
onResizeRef === null || onResizeRef === void 0 ? void 0 : onResizeRef({
|
|
595
|
+
width: dimensions.width,
|
|
596
|
+
height: dimensions.height,
|
|
597
|
+
entry,
|
|
598
|
+
});
|
|
599
|
+
return dimensions;
|
|
1178
600
|
});
|
|
1179
|
-
|
|
1180
|
-
});
|
|
601
|
+
}
|
|
1181
602
|
});
|
|
1182
|
-
}, [handleWidth, handleHeight, skipResize, box]);
|
|
603
|
+
}, [handleWidth, handleHeight, skipResize, box, disableRerender]);
|
|
1183
604
|
// Throttle/Debounce the resize event if refreshMode is configured
|
|
1184
605
|
const resizeHandler = React.useCallback(patchResizeCallback(resizeCallback, refreshMode, refreshRate, refreshOptions), [
|
|
1185
606
|
resizeCallback,
|
|
@@ -1206,7 +627,11 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1206
627
|
height: null,
|
|
1207
628
|
entry: null,
|
|
1208
629
|
});
|
|
1209
|
-
|
|
630
|
+
sizeRef.current.width = undefined;
|
|
631
|
+
sizeRef.current.height = undefined;
|
|
632
|
+
if (!disableRerender) {
|
|
633
|
+
setSize({ width: undefined, height: undefined });
|
|
634
|
+
}
|
|
1210
635
|
}
|
|
1211
636
|
// Disconnect the ResizeObserver when the component is unmounted
|
|
1212
637
|
return () => {
|
|
@@ -1215,7 +640,7 @@ function useResizeDetector({ skipOnMount = false, refreshMode, refreshRate = 100
|
|
|
1215
640
|
(_c = (_b = resizeHandler).cancel) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
1216
641
|
};
|
|
1217
642
|
}, [resizeHandler, refElement]);
|
|
1218
|
-
return Object.assign({ ref: refProxy }, size);
|
|
643
|
+
return Object.assign({ ref: refProxy }, (disableRerender ? sizeRef.current : size));
|
|
1219
644
|
}const StyledBodyRow = material.styled(material.TableRow)(({ theme }) => ({
|
|
1220
645
|
'&.odd-color:nth-of-type(odd):not(:hover)': {
|
|
1221
646
|
backgroundColor: material.lighten(theme.palette.action.hover, 0.4),
|
|
@@ -2132,7 +1557,7 @@ function throttle(func, wait, options) {
|
|
|
2132
1557
|
'trailing': trailing
|
|
2133
1558
|
});
|
|
2134
1559
|
}/**
|
|
2135
|
-
* simplebar-core - v1.3.
|
|
1560
|
+
* simplebar-core - v1.3.2
|
|
2136
1561
|
* Scrollbars, simpler.
|
|
2137
1562
|
* https://grsmto.github.io/simplebar/
|
|
2138
1563
|
*
|
|
@@ -3056,7 +2481,7 @@ var SimpleBarCore = /** @class */ (function () {
|
|
|
3056
2481
|
SimpleBarCore.helpers = helpers;
|
|
3057
2482
|
return SimpleBarCore;
|
|
3058
2483
|
}());/**
|
|
3059
|
-
* simplebar-react - v3.3.
|
|
2484
|
+
* simplebar-react - v3.3.2
|
|
3060
2485
|
* React component for SimpleBar
|
|
3061
2486
|
* https://grsmto.github.io/simplebar/
|
|
3062
2487
|
*
|