@emuanalytics/flow-rdf-ui 4.1.8 → 4.1.9
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/dist/components/range/range.component.mjs +36 -27
- package/dist/components/range/range.styles.mjs +4 -0
- package/dist/custom-elements.json +496 -464
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/package.json.mjs +1 -1
- package/dist/vscode.html-custom-data.json +74 -74
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import { boolean } from '../../internal/boolean.mjs';
|
|
|
7
7
|
import { defaultValue } from '../../internal/default-value.mjs';
|
|
8
8
|
import { FlowRdfFormControl } from '../../internal/flow-ui-rdf-element.mjs';
|
|
9
9
|
import { FormControlController } from '../../internal/form.mjs';
|
|
10
|
+
import { clamp } from '../../internal/math.mjs';
|
|
10
11
|
import { HasSlotController } from '../../internal/slot.mjs';
|
|
11
12
|
import { isNumber } from '../../internal/type-checks.mjs';
|
|
12
13
|
import { watch } from '../../internal/watch.mjs';
|
|
@@ -78,13 +79,15 @@ class FlowUiRange extends FlowRdfFormControl {
|
|
|
78
79
|
super.disconnectedCallback();
|
|
79
80
|
this.resizeObserver.unobserve(this.input);
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
+
handleRangeChange(event) {
|
|
83
|
+
event.stopPropagation();
|
|
82
84
|
this.emit("flow-ui-change");
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
handleRangeInput(event) {
|
|
87
|
+
event.stopPropagation();
|
|
85
88
|
this.value = parseFloat(this.input.value);
|
|
86
|
-
this.emit("flow-ui-input");
|
|
87
89
|
this.syncRange();
|
|
90
|
+
this.emit("flow-ui-input");
|
|
88
91
|
}
|
|
89
92
|
/*
|
|
90
93
|
Handler for flow-ui-input & flow-ui-change events from number input.
|
|
@@ -97,11 +100,13 @@ class FlowUiRange extends FlowRdfFormControl {
|
|
|
97
100
|
this.syncRange();
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
|
-
handleBlur() {
|
|
103
|
+
handleBlur(event) {
|
|
104
|
+
event.stopPropagation();
|
|
101
105
|
this.hasFocus = false;
|
|
102
106
|
this.emit("flow-ui-blur");
|
|
103
107
|
}
|
|
104
|
-
handleFocus() {
|
|
108
|
+
handleFocus(event) {
|
|
109
|
+
event.stopPropagation();
|
|
105
110
|
this.hasFocus = true;
|
|
106
111
|
this.emit("flow-ui-focus");
|
|
107
112
|
}
|
|
@@ -114,8 +119,7 @@ class FlowUiRange extends FlowRdfFormControl {
|
|
|
114
119
|
}
|
|
115
120
|
handleValueChange() {
|
|
116
121
|
this.formControlController.updateValidity();
|
|
117
|
-
this.
|
|
118
|
-
this.value = parseFloat(this.input.value);
|
|
122
|
+
this.value = clamp(this.value, this.min, this.max);
|
|
119
123
|
this.syncRange();
|
|
120
124
|
}
|
|
121
125
|
handleDisabledChange() {
|
|
@@ -126,7 +130,7 @@ class FlowUiRange extends FlowRdfFormControl {
|
|
|
126
130
|
const percent = Math.max(0, (this.value - this.min) / (this.max - this.min));
|
|
127
131
|
this.syncProgress(percent);
|
|
128
132
|
}
|
|
129
|
-
|
|
133
|
+
handleRangeInvalid(event) {
|
|
130
134
|
this.formControlController.setValidity(false);
|
|
131
135
|
this.formControlController.emitInvalidEvent(event);
|
|
132
136
|
}
|
|
@@ -240,30 +244,35 @@ class FlowUiRange extends FlowRdfFormControl {
|
|
|
240
244
|
step=${ifDefined(this.step)}
|
|
241
245
|
.value=${live(this.value.toString())}
|
|
242
246
|
aria-describedby="help-text"
|
|
243
|
-
@change=${this.
|
|
247
|
+
@change=${this.handleRangeChange}
|
|
244
248
|
@focus=${this.handleFocus}
|
|
245
|
-
@input=${this.
|
|
246
|
-
@invalid=${this.
|
|
249
|
+
@input=${this.handleRangeInput}
|
|
250
|
+
@invalid=${this.handleRangeInvalid}
|
|
247
251
|
@blur=${this.handleBlur}
|
|
248
252
|
/>
|
|
249
253
|
<slot name="suffix" part="suffix" class="range__suffix"></slot>
|
|
250
254
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
255
|
+
<flow-ui-input
|
|
256
|
+
class=${classMap({
|
|
257
|
+
"number-input": true,
|
|
258
|
+
"no-input": this.noInput
|
|
259
|
+
})}
|
|
260
|
+
type="number"
|
|
261
|
+
inline
|
|
262
|
+
filled
|
|
263
|
+
exportparts="form-control:number-input"
|
|
264
|
+
no-step-buttons
|
|
265
|
+
size=${this.size}
|
|
266
|
+
format=${this.format}
|
|
267
|
+
min=${ifDefined(this.min)}
|
|
268
|
+
max=${ifDefined(this.max)}
|
|
269
|
+
step=${ifDefined(this.step)}
|
|
270
|
+
?disabled=${this.disabled}
|
|
271
|
+
.value=${this.value.toString()}
|
|
272
|
+
@flow-ui-change=${this.handleNumberChange}
|
|
273
|
+
@flow-ui-focus=${this.handleFocus}
|
|
274
|
+
@flow-ui-blur=${this.handleBlur}
|
|
275
|
+
></flow-ui-input>
|
|
267
276
|
</div>
|
|
268
277
|
</div>
|
|
269
278
|
|