@deephaven/iris-grid 0.8.2-beta.0 → 0.9.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/AdvancedFilterCreator.d.ts +2 -2
- package/dist/AdvancedFilterCreator.d.ts.map +1 -1
- package/dist/AdvancedFilterCreatorFilterItem.d.ts +30 -31
- package/dist/AdvancedFilterCreatorFilterItem.d.ts.map +1 -1
- package/dist/AdvancedFilterCreatorFilterItem.js +21 -28
- package/dist/AdvancedFilterCreatorFilterItem.js.map +1 -1
- package/dist/CrossColumnSearch.d.ts +1 -1
- package/dist/CrossColumnSearch.d.ts.map +1 -1
- package/dist/DateUtils.d.ts +46 -44
- package/dist/DateUtils.d.ts.map +1 -1
- package/dist/DateUtils.js +37 -32
- package/dist/DateUtils.js.map +1 -1
- package/dist/Formatter.d.ts +37 -42
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +58 -38
- package/dist/Formatter.js.map +1 -1
- package/dist/FormatterUtils.d.ts +12 -8
- package/dist/FormatterUtils.d.ts.map +1 -1
- package/dist/FormatterUtils.js.map +1 -1
- package/dist/IrisGrid.d.ts +12 -4
- package/dist/IrisGrid.d.ts.map +1 -1
- package/dist/IrisGrid.js +20 -4
- package/dist/IrisGrid.js.map +1 -1
- package/dist/IrisGridMetricCalculator.d.ts +16 -2
- package/dist/IrisGridMetricCalculator.d.ts.map +1 -1
- package/dist/IrisGridMetricCalculator.js +4 -3
- package/dist/IrisGridMetricCalculator.js.map +1 -1
- package/dist/IrisGridTheme.d.ts +5 -75
- package/dist/IrisGridTheme.d.ts.map +1 -1
- package/dist/IrisGridTheme.js +2 -1
- package/dist/IrisGridTheme.js.map +1 -1
- package/dist/IrisGridUtils.d.ts +4 -4
- package/dist/IrisGridUtils.d.ts.map +1 -1
- package/dist/PartitionSelectorSearch.d.ts +1 -1
- package/dist/TableUtils.d.ts +127 -114
- package/dist/TableUtils.d.ts.map +1 -1
- package/dist/TableUtils.js +76 -69
- package/dist/TableUtils.js.map +1 -1
- package/dist/declaration.d.js +2 -0
- package/dist/declaration.d.js.map +1 -0
- package/dist/filters/FilterOperator.d.ts +5 -5
- package/dist/filters/FilterOperator.d.ts.map +1 -1
- package/dist/filters/FilterOperator.js +1 -3
- package/dist/filters/FilterOperator.js.map +1 -1
- package/dist/filters/FilterType.d.ts +23 -23
- package/dist/filters/FilterType.d.ts.map +1 -1
- package/dist/filters/FilterType.js +1 -3
- package/dist/filters/FilterType.js.map +1 -1
- package/dist/filters/index.d.ts +2 -2
- package/dist/filters/index.d.ts.map +1 -1
- package/dist/filters/index.js +2 -2
- package/dist/filters/index.js.map +1 -1
- package/dist/format-context-menus/CustomFormatAction.d.ts +27 -39
- package/dist/format-context-menus/CustomFormatAction.d.ts.map +1 -1
- package/dist/format-context-menus/CustomFormatAction.js +24 -23
- package/dist/format-context-menus/CustomFormatAction.js.map +1 -1
- package/dist/format-context-menus/DateTimeFormatContextMenu.d.ts +8 -5
- package/dist/format-context-menus/DateTimeFormatContextMenu.d.ts.map +1 -1
- package/dist/format-context-menus/DateTimeFormatContextMenu.js +3 -3
- package/dist/format-context-menus/DateTimeFormatContextMenu.js.map +1 -1
- package/dist/format-context-menus/DecimalFormatContextMenu.d.ts +7 -5
- package/dist/format-context-menus/DecimalFormatContextMenu.d.ts.map +1 -1
- package/dist/format-context-menus/DecimalFormatContextMenu.js +3 -3
- package/dist/format-context-menus/DecimalFormatContextMenu.js.map +1 -1
- package/dist/format-context-menus/FormatContextMenuUtils.d.ts +28 -27
- package/dist/format-context-menus/FormatContextMenuUtils.d.ts.map +1 -1
- package/dist/format-context-menus/FormatContextMenuUtils.js +12 -10
- package/dist/format-context-menus/FormatContextMenuUtils.js.map +1 -1
- package/dist/format-context-menus/IntegerFormatContextMenu.d.ts +7 -5
- package/dist/format-context-menus/IntegerFormatContextMenu.d.ts.map +1 -1
- package/dist/format-context-menus/IntegerFormatContextMenu.js +3 -3
- package/dist/format-context-menus/IntegerFormatContextMenu.js.map +1 -1
- package/dist/format-context-menus/index.d.ts +3 -3
- package/dist/format-context-menus/index.d.ts.map +1 -1
- package/dist/format-context-menus/index.js.map +1 -1
- package/dist/formatters/BooleanColumnFormatter.d.ts +4 -4
- package/dist/formatters/BooleanColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/BooleanColumnFormatter.js.map +1 -1
- package/dist/formatters/CharColumnFormatter.d.ts +4 -4
- package/dist/formatters/CharColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/CharColumnFormatter.js.map +1 -1
- package/dist/formatters/DateTimeColumnFormatter.d.ts +13 -11
- package/dist/formatters/DateTimeColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/DateTimeColumnFormatter.js +1 -2
- package/dist/formatters/DateTimeColumnFormatter.js.map +1 -1
- package/dist/formatters/DecimalColumnFormatter.d.ts +55 -59
- package/dist/formatters/DecimalColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/DecimalColumnFormatter.js +66 -27
- package/dist/formatters/DecimalColumnFormatter.js.map +1 -1
- package/dist/formatters/DefaultColumnFormatter.d.ts +4 -4
- package/dist/formatters/DefaultColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/DefaultColumnFormatter.js.map +1 -1
- package/dist/formatters/IntegerColumnFormatter.d.ts +50 -29
- package/dist/formatters/IntegerColumnFormatter.d.ts.map +1 -1
- package/dist/formatters/IntegerColumnFormatter.js +60 -19
- package/dist/formatters/IntegerColumnFormatter.js.map +1 -1
- package/dist/formatters/index.d.ts +8 -7
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +4 -3
- package/dist/formatters/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts +14 -5
- package/dist/mousehandlers/IrisGridContextMenuHandler.d.ts.map +1 -1
- package/dist/sidebar/ChartBuilder.d.ts +1 -1
- package/dist/sidebar/ChartBuilder.d.ts.map +1 -1
- package/dist/sidebar/TableCsvExporter.d.ts +1 -1
- package/dist/sidebar/TableCsvExporter.d.ts.map +1 -1
- package/dist/sidebar/aggregations/AggregationEdit.d.ts +2 -4
- package/dist/sidebar/aggregations/AggregationEdit.d.ts.map +1 -1
- package/dist/sidebar/aggregations/AggregationEdit.js.map +1 -1
- package/dist/sidebar/aggregations/AggregationUtils.d.ts +1 -4
- package/dist/sidebar/aggregations/AggregationUtils.d.ts.map +1 -1
- package/dist/sidebar/aggregations/AggregationUtils.js.map +1 -1
- package/package.json +11 -11
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -19,10 +19,10 @@ declare class AdvancedFilterCreator extends React.PureComponent<any, any, any> {
|
|
|
19
19
|
focusTrapContainer: React.RefObject<any>;
|
|
20
20
|
debounceTimeout: NodeJS.Timeout | null;
|
|
21
21
|
filterKey: number;
|
|
22
|
-
valuesTablePromise: import("@deephaven/utils").CancelablePromise<
|
|
22
|
+
valuesTablePromise: import("@deephaven/utils").CancelablePromise<import("@deephaven/jsapi-shim").Table> | null;
|
|
23
23
|
getFilterChangeHandler(index: any): (selectedType?: any, value?: any) => void;
|
|
24
24
|
getFilterDeleteHandler(index: any): () => void;
|
|
25
|
-
getFilterTypes: (this: any, columnType: any) =>
|
|
25
|
+
getFilterTypes: (this: any, columnType: any) => import("./filters").FilterType[];
|
|
26
26
|
initValuesTable(): void;
|
|
27
27
|
makeFilterItem(updateKey?: boolean): {
|
|
28
28
|
selectedType: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvancedFilterCreator.d.ts","sourceRoot":"","sources":["../src/AdvancedFilterCreator.jsx"],"names":[],"mappings":";AAsBA;IACE,oCAAkC;IAElC,wBA2DC;IAmED,qBAKC;IAED,oBAKC;IAED,6CAWC;IA0ED,6BASC;IAjFD,0EASC;IAED,2CAsBC;IAED,yEAIC;IAED,oBAWC;IAED,iCAGC;IAED,+BAGC;IAED,+BAMC;IAxGD,6BAKC;IAZD,2BAKC;IAuHD,4BAGC;IA3NC,yCAA2C;IAC3C,uCAA2B;IAC3B,kBAAkB;IAClB
|
|
1
|
+
{"version":3,"file":"AdvancedFilterCreator.d.ts","sourceRoot":"","sources":["../src/AdvancedFilterCreator.jsx"],"names":[],"mappings":";AAsBA;IACE,oCAAkC;IAElC,wBA2DC;IAmED,qBAKC;IAED,oBAKC;IAED,6CAWC;IA0ED,6BASC;IAjFD,0EASC;IAED,2CAsBC;IAED,yEAIC;IAED,oBAWC;IAED,iCAGC;IAED,+BAGC;IAED,+BAMC;IAxGD,6BAKC;IAZD,2BAKC;IAuHD,4BAGC;IA3NC,yCAA2C;IAC3C,uCAA2B;IAC3B,kBAAkB;IAClB,+GAA8B;IAoDhC,8EAEC;IAED,+CAEC;IAED,iFAA8E;IAE9E,wBAyBC;IAmID;;;;MAMC;IAED;;;;OAIG;IACH,+BAeC;IAED;;;;OAIG;IACH,6CAFW,OAAO,QAKjB;IAED,yBAOC;IAED,wBAKC;IAED,mBAwBC;CAyLF"}
|
|
@@ -1,34 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
typeDropdown: HTMLSelectElement | null;
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import { FilterTypeValue } from './filters';
|
|
3
|
+
interface AdvancedFilterCreatorFilterItemProps {
|
|
4
|
+
column: {
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
filterTypes: FilterTypeValue[];
|
|
8
|
+
onChange(type: FilterTypeValue, value: string): void;
|
|
9
|
+
onDelete(): void;
|
|
10
|
+
selectedType?: FilterTypeValue;
|
|
11
|
+
value?: string;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
type: PropTypes.Requireable<string>;
|
|
18
|
-
}>>;
|
|
19
|
-
const filterTypes: PropTypes.Validator<(string | null | undefined)[]>;
|
|
20
|
-
const onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
const onDelete: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
const selectedType: PropTypes.Requireable<string>;
|
|
23
|
-
const value: PropTypes.Requireable<string>;
|
|
24
|
-
}
|
|
25
|
-
namespace defaultProps {
|
|
26
|
-
const selectedType_1: string;
|
|
27
|
-
export { selectedType_1 as selectedType };
|
|
28
|
-
const value_1: string;
|
|
29
|
-
export { value_1 as value };
|
|
30
|
-
}
|
|
13
|
+
export interface AdvancedFilterCreatorFilterItemState {
|
|
14
|
+
selectedType: FilterTypeValue;
|
|
15
|
+
value: string;
|
|
31
16
|
}
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
declare class AdvancedFilterCreatorFilterItem extends PureComponent<AdvancedFilterCreatorFilterItemProps, AdvancedFilterCreatorFilterItemState> {
|
|
18
|
+
static getLabelForTextFilter(filterType: FilterTypeValue): string;
|
|
19
|
+
static getLabelForNumberFilter(filterType: FilterTypeValue): string;
|
|
20
|
+
static getLabelForDateFilter(filterType: FilterTypeValue): string;
|
|
21
|
+
static getLabelForBooleanFilter(filterType: FilterTypeValue): string;
|
|
22
|
+
static getLabelForFilter(columnType: string, filterType: FilterTypeValue): string;
|
|
23
|
+
constructor(props: AdvancedFilterCreatorFilterItemProps);
|
|
24
|
+
componentDidMount(): void;
|
|
25
|
+
componentDidUpdate(prevProps: AdvancedFilterCreatorFilterItemProps): void;
|
|
26
|
+
typeDropdown: HTMLSelectElement | null;
|
|
27
|
+
handleTypeChange(event: React.ChangeEvent<HTMLSelectElement>): void;
|
|
28
|
+
handleValueChange(event: React.ChangeEvent<HTMLInputElement>): void;
|
|
29
|
+
handleDelete(): void;
|
|
30
|
+
render(): JSX.Element;
|
|
31
|
+
}
|
|
32
|
+
export default AdvancedFilterCreatorFilterItem;
|
|
34
33
|
//# sourceMappingURL=AdvancedFilterCreatorFilterItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdvancedFilterCreatorFilterItem.d.ts","sourceRoot":"","sources":["../src/AdvancedFilterCreatorFilterItem.
|
|
1
|
+
{"version":3,"file":"AdvancedFilterCreatorFilterItem.d.ts","sourceRoot":"","sources":["../src/AdvancedFilterCreatorFilterItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM7C,OAAO,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AAIxD,UAAU,oCAAoC;IAC5C,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,QAAQ,IAAI,IAAI,CAAC;IACjB,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oCAAoC;IACnD,YAAY,EAAE,eAAe,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,cAAM,+BAAgC,SAAQ,aAAa,CACzD,oCAAoC,EACpC,oCAAoC,CACrC;IACC,MAAM,CAAC,qBAAqB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM;IAwBjE,MAAM,CAAC,uBAAuB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM;IAoBnE,MAAM,CAAC,qBAAqB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM;IAqBjE,MAAM,CAAC,wBAAwB,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM;IAcpE,MAAM,CAAC,iBAAiB,CACtB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,eAAe,GAC1B,MAAM;gBAwBG,KAAK,EAAE,oCAAoC;IAgBvD,iBAAiB,IAAI,IAAI;IAIzB,kBAAkB,CAAC,SAAS,EAAE,oCAAoC,GAAG,IAAI;IAWzE,YAAY,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAEvC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAanE,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI;IAanE,YAAY,IAAI,IAAI;IAOpB,MAAM,IAAI,GAAG,CAAC,OAAO;CA6DtB;AAED,eAAe,+BAA+B,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
1
3
|
/* eslint react/no-did-update-set-state: "off" */
|
|
2
4
|
import React, { PureComponent } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
5
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
5
6
|
import { Tooltip } from '@deephaven/components';
|
|
6
7
|
import { vsTrash } from '@deephaven/icons';
|
|
7
8
|
import Log from '@deephaven/log';
|
|
8
9
|
import TableUtils from "./TableUtils.js";
|
|
9
|
-
import FilterType from "./filters/
|
|
10
|
+
import { FilterType } from "./filters/index.js";
|
|
10
11
|
var log = Log.module('AdvancedFilterCreatorFilterItem');
|
|
11
12
|
|
|
12
13
|
class AdvancedFilterCreatorFilterItem extends PureComponent {
|
|
@@ -135,29 +136,35 @@ class AdvancedFilterCreatorFilterItem extends PureComponent {
|
|
|
135
136
|
|
|
136
137
|
constructor(props) {
|
|
137
138
|
super(props);
|
|
139
|
+
|
|
140
|
+
_defineProperty(this, "typeDropdown", void 0);
|
|
141
|
+
|
|
138
142
|
this.handleDelete = this.handleDelete.bind(this);
|
|
139
143
|
this.handleTypeChange = this.handleTypeChange.bind(this);
|
|
140
144
|
this.handleValueChange = this.handleValueChange.bind(this);
|
|
141
145
|
this.typeDropdown = null;
|
|
142
146
|
var {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
filterTypes
|
|
147
|
+
value = '',
|
|
148
|
+
filterTypes,
|
|
149
|
+
selectedType = filterTypes[0]
|
|
146
150
|
} = props;
|
|
147
151
|
this.state = {
|
|
148
|
-
selectedType
|
|
152
|
+
selectedType,
|
|
149
153
|
value
|
|
150
154
|
};
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
componentDidMount() {
|
|
154
|
-
|
|
158
|
+
var _this$typeDropdown;
|
|
159
|
+
|
|
160
|
+
(_this$typeDropdown = this.typeDropdown) === null || _this$typeDropdown === void 0 ? void 0 : _this$typeDropdown.focus();
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
componentDidUpdate(prevProps) {
|
|
158
164
|
var {
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
value = '',
|
|
166
|
+
filterTypes,
|
|
167
|
+
selectedType = filterTypes[0]
|
|
161
168
|
} = this.props;
|
|
162
169
|
|
|
163
170
|
if (prevProps.selectedType !== selectedType || prevProps.value !== value) {
|
|
@@ -202,7 +209,7 @@ class AdvancedFilterCreatorFilterItem extends PureComponent {
|
|
|
202
209
|
selectedType
|
|
203
210
|
} = this.state;
|
|
204
211
|
|
|
205
|
-
if (selectedType != null
|
|
212
|
+
if (selectedType != null) {
|
|
206
213
|
// Don't send an update unless they've already selected a type
|
|
207
214
|
onChange(selectedType, value);
|
|
208
215
|
}
|
|
@@ -229,11 +236,11 @@ class AdvancedFilterCreatorFilterItem extends PureComponent {
|
|
|
229
236
|
var typeOptionElements = [];
|
|
230
237
|
|
|
231
238
|
for (var i = 0; i < filterTypes.length; i += 1) {
|
|
232
|
-
var
|
|
233
|
-
var label = AdvancedFilterCreatorFilterItem.getLabelForFilter(column.type,
|
|
239
|
+
var _type = filterTypes[i];
|
|
240
|
+
var label = AdvancedFilterCreatorFilterItem.getLabelForFilter(column.type, _type);
|
|
234
241
|
var element = /*#__PURE__*/React.createElement("option", {
|
|
235
|
-
key:
|
|
236
|
-
value:
|
|
242
|
+
key: _type,
|
|
243
|
+
value: _type
|
|
237
244
|
}, label);
|
|
238
245
|
typeOptionElements.push(element);
|
|
239
246
|
}
|
|
@@ -274,19 +281,5 @@ class AdvancedFilterCreatorFilterItem extends PureComponent {
|
|
|
274
281
|
|
|
275
282
|
}
|
|
276
283
|
|
|
277
|
-
AdvancedFilterCreatorFilterItem.propTypes = {
|
|
278
|
-
column: PropTypes.shape({
|
|
279
|
-
type: PropTypes.string
|
|
280
|
-
}).isRequired,
|
|
281
|
-
filterTypes: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
282
|
-
onChange: PropTypes.func.isRequired,
|
|
283
|
-
onDelete: PropTypes.func.isRequired,
|
|
284
|
-
selectedType: PropTypes.string,
|
|
285
|
-
value: PropTypes.string
|
|
286
|
-
};
|
|
287
|
-
AdvancedFilterCreatorFilterItem.defaultProps = {
|
|
288
|
-
selectedType: '',
|
|
289
|
-
value: ''
|
|
290
|
-
};
|
|
291
284
|
export default AdvancedFilterCreatorFilterItem;
|
|
292
285
|
//# sourceMappingURL=AdvancedFilterCreatorFilterItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AdvancedFilterCreatorFilterItem.jsx"],"names":["React","PureComponent","PropTypes","FontAwesomeIcon","Tooltip","vsTrash","Log","TableUtils","FilterType","log","module","AdvancedFilterCreatorFilterItem","getLabelForTextFilter","filterType","eq","eqIgnoreCase","notEq","notEqIgnoreCase","contains","notContains","startsWith","endsWith","warn","getLabelForNumberFilter","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","getLabelForDateFilter","getLabelForBooleanFilter","isTrue","isFalse","isNull","getLabelForFilter","columnType","isNumberType","isCharType","isTextType","isDateType","isBooleanType","constructor","props","handleDelete","bind","handleTypeChange","handleValueChange","typeDropdown","selectedType","value","filterTypes","state","componentDidMount","focus","componentDidUpdate","prevProps","setState","event","debug2","target","onChange","length","debug","onDelete","render","column","showValueInput","type","typeOptionElements","i","label","element","push","propTypes","shape","string","isRequired","arrayOf","func","defaultProps"],"mappings":"AAAA;AACA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,U;OACAC,U;AAEP,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAJ,CAAW,iCAAX,CAAZ;;AAEA,MAAMC,+BAAN,SAA8CV,aAA9C,CAA4D;AAC9B,SAArBW,qBAAqB,CAACC,UAAD,EAAa;AACvC,YAAQA,UAAR;AACE,WAAKL,UAAU,CAACM,EAAhB;AACE,eAAO,YAAP;;AACF,WAAKN,UAAU,CAACO,YAAhB;AACE,eAAO,0BAAP;;AACF,WAAKP,UAAU,CAACQ,KAAhB;AACE,eAAO,gBAAP;;AACF,WAAKR,UAAU,CAACS,eAAhB;AACE,eAAO,8BAAP;;AACF,WAAKT,UAAU,CAACU,QAAhB;AACE,eAAO,UAAP;;AACF,WAAKV,UAAU,CAACW,WAAhB;AACE,eAAO,kBAAP;;AACF,WAAKX,UAAU,CAACY,UAAhB;AACE,eAAO,aAAP;;AACF,WAAKZ,UAAU,CAACa,QAAhB;AACE,eAAO,WAAP;;AACF;AACEZ,QAAAA,GAAG,CAACa,IAAJ,CAAS,+BAAT,EAA0CT,UAA1C;AACA,eAAO,EAAP;AAnBJ;AAqBD;;AAE6B,SAAvBU,uBAAuB,CAACV,UAAD,EAAa;AACzC,YAAQA,UAAR;AACE,WAAKL,UAAU,CAACM,EAAhB;AACE,eAAO,aAAP;;AACF,WAAKN,UAAU,CAACQ,KAAhB;AACE,eAAO,iBAAP;;AACF,WAAKR,UAAU,CAACgB,WAAhB;AACE,eAAO,cAAP;;AACF,WAAK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Z;AAGE,MAAA,WAAW,EAAC,aAHd;AAIE,MAAA,KAAK,EAAEjB,KAJT;AAKE,MAAA,QAAQ,EAAE,KAAKH;AALjB,MADF,CADF,CAdJ,eA0BE;AAAK,MAAA,SAAS,EAAC;AAAf,oBACE;AACE,MAAA,IAAI,EAAC,QADP;AAEE,MAAA,SAAS,EAAC,gDAFZ;AAGE,MAAA,OAAO,EAAE,KAAKH;AAHhB,oBAKE,oBAAC,eAAD;AAAiB,MAAA,IAAI,EAAErC;AAAvB,MALF,eAME,oBAAC,OAAD,wBANF,CADF,CA1BF,CADF,CADF;AAyCD;;AAhOyD;;AAmO5DM,+BAA+B,CAAC6D,SAAhC,GAA4C;AAC1CR,EAAAA,MAAM,EAAE9D,SAAS,CAACuE,KAAV,CAAgB;AAAEP,IAAAA,IAAI,EAAEhE,SAAS,CAACwE;AAAlB,GAAhB,EAA4CC,UADV;AAE1C1B,EAAAA,WAAW,EAAE/C,SAAS,CAAC0E,OAAV,CAAkB1E,SAAS,CAACwE,MAA5B,EAAoCC,UAFP;AAG1ChB,EAAAA,QAAQ,EAAEzD,SAAS,CAAC2E,IAAV,CAAeF,UAHiB;AAI1Cb,EAAAA,QAAQ,EAAE5D,SAAS,CAAC2E,IAAV,CAAeF,UAJiB;AAK1C5B,EAAAA,YAAY,EAAE7C,SAAS,CAACwE,MALkB;AAM1C1B,EAAAA,KAAK,EAAE9C,SAAS,CAACwE;AANyB,CAA5C;AASA/D,+BAA+B,CAACmE,YAAhC,GAA+C;AAC7C/B,EAAAA,YAAY,EAAE,EAD+B;AAE7CC,EAAAA,KAAK,EAAE;AAFsC,CAA/C;AAKA,eAAerC,+BAAf","sourcesContent":["/* eslint react/no-did-update-set-state: \"off\" */\nimport React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { Tooltip } from '@deephaven/components';\nimport { vsTrash } from '@deephaven/icons';\nimport Log from '@deephaven/log';\nimport TableUtils from './TableUtils';\nimport FilterType from './filters/FilterType';\n\nconst log = Log.module('AdvancedFilterCreatorFilterItem');\n\nclass AdvancedFilterCreatorFilterItem extends PureComponent {\n static getLabelForTextFilter(filterType) {\n switch (filterType) {\n case FilterType.eq:\n return 'is exactly';\n case FilterType.eqIgnoreCase:\n return 'is exactly (ignore case)';\n case FilterType.notEq:\n return 'is not exactly';\n case FilterType.notEqIgnoreCase:\n return 'is not exactly (ignore case)';\n case FilterType.contains:\n return 'contains';\n case FilterType.notContains:\n return 'does not contain';\n case FilterType.startsWith:\n return 'starts with';\n case FilterType.endsWith:\n return 'ends with';\n default:\n log.warn('Unrecognized text filter type', filterType);\n return '';\n }\n }\n\n static getLabelForNumberFilter(filterType) {\n switch (filterType) {\n case FilterType.eq:\n return 'is equal to';\n case FilterType.notEq:\n return 'is not equal to';\n case FilterType.greaterThan:\n return 'greater than';\n case FilterType.greaterThanOrEqualTo:\n return 'greater than or equal to';\n case FilterType.lessThan:\n return 'less than';\n case FilterType.lessThanOrEqualTo:\n return 'less than or equal to';\n default:\n log.warn('Unrecognized number filter type', filterType);\n return '';\n }\n }\n\n static getLabelForDateFilter(filterType) {\n switch (filterType) {\n case FilterType.eq:\n return 'date is';\n case FilterType.notEq:\n return 'date is not';\n case FilterType.notEqIgnoreCase:\n case FilterType.greaterThan:\n return 'date is after';\n case FilterType.greaterThanOrEqualTo:\n return 'date is after or equal';\n case FilterType.lessThan:\n return 'date is before';\n case FilterType.lessThanOrEqualTo:\n return 'date is before or equal';\n default:\n log.warn('Unrecognized date filter type', filterType);\n return '';\n }\n }\n\n static getLabelForBooleanFilter(filterType) {\n switch (filterType) {\n case FilterType.isTrue:\n return 'Is True';\n case FilterType.isFalse:\n return 'Is False';\n case FilterType.isNull:\n return 'Is Null';\n default:\n log.warn('Unrecognized boolean filter type', filterType);\n return '';\n }\n }\n\n static getLabelForFilter(columnType, filterType) {\n if (\n TableUtils.isNumberType(columnType) ||\n TableUtils.isCharType(columnType)\n ) {\n return AdvancedFilterCreatorFilterItem.getLabelForNumberFilter(\n filterType\n );\n }\n if (TableUtils.isTextType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForTextFilter(filterType);\n }\n if (TableUtils.isDateType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForDateFilter(filterType);\n }\n if (TableUtils.isBooleanType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForBooleanFilter(\n filterType\n );\n }\n log.warn('Unrecognized column type: ', columnType);\n return '';\n }\n\n constructor(props) {\n super(props);\n\n this.handleDelete = this.handleDelete.bind(this);\n this.handleTypeChange = this.handleTypeChange.bind(this);\n this.handleValueChange = this.handleValueChange.bind(this);\n this.typeDropdown = null;\n\n const { selectedType, value, filterTypes } = props;\n\n this.state = {\n selectedType: selectedType || filterTypes[0],\n value,\n };\n }\n\n componentDidMount() {\n this.typeDropdown.focus();\n }\n\n componentDidUpdate(prevProps) {\n const { selectedType, value } = this.props;\n if (prevProps.selectedType !== selectedType || prevProps.value !== value) {\n this.setState({ selectedType, value });\n }\n }\n\n handleTypeChange(event) {\n log.debug2('typeChange');\n const selectedType = event.target.value;\n this.setState({ selectedType });\n\n const { onChange } = this.props;\n const { value } = this.state;\n if (value != null && value.length > 0) {\n // Don't send an update unless there's already a value entered\n onChange(selectedType, value);\n }\n }\n\n handleValueChange(event) {\n log.debug2('valueChange');\n const { value } = event.target;\n this.setState({ value });\n\n const { onChange } = this.props;\n const { selectedType } = this.state;\n if (selectedType != null && selectedType.length > 0) {\n // Don't send an update unless they've already selected a type\n onChange(selectedType, value);\n }\n }\n\n handleDelete() {\n log.debug('delete');\n\n const { onDelete } = this.props;\n onDelete();\n }\n\n render() {\n const { column, filterTypes } = this.props;\n const { selectedType, value } = this.state;\n const showValueInput = !TableUtils.isBooleanType(column.type);\n const typeOptionElements = [];\n for (let i = 0; i < filterTypes.length; i += 1) {\n const type = filterTypes[i];\n const label = AdvancedFilterCreatorFilterItem.getLabelForFilter(\n column.type,\n type\n );\n const element = (\n <option key={type} value={type}>\n {label}\n </option>\n );\n typeOptionElements.push(element);\n }\n\n return (\n <div className=\"advanced-filter-creator-filter-item\">\n <div className=\"form-row\">\n <div className=\"form-group col\">\n <select\n className=\"form-control custom-select\"\n value={selectedType}\n onChange={this.handleTypeChange}\n ref={typeDropdown => {\n this.typeDropdown = typeDropdown;\n }}\n >\n {typeOptionElements}\n </select>\n </div>\n {showValueInput && (\n <div className=\"form-group col\">\n <div className=\"input-group\">\n <input\n type=\"text\"\n className=\"form-control\"\n placeholder=\"Enter value\"\n value={value}\n onChange={this.handleValueChange}\n />\n </div>\n </div>\n )}\n <div className=\"form-group col-1 px-0\">\n <button\n type=\"button\"\n className=\"btn btn-link btn-link-icon w-100 h-100 p-0 m-0\"\n onClick={this.handleDelete}\n >\n <FontAwesomeIcon icon={vsTrash} />\n <Tooltip>Remove Filter</Tooltip>\n </button>\n </div>\n </div>\n </div>\n );\n }\n}\n\nAdvancedFilterCreatorFilterItem.propTypes = {\n column: PropTypes.shape({ type: PropTypes.string }).isRequired,\n filterTypes: PropTypes.arrayOf(PropTypes.string).isRequired,\n onChange: PropTypes.func.isRequired,\n onDelete: PropTypes.func.isRequired,\n selectedType: PropTypes.string,\n value: PropTypes.string,\n};\n\nAdvancedFilterCreatorFilterItem.defaultProps = {\n selectedType: '',\n value: '',\n};\n\nexport default AdvancedFilterCreatorFilterItem;\n"],"file":"AdvancedFilterCreatorFilterItem.js"}
|
|
1
|
+
{"version":3,"sources":["../src/AdvancedFilterCreatorFilterItem.tsx"],"names":["React","PureComponent","FontAwesomeIcon","Tooltip","vsTrash","Log","TableUtils","FilterType","log","module","AdvancedFilterCreatorFilterItem","getLabelForTextFilter","filterType","eq","eqIgnoreCase","notEq","notEqIgnoreCase","contains","notContains","startsWith","endsWith","warn","getLabelForNumberFilter","greaterThan","greaterThanOrEqualTo","lessThan","lessThanOrEqualTo","getLabelForDateFilter","getLabelForBooleanFilter","isTrue","isFalse","isNull","getLabelForFilter","columnType","isNumberType","isCharType","isTextType","isDateType","isBooleanType","constructor","props","handleDelete","bind","handleTypeChange","handleValueChange","typeDropdown","value","filterTypes","selectedType","state","componentDidMount","focus","componentDidUpdate","prevProps","setState","event","debug2","target","onChange","length","debug","onDelete","render","column","showValueInput","type","typeOptionElements","i","label","element","push"],"mappings":";;AAAA;AACA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,OAAT,QAAwB,uBAAxB;AACA,SAASC,OAAT,QAAwB,kBAAxB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,U;SACEC,U;AAET,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAJ,CAAW,iCAAX,CAAZ;;AAgBA,MAAMC,+BAAN,SAA8CT,aAA9C,CAGE;AAC4B,SAArBU,qBAAqB,CAACC,UAAD,EAAsC;AAChE,YAAQA,UAAR;AACE,WAAKL,UAAU,CAACM,EAAhB;AACE,eAAO,YAAP;;AACF,WAAKN,UAAU,CAACO,YAAhB;AACE,eAAO,0BAAP;;AACF,WAAKP,UAAU,CAACQ,KAAhB;AACE,eAAO,gBAAP;;AACF,WAAKR,UAAU,CAACS,eAAhB;AACE,eAAO,8BAAP;;AACF,WAAKT,UAAU,CAACU,QAAhB;AACE,eAAO,UAAP;;AACF,WAAKV,UAAU,CAACW,WAAhB;AACE,eAAO,kBAAP;;AACF,WAAKX,UAAU,CAACY,UAAhB;AACE,eAAO,aAAP;;AACF,WAAKZ,UAAU,CAACa,QAAhB;AACE,eAAO,WAAP;;AACF;AACEZ,QAAAA,GAAG,CAACa,IAAJ,CAAS,+BAAT,EAA0CT,UAA1C;AACA,eAAO,EAAP;AAnBJ;AAqBD;;AAE6B,SAAvBU,uBAAuB,CAACV,UAAD,EAAsC;AAClE,YAAQA,UAAR;AACE,WAAKL,UAAU,CAACM,EAAhB;AACE,eAAO,aAAP;;AACF,WAAKN,UAAU,CAACQ,KAAhB;AACE,eAAO,iBAAP;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f,oBACE;AAAK,MAAA,SAAS,EAAC;AAAf,oBACE;AACE,MAAA,IAAI,EAAC,MADP;AAEE,MAAA,SAAS,EAAC,cAFZ;AAGE,MAAA,WAAW,EAAC,aAHd;AAIE,MAAA,KAAK,EAAElB,KAJT;AAKE,MAAA,QAAQ,EAAE,KAAKF;AALjB,MADF,CADF,CAdJ,eA0BE;AAAK,MAAA,SAAS,EAAC;AAAf,oBACE;AACE,MAAA,IAAI,EAAC,QADP;AAEE,MAAA,SAAS,EAAC,gDAFZ;AAGE,MAAA,OAAO,EAAE,KAAKH;AAHhB,oBAKE,oBAAC,eAAD;AAAiB,MAAA,IAAI,EAAErC;AAAvB,MALF,eAME,oBAAC,OAAD,wBANF,CADF,CA1BF,CADF,CADF;AAyCD;;AAzOD;;AA4OF,eAAeM,+BAAf","sourcesContent":["/* eslint react/no-did-update-set-state: \"off\" */\nimport React, { PureComponent } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { Tooltip } from '@deephaven/components';\nimport { vsTrash } from '@deephaven/icons';\nimport Log from '@deephaven/log';\nimport TableUtils from './TableUtils';\nimport { FilterType, FilterTypeValue } from './filters';\n\nconst log = Log.module('AdvancedFilterCreatorFilterItem');\n\ninterface AdvancedFilterCreatorFilterItemProps {\n column: { type: string };\n filterTypes: FilterTypeValue[];\n onChange(type: FilterTypeValue, value: string): void;\n onDelete(): void;\n selectedType?: FilterTypeValue;\n value?: string;\n}\n\nexport interface AdvancedFilterCreatorFilterItemState {\n selectedType: FilterTypeValue;\n value: string;\n}\n\nclass AdvancedFilterCreatorFilterItem extends PureComponent<\n AdvancedFilterCreatorFilterItemProps,\n AdvancedFilterCreatorFilterItemState\n> {\n static getLabelForTextFilter(filterType: FilterTypeValue): string {\n switch (filterType) {\n case FilterType.eq:\n return 'is exactly';\n case FilterType.eqIgnoreCase:\n return 'is exactly (ignore case)';\n case FilterType.notEq:\n return 'is not exactly';\n case FilterType.notEqIgnoreCase:\n return 'is not exactly (ignore case)';\n case FilterType.contains:\n return 'contains';\n case FilterType.notContains:\n return 'does not contain';\n case FilterType.startsWith:\n return 'starts with';\n case FilterType.endsWith:\n return 'ends with';\n default:\n log.warn('Unrecognized text filter type', filterType);\n return '';\n }\n }\n\n static getLabelForNumberFilter(filterType: FilterTypeValue): string {\n switch (filterType) {\n case FilterType.eq:\n return 'is equal to';\n case FilterType.notEq:\n return 'is not equal to';\n case FilterType.greaterThan:\n return 'greater than';\n case FilterType.greaterThanOrEqualTo:\n return 'greater than or equal to';\n case FilterType.lessThan:\n return 'less than';\n case FilterType.lessThanOrEqualTo:\n return 'less than or equal to';\n default:\n log.warn('Unrecognized number filter type', filterType);\n return '';\n }\n }\n\n static getLabelForDateFilter(filterType: FilterTypeValue): string {\n switch (filterType) {\n case FilterType.eq:\n return 'date is';\n case FilterType.notEq:\n return 'date is not';\n case FilterType.notEqIgnoreCase:\n case FilterType.greaterThan:\n return 'date is after';\n case FilterType.greaterThanOrEqualTo:\n return 'date is after or equal';\n case FilterType.lessThan:\n return 'date is before';\n case FilterType.lessThanOrEqualTo:\n return 'date is before or equal';\n default:\n log.warn('Unrecognized date filter type', filterType);\n return '';\n }\n }\n\n static getLabelForBooleanFilter(filterType: FilterTypeValue): string {\n switch (filterType) {\n case FilterType.isTrue:\n return 'Is True';\n case FilterType.isFalse:\n return 'Is False';\n case FilterType.isNull:\n return 'Is Null';\n default:\n log.warn('Unrecognized boolean filter type', filterType);\n return '';\n }\n }\n\n static getLabelForFilter(\n columnType: string,\n filterType: FilterTypeValue\n ): string {\n if (\n TableUtils.isNumberType(columnType) ||\n TableUtils.isCharType(columnType)\n ) {\n return AdvancedFilterCreatorFilterItem.getLabelForNumberFilter(\n filterType\n );\n }\n if (TableUtils.isTextType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForTextFilter(filterType);\n }\n if (TableUtils.isDateType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForDateFilter(filterType);\n }\n if (TableUtils.isBooleanType(columnType)) {\n return AdvancedFilterCreatorFilterItem.getLabelForBooleanFilter(\n filterType\n );\n }\n log.warn('Unrecognized column type: ', columnType);\n return '';\n }\n\n constructor(props: AdvancedFilterCreatorFilterItemProps) {\n super(props);\n\n this.handleDelete = this.handleDelete.bind(this);\n this.handleTypeChange = this.handleTypeChange.bind(this);\n this.handleValueChange = this.handleValueChange.bind(this);\n this.typeDropdown = null;\n\n const { value = '', filterTypes, selectedType = filterTypes[0] } = props;\n\n this.state = {\n selectedType,\n value,\n };\n }\n\n componentDidMount(): void {\n this.typeDropdown?.focus();\n }\n\n componentDidUpdate(prevProps: AdvancedFilterCreatorFilterItemProps): void {\n const {\n value = '',\n filterTypes,\n selectedType = filterTypes[0],\n } = this.props;\n if (prevProps.selectedType !== selectedType || prevProps.value !== value) {\n this.setState({ selectedType, value });\n }\n }\n\n typeDropdown: HTMLSelectElement | null;\n\n handleTypeChange(event: React.ChangeEvent<HTMLSelectElement>): void {\n log.debug2('typeChange');\n const selectedType = event.target.value as FilterTypeValue;\n this.setState({ selectedType });\n\n const { onChange } = this.props;\n const { value } = this.state;\n if (value != null && value.length > 0) {\n // Don't send an update unless there's already a value entered\n onChange(selectedType, value);\n }\n }\n\n handleValueChange(event: React.ChangeEvent<HTMLInputElement>): void {\n log.debug2('valueChange');\n const { value } = event.target;\n this.setState({ value });\n\n const { onChange } = this.props;\n const { selectedType } = this.state;\n if (selectedType != null) {\n // Don't send an update unless they've already selected a type\n onChange(selectedType, value);\n }\n }\n\n handleDelete(): void {\n log.debug('delete');\n\n const { onDelete } = this.props;\n onDelete();\n }\n\n render(): JSX.Element {\n const { column, filterTypes } = this.props;\n const { selectedType, value } = this.state;\n const showValueInput = !TableUtils.isBooleanType(column.type);\n const typeOptionElements = [];\n for (let i = 0; i < filterTypes.length; i += 1) {\n const type = filterTypes[i];\n const label = AdvancedFilterCreatorFilterItem.getLabelForFilter(\n column.type,\n type\n );\n const element = (\n <option key={type} value={type}>\n {label}\n </option>\n );\n typeOptionElements.push(element);\n }\n\n return (\n <div className=\"advanced-filter-creator-filter-item\">\n <div className=\"form-row\">\n <div className=\"form-group col\">\n <select\n className=\"form-control custom-select\"\n value={selectedType}\n onChange={this.handleTypeChange}\n ref={typeDropdown => {\n this.typeDropdown = typeDropdown;\n }}\n >\n {typeOptionElements}\n </select>\n </div>\n {showValueInput && (\n <div className=\"form-group col\">\n <div className=\"input-group\">\n <input\n type=\"text\"\n className=\"form-control\"\n placeholder=\"Enter value\"\n value={value}\n onChange={this.handleValueChange}\n />\n </div>\n </div>\n )}\n <div className=\"form-group col-1 px-0\">\n <button\n type=\"button\"\n className=\"btn btn-link btn-link-icon w-100 h-100 p-0 m-0\"\n onClick={this.handleDelete}\n >\n <FontAwesomeIcon icon={vsTrash} />\n <Tooltip>Remove Filter</Tooltip>\n </button>\n </div>\n </div>\n </div>\n );\n }\n}\n\nexport default AdvancedFilterCreatorFilterItem;\n"],"file":"AdvancedFilterCreatorFilterItem.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default CrossColumnSearch;
|
|
2
2
|
declare class CrossColumnSearch extends React.PureComponent<any, any, any> {
|
|
3
|
-
static createSearchFilter(searchValue: any, selectedColumns: any, columns: any, invertSelection: any):
|
|
3
|
+
static createSearchFilter(searchValue: any, selectedColumns: any, columns: any, invertSelection: any): import("@deephaven/jsapi-shim").FilterCondition | null;
|
|
4
4
|
constructor(props: any);
|
|
5
5
|
handleSearchValueChange(event: any): void;
|
|
6
6
|
toggleColumn(name: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrossColumnSearch.d.ts","sourceRoot":"","sources":["../src/CrossColumnSearch.jsx"],"names":[],"mappings":";AAgBA;IACE,
|
|
1
|
+
{"version":3,"file":"CrossColumnSearch.d.ts","sourceRoot":"","sources":["../src/CrossColumnSearch.jsx"],"names":[],"mappings":";AAgBA;IACE,8JAyBC;IAED,wBAaC;IAMD,0CAGC;IAYD,8BAYC;IAED,kBAEC;IAED,cAEC;IAED,sBAQC;IAxDC,kCAAoC;IAOtC,cAEC;IAOD,mEAGC;IAED,+CAGC;CAuLF"}
|
package/dist/DateUtils.d.ts
CHANGED
|
@@ -1,80 +1,82 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DateWrapper } from '@deephaven/jsapi-shim';
|
|
2
|
+
interface DateParts<T> {
|
|
3
|
+
year: T;
|
|
4
|
+
month: T;
|
|
5
|
+
date: T;
|
|
6
|
+
hours: T;
|
|
7
|
+
minutes: T;
|
|
8
|
+
seconds: T;
|
|
9
|
+
nanos: T;
|
|
10
|
+
}
|
|
2
11
|
declare class DateUtils {
|
|
3
12
|
static FULL_DATE_FORMAT: string;
|
|
4
13
|
static months: string[];
|
|
5
14
|
/**
|
|
6
15
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
16
|
+
* @param timeZone The time zone to parse this time in. E.g. America/New_York
|
|
17
|
+
* @param year The year for the date
|
|
18
|
+
* @param month The month, starting at 0
|
|
19
|
+
* @param day The day, starting at 1
|
|
20
|
+
* @param hour The hours
|
|
21
|
+
* @param minute The minutes
|
|
22
|
+
* @param second The seconds
|
|
23
|
+
* @param ns The nanoseconds
|
|
15
24
|
*/
|
|
16
|
-
static makeDateWrapper(timeZone: string, year: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, ns?: number):
|
|
25
|
+
static makeDateWrapper(timeZone: string, year: number, month?: number, day?: number, hour?: number, minute?: number, second?: number, ns?: number): DateWrapper;
|
|
17
26
|
/**
|
|
18
27
|
* Takes the string the user entered and returns the next nanos value
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
28
|
+
* @param nanoString The nano string to get the next one of
|
|
29
|
+
* @returns The value of the next nanos
|
|
21
30
|
*/
|
|
22
31
|
static getNextNanos(nanoString: string): number;
|
|
23
32
|
/**
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
27
|
-
* @returns
|
|
33
|
+
* @param components The string components that were parsed from the original string
|
|
34
|
+
* @param values The values that were parsed from the components
|
|
35
|
+
* @param timeZone The time zone to parse the date in. E.g. America/New_York
|
|
36
|
+
* @returns Returns the DateWrapper for the next date, or null if a full date was passed in
|
|
28
37
|
*/
|
|
29
|
-
static getNextDate(components:
|
|
38
|
+
static getNextDate(components: DateParts<string>, values: DateParts<number>, timeZone: string): DateWrapper | null;
|
|
30
39
|
/**
|
|
31
40
|
* Get the JS month value for the provided string.
|
|
32
41
|
* Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)
|
|
33
|
-
* @param
|
|
34
|
-
* @returns number
|
|
42
|
+
* @param monthString The string to parse to a JS month value
|
|
43
|
+
* @returns number The JS month value, which starts at 0 for january, or NaN if nothing could be parsed
|
|
35
44
|
*/
|
|
36
45
|
static parseMonth(monthString: string): number;
|
|
37
46
|
/**
|
|
38
47
|
* Parse a date object out of the provided string segments.
|
|
39
48
|
* Also using `parseMonth` to get month names like Aug/August rather than
|
|
40
49
|
* simply doing `parseInt`.
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
50
|
+
* @param yearString The year part of the string
|
|
51
|
+
* @param monthString The month part of the string
|
|
52
|
+
* @param dayString The day part of the string
|
|
53
|
+
* @param hourString The hour part of the string
|
|
54
|
+
* @param minuteString The minute part of the string
|
|
55
|
+
* @param secondString The second part of the string
|
|
56
|
+
* @param nanoString The milli part of the string
|
|
48
57
|
*/
|
|
49
|
-
static parseDateValues(yearString: string, monthString: string, dayString: string, hourString: string, minuteString: string, secondString: string, nanoString: string):
|
|
50
|
-
year: number;
|
|
51
|
-
month: number;
|
|
52
|
-
date: number;
|
|
53
|
-
hours: number;
|
|
54
|
-
minutes: number;
|
|
55
|
-
seconds: number;
|
|
56
|
-
nanos: number;
|
|
57
|
-
} | null;
|
|
58
|
+
static parseDateValues(yearString: string, monthString: string, dayString: string, hourString: string, minuteString: string, secondString: string, nanoString: string): DateParts<number> | null;
|
|
58
59
|
/**
|
|
59
60
|
* Parse out a date time string into it's string components.
|
|
60
61
|
* Anything that is not captured in the string will be undefined.
|
|
61
62
|
*
|
|
62
|
-
* @param
|
|
63
|
-
* @returns
|
|
63
|
+
* @param dateTimeString The date time string to parse
|
|
64
|
+
* @returns Containing the date time components
|
|
64
65
|
*/
|
|
65
|
-
static parseDateTimeString(dateTimeString: string):
|
|
66
|
+
static parseDateTimeString(dateTimeString: string): DateParts<string>;
|
|
66
67
|
/**
|
|
67
68
|
* Parses the date range provided from a string of text.
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* @returns
|
|
69
|
+
* @param text The string to parse the date from. Can be a keyword like "today", or in the format "2018-08-04"
|
|
70
|
+
* @param timeZone The time zone to parse this range in. E.g. America/New_York
|
|
71
|
+
* @returns A tuple with the start and end value/null for that date range, or both null
|
|
71
72
|
*/
|
|
72
|
-
static parseDateRange(text: string, timeZone: string): [
|
|
73
|
+
static parseDateRange(text: string, timeZone: string): [DateWrapper, DateWrapper | null] | [null, null];
|
|
73
74
|
/**
|
|
74
75
|
* Gets the Js Date object from the provided DateWrapper.
|
|
75
76
|
* In unit test, DateWrapper is just a number provided in millis, so handles that case.
|
|
76
|
-
* @param
|
|
77
|
+
* @param dateWrapper The DateWrapper object, or time in millis
|
|
77
78
|
*/
|
|
78
|
-
static getJsDate(dateWrapper:
|
|
79
|
+
static getJsDate(dateWrapper: DateWrapper | number): Date;
|
|
79
80
|
}
|
|
81
|
+
export default DateUtils;
|
|
80
82
|
//# sourceMappingURL=DateUtils.d.ts.map
|
package/dist/DateUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateUtils.d.ts","sourceRoot":"","sources":["../src/DateUtils.
|
|
1
|
+
{"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G,IAAI;IAwB3B;;;;;;OAMG;IACH,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAiCrE;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;IAwFnD;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;CAM1D;AAED,eAAe,SAAS,CAAC"}
|
package/dist/DateUtils.js
CHANGED
|
@@ -5,14 +5,14 @@ import dh from '@deephaven/jsapi-shim';
|
|
|
5
5
|
class DateUtils {
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
8
|
+
* @param timeZone The time zone to parse this time in. E.g. America/New_York
|
|
9
|
+
* @param year The year for the date
|
|
10
|
+
* @param month The month, starting at 0
|
|
11
|
+
* @param day The day, starting at 1
|
|
12
|
+
* @param hour The hours
|
|
13
|
+
* @param minute The minutes
|
|
14
|
+
* @param second The seconds
|
|
15
|
+
* @param ns The nanoseconds
|
|
16
16
|
*/
|
|
17
17
|
static makeDateWrapper(timeZone, year) {
|
|
18
18
|
var month = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -33,8 +33,8 @@ class DateUtils {
|
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Takes the string the user entered and returns the next nanos value
|
|
36
|
-
* @param
|
|
37
|
-
* @returns
|
|
36
|
+
* @param nanoString The nano string to get the next one of
|
|
37
|
+
* @returns The value of the next nanos
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
40
|
|
|
@@ -46,10 +46,10 @@ class DateUtils {
|
|
|
46
46
|
return parseInt(nextNanoString, 10);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
49
|
+
* @param components The string components that were parsed from the original string
|
|
50
|
+
* @param values The values that were parsed from the components
|
|
51
|
+
* @param timeZone The time zone to parse the date in. E.g. America/New_York
|
|
52
|
+
* @returns Returns the DateWrapper for the next date, or null if a full date was passed in
|
|
53
53
|
*/
|
|
54
54
|
|
|
55
55
|
|
|
@@ -100,8 +100,8 @@ class DateUtils {
|
|
|
100
100
|
/**
|
|
101
101
|
* Get the JS month value for the provided string.
|
|
102
102
|
* Matches digits or a month name (eg. '1', '01', 'jan', 'january' should all work)
|
|
103
|
-
* @param
|
|
104
|
-
* @returns number
|
|
103
|
+
* @param monthString The string to parse to a JS month value
|
|
104
|
+
* @returns number The JS month value, which starts at 0 for january, or NaN if nothing could be parsed
|
|
105
105
|
*/
|
|
106
106
|
|
|
107
107
|
|
|
@@ -132,13 +132,13 @@ class DateUtils {
|
|
|
132
132
|
* Parse a date object out of the provided string segments.
|
|
133
133
|
* Also using `parseMonth` to get month names like Aug/August rather than
|
|
134
134
|
* simply doing `parseInt`.
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
137
|
-
* @param
|
|
138
|
-
* @param
|
|
139
|
-
* @param
|
|
140
|
-
* @param
|
|
141
|
-
* @param
|
|
135
|
+
* @param yearString The year part of the string
|
|
136
|
+
* @param monthString The month part of the string
|
|
137
|
+
* @param dayString The day part of the string
|
|
138
|
+
* @param hourString The hour part of the string
|
|
139
|
+
* @param minuteString The minute part of the string
|
|
140
|
+
* @param secondString The second part of the string
|
|
141
|
+
* @param nanoString The milli part of the string
|
|
142
142
|
*/
|
|
143
143
|
|
|
144
144
|
|
|
@@ -169,8 +169,8 @@ class DateUtils {
|
|
|
169
169
|
* Parse out a date time string into it's string components.
|
|
170
170
|
* Anything that is not captured in the string will be undefined.
|
|
171
171
|
*
|
|
172
|
-
* @param
|
|
173
|
-
* @returns
|
|
172
|
+
* @param dateTimeString The date time string to parse
|
|
173
|
+
* @returns Containing the date time components
|
|
174
174
|
*/
|
|
175
175
|
|
|
176
176
|
|
|
@@ -200,9 +200,9 @@ class DateUtils {
|
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Parses the date range provided from a string of text.
|
|
203
|
-
* @param
|
|
204
|
-
* @param
|
|
205
|
-
* @returns
|
|
203
|
+
* @param text The string to parse the date from. Can be a keyword like "today", or in the format "2018-08-04"
|
|
204
|
+
* @param timeZone The time zone to parse this range in. E.g. America/New_York
|
|
205
|
+
* @returns A tuple with the start and end value/null for that date range, or both null
|
|
206
206
|
*/
|
|
207
207
|
|
|
208
208
|
|
|
@@ -251,6 +251,11 @@ class DateUtils {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
var values = DateUtils.parseDateValues(components.year, components.month, components.date, components.hours, components.minutes, components.seconds, components.nanos);
|
|
254
|
+
|
|
255
|
+
if (values == null) {
|
|
256
|
+
throw new Error("Unable to extract date values from ".concat(components));
|
|
257
|
+
}
|
|
258
|
+
|
|
254
259
|
var startDate = DateUtils.makeDateWrapper(timeZone, values.year, values.month, values.date, values.hours, values.minutes, values.seconds, values.nanos);
|
|
255
260
|
var endDate = DateUtils.getNextDate(components, values, timeZone);
|
|
256
261
|
return [startDate, endDate];
|
|
@@ -258,16 +263,16 @@ class DateUtils {
|
|
|
258
263
|
/**
|
|
259
264
|
* Gets the Js Date object from the provided DateWrapper.
|
|
260
265
|
* In unit test, DateWrapper is just a number provided in millis, so handles that case.
|
|
261
|
-
* @param
|
|
266
|
+
* @param dateWrapper The DateWrapper object, or time in millis
|
|
262
267
|
*/
|
|
263
268
|
|
|
264
269
|
|
|
265
270
|
static getJsDate(dateWrapper) {
|
|
266
|
-
if (dateWrapper
|
|
267
|
-
return dateWrapper
|
|
271
|
+
if (typeof dateWrapper === 'number') {
|
|
272
|
+
return new Date(dateWrapper);
|
|
268
273
|
}
|
|
269
274
|
|
|
270
|
-
return
|
|
275
|
+
return dateWrapper.asDate();
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
}
|