@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.
@@ -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.1.2 (built at Fri Jul 08 2022 09:09:51 GMT+0200 (Central European Summer Time))
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); // eslint-disable-next-line no-restricted-syntax, guard-for-in
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
- } // eslint-disable-next-line no-restricted-syntax
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 = {}; // eslint-disable-next-line no-restricted-syntax
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
- } // eslint-disable-next-line no-restricted-syntax
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.1.2";
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(); // Data is automatically synchronized by reference.
189
-
171
+ this.matchHotMappersSize();
172
+ // Data is automatically synchronized by reference.
190
173
  delete settings.data;
191
174
  }
192
- } // If there are another options changed, update the HOT settings, render the table otherwise.
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;;;;;AAKG;;AACG,SA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Aa,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,MAAM;AACZ,MAAA,SAAA,EA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A,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.1.2 (built at Fri Jul 08 2022 09:09:53 GMT+0200 (Central European Summer Time))
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.1.2"}),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})}));
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,GAShD,SAAUI,EAAYC,GAC1B,IAAMC,EAAkBC,EAAAA,QAAaC,MAAMC,gBACrCC,EAAsC,GAK5C,IAAK,IAAMC,KAHXV,OAAOW,OAAOF,EAAYH,EAAY,QAACM,iBAGpBH,EACjBA,EAAWC,GAAQ,CACjBG,QAASlB,GAIb,IAAK,IAAImB,EAAI,EAAOT,EAAgBU,OAApBD,EAA4BA,IAC1CL,EAAWJ,EAAgBS,IAAM,CAC/BD,QAASlB,GAeb,OAXAc,EAAWO,SAAW,CACpBH,QAASlB,GAGI,aAAXS,IACFK,EAAWQ,GAAK,CACdC,KAAMC,OACNN,QAAgBO,OAAAA,OAAAA,KAAKC,SAASC,SAAS,IAAIC,UAAU,MAIlDd,EASH,SAAUe,EAAkBC,GAChC,IAAMC,EAAyC,GACzCC,EAAqBF,EAAMT,SAEjC,GAAIW,IAAuBhC,EAEzB,IAAK,IAAMiC,KAAYD,EACjB9B,EAAe8B,EAAoBC,IAAaD,EAAmBC,KAAcjC,IACnF+B,EAAcE,GAAYD,EAAmBC,IAMnD,IAAK,IAAMA,KAAYH,EACjB5B,EAAe4B,EAAOG,IAA0B,aAAbA,GAA2BH,EAAMG,KA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fa&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,GAC9C,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAQC,EACtD,CAQM,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,EAAgBS,IAAM,CAC/BD,QAASlB,GAeb,OAXAc,EAAWO,SAAW,CACpBH,QAASlB,GAGI,aAAXS,IACFK,EAAWQ,GAAK,CACdC,KAAMC,OACNN,QAAA,OAAAO,OAAgBC,KAAKC,SAASC,SAAS,IAAIC,UAAU,MAIlDf,CACT,CAQM,SAAUgB,EAAkBC,GAChC,IAAMC,EAAyC,CAAA,EACzCC,EAAqBF,EAAMV,SAEjC,GAAIY,IAAuBjC,EAEzB,IAAK,I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