@handsontable/vue3 14.0.0-next-ecaa005-20231130 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,7 +120,7 @@ function simpleEqual(objectA, objectB) {
120
120
  return JSON.stringify(objectA) === JSON.stringify(objectB);
121
121
  }
122
122
 
123
- var version="14.0.0-next-ecaa005-20231130";
123
+ var version="14.0.0";
124
124
 
125
125
  var HotTable = vue.defineComponent({
126
126
  name: 'HotTable',
@@ -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: 14.0.0-next-ecaa005-20231130 (built at Thu Nov 30 2023 08:42:49 GMT+0000 (Coordinated Universal Time))
28
+ * Version: 14.0.0 (built at Thu Nov 30 2023 10:13:37 GMT+0100 (Central European Standard Time))
29
29
  */
30
30
  (function (global, factory) {
31
31
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('handsontable/base')) :
@@ -148,7 +148,7 @@ function simpleEqual(objectA, objectB) {
148
148
  return JSON.stringify(objectA) === JSON.stringify(objectB);
149
149
  }
150
150
 
151
- var version="14.0.0-next-ecaa005-20231130";
151
+ var version="14.0.0";
152
152
 
153
153
  var HotTable = vue.defineComponent({
154
154
  name: 'HotTable',
@@ -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: 14.0.0-next-ecaa005-20231130 (built at Thu Nov 30 2023 08:42:53 GMT+0000 (Coordinated Universal Time))
28
+ * Version: 14.0.0 (built at Thu Nov 30 2023 10:13:42 GMT+0100 (Central European Standard 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),i=Symbol("unassigned");function s(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a(t){var e=r.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,r.default.DefaultSettings),n)n[o]={default:i};for(var s=0;e.length>s;s++)n[e[s]]={default:i};return n.settings={default:i},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function c(t){var e={},n=t.settings;if(n!==i)for(var o in n)s(n,o)&&n[o]!==i&&(e[o]=n[o]);for(var r in t)s(t,r)&&"settings"!==r&&t[r]!==i&&(e[r]=t[r]);return e}function u(t,e){var n=c(t),o=t.settings?t.settings:n,r=t.settings?n:null,i={};for(var a in o)!s(o,a)||void 0===o[a]||e&&"data"!==a&&l(e[a],o[a])||(i[a]=o[a]);for(var u in r)!s(r,u)||"id"===u||"settings"===u||void 0===r[u]||e&&"data"!==u&&l(e[u],r[u])||(i[u]=r[u]);return i}function l(t,e){return JSON.stringify(t)===JSON.stringify(e)}var h=e.defineComponent({name:"HotTable",props:a("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=u(t,this.hotInstance?this.hotInstance.getSettings():void 0);this.hotInstance&&void 0!==e&&(e.data&&(this.hotInstance.isColumnModificationAllowed()||!this.hotInstance.isColumnModificationAllowed()&&this.hotInstance.countSourceCols()===this.miscCache.currentSourceColumns)&&(this.matchHotMappersSize(),delete e.data),Object.keys(e).length?this.hotInstance.updateSettings(e):this.hotInstance.render(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols())},deep:!0,immediate:!0}},data:function(){return{__hotInstance:null,miscCache:{currentSourceColumns:null},columnSettings:null,columnsCache:new Map,get hotInstance(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set hotInstance(t){this.__hotInstance=t}}},methods:{hotInit:function(){var t=u(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new 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:"14.0.0-next-ecaa005-20231130"}),d=["id"];function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function m(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");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}h.render=function(t,n,o,r,i,s){return e.openBlock(),e.createElementBlock("div",{id:t.id},[e.renderSlot(t.$slots,"default")],8,d)},h.__file="src/HotTable.vue";var p=e.defineComponent({name:"HotColumn",props:a("HotColumn"),inject:["columnsCache"],methods:{createColumnSettings:function(){var t=c(this.$props),e=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);t.renderer&&(e.renderer=t.renderer),t.editor&&(e.editor=t.editor),this.columnsCache.set(this,e)}},mounted:function(){this.createColumnSettings()},unmounted:function(){this.columnsCache.delete(this)},render:function(){return null}});p.__file="src/HotColumn.vue",t.HotColumn=p,t.HotTable=h,t.default=h,Object.defineProperty(t,"__esModule",{value:!0})}));
30
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("handsontable/base")):"function"==typeof define&&define.amd?define(["exports","vue","handsontable/base"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Handsontable=t.Handsontable||{},t.Handsontable.vue={}),t.Vue,t.Handsontable)}(this,(function(t,e,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=o(n),i=Symbol("unassigned");function s(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a(t){var e=r.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,r.default.DefaultSettings),n)n[o]={default:i};for(var s=0;e.length>s;s++)n[e[s]]={default:i};return n.settings={default:i},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function c(t){var e={},n=t.settings;if(n!==i)for(var o in n)s(n,o)&&n[o]!==i&&(e[o]=n[o]);for(var r in t)s(t,r)&&"settings"!==r&&t[r]!==i&&(e[r]=t[r]);return e}function u(t,e){var n=c(t),o=t.settings?t.settings:n,r=t.settings?n:null,i={};for(var a in o)!s(o,a)||void 0===o[a]||e&&"data"!==a&&l(e[a],o[a])||(i[a]=o[a]);for(var u in r)!s(r,u)||"id"===u||"settings"===u||void 0===r[u]||e&&"data"!==u&&l(e[u],r[u])||(i[u]=r[u]);return i}function l(t,e){return JSON.stringify(t)===JSON.stringify(e)}var h=e.defineComponent({name:"HotTable",props:a("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=u(t,this.hotInstance?this.hotInstance.getSettings():void 0);this.hotInstance&&void 0!==e&&(e.data&&(this.hotInstance.isColumnModificationAllowed()||!this.hotInstance.isColumnModificationAllowed()&&this.hotInstance.countSourceCols()===this.miscCache.currentSourceColumns)&&(this.matchHotMappersSize(),delete e.data),Object.keys(e).length?this.hotInstance.updateSettings(e):this.hotInstance.render(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols())},deep:!0,immediate:!0}},data:function(){return{__hotInstance:null,miscCache:{currentSourceColumns:null},columnSettings:null,columnsCache:new Map,get hotInstance(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set hotInstance(t){this.__hotInstance=t}}},methods:{hotInit:function(){var t=u(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new 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:"14.0.0"}),d=["id"];function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function m(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");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}h.render=function(t,n,o,r,i,s){return e.openBlock(),e.createElementBlock("div",{id:t.id},[e.renderSlot(t.$slots,"default")],8,d)},h.__file="src/HotTable.vue";var p=e.defineComponent({name:"HotColumn",props:a("HotColumn"),inject:["columnsCache"],methods:{createColumnSettings:function(){var t=c(this.$props),e=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);t.renderer&&(e.renderer=t.renderer),t.editor&&(e.editor=t.editor),this.columnsCache.set(this,e)}},mounted:function(){this.createColumnSettings()},unmounted:function(){this.columnsCache.delete(this)},render:function(){return null}});p.__file="src/HotColumn.vue",t.HotColumn=p,t.HotTable=h,t.default=h,Object.defineProperty(t,"__esModule",{value:!0})}));
31
31
  //# sourceMappingURL=vue-handsontable.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-handsontable.min.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","prop","assign","DefaultSettings","default","i","length","settings","id","type","String","concat","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","this","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","_this","_data$","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","_createElementBlock","createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","_objectSpread","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;8cAGMA,EAAuBC,OAAO,cAepB,SAAAC,EAAeC,EAAiBC,GAC9C,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAQC,EACtD,CAQM,SAAUI,EAAYC,GAC1B,IAAMC,EAAkBC,EAAAA,QAAaC,MAAMC,gBACrCC,EAAsC,CAAA,EAK5C,IAAK,IAAMC,K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AAK8C,oBAC3B9C,KAAKwB,SACN,EACD2B,cAAa,WACPnD,KAAKI,aACPJ,KAAKI,YAAYgD,SAEpB,EACDC,uwBCrLAC,EAEKC,mBAAA,MAAA,CAFCpF,GAAIqF,EAAErF,IAAA,CACVsF,EAAAA,WAAYD,EAAAE,OAAA,8CCKVC,IAAAA,EAAY/D,EAAAA,gBAAgB,CAChCC,KAAM,YACNjB,MAAOvB,EAAY,aACnBuG,OAAQ,CAAC,gBACTrC,QAAS,CAKPsC,qBAAoB,WAClB,IAAM3E,EAAgBP,EAAkBqB,KAAKE,QACvCgB,iWAAa4C,CAAA,CAAA,EAAS5E,GAExBA,EAAc6E,WAChB7C,EAAe6C,SAAW7E,EAAc6E,UAGtC7E,EAAc8E,SAChB9C,EAAe8C,OAAS9E,EAAc8E,QAGxChE,KAAKD,aAAakE,IAAIjE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK6D,sBACN,EACDK,UAAS,WACPlE,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 return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","prop","assign","DefaultSettings","default","i","length","settings","id","type","String","concat","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","this","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","_this","_data$","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","_createElementBlock","createElementBlock","_ctx","_renderSlot","$slots","HotColumn","in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AS,EAC3B6D,EAAK1B,YAAYqC,kBAAkBG,cAAcV,GAGjDJ,EAAK1B,YAAYqC,kBACdI,cAAcP,EAAyB,EAAGhC,EAAK,GAAGrC,OAASqE,GAGpE,GA/CA,CAgDD,EAODQ,kBAAiB,WACf,IAAM5B,EAAkC6B,MAAMC,KAAKhD,KAAKD,aAAakD,UAErE,OAAO/B,EAAejD,OAASiD,OAAiB,CAClD,GAEFgC,QAAO,WACLlD,KAAKkB,eAAiBlB,KAAK8C,oBAC3B9C,KAAKwB,SACN,EACD2B,cAAa,WACPnD,KAAKI,aACPJ,KAAKI,YAAYgD,SAEpB,EACDC,ivBCrLAC,EAEKC,mBAAA,MAAA,CAFCpF,GAAIqF,EAAErF,IAAA,CACVsF,EAAAA,WAAYD,EAAAE,OAAA,8CCKVC,IAAAA,EAAY/D,EAAAA,gBAAgB,CAChCC,KAAM,YACNjB,MAAOvB,EAAY,aACnBuG,OAAQ,CAAC,gBACTrC,QAAS,CAKPsC,qBAAoB,WAClB,IAAM3E,EAAgBP,EAAkBqB,KAAKE,QACvCgB,iWAAa4C,CAAA,CAAA,EAAS5E,GAExBA,EAAc6E,WAChB7C,EAAe6C,SAAW7E,EAAc6E,UAGtC7E,EAAc8E,SAChB9C,EAAe8C,OAAS9E,EAAc8E,QAGxChE,KAAKD,aAAakE,IAAIjE,KAAMkB,EAC9B,GAEFgC,QAAO,WACLlD,KAAK6D,sBACN,EACDK,UAAS,WACPlE,KAAKD,aAAmB,OAACC,KAC1B,EACDc,OAAM,WACJ,OAAO,IACT"}
@@ -112,7 +112,7 @@ function simpleEqual(objectA, objectB) {
112
112
  return JSON.stringify(objectA) === JSON.stringify(objectB);
113
113
  }
114
114
 
115
- var version="14.0.0-next-ecaa005-20231130";
115
+ var version="14.0.0";
116
116
 
117
117
  var HotTable = defineComponent({
118
118
  name: 'HotTable',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsontable/vue3",
3
- "version": "14.0.0-next-ecaa005-20231130",
3
+ "version": "14.0.0",
4
4
  "description": "Best Data Grid for Vue with Spreadsheet Look and Feel.",
5
5
  "author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
6
6
  "homepage": "https://handsontable.com",
@@ -53,7 +53,7 @@
53
53
  "url": "https://github.com/handsontable/handsontable/issues"
54
54
  },
55
55
  "peerDependencies": {
56
- "handsontable": "14.0.0-next-ecaa005-20231130",
56
+ "handsontable": ">=14.0.0",
57
57
  "vue": "next"
58
58
  },
59
59
  "devDependencies": {
@@ -72,7 +72,7 @@
72
72
  "babel-core": "^7.0.0-bridge.0",
73
73
  "cross-env": "^7.0.3",
74
74
  "eslint-plugin-vue": "^8.0.3",
75
- "handsontable": "14.0.0-next-ecaa005-20231130",
75
+ "handsontable": "^14.0.0",
76
76
  "jest": "^26.6.3",
77
77
  "rimraf": "^3.0.2",
78
78
  "rollup": "^2.0.0",