@adaptabletools/adaptable-vue3-aggrid 18.1.4 → 18.1.5

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.
@@ -1,7 +1,8 @@
1
- import { defineComponent, h, inject, isProxy, isReactive, isRef, toRaw } from 'vue';
1
+ import { defineComponent, h, inject, toRaw } from 'vue';
2
2
  import { AdaptableAgGridStateTransitions, AdaptableProviderContextKey, } from './AdaptableProviderContext';
3
3
  import { AgGridVue } from '@ag-grid-community/vue3';
4
4
  import { ComponentUtil } from '@ag-grid-community/core';
5
+ import { deepToRaw } from './utils';
5
6
  const agGridPropertySet = new Set(ComponentUtil.ALL_PROPERTIES);
6
7
  const PASS_THROUGH_PROPS = [
7
8
  'modelValue',
@@ -10,24 +11,6 @@ const PASS_THROUGH_PROPS = [
10
11
  'componentDependencies',
11
12
  'plugins',
12
13
  ];
13
- function deepToRaw(sourceObj) {
14
- const objectIterator = (input) => {
15
- if (Array.isArray(input)) {
16
- return input.map((item) => objectIterator(item));
17
- }
18
- if (isRef(input) || isReactive(input) || isProxy(input)) {
19
- return objectIterator(toRaw(input));
20
- }
21
- if (input && typeof input === 'object') {
22
- return Object.keys(input).reduce((acc, key) => {
23
- acc[key] = objectIterator(input[key]);
24
- return acc;
25
- }, {});
26
- }
27
- return input;
28
- };
29
- return objectIterator(sourceObj);
30
- }
31
14
  const watch = ComponentUtil.ALL_PROPERTIES.reduce((acc, key) => {
32
15
  acc[key] = function (newValue) {
33
16
  /**
@@ -2,6 +2,7 @@ import { _AdaptableAgGrid } from '@adaptabletools/adaptable/agGrid';
2
2
  import { defineComponent, h, inject, toRaw } from 'vue';
3
3
  import { AdaptableAgGridStateTransitions, AdaptableProviderContextKey, } from './AdaptableProviderContext';
4
4
  import { setupFrameworkComponents } from './setupFrameworkComponents';
5
+ import { deepToRaw, deleteUndefinedShallow } from './utils';
5
6
  /**
6
7
  * This component handles the logic of initializing the Adaptable.
7
8
  * It always renders a div, which is the container for the Adaptable.
@@ -54,10 +55,11 @@ export const AdaptableUI = defineComponent({
54
55
  if (transition === AdaptableAgGridStateTransitions.INITIALIZE_ADAPTABLE) {
55
56
  this.adaptableInitialized = true;
56
57
  const el = this.$el;
58
+ const gridOptions = Object.assign(Object.assign({}, deepToRaw(this.gridOptions)), deleteUndefinedShallow(rawAgGridProps));
57
59
  const adaptableApi = await _AdaptableAgGrid._initInternal({
58
60
  modules: this.modules,
59
61
  adaptableOptions: Object.assign(Object.assign({}, this.adaptableOptions), { containerOptions: Object.assign(Object.assign({}, (_a = this.adaptableOptions) === null || _a === void 0 ? void 0 : _a.containerOptions), { adaptableContainer: el }) }),
60
- gridOptions: Object.assign(Object.assign({}, toRaw(this.gridOptions)), rawAgGridProps),
62
+ gridOptions,
61
63
  variant: 'vue',
62
64
  renderAgGridFrameworkComponent: this.renderAgGridFrameworkComponent,
63
65
  });
package/lib/utils.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function deepToRaw<T extends Record<string, any>>(sourceObj: T): T;
2
+ export declare function deleteUndefinedShallow<T extends Record<string, unknown>>(sourceObj: T): T;
package/lib/utils.js ADDED
@@ -0,0 +1,28 @@
1
+ import { isProxy, isReactive, isRef, toRaw } from 'vue';
2
+ export function deepToRaw(sourceObj) {
3
+ const objectIterator = (input) => {
4
+ if (Array.isArray(input)) {
5
+ return input.map((item) => objectIterator(item));
6
+ }
7
+ if (isRef(input) || isReactive(input) || isProxy(input)) {
8
+ return objectIterator(toRaw(input));
9
+ }
10
+ if (input && typeof input === 'object') {
11
+ return Object.keys(input).reduce((acc, key) => {
12
+ acc[key] = objectIterator(input[key]);
13
+ return acc;
14
+ }, {});
15
+ }
16
+ return input;
17
+ };
18
+ return objectIterator(sourceObj);
19
+ }
20
+ export function deleteUndefinedShallow(sourceObj) {
21
+ return Object.keys(sourceObj).reduce((acc, key) => {
22
+ if (sourceObj[key] !== undefined) {
23
+ // @ts-ignore
24
+ acc[key] = sourceObj[key];
25
+ }
26
+ return acc;
27
+ }, {});
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-vue3-aggrid",
3
- "version": "18.1.4",
3
+ "version": "18.1.5",
4
4
  "type": "module",
5
5
  "typings": "lib/index.d.ts",
6
6
  "peerDependencies": {
@@ -9,7 +9,7 @@
9
9
  "vue": "^3.0.0"
10
10
  },
11
11
  "dependencies": {
12
- "@adaptabletools/adaptable": "18.1.4"
12
+ "@adaptabletools/adaptable": "18.1.5"
13
13
  },
14
14
  "module": "lib/index.js"
15
15
  }