@dile/crud 0.0.20 → 0.0.22
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.
|
@@ -262,7 +262,11 @@ export class DileCrud extends DileCrudMixin(LitElement) {
|
|
|
262
262
|
|
|
263
263
|
openInsert() {
|
|
264
264
|
this.dispatchEvent(new CustomEvent('crud-item-insert', { bubbles: true, composed: true }));
|
|
265
|
-
this.
|
|
265
|
+
if (this.config.insertOperation?.type === 'modal') {
|
|
266
|
+
this.modalInsert.open();
|
|
267
|
+
} else if (this.config.insertOperation?.type == 'handler') {
|
|
268
|
+
this.config.insertOperation.handler(this);
|
|
269
|
+
}
|
|
266
270
|
}
|
|
267
271
|
|
|
268
272
|
insertSaveSuccess() {
|
|
@@ -270,8 +274,13 @@ export class DileCrud extends DileCrudMixin(LitElement) {
|
|
|
270
274
|
}
|
|
271
275
|
|
|
272
276
|
updateRequest(e) {
|
|
273
|
-
|
|
274
|
-
this.
|
|
277
|
+
const itemId = e.detail.itemId;
|
|
278
|
+
if (this.config.updateOperation?.type === 'modal') {
|
|
279
|
+
this.editItem(itemId);
|
|
280
|
+
this.modalUpdate.open();
|
|
281
|
+
} else if (this.config.updateOperation?.type == 'handler') {
|
|
282
|
+
this.config.updateOperation.handler(itemId, this);
|
|
283
|
+
}
|
|
275
284
|
}
|
|
276
285
|
|
|
277
286
|
editItem(id) {
|
package/lib/defaultConfig.js
CHANGED
|
@@ -30,6 +30,18 @@ export const defaultConfig = {
|
|
|
30
30
|
},
|
|
31
31
|
responseAdapter: new ResponseApiAdapter(),
|
|
32
32
|
requestAdapter: new RequestApiAdapter(),
|
|
33
|
+
insertOperation: {
|
|
34
|
+
type: 'modal'
|
|
35
|
+
},
|
|
36
|
+
updateOperation: {
|
|
37
|
+
type: 'modal'
|
|
38
|
+
},
|
|
39
|
+
insertOperation: {
|
|
40
|
+
type: 'modal'
|
|
41
|
+
},
|
|
42
|
+
computeItemId(element) {
|
|
43
|
+
return element.id;
|
|
44
|
+
},
|
|
33
45
|
actions: {
|
|
34
46
|
list: [
|
|
35
47
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
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": "f45af75c2af49f385aee09c56d78752b84bc10c3"
|
|
35
35
|
}
|