@handsontable/vue3 12.1.3 → 12.3.0-next-bb1a7c2-20221208
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/commonjs/types.d.ts +1 -1
- package/commonjs/vue-handsontable.js +29 -58
- package/dist/types.d.ts +1 -1
- package/dist/vue-handsontable.js +30 -59
- package/dist/vue-handsontable.js.map +1 -1
- package/dist/vue-handsontable.min.js +2 -2
- package/dist/vue-handsontable.min.js.map +1 -1
- package/es/{vue-handsontable.js → vue-handsontable.mjs} +29 -58
- package/package.json +6 -4
- package/types.d.ts +1 -1
package/commonjs/types.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ var unassignedPropSymbol = Symbol('unassigned');
|
|
|
13
13
|
/**
|
|
14
14
|
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
16
|
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
|
18
17
|
/**
|
|
19
18
|
* Check if at specified `key` there is any value for `object`.
|
|
@@ -22,7 +21,6 @@ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component w
|
|
|
22
21
|
* @param {string} key String key to check.
|
|
23
22
|
* @returns {boolean}
|
|
24
23
|
*/
|
|
25
|
-
|
|
26
24
|
function hasOwnProperty(object, key) {
|
|
27
25
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
28
26
|
}
|
|
@@ -32,35 +30,30 @@ function hasOwnProperty(object, key) {
|
|
|
32
30
|
* @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
|
|
33
31
|
* @returns {object}
|
|
34
32
|
*/
|
|
35
|
-
|
|
36
33
|
function propFactory(source) {
|
|
37
34
|
var registeredHooks = Handsontable__default["default"].hooks.getRegistered();
|
|
38
35
|
var propSchema = {};
|
|
39
|
-
Object.assign(propSchema, Handsontable__default["default"].DefaultSettings);
|
|
40
|
-
|
|
36
|
+
Object.assign(propSchema, Handsontable__default["default"].DefaultSettings);
|
|
37
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
41
38
|
for (var prop in propSchema) {
|
|
42
39
|
propSchema[prop] = {
|
|
43
40
|
"default": unassignedPropSymbol
|
|
44
41
|
};
|
|
45
42
|
}
|
|
46
|
-
|
|
47
43
|
for (var i = 0; i < registeredHooks.length; i++) {
|
|
48
44
|
propSchema[registeredHooks[i]] = {
|
|
49
45
|
"default": unassignedPropSymbol
|
|
50
46
|
};
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
propSchema.settings = {
|
|
54
49
|
"default": unassignedPropSymbol
|
|
55
50
|
};
|
|
56
|
-
|
|
57
51
|
if (source === 'HotTable') {
|
|
58
52
|
propSchema.id = {
|
|
59
53
|
type: String,
|
|
60
54
|
"default": "hot-".concat(Math.random().toString(36).substring(5))
|
|
61
55
|
};
|
|
62
56
|
}
|
|
63
|
-
|
|
64
57
|
return propSchema;
|
|
65
58
|
}
|
|
66
59
|
/**
|
|
@@ -69,11 +62,9 @@ function propFactory(source) {
|
|
|
69
62
|
* @param {object} props Object containing all the possible props.
|
|
70
63
|
* @returns {object} Object containing only used props.
|
|
71
64
|
*/
|
|
72
|
-
|
|
73
65
|
function filterPassedProps(props) {
|
|
74
66
|
var filteredProps = {};
|
|
75
67
|
var columnSettingsProp = props.settings;
|
|
76
|
-
|
|
77
68
|
if (columnSettingsProp !== unassignedPropSymbol) {
|
|
78
69
|
// eslint-disable-next-line no-restricted-syntax
|
|
79
70
|
for (var propName in columnSettingsProp) {
|
|
@@ -81,15 +72,13 @@ function filterPassedProps(props) {
|
|
|
81
72
|
filteredProps[propName] = columnSettingsProp[propName];
|
|
82
73
|
}
|
|
83
74
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
}
|
|
76
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
87
77
|
for (var _propName in props) {
|
|
88
78
|
if (hasOwnProperty(props, _propName) && _propName !== 'settings' && props[_propName] !== unassignedPropSymbol) {
|
|
89
79
|
filteredProps[_propName] = props[_propName];
|
|
90
80
|
}
|
|
91
81
|
}
|
|
92
|
-
|
|
93
82
|
return filteredProps;
|
|
94
83
|
}
|
|
95
84
|
/**
|
|
@@ -99,26 +88,23 @@ function filterPassedProps(props) {
|
|
|
99
88
|
* @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
|
|
100
89
|
* @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
|
|
101
90
|
*/
|
|
102
|
-
|
|
103
91
|
function prepareSettings(props, currentSettings) {
|
|
104
92
|
var assignedProps = filterPassedProps(props);
|
|
105
93
|
var hotSettingsInProps = props.settings ? props.settings : assignedProps;
|
|
106
94
|
var additionalHotSettingsInProps = props.settings ? assignedProps : null;
|
|
107
|
-
var newSettings = {};
|
|
108
|
-
|
|
95
|
+
var newSettings = {};
|
|
96
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
109
97
|
for (var key in hotSettingsInProps) {
|
|
110
98
|
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
111
99
|
newSettings[key] = hotSettingsInProps[key];
|
|
112
100
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
}
|
|
102
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
116
103
|
for (var _key in additionalHotSettingsInProps) {
|
|
117
104
|
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
118
105
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
119
106
|
}
|
|
120
107
|
}
|
|
121
|
-
|
|
122
108
|
return newSettings;
|
|
123
109
|
}
|
|
124
110
|
/**
|
|
@@ -130,12 +116,11 @@ function prepareSettings(props, currentSettings) {
|
|
|
130
116
|
* @param {object} objectB Second object to compare.
|
|
131
117
|
* @returns {boolean} `true` if they're the same, `false` otherwise.
|
|
132
118
|
*/
|
|
133
|
-
|
|
134
119
|
function simpleEqual(objectA, objectB) {
|
|
135
120
|
return JSON.stringify(objectA) === JSON.stringify(objectB);
|
|
136
121
|
}
|
|
137
122
|
|
|
138
|
-
var version="12.
|
|
123
|
+
var version="12.3.0-next-bb1a7c2-20221208";
|
|
139
124
|
|
|
140
125
|
var HotTable = vue.defineComponent({
|
|
141
126
|
name: 'HotTable',
|
|
@@ -149,27 +134,23 @@ var HotTable = vue.defineComponent({
|
|
|
149
134
|
$props: {
|
|
150
135
|
handler: function handler(props) {
|
|
151
136
|
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
152
|
-
|
|
153
137
|
if (!this.hotInstance || settings === void 0) {
|
|
154
138
|
return;
|
|
155
139
|
}
|
|
156
|
-
|
|
157
140
|
if (settings.data) {
|
|
158
141
|
if (this.hotInstance.isColumnModificationAllowed() || !this.hotInstance.isColumnModificationAllowed() && this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns) {
|
|
159
142
|
// If the dataset dimensions change, update the index mappers.
|
|
160
|
-
this.matchHotMappersSize();
|
|
161
|
-
|
|
143
|
+
this.matchHotMappersSize();
|
|
144
|
+
// Data is automatically synchronized by reference.
|
|
162
145
|
delete settings.data;
|
|
163
146
|
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
147
|
+
}
|
|
148
|
+
// If there are another options changed, update the HOT settings, render the table otherwise.
|
|
167
149
|
if (Object.keys(settings).length) {
|
|
168
150
|
this.hotInstance.updateSettings(settings);
|
|
169
151
|
} else {
|
|
170
152
|
this.hotInstance.render();
|
|
171
153
|
}
|
|
172
|
-
|
|
173
154
|
this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();
|
|
174
155
|
},
|
|
175
156
|
deep: true,
|
|
@@ -180,14 +161,12 @@ var HotTable = vue.defineComponent({
|
|
|
180
161
|
return {
|
|
181
162
|
/* eslint-disable vue/no-reserved-keys */
|
|
182
163
|
__hotInstance: null,
|
|
183
|
-
|
|
184
164
|
/* eslint-enable vue/no-reserved-keys */
|
|
185
165
|
miscCache: {
|
|
186
166
|
currentSourceColumns: null
|
|
187
167
|
},
|
|
188
168
|
columnSettings: null,
|
|
189
169
|
columnsCache: new Map(),
|
|
190
|
-
|
|
191
170
|
get hotInstance() {
|
|
192
171
|
if (!this.__hotInstance || this.__hotInstance && !this.__hotInstance.isDestroyed) {
|
|
193
172
|
// Will return the Handsontable instance or `null` if it's not yet been created.
|
|
@@ -198,11 +177,9 @@ var HotTable = vue.defineComponent({
|
|
|
198
177
|
return null;
|
|
199
178
|
}
|
|
200
179
|
},
|
|
201
|
-
|
|
202
180
|
set hotInstance(hotInstance) {
|
|
203
181
|
this.__hotInstance = hotInstance;
|
|
204
182
|
}
|
|
205
|
-
|
|
206
183
|
};
|
|
207
184
|
},
|
|
208
185
|
methods: {
|
|
@@ -218,18 +195,15 @@ var HotTable = vue.defineComponent({
|
|
|
218
195
|
},
|
|
219
196
|
matchHotMappersSize: function matchHotMappersSize() {
|
|
220
197
|
var _this = this;
|
|
221
|
-
|
|
222
198
|
if (!this.hotInstance) {
|
|
223
199
|
return;
|
|
224
200
|
}
|
|
225
|
-
|
|
226
201
|
var data = this.hotInstance.getSourceData();
|
|
227
202
|
var rowsToRemove = [];
|
|
228
203
|
var columnsToRemove = [];
|
|
229
204
|
var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
|
|
230
205
|
var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
|
|
231
206
|
var indexMapperColumnCount = 0;
|
|
232
|
-
|
|
233
207
|
if (data && data.length !== indexMapperRowCount) {
|
|
234
208
|
if (data.length < indexMapperRowCount) {
|
|
235
209
|
for (var r = data.length; r < indexMapperRowCount; r++) {
|
|
@@ -237,12 +211,9 @@ var HotTable = vue.defineComponent({
|
|
|
237
211
|
}
|
|
238
212
|
}
|
|
239
213
|
}
|
|
240
|
-
|
|
241
214
|
if (isColumnModificationAllowed) {
|
|
242
215
|
var _data$;
|
|
243
|
-
|
|
244
216
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
245
|
-
|
|
246
217
|
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
247
218
|
if (data[0].length < indexMapperColumnCount) {
|
|
248
219
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
@@ -251,14 +222,12 @@ var HotTable = vue.defineComponent({
|
|
|
251
222
|
}
|
|
252
223
|
}
|
|
253
224
|
}
|
|
254
|
-
|
|
255
225
|
this.hotInstance.batch(function () {
|
|
256
226
|
if (rowsToRemove.length > 0) {
|
|
257
227
|
_this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
|
|
258
228
|
} else {
|
|
259
229
|
_this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
|
|
260
230
|
}
|
|
261
|
-
|
|
262
231
|
if (isColumnModificationAllowed && data.length !== 0) {
|
|
263
232
|
if (columnsToRemove.length > 0) {
|
|
264
233
|
_this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
|
|
@@ -268,7 +237,6 @@ var HotTable = vue.defineComponent({
|
|
|
268
237
|
}
|
|
269
238
|
});
|
|
270
239
|
},
|
|
271
|
-
|
|
272
240
|
/**
|
|
273
241
|
* Get settings for the columns provided in the `hot-column` components.
|
|
274
242
|
*
|
|
@@ -295,9 +263,7 @@ var _hoisted_1 = ["id"];
|
|
|
295
263
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
296
264
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
297
265
|
id: _ctx.id
|
|
298
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 8
|
|
299
|
-
/* PROPS */
|
|
300
|
-
, _hoisted_1);
|
|
266
|
+
}, [vue.renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
|
|
301
267
|
}
|
|
302
268
|
|
|
303
269
|
HotTable.render = render;
|
|
@@ -305,17 +271,14 @@ HotTable.__file = "src/HotTable.vue";
|
|
|
305
271
|
|
|
306
272
|
function ownKeys(object, enumerableOnly) {
|
|
307
273
|
var keys = Object.keys(object);
|
|
308
|
-
|
|
309
274
|
if (Object.getOwnPropertySymbols) {
|
|
310
275
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
311
276
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
312
277
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
313
278
|
})), keys.push.apply(keys, symbols);
|
|
314
279
|
}
|
|
315
|
-
|
|
316
280
|
return keys;
|
|
317
281
|
}
|
|
318
|
-
|
|
319
282
|
function _objectSpread2(target) {
|
|
320
283
|
for (var i = 1; i < arguments.length; i++) {
|
|
321
284
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -325,11 +288,10 @@ function _objectSpread2(target) {
|
|
|
325
288
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
326
289
|
});
|
|
327
290
|
}
|
|
328
|
-
|
|
329
291
|
return target;
|
|
330
292
|
}
|
|
331
|
-
|
|
332
293
|
function _defineProperty(obj, key, value) {
|
|
294
|
+
key = _toPropertyKey(key);
|
|
333
295
|
if (key in obj) {
|
|
334
296
|
Object.defineProperty(obj, key, {
|
|
335
297
|
value: value,
|
|
@@ -340,9 +302,22 @@ function _defineProperty(obj, key, value) {
|
|
|
340
302
|
} else {
|
|
341
303
|
obj[key] = value;
|
|
342
304
|
}
|
|
343
|
-
|
|
344
305
|
return obj;
|
|
345
306
|
}
|
|
307
|
+
function _toPrimitive(input, hint) {
|
|
308
|
+
if (typeof input !== "object" || input === null) return input;
|
|
309
|
+
var prim = input[Symbol.toPrimitive];
|
|
310
|
+
if (prim !== undefined) {
|
|
311
|
+
var res = prim.call(input, hint || "default");
|
|
312
|
+
if (typeof res !== "object") return res;
|
|
313
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
314
|
+
}
|
|
315
|
+
return (hint === "string" ? String : Number)(input);
|
|
316
|
+
}
|
|
317
|
+
function _toPropertyKey(arg) {
|
|
318
|
+
var key = _toPrimitive(arg, "string");
|
|
319
|
+
return typeof key === "symbol" ? key : String(key);
|
|
320
|
+
}
|
|
346
321
|
|
|
347
322
|
var HotColumn = vue.defineComponent({
|
|
348
323
|
name: 'HotColumn',
|
|
@@ -355,17 +330,13 @@ var HotColumn = vue.defineComponent({
|
|
|
355
330
|
*/
|
|
356
331
|
createColumnSettings: function createColumnSettings() {
|
|
357
332
|
var assignedProps = filterPassedProps(this.$props);
|
|
358
|
-
|
|
359
333
|
var columnSettings = _objectSpread2({}, assignedProps);
|
|
360
|
-
|
|
361
334
|
if (assignedProps.renderer) {
|
|
362
335
|
columnSettings.renderer = assignedProps.renderer;
|
|
363
336
|
}
|
|
364
|
-
|
|
365
337
|
if (assignedProps.editor) {
|
|
366
338
|
columnSettings.editor = assignedProps.editor;
|
|
367
339
|
}
|
|
368
|
-
|
|
369
340
|
this.columnsCache.set(this, columnSettings);
|
|
370
341
|
}
|
|
371
342
|
},
|
package/dist/types.d.ts
CHANGED
package/dist/vue-handsontable.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
|
26
26
|
* USE OR INABILITY TO USE THIS SOFTWARE.
|
|
27
27
|
*
|
|
28
|
-
* Version: 12.
|
|
28
|
+
* Version: 12.3.0-next-bb1a7c2-20221208 (built at Thu Dec 08 2022 08:21:32 GMT+0000 (Coordinated Universal Time))
|
|
29
29
|
*/
|
|
30
30
|
(function (global, factory) {
|
|
31
31
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('handsontable/base')) :
|
|
@@ -41,7 +41,6 @@ var unassignedPropSymbol = Symbol('unassigned');
|
|
|
41
41
|
/**
|
|
42
42
|
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
43
43
|
*/
|
|
44
|
-
|
|
45
44
|
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
|
46
45
|
/**
|
|
47
46
|
* Check if at specified `key` there is any value for `object`.
|
|
@@ -50,7 +49,6 @@ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component w
|
|
|
50
49
|
* @param {string} key String key to check.
|
|
51
50
|
* @returns {boolean}
|
|
52
51
|
*/
|
|
53
|
-
|
|
54
52
|
function hasOwnProperty(object, key) {
|
|
55
53
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
56
54
|
}
|
|
@@ -60,35 +58,30 @@ function hasOwnProperty(object, key) {
|
|
|
60
58
|
* @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
|
|
61
59
|
* @returns {object}
|
|
62
60
|
*/
|
|
63
|
-
|
|
64
61
|
function propFactory(source) {
|
|
65
62
|
var registeredHooks = Handsontable__default["default"].hooks.getRegistered();
|
|
66
63
|
var propSchema = {};
|
|
67
|
-
Object.assign(propSchema, Handsontable__default["default"].DefaultSettings);
|
|
68
|
-
|
|
64
|
+
Object.assign(propSchema, Handsontable__default["default"].DefaultSettings);
|
|
65
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
69
66
|
for (var prop in propSchema) {
|
|
70
67
|
propSchema[prop] = {
|
|
71
68
|
"default": unassignedPropSymbol
|
|
72
69
|
};
|
|
73
70
|
}
|
|
74
|
-
|
|
75
71
|
for (var i = 0; i < registeredHooks.length; i++) {
|
|
76
72
|
propSchema[registeredHooks[i]] = {
|
|
77
73
|
"default": unassignedPropSymbol
|
|
78
74
|
};
|
|
79
75
|
}
|
|
80
|
-
|
|
81
76
|
propSchema.settings = {
|
|
82
77
|
"default": unassignedPropSymbol
|
|
83
78
|
};
|
|
84
|
-
|
|
85
79
|
if (source === 'HotTable') {
|
|
86
80
|
propSchema.id = {
|
|
87
81
|
type: String,
|
|
88
82
|
"default": "hot-".concat(Math.random().toString(36).substring(5))
|
|
89
83
|
};
|
|
90
84
|
}
|
|
91
|
-
|
|
92
85
|
return propSchema;
|
|
93
86
|
}
|
|
94
87
|
/**
|
|
@@ -97,11 +90,9 @@ function propFactory(source) {
|
|
|
97
90
|
* @param {object} props Object containing all the possible props.
|
|
98
91
|
* @returns {object} Object containing only used props.
|
|
99
92
|
*/
|
|
100
|
-
|
|
101
93
|
function filterPassedProps(props) {
|
|
102
94
|
var filteredProps = {};
|
|
103
95
|
var columnSettingsProp = props.settings;
|
|
104
|
-
|
|
105
96
|
if (columnSettingsProp !== unassignedPropSymbol) {
|
|
106
97
|
// eslint-disable-next-line no-restricted-syntax
|
|
107
98
|
for (var propName in columnSettingsProp) {
|
|
@@ -109,15 +100,13 @@ function filterPassedProps(props) {
|
|
|
109
100
|
filteredProps[propName] = columnSettingsProp[propName];
|
|
110
101
|
}
|
|
111
102
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
103
|
+
}
|
|
104
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
115
105
|
for (var _propName in props) {
|
|
116
106
|
if (hasOwnProperty(props, _propName) && _propName !== 'settings' && props[_propName] !== unassignedPropSymbol) {
|
|
117
107
|
filteredProps[_propName] = props[_propName];
|
|
118
108
|
}
|
|
119
109
|
}
|
|
120
|
-
|
|
121
110
|
return filteredProps;
|
|
122
111
|
}
|
|
123
112
|
/**
|
|
@@ -127,26 +116,23 @@ function filterPassedProps(props) {
|
|
|
127
116
|
* @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
|
|
128
117
|
* @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
|
|
129
118
|
*/
|
|
130
|
-
|
|
131
119
|
function prepareSettings(props, currentSettings) {
|
|
132
120
|
var assignedProps = filterPassedProps(props);
|
|
133
121
|
var hotSettingsInProps = props.settings ? props.settings : assignedProps;
|
|
134
122
|
var additionalHotSettingsInProps = props.settings ? assignedProps : null;
|
|
135
|
-
var newSettings = {};
|
|
136
|
-
|
|
123
|
+
var newSettings = {};
|
|
124
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
137
125
|
for (var key in hotSettingsInProps) {
|
|
138
126
|
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
139
127
|
newSettings[key] = hotSettingsInProps[key];
|
|
140
128
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
}
|
|
130
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
144
131
|
for (var _key in additionalHotSettingsInProps) {
|
|
145
132
|
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
146
133
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
147
134
|
}
|
|
148
135
|
}
|
|
149
|
-
|
|
150
136
|
return newSettings;
|
|
151
137
|
}
|
|
152
138
|
/**
|
|
@@ -158,12 +144,11 @@ function prepareSettings(props, currentSettings) {
|
|
|
158
144
|
* @param {object} objectB Second object to compare.
|
|
159
145
|
* @returns {boolean} `true` if they're the same, `false` otherwise.
|
|
160
146
|
*/
|
|
161
|
-
|
|
162
147
|
function simpleEqual(objectA, objectB) {
|
|
163
148
|
return JSON.stringify(objectA) === JSON.stringify(objectB);
|
|
164
149
|
}
|
|
165
150
|
|
|
166
|
-
var version="12.
|
|
151
|
+
var version="12.3.0-next-bb1a7c2-20221208";
|
|
167
152
|
|
|
168
153
|
var HotTable = vue.defineComponent({
|
|
169
154
|
name: 'HotTable',
|
|
@@ -177,27 +162,23 @@ var HotTable = vue.defineComponent({
|
|
|
177
162
|
$props: {
|
|
178
163
|
handler: function handler(props) {
|
|
179
164
|
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
180
|
-
|
|
181
165
|
if (!this.hotInstance || settings === void 0) {
|
|
182
166
|
return;
|
|
183
167
|
}
|
|
184
|
-
|
|
185
168
|
if (settings.data) {
|
|
186
169
|
if (this.hotInstance.isColumnModificationAllowed() || !this.hotInstance.isColumnModificationAllowed() && this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns) {
|
|
187
170
|
// If the dataset dimensions change, update the index mappers.
|
|
188
|
-
this.matchHotMappersSize();
|
|
189
|
-
|
|
171
|
+
this.matchHotMappersSize();
|
|
172
|
+
// Data is automatically synchronized by reference.
|
|
190
173
|
delete settings.data;
|
|
191
174
|
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
|
|
175
|
+
}
|
|
176
|
+
// If there are another options changed, update the HOT settings, render the table otherwise.
|
|
195
177
|
if (Object.keys(settings).length) {
|
|
196
178
|
this.hotInstance.updateSettings(settings);
|
|
197
179
|
} else {
|
|
198
180
|
this.hotInstance.render();
|
|
199
181
|
}
|
|
200
|
-
|
|
201
182
|
this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();
|
|
202
183
|
},
|
|
203
184
|
deep: true,
|
|
@@ -208,14 +189,12 @@ var HotTable = vue.defineComponent({
|
|
|
208
189
|
return {
|
|
209
190
|
/* eslint-disable vue/no-reserved-keys */
|
|
210
191
|
__hotInstance: null,
|
|
211
|
-
|
|
212
192
|
/* eslint-enable vue/no-reserved-keys */
|
|
213
193
|
miscCache: {
|
|
214
194
|
currentSourceColumns: null
|
|
215
195
|
},
|
|
216
196
|
columnSettings: null,
|
|
217
197
|
columnsCache: new Map(),
|
|
218
|
-
|
|
219
198
|
get hotInstance() {
|
|
220
199
|
if (!this.__hotInstance || this.__hotInstance && !this.__hotInstance.isDestroyed) {
|
|
221
200
|
// Will return the Handsontable instance or `null` if it's not yet been created.
|
|
@@ -226,11 +205,9 @@ var HotTable = vue.defineComponent({
|
|
|
226
205
|
return null;
|
|
227
206
|
}
|
|
228
207
|
},
|
|
229
|
-
|
|
230
208
|
set hotInstance(hotInstance) {
|
|
231
209
|
this.__hotInstance = hotInstance;
|
|
232
210
|
}
|
|
233
|
-
|
|
234
211
|
};
|
|
235
212
|
},
|
|
236
213
|
methods: {
|
|
@@ -246,18 +223,15 @@ var HotTable = vue.defineComponent({
|
|
|
246
223
|
},
|
|
247
224
|
matchHotMappersSize: function matchHotMappersSize() {
|
|
248
225
|
var _this = this;
|
|
249
|
-
|
|
250
226
|
if (!this.hotInstance) {
|
|
251
227
|
return;
|
|
252
228
|
}
|
|
253
|
-
|
|
254
229
|
var data = this.hotInstance.getSourceData();
|
|
255
230
|
var rowsToRemove = [];
|
|
256
231
|
var columnsToRemove = [];
|
|
257
232
|
var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
|
|
258
233
|
var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
|
|
259
234
|
var indexMapperColumnCount = 0;
|
|
260
|
-
|
|
261
235
|
if (data && data.length !== indexMapperRowCount) {
|
|
262
236
|
if (data.length < indexMapperRowCount) {
|
|
263
237
|
for (var r = data.length; r < indexMapperRowCount; r++) {
|
|
@@ -265,12 +239,9 @@ var HotTable = vue.defineComponent({
|
|
|
265
239
|
}
|
|
266
240
|
}
|
|
267
241
|
}
|
|
268
|
-
|
|
269
242
|
if (isColumnModificationAllowed) {
|
|
270
243
|
var _data$;
|
|
271
|
-
|
|
272
244
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
273
|
-
|
|
274
245
|
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
275
246
|
if (data[0].length < indexMapperColumnCount) {
|
|
276
247
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
@@ -279,14 +250,12 @@ var HotTable = vue.defineComponent({
|
|
|
279
250
|
}
|
|
280
251
|
}
|
|
281
252
|
}
|
|
282
|
-
|
|
283
253
|
this.hotInstance.batch(function () {
|
|
284
254
|
if (rowsToRemove.length > 0) {
|
|
285
255
|
_this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
|
|
286
256
|
} else {
|
|
287
257
|
_this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
|
|
288
258
|
}
|
|
289
|
-
|
|
290
259
|
if (isColumnModificationAllowed && data.length !== 0) {
|
|
291
260
|
if (columnsToRemove.length > 0) {
|
|
292
261
|
_this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
|
|
@@ -296,7 +265,6 @@ var HotTable = vue.defineComponent({
|
|
|
296
265
|
}
|
|
297
266
|
});
|
|
298
267
|
},
|
|
299
|
-
|
|
300
268
|
/**
|
|
301
269
|
* Get settings for the columns provided in the `hot-column` components.
|
|
302
270
|
*
|
|
@@ -323,9 +291,7 @@ var _hoisted_1 = ["id"];
|
|
|
323
291
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
324
292
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
325
293
|
id: _ctx.id
|
|
326
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 8
|
|
327
|
-
/* PROPS */
|
|
328
|
-
, _hoisted_1);
|
|
294
|
+
}, [vue.renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
|
|
329
295
|
}
|
|
330
296
|
|
|
331
297
|
HotTable.render = render;
|
|
@@ -333,17 +299,14 @@ HotTable.__file = "src/HotTable.vue";
|
|
|
333
299
|
|
|
334
300
|
function ownKeys(object, enumerableOnly) {
|
|
335
301
|
var keys = Object.keys(object);
|
|
336
|
-
|
|
337
302
|
if (Object.getOwnPropertySymbols) {
|
|
338
303
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
339
304
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
340
305
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
341
306
|
})), keys.push.apply(keys, symbols);
|
|
342
307
|
}
|
|
343
|
-
|
|
344
308
|
return keys;
|
|
345
309
|
}
|
|
346
|
-
|
|
347
310
|
function _objectSpread2(target) {
|
|
348
311
|
for (var i = 1; i < arguments.length; i++) {
|
|
349
312
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -353,11 +316,10 @@ function _objectSpread2(target) {
|
|
|
353
316
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
354
317
|
});
|
|
355
318
|
}
|
|
356
|
-
|
|
357
319
|
return target;
|
|
358
320
|
}
|
|
359
|
-
|
|
360
321
|
function _defineProperty(obj, key, value) {
|
|
322
|
+
key = _toPropertyKey(key);
|
|
361
323
|
if (key in obj) {
|
|
362
324
|
Object.defineProperty(obj, key, {
|
|
363
325
|
value: value,
|
|
@@ -368,9 +330,22 @@ function _defineProperty(obj, key, value) {
|
|
|
368
330
|
} else {
|
|
369
331
|
obj[key] = value;
|
|
370
332
|
}
|
|
371
|
-
|
|
372
333
|
return obj;
|
|
373
334
|
}
|
|
335
|
+
function _toPrimitive(input, hint) {
|
|
336
|
+
if (typeof input !== "object" || input === null) return input;
|
|
337
|
+
var prim = input[Symbol.toPrimitive];
|
|
338
|
+
if (prim !== undefined) {
|
|
339
|
+
var res = prim.call(input, hint || "default");
|
|
340
|
+
if (typeof res !== "object") return res;
|
|
341
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
342
|
+
}
|
|
343
|
+
return (hint === "string" ? String : Number)(input);
|
|
344
|
+
}
|
|
345
|
+
function _toPropertyKey(arg) {
|
|
346
|
+
var key = _toPrimitive(arg, "string");
|
|
347
|
+
return typeof key === "symbol" ? key : String(key);
|
|
348
|
+
}
|
|
374
349
|
|
|
375
350
|
var HotColumn = vue.defineComponent({
|
|
376
351
|
name: 'HotColumn',
|
|
@@ -383,17 +358,13 @@ var HotColumn = vue.defineComponent({
|
|
|
383
358
|
*/
|
|
384
359
|
createColumnSettings: function createColumnSettings() {
|
|
385
360
|
var assignedProps = filterPassedProps(this.$props);
|
|
386
|
-
|
|
387
361
|
var columnSettings = _objectSpread2({}, assignedProps);
|
|
388
|
-
|
|
389
362
|
if (assignedProps.renderer) {
|
|
390
363
|
columnSettings.renderer = assignedProps.renderer;
|
|
391
364
|
}
|
|
392
|
-
|
|
393
365
|
if (assignedProps.editor) {
|
|
394
366
|
columnSettings.editor = assignedProps.editor;
|
|
395
367
|
}
|
|
396
|
-
|
|
397
368
|
this.columnsCache.set(this, columnSettings);
|
|
398
369
|
}
|
|
399
370
|
},
|