@dile/crud 0.0.32 → 0.0.33

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.
@@ -153,6 +153,7 @@ export class DileCrudDetail extends DileLoading(LitElement) {
153
153
  }
154
154
 
155
155
  doErrorGet(e) {
156
+ this.loading = false;
156
157
  this.dispatchEvent(new CustomEvent('crud-item-detail-load-error', {
157
158
  bubbles: true,
158
159
  composed: true,
@@ -83,7 +83,15 @@ export class DileCrudItemDelete extends DileI18nMixin(LitElement) {
83
83
  }
84
84
 
85
85
  doSuccessDelete(e) {
86
- this.dispatchEvent(new CustomEvent('delete-success', { bubbles: true, composed: true }));
86
+ let msg = this.computeResponseMessage(e.detail);
87
+ this.dispatchEvent(new CustomEvent('delete-success', {
88
+ bubbles: true,
89
+ composed: true,
90
+ detail: {
91
+ msg,
92
+ previousDetail: e.detail,
93
+ }
94
+ }));
87
95
  }
88
96
 
89
97
  doErrorDelete(e) {
@@ -1,5 +1,4 @@
1
1
  import { LitElement, html, css } from 'lit';
2
- import { deepMerge } from '../../../lib/deepMerge.js';
3
2
  import { DileLoading, loadingStyles } from '../../../lib/DileLoading.js';
4
3
  import '@dile/ui/components/button/button.js';
5
4
  import '../../ajax/ajax.js'
@@ -8,8 +7,9 @@ import '../../list/crud-list-pagination-links.js';
8
7
  import '../crud-list-item.js';
9
8
  import '../crud-select-all';
10
9
  import '../crud-list-service.js';
10
+ import { DileI18nMixin } from '../../../lib/DileI18nMixin.js';
11
11
 
12
- export class DileCrudList extends DileLoading(LitElement) {
12
+ export class DileCrudList extends DileI18nMixin(DileLoading(LitElement)) {
13
13
  static styles = [
14
14
  loadingStyles,
15
15
  css`
@@ -130,13 +130,14 @@ export class DileCrudList extends DileLoading(LitElement) {
130
130
  pageSize=${this.pageSize}
131
131
  numItems=${this.numItems}
132
132
  ?disablePagination=${this.config.customization?.disablePagination}
133
+ language="${this.language}"
133
134
  ></dile-crud-select-all>
134
135
  `
135
136
  }
136
137
  <span>
137
138
  ${this.numItems != undefined
138
139
  ? html`
139
- ${this.numItems} items in total. ${this.config.customization?.disablePagination ? '' : html`Showing ${this.pageSize} items per page.` }
140
+ ${this.numItems} ${this.translations.items_total}. ${this.config.customization?.disablePagination ? '' : this.translations.showing_page_size(this.pageSize) }
140
141
  `
141
142
  : 'Loading...'
142
143
  }
@@ -157,6 +158,7 @@ export class DileCrudList extends DileLoading(LitElement) {
157
158
  belongsTo=${this.belongsTo}
158
159
  relationId=${this.relationId}
159
160
  @crud-list-get-success=${this.getSuccess}
161
+ language="${this.language}"
160
162
  ></dile-crud-list-service>
161
163
  <dile-ajax
162
164
  id="ajaxgetallids"
@@ -164,18 +166,24 @@ export class DileCrudList extends DileLoading(LitElement) {
164
166
  url="${this.allIdsUrl}"
165
167
  @ajax-success="${this.doSuccessGetIds}"
166
168
  @ajax-error="${this.doErrorGet}"
169
+ language="${this.language}"
167
170
  ></dile-ajax>
168
171
  `;
169
172
  }
170
173
  get emptyTemplate() {
171
174
  return html`
172
175
  <div class="empty">
173
- <p>There are no items yet</p>
176
+ <p>${this.translations.empty_list}</p>
174
177
  ${this.config.customization.disableInsert || this.config.customization?.hideEmptyInsertButton
175
178
  ? ''
176
- : html`<p><dile-button @click=${this.dispatchInsertRequest}>${this.config.labels.insertAction}</dile-button></p>`
179
+ : html`
180
+ <p>
181
+ <dile-button @click=${this.dispatchInsertRequest}>
182
+ ${this.config.labels.insertAction}
183
+ </dile-button>
184
+ </p>
185
+ `
177
186
  }
178
-
179
187
  </div>
180
188
  `;
181
189
  }
@@ -220,6 +228,7 @@ export class DileCrudList extends DileLoading(LitElement) {
220
228
  pageSize="${this.pageSize}"
221
229
  @crud-pagination-prev=${this.goPrev}
222
230
  @crud-pagination-next=${this.goNext}
231
+ language="${this.language}"
223
232
  ></dile-crud-list-pagination-links>
224
233
  `
225
234
  }
@@ -1,7 +1,8 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import '../../ui/crud-pagination-nav-button';
3
+ import { DileI18nMixin } from '../../../lib/DileI18nMixin.js';
3
4
 
4
- export class DileCrudListPaginationLinks extends LitElement {
5
+ export class DileCrudListPaginationLinks extends DileI18nMixin(LitElement) {
5
6
  static styles = [
6
7
  css`
7
8
  :host {
@@ -52,7 +53,7 @@ export class DileCrudListPaginationLinks extends LitElement {
52
53
  ></dile-crud-pagination-nav-button>
53
54
  </span>
54
55
  <span class="pagination-summary">
55
- Página ${this.paginationData.currentPage} de ${this.numPages(this.numItems, this.pageSize)}
56
+ ${this.translations.current_page(this.paginationData.currentPage, this.numPages(this.numItems, this.pageSize))}
56
57
  </span>
57
58
  <span class="pagination-next">
58
59
  <dile-crud-pagination-nav-button
@@ -66,7 +67,7 @@ export class DileCrudListPaginationLinks extends LitElement {
66
67
  } else {
67
68
  return html`
68
69
  <div class="pagination-summary-one-page">
69
- Page 1 of 1
70
+ ${this.translations.one_page}
70
71
  </div>
71
72
  `;
72
73
  }
@@ -1,6 +1,7 @@
1
1
  import { LitElement, html, css } from 'lit';
2
+ import { DileI18nMixin } from '../../../lib/DileI18nMixin.js';
2
3
 
3
- export class DileCrudListService extends LitElement {
4
+ export class DileCrudListService extends DileI18nMixin(LitElement) {
4
5
  static styles = [
5
6
  css`
6
7
  :host {
@@ -44,6 +45,7 @@ export class DileCrudListService extends LitElement {
44
45
  url="${this.cleanUrl}"
45
46
  @ajax-success="${this.doSuccessGet}"
46
47
  @ajax-error="${this.doErrorGet}"
48
+ language="${this.language}"
47
49
  ></dile-ajax>
48
50
  `;
49
51
  }
@@ -3,8 +3,9 @@ import '@dile/ui/components/button/button-icon.js';
3
3
  import { checkboxBlankIcon, arrowDropDownIcon, checkboxCheckedIcon } from '@dile/icons';
4
4
  import '@dile/ui/components/icon/icon.js';
5
5
  import '@dile/ui/components/menu-overlay/menu-overlay.js';
6
+ import { DileI18nMixin } from '../../../lib/DileI18nMixin.js';
6
7
 
7
- export class DileCrudSelectAll extends LitElement {
8
+ export class DileCrudSelectAll extends DileI18nMixin(LitElement) {
8
9
 
9
10
  static get styles() {
10
11
  return css`
@@ -19,6 +20,13 @@ export class DileCrudSelectAll extends LitElement {
19
20
  display: flex;
20
21
  align-items: center;
21
22
  }
23
+
24
+ dile-button-icon div {
25
+ max-width: 130px;
26
+ white-space: nowrap;
27
+ text-overflow: ellipsis;
28
+ overflow: hidden;
29
+ }
22
30
  dile-button-icon div {
23
31
  margin-right: 0.5rem;
24
32
  display: inline-block;
@@ -75,8 +83,8 @@ export class DileCrudSelectAll extends LitElement {
75
83
  render() {
76
84
  return html`
77
85
  <dile-menu-overlay>
78
- <dile-button-icon small .icon="${this.selectIcon(this.mainChecked)}" slot="trigger">
79
- <div>Select <span class="desk">all</span></div>
86
+ <dile-button-icon no-wrap small .icon="${this.selectIcon(this.mainChecked)}" slot="trigger">
87
+ <div>${this.translations.select} <span class="desk">${this.translations.all}</span></div>
80
88
  <dile-icon .icon=${arrowDropDownIcon} class="drop"></dile-icon>
81
89
  </dile-button-icon>
82
90
  <div slot="content" class="content">
@@ -86,7 +94,7 @@ export class DileCrudSelectAll extends LitElement {
86
94
  <p class="option" @click=${this.checkPageItems}>
87
95
  <dile-icon .icon=${this.selectIcon(this.pageChecked)} class="drop"></dile-icon>
88
96
  <span>
89
- Todos de esta página
97
+ ${this.translations.all_in_page}
90
98
  (${this.pageSize > this.numItems ? this.numItems : this.pageSize})
91
99
  </span>
92
100
  </p>
@@ -95,7 +103,7 @@ export class DileCrudSelectAll extends LitElement {
95
103
  <p class="option" @click=${this.checkAllItems}>
96
104
  <dile-icon .icon=${this.selectIcon(this.allChecked)} class="drop"></dile-icon>
97
105
  <span>
98
- Seleccionar todos
106
+ ${this.translations.select_matching}
99
107
  (${this.numItems})
100
108
  </span>
101
109
  </p>
@@ -11,6 +11,12 @@ export const DileI18nMixin = (superclass) => class extends superclass {
11
11
  constructor() {
12
12
  super();
13
13
  this.language = 'en';
14
+ this.translations = {
15
+ success_operation: () => '',
16
+ error_operation: () => '',
17
+ showing_page_size: () => '',
18
+ current_page: () => '',
19
+ };
14
20
  }
15
21
 
16
22
  async connectedCallback() {
package/lib/i18n/en.js CHANGED
@@ -16,4 +16,13 @@ export const translations = {
16
16
  delete_label: "Delete",
17
17
  cancel_label: "Cancel",
18
18
  delete_confirm_message: "Are you sure you want to delete this item?",
19
+ items_total: "items in total",
20
+ showing_page_size: (pageSize) => `Showing ${pageSize} items per page.`,
21
+ empty_list: "There are no items yet",
22
+ one_page: "Page 1 of 1",
23
+ current_page: (page, numPages) => `Page ${page} of ${numPages}`,
24
+ select: "Select",
25
+ all: "all",
26
+ all_in_page: "All in this page",
27
+ select_matching: "Select all matching",
19
28
  };
package/lib/i18n/es.js CHANGED
@@ -16,4 +16,14 @@ export const translations = {
16
16
  delete_label: "Borrar",
17
17
  cancel_label: "Cancelar",
18
18
  delete_confirm_message: "¿Estás seguro que quieres borrar este ítem?",
19
+ items_total: "Elementos en total",
20
+ showing_page_size: (pageSize) => `Mostrando ${pageSize} elementos por página.`,
21
+ empty_list: "No tenemos elementos todavía",
22
+ one_page: "Página 1 de 1",
23
+ current_page: (page, numPages) => `Página ${page} de ${numPages}`,
24
+ select: "Seleccionar",
25
+ all: "todos",
26
+ all_in_page: "Todos de esta página",
27
+ select_matching: "Seleccionar coincidentes",
28
+
19
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/crud",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
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.16",
27
+ "@dile/ui": "^2.1.17",
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": "817f5102c42848615896580e968fc42d8ee21d66"
34
+ "gitHead": "15a59318f4be16facc3e442c13709fc0c543b57b"
35
35
  }