@dile/crud 1.11.1 → 1.12.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.
|
@@ -56,7 +56,9 @@ export class DileCrudSingleActions extends DileCrudActions {
|
|
|
56
56
|
attrForSelected="name"
|
|
57
57
|
@dile-selected-changed="${this.onActionSelected}"
|
|
58
58
|
>
|
|
59
|
-
${this.actions
|
|
59
|
+
${this.actions
|
|
60
|
+
.filter(action => !action.shouldAppear || action.shouldAppear(this.element))
|
|
61
|
+
.map(action => html`
|
|
60
62
|
<dile-box-selector-item
|
|
61
63
|
label="${action.label}"
|
|
62
64
|
name="${action.name}"
|
|
@@ -123,6 +123,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
123
123
|
message: { type: String },
|
|
124
124
|
errored: { type: Boolean },
|
|
125
125
|
hideErrorOnInput: { type: Boolean },
|
|
126
|
+
addOnSelect: { type: Boolean },
|
|
126
127
|
|
|
127
128
|
// Internal state
|
|
128
129
|
_items: { type: Array, state: true },
|
|
@@ -143,6 +144,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
143
144
|
this.itemTemplate = (item) => html`${item[this.displayProperty]}`;
|
|
144
145
|
this.bodyIdProperty = null;
|
|
145
146
|
this._loadingList = false;
|
|
147
|
+
this.addOnSelect = false;
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
updated(changedProperties) {
|
|
@@ -204,12 +206,14 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
204
206
|
language="${this.language}"
|
|
205
207
|
@element-changed="${this._onSelectChanged}"
|
|
206
208
|
></dile-ajax-select-crud>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
${!this.addOnSelect ? html`
|
|
210
|
+
<button
|
|
211
|
+
class="add-btn"
|
|
212
|
+
?disabled="${!this._selectedId}"
|
|
213
|
+
title="${this.addRelationLabelComputed(this.addRelationLabel, this.translations)}"
|
|
214
|
+
@click="${this._addSelectedItem}"
|
|
215
|
+
><dile-icon .icon="${addIcon}"></dile-icon></button>
|
|
216
|
+
` : ''}
|
|
213
217
|
</div>
|
|
214
218
|
|
|
215
219
|
${this._loadingList
|
|
@@ -238,6 +242,9 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
238
242
|
|
|
239
243
|
_onSelectChanged(e) {
|
|
240
244
|
this._selectedId = e.detail.value || null;
|
|
245
|
+
if (this.addOnSelect && this._selectedId) {
|
|
246
|
+
this._addSelectedItem();
|
|
247
|
+
}
|
|
241
248
|
}
|
|
242
249
|
|
|
243
250
|
_addSelectedItem() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
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": "43d7239247c27c55f83dc12310a3936e23b28a40"
|
|
35
35
|
}
|