@adaptabletools/adaptable-cjs 22.0.0-canary.8 → 22.0.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.
Files changed (172) hide show
  1. package/agGrid.d.ts +9 -9
  2. package/agGrid.js +1 -0
  3. package/index.css +1157 -1319
  4. package/index.css.map +1 -1
  5. package/index.d.ts +66 -0
  6. package/index.js +85 -0
  7. package/package.json +3 -6
  8. package/src/AdaptableOptions/ColumnOptions.d.ts +2 -2
  9. package/src/AdaptableOptions/UserInterfaceOptions.d.ts +2 -2
  10. package/src/AdaptableState/Common/AdaptableColumn.d.ts +13 -13
  11. package/src/AdaptableState/Common/AdaptableForm.d.ts +1 -1
  12. package/src/AdaptableState/Common/AggregationColumns.d.ts +1 -0
  13. package/src/AdaptableState/Common/AggregationColumns.js +2 -1
  14. package/src/AdaptableState/Common/DataUpdateConfig.d.ts +15 -5
  15. package/src/AdaptableState/Common/TransposeConfig.d.ts +4 -9
  16. package/src/AdaptableState/InitialState.d.ts +1 -1
  17. package/src/AdaptableState/UserInterfaceState.d.ts +1 -1
  18. package/src/Api/ColumnApi.d.ts +1 -1
  19. package/src/Api/GridApi.d.ts +4 -0
  20. package/src/Api/Implementation/ApiBase.d.ts +1 -1
  21. package/src/Api/Implementation/ApiBase.js +1 -1
  22. package/src/Api/Implementation/ColumnApiImpl.d.ts +2 -2
  23. package/src/Api/Implementation/ColumnApiImpl.js +4 -4
  24. package/src/Api/Implementation/GridApiImpl.d.ts +1 -0
  25. package/src/Api/Implementation/GridApiImpl.js +6 -5
  26. package/src/Api/Implementation/LayoutHelpers.js +1 -1
  27. package/src/Api/Internal/ColumnInternalApi.d.ts +1 -1
  28. package/src/Api/Internal/ColumnInternalApi.js +5 -3
  29. package/src/Api/Internal/EventInternalApi.js +1 -1
  30. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +1 -1
  31. package/src/Redux/Store/AdaptableReduxMerger.js +5 -6
  32. package/src/Strategy/FormatColumnModule.js +2 -2
  33. package/src/Strategy/LayoutModule.js +1 -1
  34. package/src/Strategy/StyledColumnModule.js +14 -6
  35. package/src/Strategy/TeamSharingModule.js +2 -2
  36. package/src/Strategy/Utilities/FormatColumn/{getFormatColumnSettingsTargetItems.d.ts → getFormatColumnRowTargetItems.d.ts} +1 -1
  37. package/src/Strategy/Utilities/FormatColumn/getFormatColumnRowTargetItems.js +26 -0
  38. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +5 -13
  39. package/src/Utilities/ExpressionFunctions/aggregatedBooleanExpressionFunctions.js +1 -1
  40. package/src/Utilities/ExpressionFunctions/aggregatedScalarExpressionFunctions.js +1 -1
  41. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.js +1 -1
  42. package/src/Utilities/ExpressionFunctions/observableExpressionFunctions.js +1 -1
  43. package/src/Utilities/Extensions/StringExtensions.js +1 -1
  44. package/src/Utilities/Helpers/AdaptableHelper.js +2 -2
  45. package/src/Utilities/Helpers/FormatHelper.js +2 -2
  46. package/src/Utilities/Hooks/index.d.ts +1 -2
  47. package/src/Utilities/Hooks/index.js +1 -3
  48. package/src/Utilities/Services/LicenseService/index.js +1 -1
  49. package/src/Utilities/Services/RowSummaryService.d.ts +1 -1
  50. package/src/Utilities/Services/RowSummaryService.js +2 -2
  51. package/src/Utilities/getScopeViewItems.js +1 -1
  52. package/src/Utilities/only.d.ts +15 -0
  53. package/src/Utilities/only.js +58 -0
  54. package/src/Utilities/utils/chunk.d.ts +6 -0
  55. package/src/Utilities/utils/chunk.js +20 -0
  56. package/src/Utilities/utils/clamp.d.ts +5 -0
  57. package/src/Utilities/utils/clamp.js +10 -0
  58. package/src/Utilities/utils/cloneDeepWith.d.ts +9 -0
  59. package/src/Utilities/utils/cloneDeepWith.js +70 -0
  60. package/src/Utilities/utils/debounce.d.ts +20 -0
  61. package/src/Utilities/utils/debounce.js +124 -0
  62. package/src/Utilities/utils/flatten.d.ts +5 -0
  63. package/src/Utilities/utils/flatten.js +10 -0
  64. package/src/Utilities/utils/flattenDeep.d.ts +5 -0
  65. package/src/Utilities/utils/flattenDeep.js +10 -0
  66. package/src/Utilities/utils/get.d.ts +6 -0
  67. package/src/Utilities/utils/get.js +38 -0
  68. package/src/Utilities/utils/index.d.ts +22 -0
  69. package/src/Utilities/utils/index.js +48 -0
  70. package/src/Utilities/utils/isArray.d.ts +6 -0
  71. package/src/Utilities/utils/isArray.js +8 -0
  72. package/src/Utilities/utils/isEqual.d.ts +5 -0
  73. package/src/Utilities/utils/isEqual.js +127 -0
  74. package/src/Utilities/utils/isObject.d.ts +6 -0
  75. package/src/Utilities/utils/isObject.js +12 -0
  76. package/src/Utilities/utils/isPlainObject.d.ts +6 -0
  77. package/src/Utilities/utils/isPlainObject.js +20 -0
  78. package/src/Utilities/utils/kebabCase.d.ts +5 -0
  79. package/src/Utilities/utils/kebabCase.js +12 -0
  80. package/src/Utilities/utils/merge.d.ts +11 -0
  81. package/src/Utilities/utils/merge.js +44 -0
  82. package/src/Utilities/utils/mergeWith.d.ts +7 -0
  83. package/src/Utilities/utils/mergeWith.js +50 -0
  84. package/src/Utilities/utils/orderBy.d.ts +8 -0
  85. package/src/Utilities/utils/orderBy.js +33 -0
  86. package/src/Utilities/utils/parseInt.d.ts +6 -0
  87. package/src/Utilities/utils/parseInt.js +12 -0
  88. package/src/Utilities/utils/sentenceCase.d.ts +6 -0
  89. package/src/Utilities/utils/sentenceCase.js +19 -0
  90. package/src/Utilities/utils/startCase.d.ts +5 -0
  91. package/src/Utilities/utils/startCase.js +15 -0
  92. package/src/Utilities/utils/throttle.d.ts +17 -0
  93. package/src/Utilities/utils/throttle.js +23 -0
  94. package/src/Utilities/utils/toNumber.d.ts +5 -0
  95. package/src/Utilities/utils/toNumber.js +42 -0
  96. package/src/Utilities/utils/uniq.d.ts +7 -0
  97. package/src/Utilities/utils/uniq.js +12 -0
  98. package/src/Utilities/utils/uniqBy.d.ts +8 -0
  99. package/src/Utilities/utils/uniqBy.js +25 -0
  100. package/src/Utilities/utils/words.d.ts +7 -0
  101. package/src/Utilities/utils/words.js +13 -0
  102. package/src/Utilities/weightedAverage.js +1 -1
  103. package/src/View/AdaptableComputedCSSVarsContext.js +1 -1
  104. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +1 -1
  105. package/src/View/Alert/Wizard/AlertButtonsEditor.js +2 -2
  106. package/src/View/Charting/ChartingWizard/AgChargingWizard/PreviewChartSection.js +1 -1
  107. package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +1 -1
  108. package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +2 -2
  109. package/src/View/Components/ColumnFilter/components/FloatingFilterInputList.js +2 -2
  110. package/src/View/Components/RangesComponent.js +1 -1
  111. package/src/View/Components/Selectors/PermittedValuesSelector.js +1 -1
  112. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +1 -1
  113. package/src/View/Components/ToolPanel/CustomToolPanelContent.js +1 -1
  114. package/src/View/Components/ValueSelector/index.js +7 -2
  115. package/src/View/Dashboard/CustomDashboardButton.js +1 -1
  116. package/src/View/Dashboard/Dashboard.js +1 -1
  117. package/src/View/Dashboard/DashboardPopup.js +4 -3
  118. package/src/View/DataImport/DataImportWizard/sections/DataPreview.js +1 -1
  119. package/src/View/DataSet/DataSetViewPanel.d.ts +1 -1
  120. package/src/View/Export/Wizard/NewReportWizard.js +8 -8
  121. package/src/View/Filter/FilterViewPanel.d.ts +1 -1
  122. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +19 -10
  123. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +1 -1
  124. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +2 -2
  125. package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.d.ts +8 -0
  126. package/src/View/FormatColumn/Wizard/FormatColumnRowScopeWizardSection.js +86 -0
  127. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +22 -61
  128. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +22 -10
  129. package/src/View/GridFilter/GridFilterViewPanel.js +3 -3
  130. package/src/View/Layout/LayoutViewPanel.js +1 -1
  131. package/src/View/Layout/TransposedPopup.js +0 -1
  132. package/src/View/Layout/Wizard/sections/ColumnsSection.js +1 -1
  133. package/src/View/Note/NoteEditor.js +1 -1
  134. package/src/View/QuickSearch/useQuickSearchDebounced.js +1 -1
  135. package/src/View/SpecialColumnSettingsWizardStep.js +1 -1
  136. package/src/View/StyledColumn/Wizard/StyledColumnBadgeRowsSection.d.ts +8 -0
  137. package/src/View/StyledColumn/Wizard/{StyledColumnWizardSettingsSection.js → StyledColumnBadgeRowsSection.js} +22 -22
  138. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +10 -11
  139. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +1 -1
  140. package/src/View/Theme/ThemeEditor.js +1 -1
  141. package/src/View/Theme/ThemeField.js +1 -1
  142. package/src/View/Wizard/OnePageAdaptableWizard.js +1 -1
  143. package/src/View/Wizard/OnePageWizards.js +1 -1
  144. package/src/agGrid/AdaptableAgGrid.js +25 -6
  145. package/src/agGrid/AgGridAdapter.js +4 -4
  146. package/src/agGrid/AgGridColumnAdapter.js +11 -4
  147. package/src/agGrid/AgGridExportAdapter.d.ts +2 -2
  148. package/src/agGrid/AgGridExportAdapter.js +7 -6
  149. package/src/agGrid/cellRenderers/PercentBarRenderer.js +17 -5
  150. package/src/components/ColorPicker/ColorPicker.js +1 -1
  151. package/src/components/DropdownButton/renderItem.js +1 -1
  152. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +1 -1
  153. package/src/components/FormLayout/index.js +1 -1
  154. package/src/components/OverlayTrigger/index.js +1 -1
  155. package/src/components/Select/Select.js +4 -0
  156. package/src/env.js +2 -2
  157. package/src/layout-manager/src/isLayoutEqual.js +1 -1
  158. package/src/metamodel/adaptable.metamodel.d.ts +12 -1
  159. package/src/metamodel/adaptable.metamodel.js +1 -1
  160. package/src/migration/VersionUpgrade22.js +9 -0
  161. package/src/types.d.ts +2 -2
  162. package/themes/dark.css +2 -3
  163. package/themes/light.css +1 -1
  164. package/tsconfig.cjs.tsbuildinfo +1 -1
  165. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsTargetItems.js +0 -16
  166. package/src/Utilities/Hooks/useAdaptableState.d.ts +0 -3
  167. package/src/Utilities/Hooks/useAdaptableState.js +0 -42
  168. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.d.ts +0 -8
  169. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.js +0 -37
  170. package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.d.ts +0 -8
  171. /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.d.ts → FormatColumnColumnScopeWizardSection.d.ts} +0 -0
  172. /package/src/View/FormatColumn/Wizard/{FormatColumnScopeWizardSection.js → FormatColumnColumnScopeWizardSection.js} +0 -0
@@ -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("lodash").DebouncedFuncLeading<(reason?: {
22
+ _throttledEvaluateRowSummary: import("../utils/debounce").DebouncedFunction<(reason?: {
23
23
  columnIds: string[];
24
24
  }) => void>;
25
25
  private evaluateRowSummary;
@@ -8,8 +8,8 @@ const ModuleConstants = tslib_1.__importStar(require("../../Utilities/Constants/
8
8
  const Helper_1 = tslib_1.__importDefault(require("../Helpers/Helper"));
9
9
  const AggregatedScalarLiveValue_1 = require("./AggregatedScalarLiveValue");
10
10
  const ObjectExtensions_1 = require("../Extensions/ObjectExtensions");
11
- const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
12
- const isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
11
+ const throttle_1 = tslib_1.__importDefault(require("../utils/throttle"));
12
+ const isEqual_1 = tslib_1.__importDefault(require("../utils/isEqual"));
13
13
  /**
14
14
  * The logic is extracted here to make it easier to follow
15
15
  */
@@ -21,7 +21,7 @@ const getScopeViewItems = (scope, api) => {
21
21
  values = scope.ColumnTypes;
22
22
  }
23
23
  return {
24
- label: 'Scope',
24
+ label: 'Columns',
25
25
  name: 'Target',
26
26
  values,
27
27
  };
@@ -0,0 +1,15 @@
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
+ * Supports multiple group levels: leaf groups aggregate raw cell values while
12
+ * parent groups merge the metadata objects returned by child groups.
13
+ */
14
+ export declare const only: (params: IAggFuncParams, columnId: string) => OnlyAggResult;
15
+ export {};
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.only = void 0;
4
+ function createOnlyResult(distinctValues) {
5
+ const value = distinctValues.size === 1 ? distinctValues.values().next().value : null;
6
+ return {
7
+ distinctValues,
8
+ value,
9
+ toString() {
10
+ return value != null ? String(value) : '';
11
+ },
12
+ };
13
+ }
14
+ /**
15
+ * AG Grid aggFunc that returns the column value only when all rows in the group
16
+ * share the same value. Returns null when values differ (or when there are no values).
17
+ *
18
+ * Supports multiple group levels: leaf groups aggregate raw cell values while
19
+ * parent groups merge the metadata objects returned by child groups.
20
+ */
21
+ const only = (params, columnId) => {
22
+ const { api: gridApi, rowNode: groupRowNode, values } = params;
23
+ // Leaf group: the lowest-level group whose children are actual data rows.
24
+ // We read raw cell values and collect distinct ones, bailing out early
25
+ // as soon as we see a second distinct value (the result would be null anyway).
26
+ if (groupRowNode.leafGroup) {
27
+ const filteredOnly = !gridApi.getGridOption('suppressAggFilteredOnly');
28
+ const childNodes = (filteredOnly ? groupRowNode.childrenAfterFilter : groupRowNode.childrenAfterGroup) ?? [];
29
+ const distinctValues = new Set();
30
+ for (const rowNode of childNodes) {
31
+ const rawValue = gridApi.getCellValue({ colKey: columnId, rowNode });
32
+ if (typeof rawValue === 'number' || typeof rawValue === 'string') {
33
+ distinctValues.add(rawValue);
34
+ if (distinctValues.size > 1) {
35
+ return createOnlyResult(distinctValues);
36
+ }
37
+ }
38
+ }
39
+ return createOnlyResult(distinctValues);
40
+ }
41
+ // Non-leaf group: children are other groups, not data rows.
42
+ // AG Grid has already called this aggFunc on each child group, so
43
+ // `params.values` contains the OnlyAggResult objects they returned.
44
+ // We merge their distinctValues sets instead of re-traversing leaf rows.
45
+ const mergedDistinctValues = new Set();
46
+ for (const childResult of values) {
47
+ if (childResult && typeof childResult === 'object' && 'distinctValues' in childResult) {
48
+ for (const val of childResult.distinctValues) {
49
+ mergedDistinctValues.add(val);
50
+ if (mergedDistinctValues.size > 1) {
51
+ return createOnlyResult(mergedDistinctValues);
52
+ }
53
+ }
54
+ }
55
+ }
56
+ return createOnlyResult(mergedDistinctValues);
57
+ };
58
+ exports.only = only;
@@ -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,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = chunk;
4
+ /**
5
+ * Creates an array of elements split into groups the length of size.
6
+ * If array can't be split evenly, the final chunk will be the remaining elements.
7
+ * Drop-in replacement for lodash/chunk.
8
+ */
9
+ function chunk(array, size = 1) {
10
+ const length = array.length;
11
+ if (!length || !(size >= 1)) {
12
+ return [];
13
+ }
14
+ const chunkSize = Math.floor(size);
15
+ const result = [];
16
+ for (let i = 0; i < length; i += chunkSize) {
17
+ result.push(array.slice(i, i + chunkSize));
18
+ }
19
+ return result;
20
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Clamps number within the inclusive lower and upper bounds.
3
+ * Drop-in replacement for lodash/clamp.
4
+ */
5
+ export default function clamp(number: number, lower: number, upper: number): number;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = clamp;
4
+ /**
5
+ * Clamps number within the inclusive lower and upper bounds.
6
+ * Drop-in replacement for lodash/clamp.
7
+ */
8
+ function clamp(number, lower, upper) {
9
+ return Math.min(Math.max(number, lower), upper);
10
+ }
@@ -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,70 @@
1
+ "use strict";
2
+ /**
3
+ * This method is like `cloneDeep` except that it accepts customizer which
4
+ * is invoked to produce the cloned value. If customizer returns undefined,
5
+ * cloning is handled by the method instead.
6
+ * Drop-in replacement for lodash/cloneDeepWith.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.default = cloneDeepWith;
10
+ function baseCloneDeep(value, customizer, seen) {
11
+ // Invoke customizer first
12
+ const customResult = customizer(value);
13
+ if (customResult !== undefined) {
14
+ return customResult;
15
+ }
16
+ // Primitives
17
+ if (value === null || typeof value !== 'object') {
18
+ return value;
19
+ }
20
+ // Circular reference detection
21
+ if (seen.has(value)) {
22
+ return seen.get(value);
23
+ }
24
+ // Date
25
+ if (value instanceof Date) {
26
+ return new Date(value.getTime());
27
+ }
28
+ // RegExp
29
+ if (value instanceof RegExp) {
30
+ return new RegExp(value.source, value.flags);
31
+ }
32
+ // Map
33
+ if (value instanceof Map) {
34
+ const cloned = new Map();
35
+ seen.set(value, cloned);
36
+ value.forEach((v, k) => {
37
+ cloned.set(baseCloneDeep(k, customizer, seen), baseCloneDeep(v, customizer, seen));
38
+ });
39
+ return cloned;
40
+ }
41
+ // Set
42
+ if (value instanceof Set) {
43
+ const cloned = new Set();
44
+ seen.set(value, cloned);
45
+ value.forEach((v) => {
46
+ cloned.add(baseCloneDeep(v, customizer, seen));
47
+ });
48
+ return cloned;
49
+ }
50
+ // Arrays
51
+ if (Array.isArray(value)) {
52
+ const cloned = [];
53
+ seen.set(value, cloned);
54
+ for (let i = 0; i < value.length; i++) {
55
+ cloned[i] = baseCloneDeep(value[i], customizer, seen);
56
+ }
57
+ return cloned;
58
+ }
59
+ // Plain objects and others
60
+ const cloned = Object.create(Object.getPrototypeOf(value));
61
+ seen.set(value, cloned);
62
+ const keys = Object.keys(value);
63
+ for (const key of keys) {
64
+ cloned[key] = baseCloneDeep(value[key], customizer, seen);
65
+ }
66
+ return cloned;
67
+ }
68
+ function cloneDeepWith(value, customizer) {
69
+ return baseCloneDeep(value, customizer, new Map());
70
+ }
@@ -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,124 @@
1
+ "use strict";
2
+ /**
3
+ * Creates a debounced function that delays invoking func until after wait
4
+ * milliseconds have elapsed since the last time the debounced function was
5
+ * invoked. The debounced function comes with a cancel method to cancel
6
+ * delayed func invocations and a flush method to immediately invoke them.
7
+ *
8
+ * Supports options: { leading, trailing, maxWait }
9
+ * Drop-in replacement for lodash/debounce.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.default = debounce;
13
+ function debounce(func, wait = 0, options) {
14
+ let lastArgs;
15
+ let lastThis;
16
+ let result;
17
+ let timerId;
18
+ let lastCallTime;
19
+ let lastInvokeTime = 0;
20
+ const leading = options?.leading ?? false;
21
+ const trailing = options?.trailing ?? true;
22
+ const maxWait = options?.maxWait;
23
+ const hasMaxWait = maxWait !== undefined;
24
+ const maxing = hasMaxWait;
25
+ function invokeFunc(time) {
26
+ const args = lastArgs;
27
+ const thisArg = lastThis;
28
+ lastArgs = undefined;
29
+ lastThis = undefined;
30
+ lastInvokeTime = time;
31
+ result = func.apply(thisArg, args);
32
+ return result;
33
+ }
34
+ function startTimer(pendingFunc, waitMs) {
35
+ timerId = setTimeout(pendingFunc, waitMs);
36
+ }
37
+ function cancelTimer() {
38
+ if (timerId !== undefined) {
39
+ clearTimeout(timerId);
40
+ }
41
+ timerId = undefined;
42
+ }
43
+ function remainingWait(time) {
44
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
45
+ const timeSinceLastInvoke = time - lastInvokeTime;
46
+ const timeWaiting = wait - timeSinceLastCall;
47
+ return maxing
48
+ ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke)
49
+ : timeWaiting;
50
+ }
51
+ function shouldInvoke(time) {
52
+ const timeSinceLastCall = time - (lastCallTime ?? 0);
53
+ const timeSinceLastInvoke = time - lastInvokeTime;
54
+ return (lastCallTime === undefined ||
55
+ timeSinceLastCall >= wait ||
56
+ timeSinceLastCall < 0 ||
57
+ (maxing && timeSinceLastInvoke >= maxWait));
58
+ }
59
+ function timerExpired() {
60
+ const time = Date.now();
61
+ if (shouldInvoke(time)) {
62
+ trailingEdge(time);
63
+ return;
64
+ }
65
+ // Restart the timer
66
+ startTimer(timerExpired, remainingWait(time));
67
+ }
68
+ function trailingEdge(time) {
69
+ timerId = undefined;
70
+ if (trailing && lastArgs) {
71
+ invokeFunc(time);
72
+ }
73
+ else {
74
+ lastArgs = undefined;
75
+ lastThis = undefined;
76
+ }
77
+ }
78
+ function leadingEdge(time) {
79
+ lastInvokeTime = time;
80
+ startTimer(timerExpired, wait);
81
+ if (leading) {
82
+ invokeFunc(time);
83
+ }
84
+ }
85
+ function debounced(...args) {
86
+ const time = Date.now();
87
+ const isInvoking = shouldInvoke(time);
88
+ lastArgs = args;
89
+ lastThis = this;
90
+ lastCallTime = time;
91
+ if (isInvoking) {
92
+ if (timerId === undefined) {
93
+ leadingEdge(time);
94
+ return result;
95
+ }
96
+ if (maxing) {
97
+ // Handle invocations in a tight loop with maxWait
98
+ cancelTimer();
99
+ startTimer(timerExpired, wait);
100
+ invokeFunc(time);
101
+ return result;
102
+ }
103
+ }
104
+ if (timerId === undefined) {
105
+ startTimer(timerExpired, wait);
106
+ }
107
+ return result;
108
+ }
109
+ debounced.cancel = function cancel() {
110
+ cancelTimer();
111
+ lastInvokeTime = 0;
112
+ lastArgs = undefined;
113
+ lastCallTime = undefined;
114
+ lastThis = undefined;
115
+ };
116
+ debounced.flush = function flush() {
117
+ if (timerId === undefined) {
118
+ return result;
119
+ }
120
+ trailingEdge(Date.now());
121
+ return result;
122
+ };
123
+ return debounced;
124
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Flattens array a single level deep.
3
+ * Drop-in replacement for lodash/flatten.
4
+ */
5
+ export default function flatten<T>(array: (T | T[])[]): T[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = flatten;
4
+ /**
5
+ * Flattens array a single level deep.
6
+ * Drop-in replacement for lodash/flatten.
7
+ */
8
+ function flatten(array) {
9
+ return array.flat();
10
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Recursively flattens array.
3
+ * Drop-in replacement for lodash/flattenDeep.
4
+ */
5
+ export default function flattenDeep<T>(array: any[]): T[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = flattenDeep;
4
+ /**
5
+ * Recursively flattens array.
6
+ * Drop-in replacement for lodash/flattenDeep.
7
+ */
8
+ function flattenDeep(array) {
9
+ return array.flat(Infinity);
10
+ }
@@ -0,0 +1,6 @@
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
+ export default function get(object: any, path: string | string[], defaultValue?: any): any;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Gets the value at path of object. If the resolved value is undefined,
4
+ * the defaultValue is returned in its place.
5
+ * Drop-in replacement for lodash/get.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.default = get;
9
+ const rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
10
+ function toPath(path) {
11
+ if (Array.isArray(path)) {
12
+ return path;
13
+ }
14
+ const result = [];
15
+ const str = String(path);
16
+ str.replace(rePropName, (match, number, quote, subString) => {
17
+ result.push(quote ? subString.replace(/\\(\\)?/g, '$1') : number || match);
18
+ return match;
19
+ });
20
+ return result;
21
+ }
22
+ function get(object, path, defaultValue) {
23
+ if (typeof path === 'string' && path === '') {
24
+ return defaultValue;
25
+ }
26
+ const keys = toPath(path);
27
+ if (keys.length === 0) {
28
+ return defaultValue;
29
+ }
30
+ let result = object;
31
+ for (const key of keys) {
32
+ if (result == null) {
33
+ return defaultValue;
34
+ }
35
+ result = result[key];
36
+ }
37
+ return result === undefined ? defaultValue : result;
38
+ }
@@ -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,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uniqBy = exports.uniq = exports.toNumber = exports.throttle = exports.startCase = exports.sentenceCase = exports.parseInt = exports.orderBy = exports.mergeWith = exports.merge = exports.kebabCase = exports.isPlainObject = exports.isObject = exports.isEqual = exports.isArray = exports.get = exports.flattenDeep = exports.flatten = exports.debounce = exports.cloneDeepWith = exports.clamp = exports.chunk = void 0;
4
+ const tslib_1 = require("tslib");
5
+ var chunk_1 = require("./chunk");
6
+ Object.defineProperty(exports, "chunk", { enumerable: true, get: function () { return tslib_1.__importDefault(chunk_1).default; } });
7
+ var clamp_1 = require("./clamp");
8
+ Object.defineProperty(exports, "clamp", { enumerable: true, get: function () { return tslib_1.__importDefault(clamp_1).default; } });
9
+ var cloneDeepWith_1 = require("./cloneDeepWith");
10
+ Object.defineProperty(exports, "cloneDeepWith", { enumerable: true, get: function () { return tslib_1.__importDefault(cloneDeepWith_1).default; } });
11
+ var debounce_1 = require("./debounce");
12
+ Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return tslib_1.__importDefault(debounce_1).default; } });
13
+ var flatten_1 = require("./flatten");
14
+ Object.defineProperty(exports, "flatten", { enumerable: true, get: function () { return tslib_1.__importDefault(flatten_1).default; } });
15
+ var flattenDeep_1 = require("./flattenDeep");
16
+ Object.defineProperty(exports, "flattenDeep", { enumerable: true, get: function () { return tslib_1.__importDefault(flattenDeep_1).default; } });
17
+ var get_1 = require("./get");
18
+ Object.defineProperty(exports, "get", { enumerable: true, get: function () { return tslib_1.__importDefault(get_1).default; } });
19
+ var isArray_1 = require("./isArray");
20
+ Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return tslib_1.__importDefault(isArray_1).default; } });
21
+ var isEqual_1 = require("./isEqual");
22
+ Object.defineProperty(exports, "isEqual", { enumerable: true, get: function () { return tslib_1.__importDefault(isEqual_1).default; } });
23
+ var isObject_1 = require("./isObject");
24
+ Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return tslib_1.__importDefault(isObject_1).default; } });
25
+ var isPlainObject_1 = require("./isPlainObject");
26
+ Object.defineProperty(exports, "isPlainObject", { enumerable: true, get: function () { return tslib_1.__importDefault(isPlainObject_1).default; } });
27
+ var kebabCase_1 = require("./kebabCase");
28
+ Object.defineProperty(exports, "kebabCase", { enumerable: true, get: function () { return tslib_1.__importDefault(kebabCase_1).default; } });
29
+ var merge_1 = require("./merge");
30
+ Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return tslib_1.__importDefault(merge_1).default; } });
31
+ var mergeWith_1 = require("./mergeWith");
32
+ Object.defineProperty(exports, "mergeWith", { enumerable: true, get: function () { return tslib_1.__importDefault(mergeWith_1).default; } });
33
+ var orderBy_1 = require("./orderBy");
34
+ Object.defineProperty(exports, "orderBy", { enumerable: true, get: function () { return tslib_1.__importDefault(orderBy_1).default; } });
35
+ var parseInt_1 = require("./parseInt");
36
+ Object.defineProperty(exports, "parseInt", { enumerable: true, get: function () { return tslib_1.__importDefault(parseInt_1).default; } });
37
+ var sentenceCase_1 = require("./sentenceCase");
38
+ Object.defineProperty(exports, "sentenceCase", { enumerable: true, get: function () { return tslib_1.__importDefault(sentenceCase_1).default; } });
39
+ var startCase_1 = require("./startCase");
40
+ Object.defineProperty(exports, "startCase", { enumerable: true, get: function () { return tslib_1.__importDefault(startCase_1).default; } });
41
+ var throttle_1 = require("./throttle");
42
+ Object.defineProperty(exports, "throttle", { enumerable: true, get: function () { return tslib_1.__importDefault(throttle_1).default; } });
43
+ var toNumber_1 = require("./toNumber");
44
+ Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return tslib_1.__importDefault(toNumber_1).default; } });
45
+ var uniq_1 = require("./uniq");
46
+ Object.defineProperty(exports, "uniq", { enumerable: true, get: function () { return tslib_1.__importDefault(uniq_1).default; } });
47
+ var uniqBy_1 = require("./uniqBy");
48
+ Object.defineProperty(exports, "uniqBy", { enumerable: true, get: function () { return tslib_1.__importDefault(uniqBy_1).default; } });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Checks if value is classified as an Array object.
3
+ * Drop-in replacement for lodash/isArray.
4
+ */
5
+ declare const isArray: (value: any) => value is any[];
6
+ export default isArray;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Checks if value is classified as an Array object.
5
+ * Drop-in replacement for lodash/isArray.
6
+ */
7
+ const isArray = Array.isArray;
8
+ exports.default = isArray;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Performs a deep comparison between two values to determine if they are equivalent.
3
+ * Drop-in replacement for lodash/isEqual.
4
+ */
5
+ export default function isEqual(value: any, other: any): boolean;