@dile/crud 1.10.6 → 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
- editClick() {
133
- this.dispatchEvent(new CustomEvent('crud-item-edit', {
133
+ _dispatchItemEvent(eventName) {
134
+ this.dispatchEvent(new CustomEvent(eventName, {
134
135
  bubbles: true,
135
136
  composed: true,
136
137
  detail: {
137
- itemId: this.itemId
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.dispatchEvent(new CustomEvent('crud-item-delete', {
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.dispatchEvent(new CustomEvent('crud-item-restore', {
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,13 +26,14 @@ 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
  }
38
39
  .relation-item > dile-icon {
@@ -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.6",
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": {
@@ -31,5 +31,5 @@
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "d7a4a5656ebfc843fb67a8c8c81d83cab95a7429"
34
+ "gitHead": "55837f27bec72372e2be12f49583738aa5944f8f"
35
35
  }