@tekkare/auriga 0.1.10 → 0.1.12
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/module.json +1 -1
- package/dist/runtime/components/allFlags.vue +245 -0
- package/dist/runtime/components/allFlags.vue.d.ts +8 -0
- package/dist/runtime/components/argActions.vue +11 -6
- package/dist/runtime/components/argActions.vue.d.ts +12 -3
- package/dist/runtime/components/argChart.vue +109 -167
- package/dist/runtime/components/argChart.vue.d.ts +1 -1
- package/dist/runtime/components/argChartTableCard.vue +12 -2
- package/dist/runtime/components/argChartTableCard.vue.d.ts +22 -1
- package/dist/runtime/components/argComplexSelect.vue +1 -1
- package/dist/runtime/components/argDate.vue +77 -0
- package/dist/runtime/components/argDate.vue.d.ts +34 -0
- package/dist/runtime/components/argErrors.vue +168 -0
- package/dist/runtime/components/argErrors.vue.d.ts +56 -0
- package/dist/runtime/components/argFilterCard.vue +1 -0
- package/dist/runtime/components/argFlag.vue +447 -217
- package/dist/runtime/components/argFlag.vue.d.ts +4 -4
- package/dist/runtime/components/argHybridChart.vue +277 -0
- package/dist/runtime/components/argHybridChart.vue.d.ts +48 -0
- package/dist/runtime/components/argMainLayout.vue +1 -0
- package/dist/runtime/components/argMenuLink.vue +43 -15
- package/dist/runtime/components/argMenuLink.vue.d.ts +15 -4
- package/dist/runtime/components/argNumberInput.vue +223 -0
- package/dist/runtime/components/argNumberInput.vue.d.ts +57 -0
- package/dist/runtime/components/argSearchInput.vue +1 -2
- package/dist/runtime/components/argSearchInput.vue.d.ts +0 -2
- package/dist/runtime/components/argSimpleChart.vue +123 -0
- package/dist/runtime/components/argSimpleChart.vue.d.ts +32 -0
- package/dist/runtime/components/argSimpleInput.vue +99 -0
- package/dist/runtime/components/argSimpleInput.vue.d.ts +48 -0
- package/dist/runtime/components/argSmallAreaChart.vue +138 -0
- package/dist/runtime/components/argSmallAreaChart.vue.d.ts +122 -0
- package/dist/runtime/components/argSourceContainer.vue +34 -0
- package/dist/runtime/components/argSourceContainer.vue.d.ts +2 -0
- package/dist/runtime/components/argStyle.vue +8 -0
- package/dist/runtime/components/argTable.vue +45 -8
- package/dist/runtime/components/argTable.vue.d.ts +14 -2
- package/dist/runtime/components/argTags.vue +6 -4
- package/dist/runtime/components/argTrendIndicator.vue +82 -0
- package/dist/runtime/components/argTrendIndicator.vue.d.ts +23 -0
- package/dist/runtime/components/argTutoModal.vue +186 -0
- package/dist/runtime/components/argTutoModal.vue.d.ts +41 -0
- package/package.json +2 -1
|
@@ -88,10 +88,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
88
|
FM: string;
|
|
89
89
|
FR: string;
|
|
90
90
|
GA: string;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
"GB-ENG": string;
|
|
92
|
+
"GB-NIR": string;
|
|
93
|
+
"GB-SCT": string;
|
|
94
|
+
"GB-WLS": string;
|
|
95
95
|
GB: string;
|
|
96
96
|
GD: string;
|
|
97
97
|
GE: string;
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<client-only>
|
|
4
|
+
<table class="oip_hybrid_chart">
|
|
5
|
+
<thead class="oip_hybrid_chart__header">
|
|
6
|
+
<tr>
|
|
7
|
+
<th
|
|
8
|
+
class="oip_hybrid_chart__header_elem"
|
|
9
|
+
v-for="(header, index) in heads"
|
|
10
|
+
:key="index"
|
|
11
|
+
>
|
|
12
|
+
{{ header }}
|
|
13
|
+
</th>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
<tbody class="oip_hybrid_chart__body">
|
|
17
|
+
<tr v-for="(row, tableIndex) in tableBody" :key="tableIndex">
|
|
18
|
+
<td
|
|
19
|
+
v-for="(val, index) in row.values"
|
|
20
|
+
:key="index"
|
|
21
|
+
class="oip_hybrid_chart__td"
|
|
22
|
+
>
|
|
23
|
+
<div class="oip_hybrid_chart__bar_group" v-if="index === 0">
|
|
24
|
+
<div
|
|
25
|
+
class="oip_hybrid_chart__bar"
|
|
26
|
+
:style="{
|
|
27
|
+
background: barColor + '1a',
|
|
28
|
+
width: `${getPercentage(row.values[1].percentage)}%`,
|
|
29
|
+
}"
|
|
30
|
+
></div>
|
|
31
|
+
<arg-tooltip
|
|
32
|
+
:id="`tooltip-${val}`"
|
|
33
|
+
:disable="isEllipsisActive(val)"
|
|
34
|
+
:tooltipText="val"
|
|
35
|
+
:dir="tableIndex === tableBody.length - 1 ? 'bottom' : 'top'"
|
|
36
|
+
class="oip_hybrid_chart__bar_content"
|
|
37
|
+
>
|
|
38
|
+
<div :id="`text-value-${val}`" class="truncated">
|
|
39
|
+
{{ val }}
|
|
40
|
+
</div>
|
|
41
|
+
</arg-tooltip>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="oip_hybrid_chart__td_content" v-if="index === 1">
|
|
44
|
+
<p>
|
|
45
|
+
{{
|
|
46
|
+
new Intl.NumberFormat("fr-FR")
|
|
47
|
+
.format(val.value)
|
|
48
|
+
.replace(",", ".")
|
|
49
|
+
}}
|
|
50
|
+
<span class="oip_hybrid_chart__bar_percentage"
|
|
51
|
+
>({{ val.percentage }} %)</span
|
|
52
|
+
>
|
|
53
|
+
</p>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="oip_hybrid_chart__td_content" v-if="index > 1">
|
|
56
|
+
{{ val }}
|
|
57
|
+
</div>
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
</tbody>
|
|
61
|
+
</table>
|
|
62
|
+
</client-only>
|
|
63
|
+
<div class="oip_hybrid_chart__footer" v-if="limiter">
|
|
64
|
+
<arg-btn
|
|
65
|
+
btnStyle="skeleton"
|
|
66
|
+
prefixIcon="CornersOut"
|
|
67
|
+
@onClick="changeShowState(true)"
|
|
68
|
+
v-if="!showAll"
|
|
69
|
+
>Show all</arg-btn
|
|
70
|
+
>
|
|
71
|
+
<arg-btn
|
|
72
|
+
btnStyle="skeleton"
|
|
73
|
+
prefixIcon="CornersIn"
|
|
74
|
+
@onClick="changeShowState(false)"
|
|
75
|
+
v-if="showAll"
|
|
76
|
+
>Show less</arg-btn
|
|
77
|
+
>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
<script>
|
|
82
|
+
import argBtn from "./argBtn";
|
|
83
|
+
import argTooltip from "./argTooltip";
|
|
84
|
+
import {
|
|
85
|
+
onMounted,
|
|
86
|
+
ref,
|
|
87
|
+
computed,
|
|
88
|
+
watch,
|
|
89
|
+
defineComponent
|
|
90
|
+
} from "vue";
|
|
91
|
+
export default defineComponent({
|
|
92
|
+
name: "argHybridChart",
|
|
93
|
+
components: { argBtn, argTooltip },
|
|
94
|
+
props: {
|
|
95
|
+
heads: {
|
|
96
|
+
type: Array,
|
|
97
|
+
required: true
|
|
98
|
+
},
|
|
99
|
+
contents: {
|
|
100
|
+
type: Array,
|
|
101
|
+
required: true
|
|
102
|
+
},
|
|
103
|
+
barColor: {
|
|
104
|
+
type: String,
|
|
105
|
+
default: "#4475FB"
|
|
106
|
+
},
|
|
107
|
+
limiter: {
|
|
108
|
+
type: Number,
|
|
109
|
+
required: false
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
emits: ["showState"],
|
|
113
|
+
setup(props, { emit }) {
|
|
114
|
+
const showAll = ref(false);
|
|
115
|
+
const maxValue = ref(0);
|
|
116
|
+
const tableBody = computed(() => {
|
|
117
|
+
let contentValues = [];
|
|
118
|
+
if (props.limiter) {
|
|
119
|
+
if (!showAll.value) {
|
|
120
|
+
contentValues = props.contents.slice(0, props.limiter);
|
|
121
|
+
} else {
|
|
122
|
+
contentValues = props.contents;
|
|
123
|
+
}
|
|
124
|
+
} else {
|
|
125
|
+
contentValues = props.contents;
|
|
126
|
+
}
|
|
127
|
+
return contentValues;
|
|
128
|
+
});
|
|
129
|
+
onMounted(() => {
|
|
130
|
+
getMaxValue();
|
|
131
|
+
});
|
|
132
|
+
watch(
|
|
133
|
+
() => props.contents,
|
|
134
|
+
(new_contents) => {
|
|
135
|
+
maxValue.value = 0;
|
|
136
|
+
getMaxValue();
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
function isEllipsisActive(value) {
|
|
140
|
+
let textValue = document?.getElementById(`text-value-${value}`);
|
|
141
|
+
let tooltip = document?.getElementById(`tooltip-${value}`);
|
|
142
|
+
if (textValue !== void 0 && textValue !== null && tooltip !== null) {
|
|
143
|
+
tooltip.style.maxWidth = "12000px";
|
|
144
|
+
textValue.style.overflow = "initial";
|
|
145
|
+
const noEllipsisWidth = textValue.offsetWidth;
|
|
146
|
+
tooltip.style.maxWidth = "100%";
|
|
147
|
+
textValue.style.overflow = "hidden";
|
|
148
|
+
const ellipsisWidth = textValue.offsetWidth;
|
|
149
|
+
if (ellipsisWidth < noEllipsisWidth) {
|
|
150
|
+
return false;
|
|
151
|
+
} else {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function getMaxValue() {
|
|
157
|
+
for (let i = 0; i < props.contents.length; i++) {
|
|
158
|
+
if (parseFloat(props.contents[i].values[1].percentage) > maxValue.value) {
|
|
159
|
+
parseFloat(maxValue.value = props.contents[i].values[1].percentage);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
function changeShowState(val) {
|
|
164
|
+
showAll.value = val;
|
|
165
|
+
emit("showState", val);
|
|
166
|
+
}
|
|
167
|
+
function getPercentage(value) {
|
|
168
|
+
if (maxValue.value === 100) {
|
|
169
|
+
return value;
|
|
170
|
+
} else {
|
|
171
|
+
if (value === maxValue.value) {
|
|
172
|
+
return 100;
|
|
173
|
+
} else {
|
|
174
|
+
return value * 100 / maxValue.value;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
maxValue,
|
|
180
|
+
showAll,
|
|
181
|
+
getMaxValue,
|
|
182
|
+
changeShowState,
|
|
183
|
+
getPercentage,
|
|
184
|
+
tableBody,
|
|
185
|
+
isEllipsisActive
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
</script>
|
|
190
|
+
<style scoped>
|
|
191
|
+
.oip_hybrid_chart {
|
|
192
|
+
border-collapse: collapse;
|
|
193
|
+
border-spacing: 0;
|
|
194
|
+
width: 100%;
|
|
195
|
+
table-layout: auto;
|
|
196
|
+
}
|
|
197
|
+
.oip_hybrid_chart__header th {
|
|
198
|
+
font-style: normal;
|
|
199
|
+
font-weight: 400;
|
|
200
|
+
font-size: 12px;
|
|
201
|
+
line-height: 14px;
|
|
202
|
+
color: var(--cool-grey);
|
|
203
|
+
}
|
|
204
|
+
.oip_hybrid_chart__header_elem:first-child {
|
|
205
|
+
text-align: left;
|
|
206
|
+
padding-left: 0;
|
|
207
|
+
}
|
|
208
|
+
.oip_hybrid_chart__header_elem:last-child {
|
|
209
|
+
padding-right: 0;
|
|
210
|
+
}
|
|
211
|
+
.oip_hybrid_chart__header_elem {
|
|
212
|
+
padding: 5px 10px;
|
|
213
|
+
white-space: nowrap;
|
|
214
|
+
text-align: right;
|
|
215
|
+
}
|
|
216
|
+
.oip_hybrid_chart__body tr {
|
|
217
|
+
padding: 4px 0;
|
|
218
|
+
height: 40px;
|
|
219
|
+
}
|
|
220
|
+
.oip_hybrid_chart__td:first-child {
|
|
221
|
+
width: 100%;
|
|
222
|
+
padding-left: 0;
|
|
223
|
+
}
|
|
224
|
+
.oip_hybrid_chart__td:last-child .oip_hybrid_chart__td_content {
|
|
225
|
+
padding-right: 0;
|
|
226
|
+
}
|
|
227
|
+
.oip_hybrid_chart__td {
|
|
228
|
+
vertical-align: top !important;
|
|
229
|
+
}
|
|
230
|
+
.oip_hybrid_chart__td_content {
|
|
231
|
+
padding: 5px 10px;
|
|
232
|
+
font-style: normal;
|
|
233
|
+
font-weight: 500;
|
|
234
|
+
font-size: 14px;
|
|
235
|
+
line-height: 160%;
|
|
236
|
+
color: var(--independence);
|
|
237
|
+
white-space: nowrap;
|
|
238
|
+
text-align: right;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.oip_hybrid_chart__bar_group {
|
|
242
|
+
position: relative;
|
|
243
|
+
width: 100%;
|
|
244
|
+
}
|
|
245
|
+
.oip_hybrid_chart__bar {
|
|
246
|
+
position: absolute;
|
|
247
|
+
z-index: 0;
|
|
248
|
+
height: 32px;
|
|
249
|
+
}
|
|
250
|
+
.oip_hybrid_chart__bar_content {
|
|
251
|
+
position: absolute;
|
|
252
|
+
z-index: 1;
|
|
253
|
+
padding: 8px 10px;
|
|
254
|
+
white-space: nowrap;
|
|
255
|
+
font-style: normal;
|
|
256
|
+
font-weight: 400;
|
|
257
|
+
font-size: 14px;
|
|
258
|
+
max-width: 100%;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.oip_hybrid_chart__bar_percentage {
|
|
262
|
+
margin-left: 4px;
|
|
263
|
+
font-weight: 400;
|
|
264
|
+
}
|
|
265
|
+
.oip_hybrid_chart__footer {
|
|
266
|
+
display: flex;
|
|
267
|
+
justify-content: center;
|
|
268
|
+
margin-top: 32px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.truncated {
|
|
272
|
+
display: block;
|
|
273
|
+
white-space: nowrap; /* forces text to single line */
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
text-overflow: ellipsis;
|
|
276
|
+
}
|
|
277
|
+
</style>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
heads: {
|
|
3
|
+
type: ArrayConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
contents: {
|
|
7
|
+
type: ArrayConstructor;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
barColor: {
|
|
11
|
+
type: StringConstructor;
|
|
12
|
+
default: string;
|
|
13
|
+
};
|
|
14
|
+
limiter: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
required: false;
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
maxValue: import("vue").Ref<number>;
|
|
20
|
+
showAll: import("vue").Ref<boolean>;
|
|
21
|
+
getMaxValue: () => void;
|
|
22
|
+
changeShowState: (val: boolean) => void;
|
|
23
|
+
getPercentage: (value: number) => number;
|
|
24
|
+
tableBody: import("vue").ComputedRef<never[]>;
|
|
25
|
+
isEllipsisActive: (value: string) => boolean | undefined;
|
|
26
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "showState"[], "showState", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
heads: {
|
|
28
|
+
type: ArrayConstructor;
|
|
29
|
+
required: true;
|
|
30
|
+
};
|
|
31
|
+
contents: {
|
|
32
|
+
type: ArrayConstructor;
|
|
33
|
+
required: true;
|
|
34
|
+
};
|
|
35
|
+
barColor: {
|
|
36
|
+
type: StringConstructor;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
limiter: {
|
|
40
|
+
type: NumberConstructor;
|
|
41
|
+
required: false;
|
|
42
|
+
};
|
|
43
|
+
}>> & {
|
|
44
|
+
onShowState?: ((...args: any[]) => any) | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
barColor: string;
|
|
47
|
+
}, {}>;
|
|
48
|
+
export default _default;
|
|
@@ -1,30 +1,58 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
<div>
|
|
3
|
+
<nuxt-link v-if="!isAction" :to="to" class="arg_menu_link">
|
|
4
|
+
<arg-tooltip
|
|
5
|
+
:tooltip-text="label"
|
|
6
|
+
:disable="sidebarOpen"
|
|
7
|
+
dir="right"
|
|
8
|
+
:class="[
|
|
9
|
+
'tooltip_display',
|
|
10
|
+
sidebarOpen ? '' : 'link_menu_tooltip_icon',
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<arg-icon :name="icon" color="var(--cool-grey)" size="20" />
|
|
14
|
+
</arg-tooltip>
|
|
15
|
+
<span v-show="sidebarOpen">{{ label }}</span>
|
|
16
|
+
</nuxt-link>
|
|
17
|
+
<div v-else class="arg_menu_link" @click="sendAction()">
|
|
18
|
+
<arg-tooltip
|
|
19
|
+
:tooltip-text="label"
|
|
20
|
+
:disable="sidebarOpen"
|
|
21
|
+
dir="right"
|
|
22
|
+
:class="[
|
|
23
|
+
'tooltip_display',
|
|
24
|
+
sidebarOpen ? '' : 'link_menu_tooltip_icon',
|
|
25
|
+
]"
|
|
26
|
+
>
|
|
27
|
+
<arg-icon :name="icon" color="var(--cool-grey)" size="20" />
|
|
28
|
+
</arg-tooltip>
|
|
29
|
+
<span v-show="sidebarOpen">{{ label }}</span>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
13
32
|
</template>
|
|
14
33
|
<script>
|
|
15
34
|
import {
|
|
16
35
|
defineComponent
|
|
17
36
|
} from "vue";
|
|
18
37
|
import argIcon from "./argIcon.vue";
|
|
19
|
-
import argStyle from "./argStyle.vue";
|
|
20
38
|
export default defineComponent({
|
|
21
39
|
name: "argMenuLink",
|
|
22
|
-
components: { argIcon
|
|
40
|
+
components: { argIcon },
|
|
23
41
|
props: {
|
|
24
42
|
icon: { type: String, required: true },
|
|
25
43
|
label: { type: String, required: true },
|
|
26
|
-
to: { type: String,
|
|
27
|
-
sidebarOpen: { type: Boolean, default: true }
|
|
44
|
+
to: { type: String, default: "/" },
|
|
45
|
+
sidebarOpen: { type: Boolean, default: true },
|
|
46
|
+
isAction: { type: Boolean, default: false }
|
|
47
|
+
},
|
|
48
|
+
emits: ["onClick"],
|
|
49
|
+
setup(props, { emit }) {
|
|
50
|
+
function sendAction() {
|
|
51
|
+
emit("onClick");
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
sendAction
|
|
55
|
+
};
|
|
28
56
|
}
|
|
29
57
|
});
|
|
30
58
|
</script>
|
|
@@ -9,14 +9,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9
9
|
};
|
|
10
10
|
to: {
|
|
11
11
|
type: StringConstructor;
|
|
12
|
-
required: true;
|
|
13
12
|
default: string;
|
|
14
13
|
};
|
|
15
14
|
sidebarOpen: {
|
|
16
15
|
type: BooleanConstructor;
|
|
17
16
|
default: boolean;
|
|
18
17
|
};
|
|
19
|
-
|
|
18
|
+
isAction: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
sendAction: () => void;
|
|
24
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
25
|
icon: {
|
|
21
26
|
type: StringConstructor;
|
|
22
27
|
required: true;
|
|
@@ -27,15 +32,21 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
27
32
|
};
|
|
28
33
|
to: {
|
|
29
34
|
type: StringConstructor;
|
|
30
|
-
required: true;
|
|
31
35
|
default: string;
|
|
32
36
|
};
|
|
33
37
|
sidebarOpen: {
|
|
34
38
|
type: BooleanConstructor;
|
|
35
39
|
default: boolean;
|
|
36
40
|
};
|
|
37
|
-
|
|
41
|
+
isAction: {
|
|
42
|
+
type: BooleanConstructor;
|
|
43
|
+
default: boolean;
|
|
44
|
+
};
|
|
45
|
+
}>> & {
|
|
46
|
+
onOnClick?: ((...args: any[]) => any) | undefined;
|
|
47
|
+
}, {
|
|
38
48
|
sidebarOpen: boolean;
|
|
39
49
|
to: string;
|
|
50
|
+
isAction: boolean;
|
|
40
51
|
}, {}>;
|
|
41
52
|
export default _default;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="['input_number_section', typing ? 'open' : '']" @click.stop>
|
|
3
|
+
<p class="oip_filter_label">{{ inputLabel }}</p>
|
|
4
|
+
<div class="input_number_box">
|
|
5
|
+
<div
|
|
6
|
+
class="input_number_action action_left"
|
|
7
|
+
@click="changeValueClick(-stepValue)"
|
|
8
|
+
>
|
|
9
|
+
<arg-icon name="Minus" color="var(--cool-grey)" size="16" />
|
|
10
|
+
</div>
|
|
11
|
+
<input
|
|
12
|
+
type="number"
|
|
13
|
+
:max="maxValue === -1 ? 0 : maxValue"
|
|
14
|
+
:value="returnValue"
|
|
15
|
+
class="number_input_style"
|
|
16
|
+
@input="changeInput"
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
class="input_number_action action_right"
|
|
20
|
+
@click="changeValueClick(stepValue)"
|
|
21
|
+
>
|
|
22
|
+
<arg-icon name="Plus" color="var(--cool-grey)" size="16" />
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import { toInteger } from "lodash";
|
|
30
|
+
import argIcon from "./argIcon.vue";
|
|
31
|
+
import {
|
|
32
|
+
onMounted,
|
|
33
|
+
ref,
|
|
34
|
+
watch,
|
|
35
|
+
defineComponent
|
|
36
|
+
} from "vue";
|
|
37
|
+
export default defineComponent({
|
|
38
|
+
name: "argNumberInput",
|
|
39
|
+
components: { argIcon },
|
|
40
|
+
props: {
|
|
41
|
+
inputLabel: {
|
|
42
|
+
type: String,
|
|
43
|
+
required: true
|
|
44
|
+
},
|
|
45
|
+
defaultValue: {
|
|
46
|
+
type: Number,
|
|
47
|
+
default: 1
|
|
48
|
+
},
|
|
49
|
+
maxValue: {
|
|
50
|
+
type: Number,
|
|
51
|
+
default: -1
|
|
52
|
+
},
|
|
53
|
+
hasNegativeValue: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
stepValue: {
|
|
58
|
+
type: Number,
|
|
59
|
+
default: 1
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
emits: ["update:Number", "changeValue"],
|
|
63
|
+
setup(props, { emit }) {
|
|
64
|
+
const returnValue = ref(1);
|
|
65
|
+
const typing = ref(false);
|
|
66
|
+
onMounted(() => {
|
|
67
|
+
returnValue.value = props.defaultValue;
|
|
68
|
+
emit("update:Number", returnValue.value);
|
|
69
|
+
emit("changeValue", returnValue.value);
|
|
70
|
+
});
|
|
71
|
+
watch(
|
|
72
|
+
() => props.defaultValue,
|
|
73
|
+
(new_default_value) => {
|
|
74
|
+
returnValue.value = new_default_value;
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
function changeInput(event) {
|
|
78
|
+
if (event.target !== null) {
|
|
79
|
+
if (props.maxValue !== -1 && event.target.value > props.maxValue) {
|
|
80
|
+
event.target.value = props.maxValue;
|
|
81
|
+
} else if (props.hasNegativeValue === false && event.target.value < 0) {
|
|
82
|
+
event.target.value = 0;
|
|
83
|
+
}
|
|
84
|
+
returnValue.value = toInteger(event.target.value);
|
|
85
|
+
emit("update:Number", returnValue.value);
|
|
86
|
+
emit("changeValue", returnValue.value);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function changeValueClick(value) {
|
|
90
|
+
if (props.maxValue !== -1 && returnValue.value + value > props.maxValue) {
|
|
91
|
+
returnValue.value = props.maxValue;
|
|
92
|
+
} else if (props.hasNegativeValue === false && returnValue.value + value < 0) {
|
|
93
|
+
returnValue.value = 0;
|
|
94
|
+
} else
|
|
95
|
+
returnValue.value += value;
|
|
96
|
+
emit("update:Number", returnValue.value);
|
|
97
|
+
emit("changeValue", returnValue.value);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
returnValue,
|
|
101
|
+
typing,
|
|
102
|
+
changeInput,
|
|
103
|
+
changeValueClick
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style scoped>
|
|
110
|
+
.input_number_box .input_number_action.action_left:hover,
|
|
111
|
+
.input_number_box .input_number_action.action_right:hover {
|
|
112
|
+
border: 1.5px solid rgba(33, 118, 255, 0.2) !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.input_number_box .input_number_action.action_left:hover svg,
|
|
116
|
+
.input_number_box .input_number_action.action_right:hover svg {
|
|
117
|
+
color: var(--primary) !important;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.input_number_box:focus-within {
|
|
121
|
+
border: 1.5px solid var(--primary) !important;
|
|
122
|
+
box-shadow: 0px 0px 0px 4px rgba(33, 118, 255, 0.1) !important;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.input_number_box:focus-within .input_number_action.action_left {
|
|
126
|
+
top: 0px !important;
|
|
127
|
+
left: 0px !important;
|
|
128
|
+
}
|
|
129
|
+
.input_number_box:focus-within .input_number_action.action_right {
|
|
130
|
+
top: 0px !important;
|
|
131
|
+
right: 0px !important;
|
|
132
|
+
}
|
|
133
|
+
.input_number_box:focus-within {
|
|
134
|
+
z-index: 9999 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.input_number_box:focus-within .input_number_action.action_left,
|
|
138
|
+
.input_number_box:focus-within
|
|
139
|
+
.input_number_box
|
|
140
|
+
.input_number_action.action_left:hover {
|
|
141
|
+
border-top: 1.5px transparent !important;
|
|
142
|
+
border-left: 1.5px transparent !important;
|
|
143
|
+
border-bottom: 1.5px transparent !important;
|
|
144
|
+
}
|
|
145
|
+
.input_number_box:focus-within .input_number_action.action_right,
|
|
146
|
+
.input_number_box:focus-within
|
|
147
|
+
.input_number_box
|
|
148
|
+
.input_number_action.action_right:hover {
|
|
149
|
+
border-top: 1.5px transparent !important;
|
|
150
|
+
border-right: 1.5px transparent !important;
|
|
151
|
+
border-bottom: 1.5px transparent !important;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.input_number_section {
|
|
155
|
+
display: flex;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
align-items: flex-start;
|
|
158
|
+
padding: 0px;
|
|
159
|
+
gap: 4px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.input_number_box {
|
|
163
|
+
display: flex;
|
|
164
|
+
flex-direction: row;
|
|
165
|
+
align-items: center;
|
|
166
|
+
padding: 12px 48px;
|
|
167
|
+
gap: 8px;
|
|
168
|
+
background: var(--pure-white);
|
|
169
|
+
border: 1.5px solid var(--dividers);
|
|
170
|
+
border-radius: 8px;
|
|
171
|
+
position: relative;
|
|
172
|
+
z-index: 1;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.input_number_action {
|
|
176
|
+
position: absolute;
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: row;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
align-items: center;
|
|
181
|
+
padding: 12px;
|
|
182
|
+
gap: 8px;
|
|
183
|
+
background: var(--pure-white);
|
|
184
|
+
border: 1.5px solid var(--dividers);
|
|
185
|
+
border-radius: 8px;
|
|
186
|
+
z-index: 2;
|
|
187
|
+
cursor: pointer;
|
|
188
|
+
}
|
|
189
|
+
.action_right {
|
|
190
|
+
top: -1.5px;
|
|
191
|
+
right: -1.5px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.action_left {
|
|
195
|
+
top: -1.5px;
|
|
196
|
+
left: -1.5px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.number_input_style {
|
|
200
|
+
border: none;
|
|
201
|
+
text-align: center;
|
|
202
|
+
max-width: 127.5px;
|
|
203
|
+
height: 16px;
|
|
204
|
+
padding: 0px !important;
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
font-size: 14px;
|
|
207
|
+
line-height: 16px;
|
|
208
|
+
color: var(--independence);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.number_input_style:focus-visible {
|
|
212
|
+
border: none;
|
|
213
|
+
outline: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
input[type="number"]::-webkit-inner-spin-button {
|
|
217
|
+
-webkit-appearance: none;
|
|
218
|
+
}
|
|
219
|
+
input[type="number"] {
|
|
220
|
+
-moz-appearance: textfield;
|
|
221
|
+
appearance: textfield;
|
|
222
|
+
}
|
|
223
|
+
</style>
|