@dile/crud 1.10.5 → 1.10.7
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.
|
@@ -294,11 +294,12 @@ export class DileCrud extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
294
294
|
|
|
295
295
|
updateRequest(e) {
|
|
296
296
|
const itemId = e.detail.itemId;
|
|
297
|
+
const item = e.detail.item;
|
|
297
298
|
if (this.config.updateOperation?.type === 'modal') {
|
|
298
299
|
this.editItem(itemId);
|
|
299
300
|
this.modalUpdate.open();
|
|
300
301
|
} else if (this.config.updateOperation?.type == 'handler') {
|
|
301
|
-
this.config.updateOperation.handler(itemId, this);
|
|
302
|
+
this.config.updateOperation.handler(itemId, this, item);
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
|
|
@@ -203,6 +203,7 @@ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
|
|
|
203
203
|
return html`
|
|
204
204
|
${this.elements.map(element => html`
|
|
205
205
|
<dile-crud-list-item
|
|
206
|
+
.item=${element}
|
|
206
207
|
itemId="${this.computeItemId(element)}"
|
|
207
208
|
.actionIds="${this.actionIds}"
|
|
208
209
|
?disableEdit=${!this.isItemEditable(element)}
|
|
@@ -52,6 +52,7 @@ export class DileCrudListItem extends LitElement {
|
|
|
52
52
|
|
|
53
53
|
static get properties() {
|
|
54
54
|
return {
|
|
55
|
+
item: { type: Object },
|
|
55
56
|
itemId: { type: String },
|
|
56
57
|
actionIds: { type: Array },
|
|
57
58
|
disableEdit: { type: Boolean },
|
|
@@ -129,33 +130,26 @@ export class DileCrudListItem extends LitElement {
|
|
|
129
130
|
}));
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
-
this.dispatchEvent(new CustomEvent(
|
|
133
|
+
_dispatchItemEvent(eventName) {
|
|
134
|
+
this.dispatchEvent(new CustomEvent(eventName, {
|
|
134
135
|
bubbles: true,
|
|
135
136
|
composed: true,
|
|
136
137
|
detail: {
|
|
137
|
-
|
|
138
|
+
item: this.item,
|
|
139
|
+
itemId: this.itemId,
|
|
138
140
|
}
|
|
139
141
|
}));
|
|
140
142
|
}
|
|
141
143
|
|
|
144
|
+
editClick() {
|
|
145
|
+
this._dispatchItemEvent('crud-item-edit');
|
|
146
|
+
}
|
|
147
|
+
|
|
142
148
|
deleteClick() {
|
|
143
|
-
this.
|
|
144
|
-
bubbles: true,
|
|
145
|
-
composed: true,
|
|
146
|
-
detail: {
|
|
147
|
-
itemId: this.itemId
|
|
148
|
-
}
|
|
149
|
-
}));
|
|
149
|
+
this._dispatchItemEvent('crud-item-delete');
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
restoreClick() {
|
|
153
|
-
this.
|
|
154
|
-
bubbles: true,
|
|
155
|
-
composed: true,
|
|
156
|
-
detail: {
|
|
157
|
-
itemId: this.itemId
|
|
158
|
-
}
|
|
159
|
-
}));
|
|
153
|
+
this._dispatchItemEvent('crud-item-restore');
|
|
160
154
|
}
|
|
161
155
|
}
|
|
@@ -26,15 +26,20 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
26
26
|
.relation-item {
|
|
27
27
|
display: flex;
|
|
28
28
|
align-items: center;
|
|
29
|
-
gap: 0.5rem;
|
|
29
|
+
gap: var(--many-relation-item-gap, 0.5rem);
|
|
30
30
|
padding: 0.25rem 0;
|
|
31
31
|
}
|
|
32
32
|
.relation-item-content {
|
|
33
33
|
flex: 1;
|
|
34
|
-
padding-left: 0.4rem;
|
|
34
|
+
padding-left: var(--many-relation-item-content-padding-left, 0.4rem);
|
|
35
35
|
font-size: var(--many-relation-item-font-size, 0.9rem);
|
|
36
|
+
font-weight: var(--many-relation-item-content-font-weight, normal);
|
|
36
37
|
color: var(--many-relation-item-color, inherit);
|
|
37
38
|
}
|
|
39
|
+
.relation-item > dile-icon {
|
|
40
|
+
--dile-icon-color: var(--many-relation-list-icon-color, #666);
|
|
41
|
+
--dile-icon-size: var(--many-relation-list-icon-size, 24px);
|
|
42
|
+
}
|
|
38
43
|
button.remove-btn,
|
|
39
44
|
button.add-btn {
|
|
40
45
|
background: none;
|
|
@@ -111,6 +116,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
111
116
|
// Related list customisation
|
|
112
117
|
itemTemplate: { type: Object },
|
|
113
118
|
getListItems: { type: Object },
|
|
119
|
+
listIcon: { type: Object },
|
|
114
120
|
addRelationLabel: { type: String },
|
|
115
121
|
emptyListMessage: { type: String },
|
|
116
122
|
bodyIdProperty: { type: String },
|
|
@@ -212,6 +218,7 @@ export class DileManyRelation extends DileI18nMixin(LitElement) {
|
|
|
212
218
|
? html`<p class="empty-msg">${this.emptyListMessageComputed(this.emptyListMessage, this.translations)}</p>`
|
|
213
219
|
: this._items.map(item => html`
|
|
214
220
|
<div class="relation-item">
|
|
221
|
+
${this.listIcon ? html`<dile-icon .icon="${this.listIcon}"></dile-icon>` : ''}
|
|
215
222
|
<span class="relation-item-content">${this.itemTemplate(item)}</span>
|
|
216
223
|
<button
|
|
217
224
|
class="remove-btn"
|
|
@@ -149,7 +149,7 @@ export class DileCrudSingle extends DileI18nMixin(DileCrudMixin(LitElement)) {
|
|
|
149
149
|
this.updateElement.edit(this.relatedId);
|
|
150
150
|
this.modalUpdate.open();
|
|
151
151
|
} else if (this.config.updateOperation?.type == 'handler') {
|
|
152
|
-
this.config.updateOperation.handler(this.relatedId, this);
|
|
152
|
+
this.config.updateOperation.handler(this.relatedId, this, element);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.7",
|
|
4
4
|
"description": "Components to create a generic crud system based on Web Components and Lit",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://dile-components.com/",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dile/ui": "^2.23.
|
|
27
|
+
"@dile/ui": "^2.23.10",
|
|
28
28
|
"axios": "^1.16.0",
|
|
29
29
|
"lit": "^2.7.0 || ^3.0.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "55837f27bec72372e2be12f49583738aa5944f8f"
|
|
35
35
|
}
|