myio-js-library 0.1.515 → 0.1.516
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 +88 -30
- package/dist/index.d.cts +6 -0
- package/dist/index.js +88 -30
- package/dist/myio-js-library.umd.js +88 -30
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1208,7 +1208,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
1208
1208
|
// package.json
|
|
1209
1209
|
var package_default = {
|
|
1210
1210
|
name: "myio-js-library",
|
|
1211
|
-
version: "0.1.
|
|
1211
|
+
version: "0.1.516",
|
|
1212
1212
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
1213
1213
|
license: "MIT",
|
|
1214
1214
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -84810,6 +84810,40 @@ var DEFAULT_INGESTION_API_BASE = "https://api.data.apps.myio-bas.com";
|
|
|
84810
84810
|
var CACHE_TTL_MS2 = 5 * 60 * 1e3;
|
|
84811
84811
|
var MYIO_PURPLE = "#3e1a7d";
|
|
84812
84812
|
var MYIO_PURPLE_DARK = "#2d1360";
|
|
84813
|
+
var BULK_DEVICE_TYPE_OPTIONS = [
|
|
84814
|
+
// Energia
|
|
84815
|
+
"COMPRESSOR",
|
|
84816
|
+
"VENTILADOR",
|
|
84817
|
+
"MOTOR",
|
|
84818
|
+
"BOMBA_HIDRAULICA",
|
|
84819
|
+
"BOMBA_CAG",
|
|
84820
|
+
"BOMBA_INCENDIO",
|
|
84821
|
+
"CHILLER",
|
|
84822
|
+
"FANCOIL",
|
|
84823
|
+
"AR_CONDICIONADO",
|
|
84824
|
+
"3F_MEDIDOR",
|
|
84825
|
+
"ELEVADOR",
|
|
84826
|
+
"ESCADA_ROLANTE",
|
|
84827
|
+
"RELOGIO",
|
|
84828
|
+
"ENTRADA",
|
|
84829
|
+
"SUBESTACAO",
|
|
84830
|
+
"TRAFO",
|
|
84831
|
+
// Água
|
|
84832
|
+
"HIDROMETRO",
|
|
84833
|
+
"HIDROMETRO_AREA_COMUM",
|
|
84834
|
+
"HIDROMETRO_SHOPPING",
|
|
84835
|
+
"CAIXA_DAGUA",
|
|
84836
|
+
"TANK",
|
|
84837
|
+
// BAS / Outros (switch, automação, climatização auxiliar)
|
|
84838
|
+
"TERMOSTATO",
|
|
84839
|
+
"LAMP",
|
|
84840
|
+
"PLUG",
|
|
84841
|
+
"REMOTE",
|
|
84842
|
+
"CONTROLE_REMOTO",
|
|
84843
|
+
"SELETOR_AUTO_MANUAL",
|
|
84844
|
+
"SOLENOIDE",
|
|
84845
|
+
"GLOBAL_AUTOMACAO"
|
|
84846
|
+
];
|
|
84813
84847
|
var CHECK_FIX_DOMAIN = {
|
|
84814
84848
|
COMPRESSOR: "energy",
|
|
84815
84849
|
VENTILADOR: "energy",
|
|
@@ -85304,7 +85338,7 @@ function openUpsellModal(params) {
|
|
|
85304
85338
|
deviceFilters: { types: [], deviceTypes: [], deviceProfiles: [], statuses: [], telemetryKeys: [] },
|
|
85305
85339
|
deviceSelectionMode: "single",
|
|
85306
85340
|
selectedDevices: [],
|
|
85307
|
-
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false },
|
|
85341
|
+
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false, customValue: false },
|
|
85308
85342
|
bulkProfileModal: { open: false, selectedProfileId: "", saving: false },
|
|
85309
85343
|
bulkOwnerModal: { open: false, saving: false, targetCustomerId: "" },
|
|
85310
85344
|
columnWidths: {
|
|
@@ -85625,34 +85659,20 @@ function renderModal4(container, state6, modalId, t, error) {
|
|
|
85625
85659
|
<label style="display: block; color: ${colors2.textMuted}; font-size: 12px; margin-bottom: 6px; font-weight: 500;">
|
|
85626
85660
|
Valor
|
|
85627
85661
|
</label>
|
|
85628
|
-
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-
|
|
85662
|
+
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-type-select" style="
|
|
85629
85663
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
85630
85664
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
85631
85665
|
background: ${colors2.inputBg}; cursor: pointer; box-sizing: border-box;
|
|
85632
85666
|
">
|
|
85633
85667
|
<option value="">\u2014 Selecione \u2014</option>
|
|
85634
|
-
${
|
|
85635
|
-
|
|
85636
|
-
|
|
85637
|
-
|
|
85638
|
-
|
|
85639
|
-
|
|
85640
|
-
|
|
85641
|
-
|
|
85642
|
-
"FANCOIL",
|
|
85643
|
-
"3F_MEDIDOR",
|
|
85644
|
-
"RELOGIO",
|
|
85645
|
-
"ENTRADA",
|
|
85646
|
-
"SUBESTACAO",
|
|
85647
|
-
"AR_CONDICIONADO",
|
|
85648
|
-
"HIDROMETRO",
|
|
85649
|
-
"HIDROMETRO_AREA_COMUM",
|
|
85650
|
-
"HIDROMETRO_SHOPPING",
|
|
85651
|
-
"CAIXA_DAGUA",
|
|
85652
|
-
"TANK",
|
|
85653
|
-
"TERMOSTATO"
|
|
85654
|
-
].map((opt) => `<option value="${opt}" ${state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
85655
|
-
</select>` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
85668
|
+
${BULK_DEVICE_TYPE_OPTIONS.map((opt) => `<option value="${opt}" ${!state6.bulkAttributeModal.customValue && state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
85669
|
+
<option value="__OTHER__" ${state6.bulkAttributeModal.customValue ? "selected" : ""}>Outro (digitar)\u2026</option>
|
|
85670
|
+
</select>
|
|
85671
|
+
${state6.bulkAttributeModal.customValue ? `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
85672
|
+
width: 100%; padding: 10px 12px; margin-top: 8px; border: 1px solid ${colors2.border};
|
|
85673
|
+
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
85674
|
+
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
85675
|
+
"/>` : ""}` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
85656
85676
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
85657
85677
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
85658
85678
|
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
@@ -88541,16 +88561,31 @@ function setupEventListeners3(container, state6, modalId, t, onClose) {
|
|
|
88541
88561
|
document.getElementById(`${modalId}-bulk-close`)?.addEventListener("click", () => {
|
|
88542
88562
|
state6.bulkAttributeModal.open = false;
|
|
88543
88563
|
state6.bulkAttributeModal.value = "";
|
|
88564
|
+
state6.bulkAttributeModal.customValue = false;
|
|
88544
88565
|
renderModal4(container, state6, modalId, t);
|
|
88545
88566
|
});
|
|
88546
88567
|
document.getElementById(`${modalId}-bulk-cancel`)?.addEventListener("click", () => {
|
|
88547
88568
|
state6.bulkAttributeModal.open = false;
|
|
88548
88569
|
state6.bulkAttributeModal.value = "";
|
|
88570
|
+
state6.bulkAttributeModal.customValue = false;
|
|
88549
88571
|
renderModal4(container, state6, modalId, t);
|
|
88550
88572
|
});
|
|
88551
88573
|
document.getElementById(`${modalId}-bulk-attr-select`)?.addEventListener("change", (e) => {
|
|
88552
88574
|
state6.bulkAttributeModal.attribute = e.target.value;
|
|
88553
88575
|
state6.bulkAttributeModal.value = "";
|
|
88576
|
+
state6.bulkAttributeModal.customValue = false;
|
|
88577
|
+
renderModal4(container, state6, modalId, t);
|
|
88578
|
+
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
88579
|
+
});
|
|
88580
|
+
document.getElementById(`${modalId}-bulk-attr-type-select`)?.addEventListener("change", (e) => {
|
|
88581
|
+
const selected = e.target.value;
|
|
88582
|
+
if (selected === "__OTHER__") {
|
|
88583
|
+
state6.bulkAttributeModal.customValue = true;
|
|
88584
|
+
state6.bulkAttributeModal.value = "";
|
|
88585
|
+
} else {
|
|
88586
|
+
state6.bulkAttributeModal.customValue = false;
|
|
88587
|
+
state6.bulkAttributeModal.value = selected;
|
|
88588
|
+
}
|
|
88554
88589
|
renderModal4(container, state6, modalId, t);
|
|
88555
88590
|
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
88556
88591
|
});
|
|
@@ -88558,9 +88593,6 @@ function setupEventListeners3(container, state6, modalId, t, onClose) {
|
|
|
88558
88593
|
bulkAttrValueEl?.addEventListener("input", (e) => {
|
|
88559
88594
|
state6.bulkAttributeModal.value = e.target.value;
|
|
88560
88595
|
});
|
|
88561
|
-
bulkAttrValueEl?.addEventListener("change", (e) => {
|
|
88562
|
-
state6.bulkAttributeModal.value = e.target.value;
|
|
88563
|
-
});
|
|
88564
88596
|
document.getElementById(`${modalId}-bulk-save`)?.addEventListener("click", async () => {
|
|
88565
88597
|
await saveBulkAttribute(state6, container, modalId, t, onClose);
|
|
88566
88598
|
});
|
|
@@ -90409,6 +90441,7 @@ async function saveBulkAttribute(state6, container, modalId, t, onClose) {
|
|
|
90409
90441
|
state6.bulkAttributeModal.saving = false;
|
|
90410
90442
|
state6.bulkAttributeModal.open = false;
|
|
90411
90443
|
state6.bulkAttributeModal.value = "";
|
|
90444
|
+
state6.bulkAttributeModal.customValue = false;
|
|
90412
90445
|
if (errorCount === 0) {
|
|
90413
90446
|
alert(`Atributo "${attribute}" salvo com sucesso para ${successCount} dispositivos!`);
|
|
90414
90447
|
} else {
|
|
@@ -134143,6 +134176,13 @@ function injectAmbienteModalStyles() {
|
|
|
134143
134176
|
border-radius: 10px;
|
|
134144
134177
|
background: rgba(108, 117, 125, 0.08);
|
|
134145
134178
|
border: 1px solid rgba(108, 117, 125, 0.18);
|
|
134179
|
+
cursor: pointer;
|
|
134180
|
+
transition: background 0.15s ease, border-color 0.15s ease;
|
|
134181
|
+
}
|
|
134182
|
+
|
|
134183
|
+
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item:hover {
|
|
134184
|
+
background: rgba(108, 117, 125, 0.14);
|
|
134185
|
+
border-color: rgba(108, 117, 125, 0.32);
|
|
134146
134186
|
}
|
|
134147
134187
|
|
|
134148
134188
|
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-info {
|
|
@@ -134636,13 +134676,31 @@ function createAmbienteDetailModal(data, source, config = {}) {
|
|
|
134636
134676
|
btn.addEventListener("click", (e) => {
|
|
134637
134677
|
e.stopPropagation();
|
|
134638
134678
|
const remoteId = btn.dataset.remoteId;
|
|
134639
|
-
const currentState = btn.dataset.remoteState === "on";
|
|
134640
134679
|
const remote = data.remoteDevices?.find((r) => r.id === remoteId);
|
|
134641
|
-
if (remote
|
|
134680
|
+
if (!remote) return;
|
|
134681
|
+
if (config.onSwitchClick) {
|
|
134682
|
+
close();
|
|
134683
|
+
config.onSwitchClick(remote);
|
|
134684
|
+
} else if (config.onRemoteToggle) {
|
|
134685
|
+
const currentState = btn.dataset.remoteState === "on";
|
|
134642
134686
|
config.onRemoteToggle(!currentState, remote);
|
|
134643
134687
|
}
|
|
134644
134688
|
});
|
|
134645
134689
|
});
|
|
134690
|
+
if (config.onSwitchClick) {
|
|
134691
|
+
const seletorItems = container.querySelectorAll(`.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item`);
|
|
134692
|
+
seletorItems.forEach((item) => {
|
|
134693
|
+
item.addEventListener("click", (e) => {
|
|
134694
|
+
e.stopPropagation();
|
|
134695
|
+
const seletorId = item.dataset.seletorId;
|
|
134696
|
+
const seletor = data.seletorDevices?.find((s) => s.id === seletorId);
|
|
134697
|
+
if (seletor && config.onSwitchClick) {
|
|
134698
|
+
close();
|
|
134699
|
+
config.onSwitchClick(seletor);
|
|
134700
|
+
}
|
|
134701
|
+
});
|
|
134702
|
+
});
|
|
134703
|
+
}
|
|
134646
134704
|
if (config.onEnergyDeviceClick) {
|
|
134647
134705
|
const energyDeviceItems = container.querySelectorAll(`[data-energy-device-id]`);
|
|
134648
134706
|
energyDeviceItems.forEach((item) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -18113,6 +18113,12 @@ interface AmbienteDetailModalConfig {
|
|
|
18113
18113
|
showTimelineChart?: boolean;
|
|
18114
18114
|
/** Callback when remote toggle is clicked */
|
|
18115
18115
|
onRemoteToggle?: (isOn: boolean, remote: AmbienteRemoteDevice) => void;
|
|
18116
|
+
/**
|
|
18117
|
+
* Callback when a switch device (Interruptor LAMP/REMOTE or Seletor) is clicked.
|
|
18118
|
+
* Used to open the On/Off device modal (control + actuation logs + scheduling).
|
|
18119
|
+
* Takes precedence over onRemoteToggle for the Interruptor buttons.
|
|
18120
|
+
*/
|
|
18121
|
+
onSwitchClick?: (device: AmbienteRemoteDevice | AmbienteSeletorDevice) => void;
|
|
18116
18122
|
/** Callback when energy device is clicked (closes modal and opens device modal) */
|
|
18117
18123
|
onEnergyDeviceClick?: (device: AmbienteEnergyDevice) => void;
|
|
18118
18124
|
/** Callback when modal is closed */
|
package/dist/index.js
CHANGED
|
@@ -546,7 +546,7 @@ var init_template_card = __esm({
|
|
|
546
546
|
// package.json
|
|
547
547
|
var package_default = {
|
|
548
548
|
name: "myio-js-library",
|
|
549
|
-
version: "0.1.
|
|
549
|
+
version: "0.1.516",
|
|
550
550
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
551
551
|
license: "MIT",
|
|
552
552
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -84148,6 +84148,40 @@ var DEFAULT_INGESTION_API_BASE = "https://api.data.apps.myio-bas.com";
|
|
|
84148
84148
|
var CACHE_TTL_MS2 = 5 * 60 * 1e3;
|
|
84149
84149
|
var MYIO_PURPLE = "#3e1a7d";
|
|
84150
84150
|
var MYIO_PURPLE_DARK = "#2d1360";
|
|
84151
|
+
var BULK_DEVICE_TYPE_OPTIONS = [
|
|
84152
|
+
// Energia
|
|
84153
|
+
"COMPRESSOR",
|
|
84154
|
+
"VENTILADOR",
|
|
84155
|
+
"MOTOR",
|
|
84156
|
+
"BOMBA_HIDRAULICA",
|
|
84157
|
+
"BOMBA_CAG",
|
|
84158
|
+
"BOMBA_INCENDIO",
|
|
84159
|
+
"CHILLER",
|
|
84160
|
+
"FANCOIL",
|
|
84161
|
+
"AR_CONDICIONADO",
|
|
84162
|
+
"3F_MEDIDOR",
|
|
84163
|
+
"ELEVADOR",
|
|
84164
|
+
"ESCADA_ROLANTE",
|
|
84165
|
+
"RELOGIO",
|
|
84166
|
+
"ENTRADA",
|
|
84167
|
+
"SUBESTACAO",
|
|
84168
|
+
"TRAFO",
|
|
84169
|
+
// Água
|
|
84170
|
+
"HIDROMETRO",
|
|
84171
|
+
"HIDROMETRO_AREA_COMUM",
|
|
84172
|
+
"HIDROMETRO_SHOPPING",
|
|
84173
|
+
"CAIXA_DAGUA",
|
|
84174
|
+
"TANK",
|
|
84175
|
+
// BAS / Outros (switch, automação, climatização auxiliar)
|
|
84176
|
+
"TERMOSTATO",
|
|
84177
|
+
"LAMP",
|
|
84178
|
+
"PLUG",
|
|
84179
|
+
"REMOTE",
|
|
84180
|
+
"CONTROLE_REMOTO",
|
|
84181
|
+
"SELETOR_AUTO_MANUAL",
|
|
84182
|
+
"SOLENOIDE",
|
|
84183
|
+
"GLOBAL_AUTOMACAO"
|
|
84184
|
+
];
|
|
84151
84185
|
var CHECK_FIX_DOMAIN = {
|
|
84152
84186
|
COMPRESSOR: "energy",
|
|
84153
84187
|
VENTILADOR: "energy",
|
|
@@ -84642,7 +84676,7 @@ function openUpsellModal(params) {
|
|
|
84642
84676
|
deviceFilters: { types: [], deviceTypes: [], deviceProfiles: [], statuses: [], telemetryKeys: [] },
|
|
84643
84677
|
deviceSelectionMode: "single",
|
|
84644
84678
|
selectedDevices: [],
|
|
84645
|
-
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false },
|
|
84679
|
+
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false, customValue: false },
|
|
84646
84680
|
bulkProfileModal: { open: false, selectedProfileId: "", saving: false },
|
|
84647
84681
|
bulkOwnerModal: { open: false, saving: false, targetCustomerId: "" },
|
|
84648
84682
|
columnWidths: {
|
|
@@ -84963,34 +84997,20 @@ function renderModal4(container, state6, modalId, t, error) {
|
|
|
84963
84997
|
<label style="display: block; color: ${colors2.textMuted}; font-size: 12px; margin-bottom: 6px; font-weight: 500;">
|
|
84964
84998
|
Valor
|
|
84965
84999
|
</label>
|
|
84966
|
-
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-
|
|
85000
|
+
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-type-select" style="
|
|
84967
85001
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
84968
85002
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
84969
85003
|
background: ${colors2.inputBg}; cursor: pointer; box-sizing: border-box;
|
|
84970
85004
|
">
|
|
84971
85005
|
<option value="">\u2014 Selecione \u2014</option>
|
|
84972
|
-
${
|
|
84973
|
-
|
|
84974
|
-
|
|
84975
|
-
|
|
84976
|
-
|
|
84977
|
-
|
|
84978
|
-
|
|
84979
|
-
|
|
84980
|
-
"FANCOIL",
|
|
84981
|
-
"3F_MEDIDOR",
|
|
84982
|
-
"RELOGIO",
|
|
84983
|
-
"ENTRADA",
|
|
84984
|
-
"SUBESTACAO",
|
|
84985
|
-
"AR_CONDICIONADO",
|
|
84986
|
-
"HIDROMETRO",
|
|
84987
|
-
"HIDROMETRO_AREA_COMUM",
|
|
84988
|
-
"HIDROMETRO_SHOPPING",
|
|
84989
|
-
"CAIXA_DAGUA",
|
|
84990
|
-
"TANK",
|
|
84991
|
-
"TERMOSTATO"
|
|
84992
|
-
].map((opt) => `<option value="${opt}" ${state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
84993
|
-
</select>` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
85006
|
+
${BULK_DEVICE_TYPE_OPTIONS.map((opt) => `<option value="${opt}" ${!state6.bulkAttributeModal.customValue && state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
85007
|
+
<option value="__OTHER__" ${state6.bulkAttributeModal.customValue ? "selected" : ""}>Outro (digitar)\u2026</option>
|
|
85008
|
+
</select>
|
|
85009
|
+
${state6.bulkAttributeModal.customValue ? `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
85010
|
+
width: 100%; padding: 10px 12px; margin-top: 8px; border: 1px solid ${colors2.border};
|
|
85011
|
+
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
85012
|
+
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
85013
|
+
"/>` : ""}` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
84994
85014
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
84995
85015
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
84996
85016
|
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
@@ -87879,16 +87899,31 @@ function setupEventListeners3(container, state6, modalId, t, onClose) {
|
|
|
87879
87899
|
document.getElementById(`${modalId}-bulk-close`)?.addEventListener("click", () => {
|
|
87880
87900
|
state6.bulkAttributeModal.open = false;
|
|
87881
87901
|
state6.bulkAttributeModal.value = "";
|
|
87902
|
+
state6.bulkAttributeModal.customValue = false;
|
|
87882
87903
|
renderModal4(container, state6, modalId, t);
|
|
87883
87904
|
});
|
|
87884
87905
|
document.getElementById(`${modalId}-bulk-cancel`)?.addEventListener("click", () => {
|
|
87885
87906
|
state6.bulkAttributeModal.open = false;
|
|
87886
87907
|
state6.bulkAttributeModal.value = "";
|
|
87908
|
+
state6.bulkAttributeModal.customValue = false;
|
|
87887
87909
|
renderModal4(container, state6, modalId, t);
|
|
87888
87910
|
});
|
|
87889
87911
|
document.getElementById(`${modalId}-bulk-attr-select`)?.addEventListener("change", (e) => {
|
|
87890
87912
|
state6.bulkAttributeModal.attribute = e.target.value;
|
|
87891
87913
|
state6.bulkAttributeModal.value = "";
|
|
87914
|
+
state6.bulkAttributeModal.customValue = false;
|
|
87915
|
+
renderModal4(container, state6, modalId, t);
|
|
87916
|
+
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
87917
|
+
});
|
|
87918
|
+
document.getElementById(`${modalId}-bulk-attr-type-select`)?.addEventListener("change", (e) => {
|
|
87919
|
+
const selected = e.target.value;
|
|
87920
|
+
if (selected === "__OTHER__") {
|
|
87921
|
+
state6.bulkAttributeModal.customValue = true;
|
|
87922
|
+
state6.bulkAttributeModal.value = "";
|
|
87923
|
+
} else {
|
|
87924
|
+
state6.bulkAttributeModal.customValue = false;
|
|
87925
|
+
state6.bulkAttributeModal.value = selected;
|
|
87926
|
+
}
|
|
87892
87927
|
renderModal4(container, state6, modalId, t);
|
|
87893
87928
|
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
87894
87929
|
});
|
|
@@ -87896,9 +87931,6 @@ function setupEventListeners3(container, state6, modalId, t, onClose) {
|
|
|
87896
87931
|
bulkAttrValueEl?.addEventListener("input", (e) => {
|
|
87897
87932
|
state6.bulkAttributeModal.value = e.target.value;
|
|
87898
87933
|
});
|
|
87899
|
-
bulkAttrValueEl?.addEventListener("change", (e) => {
|
|
87900
|
-
state6.bulkAttributeModal.value = e.target.value;
|
|
87901
|
-
});
|
|
87902
87934
|
document.getElementById(`${modalId}-bulk-save`)?.addEventListener("click", async () => {
|
|
87903
87935
|
await saveBulkAttribute(state6, container, modalId, t, onClose);
|
|
87904
87936
|
});
|
|
@@ -89747,6 +89779,7 @@ async function saveBulkAttribute(state6, container, modalId, t, onClose) {
|
|
|
89747
89779
|
state6.bulkAttributeModal.saving = false;
|
|
89748
89780
|
state6.bulkAttributeModal.open = false;
|
|
89749
89781
|
state6.bulkAttributeModal.value = "";
|
|
89782
|
+
state6.bulkAttributeModal.customValue = false;
|
|
89750
89783
|
if (errorCount === 0) {
|
|
89751
89784
|
alert(`Atributo "${attribute}" salvo com sucesso para ${successCount} dispositivos!`);
|
|
89752
89785
|
} else {
|
|
@@ -133481,6 +133514,13 @@ function injectAmbienteModalStyles() {
|
|
|
133481
133514
|
border-radius: 10px;
|
|
133482
133515
|
background: rgba(108, 117, 125, 0.08);
|
|
133483
133516
|
border: 1px solid rgba(108, 117, 125, 0.18);
|
|
133517
|
+
cursor: pointer;
|
|
133518
|
+
transition: background 0.15s ease, border-color 0.15s ease;
|
|
133519
|
+
}
|
|
133520
|
+
|
|
133521
|
+
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item:hover {
|
|
133522
|
+
background: rgba(108, 117, 125, 0.14);
|
|
133523
|
+
border-color: rgba(108, 117, 125, 0.32);
|
|
133484
133524
|
}
|
|
133485
133525
|
|
|
133486
133526
|
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-info {
|
|
@@ -133974,13 +134014,31 @@ function createAmbienteDetailModal(data, source, config = {}) {
|
|
|
133974
134014
|
btn.addEventListener("click", (e) => {
|
|
133975
134015
|
e.stopPropagation();
|
|
133976
134016
|
const remoteId = btn.dataset.remoteId;
|
|
133977
|
-
const currentState = btn.dataset.remoteState === "on";
|
|
133978
134017
|
const remote = data.remoteDevices?.find((r) => r.id === remoteId);
|
|
133979
|
-
if (remote
|
|
134018
|
+
if (!remote) return;
|
|
134019
|
+
if (config.onSwitchClick) {
|
|
134020
|
+
close();
|
|
134021
|
+
config.onSwitchClick(remote);
|
|
134022
|
+
} else if (config.onRemoteToggle) {
|
|
134023
|
+
const currentState = btn.dataset.remoteState === "on";
|
|
133980
134024
|
config.onRemoteToggle(!currentState, remote);
|
|
133981
134025
|
}
|
|
133982
134026
|
});
|
|
133983
134027
|
});
|
|
134028
|
+
if (config.onSwitchClick) {
|
|
134029
|
+
const seletorItems = container.querySelectorAll(`.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item`);
|
|
134030
|
+
seletorItems.forEach((item) => {
|
|
134031
|
+
item.addEventListener("click", (e) => {
|
|
134032
|
+
e.stopPropagation();
|
|
134033
|
+
const seletorId = item.dataset.seletorId;
|
|
134034
|
+
const seletor = data.seletorDevices?.find((s) => s.id === seletorId);
|
|
134035
|
+
if (seletor && config.onSwitchClick) {
|
|
134036
|
+
close();
|
|
134037
|
+
config.onSwitchClick(seletor);
|
|
134038
|
+
}
|
|
134039
|
+
});
|
|
134040
|
+
});
|
|
134041
|
+
}
|
|
133984
134042
|
if (config.onEnergyDeviceClick) {
|
|
133985
134043
|
const energyDeviceItems = container.querySelectorAll(`[data-energy-device-id]`);
|
|
133986
134044
|
energyDeviceItems.forEach((item) => {
|
|
@@ -4070,7 +4070,7 @@
|
|
|
4070
4070
|
|
|
4071
4071
|
// package.json
|
|
4072
4072
|
var package_default = {
|
|
4073
|
-
version: "0.1.
|
|
4073
|
+
version: "0.1.516"};
|
|
4074
4074
|
|
|
4075
4075
|
// src/format/energy.ts
|
|
4076
4076
|
function formatPower(value, decimals = 2) {
|
|
@@ -87372,6 +87372,40 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
87372
87372
|
var CACHE_TTL_MS2 = 5 * 60 * 1e3;
|
|
87373
87373
|
var MYIO_PURPLE = "#3e1a7d";
|
|
87374
87374
|
var MYIO_PURPLE_DARK = "#2d1360";
|
|
87375
|
+
var BULK_DEVICE_TYPE_OPTIONS = [
|
|
87376
|
+
// Energia
|
|
87377
|
+
"COMPRESSOR",
|
|
87378
|
+
"VENTILADOR",
|
|
87379
|
+
"MOTOR",
|
|
87380
|
+
"BOMBA_HIDRAULICA",
|
|
87381
|
+
"BOMBA_CAG",
|
|
87382
|
+
"BOMBA_INCENDIO",
|
|
87383
|
+
"CHILLER",
|
|
87384
|
+
"FANCOIL",
|
|
87385
|
+
"AR_CONDICIONADO",
|
|
87386
|
+
"3F_MEDIDOR",
|
|
87387
|
+
"ELEVADOR",
|
|
87388
|
+
"ESCADA_ROLANTE",
|
|
87389
|
+
"RELOGIO",
|
|
87390
|
+
"ENTRADA",
|
|
87391
|
+
"SUBESTACAO",
|
|
87392
|
+
"TRAFO",
|
|
87393
|
+
// Água
|
|
87394
|
+
"HIDROMETRO",
|
|
87395
|
+
"HIDROMETRO_AREA_COMUM",
|
|
87396
|
+
"HIDROMETRO_SHOPPING",
|
|
87397
|
+
"CAIXA_DAGUA",
|
|
87398
|
+
"TANK",
|
|
87399
|
+
// BAS / Outros (switch, automação, climatização auxiliar)
|
|
87400
|
+
"TERMOSTATO",
|
|
87401
|
+
"LAMP",
|
|
87402
|
+
"PLUG",
|
|
87403
|
+
"REMOTE",
|
|
87404
|
+
"CONTROLE_REMOTO",
|
|
87405
|
+
"SELETOR_AUTO_MANUAL",
|
|
87406
|
+
"SOLENOIDE",
|
|
87407
|
+
"GLOBAL_AUTOMACAO"
|
|
87408
|
+
];
|
|
87375
87409
|
var CHECK_FIX_DOMAIN = {
|
|
87376
87410
|
COMPRESSOR: "energy",
|
|
87377
87411
|
VENTILADOR: "energy",
|
|
@@ -87866,7 +87900,7 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
87866
87900
|
deviceFilters: { types: [], deviceTypes: [], deviceProfiles: [], statuses: [], telemetryKeys: [] },
|
|
87867
87901
|
deviceSelectionMode: "single",
|
|
87868
87902
|
selectedDevices: [],
|
|
87869
|
-
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false },
|
|
87903
|
+
bulkAttributeModal: { open: false, attribute: "deviceType", value: "", saving: false, customValue: false },
|
|
87870
87904
|
bulkProfileModal: { open: false, selectedProfileId: "", saving: false },
|
|
87871
87905
|
bulkOwnerModal: { open: false, saving: false, targetCustomerId: "" },
|
|
87872
87906
|
columnWidths: {
|
|
@@ -88187,34 +88221,20 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
88187
88221
|
<label style="display: block; color: ${colors2.textMuted}; font-size: 12px; margin-bottom: 6px; font-weight: 500;">
|
|
88188
88222
|
Valor
|
|
88189
88223
|
</label>
|
|
88190
|
-
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-
|
|
88224
|
+
${state6.bulkAttributeModal.attribute === "deviceType" || state6.bulkAttributeModal.attribute === "deviceProfile" ? `<select id="${modalId}-bulk-attr-type-select" style="
|
|
88191
88225
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
88192
88226
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
88193
88227
|
background: ${colors2.inputBg}; cursor: pointer; box-sizing: border-box;
|
|
88194
88228
|
">
|
|
88195
88229
|
<option value="">\u2014 Selecione \u2014</option>
|
|
88196
|
-
${
|
|
88197
|
-
|
|
88198
|
-
|
|
88199
|
-
|
|
88200
|
-
|
|
88201
|
-
|
|
88202
|
-
|
|
88203
|
-
|
|
88204
|
-
"FANCOIL",
|
|
88205
|
-
"3F_MEDIDOR",
|
|
88206
|
-
"RELOGIO",
|
|
88207
|
-
"ENTRADA",
|
|
88208
|
-
"SUBESTACAO",
|
|
88209
|
-
"AR_CONDICIONADO",
|
|
88210
|
-
"HIDROMETRO",
|
|
88211
|
-
"HIDROMETRO_AREA_COMUM",
|
|
88212
|
-
"HIDROMETRO_SHOPPING",
|
|
88213
|
-
"CAIXA_DAGUA",
|
|
88214
|
-
"TANK",
|
|
88215
|
-
"TERMOSTATO"
|
|
88216
|
-
].map((opt) => `<option value="${opt}" ${state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
88217
|
-
</select>` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
88230
|
+
${BULK_DEVICE_TYPE_OPTIONS.map((opt) => `<option value="${opt}" ${!state6.bulkAttributeModal.customValue && state6.bulkAttributeModal.value === opt ? "selected" : ""}>${opt}</option>`).join("")}
|
|
88231
|
+
<option value="__OTHER__" ${state6.bulkAttributeModal.customValue ? "selected" : ""}>Outro (digitar)\u2026</option>
|
|
88232
|
+
</select>
|
|
88233
|
+
${state6.bulkAttributeModal.customValue ? `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
88234
|
+
width: 100%; padding: 10px 12px; margin-top: 8px; border: 1px solid ${colors2.border};
|
|
88235
|
+
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
88236
|
+
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
88237
|
+
"/>` : ""}` : `<input type="text" id="${modalId}-bulk-attr-value" value="${state6.bulkAttributeModal.value}" placeholder="Digite o valor..." style="
|
|
88218
88238
|
width: 100%; padding: 10px 12px; border: 1px solid ${colors2.border};
|
|
88219
88239
|
border-radius: 6px; font-size: 14px; color: ${colors2.text};
|
|
88220
88240
|
background: ${colors2.inputBg}; box-sizing: border-box;
|
|
@@ -91101,16 +91121,31 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
91101
91121
|
document.getElementById(`${modalId}-bulk-close`)?.addEventListener("click", () => {
|
|
91102
91122
|
state6.bulkAttributeModal.open = false;
|
|
91103
91123
|
state6.bulkAttributeModal.value = "";
|
|
91124
|
+
state6.bulkAttributeModal.customValue = false;
|
|
91104
91125
|
renderModal4(container, state6, modalId, t);
|
|
91105
91126
|
});
|
|
91106
91127
|
document.getElementById(`${modalId}-bulk-cancel`)?.addEventListener("click", () => {
|
|
91107
91128
|
state6.bulkAttributeModal.open = false;
|
|
91108
91129
|
state6.bulkAttributeModal.value = "";
|
|
91130
|
+
state6.bulkAttributeModal.customValue = false;
|
|
91109
91131
|
renderModal4(container, state6, modalId, t);
|
|
91110
91132
|
});
|
|
91111
91133
|
document.getElementById(`${modalId}-bulk-attr-select`)?.addEventListener("change", (e) => {
|
|
91112
91134
|
state6.bulkAttributeModal.attribute = e.target.value;
|
|
91113
91135
|
state6.bulkAttributeModal.value = "";
|
|
91136
|
+
state6.bulkAttributeModal.customValue = false;
|
|
91137
|
+
renderModal4(container, state6, modalId, t);
|
|
91138
|
+
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
91139
|
+
});
|
|
91140
|
+
document.getElementById(`${modalId}-bulk-attr-type-select`)?.addEventListener("change", (e) => {
|
|
91141
|
+
const selected = e.target.value;
|
|
91142
|
+
if (selected === "__OTHER__") {
|
|
91143
|
+
state6.bulkAttributeModal.customValue = true;
|
|
91144
|
+
state6.bulkAttributeModal.value = "";
|
|
91145
|
+
} else {
|
|
91146
|
+
state6.bulkAttributeModal.customValue = false;
|
|
91147
|
+
state6.bulkAttributeModal.value = selected;
|
|
91148
|
+
}
|
|
91114
91149
|
renderModal4(container, state6, modalId, t);
|
|
91115
91150
|
setupEventListeners3(container, state6, modalId, t, onClose);
|
|
91116
91151
|
});
|
|
@@ -91118,9 +91153,6 @@ ${this._formatFileSize(f.size)} \xB7 ${f.type || "arquivo"}`;
|
|
|
91118
91153
|
bulkAttrValueEl?.addEventListener("input", (e) => {
|
|
91119
91154
|
state6.bulkAttributeModal.value = e.target.value;
|
|
91120
91155
|
});
|
|
91121
|
-
bulkAttrValueEl?.addEventListener("change", (e) => {
|
|
91122
|
-
state6.bulkAttributeModal.value = e.target.value;
|
|
91123
|
-
});
|
|
91124
91156
|
document.getElementById(`${modalId}-bulk-save`)?.addEventListener("click", async () => {
|
|
91125
91157
|
await saveBulkAttribute(state6, container, modalId, t);
|
|
91126
91158
|
});
|
|
@@ -92969,6 +93001,7 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
|
|
|
92969
93001
|
state6.bulkAttributeModal.saving = false;
|
|
92970
93002
|
state6.bulkAttributeModal.open = false;
|
|
92971
93003
|
state6.bulkAttributeModal.value = "";
|
|
93004
|
+
state6.bulkAttributeModal.customValue = false;
|
|
92972
93005
|
if (errorCount === 0) {
|
|
92973
93006
|
alert(`Atributo "${attribute}" salvo com sucesso para ${successCount} dispositivos!`);
|
|
92974
93007
|
} else {
|
|
@@ -136690,6 +136723,13 @@ Esta a\xE7\xE3o afeta todos os grupos que utilizam este canal.`
|
|
|
136690
136723
|
border-radius: 10px;
|
|
136691
136724
|
background: rgba(108, 117, 125, 0.08);
|
|
136692
136725
|
border: 1px solid rgba(108, 117, 125, 0.18);
|
|
136726
|
+
cursor: pointer;
|
|
136727
|
+
transition: background 0.15s ease, border-color 0.15s ease;
|
|
136728
|
+
}
|
|
136729
|
+
|
|
136730
|
+
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item:hover {
|
|
136731
|
+
background: rgba(108, 117, 125, 0.14);
|
|
136732
|
+
border-color: rgba(108, 117, 125, 0.32);
|
|
136693
136733
|
}
|
|
136694
136734
|
|
|
136695
136735
|
.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-info {
|
|
@@ -137183,13 +137223,31 @@ Esta a\xE7\xE3o afeta todos os grupos que utilizam este canal.`
|
|
|
137183
137223
|
btn.addEventListener("click", (e) => {
|
|
137184
137224
|
e.stopPropagation();
|
|
137185
137225
|
const remoteId = btn.dataset.remoteId;
|
|
137186
|
-
const currentState = btn.dataset.remoteState === "on";
|
|
137187
137226
|
const remote = data.remoteDevices?.find((r) => r.id === remoteId);
|
|
137188
|
-
if (remote
|
|
137227
|
+
if (!remote) return;
|
|
137228
|
+
if (config.onSwitchClick) {
|
|
137229
|
+
close();
|
|
137230
|
+
config.onSwitchClick(remote);
|
|
137231
|
+
} else if (config.onRemoteToggle) {
|
|
137232
|
+
const currentState = btn.dataset.remoteState === "on";
|
|
137189
137233
|
config.onRemoteToggle(!currentState, remote);
|
|
137190
137234
|
}
|
|
137191
137235
|
});
|
|
137192
137236
|
});
|
|
137237
|
+
if (config.onSwitchClick) {
|
|
137238
|
+
const seletorItems = container.querySelectorAll(`.${AMBIENTE_MODAL_CSS_PREFIX}__seletor-item`);
|
|
137239
|
+
seletorItems.forEach((item) => {
|
|
137240
|
+
item.addEventListener("click", (e) => {
|
|
137241
|
+
e.stopPropagation();
|
|
137242
|
+
const seletorId = item.dataset.seletorId;
|
|
137243
|
+
const seletor = data.seletorDevices?.find((s) => s.id === seletorId);
|
|
137244
|
+
if (seletor && config.onSwitchClick) {
|
|
137245
|
+
close();
|
|
137246
|
+
config.onSwitchClick(seletor);
|
|
137247
|
+
}
|
|
137248
|
+
});
|
|
137249
|
+
});
|
|
137250
|
+
}
|
|
137193
137251
|
if (config.onEnergyDeviceClick) {
|
|
137194
137252
|
const energyDeviceItems = container.querySelectorAll(`[data-energy-device-id]`);
|
|
137195
137253
|
energyDeviceItems.forEach((item) => {
|