@dile/crud 1.9.0 → 1.9.2
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.
|
@@ -12,6 +12,13 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
12
12
|
:host {
|
|
13
13
|
display: block;
|
|
14
14
|
}
|
|
15
|
+
label {
|
|
16
|
+
display: block;
|
|
17
|
+
margin-bottom: var(--dile-input-label-margin-bottom, 4px);
|
|
18
|
+
font-size: var(--dile-input-label-font-size, 1em);
|
|
19
|
+
color: var(--dile-input-label-color, #59e);
|
|
20
|
+
font-weight: var(--dile-input-label-font-weight, normal);
|
|
21
|
+
}
|
|
15
22
|
dile-ajax-select-crud{
|
|
16
23
|
margin-bottom: 0;
|
|
17
24
|
}
|
|
@@ -45,7 +52,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
45
52
|
}
|
|
46
53
|
button.remove-btn dile-icon {
|
|
47
54
|
--dile-icon-color: var(--many-relation-remove-color, #c00);
|
|
48
|
-
--dile-icon-size: var(--many-relation-remove-size,
|
|
55
|
+
--dile-icon-size: var(--many-relation-remove-size, 24px);
|
|
49
56
|
}
|
|
50
57
|
.add-row {
|
|
51
58
|
display: flex;
|
|
@@ -77,6 +84,8 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
77
84
|
|
|
78
85
|
static get properties() {
|
|
79
86
|
return {
|
|
87
|
+
label: { type: String },
|
|
88
|
+
|
|
80
89
|
// Endpoints
|
|
81
90
|
endpointGet: { type: String },
|
|
82
91
|
endpointList: { type: String },
|
|
@@ -102,6 +111,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
102
111
|
itemTemplate: { type: Object },
|
|
103
112
|
getListItems: { type: Object },
|
|
104
113
|
addRelationLabel: { type: String },
|
|
114
|
+
emptyListMessage: { type: String },
|
|
105
115
|
bodyIdProperty: { type: String },
|
|
106
116
|
|
|
107
117
|
// Internal state
|
|
@@ -164,6 +174,10 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
164
174
|
@ajax-error="${this._onRemoveError}"
|
|
165
175
|
></dile-ajax>
|
|
166
176
|
|
|
177
|
+
${this.label
|
|
178
|
+
? html`<label for="textField">${this.label}</label>`
|
|
179
|
+
: ""
|
|
180
|
+
}
|
|
167
181
|
<div class="add-row">
|
|
168
182
|
<dile-ajax-select-crud
|
|
169
183
|
id="theselect"
|
|
@@ -191,7 +205,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
191
205
|
${this._loadingList
|
|
192
206
|
? html`<dile-spinner active></dile-spinner>`
|
|
193
207
|
: this._items.length === 0
|
|
194
|
-
? html`<p class="empty-msg">${this.translations
|
|
208
|
+
? html`<p class="empty-msg">${this.emptyListMessageComputed(this.emptyListMessage, this.translations)}</p>`
|
|
195
209
|
: this._items.map(item => html`
|
|
196
210
|
<div class="relation-item">
|
|
197
211
|
<span class="relation-item-content">${this.itemTemplate(item)}</span>
|
|
@@ -212,7 +226,10 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
212
226
|
}
|
|
213
227
|
|
|
214
228
|
_addSelectedItem() {
|
|
215
|
-
if (!this._selectedId)
|
|
229
|
+
if (!this._selectedId) {
|
|
230
|
+
this._dispatch('many-relation-add-no-selection');
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
216
233
|
const bodyKey = this.bodyIdProperty || this.idProperty;
|
|
217
234
|
this._ajaxadd.data = { [bodyKey]: this._selectedId };
|
|
218
235
|
this._ajaxadd.generateRequest();
|
|
@@ -280,4 +297,8 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
280
297
|
selectDefaultPlaceholderComputed(value, translations) {
|
|
281
298
|
return value ? value : translations?.select_relation_placeholder ?? 'Select...';
|
|
282
299
|
}
|
|
300
|
+
|
|
301
|
+
emptyListMessageComputed(message, translations) {
|
|
302
|
+
return message ? message : translations?.empty_list ?? 'There are no items yet';
|
|
303
|
+
}
|
|
283
304
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "1fe481edcd8ccfaf7a7aeb74f8d66a22a4423228"
|
|
35
35
|
}
|