@handsontable/vue3 12.1.2 → 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.
- package/HotColumn.vue.d.ts +1 -1
- package/HotTable.vue.d.ts +1 -1
- package/commonjs/HotColumn.vue.d.ts +1 -1
- package/commonjs/HotTable.vue.d.ts +1 -1
- package/commonjs/vue-handsontable.js +17 -64
- package/dist/HotColumn.vue.d.ts +1 -1
- package/dist/HotTable.vue.d.ts +1 -1
- package/dist/vue-handsontable.js +18 -65
- package/dist/vue-handsontable.js.map +1 -1
- package/dist/vue-handsontable.min.js +2 -2
- package/dist/vue-handsontable.min.js.map +1 -1
- package/es/vue-handsontable.js +17 -64
- package/package.json +1 -1
package/HotColumn.vue.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const HotColumn: import("vue").DefineComponent<import("./types").VueProp
|
|
|
4
4
|
* component and it's child components.
|
|
5
5
|
*/
|
|
6
6
|
createColumnSettings(): void;
|
|
7
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
7
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<import("./types").HotTableProps>>>, {
|
|
8
8
|
[x: string]: any;
|
|
9
9
|
}>;
|
|
10
10
|
export default HotColumn;
|
package/HotTable.vue.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const HotTable: import("vue").DefineComponent<import("./types").VueProps
|
|
|
23
23
|
* @returns {HotTableProps[] | undefined}
|
|
24
24
|
*/
|
|
25
25
|
getColumnSettings(): HotTableProps[] | void;
|
|
26
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
26
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<HotTableProps>>>, {
|
|
27
27
|
[x: string]: any;
|
|
28
28
|
}>;
|
|
29
29
|
export default HotTable;
|
|
@@ -4,7 +4,7 @@ declare const HotColumn: import("vue").DefineComponent<import("./types").VueProp
|
|
|
4
4
|
* component and it's child components.
|
|
5
5
|
*/
|
|
6
6
|
createColumnSettings(): void;
|
|
7
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
7
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<import("./types").HotTableProps>>>, {
|
|
8
8
|
[x: string]: any;
|
|
9
9
|
}>;
|
|
10
10
|
export default HotColumn;
|
|
@@ -23,7 +23,7 @@ declare const HotTable: import("vue").DefineComponent<import("./types").VueProps
|
|
|
23
23
|
* @returns {HotTableProps[] | undefined}
|
|
24
24
|
*/
|
|
25
25
|
getColumnSettings(): HotTableProps[] | void;
|
|
26
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
26
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<HotTableProps>>>, {
|
|
27
27
|
[x: string]: any;
|
|
28
28
|
}>;
|
|
29
29
|
export default HotTable;
|
|
@@ -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/HotColumn.vue.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const HotColumn: import("vue").DefineComponent<import("./types").VueProp
|
|
|
4
4
|
* component and it's child components.
|
|
5
5
|
*/
|
|
6
6
|
createColumnSettings(): void;
|
|
7
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
7
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<import("./types").HotTableProps>>>, {
|
|
8
8
|
[x: string]: any;
|
|
9
9
|
}>;
|
|
10
10
|
export default HotColumn;
|
package/dist/HotTable.vue.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const HotTable: import("vue").DefineComponent<import("./types").VueProps
|
|
|
23
23
|
* @returns {HotTableProps[] | undefined}
|
|
24
24
|
*/
|
|
25
25
|
getColumnSettings(): HotTableProps[] | void;
|
|
26
|
-
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
26
|
+
}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<HotTableProps>>>, {
|
|
27
27
|
[x: string]: any;
|
|
28
28
|
}>;
|
|
29
29
|
export default HotTable;
|