handsontable 0.0.0-next-817afa4-20240202 → 0.0.0-next-5787854-20240205
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dataMap/metaManager/index.js +1 -1
- package/dataMap/metaManager/index.mjs +1 -1
- package/dataMap/metaManager/metaSchema.js +0 -17
- package/dataMap/metaManager/metaSchema.mjs +0 -17
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +17 -123
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +6 -6
- package/dist/handsontable.js +17 -123
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +6 -6
- package/helpers/dom/element.js +0 -16
- package/helpers/dom/element.mjs +0 -15
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/filters/component/value.js +6 -16
- package/plugins/filters/component/value.mjs +7 -17
- package/plugins/filters/ui/multipleSelect.js +0 -38
- package/plugins/filters/ui/multipleSelect.mjs +1 -39
- package/plugins/filters/utils.js +5 -29
- package/plugins/filters/utils.mjs +5 -28
- package/renderers/numericRenderer/numericRenderer.js +0 -1
- package/renderers/numericRenderer/numericRenderer.mjs +0 -1
package/helpers/dom/element.js
CHANGED
@@ -50,7 +50,6 @@ exports.removeClass = removeClass;
|
|
50
50
|
exports.removeContentEditableFromElementAndDeselect = removeContentEditableFromElementAndDeselect;
|
51
51
|
exports.removeEvent = removeEvent;
|
52
52
|
exports.removeTextNodes = removeTextNodes;
|
53
|
-
exports.renderMockCell = renderMockCell;
|
54
53
|
exports.resetCssTransform = resetCssTransform;
|
55
54
|
exports.runWithSelectedContendEditableElement = runWithSelectedContendEditableElement;
|
56
55
|
exports.selectElementIfAllowed = selectElementIfAllowed;
|
@@ -1136,19 +1135,4 @@ function runWithSelectedContendEditableElement(element, callback) {
|
|
1136
1135
|
makeElementContentEditableAndSelectItsContent(element, invisibleSelection);
|
1137
1136
|
callback();
|
1138
1137
|
removeContentEditableFromElementAndDeselect(element, invisibleSelection);
|
1139
|
-
}
|
1140
|
-
|
1141
|
-
/**
|
1142
|
-
* Return a `td` element rendered outside of the table with the provided renderer function.
|
1143
|
-
*
|
1144
|
-
* @param {Document} rootDocument Root document element.
|
1145
|
-
* @param {Function} renderFunction The renderer function.
|
1146
|
-
* @param {Array} renderArgs The renderer arguments.
|
1147
|
-
* @returns {HTMLElement} The rendered `td` element.
|
1148
|
-
*/
|
1149
|
-
function renderMockCell(rootDocument, renderFunction, renderArgs) {
|
1150
|
-
const cell = rootDocument.createElement('td');
|
1151
|
-
renderArgs.splice(1, 0, cell);
|
1152
|
-
renderFunction.call(renderArgs.instance, ...renderArgs);
|
1153
|
-
return cell;
|
1154
1138
|
}
|
package/helpers/dom/element.mjs
CHANGED
@@ -1077,19 +1077,4 @@ export function runWithSelectedContendEditableElement(element, callback) {
|
|
1077
1077
|
makeElementContentEditableAndSelectItsContent(element, invisibleSelection);
|
1078
1078
|
callback();
|
1079
1079
|
removeContentEditableFromElementAndDeselect(element, invisibleSelection);
|
1080
|
-
}
|
1081
|
-
|
1082
|
-
/**
|
1083
|
-
* Return a `td` element rendered outside of the table with the provided renderer function.
|
1084
|
-
*
|
1085
|
-
* @param {Document} rootDocument Root document element.
|
1086
|
-
* @param {Function} renderFunction The renderer function.
|
1087
|
-
* @param {Array} renderArgs The renderer arguments.
|
1088
|
-
* @returns {HTMLElement} The rendered `td` element.
|
1089
|
-
*/
|
1090
|
-
export function renderMockCell(rootDocument, renderFunction, renderArgs) {
|
1091
|
-
const cell = rootDocument.createElement('td');
|
1092
|
-
renderArgs.splice(1, 0, cell);
|
1093
|
-
renderFunction.call(renderArgs.instance, ...renderArgs);
|
1094
|
-
return cell;
|
1095
1080
|
}
|
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-5787854-20240205";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-5787854-20240205";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-5787854-20240205",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -108,23 +108,17 @@ class ValueComponent extends _base.BaseComponent {
|
|
108
108
|
* `editedConditionStack`, `dependentConditionStacks`, `visibleDataFactory` and `conditionArgsChange`.
|
109
109
|
*/
|
110
110
|
updateState(stateInfo) {
|
111
|
-
const multipleSelectComponent = this.getMultipleSelectElement();
|
112
111
|
const updateColumnState = (physicalColumn, conditions, conditionArgsChange, filteredRowsFactory, conditionsStack) => {
|
113
112
|
const [firstByValueCondition] = (0, _array.arrayFilter)(conditions, condition => condition.name === _constants2.CONDITION_BY_VALUE);
|
114
113
|
const state = {};
|
115
114
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
116
115
|
if (firstByValueCondition) {
|
117
|
-
const
|
118
|
-
const rowValues = (0, _array.arrayMap)(filteredRows, row => row.value);
|
119
|
-
const rowIndexes = (0, _array.arrayMap)(filteredRows, row => row.meta.visualRow);
|
120
|
-
const unifiedRowValues = (0, _utils.unifyColumnValues)(rowValues);
|
121
|
-
const displayValues = (multipleSelectComponent.getDisplayValuesAtCol(this.hot.toVisualColumn(physicalColumn)) || []).filter((value, index) => rowIndexes.includes(index));
|
122
|
-
const displayValuesSyncedWithUnifiedValues = (0, _utils.syncDisplayValuesToUnifiedValues)(displayValues, rowValues, unifiedRowValues);
|
116
|
+
const rowValues = (0, _utils.unifyColumnValues)((0, _array.arrayMap)(filteredRowsFactory(physicalColumn, conditionsStack), row => row.value));
|
123
117
|
if (conditionArgsChange) {
|
124
118
|
firstByValueCondition.args[0] = conditionArgsChange;
|
125
119
|
}
|
126
120
|
const selectedValues = [];
|
127
|
-
const itemsSnapshot = (0, _utils.intersectValues)(
|
121
|
+
const itemsSnapshot = (0, _utils.intersectValues)(rowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
|
128
122
|
if (item.checked) {
|
129
123
|
selectedValues.push(item.value);
|
130
124
|
}
|
@@ -187,17 +181,13 @@ class ValueComponent extends _base.BaseComponent {
|
|
187
181
|
* Reset elements to their initial state.
|
188
182
|
*/
|
189
183
|
reset() {
|
190
|
-
const multiSelectComponent = this.getMultipleSelectElement();
|
191
|
-
const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();
|
192
184
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
193
|
-
const values = this._getColumnVisibleValues();
|
194
|
-
const
|
195
|
-
const displayValues = multiSelectComponent.getDisplayValuesAtCol(selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.visualIndex) || [];
|
196
|
-
const displayValuesSyncedWithUnifiedValues = (0, _utils.syncDisplayValuesToUnifiedValues)(displayValues, values, unifiedValues);
|
197
|
-
const items = (0, _utils.intersectValues)(unifiedValues, unifiedValues, defaultBlankCellValue, displayValuesSyncedWithUnifiedValues || []);
|
185
|
+
const values = (0, _utils.unifyColumnValues)(this._getColumnVisibleValues());
|
186
|
+
const items = (0, _utils.intersectValues)(values, values, defaultBlankCellValue);
|
198
187
|
this.getMultipleSelectElement().setItems(items);
|
199
188
|
super.reset();
|
200
|
-
this.getMultipleSelectElement().setValue(
|
189
|
+
this.getMultipleSelectElement().setValue(values);
|
190
|
+
const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();
|
201
191
|
if (selectedColumn !== null) {
|
202
192
|
this.getMultipleSelectElement().setLocale(this.hot.getCellMeta(0, selectedColumn.visualIndex).locale);
|
203
193
|
}
|
@@ -11,7 +11,7 @@ import { stopImmediatePropagation } from "../../../helpers/dom/event.mjs";
|
|
11
11
|
import { arrayEach, arrayFilter, arrayMap } from "../../../helpers/array.mjs";
|
12
12
|
import { isKey } from "../../../helpers/unicode.mjs";
|
13
13
|
import * as C from "../../../i18n/constants.mjs";
|
14
|
-
import { unifyColumnValues, intersectValues, toEmptyString
|
14
|
+
import { unifyColumnValues, intersectValues, toEmptyString } from "../utils.mjs";
|
15
15
|
import { BaseComponent } from "./_base.mjs";
|
16
16
|
import { MultipleSelectUI } from "../ui/multipleSelect.mjs";
|
17
17
|
import { CONDITION_BY_VALUE, CONDITION_NONE } from "../constants.mjs";
|
@@ -103,23 +103,17 @@ export class ValueComponent extends BaseComponent {
|
|
103
103
|
* `editedConditionStack`, `dependentConditionStacks`, `visibleDataFactory` and `conditionArgsChange`.
|
104
104
|
*/
|
105
105
|
updateState(stateInfo) {
|
106
|
-
const multipleSelectComponent = this.getMultipleSelectElement();
|
107
106
|
const updateColumnState = (physicalColumn, conditions, conditionArgsChange, filteredRowsFactory, conditionsStack) => {
|
108
107
|
const [firstByValueCondition] = arrayFilter(conditions, condition => condition.name === CONDITION_BY_VALUE);
|
109
108
|
const state = {};
|
110
109
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
111
110
|
if (firstByValueCondition) {
|
112
|
-
const
|
113
|
-
const rowValues = arrayMap(filteredRows, row => row.value);
|
114
|
-
const rowIndexes = arrayMap(filteredRows, row => row.meta.visualRow);
|
115
|
-
const unifiedRowValues = unifyColumnValues(rowValues);
|
116
|
-
const displayValues = (multipleSelectComponent.getDisplayValuesAtCol(this.hot.toVisualColumn(physicalColumn)) || []).filter((value, index) => rowIndexes.includes(index));
|
117
|
-
const displayValuesSyncedWithUnifiedValues = syncDisplayValuesToUnifiedValues(displayValues, rowValues, unifiedRowValues);
|
111
|
+
const rowValues = unifyColumnValues(arrayMap(filteredRowsFactory(physicalColumn, conditionsStack), row => row.value));
|
118
112
|
if (conditionArgsChange) {
|
119
113
|
firstByValueCondition.args[0] = conditionArgsChange;
|
120
114
|
}
|
121
115
|
const selectedValues = [];
|
122
|
-
const itemsSnapshot = intersectValues(
|
116
|
+
const itemsSnapshot = intersectValues(rowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
|
123
117
|
if (item.checked) {
|
124
118
|
selectedValues.push(item.value);
|
125
119
|
}
|
@@ -182,17 +176,13 @@ export class ValueComponent extends BaseComponent {
|
|
182
176
|
* Reset elements to their initial state.
|
183
177
|
*/
|
184
178
|
reset() {
|
185
|
-
const multiSelectComponent = this.getMultipleSelectElement();
|
186
|
-
const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();
|
187
179
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
188
|
-
const values = this._getColumnVisibleValues();
|
189
|
-
const
|
190
|
-
const displayValues = multiSelectComponent.getDisplayValuesAtCol(selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.visualIndex) || [];
|
191
|
-
const displayValuesSyncedWithUnifiedValues = syncDisplayValuesToUnifiedValues(displayValues, values, unifiedValues);
|
192
|
-
const items = intersectValues(unifiedValues, unifiedValues, defaultBlankCellValue, displayValuesSyncedWithUnifiedValues || []);
|
180
|
+
const values = unifyColumnValues(this._getColumnVisibleValues());
|
181
|
+
const items = intersectValues(values, values, defaultBlankCellValue);
|
193
182
|
this.getMultipleSelectElement().setItems(items);
|
194
183
|
super.reset();
|
195
|
-
this.getMultipleSelectElement().setValue(
|
184
|
+
this.getMultipleSelectElement().setValue(values);
|
185
|
+
const selectedColumn = this.hot.getPlugin('filters').getSelectedColumn();
|
196
186
|
if (selectedColumn !== null) {
|
197
187
|
this.getMultipleSelectElement().setLocale(this.hot.getCellMeta(0, selectedColumn.visualIndex).locale);
|
198
188
|
}
|
@@ -380,44 +380,6 @@ class MultipleSelectUI extends _base.BaseUI {
|
|
380
380
|
_classPrivateFieldSet(this, _items, null);
|
381
381
|
super.destroy();
|
382
382
|
}
|
383
|
-
|
384
|
-
/**
|
385
|
-
* Returns the display values for all the cells at the given `column` visual index.
|
386
|
-
* If no display values are defined, the `source data` values will be returned instead.
|
387
|
-
*
|
388
|
-
* If the provided column index is not a valid integer, the method will return `null`.
|
389
|
-
*
|
390
|
-
* @param {number} column From visual column index.
|
391
|
-
* @returns {Array[]|null} Array containing the display values of all the cells in the column.
|
392
|
-
*/
|
393
|
-
getDisplayValuesAtCol(column) {
|
394
|
-
if (!Number.isInteger(column)) {
|
395
|
-
return null;
|
396
|
-
}
|
397
|
-
const sourceRowCount = this.hot.countSourceRows();
|
398
|
-
const columnData = [];
|
399
|
-
let returnValue;
|
400
|
-
for (let row = 0; row < sourceRowCount; row += 1) {
|
401
|
-
const cellMeta = this.hot.getCellMeta(row, column);
|
402
|
-
const {
|
403
|
-
prop,
|
404
|
-
displayValue
|
405
|
-
} = cellMeta;
|
406
|
-
const cellSourceData = this.hot.getSourceDataAtCell(row, column);
|
407
|
-
if (displayValue) {
|
408
|
-
returnValue = displayValue;
|
409
|
-
} else {
|
410
|
-
var _cellMeta$displayValu;
|
411
|
-
// Render the cell in a mock element to try to get the display value (possibly applied in the renderer).
|
412
|
-
(0, _element.renderMockCell)(this.hot.rootDocument, this.hot.getCellRenderer(row, column), [this.hot, row, column, prop, cellSourceData, cellMeta]);
|
413
|
-
|
414
|
-
// Retry getting the display value.
|
415
|
-
returnValue = (_cellMeta$displayValu = cellMeta.displayValue) !== null && _cellMeta$displayValu !== void 0 ? _cellMeta$displayValu : cellSourceData;
|
416
|
-
}
|
417
|
-
columnData.push(returnValue);
|
418
|
-
}
|
419
|
-
return columnData;
|
420
|
-
}
|
421
383
|
}
|
422
384
|
exports.MultipleSelectUI = MultipleSelectUI;
|
423
385
|
function _onInput2(event) {
|
@@ -9,7 +9,7 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
|
|
9
9
|
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
10
10
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
11
11
|
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
12
|
-
import { addClass, getScrollbarWidth
|
12
|
+
import { addClass, getScrollbarWidth } from "../../../helpers/dom/element.mjs";
|
13
13
|
import { clone, extend } from "../../../helpers/object.mjs";
|
14
14
|
import { arrayFilter, arrayMap, arrayEach } from "../../../helpers/array.mjs";
|
15
15
|
import { isKey } from "../../../helpers/unicode.mjs";
|
@@ -375,44 +375,6 @@ export class MultipleSelectUI extends BaseUI {
|
|
375
375
|
_classPrivateFieldSet(this, _items, null);
|
376
376
|
super.destroy();
|
377
377
|
}
|
378
|
-
|
379
|
-
/**
|
380
|
-
* Returns the display values for all the cells at the given `column` visual index.
|
381
|
-
* If no display values are defined, the `source data` values will be returned instead.
|
382
|
-
*
|
383
|
-
* If the provided column index is not a valid integer, the method will return `null`.
|
384
|
-
*
|
385
|
-
* @param {number} column From visual column index.
|
386
|
-
* @returns {Array[]|null} Array containing the display values of all the cells in the column.
|
387
|
-
*/
|
388
|
-
getDisplayValuesAtCol(column) {
|
389
|
-
if (!Number.isInteger(column)) {
|
390
|
-
return null;
|
391
|
-
}
|
392
|
-
const sourceRowCount = this.hot.countSourceRows();
|
393
|
-
const columnData = [];
|
394
|
-
let returnValue;
|
395
|
-
for (let row = 0; row < sourceRowCount; row += 1) {
|
396
|
-
const cellMeta = this.hot.getCellMeta(row, column);
|
397
|
-
const {
|
398
|
-
prop,
|
399
|
-
displayValue
|
400
|
-
} = cellMeta;
|
401
|
-
const cellSourceData = this.hot.getSourceDataAtCell(row, column);
|
402
|
-
if (displayValue) {
|
403
|
-
returnValue = displayValue;
|
404
|
-
} else {
|
405
|
-
var _cellMeta$displayValu;
|
406
|
-
// Render the cell in a mock element to try to get the display value (possibly applied in the renderer).
|
407
|
-
renderMockCell(this.hot.rootDocument, this.hot.getCellRenderer(row, column), [this.hot, row, column, prop, cellSourceData, cellMeta]);
|
408
|
-
|
409
|
-
// Retry getting the display value.
|
410
|
-
returnValue = (_cellMeta$displayValu = cellMeta.displayValue) !== null && _cellMeta$displayValu !== void 0 ? _cellMeta$displayValu : cellSourceData;
|
411
|
-
}
|
412
|
-
columnData.push(returnValue);
|
413
|
-
}
|
414
|
-
return columnData;
|
415
|
-
}
|
416
378
|
}
|
417
379
|
function _onInput2(event) {
|
418
380
|
const value = event.target.value.toLocaleLowerCase(this.getLocale());
|
package/plugins/filters/utils.js
CHANGED
@@ -4,7 +4,6 @@ exports.__esModule = true;
|
|
4
4
|
exports.createArrayAssertion = createArrayAssertion;
|
5
5
|
exports.intersectValues = intersectValues;
|
6
6
|
exports.sortComparison = sortComparison;
|
7
|
-
exports.syncDisplayValuesToUnifiedValues = syncDisplayValuesToUnifiedValues;
|
8
7
|
exports.toEmptyString = toEmptyString;
|
9
8
|
exports.toVisualValue = toVisualValue;
|
10
9
|
exports.unifyColumnValues = unifyColumnValues;
|
@@ -32,15 +31,12 @@ function sortComparison(a, b) {
|
|
32
31
|
*
|
33
32
|
* @param {*} value The value to convert.
|
34
33
|
* @param {string} defaultEmptyValue Default value for empty cells.
|
35
|
-
* @param {string} [displayValue] The display value.
|
36
34
|
* @returns {*}
|
37
35
|
*/
|
38
|
-
function toVisualValue(value, defaultEmptyValue
|
36
|
+
function toVisualValue(value, defaultEmptyValue) {
|
39
37
|
let visualValue = value;
|
40
38
|
if (visualValue === '') {
|
41
39
|
visualValue = `(${defaultEmptyValue})`;
|
42
|
-
} else if (displayValue) {
|
43
|
-
visualValue = displayValue;
|
44
40
|
}
|
45
41
|
return visualValue;
|
46
42
|
}
|
@@ -81,7 +77,7 @@ function toEmptyString(value) {
|
|
81
77
|
}
|
82
78
|
|
83
79
|
/**
|
84
|
-
* Unify column values (
|
80
|
+
* Unify column values (replace `null` and `undefined` values into empty string, unique values and sort them).
|
85
81
|
*
|
86
82
|
* @param {Array} values An array of values.
|
87
83
|
* @returns {Array}
|
@@ -105,43 +101,23 @@ function unifyColumnValues(values) {
|
|
105
101
|
return unifiedValues;
|
106
102
|
}
|
107
103
|
|
108
|
-
/**
|
109
|
-
* Synchronize display values with the provided unified values.
|
110
|
-
*
|
111
|
-
* @param {Array} displayValues An array of display values.
|
112
|
-
* @param {Array} values An array of source values.
|
113
|
-
* @param {Array} unifiedValues An array of unified values.
|
114
|
-
*
|
115
|
-
* @returns {Array} An array of synchronized display values.
|
116
|
-
*/
|
117
|
-
function syncDisplayValuesToUnifiedValues(displayValues, values, unifiedValues) {
|
118
|
-
const syncedDisplayValues = [];
|
119
|
-
(0, _array.arrayEach)(unifiedValues, unifiedValue => {
|
120
|
-
const index = values.indexOf(unifiedValue);
|
121
|
-
const displayValue = displayValues[index];
|
122
|
-
syncedDisplayValues.push(displayValue);
|
123
|
-
});
|
124
|
-
return syncedDisplayValues;
|
125
|
-
}
|
126
|
-
|
127
104
|
/**
|
128
105
|
* Intersect 'base' values with 'selected' values and return an array of object.
|
129
106
|
*
|
130
107
|
* @param {Array} base An array of base values.
|
131
108
|
* @param {Array} selected An array of selected values.
|
132
109
|
* @param {string} defaultEmptyValue Default value for empty cells.
|
133
|
-
* @param {string[]} [displayValues] An array of display values.
|
134
110
|
* @param {Function} [callback] A callback function which is invoked for every item in an array.
|
135
111
|
* @returns {Array}
|
136
112
|
*/
|
137
|
-
function intersectValues(base, selected, defaultEmptyValue,
|
113
|
+
function intersectValues(base, selected, defaultEmptyValue, callback) {
|
138
114
|
const result = [];
|
139
115
|
const same = base === selected;
|
140
116
|
let selectedItemsAssertion;
|
141
117
|
if (!same) {
|
142
118
|
selectedItemsAssertion = createArrayAssertion(selected);
|
143
119
|
}
|
144
|
-
(0, _array.arrayEach)(base,
|
120
|
+
(0, _array.arrayEach)(base, value => {
|
145
121
|
let checked = false;
|
146
122
|
if (same || selectedItemsAssertion(value)) {
|
147
123
|
checked = true;
|
@@ -149,7 +125,7 @@ function intersectValues(base, selected, defaultEmptyValue, displayValues, callb
|
|
149
125
|
const item = {
|
150
126
|
checked,
|
151
127
|
value,
|
152
|
-
visualValue: toVisualValue(value, defaultEmptyValue
|
128
|
+
visualValue: toVisualValue(value, defaultEmptyValue)
|
153
129
|
};
|
154
130
|
if (callback) {
|
155
131
|
callback(item);
|
@@ -22,15 +22,12 @@ export function sortComparison(a, b) {
|
|
22
22
|
*
|
23
23
|
* @param {*} value The value to convert.
|
24
24
|
* @param {string} defaultEmptyValue Default value for empty cells.
|
25
|
-
* @param {string} [displayValue] The display value.
|
26
25
|
* @returns {*}
|
27
26
|
*/
|
28
|
-
export function toVisualValue(value, defaultEmptyValue
|
27
|
+
export function toVisualValue(value, defaultEmptyValue) {
|
29
28
|
let visualValue = value;
|
30
29
|
if (visualValue === '') {
|
31
30
|
visualValue = `(${defaultEmptyValue})`;
|
32
|
-
} else if (displayValue) {
|
33
|
-
visualValue = displayValue;
|
34
31
|
}
|
35
32
|
return visualValue;
|
36
33
|
}
|
@@ -71,7 +68,7 @@ export function toEmptyString(value) {
|
|
71
68
|
}
|
72
69
|
|
73
70
|
/**
|
74
|
-
* Unify column values (
|
71
|
+
* Unify column values (replace `null` and `undefined` values into empty string, unique values and sort them).
|
75
72
|
*
|
76
73
|
* @param {Array} values An array of values.
|
77
74
|
* @returns {Array}
|
@@ -95,43 +92,23 @@ export function unifyColumnValues(values) {
|
|
95
92
|
return unifiedValues;
|
96
93
|
}
|
97
94
|
|
98
|
-
/**
|
99
|
-
* Synchronize display values with the provided unified values.
|
100
|
-
*
|
101
|
-
* @param {Array} displayValues An array of display values.
|
102
|
-
* @param {Array} values An array of source values.
|
103
|
-
* @param {Array} unifiedValues An array of unified values.
|
104
|
-
*
|
105
|
-
* @returns {Array} An array of synchronized display values.
|
106
|
-
*/
|
107
|
-
export function syncDisplayValuesToUnifiedValues(displayValues, values, unifiedValues) {
|
108
|
-
const syncedDisplayValues = [];
|
109
|
-
arrayEach(unifiedValues, unifiedValue => {
|
110
|
-
const index = values.indexOf(unifiedValue);
|
111
|
-
const displayValue = displayValues[index];
|
112
|
-
syncedDisplayValues.push(displayValue);
|
113
|
-
});
|
114
|
-
return syncedDisplayValues;
|
115
|
-
}
|
116
|
-
|
117
95
|
/**
|
118
96
|
* Intersect 'base' values with 'selected' values and return an array of object.
|
119
97
|
*
|
120
98
|
* @param {Array} base An array of base values.
|
121
99
|
* @param {Array} selected An array of selected values.
|
122
100
|
* @param {string} defaultEmptyValue Default value for empty cells.
|
123
|
-
* @param {string[]} [displayValues] An array of display values.
|
124
101
|
* @param {Function} [callback] A callback function which is invoked for every item in an array.
|
125
102
|
* @returns {Array}
|
126
103
|
*/
|
127
|
-
export function intersectValues(base, selected, defaultEmptyValue,
|
104
|
+
export function intersectValues(base, selected, defaultEmptyValue, callback) {
|
128
105
|
const result = [];
|
129
106
|
const same = base === selected;
|
130
107
|
let selectedItemsAssertion;
|
131
108
|
if (!same) {
|
132
109
|
selectedItemsAssertion = createArrayAssertion(selected);
|
133
110
|
}
|
134
|
-
arrayEach(base,
|
111
|
+
arrayEach(base, value => {
|
135
112
|
let checked = false;
|
136
113
|
if (same || selectedItemsAssertion(value)) {
|
137
114
|
checked = true;
|
@@ -139,7 +116,7 @@ export function intersectValues(base, selected, defaultEmptyValue, displayValues
|
|
139
116
|
const item = {
|
140
117
|
checked,
|
141
118
|
value,
|
142
|
-
visualValue: toVisualValue(value, defaultEmptyValue
|
119
|
+
visualValue: toVisualValue(value, defaultEmptyValue)
|
143
120
|
};
|
144
121
|
if (callback) {
|
145
122
|
callback(item);
|
@@ -47,7 +47,6 @@ function numericRenderer(hotInstance, TD, row, col, prop, value, cellProperties)
|
|
47
47
|
cellProperties.className = classArr.join(' ');
|
48
48
|
TD.dir = 'ltr';
|
49
49
|
}
|
50
|
-
cellProperties.displayValue = newValue;
|
51
50
|
(0, _textRenderer.textRenderer)(hotInstance, TD, row, col, prop, newValue, cellProperties);
|
52
51
|
}
|
53
52
|
numericRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -42,7 +42,6 @@ export function numericRenderer(hotInstance, TD, row, col, prop, value, cellProp
|
|
42
42
|
cellProperties.className = classArr.join(' ');
|
43
43
|
TD.dir = 'ltr';
|
44
44
|
}
|
45
|
-
cellProperties.displayValue = newValue;
|
46
45
|
textRenderer(hotInstance, TD, row, col, prop, newValue, cellProperties);
|
47
46
|
}
|
48
47
|
numericRenderer.RENDERER_TYPE = RENDERER_TYPE;
|