@dile/crud 0.0.19 → 0.0.21

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.modalInsert.open();
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
- this.editItem(e.detail.itemId);
274
- this.modalUpdate.open();
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) {
@@ -30,6 +30,15 @@ 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
+ },
33
42
  actions: {
34
43
  list: [
35
44
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
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.polydile.com/",
26
26
  "dependencies": {
27
- "@dile/ui": "^2.1.15",
27
+ "@dile/ui": "^2.1.16",
28
28
  "axios": "^1.7.2",
29
29
  "lit": "^2.7.0 || ^3.0.0"
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
- "gitHead": "6244e9d41ec5e64ea28573605ab30cb710fdd584"
34
+ "gitHead": "aa323d57b8ddd1109420fee58af69487d76859c9"
35
35
  }