@igea/oac_frontend 1.0.106 → 1.0.108
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/package.json
CHANGED
|
@@ -389,6 +389,148 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
389
389
|
var intervalId = setInterval(() => {
|
|
390
390
|
if(_this.form.shadowRoot){
|
|
391
391
|
clearInterval(intervalId);
|
|
392
|
+
// 🔥 Fix alignment for add-property blocks
|
|
393
|
+
const shadow = _this.form.shadowRoot;
|
|
394
|
+
|
|
395
|
+
if (!shadow.querySelector('#oac-final-layout')) {
|
|
396
|
+
const style = document.createElement('style');
|
|
397
|
+
style.id = 'oac-final-layout';
|
|
398
|
+
style.textContent = `
|
|
399
|
+
|
|
400
|
+
/* ============================= */
|
|
401
|
+
/* Layout moderno a 3 elementi */
|
|
402
|
+
/* ============================= */
|
|
403
|
+
|
|
404
|
+
.property-instance {
|
|
405
|
+
display: flex !important;
|
|
406
|
+
align-items: center !important;
|
|
407
|
+
gap: 10px !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* Label senza width fissa */
|
|
411
|
+
.property-instance label {
|
|
412
|
+
width: auto !important;
|
|
413
|
+
min-width: 220px !important;
|
|
414
|
+
white-space: nowrap !important;
|
|
415
|
+
flex-shrink: 0 !important;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/* Editor cresce */
|
|
419
|
+
.property-instance .editor {
|
|
420
|
+
flex: 1 1 auto !important;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* 🔥 Disattiva spunta originale */
|
|
424
|
+
.property-instance.valid::before {
|
|
425
|
+
content: none !important;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/* 🔥 Crea spunta a fine label */
|
|
429
|
+
.property-instance.valid > label::after {
|
|
430
|
+
content: '';
|
|
431
|
+
display: inline-block;
|
|
432
|
+
width: 0.9em;
|
|
433
|
+
height: 0.9em;
|
|
434
|
+
margin-left: 6px;
|
|
435
|
+
vertical-align: middle;
|
|
436
|
+
|
|
437
|
+
background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1024 1024" fill="green" xmlns="http://www.w3.org/2000/svg"><path d="M866.133333 258.133333L362.666667 761.6l-204.8-204.8L98.133333 618.666667 362.666667 881.066667l563.2-563.2z"/></svg>');
|
|
438
|
+
background-size: contain;
|
|
439
|
+
background-repeat: no-repeat;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
`;
|
|
448
|
+
shadow.appendChild(style);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
function hideOnlyDuplicateRemoveButtons(shadowRoot) {
|
|
453
|
+
shadowRoot.querySelectorAll('.property-instance').forEach(pi => {
|
|
454
|
+
|
|
455
|
+
// consideriamo solo i wrapper "esterni" che contengono uno shacl-node
|
|
456
|
+
const shaclNode = pi.querySelector(':scope > shacl-node');
|
|
457
|
+
if (!shaclNode) return;
|
|
458
|
+
|
|
459
|
+
// remove wrapper diretto del wrapper esterno (quello che sospettiamo duplicato)
|
|
460
|
+
const directRemoveWrapper = pi.querySelector(':scope > .remove-button-wrapper');
|
|
461
|
+
if (!directRemoveWrapper) return;
|
|
462
|
+
|
|
463
|
+
const directRemoveBtn = directRemoveWrapper.querySelector('rokit-button.remove-button[title]');
|
|
464
|
+
if (!directRemoveBtn) return;
|
|
465
|
+
|
|
466
|
+
const title = directRemoveBtn.getAttribute('title');
|
|
467
|
+
if (!title) return;
|
|
468
|
+
|
|
469
|
+
// cerco un altro remove con lo stesso title *dentro* lo shacl-node
|
|
470
|
+
// (escludo quello esterno: infatti quello esterno NON è dentro shaclNode)
|
|
471
|
+
const duplicateInside = shaclNode.querySelector(`rokit-button.remove-button[title="${CSS.escape(title)}"]`);
|
|
472
|
+
|
|
473
|
+
// se esiste, quello esterno è duplicato => nascondo SOLO quello esterno
|
|
474
|
+
if (duplicateInside) {
|
|
475
|
+
directRemoveWrapper.style.display = 'none';
|
|
476
|
+
} else {
|
|
477
|
+
// se non c'è duplicato interno, quello esterno serve => lo lascio visibile
|
|
478
|
+
directRemoveWrapper.style.display = '';
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// prima applicazione
|
|
484
|
+
hideOnlyDuplicateRemoveButtons(shadow);
|
|
485
|
+
|
|
486
|
+
// observer per elementi aggiunti con "+"
|
|
487
|
+
const dupRemoveObserver = new MutationObserver(() => {
|
|
488
|
+
hideOnlyDuplicateRemoveButtons(shadow);
|
|
489
|
+
});
|
|
490
|
+
dupRemoveObserver.observe(shadow, { childList: true, subtree: true });
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
if (!shadow.querySelector('#oac-fix-add-buttons')) {
|
|
495
|
+
const style = document.createElement('style');
|
|
496
|
+
style.id = 'oac-fix-add-buttons';
|
|
497
|
+
style.textContent = `
|
|
498
|
+
|
|
499
|
+
/* Sposta i blocchi add a sinistra */
|
|
500
|
+
shacl-property:not(:has(>.collapsible)),
|
|
501
|
+
shacl-property > .collapsible::part(content) {
|
|
502
|
+
align-items: flex-start !important;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/* Assicura che il + sia inline */
|
|
506
|
+
shacl-property .add-button {
|
|
507
|
+
align-self: flex-start !important;
|
|
508
|
+
margin-right: 0 !important;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
`;
|
|
512
|
+
shadow.appendChild(style);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
if (!shadow.querySelector('#oac-limit-editor-width')) {
|
|
517
|
+
const style = document.createElement('style');
|
|
518
|
+
style.id = 'oac-limit-editor-width';
|
|
519
|
+
style.textContent = `
|
|
520
|
+
|
|
521
|
+
.property-instance .editor {
|
|
522
|
+
flex-grow: 0 !important;
|
|
523
|
+
max-width: 500px !important;
|
|
524
|
+
width: 100% !important;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
`;
|
|
528
|
+
shadow.appendChild(style);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
392
534
|
if(_this.inEditing)
|
|
393
535
|
_this.inputIdentifizier();
|
|
394
536
|
else
|
|
@@ -112,8 +112,8 @@
|
|
|
112
112
|
{% endif %}
|
|
113
113
|
|
|
114
114
|
<div id="shacl-container"
|
|
115
|
-
style="
|
|
116
|
-
<shacl-form id="shacl-form" data-collapse="open"
|
|
115
|
+
style="border:dashed 2px gray; padding:10px; border-radius:5px; max-width: 60%; margin: 0 auto; margin-top:20px;">
|
|
116
|
+
<shacl-form shadow="false" id="shacl-form" data-collapse="open"
|
|
117
117
|
data-values-namespace="indagine:"
|
|
118
118
|
data-shapes-url="/backend/ontology/schema/editing"
|
|
119
119
|
data-generate-node-shape-reference=""
|
package/src/views/v2/layout.twig
CHANGED