@duet3d/objectmodel 3.7.0-beta.5 → 3.7.0-beta.6
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/README.md +1 -7
- package/dist/ModelCollection.js +4 -5
- package/dist/ModelObject.js +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,13 +4,7 @@ TypeScript implementation of the Duet3D Object Model.
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
Install via `npm install @duet3d/objectmodel`.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
globalThis._duetModelSetArray = (array, index, value) => Vue.set(array, index, value);
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This is required to make sure that change events for arrays are correctly fired.
|
|
7
|
+
Install via `npm install @duet3d/objectmodel`.
|
|
14
8
|
|
|
15
9
|
## Bug reports
|
|
16
10
|
|
package/dist/ModelCollection.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isModelObject } from "./ModelObject";
|
|
2
|
-
import { setArrayItem } from "./index";
|
|
3
2
|
/**
|
|
4
3
|
* Class for storing model object items in an array
|
|
5
4
|
*/
|
|
@@ -52,23 +51,23 @@ export class ModelCollection extends Array {
|
|
|
52
51
|
if (currentItem === null) {
|
|
53
52
|
const newItem = jsonElement[i];
|
|
54
53
|
if (newItem instanceof that.$itemConstructor) {
|
|
55
|
-
|
|
54
|
+
this[i] = jsonElement[i];
|
|
56
55
|
}
|
|
57
56
|
else {
|
|
58
57
|
const refItem = new that.$itemConstructor();
|
|
59
|
-
|
|
58
|
+
this[i] = refItem.update(newItem);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
else if (isModelObject(currentItem)) {
|
|
63
62
|
const newItem = currentItem.update(jsonElement[i]);
|
|
64
63
|
if (currentItem !== newItem) {
|
|
65
|
-
|
|
64
|
+
this[i] = newItem;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
68
|
const newItem = jsonElement[i];
|
|
70
69
|
if (currentItem !== newItem) {
|
|
71
|
-
|
|
70
|
+
this[i] = newItem;
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
}
|
package/dist/ModelObject.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelCollection
|
|
1
|
+
import { ModelCollection } from "./index";
|
|
2
2
|
/**
|
|
3
3
|
* Check whether a given value provides model update functionality
|
|
4
4
|
* @param value Value to check
|
|
@@ -49,12 +49,12 @@ export class ModelObject {
|
|
|
49
49
|
for (let i = 0; i < Math.min(prop.length, value.length); i++) {
|
|
50
50
|
const propItem = prop[i];
|
|
51
51
|
if (propItem === null) {
|
|
52
|
-
|
|
52
|
+
prop[i] = value[i];
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
55
|
const newItem = value[i];
|
|
56
56
|
if (propItem !== newItem) {
|
|
57
|
-
|
|
57
|
+
prop[i] = newItem;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -25,13 +25,3 @@ export * from "./ObjectModel";
|
|
|
25
25
|
// Expose ObjectModel as default export
|
|
26
26
|
import ObjectModel from "./ObjectModel";
|
|
27
27
|
export default ObjectModel;
|
|
28
|
-
// Unfortunately we need to define a way to update arrays to remain compatible with Vue 2 (due to IE11).
|
|
29
|
-
// This will become obsolete as soon as DWC is upgraded to Vue 3, but that isn't going to happen anytime soon.
|
|
30
|
-
// Until then a Vue 2 user would have to call something like this on initialization to work around this limitation:
|
|
31
|
-
// globalThis._duetModelSetArray = (array, index, value) => Vue.set(array, index, value);
|
|
32
|
-
// or in TypeScript
|
|
33
|
-
// (globalThis as any)._duetModelSetArray = (array: object, index: string | number, value: any) => Vue.set(array, index, value);
|
|
34
|
-
globalThis._duetModelSetArray = (array, index, value) => array[index] = value;
|
|
35
|
-
export function setArrayItem(array, index, value) {
|
|
36
|
-
globalThis._duetModelSetArray(array, index, value);
|
|
37
|
-
}
|