@eturnity/eturnity_reusable_components 1.2.31 → 1.2.34-3d-master.1

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.
Files changed (40) hide show
  1. package/package.json +1 -1
  2. package/src/App.vue +96 -205
  3. package/src/assets/svgIcons/areas_tool.svg +14 -0
  4. package/src/assets/svgIcons/base_layer.svg +3 -0
  5. package/src/assets/svgIcons/bug.svg +6 -0
  6. package/src/assets/svgIcons/direction_arrow.svg +4 -0
  7. package/src/assets/svgIcons/distance_tool.svg +8 -0
  8. package/src/assets/svgIcons/distort_tool.svg +10 -0
  9. package/src/assets/svgIcons/distort_tool2.svg +16 -0
  10. package/src/assets/svgIcons/draggable_corner.svg +5 -0
  11. package/src/assets/svgIcons/draw_tool.svg +3 -0
  12. package/src/assets/svgIcons/flatten.svg +12 -0
  13. package/src/assets/svgIcons/layers_close.svg +4 -0
  14. package/src/assets/svgIcons/layers_open.svg +4 -0
  15. package/src/assets/svgIcons/magic_tool.svg +6 -0
  16. package/src/assets/svgIcons/map_icon.svg +4 -2
  17. package/src/assets/svgIcons/map_settings.svg +3 -0
  18. package/src/assets/svgIcons/margin_tool.svg +4 -0
  19. package/src/assets/svgIcons/obstacle_tool.svg +7 -11
  20. package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -0
  21. package/src/assets/svgIcons/opacity.svg +1 -0
  22. package/src/assets/svgIcons/outline_tool.svg +11 -0
  23. package/src/assets/svgIcons/redo.svg +6 -0
  24. package/src/assets/svgIcons/resizer.svg +5 -0
  25. package/src/assets/svgIcons/roof_layer.svg +3 -0
  26. package/src/assets/svgIcons/rotate_tool.svg +3 -0
  27. package/src/assets/svgIcons/ruler_tool.svg +3 -0
  28. package/src/assets/svgIcons/trim_tool.svg +4 -0
  29. package/src/assets/svgIcons/undo.svg +6 -0
  30. package/src/assets/svgIcons/vertical_tool.svg +3 -0
  31. package/src/assets/theme.js +2 -0
  32. package/src/components/icon/index.vue +11 -10
  33. package/src/components/iconWrapper/index.vue +116 -0
  34. package/src/components/inputs/inputNumber/index.vue +113 -15
  35. package/src/components/inputs/select/index.vue +280 -0
  36. package/src/components/inputs/select/option/index.vue +57 -0
  37. package/src/components/inputs/select/select.stories.js +59 -0
  38. package/src/components/inputs/switchField/index.vue +244 -0
  39. package/src/components/modals/modal/index.vue +7 -2
  40. package/src/helpers/numberConverter.js +1 -0
@@ -20,6 +20,8 @@ const theme = {
20
20
  grey5: '#fafafa',
21
21
  grey6: '#555d61',
22
22
  green: '#99db0c',
23
+ transparentWhite1:'#ffffff32',
24
+ transparentBlack1:'#263238e6',
23
25
  disabled: '#dfe1e1',
24
26
  eturnityGrey: '#263238'
25
27
  },
@@ -1,6 +1,7 @@
1
1
  <template>
2
- <wrapper :isDisabled="isDisabled" :size="size" :cursor="cursor">
2
+ <Wrapper :isDisabled="disabled" :size="size" :cursor="cursor">
3
3
  <icon-image
4
+ :disabled="disabled"
4
5
  :size="size"
5
6
  :color="color"
6
7
  :hoveredColor="hoveredColor"
@@ -8,7 +9,7 @@
8
9
  require(`!html-loader!./../../assets/svgIcons/${name.toLowerCase()}.svg`)
9
10
  "
10
11
  ></icon-image>
11
- </wrapper>
12
+ </Wrapper>
12
13
  </template>
13
14
 
14
15
  <script>
@@ -35,14 +36,14 @@ const Wrapper = styled('div', wrapperAttrs)`
35
36
  const IconImageProps = { color: String, hoveredColor: String, size: String }
36
37
  const IconImage = styled('div', IconImageProps)`
37
38
  svg {
38
- width: ${(props) => props.size};
39
- height: ${(props) => props.size};
39
+ width: 100%;
40
+ height: 100%;
40
41
  }
41
- svg > path {
42
+ svg path {
42
43
  ${(props) =>
43
44
  props.color && `fill: ${props.theme.colors[props.color] || props.color};`}
44
45
  }
45
- &:hover > svg > path {
46
+ &:hover > svg path {
46
47
  ${(props) => props.hoveredColor && `fill: ${props.hoveredColor};`}
47
48
  }
48
49
  `
@@ -50,11 +51,11 @@ const IconImage = styled('div', IconImageProps)`
50
51
  export default {
51
52
  name: 'icon',
52
53
  components: {
53
- Wrapper,
54
- IconImage
54
+ IconImage,
55
+ Wrapper
55
56
  },
56
57
  props: {
57
- isDisabled: {
58
+ disabled: {
58
59
  required: false,
59
60
  default: false
60
61
  },
@@ -73,7 +74,7 @@ export default {
73
74
  },
74
75
  cursor: {
75
76
  required: false,
76
- default: 'pointer'
77
+ default: null
77
78
  }
78
79
  },
79
80
  data() {
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <Wrapper
3
+ :disabled="disabled"
4
+ :size="size"
5
+ :backgroundColor="backgroundColor"
6
+ :borderRadius="borderRadius"
7
+ :hoveredBackgroundColor="hoveredBackgroundColor"
8
+ :isHovered="isHovered"
9
+ >
10
+ <icon :disabled="disabled"
11
+ :size="iconSize"
12
+ :name="name"
13
+ :color="iconColor"
14
+ :hoveredColor="hoveredIconColor" />
15
+ <caret v-if="hasCaret">
16
+ <iconWrapper :disabled="disabled"
17
+ size="10px"
18
+ name="arrow_down"
19
+ :iconColor="iconColor"
20
+ :hoveredBackgroundColor="hoveredIconColor"
21
+ borderRadius="1px"
22
+ />
23
+ </caret>
24
+ </Wrapper>
25
+ </template>
26
+
27
+ <script>
28
+ // import Icon from "@eturnity/eturnity_reusable_components/src/components/icon"
29
+ // How to use:
30
+ //<icon
31
+ // name="House" //required. a svg file named [name].svg should be present in /assets/svgIcons
32
+ // color="red"
33
+ // hoveredColor="blue"
34
+ // size="60px" by default, this is 30px
35
+ // />
36
+
37
+ import styled from 'vue-styled-components'
38
+ import icon from '../icon'
39
+ const wrapperAttrs = { isHovered:Boolean,borderRadius:String,disabled: Boolean, size: String,backgroundColor:String,hoveredBackgroundColor:String }
40
+ const Wrapper = styled('div', wrapperAttrs)`
41
+ position:relative;
42
+ display: inline-flex;
43
+ width: ${(props) => props.size};
44
+ height: ${(props) => props.size};
45
+ justify-content:center;
46
+ align-items:center;
47
+ cursor: ${(props) => (props.disabled ? 'not-allowed' : 'pointer')};
48
+ background-color: ${(props)=>props.theme.colors[props.backgroundColor] || props.backgroundColor};
49
+ border-radius: ${(props) => props.borderRadius};
50
+ ${(props)=>(props.isHovered ? 'background-color:'+props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor : "")};
51
+ &:hover{
52
+ background-color:${(props)=>props.theme.colors[props.hoveredBackgroundColor] || props.hoveredBackgroundColor};
53
+ }
54
+ `
55
+ const caret=styled.div`
56
+ position:absolute;
57
+ bottom:3px;
58
+ right:2px;
59
+ height:10px;
60
+ `
61
+
62
+ export default {
63
+ name: 'iconWrapper',
64
+ components: {
65
+ Wrapper,
66
+ icon,
67
+ caret
68
+ },
69
+ props: {
70
+ disabled: {
71
+ required: false,
72
+ default: false
73
+ },
74
+ name: {
75
+ required: true
76
+ },
77
+ iconColor: {
78
+ required: false,
79
+ default: 'white'
80
+ },
81
+ hoveredIconColor: {
82
+ required: false
83
+ },
84
+ backgroundColor: {
85
+ required: false,
86
+ },
87
+ hoveredBackgroundColor: {
88
+ required: false,
89
+ default:"transparentWhite1"
90
+ },
91
+ size: {
92
+ required: false,
93
+ default: '32px'
94
+ },
95
+ iconSize:{
96
+ required: false,
97
+ default:'18px'
98
+ },
99
+ hasCaret:{
100
+ required: false,
101
+ default: false
102
+ },
103
+ borderRadius:{
104
+ required:false,
105
+ default:'6px'
106
+ },
107
+ isHovered:{
108
+ required:false,
109
+ default:false
110
+ }
111
+ },
112
+ data() {
113
+ return {}
114
+ }
115
+ }
116
+ </script>
@@ -1,7 +1,11 @@
1
1
  <template>
2
- <container :inputWidth="inputWidth">
2
+ <container :inputWidth="inputWidth" :alignItems="alignItems">
3
+ <label-slot-wrapper v-if="hasLabelSlot" :isInteractive="isInteractive" @mousedown="initInteraction">
4
+ <slot name="label"></slot>
5
+ </label-slot-wrapper>
6
+
3
7
  <label-wrapper v-if="labelText">
4
- <label-text>
8
+ <label-text :labelFontColor="labelFontColor">
5
9
  {{ labelText }}
6
10
  </label-text>
7
11
  <info-text
@@ -19,21 +23,24 @@
19
23
  :hasUnit="unitName && !!unitName.length"
20
24
  :placeholder="displayedPlaceholder"
21
25
  :isError="isError"
22
- :inputWidth="inputWidth"
23
26
  :inputHeight="inputHeight"
24
27
  :minWidth="minWidth"
25
28
  :value="formatWithCurrency(value)"
26
29
  @blur="onInputBlur($event)"
27
30
  @focus="focusInput()"
28
31
  @keyup.enter="$emit('on-enter-click')"
32
+ @input="onInput($event)"
29
33
  :disabled="disabled"
30
34
  :isDisabled="disabled"
31
35
  :noBorder="noBorder"
36
+ :borderColor="borderColor"
32
37
  :textAlign="textAlign"
33
38
  :fontSize="fontSize"
34
39
  :fontColor="fontColor"
40
+ :backgroundColor="backgroundColor"
35
41
  v-on="$listeners"
36
42
  :hasSlot="hasSlot"
43
+ :hasLabelSlot="hasLabelSlot"
37
44
  :slotSize="slotSize"
38
45
  />
39
46
  <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
@@ -101,14 +108,23 @@ const inputProps = {
101
108
  textAlign: String,
102
109
  fontSize: String,
103
110
  fontColor: String,
111
+ backgroundColor:String,
104
112
  hasSlot: Boolean,
113
+ hasLabelSlot: Boolean,
105
114
  slotSize: String,
106
- inputHeight: String
115
+ inputHeight:String,
116
+ isInteractive:Boolean,
117
+ alignItems:String,
118
+ labelFontColor:String,
119
+ borderColor:String
107
120
  }
108
121
 
109
122
  const Container = styled('div', inputProps)`
110
123
  width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
111
124
  position: relative;
125
+ display:grid;
126
+ grid-template-columns: ${(props) =>
127
+ props.alignItems === "vertical" ? "1fr" : "auto 1fr"};
112
128
  `
113
129
 
114
130
  const InputContainer = styled('input', inputProps)`
@@ -117,6 +133,10 @@ const InputContainer = styled('input', inputProps)`
117
133
  ? '1px solid ' + props.theme.colors.red
118
134
  : props.noBorder
119
135
  ? 'none'
136
+ : props.borderColor ?
137
+ props.theme.colors[props.borderColor]
138
+ ? '1px solid ' + props.theme.colors[props.borderColor]
139
+ : '1px solid ' + props.borderColor
120
140
  : '1px solid ' + props.theme.colors.grey4};
121
141
  padding-top: 11px;
122
142
  padding-bottom: 11px;
@@ -124,8 +144,6 @@ const InputContainer = styled('input', inputProps)`
124
144
  padding-right: ${(props) =>
125
145
  props.slotSize
126
146
  ? 'calc(' + props.slotSize + ' + 10px)'
127
- : props.hasUnit
128
- ? '40px'
129
147
  : '5px'};
130
148
  border-radius: 4px;
131
149
  text-align: ${(props) => props.textAlign};
@@ -139,7 +157,10 @@ const InputContainer = styled('input', inputProps)`
139
157
  : props.fontColor
140
158
  ? props.fontColor + ' !important'
141
159
  : props.theme.colors.black};
142
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
160
+ background-color:${(props) => props.backgroundColor
161
+ ? props.backgroundColor+' !important'
162
+ : props.theme.colors.white};
163
+ width: ${(props) => (props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%')};
143
164
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
144
165
  background-color: ${(props) =>
145
166
  props.isDisabled ? props.theme.colors.grey5 : '#fff'};
@@ -211,15 +232,22 @@ const SlotContainer = styled('span', inputProps)`
211
232
  : props.theme.colors.mediumGray};
212
233
  `
213
234
 
214
- const LabelWrapper = styled.div`
235
+ const LabelWrapper = styled('div',inputProps)`
215
236
  display: flex;
216
237
  gap: 10px;
217
238
  margin-bottom: 8px;
239
+ cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
240
+ `
241
+ const LabelSlotWrapper = styled('div',inputProps)`
242
+ display: flex;
243
+ gap: 10px;
244
+ align-items:center;
245
+ cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
218
246
  `
219
247
 
220
- const LabelText = styled.div`
248
+ const LabelText = styled('div',inputProps)`
221
249
  font-size: 13px;
222
- color: ${(props) => props.theme.colors.eturnityGrey};
250
+ color: ${(props) => props.theme.colors[props.labelFontColor]?props.theme.colors[props.labelFontColor]:props.labelFontColor};
223
251
  font-weight: 700;
224
252
  `
225
253
 
@@ -232,10 +260,11 @@ export default {
232
260
  UnitContainer,
233
261
  ErrorMessage,
234
262
  LabelWrapper,
263
+ LabelSlotWrapper,
235
264
  LabelText,
236
265
  InfoText,
237
266
  Icon,
238
- SlotContainer
267
+ SlotContainer,
239
268
  },
240
269
  inheritAttrs: false,
241
270
  data() {
@@ -274,6 +303,10 @@ export default {
274
303
  required: false,
275
304
  default: false
276
305
  },
306
+ alignItems: {
307
+ required: false,
308
+ default: "vertical",
309
+ },
277
310
  errorMessage: {
278
311
  required: false,
279
312
  default: 'Please insert a correct number'
@@ -298,6 +331,10 @@ export default {
298
331
  required: false,
299
332
  default: false
300
333
  },
334
+ borderColor:{
335
+ required:false,
336
+ default: false
337
+ },
301
338
  textAlign: {
302
339
  required: false,
303
340
  default: 'left'
@@ -306,6 +343,14 @@ export default {
306
343
  required: false,
307
344
  default: '13px'
308
345
  },
346
+ isInteractive: {
347
+ required: false,
348
+ default: false
349
+ },
350
+ interactionStep:{
351
+ required:false,
352
+ default:1
353
+ },
309
354
  labelText: {
310
355
  required: false,
311
356
  default: null
@@ -326,6 +371,10 @@ export default {
326
371
  required: false,
327
372
  default: null
328
373
  },
374
+ backgroundColor: {
375
+ required: false,
376
+ default: null
377
+ },
329
378
  numberToStringEnabled: {
330
379
  required: false,
331
380
  default: true
@@ -351,6 +400,10 @@ export default {
351
400
  },
352
401
  slotSize: {
353
402
  required: false
403
+ },
404
+ labelFontColor:{
405
+ required:false,
406
+ default:'eturnityGrey'
354
407
  }
355
408
  },
356
409
  computed: {
@@ -361,9 +414,9 @@ export default {
361
414
  hasSlot() {
362
415
  return !!this.$slots.default
363
416
  },
364
- computedSlotSize() {
365
- return this.slotSize || this.$slots['default'][0].elm.clientWidth
366
- }
417
+ hasLabelSlot(){
418
+ return !!this.$slots.label
419
+ },
367
420
  },
368
421
  methods: {
369
422
  onChangeHandler(event) {
@@ -412,6 +465,16 @@ export default {
412
465
  }
413
466
  return evaluated
414
467
  },
468
+ onInput(value){
469
+ let evaluatedVal
470
+ try{
471
+ evaluatedVal=this.onEvaluateCode(value)
472
+ }finally {
473
+ if(evaluatedVal){
474
+ this.$emit('on-input',evaluatedVal)
475
+ }
476
+ }
477
+ },
415
478
  onInputBlur(e) {
416
479
  this.isFocused = false
417
480
  let value = e.target.value
@@ -442,6 +505,15 @@ export default {
442
505
  })
443
506
  this.$emit('input-focus')
444
507
  },
508
+ blurInput() {
509
+ if (this.disabled) {
510
+ return
511
+ }
512
+ this.isFocused = false
513
+ this.$nextTick(() => {
514
+ this.$refs.inputField1.$el.blur()
515
+ })
516
+ },
445
517
  formatWithCurrency(value) {
446
518
  let adjustedMinValue =
447
519
  value || value === 0
@@ -469,7 +541,33 @@ export default {
469
541
  })
470
542
  : adjustedMinValue
471
543
  }
472
- }
544
+ },
545
+ initInteraction(e) {
546
+ window.addEventListener('mousemove', this.interact, false);
547
+ window.addEventListener('mouseup', this.stopInteract, false);
548
+ e.preventDefault()
549
+ this.focusInput()
550
+ },
551
+ interact(e) {
552
+ e.preventDefault()
553
+ let value=parseFloat(this.value || 0)
554
+ console.log("value",value)
555
+ value+=parseFloat(this.interactionStep)*parseInt(e.movementX)
556
+ this.$emit('on-input',value)
557
+
558
+ this.textInput=numberToString({
559
+ value:
560
+ value && value.length ? value : this.minNumber,
561
+ numberPrecision: this.numberPrecision
562
+ })
563
+ //this.value=value
564
+ },
565
+ stopInteract(e) {
566
+ e.preventDefault()
567
+ window.removeEventListener('mousemove', this.interact, false);
568
+ window.removeEventListener('mouseup', this.stopInteract, false);
569
+ this.blurInput()
570
+ },
473
571
  },
474
572
  created() {
475
573
  if (this.value) {