@deephaven/jsapi-utils 0.15.7-beta.0 → 0.16.1-beta.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/dist/FormatterUtils.d.ts +17 -22
- package/dist/FormatterUtils.d.ts.map +1 -1
- package/dist/FormatterUtils.js +31 -34
- package/dist/FormatterUtils.js.map +1 -1
- package/dist/Settings.d.ts +23 -0
- package/dist/Settings.d.ts.map +1 -0
- package/dist/Settings.js +2 -0
- package/dist/Settings.js.map +1 -0
- package/dist/TableUtils.d.ts +8 -1
- package/dist/TableUtils.d.ts.map +1 -1
- package/dist/TableUtils.js +69 -11
- package/dist/TableUtils.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/FormatterUtils.d.ts
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import type { FormattingRule } from './Formatter';
|
|
2
2
|
import Formatter from './Formatter';
|
|
3
3
|
import { DateTimeColumnFormatter } from './formatters';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @returns True, if a custom format is defined
|
|
22
|
-
*/
|
|
23
|
-
static isCustomColumnFormatDefined(formatter: Formatter, columnName: string, columnType: string): boolean;
|
|
24
|
-
}
|
|
25
|
-
export default FormatterUtils;
|
|
4
|
+
import { ColumnFormatSettings, DateTimeFormatSettings } from './Settings';
|
|
5
|
+
export declare function getColumnFormats(settings?: ColumnFormatSettings): FormattingRule[] | undefined;
|
|
6
|
+
export declare function getDateTimeFormatterOptions(settings?: DateTimeFormatSettings | null): ConstructorParameters<typeof DateTimeColumnFormatter>[0];
|
|
7
|
+
/**
|
|
8
|
+
* Check if the formatter has a custom format defined for the column name and type
|
|
9
|
+
* @param formatter Formatter to check
|
|
10
|
+
* @param columnName Column name
|
|
11
|
+
* @param columnType Column type
|
|
12
|
+
* @returns True, if a custom format is defined
|
|
13
|
+
*/
|
|
14
|
+
export declare function isCustomColumnFormatDefined(formatter: Formatter, columnName: string, columnType: string): boolean;
|
|
15
|
+
declare const _default: {
|
|
16
|
+
getColumnFormats: typeof getColumnFormats;
|
|
17
|
+
getDateTimeFormatterOptions: typeof getDateTimeFormatterOptions;
|
|
18
|
+
isCustomColumnFormatDefined: typeof isCustomColumnFormatDefined;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
26
21
|
//# sourceMappingURL=FormatterUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FormatterUtils.d.ts","sourceRoot":"","sources":["../src/FormatterUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAwB,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAE1E,wBAAgB,gBAAgB,CAC9B,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,cAAc,EAAE,GAAG,SAAS,CAM9B;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,CAAC,EAAE,sBAAsB,GAAG,IAAI,GACvC,qBAAqB,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAO1D;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAOT;;;;;;AAED,wBAIE"}
|
package/dist/FormatterUtils.js
CHANGED
|
@@ -1,40 +1,37 @@
|
|
|
1
1
|
import { TableColumnFormatter } from "./formatters/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} = settings;
|
|
9
|
-
return formatter;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return undefined;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
static getDateTimeFormatterOptions(settings) {
|
|
16
|
-
return {
|
|
17
|
-
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
18
|
-
defaultDateTimeFormatString: settings === null || settings === void 0 ? void 0 : settings.defaultDateTimeFormat,
|
|
19
|
-
showTimeZone: settings === null || settings === void 0 ? void 0 : settings.showTimeZone,
|
|
20
|
-
showTSeparator: settings === null || settings === void 0 ? void 0 : settings.showTSeparator
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Check if the formatter has a custom format defined for the column name and type
|
|
25
|
-
* @param formatter Formatter to check
|
|
26
|
-
* @param columnName Column name
|
|
27
|
-
* @param columnType Column type
|
|
28
|
-
* @returns True, if a custom format is defined
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
static isCustomColumnFormatDefined(formatter, columnName, columnType) {
|
|
33
|
-
var columnFormat = formatter.getColumnFormat(columnType, columnName);
|
|
34
|
-
return columnFormat != null && (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET || columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM);
|
|
2
|
+
export function getColumnFormats(settings) {
|
|
3
|
+
if (settings && settings.formatter) {
|
|
4
|
+
var {
|
|
5
|
+
formatter
|
|
6
|
+
} = settings;
|
|
7
|
+
return formatter;
|
|
35
8
|
}
|
|
36
9
|
|
|
10
|
+
return undefined;
|
|
37
11
|
}
|
|
12
|
+
export function getDateTimeFormatterOptions(settings) {
|
|
13
|
+
return {
|
|
14
|
+
timeZone: settings === null || settings === void 0 ? void 0 : settings.timeZone,
|
|
15
|
+
defaultDateTimeFormatString: settings === null || settings === void 0 ? void 0 : settings.defaultDateTimeFormat,
|
|
16
|
+
showTimeZone: settings === null || settings === void 0 ? void 0 : settings.showTimeZone,
|
|
17
|
+
showTSeparator: settings === null || settings === void 0 ? void 0 : settings.showTSeparator
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Check if the formatter has a custom format defined for the column name and type
|
|
22
|
+
* @param formatter Formatter to check
|
|
23
|
+
* @param columnName Column name
|
|
24
|
+
* @param columnType Column type
|
|
25
|
+
* @returns True, if a custom format is defined
|
|
26
|
+
*/
|
|
38
27
|
|
|
39
|
-
export
|
|
28
|
+
export function isCustomColumnFormatDefined(formatter, columnName, columnType) {
|
|
29
|
+
var columnFormat = formatter.getColumnFormat(columnType, columnName);
|
|
30
|
+
return columnFormat != null && (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET || columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM);
|
|
31
|
+
}
|
|
32
|
+
export default {
|
|
33
|
+
getColumnFormats,
|
|
34
|
+
getDateTimeFormatterOptions,
|
|
35
|
+
isCustomColumnFormatDefined
|
|
36
|
+
};
|
|
40
37
|
//# sourceMappingURL=FormatterUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/FormatterUtils.ts"],"names":["TableColumnFormatter","
|
|
1
|
+
{"version":3,"sources":["../src/FormatterUtils.ts"],"names":["TableColumnFormatter","getColumnFormats","settings","formatter","undefined","getDateTimeFormatterOptions","timeZone","defaultDateTimeFormatString","defaultDateTimeFormat","showTimeZone","showTSeparator","isCustomColumnFormatDefined","columnName","columnType","columnFormat","getColumnFormat","type","TYPE_CONTEXT_PRESET","TYPE_CONTEXT_CUSTOM"],"mappings":"SAEkCA,oB;AAGlC,OAAO,SAASC,gBAAT,CACLC,QADK,EAEyB;AAC9B,MAAIA,QAAQ,IAAIA,QAAQ,CAACC,SAAzB,EAAoC;AAClC,QAAM;AAAEA,MAAAA;AAAF,QAAgBD,QAAtB;AACA,WAAOC,SAAP;AACD;;AACD,SAAOC,SAAP;AACD;AAED,OAAO,SAASC,2BAAT,CACLH,QADK,EAEqD;AAC1D,SAAO;AACLI,IAAAA,QAAQ,EAAEJ,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEI,QADf;AAELC,IAAAA,2BAA2B,EAAEL,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEM,qBAFlC;AAGLC,IAAAA,YAAY,EAAEP,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEO,YAHnB;AAILC,IAAAA,cAAc,EAAER,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEQ;AAJrB,GAAP;AAMD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,2BAAT,CACLR,SADK,EAELS,UAFK,EAGLC,UAHK,EAII;AACT,MAAMC,YAAY,GAAGX,SAAS,CAACY,eAAV,CAA0BF,UAA1B,EAAsCD,UAAtC,CAArB;AACA,SACEE,YAAY,IAAI,IAAhB,KACCA,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACiB,mBAA3C,IACCH,YAAY,CAACE,IAAb,KAAsBhB,oBAAoB,CAACkB,mBAF7C,CADF;AAKD;AAED,eAAe;AACbjB,EAAAA,gBADa;AAEbI,EAAAA,2BAFa;AAGbM,EAAAA;AAHa,CAAf","sourcesContent":["import type { FormattingRule } from './Formatter';\nimport Formatter from './Formatter';\nimport { DateTimeColumnFormatter, TableColumnFormatter } from './formatters';\nimport { ColumnFormatSettings, DateTimeFormatSettings } from './Settings';\n\nexport function getColumnFormats(\n settings?: ColumnFormatSettings\n): FormattingRule[] | undefined {\n if (settings && settings.formatter) {\n const { formatter } = settings;\n return formatter;\n }\n return undefined;\n}\n\nexport function getDateTimeFormatterOptions(\n settings?: DateTimeFormatSettings | null\n): ConstructorParameters<typeof DateTimeColumnFormatter>[0] {\n return {\n timeZone: settings?.timeZone,\n defaultDateTimeFormatString: settings?.defaultDateTimeFormat,\n showTimeZone: settings?.showTimeZone,\n showTSeparator: settings?.showTSeparator,\n };\n}\n\n/**\n * Check if the formatter has a custom format defined for the column name and type\n * @param formatter Formatter to check\n * @param columnName Column name\n * @param columnType Column type\n * @returns True, if a custom format is defined\n */\nexport function isCustomColumnFormatDefined(\n formatter: Formatter,\n columnName: string,\n columnType: string\n): boolean {\n const columnFormat = formatter.getColumnFormat(columnType, columnName);\n return (\n columnFormat != null &&\n (columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_PRESET ||\n columnFormat.type === TableColumnFormatter.TYPE_CONTEXT_CUSTOM)\n );\n}\n\nexport default {\n getColumnFormats,\n getDateTimeFormatterOptions,\n isCustomColumnFormatDefined,\n};\n"],"file":"FormatterUtils.js"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormattingRule } from './Formatter';
|
|
2
|
+
export interface ColumnFormatSettings {
|
|
3
|
+
formatter?: FormattingRule[];
|
|
4
|
+
}
|
|
5
|
+
export interface DateTimeFormatSettings {
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
defaultDateTimeFormat?: string;
|
|
8
|
+
showTimeZone?: boolean;
|
|
9
|
+
showTSeparator?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface NumberFormatSettings {
|
|
12
|
+
defaultDecimalFormatOptions?: {
|
|
13
|
+
defaultFormatString?: string;
|
|
14
|
+
};
|
|
15
|
+
defaultIntegerFormatOptions?: {
|
|
16
|
+
defaultFormatString?: string;
|
|
17
|
+
};
|
|
18
|
+
truncateNumbersWithPound?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface Settings extends ColumnFormatSettings, DateTimeFormatSettings, NumberFormatSettings {
|
|
21
|
+
}
|
|
22
|
+
export default Settings;
|
|
23
|
+
//# sourceMappingURL=Settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Settings.d.ts","sourceRoot":"","sources":["../src/Settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,oBAAoB;IACnC,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,2BAA2B,CAAC,EAAE;QAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,2BAA2B,CAAC,EAAE;QAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;KAC9B,CAAC;IACF,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,WAAW,QACf,SAAQ,oBAAoB,EAC1B,sBAAsB,EACtB,oBAAoB;CAAG;AAE3B,eAAe,QAAQ,CAAC"}
|
package/dist/Settings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"Settings.js"}
|
package/dist/TableUtils.d.ts
CHANGED
|
@@ -129,6 +129,12 @@ export declare class TableUtils {
|
|
|
129
129
|
* @param timeZone The time zone to make this filter with. E.g. America/New_York
|
|
130
130
|
*/
|
|
131
131
|
static makeQuickDateFilterWithOperation(column: Column, text: string, operation: string | undefined, timeZone: string): FilterCondition;
|
|
132
|
+
/**
|
|
133
|
+
* Adds quotes to a value if they're not already added
|
|
134
|
+
* @param value Value to add quotes around
|
|
135
|
+
*/
|
|
136
|
+
static quoteValue(value: string): string;
|
|
137
|
+
static isRangeOperation(operation: string): boolean;
|
|
132
138
|
static makeQuickCharFilter(column: Column, text: string): FilterCondition | null;
|
|
133
139
|
/**
|
|
134
140
|
* @param filter The column filter to apply the range operation to
|
|
@@ -177,7 +183,8 @@ export declare class TableUtils {
|
|
|
177
183
|
static makeValue(columnType: string, text: string, timeZone: string): string | number | boolean | LongWrapper | null;
|
|
178
184
|
static makeBooleanValue(text: string, allowEmpty?: boolean): boolean | null;
|
|
179
185
|
static makeNumberValue(text: string): number | null;
|
|
180
|
-
static
|
|
186
|
+
static getFilterOperatorString(operation: FilterTypeValue): string;
|
|
187
|
+
static makeAdvancedValueFilter(column: Column, operation: FilterTypeValue, value: string, timeZone: string): FilterCondition | null;
|
|
181
188
|
/**
|
|
182
189
|
* Create a filter using the selected items
|
|
183
190
|
* Has a flag for invertSelection as we start from a "Select All" state and a user just deselects items.
|
package/dist/TableUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableUtils.d.ts","sourceRoot":"","sources":["../src/TableUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,IAAI,eAAe,EAC5B,aAAa,IAAI,mBAAmB,EACrC,MAAM,oBAAoB,CAAC;AAE5B,OAAW,EACT,MAAM,EACN,eAAe,EACf,WAAW,EACX,WAAW,EAEX,IAAI,EACJ,KAAK,EACL,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,iBAAiB,EAIlB,MAAM,kBAAkB,CAAC;AAK1B,aAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5B,oBAAY,QAAQ,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC1D,oBAAY,aAAa,GAAG,MAAM,CAAC,OAAO,UA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eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW;IActE;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,OAAO,GAChB,WAAW;IAYd;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CACd,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,GAAG,IAAI;IA0BjD,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,UAAQ,GAAG,OAAO,GAAG,IAAI;IA+BzE,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAyBnD,MAAM,CAAC,uBAAuB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM;IAuBlE,MAAM,CAAC,uBAAuB,CAC5B,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,GACf,eAAe,GAAG,IAAI;IAgGzB;;;;;;;;OAQG;IACH,MAAM,CAAC,qBAAqB,CAC1B,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OAAO,EAAE,EACzB,eAAe,EAAE,OAAO,GACvB,eAAe,GAAG,IAAI;IAwEzB,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS;IAQtD;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,UAAO,GAAG,MAAM,EAAE;CAOpE;AAED,eAAe,UAAU,CAAC"}
|
package/dist/TableUtils.js
CHANGED
|
@@ -53,16 +53,9 @@ export class TableUtils {
|
|
|
53
53
|
static getFilterTypes(columnType) {
|
|
54
54
|
if (TableUtils.isBooleanType(columnType)) {
|
|
55
55
|
return [FilterType.isTrue, FilterType.isFalse, FilterType.isNull];
|
|
56
|
-
} // TODO (DH-11799): In Bard (and beyond), we should use the same types as numbers
|
|
57
|
-
// It should just work after the merge for DH-11040: https://gitlab.eng.illumon.com/illumon/iris/merge_requests/5801
|
|
58
|
-
// In Powell though, just support equals/not equals
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (TableUtils.isCharType(columnType)) {
|
|
62
|
-
return [FilterType.eq, FilterType.notEq];
|
|
63
56
|
}
|
|
64
57
|
|
|
65
|
-
if (TableUtils.isNumberType(columnType) || TableUtils.isDateType(columnType)) {
|
|
58
|
+
if (TableUtils.isCharType(columnType) || TableUtils.isNumberType(columnType) || TableUtils.isDateType(columnType)) {
|
|
66
59
|
return [FilterType.eq, FilterType.notEq, FilterType.greaterThan, FilterType.greaterThanOrEqualTo, FilterType.lessThan, FilterType.lessThanOrEqualTo];
|
|
67
60
|
}
|
|
68
61
|
|
|
@@ -787,6 +780,34 @@ export class TableUtils {
|
|
|
787
780
|
throw new Error("Invalid operator: ".concat(operation));
|
|
788
781
|
}
|
|
789
782
|
}
|
|
783
|
+
/**
|
|
784
|
+
* Adds quotes to a value if they're not already added
|
|
785
|
+
* @param value Value to add quotes around
|
|
786
|
+
*/
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
static quoteValue(value) {
|
|
790
|
+
if (value.length >= 2 && (value.charAt(0) === '"' && value.charAt(value.length - 1) === '"' || value.charAt(0) === "'" && value.charAt(value.length - 1) === "'")) {
|
|
791
|
+
return value;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
return "\"".concat(value, "\"");
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
static isRangeOperation(operation) {
|
|
798
|
+
switch (operation) {
|
|
799
|
+
case '<':
|
|
800
|
+
case '<=':
|
|
801
|
+
case '=<':
|
|
802
|
+
case '>':
|
|
803
|
+
case '>=':
|
|
804
|
+
case '=>':
|
|
805
|
+
return true;
|
|
806
|
+
|
|
807
|
+
default:
|
|
808
|
+
return false;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
790
811
|
|
|
791
812
|
static makeQuickCharFilter(column, text) {
|
|
792
813
|
if (text == null) {
|
|
@@ -794,7 +815,7 @@ export class TableUtils {
|
|
|
794
815
|
}
|
|
795
816
|
|
|
796
817
|
var cleanText = "".concat(text).trim();
|
|
797
|
-
var regex = /^(
|
|
818
|
+
var regex = /^(>=|<=|=>|=<|>|<|!=|=|!)?(null|"."|'.'|.)?(.*)/;
|
|
798
819
|
var result = regex.exec(cleanText);
|
|
799
820
|
var operation = null;
|
|
800
821
|
var value = null;
|
|
@@ -832,9 +853,11 @@ export class TableUtils {
|
|
|
832
853
|
default:
|
|
833
854
|
return null;
|
|
834
855
|
}
|
|
835
|
-
}
|
|
856
|
+
} // We need to put quotes around range operations or else the API fails
|
|
836
857
|
|
|
837
|
-
|
|
858
|
+
|
|
859
|
+
var filterValue = dh.FilterValue.ofString(TableUtils.isRangeOperation(operation) ? TableUtils.quoteValue(value) : value);
|
|
860
|
+
return TableUtils.makeRangeFilterWithOperation(filter, operation, filterValue);
|
|
838
861
|
}
|
|
839
862
|
/**
|
|
840
863
|
* @param filter The column filter to apply the range operation to
|
|
@@ -1135,11 +1158,46 @@ export class TableUtils {
|
|
|
1135
1158
|
throw new Error("Invalid number '".concat(text, "'"));
|
|
1136
1159
|
}
|
|
1137
1160
|
|
|
1161
|
+
static getFilterOperatorString(operation) {
|
|
1162
|
+
switch (operation) {
|
|
1163
|
+
case FilterType.eq:
|
|
1164
|
+
return '=';
|
|
1165
|
+
|
|
1166
|
+
case FilterType.notEq:
|
|
1167
|
+
return '!=';
|
|
1168
|
+
|
|
1169
|
+
case FilterType.greaterThan:
|
|
1170
|
+
return '>';
|
|
1171
|
+
|
|
1172
|
+
case FilterType.greaterThanOrEqualTo:
|
|
1173
|
+
return '>=';
|
|
1174
|
+
|
|
1175
|
+
case FilterType.lessThan:
|
|
1176
|
+
return '<';
|
|
1177
|
+
|
|
1178
|
+
case FilterType.lessThanOrEqualTo:
|
|
1179
|
+
return '<=';
|
|
1180
|
+
|
|
1181
|
+
case FilterType.contains:
|
|
1182
|
+
return '~';
|
|
1183
|
+
|
|
1184
|
+
case FilterType.notContains:
|
|
1185
|
+
return '!~';
|
|
1186
|
+
|
|
1187
|
+
default:
|
|
1188
|
+
throw new Error("Unexpected filter type ".concat(operation));
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1138
1192
|
static makeAdvancedValueFilter(column, operation, value, timeZone) {
|
|
1139
1193
|
if (TableUtils.isDateType(column.type)) {
|
|
1140
1194
|
return TableUtils.makeQuickDateFilterWithOperation(column, value, operation, timeZone);
|
|
1141
1195
|
}
|
|
1142
1196
|
|
|
1197
|
+
if (TableUtils.isNumberType(column.type) || TableUtils.isCharType(column.type)) {
|
|
1198
|
+
return TableUtils.makeQuickFilter(column, "".concat(TableUtils.getFilterOperatorString(operation)).concat(value));
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1143
1201
|
var filterValue = TableUtils.makeFilterValue(column.type, value);
|
|
1144
1202
|
var filter = column.filter();
|
|
1145
1203
|
|
package/dist/TableUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/TableUtils.ts"],"names":["Type","FilterType","Operator","FilterOperator","Log","dh","PromiseUtils","TextUtils","TimeoutError","DateUtils","log","module","TableUtils","getSortIndex","sort","columnIndex","i","length","s","column","index","getSortForColumn","tableSort","sortIndex","getFilterText","filter","toString","getFilterTypes","columnType","isBooleanType","isTrue","isFalse","isNull","isCharType","eq","notEq","isNumberType","isDateType","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","isTextType","eqIgnoreCase","notEqIgnoreCase","contains","notContains","startsWith","endsWith","getNextSort","columns","sorts","asc","direction","sortDirection","ascending","desc","makeColumnSort","isAbs","none","descending","abs","toggleSortForColumn","addToExisting","newSort","setSortForColumn","sortColumn","modelColumn","concat","reverse","splice","push","getNormalizedType","dataType","BOOLEAN","CHAR","STRING","DATETIME","DECIMAL","INT","UNKNOWN","isLongType","isIntegerType","isDecimalType","isStringType","getBaseType","split","isCompatibleType","type1","type2","makeQuickFilter","text","timeZone","orComponents","orFilter","orComponent","andComponents","andFilter","j","andComponent","trim","makeQuickFilterFromComponent","and","Error","or","type","makeQuickNumberFilter","makeQuickBooleanFilter","makeQuickDateFilter","makeQuickCharFilter","makeQuickTextFilter","columnFilter","regex","result","exec","operation","negativeSign","value","abnormalValue","overflow","toLowerCase","FilterCondition","invoke","FilterValue","ofNumber","not","removeCommas","LongWrapper","ofString","error","warn","parseFloat","Number","isNaN","makeRangeFilterWithOperation","cleanText","prefix","suffix","substring","replace","notEqual","cleanValue","boolValue","makeBooleanValue","e","dateText","filterOperation","makeQuickDateFilterWithOperation","startDate","endDate","parseDateRange","startValue","endValue","startFilter","endFilter","makeCancelableTablePromise","table","makeCancelable","resolved","close","makeCancelableTableEventPromise","eventName","timeout","matcher","eventCleanup","timeoutId","isPending","wrappedPromise","Promise","resolve","reject","setTimeout","addEventListener","event","debug2","clearTimeout","cancel","makeAdvancedFilter","options","filterItems","filterOperators","invertSelection","selectedValues","filterItem","selectedType","newFilter","makeAdvancedValueFilter","filterOperator","err","selectValueFilter","makeSelectValueFilter","makeFilterValue","makeFilterRawValue","rawValue","ofBoolean","makeValue","date","makeNumberValue","allowEmpty","POSITIVE_INFINITY","NEGATIVE_INFINITY","numberText","NUMBER_REGEX","test","filterValue","in","inIgnoreCase","notIn","notInIgnoreCase","DateWrapper","ofJsDate","Date","eqFilter","notEqFilter","values","isNullSelected","String","fromCharCode","isTreeTable","expand","undefined","collapse","sortColumns","isAscending","a","b","aName","name","toUpperCase","bName","Object","freeze","NONE","PRE_SORT","POST_SORT"],"mappings":";;AAAA,SACEA,IAAI,IAAIC,UADV,EAEEC,QAAQ,IAAIC,cAFd,QAKO,oBALP;AAMA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,EAAP,MASO,uBATP;AA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,IAAI,EAAE,MAFU;AAGhBE,EAAAA,QAAQ,EAAE,UAHM;AAIhBC,EAAAA,OAAO,EAAE,SAJO;AAKhBC,EAAAA,GAAG,EAAE,KALW;AAMhBH,EAAAA,MAAM,EAAE,QANQ;AAOhBI,EAAAA,OAAO,EAAE;AAPO,C;;gBADPpE,U,mBAWY;AACrB2C,EAAAA,SAAS,EAAE,KADU;AAErBK,EAAAA,UAAU,EAAE,MAFS;AAGrBS,EAAAA,OAAO,EAAE,SAHY;AAIrBV,EAAAA,IAAI,EAAE;AAJe,C;;gBAXZ/C,U,kBAkBW0N,MAAM,CAACC,MAAP,CAAc;AAClCC,EAAAA,IAAI,EAAE,MAD4B;AAElCC,EAAAA,QAAQ,EAAE,UAFwB;AAGlCC,EAAAA,SAAS,EAAE;AAHuB,CAAd,C;;gBAlBX9N,U,kBAyBW,iB;;AA03CxB,eAAeA,UAAf","sourcesContent":["import {\n Type as FilterType,\n Operator as FilterOperator,\n TypeValue as FilterTypeValue,\n OperatorValue as FilterOperatorValue,\n} from '@deephaven/filters';\nimport Log from '@deephaven/log';\nimport dh, {\n Column,\n FilterCondition,\n FilterValue,\n LongWrapper,\n RemoverFn,\n Sort,\n Table,\n TreeTable,\n} from '@deephaven/jsapi-shim';\nimport {\n CancelablePromise,\n PromiseUtils,\n TextUtils,\n TimeoutError,\n} from '@deephaven/utils';\nimport DateUtils from './DateUtils';\n\nconst log = Log.module('TableUtils');\n\ntype Values<T> = T[keyof T];\nexport type DataType = Values<typeof TableUtils.dataType>;\nexport type SortDirection = Values<typeof TableUtils.sortDirection>;\nexport type ReverseType = Values<typeof TableUtils.REVERSE_TYPE>;\nexport type AdvancedFilterItemType = {\n selectedType: FilterTypeValue;\n value: string;\n};\n\nexport interface FilterItem {\n selectedType: FilterTypeValue;\n value: string;\n}\n\nexport type AdvancedFilterOptions = {\n filterItems: FilterItem[];\n filterOperators: FilterOperatorValue[];\n invertSelection: boolean;\n selectedValues: unknown[];\n};\n\n/** Utility class to provide some functions for working with tables */\nexport class TableUtils {\n static dataType = {\n BOOLEAN: 'boolean',\n CHAR: 'char',\n DATETIME: 'datetime',\n DECIMAL: 'decimal',\n INT: 'int',\n STRING: 'string',\n UNKNOWN: 'unknown',\n } as const;\n\n static sortDirection = {\n ascending: 'ASC',\n descending: 'DESC',\n reverse: 'REVERSE',\n none: null,\n } as const;\n\n static REVERSE_TYPE = Object.freeze({\n NONE: 'none',\n PRE_SORT: 'pre-sort',\n POST_SORT: 'post-sort',\n } as const);\n\n // Regex looking for a negative or positive integer or decimal number\n static NUMBER_REGEX = /^-?\\d+(\\.\\d+)?$/;\n\n static getSortIndex(sort: Sort[], columnIndex: number): number | null {\n for (let i = 0; i < sort.length; i += 1) {\n const s = sort[i];\n if (s.column?.index === columnIndex) {\n return i;\n }\n }\n\n return null;\n }\n\n /**\n * @param tableSort The sorts from the table to get the sort from\n * @param columnIndex The index of the column to get the sort for\n * @returns The sort for the column, or null if it's not sorted\n */\n static getSortForColumn(tableSort: Sort[], columnIndex: number): Sort | null {\n const sortIndex = TableUtils.getSortIndex(tableSort, columnIndex);\n if (sortIndex != null) {\n return tableSort[sortIndex];\n }\n return null;\n }\n\n static getFilterText(filter?: FilterCondition | null): string | null {\n if (filter) {\n return filter.toString();\n }\n return null;\n }\n\n /** Return the valid filter types for the column */\n static getFilterTypes(columnType: string): FilterTypeValue[] {\n if (TableUtils.isBooleanType(columnType)) {\n return [FilterType.isTrue, FilterType.isFalse, FilterType.isNull];\n }\n // TODO (DH-11799): In Bard (and beyond), we should use the same types as numbers\n // It should just work after the merge for DH-11040: https://gitlab.eng.illumon.com/illumon/iris/merge_requests/5801\n // In Powell though, just support equals/not equals\n if (TableUtils.isCharType(columnType)) {\n return [FilterType.eq, FilterType.notEq];\n }\n if (\n TableUtils.isNumberType(columnType) ||\n TableUtils.isDateType(columnType)\n ) {\n return [\n FilterType.eq,\n FilterType.notEq,\n FilterType.greaterThan,\n FilterType.greaterThanOrEqualTo,\n FilterType.lessThan,\n FilterType.lessThanOrEqualTo,\n ];\n }\n if (TableUtils.isTextType(columnType)) {\n return [\n FilterType.eq,\n FilterType.eqIgnoreCase,\n FilterType.notEq,\n FilterType.notEqIgnoreCase,\n FilterType.contains,\n FilterType.notContains,\n FilterType.startsWith,\n FilterType.endsWith,\n ];\n }\n return [];\n }\n\n static getNextSort(\n columns: Column[],\n sorts: Sort[],\n columnIndex: number\n ): Sort | null {\n if (!columns || columnIndex < 0 || columnIndex >= columns.length) {\n return null;\n }\n\n const sort = TableUtils.getSortForColumn(sorts, columnIndex);\n if (sort === null) {\n return columns[columnIndex].sort().asc();\n }\n if (sort.direction === TableUtils.sortDirection.ascending) {\n return sort.desc();\n }\n return null;\n }\n\n static makeColumnSort(\n columns: Column[],\n columnIndex: number,\n direction: SortDirection,\n isAbs: boolean\n ): Sort | null {\n if (!columns || columnIndex < 0 || columnIndex >= columns.length) {\n return null;\n }\n\n if (direction === TableUtils.sortDirection.none) {\n return null;\n }\n\n let sort = columns[columnIndex].sort();\n\n switch (direction) {\n case TableUtils.sortDirection.ascending:\n sort = sort.asc();\n break;\n case TableUtils.sortDirection.descending:\n sort = sort.desc();\n break;\n default:\n break;\n }\n if (isAbs) {\n sort = sort.abs();\n }\n return sort;\n }\n\n /**\n * Toggles the sort for the specified column\n * @param sorts The current sorts from IrisGrid.state\n * @param columns The columns to apply the sort to\n * @param columnIndex The column index to apply the sort to\n * @param addToExisting Add this sort to the existing sort\n */\n static toggleSortForColumn(\n sorts: Sort[],\n columns: Column[],\n columnIndex: number,\n addToExisting = false\n ): Sort[] {\n if (columnIndex < 0 || columnIndex >= columns.length) {\n return [];\n }\n\n const newSort = TableUtils.getNextSort(columns, sorts, columnIndex);\n\n return TableUtils.setSortForColumn(\n sorts,\n columnIndex,\n newSort,\n addToExisting\n );\n }\n\n static sortColumn(\n sorts: Sort[],\n columns: Column[],\n modelColumn: number,\n direction: SortDirection,\n isAbs: boolean,\n addToExisting: boolean\n ): Sort[] {\n if (!sorts || modelColumn < 0 || modelColumn >= columns.length) {\n return [];\n }\n\n const newSort = TableUtils.makeColumnSort(\n columns,\n modelColumn,\n direction,\n isAbs\n );\n\n return TableUtils.setSortForColumn(\n sorts,\n modelColumn,\n newSort,\n addToExisting\n );\n }\n\n /**\n * Sets the sort for the given column *and* removes any reverses\n * @param tableSort The current sorts from IrisGrid.state\n * @param columnIndex The column index to apply the sort to\n * @param sort The sort object to add\n * @param addToExisting Add this sort to the existing sort\n * @returns Returns the modified array of sorts - removing reverses\n */\n static setSortForColumn(\n tableSort: Sort[],\n columnIndex: number,\n sort: Sort | null,\n addToExisting = false\n ): Sort[] {\n const sortIndex = TableUtils.getSortIndex(tableSort, columnIndex);\n let sorts: Sort[] = [];\n if (addToExisting) {\n sorts = sorts.concat(\n tableSort.filter(\n ({ direction }) => direction !== TableUtils.sortDirection.reverse\n )\n );\n if (sortIndex !== null) {\n sorts.splice(sortIndex, 1);\n }\n }\n\n if (sort !== null) {\n sorts.push(sort);\n }\n\n return sorts;\n }\n\n static getNormalizedType(columnType?: string | null): DataType {\n switch (columnType) {\n case 'boolean':\n case 'java.lang.Boolean':\n case TableUtils.dataType.BOOLEAN:\n return TableUtils.dataType.BOOLEAN;\n case 'char':\n case 'java.lang.Character':\n case TableUtils.dataType.CHAR:\n return TableUtils.dataType.CHAR;\n case 'java.lang.String':\n case TableUtils.dataType.STRING:\n return TableUtils.dataType.STRING;\n case 'io.deephaven.db.tables.utils.DBDateTime':\n case 'io.deephaven.time.DateTime':\n case 'com.illumon.iris.db.tables.utils.DBDateTime':\n case TableUtils.dataType.DATETIME:\n return TableUtils.dataType.DATETIME;\n case 'double':\n case 'java.lang.Double':\n case 'float':\n case 'java.lang.Float':\n case 'java.math.BigDecimal':\n case TableUtils.dataType.DECIMAL:\n return TableUtils.dataType.DECIMAL;\n case 'int':\n case 'java.lang.Integer':\n case 'long':\n case 'java.lang.Long':\n case 'short':\n case 'java.lang.Short':\n case 'byte':\n case 'java.lang.Byte':\n case 'java.math.BigInteger':\n case TableUtils.dataType.INT:\n return TableUtils.dataType.INT;\n default:\n return TableUtils.dataType.UNKNOWN;\n }\n }\n\n static isLongType(columnType: string): boolean {\n switch (columnType) {\n case 'long':\n case 'java.lang.Long':\n return true;\n default:\n return false;\n }\n }\n\n static isDateType(columnType: string): boolean {\n switch (columnType) {\n case 'io.deephaven.db.tables.utils.DBDateTime':\n case 'io.deephaven.time.DateTime':\n case 'com.illumon.iris.db.tables.utils.DBDateTime':\n return true;\n default:\n return false;\n }\n }\n\n static isNumberType(columnType: string): boolean {\n return (\n TableUtils.isIntegerType(columnType) ||\n TableUtils.isDecimalType(columnType)\n );\n }\n\n static isIntegerType(columnType: string): boolean {\n switch (columnType) {\n case 'int':\n case 'java.lang.Integer':\n case 'java.math.BigInteger':\n case 'long':\n case 'java.lang.Long':\n case 'short':\n case 'java.lang.Short':\n case 'byte':\n case 'java.lang.Byte':\n return true;\n default:\n return false;\n }\n }\n\n static isDecimalType(columnType: string): boolean {\n switch (columnType) {\n case 'double':\n case 'java.lang.Double':\n case 'java.math.BigDecimal':\n case 'float':\n case 'java.lang.Float':\n return true;\n default:\n return false;\n }\n }\n\n static isBooleanType(columnType: string): boolean {\n switch (columnType) {\n case 'boolean':\n case 'java.lang.Boolean':\n return true;\n default:\n return false;\n }\n }\n\n static isCharType(columnType: string): boolean {\n switch (columnType) {\n case 'char':\n case 'java.lang.Character':\n return true;\n default:\n return false;\n }\n }\n\n static isStringType(columnType: string): boolean {\n switch (columnType) {\n case 'java.lang.String':\n return true;\n default:\n return false;\n }\n }\n\n static isTextType(columnType: string): boolean {\n return this.isStringType(columnType) || this.isCharType(columnType);\n }\n\n /**\n * Get base column type\n * @param columnType Column type\n * @returns Element type for array columns, original type for non-array columns\n */\n static getBaseType(columnType: string): string {\n return columnType.split('[]')[0];\n }\n\n /**\n * Check if the column types are compatible\n * @param type1 Column type to check\n * @param type2 Column type to check\n * @returns True, if types are compatible\n */\n static isCompatibleType(\n type1?: string | null,\n type2?: string | null\n ): boolean {\n return (\n TableUtils.getNormalizedType(type1) ===\n TableUtils.getNormalizedType(type2)\n );\n }\n\n /**\n * Create filter with the provided column and text. Handles multiple filters joined with && or ||\n * @param column The column to set the filter on\n * @param text The text string to create the filter from\n * @param timeZone The time zone to make this value in if it is a date type. E.g. America/New_York\n * @returns Returns the created filter, null if text could not be parsed\n */\n static makeQuickFilter(\n column: Column,\n text: string,\n timeZone?: string\n ): FilterCondition | null {\n const orComponents = text.split('||');\n let orFilter = null;\n for (let i = 0; i < orComponents.length; i += 1) {\n const orComponent = orComponents[i];\n const andComponents = orComponent.split('&&');\n let andFilter = null;\n for (let j = 0; j < andComponents.length; j += 1) {\n const andComponent = andComponents[j].trim();\n if (andComponent.length > 0) {\n const filter = TableUtils.makeQuickFilterFromComponent(\n column,\n andComponent,\n timeZone\n );\n if (filter) {\n if (andFilter) {\n andFilter = andFilter.and(filter);\n } else {\n andFilter = filter;\n }\n } else {\n throw new Error(`Unable to parse quick filter from text ${text}`);\n }\n }\n }\n\n if (orFilter && andFilter) {\n orFilter = orFilter.or(andFilter);\n } else {\n orFilter = andFilter;\n }\n }\n\n return orFilter;\n }\n\n /**\n * Create filter with the provided column and text of one component (no multiple conditions)\n * @param column The column to set the filter on\n * @param text The text string to create the filter from\n * @param timeZone The time zone to make this filter in if it is a date type. E.g. America/New_York\n * @returns Returns the created filter, null if text could not be parsed\n */\n static makeQuickFilterFromComponent(\n column: Column,\n text: string,\n timeZone?: string\n ): FilterCondition | null {\n const { type } = column;\n if (TableUtils.isNumberType(type)) {\n return this.makeQuickNumberFilter(column, text);\n }\n if (TableUtils.isBooleanType(type)) {\n return this.makeQuickBooleanFilter(column, text);\n }\n if (timeZone && TableUtils.isDateType(type)) {\n return this.makeQuickDateFilter(column, text, timeZone);\n }\n if (TableUtils.isCharType(type)) {\n return this.makeQuickCharFilter(column, text);\n }\n return this.makeQuickTextFilter(column, text);\n }\n\n static makeQuickNumberFilter(\n column: Column,\n text: string\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const columnFilter = column.filter();\n let filter = null;\n\n const regex = /\\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\\s*-\\s*)?(\\s*\\d*(?:,\\d{3})*(?:\\.\\d*)?\\s*)?(null|nan|infinity|inf|\\u221E)?(.*)/i;\n const result = regex.exec(text);\n\n let operation = null;\n let negativeSign = null;\n let value = null;\n let abnormalValue = null; // includes nan, null and infinity(positive & negative)\n let overflow = null;\n\n if (result !== null && result.length > 3) {\n [, operation, negativeSign, value, abnormalValue, overflow] = result;\n }\n\n if (overflow != null && overflow.trim().length > 0) {\n // Some bad characters after the number, bail out!\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n if (abnormalValue != null) {\n if (!(operation === '=' || operation === '!' || operation === '!=')) {\n // only equal and not equal operations are supported for abnormal value filter\n return null;\n }\n abnormalValue = abnormalValue.trim().toLowerCase();\n switch (abnormalValue) {\n case 'null':\n filter = columnFilter.isNull();\n break;\n case 'nan':\n filter = dh.FilterCondition.invoke('isNaN', columnFilter);\n break;\n case 'infinity':\n case 'inf':\n case '\\u221E':\n if (negativeSign != null) {\n filter = dh.FilterCondition.invoke('isInf', columnFilter).and(\n columnFilter.lessThan(dh.FilterValue.ofNumber(0))\n );\n } else {\n filter = dh.FilterCondition.invoke('isInf', columnFilter).and(\n columnFilter.greaterThan(dh.FilterValue.ofNumber(0))\n );\n }\n break;\n default:\n break;\n }\n if (filter !== null && (operation === '!' || operation === '!=')) {\n filter = filter.not();\n }\n return filter;\n }\n\n if (value == null) {\n return null;\n }\n\n value = TableUtils.removeCommas(value);\n if (TableUtils.isLongType(column.type)) {\n try {\n value = dh.FilterValue.ofNumber(\n dh.LongWrapper.ofString(`${negativeSign != null ? '-' : ''}${value}`)\n );\n } catch (error) {\n log.warn('Unable to create long filter', error);\n return null;\n }\n } else {\n value = parseFloat(value);\n if (value == null || Number.isNaN(value)) {\n return null;\n }\n\n value = dh.FilterValue.ofNumber(negativeSign != null ? 0 - value : value);\n }\n\n filter = column.filter();\n\n return TableUtils.makeRangeFilterWithOperation(filter, operation, value);\n }\n\n static makeQuickTextFilter(\n column: Column,\n text: string | null\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const cleanText = `${text}`.trim();\n const regex = /^(!~|!=|~|=|!)?(.*)/;\n const result = regex.exec(cleanText);\n\n let operation = null;\n let value = null;\n if (result !== null && result.length > 2) {\n [, operation, value] = result;\n if (value != null) {\n value = value.trim();\n }\n }\n\n if (value == null || value.length === 0) {\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n const filter = column.filter();\n if (value.toLowerCase() === 'null') {\n // Null is a special case!\n switch (operation) {\n case '=':\n return filter.isNull();\n case '!=':\n case '!':\n return filter.isNull().not();\n default:\n return null;\n }\n }\n\n let prefix = null;\n let suffix = null;\n if (value.startsWith('*')) {\n prefix = '*';\n value = value.substring(1);\n } else if (value.endsWith('*') && !value.endsWith('\\\\*')) {\n suffix = '*';\n value = value.substring(0, value.length - 1);\n }\n\n value = value.replace('\\\\', '');\n\n switch (operation) {\n case '~': {\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n );\n }\n case '!~':\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n case '!=':\n if (prefix === '*') {\n // Does not end with\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n .not()\n );\n }\n if (suffix === '*') {\n // Does not start with\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n }\n return filter.notEqIgnoreCase(\n dh.FilterValue.ofString(value.toLowerCase())\n );\n\n case '=':\n if (prefix === '*') {\n // Ends with\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n );\n }\n if (suffix === '*') {\n // Starts with\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n );\n }\n return filter.eqIgnoreCase(\n dh.FilterValue.ofString(value.toLowerCase())\n );\n\n default:\n break;\n }\n\n return null;\n }\n\n static makeQuickBooleanFilter(\n column: Column,\n text: string | number\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const regex = /^(!=|=|!)?(.*)/;\n const result = regex.exec(`${text}`.trim());\n if (result === null) {\n return null;\n }\n const [, operation, value] = result;\n const notEqual = operation === '!' || operation === '!=';\n const cleanValue = value.trim().toLowerCase();\n\n let filter: FilterCondition | FilterValue = column.filter();\n\n try {\n const boolValue = TableUtils.makeBooleanValue(cleanValue);\n if (boolValue) {\n filter = filter.isTrue();\n } else if (boolValue === null) {\n filter = filter.isNull();\n } else {\n filter = filter.isFalse();\n }\n\n return notEqual ? filter.not() : filter;\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Builds a date filter parsed from the text string which may or may not include an operator.\n * @param column The column to build the filter from, with or without a leading operator.\n * @param text The date string text to parse.\n * @param timeZone The time zone to make this filter in if it is a date type. E.g. America/New_York\n */\n static makeQuickDateFilter(\n column: Column,\n text: string,\n timeZone: string\n ): FilterCondition {\n const cleanText = text.trim();\n const regex = /\\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/;\n const result = regex.exec(cleanText);\n if (result == null || result.length <= 2) {\n throw new Error(`Unable to parse date filter: ${text}`);\n }\n\n let operation = null;\n let dateText = null;\n\n [, operation, dateText] = result;\n\n let filterOperation: FilterTypeValue = FilterType.eq;\n switch (operation) {\n case '<':\n filterOperation = FilterType.lessThan;\n break;\n case '<=':\n case '=<':\n filterOperation = FilterType.lessThanOrEqualTo;\n break;\n case '>':\n filterOperation = FilterType.greaterThan;\n break;\n case '>=':\n case '=>':\n filterOperation = FilterType.greaterThanOrEqualTo;\n break;\n case '!=':\n case '!':\n filterOperation = FilterType.notEq;\n break;\n case '=':\n case '==':\n default:\n filterOperation = FilterType.eq;\n break;\n }\n\n return TableUtils.makeQuickDateFilterWithOperation(\n column,\n dateText,\n filterOperation,\n timeZone\n );\n }\n\n /**\n * Builds a date filter parsed from the text string with the provided filter.\n * @param column The column to build the filter from.\n * @param text The date string text to parse, without an operator.\n * @param operation The filter operation to use.\n * @param timeZone The time zone to make this filter with. E.g. America/New_York\n */\n static makeQuickDateFilterWithOperation(\n column: Column,\n text: string,\n operation: FilterTypeValue = FilterType.eq,\n timeZone: string\n ): FilterCondition {\n if (column == null) {\n throw new Error('Column is null');\n }\n\n const [startDate, endDate] = DateUtils.parseDateRange(text, timeZone);\n\n const startValue =\n startDate != null ? dh.FilterValue.ofNumber(startDate) : null;\n const endValue = endDate != null ? dh.FilterValue.ofNumber(endDate) : null;\n\n const filter = column.filter();\n if (startValue == null) {\n return operation === FilterType.notEq\n ? filter.isNull().not()\n : filter.isNull();\n }\n\n switch (operation) {\n case FilterType.eq: {\n if (endValue != null) {\n const startFilter = filter.greaterThanOrEqualTo(startValue);\n const endFilter = filter.lessThan(endValue);\n return startFilter.and(endFilter);\n }\n return filter.eq(startValue);\n }\n case FilterType.lessThan: {\n return filter.lessThan(startValue);\n }\n case FilterType.lessThanOrEqualTo: {\n if (endValue != null) {\n return filter.lessThan(endValue);\n }\n return filter.lessThanOrEqualTo(startValue);\n }\n case FilterType.greaterThan: {\n if (endValue != null) {\n return filter.greaterThanOrEqualTo(endValue);\n }\n return filter.greaterThan(startValue);\n }\n case FilterType.greaterThanOrEqualTo:\n return filter.greaterThanOrEqualTo(startValue);\n case FilterType.notEq: {\n if (endValue != null) {\n const startFilter = filter.lessThan(startValue);\n const endFilter = filter.greaterThanOrEqualTo(endValue);\n return startFilter.or(endFilter);\n }\n return filter.notEq(startValue);\n }\n\n default:\n throw new Error(`Invalid operator: ${operation}`);\n }\n }\n\n static makeQuickCharFilter(\n column: Column,\n text: string\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const cleanText = `${text}`.trim();\n const regex = /^(!=|=|!)?(null|.)?(.*)/;\n const result = regex.exec(cleanText);\n\n let operation = null;\n let value = null;\n let overflow = null;\n if (result !== null && result.length > 3) {\n [, operation, value, overflow] = result;\n }\n if (overflow != null && overflow.trim().length > 0) {\n // Some bad characters after the number, bail out!\n return null;\n }\n\n if (value == null || value.length === 0) {\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n const filter = column.filter();\n if (value.toLowerCase() === 'null') {\n // Null is a special case!\n switch (operation) {\n case '=':\n return filter.isNull();\n case '!=':\n case '!':\n return filter.isNull().not();\n default:\n return null;\n }\n }\n\n return TableUtils.makeRangeFilterWithOperation(\n filter,\n operation,\n dh.FilterValue.ofString(value)\n );\n }\n\n /**\n * @param filter The column filter to apply the range operation to\n * @param operation The range operation to run\n * @param value The value to use for the operation\n * @returns The condition with the specified operation\n */\n static makeRangeFilterWithOperation(\n filter: FilterValue,\n operation: string,\n value: FilterValue\n ): FilterCondition | null {\n switch (operation) {\n case '=':\n return filter.eq(value);\n case '<':\n return filter.lessThan(value);\n case '<=':\n case '=<':\n return filter.lessThanOrEqualTo(value);\n case '>':\n return filter.greaterThan(value);\n case '>=':\n case '=>':\n return filter.greaterThanOrEqualTo(value);\n case '!=':\n case '!':\n return filter.notEq(value);\n default:\n return null;\n }\n }\n\n /**\n * Wraps a table promise in a cancelable promise that will close the table if the promise is cancelled.\n * Use in a component that loads a table, and call cancel when unmounting.\n * @param table The table promise to wrap\n */\n static makeCancelableTablePromise(\n table: Promise<Table> | Table\n ): CancelablePromise<Table> {\n return PromiseUtils.makeCancelable(table, resolved => {\n resolved.close();\n });\n }\n\n /**\n * Make a cancelable promise for a one-shot table event with a timeout.\n * @param table Table to listen for events on\n * @param eventName Event to listen for\n * @param timeout Event timeout in milliseconds, defaults to 0\n * @param matcher Optional function to determine if the promise can be resolved or stays pending\n * @returns Resolves with the event data\n */\n static makeCancelableTableEventPromise(\n table: Table | TreeTable,\n eventName: string,\n timeout = 0,\n matcher: ((event: CustomEvent) => boolean) | null = null\n ): CancelablePromise<CustomEvent> {\n let eventCleanup: RemoverFn;\n let timeoutId: ReturnType<typeof setTimeout>;\n let isPending = true;\n const wrappedPromise = new Promise((resolve, reject) => {\n timeoutId = setTimeout(() => {\n eventCleanup();\n isPending = false;\n reject(new TimeoutError(`Event \"${eventName}\" timed out.`));\n }, timeout);\n eventCleanup = table.addEventListener(eventName, event => {\n if (matcher != null && !matcher(event)) {\n log.debug2('Event triggered, but matcher returned false.');\n return;\n }\n log.debug2('Event triggered, resolving.');\n eventCleanup();\n clearTimeout(timeoutId);\n isPending = false;\n resolve(event);\n });\n }) as CancelablePromise<CustomEvent>;\n wrappedPromise.cancel = () => {\n if (isPending) {\n log.debug2('Pending promise cleanup.');\n eventCleanup();\n clearTimeout(timeoutId);\n isPending = false;\n return;\n }\n log.debug2('Ignoring non-pending promise cancel.');\n };\n return wrappedPromise;\n }\n\n static makeAdvancedFilter(\n column: Column,\n options: AdvancedFilterOptions,\n timeZone: string\n ): FilterCondition | null {\n const {\n filterItems,\n filterOperators,\n invertSelection,\n selectedValues,\n } = options;\n let filter = null;\n for (let i = 0; i < filterItems.length; i += 1) {\n const filterItem = filterItems[i];\n const { selectedType, value } = filterItem;\n if (\n selectedType != null &&\n selectedType.length > 0 &&\n value != null &&\n value.length > 0\n ) {\n try {\n const newFilter = TableUtils.makeAdvancedValueFilter(\n column,\n selectedType,\n value,\n timeZone\n );\n if (newFilter != null) {\n if (i === 0) {\n filter = newFilter;\n } else if (filter !== null && i - 1 < filterOperators.length) {\n const filterOperator = filterOperators[i - 1];\n if (filterOperator === FilterOperator.and) {\n filter = filter.and(newFilter);\n } else if (filterOperator === FilterOperator.or) {\n filter = filter.or(newFilter);\n } else {\n log.error(\n 'Unexpected filter operator',\n filterOperator,\n newFilter\n );\n filter = null;\n break;\n }\n }\n } else {\n log.debug2('Empty filter ignored for', selectedType, value);\n }\n } catch (err) {\n log.error('Unable to create filter', err);\n filter = null;\n break;\n }\n }\n }\n\n const selectValueFilter = TableUtils.makeSelectValueFilter(\n column,\n selectedValues,\n invertSelection\n );\n if (selectValueFilter != null) {\n if (filter != null) {\n filter = filter.and(selectValueFilter);\n } else {\n filter = selectValueFilter;\n }\n }\n\n return filter;\n }\n\n static removeCommas(value: string): string {\n return value.replace(/[\\s|,]/g, '');\n }\n\n /**\n * @param columnType The column type to make the filter value from.\n * @param value The value to make the filter value from.\n * @returns The FilterValue item for this column/value combination\n */\n static makeFilterValue(columnType: string, value: string): FilterValue {\n const type = TableUtils.getBaseType(columnType);\n if (TableUtils.isTextType(type)) {\n return dh.FilterValue.ofString(value);\n }\n if (TableUtils.isLongType(type)) {\n return dh.FilterValue.ofNumber(\n dh.LongWrapper.ofString(TableUtils.removeCommas(value))\n );\n }\n\n return dh.FilterValue.ofNumber(TableUtils.removeCommas(value));\n }\n\n /**\n * Takes a value and converts it to an `dh.FilterValue`\n *\n * @param columnType The column type to make the filter value from.\n * @param value The value to actually set\n * @returns The FilterValue item for this column/value combination\n */\n static makeFilterRawValue(\n columnType: string,\n rawValue: unknown\n ): FilterValue {\n if (TableUtils.isTextType(columnType)) {\n return dh.FilterValue.ofString(rawValue);\n }\n\n if (TableUtils.isBooleanType(columnType)) {\n return dh.FilterValue.ofBoolean(rawValue);\n }\n\n return dh.FilterValue.ofNumber(rawValue);\n }\n\n /**\n * Converts a string value to a value appropriate for the column\n * @param columnType The column type to make the value for\n * @param text The string value to make a type for\n * @param timeZone The time zone to make this value in if it is a date type. E.g. America/New_York\n */\n static makeValue(\n columnType: string,\n text: string,\n timeZone: string\n ): string | number | boolean | LongWrapper | null {\n if (text == null || text === 'null') {\n return null;\n }\n if (TableUtils.isTextType(columnType)) {\n return text;\n }\n if (TableUtils.isLongType(columnType)) {\n return dh.LongWrapper.ofString(TableUtils.removeCommas(text));\n }\n if (TableUtils.isBooleanType(columnType)) {\n return TableUtils.makeBooleanValue(text, true);\n }\n if (TableUtils.isDateType(columnType)) {\n const [date] = DateUtils.parseDateRange(text, timeZone);\n return date;\n }\n\n if (TableUtils.isNumberType(columnType)) {\n return TableUtils.makeNumberValue(text);\n }\n\n log.error('Unexpected column type', columnType);\n return null;\n }\n\n static makeBooleanValue(text: string, allowEmpty = false): boolean | null {\n if (text === '' && allowEmpty) {\n return null;\n }\n\n switch (text?.toLowerCase()) {\n case 'null':\n return null;\n case '0':\n case 'f':\n case 'fa':\n case 'fal':\n case 'fals':\n case 'false':\n case 'n':\n case 'no':\n return false;\n case '1':\n case 't':\n case 'tr':\n case 'tru':\n case 'true':\n case 'y':\n case 'ye':\n case 'yes':\n return true;\n default:\n throw new Error(`Invalid boolean '${text}'`);\n }\n }\n\n static makeNumberValue(text: string): number | null {\n if (text == null || text === 'null' || text === '') {\n return null;\n }\n\n const cleanText = text.toLowerCase().trim();\n if (cleanText === '∞' || cleanText === 'infinity' || cleanText === 'inf') {\n return Number.POSITIVE_INFINITY;\n }\n if (\n cleanText === '-∞' ||\n cleanText === '-infinity' ||\n cleanText === '-inf'\n ) {\n return Number.NEGATIVE_INFINITY;\n }\n\n const numberText = TableUtils.removeCommas(cleanText);\n if (TableUtils.NUMBER_REGEX.test(numberText)) {\n return parseFloat(numberText);\n }\n\n throw new Error(`Invalid number '${text}'`);\n }\n\n static makeAdvancedValueFilter(\n column: Column,\n operation: FilterTypeValue,\n value: string,\n timeZone: string\n ): FilterCondition {\n if (TableUtils.isDateType(column.type)) {\n return TableUtils.makeQuickDateFilterWithOperation(\n column,\n value,\n operation,\n timeZone\n );\n }\n\n const filterValue = TableUtils.makeFilterValue(column.type, value);\n const filter = column.filter();\n switch (operation) {\n case FilterType.eq:\n return filter.eq(filterValue);\n case FilterType.eqIgnoreCase:\n return filter.eqIgnoreCase(filterValue);\n case FilterType.notEq:\n return filter.notEq(filterValue);\n case FilterType.notEqIgnoreCase:\n return filter.notEqIgnoreCase(filterValue);\n case FilterType.greaterThan:\n return filter.greaterThan(filterValue);\n case FilterType.greaterThanOrEqualTo:\n return filter.greaterThanOrEqualTo(filterValue);\n case FilterType.lessThan:\n return filter.lessThan(filterValue);\n case FilterType.lessThanOrEqualTo:\n return filter.lessThanOrEqualTo(filterValue);\n case FilterType.isTrue:\n return filter.isTrue();\n case FilterType.isFalse:\n return filter.isFalse();\n case FilterType.isNull:\n return filter.isNull();\n case FilterType.contains:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n );\n case FilterType.notContains:\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n case FilterType.startsWith:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n );\n case FilterType.endsWith:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n );\n case FilterType.in:\n case FilterType.inIgnoreCase:\n case FilterType.notIn:\n case FilterType.notInIgnoreCase:\n case FilterType.invoke:\n default:\n throw new Error(`Unexpected filter operation: ${operation}`);\n }\n }\n\n /**\n * Create a filter using the selected items\n * Has a flag for invertSelection as we start from a \"Select All\" state and a user just deselects items.\n * Since there may be millions of distinct items, it's easier to build an inverse filter.\n * @param column The column to set the filter on\n * @param selectedValues The values that are selected\n * @param invertSelection Invert the selection (eg. All items are selected, then you deselect items)\n * @returns Returns a `in` or `notIn` FilterCondition as necessary, or null if no filtering should be applied (everything selected)\n */\n static makeSelectValueFilter(\n column: Column,\n selectedValues: unknown[],\n invertSelection: boolean\n ): FilterCondition | null {\n if (selectedValues.length === 0) {\n if (invertSelection) {\n // No filter means select everything\n return null;\n }\n\n // KLUDGE: Return a conflicting filter to show no results.\n // Could recognize this situation at a higher or lower level and pause updates on the\n // table, but this situation should be rare and that wouldn't be much gains for some added complexity\n let value = null;\n\n if (TableUtils.isTextType(column.type)) {\n // Use 'a' so that it can work for String or Character types\n value = dh.FilterValue.ofString('a');\n } else if (TableUtils.isBooleanType(column.type)) {\n value = dh.FilterValue.ofBoolean(true);\n } else if (TableUtils.isDateType(column.type)) {\n value = dh.FilterValue.ofNumber(dh.DateWrapper.ofJsDate(new Date()));\n } else {\n value = dh.FilterValue.ofNumber(0);\n }\n\n const eqFilter = column.filter().eq(value);\n const notEqFilter = column.filter().notEq(value);\n return eqFilter.and(notEqFilter);\n }\n\n const values = [];\n let isNullSelected = false;\n for (let i = 0; i < selectedValues.length; i += 1) {\n const value = selectedValues[i];\n if (value == null) {\n isNullSelected = true;\n } else if (TableUtils.isTextType(column.type)) {\n values.push(\n dh.FilterValue.ofString(\n typeof value === 'number' ? String.fromCharCode(value) : value\n )\n );\n } else if (TableUtils.isBooleanType(column.type)) {\n values.push(dh.FilterValue.ofBoolean(!!value));\n } else {\n values.push(dh.FilterValue.ofNumber(value));\n }\n }\n\n if (isNullSelected) {\n if (values.length > 0) {\n if (invertSelection) {\n return column\n .filter()\n .isNull()\n .not()\n .and(column.filter().notIn(values));\n }\n return column.filter().isNull().or(column.filter().in(values));\n }\n if (invertSelection) {\n return column.filter().isNull().not();\n }\n\n return column.filter().isNull();\n }\n\n if (invertSelection) {\n return column.filter().notIn(values);\n }\n\n return column.filter().in(values);\n }\n\n static isTreeTable(table: unknown): table is TreeTable {\n return (\n table != null &&\n (table as TreeTable).expand !== undefined &&\n (table as TreeTable).collapse !== undefined\n );\n }\n\n /**\n * Copies the provided array, sorts by column name case insensitive, and returns the sorted array.\n * @param columns The columns to sort\n * @param isAscending Whether to sort ascending\n */\n static sortColumns(columns: Column[], isAscending = true): Column[] {\n return [...columns].sort((a, b) => {\n const aName = a.name.toUpperCase();\n const bName = b.name.toUpperCase();\n return TextUtils.sort(aName, bName, isAscending);\n });\n }\n}\n\nexport default TableUtils;\n"],"file":"TableUtils.js"}
|
|
1
|
+
{"version":3,"sources":["../src/TableUtils.ts"],"names":["Type","FilterType","Operator","FilterOperator","Log","dh","PromiseUtils","TextUtils","TimeoutError","DateUtils","log","module","TableUtils","getSortIndex","sort","columnIndex","i","length","s","column","index","getSortForColumn","tableSort","sortIndex","getFilterText","filter","toString","getFilterTypes","columnType","isBooleanType","isTrue","isFalse","isNull","isCharType","isNumberType","isDateType","eq","notEq","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","isTextType","eqIgnoreCase","notEqIgnoreCase","contains","notContains","startsWith","endsWith","getNextSort","columns","sorts","asc","direction","sortDirection","ascending","desc","makeColumnSort","isAbs","none","descending","abs","toggleSortForColumn","addToExisting","newSort","setSortForColumn","sortColumn","modelColumn","concat","reverse","splice","push","getNormalizedType","dataType","BOOLEAN","CHAR","STRING","DATETIME","DECIMAL","INT","UNKNOWN","isLongType","isIntegerType","isDecimalType","isStringType","getBaseType","split","isCompatibleType","type1","type2","makeQuickFilter","text","timeZone","orComponents","orFilter","orComponent","andComponents","andFilter","j","andComponent","trim","makeQuickFilterFromComponent","and","Error","or","type","makeQuickNumberFilter","makeQuickBooleanFilter","makeQuickDateFilter","makeQuickCharFilter","makeQuickTextFilter","columnFilter","regex","result","exec","operation","negativeSign","value","abnormalValue","overflow","toLowerCase","FilterCondition","invoke","FilterValue","ofNumber","not","removeCommas","LongWrapper","ofString","error","warn","parseFloat","Number","isNaN","makeRangeFilterWithOperation","cleanText","prefix","suffix","substring","replace","notEqual","cleanValue","boolValue","makeBooleanValue","e","dateText","filterOperation","makeQuickDateFilterWithOperation","startDate","endDate","parseDateRange","startValue","endValue","startFilter","endFilter","quoteValue","charAt","isRangeOperation","filterValue","makeCancelableTablePromise","table","makeCancelable","resolved","close","makeCancelableTableEventPromise","eventName","timeout","matcher","eventCleanup","timeoutId","isPending","wrappedPromise","Promise","resolve","reject","setTimeout","addEventListener","event","debug2","clearTimeout","cancel","makeAdvancedFilter","options","filterItems","filterOperators","invertSelection","selectedValues","filterItem","selectedType","newFilter","makeAdvancedValueFilter","filterOperator","err","selectValueFilter","makeSelectValueFilter","makeFilterValue","makeFilterRawValue","rawValue","ofBoolean","makeValue","date","makeNumberValue","allowEmpty","POSITIVE_INFINITY","NEGATIVE_INFINITY","numberText","NUMBER_REGEX","test","getFilterOperatorString","in","inIgnoreCase","notIn","notInIgnoreCase","DateWrapper","ofJsDate","Date","eqFilter","notEqFilter","values","isNullSelected","String","fromCharCode","isTreeTable","expand","undefined","collapse","sortColumns","isAscending","a","b","aName","name","toUpperCase","bName","Object","freeze","NONE","PRE_SORT","POST_SORT"],"mappings":";;AAAA,SACEA,IAAI,IAAIC,UADV,EAEEC,QAAQ,IAAIC,cAFd,QAKO,oBALP;AAMA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,OAAOC,EAAP,MASO,uBATP;AAUA,SAEEC,YAFF,EAGEC,SAHF,EAIEC,YAJF,QAKO,kBALP;OAMOC,S;AAEP,IAAMC,GAAG,GAAGN,GAAG,CAACO,MAAJ,CAAW,YAAX,CAAZ;;AAuBA;AACA,OAAO,MAAMC,UAAN,CAAiB;AAwBtB;AAGmB,SAAZC,YAAY,CAACC,IAAD,EAAeC,WAAf,EAAmD;AACpE,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,IAAI,CAAtC,EAAyC;AAAA;;AACvC,UAAME,CAAC,GAAGJ,IAAI,CAACE,CAAD,CAAd;;AACA,UAAI,cAAAE,CAAC,CAACC,MAAF,wDAAUC,KAAV,MAAoBL,WAAxB,EAAqC;AACnC,eAAOC,CAAP;AACD;AACF;;AAED,WAAO,IAAP;AACD;AAED;AACF;AACA;AACA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SAHY;AAIrBV,EAAAA,IAAI,EAAE;AAJe,C;;gBAXZ/C,U,kBAkBW8N,MAAM,CAACC,MAAP,CAAc;AAClCC,EAAAA,IAAI,EAAE,MAD4B;AAElCC,EAAAA,QAAQ,EAAE,UAFwB;AAGlCC,EAAAA,SAAS,EAAE;AAHuB,CAAd,C;;gBAlBXlO,U,kBAyBW,iB;;AAy7CxB,eAAeA,UAAf","sourcesContent":["import {\n Type as FilterType,\n Operator as FilterOperator,\n TypeValue as FilterTypeValue,\n OperatorValue as FilterOperatorValue,\n} from '@deephaven/filters';\nimport Log from '@deephaven/log';\nimport dh, {\n Column,\n FilterCondition,\n FilterValue,\n LongWrapper,\n RemoverFn,\n Sort,\n Table,\n TreeTable,\n} from '@deephaven/jsapi-shim';\nimport {\n CancelablePromise,\n PromiseUtils,\n TextUtils,\n TimeoutError,\n} from '@deephaven/utils';\nimport DateUtils from './DateUtils';\n\nconst log = Log.module('TableUtils');\n\ntype Values<T> = T[keyof T];\nexport type DataType = Values<typeof TableUtils.dataType>;\nexport type SortDirection = Values<typeof TableUtils.sortDirection>;\nexport type ReverseType = Values<typeof TableUtils.REVERSE_TYPE>;\nexport type AdvancedFilterItemType = {\n selectedType: FilterTypeValue;\n value: string;\n};\n\nexport interface FilterItem {\n selectedType: FilterTypeValue;\n value: string;\n}\n\nexport type AdvancedFilterOptions = {\n filterItems: FilterItem[];\n filterOperators: FilterOperatorValue[];\n invertSelection: boolean;\n selectedValues: unknown[];\n};\n\n/** Utility class to provide some functions for working with tables */\nexport class TableUtils {\n static dataType = {\n BOOLEAN: 'boolean',\n CHAR: 'char',\n DATETIME: 'datetime',\n DECIMAL: 'decimal',\n INT: 'int',\n STRING: 'string',\n UNKNOWN: 'unknown',\n } as const;\n\n static sortDirection = {\n ascending: 'ASC',\n descending: 'DESC',\n reverse: 'REVERSE',\n none: null,\n } as const;\n\n static REVERSE_TYPE = Object.freeze({\n NONE: 'none',\n PRE_SORT: 'pre-sort',\n POST_SORT: 'post-sort',\n } as const);\n\n // Regex looking for a negative or positive integer or decimal number\n static NUMBER_REGEX = /^-?\\d+(\\.\\d+)?$/;\n\n static getSortIndex(sort: Sort[], columnIndex: number): number | null {\n for (let i = 0; i < sort.length; i += 1) {\n const s = sort[i];\n if (s.column?.index === columnIndex) {\n return i;\n }\n }\n\n return null;\n }\n\n /**\n * @param tableSort The sorts from the table to get the sort from\n * @param columnIndex The index of the column to get the sort for\n * @returns The sort for the column, or null if it's not sorted\n */\n static getSortForColumn(tableSort: Sort[], columnIndex: number): Sort | null {\n const sortIndex = TableUtils.getSortIndex(tableSort, columnIndex);\n if (sortIndex != null) {\n return tableSort[sortIndex];\n }\n return null;\n }\n\n static getFilterText(filter?: FilterCondition | null): string | null {\n if (filter) {\n return filter.toString();\n }\n return null;\n }\n\n /** Return the valid filter types for the column */\n static getFilterTypes(columnType: string): FilterTypeValue[] {\n if (TableUtils.isBooleanType(columnType)) {\n return [FilterType.isTrue, FilterType.isFalse, FilterType.isNull];\n }\n if (\n TableUtils.isCharType(columnType) ||\n TableUtils.isNumberType(columnType) ||\n TableUtils.isDateType(columnType)\n ) {\n return [\n FilterType.eq,\n FilterType.notEq,\n FilterType.greaterThan,\n FilterType.greaterThanOrEqualTo,\n FilterType.lessThan,\n FilterType.lessThanOrEqualTo,\n ];\n }\n if (TableUtils.isTextType(columnType)) {\n return [\n FilterType.eq,\n FilterType.eqIgnoreCase,\n FilterType.notEq,\n FilterType.notEqIgnoreCase,\n FilterType.contains,\n FilterType.notContains,\n FilterType.startsWith,\n FilterType.endsWith,\n ];\n }\n return [];\n }\n\n static getNextSort(\n columns: Column[],\n sorts: Sort[],\n columnIndex: number\n ): Sort | null {\n if (!columns || columnIndex < 0 || columnIndex >= columns.length) {\n return null;\n }\n\n const sort = TableUtils.getSortForColumn(sorts, columnIndex);\n if (sort === null) {\n return columns[columnIndex].sort().asc();\n }\n if (sort.direction === TableUtils.sortDirection.ascending) {\n return sort.desc();\n }\n return null;\n }\n\n static makeColumnSort(\n columns: Column[],\n columnIndex: number,\n direction: SortDirection,\n isAbs: boolean\n ): Sort | null {\n if (!columns || columnIndex < 0 || columnIndex >= columns.length) {\n return null;\n }\n\n if (direction === TableUtils.sortDirection.none) {\n return null;\n }\n\n let sort = columns[columnIndex].sort();\n\n switch (direction) {\n case TableUtils.sortDirection.ascending:\n sort = sort.asc();\n break;\n case TableUtils.sortDirection.descending:\n sort = sort.desc();\n break;\n default:\n break;\n }\n if (isAbs) {\n sort = sort.abs();\n }\n return sort;\n }\n\n /**\n * Toggles the sort for the specified column\n * @param sorts The current sorts from IrisGrid.state\n * @param columns The columns to apply the sort to\n * @param columnIndex The column index to apply the sort to\n * @param addToExisting Add this sort to the existing sort\n */\n static toggleSortForColumn(\n sorts: Sort[],\n columns: Column[],\n columnIndex: number,\n addToExisting = false\n ): Sort[] {\n if (columnIndex < 0 || columnIndex >= columns.length) {\n return [];\n }\n\n const newSort = TableUtils.getNextSort(columns, sorts, columnIndex);\n\n return TableUtils.setSortForColumn(\n sorts,\n columnIndex,\n newSort,\n addToExisting\n );\n }\n\n static sortColumn(\n sorts: Sort[],\n columns: Column[],\n modelColumn: number,\n direction: SortDirection,\n isAbs: boolean,\n addToExisting: boolean\n ): Sort[] {\n if (!sorts || modelColumn < 0 || modelColumn >= columns.length) {\n return [];\n }\n\n const newSort = TableUtils.makeColumnSort(\n columns,\n modelColumn,\n direction,\n isAbs\n );\n\n return TableUtils.setSortForColumn(\n sorts,\n modelColumn,\n newSort,\n addToExisting\n );\n }\n\n /**\n * Sets the sort for the given column *and* removes any reverses\n * @param tableSort The current sorts from IrisGrid.state\n * @param columnIndex The column index to apply the sort to\n * @param sort The sort object to add\n * @param addToExisting Add this sort to the existing sort\n * @returns Returns the modified array of sorts - removing reverses\n */\n static setSortForColumn(\n tableSort: Sort[],\n columnIndex: number,\n sort: Sort | null,\n addToExisting = false\n ): Sort[] {\n const sortIndex = TableUtils.getSortIndex(tableSort, columnIndex);\n let sorts: Sort[] = [];\n if (addToExisting) {\n sorts = sorts.concat(\n tableSort.filter(\n ({ direction }) => direction !== TableUtils.sortDirection.reverse\n )\n );\n if (sortIndex !== null) {\n sorts.splice(sortIndex, 1);\n }\n }\n\n if (sort !== null) {\n sorts.push(sort);\n }\n\n return sorts;\n }\n\n static getNormalizedType(columnType?: string | null): DataType {\n switch (columnType) {\n case 'boolean':\n case 'java.lang.Boolean':\n case TableUtils.dataType.BOOLEAN:\n return TableUtils.dataType.BOOLEAN;\n case 'char':\n case 'java.lang.Character':\n case TableUtils.dataType.CHAR:\n return TableUtils.dataType.CHAR;\n case 'java.lang.String':\n case TableUtils.dataType.STRING:\n return TableUtils.dataType.STRING;\n case 'io.deephaven.db.tables.utils.DBDateTime':\n case 'io.deephaven.time.DateTime':\n case 'com.illumon.iris.db.tables.utils.DBDateTime':\n case TableUtils.dataType.DATETIME:\n return TableUtils.dataType.DATETIME;\n case 'double':\n case 'java.lang.Double':\n case 'float':\n case 'java.lang.Float':\n case 'java.math.BigDecimal':\n case TableUtils.dataType.DECIMAL:\n return TableUtils.dataType.DECIMAL;\n case 'int':\n case 'java.lang.Integer':\n case 'long':\n case 'java.lang.Long':\n case 'short':\n case 'java.lang.Short':\n case 'byte':\n case 'java.lang.Byte':\n case 'java.math.BigInteger':\n case TableUtils.dataType.INT:\n return TableUtils.dataType.INT;\n default:\n return TableUtils.dataType.UNKNOWN;\n }\n }\n\n static isLongType(columnType: string): boolean {\n switch (columnType) {\n case 'long':\n case 'java.lang.Long':\n return true;\n default:\n return false;\n }\n }\n\n static isDateType(columnType: string): boolean {\n switch (columnType) {\n case 'io.deephaven.db.tables.utils.DBDateTime':\n case 'io.deephaven.time.DateTime':\n case 'com.illumon.iris.db.tables.utils.DBDateTime':\n return true;\n default:\n return false;\n }\n }\n\n static isNumberType(columnType: string): boolean {\n return (\n TableUtils.isIntegerType(columnType) ||\n TableUtils.isDecimalType(columnType)\n );\n }\n\n static isIntegerType(columnType: string): boolean {\n switch (columnType) {\n case 'int':\n case 'java.lang.Integer':\n case 'java.math.BigInteger':\n case 'long':\n case 'java.lang.Long':\n case 'short':\n case 'java.lang.Short':\n case 'byte':\n case 'java.lang.Byte':\n return true;\n default:\n return false;\n }\n }\n\n static isDecimalType(columnType: string): boolean {\n switch (columnType) {\n case 'double':\n case 'java.lang.Double':\n case 'java.math.BigDecimal':\n case 'float':\n case 'java.lang.Float':\n return true;\n default:\n return false;\n }\n }\n\n static isBooleanType(columnType: string): boolean {\n switch (columnType) {\n case 'boolean':\n case 'java.lang.Boolean':\n return true;\n default:\n return false;\n }\n }\n\n static isCharType(columnType: string): boolean {\n switch (columnType) {\n case 'char':\n case 'java.lang.Character':\n return true;\n default:\n return false;\n }\n }\n\n static isStringType(columnType: string): boolean {\n switch (columnType) {\n case 'java.lang.String':\n return true;\n default:\n return false;\n }\n }\n\n static isTextType(columnType: string): boolean {\n return this.isStringType(columnType) || this.isCharType(columnType);\n }\n\n /**\n * Get base column type\n * @param columnType Column type\n * @returns Element type for array columns, original type for non-array columns\n */\n static getBaseType(columnType: string): string {\n return columnType.split('[]')[0];\n }\n\n /**\n * Check if the column types are compatible\n * @param type1 Column type to check\n * @param type2 Column type to check\n * @returns True, if types are compatible\n */\n static isCompatibleType(\n type1?: string | null,\n type2?: string | null\n ): boolean {\n return (\n TableUtils.getNormalizedType(type1) ===\n TableUtils.getNormalizedType(type2)\n );\n }\n\n /**\n * Create filter with the provided column and text. Handles multiple filters joined with && or ||\n * @param column The column to set the filter on\n * @param text The text string to create the filter from\n * @param timeZone The time zone to make this value in if it is a date type. E.g. America/New_York\n * @returns Returns the created filter, null if text could not be parsed\n */\n static makeQuickFilter(\n column: Column,\n text: string,\n timeZone?: string\n ): FilterCondition | null {\n const orComponents = text.split('||');\n let orFilter = null;\n for (let i = 0; i < orComponents.length; i += 1) {\n const orComponent = orComponents[i];\n const andComponents = orComponent.split('&&');\n let andFilter = null;\n for (let j = 0; j < andComponents.length; j += 1) {\n const andComponent = andComponents[j].trim();\n if (andComponent.length > 0) {\n const filter = TableUtils.makeQuickFilterFromComponent(\n column,\n andComponent,\n timeZone\n );\n if (filter) {\n if (andFilter) {\n andFilter = andFilter.and(filter);\n } else {\n andFilter = filter;\n }\n } else {\n throw new Error(`Unable to parse quick filter from text ${text}`);\n }\n }\n }\n\n if (orFilter && andFilter) {\n orFilter = orFilter.or(andFilter);\n } else {\n orFilter = andFilter;\n }\n }\n\n return orFilter;\n }\n\n /**\n * Create filter with the provided column and text of one component (no multiple conditions)\n * @param column The column to set the filter on\n * @param text The text string to create the filter from\n * @param timeZone The time zone to make this filter in if it is a date type. E.g. America/New_York\n * @returns Returns the created filter, null if text could not be parsed\n */\n static makeQuickFilterFromComponent(\n column: Column,\n text: string,\n timeZone?: string\n ): FilterCondition | null {\n const { type } = column;\n if (TableUtils.isNumberType(type)) {\n return this.makeQuickNumberFilter(column, text);\n }\n if (TableUtils.isBooleanType(type)) {\n return this.makeQuickBooleanFilter(column, text);\n }\n if (timeZone && TableUtils.isDateType(type)) {\n return this.makeQuickDateFilter(column, text, timeZone);\n }\n if (TableUtils.isCharType(type)) {\n return this.makeQuickCharFilter(column, text);\n }\n return this.makeQuickTextFilter(column, text);\n }\n\n static makeQuickNumberFilter(\n column: Column,\n text: string\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const columnFilter = column.filter();\n let filter = null;\n\n const regex = /\\s*(>=|<=|=>|=<|>|<|!=|=|!)?(\\s*-\\s*)?(\\s*\\d*(?:,\\d{3})*(?:\\.\\d*)?\\s*)?(null|nan|infinity|inf|\\u221E)?(.*)/i;\n const result = regex.exec(text);\n\n let operation = null;\n let negativeSign = null;\n let value = null;\n let abnormalValue = null; // includes nan, null and infinity(positive & negative)\n let overflow = null;\n\n if (result !== null && result.length > 3) {\n [, operation, negativeSign, value, abnormalValue, overflow] = result;\n }\n\n if (overflow != null && overflow.trim().length > 0) {\n // Some bad characters after the number, bail out!\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n if (abnormalValue != null) {\n if (!(operation === '=' || operation === '!' || operation === '!=')) {\n // only equal and not equal operations are supported for abnormal value filter\n return null;\n }\n abnormalValue = abnormalValue.trim().toLowerCase();\n switch (abnormalValue) {\n case 'null':\n filter = columnFilter.isNull();\n break;\n case 'nan':\n filter = dh.FilterCondition.invoke('isNaN', columnFilter);\n break;\n case 'infinity':\n case 'inf':\n case '\\u221E':\n if (negativeSign != null) {\n filter = dh.FilterCondition.invoke('isInf', columnFilter).and(\n columnFilter.lessThan(dh.FilterValue.ofNumber(0))\n );\n } else {\n filter = dh.FilterCondition.invoke('isInf', columnFilter).and(\n columnFilter.greaterThan(dh.FilterValue.ofNumber(0))\n );\n }\n break;\n default:\n break;\n }\n if (filter !== null && (operation === '!' || operation === '!=')) {\n filter = filter.not();\n }\n return filter;\n }\n\n if (value == null) {\n return null;\n }\n\n value = TableUtils.removeCommas(value);\n if (TableUtils.isLongType(column.type)) {\n try {\n value = dh.FilterValue.ofNumber(\n dh.LongWrapper.ofString(`${negativeSign != null ? '-' : ''}${value}`)\n );\n } catch (error) {\n log.warn('Unable to create long filter', error);\n return null;\n }\n } else {\n value = parseFloat(value);\n if (value == null || Number.isNaN(value)) {\n return null;\n }\n\n value = dh.FilterValue.ofNumber(negativeSign != null ? 0 - value : value);\n }\n\n filter = column.filter();\n\n return TableUtils.makeRangeFilterWithOperation(filter, operation, value);\n }\n\n static makeQuickTextFilter(\n column: Column,\n text: string | null\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const cleanText = `${text}`.trim();\n const regex = /^(!~|!=|~|=|!)?(.*)/;\n const result = regex.exec(cleanText);\n\n let operation = null;\n let value = null;\n if (result !== null && result.length > 2) {\n [, operation, value] = result;\n if (value != null) {\n value = value.trim();\n }\n }\n\n if (value == null || value.length === 0) {\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n const filter = column.filter();\n if (value.toLowerCase() === 'null') {\n // Null is a special case!\n switch (operation) {\n case '=':\n return filter.isNull();\n case '!=':\n case '!':\n return filter.isNull().not();\n default:\n return null;\n }\n }\n\n let prefix = null;\n let suffix = null;\n if (value.startsWith('*')) {\n prefix = '*';\n value = value.substring(1);\n } else if (value.endsWith('*') && !value.endsWith('\\\\*')) {\n suffix = '*';\n value = value.substring(0, value.length - 1);\n }\n\n value = value.replace('\\\\', '');\n\n switch (operation) {\n case '~': {\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n );\n }\n case '!~':\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n case '!=':\n if (prefix === '*') {\n // Does not end with\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n .not()\n );\n }\n if (suffix === '*') {\n // Does not start with\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n }\n return filter.notEqIgnoreCase(\n dh.FilterValue.ofString(value.toLowerCase())\n );\n\n case '=':\n if (prefix === '*') {\n // Ends with\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n );\n }\n if (suffix === '*') {\n // Starts with\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n );\n }\n return filter.eqIgnoreCase(\n dh.FilterValue.ofString(value.toLowerCase())\n );\n\n default:\n break;\n }\n\n return null;\n }\n\n static makeQuickBooleanFilter(\n column: Column,\n text: string | number\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const regex = /^(!=|=|!)?(.*)/;\n const result = regex.exec(`${text}`.trim());\n if (result === null) {\n return null;\n }\n const [, operation, value] = result;\n const notEqual = operation === '!' || operation === '!=';\n const cleanValue = value.trim().toLowerCase();\n\n let filter: FilterCondition | FilterValue = column.filter();\n\n try {\n const boolValue = TableUtils.makeBooleanValue(cleanValue);\n if (boolValue) {\n filter = filter.isTrue();\n } else if (boolValue === null) {\n filter = filter.isNull();\n } else {\n filter = filter.isFalse();\n }\n\n return notEqual ? filter.not() : filter;\n } catch (e) {\n return null;\n }\n }\n\n /**\n * Builds a date filter parsed from the text string which may or may not include an operator.\n * @param column The column to build the filter from, with or without a leading operator.\n * @param text The date string text to parse.\n * @param timeZone The time zone to make this filter in if it is a date type. E.g. America/New_York\n */\n static makeQuickDateFilter(\n column: Column,\n text: string,\n timeZone: string\n ): FilterCondition {\n const cleanText = text.trim();\n const regex = /\\s*(>=|<=|=>|=<|>|<|!=|!|=)?(.*)/;\n const result = regex.exec(cleanText);\n if (result == null || result.length <= 2) {\n throw new Error(`Unable to parse date filter: ${text}`);\n }\n\n let operation = null;\n let dateText = null;\n\n [, operation, dateText] = result;\n\n let filterOperation: FilterTypeValue = FilterType.eq;\n switch (operation) {\n case '<':\n filterOperation = FilterType.lessThan;\n break;\n case '<=':\n case '=<':\n filterOperation = FilterType.lessThanOrEqualTo;\n break;\n case '>':\n filterOperation = FilterType.greaterThan;\n break;\n case '>=':\n case '=>':\n filterOperation = FilterType.greaterThanOrEqualTo;\n break;\n case '!=':\n case '!':\n filterOperation = FilterType.notEq;\n break;\n case '=':\n case '==':\n default:\n filterOperation = FilterType.eq;\n break;\n }\n\n return TableUtils.makeQuickDateFilterWithOperation(\n column,\n dateText,\n filterOperation,\n timeZone\n );\n }\n\n /**\n * Builds a date filter parsed from the text string with the provided filter.\n * @param column The column to build the filter from.\n * @param text The date string text to parse, without an operator.\n * @param operation The filter operation to use.\n * @param timeZone The time zone to make this filter with. E.g. America/New_York\n */\n static makeQuickDateFilterWithOperation(\n column: Column,\n text: string,\n operation: FilterTypeValue = FilterType.eq,\n timeZone: string\n ): FilterCondition {\n if (column == null) {\n throw new Error('Column is null');\n }\n\n const [startDate, endDate] = DateUtils.parseDateRange(text, timeZone);\n\n const startValue =\n startDate != null ? dh.FilterValue.ofNumber(startDate) : null;\n const endValue = endDate != null ? dh.FilterValue.ofNumber(endDate) : null;\n\n const filter = column.filter();\n if (startValue == null) {\n return operation === FilterType.notEq\n ? filter.isNull().not()\n : filter.isNull();\n }\n\n switch (operation) {\n case FilterType.eq: {\n if (endValue != null) {\n const startFilter = filter.greaterThanOrEqualTo(startValue);\n const endFilter = filter.lessThan(endValue);\n return startFilter.and(endFilter);\n }\n return filter.eq(startValue);\n }\n case FilterType.lessThan: {\n return filter.lessThan(startValue);\n }\n case FilterType.lessThanOrEqualTo: {\n if (endValue != null) {\n return filter.lessThan(endValue);\n }\n return filter.lessThanOrEqualTo(startValue);\n }\n case FilterType.greaterThan: {\n if (endValue != null) {\n return filter.greaterThanOrEqualTo(endValue);\n }\n return filter.greaterThan(startValue);\n }\n case FilterType.greaterThanOrEqualTo:\n return filter.greaterThanOrEqualTo(startValue);\n case FilterType.notEq: {\n if (endValue != null) {\n const startFilter = filter.lessThan(startValue);\n const endFilter = filter.greaterThanOrEqualTo(endValue);\n return startFilter.or(endFilter);\n }\n return filter.notEq(startValue);\n }\n\n default:\n throw new Error(`Invalid operator: ${operation}`);\n }\n }\n\n /**\n * Adds quotes to a value if they're not already added\n * @param value Value to add quotes around\n */\n static quoteValue(value: string): string {\n if (\n value.length >= 2 &&\n ((value.charAt(0) === '\"' && value.charAt(value.length - 1) === '\"') ||\n (value.charAt(0) === \"'\" && value.charAt(value.length - 1) === \"'\"))\n ) {\n return value;\n }\n return `\"${value}\"`;\n }\n\n static isRangeOperation(operation: string): boolean {\n switch (operation) {\n case '<':\n case '<=':\n case '=<':\n case '>':\n case '>=':\n case '=>':\n return true;\n default:\n return false;\n }\n }\n\n static makeQuickCharFilter(\n column: Column,\n text: string\n ): FilterCondition | null {\n if (text == null) {\n return null;\n }\n\n const cleanText = `${text}`.trim();\n const regex = /^(>=|<=|=>|=<|>|<|!=|=|!)?(null|\".\"|'.'|.)?(.*)/;\n const result = regex.exec(cleanText);\n\n let operation = null;\n let value = null;\n let overflow = null;\n if (result !== null && result.length > 3) {\n [, operation, value, overflow] = result;\n }\n if (overflow != null && overflow.trim().length > 0) {\n // Some bad characters after the number, bail out!\n return null;\n }\n\n if (value == null || value.length === 0) {\n return null;\n }\n\n if (operation == null) {\n operation = '=';\n }\n\n const filter = column.filter();\n if (value.toLowerCase() === 'null') {\n // Null is a special case!\n switch (operation) {\n case '=':\n return filter.isNull();\n case '!=':\n case '!':\n return filter.isNull().not();\n default:\n return null;\n }\n }\n\n // We need to put quotes around range operations or else the API fails\n const filterValue = dh.FilterValue.ofString(\n TableUtils.isRangeOperation(operation)\n ? TableUtils.quoteValue(value)\n : value\n );\n return TableUtils.makeRangeFilterWithOperation(\n filter,\n operation,\n filterValue\n );\n }\n\n /**\n * @param filter The column filter to apply the range operation to\n * @param operation The range operation to run\n * @param value The value to use for the operation\n * @returns The condition with the specified operation\n */\n static makeRangeFilterWithOperation(\n filter: FilterValue,\n operation: string,\n value: FilterValue\n ): FilterCondition | null {\n switch (operation) {\n case '=':\n return filter.eq(value);\n case '<':\n return filter.lessThan(value);\n case '<=':\n case '=<':\n return filter.lessThanOrEqualTo(value);\n case '>':\n return filter.greaterThan(value);\n case '>=':\n case '=>':\n return filter.greaterThanOrEqualTo(value);\n case '!=':\n case '!':\n return filter.notEq(value);\n default:\n return null;\n }\n }\n\n /**\n * Wraps a table promise in a cancelable promise that will close the table if the promise is cancelled.\n * Use in a component that loads a table, and call cancel when unmounting.\n * @param table The table promise to wrap\n */\n static makeCancelableTablePromise(\n table: Promise<Table> | Table\n ): CancelablePromise<Table> {\n return PromiseUtils.makeCancelable(table, resolved => {\n resolved.close();\n });\n }\n\n /**\n * Make a cancelable promise for a one-shot table event with a timeout.\n * @param table Table to listen for events on\n * @param eventName Event to listen for\n * @param timeout Event timeout in milliseconds, defaults to 0\n * @param matcher Optional function to determine if the promise can be resolved or stays pending\n * @returns Resolves with the event data\n */\n static makeCancelableTableEventPromise(\n table: Table | TreeTable,\n eventName: string,\n timeout = 0,\n matcher: ((event: CustomEvent) => boolean) | null = null\n ): CancelablePromise<CustomEvent> {\n let eventCleanup: RemoverFn;\n let timeoutId: ReturnType<typeof setTimeout>;\n let isPending = true;\n const wrappedPromise = new Promise((resolve, reject) => {\n timeoutId = setTimeout(() => {\n eventCleanup();\n isPending = false;\n reject(new TimeoutError(`Event \"${eventName}\" timed out.`));\n }, timeout);\n eventCleanup = table.addEventListener(eventName, event => {\n if (matcher != null && !matcher(event)) {\n log.debug2('Event triggered, but matcher returned false.');\n return;\n }\n log.debug2('Event triggered, resolving.');\n eventCleanup();\n clearTimeout(timeoutId);\n isPending = false;\n resolve(event);\n });\n }) as CancelablePromise<CustomEvent>;\n wrappedPromise.cancel = () => {\n if (isPending) {\n log.debug2('Pending promise cleanup.');\n eventCleanup();\n clearTimeout(timeoutId);\n isPending = false;\n return;\n }\n log.debug2('Ignoring non-pending promise cancel.');\n };\n return wrappedPromise;\n }\n\n static makeAdvancedFilter(\n column: Column,\n options: AdvancedFilterOptions,\n timeZone: string\n ): FilterCondition | null {\n const {\n filterItems,\n filterOperators,\n invertSelection,\n selectedValues,\n } = options;\n let filter = null;\n for (let i = 0; i < filterItems.length; i += 1) {\n const filterItem = filterItems[i];\n const { selectedType, value } = filterItem;\n if (\n selectedType != null &&\n selectedType.length > 0 &&\n value != null &&\n value.length > 0\n ) {\n try {\n const newFilter = TableUtils.makeAdvancedValueFilter(\n column,\n selectedType,\n value,\n timeZone\n );\n if (newFilter != null) {\n if (i === 0) {\n filter = newFilter;\n } else if (filter !== null && i - 1 < filterOperators.length) {\n const filterOperator = filterOperators[i - 1];\n if (filterOperator === FilterOperator.and) {\n filter = filter.and(newFilter);\n } else if (filterOperator === FilterOperator.or) {\n filter = filter.or(newFilter);\n } else {\n log.error(\n 'Unexpected filter operator',\n filterOperator,\n newFilter\n );\n filter = null;\n break;\n }\n }\n } else {\n log.debug2('Empty filter ignored for', selectedType, value);\n }\n } catch (err) {\n log.error('Unable to create filter', err);\n filter = null;\n break;\n }\n }\n }\n\n const selectValueFilter = TableUtils.makeSelectValueFilter(\n column,\n selectedValues,\n invertSelection\n );\n if (selectValueFilter != null) {\n if (filter != null) {\n filter = filter.and(selectValueFilter);\n } else {\n filter = selectValueFilter;\n }\n }\n\n return filter;\n }\n\n static removeCommas(value: string): string {\n return value.replace(/[\\s|,]/g, '');\n }\n\n /**\n * @param columnType The column type to make the filter value from.\n * @param value The value to make the filter value from.\n * @returns The FilterValue item for this column/value combination\n */\n static makeFilterValue(columnType: string, value: string): FilterValue {\n const type = TableUtils.getBaseType(columnType);\n if (TableUtils.isTextType(type)) {\n return dh.FilterValue.ofString(value);\n }\n if (TableUtils.isLongType(type)) {\n return dh.FilterValue.ofNumber(\n dh.LongWrapper.ofString(TableUtils.removeCommas(value))\n );\n }\n\n return dh.FilterValue.ofNumber(TableUtils.removeCommas(value));\n }\n\n /**\n * Takes a value and converts it to an `dh.FilterValue`\n *\n * @param columnType The column type to make the filter value from.\n * @param value The value to actually set\n * @returns The FilterValue item for this column/value combination\n */\n static makeFilterRawValue(\n columnType: string,\n rawValue: unknown\n ): FilterValue {\n if (TableUtils.isTextType(columnType)) {\n return dh.FilterValue.ofString(rawValue);\n }\n\n if (TableUtils.isBooleanType(columnType)) {\n return dh.FilterValue.ofBoolean(rawValue);\n }\n\n return dh.FilterValue.ofNumber(rawValue);\n }\n\n /**\n * Converts a string value to a value appropriate for the column\n * @param columnType The column type to make the value for\n * @param text The string value to make a type for\n * @param timeZone The time zone to make this value in if it is a date type. E.g. America/New_York\n */\n static makeValue(\n columnType: string,\n text: string,\n timeZone: string\n ): string | number | boolean | LongWrapper | null {\n if (text == null || text === 'null') {\n return null;\n }\n if (TableUtils.isTextType(columnType)) {\n return text;\n }\n if (TableUtils.isLongType(columnType)) {\n return dh.LongWrapper.ofString(TableUtils.removeCommas(text));\n }\n if (TableUtils.isBooleanType(columnType)) {\n return TableUtils.makeBooleanValue(text, true);\n }\n if (TableUtils.isDateType(columnType)) {\n const [date] = DateUtils.parseDateRange(text, timeZone);\n return date;\n }\n\n if (TableUtils.isNumberType(columnType)) {\n return TableUtils.makeNumberValue(text);\n }\n\n log.error('Unexpected column type', columnType);\n return null;\n }\n\n static makeBooleanValue(text: string, allowEmpty = false): boolean | null {\n if (text === '' && allowEmpty) {\n return null;\n }\n\n switch (text?.toLowerCase()) {\n case 'null':\n return null;\n case '0':\n case 'f':\n case 'fa':\n case 'fal':\n case 'fals':\n case 'false':\n case 'n':\n case 'no':\n return false;\n case '1':\n case 't':\n case 'tr':\n case 'tru':\n case 'true':\n case 'y':\n case 'ye':\n case 'yes':\n return true;\n default:\n throw new Error(`Invalid boolean '${text}'`);\n }\n }\n\n static makeNumberValue(text: string): number | null {\n if (text == null || text === 'null' || text === '') {\n return null;\n }\n\n const cleanText = text.toLowerCase().trim();\n if (cleanText === '∞' || cleanText === 'infinity' || cleanText === 'inf') {\n return Number.POSITIVE_INFINITY;\n }\n if (\n cleanText === '-∞' ||\n cleanText === '-infinity' ||\n cleanText === '-inf'\n ) {\n return Number.NEGATIVE_INFINITY;\n }\n\n const numberText = TableUtils.removeCommas(cleanText);\n if (TableUtils.NUMBER_REGEX.test(numberText)) {\n return parseFloat(numberText);\n }\n\n throw new Error(`Invalid number '${text}'`);\n }\n\n static getFilterOperatorString(operation: FilterTypeValue): string {\n switch (operation) {\n case FilterType.eq:\n return '=';\n case FilterType.notEq:\n return '!=';\n case FilterType.greaterThan:\n return '>';\n case FilterType.greaterThanOrEqualTo:\n return '>=';\n case FilterType.lessThan:\n return '<';\n case FilterType.lessThanOrEqualTo:\n return '<=';\n case FilterType.contains:\n return '~';\n case FilterType.notContains:\n return '!~';\n default:\n throw new Error(`Unexpected filter type ${operation}`);\n }\n }\n\n static makeAdvancedValueFilter(\n column: Column,\n operation: FilterTypeValue,\n value: string,\n timeZone: string\n ): FilterCondition | null {\n if (TableUtils.isDateType(column.type)) {\n return TableUtils.makeQuickDateFilterWithOperation(\n column,\n value,\n operation,\n timeZone\n );\n }\n\n if (\n TableUtils.isNumberType(column.type) ||\n TableUtils.isCharType(column.type)\n ) {\n return TableUtils.makeQuickFilter(\n column,\n `${TableUtils.getFilterOperatorString(operation)}${value}`\n );\n }\n\n const filterValue = TableUtils.makeFilterValue(column.type, value);\n const filter = column.filter();\n switch (operation) {\n case FilterType.eq:\n return filter.eq(filterValue);\n case FilterType.eqIgnoreCase:\n return filter.eqIgnoreCase(filterValue);\n case FilterType.notEq:\n return filter.notEq(filterValue);\n case FilterType.notEqIgnoreCase:\n return filter.notEqIgnoreCase(filterValue);\n case FilterType.greaterThan:\n return filter.greaterThan(filterValue);\n case FilterType.greaterThanOrEqualTo:\n return filter.greaterThanOrEqualTo(filterValue);\n case FilterType.lessThan:\n return filter.lessThan(filterValue);\n case FilterType.lessThanOrEqualTo:\n return filter.lessThanOrEqualTo(filterValue);\n case FilterType.isTrue:\n return filter.isTrue();\n case FilterType.isFalse:\n return filter.isFalse();\n case FilterType.isNull:\n return filter.isNull();\n case FilterType.contains:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n );\n case FilterType.notContains:\n return filter\n .isNull()\n .or(\n filter\n .invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E.*`)\n )\n .not()\n );\n case FilterType.startsWith:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i)^\\\\Q${value}\\\\E.*`)\n )\n );\n case FilterType.endsWith:\n return filter\n .isNull()\n .not()\n .and(\n filter.invoke(\n 'matches',\n dh.FilterValue.ofString(`(?s)(?i).*\\\\Q${value}\\\\E$`)\n )\n );\n case FilterType.in:\n case FilterType.inIgnoreCase:\n case FilterType.notIn:\n case FilterType.notInIgnoreCase:\n case FilterType.invoke:\n default:\n throw new Error(`Unexpected filter operation: ${operation}`);\n }\n }\n\n /**\n * Create a filter using the selected items\n * Has a flag for invertSelection as we start from a \"Select All\" state and a user just deselects items.\n * Since there may be millions of distinct items, it's easier to build an inverse filter.\n * @param column The column to set the filter on\n * @param selectedValues The values that are selected\n * @param invertSelection Invert the selection (eg. All items are selected, then you deselect items)\n * @returns Returns a `in` or `notIn` FilterCondition as necessary, or null if no filtering should be applied (everything selected)\n */\n static makeSelectValueFilter(\n column: Column,\n selectedValues: unknown[],\n invertSelection: boolean\n ): FilterCondition | null {\n if (selectedValues.length === 0) {\n if (invertSelection) {\n // No filter means select everything\n return null;\n }\n\n // KLUDGE: Return a conflicting filter to show no results.\n // Could recognize this situation at a higher or lower level and pause updates on the\n // table, but this situation should be rare and that wouldn't be much gains for some added complexity\n let value = null;\n\n if (TableUtils.isTextType(column.type)) {\n // Use 'a' so that it can work for String or Character types\n value = dh.FilterValue.ofString('a');\n } else if (TableUtils.isBooleanType(column.type)) {\n value = dh.FilterValue.ofBoolean(true);\n } else if (TableUtils.isDateType(column.type)) {\n value = dh.FilterValue.ofNumber(dh.DateWrapper.ofJsDate(new Date()));\n } else {\n value = dh.FilterValue.ofNumber(0);\n }\n\n const eqFilter = column.filter().eq(value);\n const notEqFilter = column.filter().notEq(value);\n return eqFilter.and(notEqFilter);\n }\n\n const values = [];\n let isNullSelected = false;\n for (let i = 0; i < selectedValues.length; i += 1) {\n const value = selectedValues[i];\n if (value == null) {\n isNullSelected = true;\n } else if (TableUtils.isTextType(column.type)) {\n values.push(\n dh.FilterValue.ofString(\n typeof value === 'number' ? String.fromCharCode(value) : value\n )\n );\n } else if (TableUtils.isBooleanType(column.type)) {\n values.push(dh.FilterValue.ofBoolean(!!value));\n } else {\n values.push(dh.FilterValue.ofNumber(value));\n }\n }\n\n if (isNullSelected) {\n if (values.length > 0) {\n if (invertSelection) {\n return column\n .filter()\n .isNull()\n .not()\n .and(column.filter().notIn(values));\n }\n return column.filter().isNull().or(column.filter().in(values));\n }\n if (invertSelection) {\n return column.filter().isNull().not();\n }\n\n return column.filter().isNull();\n }\n\n if (invertSelection) {\n return column.filter().notIn(values);\n }\n\n return column.filter().in(values);\n }\n\n static isTreeTable(table: unknown): table is TreeTable {\n return (\n table != null &&\n (table as TreeTable).expand !== undefined &&\n (table as TreeTable).collapse !== undefined\n );\n }\n\n /**\n * Copies the provided array, sorts by column name case insensitive, and returns the sorted array.\n * @param columns The columns to sort\n * @param isAscending Whether to sort ascending\n */\n static sortColumns(columns: Column[], isAscending = true): Column[] {\n return [...columns].sort((a, b) => {\n const aName = a.name.toUpperCase();\n const bName = b.name.toUpperCase();\n return TextUtils.sort(aName, bName, isAscending);\n });\n }\n}\n\nexport default TableUtils;\n"],"file":"TableUtils.js"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,6 @@ export * from "./DateUtils.js";
|
|
|
3
3
|
export * from "./Formatter.js";
|
|
4
4
|
export { default as FormatterUtils } from "./FormatterUtils.js";
|
|
5
5
|
export * from "./FormatterUtils.js";
|
|
6
|
+
export * from "./Settings.js";
|
|
6
7
|
export * from "./TableUtils.js";
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["default","FormatterUtils"],"mappings":";;;SAGSA,OAAO,IAAIC,c","sourcesContent":["export * from './formatters';\nexport * from './DateUtils';\nexport * from './Formatter';\nexport { default as FormatterUtils } from './FormatterUtils';\nexport * from './FormatterUtils';\nexport * from './TableUtils';\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["default","FormatterUtils"],"mappings":";;;SAGSA,OAAO,IAAIC,c","sourcesContent":["export * from './formatters';\nexport * from './DateUtils';\nexport * from './Formatter';\nexport { default as FormatterUtils } from './FormatterUtils';\nexport * from './FormatterUtils';\nexport * from './Settings';\nexport * from './TableUtils';\n"],"file":"index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/jsapi-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1-beta.0+1d10956",
|
|
4
4
|
"description": "Deephaven JSAPI Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"start": "cross-env NODE_ENV=development npm run watch"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@deephaven/filters": "^0.
|
|
31
|
-
"@deephaven/jsapi-shim": "^0.
|
|
32
|
-
"@deephaven/log": "^0.
|
|
33
|
-
"@deephaven/utils": "^0.
|
|
30
|
+
"@deephaven/filters": "^0.16.1-beta.0+1d10956",
|
|
31
|
+
"@deephaven/jsapi-shim": "^0.16.1-beta.0+1d10956",
|
|
32
|
+
"@deephaven/log": "^0.16.1-beta.0+1d10956",
|
|
33
|
+
"@deephaven/utils": "^0.16.1-beta.0+1d10956"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@deephaven/tsconfig": "^0.
|
|
36
|
+
"@deephaven/tsconfig": "^0.16.1-beta.0+1d10956"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist"
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "1d10956499cd451145e704690bc8f2d5cfb6a786"
|
|
45
45
|
}
|