myio-js-library 0.1.84 → 0.1.85
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 +13 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.js +13 -2
- package/dist/myio-js-library.umd.js +25 -15
- 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,19 @@ 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.MyIOSelectionStore
|
|
2247
|
+
if (globalThis.window.MyIOSelectionStore) {
|
|
2248
|
+
console.log("[SelectionStore] \u{1F504} REUSING existing global instance");
|
|
2249
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2250
|
+
} else {
|
|
2251
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2252
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2253
|
+
globalThis.window.MyIOSelectionStore = MyIOSelectionStore;
|
|
2254
|
+
}
|
|
2246
2255
|
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2256
|
+
} else {
|
|
2257
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2247
2258
|
}
|
|
2248
2259
|
if (typeof module !== "undefined" && module.exports) {
|
|
2249
2260
|
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,19 @@ 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.MyIOSelectionStore
|
|
2159
|
+
if (globalThis.window.MyIOSelectionStore) {
|
|
2160
|
+
console.log("[SelectionStore] \u{1F504} REUSING existing global instance");
|
|
2161
|
+
MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2162
|
+
} else {
|
|
2163
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2164
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2165
|
+
globalThis.window.MyIOSelectionStore = MyIOSelectionStore;
|
|
2166
|
+
}
|
|
2158
2167
|
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2168
|
+
} else {
|
|
2169
|
+
MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2159
2170
|
}
|
|
2160
2171
|
if (typeof module !== "undefined" && module.exports) {
|
|
2161
2172
|
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,22 @@
|
|
|
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.MyIOSelectionStore
|
|
2165
|
+
if (globalThis.window.MyIOSelectionStore) {
|
|
2166
|
+
console.log("[SelectionStore] \u{1F504} REUSING existing global instance");
|
|
2167
|
+
exports.MyIOSelectionStore = globalThis.window.MyIOSelectionStore;
|
|
2168
|
+
} else {
|
|
2169
|
+
console.log("[SelectionStore] \u{1F195} Creating new global singleton instance");
|
|
2170
|
+
exports.MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2171
|
+
globalThis.window.MyIOSelectionStore = exports.MyIOSelectionStore;
|
|
2172
|
+
}
|
|
2164
2173
|
globalThis.window.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
2174
|
+
} else {
|
|
2175
|
+
exports.MyIOSelectionStore = new MyIOSelectionStoreClass();
|
|
2165
2176
|
}
|
|
2166
2177
|
if (typeof module !== "undefined" && module.exports) {
|
|
2167
|
-
module.exports = { MyIOSelectionStore, MyIOSelectionStoreClass };
|
|
2178
|
+
module.exports = { MyIOSelectionStore: exports.MyIOSelectionStore, MyIOSelectionStoreClass };
|
|
2168
2179
|
}
|
|
2169
2180
|
|
|
2170
2181
|
// src/components/DraggableCard.js
|
|
@@ -2683,8 +2694,8 @@
|
|
|
2683
2694
|
unit: determineUnit(deviceType),
|
|
2684
2695
|
status: mapDeviceStatusToCardStatus(deviceStatus)
|
|
2685
2696
|
};
|
|
2686
|
-
if (enableSelection && MyIOSelectionStore) {
|
|
2687
|
-
MyIOSelectionStore.registerEntity(cardEntity);
|
|
2697
|
+
if (enableSelection && exports.MyIOSelectionStore) {
|
|
2698
|
+
exports.MyIOSelectionStore.registerEntity(cardEntity);
|
|
2688
2699
|
}
|
|
2689
2700
|
const container = document.createElement("div");
|
|
2690
2701
|
container.className = "myio-enhanced-card-container";
|
|
@@ -3442,14 +3453,14 @@
|
|
|
3442
3453
|
if (enhancedCardElement && actionsContainer.children.length > 0) {
|
|
3443
3454
|
enhancedCardElement.insertBefore(actionsContainer, enhancedCardElement.firstChild);
|
|
3444
3455
|
}
|
|
3445
|
-
if (enableSelection && MyIOSelectionStore) {
|
|
3456
|
+
if (enableSelection && exports.MyIOSelectionStore) {
|
|
3446
3457
|
const checkbox = enhancedCardElement.querySelector(".card-checkbox");
|
|
3447
3458
|
if (checkbox) {
|
|
3448
3459
|
checkbox.addEventListener("change", (e) => {
|
|
3449
3460
|
e.stopPropagation();
|
|
3450
3461
|
if (e.target.checked) {
|
|
3451
|
-
const currentCount = MyIOSelectionStore.getSelectedEntities().length;
|
|
3452
|
-
const selectedEntityes = MyIOSelectionStore.getSelectedEntities();
|
|
3462
|
+
const currentCount = exports.MyIOSelectionStore.getSelectedEntities().length;
|
|
3463
|
+
const selectedEntityes = exports.MyIOSelectionStore.getSelectedEntities();
|
|
3453
3464
|
console.log("selectedEntityes", selectedEntityes);
|
|
3454
3465
|
const isTryingToAdd = e.target.checked;
|
|
3455
3466
|
if (isTryingToAdd && currentCount >= 6) {
|
|
@@ -3481,14 +3492,14 @@
|
|
|
3481
3492
|
}
|
|
3482
3493
|
enhancedCardElement.classList.toggle("selected", isSelected);
|
|
3483
3494
|
};
|
|
3484
|
-
MyIOSelectionStore.on("selection:change", handleSelectionChange);
|
|
3485
|
-
const isInitiallySelected = MyIOSelectionStore.isSelected(entityId);
|
|
3495
|
+
exports.MyIOSelectionStore.on("selection:change", handleSelectionChange);
|
|
3496
|
+
const isInitiallySelected = exports.MyIOSelectionStore.isSelected(entityId);
|
|
3486
3497
|
if (checkbox) {
|
|
3487
3498
|
checkbox.checked = isInitiallySelected;
|
|
3488
3499
|
}
|
|
3489
3500
|
enhancedCardElement.classList.toggle("selected", isInitiallySelected);
|
|
3490
3501
|
container._cleanup = () => {
|
|
3491
|
-
MyIOSelectionStore.off("selection:change", handleSelectionChange);
|
|
3502
|
+
exports.MyIOSelectionStore.off("selection:change", handleSelectionChange);
|
|
3492
3503
|
};
|
|
3493
3504
|
}
|
|
3494
3505
|
if (enableDragDrop) {
|
|
@@ -3497,8 +3508,8 @@
|
|
|
3497
3508
|
e.dataTransfer.setData("application/json", JSON.stringify(entityObject));
|
|
3498
3509
|
e.dataTransfer.setData("text/myio-name", entityObject.labelOrName);
|
|
3499
3510
|
e.dataTransfer.effectAllowed = "copy";
|
|
3500
|
-
if (MyIOSelectionStore) {
|
|
3501
|
-
MyIOSelectionStore.startDrag(entityId);
|
|
3511
|
+
if (exports.MyIOSelectionStore) {
|
|
3512
|
+
exports.MyIOSelectionStore.startDrag(entityId);
|
|
3502
3513
|
}
|
|
3503
3514
|
});
|
|
3504
3515
|
enhancedCardElement.addEventListener("dragend", () => {
|
|
@@ -3553,7 +3564,7 @@
|
|
|
3553
3564
|
return renderCardComponent3(options);
|
|
3554
3565
|
}
|
|
3555
3566
|
function renderCardComponent2(options) {
|
|
3556
|
-
const useNewComponents = options.useNewComponents !== false && typeof MyIOSelectionStore !== "undefined" && typeof MyIODraggableCard !== "undefined";
|
|
3567
|
+
const useNewComponents = options.useNewComponents !== false && typeof exports.MyIOSelectionStore !== "undefined" && typeof MyIODraggableCard !== "undefined";
|
|
3557
3568
|
if (useNewComponents) {
|
|
3558
3569
|
return renderCardComponentV2(options);
|
|
3559
3570
|
} else {
|
|
@@ -12345,7 +12356,6 @@
|
|
|
12345
12356
|
exports.DeviceStatusType = DeviceStatusType;
|
|
12346
12357
|
exports.MyIOChartModal = MyIOChartModal;
|
|
12347
12358
|
exports.MyIODraggableCard = MyIODraggableCard;
|
|
12348
|
-
exports.MyIOSelectionStore = MyIOSelectionStore;
|
|
12349
12359
|
exports.MyIOSelectionStoreClass = MyIOSelectionStoreClass;
|
|
12350
12360
|
exports.addDetectionContext = addDetectionContext;
|
|
12351
12361
|
exports.addNamespace = addNamespace;
|