@deephaven/iris-grid 0.59.0 → 0.59.1-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/EmptyIrisGridModel.d.ts +62 -0
  2. package/dist/EmptyIrisGridModel.d.ts.map +1 -0
  3. package/dist/EmptyIrisGridModel.js +168 -0
  4. package/dist/EmptyIrisGridModel.js.map +1 -0
  5. package/dist/GotoRow.d.ts.map +1 -1
  6. package/dist/GotoRow.js +1 -0
  7. package/dist/GotoRow.js.map +1 -1
  8. package/dist/IrisGrid.d.ts +18 -14
  9. package/dist/IrisGrid.d.ts.map +1 -1
  10. package/dist/IrisGrid.js +185 -157
  11. package/dist/IrisGrid.js.map +1 -1
  12. package/dist/IrisGridModel.d.ts +5 -4
  13. package/dist/IrisGridModel.d.ts.map +1 -1
  14. package/dist/IrisGridModel.js +2 -1
  15. package/dist/IrisGridModel.js.map +1 -1
  16. package/dist/IrisGridModelFactory.d.ts +2 -2
  17. package/dist/IrisGridModelFactory.d.ts.map +1 -1
  18. package/dist/IrisGridModelFactory.js +1 -1
  19. package/dist/IrisGridModelFactory.js.map +1 -1
  20. package/dist/IrisGridModelUpdater.d.ts +3 -1
  21. package/dist/IrisGridModelUpdater.d.ts.map +1 -1
  22. package/dist/IrisGridModelUpdater.js +8 -1
  23. package/dist/IrisGridModelUpdater.js.map +1 -1
  24. package/dist/IrisGridPartitionSelector.css +14 -36
  25. package/dist/IrisGridPartitionSelector.css.map +1 -1
  26. package/dist/IrisGridPartitionSelector.d.ts +39 -38
  27. package/dist/IrisGridPartitionSelector.d.ts.map +1 -1
  28. package/dist/IrisGridPartitionSelector.js +253 -227
  29. package/dist/IrisGridPartitionSelector.js.map +1 -1
  30. package/dist/IrisGridPartitionedTableModel.d.ts +25 -0
  31. package/dist/IrisGridPartitionedTableModel.d.ts.map +1 -0
  32. package/dist/IrisGridPartitionedTableModel.js +74 -0
  33. package/dist/IrisGridPartitionedTableModel.js.map +1 -0
  34. package/dist/IrisGridProxyModel.d.ts +18 -4
  35. package/dist/IrisGridProxyModel.d.ts.map +1 -1
  36. package/dist/IrisGridProxyModel.js +84 -5
  37. package/dist/IrisGridProxyModel.js.map +1 -1
  38. package/dist/IrisGridTableModel.d.ts +14 -4
  39. package/dist/IrisGridTableModel.d.ts.map +1 -1
  40. package/dist/IrisGridTableModel.js +96 -21
  41. package/dist/IrisGridTableModel.js.map +1 -1
  42. package/dist/IrisGridTableModelTemplate.d.ts +7 -7
  43. package/dist/IrisGridTableModelTemplate.d.ts.map +1 -1
  44. package/dist/IrisGridTableModelTemplate.js +1 -1
  45. package/dist/IrisGridTableModelTemplate.js.map +1 -1
  46. package/dist/IrisGridTreeTableModel.js +2 -4
  47. package/dist/IrisGridTreeTableModel.js.map +1 -1
  48. package/dist/IrisGridUtils.d.ts +7 -7
  49. package/dist/IrisGridUtils.d.ts.map +1 -1
  50. package/dist/IrisGridUtils.js +33 -34
  51. package/dist/IrisGridUtils.js.map +1 -1
  52. package/dist/MissingPartitionError.d.ts +6 -0
  53. package/dist/MissingPartitionError.d.ts.map +1 -0
  54. package/dist/MissingPartitionError.js +14 -0
  55. package/dist/MissingPartitionError.js.map +1 -0
  56. package/dist/PartitionedGridModel.d.ts +38 -0
  57. package/dist/PartitionedGridModel.d.ts.map +1 -0
  58. package/dist/PartitionedGridModel.js +15 -0
  59. package/dist/PartitionedGridModel.js.map +1 -0
  60. package/dist/index.d.ts +3 -1
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +3 -1
  63. package/dist/index.js.map +1 -1
  64. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.d.ts +2 -2
  65. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.d.ts.map +1 -1
  66. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js +2 -1
  67. package/dist/mousehandlers/IrisGridDataSelectMouseHandler.js.map +1 -1
  68. package/package.json +16 -15
  69. package/dist/PartitionSelectorSearch.css +0 -23
  70. package/dist/PartitionSelectorSearch.css.map +0 -1
  71. package/dist/PartitionSelectorSearch.d.ts +0 -78
  72. package/dist/PartitionSelectorSearch.d.ts.map +0 -1
  73. package/dist/PartitionSelectorSearch.js +0 -343
  74. package/dist/PartitionSelectorSearch.js.map +0 -1
@@ -1,49 +1,43 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
3
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
4
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
3
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
7
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
8
  import React, { Component } from 'react';
9
+ import memoizee from 'memoizee';
7
10
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
- import { DropdownMenu, Tooltip } from '@deephaven/components';
9
- import { vsTriangleDown, vsClose } from '@deephaven/icons';
11
+ import { Button } from '@deephaven/components';
12
+ import { vsChevronRight, vsMerge, vsKey } from '@deephaven/icons';
10
13
  import Log from '@deephaven/log';
11
- import debounce from 'lodash.debounce';
14
+ import { TableDropdown } from '@deephaven/jsapi-components';
12
15
  import { TableUtils } from '@deephaven/jsapi-utils';
13
- import PartitionSelectorSearch from "./PartitionSelectorSearch.js";
16
+ import { assertNotNull, Pending, PromiseUtils } from '@deephaven/utils';
14
17
  import "./IrisGridPartitionSelector.css";
15
- import IrisGridUtils from "./IrisGridUtils.js";
16
18
  import { jsx as _jsx } from "react/jsx-runtime";
17
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
- import { Fragment as _Fragment } from "react/jsx-runtime";
19
20
  var log = Log.module('IrisGridPartitionSelector');
20
- var PARTITION_CHANGE_DEBOUNCE_MS = 250;
21
21
  class IrisGridPartitionSelector extends Component {
22
22
  constructor(props) {
23
23
  super(props);
24
+ _defineProperty(this, "pending", void 0);
24
25
  _defineProperty(this, "tableUtils", void 0);
25
- _defineProperty(this, "searchMenu", void 0);
26
- _defineProperty(this, "selectorSearch", void 0);
27
- _defineProperty(this, "debounceUpdate", debounce(() => {
28
- this.sendUpdate();
29
- }, PARTITION_CHANGE_DEBOUNCE_MS));
30
- this.handleCloseClick = this.handleCloseClick.bind(this);
31
- this.handleIgnoreClick = this.handleIgnoreClick.bind(this);
32
- this.handlePartitionChange = this.handlePartitionChange.bind(this);
26
+ _defineProperty(this, "getCachedChangeCallback", memoizee(index => value => this.handlePartitionSelect(index, value)));
27
+ _defineProperty(this, "getCachedFormatValueCallback", memoizee(index => value => this.getDisplayValue(index, value)));
28
+ this.handleKeyTableClick = this.handleKeyTableClick.bind(this);
29
+ this.handleMergeClick = this.handleMergeClick.bind(this);
33
30
  this.handlePartitionSelect = this.handlePartitionSelect.bind(this);
34
- this.handlePartitionListResized = this.handlePartitionListResized.bind(this);
35
- this.handleSearchOpened = this.handleSearchOpened.bind(this);
36
- this.handleSearchClosed = this.handleSearchClosed.bind(this);
37
31
  var {
38
- dh,
39
- columns,
40
- partitions
32
+ model
41
33
  } = props;
42
- this.tableUtils = new TableUtils(dh);
43
- this.searchMenu = columns.map(() => null);
44
- this.selectorSearch = columns.map(() => null);
34
+ this.tableUtils = new TableUtils(model.dh);
35
+ this.pending = new Pending();
45
36
  this.state = {
46
- partitions,
37
+ // We start be loading the partition tables, so we should be in a loading state
38
+ isLoading: true,
39
+ keysTable: null,
40
+ partitionFilters: null,
47
41
  partitionTables: null
48
42
  };
49
43
  }
@@ -51,254 +45,286 @@ class IrisGridPartitionSelector extends Component {
51
45
  var _this = this;
52
46
  return _asyncToGenerator(function* () {
53
47
  var {
54
- columns,
55
- table
48
+ model
56
49
  } = _this.props;
57
- var {
58
- partitions
59
- } = _this.state;
60
- var partitionTables = yield Promise.all(columns.map( /*#__PURE__*/function () {
61
- var _ref = _asyncToGenerator(function* (_, i) {
62
- return table.selectDistinct(columns.slice(0, i + 1));
50
+ try {
51
+ var keysTable = yield _this.pending.add(model.partitionKeysTable().then(keyTable => {
52
+ var sorts = model.partitionColumns.map(column => column.sort().desc());
53
+ keyTable.applySort(sorts);
54
+ return keyTable;
55
+ }), t => t.close());
56
+ var partitionTables = yield Promise.all(model.partitionColumns.map( /*#__PURE__*/function () {
57
+ var _ref = _asyncToGenerator(function* (_, i) {
58
+ return _this.pending.add(keysTable.selectDistinct(model.partitionColumns.slice(0, i + 1)), t => t.close());
59
+ });
60
+ return function (_x, _x2) {
61
+ return _ref.apply(this, arguments);
62
+ };
63
+ }()));
64
+ var partitionFilters = _this.getPartitionFilters(partitionTables);
65
+ _this.setState({
66
+ isLoading: false,
67
+ keysTable,
68
+ partitionFilters,
69
+ partitionTables
63
70
  });
64
- return function (_x, _x2) {
65
- return _ref.apply(this, arguments);
66
- };
67
- }()));
68
- _this.updatePartitionFilters(partitions, partitionTables);
71
+ } catch (e) {
72
+ if (!PromiseUtils.isCanceled(e)) {
73
+ // Just re-throw the error if it's not a cancel
74
+ throw e;
75
+ }
76
+ }
69
77
  })();
70
78
  }
71
- componentWillUnmount() {
79
+ componentDidUpdate(prevProps) {
72
80
  var {
73
- partitionTables
74
- } = this.state;
75
- partitionTables === null || partitionTables === void 0 ? void 0 : partitionTables.forEach(table => table.close());
76
- this.debounceUpdate.cancel();
77
- }
78
- handleCloseClick() {
79
- log.debug2('handleCloseClick');
80
- this.sendDone();
81
- }
82
- handleIgnoreClick() {
83
- log.debug2('handleIgnoreClick');
84
- this.sendFetchAll();
85
- }
86
- handlePartitionChange(index, event) {
87
- log.debug2('handlePartitionChange');
81
+ partitionConfig: prevConfig
82
+ } = prevProps;
88
83
  var {
89
- columns
84
+ partitionConfig
90
85
  } = this.props;
91
- var {
92
- partitions,
93
- partitionTables
94
- } = this.state;
95
- var {
96
- value: partition
97
- } = event.target;
98
- var newPartitions = [...partitions];
99
- newPartitions[index] = TableUtils.isCharType(columns[index].type) && partition.length > 0 ? partition.charCodeAt(0).toString() : partition;
100
- if (partitionTables) {
101
- this.updatePartitionFilters(newPartitions, partitionTables);
86
+ if (prevConfig !== partitionConfig) {
87
+ this.updatePartitionFilters();
102
88
  }
103
- this.setState({
104
- partitions: newPartitions
105
- });
106
- this.debounceUpdate();
107
89
  }
108
- handlePartitionSelect(index, partition) {
90
+ componentWillUnmount() {
91
+ this.pending.cancel();
109
92
  var {
110
- partitions,
93
+ keysTable,
111
94
  partitionTables
112
95
  } = this.state;
113
- var selectedMenu = this.searchMenu[index];
114
- if (selectedMenu) {
115
- selectedMenu.closeMenu();
116
- }
117
- var newPartitions = [...partitions];
118
- newPartitions[index] = partition;
119
- if (partitionTables) {
120
- this.updatePartitionFilters(newPartitions, partitionTables);
121
- }
122
- this.setState({
123
- partitions: newPartitions
124
- }, () => {
125
- this.sendUpdate();
126
- });
96
+ keysTable === null || keysTable === void 0 ? void 0 : keysTable.close();
97
+ partitionTables === null || partitionTables === void 0 ? void 0 : partitionTables.forEach(table => table.close());
127
98
  }
128
- handlePartitionListResized(index) {
129
- var selectedMenu = this.searchMenu[index];
130
- if (selectedMenu) {
131
- selectedMenu.scheduleUpdate();
132
- }
99
+ handleKeyTableClick() {
100
+ log.debug2('handleKeyTableClick');
101
+ var {
102
+ partitionConfig
103
+ } = this.props;
104
+ var newPartitionConfig = _objectSpread({}, partitionConfig);
105
+ // Toggle between Keys and Partition mode
106
+ newPartitionConfig.mode = partitionConfig.mode === 'keys' ? 'partition' : 'keys';
107
+ this.sendUpdate(newPartitionConfig);
133
108
  }
134
- handleSearchClosed() {
135
- // Reset the table filter so it's ready next time user opens search
109
+ handleMergeClick() {
110
+ log.debug2('handleMergeClick');
136
111
  var {
137
- table
112
+ partitionConfig
138
113
  } = this.props;
139
- table.applyFilter([]);
114
+ var newPartitionConfig = _objectSpread({}, partitionConfig);
115
+ // Toggle between Merged and Partition mode
116
+ newPartitionConfig.mode = partitionConfig.mode === 'merged' ? 'partition' : 'merged';
117
+ this.sendUpdate(newPartitionConfig);
140
118
  }
141
- handleSearchOpened(index) {
142
- var selectedSearch = this.selectorSearch[index];
143
- if (selectedSearch) {
144
- selectedSearch.focus();
145
- }
119
+
120
+ /**
121
+ * Handles when a partition dropdown selection is changed. Will send an update with the new partition config
122
+ * @param index Index of the partition column that was changed
123
+ * @param selectedValue Selected value of the partition column
124
+ */
125
+ handlePartitionSelect(index, selectedValue) {
126
+ var _this2 = this;
127
+ return _asyncToGenerator(function* () {
128
+ var {
129
+ model,
130
+ partitionConfig: prevConfig
131
+ } = _this2.props;
132
+ log.debug('handlePartitionSelect', index, selectedValue, prevConfig);
133
+ var newPartitions = [...prevConfig.partitions];
134
+ newPartitions[index] = selectedValue;
135
+
136
+ // If it's the last partition changed, we know it's already a valid value, just emit it
137
+ if (index === model.partitionColumns.length - 1) {
138
+ _this2.sendUpdate({
139
+ partitions: newPartitions,
140
+ mode: 'partition'
141
+ });
142
+ return;
143
+ }
144
+ var {
145
+ keysTable
146
+ } = _this2.state;
147
+ // Otherwise, we need to get the value from a filtered key table
148
+ assertNotNull(keysTable);
149
+ try {
150
+ _this2.setState({
151
+ isLoading: true
152
+ });
153
+ var t = yield _this2.pending.add(keysTable.copy(), tCopy => tCopy.close());
154
+
155
+ // Apply our partition filters, and just get the first value
156
+ var partitionFilters = newPartitions.slice(0, index + 1).map((partition, i) => {
157
+ var partitionColumn = t.columns[i];
158
+ return partitionColumn.filter().eq(_this2.tableUtils.makeFilterRawValue(partitionColumn.type, partition));
159
+ });
160
+ t.applyFilter(partitionFilters);
161
+ t.setViewport(0, 0, t.columns);
162
+ var data = yield _this2.pending.add(t.getViewportData());
163
+ var newConfig = {
164
+ partitions: t.columns.map(column => data.rows[0].get(column)),
165
+ mode: 'partition'
166
+ };
167
+ t.close();
168
+ _this2.sendUpdate(newConfig);
169
+ } catch (e) {
170
+ if (!PromiseUtils.isCanceled(e)) {
171
+ log.error('Unable to get partition tables', e);
172
+ }
173
+ } finally {
174
+ _this2.setState({
175
+ isLoading: false
176
+ });
177
+ }
178
+ })();
146
179
  }
147
- sendDone() {
148
- this.debounceUpdate.flush();
180
+ sendUpdate(partitionConfig) {
181
+ log.debug2('sendUpdate', partitionConfig);
149
182
  var {
150
- onDone
183
+ onChange
151
184
  } = this.props;
152
- onDone();
185
+ onChange(partitionConfig);
153
186
  }
154
- sendUpdate() {
155
- log.debug2('sendUpdate');
187
+
188
+ /**
189
+ * Calls model.displayString with a special character case
190
+ * @param index The index of the partition column to get the display value for
191
+ * @param value The partition value to get the display value for
192
+ */
193
+ getDisplayValue(index, value) {
156
194
  var {
157
- onChange
195
+ model
158
196
  } = this.props;
197
+ if (value == null || value === '') {
198
+ return '';
199
+ }
200
+ var column = model.partitionColumns[index];
201
+ if (TableUtils.isCharType(column.type) && value.toString().length > 0) {
202
+ return String.fromCharCode(parseInt(value.toString(), 10));
203
+ }
204
+ return model.displayString(value, column.type, column.name);
205
+ }
206
+
207
+ /**
208
+ * Update the filters on the partition dropdown tables
209
+ */
210
+ updatePartitionFilters() {
159
211
  var {
160
- partitions
212
+ partitionTables
161
213
  } = this.state;
162
- onChange(partitions);
163
- }
164
- sendFetchAll() {
165
- log.debug2('sendFetchAll');
166
- this.debounceUpdate.cancel();
214
+ assertNotNull(partitionTables);
167
215
  var {
168
- onFetchAll
216
+ partitionConfig
169
217
  } = this.props;
170
- onFetchAll();
218
+ var {
219
+ mode
220
+ } = partitionConfig;
221
+ log.debug('updatePartitionFilters', partitionConfig);
222
+ if (mode !== 'partition') {
223
+ // We only need to update the filters if the mode is `partitions`
224
+ // In the other modes, we disable the dropdowns anyway
225
+ return;
226
+ }
227
+ var partitionFilters = this.getPartitionFilters(partitionTables);
228
+ this.setState({
229
+ partitionFilters
230
+ });
171
231
  }
172
- getDisplayValue(column, index) {
232
+ getPartitionFilters(partitionTables) {
233
+ var {
234
+ model,
235
+ partitionConfig
236
+ } = this.props;
173
237
  var {
174
238
  partitions
175
- } = this.state;
176
- var partition = partitions[index];
177
- if (partition == null) {
178
- return '';
239
+ } = partitionConfig;
240
+ log.debug('getPartitionFilters', partitionConfig);
241
+ if (partitions.length !== partitionTables.length) {
242
+ throw new Error("Invalid partition config set. Expected ".concat(partitionTables.length, " partitions, but got ").concat(partitions.length));
179
243
  }
180
- if (TableUtils.isCharType(column.type) && partition.toString().length > 0) {
181
- return String.fromCharCode(parseInt(partition, 10));
182
- }
183
- return IrisGridUtils.convertValueToText(partition, column.type);
184
- }
185
- updatePartitionFilters(partitions, partitionTables) {
186
- var _this2 = this;
187
- return _asyncToGenerator(function* () {
188
- var _partitionTables;
189
- var {
190
- columns,
191
- getFormattedString
192
- } = _this2.props;
193
- var partitionFilters = [];
194
- for (var i = 0; i < columns.length - 1; i += 1) {
195
- var _partitionTables$i;
196
- var partition = partitions[i];
197
- var partitionColumn = columns[i];
198
- (_partitionTables$i = partitionTables[i]) === null || _partitionTables$i === void 0 ? void 0 : _partitionTables$i.applyFilter(partitionFilters);
199
- if (partition !== null && !(TableUtils.isCharType(partitionColumn.type) && partition === '')) {
200
- var partitionText = TableUtils.isCharType(partitionColumn.type) ? getFormattedString(partition, partitionColumn.type, partitionColumn.name) : partition;
201
- var partitionFilter = _this2.tableUtils.makeQuickFilterFromComponent(partitionColumn, partitionText);
202
- if (partitionFilter !== null) {
203
- partitionFilters.push(partitionFilter);
204
- }
205
- }
244
+
245
+ // The filters are applied in order, so we need to build up the filters for each partition
246
+ var partitionFilters = [];
247
+ for (var i = 0; i < partitions.length; i += 1) {
248
+ if (i === 0) {
249
+ // There's no reason to ever filter the first table
250
+ partitionFilters.push([]);
251
+ } else {
252
+ var previousFilter = partitionFilters[i - 1];
253
+ var previousPartition = partitions[i - 1];
254
+ var previousColumn = model.partitionColumns[i - 1];
255
+ var partitionFilter = [...previousFilter, previousColumn.filter().eq(this.tableUtils.makeFilterRawValue(previousColumn.type, previousPartition))];
256
+ partitionFilters.push(partitionFilter);
206
257
  }
207
- (_partitionTables = partitionTables[partitionTables.length - 1]) === null || _partitionTables === void 0 ? void 0 : _partitionTables.applyFilter(partitionFilters);
208
- _this2.setState({
209
- partitionTables
210
- });
211
- })();
258
+ }
259
+ return partitionFilters;
212
260
  }
213
261
  render() {
214
262
  var {
215
- columns,
216
- dh,
217
- getFormattedString,
218
- onDone
263
+ model,
264
+ partitionConfig
219
265
  } = this.props;
220
266
  var {
267
+ isLoading,
268
+ partitionFilters,
221
269
  partitionTables
222
270
  } = this.state;
223
- var partitionSelectorSearch = columns.map((column, index) => partitionTables && /*#__PURE__*/_jsx(PartitionSelectorSearch, {
224
- dh: dh,
225
- column: column,
226
- getFormattedString: getFormattedString,
227
- table: partitionTables[index],
228
- onSelect: partition => this.handlePartitionSelect(index, partition),
229
- onListResized: () => this.handlePartitionListResized(index),
230
- ref: selectorSearch => {
231
- this.selectorSearch[index] = selectorSearch;
232
- }
233
- }, "search-".concat(column.name)));
234
- var partitionSelectors = columns.map((column, index) => {
235
- var _partitionSelectorSea;
236
- return /*#__PURE__*/_jsxs(_Fragment, {
271
+ var {
272
+ mode,
273
+ partitions
274
+ } = partitionConfig;
275
+ var partitionSelectors = model.partitionColumns.map((column, index) => {
276
+ var _partitionTables$inde;
277
+ return /*#__PURE__*/_jsxs("div", {
278
+ className: "column-selector",
237
279
  children: [/*#__PURE__*/_jsx("div", {
238
- className: "status-message",
239
- children: /*#__PURE__*/_jsxs("span", {
240
- children: [column.name, ": "]
241
- })
242
- }), /*#__PURE__*/_jsxs("div", {
243
- className: "input-group",
244
- children: [/*#__PURE__*/_jsx("input", {
245
- type: "text",
246
- value: this.getDisplayValue(column, index),
247
- onChange: e => {
248
- this.handlePartitionChange(index, e);
249
- },
250
- className: "form-control input-partition"
251
- }), /*#__PURE__*/_jsx("div", {
252
- className: "input-group-append",
253
- children: /*#__PURE__*/_jsxs("button", {
254
- type: "button",
255
- className: "btn btn-outline-primary",
256
- children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
257
- icon: vsTriangleDown
258
- }), /*#__PURE__*/_jsx(Tooltip, {
259
- children: "Partitions"
260
- }), /*#__PURE__*/_jsx(DropdownMenu, {
261
- ref: searchMenu => {
262
- this.searchMenu[index] = searchMenu;
263
- },
264
- actions: [{
265
- menuElement: (_partitionSelectorSea = partitionSelectorSearch[index]) !== null && _partitionSelectorSea !== void 0 ? _partitionSelectorSea : undefined
266
- }],
267
- onMenuOpened: () => {
268
- this.handleSearchOpened(index);
269
- },
270
- onMenuClosed: this.handleSearchClosed
271
- })]
272
- })
273
- })]
274
- }), /*#__PURE__*/_jsx("div", {
275
- className: "iris-grid-partition-selector-spacer"
280
+ className: "column-name",
281
+ children: column.name
282
+ }), /*#__PURE__*/_jsx(TableDropdown, {
283
+ className: "custom-select-sm",
284
+ table: partitionTables === null || partitionTables === void 0 ? void 0 : partitionTables[index],
285
+ column: partitionTables === null || partitionTables === void 0 ? void 0 : (_partitionTables$inde = partitionTables[index]) === null || _partitionTables$inde === void 0 ? void 0 : _partitionTables$inde.columns[index],
286
+ filter: partitionFilters === null || partitionFilters === void 0 ? void 0 : partitionFilters[index],
287
+ onChange: this.getCachedChangeCallback(index),
288
+ selectedValue: mode === 'partition' ? partitions[index] : undefined,
289
+ disabled: index > 0 && partitionConfig.mode !== 'partition' || isLoading,
290
+ formatValue: this.getCachedFormatValueCallback(index)
291
+ }), model.partitionColumns.length - 1 === index || /*#__PURE__*/_jsx(FontAwesomeIcon, {
292
+ icon: vsChevronRight
276
293
  })]
277
- });
294
+ }, "selector-".concat(column.name));
278
295
  });
279
296
  return /*#__PURE__*/_jsxs("div", {
280
297
  className: "iris-grid-partition-selector",
281
- children: [partitionSelectors, /*#__PURE__*/_jsx("button", {
282
- type: "button",
283
- className: "btn btn-outline-primary btn-ignore",
284
- onClick: this.handleIgnoreClick,
285
- children: "Ignore & Fetch All"
286
- }), /*#__PURE__*/_jsx("button", {
287
- type: "button",
288
- className: "btn btn-link btn-link-icon btn-close",
289
- onClick: onDone,
290
- children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
291
- icon: vsClose
292
- })
293
- })]
298
+ children: [/*#__PURE__*/_jsx("div", {
299
+ className: "table-name",
300
+ children: "Partitioned Table"
301
+ }), /*#__PURE__*/_jsxs("div", {
302
+ className: "partition-button-group",
303
+ children: [/*#__PURE__*/_jsx(Button, {
304
+ className: "btn-sm",
305
+ onClick: this.handleKeyTableClick,
306
+ kind: "inline",
307
+ tooltip: "View keys as table",
308
+ icon: vsKey,
309
+ active: partitionConfig.mode === 'keys',
310
+ disabled: isLoading,
311
+ children: "Keys"
312
+ }), /*#__PURE__*/_jsx(Button, {
313
+ className: "btn-sm",
314
+ onClick: this.handleMergeClick,
315
+ kind: "inline",
316
+ tooltip: "View all partitions as one merged table",
317
+ icon: /*#__PURE__*/_jsx(FontAwesomeIcon, {
318
+ icon: vsMerge,
319
+ rotation: 90
320
+ }),
321
+ active: partitionConfig.mode === 'merged',
322
+ disabled: isLoading,
323
+ children: "Merge"
324
+ })]
325
+ }), partitionSelectors]
294
326
  });
295
327
  }
296
328
  }
297
- _defineProperty(IrisGridPartitionSelector, "defaultProps", {
298
- onChange: () => undefined,
299
- onFetchAll: () => undefined,
300
- onDone: () => undefined,
301
- partitions: []
302
- });
303
329
  export default IrisGridPartitionSelector;
304
330
  //# sourceMappingURL=IrisGridPartitionSelector.js.map