@handsontable/vue3 0.0.0-next-9ec04ce-20221121

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.
@@ -0,0 +1,30 @@
1
+ import { VNode } from 'vue';
2
+ import Handsontable from 'handsontable/base';
3
+ import { HotTableProps } from './types';
4
+ declare const HotTable: import("vue").DefineComponent<import("./types").VueProps<HotTableProps>, unknown, {
5
+ __hotInstance: Handsontable;
6
+ miscCache: {
7
+ currentSourceColumns: any;
8
+ };
9
+ columnSettings: HotTableProps[];
10
+ columnsCache: Map<VNode<import("vue").RendererNode, import("vue").RendererElement, {
11
+ [key: string]: any;
12
+ }>, HotTableProps>;
13
+ hotInstance: Handsontable;
14
+ }, {}, {
15
+ /**
16
+ * Initialize Handsontable.
17
+ */
18
+ hotInit(): void;
19
+ matchHotMappersSize(): void;
20
+ /**
21
+ * Get settings for the columns provided in the `hot-column` components.
22
+ *
23
+ * @returns {HotTableProps[] | undefined}
24
+ */
25
+ getColumnSettings(): HotTableProps[] | void;
26
+ }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<import("./types").VueProps<HotTableProps>>>, {
27
+ [x: string]: any;
28
+ }>;
29
+ export default HotTable;
30
+ export { HotTable };
@@ -0,0 +1,36 @@
1
+ import Handsontable from 'handsontable/base';
2
+ import { HotTableProps, VueProps } from './types';
3
+ /**
4
+ * Message for the warning thrown if the Handsontable instance has been destroyed.
5
+ */
6
+ export declare const HOT_DESTROYED_WARNING: string;
7
+ /**
8
+ * Check if at specified `key` there is any value for `object`.
9
+ *
10
+ * @param {object} object Object to search value at specyfic key.
11
+ * @param {string} key String key to check.
12
+ * @returns {boolean}
13
+ */
14
+ export declare function hasOwnProperty(object: unknown, key: string): boolean;
15
+ /**
16
+ * Generate an object containing all the available Handsontable properties and plugin hooks.
17
+ *
18
+ * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
19
+ * @returns {object}
20
+ */
21
+ export declare function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps>;
22
+ /**
23
+ * Filter out all of the unassigned props, and return only the one passed to the component.
24
+ *
25
+ * @param {object} props Object containing all the possible props.
26
+ * @returns {object} Object containing only used props.
27
+ */
28
+ export declare function filterPassedProps(props: any): VueProps<HotTableProps>;
29
+ /**
30
+ * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.
31
+ *
32
+ * @param {HotTableProps} props The props passed to the component.
33
+ * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
34
+ * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
35
+ */
36
+ export declare function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps;
@@ -0,0 +1,3 @@
1
+ import HotTable from './HotTable.vue';
2
+ import HotColumn from './HotColumn.vue';
3
+ export { HotTable as default, HotTable, HotColumn };
@@ -0,0 +1,9 @@
1
+ import Handsontable from 'handsontable/base';
2
+ export interface HotTableProps extends Handsontable.GridSettings {
3
+ id?: string;
4
+ settings?: Handsontable.GridSettings;
5
+ [additional: string]: any;
6
+ }
7
+ export declare type VueProps<T> = {
8
+ [P in keyof T]: any;
9
+ };
@@ -0,0 +1,376 @@
1
+ /*!
2
+ * Copyright (c) HANDSONCODE sp. z o. o.
3
+ *
4
+ * HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in
5
+ * Gdynia, Poland, at Aleja Zwycięstwa 96-98, registered by the District Court in Gdansk under number
6
+ * 538651, EU tax ID number: PL5862294002, share capital: PLN 62,800.00.
7
+ *
8
+ * This software is protected by applicable copyright laws, including international treaties, and dual-
9
+ * licensed – depending on whether your use for commercial purposes, meaning intended for or
10
+ * resulting in commercial advantage or monetary compensation, or not.
11
+ *
12
+ * If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
13
+ * the suitability, performance, and usefulness of this software outside the production environment,
14
+ * you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file.
15
+ *
16
+ * Your use of this software for commercial purposes is subject to the terms included in an applicable
17
+ * license agreement.
18
+ *
19
+ * In any case, you must not make any such use of this software as to develop software which may be
20
+ * considered competitive with this software.
21
+ *
22
+ * UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS"
23
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO
24
+ * LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
25
+ * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
+ * USE OR INABILITY TO USE THIS SOFTWARE.
27
+ *
28
+ * Version: 0.0.0-next-9ec04ce-20221121 (built at Mon Nov 21 2022 14:49:14 GMT+0000 (Coordinated Universal Time))
29
+ */
30
+ (function (global, factory) {
31
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('handsontable/base')) :
32
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', 'handsontable/base'], factory) :
33
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.Handsontable = global.Handsontable || {}, global.Handsontable.vue = {}), global.Vue, global.Handsontable));
34
+ })(this, (function (exports, vue, Handsontable) { 'use strict';
35
+
36
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
37
+
38
+ var Handsontable__default = /*#__PURE__*/_interopDefaultLegacy(Handsontable);
39
+
40
+ var unassignedPropSymbol = Symbol('unassigned');
41
+ /**
42
+ * Message for the warning thrown if the Handsontable instance has been destroyed.
43
+ */
44
+ var HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' + ' used properly.';
45
+ /**
46
+ * Check if at specified `key` there is any value for `object`.
47
+ *
48
+ * @param {object} object Object to search value at specyfic key.
49
+ * @param {string} key String key to check.
50
+ * @returns {boolean}
51
+ */
52
+ function hasOwnProperty(object, key) {
53
+ return Object.prototype.hasOwnProperty.call(object, key);
54
+ }
55
+ /**
56
+ * Generate an object containing all the available Handsontable properties and plugin hooks.
57
+ *
58
+ * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
59
+ * @returns {object}
60
+ */
61
+ function propFactory(source) {
62
+ var registeredHooks = Handsontable__default["default"].hooks.getRegistered();
63
+ var propSchema = {};
64
+ Object.assign(propSchema, Handsontable__default["default"].DefaultSettings);
65
+ // eslint-disable-next-line no-restricted-syntax, guard-for-in
66
+ for (var prop in propSchema) {
67
+ propSchema[prop] = {
68
+ "default": unassignedPropSymbol
69
+ };
70
+ }
71
+ for (var i = 0; i < registeredHooks.length; i++) {
72
+ propSchema[registeredHooks[i]] = {
73
+ "default": unassignedPropSymbol
74
+ };
75
+ }
76
+ propSchema.settings = {
77
+ "default": unassignedPropSymbol
78
+ };
79
+ if (source === 'HotTable') {
80
+ propSchema.id = {
81
+ type: String,
82
+ "default": "hot-".concat(Math.random().toString(36).substring(5))
83
+ };
84
+ }
85
+ return propSchema;
86
+ }
87
+ /**
88
+ * Filter out all of the unassigned props, and return only the one passed to the component.
89
+ *
90
+ * @param {object} props Object containing all the possible props.
91
+ * @returns {object} Object containing only used props.
92
+ */
93
+ function filterPassedProps(props) {
94
+ var filteredProps = {};
95
+ var columnSettingsProp = props.settings;
96
+ if (columnSettingsProp !== unassignedPropSymbol) {
97
+ // eslint-disable-next-line no-restricted-syntax
98
+ for (var propName in columnSettingsProp) {
99
+ if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {
100
+ filteredProps[propName] = columnSettingsProp[propName];
101
+ }
102
+ }
103
+ }
104
+ // eslint-disable-next-line no-restricted-syntax
105
+ for (var _propName in props) {
106
+ if (hasOwnProperty(props, _propName) && _propName !== 'settings' && props[_propName] !== unassignedPropSymbol) {
107
+ filteredProps[_propName] = props[_propName];
108
+ }
109
+ }
110
+ return filteredProps;
111
+ }
112
+ /**
113
+ * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.
114
+ *
115
+ * @param {HotTableProps} props The props passed to the component.
116
+ * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
117
+ * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
118
+ */
119
+ function prepareSettings(props, currentSettings) {
120
+ var assignedProps = filterPassedProps(props);
121
+ var hotSettingsInProps = props.settings ? props.settings : assignedProps;
122
+ var additionalHotSettingsInProps = props.settings ? assignedProps : null;
123
+ var newSettings = {};
124
+ // eslint-disable-next-line no-restricted-syntax
125
+ for (var key in hotSettingsInProps) {
126
+ if (hasOwnProperty(hotSettingsInProps, key) && hotSettingsInProps[key] !== void 0 && (currentSettings && key !== 'data' ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)) {
127
+ newSettings[key] = hotSettingsInProps[key];
128
+ }
129
+ }
130
+ // eslint-disable-next-line no-restricted-syntax
131
+ for (var _key in additionalHotSettingsInProps) {
132
+ if (hasOwnProperty(additionalHotSettingsInProps, _key) && _key !== 'id' && _key !== 'settings' && additionalHotSettingsInProps[_key] !== void 0 && (currentSettings && _key !== 'data' ? !simpleEqual(currentSettings[_key], additionalHotSettingsInProps[_key]) : true)) {
133
+ newSettings[_key] = additionalHotSettingsInProps[_key];
134
+ }
135
+ }
136
+ return newSettings;
137
+ }
138
+ /**
139
+ * Compare two objects using `JSON.stringify`.
140
+ * *Note: * As it's using the stringify function to compare objects, the property order in both objects is
141
+ * important. It will return `false` for the same objects, if they're defined in a different order.
142
+ *
143
+ * @param {object} objectA First object to compare.
144
+ * @param {object} objectB Second object to compare.
145
+ * @returns {boolean} `true` if they're the same, `false` otherwise.
146
+ */
147
+ function simpleEqual(objectA, objectB) {
148
+ return JSON.stringify(objectA) === JSON.stringify(objectB);
149
+ }
150
+
151
+ var version="0.0.0-next-9ec04ce-20221121";
152
+
153
+ var HotTable = vue.defineComponent({
154
+ name: 'HotTable',
155
+ props: propFactory('HotTable'),
156
+ provide: function provide() {
157
+ return {
158
+ columnsCache: this.columnsCache
159
+ };
160
+ },
161
+ watch: {
162
+ $props: {
163
+ handler: function handler(props) {
164
+ var settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);
165
+ if (!this.hotInstance || settings === void 0) {
166
+ return;
167
+ }
168
+ if (settings.data) {
169
+ if (this.hotInstance.isColumnModificationAllowed() || !this.hotInstance.isColumnModificationAllowed() && this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns) {
170
+ // If the dataset dimensions change, update the index mappers.
171
+ this.matchHotMappersSize();
172
+ // Data is automatically synchronized by reference.
173
+ delete settings.data;
174
+ }
175
+ }
176
+ // If there are another options changed, update the HOT settings, render the table otherwise.
177
+ if (Object.keys(settings).length) {
178
+ this.hotInstance.updateSettings(settings);
179
+ } else {
180
+ this.hotInstance.render();
181
+ }
182
+ this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();
183
+ },
184
+ deep: true,
185
+ immediate: true
186
+ }
187
+ },
188
+ data: function data() {
189
+ return {
190
+ /* eslint-disable vue/no-reserved-keys */
191
+ __hotInstance: null,
192
+ /* eslint-enable vue/no-reserved-keys */
193
+ miscCache: {
194
+ currentSourceColumns: null
195
+ },
196
+ columnSettings: null,
197
+ columnsCache: new Map(),
198
+ get hotInstance() {
199
+ if (!this.__hotInstance || this.__hotInstance && !this.__hotInstance.isDestroyed) {
200
+ // Will return the Handsontable instance or `null` if it's not yet been created.
201
+ return this.__hotInstance;
202
+ } else {
203
+ /* eslint-disable-next-line no-console */
204
+ console.warn(HOT_DESTROYED_WARNING);
205
+ return null;
206
+ }
207
+ },
208
+ set hotInstance(hotInstance) {
209
+ this.__hotInstance = hotInstance;
210
+ }
211
+ };
212
+ },
213
+ methods: {
214
+ /**
215
+ * Initialize Handsontable.
216
+ */
217
+ hotInit: function hotInit() {
218
+ var newSettings = prepareSettings(this.$props);
219
+ newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;
220
+ this.hotInstance = vue.markRaw(new Handsontable__default["default"].Core(this.$el, newSettings));
221
+ this.hotInstance.init();
222
+ this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();
223
+ },
224
+ matchHotMappersSize: function matchHotMappersSize() {
225
+ var _this = this;
226
+ if (!this.hotInstance) {
227
+ return;
228
+ }
229
+ var data = this.hotInstance.getSourceData();
230
+ var rowsToRemove = [];
231
+ var columnsToRemove = [];
232
+ var indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();
233
+ var isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();
234
+ var indexMapperColumnCount = 0;
235
+ if (data && data.length !== indexMapperRowCount) {
236
+ if (data.length < indexMapperRowCount) {
237
+ for (var r = data.length; r < indexMapperRowCount; r++) {
238
+ rowsToRemove.push(r);
239
+ }
240
+ }
241
+ }
242
+ if (isColumnModificationAllowed) {
243
+ var _data$;
244
+ indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();
245
+ if (data && data[0] && ((_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.length) !== indexMapperColumnCount) {
246
+ if (data[0].length < indexMapperColumnCount) {
247
+ for (var c = data[0].length; c < indexMapperColumnCount; c++) {
248
+ columnsToRemove.push(c);
249
+ }
250
+ }
251
+ }
252
+ }
253
+ this.hotInstance.batch(function () {
254
+ if (rowsToRemove.length > 0) {
255
+ _this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);
256
+ } else {
257
+ _this.hotInstance.rowIndexMapper.insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);
258
+ }
259
+ if (isColumnModificationAllowed && data.length !== 0) {
260
+ if (columnsToRemove.length > 0) {
261
+ _this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);
262
+ } else {
263
+ _this.hotInstance.columnIndexMapper.insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);
264
+ }
265
+ }
266
+ });
267
+ },
268
+ /**
269
+ * Get settings for the columns provided in the `hot-column` components.
270
+ *
271
+ * @returns {HotTableProps[] | undefined}
272
+ */
273
+ getColumnSettings: function getColumnSettings() {
274
+ var columnSettings = Array.from(this.columnsCache.values());
275
+ return columnSettings.length ? columnSettings : void 0;
276
+ }
277
+ },
278
+ mounted: function mounted() {
279
+ this.columnSettings = this.getColumnSettings();
280
+ this.hotInit();
281
+ },
282
+ beforeUnmount: function beforeUnmount() {
283
+ if (this.hotInstance) {
284
+ this.hotInstance.destroy();
285
+ }
286
+ },
287
+ version: version
288
+ });
289
+
290
+ var _hoisted_1 = ["id"];
291
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
292
+ return vue.openBlock(), vue.createElementBlock("div", {
293
+ id: _ctx.id
294
+ }, [vue.renderSlot(_ctx.$slots, "default")], 8 /* PROPS */, _hoisted_1);
295
+ }
296
+
297
+ HotTable.render = render;
298
+ HotTable.__file = "src/HotTable.vue";
299
+
300
+ function ownKeys(object, enumerableOnly) {
301
+ var keys = Object.keys(object);
302
+ if (Object.getOwnPropertySymbols) {
303
+ var symbols = Object.getOwnPropertySymbols(object);
304
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
305
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
306
+ })), keys.push.apply(keys, symbols);
307
+ }
308
+ return keys;
309
+ }
310
+ function _objectSpread2(target) {
311
+ for (var i = 1; i < arguments.length; i++) {
312
+ var source = null != arguments[i] ? arguments[i] : {};
313
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
314
+ _defineProperty(target, key, source[key]);
315
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
316
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
317
+ });
318
+ }
319
+ return target;
320
+ }
321
+ function _defineProperty(obj, key, value) {
322
+ if (key in obj) {
323
+ Object.defineProperty(obj, key, {
324
+ value: value,
325
+ enumerable: true,
326
+ configurable: true,
327
+ writable: true
328
+ });
329
+ } else {
330
+ obj[key] = value;
331
+ }
332
+ return obj;
333
+ }
334
+
335
+ var HotColumn = vue.defineComponent({
336
+ name: 'HotColumn',
337
+ props: propFactory('HotColumn'),
338
+ inject: ['columnsCache'],
339
+ methods: {
340
+ /**
341
+ * Create the column settings based on the data provided to the `hot-column`
342
+ * component and it's child components.
343
+ */
344
+ createColumnSettings: function createColumnSettings() {
345
+ var assignedProps = filterPassedProps(this.$props);
346
+ var columnSettings = _objectSpread2({}, assignedProps);
347
+ if (assignedProps.renderer) {
348
+ columnSettings.renderer = assignedProps.renderer;
349
+ }
350
+ if (assignedProps.editor) {
351
+ columnSettings.editor = assignedProps.editor;
352
+ }
353
+ this.columnsCache.set(this, columnSettings);
354
+ }
355
+ },
356
+ mounted: function mounted() {
357
+ this.createColumnSettings();
358
+ },
359
+ unmounted: function unmounted() {
360
+ this.columnsCache["delete"](this);
361
+ },
362
+ render: function render() {
363
+ return null;
364
+ }
365
+ });
366
+
367
+ HotColumn.__file = "src/HotColumn.vue";
368
+
369
+ exports.HotColumn = HotColumn;
370
+ exports.HotTable = HotTable;
371
+ exports["default"] = HotTable;
372
+
373
+ Object.defineProperty(exports, '__esModule', { value: true });
374
+
375
+ }));
376
+ //# sourceMappingURL=vue-handsontable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue-handsontable.js","sources":["../src/helpers.ts","../src/HotTable.vue","../src/HotTable.vue?vue&type=template&id=54bcc3fa&lang.js","../src/HotColumn.vue"],"sourcesContent":["import Handsontable from 'handsontable/base';\nimport { HotTableProps, VueProps } from './types';\n\nconst unassignedPropSymbol = Symbol('unassigned');\n\n/**\n * Message for the warning thrown if the Handsontable instance has been destroyed.\n */\nexport const HOT_DESTROYED_WARNING = 'The Handsontable instance bound to this component was destroyed and cannot be' +\n ' used properly.';\n\n/**\n * Check if at specified `key` there is any value for `object`.\n *\n * @param {object} object Object to search value at specyfic key.\n * @param {string} key String key to check.\n * @returns {boolean}\n */\nexport function hasOwnProperty(object: unknown, key: string): boolean {\n return Object.prototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Generate an object containing all the available Handsontable properties and plugin hooks.\n *\n * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').\n * @returns {object}\n */\nexport function propFactory(source: 'HotTable' | 'HotColumn'): VueProps<HotTableProps> {\n const registeredHooks = Handsontable.hooks.getRegistered();\n const propSchema: VueProps<HotTableProps> = {};\n\n Object.assign(propSchema, Handsontable.DefaultSettings);\n\n // eslint-disable-next-line no-restricted-syntax, guard-for-in\n for (const prop in propSchema) {\n propSchema[prop] = {\n default: unassignedPropSymbol\n };\n }\n\n for (let i = 0; i < registeredHooks.length; i++) {\n propSchema[registeredHooks[i]] = {\n default: unassignedPropSymbol\n };\n }\n\n propSchema.settings = {\n default: unassignedPropSymbol\n };\n\n if (source === 'HotTable') {\n propSchema.id = {\n type: String,\n default: `hot-${Math.random().toString(36).substring(5)}`\n };\n }\n\n return propSchema;\n}\n\n/**\n * Filter out all of the unassigned props, and return only the one passed to the component.\n *\n * @param {object} props Object containing all the possible props.\n * @returns {object} Object containing only used props.\n */\nexport function filterPassedProps(props) {\n const filteredProps: VueProps<HotTableProps> = {};\n const columnSettingsProp = props.settings;\n\n if (columnSettingsProp !== unassignedPropSymbol) {\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in columnSettingsProp) {\n if (hasOwnProperty(columnSettingsProp, propName) && columnSettingsProp[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = columnSettingsProp[propName];\n }\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const propName in props) {\n if (hasOwnProperty(props, propName) && propName !== 'settings' && props[propName] !== unassignedPropSymbol) {\n filteredProps[propName] = props[propName];\n }\n }\n\n return filteredProps;\n}\n\n/**\n * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.\n *\n * @param {HotTableProps} props The props passed to the component.\n * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.\n * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.\n */\nexport function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings): HotTableProps {\n const assignedProps: VueProps<HotTableProps> = filterPassedProps(props);\n const hotSettingsInProps: Handsontable.GridSettings = props.settings ? props.settings : assignedProps;\n const additionalHotSettingsInProps: Handsontable.GridSettings = props.settings ? assignedProps : null;\n const newSettings: Handsontable.GridSettings = {};\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in hotSettingsInProps) {\n if (\n hasOwnProperty(hotSettingsInProps, key) &&\n hotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data') ? !simpleEqual(currentSettings[key], hotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = hotSettingsInProps[key];\n }\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const key in additionalHotSettingsInProps) {\n if (\n hasOwnProperty(additionalHotSettingsInProps, key) &&\n key !== 'id' &&\n key !== 'settings' &&\n additionalHotSettingsInProps[key] !== void 0 &&\n ((currentSettings && key !== 'data')\n ? !simpleEqual(currentSettings[key], additionalHotSettingsInProps[key]) : true)\n ) {\n newSettings[key] = additionalHotSettingsInProps[key];\n }\n }\n\n return newSettings;\n}\n\n/**\n * Compare two objects using `JSON.stringify`.\n * *Note: * As it's using the stringify function to compare objects, the property order in both objects is\n * important. It will return `false` for the same objects, if they're defined in a different order.\n *\n * @param {object} objectA First object to compare.\n * @param {object} objectB Second object to compare.\n * @returns {boolean} `true` if they're the same, `false` otherwise.\n */\nfunction simpleEqual(objectA, objectB) {\n return JSON.stringify(objectA) === JSON.stringify(objectB);\n}\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<template>\n <div :id=\"id\">\n <slot></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, VNode, markRaw } from 'vue';\nimport Handsontable from 'handsontable/base';\nimport {\n HOT_DESTROYED_WARNING,\n prepareSettings,\n propFactory,\n} from './helpers';\nimport {\n HotTableProps,\n} from './types';\nimport * as packageJson from '../package.json';\n\nconst HotTable = defineComponent({\n name: 'HotTable',\n props: propFactory('HotTable'),\n provide() {\n return {\n columnsCache: this.columnsCache\n };\n },\n watch: {\n $props: {\n handler(props) {\n const settings = prepareSettings(props, this.hotInstance ? this.hotInstance.getSettings() : void 0);\n\n if (!this.hotInstance || settings === void 0) {\n return;\n }\n\n if (settings.data) {\n if (\n this.hotInstance.isColumnModificationAllowed() ||\n (\n !this.hotInstance.isColumnModificationAllowed() &&\n this.hotInstance.countSourceCols() === this.miscCache.currentSourceColumns\n )\n ) {\n // If the dataset dimensions change, update the index mappers.\n this.matchHotMappersSize();\n\n // Data is automatically synchronized by reference.\n delete settings.data;\n }\n }\n\n // If there are another options changed, update the HOT settings, render the table otherwise.\n if (Object.keys(settings).length) {\n this.hotInstance.updateSettings(settings);\n\n } else {\n this.hotInstance.render();\n }\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n deep: true,\n immediate: true,\n },\n },\n data() {\n return {\n /* eslint-disable vue/no-reserved-keys */\n __hotInstance: null as Handsontable,\n /* eslint-enable vue/no-reserved-keys */\n miscCache: {\n currentSourceColumns: null,\n },\n columnSettings: null as HotTableProps[],\n columnsCache: new Map<VNode, HotTableProps>(),\n get hotInstance(): Handsontable | null {\n if (!this.__hotInstance || (this.__hotInstance && !this.__hotInstance.isDestroyed)) {\n\n // Will return the Handsontable instance or `null` if it's not yet been created.\n return this.__hotInstance;\n\n } else {\n /* eslint-disable-next-line no-console */\n console.warn(HOT_DESTROYED_WARNING);\n\n return null;\n }\n },\n set hotInstance(hotInstance: Handsontable) {\n this.__hotInstance = hotInstance;\n },\n };\n },\n methods: {\n /**\n * Initialize Handsontable.\n */\n hotInit() {\n const newSettings = prepareSettings(this.$props);\n\n newSettings.columns = this.columnSettings ? this.columnSettings : newSettings.columns;\n\n this.hotInstance = markRaw<Handsontable>(new Handsontable.Core(this.$el, newSettings));\n this.hotInstance.init();\n\n this.miscCache.currentSourceColumns = this.hotInstance.countSourceCols();\n },\n\n matchHotMappersSize(): void {\n if (!this.hotInstance) {\n return;\n }\n\n const data: Handsontable.CellValue[][] = this.hotInstance.getSourceData();\n const rowsToRemove: number[] = [];\n const columnsToRemove: number[] = [];\n const indexMapperRowCount = this.hotInstance.rowIndexMapper.getNumberOfIndexes();\n const isColumnModificationAllowed = this.hotInstance.isColumnModificationAllowed();\n let indexMapperColumnCount = 0;\n\n if (data && data.length !== indexMapperRowCount) {\n if (data.length < indexMapperRowCount) {\n for (let r = data.length; r < indexMapperRowCount; r++) {\n rowsToRemove.push(r);\n }\n }\n }\n\n if (isColumnModificationAllowed) {\n indexMapperColumnCount = this.hotInstance.columnIndexMapper.getNumberOfIndexes();\n\n if (data && data[0] && data[0]?.length !== indexMapperColumnCount) {\n if (data[0].length < indexMapperColumnCount) {\n for (let c = data[0].length; c < indexMapperColumnCount; c++) {\n columnsToRemove.push(c);\n }\n }\n }\n }\n\n this.hotInstance.batch(() => {\n if (rowsToRemove.length > 0) {\n this.hotInstance.rowIndexMapper.removeIndexes(rowsToRemove);\n\n } else {\n this.hotInstance.rowIndexMapper\n .insertIndexes(indexMapperRowCount - 1, data.length - indexMapperRowCount);\n }\n\n if (isColumnModificationAllowed && data.length !== 0) {\n if (columnsToRemove.length > 0) {\n this.hotInstance.columnIndexMapper.removeIndexes(columnsToRemove);\n\n } else {\n this.hotInstance.columnIndexMapper\n .insertIndexes(indexMapperColumnCount - 1, data[0].length - indexMapperColumnCount);\n }\n }\n });\n },\n\n /**\n * Get settings for the columns provided in the `hot-column` components.\n *\n * @returns {HotTableProps[] | undefined}\n */\n getColumnSettings(): HotTableProps[] | void {\n const columnSettings: HotTableProps[] = Array.from(this.columnsCache.values());\n\n return columnSettings.length ? columnSettings : void 0;\n },\n },\n mounted() {\n this.columnSettings = this.getColumnSettings();\n this.hotInit();\n },\n beforeUnmount() {\n if (this.hotInstance) {\n this.hotInstance.destroy();\n }\n },\n version: (packageJson as unknown as { version: string }).version,\n});\n\nexport default HotTable;\nexport { HotTable };\n</script>\n","<script lang=\"ts\">\nimport { defineComponent } from 'vue';\nimport {\n propFactory,\n filterPassedProps\n} from './helpers';\n\nconst HotColumn = defineComponent({\n name: 'HotColumn',\n props: propFactory('HotColumn'),\n inject: ['columnsCache'],\n methods: {\n /**\n * Create the column settings based on the data provided to the `hot-column`\n * component and it's child components.\n */\n createColumnSettings(): void {\n const assignedProps = filterPassedProps(this.$props);\n const columnSettings = { ...assignedProps };\n\n if (assignedProps.renderer) {\n columnSettings.renderer = assignedProps.renderer;\n }\n\n if (assignedProps.editor) {\n columnSettings.editor = assignedProps.editor;\n }\n\n this.columnsCache.set(this, columnSettings);\n }\n },\n mounted() {\n this.createColumnSettings();\n },\n unmounted() {\n this.columnsCache.delete(this);\n },\n render() {\n return null;\n }\n});\n\nexport default HotColumn;\nexport { HotColumn };\n</script>\n"],"names":["unassignedPropSymbol","Symbol","HOT_DESTROYED_WARNING","hasOwnProperty","object","key","Object","prototype","call","propFactory","source","registeredHooks","Handsontable","hooks","getRegistered","propSchema","assign","DefaultSettings","prop","i","length","settings","id","type","String","Math","random","toString","substring","filterPassedProps","props","filteredProps","columnSettingsProp","propName","prepareSettings","currentSettings","assignedProps","hotSettingsInProps","additionalHotSettingsInProps","newSettings","simpleEqual","objectA","objectB","JSON","stringify","HotTable","defineComponent","name","provide","columnsCache","watch","$props","handler","hotInstance","getSettings","data","isColumnModificationAllowed","countSourceCols","miscCache","currentSourceColumns","matchHotMappersSize","keys","updateSettings","render","deep","immediate","__hotInstance","columnSettings","Map","isDestroyed","console","warn","methods","hotInit","columns","markRaw","Core","$el","init","getSourceData","rowsToRemove","columnsToRemove","indexMapperRowCount","rowIndexMapper","getNumberOfIndexes","indexMapperColumnCount","r","push","columnIndexMapper","c","batch","removeIndexes","insertIndexes","getColumnSettings","Array","from","values","mounted","beforeUnmount","destroy","version","packageJson","_createElementBlock","_ctx","_renderSlot","$slots","HotColumn","inject","createColumnSettings","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAMA,oBAAoB,GAAGC,MAAM,CAAC,YAAY,CAAC,CAAA;AAEjD;;AAEG;AACI,IAAMC,qBAAqB,GAAG,+EAA+E,GAClH,iBAAiB,CAAA;AAEnB;;;;;;AAMG;AACa,SAAAC,cAAc,CAACC,MAAe,EAAEC,GAAW,EAAA;EACzD,OAAOC,MAAM,CAACC,SAAS,CAACJ,cAAc,CAACK,IAAI,CAACJ,MAAM,EAAEC,GAAG,CAAC,CAAA;AAC1D,CAAA;AAEA;;;;;AAKG;AACG,SAAUI,WAAW,CAACC,MAAgC,EAAA;AAC1D,EAAA,IAAMC,eAAe,GAAGC,gCAAY,CAACC,KAAK,CAACC,aAAa,EAAE,CAAA;EAC1D,IAAMC,UAAU,GAA4B,EAAE,CAAA;EAE9CT,MAAM,CAACU,MAAM,CAACD,UAAU,EAAEH,gCAAY,CAACK,eAAe,CAAC,CAAA;AAEvD;AACA,EAAA,KAAK,IAAMC,IAAI,IAAIH,UAAU,EAAE;IAC7BA,UAAU,CAACG,IAAI,CAAC,GAAG;MACjB,SAASlB,EAAAA,oBAAAA;KACV,CAAA;AACF,GAAA;AAED,EAAA,KAAK,IAAImB,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,eAAe,CAACS,MAAM,EAAED,CAAC,EAAE,EAAE;AAC/CJ,IAAAA,UAAU,CAACJ,eAAe,CAACQ,CAAC,CAAC,CAAC,GAAG;MAC/B,SAASnB,EAAAA,oBAAAA;KACV,CAAA;AACF,GAAA;EAEDe,UAAU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AO,EAAE;AACP;;;AAGE;AACFoC,IAAAA,oBAAoB,EAAA,SAAA,oBAAA,GAAA;AAClB,MAAA,IAAMxE,gBAAgBP,iBAAiB,CAAC,IAAI,CAACsB,MAAM,CAAC,CAAA;MACpD,IAAMgB,cAAa,GAAS/B,cAAAA,CAAAA,EAAAA,EAAAA,cAAe,CAAA;MAE3C,IAAIA,aAAa,CAACyE,QAAQ,EAAE;AAC1B1C,QAAAA,cAAc,CAAC0C,QAAO,GAAIzE,aAAa,CAACyE,QAAQ,CAAA;AAClD,OAAA;MAEA,IAAIzE,aAAa,CAAC0E,MAAM,EAAE;AACxB3C,QAAAA,cAAc,CAAC2C,MAAK,GAAI1E,aAAa,CAAC0E,MAAM,CAAA;AAC9C,OAAA;MAEA,IAAI,CAAC7D,YAAY,CAAC8D,GAAG,CAAC,IAAI,EAAE5C,cAAc,CAAC,CAAA;AAC7C,KAAA;GACD;AACD8B,EAAAA,OAAO,EAAA,SAAA,OAAA,GAAA;IACL,IAAI,CAACW,oBAAoB,EAAE,CAAA;GAC5B;AACDI,EAAAA,SAAS,EAAA,SAAA,SAAA,GAAA;AACP,IAAA,IAAI,CAAC/D,YAAY,CAAO,QAAA,CAAA,CAAC,IAAI,CAAC,CAAA;GAC/B;AACDc,EAAAA,MAAM,EAAA,SAAA,MAAA,GAAA;AACJ,IAAA,OAAO,IAAI,CAAA;AACb,GAAA;AACD,CAAA;;;;;;;;;;;;;;"}
@@ -0,0 +1,31 @@
1
+ /*!
2
+ * Copyright (c) HANDSONCODE sp. z o. o.
3
+ *
4
+ * HANDSONTABLE is a software distributed by HANDSONCODE sp. z o. o., a Polish corporation based in
5
+ * Gdynia, Poland, at Aleja Zwycięstwa 96-98, registered by the District Court in Gdansk under number
6
+ * 538651, EU tax ID number: PL5862294002, share capital: PLN 62,800.00.
7
+ *
8
+ * This software is protected by applicable copyright laws, including international treaties, and dual-
9
+ * licensed – depending on whether your use for commercial purposes, meaning intended for or
10
+ * resulting in commercial advantage or monetary compensation, or not.
11
+ *
12
+ * If your use is strictly personal or solely for evaluation purposes, meaning for the purposes of testing
13
+ * the suitability, performance, and usefulness of this software outside the production environment,
14
+ * you agree to be bound by the terms included in the "handsontable-non-commercial-license.pdf" file.
15
+ *
16
+ * Your use of this software for commercial purposes is subject to the terms included in an applicable
17
+ * license agreement.
18
+ *
19
+ * In any case, you must not make any such use of this software as to develop software which may be
20
+ * considered competitive with this software.
21
+ *
22
+ * UNLESS EXPRESSLY AGREED OTHERWISE, HANDSONCODE PROVIDES THIS SOFTWARE ON AN "AS IS"
23
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, AND IN NO EVENT AND UNDER NO
24
+ * LEGAL THEORY, SHALL HANDSONCODE BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT,
25
+ * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
26
+ * USE OR INABILITY TO USE THIS SOFTWARE.
27
+ *
28
+ * Version: 0.0.0-next-9ec04ce-20221121 (built at Mon Nov 21 2022 14:49:20 GMT+0000 (Coordinated Universal Time))
29
+ */
30
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("handsontable/base")):"function"==typeof define&&define.amd?define(["exports","vue","handsontable/base"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Handsontable=t.Handsontable||{},t.Handsontable.vue={}),t.Vue,t.Handsontable)}(this,(function(t,e,n){"use strict";function o(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var s=o(n),r=Symbol("unassigned");function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a(t){var e=s.default.hooks.getRegistered(),n={};for(var o in Object.assign(n,s.default.DefaultSettings),n)n[o]={default:r};for(var i=0;e.length>i;i++)n[e[i]]={default:r};return n.settings={default:r},"HotTable"===t&&(n.id={type:String,default:"hot-".concat(Math.random().toString(36).substring(5))}),n}function c(t){var e={},n=t.settings;if(n!==r)for(var o in n)i(n,o)&&n[o]!==r&&(e[o]=n[o]);for(var s in t)i(t,s)&&"settings"!==s&&t[s]!==r&&(e[s]=t[s]);return e}function u(t,e){var n=c(t),o=t.settings?t.settings:n,s=t.settings?n:null,r={};for(var a in o)!i(o,a)||void 0===o[a]||e&&"data"!==a&&l(e[a],o[a])||(r[a]=o[a]);for(var u in s)!i(s,u)||"id"===u||"settings"===u||void 0===s[u]||e&&"data"!==u&&l(e[u],s[u])||(r[u]=s[u]);return r}function l(t,e){return JSON.stringify(t)===JSON.stringify(e)}var h=e.defineComponent({name:"HotTable",props:a("HotTable"),provide:function(){return{columnsCache:this.columnsCache}},watch:{$props:{handler:function(t){var e=u(t,this.hotInstance?this.hotInstance.getSettings():void 0);this.hotInstance&&void 0!==e&&(e.data&&(this.hotInstance.isColumnModificationAllowed()||!this.hotInstance.isColumnModificationAllowed()&&this.hotInstance.countSourceCols()===this.miscCache.currentSourceColumns)&&(this.matchHotMappersSize(),delete e.data),Object.keys(e).length?this.hotInstance.updateSettings(e):this.hotInstance.render(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols())},deep:!0,immediate:!0}},data:function(){return{__hotInstance:null,miscCache:{currentSourceColumns:null},columnSettings:null,columnsCache:new Map,get hotInstance(){return!this.__hotInstance||this.__hotInstance&&!this.__hotInstance.isDestroyed?this.__hotInstance:(console.warn("The Handsontable instance bound to this component was destroyed and cannot be used properly."),null)},set hotInstance(t){this.__hotInstance=t}}},methods:{hotInit:function(){var t=u(this.$props);t.columns=this.columnSettings?this.columnSettings:t.columns,this.hotInstance=e.markRaw(new s.default.Core(this.$el,t)),this.hotInstance.init(),this.miscCache.currentSourceColumns=this.hotInstance.countSourceCols()},matchHotMappersSize:function(){var t=this;if(this.hotInstance){var e,n=this.hotInstance.getSourceData(),o=[],s=[],r=this.hotInstance.rowIndexMapper.getNumberOfIndexes(),i=this.hotInstance.isColumnModificationAllowed(),a=0;if(n&&n.length!==r&&r>n.length)for(var c=n.length;r>c;c++)o.push(c);if(i)if(a=this.hotInstance.columnIndexMapper.getNumberOfIndexes(),n&&n[0]&&(null===(e=n[0])||void 0===e?void 0:e.length)!==a&&a>n[0].length)for(var u=n[0].length;a>u;u++)s.push(u);this.hotInstance.batch((function(){o.length>0?t.hotInstance.rowIndexMapper.removeIndexes(o):t.hotInstance.rowIndexMapper.insertIndexes(r-1,n.length-r),i&&0!==n.length&&(s.length>0?t.hotInstance.columnIndexMapper.removeIndexes(s):t.hotInstance.columnIndexMapper.insertIndexes(a-1,n[0].length-a))}))}},getColumnSettings:function(){var t=Array.from(this.columnsCache.values());return t.length?t:void 0}},mounted:function(){this.columnSettings=this.getColumnSettings(),this.hotInit()},beforeUnmount:function(){this.hotInstance&&this.hotInstance.destroy()},version:"0.0.0-next-9ec04ce-20221121"}),d=["id"];function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}h.render=function(t,n,o,s,r,i){return e.openBlock(),e.createElementBlock("div",{id:t.id},[e.renderSlot(t.$slots,"default")],8,d)},h.__file="src/HotTable.vue";var m=e.defineComponent({name:"HotColumn",props:a("HotColumn"),inject:["columnsCache"],methods:{createColumnSettings:function(){var t=c(this.$props),e=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?f(Object(n),!0).forEach((function(e){p(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},t);t.renderer&&(e.renderer=t.renderer),t.editor&&(e.editor=t.editor),this.columnsCache.set(this,e)}},mounted:function(){this.createColumnSettings()},unmounted:function(){this.columnsCache.delete(this)},render:function(){return null}});m.__file="src/HotColumn.vue",t.HotColumn=m,t.HotTable=h,t.default=h,Object.defineProperty(t,"__esModule",{value:!0})}));
31
+ //# sourceMappingURL=vue-handsontable.min.js.map
@@ -0,0 +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","renderer","editor","set","unmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;8cAGMA,EAAuBC,OAAO,cAepB,SAAAC,EAAeC,EAAiBC,GAC9C,OAAOC,OAAOC,UAAUJ,eAAeK,KAAKJ,EAAQC,EACtD,CAQM,SAAUI,EAAYC,GAC1B,IAAMC,EAAkBC,EAAAA,QAAaC,MAAMC,gBACrCC,EAAsC,CAAA,EAK5C,IAAK,IAAMC,KAHXV,OAAOW,OAAOF,EAAYH,EAAY,QAACM,iBAGpBH,EACjBA,EAAWC,GAAQ,CACjBG,QAASlB,GAIb,IAAK,IAAImB,EAAI,EAAOT,EAAgBU,OAApBD,EAA4BA,IAC1CL,EAAWJ,EAAgBS,IAAM,CAC/BD,QAASlB,GAeb,OAXAc,EAAWO,SAAW,CACpBH,QAAS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