myio-js-library 0.1.84 → 0.1.86
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/dist/index.cjs +32 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.js +32 -3
- package/dist/myio-js-library.umd.js +44 -16
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1913,6 +1913,8 @@ init_template_card();
|
|
|
1913
1913
|
// src/components/SelectionStore.js
|
|
1914
1914
|
var MyIOSelectionStoreClass = class {
|
|
1915
1915
|
constructor() {
|
|
1916
|
+
console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
|
|
1917
|
+
console.trace("[SelectionStore] Constructor called from:");
|
|
1916
1918
|
this.state = { selectedDevice: null };
|
|
1917
1919
|
this.selectedIds = /* @__PURE__ */ new Set();
|
|
1918
1920
|
this.entities = /* @__PURE__ */ new Map();
|
|
@@ -2240,10 +2242,37 @@ var MyIOSelectionStoreClass = class {
|
|
|
2240
2242
|
return data;
|
|
2241
2243
|
}
|
|
2242
2244
|
};
|
|
2243
|
-
var MyIOSelectionStore
|
|
2245
|
+
var MyIOSelectionStore;
|
|
2244
2246
|
if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
|
|
2245
|
-
globalThis.window
|
|
2246
|
-
|
|
2247
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
|
|
2248
|
+
if (descriptor && !descriptor.configurable) {
|
|
2249
|
+
console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
|
|
2250
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2251
|
+
} else if (globalThis.window.MyIOSelectionStore) {
|
|
2252
|
+
console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
|
|
2253
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2254
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2255
|
+
value: MyIOSelectionStore,
|
|
2256
|
+
writable: false,
|
|
2257
|
+
configurable: false,
|
|
2258
|
+
enumerable: true
|
|
2259
|
+
});
|
|
2260
|
+
} else {
|
|
2261
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2262
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2263
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2264
|
+
value: MyIOSelectionStore,
|
|
2265
|
+
writable: false,
|
|
2266
|
+
configurable: false,
|
|
2267
|
+
enumerable: true
|
|
2268
|
+
});
|
|
2269
|
+
console.log("[SelectionStore] \u{1F512} Instance locked and ready");
|
|
2270
|
+
}
|
|
2271
|
+
if (!globalThis.window.MyIOSelectionStoreClass) {
|
|
2272
|
+
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2273
|
+
}
|
|
2274
|
+
} else {
|
|
2275
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2247
2276
|
}
|
|
2248
2277
|
if (typeof module !== "undefined" && module.exports) {
|
|
2249
2278
|
module.exports = { MyIOSelectionStore, MyIOSelectionStoreClass };
|
package/dist/index.d.cts
CHANGED
|
@@ -767,7 +767,7 @@ declare function renderCardComponentHeadOffice(containerEl: any, params: any): {
|
|
|
767
767
|
getRoot(): HTMLDivElement;
|
|
768
768
|
};
|
|
769
769
|
|
|
770
|
-
declare
|
|
770
|
+
declare let MyIOSelectionStore: any;
|
|
771
771
|
/**
|
|
772
772
|
* MYIO SelectionStore Component
|
|
773
773
|
* Global singleton for managing selection state, multi-unit totals, time-series data, and analytics
|
package/dist/index.js
CHANGED
|
@@ -1825,6 +1825,8 @@ init_template_card();
|
|
|
1825
1825
|
// src/components/SelectionStore.js
|
|
1826
1826
|
var MyIOSelectionStoreClass = class {
|
|
1827
1827
|
constructor() {
|
|
1828
|
+
console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
|
|
1829
|
+
console.trace("[SelectionStore] Constructor called from:");
|
|
1828
1830
|
this.state = { selectedDevice: null };
|
|
1829
1831
|
this.selectedIds = /* @__PURE__ */ new Set();
|
|
1830
1832
|
this.entities = /* @__PURE__ */ new Map();
|
|
@@ -2152,10 +2154,37 @@ var MyIOSelectionStoreClass = class {
|
|
|
2152
2154
|
return data;
|
|
2153
2155
|
}
|
|
2154
2156
|
};
|
|
2155
|
-
var MyIOSelectionStore
|
|
2157
|
+
var MyIOSelectionStore;
|
|
2156
2158
|
if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
|
|
2157
|
-
globalThis.window
|
|
2158
|
-
|
|
2159
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
|
|
2160
|
+
if (descriptor && !descriptor.configurable) {
|
|
2161
|
+
console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
|
|
2162
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2163
|
+
} else if (globalThis.window.MyIOSelectionStore) {
|
|
2164
|
+
console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
|
|
2165
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2166
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2167
|
+
value: MyIOSelectionStore,
|
|
2168
|
+
writable: false,
|
|
2169
|
+
configurable: false,
|
|
2170
|
+
enumerable: true
|
|
2171
|
+
});
|
|
2172
|
+
} else {
|
|
2173
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2174
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2175
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2176
|
+
value: MyIOSelectionStore,
|
|
2177
|
+
writable: false,
|
|
2178
|
+
configurable: false,
|
|
2179
|
+
enumerable: true
|
|
2180
|
+
});
|
|
2181
|
+
console.log("[SelectionStore] \u{1F512} Instance locked and ready");
|
|
2182
|
+
}
|
|
2183
|
+
if (!globalThis.window.MyIOSelectionStoreClass) {
|
|
2184
|
+
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2185
|
+
}
|
|
2186
|
+
} else {
|
|
2187
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2159
2188
|
}
|
|
2160
2189
|
if (typeof module !== "undefined" && module.exports) {
|
|
2161
2190
|
module.exports = { MyIOSelectionStore, MyIOSelectionStoreClass };
|
|
@@ -1831,6 +1831,8 @@
|
|
|
1831
1831
|
// src/components/SelectionStore.js
|
|
1832
1832
|
var MyIOSelectionStoreClass = class {
|
|
1833
1833
|
constructor() {
|
|
1834
|
+
console.log("[SelectionStore] \u{1F3D7}\uFE0F NEW INSTANCE CREATED at:", (/* @__PURE__ */ new Date()).toISOString());
|
|
1835
|
+
console.trace("[SelectionStore] Constructor called from:");
|
|
1834
1836
|
this.state = { selectedDevice: null };
|
|
1835
1837
|
this.selectedIds = /* @__PURE__ */ new Set();
|
|
1836
1838
|
this.entities = /* @__PURE__ */ new Map();
|
|
@@ -2158,13 +2160,40 @@
|
|
|
2158
2160
|
return data;
|
|
2159
2161
|
}
|
|
2160
2162
|
};
|
|
2161
|
-
|
|
2163
|
+
exports.MyIOSelectionStore = void 0;
|
|
2162
2164
|
if (typeof globalThis !== "undefined" && typeof globalThis.window !== "undefined") {
|
|
2163
|
-
globalThis.window
|
|
2164
|
-
|
|
2165
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis.window, "MyIOSelectionStore");
|
|
2166
|
+
if (descriptor && !descriptor.configurable) {
|
|
2167
|
+
console.log("[SelectionStore] \u{1F504} REUSING locked global instance");
|
|
2168
|
+
exports.MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2169
|
+
} else if (globalThis.window.MyIOSelectionStore) {
|
|
2170
|
+
console.log("[SelectionStore] \u{1F512} LOCKING existing instance");
|
|
2171
|
+
exports.MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2172
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2173
|
+
value: exports.MyIOSelectionStore,
|
|
2174
|
+
writable: false,
|
|
2175
|
+
configurable: false,
|
|
2176
|
+
enumerable: true
|
|
2177
|
+
});
|
|
2178
|
+
} else {
|
|
2179
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2180
|
+
exports.MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2181
|
+
Object.defineProperty(globalThis.window, "MyIOSelectionStore", {
|
|
2182
|
+
value: exports.MyIOSelectionStore,
|
|
2183
|
+
writable: false,
|
|
2184
|
+
configurable: false,
|
|
2185
|
+
enumerable: true
|
|
2186
|
+
});
|
|
2187
|
+
console.log("[SelectionStore] \u{1F512} Instance locked and ready");
|
|
2188
|
+
}
|
|
2189
|
+
if (!globalThis.window.MyIOSelectionStoreClass) {
|
|
2190
|
+
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2191
|
+
}
|
|
2192
|
+
} else {
|
|
2193
|
+
exports.MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2165
2194
|
}
|
|
2166
2195
|
if (typeof module !== "undefined" && module.exports) {
|
|
2167
|
-
module.exports = { MyIOSelectionStore, MyIOSelectionStoreClass };
|
|
2196
|
+
module.exports = { MyIOSelectionStore: exports.MyIOSelectionStore, MyIOSelectionStoreClass };
|
|
2168
2197
|
}
|
|
2169
2198
|
|
|
2170
2199
|
// src/components/DraggableCard.js
|
|
@@ -2683,8 +2712,8 @@
|
|
|
2683
2712
|
unit: determineUnit(deviceType),
|
|
2684
2713
|
status: mapDeviceStatusToCardStatus(deviceStatus)
|
|
2685
2714
|
};
|
|
2686
|
-
if (enableSelection && MyIOSelectionStore) {
|
|
2687
|
-
MyIOSelectionStore.registerEntity(cardEntity);
|
|
2715
|
+
if (enableSelection && exports.MyIOSelectionStore) {
|
|
2716
|
+
exports.MyIOSelectionStore.registerEntity(cardEntity);
|
|
2688
2717
|
}
|
|
2689
2718
|
const container = document.createElement("div");
|
|
2690
2719
|
container.className = "myio-enhanced-card-container";
|
|
@@ -3442,14 +3471,14 @@
|
|
|
3442
3471
|
if (enhancedCardElement && actionsContainer.children.length > 0) {
|
|
3443
3472
|
enhancedCardElement.insertBefore(actionsContainer, enhancedCardElement.firstChild);
|
|
3444
3473
|
}
|
|
3445
|
-
if (enableSelection && MyIOSelectionStore) {
|
|
3474
|
+
if (enableSelection && exports.MyIOSelectionStore) {
|
|
3446
3475
|
const checkbox = enhancedCardElement.querySelector(".card-checkbox");
|
|
3447
3476
|
if (checkbox) {
|
|
3448
3477
|
checkbox.addEventListener("change", (e) => {
|
|
3449
3478
|
e.stopPropagation();
|
|
3450
3479
|
if (e.target.checked) {
|
|
3451
|
-
const currentCount = MyIOSelectionStore.getSelectedEntities().length;
|
|
3452
|
-
const selectedEntityes = MyIOSelectionStore.getSelectedEntities();
|
|
3480
|
+
const currentCount = exports.MyIOSelectionStore.getSelectedEntities().length;
|
|
3481
|
+
const selectedEntityes = exports.MyIOSelectionStore.getSelectedEntities();
|
|
3453
3482
|
console.log("selectedEntityes", selectedEntityes);
|
|
3454
3483
|
const isTryingToAdd = e.target.checked;
|
|
3455
3484
|
if (isTryingToAdd && currentCount >= 6) {
|
|
@@ -3481,14 +3510,14 @@
|
|
|
3481
3510
|
}
|
|
3482
3511
|
enhancedCardElement.classList.toggle("selected", isSelected);
|
|
3483
3512
|
};
|
|
3484
|
-
MyIOSelectionStore.on("selection:change", handleSelectionChange);
|
|
3485
|
-
const isInitiallySelected = MyIOSelectionStore.isSelected(entityId);
|
|
3513
|
+
exports.MyIOSelectionStore.on("selection:change", handleSelectionChange);
|
|
3514
|
+
const isInitiallySelected = exports.MyIOSelectionStore.isSelected(entityId);
|
|
3486
3515
|
if (checkbox) {
|
|
3487
3516
|
checkbox.checked = isInitiallySelected;
|
|
3488
3517
|
}
|
|
3489
3518
|
enhancedCardElement.classList.toggle("selected", isInitiallySelected);
|
|
3490
3519
|
container._cleanup = () => {
|
|
3491
|
-
MyIOSelectionStore.off("selection:change", handleSelectionChange);
|
|
3520
|
+
exports.MyIOSelectionStore.off("selection:change", handleSelectionChange);
|
|
3492
3521
|
};
|
|
3493
3522
|
}
|
|
3494
3523
|
if (enableDragDrop) {
|
|
@@ -3497,8 +3526,8 @@
|
|
|
3497
3526
|
e.dataTransfer.setData("application/json", JSON.stringify(entityObject));
|
|
3498
3527
|
e.dataTransfer.setData("text/myio-name", entityObject.labelOrName);
|
|
3499
3528
|
e.dataTransfer.effectAllowed = "copy";
|
|
3500
|
-
if (MyIOSelectionStore) {
|
|
3501
|
-
MyIOSelectionStore.startDrag(entityId);
|
|
3529
|
+
if (exports.MyIOSelectionStore) {
|
|
3530
|
+
exports.MyIOSelectionStore.startDrag(entityId);
|
|
3502
3531
|
}
|
|
3503
3532
|
});
|
|
3504
3533
|
enhancedCardElement.addEventListener("dragend", () => {
|
|
@@ -3553,7 +3582,7 @@
|
|
|
3553
3582
|
return renderCardComponent3(options);
|
|
3554
3583
|
}
|
|
3555
3584
|
function renderCardComponent2(options) {
|
|
3556
|
-
const useNewComponents = options.useNewComponents !== false && typeof MyIOSelectionStore !== "undefined" && typeof MyIODraggableCard !== "undefined";
|
|
3585
|
+
const useNewComponents = options.useNewComponents !== false && typeof exports.MyIOSelectionStore !== "undefined" && typeof MyIODraggableCard !== "undefined";
|
|
3557
3586
|
if (useNewComponents) {
|
|
3558
3587
|
return renderCardComponentV2(options);
|
|
3559
3588
|
} else {
|
|
@@ -12345,7 +12374,6 @@
|
|
|
12345
12374
|
exports.DeviceStatusType = DeviceStatusType;
|
|
12346
12375
|
exports.MyIOChartModal = MyIOChartModal;
|
|
12347
12376
|
exports.MyIODraggableCard = MyIODraggableCard;
|
|
12348
|
-
exports.MyIOSelectionStore = MyIOSelectionStore;
|
|
12349
12377
|
exports.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
12350
12378
|
exports.addDetectionContext = addDetectionContext;
|
|
12351
12379
|
exports.addNamespace = addNamespace;
|