@ukiahinsure/a2ui-react-adapter 0.1.23 → 0.1.24
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.js +31 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2184,6 +2184,12 @@ function currentQuestionElement(root) {
|
|
|
2184
2184
|
}
|
|
2185
2185
|
return container !== null && container !== root && root.contains(container) ? container : action;
|
|
2186
2186
|
}
|
|
2187
|
+
var RENDERER_CONTROL_SELECTOR = "input:not([data-a2ui-loop-edit-input]), select, textarea";
|
|
2188
|
+
function addsRendererControl(record) {
|
|
2189
|
+
return [...record.addedNodes].some(
|
|
2190
|
+
(node) => node instanceof Element && (node.matches(RENDERER_CONTROL_SELECTOR) || node.querySelector(RENDERER_CONTROL_SELECTOR) !== null)
|
|
2191
|
+
);
|
|
2192
|
+
}
|
|
2187
2193
|
function textOf(element) {
|
|
2188
2194
|
return (element.textContent ?? "").replace(/\s+/g, "");
|
|
2189
2195
|
}
|
|
@@ -3478,6 +3484,30 @@ function enhanceTabs(root, tabs, navigation, viewedSectionId, frameId, onPanelCh
|
|
|
3478
3484
|
});
|
|
3479
3485
|
panel.setAttribute("aria-labelledby", selected.id);
|
|
3480
3486
|
onPanelChange();
|
|
3487
|
+
watchPanelRender();
|
|
3488
|
+
};
|
|
3489
|
+
let panelObserver;
|
|
3490
|
+
let panelObserverTimer;
|
|
3491
|
+
const stopWatchingPanel = () => {
|
|
3492
|
+
panelObserver?.disconnect();
|
|
3493
|
+
panelObserver = void 0;
|
|
3494
|
+
if (panelObserverTimer !== void 0) {
|
|
3495
|
+
globalThis.clearTimeout(panelObserverTimer);
|
|
3496
|
+
panelObserverTimer = void 0;
|
|
3497
|
+
}
|
|
3498
|
+
};
|
|
3499
|
+
const watchPanelRender = () => {
|
|
3500
|
+
stopWatchingPanel();
|
|
3501
|
+
if (typeof MutationObserver === "undefined") {
|
|
3502
|
+
return;
|
|
3503
|
+
}
|
|
3504
|
+
panelObserver = new MutationObserver((records) => {
|
|
3505
|
+
if (records.some(addsRendererControl)) {
|
|
3506
|
+
onPanelChange();
|
|
3507
|
+
}
|
|
3508
|
+
});
|
|
3509
|
+
panelObserver.observe(panel, { childList: true, subtree: true });
|
|
3510
|
+
panelObserverTimer = globalThis.setTimeout(stopWatchingPanel, 3e3);
|
|
3481
3511
|
};
|
|
3482
3512
|
buttons.forEach((button, index) => {
|
|
3483
3513
|
button.dataset.a2uiTab = statuses[index];
|
|
@@ -3520,6 +3550,7 @@ function enhanceTabs(root, tabs, navigation, viewedSectionId, frameId, onPanelCh
|
|
|
3520
3550
|
synchronizingRenderer = false;
|
|
3521
3551
|
activate(selectedIndex);
|
|
3522
3552
|
return () => {
|
|
3553
|
+
stopWatchingPanel();
|
|
3523
3554
|
for (const remove of listeners) {
|
|
3524
3555
|
remove();
|
|
3525
3556
|
}
|