revert Merge pull request 'feat(widgets): add phase 4 validation and accessibility' (#6) from worktree/widgets-phase-4 into main

Reviewed-on: #6
This commit is contained in:
2026-08-17 11:20:54 +00:00
parent e1723a8f08
commit 463ef36ed3
23 changed files with 53 additions and 8078 deletions
+15 -4
View File
@@ -2,7 +2,6 @@
'use strict';
const config = window.aksrtWidgetAdmin || {};
const core = window.AKSRTWidgetAdminCore;
function initForm(root) {
const $root = $(root);
@@ -69,7 +68,15 @@
$form.find('[name]').each(function () {
const rowIndexes = $(this).parents('.aksrt-widget-repeater__row').get().reverse().map((row) => Number(row.dataset.rowIndex || 0));
if (!rowIndexes.length) return;
this.name = core.replaceRepeaterIndexes(this.name, rowIndexes);
let foundWidgetNumber = false;
let cursor = 0;
this.name = this.name.replace(/\[(\d+|__index_[a-f0-9]+__)\]/g, (match, index) => {
if (!foundWidgetNumber && /^\d+$/.test(index)) {
foundWidgetNumber = true;
return match;
}
return cursor < rowIndexes.length ? `[${rowIndexes[cursor++]}]` : match;
});
});
}
@@ -82,10 +89,14 @@
function evaluateDependencies($form) {
$form.find('[data-dependency]').each(function () {
const rule = core.parseDependency(this.dataset.dependency || '[]');
let rule;
try { rule = JSON.parse(this.dataset.dependency || '[]'); } catch (_error) { return; }
if (!Array.isArray(rule) || rule.length < 3) return;
const $row = $(this).closest('.aksrt-widget-repeater__row');
const current = fieldValue($row.length ? $row : $form, String(rule[0]));
this.hidden = !core.dependencyVisible(rule, current);
const expected = String(rule[2]);
const visible = rule[1] === '==' ? current === expected : current !== expected;
this.hidden = !visible;
});
}