@eturnity/eturnity_reusable_components 1.2.34 → 1.2.36
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/package.json +1 -1
- package/src/App.vue +105 -204
- package/src/assets/svgIcons/align_panel.svg +1 -0
- package/src/assets/svgIcons/areas_tool.svg +14 -0
- package/src/assets/svgIcons/base_layer.svg +3 -0
- package/src/assets/svgIcons/bug.svg +6 -0
- package/src/assets/svgIcons/direction_arrow.svg +4 -0
- package/src/assets/svgIcons/distance_tool.svg +8 -0
- package/src/assets/svgIcons/distort_tool.svg +10 -0
- package/src/assets/svgIcons/distort_tool2.svg +16 -0
- package/src/assets/svgIcons/draggable_corner.svg +5 -0
- package/src/assets/svgIcons/draw_tool.svg +3 -0
- package/src/assets/svgIcons/flatten.svg +12 -0
- package/src/assets/svgIcons/layers_close.svg +4 -0
- package/src/assets/svgIcons/layers_open.svg +4 -0
- package/src/assets/svgIcons/magic_tool.svg +6 -0
- package/src/assets/svgIcons/map_icon.svg +4 -2
- package/src/assets/svgIcons/map_settings.svg +3 -0
- package/src/assets/svgIcons/margin_tool.svg +4 -0
- package/src/assets/svgIcons/obstacle_tool.svg +7 -11
- package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -0
- package/src/assets/svgIcons/opacity.svg +1 -0
- package/src/assets/svgIcons/outline_tool.svg +11 -0
- package/src/assets/svgIcons/redo.svg +6 -0
- package/src/assets/svgIcons/resizer.svg +5 -0
- package/src/assets/svgIcons/roof_layer.svg +3 -0
- package/src/assets/svgIcons/rotate_tool.svg +3 -0
- package/src/assets/svgIcons/ruler_tool.svg +3 -0
- package/src/assets/svgIcons/trim_tool.svg +4 -0
- package/src/assets/svgIcons/undo.svg +6 -0
- package/src/assets/svgIcons/vertical_tool.svg +3 -0
- package/src/assets/theme.js +2 -0
- package/src/components/icon/index.vue +13 -10
- package/src/components/iconWrapper/index.vue +116 -0
- package/src/components/inputs/inputNumber/index.vue +112 -15
- package/src/components/inputs/inputText/index.vue +49 -8
- package/src/components/inputs/select/index.vue +387 -0
- package/src/components/inputs/select/option/index.vue +60 -0
- package/src/components/inputs/select/select.stories.js +59 -0
- package/src/components/inputs/switchField/index.vue +244 -0
- package/src/components/modals/modal/index.vue +7 -2
- package/src/helpers/numberConverter.js +1 -0
@@ -0,0 +1,244 @@
|
|
1
|
+
<template>
|
2
|
+
<container>
|
3
|
+
<flex-wrapper :size="size" :disabled="disabled" :alignItems="alignItems" :label="label">
|
4
|
+
<label-container
|
5
|
+
v-if="label && labelAlign === 'left'"
|
6
|
+
:hasInfoMessage="!!infoTextMessage"
|
7
|
+
:colorMode="colorMode"
|
8
|
+
>
|
9
|
+
<label-text :size="size">{{ label }}</label-text>
|
10
|
+
<info-text
|
11
|
+
v-if="infoTextMessage"
|
12
|
+
:text="infoTextMessage"
|
13
|
+
borderColor="#ccc"
|
14
|
+
size="14px"
|
15
|
+
:alignText="infoTextAlign"
|
16
|
+
/>
|
17
|
+
</label-container>
|
18
|
+
|
19
|
+
<switch-wrapper
|
20
|
+
:size="size"
|
21
|
+
:disabled="disabled"
|
22
|
+
:backgroundColor="backgroundColor"
|
23
|
+
>
|
24
|
+
<switchOption
|
25
|
+
v-for="(item,index) in options"
|
26
|
+
:key="index"
|
27
|
+
@click="selectItem(item.value)"
|
28
|
+
:isActive="selectedValue==item.value"
|
29
|
+
:colorMode="colorMode"
|
30
|
+
:primaryColor="primaryColor"
|
31
|
+
:secondaryColor="secondaryColor"
|
32
|
+
:inactiveColor="inactiveColor"
|
33
|
+
>
|
34
|
+
{{ item.content }}
|
35
|
+
</switchOption>
|
36
|
+
</switch-wrapper>
|
37
|
+
<label-container
|
38
|
+
v-if="label && labelAlign === 'right'"
|
39
|
+
:hasInfoMessage="!!infoTextMessage"
|
40
|
+
>
|
41
|
+
<label-text :size="size" :fontColor="fontColor">{{ label }}</label-text>
|
42
|
+
<info-text
|
43
|
+
@click.native.stop
|
44
|
+
v-if="infoTextMessage"
|
45
|
+
:text="infoTextMessage"
|
46
|
+
borderColor="#ccc"
|
47
|
+
size="14px"
|
48
|
+
:alignText="infoTextAlign"
|
49
|
+
/>
|
50
|
+
</label-container>
|
51
|
+
</flex-wrapper>
|
52
|
+
</container>
|
53
|
+
</template>
|
54
|
+
|
55
|
+
<script>
|
56
|
+
// import Toggle from "@eturnity/eturnity_reusable_components/src/components/inputs/toggle"
|
57
|
+
// To use:
|
58
|
+
// <SwitchField
|
59
|
+
// @on-switch-change="onInputChange($event)"
|
60
|
+
// :options="[{value:0,content:'zero'},{value:1,content:'one'},{value:2,content:'two'}]"
|
61
|
+
// :value="1"
|
62
|
+
// label="label"
|
63
|
+
// toggleColor="red"
|
64
|
+
// size="large"
|
65
|
+
// backgroundColor="blue"
|
66
|
+
// labelAlign="left"
|
67
|
+
// fontColor="black"
|
68
|
+
// :disabled="false"
|
69
|
+
// />
|
70
|
+
|
71
|
+
import styled from "vue-styled-components"
|
72
|
+
import InfoText from "../../infoText"
|
73
|
+
import theme from "../../../assets/theme"
|
74
|
+
const Container = styled.div`
|
75
|
+
display: inline-block;
|
76
|
+
`
|
77
|
+
|
78
|
+
const flexAttrs = { label:String,size: String, disabled: Boolean,alignItems: String }
|
79
|
+
const FlexWrapper = styled("div", flexAttrs)`
|
80
|
+
display: grid;
|
81
|
+
grid-template-columns: auto 1fr;
|
82
|
+
grid-gap: 10px;
|
83
|
+
align-items: center;
|
84
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
85
|
+
grid-template-columns: ${(props) =>
|
86
|
+
props.alignItems === 'vertical' || !props.label ? '1fr' : 'auto 1fr'};
|
87
|
+
`
|
88
|
+
|
89
|
+
const toggleAttrs = {
|
90
|
+
size: String,
|
91
|
+
fontColor: String,
|
92
|
+
disabled: Boolean,
|
93
|
+
backgroundColor: String,
|
94
|
+
isChecked: Boolean,
|
95
|
+
}
|
96
|
+
const LabelText = styled("div", toggleAttrs)`
|
97
|
+
color: white;
|
98
|
+
font-size: 13px;
|
99
|
+
font-family: 'Lato-Bold',Arial;
|
100
|
+
`
|
101
|
+
|
102
|
+
const SwitchWrapper = styled("span", toggleAttrs)`
|
103
|
+
display: flex;
|
104
|
+
position: relative;
|
105
|
+
cursor: ${(props) => (props.disabled ? "not-allowed" : "pointer")};
|
106
|
+
height: ${(props) =>
|
107
|
+
props.size === "medium"
|
108
|
+
? "24px"
|
109
|
+
: props.size === "small"
|
110
|
+
? "16px"
|
111
|
+
: "24px"};
|
112
|
+
`
|
113
|
+
const optionAttrs={isActive:Boolean,primaryColor:String,secondaryColor:String,inactiveColor:String}
|
114
|
+
const switchOption=styled('div',optionAttrs)`
|
115
|
+
color:${props=>props.isActive?props.primaryColor:props.inactiveColor};
|
116
|
+
background-color:${props=>props.isActive?props.secondaryColor:"transparent"};
|
117
|
+
border:1px solid ${props=>props.isActive?props.secondaryColor:props.inactiveColor};
|
118
|
+
display:flex;
|
119
|
+
align-items:center;
|
120
|
+
font-size: 14px;
|
121
|
+
line-height: 1;
|
122
|
+
text-align: center;
|
123
|
+
padding: 10px;
|
124
|
+
margin-right: -1px;
|
125
|
+
transition: all 0.1s ease-in-out;
|
126
|
+
overflow:hidden;
|
127
|
+
& :hover{
|
128
|
+
cursor: pointer;
|
129
|
+
}
|
130
|
+
&:first-child {
|
131
|
+
border-radius: 4px 0 0 4px;
|
132
|
+
}
|
133
|
+
&:last-child {
|
134
|
+
border-radius: 0 4px 4px 0;
|
135
|
+
}
|
136
|
+
|
137
|
+
`
|
138
|
+
|
139
|
+
const labelAttrs = { hasInfoMessage: Boolean }
|
140
|
+
const LabelContainer = styled("div", labelAttrs)`
|
141
|
+
display: inline-grid;
|
142
|
+
grid-template-columns: ${(props) =>
|
143
|
+
props.hasInfoMessage ? "auto 1fr" : "auto"};
|
144
|
+
grid-gap: 12px;
|
145
|
+
align-items: center;
|
146
|
+
`
|
147
|
+
|
148
|
+
export default {
|
149
|
+
name: "switchField",
|
150
|
+
components: {
|
151
|
+
Container,
|
152
|
+
SwitchWrapper,
|
153
|
+
FlexWrapper,
|
154
|
+
LabelText,
|
155
|
+
InfoText,
|
156
|
+
LabelContainer,
|
157
|
+
switchOption,
|
158
|
+
},
|
159
|
+
props: {
|
160
|
+
label: {
|
161
|
+
required: false,
|
162
|
+
default: "",
|
163
|
+
},
|
164
|
+
toggleColor: {
|
165
|
+
required: false,
|
166
|
+
},
|
167
|
+
backgroundColor: {
|
168
|
+
required: false,
|
169
|
+
},
|
170
|
+
size: {
|
171
|
+
required: false,
|
172
|
+
default: "small",
|
173
|
+
},
|
174
|
+
labelAlign: {
|
175
|
+
required: false,
|
176
|
+
default: "left",
|
177
|
+
},
|
178
|
+
fontColor: {
|
179
|
+
required: false,
|
180
|
+
},
|
181
|
+
disabled: {
|
182
|
+
required: false,
|
183
|
+
default: false,
|
184
|
+
},
|
185
|
+
infoTextMessage: {
|
186
|
+
required: false,
|
187
|
+
},
|
188
|
+
infoTextAlign: {
|
189
|
+
required: false,
|
190
|
+
},
|
191
|
+
colorMode: {
|
192
|
+
required: false,
|
193
|
+
default:'light'
|
194
|
+
},
|
195
|
+
alignItems:{
|
196
|
+
required: false,
|
197
|
+
default: 'horizontal'
|
198
|
+
},
|
199
|
+
options:{
|
200
|
+
required:true
|
201
|
+
},
|
202
|
+
value:{
|
203
|
+
required:false,
|
204
|
+
default:null
|
205
|
+
},
|
206
|
+
},
|
207
|
+
data() {
|
208
|
+
return {
|
209
|
+
selectedValue:null,
|
210
|
+
primaryColor:"white",
|
211
|
+
secondaryColor:"black",
|
212
|
+
inactiveColor:"grey6"
|
213
|
+
}
|
214
|
+
},
|
215
|
+
created(){
|
216
|
+
this.selectedValue=this.value
|
217
|
+
|
218
|
+
if(this.colorMode=='dark'){
|
219
|
+
this.primaryColor=theme.colors.black
|
220
|
+
this.secondaryColor=theme.colors.white
|
221
|
+
this.inactiveColor=theme.colors.grey6
|
222
|
+
}else{
|
223
|
+
this.primaryColor=theme.colors.white
|
224
|
+
this.secondaryColor=theme.colors.black
|
225
|
+
this.inactiveColor=theme.colors.grey6
|
226
|
+
}
|
227
|
+
},
|
228
|
+
methods: {
|
229
|
+
selectItem(value){
|
230
|
+
if (this.disabled) {
|
231
|
+
return
|
232
|
+
}
|
233
|
+
this.selectedValue=value
|
234
|
+
this.$emit("on-switch-change", this.selectedValue)
|
235
|
+
},
|
236
|
+
},
|
237
|
+
watch:{
|
238
|
+
value(val){
|
239
|
+
this.selectedValue=val
|
240
|
+
}
|
241
|
+
}
|
242
|
+
}
|
243
|
+
</script>
|
244
|
+
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<template>
|
2
2
|
<page-wrapper
|
3
|
+
:position="position"
|
3
4
|
:isOpen="isOpen"
|
4
5
|
:class="{ visible: isOpen, hidden: !isOpen }"
|
5
6
|
@click.native="onOutsideClose()"
|
@@ -36,9 +37,9 @@ const ContentContainer = styled('div', contentAttrs)`
|
|
36
37
|
visibility: ${(props) => (props.visible ? 'inherit' : 'hidden')};
|
37
38
|
`
|
38
39
|
|
39
|
-
const pageAttrs = { isOpen: Boolean, backdrop: String }
|
40
|
+
const pageAttrs = { isOpen: Boolean, backdrop: String,position:String }
|
40
41
|
const PageWrapper = styled('div', pageAttrs)`
|
41
|
-
position:
|
42
|
+
position: ${(props) => props.position}
|
42
43
|
display: grid;
|
43
44
|
top: 0;
|
44
45
|
left: 0;
|
@@ -132,6 +133,10 @@ export default {
|
|
132
133
|
backdrop: {
|
133
134
|
required: false,
|
134
135
|
default: 'white'
|
136
|
+
},
|
137
|
+
position: {
|
138
|
+
required: false,
|
139
|
+
default: 'fixed'
|
135
140
|
}
|
136
141
|
},
|
137
142
|
methods: {
|
@@ -94,6 +94,7 @@ export const numberToString = ({ value, numberPrecision }) => {
|
|
94
94
|
? 'fr-fr'
|
95
95
|
: localStorage.getItem('lang')
|
96
96
|
: 'en-US'
|
97
|
+
if(selectedLang=="null"){selectedLang='en-US'}
|
97
98
|
value=parseFloat(value)
|
98
99
|
return value.toLocaleString(selectedLang, {
|
99
100
|
minimumFractionDigits: numberPrecision,
|