@handsontable/vue3 18.1.3 → 19.0.0-rc10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/helpers.d.ts ADDED
@@ -0,0 +1,127 @@
1
+ import { PropType } from 'vue';
2
+ import Handsontable, { OmitHooks, RemoveIndexSignature } from 'handsontable/base';
3
+ import { HotTableProps, VueProps } from './types';
4
+ /**
5
+ * The shape `defineComponent()` reads the prop types from, with one entry per option of `Settings`. `type`
6
+ * exists only for the type checker: the runtime schema built by `propFactory()` carries none, so Vue
7
+ * neither validates nor casts a prop.
8
+ *
9
+ * `RemoveIndexSignature` drops the index signature of `Settings`. Left in, it becomes an index signature of
10
+ * the props, and Vue types every prop as `any` again. The mapping also drops `afterChangesObserved`: the
11
+ * settings types list that hook, but core neither registers nor fires it, so a prop for it could never work.
12
+ * `SettingsProp` is what the `settings` prop takes.
13
+ */
14
+ type PropSchema<Settings, SettingsProp = Settings> = {
15
+ [P in keyof RemoveIndexSignature<Settings> as P extends 'afterChangesObserved' ? never : P]-?: {
16
+ type: PropType<RemoveIndexSignature<Settings>[P]>;
17
+ default: unknown;
18
+ };
19
+ } & {
20
+ settings: {
21
+ type: PropType<SettingsProp>;
22
+ default: unknown;
23
+ };
24
+ };
25
+ /**
26
+ * `HotColumn` takes column settings, not grid settings: its `data` is a property name or a getter, where the
27
+ * grid's `data` is an array of rows. Hooks run from the grid-level settings only, and core reads `getValue`
28
+ * from the table meta only, so neither is a prop of a column. The `settings` prop also takes a grid settings
29
+ * object, as it did when every prop was `any`: such an object has no `data` that would clash.
30
+ */
31
+ type HotColumnPropSchema = PropSchema<Omit<OmitHooks<RemoveIndexSignature<Handsontable.ColumnSettings>>, 'getValue'>, Handsontable.ColumnSettings | Handsontable.GridSettings>;
32
+ /**
33
+ * `HotTable` takes the settings `updateSettings()` takes: a hook prop may be `null`, which removes the
34
+ * callback the earlier props passed for it.
35
+ */
36
+ type HotTablePropSchema = PropSchema<Handsontable.SettingsUpdate> & {
37
+ id: {
38
+ type: PropType<string>;
39
+ };
40
+ };
41
+ /**
42
+ * Message for the warning thrown if the Handsontable instance has been destroyed.
43
+ */
44
+ export declare const HOT_DESTROYED_WARNING: string;
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
+ export declare function hasOwnProperty(object: unknown, key: string): boolean;
53
+ /**
54
+ * Generate an object containing all the available Handsontable properties and plugin hooks.
55
+ *
56
+ * @param {string} source Source for the factory (either 'HotTable' or 'HotColumn').
57
+ * @returns {object}
58
+ */
59
+ export declare function propFactory(source: 'HotTable'): HotTablePropSchema;
60
+ export declare function propFactory(source: 'HotColumn'): HotColumnPropSchema;
61
+ /**
62
+ * Generate a random id for the `HotTable` container. It has to be created on the client only: an id
63
+ * generated on the server never matches the one the browser generates while hydrating.
64
+ *
65
+ * @returns {string} The container id.
66
+ */
67
+ export declare function generateContainerId(): string;
68
+ /**
69
+ * Filter out all of the unassigned props, and return only the one passed to the component.
70
+ *
71
+ * @param {object} props Object containing all the possible props.
72
+ * @returns {object} Object containing only used props.
73
+ */
74
+ export declare function filterPassedProps(props: any): VueProps<HotTableProps>;
75
+ /**
76
+ * List the hooks the props pass a callback for, directly or through the `settings` prop. A key counts as
77
+ * a hook by the rule core's `updateSettings()` uses in `core.ts`: a registered or a deprecated hook name.
78
+ * Only a function or an array of them counts as a callback: core ignores any other value, so a hook prop
79
+ * that holds `false` (`:afterChange="on && logChange"`) is treated as removed.
80
+ *
81
+ * @param {HotTableProps} props The props passed to the component.
82
+ * @returns {string[]} The hook names.
83
+ */
84
+ export declare function getPassedHookKeys(props: HotTableProps): string[];
85
+ /**
86
+ * What the wrapper last knew about a setting: the prop value it synced, a copy of its content, and the value the
87
+ * grid held right after. The copy is needed because core edits an array it was given in place (`alter()` splices
88
+ * `colHeaders`), so the prop itself no longer shows what was synced.
89
+ */
90
+ export type SettingBaseline = {
91
+ prop: unknown;
92
+ copy: unknown;
93
+ live: unknown;
94
+ };
95
+ /**
96
+ * The settings by name, as `SettingBaseline`s. `HotTable` keeps one per instance.
97
+ */
98
+ export type SettingBaselines = Record<string, SettingBaseline>;
99
+ /**
100
+ * Record the props the wrapper has just synced with the grid, for the next change to compare with. A setting the
101
+ * app overrode (`overriddenKeys`) keeps its previous baseline, so the override outlives the next changes and
102
+ * is given up only when the prop itself changes.
103
+ *
104
+ * @param {SettingBaselines} baselines What the wrapper last synced. It is updated in place.
105
+ * @param {HotTableProps} props The props passed to the component.
106
+ * @param {Handsontable.GridSettings} currentSettings The grid's current settings.
107
+ * @param {string[]} [overriddenKeys] The settings `prepareSettings()` left out because the app overrode them.
108
+ */
109
+ export declare function recordSettingBaselines(baselines: SettingBaselines, props: HotTableProps, currentSettings: Handsontable.GridSettings, overriddenKeys?: string[]): void;
110
+ /**
111
+ * Prepare the settings object to be used as the settings for Handsontable, based on the props provided to the component.
112
+ *
113
+ * A hook listed in `previousHookKeys` that the props no longer pass a callback for (the prop is removed or
114
+ * `undefined`) is sent as `null`, which removes the callback the props registered.
115
+ *
116
+ * A prop that is the same value the wrapper last synced (`baselines`) is left out when the grid's value for it
117
+ * was replaced since, through `hot.updateSettings()`: the app's value stays until the prop changes.
118
+ *
119
+ * @param {HotTableProps} props The props passed to the component.
120
+ * @param {Handsontable.GridSettings} currentSettings The current Handsontable settings.
121
+ * @param {string[]} previousHookKeys The hooks the previous props passed a callback for.
122
+ * @param {SettingBaselines} [baselines] What the wrapper last synced.
123
+ * @param {string[]} [overriddenKeys] Receives the names of the props left out because the app overrode them.
124
+ * @returns {Handsontable.GridSettings} An object containing the properties, ready to be used within Handsontable.
125
+ */
126
+ export declare function prepareSettings(props: HotTableProps, currentSettings?: Handsontable.GridSettings, previousHookKeys?: string[], baselines?: SettingBaselines, overriddenKeys?: string[]): HotTableProps;
127
+ export {};
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import HotTable from './HotTable.vue';
2
+ import HotColumn from './HotColumn.vue';
3
+ export { HotTable as default, HotTable, HotColumn };
4
+ export * from './types';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@handsontable/vue3",
3
- "version": "18.1.3",
4
- "description": "Best Data Grid for Vue with Spreadsheet Look and Feel.",
3
+ "version": "19.0.0-rc10",
4
+ "description": "Handsontable DataGrid for Vue with a spreadsheet look and feel.",
5
5
  "author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
6
6
  "homepage": "https://handsontable.com",
7
7
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -53,7 +53,7 @@
53
53
  "url": "https://github.com/handsontable/handsontable/issues"
54
54
  },
55
55
  "peerDependencies": {
56
- "handsontable": "^18.0.0",
56
+ "handsontable": "^19.0.0",
57
57
  "vue": "^3.2.22"
58
58
  },
59
59
  "devDependencies": {
@@ -64,7 +64,7 @@
64
64
  "@babel/preset-env": "^7.11.0",
65
65
  "@babel/preset-typescript": "^7.11.0",
66
66
  "@babel/runtime": "^7.11.0",
67
- "babel-jest": "^27.5.1",
67
+ "babel-jest": "^29.7.0",
68
68
  "@rollup/plugin-commonjs": "^25.0.7",
69
69
  "@rollup/plugin-node-resolve": "^15.2.3",
70
70
  "@rollup/plugin-terser": "^0.4.4",
@@ -77,37 +77,40 @@
77
77
  "@vue/compiler-sfc": "^3.2.12",
78
78
  "@vue/eslint-config-typescript": "^9.0.1",
79
79
  "@vue/test-utils": "2.0.0-rc.16",
80
- "@vue/vue3-jest": "27.0.0-alpha.4",
80
+ "@vue/vue3-jest": "^29.2.6",
81
81
  "cross-env": "^7.0.3",
82
82
  "eslint": "^8.57.1",
83
83
  "eslint-plugin-vue": "^8.0.3",
84
- "handsontable": "^18.0.0",
85
- "jest": "^27.5.1",
86
- "jest-environment-jsdom": "^27.5.1",
84
+ "handsontable": "^19.0.0",
85
+ "hyperformula": "^3.0.0",
86
+ "jest": "^29.7.0",
87
+ "jest-environment-jsdom": "^29.7.0",
87
88
  "rimraf": "^3.0.2",
88
89
  "rollup": "^4.52.5",
89
90
  "rollup-plugin-typescript2": "^0.36.0",
90
91
  "rollup-plugin-vue": "^6.0.0",
91
- "ts-jest": "^27.1.5",
92
+ "ts-jest": "^29.4.15",
92
93
  "tslib": "^2.3.0",
93
- "typescript": "^4.0.0",
94
+ "typescript": "^5.9.3",
94
95
  "vue": "^3.2.22",
95
- "vue-eslint-parser": "^8.0.1"
96
+ "vue-eslint-parser": "^8.0.1",
97
+ "vue-tsc": "^3.3.11"
96
98
  },
97
99
  "scripts": {
98
100
  "lint": "eslint --ext .js,.ts,.vue src test",
99
- "build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min",
101
+ "build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min && npm run prepare:types",
100
102
  "build:commonjs": "cross-env NODE_ENV=cjs rollup -c --bundleConfigAsCjs",
101
103
  "build:umd": "cross-env NODE_ENV=umd rollup -c --bundleConfigAsCjs",
102
104
  "build:es": "cross-env NODE_ENV=es rollup -c --bundleConfigAsCjs",
103
105
  "build:min": "cross-env NODE_ENV=min rollup -c --bundleConfigAsCjs",
104
- "build:esDts": "cross-env NODE_ENV=esDts rollup -c && rimraf ./buildTemp/",
106
+ "prepare:types": "node scripts/prepare-types.mjs",
105
107
  "watch:commonjs": "cross-env NODE_ENV=cjs rollup -c --watch",
106
108
  "watch:es": "cross-env NODE_ENV=es rollup -c --watch",
107
109
  "watch:umd": "cross-env NODE_ENV=umd rollup -c --watch",
108
- "clean": "rimraf ./es/ && rimraf ./commonjs/ && rimraf ./dist/ && rimraf ./*.d.ts",
110
+ "clean": "rimraf ./es/ && rimraf ./commonjs/ && rimraf ./dist/ && rimraf ./types/ && rimraf ./*.d.ts",
109
111
  "publish-package": "npm publish",
110
112
  "create-package": "npm pack",
111
- "test": "jest"
113
+ "test": "jest",
114
+ "test:types": "tsc --noEmit -p test/types/tsconfig.json"
112
115
  }
113
116
  }
package/types.d.ts ADDED
@@ -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 type VueProps<T> = {
8
+ [P in keyof T]: any;
9
+ };