@wikicasa-dev/components 2.0.18 → 2.0.19
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/BaseSlider.js +118 -119
- package/dist/UIKit/BaseSlider.vue.d.ts +13 -11
- package/dist/assets/BaseSlider.css +1 -1
- package/package.json +1 -1
package/dist/BaseSlider.js
CHANGED
|
@@ -1,209 +1,208 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { _ as
|
|
4
|
-
import './assets/BaseSlider.css';const
|
|
1
|
+
import { defineComponent as R, mergeModels as j, useModel as D, ref as p, useTemplateRef as T, useAttrs as q, onMounted as G, openBlock as H, createElementBlock as J, createElementVNode as x, withModifiers as _, unref as h, createVNode as k } from "vue";
|
|
2
|
+
import C from "./BaseInput.js";
|
|
3
|
+
import { _ as K } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
|
|
4
|
+
import './assets/BaseSlider.css';const O = { class: "range_container" }, Q = { class: "sliders_control" }, W = ["value", "min", "max", "step"], X = ["value", "min", "max", "step"], Y = { class: "form_control row" }, Z = { class: "pb-15 pb-sm-0 col-sm-6 col-xl-4" }, ee = { class: "col-sm-6 col-xl-4" }, le = /* @__PURE__ */ R({
|
|
5
5
|
__name: "BaseSlider",
|
|
6
|
-
props: {
|
|
6
|
+
props: /* @__PURE__ */ j({
|
|
7
7
|
type: { default: "linear" },
|
|
8
8
|
min: { default: 0 },
|
|
9
9
|
max: { default: 100 }
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
}, {
|
|
11
|
+
minValue: { default: 0 },
|
|
12
|
+
minValueModifiers: {},
|
|
13
|
+
maxValue: { default: 0 },
|
|
14
|
+
maxValueModifiers: {}
|
|
15
|
+
}),
|
|
16
|
+
emits: ["update:minValue", "update:maxValue"],
|
|
17
|
+
setup(m) {
|
|
18
|
+
function M(e, l) {
|
|
19
|
+
const a = parseInt(e.value, 10), t = parseInt(l.value, 10);
|
|
20
|
+
return [a, t];
|
|
16
21
|
}
|
|
17
|
-
const
|
|
22
|
+
const E = (e) => e.minPos + (Math.log(e.value) - e.minlval) / e.scale, L = (e) => Math.exp(
|
|
18
23
|
(e.position - e.minPos) * e.scale + e.minlval
|
|
19
24
|
);
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
|
|
25
|
+
function V(e, l, a, t, v) {
|
|
26
|
+
const i = l.max - l.min, f = e - l.min, $ = l.value - l.min;
|
|
27
|
+
v.style.background = `linear-gradient(
|
|
23
28
|
to right,
|
|
24
|
-
${
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
29
|
-
${
|
|
29
|
+
${a} 0%,
|
|
30
|
+
${a} ${f / i * 100}%,
|
|
31
|
+
${t} ${f / i * 100}%,
|
|
32
|
+
${t} ${$ / i * 100}%,
|
|
33
|
+
${a} ${$ / i * 100}%,
|
|
34
|
+
${a} 100%)`;
|
|
30
35
|
}
|
|
31
|
-
function
|
|
32
|
-
e <= 0 ?
|
|
36
|
+
function y(e, l) {
|
|
37
|
+
e <= 0 ? l.style.zIndex = "2" : l.style.zIndex = "0";
|
|
33
38
|
}
|
|
34
|
-
const
|
|
35
|
-
if (!g.value || !
|
|
36
|
-
|
|
37
|
-
const
|
|
39
|
+
const r = D(m, "minValue"), o = D(m, "maxValue"), n = p(0), u = p(100), c = p(10), d = p(40), F = p(0), P = p(0), B = p(0), g = T("fromSlider"), s = T("toSlider"), S = (e, l) => {
|
|
40
|
+
if (!g.value || !s.value) return;
|
|
41
|
+
l || (l = "0");
|
|
42
|
+
const a = parseInt(l, 10);
|
|
38
43
|
if (e == "min-input") {
|
|
39
|
-
if (
|
|
40
|
-
|
|
44
|
+
if (a >= o.value) return;
|
|
45
|
+
r.value = a, z(s.value, a, o.value);
|
|
41
46
|
return;
|
|
42
47
|
}
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
if (
|
|
48
|
+
a < r.value || (o.value = a, A(s.value, s.value, r.value, a));
|
|
49
|
+
}, I = (e) => {
|
|
50
|
+
if (m.type === "logarithmic")
|
|
46
51
|
return e = e || 1, parseInt(
|
|
47
|
-
|
|
52
|
+
E({
|
|
48
53
|
value: e,
|
|
49
54
|
minPos: n.value,
|
|
50
|
-
minlval:
|
|
51
|
-
scale:
|
|
55
|
+
minlval: F.value,
|
|
56
|
+
scale: B.value
|
|
52
57
|
}).toFixed(0),
|
|
53
58
|
10
|
|
54
59
|
);
|
|
55
|
-
if (
|
|
60
|
+
if (m.type === "linear")
|
|
56
61
|
return e;
|
|
57
62
|
throw new Error("The slider type has not been implemented");
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
63
|
+
}, b = (e) => {
|
|
64
|
+
if (m.type === "logarithmic")
|
|
60
65
|
return e = e || 1, parseInt(
|
|
61
|
-
|
|
66
|
+
L({
|
|
62
67
|
position: e,
|
|
63
|
-
scale:
|
|
64
|
-
minlval:
|
|
68
|
+
scale: B.value,
|
|
69
|
+
minlval: F.value,
|
|
65
70
|
minPos: n.value
|
|
66
71
|
}).toFixed(0),
|
|
67
72
|
10
|
|
68
73
|
);
|
|
69
|
-
if (
|
|
74
|
+
if (m.type === "linear")
|
|
70
75
|
return e;
|
|
71
76
|
throw new Error("The slider type has not been implemented");
|
|
72
|
-
},
|
|
73
|
-
const t =
|
|
74
|
-
|
|
77
|
+
}, z = (e, l, a) => {
|
|
78
|
+
const t = I(l), v = I(a);
|
|
79
|
+
V(
|
|
75
80
|
t,
|
|
76
81
|
{
|
|
77
82
|
min: n.value,
|
|
78
|
-
max:
|
|
79
|
-
value:
|
|
83
|
+
max: u.value,
|
|
84
|
+
value: v
|
|
80
85
|
},
|
|
81
86
|
"#B4C2F0",
|
|
82
87
|
"#2B5DFF",
|
|
83
88
|
e
|
|
84
89
|
);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
const i = t, f = o.value;
|
|
91
|
+
i > f ? c.value = f : c.value = i;
|
|
92
|
+
}, A = (e, l, a, t) => {
|
|
93
|
+
const v = I(a), i = I(t);
|
|
94
|
+
V(
|
|
95
|
+
v,
|
|
91
96
|
{
|
|
92
97
|
min: n.value,
|
|
93
|
-
max:
|
|
94
|
-
value:
|
|
98
|
+
max: u.value,
|
|
99
|
+
value: i
|
|
95
100
|
},
|
|
96
101
|
"#B4C2F0",
|
|
97
102
|
"#2B5DFF",
|
|
98
|
-
|
|
103
|
+
l
|
|
99
104
|
);
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
},
|
|
103
|
-
if (!
|
|
104
|
-
const [
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
const f = r.value, $ = i;
|
|
106
|
+
y(o.value, e), f <= $ ? d.value = $ : d.value = f;
|
|
107
|
+
}, N = (e, l) => {
|
|
108
|
+
if (!l.value) return;
|
|
109
|
+
const [a, t] = M(e, l), v = b(a);
|
|
110
|
+
V(
|
|
111
|
+
a,
|
|
107
112
|
{
|
|
108
113
|
min: n.value,
|
|
109
|
-
max:
|
|
110
|
-
value:
|
|
114
|
+
max: u.value,
|
|
115
|
+
value: t
|
|
111
116
|
},
|
|
112
117
|
"#B4C2F0",
|
|
113
118
|
"#2B5DFF",
|
|
114
|
-
|
|
115
|
-
),
|
|
116
|
-
},
|
|
117
|
-
if (!
|
|
118
|
-
const [
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
l
|
|
120
|
+
), a > t ? (e.value = `${t}`, c.value = t, r.value = t) : (c.value = a, r.value = v);
|
|
121
|
+
}, U = (e, l) => {
|
|
122
|
+
if (!l.value) return;
|
|
123
|
+
const [a, t] = M(e, l), v = b(t);
|
|
124
|
+
V(
|
|
125
|
+
c.value,
|
|
121
126
|
{
|
|
122
127
|
min: n.value,
|
|
123
|
-
max:
|
|
124
|
-
value:
|
|
128
|
+
max: u.value,
|
|
129
|
+
value: t
|
|
125
130
|
},
|
|
126
131
|
"#B4C2F0",
|
|
127
132
|
"#2B5DFF",
|
|
128
|
-
|
|
129
|
-
),
|
|
130
|
-
};
|
|
131
|
-
D(s, (e) => {
|
|
132
|
-
V("minChanged", e);
|
|
133
|
-
}), D(u, (e) => {
|
|
134
|
-
V("maxChanged", e);
|
|
135
|
-
});
|
|
136
|
-
const _ = G();
|
|
133
|
+
l
|
|
134
|
+
), y(parseInt(l.value, 10), l), a <= t ? (d.value = t, o.value = v) : (l.value = `${a}`, d.value = a, o.value = a);
|
|
135
|
+
}, w = q();
|
|
137
136
|
return (() => {
|
|
138
|
-
n.value = parseInt(`${
|
|
139
|
-
})(),
|
|
140
|
-
!g.value || !
|
|
141
|
-
|
|
137
|
+
n.value = parseInt(`${m.min || 0}`, 10), u.value = parseInt(`${m.max || 100}`, 10), c.value = n.value, d.value = u.value, r.value = parseInt(`${w.minValue || n.value}`, 10), o.value = parseInt(`${w.maxValue || u.value}`, 10), F.value = Math.log(r.value || 1), P.value = Math.log(o.value), B.value = (P.value - F.value) / (u.value - n.value);
|
|
138
|
+
})(), G(() => {
|
|
139
|
+
!g.value || !s.value || (V(
|
|
140
|
+
c.value,
|
|
142
141
|
{
|
|
143
142
|
min: n.value,
|
|
144
|
-
max:
|
|
145
|
-
value:
|
|
143
|
+
max: u.value,
|
|
144
|
+
value: d.value
|
|
146
145
|
},
|
|
147
146
|
"#B4C2F0",
|
|
148
147
|
"#2B5DFF",
|
|
149
|
-
|
|
150
|
-
),
|
|
151
|
-
}), (e,
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
s.value
|
|
149
|
+
), y(d.value, s.value));
|
|
150
|
+
}), (e, l) => (H(), J("div", O, [
|
|
151
|
+
x("div", Q, [
|
|
152
|
+
x("input", {
|
|
154
153
|
ref_key: "fromSlider",
|
|
155
154
|
ref: g,
|
|
156
155
|
class: "fromSlider",
|
|
157
156
|
type: "range",
|
|
158
|
-
value:
|
|
157
|
+
value: c.value,
|
|
159
158
|
min: n.value,
|
|
160
|
-
max:
|
|
159
|
+
max: u.value,
|
|
161
160
|
step: e.$attrs.step,
|
|
162
|
-
onInput:
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
onInput: l[0] || (l[0] = _((a) => N(
|
|
162
|
+
h(g),
|
|
163
|
+
h(s)
|
|
165
164
|
), ["stop"]))
|
|
166
|
-
}, null, 40,
|
|
167
|
-
|
|
165
|
+
}, null, 40, W),
|
|
166
|
+
x("input", {
|
|
168
167
|
ref_key: "toSlider",
|
|
169
|
-
ref:
|
|
168
|
+
ref: s,
|
|
170
169
|
class: "toSlider",
|
|
171
170
|
type: "range",
|
|
172
|
-
value:
|
|
171
|
+
value: d.value,
|
|
173
172
|
min: n.value,
|
|
174
|
-
max:
|
|
173
|
+
max: u.value,
|
|
175
174
|
step: e.$attrs.step,
|
|
176
|
-
onInput:
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
onInput: l[1] || (l[1] = _((a) => U(
|
|
176
|
+
h(g),
|
|
177
|
+
h(s)
|
|
179
178
|
), ["stop"]))
|
|
180
|
-
}, null, 40,
|
|
179
|
+
}, null, 40, X)
|
|
181
180
|
]),
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
k(
|
|
181
|
+
x("div", Y, [
|
|
182
|
+
x("div", Z, [
|
|
183
|
+
k(C, {
|
|
185
184
|
"label-text": "Min",
|
|
186
185
|
type: "text",
|
|
187
186
|
pattern: "[0-9]*",
|
|
188
187
|
inputmode: "numeric",
|
|
189
|
-
"model-value":
|
|
190
|
-
"onUpdate:modelValue":
|
|
188
|
+
"model-value": r.value,
|
|
189
|
+
"onUpdate:modelValue": l[2] || (l[2] = (a) => S("min-input", `${a || ""}`))
|
|
191
190
|
}, null, 8, ["model-value"])
|
|
192
191
|
]),
|
|
193
|
-
|
|
194
|
-
k(
|
|
192
|
+
x("div", ee, [
|
|
193
|
+
k(C, {
|
|
195
194
|
"label-text": "Max",
|
|
196
195
|
type: "text",
|
|
197
196
|
pattern: "[0-9]*",
|
|
198
197
|
inputmode: "numeric",
|
|
199
|
-
"model-value":
|
|
200
|
-
"onUpdate:modelValue":
|
|
198
|
+
"model-value": o.value,
|
|
199
|
+
"onUpdate:modelValue": l[3] || (l[3] = (a) => S("max-input", `${a || ""}`))
|
|
201
200
|
}, null, 8, ["model-value"])
|
|
202
201
|
])
|
|
203
202
|
])
|
|
204
203
|
]));
|
|
205
204
|
}
|
|
206
|
-
}),
|
|
205
|
+
}), oe = /* @__PURE__ */ K(le, [["__scopeId", "data-v-581ec7f4"]]);
|
|
207
206
|
export {
|
|
208
|
-
|
|
207
|
+
oe as default
|
|
209
208
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
import { Optional } from '@wikicasa-dev/types';
|
|
2
|
+
declare let __VLS_typeProps: {
|
|
2
3
|
type?: "linear" | "logarithmic";
|
|
3
4
|
min?: number;
|
|
4
5
|
max?: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = {
|
|
8
|
+
"minValue"?: Optional<number>;
|
|
9
|
+
"maxValue"?: Optional<number>;
|
|
10
|
+
} & typeof __VLS_typeProps;
|
|
11
|
+
declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
12
|
+
"update:minValue": (minValue: Optional<number>) => any;
|
|
13
|
+
"update:maxValue": (maxValue: Optional<number>) => any;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:minValue"?: ((minValue: Optional<number>) => any) | undefined;
|
|
16
|
+
"onUpdate:maxValue"?: ((maxValue: Optional<number>) => any) | undefined;
|
|
15
17
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
16
18
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[data-v-
|
|
1
|
+
[data-v-581ec7f4] .form-control{max-width:none!important}.range_container[data-v-581ec7f4]{padding-top:15px}.sliders_control[data-v-581ec7f4]{position:relative;min-height:30px}.form_control[data-v-581ec7f4]{position:relative;display:flex;justify-content:space-between;font-size:24px;color:#635a5a}input[type=range][data-v-581ec7f4]{-webkit-appearance:none;-moz-appearance:none;appearance:none;height:3px;width:100%;position:absolute;background-color:#b4c2f0;pointer-events:none}input[type=range][data-v-581ec7f4]::-webkit-slider-thumb:hover{background:#f7f7f7}input[type=range][data-v-581ec7f4]::-webkit-slider-thumb:active{box-shadow:inset 0 0 3px #387bbe,0 0 9px #387bbe;-webkit-box-shadow:inset 0 0 3px #387bbe,0 0 9px #387bbe}input[type=range][data-v-581ec7f4]::-moz-range-thumb{-moz-appearance:none;appearance:none;pointer-events:all;width:24px;height:24px;background-color:#fff;border-radius:50%;box-shadow:0 0 0 1px #c6c6c6;cursor:pointer}input[type=range][data-v-581ec7f4]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;pointer-events:all;width:24px;height:24px;background-color:#fff;border:2px solid #2B5DFF;border-radius:50%;cursor:pointer}input[type=number][data-v-581ec7f4]{color:#8a8383;width:50px;height:30px;font-size:20px;border:none}input[type=number][data-v-581ec7f4]::-webkit-inner-spin-button,input[type=number][data-v-581ec7f4]::-webkit-outer-spin-button{opacity:1}.fromSlider[data-v-581ec7f4]{height:0!important;z-index:1}.toSlider[data-v-581ec7f4]{height:3px!important}
|