@handsontable/vue3 12.1.3 → 12.2.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.
|
@@ -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.2.0";
|
|
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,18 +177,15 @@ 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: {
|
|
209
186
|
/**
|
|
210
187
|
* Initialize Handsontable.
|
|
211
|
-
*/
|
|
212
|
-
hotInit: function hotInit() {
|
|
188
|
+
*/hotInit: function hotInit() {
|
|
213
189
|
var newSettings = prepareSettings(this.$props);
|
|
214
190
|
newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;
|
|
215
191
|
this.hotInstance = vue.markRaw(new Handsontable__default["default"].Core(this.$el, newSettings));
|
|
@@ -218,18 +194,15 @@ var HotTable = vue.defineComponent({
|
|
|
218
194
|
},
|
|
219
195
|
matchHotMappersSize: function matchHotMappersSize() {
|
|
220
196
|
var _this = this;
|
|
221
|
-
|
|
222
197
|
if (!this.hotInstance) {
|
|
223
198
|
return;
|
|
224
199
|
}
|
|
225
|
-
|
|
226
200
|
var data = this.hotInstance.getSourceData();
|
|
227
201
|
var rowsToRemove = [];
|
|
228
202
|
var columnsToRemove = [];
|
|
229
203
|
var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
|
|
230
204
|
var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
|
|
231
205
|
var indexMapperColumnCount = 0;
|
|
232
|
-
|
|
233
206
|
if (data && data.length !== indexMapperRowCount) {
|
|
234
207
|
if (data.length < indexMapperRowCount) {
|
|
235
208
|
for (var r = data.length; r < indexMapperRowCount; r++) {
|
|
@@ -237,12 +210,9 @@ var HotTable = vue.defineComponent({
|
|
|
237
210
|
}
|
|
238
211
|
}
|
|
239
212
|
}
|
|
240
|
-
|
|
241
213
|
if (isColumnModificationAllowed) {
|
|
242
214
|
var _data$;
|
|
243
|
-
|
|
244
215
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
245
|
-
|
|
246
216
|
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
247
217
|
if (data[0].length < indexMapperColumnCount) {
|
|
248
218
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
@@ -251,14 +221,12 @@ var HotTable = vue.defineComponent({
|
|
|
251
221
|
}
|
|
252
222
|
}
|
|
253
223
|
}
|
|
254
|
-
|
|
255
224
|
this.hotInstance.batch(function () {
|
|
256
225
|
if (rowsToRemove.length > 0) {
|
|
257
226
|
_this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
|
|
258
227
|
} else {
|
|
259
228
|
_this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
|
|
260
229
|
}
|
|
261
|
-
|
|
262
230
|
if (isColumnModificationAllowed && data.length !== 0) {
|
|
263
231
|
if (columnsToRemove.length > 0) {
|
|
264
232
|
_this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
|
|
@@ -268,13 +236,11 @@ var HotTable = vue.defineComponent({
|
|
|
268
236
|
}
|
|
269
237
|
});
|
|
270
238
|
},
|
|
271
|
-
|
|
272
239
|
/**
|
|
273
240
|
* Get settings for the columns provided in the `hot-column` components.
|
|
274
241
|
*
|
|
275
242
|
* @returns {HotTableProps[] | undefined}
|
|
276
|
-
*/
|
|
277
|
-
getColumnSettings: function getColumnSettings() {
|
|
243
|
+
*/getColumnSettings: function getColumnSettings() {
|
|
278
244
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
279
245
|
return columnSettings.length ? columnSettings : void 0;
|
|
280
246
|
}
|
|
@@ -295,9 +261,7 @@ var _hoisted_1 = ["id"];
|
|
|
295
261
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
296
262
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
297
263
|
id: _ctx.id
|
|
298
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 8
|
|
299
|
-
/* PROPS */
|
|
300
|
-
, _hoisted_1);
|
|
264
|
+
}, [vue.renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
|
|
301
265
|
}
|
|
302
266
|
|
|
303
267
|
HotTable.render = render;
|
|
@@ -305,17 +269,14 @@ HotTable.__file = "src/HotTable.vue";
|
|
|
305
269
|
|
|
306
270
|
function ownKeys(object, enumerableOnly) {
|
|
307
271
|
var keys = Object.keys(object);
|
|
308
|
-
|
|
309
272
|
if (Object.getOwnPropertySymbols) {
|
|
310
273
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
311
274
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
312
275
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
313
276
|
})), keys.push.apply(keys, symbols);
|
|
314
277
|
}
|
|
315
|
-
|
|
316
278
|
return keys;
|
|
317
279
|
}
|
|
318
|
-
|
|
319
280
|
function _objectSpread2(target) {
|
|
320
281
|
for (var i = 1; i < arguments.length; i++) {
|
|
321
282
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -325,10 +286,8 @@ function _objectSpread2(target) {
|
|
|
325
286
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
326
287
|
});
|
|
327
288
|
}
|
|
328
|
-
|
|
329
289
|
return target;
|
|
330
290
|
}
|
|
331
|
-
|
|
332
291
|
function _defineProperty(obj, key, value) {
|
|
333
292
|
if (key in obj) {
|
|
334
293
|
Object.defineProperty(obj, key, {
|
|
@@ -340,7 +299,6 @@ function _defineProperty(obj, key, value) {
|
|
|
340
299
|
} else {
|
|
341
300
|
obj[key] = value;
|
|
342
301
|
}
|
|
343
|
-
|
|
344
302
|
return obj;
|
|
345
303
|
}
|
|
346
304
|
|
|
@@ -352,20 +310,15 @@ var HotColumn = vue.defineComponent({
|
|
|
352
310
|
/**
|
|
353
311
|
* Create the column settings based on the data provided to the `hot-column`
|
|
354
312
|
* component and it's child components.
|
|
355
|
-
*/
|
|
356
|
-
createColumnSettings: function createColumnSettings() {
|
|
313
|
+
*/createColumnSettings: function createColumnSettings() {
|
|
357
314
|
var assignedProps = filterPassedProps(this.$props);
|
|
358
|
-
|
|
359
315
|
var columnSettings = _objectSpread2({}, assignedProps);
|
|
360
|
-
|
|
361
316
|
if (assignedProps.renderer) {
|
|
362
317
|
columnSettings.renderer = assignedProps.renderer;
|
|
363
318
|
}
|
|
364
|
-
|
|
365
319
|
if (assignedProps.editor) {
|
|
366
320
|
columnSettings.editor = assignedProps.editor;
|
|
367
321
|
}
|
|
368
|
-
|
|
369
322
|
this.columnsCache.set(this, columnSettings);
|
|
370
323
|
}
|
|
371
324
|
},
|
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.2.0 (built at Tue Oct 25 2022 12:06:12 GMT+0200 (Central European Summer 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.2.0";
|
|
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,18 +205,15 @@ 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: {
|
|
237
214
|
/**
|
|
238
215
|
* Initialize Handsontable.
|
|
239
|
-
*/
|
|
240
|
-
hotInit: function hotInit() {
|
|
216
|
+
*/hotInit: function hotInit() {
|
|
241
217
|
var newSettings = prepareSettings(this.$props);
|
|
242
218
|
newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;
|
|
243
219
|
this.hotInstance = vue.markRaw(new Handsontable__default["default"].Core(this.$el, newSettings));
|
|
@@ -246,18 +222,15 @@ var HotTable = vue.defineComponent({
|
|
|
246
222
|
},
|
|
247
223
|
matchHotMappersSize: function matchHotMappersSize() {
|
|
248
224
|
var _this = this;
|
|
249
|
-
|
|
250
225
|
if (!this.hotInstance) {
|
|
251
226
|
return;
|
|
252
227
|
}
|
|
253
|
-
|
|
254
228
|
var data = this.hotInstance.getSourceData();
|
|
255
229
|
var rowsToRemove = [];
|
|
256
230
|
var columnsToRemove = [];
|
|
257
231
|
var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
|
|
258
232
|
var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
|
|
259
233
|
var indexMapperColumnCount = 0;
|
|
260
|
-
|
|
261
234
|
if (data && data.length !== indexMapperRowCount) {
|
|
262
235
|
if (data.length < indexMapperRowCount) {
|
|
263
236
|
for (var r = data.length; r < indexMapperRowCount; r++) {
|
|
@@ -265,12 +238,9 @@ var HotTable = vue.defineComponent({
|
|
|
265
238
|
}
|
|
266
239
|
}
|
|
267
240
|
}
|
|
268
|
-
|
|
269
241
|
if (isColumnModificationAllowed) {
|
|
270
242
|
var _data$;
|
|
271
|
-
|
|
272
243
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
273
|
-
|
|
274
244
|
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
275
245
|
if (data[0].length < indexMapperColumnCount) {
|
|
276
246
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
@@ -279,14 +249,12 @@ var HotTable = vue.defineComponent({
|
|
|
279
249
|
}
|
|
280
250
|
}
|
|
281
251
|
}
|
|
282
|
-
|
|
283
252
|
this.hotInstance.batch(function () {
|
|
284
253
|
if (rowsToRemove.length > 0) {
|
|
285
254
|
_this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
|
|
286
255
|
} else {
|
|
287
256
|
_this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
|
|
288
257
|
}
|
|
289
|
-
|
|
290
258
|
if (isColumnModificationAllowed && data.length !== 0) {
|
|
291
259
|
if (columnsToRemove.length > 0) {
|
|
292
260
|
_this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
|
|
@@ -296,13 +264,11 @@ var HotTable = vue.defineComponent({
|
|
|
296
264
|
}
|
|
297
265
|
});
|
|
298
266
|
},
|
|
299
|
-
|
|
300
267
|
/**
|
|
301
268
|
* Get settings for the columns provided in the `hot-column` components.
|
|
302
269
|
*
|
|
303
270
|
* @returns {HotTableProps[] | undefined}
|
|
304
|
-
*/
|
|
305
|
-
getColumnSettings: function getColumnSettings() {
|
|
271
|
+
*/getColumnSettings: function getColumnSettings() {
|
|
306
272
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
307
273
|
return columnSettings.length ? columnSettings : void 0;
|
|
308
274
|
}
|
|
@@ -323,9 +289,7 @@ var _hoisted_1 = ["id"];
|
|
|
323
289
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
324
290
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
325
291
|
id: _ctx.id
|
|
326
|
-
}, [vue.renderSlot(_ctx.$slots, "default")], 8
|
|
327
|
-
/* PROPS */
|
|
328
|
-
, _hoisted_1);
|
|
292
|
+
}, [vue.renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
|
|
329
293
|
}
|
|
330
294
|
|
|
331
295
|
HotTable.render = render;
|
|
@@ -333,17 +297,14 @@ HotTable.__file = "src/HotTable.vue";
|
|
|
333
297
|
|
|
334
298
|
function ownKeys(object, enumerableOnly) {
|
|
335
299
|
var keys = Object.keys(object);
|
|
336
|
-
|
|
337
300
|
if (Object.getOwnPropertySymbols) {
|
|
338
301
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
339
302
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
340
303
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
341
304
|
})), keys.push.apply(keys, symbols);
|
|
342
305
|
}
|
|
343
|
-
|
|
344
306
|
return keys;
|
|
345
307
|
}
|
|
346
|
-
|
|
347
308
|
function _objectSpread2(target) {
|
|
348
309
|
for (var i = 1; i < arguments.length; i++) {
|
|
349
310
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -353,10 +314,8 @@ function _objectSpread2(target) {
|
|
|
353
314
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
354
315
|
});
|
|
355
316
|
}
|
|
356
|
-
|
|
357
317
|
return target;
|
|
358
318
|
}
|
|
359
|
-
|
|
360
319
|
function _defineProperty(obj, key, value) {
|
|
361
320
|
if (key in obj) {
|
|
362
321
|
Object.defineProperty(obj, key, {
|
|
@@ -368,7 +327,6 @@ function _defineProperty(obj, key, value) {
|
|
|
368
327
|
} else {
|
|
369
328
|
obj[key] = value;
|
|
370
329
|
}
|
|
371
|
-
|
|
372
330
|
return obj;
|
|
373
331
|
}
|
|
374
332
|
|
|
@@ -380,20 +338,15 @@ var HotColumn = vue.defineComponent({
|
|
|
380
338
|
/**
|
|
381
339
|
* Create the column settings based on the data provided to the `hot-column`
|
|
382
340
|
* component and it's child components.
|
|
383
|
-
*/
|
|
384
|
-
createColumnSettings: function createColumnSettings() {
|
|
341
|
+
*/createColumnSettings: function createColumnSettings() {
|
|
385
342
|
var assignedProps = filterPassedProps(this.$props);
|
|
386
|
-
|
|
387
343
|
var columnSettings = _objectSpread2({}, assignedProps);
|
|
388
|
-
|
|
389
344
|
if (assignedProps.renderer) {
|
|
390
345
|
columnSettings.renderer = assignedProps.renderer;
|
|
391
346
|
}
|
|
392
|
-
|
|
393
347
|
if (assignedProps.editor) {
|
|
394
348
|
columnSettings.editor = assignedProps.editor;
|
|
395
349
|
}
|
|
396
|
-
|
|
397
350
|
this.columnsCache.set(this, columnSettings);
|
|
398
351
|
}
|
|
399
352
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-handsontable.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","HOT_DESTROYED_WARNING","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","assign","DefaultSettings","prop","i","length","settings","id","type","String","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","packageJson","_createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAMA,oBAAoB,GAAGC,MAAM,CAAC,YAAD,CAAnC,CAAA;AAEA;;AAEG;;AACI,IAAMC,qBAAqB,GAAG,+EAAA,GACnC,iBADK,CAAA;AAGP;;;;;;AAMG;;AACa,SAAAC,cAAA,CAAeC,MAAf,EAAgCC,GAAhC,EAA2C;EACzD,OAAOC,MAAM,CAACC,SAAP,CAAiBJ,cAAjB,CAAgCK,IAAhC,CAAqCJ,MAArC,EAA6CC,GAA7C,CAAP,CAAA;AACD,CAAA;AAED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AA;;MAEA,IAAIA,aAAa,CAACyE,QAAlB,EAA4B;AAC1B1C,QAAAA,cAAc,CAAC0C,QAAf,GAA0BzE,aAAa,CAACyE,QAAxC,CAAA;AACF,OAAA;;MAEA,IAAIzE,aAAa,CAAC0E,MAAlB,EAA0B;AACxB3C,QAAAA,cAAc,CAAC2C,MAAf,GAAwB1E,aAAa,CAAC0E,MAAtC,CAAA;AACF,OAAA;;AAEA,MAAA,IAAA,CAAK7D,YAAL,CAAkB8D,GAAlB,CAAsB,IAAtB,EAA4B5C,cAA5B,CAAA,CAAA;AACF,KAAA;GAtB8B;AAwBhC8B,EAAAA,OAxBgC,EAwBzB,SAAA,OAAA,GAAA;AACL,IAAA,IAAA,CAAKW,oBAAL,EAAA,CAAA;GAzB8B;AA2BhCI,EAAAA,SA3BgC,EA2BvB,SAAA,SAAA,GAAA;IACP,IAAK/D,CAAAA,YAAL,WAAyB,IAAzB,CAAA,CAAA;GA5B8B;AA8BhCc,EAAAA,MA9BgC,EA8B1B,SAAA,MAAA,GAAA;AACJ,IAAA,OAAO,IAAP,CAAA;AACF,GAAA;AAhCgC,CAAD;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vue-handsontable.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","HOT_DESTROYED_WARNING","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","assign","DefaultSettings","prop","i","length","settings","id","type","String","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","packageJson","_createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAMA,oBAAoB,GAAGC,MAAM,CAAC,YAAY,CAAC,CAAA;AAEjD;;AAEG;AACI,IAAMC,qBAAqB,GAAG,+EAA+E,GAClH,iBAAiB,CAAA;AAEnB;;;;;;AAMG;AACa,SAAAC,cAAc,CAACC,MAAe,EAAEC,GAAW,EAAA;EACzD,OAAOC,MAAM,CAACC,SAAS,CAACJ,cAAc,CAACK,IAAI,CAACJ,MAAM,EAAEC,GAAG,CAAC,CAAA;AAC1D,CAAA;AAEA;;;;;AAKG;AACG,SAAUI,WAAW,CAACC,MAAgC,EAAA;AAC1D,EAAA,IAAMC,eAAe,GAAGC,gCAAY,CAACC,KAAK,CAACC,aAAa,EAAE,CAAA;EAC1D,IAAMC,UAAU,GAA4B,EAAE,CAAA;EAE9CT,MAAM,CAACU,MAAM,CAACD,UAAU,EAAEH,gCAAY,CAACK,eAAe,CAAC,CAAA;AAEvD;AACA,EAAA,KAAK,IAAMC,IAAI,IAAIH,UAAU,EAAE;IAC7BA,UAAU,CAACG,IAAI,CAAC,GAAG;MACjB,SAASlB,EAAAA,oBAAAA;KACV,CAAA;AACF,GAAA;AAED,EAAA,KAAK,IAAImB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,eAAe,CAACS,MAAM,EAAED,CAAC,EAAE,EAAE;AAC/CJ,IAAAA,UAAU,CAACJ,eAAe,CAACQ,CAAC,CAAC,CAAC,GAAG;MAC/B,SAASnB,EAAAA,oBAAAA;KACV,CAAA;AACF,GAAA;EAEDe,UAAU,CAACM,QAAQ,GAAG;IACpB,SAASrB,EAAAA,oBAAAA;GACV,CAAA;EAED,IAAIU,MAAM,KAAK,UAAU,EAAE;IACzBK,UAAU,CAACO,EAAE,GAAG;AACdC,MAAAA,IAAI,EAAEC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,cAAAA,CAAAA,EAAAA,EAAAA,cAAe,CAAA;MAE3C,IAAIA,aAAa,CAACyE,QAAQ,EAAE;AAC1B1C,QAAAA,cAAc,CAAC0C,QAAO,GAAIzE,aAAa,CAACyE,QAAQ,CAAA;AAClD,OAAA;MAEA,IAAIzE,aAAa,CAAC0E,MAAM,EAAE;AACxB3C,QAAAA,cAAc,CAAC2C,MAAK,GAAI1E,aAAa,CAAC0E,MAAM,CAAA;AAC9C,OAAA;MAEA,IAAI,CAAC7D,YAAY,CAAC8D,GAAG,CAAC,IAAI,EAAE5C,cAAc,CAAC,CAAA;AAC7C,KAAA;GACD;AACD8B,EAAAA,OAAO,EAAA,SAAA,OAAA,GAAA;IACL,IAAI,CAACW,oBAAoB,EAAE,CAAA;GAC5B;AACDI,EAAAA,SAAS,EAAA,SAAA,SAAA,GAAA;AACP,IAAA,IAAI,CAAC/D,YAAY,CAAO,QAAA,CAAA,CAAC,IAAI,CAAC,CAAA;GAC/B;AACDc,EAAAA,MAAM,EAAA,SAAA,MAAA,GAAA;AACJ,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACD,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -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.2.0 (built at Tue Oct 25 2022 12:06:20 GMT+0200 (Central European Summer Time))
|
|
29
29
|
*/
|
|
30
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("handsontable/base")):"function"==typeof define&&define.amd?define(["exports","vue","handsontable/base"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Handsontable=t.Handsontable||{},t.Handsontable.vue={}),t.Vue,t.Handsontable)}(this,(function(t,e,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(n),r=Symbol("unassigned");function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a(t){var e=s.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,s.default.DefaultSettings),n)n[o]={default:r};for(var i=0;e.length>i;i++)n[e[i]]={default:r};return n.settings={default:r},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function c(t){var e={},n=t.settings;if(n!==r)for(var o in n)i(n,o)&&n[o]!==r&&(e[o]=n[o]);for(var s in t)i(t,s)&&"settings"!==s&&t[s]!==r&&(e[s]=t[s]);return e}function u(t,e){var n=c(t),o=t.settings?t.settings:n,s=t.settings?n:null,r={};for(var a in o)!i(o,a)||void 0===o[a]||e&&"data"!==a&&l(e[a],o[a])||(r[a]=o[a]);for(var u in s)!i(s,u)||"id"===u||"settings"===u||void 0===s[u]||e&&"data"!==u&&l(e[u],s[u])||(r[u]=s[u]);return r}function l(t,e){return JSON.stringify(t)===JSON.stringify(e)}var h=e.defineComponent({name:"HotTable",props:a("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=u(t,this.hotInstance?this.hotInstance.getSettings():void 0);this.hotInstance&&void 0!==e&&(e.data&&(this.hotInstance.isColumnModificationAllowed()||!this.hotInstance.isColumnModificationAllowed()&&this.hotInstance.countSourceCols()===this.miscCache.currentSourceColumns)&&(this.matchHotMappersSize(),delete e.data),Object.keys(e).length?this.hotInstance.updateSettings(e):this.hotInstance.render(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols())},deep:!0,immediate:!0}},data:function(){return{__hotInstance:null,miscCache:{currentSourceColumns:null},columnSettings:null,columnsCache:new Map,get hotInstance(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set hotInstance(t){this.__hotInstance=t}}},methods:{hotInit:function(){var t=u(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new s.default.Core(this.$el,t)),this.hotInstance.init(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols()},matchHotMappersSize:function(){var t=this;if(this.hotInstance){var e,n=this.hotInstance.getSourceData(),o=[],s=[],r=this.hotInstance.rowIndexMapper.getNumberOfIndexes(),i=this.hotInstance.isColumnModificationAllowed(),a=0;if(n&&n.length!==r&&r>n.length)for(var c=n.length;r>c;c++)o.push(c);if(i)if(a=this.hotInstance.columnIndexMapper.getNumberOfIndexes(),n&&n[0]&&(null===(e=n[0])||void 0===e?void 0:e.length)!==a&&a>n[0].length)for(var u=n[0].length;a>u;u++)s.push(u);this.hotInstance.batch((function(){o.length>0?t.hotInstance.rowIndexMapper.removeIndexes(o):t.hotInstance.rowIndexMapper.insertIndexes(r-1,n.length-r),i&&0!==n.length&&(s.length>0?t.hotInstance.columnIndexMapper.removeIndexes(s):t.hotInstance.columnIndexMapper.insertIndexes(a-1,n[0].length-a))}))}},getColumnSettings:function(){var t=Array.from(this.columnsCache.values());return t.length?t:void 0}},mounted:function(){this.columnSettings=this.getColumnSettings(),this.hotInit()},beforeUnmount:function(){this.hotInstance&&this.hotInstance.destroy()},version:"12.
|
|
30
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("handsontable/base")):"function"==typeof define&&define.amd?define(["exports","vue","handsontable/base"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Handsontable=t.Handsontable||{},t.Handsontable.vue={}),t.Vue,t.Handsontable)}(this,(function(t,e,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(n),r=Symbol("unassigned");function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a(t){var e=s.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,s.default.DefaultSettings),n)n[o]={default:r};for(var i=0;e.length>i;i++)n[e[i]]={default:r};return n.settings={default:r},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function c(t){var e={},n=t.settings;if(n!==r)for(var o in n)i(n,o)&&n[o]!==r&&(e[o]=n[o]);for(var s in t)i(t,s)&&"settings"!==s&&t[s]!==r&&(e[s]=t[s]);return e}function u(t,e){var n=c(t),o=t.settings?t.settings:n,s=t.settings?n:null,r={};for(var a in o)!i(o,a)||void 0===o[a]||e&&"data"!==a&&l(e[a],o[a])||(r[a]=o[a]);for(var u in s)!i(s,u)||"id"===u||"settings"===u||void 0===s[u]||e&&"data"!==u&&l(e[u],s[u])||(r[u]=s[u]);return r}function l(t,e){return JSON.stringify(t)===JSON.stringify(e)}var h=e.defineComponent({name:"HotTable",props:a("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=u(t,this.hotInstance?this.hotInstance.getSettings():void 0);this.hotInstance&&void 0!==e&&(e.data&&(this.hotInstance.isColumnModificationAllowed()||!this.hotInstance.isColumnModificationAllowed()&&this.hotInstance.countSourceCols()===this.miscCache.currentSourceColumns)&&(this.matchHotMappersSize(),delete e.data),Object.keys(e).length?this.hotInstance.updateSettings(e):this.hotInstance.render(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols())},deep:!0,immediate:!0}},data:function(){return{__hotInstance:null,miscCache:{currentSourceColumns:null},columnSettings:null,columnsCache:new Map,get hotInstance(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set hotInstance(t){this.__hotInstance=t}}},methods:{hotInit:function(){var t=u(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new s.default.Core(this.$el,t)),this.hotInstance.init(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols()},matchHotMappersSize:function(){var t=this;if(this.hotInstance){var e,n=this.hotInstance.getSourceData(),o=[],s=[],r=this.hotInstance.rowIndexMapper.getNumberOfIndexes(),i=this.hotInstance.isColumnModificationAllowed(),a=0;if(n&&n.length!==r&&r>n.length)for(var c=n.length;r>c;c++)o.push(c);if(i)if(a=this.hotInstance.columnIndexMapper.getNumberOfIndexes(),n&&n[0]&&(null===(e=n[0])||void 0===e?void 0:e.length)!==a&&a>n[0].length)for(var u=n[0].length;a>u;u++)s.push(u);this.hotInstance.batch((function(){o.length>0?t.hotInstance.rowIndexMapper.removeIndexes(o):t.hotInstance.rowIndexMapper.insertIndexes(r-1,n.length-r),i&&0!==n.length&&(s.length>0?t.hotInstance.columnIndexMapper.removeIndexes(s):t.hotInstance.columnIndexMapper.insertIndexes(a-1,n[0].length-a))}))}},getColumnSettings:function(){var t=Array.from(this.columnsCache.values());return t.length?t:void 0}},mounted:function(){this.columnSettings=this.getColumnSettings(),this.hotInit()},beforeUnmount:function(){this.hotInstance&&this.hotInstance.destroy()},version:"12.2.0"}),d=["id"];function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}h.render=function(t,n,o,s,r,i){return e.openBlock(),e.createElementBlock("div",{id:t.id},[e.renderSlot(t.$slots,"default")],8,d)},h.__file="src/HotTable.vue";var m=e.defineComponent({name:"HotColumn",props:a("HotColumn"),inject:["columnsCache"],methods:{createColumnSettings:function(){var t=c(this.$props),e=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach((function(e){p(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);t.renderer&&(e.renderer=t.renderer),t.editor&&(e.editor=t.editor),this.columnsCache.set(this,e)}},mounted:function(){this.createColumnSettings()},unmounted:function(){this.columnsCache.delete(this)},render:function(){return null}});m.__file="src/HotColumn.vue",t.HotColumn=m,t.HotTable=h,t.default=h,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
31
31
|
//# sourceMappingURL=vue-handsontable.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vue-handsontable.min.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","prop","assign","DefaultSettings","default","i","length","settings","id","type","String","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","this","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","_this","_data$","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","_createElementBlock","createElementBlock","_ctx","_renderSlot","renderSlot","$slots","HotColumn","inject","createColumnSettings","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;8cAGMA,EAAuBC,OAAO,cAepB,SAAAC,EAAeC,EAAiBC,GAC9C,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAQC,EACrD,CAQK,SAAUI,EAAYC,GAC1B,IAAMC,EAAkBC,EAAAA,QAAaC,MAAMC,gBACrCC,EAAsC,CAAA,EAK5C,IAAK,IAAMC,KAHXV,OAAOW,OAAOF,EAAYH,EAAY,QAACM,iBAGpBH,EACjBA,EAAWC,GAAQ,CACjBG,QAASlB,GAIb,IAAK,IAAImB,EAAI,EAAOT,EAAgBU,OAApBD,EAA4BA,IAC1CL,EAAWJ,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F,EAAEpF,IAAA,CACVqF,EAAYC,WAAAF,EAAAG,OAAA,8CCKVC,IAAAA,EAAYhE,EAAAA,gBAAgB,CAChCC,KAAM,YACNjB,MAAOtB,EAAY,aACnBuG,OAAQ,CAAC,gBACTtC,QAAS,CAKPuC,qBAAoB,WAClB,IAAM5E,EAAgBP,EAAkBqB,KAAKE,QACvCgB,iWAAsBhC,CAAAA,CAAAA,EAAAA,GAExBA,EAAc6E,WAChB7C,EAAe6C,SAAW7E,EAAc6E,UAGtC7E,EAAc8E,SAChB9C,EAAe8C,OAAS9E,EAAc8E,QAGxChE,KAAKD,aAAakE,IAAIjE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK8D,sBAzByB,EA2BhCI,UAAS,WACPlE,KAAKD,oBAAoBC,KA5BK,EA8BhCc,OAAM,WACJ,OAAO,IACT"}
|
|
1
|
+
{"version":3,"file":"vue-handsontable.min.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","prop","assign","DefaultSettings","default","i","length","settings","id","type","String","concat","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","this","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","_this","_data$","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","_createElementBlock","createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;8cAGMA,EAAuBC,OAAO,cAepB,SAAAC,EAAeC,EAAiBC,G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A,CAgDD,EAODQ,kBAAiB,WACf,IAAM5B,EAAkC6B,MAAMC,KAAKhD,KAAKD,aAAakD,UAErE,OAAO/B,EAAejD,OAASiD,OAAiB,CAClD,GAEFgC,QAAO,WACLlD,KAAKkB,eAAiBlB,KAAK8C,oBAC3B9C,KAAKwB,SACN,EACD2B,cAAa,WACPnD,KAAKI,aACPJ,KAAKI,YAAYgD,SAEpB,EACDC,saCrLAC,EAEKC,mBAAA,MAAA,CAFCpF,GAAIqF,EAAErF,IAAA,CACVsF,EAAAA,WAAYD,EAAAE,OAAA,8CCKVC,IAAAA,EAAY/D,EAAAA,gBAAgB,CAChCC,KAAM,YACNjB,MAAOvB,EAAY,aACnBuG,OAAQ,CAAC,gBACTrC,QAAS,CAKPsC,qBAAoB,WAClB,IAAM3E,EAAgBP,EAAkBqB,KAAKE,QACvCgB,iWAAsBhC,CAAAA,CAAAA,EAAAA,GAExBA,EAAc4E,WAChB5C,EAAe4C,SAAW5E,EAAc4E,UAGtC5E,EAAc6E,SAChB7C,EAAe6C,OAAS7E,EAAc6E,QAGxC/D,KAAKD,aAAaiE,IAAIhE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK6D,sBACN,EACDI,UAAS,WACPjE,KAAKD,aAAmB,OAACC,KAC1B,EACDc,OAAM,WACJ,OAAO,IACT"}
|
package/es/vue-handsontable.js
CHANGED
|
@@ -5,7 +5,6 @@ var unassignedPropSymbol = Symbol('unassigned');
|
|
|
5
5
|
/**
|
|
6
6
|
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
8
|
var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
|
|
10
9
|
/**
|
|
11
10
|
* Check if at specified `key` there is any value for `object`.
|
|
@@ -14,7 +13,6 @@ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component w
|
|
|
14
13
|
* @param {string} key String key to check.
|
|
15
14
|
* @returns {boolean}
|
|
16
15
|
*/
|
|
17
|
-
|
|
18
16
|
function hasOwnProperty(object, key) {
|
|
19
17
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
20
18
|
}
|
|
@@ -24,35 +22,30 @@ function hasOwnProperty(object, key) {
|
|
|
24
22
|
* @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
|
|
25
23
|
* @returns {object}
|
|
26
24
|
*/
|
|
27
|
-
|
|
28
25
|
function propFactory(source) {
|
|
29
26
|
var registeredHooks = Handsontable.hooks.getRegistered();
|
|
30
27
|
var propSchema = {};
|
|
31
|
-
Object.assign(propSchema, Handsontable.DefaultSettings);
|
|
32
|
-
|
|
28
|
+
Object.assign(propSchema, Handsontable.DefaultSettings);
|
|
29
|
+
// eslint-disable-next-line no-restricted-syntax, guard-for-in
|
|
33
30
|
for (var prop in propSchema) {
|
|
34
31
|
propSchema[prop] = {
|
|
35
32
|
"default": unassignedPropSymbol
|
|
36
33
|
};
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
for (var i = 0; i < registeredHooks.length; i++) {
|
|
40
36
|
propSchema[registeredHooks[i]] = {
|
|
41
37
|
"default": unassignedPropSymbol
|
|
42
38
|
};
|
|
43
39
|
}
|
|
44
|
-
|
|
45
40
|
propSchema.settings = {
|
|
46
41
|
"default": unassignedPropSymbol
|
|
47
42
|
};
|
|
48
|
-
|
|
49
43
|
if (source === 'HotTable') {
|
|
50
44
|
propSchema.id = {
|
|
51
45
|
type: String,
|
|
52
46
|
"default": "hot-".concat(Math.random().toString(36).substring(5))
|
|
53
47
|
};
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
return propSchema;
|
|
57
50
|
}
|
|
58
51
|
/**
|
|
@@ -61,11 +54,9 @@ function propFactory(source) {
|
|
|
61
54
|
* @param {object} props Object containing all the possible props.
|
|
62
55
|
* @returns {object} Object containing only used props.
|
|
63
56
|
*/
|
|
64
|
-
|
|
65
57
|
function filterPassedProps(props) {
|
|
66
58
|
var filteredProps = {};
|
|
67
59
|
var columnSettingsProp = props.settings;
|
|
68
|
-
|
|
69
60
|
if (columnSettingsProp !== unassignedPropSymbol) {
|
|
70
61
|
// eslint-disable-next-line no-restricted-syntax
|
|
71
62
|
for (var propName in columnSettingsProp) {
|
|
@@ -73,15 +64,13 @@ function filterPassedProps(props) {
|
|
|
73
64
|
filteredProps[propName] = columnSettingsProp[propName];
|
|
74
65
|
}
|
|
75
66
|
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
79
69
|
for (var _propName in props) {
|
|
80
70
|
if (hasOwnProperty(props, _propName) && _propName !== 'settings' && props[_propName] !== unassignedPropSymbol) {
|
|
81
71
|
filteredProps[_propName] = props[_propName];
|
|
82
72
|
}
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
return filteredProps;
|
|
86
75
|
}
|
|
87
76
|
/**
|
|
@@ -91,26 +80,23 @@ function filterPassedProps(props) {
|
|
|
91
80
|
* @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
|
|
92
81
|
* @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
|
|
93
82
|
*/
|
|
94
|
-
|
|
95
83
|
function prepareSettings(props, currentSettings) {
|
|
96
84
|
var assignedProps = filterPassedProps(props);
|
|
97
85
|
var hotSettingsInProps = props.settings ? props.settings : assignedProps;
|
|
98
86
|
var additionalHotSettingsInProps = props.settings ? assignedProps : null;
|
|
99
|
-
var newSettings = {};
|
|
100
|
-
|
|
87
|
+
var newSettings = {};
|
|
88
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
101
89
|
for (var key in hotSettingsInProps) {
|
|
102
90
|
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
103
91
|
newSettings[key] = hotSettingsInProps[key];
|
|
104
92
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
}
|
|
94
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
108
95
|
for (var _key in additionalHotSettingsInProps) {
|
|
109
96
|
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
110
97
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
111
98
|
}
|
|
112
99
|
}
|
|
113
|
-
|
|
114
100
|
return newSettings;
|
|
115
101
|
}
|
|
116
102
|
/**
|
|
@@ -122,12 +108,11 @@ function prepareSettings(props, currentSettings) {
|
|
|
122
108
|
* @param {object} objectB Second object to compare.
|
|
123
109
|
* @returns {boolean} `true` if they're the same, `false` otherwise.
|
|
124
110
|
*/
|
|
125
|
-
|
|
126
111
|
function simpleEqual(objectA, objectB) {
|
|
127
112
|
return JSON.stringify(objectA) === JSON.stringify(objectB);
|
|
128
113
|
}
|
|
129
114
|
|
|
130
|
-
var version="12.
|
|
115
|
+
var version="12.2.0";
|
|
131
116
|
|
|
132
117
|
var HotTable = defineComponent({
|
|
133
118
|
name: 'HotTable',
|
|
@@ -141,27 +126,23 @@ var HotTable = defineComponent({
|
|
|
141
126
|
$props: {
|
|
142
127
|
handler: function handler(props) {
|
|
143
128
|
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
144
|
-
|
|
145
129
|
if (!this.hotInstance || settings === void 0) {
|
|
146
130
|
return;
|
|
147
131
|
}
|
|
148
|
-
|
|
149
132
|
if (settings.data) {
|
|
150
133
|
if (this.hotInstance.isColumnModificationAllowed() || !this.hotInstance.isColumnModificationAllowed() && this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns) {
|
|
151
134
|
// If the dataset dimensions change, update the index mappers.
|
|
152
|
-
this.matchHotMappersSize();
|
|
153
|
-
|
|
135
|
+
this.matchHotMappersSize();
|
|
136
|
+
// Data is automatically synchronized by reference.
|
|
154
137
|
delete settings.data;
|
|
155
138
|
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
139
|
+
}
|
|
140
|
+
// If there are another options changed, update the HOT settings, render the table otherwise.
|
|
159
141
|
if (Object.keys(settings).length) {
|
|
160
142
|
this.hotInstance.updateSettings(settings);
|
|
161
143
|
} else {
|
|
162
144
|
this.hotInstance.render();
|
|
163
145
|
}
|
|
164
|
-
|
|
165
146
|
this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();
|
|
166
147
|
},
|
|
167
148
|
deep: true,
|
|
@@ -172,14 +153,12 @@ var HotTable = defineComponent({
|
|
|
172
153
|
return {
|
|
173
154
|
/* eslint-disable vue/no-reserved-keys */
|
|
174
155
|
__hotInstance: null,
|
|
175
|
-
|
|
176
156
|
/* eslint-enable vue/no-reserved-keys */
|
|
177
157
|
miscCache: {
|
|
178
158
|
currentSourceColumns: null
|
|
179
159
|
},
|
|
180
160
|
columnSettings: null,
|
|
181
161
|
columnsCache: new Map(),
|
|
182
|
-
|
|
183
162
|
get hotInstance() {
|
|
184
163
|
if (!this.__hotInstance || this.__hotInstance && !this.__hotInstance.isDestroyed) {
|
|
185
164
|
// Will return the Handsontable instance or `null` if it's not yet been created.
|
|
@@ -190,18 +169,15 @@ var HotTable = defineComponent({
|
|
|
190
169
|
return null;
|
|
191
170
|
}
|
|
192
171
|
},
|
|
193
|
-
|
|
194
172
|
set hotInstance(hotInstance) {
|
|
195
173
|
this.__hotInstance = hotInstance;
|
|
196
174
|
}
|
|
197
|
-
|
|
198
175
|
};
|
|
199
176
|
},
|
|
200
177
|
methods: {
|
|
201
178
|
/**
|
|
202
179
|
* Initialize Handsontable.
|
|
203
|
-
*/
|
|
204
|
-
hotInit: function hotInit() {
|
|
180
|
+
*/hotInit: function hotInit() {
|
|
205
181
|
var newSettings = prepareSettings(this.$props);
|
|
206
182
|
newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;
|
|
207
183
|
this.hotInstance = markRaw(new Handsontable.Core(this.$el, newSettings));
|
|
@@ -210,18 +186,15 @@ var HotTable = defineComponent({
|
|
|
210
186
|
},
|
|
211
187
|
matchHotMappersSize: function matchHotMappersSize() {
|
|
212
188
|
var _this = this;
|
|
213
|
-
|
|
214
189
|
if (!this.hotInstance) {
|
|
215
190
|
return;
|
|
216
191
|
}
|
|
217
|
-
|
|
218
192
|
var data = this.hotInstance.getSourceData();
|
|
219
193
|
var rowsToRemove = [];
|
|
220
194
|
var columnsToRemove = [];
|
|
221
195
|
var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
|
|
222
196
|
var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
|
|
223
197
|
var indexMapperColumnCount = 0;
|
|
224
|
-
|
|
225
198
|
if (data && data.length !== indexMapperRowCount) {
|
|
226
199
|
if (data.length < indexMapperRowCount) {
|
|
227
200
|
for (var r = data.length; r < indexMapperRowCount; r++) {
|
|
@@ -229,12 +202,9 @@ var HotTable = defineComponent({
|
|
|
229
202
|
}
|
|
230
203
|
}
|
|
231
204
|
}
|
|
232
|
-
|
|
233
205
|
if (isColumnModificationAllowed) {
|
|
234
206
|
var _data$;
|
|
235
|
-
|
|
236
207
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
237
|
-
|
|
238
208
|
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
239
209
|
if (data[0].length < indexMapperColumnCount) {
|
|
240
210
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
@@ -243,14 +213,12 @@ var HotTable = defineComponent({
|
|
|
243
213
|
}
|
|
244
214
|
}
|
|
245
215
|
}
|
|
246
|
-
|
|
247
216
|
this.hotInstance.batch(function () {
|
|
248
217
|
if (rowsToRemove.length > 0) {
|
|
249
218
|
_this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
|
|
250
219
|
} else {
|
|
251
220
|
_this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
|
|
252
221
|
}
|
|
253
|
-
|
|
254
222
|
if (isColumnModificationAllowed && data.length !== 0) {
|
|
255
223
|
if (columnsToRemove.length > 0) {
|
|
256
224
|
_this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
|
|
@@ -260,13 +228,11 @@ var HotTable = defineComponent({
|
|
|
260
228
|
}
|
|
261
229
|
});
|
|
262
230
|
},
|
|
263
|
-
|
|
264
231
|
/**
|
|
265
232
|
* Get settings for the columns provided in the `hot-column` components.
|
|
266
233
|
*
|
|
267
234
|
* @returns {HotTableProps[] | undefined}
|
|
268
|
-
*/
|
|
269
|
-
getColumnSettings: function getColumnSettings() {
|
|
235
|
+
*/getColumnSettings: function getColumnSettings() {
|
|
270
236
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
271
237
|
return columnSettings.length ? columnSettings : void 0;
|
|
272
238
|
}
|
|
@@ -287,9 +253,7 @@ var _hoisted_1 = ["id"];
|
|
|
287
253
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
288
254
|
return openBlock(), createElementBlock("div", {
|
|
289
255
|
id: _ctx.id
|
|
290
|
-
}, [renderSlot(_ctx.$slots, "default")], 8
|
|
291
|
-
/* PROPS */
|
|
292
|
-
, _hoisted_1);
|
|
256
|
+
}, [renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
|
|
293
257
|
}
|
|
294
258
|
|
|
295
259
|
HotTable.render = render;
|
|
@@ -297,17 +261,14 @@ HotTable.__file = "src/HotTable.vue";
|
|
|
297
261
|
|
|
298
262
|
function ownKeys(object, enumerableOnly) {
|
|
299
263
|
var keys = Object.keys(object);
|
|
300
|
-
|
|
301
264
|
if (Object.getOwnPropertySymbols) {
|
|
302
265
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
303
266
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
304
267
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
305
268
|
})), keys.push.apply(keys, symbols);
|
|
306
269
|
}
|
|
307
|
-
|
|
308
270
|
return keys;
|
|
309
271
|
}
|
|
310
|
-
|
|
311
272
|
function _objectSpread2(target) {
|
|
312
273
|
for (var i = 1; i < arguments.length; i++) {
|
|
313
274
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -317,10 +278,8 @@ function _objectSpread2(target) {
|
|
|
317
278
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
318
279
|
});
|
|
319
280
|
}
|
|
320
|
-
|
|
321
281
|
return target;
|
|
322
282
|
}
|
|
323
|
-
|
|
324
283
|
function _defineProperty(obj, key, value) {
|
|
325
284
|
if (key in obj) {
|
|
326
285
|
Object.defineProperty(obj, key, {
|
|
@@ -332,7 +291,6 @@ function _defineProperty(obj, key, value) {
|
|
|
332
291
|
} else {
|
|
333
292
|
obj[key] = value;
|
|
334
293
|
}
|
|
335
|
-
|
|
336
294
|
return obj;
|
|
337
295
|
}
|
|
338
296
|
|
|
@@ -344,20 +302,15 @@ var HotColumn = defineComponent({
|
|
|
344
302
|
/**
|
|
345
303
|
* Create the column settings based on the data provided to the `hot-column`
|
|
346
304
|
* component and it's child components.
|
|
347
|
-
*/
|
|
348
|
-
createColumnSettings: function createColumnSettings() {
|
|
305
|
+
*/createColumnSettings: function createColumnSettings() {
|
|
349
306
|
var assignedProps = filterPassedProps(this.$props);
|
|
350
|
-
|
|
351
307
|
var columnSettings = _objectSpread2({}, assignedProps);
|
|
352
|
-
|
|
353
308
|
if (assignedProps.renderer) {
|
|
354
309
|
columnSettings.renderer = assignedProps.renderer;
|
|
355
310
|
}
|
|
356
|
-
|
|
357
311
|
if (assignedProps.editor) {
|
|
358
312
|
columnSettings.editor = assignedProps.editor;
|
|
359
313
|
}
|
|
360
|
-
|
|
361
314
|
this.columnsCache.set(this, columnSettings);
|
|
362
315
|
}
|
|
363
316
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsontable/vue3",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "Best Data Grid for Vue with Spreadsheet Look and Feel.",
|
|
5
5
|
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
|
|
6
6
|
"homepage": "https://handsontable.com",
|