@dile/crud 2.15.5 → 2.16.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.
- package/components/action/src/DileCrudActions.js +17 -1
- package/components/crud/src/DileCrud.js +6 -0
- package/components/list/src/DileCrudList.js +50 -3
- package/components/list/src/DileCrudListService.js +3 -0
- package/components/list/src/DileCrudSelectAll.js +124 -35
- package/lib/DileCrudMixin.js +1 -0
- package/lib/DileI18nMixin.js +3 -0
- package/lib/ResponseApiAdapter.js +8 -0
- package/lib/i18n/en.js +6 -0
- package/lib/i18n/es.js +6 -0
- package/package.json +2 -2
|
@@ -39,6 +39,10 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
|
|
|
39
39
|
.hide {
|
|
40
40
|
display: none;
|
|
41
41
|
}
|
|
42
|
+
.limit {
|
|
43
|
+
color: var(--dile-crud-actions-limit-color, var(--dile-danger-color, #E31E1B));
|
|
44
|
+
font-size: var(--dile-crud-actions-limit-font-size, 0.875rem);
|
|
45
|
+
}
|
|
42
46
|
.modalcontainer {
|
|
43
47
|
color: var(--dile-on-background-color, #303030);
|
|
44
48
|
}
|
|
@@ -67,6 +71,7 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
|
|
|
67
71
|
responseAdapter: { type: Object },
|
|
68
72
|
loading: { type: Boolean },
|
|
69
73
|
fullWidth: { type: Boolean, reflect: true, attribute: 'full-width' },
|
|
74
|
+
maxItems: { type: Number },
|
|
70
75
|
};
|
|
71
76
|
}
|
|
72
77
|
|
|
@@ -110,10 +115,14 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
|
|
|
110
115
|
return html`
|
|
111
116
|
<dile-crud-list-options .fullWidth=${this.fullWidth} .icon="${moreVertIcon}" label="${this.translations.actions_label}" class="${this.actionIds.length > 0 ? 'visible' : 'hide'}">
|
|
112
117
|
<p>${this.actionIds.length} ${this.actionIds.length == 1 ? this.translations.element_label : this.translations.element_plural_label}</p>
|
|
118
|
+
${this.exceedsLimit
|
|
119
|
+
? html`<p class="limit">${this.translations.action_limit_exceeded(this.actionIds.length, this.maxItems)}</p>`
|
|
120
|
+
: ''
|
|
121
|
+
}
|
|
113
122
|
<div @element-changed=${this.selectorChanged}>
|
|
114
123
|
${this.selectActionsTemplate}
|
|
115
124
|
</div>
|
|
116
|
-
<dile-button @click=${this.showAction}>${this.translations.run_action_label}</dile-button>
|
|
125
|
+
<dile-button ?disabled=${this.exceedsLimit} @click=${this.showAction}>${this.translations.run_action_label}</dile-button>
|
|
117
126
|
</dile-crud-list-options>
|
|
118
127
|
`;
|
|
119
128
|
}
|
|
@@ -149,6 +158,10 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
|
|
|
149
158
|
return this.formActionsTemplate(this.selection, this.actionIds);
|
|
150
159
|
}
|
|
151
160
|
|
|
161
|
+
get exceedsLimit() {
|
|
162
|
+
return Number.isFinite(this.maxItems) && this.actionIds.length > this.maxItems;
|
|
163
|
+
}
|
|
164
|
+
|
|
152
165
|
setActionIds(items) {
|
|
153
166
|
this.actionIds = items;
|
|
154
167
|
}
|
|
@@ -172,6 +185,9 @@ export class DileCrudActions extends DileI18nMixin(LitElement) {
|
|
|
172
185
|
}
|
|
173
186
|
|
|
174
187
|
showAction() {
|
|
188
|
+
if (this.exceedsLimit) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
175
191
|
this.dispatchEvent(new CustomEvent('crud-action-requested', {
|
|
176
192
|
bubbles: true,
|
|
177
193
|
composed: true,
|
|
@@ -125,6 +125,7 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
125
125
|
title: { type: String },
|
|
126
126
|
config: { type: Object },
|
|
127
127
|
actionIds: { type: Array },
|
|
128
|
+
batchLimit: { type: Number },
|
|
128
129
|
keyword: { type: String },
|
|
129
130
|
belongsTo: { type: String },
|
|
130
131
|
relationId: { type: String },
|
|
@@ -192,6 +193,7 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
192
193
|
@item-checkbox-changed=${this.itemCheckboxChanged}
|
|
193
194
|
@dile-chip-icon-click=${this.removeFilter}
|
|
194
195
|
@crud-list-all-ids-selected=${this.crudSelectAll}
|
|
196
|
+
@crud-list-batch-limit-changed=${this.batchLimitChanged}
|
|
195
197
|
@crud-list-sort-changed=${this.listSortChanged}
|
|
196
198
|
>
|
|
197
199
|
${this.listTemplate}
|
|
@@ -550,6 +552,10 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
550
552
|
this.actionIds = e.detail.ids;
|
|
551
553
|
}
|
|
552
554
|
|
|
555
|
+
batchLimitChanged(e) {
|
|
556
|
+
this.batchLimit = e.detail.limit;
|
|
557
|
+
}
|
|
558
|
+
|
|
553
559
|
itemDeleteRequest(e) {
|
|
554
560
|
this.deleteElement.delete(e.detail.itemId, e.detail.item);
|
|
555
561
|
}
|
|
@@ -89,6 +89,7 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
89
89
|
pageSize: { type: Number },
|
|
90
90
|
keyword: { type: String },
|
|
91
91
|
isSelectAllActive: { type: Boolean },
|
|
92
|
+
maxIds: { type: Number },
|
|
92
93
|
sort: { type: Object },
|
|
93
94
|
actionIds: { type: Array },
|
|
94
95
|
filters: { type: Array },
|
|
@@ -111,6 +112,7 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
111
112
|
this.delayTime = 200;
|
|
112
113
|
this.delayTimer = null;
|
|
113
114
|
this.isSelectAllActive = false;
|
|
115
|
+
this.maxIds = null;
|
|
114
116
|
this.loading = true;
|
|
115
117
|
this.disableLoadOnStart = false;
|
|
116
118
|
this.listError = null;
|
|
@@ -202,7 +204,8 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
202
204
|
numItems=${this.numItems}
|
|
203
205
|
?disablePagination=${this.config.customization?.disablePagination}
|
|
204
206
|
language="${this.language}"
|
|
205
|
-
maxBatchActionItems=${this.
|
|
207
|
+
.maxBatchActionItems=${this.batchLimit}
|
|
208
|
+
.selectedCount=${this.actionIds.length}
|
|
206
209
|
></dile-crud-select-all>
|
|
207
210
|
`
|
|
208
211
|
}
|
|
@@ -238,7 +241,7 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
238
241
|
method="get"
|
|
239
242
|
url="${this.allIdsUrl}"
|
|
240
243
|
@ajax-success="${this.doSuccessGetIds}"
|
|
241
|
-
@ajax-error="${this.
|
|
244
|
+
@ajax-error="${this.doErrorGetIds}"
|
|
242
245
|
language="${this.language}"
|
|
243
246
|
></dile-ajax>
|
|
244
247
|
`;
|
|
@@ -338,6 +341,22 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
338
341
|
this.elements = e.detail.elements;
|
|
339
342
|
this.numItems = e.detail.numItems;
|
|
340
343
|
this.paginationData = e.detail.paginationData;
|
|
344
|
+
this.maxIds = e.detail.maxIds ?? null;
|
|
345
|
+
this.dispatchEvent(new CustomEvent('crud-list-batch-limit-changed', {
|
|
346
|
+
bubbles: true,
|
|
347
|
+
composed: true,
|
|
348
|
+
detail: { limit: this.batchLimit }
|
|
349
|
+
}));
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Maximum number of items a batch action can receive: the lower of
|
|
354
|
+
* config.maxBatchActionItems and the maxIds sent by the server with the listing.
|
|
355
|
+
*/
|
|
356
|
+
get batchLimit() {
|
|
357
|
+
const limits = [this.config?.maxBatchActionItems, this.maxIds]
|
|
358
|
+
.filter(limit => Number.isFinite(limit));
|
|
359
|
+
return limits.length ? Math.min(...limits) : undefined;
|
|
341
360
|
}
|
|
342
361
|
|
|
343
362
|
computeItemId(element) {
|
|
@@ -489,6 +508,13 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
489
508
|
keyword: this.keyword,
|
|
490
509
|
filters: this.filters,
|
|
491
510
|
}
|
|
511
|
+
// The server applies the same order as the listing, in case it truncates the ids
|
|
512
|
+
if (this.sort?.sortField) {
|
|
513
|
+
data.sortField = this.sort.sortField;
|
|
514
|
+
}
|
|
515
|
+
if (this.sort?.sortDirection) {
|
|
516
|
+
data.sortDirection = this.sort.sortDirection;
|
|
517
|
+
}
|
|
492
518
|
if (this.belongsTo && this.relationId) {
|
|
493
519
|
data.belongsTo = this.belongsTo;
|
|
494
520
|
data.relationId = this.relationId;
|
|
@@ -501,7 +527,28 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
501
527
|
|
|
502
528
|
doSuccessGetIds(e) {
|
|
503
529
|
this.config.responseAdapter.setResponse(e.detail);
|
|
504
|
-
this.
|
|
530
|
+
const ids = this.config.responseAdapter.getIds();
|
|
531
|
+
// A different number means the list changed (or the server truncated the ids):
|
|
532
|
+
// selecting them would apply actions to items the user didn't see.
|
|
533
|
+
if (!Array.isArray(ids) || ids.length !== this.numItems) {
|
|
534
|
+
this.selectAllFailed(this.translations.select_all_count_changed);
|
|
535
|
+
this.refresh();
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
this.dispactSelectAll(ids);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
doErrorGetIds(e) {
|
|
542
|
+
this.selectAllFailed(e.detail?.message || this.translations.select_all_error);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
selectAllFailed(msg) {
|
|
546
|
+
this.shadowRoot.querySelector('dile-crud-select-all')?.reset();
|
|
547
|
+
this.dispatchEvent(new CustomEvent('crud-select-all-error', {
|
|
548
|
+
bubbles: true,
|
|
549
|
+
composed: true,
|
|
550
|
+
detail: { msg }
|
|
551
|
+
}));
|
|
505
552
|
}
|
|
506
553
|
|
|
507
554
|
onItemsCheckboxChanged(e) {
|
|
@@ -99,6 +99,7 @@ export class DileCrudListService extends DileI18nMixin(LitElement) {
|
|
|
99
99
|
this.config.responseAdapter.setResponse(e.detail);
|
|
100
100
|
let elements = this.config.responseAdapter.getElementList();
|
|
101
101
|
let numItems;
|
|
102
|
+
let maxIds = null;
|
|
102
103
|
if (this.config.customization.disablePagination) {
|
|
103
104
|
numItems = elements.length;
|
|
104
105
|
} else {
|
|
@@ -109,6 +110,7 @@ export class DileCrudListService extends DileI18nMixin(LitElement) {
|
|
|
109
110
|
currentPage: data.result.current_page,
|
|
110
111
|
}
|
|
111
112
|
numItems = data.countItems;
|
|
113
|
+
maxIds = this.config.responseAdapter.getMaxIds?.() ?? null;
|
|
112
114
|
}
|
|
113
115
|
this.dispatchEvent(new CustomEvent('crud-list-get-success', {
|
|
114
116
|
bubbles: true,
|
|
@@ -116,6 +118,7 @@ export class DileCrudListService extends DileI18nMixin(LitElement) {
|
|
|
116
118
|
detail: {
|
|
117
119
|
elements,
|
|
118
120
|
numItems,
|
|
121
|
+
maxIds,
|
|
119
122
|
paginationData: this.paginationData,
|
|
120
123
|
}
|
|
121
124
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import '@dile/ui/components/button/button-icon.js';
|
|
3
|
-
import { checkboxBlankIcon, arrowDropDownIcon, checkboxCheckedIcon } from '@dile/icons';
|
|
3
|
+
import { checkboxBlankIcon, arrowDropDownIcon, checkboxCheckedIcon, closeIcon } from '@dile/icons';
|
|
4
4
|
import '@dile/ui/components/icon/icon.js';
|
|
5
5
|
import '@dile/ui/components/menu-overlay/menu-overlay.js';
|
|
6
6
|
import { DileI18nMixin } from '../../../lib/DileI18nMixin.js';
|
|
@@ -44,10 +44,61 @@ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
|
|
|
44
44
|
padding: 0.5rem;
|
|
45
45
|
font-size: 1rem;
|
|
46
46
|
}
|
|
47
|
+
/* Native buttons, so they get the focus with Tab and activate with Enter and Space.
|
|
48
|
+
Same space between options as between the separator line and the text of .clear */
|
|
47
49
|
.option {
|
|
48
50
|
display: flex;
|
|
49
51
|
align-items: center;
|
|
52
|
+
width: 100%;
|
|
53
|
+
box-sizing: border-box;
|
|
50
54
|
cursor: pointer;
|
|
55
|
+
margin: 0.75rem 0;
|
|
56
|
+
padding: 0;
|
|
57
|
+
border: none;
|
|
58
|
+
border-radius: 3px;
|
|
59
|
+
background: none;
|
|
60
|
+
color: inherit;
|
|
61
|
+
font: inherit;
|
|
62
|
+
text-align: left;
|
|
63
|
+
}
|
|
64
|
+
.option:focus-visible {
|
|
65
|
+
outline: 2px solid var(--dile-crud-select-all-focus-outline-color, #2563eb);
|
|
66
|
+
outline-offset: 2px;
|
|
67
|
+
}
|
|
68
|
+
.option.disabled {
|
|
69
|
+
cursor: default;
|
|
70
|
+
}
|
|
71
|
+
/* With the limit message below the label, the icon stays next to the first line */
|
|
72
|
+
.option.has-limit {
|
|
73
|
+
align-items: flex-start;
|
|
74
|
+
}
|
|
75
|
+
.option.disabled .label {
|
|
76
|
+
opacity: 0.6;
|
|
77
|
+
}
|
|
78
|
+
.option.disabled dile-icon {
|
|
79
|
+
--dile-icon-color: var(--dile-crud-select-all-overlay-checkbox-disabled-color, #c0c0c0);
|
|
80
|
+
}
|
|
81
|
+
.text {
|
|
82
|
+
display: flex;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
}
|
|
85
|
+
.limit {
|
|
86
|
+
margin-top: 0.125rem;
|
|
87
|
+
font-size: var(--dile-crud-select-all-limit-font-size, 0.8rem);
|
|
88
|
+
line-height: 1.25;
|
|
89
|
+
color: var(--dile-crud-select-all-limit-color, inherit);
|
|
90
|
+
}
|
|
91
|
+
/* The same space above the first option as below the last one (.clear) */
|
|
92
|
+
.option:first-child {
|
|
93
|
+
margin-top: 0.25rem;
|
|
94
|
+
}
|
|
95
|
+
/* A separate element, so the focus outline of .clear doesn't wrap the line */
|
|
96
|
+
.separator {
|
|
97
|
+
border-top: 1px solid var(--dile-crud-select-all-separator-color, #ddd);
|
|
98
|
+
}
|
|
99
|
+
/* The bottom margin plus the padding of .content matches the space above the text */
|
|
100
|
+
.clear {
|
|
101
|
+
margin-bottom: 0.25rem;
|
|
51
102
|
}
|
|
52
103
|
.option dile-icon {
|
|
53
104
|
--dile-icon-size: var(--dile-crud-select-all-checkbox-size, 1.5rem);
|
|
@@ -78,6 +129,7 @@ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
|
|
|
78
129
|
numItems: { type: Number },
|
|
79
130
|
disablePagination: { type: Boolean },
|
|
80
131
|
maxBatchActionItems: { type: Number },
|
|
132
|
+
selectedCount: { type: Number },
|
|
81
133
|
};
|
|
82
134
|
}
|
|
83
135
|
|
|
@@ -85,20 +137,11 @@ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
|
|
|
85
137
|
super();
|
|
86
138
|
this.checked = false;
|
|
87
139
|
this.disablePagination = false;
|
|
140
|
+
this.selectedCount = 0;
|
|
88
141
|
}
|
|
89
142
|
|
|
90
143
|
render() {
|
|
91
|
-
return
|
|
92
|
-
${this.shouldShowElementSelection(
|
|
93
|
-
this.maxBatchActionItems,
|
|
94
|
-
this.disablePagination,
|
|
95
|
-
this.pageSize,
|
|
96
|
-
this.numItems
|
|
97
|
-
)
|
|
98
|
-
? this.elementTemplate
|
|
99
|
-
: ''
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
144
|
+
return this.elementTemplate;
|
|
102
145
|
}
|
|
103
146
|
|
|
104
147
|
get elementTemplate() {
|
|
@@ -111,35 +154,75 @@ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
|
|
|
111
154
|
<div slot="content" class="content">
|
|
112
155
|
${this.disablePagination
|
|
113
156
|
? ''
|
|
114
|
-
:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</p>
|
|
122
|
-
`
|
|
123
|
-
}
|
|
124
|
-
${this.numItems <= this.maxBatchActionItems
|
|
125
|
-
? html`
|
|
126
|
-
<p class="option" @click=${this.checkAllItems}>
|
|
127
|
-
<dile-icon .icon=${this.selectIcon(this.allChecked)} class="drop"></dile-icon>
|
|
128
|
-
<span>
|
|
129
|
-
${this.translations.select_matching}
|
|
130
|
-
(${this.numItems})
|
|
131
|
-
</span>
|
|
132
|
-
</p>
|
|
133
|
-
`
|
|
134
|
-
: ''
|
|
157
|
+
: this.optionTemplate(
|
|
158
|
+
this.translations.all_in_page,
|
|
159
|
+
this.pageItemsCount,
|
|
160
|
+
this.pageChecked,
|
|
161
|
+
this.checkPageItems,
|
|
162
|
+
this.translations.select_page_limit_exceeded
|
|
163
|
+
)
|
|
135
164
|
}
|
|
165
|
+
${this.optionTemplate(
|
|
166
|
+
this.translations.select_matching,
|
|
167
|
+
this.numItems,
|
|
168
|
+
this.allChecked,
|
|
169
|
+
this.checkAllItems,
|
|
170
|
+
this.translations.select_matching_limit_exceeded
|
|
171
|
+
)}
|
|
172
|
+
${this.clearSelectionTemplate}
|
|
136
173
|
</div>
|
|
137
174
|
</dile-menu-overlay>
|
|
138
175
|
`;
|
|
139
176
|
}
|
|
140
177
|
|
|
141
|
-
|
|
142
|
-
|
|
178
|
+
// Options over the limit are shown disabled instead of hidden, with the reason just below
|
|
179
|
+
// their label, so the user knows why they can't select those items. They use aria-disabled
|
|
180
|
+
// instead of disabled so they stay in the tab order and keyboard users can reach that reason.
|
|
181
|
+
optionTemplate(label, count, checked, handler, limitMessage) {
|
|
182
|
+
const disabled = this.exceedsLimit(count);
|
|
183
|
+
return html`
|
|
184
|
+
<button
|
|
185
|
+
type="button"
|
|
186
|
+
class="option ${disabled ? 'disabled has-limit' : ''}"
|
|
187
|
+
aria-pressed=${checked ? 'true' : 'false'}
|
|
188
|
+
aria-disabled=${disabled ? 'true' : 'false'}
|
|
189
|
+
@click=${disabled ? null : handler}
|
|
190
|
+
>
|
|
191
|
+
<dile-icon .icon=${this.selectIcon(checked)} class="drop"></dile-icon>
|
|
192
|
+
<span class="text">
|
|
193
|
+
<span class="label">${label} (${count})</span>
|
|
194
|
+
${disabled
|
|
195
|
+
? html`<span class="limit">${limitMessage(this.maxBatchActionItems)}</span>`
|
|
196
|
+
: ''
|
|
197
|
+
}
|
|
198
|
+
</span>
|
|
199
|
+
</button>
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Always visible so the user knows it exists, disabled while nothing is selected.
|
|
204
|
+
get clearSelectionTemplate() {
|
|
205
|
+
const disabled = !(this.selectedCount > 0);
|
|
206
|
+
return html`
|
|
207
|
+
<div class="separator" aria-hidden="true"></div>
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
class="option clear ${disabled ? 'disabled' : ''}"
|
|
211
|
+
aria-disabled=${disabled ? 'true' : 'false'}
|
|
212
|
+
@click=${disabled ? null : this.clearSelection}
|
|
213
|
+
>
|
|
214
|
+
<dile-icon .icon=${closeIcon} class="drop"></dile-icon>
|
|
215
|
+
<span class="label">${this.translations.clear_selection}${disabled ? '' : ` (${this.selectedCount})`}</span>
|
|
216
|
+
</button>
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get pageItemsCount() {
|
|
221
|
+
return this.pageSize > this.numItems ? this.numItems : this.pageSize;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
exceedsLimit(count) {
|
|
225
|
+
return Number.isFinite(this.maxBatchActionItems) && count > this.maxBatchActionItems;
|
|
143
226
|
}
|
|
144
227
|
|
|
145
228
|
selectIcon(checked) {
|
|
@@ -183,6 +266,12 @@ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
|
|
|
183
266
|
}));
|
|
184
267
|
}
|
|
185
268
|
|
|
269
|
+
// Unchecking both options makes dile-crud-list empty the selection, including the items
|
|
270
|
+
// checked one by one.
|
|
271
|
+
clearSelection() {
|
|
272
|
+
this.reset();
|
|
273
|
+
}
|
|
274
|
+
|
|
186
275
|
reset() {
|
|
187
276
|
this.resetWithoutDispatch();
|
|
188
277
|
this.dispatchCheked();
|
package/lib/DileCrudMixin.js
CHANGED
|
@@ -23,6 +23,7 @@ export const DileCrudMixin = (superclass) => class extends superclass {
|
|
|
23
23
|
id="elactions"
|
|
24
24
|
.fullWidth=${!!this.fullWidthActions}
|
|
25
25
|
.actionIds=${this.actionIds}
|
|
26
|
+
.maxItems=${this.batchLimit}
|
|
26
27
|
endpoint=${this.config.endpoint}
|
|
27
28
|
.actions=${this.config.actions.list}
|
|
28
29
|
.formActionsTemplate=${this.config.templates.formActions}
|
package/lib/DileI18nMixin.js
CHANGED
|
@@ -9,6 +9,9 @@ export const DileI18nMixin = (superclass) =>
|
|
|
9
9
|
error_operation: () => '',
|
|
10
10
|
showing_page_size: () => '',
|
|
11
11
|
current_page: () => '',
|
|
12
|
+
select_page_limit_exceeded: () => '',
|
|
13
|
+
select_matching_limit_exceeded: () => '',
|
|
14
|
+
action_limit_exceeded: () => '',
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
};
|
|
@@ -34,6 +34,14 @@ export class ResponseApiAdapter {
|
|
|
34
34
|
return this.response.data;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Maximum number of ids the server accepts in /allids, sent with paginated listings.
|
|
39
|
+
* Returns null when the server doesn't send it or has no limit.
|
|
40
|
+
*/
|
|
41
|
+
getMaxIds() {
|
|
42
|
+
return this.response.data?.maxIds ?? null;
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
getActionResponseMessage() {
|
|
38
46
|
return this.response.message;
|
|
39
47
|
}
|
package/lib/i18n/en.js
CHANGED
|
@@ -43,6 +43,12 @@ export const translations = {
|
|
|
43
43
|
all: "all",
|
|
44
44
|
all_in_page: "All in this page",
|
|
45
45
|
select_matching: "Select all matching",
|
|
46
|
+
clear_selection: "Clear selection",
|
|
47
|
+
select_page_limit_exceeded: (max) => `Reduce the page size: up to ${max} items per action.`,
|
|
48
|
+
select_matching_limit_exceeded: (max) => `Filter the list: up to ${max} items per action.`,
|
|
49
|
+
select_all_count_changed: "The list changed while you were selecting. Check the items and select them again.",
|
|
50
|
+
select_all_error: "All items could not be selected.",
|
|
51
|
+
action_limit_exceeded: (count, max) => `You selected ${count} items and an action accepts up to ${max}. Remove some items from the selection.`,
|
|
46
52
|
element_actions: "Element actions",
|
|
47
53
|
select_image: "Select an image",
|
|
48
54
|
save_image: "Save image",
|
package/lib/i18n/es.js
CHANGED
|
@@ -43,6 +43,12 @@ export const translations = {
|
|
|
43
43
|
all: "todos",
|
|
44
44
|
all_in_page: "Todos de esta página",
|
|
45
45
|
select_matching: "Seleccionar coincidentes",
|
|
46
|
+
clear_selection: "Quitar selección",
|
|
47
|
+
select_page_limit_exceeded: (max) => `Reduce el tamaño de página: máximo ${max} ítems por acción.`,
|
|
48
|
+
select_matching_limit_exceeded: (max) => `Filtra la lista: máximo ${max} ítems por acción.`,
|
|
49
|
+
select_all_count_changed: "La lista ha cambiado mientras seleccionabas. Revisa los elementos y vuelve a seleccionarlos.",
|
|
50
|
+
select_all_error: "No se han podido seleccionar todos los elementos.",
|
|
51
|
+
action_limit_exceeded: (count, max) => `Has seleccionado ${count} elementos y una acción admite un máximo de ${max}. Quita elementos de la selección.`,
|
|
46
52
|
element_actions: "Acciones en este ítem",
|
|
47
53
|
select_image: "Selecciona una imagen",
|
|
48
54
|
save_image: "Salvar la imagen",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.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",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "446ece215db3d6ca0b62cc6b70ec47c3ca1478cc"
|
|
37
37
|
}
|