@eturnity/eturnity_reusable_components 1.2.21 → 1.2.22-3d-master.4

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 (32) hide show
  1. package/babel.config.js +1 -1
  2. package/package.json +2 -3
  3. package/src/App.vue +75 -53
  4. package/src/assets/icons/error_icon copy.png +0 -0
  5. package/src/assets/svgIcons/base_layer.svg +3 -0
  6. package/src/assets/svgIcons/{bookmaker.svg → duplicate-3.svg} +0 -0
  7. package/src/assets/svgIcons/map_icon.svg +1 -1
  8. package/src/assets/svgIcons/margin_tool.svg +6 -0
  9. package/src/assets/svgIcons/obstacle_tool.svg +7 -11
  10. package/src/assets/svgIcons/redo.svg +6 -0
  11. package/src/assets/svgIcons/roof_layer.svg +3 -0
  12. package/src/assets/svgIcons/undo.svg +6 -0
  13. package/src/assets/theme.js +2 -0
  14. package/src/components/errorMessage/index.vue +62 -0
  15. package/src/components/icon/index.vue +13 -21
  16. package/src/components/iconWrapper/index.vue +116 -0
  17. package/src/components/infoText/index.vue +68 -53
  18. package/src/components/inputs/inputNumber/index.vue +120 -25
  19. package/src/components/inputs/inputText/index.vue +12 -10
  20. package/src/components/inputs/radioButton/index.vue +39 -32
  21. package/src/components/inputs/searchInput/index.vue +1 -2
  22. package/src/components/inputs/textAreaInput/index.vue +7 -2
  23. package/src/components/inputs/toggle/index.vue +2 -2
  24. package/src/components/pageSubtitle/index.vue +4 -8
  25. package/src/components/pageTitle/index.vue +4 -12
  26. package/src/components/tables/mainTable/index.vue +3 -8
  27. package/src/components/threeDots/index.vue +27 -36
  28. package/src/helpers/numberConverter.js +5 -0
  29. package/src/main.js +0 -2
  30. package/src/assets/svgIcons/cross.svg +0 -4
  31. package/src/assets/svgIcons/transfer.svg +0 -4
  32. package/src/components/projectMarker/index.vue +0 -285
@@ -1,34 +1,25 @@
1
1
  <template>
2
2
  <component-wrapper>
3
- <icon-wrapper>
3
+ <icon-wrapper :size="size">
4
4
  <icon-img
5
5
  :isActive="showInfo"
6
6
  :size="size"
7
7
  :borderColor="borderColor"
8
8
  @click.prevent="toggleShowInfo()"
9
- @mouseenter="toggleShowInfo()"
10
- @mouseleave="toggleShowInfo()"
9
+ @mouseenter="openTrigger == 'onHover' ? toggleShowInfo() : ''"
10
+ @mouseleave="openTrigger == 'onHover' ? toggleShowInfo() : ''"
11
11
  >
12
- <svg
13
- class="img-icon"
14
- :width="size"
15
- :height="size"
16
- viewBox="0 0 24 24"
17
- fill="none"
18
- xmlns="http://www.w3.org/2000/svg"
19
- >
20
- <path
21
- class="img-icon"
22
- d="M20.4853 3.51469C18.2188 1.24823 15.2053 0 12 0C8.79469 0 5.78123 1.24823 3.51469 3.51469C1.24823 5.78123 0 8.79469 0 12C0 15.2053 1.24823 18.2188 3.51469 20.4853C5.78123 22.7518 8.79469 24 12 24C15.2053 24 18.2188 22.7518 20.4853 20.4853C22.7518 18.2188 24 15.2053 24 12C24 8.79469 22.7518 5.78123 20.4853 3.51469ZM12 3.28125C13.4216 3.28125 14.5781 4.4378 14.5781 5.85938C14.5781 7.28095 13.4216 8.4375 12 8.4375C10.5784 8.4375 9.42188 7.28095 9.42188 5.85938C9.42188 4.4378 10.5784 3.28125 12 3.28125ZM15.2812 19.6875H8.71875V18.2812H10.125V11.9167H8.71875V10.5104H13.875V18.2812H15.2812V19.6875Z"
23
- fill="#D5D5D5"
24
- />
25
- </svg>
12
+ <icon :size="size" name="info" :color="iconColor" />
26
13
  </icon-img>
27
14
  <text-overlay
28
15
  v-if="showInfo"
29
16
  :borderColor="borderColor"
30
17
  :alignText="alignText"
31
- >
18
+ :width="width"
19
+ :halfComputedTextInfoWidth="halfComputedTextInfoWidth"
20
+ :alignArrow="alignArrow"
21
+ :iconSize="size"
22
+ ><slot />
32
23
  {{ text }}
33
24
  </text-overlay>
34
25
  </icon-wrapper>
@@ -44,22 +35,23 @@
44
35
  // size="20"
45
36
  // alignText="right" // default is left
46
37
  // />
38
+ import theme from '../../assets/theme.js'
39
+ import styled from 'vue-styled-components'
40
+ import icon from '../icon'
47
41
 
48
- import styled from "vue-styled-components"
49
-
50
- const IconWrapper = styled.div`
51
- position: relative;
52
- `
53
-
54
- const textAttrs = { borderColor: String, alignText: String }
55
- const TextOverlay = styled("div", textAttrs)`
42
+ const textAttrs = { iconSize:String, borderColor: String, alignArrow:String, alignText: String, width:String,halfComputedTextInfoWidth:Number }
43
+ const TextOverlay = styled('div', textAttrs)`
56
44
  position: absolute;
57
- top: 26px;
58
- right: ${(props) => (props.alignText === "left" ? "-10px" : "inherit")};
59
- left: ${(props) => (props.alignText === "left" ? "inherit" : "-10px")};
45
+ top: ${(props) => 'calc('+props.iconSize+' + 15px)'};
46
+ ${(props) => (props.alignArrow === 'left'
47
+ ? 'left: calc('+props.iconSize+' /2 - 18px)'
48
+ : props.alignArrow === 'center'
49
+ ? 'left: calc((-'+props.width+' + '+props.iconSize+') /2 + 2px)'
50
+ : 'right: calc('+props.iconSize+' /2 - 17px)')};
51
+ text-align: ${(props) => props.alignText};
60
52
  background: ${(props) => props.theme.colors.black};
61
53
  padding: 10px;
62
- width: max-content;
54
+ width: ${(props) => props.width };
63
55
  max-width: 400px;
64
56
  font-size: 13px;
65
57
  font-weight: 400;
@@ -68,12 +60,13 @@ const TextOverlay = styled("div", textAttrs)`
68
60
  color: ${(props) => props.theme.colors.white};
69
61
 
70
62
  :before {
71
- content: "";
63
+ content: '';
72
64
  background-color: ${(props) => props.theme.colors.black};
73
65
  position: absolute;
74
66
  top: 2px;
75
- right: ${(props) => (props.alignText === "left" ? "-12px" : "inherit")};
76
- left: ${(props) => (props.alignText === "left" ? "inherit" : "40px")};
67
+ ${(props) => (props.alignArrow === 'left' ? 'left:40px;' :
68
+ props.alignArrow=='center' ? 'left: calc(50% + 19px);' :
69
+ 'right:-13px;')};
77
70
  height: 8px;
78
71
  width: 8px;
79
72
  transform-origin: center center;
@@ -82,18 +75,15 @@ const TextOverlay = styled("div", textAttrs)`
82
75
  `
83
76
 
84
77
  const iconAttrs = { isActive: Boolean, size: String, borderColor: String }
85
- const IconImg = styled("div", iconAttrs)`
86
- cursor: pointer;
87
- height: ${(props) => props.size + "px"};
88
78
 
89
- .img-icon {
90
- fill: ${(props) =>
91
- props.isActive
92
- ? props.borderColor
93
- ? props.borderColor
94
- : props.theme.colors.secondary
95
- : props.theme.colors.mediumGray};
96
- }
79
+ const IconWrapper = styled('div', iconAttrs)`
80
+ position: relative;
81
+ top: 1px;
82
+ height: ${(props) => props.size};
83
+ `
84
+ const IconImg = styled('div', iconAttrs)`
85
+ cursor: pointer;
86
+ height: ${(props) => props.size};
97
87
  `
98
88
 
99
89
  const ComponentWrapper = styled.div`
@@ -101,38 +91,51 @@ const ComponentWrapper = styled.div`
101
91
  `
102
92
 
103
93
  export default {
104
- name: "info-text",
94
+ name: 'info-text',
105
95
  components: {
106
96
  IconWrapper,
107
97
  TextOverlay,
108
98
  ComponentWrapper,
109
99
  IconImg,
100
+ icon
110
101
  },
111
102
  props: {
112
103
  text: {
113
- required: true,
104
+ required: false,
114
105
  },
115
106
  borderColor: {
116
107
  required: false,
117
- default: null,
108
+ default: null
118
109
  },
119
110
  size: {
120
111
  required: false,
121
- default: "20",
112
+ default: '14px'
122
113
  },
123
114
  alignText: {
124
115
  required: false,
125
- default: "left", // "left" or "right"
116
+ default: 'left' // "left" or "right"
117
+ },
118
+ alignArrow:{
119
+ required:false,
120
+ default:'center'
121
+ },
122
+ openTrigger:{
123
+ required:false,
124
+ default: 'onClick'
126
125
  },
126
+ width:{
127
+ required:false,
128
+ default:'165px'
129
+ }
127
130
  },
128
131
  methods: {
129
132
  toggleShowInfo() {
130
133
  this.showInfo = !this.showInfo
131
134
 
132
135
  if (this.showInfo) {
133
- document.addEventListener("click", this.clickOutside)
136
+ document.addEventListener('click', this.clickOutside)
134
137
  } else {
135
- document.removeEventListener("click", this.clickOutside)
138
+ document.removeEventListener('click', this.clickOutside)
136
139
  }
137
140
  },
138
141
  clickOutside(event) {
@@ -140,12 +143,24 @@ export default {
140
143
  return
141
144
  }
142
145
  this.toggleShowInfo()
143
- },
146
+ }
144
147
  },
145
148
  data() {
146
149
  return {
147
150
  showInfo: false,
148
151
  }
149
152
  },
153
+ computed: {
154
+ iconColor() {
155
+ return this.isActive
156
+ ? this.borderColor
157
+ ? this.borderColor
158
+ : theme.colors.secondary
159
+ : theme.colors.mediumGray
160
+ },
161
+ halfComputedTextInfoWidth() {
162
+ return parseInt(this.width)/2;
163
+ }
164
+ }
150
165
  }
151
- </script>
166
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <container>
2
+ <container :inputWidth="inputWidth">
3
3
  <label-wrapper v-if="labelText">
4
4
  <label-text>
5
5
  {{ labelText }}
@@ -8,17 +8,19 @@
8
8
  v-if="labelInfoText"
9
9
  :text="labelInfoText"
10
10
  borderColor="#ccc"
11
- size="13"
11
+ size="14px"
12
12
  :alignText="labelInfoAlign"
13
13
  />
14
14
  </label-wrapper>
15
15
  <input-wrapper>
16
16
  <input-container
17
+ v-bind="$attrs"
17
18
  ref="inputField1"
18
19
  :hasUnit="unitName && !!unitName.length"
19
- :placeholder="placeholder"
20
+ :placeholder="displayedPlaceholder"
20
21
  :isError="isError"
21
22
  :inputWidth="inputWidth"
23
+ :inputHeight="inputHeight"
22
24
  :minWidth="minWidth"
23
25
  :value="formatWithCurrency(value)"
24
26
  @blur="onInputBlur($event)"
@@ -30,13 +32,25 @@
30
32
  :textAlign="textAlign"
31
33
  :fontSize="fontSize"
32
34
  :fontColor="fontColor"
35
+ v-on="$listeners"
36
+ :hasSlot="hasSlot"
37
+ :slotSize="slotSize"
33
38
  />
39
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
40
+ <slot></slot>
41
+ </slot-container>
42
+
34
43
  <unit-container
35
- v-if="unitName && showLinearUnitName"
44
+ v-if="unitName && showLinearUnitName && !hasSlot"
36
45
  :hasLength="!!textInput.length"
37
46
  :isError="isError"
38
47
  >{{ unitName }}</unit-container
39
48
  >
49
+ <icon
50
+ v-if="(isError || inputIcon) && !showLinearUnitName"
51
+ :class="inputIconImageClass"
52
+ :src="isError ? warningIcon : inputIconImage"
53
+ />
40
54
  </input-wrapper>
41
55
  <error-message v-if="isError">{{ errorMessage }}</error-message>
42
56
  </container>
@@ -74,11 +88,8 @@ import {
74
88
  numberToString
75
89
  } from '../../../helpers/numberConverter'
76
90
  import InfoText from '../../infoText'
77
-
78
- const Container = styled.div`
79
- width: 100%;
80
- position: relative;
81
- `
91
+ import ErrorMessage from '../../errorMessage'
92
+ import warningIcon from '../../../assets/icons/error_icon.png'
82
93
 
83
94
  const inputProps = {
84
95
  isError: Boolean,
@@ -89,8 +100,17 @@ const inputProps = {
89
100
  noBorder: Boolean,
90
101
  textAlign: String,
91
102
  fontSize: String,
92
- fontColor: String
103
+ fontColor: String,
104
+ hasSlot: Boolean,
105
+ slotSize: String,
106
+ inputHeight:String
93
107
  }
108
+
109
+ const Container = styled('div', inputProps)`
110
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
111
+ position: relative;
112
+ `
113
+
94
114
  const InputContainer = styled('input', inputProps)`
95
115
  border: ${(props) =>
96
116
  props.isError
@@ -98,8 +118,15 @@ const InputContainer = styled('input', inputProps)`
98
118
  : props.noBorder
99
119
  ? 'none'
100
120
  : '1px solid ' + props.theme.colors.mediumGray};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
121
+ padding-top: 11px;
122
+ padding-bottom: 11px;
123
+ padding-left: 10px;
124
+ padding-right: ${(props) =>
125
+ props.slotSize
126
+ ? 'calc(' + props.slotSize + ' + 10px)'
127
+ : props.hasUnit
128
+ ? '40px'
129
+ : '5px'};
103
130
  border-radius: 4px;
104
131
  text-align: ${(props) => props.textAlign};
105
132
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -115,7 +142,7 @@ const InputContainer = styled('input', inputProps)`
115
142
  background-color: ${(props) =>
116
143
  props.isDisabled ? props.theme.colors.grey5 : '#fff'};
117
144
  box-sizing: border-box;
118
-
145
+ max-height: ${(props) => (props.inputHeight)};
119
146
  &::placeholder {
120
147
  color: ${(props) =>
121
148
  props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
@@ -125,6 +152,15 @@ const InputContainer = styled('input', inputProps)`
125
152
  outline: none;
126
153
  }
127
154
  `
155
+ const IconProps = {
156
+ inputIconHeight: String
157
+ }
158
+
159
+ const Icon = styled('img', IconProps)`
160
+ position: absolute;
161
+ right: 10px;
162
+ top: 2px;
163
+ `
128
164
 
129
165
  const InputWrapper = styled.span`
130
166
  position: relative;
@@ -142,6 +178,7 @@ const UnitContainer = styled('span', inputProps)`
142
178
  right: 10px;
143
179
  top: 0;
144
180
  padding-left: 10px;
181
+ text-align: right;
145
182
  color: ${(props) =>
146
183
  props.isError
147
184
  ? props.theme.colors.red
@@ -150,11 +187,27 @@ const UnitContainer = styled('span', inputProps)`
150
187
  : props.theme.colors.mediumGray};
151
188
  `
152
189
 
153
- const ErrorMessage = styled.div`
154
- font-size: 14px;
155
- color: ${(props) => props.theme.colors.red};
190
+ const SlotContainer = styled('span', inputProps)`
191
+ text-align: right;
192
+ border-left: 1px solid
193
+ ${(props) =>
194
+ props.isError
195
+ ? props.theme.colors.red
196
+ : props.hasLength
197
+ ? props.theme.colors.black
198
+ : props.theme.colors.mediumGray};
156
199
  position: absolute;
157
- top: calc(100% + 1px);
200
+ width: ${(props) =>
201
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
202
+ right: 10px;
203
+ top: 0;
204
+ padding-left: 10px;
205
+ color: ${(props) =>
206
+ props.isError
207
+ ? props.theme.colors.red
208
+ : props.hasLength
209
+ ? props.theme.colors.black
210
+ : props.theme.colors.mediumGray};
158
211
  `
159
212
 
160
213
  const LabelWrapper = styled.div`
@@ -178,12 +231,16 @@ export default {
178
231
  ErrorMessage,
179
232
  LabelWrapper,
180
233
  LabelText,
181
- InfoText
234
+ InfoText,
235
+ Icon,
236
+ SlotContainer
182
237
  },
238
+ inheritAttrs: false,
183
239
  data() {
184
240
  return {
185
241
  textInput: '',
186
- isFocused: false
242
+ isFocused: false,
243
+ warningIcon: warningIcon,
187
244
  }
188
245
  },
189
246
  props: {
@@ -203,6 +260,10 @@ export default {
203
260
  required: false,
204
261
  default: null
205
262
  },
263
+ inputHeight:{
264
+ required:false,
265
+ default:null
266
+ },
206
267
  value: {
207
268
  required: true,
208
269
  default: null
@@ -253,7 +314,7 @@ export default {
253
314
  },
254
315
  labelInfoAlign: {
255
316
  required: false,
256
- default: 'right'
317
+ default: 'left'
257
318
  },
258
319
  minNumber: {
259
320
  required: false,
@@ -266,11 +327,41 @@ export default {
266
327
  numberToStringEnabled: {
267
328
  required: false,
268
329
  default: true
330
+ },
331
+ inputIcon: {
332
+ require: false,
333
+ type: Boolean,
334
+ default: false
335
+ },
336
+ inputIconImage: {
337
+ require: false,
338
+ type: String,
339
+ default: ''
340
+ },
341
+ inputIconImageClass: {
342
+ require: false,
343
+ type: Array,
344
+ default: () => []
345
+ },
346
+ slotSize: {
347
+ required: false
348
+ }
349
+ },
350
+ computed: {
351
+ displayedPlaceholder() {
352
+ if (this.placeholder) return this.placeholder
353
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
354
+ },
355
+ hasSlot() {
356
+ return !!this.$slots.default
357
+ },
358
+ computedSlotSize() {
359
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
269
360
  }
270
361
  },
271
362
  methods: {
272
363
  onChangeHandler(event) {
273
- if (isNaN(event)) {
364
+ if (isNaN(event) || event=="") {
274
365
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
366
  }
276
367
  this.$emit('input-change', event)
@@ -305,6 +396,8 @@ export default {
305
396
  value: evaluated,
306
397
  numberPrecision: this.numberPrecision
307
398
  })
399
+ }else if(typeof evaluated === 'number'){
400
+ evaluated=evaluated.toFixed(this.numberPrecision)
308
401
  }
309
402
  return evaluated
310
403
  },
@@ -321,11 +414,11 @@ export default {
321
414
  })
322
415
  }
323
416
  let adjustedMinValue =
324
- value && value.length
325
- ? value
417
+ evaluatedInput && evaluatedInput.length
418
+ ? evaluatedInput
326
419
  : this.minNumber || this.minNumber === 0
327
420
  ? this.minNumber
328
- : ''
421
+ : ''
329
422
  this.$emit('input-blur', adjustedMinValue)
330
423
  },
331
424
  focusInput() {
@@ -336,6 +429,7 @@ export default {
336
429
  this.$nextTick(() => {
337
430
  this.$refs.inputField1.$el.select()
338
431
  })
432
+ this.$emit('input-focus')
339
433
  },
340
434
  formatWithCurrency(value) {
341
435
  let adjustedMinValue =
@@ -352,6 +446,7 @@ export default {
352
446
  })
353
447
  : adjustedMinValue
354
448
  let unit = this.showLinearUnitName ? '' : this.unitName
449
+ //return input + ' ' + unit
355
450
  return input + ' ' + unit
356
451
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
357
452
  return ''
@@ -387,4 +482,4 @@ export default {
387
482
  }
388
483
  }
389
484
  }
390
- </script>
485
+ </script>
@@ -10,10 +10,11 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- :size="fontSize ? fontSize : '16'"
13
+ :size="fontSize ? fontSize : '16px'"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
17
+ <input-error-wrapper>
17
18
  <input-container
18
19
  :placeholder="placeholder"
19
20
  :isError="isError"
@@ -26,20 +27,27 @@
26
27
  :isDisabled="disabled"
27
28
  :fontSize="fontSize"
28
29
  />
30
+ <error-message v-if="isError">{{ errorMessage }}</error-message>
31
+ </input-error-wrapper>
29
32
  </input-wrapper>
30
- <error-message v-if="isError">{{ errorMessage }}</error-message>
31
33
  </container>
32
34
  </template>
33
35
 
34
36
  <script>
35
37
  import styled from "vue-styled-components"
36
38
  import InfoText from "../../infoText"
39
+ import ErrorMessage from '../../errorMessage'
37
40
 
38
41
  const Container = styled.div`
39
42
  width: 100%;
40
43
  position: relative;
41
44
  `
42
-
45
+ const InputErrorWrapper = styled.div`
46
+ display: inline-grid;
47
+ grid-template-row: auto auto;
48
+ grid-gap: 0px;
49
+ align-items: center;
50
+ `
43
51
  const labelAttrs = { fontSize: String }
44
52
  const InputLabel = styled("div", labelAttrs)`
45
53
  font-weight: bold;
@@ -104,13 +112,6 @@ const InputWrapper = styled("div", inputAttrs)`
104
112
  props.alignItems === "vertical" || !props.hasLabel ? "1fr" : "auto 1fr"};
105
113
  `
106
114
 
107
- const ErrorMessage = styled.div`
108
- font-size: 14px;
109
- color: ${(props) => props.theme.colors.red};
110
- position: absolute;
111
- top: calc(100% + 1px);
112
- `
113
-
114
115
  export default {
115
116
  // import InputText from "@eturnity/eturnity_reusable_components/src/components/inputs/inputText"
116
117
  // To use:
@@ -136,6 +137,7 @@ export default {
136
137
  ErrorMessage,
137
138
  InfoText,
138
139
  InputLabel,
140
+ InputErrorWrapper,
139
141
  LabelWrapper,
140
142
  },
141
143
  props: {