@dile/crud 0.0.55 → 0.0.56

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.
@@ -35,6 +35,7 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
35
35
  :host([inline]) section {
36
36
  display: flex;
37
37
  align-items: center;
38
+ gap: var(--inline-gap, 1rem);
38
39
  }
39
40
  :host([inline]) dile-inline-feedback {
40
41
  display: none;
@@ -42,6 +43,12 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
42
43
  :host([hidefeedback]) dile-inline-feedback {
43
44
  display: none;
44
45
  }
46
+ .actionIcon {
47
+ --dile-icon-color: var(--action-icon-color, var(--dile-primary-color, #674cdc));
48
+ }
49
+ .cancelIcon {
50
+ --dile-icon-color: var(--cancel-icon-color, #d74c3c);
51
+ }
45
52
  `
46
53
  ];
47
54
 
@@ -60,6 +67,9 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
60
67
  responseAdapter: { type: Object },
61
68
  sendDataAsFormData: { type: Boolean },
62
69
  showCancelButton: { type: Boolean },
70
+ inline: { type: Boolean, reflect: true },
71
+ actionIcon: { type: Object },
72
+ cancelIcon: { type: Object },
63
73
  };
64
74
  }
65
75
 
@@ -108,14 +118,29 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
108
118
  return html`
109
119
  ${this.ajaxComponents}
110
120
  <section>
111
- <slot></slot>
121
+ <slot></slot>
122
+ ${this.inline ? this.actionsTemplate : ''}
123
+ </section>
112
124
  <dile-inline-feedback id="feedback"></dile-inline-feedback>
125
+ ${this.inline ? '' : this.actionsTemplate}
126
+ `;
127
+ }
128
+
129
+ get actionsTemplate() {
130
+ return html`
113
131
  <div class="actions">
114
- <dile-button @click=${this.doAction}>${this.actionLabelComputed(this.actionLabel, this.translations, this.operation)}</dile-button>
115
- ${this.showCancelButton ? html`<dile-button class="cancel_button" @click=${this.doCancel}>${this.translations.cancel_label}</dile-button>` : ''}
132
+ ${this.actionIcon
133
+ ? html`<a href="#" @click=${this.doAction}><dile-icon .icon=${this.actionIcon} class="actionIcon"></dile-icon></a>`
134
+ : html`<dile-button @click=${this.doAction}>${this.actionLabelComputed(this.actionLabel, this.translations, this.operation)}</dile-button>`
135
+ }
136
+ ${this.showCancelButton ?
137
+ this.cancelIcon
138
+ ? html`<a href="#" @click=${this.doCancel}><dile-icon @click=${this.doAction} .icon=${this.cancelIcon} class="cancelIcon"></dile-icon></a>`
139
+ : html`<dile-button class="cancel_button" @click=${this.doCancel}>${this.translations.cancel_label}</dile-button>`
140
+ : ''
141
+ }
116
142
  </div>
117
- </section>
118
- `;
143
+ `
119
144
  }
120
145
 
121
146
  get ajaxComponents() {
@@ -148,7 +173,8 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
148
173
  }
149
174
  }
150
175
 
151
- doAction() {
176
+ doAction(e) {
177
+ e.preventDefault();
152
178
  this.feedback.clear();
153
179
  this.ajaxsave.data = this.form.getData();
154
180
  this.ajaxsave.generateRequest();
@@ -266,7 +292,8 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
266
292
  return this.translations.error_operation(this.operation);
267
293
  }
268
294
 
269
- doCancel() {
295
+ doCancel(e) {
296
+ e.preventDefault();
270
297
  this.dispatchEvent(new CustomEvent('form-canceled', {
271
298
  bubbles: true,
272
299
  composed: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
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": "8f71392b64dc49d9049cf98d1087dcb2d841c5df"
34
+ "gitHead": "995e1cef5db80dad3e967d4a88b26d19ae37d5cc"
35
35
  }