@dile/crud 2.13.0 → 2.15.0

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.
@@ -66,6 +66,7 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
66
66
  destructive: { type: Boolean, reflect: true },
67
67
  responseAdapter: { type: Object },
68
68
  loading: { type: Boolean },
69
+ fullWidth: { type: Boolean, reflect: true, attribute: 'full-width' },
69
70
  };
70
71
  }
71
72
 
@@ -76,6 +77,7 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
76
77
  this.selection = 'DeleteAction';
77
78
  this.responseAdapter = new ResponseApiAdapter();
78
79
  this.loading = false;
80
+ this.fullWidth = false;
79
81
  }
80
82
 
81
83
  firstUpdated() {
@@ -106,7 +108,7 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
106
108
 
107
109
  get actionListTemplate() {
108
110
  return html`
109
- <dile-crud-list-options .icon="${moreVertIcon}" label="${this.translations.actions_label}" class="${this.actionIds.length > 0 ? 'visible' : 'hide'}">
111
+ <dile-crud-list-options .fullWidth=${this.fullWidth} .icon="${moreVertIcon}" label="${this.translations.actions_label}" class="${this.actionIds.length > 0 ? 'visible' : 'hide'}">
110
112
  <p>${this.actionIds.length} ${this.actionIds.length == 1 ? this.translations.element_label : this.translations.element_plural_label}</p>
111
113
  <div @element-changed=${this.selectorChanged}>
112
114
  ${this.selectActionsTemplate}
@@ -14,6 +14,10 @@ export class DileCrudSingleActionDispatcher extends DileCrudActions {
14
14
  --dile-button-hover-text-color: var(--dile-crud-single-action-hover-text-color, var(--dile-on-primary-light-color, #303030));
15
15
  --dile-button-hover-border-color: var(--dile-crud-single-action-hover-border-color, var(--dile-primary-color, #666666));
16
16
  }
17
+ :host([full-width]) dile-button.visible {
18
+ display: block;
19
+ --dile-button-width: 100%;
20
+ }
17
21
  `
18
22
  ];
19
23
 
@@ -16,13 +16,13 @@ export class DileCrudSingleActions extends DileCrudActions {
16
16
  }
17
17
  dile-card {
18
18
  --dile-card-border: none;
19
- margin-bottom: 1.5rem;
19
+ margin-bottom: var(--dile-crud-single-actions-card-margin-bottom, 1.5rem);
20
20
  --dile-card-background-color: var(--dile-secondary-light-color, #beed8e);
21
21
  --dile-card-text-color: var(--dile-on-secondary-light-color, #303030);
22
22
  }
23
23
  .action-list {
24
24
  display: grid;
25
- grid-template-columns: 1fr 1fr;
25
+ grid-template-columns: var(--dile-crud-single-actions-columns, 1fr 1fr);
26
26
  grid-gap: 1rem;
27
27
  align-items: stretch;
28
28
  }
@@ -203,6 +203,7 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
203
203
  <dile-crud-item-delete
204
204
  id="eldelete"
205
205
  endpoint="${this.config.endpoint}"
206
+ .confirmMessageTemplate=${this.config.templates.deleteConfirmMessage}
206
207
  @delete-success=${this.deleteSuccess}
207
208
  language="${this.language}"
208
209
  ></dile-crud-item-delete>
@@ -550,7 +551,7 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
550
551
  }
551
552
 
552
553
  itemDeleteRequest(e) {
553
- this.deleteElement.delete(e.detail.itemId)
554
+ this.deleteElement.delete(e.detail.itemId, e.detail.item);
554
555
  }
555
556
 
556
557
  itemRestoreRequest(e) {
@@ -23,9 +23,10 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
23
23
  --dile-confirm-cancel-button-color: var(--neutral-icon-color, #337aad);
24
24
  --dile-confirm-cancel-text-button-color: #fff;
25
25
  }
26
- p {
26
+ .message {
27
27
  text-align: center;
28
28
  color: #303030;
29
+ margin: 1em 0;
29
30
  }
30
31
  `
31
32
  ];
@@ -39,6 +40,8 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
39
40
  cancelLabel: { type: String },
40
41
  acceptLabel: { type: String },
41
42
  method: { type: String },
43
+ confirmMessageTemplate: { attribute: false },
44
+ itemToDelete: { state: true },
42
45
  };
43
46
  }
44
47
 
@@ -48,7 +51,8 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
48
51
  this.errorEventName = 'delete-error';
49
52
  this.responseAdapter = new ResponseApiAdapter();
50
53
  this.method = 'delete';
51
- this.ITEM_TO_DELETE_
54
+ this.confirmMessageTemplate = null;
55
+ this.itemToDelete = null;
52
56
  }
53
57
 
54
58
  firstUpdated() {
@@ -70,8 +74,9 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
70
74
  acceptLabel="${this.acceptLabelComputed(this.acceptLabel, this.translations)}"
71
75
  id="elconfirm"
72
76
  @dile-confirm-accepted=${this.deleteAccepted}
77
+ @dile-confirm-cancelled=${this.deleteCancelled}
73
78
  >
74
- <p>${this.confirmMessageComputed(this.confirmMessage, this.translations)}</p>
79
+ <div class="message">${this.confirmMessageComputed(this.confirmMessage, this.translations, this.confirmMessageTemplate, this.itemToDelete)}</div>
75
80
  </dile-confirm>
76
81
  `;
77
82
  }
@@ -80,9 +85,11 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
80
85
  return `${endpoint}/${relatedId}`
81
86
  }
82
87
 
83
- delete(itemId) {
88
+ delete(itemId, item = null) {
84
89
  if(itemId != "" && itemId != undefined) {
85
90
  this.relatedId = itemId;
91
+ // Reactive: the confirm message is re-rendered with this item
92
+ this.itemToDelete = item;
86
93
  this.elconfirm.open();
87
94
  } else {
88
95
  throw new Error(OPERATION_ITEM_MISSING_ERROR);
@@ -93,7 +100,12 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
93
100
  this.ajaxdelete.generateRequest();
94
101
  }
95
102
 
103
+ deleteCancelled() {
104
+ this.itemToDelete = null;
105
+ }
106
+
96
107
  doSuccessDelete(e) {
108
+ this.itemToDelete = null;
97
109
  let msg = this.computeResponseMessage(e.detail);
98
110
  this.dispatchEvent(new CustomEvent(this.successEventName, {
99
111
  bubbles: true,
@@ -106,6 +118,7 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
106
118
  }
107
119
 
108
120
  doErrorDelete(e) {
121
+ this.itemToDelete = null;
109
122
  let msg = this.computeResponseMessage(e.detail);
110
123
  this.dispatchEvent(new CustomEvent(this.errorEventName, {
111
124
  bubbles: true,
@@ -134,7 +147,10 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
134
147
  return label ? label : translations?.delete_label ? translations.delete_label : 'Delete';
135
148
  }
136
149
 
137
- confirmMessageComputed(message, translations) {
150
+ confirmMessageComputed(message, translations, template = null, item = null) {
151
+ if(typeof template === 'function' && item) {
152
+ return template(item);
153
+ }
138
154
  return message ? message : translations?.delete_confirm_message ? translations.delete_confirm_message : 'Are you sure?';
139
155
  }
140
156
  }
@@ -70,6 +70,121 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
70
70
  .statscontainer {
71
71
  margin: 0 1rem;
72
72
  }
73
+
74
+ /* Sidebar layout */
75
+ .sidebar-container {
76
+ container-type: inline-size;
77
+ container-name: dile-crud-single;
78
+ margin-bottom: 1.5rem;
79
+ }
80
+ .sidebar-layout {
81
+ display: grid;
82
+ grid-template-columns: minmax(0, 1fr);
83
+ gap: var(--dile-crud-single-gap, 1.5rem);
84
+ align-items: start;
85
+ }
86
+ @container dile-crud-single (min-width: 48rem) {
87
+ .sidebar-layout {
88
+ grid-template-columns: minmax(0, 1fr) var(--dile-crud-single-sidebar-width, 18rem);
89
+ }
90
+ }
91
+ .sidebar-layout main.elcontainer {
92
+ margin-bottom: 0;
93
+ min-width: 0;
94
+ }
95
+ aside.sidebar {
96
+ display: flex;
97
+ flex-direction: column;
98
+ gap: var(--dile-crud-single-sidebar-gap, 1rem);
99
+ min-width: 0;
100
+ }
101
+ aside.sidebar .actions {
102
+ flex-direction: column;
103
+ align-items: stretch;
104
+ gap: 0.5rem;
105
+ margin-bottom: 0;
106
+ padding: var(--dile-crud-single-sidebar-actions-padding, 1rem);
107
+ border-radius: var(--dile-crud-single-sidebar-actions-border-radius, 0.5rem);
108
+ background-color: var(--dile-crud-single-sidebar-actions-background-color, var(--dile-primary-dark-color, #d7d353));
109
+ --dile-button-width: 100%;
110
+ }
111
+ aside.sidebar .action-controller {
112
+ margin-left: 0;
113
+ }
114
+ aside.sidebar dile-crud-single-actions {
115
+ --dile-crud-single-actions-columns: 1fr;
116
+ --dile-crud-single-actions-card-margin-bottom: 0;
117
+ }
118
+
119
+ /* Action groups */
120
+ .action-groups {
121
+ display: grid;
122
+ grid-template-columns: repeat(auto-fill, minmax(var(--dile-crud-single-groups-min-width, 16rem), 1fr));
123
+ gap: var(--dile-crud-single-groups-gap, 1rem);
124
+ align-items: start;
125
+ margin-bottom: 1.5rem;
126
+ }
127
+ aside.sidebar .action-groups {
128
+ grid-template-columns: minmax(0, 1fr);
129
+ margin-bottom: 0;
130
+ }
131
+ .action-group {
132
+ display: flex;
133
+ flex-direction: column;
134
+ gap: var(--dile-crud-single-group-buttons-gap, 0.6rem);
135
+ padding: var(--dile-crud-single-group-padding, 1rem);
136
+ border-radius: var(--dile-crud-single-group-border-radius, 0.5rem);
137
+ background-color: var(--dile-crud-single-group-background-color, var(--dile-background-color, #fff));
138
+ color: var(--dile-crud-single-group-text-color, var(--dile-on-background-color, #303030));
139
+ border: var(--dile-crud-single-group-border, 1px solid rgba(0, 0, 0, 0.08));
140
+ box-shadow: var(--dile-crud-single-group-box-shadow, 0 1px 3px rgba(0, 0, 0, 0.08));
141
+ }
142
+ .action-group-title {
143
+ margin: 0 0 0.25rem 0;
144
+ font-size: var(--dile-crud-single-group-title-font-size, 1.25rem);
145
+ font-weight: var(--dile-crud-single-group-title-font-weight, 400);
146
+ color: var(--dile-crud-single-group-title-color, inherit);
147
+ }
148
+ .group-action {
149
+ display: block;
150
+ --dile-button-width: 100%;
151
+ --dile-button-font-size: var(--dile-crud-single-group-action-font-size, 1rem);
152
+ --dile-button-font-weight: var(--dile-crud-single-group-action-font-weight, normal);
153
+ --dile-button-border-radius: var(--dile-crud-single-group-action-border-radius, 0.5rem);
154
+ --dile-button-border-width: var(--dile-crud-single-group-action-border-width, 1px);
155
+ --dile-button-padding-y: var(--dile-crud-single-group-action-padding-y, 0.6rem);
156
+ --dile-button-padding-x: var(--dile-crud-single-group-action-padding-x, 0.8rem);
157
+ }
158
+ .group-action.variant-primary {
159
+ --dile-button-background-color: var(--dile-crud-single-action-primary-background-color, var(--dile-primary-color, #7BB93D));
160
+ --dile-button-text-color: var(--dile-crud-single-action-primary-text-color, var(--dile-on-primary-color, #fff));
161
+ --dile-button-border-color: var(--dile-crud-single-action-primary-border-color, var(--dile-primary-color, #7BB93D));
162
+ --dile-button-hover-background-color: var(--dile-crud-single-action-primary-hover-background-color, var(--dile-primary-dark-color, #12354d));
163
+ --dile-button-hover-text-color: var(--dile-crud-single-action-primary-hover-text-color, var(--dile-on-primary-dark-color, #fff));
164
+ --dile-button-hover-border-color: var(--dile-crud-single-action-primary-hover-border-color, var(--dile-primary-dark-color, #12354d));
165
+ --dile-button-icon-color: var(--dile-button-text-color);
166
+ --dile-button-icon-hover-color: var(--dile-button-hover-text-color);
167
+ }
168
+ .group-action.variant-outline {
169
+ --dile-button-background-color: var(--dile-crud-single-action-outline-background-color, transparent);
170
+ --dile-button-text-color: var(--dile-crud-single-action-outline-text-color, var(--dile-on-background-color, #303030));
171
+ --dile-button-border-color: var(--dile-crud-single-action-outline-border-color, currentColor);
172
+ --dile-button-hover-background-color: var(--dile-crud-single-action-outline-hover-background-color, rgba(0, 0, 0, 0.05));
173
+ --dile-button-hover-text-color: var(--dile-crud-single-action-outline-hover-text-color, var(--dile-on-background-color, #303030));
174
+ --dile-button-hover-border-color: var(--dile-crud-single-action-outline-hover-border-color, var(--dile-on-background-color, #303030));
175
+ --dile-button-icon-color: var(--dile-button-text-color);
176
+ --dile-button-icon-hover-color: var(--dile-button-hover-text-color);
177
+ }
178
+ .group-action.variant-danger {
179
+ --dile-button-background-color: var(--dile-crud-single-action-danger-background-color, color-mix(in srgb, var(--dile-danger-color, #e31e1b) 15%, transparent));
180
+ --dile-button-text-color: var(--dile-crud-single-action-danger-text-color, var(--dile-danger-color, #e31e1b));
181
+ --dile-button-border-color: var(--dile-crud-single-action-danger-border-color, color-mix(in srgb, var(--dile-danger-color, #e31e1b) 40%, transparent));
182
+ --dile-button-hover-background-color: var(--dile-crud-single-action-danger-hover-background-color, var(--dile-danger-color, #e31e1b));
183
+ --dile-button-hover-text-color: var(--dile-crud-single-action-danger-hover-text-color, var(--dile-on-danger-color, #fff));
184
+ --dile-button-hover-border-color: var(--dile-crud-single-action-danger-hover-border-color, var(--dile-danger-color, #e31e1b));
185
+ --dile-button-icon-color: var(--dile-button-text-color);
186
+ --dile-button-icon-hover-color: var(--dile-button-hover-text-color);
187
+ }
73
188
  `
74
189
  ];
75
190
 
@@ -79,6 +194,13 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
79
194
  relatedId: { type: String },
80
195
  element: { type: Object },
81
196
  actionIds: { type: Array },
197
+ /**
198
+ * Visual layout of the component:
199
+ * - 'stacked' (default): detail, then the actions bar and the action card below.
200
+ * - 'sidebar': detail on the left and a column with the actions on the right.
201
+ * Falls back to config.customization.singleLayout when not set.
202
+ */
203
+ layout: { type: String, reflect: true },
82
204
  };
83
205
  }
84
206
 
@@ -87,6 +209,20 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
87
209
  this.actionIds = [];
88
210
  }
89
211
 
212
+ get computedLayout() {
213
+ const layout = this.layout || this.config?.customization?.singleLayout;
214
+ return DileCrudSingle.layouts.includes(layout) ? layout : 'stacked';
215
+ }
216
+
217
+ /** List actions (batch menu or dispatcher) take the full width of the column in the sidebar layout. */
218
+ get fullWidthActions() {
219
+ return this.computedLayout === 'sidebar';
220
+ }
221
+
222
+ static get layouts() {
223
+ return ['stacked', 'sidebar'];
224
+ }
225
+
90
226
  firstUpdated() {
91
227
  super.firstUpdated();
92
228
  this.actionIds = [this.relatedId];
@@ -110,32 +246,64 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
110
246
  get showActionsBar() {
111
247
  const c = this.config;
112
248
  const hasEdit = !c?.customization?.disableEdit;
113
- const hasDirectActions = c?.actions?.directSingleActions?.length > 0;
249
+ const hasDirectActions = this.ungroupedDirectActionNames.length > 0;
114
250
  const hasListActions = !c?.customization?.disableListActionsOnSingleComponent && c?.actions?.list?.length > 0;
115
251
  return hasEdit || hasDirectActions || hasListActions;
116
252
  }
117
253
 
118
254
  get contentTemplate() {
255
+ return html`
256
+ ${this.computedLayout === 'sidebar'
257
+ ? this.sidebarLayoutTemplate
258
+ : this.stackedLayoutTemplate
259
+ }
260
+ ${this.element ? this.config.templates.relations(this.element) : ''}
261
+ `;
262
+ }
263
+
264
+ get stackedLayoutTemplate() {
119
265
  return html`
120
266
  <main class="elcontainer">
121
267
  ${this.detailTemplate}
122
- ${this.showActionsBar ? html`
123
- <div class="actions" @action-success=${this.actionSuccess}>
124
- ${!this.config?.customization?.disableEdit ? html`
125
- <dile-button-icon .icon="${editIcon}" @click=${this.edit}>
126
- ${this.startUpdateLabelComputed(this.config.labels.startUpdateAction, this.translations)}
127
- </dile-button-icon>
128
- ` : ''}
129
- ${this.directActionsTemplate}
130
- ${this.config?.customization?.disableListActionsOnSingleComponent ? '' : this.actionsTemplate}
131
- </div>
132
- ` : ''}
268
+ ${this.actionsBarTemplate}
133
269
  </main>
134
270
 
135
271
  ${this.updateTemplate}
272
+ ${this.actionGroupsTemplate}
136
273
  ${this.singleActionsTemplate}
137
-
138
- ${this.element ? this.config.templates.relations(this.element) : ''}
274
+ `;
275
+ }
276
+
277
+ get sidebarLayoutTemplate() {
278
+ return html`
279
+ <div class="sidebar-container">
280
+ <div class="sidebar-layout">
281
+ <main class="elcontainer">
282
+ ${this.detailTemplate}
283
+ </main>
284
+ <aside class="sidebar">
285
+ ${this.actionsBarTemplate}
286
+ ${this.actionGroupsTemplate}
287
+ ${this.singleActionsTemplate}
288
+ </aside>
289
+ </div>
290
+ </div>
291
+ ${this.updateTemplate}
292
+ `;
293
+ }
294
+
295
+ get actionsBarTemplate() {
296
+ if (!this.showActionsBar) return '';
297
+ return html`
298
+ <div class="actions" @action-success=${this.actionSuccess}>
299
+ ${!this.config?.customization?.disableEdit ? html`
300
+ <dile-button-icon .icon="${editIcon}" @click=${this.edit}>
301
+ ${this.startUpdateLabelComputed(this.config.labels.startUpdateAction, this.translations)}
302
+ </dile-button-icon>
303
+ ` : ''}
304
+ ${this.directActionsTemplate}
305
+ ${this.config?.customization?.disableListActionsOnSingleComponent ? '' : this.actionsTemplate}
306
+ </div>
139
307
  `;
140
308
  }
141
309
 
@@ -155,7 +323,7 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
155
323
  return html`
156
324
  <dile-crud-single-actions
157
325
  .actions=${this.config.actions.single}
158
- .directSingleActions=${this.config.actions.directSingleActions || []}
326
+ .directSingleActions=${[...(this.config.actions.directSingleActions || []), ...this.groupedActionNames]}
159
327
  .formActionsTemplate=${this.config.templates.formSingleActions}
160
328
  .actionIds=${this.actionIds}
161
329
  endpoint=${this.config.endpoint}
@@ -168,8 +336,7 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
168
336
  }
169
337
 
170
338
  get directActionsTemplate() {
171
- const directSingleActions = this.config.actions.directSingleActions || [];
172
- return directSingleActions.map(actionName => {
339
+ return this.ungroupedDirectActionNames.map(actionName => {
173
340
  const action = (this.config.actions.single || []).find(a => a.name === actionName);
174
341
  if (!action) return '';
175
342
  if (action.shouldAppear && !action.shouldAppear(this.element)) return '';
@@ -181,6 +348,62 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
181
348
  });
182
349
  }
183
350
 
351
+ get ungroupedDirectActionNames() {
352
+ const grouped = this.groupedActionNames;
353
+ return (this.config?.actions?.directSingleActions || []).filter(name => !grouped.includes(name));
354
+ }
355
+
356
+ get groupedActionNames() {
357
+ const groups = this.config?.actions?.singleGroups || [];
358
+ return [...new Set(groups.flatMap(group => group?.actions || []))];
359
+ }
360
+
361
+ get actionGroups() {
362
+ const groups = this.config?.actions?.singleGroups || [];
363
+ const singleActions = this.config?.actions?.single || [];
364
+ return groups
365
+ .map(group => ({
366
+ title: group?.title || '',
367
+ actions: (group?.actions || [])
368
+ .map(name => singleActions.find(action => action.name === name))
369
+ .filter(action => action && (!action.shouldAppear || action.shouldAppear(this.element))),
370
+ }))
371
+ .filter(group => group.actions.length > 0);
372
+ }
373
+
374
+ static get actionVariants() {
375
+ return ['primary', 'outline', 'danger'];
376
+ }
377
+
378
+ actionVariant(action) {
379
+ if (DileCrudSingle.actionVariants.includes(action.variant)) {
380
+ return action.variant;
381
+ }
382
+ return action.destructive ? 'danger' : 'primary';
383
+ }
384
+
385
+ get actionGroupsTemplate() {
386
+ const groups = this.actionGroups;
387
+ if (groups.length === 0) return '';
388
+ return html`
389
+ <div class="action-groups">
390
+ ${groups.map(group => html`
391
+ <section class="action-group">
392
+ ${group.title ? html`<h3 class="action-group-title">${group.title}</h3>` : ''}
393
+ ${group.actions.map(action => html`
394
+ <dile-button
395
+ class="group-action variant-${this.actionVariant(action)}"
396
+ name="${action.name}"
397
+ icon="${action.icon || ''}"
398
+ @click=${() => this.triggerAction(action.name)}
399
+ >${action.label}</dile-button>
400
+ `)}
401
+ </section>
402
+ `)}
403
+ </div>
404
+ `;
405
+ }
406
+
184
407
  get detailElement() {
185
408
  return this.shadowRoot.getElementById('eldetail');
186
409
  }
@@ -43,6 +43,21 @@ export class DileCrudListOptions extends LitElement {
43
43
  display: none;
44
44
  }
45
45
  }
46
+ /* Full width mode: always the labeled button, stretched to the available width */
47
+ :host([full-width]) dile-menu-overlay {
48
+ display: block;
49
+ }
50
+ :host([full-width]) div[slot="trigger"] {
51
+ flex: 1;
52
+ min-width: 0;
53
+ }
54
+ :host([full-width]) dile-button-icon {
55
+ display: block;
56
+ --dile-button-width: 100%;
57
+ }
58
+ :host([full-width]) dile-icon {
59
+ display: none;
60
+ }
46
61
  `
47
62
  ];
48
63
 
@@ -50,9 +65,16 @@ export class DileCrudListOptions extends LitElement {
50
65
  return {
51
66
  label: { type: String },
52
67
  icon: { type: Object },
68
+ /** Stretch the trigger button to the full available width (the labeled button is always shown). */
69
+ fullWidth: { type: Boolean, reflect: true, attribute: 'full-width' },
53
70
  };
54
71
  }
55
72
 
73
+ constructor() {
74
+ super();
75
+ this.fullWidth = false;
76
+ }
77
+
56
78
  render() {
57
79
  return html`
58
80
  <dile-menu-overlay horizontalAlign="under_right" verticalAlign="bottom">
@@ -21,6 +21,7 @@ export const DileCrudMixin = (superclass) => class extends superclass {
21
21
  @crud-action-success=${this.actionSuccess}
22
22
  class="action-controller"
23
23
  id="elactions"
24
+ .fullWidth=${!!this.fullWidthActions}
24
25
  .actionIds=${this.actionIds}
25
26
  endpoint=${this.config.endpoint}
26
27
  .actions=${this.config.actions.list}
@@ -37,6 +38,7 @@ export const DileCrudMixin = (superclass) => class extends superclass {
37
38
  @crud-action-success=${this.actionSuccess}
38
39
  class="action-controller"
39
40
  id="elactions"
41
+ .fullWidth=${!!this.fullWidthActions}
40
42
  .actionIds=${this.actionIds}
41
43
  endpoint=${this.config.endpoint}
42
44
  .actions=${this.config.actions.list}
@@ -34,6 +34,7 @@ export const defaultConfig = {
34
34
  disableHelp: true,
35
35
  disableListActionsOnSingleComponent: false,
36
36
  disableListWiewSwitch: false,
37
+ singleLayout: 'stacked',
37
38
  },
38
39
  responseAdapter: new ResponseApiAdapter(),
39
40
  requestAdapter: new RequestApiAdapter(),
@@ -62,6 +63,7 @@ export const defaultConfig = {
62
63
  ],
63
64
  single: [],
64
65
  directSingleActions: [],
66
+ singleGroups: [],
65
67
  },
66
68
  templates: {
67
69
  item: () => templatePlaceholder('item'),
@@ -77,6 +79,9 @@ export const defaultConfig = {
77
79
  `,
78
80
  relations: () => '',
79
81
  formSingleActions: () => '',
82
+ // Optional. (item) => string | TemplateResult with the confirmation message
83
+ // shown when deleting an item. If null, the delete_confirm_message translation is used.
84
+ deleteConfirmMessage: null,
80
85
  },
81
86
  labels: {
82
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "2.13.0",
3
+ "version": "2.15.0",
4
4
  "description": "Components to create a generic crud system based on Web Components and Lit",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,12 +26,12 @@
26
26
  "homepage": "https://dile-components.com/",
27
27
  "dependencies": {
28
28
  "@dile/image-cropper": "^0.1.1",
29
- "@dile/ui": "^3.21.0",
29
+ "@dile/ui": "^3.21.1",
30
30
  "axios": "^1.19.0",
31
31
  "lit": "^2.7.0 || ^3.0.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "425f1cf93f61a2703365205c699b8a6fc64e538d"
36
+ "gitHead": "31543c2e6ab7d62af911c5842f2dc61596f3c14e"
37
37
  }