@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.
@@ -1,209 +1,208 @@
1
- import { defineComponent as q, ref as v, useTemplateRef as w, watch as D, useAttrs as G, onMounted as H, openBlock as J, createElementBlock as K, createElementVNode as p, withModifiers as T, unref as F, createVNode as k } from "vue";
2
- import E from "./BaseInput.js";
3
- import { _ as O } from "./chunks/_plugin-vue_export-helper.CHgC5LLL.js";
4
- import './assets/BaseSlider.css';const Q = { class: "range_container" }, W = { class: "sliders_control" }, X = ["value", "min", "max", "step"], Y = ["value", "min", "max", "step"], Z = { class: "form_control row" }, ee = { class: "pb-15 pb-sm-0 col-sm-6 col-xl-4" }, te = { class: "col-sm-6 col-xl-4" }, le = /* @__PURE__ */ q({
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
- emits: ["minChanged", "maxChanged"],
12
- setup(f, { emit: L }) {
13
- function B(e, t) {
14
- const l = parseInt(e.value, 10), a = parseInt(t.value, 10);
15
- return [l, a];
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 z = (e) => e.minPos + (Math.log(e.value) - e.minlval) / e.scale, A = (e) => Math.exp(
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 x(e, t, l, a, i) {
21
- const d = t.max - t.min, C = e - t.min, b = t.value - t.min;
22
- i.style.background = `linear-gradient(
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
- ${l} 0%,
25
- ${l} ${C / d * 100}%,
26
- ${a} ${C / d * 100}%,
27
- ${a} ${b / d * 100}%,
28
- ${l} ${b / d * 100}%,
29
- ${l} 100%)`;
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 I(e, t) {
32
- e <= 0 ? t.style.zIndex = "2" : t.style.zIndex = "0";
36
+ function y(e, l) {
37
+ e <= 0 ? l.style.zIndex = "2" : l.style.zIndex = "0";
33
38
  }
34
- const V = L, n = v(0), o = v(100), s = v(0), u = v(0), m = v(10), c = v(40), h = v(0), P = v(0), y = v(0), g = w("fromSlider"), r = w("toSlider"), M = (e, t) => {
35
- if (!g.value || !r.value) return;
36
- t || (t = "0");
37
- const l = parseInt(t, 10);
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 (l >= u.value) return;
40
- s.value = l, N(r.value);
44
+ if (a >= o.value) return;
45
+ r.value = a, z(s.value, a, o.value);
41
46
  return;
42
47
  }
43
- l < s.value || (u.value = l, U(r.value, r.value));
44
- }, $ = (e) => {
45
- if (f.type === "logarithmic")
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
- z({
52
+ E({
48
53
  value: e,
49
54
  minPos: n.value,
50
- minlval: h.value,
51
- scale: y.value
55
+ minlval: F.value,
56
+ scale: B.value
52
57
  }).toFixed(0),
53
58
  10
54
59
  );
55
- if (f.type === "linear")
60
+ if (m.type === "linear")
56
61
  return e;
57
62
  throw new Error("The slider type has not been implemented");
58
- }, S = (e) => {
59
- if (f.type === "logarithmic")
63
+ }, b = (e) => {
64
+ if (m.type === "logarithmic")
60
65
  return e = e || 1, parseInt(
61
- A({
66
+ L({
62
67
  position: e,
63
- scale: y.value,
64
- minlval: h.value,
68
+ scale: B.value,
69
+ minlval: F.value,
65
70
  minPos: n.value
66
71
  }).toFixed(0),
67
72
  10
68
73
  );
69
- if (f.type === "linear")
74
+ if (m.type === "linear")
70
75
  return e;
71
76
  throw new Error("The slider type has not been implemented");
72
- }, N = (e) => {
73
- const t = $(s.value), l = $(u.value);
74
- x(
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: o.value,
79
- value: l
83
+ max: u.value,
84
+ value: v
80
85
  },
81
86
  "#B4C2F0",
82
87
  "#2B5DFF",
83
88
  e
84
89
  );
85
- const a = t, i = u.value;
86
- a > i ? m.value = i : m.value = a;
87
- }, U = (e, t) => {
88
- const l = $(s.value), a = $(u.value);
89
- x(
90
- l,
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: o.value,
94
- value: a
98
+ max: u.value,
99
+ value: i
95
100
  },
96
101
  "#B4C2F0",
97
102
  "#2B5DFF",
98
- t
103
+ l
99
104
  );
100
- const i = s.value, d = a;
101
- I(u.value, e), i <= d ? c.value = d : c.value = i;
102
- }, R = (e, t) => {
103
- if (!t.value) return;
104
- const [l, a] = B(e, t), i = S(l);
105
- x(
106
- l,
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: o.value,
110
- value: a
114
+ max: u.value,
115
+ value: t
111
116
  },
112
117
  "#B4C2F0",
113
118
  "#2B5DFF",
114
- t
115
- ), l > a ? (e.value = `${a}`, m.value = a, s.value = a) : (m.value = l, s.value = i);
116
- }, j = (e, t) => {
117
- if (!t.value) return;
118
- const [l, a] = B(e, t), i = S(a);
119
- x(
120
- m.value,
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: o.value,
124
- value: a
128
+ max: u.value,
129
+ value: t
125
130
  },
126
131
  "#B4C2F0",
127
132
  "#2B5DFF",
128
- t
129
- ), I(parseInt(t.value, 10), t), l <= a ? (c.value = a, u.value = i) : (t.value = `${l}`, c.value = l, u.value = l);
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(`${f.min || 0}`, 10), o.value = parseInt(`${f.max || 100}`, 10), m.value = n.value, c.value = o.value, s.value = parseInt(`${_.minValue || n.value}`, 10), u.value = parseInt(`${_.maxValue || o.value}`, 10), h.value = Math.log(s.value || 1), P.value = Math.log(u.value), y.value = (P.value - h.value) / (o.value - n.value);
139
- })(), H(() => {
140
- !g.value || !r.value || (x(
141
- m.value,
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: o.value,
145
- value: c.value
143
+ max: u.value,
144
+ value: d.value
146
145
  },
147
146
  "#B4C2F0",
148
147
  "#2B5DFF",
149
- r.value
150
- ), I(c.value, r.value));
151
- }), (e, t) => (J(), K("div", Q, [
152
- p("div", W, [
153
- p("input", {
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: m.value,
157
+ value: c.value,
159
158
  min: n.value,
160
- max: o.value,
159
+ max: u.value,
161
160
  step: e.$attrs.step,
162
- onInput: t[0] || (t[0] = T((l) => R(
163
- F(g),
164
- F(r)
161
+ onInput: l[0] || (l[0] = _((a) => N(
162
+ h(g),
163
+ h(s)
165
164
  ), ["stop"]))
166
- }, null, 40, X),
167
- p("input", {
165
+ }, null, 40, W),
166
+ x("input", {
168
167
  ref_key: "toSlider",
169
- ref: r,
168
+ ref: s,
170
169
  class: "toSlider",
171
170
  type: "range",
172
- value: c.value,
171
+ value: d.value,
173
172
  min: n.value,
174
- max: o.value,
173
+ max: u.value,
175
174
  step: e.$attrs.step,
176
- onInput: t[1] || (t[1] = T((l) => j(
177
- F(g),
178
- F(r)
175
+ onInput: l[1] || (l[1] = _((a) => U(
176
+ h(g),
177
+ h(s)
179
178
  ), ["stop"]))
180
- }, null, 40, Y)
179
+ }, null, 40, X)
181
180
  ]),
182
- p("div", Z, [
183
- p("div", ee, [
184
- k(E, {
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": s.value,
190
- "onUpdate:modelValue": t[2] || (t[2] = (l) => M("min-input", `${l || ""}`))
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
- p("div", te, [
194
- k(E, {
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": u.value,
200
- "onUpdate:modelValue": t[3] || (t[3] = (l) => M("max-input", `${l || ""}`))
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
- }), se = /* @__PURE__ */ O(le, [["__scopeId", "data-v-888621e8"]]);
205
+ }), oe = /* @__PURE__ */ K(le, [["__scopeId", "data-v-581ec7f4"]]);
207
206
  export {
208
- se as default
207
+ oe as default
209
208
  };
@@ -1,16 +1,18 @@
1
- declare const _default: import('vue').DefineComponent<{
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
- }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
- minChanged: (args_0: number) => any;
7
- maxChanged: (args_0: number) => any;
8
- }, string, import('vue').PublicProps, Readonly<{
9
- type?: "linear" | "logarithmic";
10
- min?: number;
11
- max?: number;
12
- }> & Readonly<{
13
- onMinChanged?: ((args_0: number) => any) | undefined;
14
- onMaxChanged?: ((args_0: number) => any) | undefined;
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-888621e8] .form-control{max-width:none!important}.range_container[data-v-888621e8]{padding-top:15px}.sliders_control[data-v-888621e8]{position:relative;min-height:30px}.form_control[data-v-888621e8]{position:relative;display:flex;justify-content:space-between;font-size:24px;color:#635a5a}input[type=range][data-v-888621e8]{-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-888621e8]::-webkit-slider-thumb:hover{background:#f7f7f7}input[type=range][data-v-888621e8]::-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-888621e8]::-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-888621e8]::-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-888621e8]{color:#8a8383;width:50px;height:30px;font-size:20px;border:none}input[type=number][data-v-888621e8]::-webkit-inner-spin-button,input[type=number][data-v-888621e8]::-webkit-outer-spin-button{opacity:1}.fromSlider[data-v-888621e8]{height:0!important;z-index:1}.toSlider[data-v-888621e8]{height:3px!important}
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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.0.18",
3
+ "version": "2.0.19",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",