@record-evolution/widget-form 1.0.19 → 1.0.22

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.
@@ -57,6 +57,42 @@ export class WidgetForm extends LitElement {
57
57
  this.registerTheme(this.theme)
58
58
  }
59
59
 
60
+ protected updated(_changedProperties: PropertyValues): void {
61
+ this.patchDialogScrim()
62
+ }
63
+
64
+ private dialogScrimPatched = false
65
+
66
+ /**
67
+ * md-dialog renders its scrim as a `<div class="scrim">` sibling of the
68
+ * native `<dialog>` inside its shadow root, with `position: fixed; z-index: 1`,
69
+ * while disabling the native backdrop (`::backdrop { background: none }`).
70
+ * The `<dialog>` is promoted to the top layer by `showModal()`, but the scrim
71
+ * div stays in the normal layer — confined to this widget's stacking context.
72
+ * As a result it fails to cover sibling dashboard widgets painted in a higher
73
+ * stacking context. We re-enable the native `::backdrop` (which lives in the
74
+ * top layer and spans the whole viewport regardless of ancestor transforms /
75
+ * stacking contexts) and hide the confined internal scrim.
76
+ */
77
+ private patchDialogScrim() {
78
+ if (this.dialogScrimPatched) return
79
+ const root = this.dialog?.shadowRoot
80
+ if (!root) return
81
+
82
+ const sheet = new CSSStyleSheet()
83
+ sheet.replaceSync(`
84
+ dialog::backdrop {
85
+ background: var(--md-sys-color-scrim, #000);
86
+ opacity: 0.32;
87
+ }
88
+ .scrim {
89
+ display: none !important;
90
+ }
91
+ `)
92
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet]
93
+ this.dialogScrimPatched = true
94
+ }
95
+
60
96
  registerTheme(theme?: Theme) {
61
97
  const cssTextColor = getComputedStyle(this).getPropertyValue('--re-text-color').trim()
62
98
  const cssBgColor = getComputedStyle(this).getPropertyValue('--re-tile-background-color').trim()
@@ -296,16 +332,6 @@ export class WidgetForm extends LitElement {
296
332
  margin: auto;
297
333
  }
298
334
 
299
- .edit-fab {
300
- --md-fab-icon-color: white;
301
- --md-fab-container-color: #007bff;
302
- --md-fab-label-text-color: white;
303
- position: absolute;
304
- bottom: 24px;
305
- right: 24px;
306
- z-index: 10;
307
- }
308
-
309
335
  .paging:not([active]) {
310
336
  display: none !important;
311
337
  }
@@ -369,7 +395,12 @@ export class WidgetForm extends LitElement {
369
395
 
370
396
  /* The dialog classes */
371
397
  .form {
372
- min-width: 80%;
398
+ /* Fields are stacked in a single column, so a wide dialog just
399
+ stretches them unreadably. Cap at a comfortable form width but
400
+ shrink to fit narrow viewports. Height stays content-driven
401
+ (Material's fit-content), capped at 80% of the viewport. */
402
+ width: min(90vw, 480px);
403
+ max-height: 80vh;
373
404
  }
374
405
 
375
406
  .form [slot='header'] {
@@ -448,6 +479,10 @@ export class WidgetForm extends LitElement {
448
479
  --md-sys-color-on-surface-variant: ${fontColor};
449
480
  --md-sys-color-outline: ${fontColor};
450
481
  --md-sys-color-surface-container: ${bgColorOpaque};
482
+ /* Dialog/widget surface honors the theme alpha (may be transparent),
483
+ while the select dropdown panel always uses the alpha-stripped
484
+ color so it stays fully opaque. */
485
+ --md-dialog-container-color: ${bgColor};
451
486
  --md-menu-container-color: ${bgColorOpaque};
452
487
  --md-menu-item-selected-container-color: ${bgColorOpaque};
453
488
  --md-menu-item-selected-label-text-color: ${fontColor};
@@ -459,18 +494,31 @@ export class WidgetForm extends LitElement {
459
494
  ? html`
460
495
  <md-fab
461
496
  aria-label="Add"
462
- style="margin-left: 16px; --md-fab-container-color: ${this.theme?.theme_object
463
- ?.color?.[0] ?? '#9064f7'}"
497
+ .size=${this.inputData.formButtonStyle?.size || 'medium'}
498
+ style="margin: 8px; --md-fab-container-color: ${(this.inputData.formButtonStyle
499
+ ?.bgColor ||
500
+ this.theme?.theme_object?.color?.[0]) ??
501
+ '#9064f7'}; --md-fab-icon-color: ${(this.inputData.formButtonStyle?.color ||
502
+ this.theme?.theme_object?.color?.[1]) ??
503
+ '#fff'}"
464
504
  @click=${this.openFormDialog}
465
505
  >
466
506
  <md-icon slot="icon">add</md-icon>
467
507
  </md-fab>
468
508
  `
469
509
  : nothing}
470
- <header>
471
- <h3 class="paging" ?active=${this.inputData?.title}>${this.inputData?.title}</h3>
472
- <p class="paging" ?active=${this.inputData?.subTitle}>${this.inputData?.subTitle}</p>
473
- </header>
510
+ ${!this.inputData?.formButton
511
+ ? html`
512
+ <header>
513
+ <h3 class="paging" ?active=${this.inputData?.title}>
514
+ ${this.inputData?.title}
515
+ </h3>
516
+ <p class="paging" ?active=${this.inputData?.subTitle}>
517
+ ${this.inputData?.subTitle}
518
+ </p>
519
+ </header>
520
+ `
521
+ : nothing}
474
522
  </div>
475
523
  ${!this.inputData?.formButton
476
524
  ? html`