@igea/oac_frontend 1.0.107 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.107",
3
+ "version": "1.0.108",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -420,16 +420,77 @@ if (!shadow.querySelector('#oac-final-layout')) {
420
420
  flex: 1 1 auto !important;
421
421
  }
422
422
 
423
- /* 🔥 SPUNTA NON PIÙ ASSOLUTA */
424
- .property-instance.valid::before {
425
- position: static !important;
426
- margin-right: 6px !important;
427
- }
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
+
428
446
 
429
447
  `;
430
448
  shadow.appendChild(style);
431
449
  }
432
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
+
433
494
  if (!shadow.querySelector('#oac-fix-add-buttons')) {
434
495
  const style = document.createElement('style');
435
496
  style.id = 'oac-fix-add-buttons';