@dile/crud 2.14.1 → 2.15.1
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/components/action/src/DileCrudActions.js +3 -1
- package/components/action/src/DileCrudSingleActionDispatcher.js +4 -0
- package/components/action/src/DileCrudSingleActions.js +2 -2
- package/components/single/src/DileCrudSingle.js +246 -17
- package/components/ui/src/DileCrudListOptions.js +22 -0
- package/lib/DileCrudMixin.js +2 -0
- package/lib/defaultConfig.js +2 -0
- package/package.json +3 -3
|
@@ -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
|
}
|
|
@@ -70,6 +70,127 @@ 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
|
+
/* Inherited by every button in the column, including the dile-button-icon
|
|
111
|
+
rendered by dile-crud-list-options inside dile-crud-actions. */
|
|
112
|
+
--dile-button-justify-content: var(--dile-crud-single-group-action-justify-content, center);
|
|
113
|
+
--dile-button-text-align: var(--dile-crud-single-group-action-text-align, center);
|
|
114
|
+
}
|
|
115
|
+
aside.sidebar .action-controller {
|
|
116
|
+
margin-left: 0;
|
|
117
|
+
}
|
|
118
|
+
aside.sidebar dile-crud-single-actions {
|
|
119
|
+
--dile-crud-single-actions-columns: 1fr;
|
|
120
|
+
--dile-crud-single-actions-card-margin-bottom: 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Action groups */
|
|
124
|
+
.action-groups {
|
|
125
|
+
display: grid;
|
|
126
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--dile-crud-single-groups-min-width, 16rem), 1fr));
|
|
127
|
+
gap: var(--dile-crud-single-groups-gap, 1rem);
|
|
128
|
+
align-items: start;
|
|
129
|
+
margin-bottom: 1.5rem;
|
|
130
|
+
}
|
|
131
|
+
aside.sidebar .action-groups {
|
|
132
|
+
grid-template-columns: minmax(0, 1fr);
|
|
133
|
+
margin-bottom: 0;
|
|
134
|
+
}
|
|
135
|
+
.action-group {
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: var(--dile-crud-single-group-buttons-gap, 0.6rem);
|
|
139
|
+
padding: var(--dile-crud-single-group-padding, 1rem);
|
|
140
|
+
border-radius: var(--dile-crud-single-group-border-radius, 0.5rem);
|
|
141
|
+
background-color: var(--dile-crud-single-group-background-color, var(--dile-background-color, #fff));
|
|
142
|
+
color: var(--dile-crud-single-group-text-color, var(--dile-on-background-color, #303030));
|
|
143
|
+
border: var(--dile-crud-single-group-border, 1px solid rgba(0, 0, 0, 0.08));
|
|
144
|
+
box-shadow: var(--dile-crud-single-group-box-shadow, 0 1px 3px rgba(0, 0, 0, 0.08));
|
|
145
|
+
}
|
|
146
|
+
.action-group-title {
|
|
147
|
+
margin: 0 0 0.25rem 0;
|
|
148
|
+
font-size: var(--dile-crud-single-group-title-font-size, 1.25rem);
|
|
149
|
+
font-weight: var(--dile-crud-single-group-title-font-weight, 400);
|
|
150
|
+
color: var(--dile-crud-single-group-title-color, inherit);
|
|
151
|
+
}
|
|
152
|
+
.group-action {
|
|
153
|
+
display: block;
|
|
154
|
+
--dile-button-width: 100%;
|
|
155
|
+
--dile-button-font-size: var(--dile-crud-single-group-action-font-size, 1rem);
|
|
156
|
+
--dile-button-font-weight: var(--dile-crud-single-group-action-font-weight, normal);
|
|
157
|
+
--dile-button-border-radius: var(--dile-crud-single-group-action-border-radius, 0.5rem);
|
|
158
|
+
--dile-button-border-width: var(--dile-crud-single-group-action-border-width, 1px);
|
|
159
|
+
--dile-button-padding-y: var(--dile-crud-single-group-action-padding-y, 0.6rem);
|
|
160
|
+
--dile-button-padding-x: var(--dile-crud-single-group-action-padding-x, 0.8rem);
|
|
161
|
+
--dile-button-justify-content: var(--dile-crud-single-group-action-justify-content, center);
|
|
162
|
+
--dile-button-text-align: var(--dile-crud-single-group-action-text-align, center);
|
|
163
|
+
}
|
|
164
|
+
.group-action.variant-primary {
|
|
165
|
+
--dile-button-background-color: var(--dile-crud-single-action-primary-background-color, var(--dile-primary-color, #7BB93D));
|
|
166
|
+
--dile-button-text-color: var(--dile-crud-single-action-primary-text-color, var(--dile-on-primary-color, #fff));
|
|
167
|
+
--dile-button-border-color: var(--dile-crud-single-action-primary-border-color, var(--dile-primary-color, #7BB93D));
|
|
168
|
+
--dile-button-hover-background-color: var(--dile-crud-single-action-primary-hover-background-color, var(--dile-primary-dark-color, #12354d));
|
|
169
|
+
--dile-button-hover-text-color: var(--dile-crud-single-action-primary-hover-text-color, var(--dile-on-primary-dark-color, #fff));
|
|
170
|
+
--dile-button-hover-border-color: var(--dile-crud-single-action-primary-hover-border-color, var(--dile-primary-dark-color, #12354d));
|
|
171
|
+
--dile-button-icon-color: var(--dile-button-text-color);
|
|
172
|
+
--dile-button-icon-hover-color: var(--dile-button-hover-text-color);
|
|
173
|
+
}
|
|
174
|
+
.group-action.variant-outline {
|
|
175
|
+
--dile-button-background-color: var(--dile-crud-single-action-outline-background-color, transparent);
|
|
176
|
+
--dile-button-text-color: var(--dile-crud-single-action-outline-text-color, var(--dile-on-background-color, #303030));
|
|
177
|
+
--dile-button-border-color: var(--dile-crud-single-action-outline-border-color, currentColor);
|
|
178
|
+
--dile-button-hover-background-color: var(--dile-crud-single-action-outline-hover-background-color, rgba(0, 0, 0, 0.05));
|
|
179
|
+
--dile-button-hover-text-color: var(--dile-crud-single-action-outline-hover-text-color, var(--dile-on-background-color, #303030));
|
|
180
|
+
--dile-button-hover-border-color: var(--dile-crud-single-action-outline-hover-border-color, var(--dile-on-background-color, #303030));
|
|
181
|
+
--dile-button-icon-color: var(--dile-button-text-color);
|
|
182
|
+
--dile-button-icon-hover-color: var(--dile-button-hover-text-color);
|
|
183
|
+
}
|
|
184
|
+
.group-action.variant-danger {
|
|
185
|
+
--dile-button-background-color: var(--dile-crud-single-action-danger-background-color, color-mix(in srgb, var(--dile-danger-color, #e31e1b) 15%, transparent));
|
|
186
|
+
--dile-button-text-color: var(--dile-crud-single-action-danger-text-color, var(--dile-danger-color, #e31e1b));
|
|
187
|
+
--dile-button-border-color: var(--dile-crud-single-action-danger-border-color, color-mix(in srgb, var(--dile-danger-color, #e31e1b) 40%, transparent));
|
|
188
|
+
--dile-button-hover-background-color: var(--dile-crud-single-action-danger-hover-background-color, var(--dile-danger-color, #e31e1b));
|
|
189
|
+
--dile-button-hover-text-color: var(--dile-crud-single-action-danger-hover-text-color, var(--dile-on-danger-color, #fff));
|
|
190
|
+
--dile-button-hover-border-color: var(--dile-crud-single-action-danger-hover-border-color, var(--dile-danger-color, #e31e1b));
|
|
191
|
+
--dile-button-icon-color: var(--dile-button-text-color);
|
|
192
|
+
--dile-button-icon-hover-color: var(--dile-button-hover-text-color);
|
|
193
|
+
}
|
|
73
194
|
`
|
|
74
195
|
];
|
|
75
196
|
|
|
@@ -79,6 +200,13 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
79
200
|
relatedId: { type: String },
|
|
80
201
|
element: { type: Object },
|
|
81
202
|
actionIds: { type: Array },
|
|
203
|
+
/**
|
|
204
|
+
* Visual layout of the component:
|
|
205
|
+
* - 'stacked' (default): detail, then the actions bar and the action card below.
|
|
206
|
+
* - 'sidebar': detail on the left and a column with the actions on the right.
|
|
207
|
+
* Falls back to config.customization.singleLayout when not set.
|
|
208
|
+
*/
|
|
209
|
+
layout: { type: String, reflect: true },
|
|
82
210
|
};
|
|
83
211
|
}
|
|
84
212
|
|
|
@@ -87,6 +215,20 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
87
215
|
this.actionIds = [];
|
|
88
216
|
}
|
|
89
217
|
|
|
218
|
+
get computedLayout() {
|
|
219
|
+
const layout = this.layout || this.config?.customization?.singleLayout;
|
|
220
|
+
return DileCrudSingle.layouts.includes(layout) ? layout : 'stacked';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** List actions (batch menu or dispatcher) take the full width of the column in the sidebar layout. */
|
|
224
|
+
get fullWidthActions() {
|
|
225
|
+
return this.computedLayout === 'sidebar';
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
static get layouts() {
|
|
229
|
+
return ['stacked', 'sidebar'];
|
|
230
|
+
}
|
|
231
|
+
|
|
90
232
|
firstUpdated() {
|
|
91
233
|
super.firstUpdated();
|
|
92
234
|
this.actionIds = [this.relatedId];
|
|
@@ -110,32 +252,64 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
110
252
|
get showActionsBar() {
|
|
111
253
|
const c = this.config;
|
|
112
254
|
const hasEdit = !c?.customization?.disableEdit;
|
|
113
|
-
const hasDirectActions =
|
|
255
|
+
const hasDirectActions = this.ungroupedDirectActionNames.length > 0;
|
|
114
256
|
const hasListActions = !c?.customization?.disableListActionsOnSingleComponent && c?.actions?.list?.length > 0;
|
|
115
257
|
return hasEdit || hasDirectActions || hasListActions;
|
|
116
258
|
}
|
|
117
259
|
|
|
118
260
|
get contentTemplate() {
|
|
261
|
+
return html`
|
|
262
|
+
${this.computedLayout === 'sidebar'
|
|
263
|
+
? this.sidebarLayoutTemplate
|
|
264
|
+
: this.stackedLayoutTemplate
|
|
265
|
+
}
|
|
266
|
+
${this.element ? this.config.templates.relations(this.element) : ''}
|
|
267
|
+
`;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
get stackedLayoutTemplate() {
|
|
119
271
|
return html`
|
|
120
272
|
<main class="elcontainer">
|
|
121
273
|
${this.detailTemplate}
|
|
122
|
-
${this.
|
|
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
|
-
` : ''}
|
|
274
|
+
${this.actionsBarTemplate}
|
|
133
275
|
</main>
|
|
134
276
|
|
|
135
277
|
${this.updateTemplate}
|
|
278
|
+
${this.actionGroupsTemplate}
|
|
136
279
|
${this.singleActionsTemplate}
|
|
137
|
-
|
|
138
|
-
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
get sidebarLayoutTemplate() {
|
|
284
|
+
return html`
|
|
285
|
+
<div class="sidebar-container">
|
|
286
|
+
<div class="sidebar-layout">
|
|
287
|
+
<main class="elcontainer">
|
|
288
|
+
${this.detailTemplate}
|
|
289
|
+
</main>
|
|
290
|
+
<aside class="sidebar">
|
|
291
|
+
${this.actionsBarTemplate}
|
|
292
|
+
${this.actionGroupsTemplate}
|
|
293
|
+
${this.singleActionsTemplate}
|
|
294
|
+
</aside>
|
|
295
|
+
</div>
|
|
296
|
+
</div>
|
|
297
|
+
${this.updateTemplate}
|
|
298
|
+
`;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
get actionsBarTemplate() {
|
|
302
|
+
if (!this.showActionsBar) return '';
|
|
303
|
+
return html`
|
|
304
|
+
<div class="actions" @action-success=${this.actionSuccess}>
|
|
305
|
+
${!this.config?.customization?.disableEdit ? html`
|
|
306
|
+
<dile-button-icon .icon="${editIcon}" @click=${this.edit}>
|
|
307
|
+
${this.startUpdateLabelComputed(this.config.labels.startUpdateAction, this.translations)}
|
|
308
|
+
</dile-button-icon>
|
|
309
|
+
` : ''}
|
|
310
|
+
${this.directActionsTemplate}
|
|
311
|
+
${this.config?.customization?.disableListActionsOnSingleComponent ? '' : this.actionsTemplate}
|
|
312
|
+
</div>
|
|
139
313
|
`;
|
|
140
314
|
}
|
|
141
315
|
|
|
@@ -155,7 +329,7 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
155
329
|
return html`
|
|
156
330
|
<dile-crud-single-actions
|
|
157
331
|
.actions=${this.config.actions.single}
|
|
158
|
-
.directSingleActions=${this.config.actions.directSingleActions || []}
|
|
332
|
+
.directSingleActions=${[...(this.config.actions.directSingleActions || []), ...this.groupedActionNames]}
|
|
159
333
|
.formActionsTemplate=${this.config.templates.formSingleActions}
|
|
160
334
|
.actionIds=${this.actionIds}
|
|
161
335
|
endpoint=${this.config.endpoint}
|
|
@@ -168,8 +342,7 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
168
342
|
}
|
|
169
343
|
|
|
170
344
|
get directActionsTemplate() {
|
|
171
|
-
|
|
172
|
-
return directSingleActions.map(actionName => {
|
|
345
|
+
return this.ungroupedDirectActionNames.map(actionName => {
|
|
173
346
|
const action = (this.config.actions.single || []).find(a => a.name === actionName);
|
|
174
347
|
if (!action) return '';
|
|
175
348
|
if (action.shouldAppear && !action.shouldAppear(this.element)) return '';
|
|
@@ -181,6 +354,62 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
181
354
|
});
|
|
182
355
|
}
|
|
183
356
|
|
|
357
|
+
get ungroupedDirectActionNames() {
|
|
358
|
+
const grouped = this.groupedActionNames;
|
|
359
|
+
return (this.config?.actions?.directSingleActions || []).filter(name => !grouped.includes(name));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
get groupedActionNames() {
|
|
363
|
+
const groups = this.config?.actions?.singleGroups || [];
|
|
364
|
+
return [...new Set(groups.flatMap(group => group?.actions || []))];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
get actionGroups() {
|
|
368
|
+
const groups = this.config?.actions?.singleGroups || [];
|
|
369
|
+
const singleActions = this.config?.actions?.single || [];
|
|
370
|
+
return groups
|
|
371
|
+
.map(group => ({
|
|
372
|
+
title: group?.title || '',
|
|
373
|
+
actions: (group?.actions || [])
|
|
374
|
+
.map(name => singleActions.find(action => action.name === name))
|
|
375
|
+
.filter(action => action && (!action.shouldAppear || action.shouldAppear(this.element))),
|
|
376
|
+
}))
|
|
377
|
+
.filter(group => group.actions.length > 0);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
static get actionVariants() {
|
|
381
|
+
return ['primary', 'outline', 'danger'];
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
actionVariant(action) {
|
|
385
|
+
if (DileCrudSingle.actionVariants.includes(action.variant)) {
|
|
386
|
+
return action.variant;
|
|
387
|
+
}
|
|
388
|
+
return action.destructive ? 'danger' : 'primary';
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
get actionGroupsTemplate() {
|
|
392
|
+
const groups = this.actionGroups;
|
|
393
|
+
if (groups.length === 0) return '';
|
|
394
|
+
return html`
|
|
395
|
+
<div class="action-groups">
|
|
396
|
+
${groups.map(group => html`
|
|
397
|
+
<section class="action-group">
|
|
398
|
+
${group.title ? html`<h3 class="action-group-title">${group.title}</h3>` : ''}
|
|
399
|
+
${group.actions.map(action => html`
|
|
400
|
+
<dile-button
|
|
401
|
+
class="group-action variant-${this.actionVariant(action)}"
|
|
402
|
+
name="${action.name}"
|
|
403
|
+
icon="${action.icon || ''}"
|
|
404
|
+
@click=${() => this.triggerAction(action.name)}
|
|
405
|
+
>${action.label}</dile-button>
|
|
406
|
+
`)}
|
|
407
|
+
</section>
|
|
408
|
+
`)}
|
|
409
|
+
</div>
|
|
410
|
+
`;
|
|
411
|
+
}
|
|
412
|
+
|
|
184
413
|
get detailElement() {
|
|
185
414
|
return this.shadowRoot.getElementById('eldetail');
|
|
186
415
|
}
|
|
@@ -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">
|
package/lib/DileCrudMixin.js
CHANGED
|
@@ -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}
|
package/lib/defaultConfig.js
CHANGED
|
@@ -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'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.1",
|
|
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.
|
|
29
|
+
"@dile/ui": "^3.21.2",
|
|
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": "
|
|
36
|
+
"gitHead": "ebf978a759d3fc8bdc28e891f5abf72c54282d0a"
|
|
37
37
|
}
|