@dile/crud 0.4.0 → 0.4.1

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.
@@ -95,9 +95,6 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
95
95
  if(this.setDataOnInit) {
96
96
  this.initData();
97
97
  }
98
- if(!this.actionLabel) {
99
- this.actionLabel = capitalizeFirstLetter(this.operation);
100
- }
101
98
  }
102
99
 
103
100
  get form() {
@@ -105,15 +102,28 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
105
102
  }
106
103
 
107
104
  actionLabelComputed(label, translations, operation) {
105
+ if(label) {
106
+ return label;
107
+ }
108
+ if(! translations) {
109
+ return operation == 'insert' ? 'Insert' : 'Update';
110
+ }
108
111
  if(operation == 'insert') {
109
- return label ? label : translations?.insert_label ? translations.insert_label : 'Insert';
112
+ return translations.insert_label;
110
113
  }
111
114
  if(operation == 'update') {
112
- return label ? label : translations?.update_label ? translations.update_label : 'Update';
115
+ return translations.update_label;
113
116
  }
114
117
  return translations.send_label;
115
118
  }
116
119
 
120
+ cancelLabelComputed(label, translations) {
121
+ if(label) {
122
+ return label;
123
+ }
124
+ return translations ? translations.cancel_label : 'Cancel';
125
+ }
126
+
117
127
  render() {
118
128
  return html`
119
129
  ${this.ajaxComponents}
@@ -136,7 +146,7 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
136
146
  ${this.showCancelButton ?
137
147
  this.cancelIcon
138
148
  ? 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>`
149
+ : html`<dile-button class="cancel_button" @click=${this.doCancel}>${this.cancelLabelComputed(this.cancelLabel, this.translations)}</dile-button>`
140
150
  : ''
141
151
  }
142
152
  </div>
@@ -37,7 +37,7 @@ export class DileImageUploader extends DileI18nMixin(LitElement) {
37
37
  endpoint=${this.endpoint}
38
38
  actionLabel="${this.saveLabelComputed(this.saveLabel, this.translations)}"
39
39
  sendDataAsFormData
40
- language="es"
40
+ language="${this.language}"
41
41
  @save-success=${this.imageSaveSuccess}
42
42
  .responseAdapter=${this.responseAdapter}
43
43
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
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": "9514bd93f87c3237a41056fb6bb59025088f230e"
34
+ "gitHead": "74907e7bdaa0bd1656d1db1b8b2845208aa91698"
35
35
  }