@deephaven/jsapi-utils
Advanced tools
Comparing version 0.13.3-treemap.2 to 0.14.0
@@ -23,2 +23,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var ns = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0; | ||
if (!timeZone) { | ||
throw new Error('No timezone provided'); | ||
} | ||
var yearString = "".concat(year).padStart(4, '0'); | ||
@@ -25,0 +30,0 @@ var monthString = "".concat(month + 1).padStart(2, '0'); |
@@ -6,3 +6,3 @@ import { DataType } from './TableUtils'; | ||
columnType: string; | ||
columnName: string; | ||
columnName: ColumnName; | ||
format: TableColumnFormat; | ||
@@ -23,3 +23,3 @@ } | ||
*/ | ||
static makeColumnFormattingRule(columnType: DataType, columnName: string, format: TableColumnFormat): FormattingRule; | ||
static makeColumnFormattingRule(columnType: DataType, columnName: ColumnName, format: TableColumnFormat): FormattingRule; | ||
/** | ||
@@ -50,3 +50,3 @@ * @param columnFormattingRules Optional array of column formatting rules | ||
*/ | ||
getColumnFormat(columnType: string, columnName: string): TableColumnFormat | null; | ||
getColumnFormat(columnType: string, columnName: ColumnName): TableColumnFormat | null; | ||
getColumnTypeFormatter(columnType: string): TableColumnFormatter; | ||
@@ -60,3 +60,3 @@ /** | ||
*/ | ||
getFormattedString(value: unknown, columnType: string, columnName?: string, formatOverride?: TableColumnFormat): string; | ||
getFormattedString(value: unknown, columnType: string, columnName?: string, formatOverride?: Partial<TableColumnFormat>): string; | ||
/** | ||
@@ -63,0 +63,0 @@ * Gets the timeZone name |
@@ -37,5 +37,5 @@ import { DateWrapper, TimeZone } from '@deephaven/jsapi-shim'; | ||
getEffectiveFormatString(baseFormatString: string): string; | ||
format(value: Date | DateWrapper | number, format?: TableColumnFormat): string; | ||
format(value: Date | DateWrapper | number, format?: Partial<TableColumnFormat>): string; | ||
} | ||
export default DateTimeColumnFormatter; | ||
//# sourceMappingURL=DateTimeColumnFormatter.d.ts.map |
@@ -61,5 +61,5 @@ import TableColumnFormatter, { TableColumnFormat } from './TableColumnFormatter'; | ||
*/ | ||
format(valueParam: number, format?: DecimalColumnFormat): string; | ||
format(valueParam: number, format?: Partial<DecimalColumnFormat>): string; | ||
} | ||
export default DecimalColumnFormatter; | ||
//# sourceMappingURL=DecimalColumnFormatter.d.ts.map |
@@ -57,5 +57,5 @@ import TableColumnFormatter, { TableColumnFormat } from './TableColumnFormatter'; | ||
*/ | ||
format(valueParam: number, format?: IntegerColumnFormat): string; | ||
format(valueParam: number, format?: Partial<IntegerColumnFormat>): string; | ||
} | ||
export default IntegerColumnFormatter; | ||
//# sourceMappingURL=IntegerColumnFormatter.d.ts.map |
@@ -41,5 +41,5 @@ /** | ||
*/ | ||
format(value: T, format?: TableColumnFormat): string; | ||
format(value: T, format?: Partial<TableColumnFormat>): string; | ||
} | ||
export default TableColumnFormatter; | ||
//# sourceMappingURL=TableColumnFormatter.d.ts.map |
import type { FormattingRule } from './Formatter'; | ||
import Formatter from './Formatter'; | ||
import { DateTimeColumnFormatter } from './formatters'; | ||
export declare class FormatterUtils { | ||
static getColumnFormats(settings: { | ||
formatter: FormattingRule[]; | ||
}): FormattingRule[]; | ||
static getDateTimeFormatterOptions(settings: { | ||
timeZone: string; | ||
defaultDateTimeFormat: string; | ||
showTimeZone: boolean; | ||
showTSeparator: boolean; | ||
}): Required<ConstructorParameters<typeof DateTimeColumnFormatter>[0]>; | ||
declare class FormatterUtils { | ||
static getColumnFormats(settings?: { | ||
formatter?: FormattingRule[]; | ||
}): FormattingRule[] | undefined; | ||
static getDateTimeFormatterOptions(settings?: { | ||
timeZone?: string; | ||
defaultDateTimeFormat?: string; | ||
showTimeZone?: boolean; | ||
showTSeparator?: boolean; | ||
} | null): ConstructorParameters<typeof DateTimeColumnFormatter>[0]; | ||
/** | ||
@@ -15,0 +15,0 @@ * Check if the formatter has a custom format defined for the column name and type |
import { TableColumnFormatter } from "./formatters/index.js"; | ||
export class FormatterUtils { | ||
class FormatterUtils { | ||
static getColumnFormats(settings) { | ||
var { | ||
formatter | ||
} = settings; | ||
return formatter; | ||
if (settings && settings.formatter) { | ||
var { | ||
formatter | ||
} = settings; | ||
return formatter; | ||
} | ||
return undefined; | ||
} | ||
static getDateTimeFormatterOptions(settings) { | ||
var { | ||
timeZone, | ||
defaultDateTimeFormat, | ||
showTimeZone, | ||
showTSeparator | ||
} = settings; | ||
return { | ||
timeZone, | ||
defaultDateTimeFormatString: defaultDateTimeFormat, | ||
showTimeZone, | ||
showTSeparator | ||
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone, | ||
defaultDateTimeFormatString: settings === null || settings === void 0 ? void 0 : settings.defaultDateTimeFormat, | ||
showTimeZone: settings === null || settings === void 0 ? void 0 : settings.showTimeZone, | ||
showTSeparator: settings === null || settings === void 0 ? void 0 : settings.showTSeparator | ||
}; | ||
@@ -39,3 +38,4 @@ } | ||
} | ||
export default FormatterUtils; | ||
//# sourceMappingURL=FormatterUtils.js.map |
export * from './formatters'; | ||
export * from './DateUtils'; | ||
export * from './Formatter'; | ||
export { default as FormatterUtils } from './FormatterUtils'; | ||
export * from './FormatterUtils'; | ||
export * from './TableUtils'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from "./formatters/index.js"; | ||
export * from "./DateUtils.js"; | ||
export * from "./Formatter.js"; | ||
export { default as FormatterUtils } from "./FormatterUtils.js"; | ||
export * from "./FormatterUtils.js"; | ||
export * from "./TableUtils.js"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { Type as FilterType, TypeValue as FilterTypeValue, OperatorValue as FilterOperatorValue } from '@deephaven/filters'; | ||
import { TypeValue as FilterTypeValue, OperatorValue as FilterOperatorValue } from '@deephaven/filters'; | ||
import { Column, FilterCondition, FilterValue, LongWrapper, Sort, Table, TreeTable } from '@deephaven/jsapi-shim'; | ||
@@ -12,2 +12,12 @@ import { CancelablePromise } from '@deephaven/utils'; | ||
}; | ||
export interface FilterItem { | ||
selectedType: FilterTypeValue; | ||
value: string; | ||
} | ||
export declare type AdvancedFilterOptions = { | ||
filterItems: FilterItem[]; | ||
filterOperators: FilterOperatorValue[]; | ||
invertSelection: boolean; | ||
selectedValues: unknown[]; | ||
}; | ||
/** Utility class to provide some functions for working with tables */ | ||
@@ -22,2 +32,3 @@ export declare class TableUtils { | ||
readonly STRING: "string"; | ||
readonly UNKNOWN: "unknown"; | ||
}; | ||
@@ -43,16 +54,16 @@ static sortDirection: { | ||
static getSortForColumn(tableSort: Sort[], columnIndex: number): Sort | null; | ||
static getFilterText(filter: FilterCondition): string | null; | ||
static getFilterText(filter?: FilterCondition | null): string | null; | ||
/** Return the valid filter types for the column */ | ||
static getFilterTypes(columnType: string): FilterType[]; | ||
static getNextSort(table: Table, columnIndex: number): Sort | null; | ||
static makeColumnSort(table: Table, columnIndex: number, direction: SortDirection, isAbs: boolean): Sort | null; | ||
static getFilterTypes(columnType: string): FilterTypeValue[]; | ||
static getNextSort(columns: Column[], sorts: Sort[], columnIndex: number): Sort | null; | ||
static makeColumnSort(columns: Column[], columnIndex: number, direction: SortDirection, isAbs: boolean): Sort | null; | ||
/** | ||
* Toggles the sort for the specified column | ||
* @param sorts The current sorts from IrisGrid.state | ||
* @param table The table to apply the sort to | ||
* @param columns The columns to apply the sort to | ||
* @param columnIndex The column index to apply the sort to | ||
* @param addToExisting Add this sort to the existing sort | ||
*/ | ||
static toggleSortForColumn(sorts: Sort[], table: Table, columnIndex: number, addToExisting?: boolean): Sort[]; | ||
static sortColumn(table: Table, modelColumn: number, direction: SortDirection, isAbs: boolean, addToExisting: boolean): Sort[]; | ||
static toggleSortForColumn(sorts: Sort[], columns: Column[], columnIndex: number, addToExisting?: boolean): Sort[]; | ||
static sortColumn(sorts: Sort[], columns: Column[], modelColumn: number, direction: SortDirection, isAbs: boolean, addToExisting: boolean): Sort[]; | ||
/** | ||
@@ -67,3 +78,3 @@ * Sets the sort for the given column *and* removes any reverses | ||
static setSortForColumn(tableSort: Sort[], columnIndex: number, sort: Sort | null, addToExisting?: boolean): Sort[]; | ||
static getNormalizedType(columnType: string): DataType | null; | ||
static getNormalizedType(columnType: string): DataType; | ||
static isLongType(columnType: string): boolean; | ||
@@ -98,3 +109,3 @@ static isDateType(columnType: string): boolean; | ||
*/ | ||
static makeQuickFilter(column: Column, text: string, timeZone: string): FilterCondition | null; | ||
static makeQuickFilter(column: Column, text: string, timeZone?: string): FilterCondition | null; | ||
/** | ||
@@ -107,6 +118,6 @@ * Create filter with the provided column and text of one component (no multiple conditions) | ||
*/ | ||
static makeQuickFilterFromComponent(column: Column, text: string, timeZone: string): FilterCondition | null; | ||
static makeQuickFilterFromComponent(column: Column, text: string, timeZone?: string): FilterCondition | null; | ||
static makeQuickNumberFilter(column: Column, text: string): FilterCondition | null; | ||
static makeQuickTextFilter(column: Column, text: string | null): FilterCondition | null; | ||
static makeQuickBooleanFilter(column: Column, text: string): FilterCondition | null; | ||
static makeQuickBooleanFilter(column: Column, text: string | number): FilterCondition | null; | ||
/** | ||
@@ -150,8 +161,3 @@ * Builds a date filter parsed from the text string which may or may not include an operator. | ||
static makeCancelableTableEventPromise(table: Table | TreeTable, eventName: string, timeout?: number, matcher?: ((event: CustomEvent) => boolean) | null): CancelablePromise<CustomEvent>; | ||
static makeAdvancedFilter(column: Column, options: { | ||
filterItems: AdvancedFilterItemType[]; | ||
filterOperators: FilterOperatorValue[]; | ||
invertSelection: boolean; | ||
selectedValues: string[]; | ||
}, timeZone: string): FilterCondition | null; | ||
static makeAdvancedFilter(column: Column, options: AdvancedFilterOptions, timeZone: string): FilterCondition; | ||
static removeCommas(value: string): string; | ||
@@ -191,3 +197,3 @@ /** | ||
*/ | ||
static makeSelectValueFilter(column: Column, selectedValues: string[], invertSelection: boolean): FilterCondition | null; | ||
static makeSelectValueFilter(column: Column, selectedValues: unknown[], invertSelection: boolean): FilterCondition | null; | ||
static isTreeTable(table: unknown): table is TreeTable; | ||
@@ -194,0 +200,0 @@ /** |
@@ -76,11 +76,11 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
static getNextSort(table, columnIndex) { | ||
if (!table || !table.columns || columnIndex < 0 || columnIndex >= table.columns.length) { | ||
static getNextSort(columns, sorts, columnIndex) { | ||
if (!columns || columnIndex < 0 || columnIndex >= columns.length) { | ||
return null; | ||
} | ||
var sort = TableUtils.getSortForColumn(table.sort, columnIndex); | ||
var sort = TableUtils.getSortForColumn(sorts, columnIndex); | ||
if (sort === null) { | ||
return table.columns[columnIndex].sort().asc(); | ||
return columns[columnIndex].sort().asc(); | ||
} | ||
@@ -95,4 +95,4 @@ | ||
static makeColumnSort(table, columnIndex, direction, isAbs) { | ||
if (!table || !table.columns || columnIndex < 0 || columnIndex >= table.columns.length) { | ||
static makeColumnSort(columns, columnIndex, direction, isAbs) { | ||
if (!columns || columnIndex < 0 || columnIndex >= columns.length) { | ||
return null; | ||
@@ -105,3 +105,3 @@ } | ||
var sort = table.columns[columnIndex].sort(); | ||
var sort = columns[columnIndex].sort(); | ||
@@ -130,3 +130,3 @@ switch (direction) { | ||
* @param sorts The current sorts from IrisGrid.state | ||
* @param table The table to apply the sort to | ||
* @param columns The columns to apply the sort to | ||
* @param columnIndex The column index to apply the sort to | ||
@@ -137,20 +137,20 @@ * @param addToExisting Add this sort to the existing sort | ||
static toggleSortForColumn(sorts, table, columnIndex) { | ||
static toggleSortForColumn(sorts, columns, columnIndex) { | ||
var addToExisting = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; | ||
if (!table || columnIndex < 0 || columnIndex >= table.columns.length) { | ||
if (columnIndex < 0 || columnIndex >= columns.length) { | ||
return []; | ||
} | ||
var newSort = TableUtils.getNextSort(table, columnIndex); | ||
var newSort = TableUtils.getNextSort(columns, sorts, columnIndex); | ||
return TableUtils.setSortForColumn(sorts, columnIndex, newSort, addToExisting); | ||
} | ||
static sortColumn(table, modelColumn, direction, isAbs, addToExisting) { | ||
if (!table || modelColumn < 0 || modelColumn >= table.columns.length) { | ||
static sortColumn(sorts, columns, modelColumn, direction, isAbs, addToExisting) { | ||
if (!sorts || modelColumn < 0 || modelColumn >= columns.length) { | ||
return []; | ||
} | ||
var newSort = TableUtils.makeColumnSort(table, modelColumn, direction, isAbs); | ||
return TableUtils.setSortForColumn(table.sort, modelColumn, newSort, addToExisting); | ||
var newSort = TableUtils.makeColumnSort(columns, modelColumn, direction, isAbs); | ||
return TableUtils.setSortForColumn(sorts, modelColumn, newSort, addToExisting); | ||
} | ||
@@ -235,3 +235,3 @@ /** | ||
default: | ||
return null; | ||
return TableUtils.dataType.UNKNOWN; | ||
} | ||
@@ -422,3 +422,3 @@ } | ||
if (TableUtils.isDateType(type)) { | ||
if (timeZone && TableUtils.isDateType(type)) { | ||
return this.makeQuickDateFilter(column, text, timeZone); | ||
@@ -1001,2 +1001,6 @@ } | ||
if (filter === null) { | ||
throw new Error('filter is null'); | ||
} | ||
return filter; | ||
@@ -1315,3 +1319,4 @@ } | ||
INT: 'int', | ||
STRING: 'string' | ||
STRING: 'string', | ||
UNKNOWN: 'unknown' | ||
}); | ||
@@ -1318,0 +1323,0 @@ |
{ | ||
"name": "@deephaven/jsapi-utils", | ||
"version": "0.13.3-treemap.2+638dca5", | ||
"version": "0.14.0", | ||
"description": "Deephaven JSAPI Utils", | ||
@@ -30,9 +30,9 @@ "author": "Deephaven Data Labs LLC", | ||
"dependencies": { | ||
"@deephaven/filters": "^0.13.3-treemap.2+638dca5", | ||
"@deephaven/jsapi-shim": "^0.13.3-treemap.2+638dca5", | ||
"@deephaven/log": "^0.13.3-treemap.2+638dca5", | ||
"@deephaven/utils": "^0.13.3-treemap.2+638dca5" | ||
"@deephaven/filters": "^0.14.0", | ||
"@deephaven/jsapi-shim": "^0.14.0", | ||
"@deephaven/log": "^0.14.0", | ||
"@deephaven/utils": "^0.14.0" | ||
}, | ||
"devDependencies": { | ||
"@deephaven/tsconfig": "^0.13.3-treemap.2+638dca5" | ||
"@deephaven/tsconfig": "^0.14.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "files": [ | ||
}, | ||
"gitHead": "638dca59f1a244e8aea4234c5af7a09e472206e1" | ||
"gitHead": "9f92c76132a89ebc8a59755adcb4c515d02b7191" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
274979
2475
0
+ Added@deephaven/filters@0.14.0(transitive)
+ Added@deephaven/jsapi-shim@0.14.0(transitive)
+ Added@deephaven/log@0.14.0(transitive)
+ Added@deephaven/utils@0.14.0(transitive)
- Removed@deephaven/filters@0.13.13(transitive)
- Removed@deephaven/jsapi-shim@0.13.13(transitive)
- Removed@deephaven/log@0.13.13(transitive)
- Removed@deephaven/utils@0.13.13(transitive)
Updated@deephaven/filters@^0.14.0
Updated@deephaven/log@^0.14.0
Updated@deephaven/utils@^0.14.0