@adaptabletools/adaptable 22.0.0-canary.9 → 22.0.1-canary.0
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 +1157 -1319
- package/index.css.map +1 -1
- package/index.d.ts +8 -8
- package/index.js +8 -8
- package/package.json +1 -4
- package/src/AdaptableInterfaces/IAdaptable.d.ts +1 -0
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +3 -3
- package/src/AdaptableState/Common/AdaptableForm.d.ts +1 -1
- package/src/AdaptableState/Common/AggregationColumns.d.ts +1 -0
- package/src/AdaptableState/Common/AggregationColumns.js +1 -0
- package/src/AdaptableState/Common/DataUpdateConfig.d.ts +15 -5
- package/src/AdaptableState/Common/TransposeConfig.d.ts +4 -9
- package/src/AdaptableState/InitialState.d.ts +1 -1
- package/src/AdaptableState/UserInterfaceState.d.ts +1 -1
- package/src/Api/ColumnApi.d.ts +1 -1
- package/src/Api/GridApi.d.ts +8 -0
- package/src/Api/Implementation/ApiBase.d.ts +1 -1
- package/src/Api/Implementation/ApiBase.js +1 -1
- package/src/Api/Implementation/ColumnApiImpl.d.ts +1 -1
- package/src/Api/Implementation/ColumnApiImpl.js +4 -4
- package/src/Api/Implementation/GridApiImpl.d.ts +2 -0
- package/src/Api/Implementation/GridApiImpl.js +9 -5
- package/src/Api/Implementation/LayoutHelpers.js +1 -1
- package/src/Api/Implementation/RowFormApiImpl.d.ts +1 -0
- package/src/Api/Implementation/RowFormApiImpl.js +13 -0
- package/src/Api/Internal/ActionColumnInternalApi.js +2 -19
- package/src/Api/Internal/ColumnInternalApi.d.ts +1 -1
- package/src/Api/Internal/ColumnInternalApi.js +5 -3
- package/src/Api/Internal/EventInternalApi.js +1 -1
- package/src/Api/Internal/ExportInternalApi.js +1 -1
- package/src/Api/RowFormApi.d.ts +5 -0
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +1 -1
- package/src/Redux/Store/AdaptableReduxMerger.js +5 -6
- package/src/Strategy/CellSummaryModule.d.ts +1 -0
- package/src/Strategy/CellSummaryModule.js +3 -0
- package/src/Strategy/FormatColumnModule.js +2 -2
- package/src/Strategy/LayoutModule.js +23 -19
- package/src/Strategy/PlusMinusModule.d.ts +1 -0
- package/src/Strategy/PlusMinusModule.js +8 -2
- package/src/Strategy/StyledColumnModule.js +14 -6
- package/src/Strategy/TeamSharingModule.js +2 -2
- package/src/Strategy/Utilities/FormatColumn/{getFormatColumnSettingsTargetItems.d.ts → getFormatColumnRowTargetItems.d.ts} +1 -1
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnRowTargetItems.js +22 -0
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +5 -13
- package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +1 -1
- package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.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/Hooks/index.d.ts +1 -2
- package/src/Utilities/Hooks/index.js +1 -2
- 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/getScopeViewItems.js +1 -1
- package/src/Utilities/only.d.ts +18 -0
- package/src/Utilities/only.js +40 -0
- 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.d.ts +11 -0
- package/src/Utilities/weightedAverage.js +60 -46
- 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/Selectors/PermittedValuesSelector.js +1 -1
- package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
- package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
- package/src/View/Components/ValueSelector/index.js +7 -2
- package/src/View/Dashboard/CustomDashboardButton.js +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/Dashboard/DashboardPopup.js +4 -3
- package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +1 -1
- package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
- package/src/View/Export/Wizard/NewReportWizard.js +8 -8
- package/src/View/Filter/FilterViewPanel.d.ts +1 -1
- package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +19 -10
- package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +1 -1
- package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +2 -2
- package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.d.ts +8 -0
- package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.js +80 -0
- package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +22 -61
- package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +22 -8
- package/src/View/GridFilter/GridFilterViewPanel.js +3 -3
- package/src/View/Layout/LayoutViewPanel.js +1 -1
- package/src/View/Layout/TransposedPopup.js +0 -1
- package/src/View/Layout/Wizard/sections/ColumnsSection.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/StyledColumn/Wizard/StyledColumnBadgeRowsSection.d.ts +8 -0
- package/src/View/StyledColumn/Wizard/{StyledColumnWizardSettingsSection.js → StyledColumnBadgeRowsSection.js} +19 -19
- package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +10 -11
- 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/View/Wizard/OnePageWizards.js +1 -1
- package/src/agGrid/AdaptableAgGrid.d.ts +1 -0
- package/src/agGrid/AdaptableAgGrid.js +29 -7
- package/src/agGrid/AgGridAdapter.js +4 -4
- package/src/agGrid/AgGridColumnAdapter.js +11 -4
- package/src/agGrid/AgGridExportAdapter.d.ts +2 -2
- package/src/agGrid/AgGridExportAdapter.js +7 -6
- package/src/agGrid/cellRenderers/PercentBarRenderer.js +17 -5
- package/src/components/ColorPicker/ColorPicker.js +1 -1
- package/src/components/DropdownButton/renderItem.js +1 -1
- package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +1 -1
- package/src/components/FormLayout/index.js +1 -1
- package/src/components/OverlayTrigger/index.js +1 -1
- package/src/components/Select/Select.js +4 -0
- package/src/env.js +2 -2
- package/src/layout-manager/src/isLayoutEqual.js +1 -1
- package/src/metamodel/adaptable.metamodel.d.ts +12 -1
- package/src/metamodel/adaptable.metamodel.js +1 -1
- package/src/migration/VersionUpgrade22.js +9 -0
- package/themes/dark.css +2 -3
- package/themes/light.css +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsTargetItems.js +0 -12
- package/src/Utilities/Hooks/useAdaptableState.d.ts +0 -3
- package/src/Utilities/Hooks/useAdaptableState.js +0 -39
- package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.d.ts +0 -8
- package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.js +0 -31
- package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.d.ts +0 -8
- /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.d.ts → FormatColumnColumnScopeWizardSection.d.ts} +0 -0
- /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.js → FormatColumnColumnScopeWizardSection.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// TODO inspect why the following is erroring on angular build
|
|
2
2
|
import { format as dateFnsFormat } from 'date-fns';
|
|
3
|
-
import
|
|
3
|
+
import sentenceCase from '../utils/sentenceCase';
|
|
4
4
|
import { DEFAULT_DATE_FORMAT_PATTERN } from '../Constants/GeneralConstants';
|
|
5
5
|
import Helper from './Helper';
|
|
6
6
|
import StringExtensions from '../Extensions/StringExtensions';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { useAdaptableColumn } from './useAdaptableColumn';
|
|
2
2
|
import { useAdaptableOptions } from './useAdaptableOptions';
|
|
3
|
-
|
|
4
|
-
export { useAdaptableColumn, useAdaptableOptions, useAdaptableState };
|
|
3
|
+
export { useAdaptableColumn, useAdaptableOptions };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { useAdaptableColumn } from './useAdaptableColumn';
|
|
2
2
|
import { useAdaptableOptions } from './useAdaptableOptions';
|
|
3
|
-
|
|
4
|
-
export { useAdaptableColumn, useAdaptableOptions, useAdaptableState };
|
|
3
|
+
export { useAdaptableColumn, useAdaptableOptions };
|
|
@@ -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,18 @@
|
|
|
1
|
+
import { IAggFuncParams } from 'ag-grid-enterprise';
|
|
2
|
+
interface OnlyAggResult {
|
|
3
|
+
distinctValues: Set<number | string>;
|
|
4
|
+
value: number | string | null;
|
|
5
|
+
toString(): string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* AG Grid aggFunc that returns the column value only when all rows in the group
|
|
9
|
+
* share the same value. Returns null when values differ (or when there are no values).
|
|
10
|
+
*
|
|
11
|
+
* params.values already respects suppressAggFilteredOnly, containing either:
|
|
12
|
+
* - Raw cell values (string | number) for leaf children
|
|
13
|
+
* - OnlyAggResult objects for sub-group children (with pre-computed distinct values)
|
|
14
|
+
*
|
|
15
|
+
* Bails out early as soon as two distinct values are found.
|
|
16
|
+
*/
|
|
17
|
+
export declare const only: (params: IAggFuncParams) => OnlyAggResult;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
function createOnlyResult(distinctValues) {
|
|
2
|
+
const value = distinctValues.size === 1 ? distinctValues.values().next().value : null;
|
|
3
|
+
return {
|
|
4
|
+
distinctValues,
|
|
5
|
+
value,
|
|
6
|
+
toString() {
|
|
7
|
+
return value != null ? String(value) : '';
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* AG Grid aggFunc that returns the column value only when all rows in the group
|
|
13
|
+
* share the same value. Returns null when values differ (or when there are no values).
|
|
14
|
+
*
|
|
15
|
+
* params.values already respects suppressAggFilteredOnly, containing either:
|
|
16
|
+
* - Raw cell values (string | number) for leaf children
|
|
17
|
+
* - OnlyAggResult objects for sub-group children (with pre-computed distinct values)
|
|
18
|
+
*
|
|
19
|
+
* Bails out early as soon as two distinct values are found.
|
|
20
|
+
*/
|
|
21
|
+
export const only = (params) => {
|
|
22
|
+
const { values } = params;
|
|
23
|
+
const distinctValues = new Set();
|
|
24
|
+
for (let i = 0; i < values.length; i++) {
|
|
25
|
+
const value = values[i];
|
|
26
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
27
|
+
distinctValues.add(value);
|
|
28
|
+
}
|
|
29
|
+
else if (value != null && typeof value === 'object' && 'distinctValues' in value) {
|
|
30
|
+
// sub-group: merge pre-computed distinct values (set has at most 2 elements)
|
|
31
|
+
for (const v of value.distinctValues) {
|
|
32
|
+
distinctValues.add(v);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (distinctValues.size > 1) {
|
|
36
|
+
return createOnlyResult(distinctValues);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return createOnlyResult(distinctValues);
|
|
40
|
+
};
|
|
@@ -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';
|