@dile/ui 2.3.1 → 2.4.0
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.
- package/components/checkbox/src/DileCheckbox.js +6 -0
- package/components/drop-file/src/DileDropFile.js +9 -1
- package/components/input/src/DileInput.js +16 -10
- package/components/input/src/DileInputInteger.js +1 -0
- package/components/input/src/DileInputMoney.js +1 -0
- package/components/input/src/DileInputNumberMask.js +1 -0
- package/components/input/src/DileInputPercentage.js +1 -0
- package/components/radio-group/src/DileRadioGroup.js +7 -0
- package/components/range/src/DileRange.js +45 -3
- package/components/select/src/DileSelect.js +6 -0
- package/components/select/src/DileSelectAjax.js +7 -2
- package/components/textarea/src/DileTextarea.js +11 -1
- package/package.json +2 -2
|
@@ -11,10 +11,15 @@ export class DileCheckbox extends DileEmmitChange(LitElement) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
static get formAssociated() {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
constructor() {
|
|
15
19
|
super();
|
|
16
20
|
this.checked = false;
|
|
17
21
|
this.name = '';
|
|
22
|
+
this.internals = this.attachInternals();
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
static get styles() {
|
|
@@ -85,6 +90,7 @@ export class DileCheckbox extends DileEmmitChange(LitElement) {
|
|
|
85
90
|
updated(changedProperties) {
|
|
86
91
|
if (changedProperties.has("checked")) {
|
|
87
92
|
this.emmitChange();
|
|
93
|
+
this.internals.setFormValue(this.checked ? 'true' : null);
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
|
|
@@ -64,9 +64,14 @@ export class DileDropFile extends DileEmmitChange(LitElement) {
|
|
|
64
64
|
fileName: { type: String },
|
|
65
65
|
selectedFileLabel: { type: String },
|
|
66
66
|
allowedExtensions: { type: Array },
|
|
67
|
-
extensionErrorMessage: { type: String},
|
|
67
|
+
extensionErrorMessage: { type: String },
|
|
68
|
+
name: { type: String },
|
|
68
69
|
};
|
|
69
70
|
}
|
|
71
|
+
|
|
72
|
+
static get formAssociated() {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
70
75
|
|
|
71
76
|
constructor() {
|
|
72
77
|
super();
|
|
@@ -78,6 +83,7 @@ export class DileDropFile extends DileEmmitChange(LitElement) {
|
|
|
78
83
|
this.selectedFileLabel = "Selected file";
|
|
79
84
|
this.extensionErrorMessage = "Only this file extensions are allowed: "
|
|
80
85
|
this.allowedExtensions = [];
|
|
86
|
+
this.internals = this.attachInternals();
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
firstUpdated() {
|
|
@@ -161,6 +167,7 @@ export class DileDropFile extends DileEmmitChange(LitElement) {
|
|
|
161
167
|
}
|
|
162
168
|
|
|
163
169
|
_processFile(files) {
|
|
170
|
+
this.internals.setFormValue(files.length > 0 ? files[0] : null);
|
|
164
171
|
if (files.length > 0) {
|
|
165
172
|
this.fileName = files[0].name;
|
|
166
173
|
this.emmitChange();
|
|
@@ -206,6 +213,7 @@ export class DileDropFile extends DileEmmitChange(LitElement) {
|
|
|
206
213
|
clear() {
|
|
207
214
|
this.fileInput.value = "";
|
|
208
215
|
this.fileName = "";
|
|
216
|
+
this.internals.setFormValue(null);
|
|
209
217
|
this.emmitChange();
|
|
210
218
|
}
|
|
211
219
|
|
|
@@ -62,16 +62,8 @@ export class DileInput extends DileEmmitChange(LitElement) {
|
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
this.focus();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
updated(changedProperties) {
|
|
72
|
-
if(changedProperties.has('value')) {
|
|
73
|
-
this.emmitChange();
|
|
74
|
-
}
|
|
65
|
+
static get formAssociated() {
|
|
66
|
+
return true;
|
|
75
67
|
}
|
|
76
68
|
|
|
77
69
|
constructor() {
|
|
@@ -85,6 +77,20 @@ export class DileInput extends DileEmmitChange(LitElement) {
|
|
|
85
77
|
this.name = '';
|
|
86
78
|
this.type = 'text';
|
|
87
79
|
this.types = ['text', 'password', 'email', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime', 'datetime-local', 'month', 'week'];
|
|
80
|
+
this.internals = this.attachInternals();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
firstUpdated() {
|
|
84
|
+
if(this.focusOnStart) {
|
|
85
|
+
this.focus();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
updated(changedProperties) {
|
|
90
|
+
if(changedProperties.has('value')) {
|
|
91
|
+
this.emmitChange();
|
|
92
|
+
this.internals.setFormValue(this.value);
|
|
93
|
+
}
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
static get styles() {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
|
+
import '../radio.js';
|
|
3
4
|
|
|
4
5
|
export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
5
6
|
static styles = [
|
|
@@ -21,6 +22,10 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
21
22
|
`
|
|
22
23
|
];
|
|
23
24
|
|
|
25
|
+
static get formAssociated() {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
24
29
|
static get properties() {
|
|
25
30
|
return {
|
|
26
31
|
label: { type: String },
|
|
@@ -37,6 +42,7 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
37
42
|
super();
|
|
38
43
|
this.init = false;
|
|
39
44
|
this.disabled = false;
|
|
45
|
+
this.internals = this.attachInternals();
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
updated(changedProperties) {
|
|
@@ -44,6 +50,7 @@ export class DileRadioGroup extends DileEmmitChange(LitElement) {
|
|
|
44
50
|
this.doSelection(this.value);
|
|
45
51
|
this.emmitChange();
|
|
46
52
|
this.dispatchChangeEvent();
|
|
53
|
+
this.internals.setFormValue(this.value);
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
|
+
import '../../input/input-message.js';
|
|
3
4
|
|
|
4
5
|
export class DileRange extends DileEmmitChange(LitElement) {
|
|
5
6
|
|
|
@@ -7,6 +8,19 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
7
8
|
return css`
|
|
8
9
|
:host {
|
|
9
10
|
display: block;
|
|
11
|
+
margin-bottom: 10px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([errored]) {
|
|
15
|
+
--dile-range-line-color: var(--dile-range-line-errored-color, #c00);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
label {
|
|
19
|
+
display: block;
|
|
20
|
+
margin-bottom: var(--dile-input-label-margin-bottom, 4px);
|
|
21
|
+
font-size: var(--dile-input-label-font-size, 1em);
|
|
22
|
+
color: var(--dile-input-label-color, #59e);
|
|
23
|
+
font-weight: var(--dile-input-label-font-weight, normal);
|
|
10
24
|
}
|
|
11
25
|
|
|
12
26
|
/*********** Baseline, reset styles ***********/
|
|
@@ -24,10 +38,12 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
24
38
|
outline: none;
|
|
25
39
|
}
|
|
26
40
|
|
|
41
|
+
|
|
42
|
+
|
|
27
43
|
/******** Chrome, Safari, Opera and Edge Chromium styles ********/
|
|
28
44
|
/* slider track */
|
|
29
45
|
input[type="range"]::-webkit-slider-runnable-track {
|
|
30
|
-
background-color: var(--dile-range-line-color, #7BB93D);
|
|
46
|
+
background-color: var(--dile-range-line-color, var(--dile-primary-color, #7BB93D));
|
|
31
47
|
border-radius: 0.5rem;
|
|
32
48
|
height: var(--dile-range-line-height, 0.5rem);
|
|
33
49
|
}
|
|
@@ -51,7 +67,7 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
51
67
|
/*********** Firefox styles ***********/
|
|
52
68
|
/* slider track */
|
|
53
69
|
input[type="range"]::-moz-range-track {
|
|
54
|
-
background-color: var(--dile-range-line-color, #7BB93D);
|
|
70
|
+
background-color: var(--dile-range-line-color, var(--dile-primary-color, #7BB93D));
|
|
55
71
|
border-radius: 0.5rem;
|
|
56
72
|
height: var(--dile-range-line-height, 0.5rem);
|
|
57
73
|
}
|
|
@@ -69,9 +85,15 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
69
85
|
outline: 3px solid var(--dile-range-thumb-color, #303030);
|
|
70
86
|
outline-offset: 0.125rem;
|
|
71
87
|
}
|
|
88
|
+
|
|
89
|
+
|
|
72
90
|
`;
|
|
73
91
|
}
|
|
74
92
|
|
|
93
|
+
static get formAssociated() {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
75
97
|
static get properties() {
|
|
76
98
|
return {
|
|
77
99
|
max: { type: Number },
|
|
@@ -79,6 +101,10 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
79
101
|
step: { type: Number },
|
|
80
102
|
value: { type: Number },
|
|
81
103
|
name: { type: String },
|
|
104
|
+
label: { type: String },
|
|
105
|
+
message: { type: String },
|
|
106
|
+
errored: { type: Boolean, reflect: true },
|
|
107
|
+
hideErrorOnInput: { type: Boolean },
|
|
82
108
|
};
|
|
83
109
|
}
|
|
84
110
|
|
|
@@ -89,13 +115,19 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
89
115
|
this.min = 0;
|
|
90
116
|
this.step = 1;
|
|
91
117
|
this.value = 1;
|
|
118
|
+
this.message = ""
|
|
119
|
+
this.internals = this.attachInternals();
|
|
92
120
|
}
|
|
93
121
|
|
|
94
122
|
render() {
|
|
95
123
|
return html`
|
|
124
|
+
${this.label
|
|
125
|
+
? html`<label for="inputrange">${this.label}</label>`
|
|
126
|
+
: ""
|
|
127
|
+
}
|
|
96
128
|
<input
|
|
97
129
|
type="range"
|
|
98
|
-
id="
|
|
130
|
+
id="inputrange"
|
|
99
131
|
name="${this.name}"
|
|
100
132
|
min="${this.min}"
|
|
101
133
|
max="${this.max}"
|
|
@@ -103,17 +135,27 @@ export class DileRange extends DileEmmitChange(LitElement) {
|
|
|
103
135
|
value="${this.value}"
|
|
104
136
|
@input="${this.rangeChanged}"
|
|
105
137
|
>
|
|
138
|
+
<dile-input-message ?errored="${this.errored}" message="${this.message}"></dile-input-message>
|
|
106
139
|
`;
|
|
107
140
|
}
|
|
108
141
|
|
|
109
142
|
rangeChanged(e) {
|
|
110
143
|
this.value = e.target.value;
|
|
144
|
+
if (this.hideErrorOnInput && this.errored) {
|
|
145
|
+
this.clearError();
|
|
146
|
+
}
|
|
111
147
|
}
|
|
112
148
|
|
|
113
149
|
updated(changedProperties) {
|
|
114
150
|
if (changedProperties.has('value')) {
|
|
115
151
|
this.emmitChange();
|
|
152
|
+
this.internals.setFormValue(this.value);
|
|
116
153
|
}
|
|
117
154
|
}
|
|
118
155
|
|
|
156
|
+
clearError() {
|
|
157
|
+
this.errored = false;
|
|
158
|
+
this.message = '';
|
|
159
|
+
}
|
|
160
|
+
|
|
119
161
|
}
|
|
@@ -56,6 +56,10 @@ export class DileSelect extends DileEmmitChange(LitElement) {
|
|
|
56
56
|
`];
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
static get formAssociated() {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
static get properties() {
|
|
60
64
|
return {
|
|
61
65
|
label: { type: String },
|
|
@@ -95,6 +99,7 @@ export class DileSelect extends DileEmmitChange(LitElement) {
|
|
|
95
99
|
this.hideErrorOnInput = false;
|
|
96
100
|
this.changeHandler = this.onChange.bind(this);
|
|
97
101
|
this.quiet = false;
|
|
102
|
+
this.internals = this.attachInternals();
|
|
98
103
|
}
|
|
99
104
|
|
|
100
105
|
|
|
@@ -131,6 +136,7 @@ export class DileSelect extends DileEmmitChange(LitElement) {
|
|
|
131
136
|
} else {
|
|
132
137
|
this.emmitChange();
|
|
133
138
|
}
|
|
139
|
+
this.internals.setFormValue(this.value);
|
|
134
140
|
}
|
|
135
141
|
if(changedProperties.has("disabled")) {
|
|
136
142
|
this.elselect.disabled = this.disabled;
|
|
@@ -57,6 +57,10 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
57
57
|
`];
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
static get formAssociated() {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
static get properties() {
|
|
61
65
|
return {
|
|
62
66
|
/* Allows to set a text for the default option, that is a empty option and do not selects nothing in the interface. */
|
|
@@ -109,6 +113,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
109
113
|
updated(changedProperties) {
|
|
110
114
|
if(changedProperties.has("value")) {
|
|
111
115
|
this.emmitChange();
|
|
116
|
+
this.internals.setFormValue(this.value);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
|
|
@@ -129,6 +134,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
129
134
|
this.queryStringVariable = 'q';
|
|
130
135
|
this.delay = 300;
|
|
131
136
|
this.idProperty = 'id';
|
|
137
|
+
this.internals = this.attachInternals();
|
|
132
138
|
}
|
|
133
139
|
|
|
134
140
|
connectedCallback() {
|
|
@@ -159,8 +165,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
|
|
|
159
165
|
}
|
|
160
166
|
|
|
161
167
|
registerText(json) {
|
|
162
|
-
|
|
163
|
-
this.selectedText = json[this.displayProperty];
|
|
168
|
+
this.selectedText = json[this.resultDataProperty][this.displayProperty];
|
|
164
169
|
this.loading = false;
|
|
165
170
|
}
|
|
166
171
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { messageStyles } from '../../input/index.js';
|
|
3
|
+
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
4
|
|
|
4
|
-
export class DileTextarea extends LitElement {
|
|
5
|
+
export class DileTextarea extends DileEmmitChange(LitElement) {
|
|
5
6
|
|
|
6
7
|
static get styles() {
|
|
7
8
|
return [
|
|
@@ -50,6 +51,10 @@ export class DileTextarea extends LitElement {
|
|
|
50
51
|
`];
|
|
51
52
|
}
|
|
52
53
|
|
|
54
|
+
static get formAssociated() {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
|
|
53
58
|
static get properties() {
|
|
54
59
|
return {
|
|
55
60
|
name: { type: String },
|
|
@@ -80,6 +85,7 @@ export class DileTextarea extends LitElement {
|
|
|
80
85
|
this.rows = 3;
|
|
81
86
|
this.maxRows = 10;
|
|
82
87
|
this._maxHeight = 100;
|
|
88
|
+
this.internals = this.attachInternals();
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
firstUpdated() {
|
|
@@ -96,6 +102,10 @@ export class DileTextarea extends LitElement {
|
|
|
96
102
|
if(changedProperties.has('maxRows')) {
|
|
97
103
|
this.calculateMaxHeight();
|
|
98
104
|
}
|
|
105
|
+
if(changedProperties.has("value")) {
|
|
106
|
+
this.emmitChange();
|
|
107
|
+
this.internals.setFormValue(this.value);
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
render() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dile/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "UI Core components from dile-components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "9514bd93f87c3237a41056fb6bb59025088f230e"
|
|
30
30
|
}
|