@dile/crud 0.0.54 → 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.
|
@@ -32,6 +32,23 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
|
|
|
32
32
|
--dile-button-hover-text-color: var(--dile-ajax-form-cancel-button-hover-text-color, #303030);
|
|
33
33
|
--dile-button-hover-border-color: var(--dile-ajax-form-cancel-button-hover-border-color, #303030);
|
|
34
34
|
}
|
|
35
|
+
:host([inline]) section {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: var(--inline-gap, 1rem);
|
|
39
|
+
}
|
|
40
|
+
:host([inline]) dile-inline-feedback {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
:host([hidefeedback]) dile-inline-feedback {
|
|
44
|
+
display: none;
|
|
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
|
+
}
|
|
35
52
|
`
|
|
36
53
|
];
|
|
37
54
|
|
|
@@ -50,6 +67,9 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
|
|
|
50
67
|
responseAdapter: { type: Object },
|
|
51
68
|
sendDataAsFormData: { type: Boolean },
|
|
52
69
|
showCancelButton: { type: Boolean },
|
|
70
|
+
inline: { type: Boolean, reflect: true },
|
|
71
|
+
actionIcon: { type: Object },
|
|
72
|
+
cancelIcon: { type: Object },
|
|
53
73
|
};
|
|
54
74
|
}
|
|
55
75
|
|
|
@@ -97,13 +117,30 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
|
|
|
97
117
|
render() {
|
|
98
118
|
return html`
|
|
99
119
|
${this.ajaxComponents}
|
|
100
|
-
<
|
|
120
|
+
<section>
|
|
121
|
+
<slot></slot>
|
|
122
|
+
${this.inline ? this.actionsTemplate : ''}
|
|
123
|
+
</section>
|
|
101
124
|
<dile-inline-feedback id="feedback"></dile-inline-feedback>
|
|
125
|
+
${this.inline ? '' : this.actionsTemplate}
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get actionsTemplate() {
|
|
130
|
+
return html`
|
|
102
131
|
<div class="actions">
|
|
103
|
-
|
|
104
|
-
|
|
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
|
+
}
|
|
105
142
|
</div>
|
|
106
|
-
|
|
143
|
+
`
|
|
107
144
|
}
|
|
108
145
|
|
|
109
146
|
get ajaxComponents() {
|
|
@@ -136,7 +173,8 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
|
|
|
136
173
|
}
|
|
137
174
|
}
|
|
138
175
|
|
|
139
|
-
doAction() {
|
|
176
|
+
doAction(e) {
|
|
177
|
+
e.preventDefault();
|
|
140
178
|
this.feedback.clear();
|
|
141
179
|
this.ajaxsave.data = this.form.getData();
|
|
142
180
|
this.ajaxsave.generateRequest();
|
|
@@ -254,7 +292,8 @@ export class DileAjaxForm extends DileI18nMixin(LitElement) {
|
|
|
254
292
|
return this.translations.error_operation(this.operation);
|
|
255
293
|
}
|
|
256
294
|
|
|
257
|
-
doCancel() {
|
|
295
|
+
doCancel(e) {
|
|
296
|
+
e.preventDefault();
|
|
258
297
|
this.dispatchEvent(new CustomEvent('form-canceled', {
|
|
259
298
|
bubbles: true,
|
|
260
299
|
composed: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/crud",
|
|
3
|
-
"version": "0.0.
|
|
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": {
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://dile-components.polydile.com/",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dile/ui": "^2.1.
|
|
27
|
+
"@dile/ui": "^2.1.30",
|
|
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": "
|
|
34
|
+
"gitHead": "995e1cef5db80dad3e967d4a88b26d19ae37d5cc"
|
|
35
35
|
}
|