@vaadin/crud 23.1.0-alpha3 → 23.1.0-beta2

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,11 +1,12 @@
1
1
  {
2
2
  "name": "@vaadin/crud",
3
- "version": "23.1.0-alpha3",
3
+ "version": "23.1.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "description": "vaadin-crud",
8
8
  "license": "https://raw.githubusercontent.com/vaadin/web-components/master/packages/crud/LICENSE",
9
+ "cvdlName": "vaadin-crud",
9
10
  "repository": {
10
11
  "type": "git",
11
12
  "url": "https://github.com/vaadin/web-components.git",
@@ -35,22 +36,22 @@
35
36
  "dependencies": {
36
37
  "@open-wc/dedupe-mixin": "^1.3.0",
37
38
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/button": "23.1.0-alpha3",
39
- "@vaadin/component-base": "23.1.0-alpha3",
40
- "@vaadin/confirm-dialog": "23.1.0-alpha3",
41
- "@vaadin/dialog": "23.1.0-alpha3",
42
- "@vaadin/form-layout": "23.1.0-alpha3",
43
- "@vaadin/grid": "23.1.0-alpha3",
44
- "@vaadin/text-field": "23.1.0-alpha3",
39
+ "@vaadin/button": "23.1.0-beta2",
40
+ "@vaadin/component-base": "23.1.0-beta2",
41
+ "@vaadin/confirm-dialog": "23.1.0-beta2",
42
+ "@vaadin/dialog": "23.1.0-beta2",
43
+ "@vaadin/form-layout": "23.1.0-beta2",
44
+ "@vaadin/grid": "23.1.0-beta2",
45
+ "@vaadin/text-field": "23.1.0-beta2",
45
46
  "@vaadin/vaadin-license-checker": "^2.1.0",
46
- "@vaadin/vaadin-lumo-styles": "23.1.0-alpha3",
47
- "@vaadin/vaadin-material-styles": "23.1.0-alpha3",
48
- "@vaadin/vaadin-themable-mixin": "23.1.0-alpha3"
47
+ "@vaadin/vaadin-lumo-styles": "23.1.0-beta2",
48
+ "@vaadin/vaadin-material-styles": "23.1.0-beta2",
49
+ "@vaadin/vaadin-themable-mixin": "23.1.0-beta2"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@esm-bundle/chai": "^4.3.4",
52
53
  "@vaadin/testing-helpers": "^0.3.2",
53
54
  "sinon": "^13.0.2"
54
55
  },
55
- "gitHead": "8c9e64e8dfa158dd52a9bf6da351ff038c88ca85"
56
+ "gitHead": "f11f9245a0b5e6bf912725a501c27c24b74e7c8d"
56
57
  }
@@ -15,25 +15,16 @@ registerStyles(
15
15
  min-width: 20em;
16
16
  }
17
17
 
18
- [part='content'] {
19
- display: flex;
20
- flex-direction: column;
21
- padding: 0;
22
- }
23
-
24
- [part='scroller'] {
25
- display: flex;
26
- flex-direction: column;
27
- overflow: auto;
28
- flex: auto;
29
- }
30
-
31
18
  [part='footer'] {
32
- display: flex;
33
- flex: none;
19
+ justify-content: flex-start;
34
20
  flex-direction: row-reverse;
35
21
  }
36
22
 
23
+ /* Make buttons clickable */
24
+ [part='footer'] ::slotted(:not([disabled])) {
25
+ pointer-events: all;
26
+ }
27
+
37
28
  :host([fullscreen]) {
38
29
  top: 0;
39
30
  left: 0;
@@ -52,24 +43,15 @@ registerStyles(
52
43
  flex: 1;
53
44
  }
54
45
  `,
55
- { moduleId: 'vaadin-crud-dialog-overlay-styles' }
46
+ { moduleId: 'vaadin-crud-dialog-overlay-styles' },
56
47
  );
57
48
 
58
49
  let memoizedTemplate;
59
50
 
60
- const editorTemplate = html`
61
- <div part="scroller" role="group" aria-labelledby="header">
62
- <div part="header" id="header">
63
- <slot name="header"></slot>
64
- </div>
65
- <slot name="form"></slot>
66
- </div>
67
-
68
- <div part="footer" role="toolbar">
69
- <slot name="save-button"></slot>
70
- <slot name="cancel-button"></slot>
71
- <slot name="delete-button"></slot>
72
- </div>
51
+ const footerTemplate = html`
52
+ <slot name="save-button"></slot>
53
+ <slot name="cancel-button"></slot>
54
+ <slot name="delete-button"></slot>
73
55
  `;
74
56
 
75
57
  class CrudDialogOverlay extends DialogOverlay {
@@ -80,13 +62,40 @@ class CrudDialogOverlay extends DialogOverlay {
80
62
  static get template() {
81
63
  if (!memoizedTemplate) {
82
64
  memoizedTemplate = super.template.cloneNode(true);
65
+
66
+ // Replace two header slots with a single one
67
+ const headerPart = memoizedTemplate.content.querySelector('[part="header"]');
68
+ headerPart.innerHTML = '';
69
+ const headerSlot = document.createElement('slot');
70
+ headerSlot.setAttribute('name', 'header');
71
+ headerPart.appendChild(headerSlot);
72
+
73
+ // Replace default slot with "form" named slot
83
74
  const contentPart = memoizedTemplate.content.querySelector('[part="content"]');
84
75
  const defaultSlot = contentPart.querySelector('slot:not([name])');
85
- contentPart.removeChild(defaultSlot);
86
- contentPart.appendChild(editorTemplate.content.cloneNode(true));
76
+ defaultSlot.setAttribute('name', 'form');
77
+
78
+ // Replace footer slot with button named slots
79
+ const footerPart = memoizedTemplate.content.querySelector('[part="footer"]');
80
+ footerPart.setAttribute('role', 'toolbar');
81
+ const footerSlot = footerPart.querySelector('slot');
82
+ footerPart.removeChild(footerSlot);
83
+ footerPart.appendChild(footerTemplate.content.cloneNode(true));
87
84
  }
88
85
  return memoizedTemplate;
89
86
  }
87
+
88
+ /**
89
+ * @protected
90
+ * @override
91
+ */
92
+ _headerFooterRendererChange(headerRenderer, footerRenderer, opened) {
93
+ super._headerFooterRendererChange(headerRenderer, footerRenderer, opened);
94
+
95
+ // CRUD has header and footer but does not use renderers
96
+ this.setAttribute('has-header', '');
97
+ this.setAttribute('has-footer', '');
98
+ }
90
99
  }
91
100
 
92
101
  customElements.define('vaadin-crud-dialog-overlay', CrudDialogOverlay);
@@ -36,7 +36,7 @@ class CrudEditColumn extends GridColumn {
36
36
  */
37
37
  width: {
38
38
  type: String,
39
- value: '4em'
39
+ value: '4em',
40
40
  },
41
41
 
42
42
  /**
@@ -45,11 +45,11 @@ class CrudEditColumn extends GridColumn {
45
45
  */
46
46
  flexGrow: {
47
47
  type: Number,
48
- value: 0
48
+ value: 0,
49
49
  },
50
50
 
51
51
  /** The arial-label for the edit button */
52
- ariaLabel: String
52
+ ariaLabel: String,
53
53
  };
54
54
  }
55
55
 
@@ -44,7 +44,7 @@ class CrudEdit extends Button {
44
44
  __onClick(e) {
45
45
  const tr = e.target.parentElement.assignedSlot.parentElement.parentElement;
46
46
  tr.dispatchEvent(
47
- new CustomEvent('edit', { detail: { item: tr._item, index: tr.index }, bubbles: true, composed: true })
47
+ new CustomEvent('edit', { detail: { item: tr._item, index: tr.index }, bubbles: true, composed: true }),
48
48
  );
49
49
  }
50
50
 
@@ -25,7 +25,7 @@ class CrudForm extends IncludedMixin(FormLayout) {
25
25
  * The item being edited.
26
26
  * @type {unknown}
27
27
  */
28
- item: Object
28
+ item: Object,
29
29
  };
30
30
  }
31
31
 
@@ -44,7 +44,7 @@ class CrudGrid extends IncludedMixin(Grid) {
44
44
  noHead: Boolean,
45
45
 
46
46
  /** @private */
47
- __hideEditColumn: Boolean
47
+ __hideEditColumn: Boolean,
48
48
  };
49
49
  }
50
50
 
@@ -54,7 +54,7 @@ class CrudGrid extends IncludedMixin(Grid) {
54
54
 
55
55
  /** @private */
56
56
  __onItemsChange(items) {
57
- if ((!this.dataProvider || this.dataProvider == this._arrayDataProvider) && !this.include && items && items[0]) {
57
+ if ((!this.dataProvider || this.dataProvider === this._arrayDataProvider) && !this.include && items && items[0]) {
58
58
  this._configure(items[0]);
59
59
  }
60
60
  }
@@ -70,7 +70,9 @@ class CrudGrid extends IncludedMixin(Grid) {
70
70
  __toggleEditColumn() {
71
71
  const el = this.querySelector('vaadin-crud-edit-column');
72
72
  if (this.hideEditColumn) {
73
- el && this.removeChild(el);
73
+ if (el) {
74
+ this.removeChild(el);
75
+ }
74
76
  } else if (!el) {
75
77
  this.appendChild(document.createElement('vaadin-crud-edit-column'));
76
78
  }
@@ -79,7 +81,7 @@ class CrudGrid extends IncludedMixin(Grid) {
79
81
  /** @private */
80
82
  __dataProviderWrapper(params, callback) {
81
83
  this.__dataProvider(params, (items, size) => {
82
- if (this.innerHTML == '' && !this.include && items[0]) {
84
+ if (this.innerHTML === '' && !this.include && items[0]) {
83
85
  this._configure(items[0]);
84
86
  }
85
87
  callback(items, size);
@@ -91,9 +93,9 @@ class CrudGrid extends IncludedMixin(Grid) {
91
93
  * @private
92
94
  */
93
95
  _dataProviderChanged(dataProvider, oldDataProvider) {
94
- if (this._arrayDataProvider == dataProvider) {
96
+ if (this._arrayDataProvider === dataProvider) {
95
97
  super._dataProviderChanged(dataProvider, oldDataProvider);
96
- } else if (this.__dataProviderWrapper != dataProvider) {
98
+ } else if (this.__dataProviderWrapper !== dataProvider) {
97
99
  this.innerHTML = '';
98
100
  this.__dataProvider = dataProvider;
99
101
  this.dataProvider = this.__dataProviderWrapper;
@@ -195,8 +197,10 @@ class CrudGrid extends IncludedMixin(Grid) {
195
197
  textField.setAttribute('slot', 'filter');
196
198
  textField.setAttribute('focus-target', true);
197
199
  textField.style.width = '100%';
198
- this.noSort && (textField.placeholder = label);
199
- textField.addEventListener('value-changed', function (event) {
200
+ if (this.noSort) {
201
+ textField.placeholder = label;
202
+ }
203
+ textField.addEventListener('value-changed', (event) => {
200
204
  filter.value = event.detail.value;
201
205
  });
202
206
 
@@ -22,7 +22,7 @@ export const IncludedMixin = (superClass) =>
22
22
  */
23
23
  exclude: {
24
24
  value: '^_',
25
- observer: '__onExcludeChange'
25
+ observer: '__onExcludeChange',
26
26
  },
27
27
 
28
28
  /**
@@ -33,21 +33,21 @@ export const IncludedMixin = (superClass) =>
33
33
  * @type {string | !Array<string> | undefined}
34
34
  */
35
35
  include: {
36
- observer: '__onIncludeChange'
37
- }
36
+ observer: '__onIncludeChange',
37
+ },
38
38
  };
39
39
  }
40
40
 
41
41
  /** @private */
42
42
  __onExcludeChange(exclude) {
43
- if (typeof exclude == 'string') {
43
+ if (typeof exclude === 'string') {
44
44
  this.exclude = exclude ? RegExp(exclude.replace(/, */g, '|'), 'i') : undefined;
45
45
  }
46
46
  }
47
47
 
48
48
  /** @private */
49
49
  __onIncludeChange(include) {
50
- if (typeof include == 'string') {
50
+ if (typeof include === 'string') {
51
51
  this.include = include ? include.split(/, */) : undefined;
52
52
  } else if (!this._fields && Array.isArray(include)) {
53
53
  const item = {};
@@ -383,13 +383,13 @@ declare class Crud<Item> extends ControllerMixin(ElementMixin(ThemableMixin(HTML
383
383
  addEventListener<K extends keyof CrudEventMap<Item>>(
384
384
  type: K,
385
385
  listener: (this: Crud<Item>, ev: CrudEventMap<Item>[K]) => void,
386
- options?: boolean | AddEventListenerOptions
386
+ options?: boolean | AddEventListenerOptions,
387
387
  ): void;
388
388
 
389
389
  removeEventListener<K extends keyof CrudEventMap<Item>>(
390
390
  type: K,
391
391
  listener: (this: Crud<Item>, ev: CrudEventMap<Item>[K]) => void,
392
- options?: boolean | EventListenerOptions
392
+ options?: boolean | EventListenerOptions,
393
393
  ): void;
394
394
  }
395
395
 
@@ -310,6 +310,10 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
310
310
  return 'vaadin-crud';
311
311
  }
312
312
 
313
+ static get cvdlName() {
314
+ return 'vaadin-crud';
315
+ }
316
+
313
317
  static get properties() {
314
318
  return {
315
319
  /**
@@ -318,7 +322,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
318
322
  */
319
323
  _grid: {
320
324
  type: HTMLElement,
321
- observer: '__gridChanged'
325
+ observer: '__gridChanged',
322
326
  },
323
327
 
324
328
  /**
@@ -327,7 +331,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
327
331
  */
328
332
  _form: {
329
333
  type: HTMLElement,
330
- observer: '__formChanged'
334
+ observer: '__formChanged',
331
335
  },
332
336
 
333
337
  /**
@@ -336,7 +340,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
336
340
  */
337
341
  _saveButton: {
338
342
  type: HTMLElement,
339
- observer: '__saveButtonChanged'
343
+ observer: '__saveButtonChanged',
340
344
  },
341
345
 
342
346
  /**
@@ -345,7 +349,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
345
349
  */
346
350
  _deleteButton: {
347
351
  type: HTMLElement,
348
- observer: '__deleteButtonChanged'
352
+ observer: '__deleteButtonChanged',
349
353
  },
350
354
 
351
355
  /**
@@ -354,7 +358,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
354
358
  */
355
359
  _cancelButton: {
356
360
  type: HTMLElement,
357
- observer: '__cancelButtonChanged'
361
+ observer: '__cancelButtonChanged',
358
362
  },
359
363
 
360
364
  /**
@@ -362,7 +366,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
362
366
  * @private
363
367
  */
364
368
  _headerNode: {
365
- type: HTMLElement
369
+ type: HTMLElement,
366
370
  },
367
371
 
368
372
  /**
@@ -372,7 +376,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
372
376
  items: {
373
377
  type: Array,
374
378
  notify: true,
375
- observer: '__itemsChanged'
379
+ observer: '__itemsChanged',
376
380
  },
377
381
 
378
382
  /**
@@ -382,7 +386,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
382
386
  editedItem: {
383
387
  type: Object,
384
388
  observer: '__editedItemChanged',
385
- notify: true
389
+ notify: true,
386
390
  },
387
391
 
388
392
  /**
@@ -399,7 +403,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
399
403
  type: String,
400
404
  value: '',
401
405
  reflectToAttribute: true,
402
- observer: '__editorPositionChanged'
406
+ observer: '__editorPositionChanged',
403
407
  },
404
408
 
405
409
  /**
@@ -410,7 +414,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
410
414
  */
411
415
  editOnClick: {
412
416
  type: Boolean,
413
- value: false
417
+ value: false,
414
418
  },
415
419
 
416
420
  /**
@@ -428,7 +432,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
428
432
  */
429
433
  dataProvider: {
430
434
  type: Function,
431
- observer: '__dataProviderChanged'
435
+ observer: '__dataProviderChanged',
432
436
  },
433
437
 
434
438
  /**
@@ -476,7 +480,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
476
480
  type: Boolean,
477
481
  reflectToAttribute: true,
478
482
  notify: true,
479
- observer: '__editorOpenedChanged'
483
+ observer: '__editorOpenedChanged',
480
484
  },
481
485
 
482
486
  /**
@@ -486,7 +490,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
486
490
  size: {
487
491
  type: Number,
488
492
  readOnly: true,
489
- notify: true
493
+ notify: true,
490
494
  },
491
495
 
492
496
  /**
@@ -497,7 +501,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
497
501
  noToolbar: {
498
502
  type: Boolean,
499
503
  value: false,
500
- reflectToAttribute: true
504
+ reflectToAttribute: true,
501
505
  },
502
506
 
503
507
  /**
@@ -541,7 +545,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
541
545
  */
542
546
  i18n: {
543
547
  type: Object,
544
- value: function () {
548
+ value() {
545
549
  return {
546
550
  newItem: 'New item',
547
551
  editItem: 'Edit item',
@@ -555,20 +559,20 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
555
559
  content: 'Are you sure you want to delete this item? This action cannot be undone.',
556
560
  button: {
557
561
  confirm: 'Delete',
558
- dismiss: 'Cancel'
559
- }
562
+ dismiss: 'Cancel',
563
+ },
560
564
  },
561
565
  cancel: {
562
566
  title: 'Discard changes',
563
567
  content: 'There are unsaved changes to this item.',
564
568
  button: {
565
569
  confirm: 'Discard',
566
- dismiss: 'Cancel'
567
- }
568
- }
569
- }
570
+ dismiss: 'Cancel',
571
+ },
572
+ },
573
+ },
570
574
  };
571
- }
575
+ },
572
576
  },
573
577
 
574
578
  /** @private */
@@ -586,7 +590,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
586
590
  */
587
591
  _fullscreen: {
588
592
  type: Boolean,
589
- observer: '__fullscreenChanged'
593
+ observer: '__fullscreenChanged',
590
594
  },
591
595
 
592
596
  /**
@@ -594,8 +598,8 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
594
598
  * @protected
595
599
  */
596
600
  _fullscreenMediaQuery: {
597
- value: '(max-width: 600px), (max-height: 600px)'
598
- }
601
+ value: '(max-width: 600px), (max-height: 600px)',
602
+ },
599
603
  };
600
604
  }
601
605
 
@@ -607,7 +611,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
607
611
  '__editOnClickChanged(editOnClick, _grid)',
608
612
  '__saveButtonPropsChanged(_saveButton, i18n.saveItem, __isDirty)',
609
613
  '__cancelButtonPropsChanged(_cancelButton, i18n.cancel)',
610
- '__deleteButtonPropsChanged(_deleteButton, i18n.deleteItem, __isNew)'
614
+ '__deleteButtonPropsChanged(_deleteButton, i18n.deleteItem, __isNew)',
611
615
  ];
612
616
  }
613
617
 
@@ -624,7 +628,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
624
628
 
625
629
  /** @private */
626
630
  static _isValidEditorPosition(editorPosition) {
627
- return ['bottom', 'aside'].indexOf(editorPosition) != -1;
631
+ return ['bottom', 'aside'].includes(editorPosition);
628
632
  }
629
633
 
630
634
  /** @protected */
@@ -655,7 +659,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
655
659
  button.id = 'delete';
656
660
  button.setAttribute('theme', 'tertiary error');
657
661
  return button;
658
- }
662
+ },
659
663
  };
660
664
  }
661
665
 
@@ -683,7 +687,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
683
687
  this.addController(
684
688
  new MediaQueryController(this._fullscreenMediaQuery, (matches) => {
685
689
  this._fullscreen = matches;
686
- })
690
+ }),
687
691
  );
688
692
  }
689
693
 
@@ -841,17 +845,17 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
841
845
  return;
842
846
  }
843
847
 
844
- if (slotAttributeValue == 'grid') {
848
+ if (slotAttributeValue === 'grid') {
845
849
  // Force to remove listener on previous grid first
846
850
  this.__editOnClickChanged(false, this._grid);
847
851
  this._grid = node;
848
852
  this.__editOnClickChanged(this.editOnClick, this._grid);
849
- } else if (slotAttributeValue == 'form') {
853
+ } else if (slotAttributeValue === 'form') {
850
854
  this._form = node;
851
855
  } else if (slotAttributeValue.indexOf('button') >= 0) {
852
856
  const [button] = slotAttributeValue.split('-');
853
857
  this[`_${button}Button`] = node;
854
- } else if (slotAttributeValue == 'header') {
858
+ } else if (slotAttributeValue === 'header') {
855
859
  this._headerNode = node;
856
860
  }
857
861
  });
@@ -1061,7 +1065,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
1061
1065
  ) {
1062
1066
  this.$.confirmCancel.opened = true;
1063
1067
  const listenOnce = (event) => {
1064
- event.preventDefault(); // prevent editor to get closed
1068
+ event.preventDefault(); // Prevent editor to get closed
1065
1069
  if (item || keepOpened) {
1066
1070
  this.__edit(item);
1067
1071
  this.__clearItemAndKeepEditorOpened(item, keepOpened);
@@ -1125,14 +1129,16 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
1125
1129
  } else {
1126
1130
  console.warn(
1127
1131
  '<vaadin-crud> Unable to autoconfigure form because the data structure is unknown. ' +
1128
- 'Either specify `include` or ensure at least one item is available beforehand.'
1132
+ 'Either specify `include` or ensure at least one item is available beforehand.',
1129
1133
  );
1130
1134
  }
1131
1135
  }
1132
1136
  this._form.item = item;
1133
1137
  this._fields.forEach((e) => {
1134
1138
  const path = e.path || e.getAttribute('path');
1135
- path && (e.value = this.get(path, item));
1139
+ if (path) {
1140
+ e.value = this.get(path, item);
1141
+ }
1136
1142
  });
1137
1143
 
1138
1144
  this.__isNew = this.__isNew || (this.items && this.items.indexOf(item) < 0);
@@ -1177,7 +1183,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
1177
1183
  /** @private */
1178
1184
  __new(event) {
1179
1185
  // This allows listening to parent element and fire only when clicking on default or custom new-button.
1180
- if (event.composedPath().filter((e) => e.nodeType == 1 && e.hasAttribute('new-button'))[0]) {
1186
+ if (event.composedPath().filter((e) => e.nodeType === 1 && e.hasAttribute('new-button'))[0]) {
1181
1187
  this.__confirmBeforeChangingEditedItem(null, true);
1182
1188
  }
1183
1189
  }
@@ -1196,7 +1202,7 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
1196
1202
  this.__isDirty = false;
1197
1203
  this.__isNew = !item;
1198
1204
  const evt = this.dispatchEvent(
1199
- new CustomEvent(this.__isNew ? 'new' : 'edit', { detail: { item: item }, cancelable: true })
1205
+ new CustomEvent(this.__isNew ? 'new' : 'edit', { detail: { item }, cancelable: true }),
1200
1206
  );
1201
1207
  if (evt) {
1202
1208
  this.editedItem = item || {};
@@ -1214,9 +1220,11 @@ class Crud extends SlotMixin(ControllerMixin(ElementMixin(ThemableMixin(PolymerE
1214
1220
  const item = { ...this.editedItem };
1215
1221
  this._fields.forEach((e) => {
1216
1222
  const path = e.path || e.getAttribute('path');
1217
- path && this.__set(path, e.value, item);
1223
+ if (path) {
1224
+ this.__set(path, e.value, item);
1225
+ }
1218
1226
  });
1219
- const evt = this.dispatchEvent(new CustomEvent('save', { detail: { item: item }, cancelable: true }));
1227
+ const evt = this.dispatchEvent(new CustomEvent('save', { detail: { item }, cancelable: true }));
1220
1228
  if (evt) {
1221
1229
  if (this.__isNew && !this.dataProvider) {
1222
1230
  if (!this.items) {
@@ -30,7 +30,7 @@ registerStyles(
30
30
  left: calc((var(--lumo-size-m) - var(--lumo-size-s)) / -2);
31
31
  }
32
32
  `,
33
- { moduleId: 'lumo-crud-grid-edit' }
33
+ { moduleId: 'lumo-crud-grid-edit' },
34
34
  );
35
35
 
36
36
  /**
@@ -42,20 +42,6 @@ const editorStyles = css`
42
42
  margin-top: 0 !important;
43
43
  }
44
44
 
45
- [part='scroller'] {
46
- padding: var(--lumo-space-l);
47
- }
48
-
49
- [part='footer'] {
50
- background-color: var(--lumo-contrast-5pct);
51
- padding: var(--lumo-space-s);
52
- }
53
-
54
- [part='footer'] ::slotted(*) {
55
- margin-left: var(--lumo-space-s);
56
- margin-right: var(--lumo-space-s);
57
- }
58
-
59
45
  :host(:not([dir='rtl'])) ::slotted([slot='delete-button']) {
60
46
  margin-right: auto;
61
47
  }
@@ -74,6 +60,10 @@ registerStyles(
74
60
  font-family: var(--lumo-font-family);
75
61
  }
76
62
 
63
+ [part='scroller'] {
64
+ padding: var(--lumo-space-l);
65
+ }
66
+
77
67
  [part='toolbar'] {
78
68
  padding: var(--lumo-space-s) var(--lumo-space-m);
79
69
  background-color: var(--lumo-contrast-5pct);
@@ -93,6 +83,16 @@ registerStyles(
93
83
  border: 0;
94
84
  }
95
85
 
86
+ [part='footer'] {
87
+ background-color: var(--lumo-contrast-5pct);
88
+ padding: var(--lumo-space-s);
89
+ }
90
+
91
+ [part='footer'] ::slotted(*) {
92
+ margin-left: var(--lumo-space-s);
93
+ margin-right: var(--lumo-space-s);
94
+ }
95
+
96
96
  [part='editor'] {
97
97
  background: var(--lumo-base-color);
98
98
  box-sizing: border-box;
@@ -121,11 +121,24 @@ registerStyles(
121
121
  vaadin-grid-cell-content {
122
122
  text-overflow: ellipsis;
123
123
  }
124
- `
124
+ `,
125
125
  ],
126
- { moduleId: 'lumo-crud' }
126
+ { moduleId: 'lumo-crud' },
127
127
  );
128
128
 
129
- registerStyles('vaadin-crud-dialog-overlay', editorStyles, {
130
- moduleId: 'lumo-crud-dialog-overlay'
131
- });
129
+ registerStyles(
130
+ 'vaadin-crud-dialog-overlay',
131
+ [
132
+ editorStyles,
133
+ css`
134
+ [part='header'] ::slotted(h3) {
135
+ margin-top: 0 !important;
136
+ margin-bottom: 0 !important;
137
+ margin-inline-start: var(--lumo-space-s);
138
+ }
139
+ `,
140
+ ],
141
+ {
142
+ moduleId: 'lumo-crud-dialog-overlay',
143
+ },
144
+ );
@@ -37,7 +37,7 @@ registerStyles(
37
37
  left: 0;
38
38
  }
39
39
  `,
40
- { moduleId: 'material-crud-grid-edit' }
40
+ { moduleId: 'material-crud-grid-edit' },
41
41
  );
42
42
 
43
43
  /**
@@ -45,19 +45,8 @@ registerStyles(
45
45
  * They are applied to both `vaadin-crud` and `vaadin-crud-dialog-overlay` components.
46
46
  */
47
47
  const editorStyles = css`
48
- [part='scroller'] {
49
- padding: 16px;
50
- background: var(--material-background-color);
51
- }
52
-
53
48
  [part='footer'] {
54
49
  background-color: var(--material-secondary-background-color);
55
- padding: 8px 4px;
56
- }
57
-
58
- [part='footer'] ::slotted(*) {
59
- margin-left: 4px;
60
- margin-right: 4px;
61
50
  }
62
51
 
63
52
  :host(:not([dir='rtl'])) ::slotted([slot='delete-button']) {
@@ -78,11 +67,25 @@ registerStyles(
78
67
  font-family: var(--material-font-family);
79
68
  }
80
69
 
70
+ [part='scroller'] {
71
+ padding: 16px;
72
+ background: var(--material-background-color);
73
+ }
74
+
81
75
  [part='toolbar'] {
82
76
  padding: 8px;
83
77
  background-color: var(--material-secondary-background-color);
84
78
  }
85
79
 
80
+ [part='footer'] {
81
+ padding: 8px 4px;
82
+ }
83
+
84
+ [part='footer'] ::slotted(*) {
85
+ margin-left: 4px;
86
+ margin-right: 4px;
87
+ }
88
+
86
89
  :host(:not([editor-position=''])) [part='editor']:not([hidden]) {
87
90
  box-shadow: var(--material-shadow-elevation-12dp);
88
91
  }
@@ -101,9 +104,9 @@ registerStyles(
101
104
  margin: 0;
102
105
  padding: 0;
103
106
  }
104
- `
107
+ `,
105
108
  ],
106
- { moduleId: 'material-crud' }
109
+ { moduleId: 'material-crud' },
107
110
  );
108
111
 
109
112
  registerStyles(
@@ -125,7 +128,16 @@ registerStyles(
125
128
  :host([closing]) {
126
129
  animation: 0.25s material-overlay-dummy-animation;
127
130
  }
128
- `
131
+
132
+ [part='header'] ::slotted(h3) {
133
+ margin-top: 0 !important;
134
+ margin-bottom: 0 !important;
135
+ }
136
+
137
+ [part='content'] {
138
+ padding: 0 16px 16px;
139
+ }
140
+ `,
129
141
  ],
130
- { moduleId: 'material-crud-dialog-overlay' }
142
+ { moduleId: 'material-crud-dialog-overlay' },
131
143
  );