@adaptabletools/adaptable 22.0.0-canary.10 → 22.0.0-canary.12
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/index.css +0 -12
- package/index.css.map +1 -1
- package/package.json +1 -4
- package/src/AdaptableState/Common/AdaptableForm.d.ts +1 -1
- package/src/AdaptableState/UserInterfaceState.d.ts +1 -1
- package/src/Api/GridApi.d.ts +4 -0
- package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
- package/src/Api/Implementation/GridApiImpl.js +3 -0
- package/src/Api/Implementation/LayoutHelpers.js +1 -1
- package/src/Api/Internal/ColumnInternalApi.js +1 -1
- package/src/Api/Internal/EventInternalApi.js +1 -1
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +1 -1
- package/src/Redux/Store/AdaptableReduxMerger.js +5 -6
- package/src/Strategy/LayoutModule.js +1 -1
- package/src/Strategy/TeamSharingModule.js +2 -2
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +1 -1
- package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
- package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +1 -1
- package/src/Utilities/Extensions/StringExtensions.js +1 -1
- package/src/Utilities/Helpers/AdaptableHelper.js +2 -2
- package/src/Utilities/Helpers/FormatHelper.js +1 -1
- package/src/Utilities/Services/LicenseService/index.js +1 -1
- package/src/Utilities/Services/RowSummaryService.d.ts +1 -1
- package/src/Utilities/Services/RowSummaryService.js +2 -2
- package/src/Utilities/utils/chunk.d.ts +6 -0
- package/src/Utilities/utils/chunk.js +17 -0
- package/src/Utilities/utils/clamp.d.ts +5 -0
- package/src/Utilities/utils/clamp.js +7 -0
- package/src/Utilities/utils/cloneDeepWith.d.ts +9 -0
- package/src/Utilities/utils/cloneDeepWith.js +67 -0
- package/src/Utilities/utils/debounce.d.ts +20 -0
- package/src/Utilities/utils/debounce.js +121 -0
- package/src/Utilities/utils/flatten.d.ts +5 -0
- package/src/Utilities/utils/flatten.js +7 -0
- package/src/Utilities/utils/flattenDeep.d.ts +5 -0
- package/src/Utilities/utils/flattenDeep.js +7 -0
- package/src/Utilities/utils/get.d.ts +6 -0
- package/src/Utilities/utils/get.js +35 -0
- package/src/Utilities/utils/index.d.ts +22 -0
- package/src/Utilities/utils/index.js +22 -0
- package/src/Utilities/utils/isArray.d.ts +6 -0
- package/src/Utilities/utils/isArray.js +6 -0
- package/src/Utilities/utils/isEqual.d.ts +5 -0
- package/src/Utilities/utils/isEqual.js +124 -0
- package/src/Utilities/utils/isObject.d.ts +6 -0
- package/src/Utilities/utils/isObject.js +9 -0
- package/src/Utilities/utils/isPlainObject.d.ts +6 -0
- package/src/Utilities/utils/isPlainObject.js +17 -0
- package/src/Utilities/utils/kebabCase.d.ts +5 -0
- package/src/Utilities/utils/kebabCase.js +8 -0
- package/src/Utilities/utils/merge.d.ts +11 -0
- package/src/Utilities/utils/merge.js +40 -0
- package/src/Utilities/utils/mergeWith.d.ts +7 -0
- package/src/Utilities/utils/mergeWith.js +46 -0
- package/src/Utilities/utils/orderBy.d.ts +8 -0
- package/src/Utilities/utils/orderBy.js +30 -0
- package/src/Utilities/utils/parseInt.d.ts +6 -0
- package/src/Utilities/utils/parseInt.js +9 -0
- package/src/Utilities/utils/sentenceCase.d.ts +6 -0
- package/src/Utilities/utils/sentenceCase.js +15 -0
- package/src/Utilities/utils/startCase.d.ts +5 -0
- package/src/Utilities/utils/startCase.js +11 -0
- package/src/Utilities/utils/throttle.d.ts +17 -0
- package/src/Utilities/utils/throttle.js +19 -0
- package/src/Utilities/utils/toNumber.d.ts +5 -0
- package/src/Utilities/utils/toNumber.js +39 -0
- package/src/Utilities/utils/uniq.d.ts +7 -0
- package/src/Utilities/utils/uniq.js +9 -0
- package/src/Utilities/utils/uniqBy.d.ts +8 -0
- package/src/Utilities/utils/uniqBy.js +22 -0
- package/src/Utilities/utils/words.d.ts +7 -0
- package/src/Utilities/utils/words.js +10 -0
- package/src/Utilities/weightedAverage.js +1 -1
- package/src/View/AdaptableComputedCSSVarsContext.js +1 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +1 -1
- package/src/View/Alert/Wizard/AlertButtonsEditor.js +1 -1
- package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +1 -1
- package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +1 -1
- package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +1 -1
- package/src/View/Components/RangesComponent.js +1 -1
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
- package/src/View/Dashboard/CustomDashboardButton.js +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +1 -1
- package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
- package/src/View/Filter/FilterViewPanel.d.ts +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +2 -2
- package/src/View/GridFilter/GridFilterViewPanel.js +3 -3
- package/src/View/Layout/LayoutViewPanel.js +1 -1
- package/src/View/Note/NoteEditor.js +1 -1
- package/src/View/QuickSearch/useQuickSearchDebounced.js +1 -1
- package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
- package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
- package/src/View/Theme/ThemeEditor.js +1 -1
- package/src/View/Theme/ThemeField.js +1 -1
- package/src/View/Wizard/OnePageAdaptableWizard.js +1 -1
- package/src/agGrid/AdaptableAgGrid.js +2 -2
- package/src/agGrid/AgGridColumnAdapter.js +2 -2
- package/src/agGrid/cellRenderers/PercentBarRenderer.js +1 -1
- package/src/components/ColorPicker/ColorPicker.js +1 -1
- package/src/components/DropdownButton/renderItem.js +1 -1
- package/src/components/FormLayout/index.js +1 -1
- package/src/components/OverlayTrigger/index.js +1 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/isLayoutEqual.js +1 -1
- package/src/migration/VersionUpgrade22.js +1 -0
- package/tsconfig.esm.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LicenseDisablePersistence as e,LicenseShowWatermark as a}from"../../../Redux/ActionsReducers/InternalRedux";import{PopupShowAlert as t}from"../../../Redux/ActionsReducers/PopupRedux";import i from"../../ObjectFactory";import s from"
|
|
1
|
+
import{LicenseDisablePersistence as e,LicenseShowWatermark as a}from"../../../Redux/ActionsReducers/InternalRedux";import{PopupShowAlert as t}from"../../../Redux/ActionsReducers/PopupRedux";import i from"../../ObjectFactory";import s from"../../utils/clamp";import{LicenseDocsLink as o}from"../../Constants/DocumentationLinkConstants";import{decode as n,GENERIC_APP_NAME as r}from"../../license/decode";import{shouldLogThankYouMessage as l}from"./shouldLogThankYouMessage";const c="sales@adaptabletools.com",p=10,d=864e5;export var LicenseValidityType;!function(e){e.INVALID_LICENSE="INVALID_LICENSE",e.NO_LICENSE="NO_LICENSE",e.NON_PRODUCTION_VALID="NON_PRODUCTION_VALID",e.NON_PRODUCTION_EXPIRED_IN_SCOPE="NON_PRODUCTION_EXPIRED_IN_SCOPE",e.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE="NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE",e.COMMERCIAL_VALID="COMMERCIAL_VALID",e.COMMERCIAL_EXPIRED_IN_SCOPE="COMMERCIAL_EXPIRED_IN_SCOPE",e.COMMERCIAL_EXPIRED_OUT_OF_SCOPE="COMMERCIAL_EXPIRED_OUT_OF_SCOPE"}(LicenseValidityType||(LicenseValidityType={}));const h=()=>"undefined"!=typeof window?window.location.origin:"",E=()=>{const e=h(),[a,t,i]=Array.from(/(https):\/\/\d+\-\d+\-\d+\-(sandpack\.codesandbox\.io)/g.exec(e)||[]);return"https"===t&&"sandpack.codesandbox.io"===i},I=()=>{const e=h(),[a,t,i]=Array.from(/(https):\/\/\S+(\.csb\.app)/g.exec(e)||[]);return"https"===t&&".csb.app"===i},_=()=>{const e=h(),[a,t,i]=Array.from(/(https):\/\/\S+(\.adaptabletools\.com)/g.exec(e)||[]);return"https"===t&&".adaptabletools.com"===i};export class LicenseService{adaptable;licenseKey;packageDetails;constructor(e,a,t){this.adaptable=e,this.licenseKey=a,this.packageDetails=t,this.adaptable=e,this.adaptable.api.eventApi.on("AdaptableReady",()=>{requestAnimationFrame(()=>{this.adaptable.isDestroyed||this.init()})})}init(){let e=null;if(this.licenseKey)try{e=n(this.licenseKey)}catch(a){e=a}E()||I()||_()||this.handleLicenseValidation(e,this.getValidityType(e,this.packageDetails))}getValidityType(e,a){if(!e)return LicenseValidityType.NO_LICENSE;if(e instanceof Error)return LicenseValidityType.INVALID_LICENSE;const t=new Date(a.publishedAt),i=new Date(e.end),s=i<new Date,o=e.trial;let n=null;return n=s?i>t?o?LicenseValidityType.NON_PRODUCTION_EXPIRED_IN_SCOPE:LicenseValidityType.COMMERCIAL_EXPIRED_IN_SCOPE:o?LicenseValidityType.NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE:LicenseValidityType.COMMERCIAL_EXPIRED_OUT_OF_SCOPE:o?LicenseValidityType.NON_PRODUCTION_VALID:LicenseValidityType.COMMERCIAL_VALID,n}handleLicenseValidation(e,a){const t=new Date;t.setHours(0,0,0,0);let i=0;e instanceof Error||!e?.end||(i=Math.floor((e?.end?.getTime()-t.getTime())/d),i=s(i,0,1/0));let n="",h="";!e||e instanceof Error||!e.appName||e.appName==r||(n=e.appName,h=" for application [APP_NAME]");const E=(e,a=o,t=c,s=i,r=n)=>e.replace("[LINK]",a).replace("[EMAIL]",t).replace("[APP_NAME]",r).replace("[DAYS]",`${s}`);switch(a){case"NO_LICENSE":case"NON_PRODUCTION_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(E("This instance of AdapTable does not have a license, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("No AdapTable License found."),this.showWatermark("This instance of AdapTable does not have a license, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"INVALID_LICENSE":this.adaptable.logger.consoleLogByMessageType(E("This instance of AdapTable seems to use a corrupted License, and some functionality has therefore been removed. In order to use a fully-featured version of AdapTable, please contact [EMAIL]. You can learn more about the different AdapTable license options at [LINK]."),"Error"),this.showNotification("Corrupted AdapTable License found."),this.showWatermark("This instance of AdapTable has a corrupted License, and some functionality has therefore been removed."),this.disableStatePersistence();break;case"NON_PRODUCTION_VALID":this.adaptable.logger.consoleLogByMessageType(E("This AdapTable trial license expires in [DAYS] days. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Info");break;case"NON_PRODUCTION_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(E("This AdapTable trial license has now expired. Please contact [EMAIL] to upgrade to a commercial version of AdapTable. You can learn more about the different AdapTable license options at [LINK]."),"Warning"),this.showWatermark("AdapTable License has expired");break;case"COMMERCIAL_VALID":if(i<=p)this.adaptable.logger.consoleLogByMessageType(E(`This AdapTable license${h} expires in [DAYS] days. Please contact [EMAIL] to renew (giving you access to Support and Updates)`),"Info");else try{l()&&this.adaptable.logger.consoleLogByMessageType(E(`Thank you for using a valid AdapTable license${h}. Your license will expire in [DAYS] days.`),"Info")}catch(e){}break;case"COMMERCIAL_EXPIRED_IN_SCOPE":this.adaptable.logger.consoleLogByMessageType(E(`This AdapTable license${h} has expired. Please contact [EMAIL] if you wish to renew (giving you access to Support and Updates)`),"Warning");break;case"COMMERCIAL_EXPIRED_OUT_OF_SCOPE":this.adaptable.logger.consoleLogByMessageType(E(`This AdapTable license${h} has expired. Adaptable version was published after the license expired. Please contact [EMAIL] if you wish to renew your license.`),"Error"),this.showNotification("Adaptable License has expired"),this.showWatermark("Adaptable License has expired")}}showNotification(e){this.adaptable.api.internalApi.dispatchReduxAction(t({alertType:"generic",header:"License Error",message:e,alertDefinition:i.CreateInternalAlertDefinitionForMessages("Error")}))}showWatermark(e){this.adaptable.api.internalApi.dispatchReduxAction(a(e))}disableStatePersistence(){this.adaptable.api.internalApi.dispatchReduxAction(e())}destroy(){}}
|
|
@@ -19,7 +19,7 @@ export declare class RowSummaryService {
|
|
|
19
19
|
*
|
|
20
20
|
* @param colId optional to evaluate only one column
|
|
21
21
|
*/
|
|
22
|
-
_throttledEvaluateRowSummary: import("
|
|
22
|
+
_throttledEvaluateRowSummary: import("../utils/debounce").DebouncedFunction<(reason?: {
|
|
23
23
|
columnIds: string[];
|
|
24
24
|
}) => void>;
|
|
25
25
|
private evaluateRowSummary;
|
|
@@ -4,8 +4,8 @@ import * as ModuleConstants from '../../Utilities/Constants/ModuleConstants';
|
|
|
4
4
|
import Helper from '../Helpers/Helper';
|
|
5
5
|
import { AggregatedScalarLiveValue } from './AggregatedScalarLiveValue';
|
|
6
6
|
import { isObjectEmpty } from '../Extensions/ObjectExtensions';
|
|
7
|
-
import throttle from '
|
|
8
|
-
import isEqual from '
|
|
7
|
+
import throttle from '../utils/throttle';
|
|
8
|
+
import isEqual from '../utils/isEqual';
|
|
9
9
|
/**
|
|
10
10
|
* The logic is extracted here to make it easier to follow
|
|
11
11
|
*/
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of elements split into groups the length of size.
|
|
3
|
+
* If array can't be split evenly, the final chunk will be the remaining elements.
|
|
4
|
+
* Drop-in replacement for lodash/chunk.
|
|
5
|
+
*/
|
|
6
|
+
export default function chunk<T>(array: T[], size?: number): T[][];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of elements split into groups the length of size.
|
|
3
|
+
* If array can't be split evenly, the final chunk will be the remaining elements.
|
|
4
|
+
* Drop-in replacement for lodash/chunk.
|
|
5
|
+
*/
|
|
6
|
+
export default function chunk(array, size = 1) {
|
|
7
|
+
const length = array.length;
|
|
8
|
+
if (!length || !(size >= 1)) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const chunkSize = Math.floor(size);
|
|
12
|
+
const result = [];
|
|
13
|
+
for (let i = 0; i < length; i += chunkSize) {
|
|
14
|
+
result.push(array.slice(i, i + chunkSize));
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This method is like `cloneDeep` except that it accepts customizer which
|
|
3
|
+
* is invoked to produce the cloned value. If customizer returns undefined,
|
|
4
|
+
* cloning is handled by the method instead.
|
|
5
|
+
* Drop-in replacement for lodash/cloneDeepWith.
|
|
6
|
+
*/
|
|
7
|
+
type CloneCustomizer = (value: any) => any;
|
|
8
|
+
export default function cloneDeepWith<T>(value: T, customizer: CloneCustomizer): T;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This method is like `cloneDeep` except that it accepts customizer which
|
|
3
|
+
* is invoked to produce the cloned value. If customizer returns undefined,
|
|
4
|
+
* cloning is handled by the method instead.
|
|
5
|
+
* Drop-in replacement for lodash/cloneDeepWith.
|
|
6
|
+
*/
|
|
7
|
+
function baseCloneDeep(value, customizer, seen) {
|
|
8
|
+
// Invoke customizer first
|
|
9
|
+
const customResult = customizer(value);
|
|
10
|
+
if (customResult !== undefined) {
|
|
11
|
+
return customResult;
|
|
12
|
+
}
|
|
13
|
+
// Primitives
|
|
14
|
+
if (value === null || typeof value !== 'object') {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
// Circular reference detection
|
|
18
|
+
if (seen.has(value)) {
|
|
19
|
+
return seen.get(value);
|
|
20
|
+
}
|
|
21
|
+
// Date
|
|
22
|
+
if (value instanceof Date) {
|
|
23
|
+
return new Date(value.getTime());
|
|
24
|
+
}
|
|
25
|
+
// RegExp
|
|
26
|
+
if (value instanceof RegExp) {
|
|
27
|
+
return new RegExp(value.source, value.flags);
|
|
28
|
+
}
|
|
29
|
+
// Map
|
|
30
|
+
if (value instanceof Map) {
|
|
31
|
+
const cloned = new Map();
|
|
32
|
+
seen.set(value, cloned);
|
|
33
|
+
value.forEach((v, k) => {
|
|
34
|
+
cloned.set(baseCloneDeep(k, customizer, seen), baseCloneDeep(v, customizer, seen));
|
|
35
|
+
});
|
|
36
|
+
return cloned;
|
|
37
|
+
}
|
|
38
|
+
// Set
|
|
39
|
+
if (value instanceof Set) {
|
|
40
|
+
const cloned = new Set();
|
|
41
|
+
seen.set(value, cloned);
|
|
42
|
+
value.forEach((v) => {
|
|
43
|
+
cloned.add(baseCloneDeep(v, customizer, seen));
|
|
44
|
+
});
|
|
45
|
+
return cloned;
|
|
46
|
+
}
|
|
47
|
+
// Arrays
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
const cloned = [];
|
|
50
|
+
seen.set(value, cloned);
|
|
51
|
+
for (let i = 0; i < value.length; i++) {
|
|
52
|
+
cloned[i] = baseCloneDeep(value[i], customizer, seen);
|
|
53
|
+
}
|
|
54
|
+
return cloned;
|
|
55
|
+
}
|
|
56
|
+
// Plain objects and others
|
|
57
|
+
const cloned = Object.create(Object.getPrototypeOf(value));
|
|
58
|
+
seen.set(value, cloned);
|
|
59
|
+
const keys = Object.keys(value);
|
|
60
|
+
for (const key of keys) {
|
|
61
|
+
cloned[key] = baseCloneDeep(value[key], customizer, seen);
|
|
62
|
+
}
|
|
63
|
+
return cloned;
|
|
64
|
+
}
|
|
65
|
+
export default function cloneDeepWith(value, customizer) {
|
|
66
|
+
return baseCloneDeep(value, customizer, new Map());
|
|
67
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a debounced function that delays invoking func until after wait
|
|
3
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4
|
+
* invoked. The debounced function comes with a cancel method to cancel
|
|
5
|
+
* delayed func invocations and a flush method to immediately invoke them.
|
|
6
|
+
*
|
|
7
|
+
* Supports options: { leading, trailing, maxWait }
|
|
8
|
+
* Drop-in replacement for lodash/debounce.
|
|
9
|
+
*/
|
|
10
|
+
export interface DebounceOptions {
|
|
11
|
+
leading?: boolean;
|
|
12
|
+
trailing?: boolean;
|
|
13
|
+
maxWait?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface DebouncedFunction<T extends (...args: any[]) => any> {
|
|
16
|
+
(...args: Parameters<T>): ReturnType<T> | undefined;
|
|
17
|
+
cancel(): void;
|
|
18
|
+
flush(): ReturnType<T> | undefined;
|
|
19
|
+
}
|
|
20
|
+
export default function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction<T>;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a debounced function that delays invoking func until after wait
|
|
3
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4
|
+
* invoked. The debounced function comes with a cancel method to cancel
|
|
5
|
+
* delayed func invocations and a flush method to immediately invoke them.
|
|
6
|
+
*
|
|
7
|
+
* Supports options: { leading, trailing, maxWait }
|
|
8
|
+
* Drop-in replacement for lodash/debounce.
|
|
9
|
+
*/
|
|
10
|
+
export default function debounce(func, wait = 0, options) {
|
|
11
|
+
let lastArgs;
|
|
12
|
+
let lastThis;
|
|
13
|
+
let result;
|
|
14
|
+
let timerId;
|
|
15
|
+
let lastCallTime;
|
|
16
|
+
let lastInvokeTime = 0;
|
|
17
|
+
const leading = options?.leading ?? false;
|
|
18
|
+
const trailing = options?.trailing ?? true;
|
|
19
|
+
const maxWait = options?.maxWait;
|
|
20
|
+
const hasMaxWait = maxWait !== undefined;
|
|
21
|
+
const maxing = hasMaxWait;
|
|
22
|
+
function invokeFunc(time) {
|
|
23
|
+
const args = lastArgs;
|
|
24
|
+
const thisArg = lastThis;
|
|
25
|
+
lastArgs = undefined;
|
|
26
|
+
lastThis = undefined;
|
|
27
|
+
lastInvokeTime = time;
|
|
28
|
+
result = func.apply(thisArg, args);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function startTimer(pendingFunc, waitMs) {
|
|
32
|
+
timerId = setTimeout(pendingFunc, waitMs);
|
|
33
|
+
}
|
|
34
|
+
function cancelTimer() {
|
|
35
|
+
if (timerId !== undefined) {
|
|
36
|
+
clearTimeout(timerId);
|
|
37
|
+
}
|
|
38
|
+
timerId = undefined;
|
|
39
|
+
}
|
|
40
|
+
function remainingWait(time) {
|
|
41
|
+
const timeSinceLastCall = time - (lastCallTime ?? 0);
|
|
42
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
43
|
+
const timeWaiting = wait - timeSinceLastCall;
|
|
44
|
+
return maxing
|
|
45
|
+
? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
46
|
+
: timeWaiting;
|
|
47
|
+
}
|
|
48
|
+
function shouldInvoke(time) {
|
|
49
|
+
const timeSinceLastCall = time - (lastCallTime ?? 0);
|
|
50
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
51
|
+
return (lastCallTime === undefined ||
|
|
52
|
+
timeSinceLastCall >= wait ||
|
|
53
|
+
timeSinceLastCall < 0 ||
|
|
54
|
+
(maxing && timeSinceLastInvoke >= maxWait));
|
|
55
|
+
}
|
|
56
|
+
function timerExpired() {
|
|
57
|
+
const time = Date.now();
|
|
58
|
+
if (shouldInvoke(time)) {
|
|
59
|
+
trailingEdge(time);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Restart the timer
|
|
63
|
+
startTimer(timerExpired, remainingWait(time));
|
|
64
|
+
}
|
|
65
|
+
function trailingEdge(time) {
|
|
66
|
+
timerId = undefined;
|
|
67
|
+
if (trailing && lastArgs) {
|
|
68
|
+
invokeFunc(time);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lastArgs = undefined;
|
|
72
|
+
lastThis = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function leadingEdge(time) {
|
|
76
|
+
lastInvokeTime = time;
|
|
77
|
+
startTimer(timerExpired, wait);
|
|
78
|
+
if (leading) {
|
|
79
|
+
invokeFunc(time);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function debounced(...args) {
|
|
83
|
+
const time = Date.now();
|
|
84
|
+
const isInvoking = shouldInvoke(time);
|
|
85
|
+
lastArgs = args;
|
|
86
|
+
lastThis = this;
|
|
87
|
+
lastCallTime = time;
|
|
88
|
+
if (isInvoking) {
|
|
89
|
+
if (timerId === undefined) {
|
|
90
|
+
leadingEdge(time);
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
if (maxing) {
|
|
94
|
+
// Handle invocations in a tight loop with maxWait
|
|
95
|
+
cancelTimer();
|
|
96
|
+
startTimer(timerExpired, wait);
|
|
97
|
+
invokeFunc(time);
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (timerId === undefined) {
|
|
102
|
+
startTimer(timerExpired, wait);
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
debounced.cancel = function cancel() {
|
|
107
|
+
cancelTimer();
|
|
108
|
+
lastInvokeTime = 0;
|
|
109
|
+
lastArgs = undefined;
|
|
110
|
+
lastCallTime = undefined;
|
|
111
|
+
lastThis = undefined;
|
|
112
|
+
};
|
|
113
|
+
debounced.flush = function flush() {
|
|
114
|
+
if (timerId === undefined) {
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
trailingEdge(Date.now());
|
|
118
|
+
return result;
|
|
119
|
+
};
|
|
120
|
+
return debounced;
|
|
121
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the value at path of object. If the resolved value is undefined,
|
|
3
|
+
* the defaultValue is returned in its place.
|
|
4
|
+
* Drop-in replacement for lodash/get.
|
|
5
|
+
*/
|
|
6
|
+
const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
7
|
+
function toPath(path) {
|
|
8
|
+
if (Array.isArray(path)) {
|
|
9
|
+
return path;
|
|
10
|
+
}
|
|
11
|
+
const result = [];
|
|
12
|
+
const str = String(path);
|
|
13
|
+
str.replace(rePropName, (match, number, quote, subString) => {
|
|
14
|
+
result.push(quote ? subString.replace(/\\(\\)?/g, '$1') : number || match);
|
|
15
|
+
return match;
|
|
16
|
+
});
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
export default function get(object, path, defaultValue) {
|
|
20
|
+
if (typeof path === 'string' && path === '') {
|
|
21
|
+
return defaultValue;
|
|
22
|
+
}
|
|
23
|
+
const keys = toPath(path);
|
|
24
|
+
if (keys.length === 0) {
|
|
25
|
+
return defaultValue;
|
|
26
|
+
}
|
|
27
|
+
let result = object;
|
|
28
|
+
for (const key of keys) {
|
|
29
|
+
if (result == null) {
|
|
30
|
+
return defaultValue;
|
|
31
|
+
}
|
|
32
|
+
result = result[key];
|
|
33
|
+
}
|
|
34
|
+
return result === undefined ? defaultValue : result;
|
|
35
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as chunk } from './chunk';
|
|
2
|
+
export { default as clamp } from './clamp';
|
|
3
|
+
export { default as cloneDeepWith } from './cloneDeepWith';
|
|
4
|
+
export { default as debounce } from './debounce';
|
|
5
|
+
export { default as flatten } from './flatten';
|
|
6
|
+
export { default as flattenDeep } from './flattenDeep';
|
|
7
|
+
export { default as get } from './get';
|
|
8
|
+
export { default as isArray } from './isArray';
|
|
9
|
+
export { default as isEqual } from './isEqual';
|
|
10
|
+
export { default as isObject } from './isObject';
|
|
11
|
+
export { default as isPlainObject } from './isPlainObject';
|
|
12
|
+
export { default as kebabCase } from './kebabCase';
|
|
13
|
+
export { default as merge } from './merge';
|
|
14
|
+
export { default as mergeWith } from './mergeWith';
|
|
15
|
+
export { default as orderBy } from './orderBy';
|
|
16
|
+
export { default as parseInt } from './parseInt';
|
|
17
|
+
export { default as sentenceCase } from './sentenceCase';
|
|
18
|
+
export { default as startCase } from './startCase';
|
|
19
|
+
export { default as throttle } from './throttle';
|
|
20
|
+
export { default as toNumber } from './toNumber';
|
|
21
|
+
export { default as uniq } from './uniq';
|
|
22
|
+
export { default as uniqBy } from './uniqBy';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { default as chunk } from './chunk';
|
|
2
|
+
export { default as clamp } from './clamp';
|
|
3
|
+
export { default as cloneDeepWith } from './cloneDeepWith';
|
|
4
|
+
export { default as debounce } from './debounce';
|
|
5
|
+
export { default as flatten } from './flatten';
|
|
6
|
+
export { default as flattenDeep } from './flattenDeep';
|
|
7
|
+
export { default as get } from './get';
|
|
8
|
+
export { default as isArray } from './isArray';
|
|
9
|
+
export { default as isEqual } from './isEqual';
|
|
10
|
+
export { default as isObject } from './isObject';
|
|
11
|
+
export { default as isPlainObject } from './isPlainObject';
|
|
12
|
+
export { default as kebabCase } from './kebabCase';
|
|
13
|
+
export { default as merge } from './merge';
|
|
14
|
+
export { default as mergeWith } from './mergeWith';
|
|
15
|
+
export { default as orderBy } from './orderBy';
|
|
16
|
+
export { default as parseInt } from './parseInt';
|
|
17
|
+
export { default as sentenceCase } from './sentenceCase';
|
|
18
|
+
export { default as startCase } from './startCase';
|
|
19
|
+
export { default as throttle } from './throttle';
|
|
20
|
+
export { default as toNumber } from './toNumber';
|
|
21
|
+
export { default as uniq } from './uniq';
|
|
22
|
+
export { default as uniqBy } from './uniqBy';
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performs a deep comparison between two values to determine if they are equivalent.
|
|
3
|
+
* Drop-in replacement for lodash/isEqual.
|
|
4
|
+
*/
|
|
5
|
+
function baseIsEqual(a, b, seen) {
|
|
6
|
+
// Identical references or primitives
|
|
7
|
+
if (a === b) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
// NaN check
|
|
11
|
+
if (a !== a && b !== b) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
// Null/undefined/primitive mismatch
|
|
15
|
+
if (a == null || b == null) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const typeA = typeof a;
|
|
19
|
+
const typeB = typeof b;
|
|
20
|
+
if (typeA !== typeB) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (typeA !== 'object') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
// Date
|
|
27
|
+
if (a instanceof Date && b instanceof Date) {
|
|
28
|
+
return a.getTime() === b.getTime();
|
|
29
|
+
}
|
|
30
|
+
// RegExp
|
|
31
|
+
if (a instanceof RegExp && b instanceof RegExp) {
|
|
32
|
+
return a.source === b.source && a.flags === b.flags;
|
|
33
|
+
}
|
|
34
|
+
// One is Date/RegExp but the other is not
|
|
35
|
+
if (a instanceof Date !== b instanceof Date) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
if (a instanceof RegExp !== b instanceof RegExp) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Circular reference detection
|
|
42
|
+
if (seen.has(a)) {
|
|
43
|
+
return seen.get(a) === b;
|
|
44
|
+
}
|
|
45
|
+
seen.set(a, b);
|
|
46
|
+
// Arrays
|
|
47
|
+
if (Array.isArray(a)) {
|
|
48
|
+
if (!Array.isArray(b) || a.length !== b.length) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
for (let i = 0; i < a.length; i++) {
|
|
52
|
+
if (!baseIsEqual(a[i], b[i], seen)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(b)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
// Map
|
|
62
|
+
if (a instanceof Map && b instanceof Map) {
|
|
63
|
+
if (a.size !== b.size) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
for (const [key, val] of a) {
|
|
67
|
+
if (!b.has(key) || !baseIsEqual(val, b.get(key), seen)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
// Set (unordered deep comparison, matching lodash behavior)
|
|
74
|
+
if (a instanceof Set && b instanceof Set) {
|
|
75
|
+
if (a.size !== b.size) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
for (const valA of a) {
|
|
79
|
+
let found = false;
|
|
80
|
+
for (const valB of b) {
|
|
81
|
+
if (baseIsEqual(valA, valB, new Map(seen))) {
|
|
82
|
+
found = true;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!found) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
// ArrayBuffer / TypedArray
|
|
93
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
94
|
+
const viewA = a;
|
|
95
|
+
const viewB = b;
|
|
96
|
+
if (viewA.length !== viewB.length) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
for (let i = 0; i < viewA.length; i++) {
|
|
100
|
+
if (viewA[i] !== viewB[i]) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
// Plain objects
|
|
107
|
+
const keysA = Object.keys(a);
|
|
108
|
+
const keysB = Object.keys(b);
|
|
109
|
+
if (keysA.length !== keysB.length) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
for (const key of keysA) {
|
|
113
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (!baseIsEqual(a[key], b[key], seen)) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
export default function isEqual(value, other) {
|
|
123
|
+
return baseIsEqual(value, other, new Map());
|
|
124
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is the language type of Object.
|
|
3
|
+
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
|
4
|
+
* Drop-in replacement for lodash/isObject.
|
|
5
|
+
*/
|
|
6
|
+
export default function isObject(value) {
|
|
7
|
+
const type = typeof value;
|
|
8
|
+
return value != null && (type === 'object' || type === 'function');
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is a plain object, that is, an object created by the
|
|
3
|
+
* Object constructor or one with a [[Prototype]] of null.
|
|
4
|
+
* Drop-in replacement for lodash/isPlainObject.
|
|
5
|
+
*/
|
|
6
|
+
export default function isPlainObject(value: any): value is Record<string, any>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if value is a plain object, that is, an object created by the
|
|
3
|
+
* Object constructor or one with a [[Prototype]] of null.
|
|
4
|
+
* Drop-in replacement for lodash/isPlainObject.
|
|
5
|
+
*/
|
|
6
|
+
export default function isPlainObject(value) {
|
|
7
|
+
if (value === null || value === undefined || typeof value !== 'object') {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const proto = Object.getPrototypeOf(value);
|
|
11
|
+
// Object.create(null)
|
|
12
|
+
if (proto === null) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
// Normal plain objects
|
|
16
|
+
return proto === Object.prototype;
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively merges own enumerable string keyed properties of source objects into
|
|
3
|
+
* the destination object. Source properties that resolve to undefined are skipped if
|
|
4
|
+
* a destination value exists. Array and plain object properties are merged recursively.
|
|
5
|
+
* Other objects and value types are overridden by assignment.
|
|
6
|
+
* Drop-in replacement for lodash/merge.
|
|
7
|
+
*/
|
|
8
|
+
export default function merge<TObject, TSource1>(object: TObject, source1: TSource1): TObject & TSource1;
|
|
9
|
+
export default function merge<TObject, TSource1, TSource2>(object: TObject, source1: TSource1, source2: TSource2): TObject & TSource1 & TSource2;
|
|
10
|
+
export default function merge<TObject, TSource1, TSource2, TSource3>(object: TObject, source1: TSource1, source2: TSource2, source3: TSource3): TObject & TSource1 & TSource2 & TSource3;
|
|
11
|
+
export default function merge(target: any, ...sources: any[]): any;
|