@handsontable/vue3 15.1.0 → 15.2.0-next-9a1a15b-20250314
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.
|
@@ -41,7 +41,7 @@ function _objectSpread2(e) {
|
|
|
41
41
|
function _toPrimitive(t, r) {
|
|
42
42
|
if ("object" != typeof t || !t) return t;
|
|
43
43
|
var e = t[Symbol.toPrimitive];
|
|
44
|
-
if (
|
|
44
|
+
if (void 0 !== e) {
|
|
45
45
|
var i = e.call(t, r);
|
|
46
46
|
if ("object" != typeof i) return i;
|
|
47
47
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -148,13 +148,13 @@ function prepareSettings(props, currentSettings) {
|
|
|
148
148
|
var newSettings = {};
|
|
149
149
|
// eslint-disable-next-line no-restricted-syntax
|
|
150
150
|
for (var key in hotSettingsInProps) {
|
|
151
|
-
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !==
|
|
151
|
+
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
152
152
|
newSettings[key] = hotSettingsInProps[key];
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
// eslint-disable-next-line no-restricted-syntax
|
|
156
156
|
for (var _key in additionalHotSettingsInProps) {
|
|
157
|
-
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !==
|
|
157
|
+
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
158
158
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -194,7 +194,7 @@ function simpleEqual(objectA, objectB) {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
var version="15.
|
|
197
|
+
var version="15.2.0-next-9a1a15b-20250314";
|
|
198
198
|
|
|
199
199
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
200
200
|
// @ts-ignore
|
|
@@ -209,8 +209,8 @@ var HotTable = vue.defineComponent({
|
|
|
209
209
|
watch: {
|
|
210
210
|
$props: {
|
|
211
211
|
handler: function handler(props) {
|
|
212
|
-
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() :
|
|
213
|
-
if (!this.hotInstance || settings ===
|
|
212
|
+
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
213
|
+
if (!this.hotInstance || settings === void 0) {
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
if (settings.data) {
|
|
@@ -290,7 +290,7 @@ var HotTable = vue.defineComponent({
|
|
|
290
290
|
if (isColumnModificationAllowed) {
|
|
291
291
|
var _data$;
|
|
292
292
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
293
|
-
if (data && data[0] && ((_data$ = data[0]) === null || _data$ ===
|
|
293
|
+
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
294
294
|
if (data[0].length < indexMapperColumnCount) {
|
|
295
295
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
296
296
|
columnsToRemove.push(c);
|
|
@@ -320,7 +320,7 @@ var HotTable = vue.defineComponent({
|
|
|
320
320
|
*/
|
|
321
321
|
getColumnSettings: function getColumnSettings() {
|
|
322
322
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
323
|
-
return columnSettings.length ? columnSettings :
|
|
323
|
+
return columnSettings.length ? columnSettings : void 0;
|
|
324
324
|
}
|
|
325
325
|
},
|
|
326
326
|
mounted: function mounted() {
|
package/dist/vue-handsontable.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
|
26
26
|
* USE OR INABILITY TO USE THIS SOFTWARE.
|
|
27
27
|
*
|
|
28
|
-
* Version: 15.
|
|
28
|
+
* Version: 15.2.0-next-9a1a15b-20250314 (built at Fri Mar 14 2025 11:52:31 GMT+0000 (Coordinated Universal Time))
|
|
29
29
|
*/
|
|
30
30
|
(function (global, factory) {
|
|
31
31
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('handsontable/base')) :
|
|
@@ -69,7 +69,7 @@ function _objectSpread2(e) {
|
|
|
69
69
|
function _toPrimitive(t, r) {
|
|
70
70
|
if ("object" != typeof t || !t) return t;
|
|
71
71
|
var e = t[Symbol.toPrimitive];
|
|
72
|
-
if (
|
|
72
|
+
if (void 0 !== e) {
|
|
73
73
|
var i = e.call(t, r);
|
|
74
74
|
if ("object" != typeof i) return i;
|
|
75
75
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -176,13 +176,13 @@ function prepareSettings(props, currentSettings) {
|
|
|
176
176
|
var newSettings = {};
|
|
177
177
|
// eslint-disable-next-line no-restricted-syntax
|
|
178
178
|
for (var key in hotSettingsInProps) {
|
|
179
|
-
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !==
|
|
179
|
+
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
180
180
|
newSettings[key] = hotSettingsInProps[key];
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
// eslint-disable-next-line no-restricted-syntax
|
|
184
184
|
for (var _key in additionalHotSettingsInProps) {
|
|
185
|
-
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !==
|
|
185
|
+
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
186
186
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -222,7 +222,7 @@ function simpleEqual(objectA, objectB) {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
var version="15.
|
|
225
|
+
var version="15.2.0-next-9a1a15b-20250314";
|
|
226
226
|
|
|
227
227
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
228
228
|
// @ts-ignore
|
|
@@ -237,8 +237,8 @@ var HotTable = vue.defineComponent({
|
|
|
237
237
|
watch: {
|
|
238
238
|
$props: {
|
|
239
239
|
handler: function handler(props) {
|
|
240
|
-
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() :
|
|
241
|
-
if (!this.hotInstance || settings ===
|
|
240
|
+
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
241
|
+
if (!this.hotInstance || settings === void 0) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
if (settings.data) {
|
|
@@ -318,7 +318,7 @@ var HotTable = vue.defineComponent({
|
|
|
318
318
|
if (isColumnModificationAllowed) {
|
|
319
319
|
var _data$;
|
|
320
320
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
321
|
-
if (data && data[0] && ((_data$ = data[0]) === null || _data$ ===
|
|
321
|
+
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
322
322
|
if (data[0].length < indexMapperColumnCount) {
|
|
323
323
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
324
324
|
columnsToRemove.push(c);
|
|
@@ -348,7 +348,7 @@ var HotTable = vue.defineComponent({
|
|
|
348
348
|
*/
|
|
349
349
|
getColumnSettings: function getColumnSettings() {
|
|
350
350
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
351
|
-
return columnSettings.length ? columnSettings :
|
|
351
|
+
return columnSettings.length ? columnSettings : void 0;
|
|
352
352
|
}
|
|
353
353
|
},
|
|
354
354
|
mounted: function mounted() {
|
|
@@ -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 const stringifyToJSON = (val) => {\n const circularReplacer = (function() {\n const seen = new WeakSet();\n\n return function(key, value) {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return;\n }\n\n seen.add(value);\n }\n\n return value;\n };\n }());\n\n return JSON.stringify(val, circularReplacer);\n };\n\n if (typeof objectA === 'function' && typeof objectB === 'function') {\n return objectA.toString() === objectB.toString();\n\n } else if (typeof objectA !== typeof objectB) {\n return false;\n\n } else {\n return stringifyToJSON(objectA) === stringifyToJSON(objectB);\n }\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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","concat","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","stringifyToJSON","val","circularReplacer","seen","WeakSet","value","_typeof","has","add","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","_this","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","_data$","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","packageJson","_createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","_objectSpread","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAMA,oBAAoB,GAAGC,MAAM,CAAC,YAAY,CAAC;AAEjD;;AAEG;AACI,IAAMC,qBAAqB,GAAG,+EAA+E,GAClH,iBAAiB;AAEnB;;;;;;AAMG;AACa,SAAAC,cAAcA,CAACC,MAAe,EAAEC,GAAW,EAAA;EACzD,OAAOC,MAAM,CAACC,SAAS,CAACJ,cAAc,CAACK,IAAI,CAACJ,MAAM,EAAEC,GAAG,CAAC;AAC1D;AAEA;;;;;AAKG;AACG,SAAUI,WAAWA,CAACC,MAAgC,EAAA;EAC1D,IAAMC,eAAe,GAAGC,gCAAY,CAACC,KAAK,CAACC,aAAa,EAAE;EAC1D,IAAMC,UAAU,GAA4B,EAAE;EAE9CT,MAAM,CAACU,MAAM,CAACD,UAAU,EAAEH,gCAAY,CAACK,eAAe,CAAC;AAEvD;AACA,EAAA,KAAK,IAAMC,IAAI,IAAIH,UAAU,EAAE;IAC7BA,UAAU,CAACG,IAAI,CAAC,GAAG;MACjB,SAASlB,EAAAA;KACV;AACF;AAED,EAAA,KAAK,IAAImB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,eAAe,CAACS,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AE,EAAE6F,IAAE,CAAA7F;AAAA,GAAA,EAAA,CACV8F,cAAY,CAAAD,IAAA,CAAAE,MAAA,EAAA,SAAA,CAAA;;;;;;ACUVC,IAAAA,SAAU,GAAE9D,mBAAe,CAAC;AAChCC,EAAAA,IAAI,EAAE,WAAW;AACjB1B,EAAAA,KAAK,EAAEtB,WAAW,CAAC,WAAW,CAAC;EAC/B8G,MAAM,EAAE,CAAC,cAAc,CAAC;AACxBrC,EAAAA,OAAO,EAAE;AACP;;;AAGE;IACFsC,oBAAoB,EAAA,SAApBA,oBAAoBA,GAAA;AAClB,MAAA,IAAMnF,gBAAgBP,iBAAiB,CAAC,IAAI,CAAC+B,MAAM,CAAC;AACpD,MAAA,IAAMgB,cAAa,GAAA4C,cAAA,CAAA,EAAA,EAASpF,cAAe;MAE3C,IAAIA,aAAa,CAACqF,QAAQ,EAAE;AAC1B7C,QAAAA,cAAc,CAAC6C,QAAO,GAAIrF,aAAa,CAACqF,QAAQ;AAClD;MAEA,IAAIrF,aAAa,CAACsF,MAAM,EAAE;AACxB9C,QAAAA,cAAc,CAAC8C,MAAK,GAAItF,aAAa,CAACsF,MAAM;AAC9C;MAEA,IAAI,CAAChE,YAAY,CAACiE,GAAG,CAAC,IAAI,EAAE/C,cAAc,CAAC;AAC7C;GACD;EACDgC,OAAO,EAAA,SAAPA,OAAOA,GAAA;IACL,IAAI,CAACW,oBAAoB,EAAE;GAC5B;EACDK,SAAS,EAAA,SAATA,SAASA,GAAA;AACP,IAAA,IAAI,CAAClE,YAAY,CAAO,QAAA,CAAA,CAAC,IAAI,CAAC;GAC/B;EACDc,MAAM,EAAA,SAANA,MAAMA,GAAA;AACJ,IAAA,OAAO,IAAI;AACb;AACD,CAAA;;;;;;;;;;;;;;"}
|
|
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 const stringifyToJSON = (val) => {\n const circularReplacer = (function() {\n const seen = new WeakSet();\n\n return function(key, value) {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return;\n }\n\n seen.add(value);\n }\n\n return value;\n };\n }());\n\n return JSON.stringify(val, circularReplacer);\n };\n\n if (typeof objectA === 'function' && typeof objectB === 'function') {\n return objectA.toString() === objectB.toString();\n\n } else if (typeof objectA !== typeof objectB) {\n return false;\n\n } else {\n return stringifyToJSON(objectA) === stringifyToJSON(objectB);\n }\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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","concat","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","stringifyToJSON","val","circularReplacer","seen","WeakSet","value","_typeof","has","add","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","_this","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","_data$","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","packageJson","_createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","_objectSpread","renderer","editor","set","unmounted"],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AAI,CAAC+B,MAAM,CAAC;AACpD,MAAA,IAAMgB,cAAa,GAAA4C,cAAA,CAAA,EAAA,EAASpF,cAAe;MAE3C,IAAIA,aAAa,CAACqF,QAAQ,EAAE;AAC1B7C,QAAAA,cAAc,CAAC6C,QAAO,GAAIrF,aAAa,CAACqF,QAAQ;AAClD;MAEA,IAAIrF,aAAa,CAACsF,MAAM,EAAE;AACxB9C,QAAAA,cAAc,CAAC8C,MAAK,GAAItF,aAAa,CAACsF,MAAM;AAC9C;MAEA,IAAI,CAAChE,YAAY,CAACiE,GAAG,CAAC,IAAI,EAAE/C,cAAc,CAAC;AAC7C;GACD;EACDgC,OAAO,EAAA,SAAPA,OAAOA,GAAA;IACL,IAAI,CAACW,oBAAoB,EAAE;GAC5B;EACDK,SAAS,EAAA,SAATA,SAASA,GAAA;AACP,IAAA,IAAI,CAAClE,YAAY,CAAO,QAAA,CAAA,CAAC,IAAI,CAAC;GAC/B;EACDc,MAAM,EAAA,SAANA,MAAMA,GAAA;AACJ,IAAA,OAAO,IAAI;AACb;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: 15.
|
|
28
|
+
* Version: 15.2.0-next-9a1a15b-20250314 (built at Fri Mar 14 2025 11:52:35 GMT+0000 (Coordinated Universal 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 r=o(n);function i(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(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 a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}var c=Symbol("unassigned");function u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function l(t){var e=r.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,r.default.DefaultSettings),n)n[o]={default:c};for(var i=0;e.length>i;i++)n[e[i]]={default:c};return n.settings={default:c},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function h(t){var e={},n=t.settings;if(n!==c)for(var o in n)u(n,o)&&n[o]!==c&&(e[o]=n[o]);for(var r in t)u(t,r)&&"settings"!==r&&t[r]!==c&&(e[r]=t[r]);return e}function f(t,e){var n=h(t),o=t.settings?t.settings:n,r=t.settings?n:null,i={};for(var s in o)!u(o,s)||void 0===o[s]||e&&"data"!==s&&d(e[s],o[s])||(i[s]=o[s]);for(var a in r)!u(r,a)||"id"===a||"settings"===a||void 0===r[a]||e&&"data"!==a&&d(e[a],r[a])||(i[a]=r[a]);return i}function d(t,e){var n=function(t){var e,n=(e=new WeakSet,function(t,n){if("object"===a(n)&&null!==n){if(e.has(n))return;e.add(n)}return n});return JSON.stringify(t,n)};return"function"==typeof t&&"function"==typeof e?""+t==""+e:a(t)===a(e)&&n(t)===n(e)}var p=e.defineComponent({name:"HotTable",props:l("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=f(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=f(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new r.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=[],r=[],i=this.hotInstance.rowIndexMapper.getNumberOfIndexes(),s=this.hotInstance.isColumnModificationAllowed(),a=0;if(n&&n.length!==i&&i>n.length)for(var c=n.length;i>c;c++)o.push(c);if(s)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++)r.push(u);this.hotInstance.batch((function(){o.length>0?t.hotInstance.rowIndexMapper.removeIndexes(o):t.hotInstance.rowIndexMapper.insertIndexes(i-1,n.length-i),s&&0!==n.length&&(r.length>0?t.hotInstance.columnIndexMapper.removeIndexes(r):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:"15.
|
|
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 r=o(n);function i(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(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 a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}var c=Symbol("unassigned");function u(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function l(t){var e=r.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,r.default.DefaultSettings),n)n[o]={default:c};for(var i=0;e.length>i;i++)n[e[i]]={default:c};return n.settings={default:c},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function h(t){var e={},n=t.settings;if(n!==c)for(var o in n)u(n,o)&&n[o]!==c&&(e[o]=n[o]);for(var r in t)u(t,r)&&"settings"!==r&&t[r]!==c&&(e[r]=t[r]);return e}function f(t,e){var n=h(t),o=t.settings?t.settings:n,r=t.settings?n:null,i={};for(var s in o)!u(o,s)||void 0===o[s]||e&&"data"!==s&&d(e[s],o[s])||(i[s]=o[s]);for(var a in r)!u(r,a)||"id"===a||"settings"===a||void 0===r[a]||e&&"data"!==a&&d(e[a],r[a])||(i[a]=r[a]);return i}function d(t,e){var n=function(t){var e,n=(e=new WeakSet,function(t,n){if("object"===a(n)&&null!==n){if(e.has(n))return;e.add(n)}return n});return JSON.stringify(t,n)};return"function"==typeof t&&"function"==typeof e?""+t==""+e:a(t)===a(e)&&n(t)===n(e)}var p=e.defineComponent({name:"HotTable",props:l("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=f(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=f(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new r.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=[],r=[],i=this.hotInstance.rowIndexMapper.getNumberOfIndexes(),s=this.hotInstance.isColumnModificationAllowed(),a=0;if(n&&n.length!==i&&i>n.length)for(var c=n.length;i>c;c++)o.push(c);if(s)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++)r.push(u);this.hotInstance.batch((function(){o.length>0?t.hotInstance.rowIndexMapper.removeIndexes(o):t.hotInstance.rowIndexMapper.insertIndexes(i-1,n.length-i),s&&0!==n.length&&(r.length>0?t.hotInstance.columnIndexMapper.removeIndexes(r):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:"15.2.0-next-9a1a15b-20250314"}),m=["id"];p.render=function(t,n,o,r,i,s){return e.openBlock(),e.createElementBlock("div",{id:t.id},[e.renderSlot(t.$slots,"default")],8,m)},p.__file="src/HotTable.vue";var b=e.defineComponent({name:"HotColumn",props:l("HotColumn"),inject:["columnsCache"],methods:{createColumnSettings:function(){var t=h(this.$props),e=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(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}});b.__file="src/HotColumn.vue",t.HotColumn=b,t.HotTable=p,t.default=p,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 const stringifyToJSON = (val) => {\n const circularReplacer = (function() {\n const seen = new WeakSet();\n\n return function(key, value) {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return;\n }\n\n seen.add(value);\n }\n\n return value;\n };\n }());\n\n return JSON.stringify(val, circularReplacer);\n };\n\n if (typeof objectA === 'function' && typeof objectB === 'function') {\n return objectA.toString() === objectB.toString();\n\n } else if (typeof objectA !== typeof objectB) {\n return false;\n\n } else {\n return stringifyToJSON(objectA) === stringifyToJSON(objectB);\n }\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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","undefined","simpleEqual","objectA","objectB","stringifyToJSON","val","seen","circularReplacer","WeakSet","value","_typeof","has","add","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","_objectSpread","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;o0CAGA,IAAMA,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,CAAE,EAK9C,IAAK,IAAMC,KAHXV,OAAOW,OAAOF,EAAYH,EAAAA,QAAaM,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,CAAE,EAC3CC,EAAqBF,EAAMV,SAEjC,GAAIY,IAAuBjC,EAEzB,IAAK,IAAMkC,KAAYD,EACjB/B,EAAe+B,EAAoBC,IAAaD,EAAmBC,KAAclC,IACnFgC,EAAcE,GAAYD,EAAmBC,IAMnD,IAAK,IAAMA,KAAYH,EACjB7B,EAAe6B,EAAOG,IAA0B,aAAbA,GAA2BH,EAAMG,KAAclC,IACpFgC,EAAcE,GAAYH,EAAMG,IAIpC,OAAOF,CACT,CASgB,SAAAG,EAAgBJ,EAAsBK,GACpD,IAAMC,EAAyCP,EAAkBC,GA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cwF,WAChB9C,EAAe8C,SAAWxF,EAAcwF,UAGtCxF,EAAcyF,SAChB/C,EAAe+C,OAASzF,EAAcyF,QAGxCjE,KAAKD,aAAamE,IAAIlE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK8D,sBACN,EACDK,UAAS,WACPnE,KAAKD,aAAmB,OAACC,KAC1B,EACDc,OAAM,WACJ,OAAO,IACT"}
|
|
1
|
+
{"version":3,"file":"vue-handsontable.min.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n const stringifyToJSON = (val) => {\n const circularReplacer = (function() {\n const seen = new WeakSet();\n\n return function(key, value) {\n if (typeof value === 'object' && value !== null) {\n if (seen.has(value)) {\n return;\n }\n\n seen.add(value);\n }\n\n return value;\n };\n }());\n\n return JSON.stringify(val, circularReplacer);\n };\n\n if (typeof objectA === 'function' && typeof objectB === 'function') {\n return objectA.toString() === objectB.toString();\n\n } else if (typeof objectA !== typeof objectB) {\n return false;\n\n } else {\n return stringifyToJSON(objectA) === stringifyToJSON(objectB);\n }\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent, VNode, markRaw } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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\">\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport { defineComponent } from 'vue';\n// TODO: The line above is ts-ignored because rollup-plugin-typescript2 throws an error otherwise.\n// It's most probably caused by outdated rollup-plugin-vue which is no longer maintained.\n\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","stringifyToJSON","val","seen","circularReplacer","WeakSet","value","_typeof","has","add","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","_objectSpread","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;o0CAGA,IAAMA,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,CAAE,EAK9C,IAAK,IAAMC,KAHXV,OAAOW,OAAOF,EAAYH,EAAAA,QAAaM,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,CAAE,EAC3CC,EAAqBF,EAAMV,SAEjC,GAAIY,IAAuBjC,EAEzB,IAAK,IAAMkC,KAAYD,EACjB/B,EAAe+B,EAAoBC,IAAaD,EAAmBC,KAAclC,IACnFgC,EAAcE,GAAYD,EAAmBC,IAMnD,IAAK,I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,KAAM,YACN1B,MAAOvB,EAAY,aACnBiH,OAAQ,CAAC,gBACTtC,QAAS,CAKPuC,qBAAoB,WAClB,IAAMrF,EAAgBP,EAAkB8B,KAAKE,QACvCgB,iWAAa6C,CAAA,CAAA,EAAStF,GAExBA,EAAcuF,WAChB9C,EAAe8C,SAAWvF,EAAcuF,UAGtCvF,EAAcwF,SAChB/C,EAAe+C,OAASxF,EAAcwF,QAGxCjE,KAAKD,aAAamE,IAAIlE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK8D,sBACN,EACDK,UAAS,WACPnE,KAAKD,aAAmB,OAACC,KAC1B,EACDc,OAAM,WACJ,OAAO,IACT"}
|
package/es/vue-handsontable.mjs
CHANGED
|
@@ -33,7 +33,7 @@ function _objectSpread2(e) {
|
|
|
33
33
|
function _toPrimitive(t, r) {
|
|
34
34
|
if ("object" != typeof t || !t) return t;
|
|
35
35
|
var e = t[Symbol.toPrimitive];
|
|
36
|
-
if (
|
|
36
|
+
if (void 0 !== e) {
|
|
37
37
|
var i = e.call(t, r);
|
|
38
38
|
if ("object" != typeof i) return i;
|
|
39
39
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -140,13 +140,13 @@ function prepareSettings(props, currentSettings) {
|
|
|
140
140
|
var newSettings = {};
|
|
141
141
|
// eslint-disable-next-line no-restricted-syntax
|
|
142
142
|
for (var key in hotSettingsInProps) {
|
|
143
|
-
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !==
|
|
143
|
+
if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
|
|
144
144
|
newSettings[key] = hotSettingsInProps[key];
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
// eslint-disable-next-line no-restricted-syntax
|
|
148
148
|
for (var _key in additionalHotSettingsInProps) {
|
|
149
|
-
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !==
|
|
149
|
+
if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
|
|
150
150
|
newSettings[_key] = additionalHotSettingsInProps[_key];
|
|
151
151
|
}
|
|
152
152
|
}
|
|
@@ -186,7 +186,7 @@ function simpleEqual(objectA, objectB) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
var version="15.
|
|
189
|
+
var version="15.2.0-next-9a1a15b-20250314";
|
|
190
190
|
|
|
191
191
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
192
192
|
// @ts-ignore
|
|
@@ -201,8 +201,8 @@ var HotTable = defineComponent({
|
|
|
201
201
|
watch: {
|
|
202
202
|
$props: {
|
|
203
203
|
handler: function handler(props) {
|
|
204
|
-
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() :
|
|
205
|
-
if (!this.hotInstance || settings ===
|
|
204
|
+
var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
|
|
205
|
+
if (!this.hotInstance || settings === void 0) {
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
208
|
if (settings.data) {
|
|
@@ -282,7 +282,7 @@ var HotTable = defineComponent({
|
|
|
282
282
|
if (isColumnModificationAllowed) {
|
|
283
283
|
var _data$;
|
|
284
284
|
indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
|
|
285
|
-
if (data && data[0] && ((_data$ = data[0]) === null || _data$ ===
|
|
285
|
+
if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
|
|
286
286
|
if (data[0].length < indexMapperColumnCount) {
|
|
287
287
|
for (var c = data[0].length; c < indexMapperColumnCount; c++) {
|
|
288
288
|
columnsToRemove.push(c);
|
|
@@ -312,7 +312,7 @@ var HotTable = defineComponent({
|
|
|
312
312
|
*/
|
|
313
313
|
getColumnSettings: function getColumnSettings() {
|
|
314
314
|
var columnSettings = Array.from(this.columnsCache.values());
|
|
315
|
-
return columnSettings.length ? columnSettings :
|
|
315
|
+
return columnSettings.length ? columnSettings : void 0;
|
|
316
316
|
}
|
|
317
317
|
},
|
|
318
318
|
mounted: function mounted() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsontable/vue3",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.2.0-next-9a1a15b-20250314",
|
|
4
4
|
"description": "Best Data Grid for Vue with Spreadsheet Look and Feel.",
|
|
5
5
|
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
|
|
6
6
|
"homepage": "https://handsontable.com",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"url": "https://github.com/handsontable/handsontable/issues"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"handsontable": "
|
|
56
|
+
"handsontable": "15.2.0-next-9a1a15b-20250314",
|
|
57
57
|
"vue": "^3.2.22"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@vue/test-utils": "2.0.0-rc.16",
|
|
78
78
|
"cross-env": "^7.0.3",
|
|
79
79
|
"eslint-plugin-vue": "^8.0.3",
|
|
80
|
-
"handsontable": "
|
|
80
|
+
"handsontable": "15.2.0-next-9a1a15b-20250314",
|
|
81
81
|
"jest": "^26.6.3",
|
|
82
82
|
"rimraf": "^3.0.2",
|
|
83
83
|
"rollup": "^4.16.1",
|