@vuu-ui/vuu-utils 0.11.2 → 0.12.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/cjs/column-utils.js +2 -2
- package/cjs/column-utils.js.map +1 -1
- package/cjs/context-definitions/DataContext.js +20 -0
- package/cjs/context-definitions/DataContext.js.map +1 -0
- package/cjs/context-definitions/DataProvider.js +24 -0
- package/cjs/context-definitions/DataProvider.js.map +1 -0
- package/cjs/context-definitions/DataSourceProvider.js +20 -17
- package/cjs/context-definitions/DataSourceProvider.js.map +1 -1
- package/cjs/datasource/BaseDataSource.js +5 -2
- package/cjs/datasource/BaseDataSource.js.map +1 -1
- package/cjs/group-utils.js +16 -1
- package/cjs/group-utils.js.map +1 -1
- package/cjs/index.js +12 -13
- package/cjs/index.js.map +1 -1
- package/cjs/logging-utils.js +4 -0
- package/cjs/logging-utils.js.map +1 -1
- package/cjs/menu-utils.js +0 -151
- package/cjs/menu-utils.js.map +1 -1
- package/cjs/moving-window.js +3 -1
- package/cjs/moving-window.js.map +1 -1
- package/cjs/range-utils.js +89 -13
- package/cjs/range-utils.js.map +1 -1
- package/cjs/sort-utils.js +17 -0
- package/cjs/sort-utils.js.map +1 -1
- package/esm/column-utils.js +2 -2
- package/esm/column-utils.js.map +1 -1
- package/esm/context-definitions/DataContext.js +18 -0
- package/esm/context-definitions/DataContext.js.map +1 -0
- package/esm/context-definitions/DataProvider.js +20 -0
- package/esm/context-definitions/DataProvider.js.map +1 -0
- package/esm/context-definitions/DataSourceProvider.js +21 -18
- package/esm/context-definitions/DataSourceProvider.js.map +1 -1
- package/esm/datasource/BaseDataSource.js +5 -2
- package/esm/datasource/BaseDataSource.js.map +1 -1
- package/esm/group-utils.js +15 -2
- package/esm/group-utils.js.map +1 -1
- package/esm/index.js +9 -8
- package/esm/index.js.map +1 -1
- package/esm/logging-utils.js +4 -1
- package/esm/logging-utils.js.map +1 -1
- package/esm/menu-utils.js +1 -145
- package/esm/menu-utils.js.map +1 -1
- package/esm/moving-window.js +3 -1
- package/esm/moving-window.js.map +1 -1
- package/esm/range-utils.js +89 -12
- package/esm/range-utils.js.map +1 -1
- package/esm/sort-utils.js +17 -1
- package/esm/sort-utils.js.map +1 -1
- package/package.json +6 -6
- package/types/column-utils.d.ts +4 -4
- package/types/context-definitions/{DataSourceContext.d.ts → DataContext.d.ts} +2 -2
- package/types/context-definitions/DataProvider.d.ts +8 -0
- package/types/context-definitions/DataSourceProvider.d.ts +9 -5
- package/types/datasource/BaseDataSource.d.ts +7 -6
- package/types/filters/filter-utils.d.ts +2 -1
- package/types/group-utils.d.ts +9 -2
- package/types/index.d.ts +3 -2
- package/types/logging-utils.d.ts +1 -0
- package/types/menu-utils.d.ts +3 -19
- package/types/moving-window.d.ts +1 -1
- package/types/range-utils.d.ts +15 -9
- package/types/sort-utils.d.ts +9 -3
- package/cjs/context-definitions/DataSourceContext.js +0 -20
- package/cjs/context-definitions/DataSourceContext.js.map +0 -1
- package/esm/context-definitions/DataSourceContext.js +0 -18
- package/esm/context-definitions/DataSourceContext.js.map +0 -1
package/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getAddedItems, getMissingItems, itemsChanged, itemsOrOrderChanged, moveItem, moveItemDeprecated, partition } from './array-utils.js';
|
|
2
2
|
export { boxContainsPoint, getCenteredBox, getPositionWithinBox, isGridLayoutSplitDirection, pointPositionWithinRect } from './box-utils.js';
|
|
3
|
-
export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, buildColumnMap, checkConfirmationPending, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupIcon, getGroupValue,
|
|
3
|
+
export { AggregationType, addColumnToSubscribedColumns, applyDefaultColumnConfig, applyGroupByToColumns, applyRuntimeColumnWidthsToConfig, applySortToColumns, applyWidthToColumns, buildColumnMap, checkConfirmationPending, dataAndColumnUnchanged, dataColumnAndKeyUnchanged, dataSourceRowToDataRowDto, existingSort, extractGroupColumn, findColumn, flattenColumnGroup, fromServerDataType, getCalculatedColumnDetails, getColumnLabel, getColumnName, getColumnStyle, getColumnsInViewport, getDefaultAlignment, getDefaultColumnType, getGroupIcon, getGroupValue, getRuntimeColumnWidth, getTableHeadings, getTypeFormattingFromColumn, hasCustomRenderer, hasHeadings, hasValidationRules, isCalculatedColumn, isColumnTypeRenderer, isDataLoading, isDateTimeDataValue, isGroupColumn, isJsonAttribute, isJsonColumn, isJsonGroup, isLookupRenderer, isMappedValueTypeRenderer, isNotHidden, isNumericColumn, isPinned, isResizing, isStringColumn, isTextColumn, isTypeDescriptor, isValidColumnAlignment, isValidPinLocation, isValueListRenderer, isVuuColumnDataType, mapSortCriteria, measurePinnedColumns, metadataKeys, moveColumnTo, projectUpdates, removeSort, replaceColumn, setAggregations, setCalculatedColumnExpression, setCalculatedColumnName, setCalculatedColumnType, sortPinnedColumns, subscribedOnly, toColumnDescriptor, toColumnName, toDataSourceColumns, updateColumn, updateColumnFormatting, updateColumnRenderProps, updateColumnType, visibleColumnAtIndex } from './column-utils.js';
|
|
4
4
|
export { getCookieValue } from './cookie-utils.js';
|
|
5
5
|
export { getCellConfigPanelRenderer, getCellRenderer, getCellRendererOptions, getColumnHeaderContentRenderer, getColumnHeaderLabelRenderer, getConfigurationEditor, getEditRuleValidator, getLayoutComponent, getRegisteredCellRenderers, getRowClassNameGenerator, isContainer, isLayoutComponent, isView, registerComponent, registerConfigurationEditor } from './component-registry.js';
|
|
6
6
|
export { DataWindow } from './DataWindow.js';
|
|
@@ -24,7 +24,7 @@ export { assertComponentRegistered, assertComponentsRegistered, byModule, env, f
|
|
|
24
24
|
export { getFieldName, getTypedValue, isNumber } from './form-utils.js';
|
|
25
25
|
export { defaultValueFormatter, getValueFormatter, lowerCase, numericFormatter } from './formatting-utils.js';
|
|
26
26
|
export { getUniqueId } from './getUniqueId.js';
|
|
27
|
-
export { addGroupColumn } from './group-utils.js';
|
|
27
|
+
export { addGroupColumn, getGroupStatus, removeGroupColumn } from './group-utils.js';
|
|
28
28
|
export { isCharacterKey, isQuoteKey } from './input-utils.js';
|
|
29
29
|
export { invariant } from './invariant.js';
|
|
30
30
|
export { itemToString } from './itemToString.js';
|
|
@@ -33,8 +33,8 @@ export { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, End, Enter, Escape, Home, Pa
|
|
|
33
33
|
export { KeySet } from './keyset.js';
|
|
34
34
|
export { getSelectedOption } from './list-utils.js';
|
|
35
35
|
export { getAllLocalEntity, getLocalEntity, saveLocalEntity } from './local-storage-utils.js';
|
|
36
|
-
export { getLoggingConfigForWorker, logger } from './logging-utils.js';
|
|
37
|
-
export {
|
|
36
|
+
export { getLoggingConfigForWorker, logUnhandledMessage, logger } from './logging-utils.js';
|
|
37
|
+
export { hasShowNotificationAction, isGroupMenuItemDescriptor, isOpenBulkEditResponse } from './menu-utils.js';
|
|
38
38
|
export { isModule } from './module-utils.js';
|
|
39
39
|
export { MovingWindow } from './moving-window.js';
|
|
40
40
|
export { uuid } from './nanoid/index.js';
|
|
@@ -43,11 +43,11 @@ export { roundDecimal } from './round-decimal.js';
|
|
|
43
43
|
export { debounce, throttle } from './perf-utils.js';
|
|
44
44
|
export { DeferredPromise } from './promise-utils.js';
|
|
45
45
|
export { isActionMessage, isEditCellRequest, isOpenDialogAction, isOpenSessionTableDialogMessage, isRequestResponse, isRpcSuccess, isSessionTable, isSessionTableActionMessage, isViewportRpcRequest, isVuuMenuRpcRequest, viewportRpcRequest, vuuAddRowRequest, vuuDeleteRowRequest, vuuEditCellRequest } from './protocol-message-utils.js';
|
|
46
|
-
export { NULL_RANGE, WindowRange, getFullRange, rangeNewItems,
|
|
46
|
+
export { NULL_RANGE, Range, WindowRange, getFullRange, rangeNewItems, withinRange } from './range-utils.js';
|
|
47
47
|
export { actualRowPositioning, asDataSourceRowObject, virtualRowPositioning } from './row-utils.js';
|
|
48
48
|
export { RowSelected, deselectItem, expandSelection, getSelectionStatus, isRowSelected, isRowSelectedLast, isSelected, selectItem, selectionCount } from './selection-utils.js';
|
|
49
49
|
export { VuuShellLocation } from './shell-layout-types.js';
|
|
50
|
-
export { addSortColumn, setSortColumn, toggleOrApplySort } from './sort-utils.js';
|
|
50
|
+
export { addSortColumn, getSortStatus, setSortColumn, toggleOrApplySort } from './sort-utils.js';
|
|
51
51
|
export { getVuuTable } from './table-schema-utils.js';
|
|
52
52
|
export { lastWord, wordify } from './text-utils.js';
|
|
53
53
|
export { NO_DATA_MATCH } from './typeahead-utils.js';
|
|
@@ -59,7 +59,8 @@ export { useId } from './useId.js';
|
|
|
59
59
|
export { useStateRef } from './useStateRef.js';
|
|
60
60
|
export { useLayoutEffectSkipFirst } from './useLayoutEffectSkipFirst.js';
|
|
61
61
|
export { ShellContext, useShellContext } from './ShellContext.js';
|
|
62
|
-
export {
|
|
63
|
-
export {
|
|
62
|
+
export { DataContext } from './context-definitions/DataContext.js';
|
|
63
|
+
export { DataProvider, useData, useDataSourceExtensions } from './context-definitions/DataProvider.js';
|
|
64
|
+
export { DataSourceProvider, useDataSource } from './context-definitions/DataSourceProvider.js';
|
|
64
65
|
export { WorkspaceContext, usePlaceholderJSON } from './context-definitions/WorkspaceContext.js';
|
|
65
66
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/esm/logging-utils.js
CHANGED
|
@@ -53,6 +53,9 @@ function getLoggingLevelFromCookie() {
|
|
|
53
53
|
const getLoggingConfigForWorker = () => {
|
|
54
54
|
return `const loggingSettings = { loggingLevel: "${getLoggingLevelFromCookie()}"};`;
|
|
55
55
|
};
|
|
56
|
+
const logUnhandledMessage = (message, context = "[logUnhandledStruct]") => {
|
|
57
|
+
console.log(`${context} ${JSON.stringify(message)}`);
|
|
58
|
+
};
|
|
56
59
|
|
|
57
|
-
export { getLoggingConfigForWorker, logger };
|
|
60
|
+
export { getLoggingConfigForWorker, logUnhandledMessage, logger };
|
|
58
61
|
//# sourceMappingURL=logging-utils.js.map
|
package/esm/logging-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging-utils.js","sources":["../src/logging-utils.ts"],"sourcesContent":["import { getCookieValue } from \"./cookie-utils\";\n\ndeclare global {\n const loggingSettings: loggingSettings;\n}\n\nexport interface LogFn {\n (message?: unknown, ...optionalParams: unknown[]): void;\n}\nexport interface AssertLogFn {\n (condition: boolean, message?: unknown, errorMessaage?: unknown): void;\n}\n\nexport interface TableLogFn {\n (properties?: object): void;\n}\n\ntype loggingSettings = {\n loggingLevel: LogLevel;\n};\n\nexport interface Logger {\n warn: LogFn;\n error: LogFn;\n debug: LogFn;\n info: LogFn;\n}\n\nexport type LogLevel = keyof Logger;\n\nconst logLevels = [\"error\", \"warn\", \"info\", \"debug\"];\nconst isValidLogLevel = (value: unknown): value is LogLevel =>\n typeof value === \"string\" && logLevels.includes(value);\n\nconst DEFAULT_LOG_LEVEL: LogLevel = \"error\";\n\nexport type BuildEnv = \"production\" | \"development\";\n\nconst NO_OP = () => undefined;\n\nconst DEFAULT_DEBUG_LEVEL: LogLevel =\n process.env.NODE_ENV === \"production\" ? \"error\" : \"info\";\n\nconst { loggingLevel = DEFAULT_DEBUG_LEVEL } = getLoggingSettings();\n// typeof loggingSettings !== \"undefined\" ? loggingSettings : {};\n// const { loggingLevel = DEFAULT_DEBUG_LEVEL } =\n// typeof loggingSettings !== \"undefined\" ? loggingSettings : {};\n\nexport const logger = (category: string) => {\n const debugEnabled = loggingLevel === \"debug\";\n const infoEnabled = debugEnabled || loggingLevel === \"info\";\n const warnEnabled = infoEnabled || loggingLevel === \"warn\";\n const errorEnabled = warnEnabled || loggingLevel === \"error\";\n\n const info = infoEnabled\n ? (message: string) => console.info(`[${category}] ${message}`)\n : NO_OP;\n const warn = warnEnabled\n ? (message: string) => console.warn(`[${category}] ${message}`)\n : NO_OP;\n const debug = debugEnabled\n ? (message: string) => console.debug(`[${category}] ${message}`)\n : NO_OP;\n const error = errorEnabled\n ? (message: string) => console.error(`[${category}] ${message}`)\n : NO_OP;\n\n if (process.env.NODE_ENV === \"production\") {\n return {\n errorEnabled,\n error,\n };\n } else {\n return {\n debugEnabled,\n infoEnabled,\n warnEnabled,\n errorEnabled,\n info,\n warn,\n debug,\n error,\n };\n }\n};\n\nfunction getLoggingSettings() {\n if (typeof loggingSettings !== \"undefined\") {\n return loggingSettings;\n } else {\n return {\n loggingLevel: getLoggingLevelFromCookie(),\n };\n }\n}\n\nfunction getLoggingLevelFromCookie(): LogLevel {\n const value = getCookieValue(\"vuu-logging-level\");\n if (isValidLogLevel(value)) {\n return value;\n } else {\n return DEFAULT_LOG_LEVEL;\n }\n}\n\nexport const getLoggingConfigForWorker = () => {\n return `const loggingSettings = { loggingLevel: \"${getLoggingLevelFromCookie()}\"};`;\n};\n"],"names":[],"mappings":";;AA8BA,MAAM,SAAY,GAAA,CAAC,OAAS,EAAA,MAAA,EAAQ,QAAQ,OAAO,CAAA;AACnD,MAAM,eAAA,GAAkB,CAAC,KACvB,KAAA,OAAO,UAAU,QAAY,IAAA,SAAA,CAAU,SAAS,KAAK,CAAA;AAEvD,MAAM,iBAA8B,GAAA,OAAA;AAIpC,MAAM,QAAQ,MAAM,KAAA,CAAA;AAEpB,MAAM,mBACJ,GAAA,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,eAAe,OAAU,GAAA,MAAA;AAEpD,MAAM,EAAE,YAAA,G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A,KAAA;AAAA,MACA;AAAA,KACF;AAAA;AAEJ;AAEA,SAAS,kBAAqB,GAAA;AAC5B,EAAI,IAAA,OAAO,oBAAoB,WAAa,EAAA;AAC1C,IAAO,OAAA,eAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA;AAAA,MACL,cAAc,yBAA0B;AAAA,KAC1C;AAAA;AAEJ;AAEA,SAAS,yBAAsC,GAAA;AAC7C,EAAM,MAAA,KAAA,GAAQ,eAAe,mBAAmB,CAAA;AAChD,EAAI,IAAA,eAAA,CAAgB,KAAK,CAAG,EAAA;AAC1B,IAAO,OAAA,KAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,iBAAA;AAAA;AAEX;AAEO,MAAM,4BAA4B,MAAM;AAC7C,EAAO,OAAA,CAAA,yCAAA,EAA4C,2BAA2B,CAAA,GAAA,CAAA;AAChF;;;;"}
|
|
1
|
+
{"version":3,"file":"logging-utils.js","sources":["../src/logging-utils.ts"],"sourcesContent":["import { getCookieValue } from \"./cookie-utils\";\n\ndeclare global {\n const loggingSettings: loggingSettings;\n}\n\nexport interface LogFn {\n (message?: unknown, ...optionalParams: unknown[]): void;\n}\nexport interface AssertLogFn {\n (condition: boolean, message?: unknown, errorMessaage?: unknown): void;\n}\n\nexport interface TableLogFn {\n (properties?: object): void;\n}\n\ntype loggingSettings = {\n loggingLevel: LogLevel;\n};\n\nexport interface Logger {\n warn: LogFn;\n error: LogFn;\n debug: LogFn;\n info: LogFn;\n}\n\nexport type LogLevel = keyof Logger;\n\nconst logLevels = [\"error\", \"warn\", \"info\", \"debug\"];\nconst isValidLogLevel = (value: unknown): value is LogLevel =>\n typeof value === \"string\" && logLevels.includes(value);\n\nconst DEFAULT_LOG_LEVEL: LogLevel = \"error\";\n\nexport type BuildEnv = \"production\" | \"development\";\n\nconst NO_OP = () => undefined;\n\nconst DEFAULT_DEBUG_LEVEL: LogLevel =\n process.env.NODE_ENV === \"production\" ? \"error\" : \"info\";\n\nconst { loggingLevel = DEFAULT_DEBUG_LEVEL } = getLoggingSettings();\n// typeof loggingSettings !== \"undefined\" ? loggingSettings : {};\n// const { loggingLevel = DEFAULT_DEBUG_LEVEL } =\n// typeof loggingSettings !== \"undefined\" ? loggingSettings : {};\n\nexport const logger = (category: string) => {\n const debugEnabled = loggingLevel === \"debug\";\n const infoEnabled = debugEnabled || loggingLevel === \"info\";\n const warnEnabled = infoEnabled || loggingLevel === \"warn\";\n const errorEnabled = warnEnabled || loggingLevel === \"error\";\n\n const info = infoEnabled\n ? (message: string) => console.info(`[${category}] ${message}`)\n : NO_OP;\n const warn = warnEnabled\n ? (message: string) => console.warn(`[${category}] ${message}`)\n : NO_OP;\n const debug = debugEnabled\n ? (message: string) => console.debug(`[${category}] ${message}`)\n : NO_OP;\n const error = errorEnabled\n ? (message: string) => console.error(`[${category}] ${message}`)\n : NO_OP;\n\n if (process.env.NODE_ENV === \"production\") {\n return {\n errorEnabled,\n error,\n };\n } else {\n return {\n debugEnabled,\n infoEnabled,\n warnEnabled,\n errorEnabled,\n info,\n warn,\n debug,\n error,\n };\n }\n};\n\nfunction getLoggingSettings() {\n if (typeof loggingSettings !== \"undefined\") {\n return loggingSettings;\n } else {\n return {\n loggingLevel: getLoggingLevelFromCookie(),\n };\n }\n}\n\nfunction getLoggingLevelFromCookie(): LogLevel {\n const value = getCookieValue(\"vuu-logging-level\");\n if (isValidLogLevel(value)) {\n return value;\n } else {\n return DEFAULT_LOG_LEVEL;\n }\n}\n\nexport const getLoggingConfigForWorker = () => {\n return `const loggingSettings = { loggingLevel: \"${getLoggingLevelFromCookie()}\"};`;\n};\n\nexport const logUnhandledMessage = (\n message: never,\n context = \"[logUnhandledStruct]\",\n) => {\n console.log(`${context} ${JSON.stringify(message)}`);\n};\n"],"names":[],"mappings":";;AA8BA,MAAM,SAAY,GAAA,CAAC,OAAS,EAAA,MAAA,EAAQ,QAAQ,OAAO,CAAA;AACnD,MAAM,eAAA,GAAkB,CAAC,KACvB,KAAA,OAAO,UAAU,QAAY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QAAA,KAAa,YAAc,EAAA;AACzC,IAAO,OAAA;AAAA,MACL,YAAA;AAAA,MACA;AAAA,KACF;AAAA,GACK,MAAA;AACL,IAAO,OAAA;AAAA,MACL,YAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA;AAAA,KACF;AAAA;AAEJ;AAEA,SAAS,kBAAqB,GAAA;AAC5B,EAAI,IAAA,OAAO,oBAAoB,WAAa,EAAA;AAC1C,IAAO,OAAA,eAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA;AAAA,MACL,cAAc,yBAA0B;AAAA,KAC1C;AAAA;AAEJ;AAEA,SAAS,yBAAsC,GAAA;AAC7C,EAAM,MAAA,KAAA,GAAQ,eAAe,mBAAmB,CAAA;AAChD,EAAI,IAAA,eAAA,CAAgB,KAAK,CAAG,EAAA;AAC1B,IAAO,OAAA,KAAA;AAAA,GACF,MAAA;AACL,IAAO,OAAA,iBAAA;AAAA;AAEX;AAEO,MAAM,4BAA4B,MAAM;AAC7C,EAAO,OAAA,CAAA,yCAAA,EAA4C,2BAA2B,CAAA,GAAA,CAAA;AAChF;AAEO,MAAM,mBAAsB,GAAA,CACjC,OACA,EAAA,OAAA,GAAU,sBACP,KAAA;AACH,EAAQ,OAAA,CAAA,GAAA,CAAI,GAAG,OAAO,CAAA,EAAA,EAAK,KAAK,SAAU,CAAA,OAAO,CAAC,CAAE,CAAA,CAAA;AACtD;;;;"}
|
package/esm/menu-utils.js
CHANGED
|
@@ -1,150 +1,6 @@
|
|
|
1
|
-
import { getFilterPredicate } from '@vuu-ui/vuu-filter-parser';
|
|
2
|
-
import { getRowRecord, metadataKeys } from './column-utils.js';
|
|
3
|
-
|
|
4
|
-
const { KEY } = metadataKeys;
|
|
5
|
-
const isRoot = (menu) => menu.name === "ROOT";
|
|
6
|
-
const isCellMenu = (options) => options.context === "cell";
|
|
7
|
-
const isRowMenu = (options) => options.context === "row";
|
|
8
|
-
const isSelectionMenu = (options) => options.context === "selected-rows";
|
|
9
1
|
const isGroupMenuItemDescriptor = (menuItem) => menuItem !== void 0 && "children" in menuItem;
|
|
10
|
-
const isTableLocation = (location) => ["grid", "header", "filter"].includes(location);
|
|
11
|
-
const isVuuMenuItem = (menu) => "rpcName" in menu;
|
|
12
|
-
const isGroupMenuItem = (menu) => "menus" in menu;
|
|
13
|
-
const hasFilter = ({ filter }) => typeof filter === "string" && filter.length > 0;
|
|
14
|
-
const vuuContextCompatibleWithTableLocation = (uiLocation, vuuContext, selectedRowCount = 0) => {
|
|
15
|
-
switch (uiLocation) {
|
|
16
|
-
case "grid":
|
|
17
|
-
if (vuuContext === "selected-rows") {
|
|
18
|
-
return selectedRowCount > 0;
|
|
19
|
-
} else {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
case "header":
|
|
23
|
-
return vuuContext === "grid";
|
|
24
|
-
default:
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const gridRowMeetsFilterCriteria = (context, row, selectedRows, filter, columnMap) => {
|
|
29
|
-
if (context === "cell" || context === "row") {
|
|
30
|
-
const filterPredicate = getFilterPredicate(columnMap, filter);
|
|
31
|
-
return filterPredicate(row);
|
|
32
|
-
} else if (context === "selected-rows") {
|
|
33
|
-
if (selectedRows.length === 0) {
|
|
34
|
-
return false;
|
|
35
|
-
} else {
|
|
36
|
-
const filterPredicate = getFilterPredicate(columnMap, filter);
|
|
37
|
-
return selectedRows.every(filterPredicate);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
const menuShouldBeRenderedInThisContext = (menuItem, tableLocation, options) => {
|
|
43
|
-
if (isGroupMenuItem(menuItem)) {
|
|
44
|
-
return menuItem.menus.some(
|
|
45
|
-
(childMenu) => menuShouldBeRenderedInThisContext(childMenu, tableLocation, options)
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
if (!vuuContextCompatibleWithTableLocation(
|
|
49
|
-
tableLocation,
|
|
50
|
-
menuItem.context,
|
|
51
|
-
options.selectedRows?.length
|
|
52
|
-
)) {
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
if (tableLocation === "grid" && hasFilter(menuItem)) {
|
|
56
|
-
return gridRowMeetsFilterCriteria(
|
|
57
|
-
menuItem.context,
|
|
58
|
-
options.row,
|
|
59
|
-
options.selectedRows,
|
|
60
|
-
menuItem.filter,
|
|
61
|
-
options.columnMap
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
if (isCellMenu(menuItem) && menuItem.field !== "*") {
|
|
65
|
-
return menuItem.field === options.columnName;
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
};
|
|
69
|
-
const getMenuItemOptions = (menu, options) => {
|
|
70
|
-
switch (menu.context) {
|
|
71
|
-
case "cell":
|
|
72
|
-
return {
|
|
73
|
-
...menu,
|
|
74
|
-
field: options.columnName,
|
|
75
|
-
rowKey: options.row[KEY],
|
|
76
|
-
value: options.row[options.columnMap[options.columnName]]
|
|
77
|
-
};
|
|
78
|
-
case "row":
|
|
79
|
-
return {
|
|
80
|
-
...menu,
|
|
81
|
-
columns: options.columns,
|
|
82
|
-
row: getRowRecord(options.row, options.columnMap),
|
|
83
|
-
rowKey: options.row[KEY]
|
|
84
|
-
};
|
|
85
|
-
case "selected-rows":
|
|
86
|
-
return {
|
|
87
|
-
...menu,
|
|
88
|
-
columns: options.columns
|
|
89
|
-
};
|
|
90
|
-
default:
|
|
91
|
-
return menu;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const buildMenuDescriptorFromVuuMenu = (menu, tableLocation, options) => {
|
|
95
|
-
if (menuShouldBeRenderedInThisContext(menu, tableLocation, options)) {
|
|
96
|
-
if (isVuuMenuItem(menu)) {
|
|
97
|
-
return {
|
|
98
|
-
label: menu.name,
|
|
99
|
-
action: "MENU_RPC_CALL",
|
|
100
|
-
options: getMenuItemOptions(menu, options)
|
|
101
|
-
};
|
|
102
|
-
} else {
|
|
103
|
-
const children = menu.menus.map(
|
|
104
|
-
(childMenu) => buildMenuDescriptorFromVuuMenu(childMenu, tableLocation, options)
|
|
105
|
-
).filter(
|
|
106
|
-
(childMenu) => childMenu !== void 0
|
|
107
|
-
);
|
|
108
|
-
if (children.length > 0) {
|
|
109
|
-
return {
|
|
110
|
-
label: menu.name,
|
|
111
|
-
children
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const getMenuRpcRequest = (options) => {
|
|
118
|
-
const { rpcName } = options;
|
|
119
|
-
if (isCellMenu(options)) {
|
|
120
|
-
return {
|
|
121
|
-
field: options.field,
|
|
122
|
-
rowKey: options.rowKey,
|
|
123
|
-
rpcName,
|
|
124
|
-
value: options.value,
|
|
125
|
-
type: "VIEW_PORT_MENU_CELL_RPC"
|
|
126
|
-
};
|
|
127
|
-
} else if (isRowMenu(options)) {
|
|
128
|
-
return {
|
|
129
|
-
rowKey: options.rowKey,
|
|
130
|
-
row: options.row,
|
|
131
|
-
rpcName,
|
|
132
|
-
type: "VIEW_PORT_MENU_ROW_RPC"
|
|
133
|
-
};
|
|
134
|
-
} else if (isSelectionMenu(options)) {
|
|
135
|
-
return {
|
|
136
|
-
rpcName,
|
|
137
|
-
type: "VIEW_PORT_MENUS_SELECT_RPC"
|
|
138
|
-
};
|
|
139
|
-
} else {
|
|
140
|
-
return {
|
|
141
|
-
rpcName,
|
|
142
|
-
type: "VIEW_PORT_MENU_TABLE_RPC"
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
2
|
const isOpenBulkEditResponse = (rpcResponse) => rpcResponse.rpcName === "VP_BULK_EDIT_BEGIN_RPC";
|
|
147
3
|
const hasShowNotificationAction = (res) => res.action?.type === "SHOW_NOTIFICATION_ACTION";
|
|
148
4
|
|
|
149
|
-
export {
|
|
5
|
+
export { hasShowNotificationAction, isGroupMenuItemDescriptor, isOpenBulkEditResponse };
|
|
150
6
|
//# sourceMappingURL=menu-utils.js.map
|
package/esm/menu-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-utils.js","sources":["../src/menu-utils.ts"],"sourcesContent":["import {\n ContextMenuGroupItemDescriptor,\n ContextMenuItemDescriptor,\n DataSourceRow,\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n} from \"@vuu-ui/vuu-data-types\";\nimport { getFilterPredicate } from \"@vuu-ui/vuu-filter-parser\";\nimport {\n ClientToServerMenuCellRPC,\n ClientToServerMenuRowRPC,\n ShowNotificationAction,\n VuuMenu,\n VuuMenuContext,\n VuuMenuItem,\n VuuRpcMenuRequest,\n VuuRpcResponse,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ColumnDescriptor,\n TableMenuLocation,\n VuuCellMenuItem,\n VuuRowMenuItem,\n} from \"@vuu-ui/vuu-table-types\";\nimport { getRowRecord, metadataKeys, type ColumnMap } from \"./column-utils\";\n\nexport type VuuServerMenuOptions = {\n columnMap: ColumnMap;\n columnName: string;\n columns: ColumnDescriptor[];\n row: DataSourceRow;\n selectedRows: DataSourceRow[];\n viewport: string;\n};\n\nconst { KEY } = metadataKeys;\n\nexport const isRoot = (menu: VuuMenu) => menu.name === \"ROOT\";\n\nexport const isCellMenu = (options: VuuMenuItem): options is VuuCellMenuItem =>\n options.context === \"cell\";\n\nexport const isRowMenu = (options: VuuMenuItem): options is VuuRowMenuItem =>\n options.context === \"row\";\n\nexport const isSelectionMenu = (options: VuuMenuItem): options is VuuMenuItem =>\n options.context === \"selected-rows\";\n\nexport const isGroupMenuItemDescriptor = (\n menuItem?: ContextMenuItemDescriptor,\n): menuItem is ContextMenuGroupItemDescriptor =>\n menuItem !== undefined && \"children\" in menuItem;\n\nexport const isTableLocation = (\n location: string,\n): location is TableMenuLocation =>\n [\"grid\", \"header\", \"filter\"].includes(location);\n\nconst isVuuMenuItem = (menu: VuuMenuItem | VuuMenu): menu is VuuMenuItem =>\n \"rpcName\" in menu;\n\nconst isGroupMenuItem = (menu: VuuMenuItem | VuuMenu): menu is VuuMenu =>\n \"menus\" in menu;\n\nconst hasFilter = ({ filter }: VuuMenuItem) =>\n typeof filter === \"string\" && filter.length > 0;\n\nconst vuuContextCompatibleWithTableLocation = (\n uiLocation: TableMenuLocation,\n vuuContext: VuuMenuContext,\n selectedRowCount = 0,\n) => {\n switch (uiLocation) {\n case \"grid\":\n if (vuuContext === \"selected-rows\") {\n return selectedRowCount > 0;\n } else {\n return true;\n }\n case \"header\":\n return vuuContext === \"grid\";\n default:\n return false;\n }\n};\n\nconst gridRowMeetsFilterCriteria = (\n context: VuuMenuContext,\n row: DataSourceRow,\n selectedRows: DataSourceRow[],\n filter: string,\n columnMap: ColumnMap,\n): boolean => {\n if (context === \"cell\" || context === \"row\") {\n const filterPredicate = getFilterPredicate(columnMap, filter);\n return filterPredicate(row);\n } else if (context === \"selected-rows\") {\n if (selectedRows.length === 0) {\n return false;\n } else {\n const filterPredicate = getFilterPredicate(columnMap, filter);\n return selectedRows.every(filterPredicate);\n }\n }\n return true;\n};\n\nconst menuShouldBeRenderedInThisContext = (\n menuItem: VuuMenu | VuuMenuItem,\n tableLocation: TableMenuLocation,\n options: VuuServerMenuOptions,\n): boolean => {\n if (isGroupMenuItem(menuItem)) {\n return menuItem.menus.some((childMenu) =>\n menuShouldBeRenderedInThisContext(childMenu, tableLocation, options),\n );\n }\n if (\n !vuuContextCompatibleWithTableLocation(\n tableLocation,\n menuItem.context,\n options.selectedRows?.length,\n )\n ) {\n return false;\n }\n\n if (tableLocation === \"grid\" && hasFilter(menuItem)) {\n return gridRowMeetsFilterCriteria(\n menuItem.context,\n options.row,\n options.selectedRows,\n menuItem.filter,\n options.columnMap,\n );\n }\n\n if (isCellMenu(menuItem) && menuItem.field !== \"*\") {\n return menuItem.field === options.columnName;\n }\n\n return true;\n};\n\nconst getMenuItemOptions = (\n menu: VuuMenuItem,\n options: VuuServerMenuOptions,\n): VuuMenuItem => {\n switch (menu.context) {\n case \"cell\":\n return {\n ...menu,\n field: options.columnName,\n rowKey: options.row[KEY],\n value: options.row[options.columnMap[options.columnName]],\n } as VuuCellMenuItem;\n case \"row\":\n return {\n ...menu,\n columns: options.columns,\n row: getRowRecord(options.row, options.columnMap),\n rowKey: options.row[KEY],\n } as VuuRowMenuItem;\n case \"selected-rows\":\n return {\n ...menu,\n columns: options.columns,\n } as any;\n default:\n return menu;\n }\n};\n\nexport const buildMenuDescriptorFromVuuMenu = (\n menu: VuuMenu | VuuMenuItem,\n tableLocation: TableMenuLocation,\n options: VuuServerMenuOptions,\n): ContextMenuItemDescriptor | undefined => {\n if (menuShouldBeRenderedInThisContext(menu, tableLocation, options)) {\n if (isVuuMenuItem(menu)) {\n return {\n label: menu.name,\n action: \"MENU_RPC_CALL\",\n options: getMenuItemOptions(menu, options),\n };\n } else {\n const children = menu.menus\n .map((childMenu) =>\n buildMenuDescriptorFromVuuMenu(childMenu, tableLocation, options),\n )\n .filter(\n (childMenu) => childMenu !== undefined,\n ) as ContextMenuItemDescriptor[];\n if (children.length > 0) {\n return {\n label: menu.name,\n children,\n };\n }\n }\n }\n};\n\nexport const getMenuRpcRequest = (\n options: VuuMenuItem,\n): Omit<VuuRpcMenuRequest, \"vpId\"> => {\n const { rpcName } = options;\n if (isCellMenu(options)) {\n return {\n field: options.field,\n rowKey: options.rowKey,\n rpcName,\n value: options.value,\n type: \"VIEW_PORT_MENU_CELL_RPC\",\n } as Omit<ClientToServerMenuCellRPC, \"vpId\">;\n } else if (isRowMenu(options)) {\n return {\n rowKey: options.rowKey,\n row: options.row,\n rpcName,\n type: \"VIEW_PORT_MENU_ROW_RPC\",\n } as Omit<ClientToServerMenuRowRPC, \"vpId\">;\n } else if (isSelectionMenu(options)) {\n return {\n rpcName,\n type: \"VIEW_PORT_MENUS_SELECT_RPC\",\n } as Omit<VuuRpcMenuRequest, \"vpId\">;\n } else {\n return {\n rpcName,\n type: \"VIEW_PORT_MENU_TABLE_RPC\",\n } as Omit<VuuRpcMenuRequest, \"vpId\">;\n }\n};\n\nexport const isOpenBulkEditResponse = (\n rpcResponse: Partial<VuuRpcResponse>,\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n (rpcResponse as MenuRpcResponse).rpcName === \"VP_BULK_EDIT_BEGIN_RPC\";\n\nexport const hasShowNotificationAction = (\n res: Partial<VuuRpcResponse>,\n): res is MenuRpcResponse<ShowNotificationAction> =>\n (res as MenuRpcResponse).action?.type === \"SHOW_NOTIFICATION_ACTION\";\n"],"names":[],"mappings":";;;AAmCA,MAAM,EAAE,KAAQ,GAAA,YAAA;AAET,MAAM,MAAS,GAAA,CAAC,IAAkB,KAAA,IAAA,CAAK,IAAS,KAAA;AAEhD,MAAM,UAAa,GAAA,CAAC,OACzB,KAAA,OAAA,CAAQ,OAAY,KAAA;AAEf,MAAM,SAAY,GAAA,CAAC,OACxB,KAAA,OAAA,CAAQ,OAAY,KAAA;AAEf,MAAM,eAAkB,GAAA,CAAC,OAC9B,KAAA,OAAA,CAAQ,OAAY,KAAA;AAEf,MAAM,yBAA4B,GAAA,CACvC,QAEA,KAAA,QAAA,KAAa,UAAa,UAAc,IAAA;AAE7B,MAAA,eAAA,GAAkB,CAC7B,QAEA,KAAA,CAAC,QAAQ,QAAU,EAAA,QAAQ,CAAE,CAAA,QAAA,CAAS,QAAQ;AAEhD,MAAM,aAAA,GAAgB,CAAC,IAAA,KACrB,SAAa,IAAA,IAAA;AAEf,MAAM,eAAA,GAAkB,CAAC,IAAA,KACvB,OAAW,IAAA,IAAA;AAEb,MAAM,SAAA,GAAY,CAAC,EAAE,MAAA,OACnB,OAAO,MAAA,KAAW,QAAY,IAAA,MAAA,CAAO,MAAS,GAAA,CAAA;AAEhD,MAAM,qCAAwC,GAAA,CAC5C,UACA,EAAA,UAAA,EACA,mBAAmB,CAChB,KAAA;AACH,EAAA,QAAQ,UAAY;AAAA,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AA;AAAA,MACA,IAAM,EAAA;AAAA,KACR;AAAA,GACK,MAAA;AACL,IAAO,OAAA;AAAA,MACL,OAAA;AAAA,MACA,IAAM,EAAA;AAAA,KACR;AAAA;AAEJ;AAEO,MAAM,sBAAyB,GAAA,CACpC,WAEC,KAAA,WAAA,CAAgC,OAAY,KAAA;AAExC,MAAM,yBAA4B,GAAA,CACvC,GAEC,KAAA,GAAA,CAAwB,QAAQ,IAAS,KAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"menu-utils.js","sources":["../src/menu-utils.ts"],"sourcesContent":["import {\n MenuRpcResponse,\n OpenDialogActionWithSchema,\n} from \"@vuu-ui/vuu-data-types\";\nimport {\n ShowNotificationAction,\n VuuRpcResponse,\n} from \"@vuu-ui/vuu-protocol-types\";\nimport {\n ContextMenuGroupItemDescriptor,\n ContextMenuItemDescriptor,\n} from \"@vuu-ui/vuu-context-menu\";\n\nexport const isGroupMenuItemDescriptor = (\n menuItem?: ContextMenuItemDescriptor,\n): menuItem is ContextMenuGroupItemDescriptor =>\n menuItem !== undefined && \"children\" in menuItem;\n\nexport const isOpenBulkEditResponse = (\n rpcResponse: Partial<VuuRpcResponse>,\n): rpcResponse is MenuRpcResponse<OpenDialogActionWithSchema> =>\n (rpcResponse as MenuRpcResponse).rpcName === \"VP_BULK_EDIT_BEGIN_RPC\";\n\nexport const hasShowNotificationAction = (\n res: Partial<VuuRpcResponse>,\n): res is MenuRpcResponse<ShowNotificationAction> =>\n (res as MenuRpcResponse).action?.type === \"SHOW_NOTIFICATION_ACTION\";\n"],"names":[],"mappings":"AAaO,MAAM,yBAA4B,GAAA,CACvC,QAEA,KAAA,QAAA,KAAa,UAAa,UAAc,IAAA;AAEnC,MAAM,sBAAyB,GAAA,CACpC,WAEC,KAAA,WAAA,CAAgC,OAAY,KAAA;AAExC,MAAM,yBAA4B,GAAA,CACvC,GAEC,KAAA,GAAA,CAAwB,QAAQ,IAAS,KAAA;;;;"}
|
package/esm/moving-window.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { metadataKeys } from './column-utils.js';
|
|
1
2
|
import { WindowRange } from './range-utils.js';
|
|
2
3
|
import { isRowSelectedLast } from './selection-utils.js';
|
|
3
|
-
import { metadataKeys } from './column-utils.js';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __typeError = (msg) => {
|
|
@@ -25,6 +25,7 @@ class MovingWindow {
|
|
|
25
25
|
}
|
|
26
26
|
this.rowCount = rowCount;
|
|
27
27
|
});
|
|
28
|
+
console.log(`[MovingWindow] new (${from}:${to})`);
|
|
28
29
|
__privateSet(this, _range, new WindowRange(from, to));
|
|
29
30
|
this.data = new Array(Math.max(0, to - from));
|
|
30
31
|
this.rowCount = 0;
|
|
@@ -50,6 +51,7 @@ class MovingWindow {
|
|
|
50
51
|
return __privateGet(this, _range).isWithin(index);
|
|
51
52
|
}
|
|
52
53
|
setRange({ from, to }) {
|
|
54
|
+
console.log(`[MovingWindow] setRange (${from}:${to})`);
|
|
53
55
|
if (from !== __privateGet(this, _range).from || to !== __privateGet(this, _range).to) {
|
|
54
56
|
const [overlapFrom, overlapTo] = __privateGet(this, _range).overlap(from, to);
|
|
55
57
|
const newData = new Array(Math.max(0, to - from));
|
package/esm/moving-window.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moving-window.js","sources":["../src/moving-window.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport {
|
|
1
|
+
{"version":3,"file":"moving-window.js","sources":["../src/moving-window.ts"],"sourcesContent":["import { DataSourceRow } from \"@vuu-ui/vuu-data-types\";\nimport { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\nimport { metadataKeys } from \"./column-utils\";\nimport { WindowRange } from \"./range-utils\";\nimport { isRowSelectedLast } from \"./selection-utils\";\n\nconst { SELECTED } = metadataKeys;\n\nexport class MovingWindow {\n public data: DataSourceRow[];\n public rowCount = 0;\n #range: WindowRange;\n\n constructor({ from, to }: VuuRange) {\n console.log(`[MovingWindow] new (${from}:${to})`);\n this.#range = new WindowRange(from, to);\n //internal data is always 0 based, we add range.from to determine an offset\n this.data = new Array(Math.max(0, to - from));\n this.rowCount = 0;\n }\n\n setRowCount = (rowCount: number) => {\n if (rowCount < this.data.length) {\n this.data.length = rowCount;\n }\n\n this.rowCount = rowCount;\n };\n\n add(data: DataSourceRow) {\n const [index] = data;\n if (this.isWithinRange(index)) {\n const internalIndex = index - this.#range.from;\n this.data[internalIndex] = data;\n\n // Hack until we can deal with this more elegantly. When we have a block\n // select operation, first row is selected (and updated via server), then\n // remaining rows are selected when we select the block-end row. We get an\n // update for all rows except first. Because we're extending the select status\n // on the client, we have to adjust the first row selected (its still selected\n // but is no longer the 'last selected row in block')\n // Maybe answer is to apply ALL the selection status code here, not in Viewport\n if (data[SELECTED]) {\n const previousRow = this.data[internalIndex - 1];\n if (isRowSelectedLast(previousRow)) {\n this.data[internalIndex - 1] = previousRow.slice() as DataSourceRow;\n this.data[internalIndex - 1][SELECTED] -= 4;\n }\n }\n }\n }\n\n getAtIndex(index: number) {\n return this.#range.isWithin(index) &&\n this.data[index - this.#range.from] != null\n ? this.data[index - this.#range.from]\n : undefined;\n }\n\n isWithinRange(index: number) {\n return this.#range.isWithin(index);\n }\n\n setRange({ from, to }: VuuRange) {\n console.log(`[MovingWindow] setRange (${from}:${to})`);\n\n if (from !== this.#range.from || to !== this.#range.to) {\n const [overlapFrom, overlapTo] = this.#range.overlap(from, to);\n const newData = new Array(Math.max(0, to - from));\n for (let i = overlapFrom; i < overlapTo; i++) {\n const data = this.getAtIndex(i);\n if (data) {\n const index = i - from;\n newData[index] = data;\n }\n }\n this.data = newData;\n this.#range.from = from;\n this.#range.to = to;\n }\n }\n\n getSelectedRows() {\n return this.data.filter((row) => row[SELECTED] !== 0);\n }\n\n get range() {\n return this.#range;\n }\n\n slice(): DataSourceRow[] {\n const data: DataSourceRow[] = [];\n const { from } = this.range;\n for (let i = 0; i < this.data.length; i++) {\n if (this.data[i]) {\n data.push(this.data[i]);\n } else {\n data.push([from + i, from + i, true, false, 1, 0, \"\", 0]);\n }\n }\n return data;\n }\n\n // TODO make this more performant, see implementation in\n // array-backed-moving-window - use same implementation\n get hasAllRowsWithinRange(): boolean {\n const { from, to } = this.#range;\n\n for (let i = from; i < to; i++) {\n if (this.getAtIndex(i) === undefined) {\n return false;\n }\n }\n return true;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,IAAA,MAAA;AAMA,MAAM,EAAE,UAAa,GAAA,YAAA;AAEd,MAAM,YAAa,CAAA;AAAA,EAKxB,WAAY,CAAA,EAAE,IAAM,EAAA,EAAA,EAAgB,EAAA;AAJpC,IAAO,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AACP,IAAA,aAAA,CAAA,IAAA,EAAO,UAAW,EAAA,CAAA,CAAA;AAClB,IAAA,YAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAUA,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,EAAc,CAAC,QAAqB,KAAA;AAClC,MAAI,IAAA,QAAA,GAAW,IAAK,CAAA,IAAA,CAAK,MAAQ,EAAA;AAC/B,QAAA,IAAA,CAAK,KAAK,MAAS,GAAA,QAAA;AAAA;AAGrB,MAAA,IAAA,CAAK,QAAW,GAAA,QAAA;AAAA,KAClB,CAAA;AAbE,IAAA,OAAA,CAAQ,GAAI,CAAA,CAAA,oBAAA,EAAuB,IAAI,CAAA,CAAA,EAAI,EAAE,CAAG,CAAA,CAAA,CAAA;AAChD,IAAA,YAAA,CAAA,IAAA,EAAK,MAAS,EAAA,IAAI,WAAY,CAAA,IAAA,EAAM,EAAE,CAAA,CAAA;AAEtC,IAAK,IAAA,CAAA,IAAA,GAAO,IAAI,KAAM,CAAA,IAAA,CAAK,IAAI,CAAG,EAAA,EAAA,GAAK,IAAI,CAAC,CAAA;AAC5C,IAAA,IAAA,CAAK,QAAW,GAAA,CAAA;AAAA;AA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I,IAAK,CAAA,IAAA,CAAK,QAAQ,CAAK,EAAA,EAAA;AACzC,MAAI,IAAA,IAAA,CAAK,IAAK,CAAA,CAAC,CAAG,EAAA;AAChB,QAAA,IAAA,CAAK,IAAK,CAAA,IAAA,CAAK,IAAK,CAAA,CAAC,CAAC,CAAA;AAAA,OACjB,MAAA;AACL,QAAA,IAAA,CAAK,IAAK,CAAA,CAAC,IAAO,GAAA,CAAA,EAAG,IAAO,GAAA,CAAA,EAAG,IAAM,EAAA,KAAA,EAAO,CAAG,EAAA,CAAA,EAAG,EAAI,EAAA,CAAC,CAAC,CAAA;AAAA;AAC1D;AAEF,IAAO,OAAA,IAAA;AAAA;AACT;AAAA;AAAA,EAIA,IAAI,qBAAiC,GAAA;AACnC,IAAA,MAAM,EAAE,IAAA,EAAM,EAAG,EAAA,GAAI,YAAK,CAAA,IAAA,EAAA,MAAA,CAAA;AAE1B,IAAA,KAAA,IAAS,CAAI,GAAA,IAAA,EAAM,CAAI,GAAA,EAAA,EAAI,CAAK,EAAA,EAAA;AAC9B,MAAA,IAAI,IAAK,CAAA,UAAA,CAAW,CAAC,CAAA,KAAM,KAAW,CAAA,EAAA;AACpC,QAAO,OAAA,KAAA;AAAA;AACT;AAEF,IAAO,OAAA,IAAA;AAAA;AAEX;AAxGE,MAAA,GAAA,IAAA,OAAA,EAAA;;;;"}
|
package/esm/range-utils.js
CHANGED
|
@@ -1,10 +1,95 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
2
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
9
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
11
|
+
var _baseFrom, _renderBufferSize, _rowCount, _baseTo;
|
|
12
|
+
const defaultRangeOptions = {
|
|
13
|
+
renderBufferSize: 0,
|
|
14
|
+
rowCount: -1
|
|
7
15
|
};
|
|
16
|
+
const _RangeImpl = class _RangeImpl {
|
|
17
|
+
constructor(from, to, rangeOptions = defaultRangeOptions) {
|
|
18
|
+
__privateAdd(this, _baseFrom);
|
|
19
|
+
__privateAdd(this, _renderBufferSize, 0);
|
|
20
|
+
__privateAdd(this, _rowCount, -1);
|
|
21
|
+
__privateAdd(this, _baseTo);
|
|
22
|
+
// We have to keep these as simple public properties (not getters) so they survive structuredClone
|
|
23
|
+
__publicField(this, "from", 0);
|
|
24
|
+
__publicField(this, "to", 0);
|
|
25
|
+
__privateSet(this, _baseFrom, from);
|
|
26
|
+
__privateSet(this, _baseTo, to);
|
|
27
|
+
this.renderBufferSize = rangeOptions.renderBufferSize ?? defaultRangeOptions.renderBufferSize;
|
|
28
|
+
this.rowCount = rangeOptions.rowCount ?? defaultRangeOptions.rowCount;
|
|
29
|
+
console.log(
|
|
30
|
+
`[Range] new (${__privateGet(this, _baseFrom)}:${__privateGet(this, _baseTo)}) renderBuffer: ${this.renderBufferSize}, rowCount: ${this.rowCount}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
get firstRowInViewport() {
|
|
34
|
+
return __privateGet(this, _baseFrom) + 1;
|
|
35
|
+
}
|
|
36
|
+
get lastRowInViewport() {
|
|
37
|
+
if (__privateGet(this, _rowCount) > 0) {
|
|
38
|
+
return Math.min(__privateGet(this, _baseTo), __privateGet(this, _rowCount));
|
|
39
|
+
} else {
|
|
40
|
+
return __privateGet(this, _baseTo);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
get renderBufferSize() {
|
|
44
|
+
return __privateGet(this, _renderBufferSize);
|
|
45
|
+
}
|
|
46
|
+
set renderBufferSize(value) {
|
|
47
|
+
__privateSet(this, _renderBufferSize, value);
|
|
48
|
+
this.from = Math.max(0, __privateGet(this, _baseFrom) - value);
|
|
49
|
+
if (__privateGet(this, _rowCount) > 0) {
|
|
50
|
+
this.to = Math.max(__privateGet(this, _baseTo) + __privateGet(this, _renderBufferSize), __privateGet(this, _rowCount));
|
|
51
|
+
} else {
|
|
52
|
+
this.to = __privateGet(this, _baseTo) + __privateGet(this, _renderBufferSize);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
get rowCount() {
|
|
56
|
+
return __privateGet(this, _rowCount);
|
|
57
|
+
}
|
|
58
|
+
set rowCount(value) {
|
|
59
|
+
__privateSet(this, _rowCount, value);
|
|
60
|
+
if (value > 0) {
|
|
61
|
+
this.to = Math.min(__privateGet(this, _baseTo) + __privateGet(this, _renderBufferSize), value);
|
|
62
|
+
} else {
|
|
63
|
+
this.to = __privateGet(this, _baseTo) + __privateGet(this, _renderBufferSize);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
get reset() {
|
|
67
|
+
return new _RangeImpl(0, __privateGet(this, _baseTo) - __privateGet(this, _baseFrom), {
|
|
68
|
+
rowCount: __privateGet(this, _rowCount),
|
|
69
|
+
renderBufferSize: __privateGet(this, _renderBufferSize)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
equals(range) {
|
|
73
|
+
return range.from === __privateGet(this, _baseFrom) && range.to === __privateGet(this, _baseTo);
|
|
74
|
+
}
|
|
75
|
+
toJson() {
|
|
76
|
+
return {
|
|
77
|
+
from: this.from,
|
|
78
|
+
to: this.to,
|
|
79
|
+
baseFrom: __privateGet(this, _baseFrom),
|
|
80
|
+
baseTo: __privateGet(this, _baseTo),
|
|
81
|
+
renderBufferSize: __privateGet(this, _renderBufferSize),
|
|
82
|
+
rowCount: __privateGet(this, _rowCount)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
_baseFrom = new WeakMap();
|
|
87
|
+
_renderBufferSize = new WeakMap();
|
|
88
|
+
_rowCount = new WeakMap();
|
|
89
|
+
_baseTo = new WeakMap();
|
|
90
|
+
let RangeImpl = _RangeImpl;
|
|
91
|
+
const Range = (from, to, rangeOptions) => new RangeImpl(from, to, rangeOptions);
|
|
92
|
+
const NULL_RANGE = Range(0, 0);
|
|
8
93
|
function getFullRange({ from, to }, bufferSize = 0, totalRowCount = Number.MAX_SAFE_INTEGER) {
|
|
9
94
|
if (from === 0 && to === 0) {
|
|
10
95
|
return { from, to };
|
|
@@ -33,14 +118,6 @@ function getFullRange({ from, to }, bufferSize = 0, totalRowCount = Number.MAX_S
|
|
|
33
118
|
}
|
|
34
119
|
}
|
|
35
120
|
}
|
|
36
|
-
function resetRange({ from, to, bufferSize = 0 }) {
|
|
37
|
-
return {
|
|
38
|
-
from: 0,
|
|
39
|
-
to: to - from,
|
|
40
|
-
bufferSize,
|
|
41
|
-
reset: true
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
121
|
const withinRange = (value, { from, to }) => value >= from && value < to;
|
|
45
122
|
const rangeNewItems = ({ from: from1, to: to1 }, newRange) => {
|
|
46
123
|
const { from: from2, to: to2 } = newRange;
|
|
@@ -67,5 +144,5 @@ class WindowRange {
|
|
|
67
144
|
}
|
|
68
145
|
}
|
|
69
146
|
|
|
70
|
-
export { NULL_RANGE, WindowRange, getFullRange, rangeNewItems,
|
|
147
|
+
export { NULL_RANGE, Range, WindowRange, getFullRange, rangeNewItems, withinRange };
|
|
71
148
|
//# sourceMappingURL=range-utils.js.map
|
package/esm/range-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-utils.js","sources":["../src/range-utils.ts"],"sourcesContent":["export interface VuuRange {\n from: number;\n to: number;\n bufferSize?: number;\n reset?: boolean;\n}\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport const NULL_RANGE: VuuRange = { from: 0, to: 0 } as const;\n\nexport const rangesAreSame = (\n r1: VuuRange | undefined,\n r2: VuuRange | undefined\n) => {\n return r1?.from === r2?.from && r1?.to === r2?.to;\n};\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n totalRowCount: number = Number.MAX_SAFE_INTEGER\n): FromToRange {\n if (from === 0 && to === 0) {\n return { from, to };\n } else if (bufferSize === 0) {\n if (totalRowCount < from) {\n return { from: 0, to: 0 };\n } else {\n return { from, to: Math.min(to, totalRowCount) };\n }\n } else if (from === 0) {\n return { from, to: Math.min(to + bufferSize, totalRowCount) };\n } else {\n const shortfallBefore = from - bufferSize < 0;\n const shortfallAfter = totalRowCount - (to + bufferSize) < 0;\n if (shortfallBefore && shortfallAfter) {\n return { from: 0, to: totalRowCount };\n } else if (shortfallBefore) {\n return { from: 0, to: to + bufferSize };\n } else if (shortfallAfter) {\n return {\n from: Math.max(0, from - bufferSize),\n to: totalRowCount,\n };\n } else {\n return { from: from - bufferSize, to: to + bufferSize };\n }\n }\n}\n\nexport function resetRange({ from, to, bufferSize = 0 }: VuuRange): VuuRange {\n return {\n from: 0,\n to: to - from,\n bufferSize,\n reset: true,\n };\n}\n\nexport const withinRange = (value: number, { from, to }: VuuRange) =>\n value >= from && value < to;\n\n// export const rangeOverlap = (\n// { from: from1, to: to1 }: VuuRange,\n// { from: from2, to: to2 }: VuuRange\n// ): VuuRange => {\n// return from2 >= to1 || to2 < from1\n// ? { from: 0, to: 0 }\n// : { from: Math.max(from2, from1), to: Math.min(to2, to1) };\n// };\n\nexport const rangeNewItems = (\n { from: from1, to: to1 }: VuuRange,\n newRange: VuuRange\n): VuuRange => {\n const { from: from2, to: to2 } = newRange;\n const noOverlap = from2 >= to1 || to2 <= from1;\n const newFullySubsumesOld = from2 < from1 && to2 > to1;\n return noOverlap || newFullySubsumesOld\n ? newRange\n : to2 > to1\n ? { from: to1, to: to2 }\n : { from: from2, to: from1 };\n};\n\nexport class WindowRange {\n public from: number;\n public to: number;\n\n constructor(from: number, to: number) {\n this.from = from;\n this.to = to;\n }\n\n public isWithin(index: number) {\n return withinRange(index, this);\n }\n\n //find the overlap of this range and a new one\n public overlap(from: number, to: number): [number, number] {\n return from >= this.to || to < this.from\n ? [0, 0]\n : [Math.max(from, this.from), Math.min(to, this.to)];\n }\n\n public copy(): WindowRange {\n return new WindowRange(this.from, this.to);\n }\n}\n"],"names":[],"mappings":";;;AAYO,MAAM,UAAuB,GAAA,EAAE,IAAM,EAAA,CAAA,EAAG,IAAI,CAAE;AAExC,MAAA,aAAA,GAAgB,CAC3B,EAAA,EACA,EACG,KAAA;AACH,EAAA,OAAO,IAAI,IAAS,KAAA,EAAA,EAAI,IAAQ,IAAA,EAAA,EAAI,OAAO,EAAI,EAAA,EAAA;AACjD;AAEgB,SAAA,YAAA,CACd,EAAE,IAAM,EAAA,EAAA,IACR,UAAa,GAAA,CAAA,EACb,aAAwB,GAAA,MAAA,CAAO,gBAClB,EAAA;AACb,EAAI,IAAA,IAAA,KAAS,CAAK,IAAA,EAAA,KAAO,CAAG,EAAA;AAC1B,IAAO,OAAA,EAAE,MAAM,EAAG,EAAA;AAAA,GACpB,MAAA,IAAW,eAAe,CAAG,EAAA;AAC3B,IAAA,IAAI,gBAAgB,IAAM,EAAA;AACxB,MAAA,OAAO,EAAE,IAAA,EAAM,CAAG,EAAA,EAAA,EAAI,CAAE,EAAA;AAAA,KACnB,MAAA;AACL,MAAA,OAAO,EAAE,IAAM,EAAA,EAAA,EAAI,KAAK,GAAI,CAAA,EAAA,EAAI,aAAa,CAAE,EAAA;AAAA;AACjD,GACF,MAAA,IAAW,SAAS,CAAG,EAAA;AACrB,IAAO,OAAA,EAAE,MAAM,EAAI,EAAA,IAAA,CAAK,IAAI,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AAA,IAAO,GAAO,IAAA,KAAA;AACzC,EAAM,MAAA,mBAAA,GAAsB,KAAQ,GAAA,KAAA,IAAS,GAAM,GAAA,GAAA;AACnD,EAAA,OAAO,SAAa,IAAA,mBAAA,GAChB,QACA,GAAA,GAAA,GAAM,MACN,EAAE,IAAA,EAAM,GAAK,EAAA,EAAA,EAAI,KACjB,GAAA,EAAE,IAAM,EAAA,KAAA,EAAO,IAAI,KAAM,EAAA;AAC/B;AAEO,MAAM,WAAY,CAAA;AAAA,EAIvB,WAAA,CAAY,MAAc,EAAY,EAAA;AAHtC,IAAO,aAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AACP,IAAO,aAAA,CAAA,IAAA,EAAA,IAAA,CAAA;AAGL,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AACZ,IAAA,IAAA,CAAK,EAAK,GAAA,EAAA;AAAA;AACZ,EAEO,SAAS,KAAe,EAAA;AAC7B,IAAO,OAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AAAA;AAChC;AAAA,EAGO,OAAA,CAAQ,MAAc,EAA8B,EAAA;AACzD,IAAO,OAAA,IAAA,IAAQ,KAAK,EAAM,IAAA,EAAA,GAAK,KAAK,IAChC,GAAA,CAAC,CAAG,EAAA,CAAC,CACL,GAAA,CAAC,KAAK,GAAI,CAAA,IAAA,EAAM,KAAK,IAAI,CAAA,EAAG,KAAK,GAAI,CAAA,EAAA,EAAI,IAAK,CAAA,EAAE,CAAC,CAAA;AAAA;AACvD,EAEO,IAAoB,GAAA;AACzB,IAAA,OAAO,IAAI,WAAA,CAAY,IAAK,CAAA,IAAA,EAAM,KAAK,EAAE,CAAA;AAAA;AAE7C;;;;"}
|
|
1
|
+
{"version":3,"file":"range-utils.js","sources":["../src/range-utils.ts"],"sourcesContent":["import { VuuRange } from \"@vuu-ui/vuu-protocol-types\";\n\ninterface FromToRange {\n from: number;\n to: number;\n}\n\nexport interface Range extends VuuRange {\n equals: (vuuRange: VuuRange) => boolean;\n firstRowInViewport: number;\n lastRowInViewport: number;\n renderBufferSize?: number;\n reset: Range;\n rowCount?: number;\n}\n\nexport interface RangeOptions {\n renderBufferSize?: number;\n rowCount?: number;\n}\n\nconst defaultRangeOptions = {\n renderBufferSize: 0,\n rowCount: -1,\n};\nclass RangeImpl implements Range {\n #baseFrom: number;\n #renderBufferSize = 0;\n #rowCount = -1;\n #baseTo: number;\n\n // We have to keep these as simple public properties (not getters) so they survive structuredClone\n public from = 0;\n public to = 0;\n\n constructor(\n /** Index position of first visible row in viewport */\n from: number,\n /** Index position of last visible row in viewport + 1 */\n to: number,\n rangeOptions: RangeOptions = defaultRangeOptions,\n ) {\n this.#baseFrom = from;\n this.#baseTo = to;\n this.renderBufferSize =\n rangeOptions.renderBufferSize ?? defaultRangeOptions.renderBufferSize;\n this.rowCount = rangeOptions.rowCount ?? defaultRangeOptions.rowCount;\n\n console.log(\n `[Range] new (${this.#baseFrom}:${this.#baseTo}) renderBuffer: ${this.renderBufferSize}, rowCount: ${this.rowCount}`,\n );\n }\n\n get firstRowInViewport() {\n return this.#baseFrom + 1;\n }\n\n get lastRowInViewport() {\n if (this.#rowCount > 0) {\n return Math.min(this.#baseTo, this.#rowCount);\n } else {\n return this.#baseTo;\n }\n }\n\n get renderBufferSize() {\n return this.#renderBufferSize;\n }\n\n set renderBufferSize(value: number) {\n this.#renderBufferSize = value;\n this.from = Math.max(0, this.#baseFrom - value);\n if (this.#rowCount > 0) {\n this.to = Math.max(this.#baseTo + this.#renderBufferSize, this.#rowCount);\n } else {\n this.to = this.#baseTo + this.#renderBufferSize;\n }\n }\n\n get rowCount() {\n return this.#rowCount;\n }\n\n set rowCount(value: number) {\n this.#rowCount = value;\n if (value > 0) {\n this.to = Math.min(this.#baseTo + this.#renderBufferSize, value);\n } else {\n this.to = this.#baseTo + this.#renderBufferSize;\n }\n }\n\n get reset() {\n return new RangeImpl(0, this.#baseTo - this.#baseFrom, {\n rowCount: this.#rowCount,\n renderBufferSize: this.#renderBufferSize,\n });\n }\n\n equals(range: VuuRange) {\n return range.from === this.#baseFrom && range.to === this.#baseTo;\n }\n\n toJson() {\n return {\n from: this.from,\n to: this.to,\n baseFrom: this.#baseFrom,\n baseTo: this.#baseTo,\n renderBufferSize: this.#renderBufferSize,\n rowCount: this.#rowCount,\n };\n }\n}\n\nexport const Range = (\n from: number,\n to: number,\n rangeOptions?: RangeOptions,\n): Range => new RangeImpl(from, to, rangeOptions);\n\nexport const NULL_RANGE = Range(0, 0);\n\nexport function getFullRange(\n { from, to }: VuuRange,\n bufferSize = 0,\n totalRowCount: number = Number.MAX_SAFE_INTEGER,\n): FromToRange {\n if (from === 0 && to === 0) {\n return { from, to };\n } else if (bufferSize === 0) {\n if (totalRowCount < from) {\n return { from: 0, to: 0 };\n } else {\n return { from, to: Math.min(to, totalRowCount) };\n }\n } else if (from === 0) {\n return { from, to: Math.min(to + bufferSize, totalRowCount) };\n } else {\n const shortfallBefore = from - bufferSize < 0;\n const shortfallAfter = totalRowCount - (to + bufferSize) < 0;\n if (shortfallBefore && shortfallAfter) {\n return { from: 0, to: totalRowCount };\n } else if (shortfallBefore) {\n return { from: 0, to: to + bufferSize };\n } else if (shortfallAfter) {\n return {\n from: Math.max(0, from - bufferSize),\n to: totalRowCount,\n };\n } else {\n return { from: from - bufferSize, to: to + bufferSize };\n }\n }\n}\n\nexport const withinRange = (value: number, { from, to }: VuuRange) =>\n value >= from && value < to;\n\n// export const rangeOverlap = (\n// { from: from1, to: to1 }: VuuRange,\n// { from: from2, to: to2 }: VuuRange\n// ): VuuRange => {\n// return from2 >= to1 || to2 < from1\n// ? { from: 0, to: 0 }\n// : { from: Math.max(from2, from1), to: Math.min(to2, to1) };\n// };\n\nexport const rangeNewItems = (\n { from: from1, to: to1 }: VuuRange,\n newRange: VuuRange,\n): VuuRange => {\n const { from: from2, to: to2 } = newRange;\n const noOverlap = from2 >= to1 || to2 <= from1;\n const newFullySubsumesOld = from2 < from1 && to2 > to1;\n return noOverlap || newFullySubsumesOld\n ? newRange\n : to2 > to1\n ? { from: to1, to: to2 }\n : { from: from2, to: from1 };\n};\n\nexport class WindowRange {\n public from: number;\n public to: number;\n\n constructor(from: number, to: number) {\n this.from = from;\n this.to = to;\n }\n\n public isWithin(index: number) {\n return withinRange(index, this);\n }\n\n //find the overlap of this range and a new one\n public overlap(from: number, to: number): [number, number] {\n return from >= this.to || to < this.from\n ? [0, 0]\n : [Math.max(from, this.from), Math.min(to, this.to)];\n }\n\n public copy(): WindowRange {\n return new WindowRange(this.from, this.to);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAAA,IAAA,SAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,OAAA;AAqBA,MAAM,mBAAsB,GAAA;AAAA,EAC1B,gBAAkB,EAAA,CAAA;AAAA,EAClB,QAAU,EAAA,CAAA;AACZ,CAAA;AACA,MAAM,UAAA,GAAN,MAAM,UAA2B,CAAA;AAAA,EAU/B,WAEE,CAAA,IAAA,EAEA,EACA,EAAA,YAAA,GAA6B,mBAC7B,EAAA;AAfF,IAAA,YAAA,CAAA,IAAA,EAAA,SAAA,CAAA;AACA,IAAoB,YAAA,CAAA,IAAA,EAAA,iBAAA,EAAA,CAAA,CAAA;AACpB,IAAY,YAAA,CAAA,IAAA,EAAA,SAAA,EAAA,CAAA,CAAA,CAAA;AACZ,IAAA,YAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AAGA;AAAA,IAAA,aAAA,CAAA,IAAA,EAAO,MAAO,EAAA,CAAA,CAAA;AACd,IAAA,aAAA,CAAA,IAAA,EAAO,IAAK,EAAA,CAAA,CAAA;AASV,IAAA,YAAA,CAAA,IAAA,EAAK,SAAY,EAAA,IAAA,CAAA;AACjB,IAAA,YAAA,CAAA,IAAA,EAAK,OAAU,EAAA,EAAA,CAAA;AACf,IAAK,IAAA,CAAA,gBAAA,GACH,YAAa,CAAA,gBAAA,IAAoB,mBAAoB,CAAA,gBAAA;AACvD,IAAK,IAAA,CAAA,QAAA,GAAW,YAAa,CAAA,QAA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,CAAA,IAAA,EAAA,MAAA,CAAA;AACP,IAAO,aAAA,CAAA,IAAA,EAAA,IAAA,CAAA;AAGL,IAAA,IAAA,CAAK,IAAO,GAAA,IAAA;AACZ,IAAA,IAAA,CAAK,EAAK,GAAA,EAAA;AAAA;AACZ,EAEO,SAAS,KAAe,EAAA;AAC7B,IAAO,OAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AAAA;AAChC;AAAA,EAGO,OAAA,CAAQ,MAAc,EAA8B,EAAA;AACzD,IAAO,OAAA,IAAA,IAAQ,KAAK,EAAM,IAAA,EAAA,GAAK,KAAK,IAChC,GAAA,CAAC,CAAG,EAAA,CAAC,CACL,GAAA,CAAC,KAAK,GAAI,CAAA,IAAA,EAAM,KAAK,IAAI,CAAA,EAAG,KAAK,GAAI,CAAA,EAAA,EAAI,IAAK,CAAA,EAAE,CAAC,CAAA;AAAA;AACvD,EAEO,IAAoB,GAAA;AACzB,IAAA,OAAO,IAAI,WAAA,CAAY,IAAK,CAAA,IAAA,EAAM,KAAK,EAAE,CAAA;AAAA;AAE7C;;;;"}
|
package/esm/sort-utils.js
CHANGED
|
@@ -52,6 +52,22 @@ const addSortColumn = ({ sortDefs }, column, sortType = "A") => {
|
|
|
52
52
|
return { sortDefs: [sortEntry] };
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
const getSortStatus = (columnName, vuuSort) => {
|
|
56
|
+
if (vuuSort === void 0 || vuuSort.sortDefs.length === 0) {
|
|
57
|
+
return "no-sort";
|
|
58
|
+
} else {
|
|
59
|
+
const sortDef = vuuSort.sortDefs.find((sd) => sd.column === columnName);
|
|
60
|
+
if (sortDef) {
|
|
61
|
+
if (vuuSort.sortDefs.length === 1) {
|
|
62
|
+
return sortDef.sortType === "A" ? "single-sort-asc" : "single-sort-desc";
|
|
63
|
+
} else {
|
|
64
|
+
return sortDef.sortType === "A" ? "multi-sort-includes-column-asc" : "multi-sort-includes-column-desc";
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
return "sort-other-column";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
55
71
|
|
|
56
|
-
export { addSortColumn, setSortColumn, toggleOrApplySort };
|
|
72
|
+
export { addSortColumn, getSortStatus, setSortColumn, toggleOrApplySort };
|
|
57
73
|
//# sourceMappingURL=sort-utils.js.map
|
package/esm/sort-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-utils.js","sources":["../src/sort-utils.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"sort-utils.js","sources":["../src/sort-utils.ts"],"sourcesContent":["import { ColumnDescriptor } from \"@vuu-ui/vuu-table-types\";\nimport { VuuSort, VuuSortCol, VuuSortType } from \"@vuu-ui/vuu-protocol-types\";\n\nconst cycleSortType = (sortType: VuuSortType) =>\n sortType === \"A\" ? \"D\" : sortType === \"D\" ? undefined : \"A\";\n\nconst NO_SORT: VuuSort = { sortDefs: [] };\n\n// Given an existing sort spec and a column we wish to sort by,\n// construct and return a new sort spec.\nexport const toggleOrApplySort = (\n { sortDefs }: VuuSort,\n { name: column }: ColumnDescriptor,\n extendSort = false,\n sortType?: VuuSortType,\n): VuuSort => {\n if (extendSort) {\n const existingDef = sortDefs.find((sortDef) => sortDef.column === column);\n if (existingDef) {\n return {\n sortDefs: sortDefs.map((sortDef) =>\n sortDef.column === column\n ? {\n column,\n sortType: sortDef.sortType === \"A\" ? \"D\" : \"A\",\n }\n : sortDef,\n ),\n };\n } else {\n return {\n sortDefs: sortDefs.concat({\n column,\n sortType: sortType ?? \"A\",\n }),\n };\n }\n }\n\n const newSortType =\n typeof sortType === \"string\"\n ? sortType\n : sortDefs.length === 1 && sortDefs[0].column === column\n ? cycleSortType(sortDefs[0].sortType)\n : \"A\";\n\n return newSortType\n ? {\n sortDefs: [{ column, sortType: newSortType }],\n }\n : NO_SORT;\n};\n\nexport const setSortColumn = (\n { sortDefs }: VuuSort,\n column: ColumnDescriptor,\n sortType?: \"A\" | \"D\",\n): VuuSort => {\n if (sortType === undefined) {\n const columnSort = sortDefs.find((item) => item.column === column.name);\n if (columnSort) {\n return {\n sortDefs: [\n {\n column: column.name,\n sortType: columnSort.sortType === \"A\" ? \"D\" : \"A\",\n },\n ],\n };\n }\n }\n return { sortDefs: [{ column: column.name, sortType: sortType ?? \"A\" }] };\n};\n\nexport const addSortColumn = (\n { sortDefs }: VuuSort,\n column: ColumnDescriptor,\n sortType: \"A\" | \"D\" = \"A\",\n): VuuSort => {\n const sortEntry: VuuSortCol = { column: column.name, sortType };\n if (sortDefs.length > 0) {\n return {\n sortDefs: sortDefs.concat(sortEntry),\n };\n } else {\n return { sortDefs: [sortEntry] };\n }\n};\n\nexport type ColumnSortStatus =\n | \"no-sort\"\n | \"sort-other-column\"\n | \"single-sort-asc\"\n | \"single-sort-desc\"\n | \"multi-sort-includes-column-asc\"\n | \"multi-sort-includes-column-desc\";\n\n/**\n * Given a VuuSort definition and a column, determine whether the given column\n * is included in the sort and if so, in what position/direction.\n */\nexport const getSortStatus = (\n columnName: string,\n vuuSort?: VuuSort,\n): ColumnSortStatus => {\n if (vuuSort === undefined || vuuSort.sortDefs.length === 0) {\n return \"no-sort\";\n } else {\n const sortDef = vuuSort.sortDefs.find((sd) => sd.column === columnName);\n if (sortDef) {\n if (vuuSort.sortDefs.length === 1) {\n return sortDef.sortType === \"A\"\n ? \"single-sort-asc\"\n : \"single-sort-desc\";\n } else {\n return sortDef.sortType === \"A\"\n ? \"multi-sort-includes-column-asc\"\n : \"multi-sort-includes-column-desc\";\n }\n } else {\n return \"sort-other-column\";\n }\n }\n};\n"],"names":[],"mappings":"AAGA,MAAM,aAAA,GAAgB,CAAC,QACrB,KAAA,QAAA,KAAa,MAAM,GAAM,GAAA,QAAA,KAAa,MAAM,KAAY,CAAA,GAAA,GAAA;AAE1D,MAAM,OAAmB,GAAA,EAAE,QAAU,EAAA,EAAG,EAAA;AAI3B,MAAA,iBAAA,GAAoB,CAC/B,EAAE,QAA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AACN,KACK,MAAA;AACL,MAAO,OAAA,mBAAA;AAAA;AACT;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.12.0",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@vuu-ui/vuu-data-types": "0.
|
|
8
|
-
"@vuu-ui/vuu-table-types": "0.
|
|
9
|
-
"@vuu-ui/vuu-filter-types": "0.
|
|
10
|
-
"@vuu-ui/vuu-protocol-types": "0.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.12.0",
|
|
8
|
+
"@vuu-ui/vuu-table-types": "0.12.0",
|
|
9
|
+
"@vuu-ui/vuu-filter-types": "0.12.0",
|
|
10
|
+
"@vuu-ui/vuu-protocol-types": "0.12.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"@internationalized/date": "^3.0.0",
|
|
14
|
-
"@vuu-ui/vuu-filter-parser": "0.
|
|
14
|
+
"@vuu-ui/vuu-filter-parser": "0.12.0",
|
|
15
15
|
"clsx": "^2.0.0",
|
|
16
16
|
"react": "^18.3.1",
|
|
17
17
|
"react-dom": "^18.3.1"
|
package/types/column-utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataSourceRow, DataValueType, DataValueTypeSimple, DateTimeDataValueDescriptor, SchemaColumn, TableSchema } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import type { VuuAggType, VuuAggregation, VuuColumnDataType, VuuDataRow,
|
|
2
|
+
import type { VuuAggType, VuuAggregation, VuuColumnDataType, VuuDataRow, VuuDataRowDto, VuuGroupBy, VuuSort } from "@vuu-ui/vuu-protocol-types";
|
|
3
3
|
import type { ColumnAlignment, ColumnDescriptor, ColumnLayout, DataValueTypeDescriptor, ColumnTypeFormatting, ColumnTypeRendering, ColumnTypeWithValidationRules, DefaultColumnConfiguration, GroupColumnDescriptor, LookupRenderer, MappedValueTypeRenderer, PinLocation, RuntimeColumnDescriptor, TableCellRendererProps, TableConfig, TableHeadings, ValueListRenderer } from "@vuu-ui/vuu-table-types";
|
|
4
4
|
import { type CSSProperties } from "react";
|
|
5
5
|
import { TableModel } from "@vuu-ui/vuu-table";
|
|
@@ -44,7 +44,7 @@ export declare const isLookupRenderer: (renderer?: unknown) => renderer is Looku
|
|
|
44
44
|
export declare const isValueListRenderer: (renderer?: unknown) => renderer is ValueListRenderer;
|
|
45
45
|
export declare const hasValidationRules: (type?: DataValueType) => type is ColumnTypeWithValidationRules;
|
|
46
46
|
export declare const isMappedValueTypeRenderer: (renderer?: unknown) => renderer is MappedValueTypeRenderer;
|
|
47
|
-
export declare function buildColumnMap(columns?: (
|
|
47
|
+
export declare function buildColumnMap(columns?: (ColumnDescriptor | SchemaColumn | string)[]): ColumnMap;
|
|
48
48
|
export declare function projectUpdates(updates: number[]): number[];
|
|
49
49
|
export declare const metadataKeys: {
|
|
50
50
|
readonly IDX: 0;
|
|
@@ -84,7 +84,7 @@ export declare const measurePinnedColumns: (columns: RuntimeColumnDescriptor[],
|
|
|
84
84
|
};
|
|
85
85
|
export declare const getTableHeadings: (columns: RuntimeColumnDescriptor[]) => TableHeadings;
|
|
86
86
|
export declare const getColumnStyle: ({ pin, pinnedOffset, width, }: RuntimeColumnDescriptor) => CSSProperties;
|
|
87
|
-
export declare const setAggregations: (aggregations: VuuAggregation[], column:
|
|
87
|
+
export declare const setAggregations: (aggregations: VuuAggregation[], column: ColumnDescriptor, aggType: VuuAggType) => VuuAggregation[];
|
|
88
88
|
export type ColumnGroupProps = {
|
|
89
89
|
columns: RuntimeColumnDescriptor[];
|
|
90
90
|
groupBy: VuuGroupBy;
|
|
@@ -101,7 +101,7 @@ export declare const findColumn: (columns: RuntimeColumnDescriptor[], columnName
|
|
|
101
101
|
export declare function updateColumn<T extends ColumnDescriptor>(columns: T[], column: T): T[];
|
|
102
102
|
export declare function updateColumn(columns: RuntimeColumnDescriptor[], column: string, options: Partial<ColumnDescriptor>): RuntimeColumnDescriptor[];
|
|
103
103
|
export declare const toDataSourceColumns: (column: ColumnDescriptor) => string;
|
|
104
|
-
export declare const
|
|
104
|
+
export declare const dataSourceRowToDataRowDto: (row: DataSourceRow, columnMap: ColumnMap) => VuuDataRowDto;
|
|
105
105
|
export declare const isDataLoading: (columns: RuntimeColumnDescriptor[]) => boolean;
|
|
106
106
|
export declare const getColumnsInViewport: (columns: RuntimeColumnDescriptor[], vpStart: number, vpEnd: number) => [RuntimeColumnDescriptor[], number];
|
|
107
107
|
export declare const isNotHidden: (column: RuntimeColumnDescriptor) => boolean;
|