@eturnity/eturnity_reusable_components 1.2.27 → 1.2.29-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 (41) hide show
  1. package/babel.config.js +1 -1
  2. package/package.json +1 -1
  3. package/src/App.vue +92 -33
  4. package/src/assets/icons/error_icon copy.png +0 -0
  5. package/src/assets/svgIcons/areas_tool.svg +14 -0
  6. package/src/assets/svgIcons/base_layer.svg +3 -0
  7. package/src/assets/svgIcons/direction_arrow.svg +4 -0
  8. package/src/assets/svgIcons/distance_tool.svg +8 -0
  9. package/src/assets/svgIcons/distort_tool.svg +10 -0
  10. package/src/assets/svgIcons/distort_tool2.svg +16 -0
  11. package/src/assets/svgIcons/draggable_corner.svg +5 -0
  12. package/src/assets/svgIcons/draw_tool.svg +3 -0
  13. package/src/assets/svgIcons/magic_tool.svg +6 -0
  14. package/src/assets/svgIcons/map_icon.svg +4 -2
  15. package/src/assets/svgIcons/map_settings.svg +3 -0
  16. package/src/assets/svgIcons/margin_tool.svg +4 -0
  17. package/src/assets/svgIcons/obstacle_tool.svg +7 -11
  18. package/src/assets/svgIcons/obstacle_tool_origin.svg +3 -0
  19. package/src/assets/svgIcons/opacity.svg +1 -0
  20. package/src/assets/svgIcons/outline_tool.svg +11 -0
  21. package/src/assets/svgIcons/redo.svg +6 -0
  22. package/src/assets/svgIcons/resizer.svg +5 -0
  23. package/src/assets/svgIcons/roof_layer.svg +3 -0
  24. package/src/assets/svgIcons/rotate_tool.svg +3 -0
  25. package/src/assets/svgIcons/ruler_tool.svg +3 -0
  26. package/src/assets/svgIcons/trim_tool.svg +4 -0
  27. package/src/assets/svgIcons/undo.svg +6 -0
  28. package/src/assets/svgIcons/vertical_tool.svg +3 -0
  29. package/src/assets/theme.js +2 -0
  30. package/src/components/errorMessage/index.vue +62 -0
  31. package/src/components/icon/index.vue +11 -10
  32. package/src/components/iconWrapper/index.vue +116 -0
  33. package/src/components/infoText/index.vue +68 -53
  34. package/src/components/inputs/inputNumber/index.vue +194 -29
  35. package/src/components/inputs/inputText/index.vue +13 -3
  36. package/src/components/inputs/radioButton/index.vue +1 -1
  37. package/src/components/inputs/textAreaInput/index.vue +7 -2
  38. package/src/components/inputs/toggle/index.vue +2 -2
  39. package/src/components/modals/modal/index.vue +7 -2
  40. package/src/components/pageSubtitle/index.vue +1 -1
  41. package/src/helpers/numberConverter.js +5 -0
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <container>
2
+ <container :inputWidth="inputWidth" :alignItems="alignItems">
3
+ <label-slot-wrapper v-if="hasLabelSlot" :isInteractive="isInteractive" @mousedown="initInteraction">
4
+
5
+ <slot name="label"></slot>
6
+ </label-slot-wrapper>
7
+
3
8
  <label-wrapper v-if="labelText">
4
9
  <label-text>
5
10
  {{ labelText }}
@@ -8,35 +13,51 @@
8
13
  v-if="labelInfoText"
9
14
  :text="labelInfoText"
10
15
  borderColor="#ccc"
11
- size="13"
16
+ size="14px"
12
17
  :alignText="labelInfoAlign"
13
18
  />
14
19
  </label-wrapper>
15
20
  <input-wrapper>
16
21
  <input-container
22
+ v-bind="$attrs"
17
23
  ref="inputField1"
18
24
  :hasUnit="unitName && !!unitName.length"
19
- :placeholder="placeholder"
25
+ :placeholder="displayedPlaceholder"
20
26
  :isError="isError"
21
- :inputWidth="inputWidth"
27
+ :inputHeight="inputHeight"
22
28
  :minWidth="minWidth"
23
29
  :value="formatWithCurrency(value)"
24
30
  @blur="onInputBlur($event)"
25
31
  @focus="focusInput()"
26
32
  @keyup.enter="$emit('on-enter-click')"
33
+ @input="onInput($event)"
27
34
  :disabled="disabled"
28
35
  :isDisabled="disabled"
29
36
  :noBorder="noBorder"
30
37
  :textAlign="textAlign"
31
38
  :fontSize="fontSize"
32
39
  :fontColor="fontColor"
40
+ :backgroundColor="backgroundColor"
41
+ v-on="$listeners"
42
+ :hasSlot="hasSlot"
43
+ :hasLabelSlot="hasLabelSlot"
44
+ :slotSize="slotSize"
33
45
  />
46
+ <slot-container v-if="hasSlot" :slotSize="slotSize" :isError="isError">
47
+ <slot></slot>
48
+ </slot-container>
49
+
34
50
  <unit-container
35
- v-if="unitName && showLinearUnitName"
51
+ v-if="unitName && showLinearUnitName && !hasSlot"
36
52
  :hasLength="!!textInput.length"
37
53
  :isError="isError"
38
54
  >{{ unitName }}</unit-container
39
55
  >
56
+ <icon
57
+ v-if="(isError || inputIcon) && !showLinearUnitName"
58
+ :class="inputIconImageClass"
59
+ :src="isError ? warningIcon : inputIconImage"
60
+ />
40
61
  </input-wrapper>
41
62
  <error-message v-if="isError">{{ errorMessage }}</error-message>
42
63
  </container>
@@ -74,11 +95,8 @@ import {
74
95
  numberToString
75
96
  } from '../../../helpers/numberConverter'
76
97
  import InfoText from '../../infoText'
77
-
78
- const Container = styled.div`
79
- width: 100%;
80
- position: relative;
81
- `
98
+ import ErrorMessage from '../../errorMessage'
99
+ import warningIcon from '../../../assets/icons/error_icon.png'
82
100
 
83
101
  const inputProps = {
84
102
  isError: Boolean,
@@ -89,8 +107,24 @@ const inputProps = {
89
107
  noBorder: Boolean,
90
108
  textAlign: String,
91
109
  fontSize: String,
92
- fontColor: String
110
+ fontColor: String,
111
+ backgroundColor:String,
112
+ hasSlot: Boolean,
113
+ hasLabelSlot: Boolean,
114
+ slotSize: String,
115
+ inputHeight:String,
116
+ isInteractive:Boolean,
117
+ alignItems:String
93
118
  }
119
+
120
+ const Container = styled('div', inputProps)`
121
+ width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
122
+ position: relative;
123
+ display:grid;
124
+ grid-template-columns: ${(props) =>
125
+ props.alignItems === "vertical" ? "1fr" : "auto 1fr"};
126
+ `
127
+
94
128
  const InputContainer = styled('input', inputProps)`
95
129
  border: ${(props) =>
96
130
  props.isError
@@ -98,8 +132,13 @@ const InputContainer = styled('input', inputProps)`
98
132
  : props.noBorder
99
133
  ? 'none'
100
134
  : '1px solid ' + props.theme.colors.mediumGray};
101
- padding: ${(props) =>
102
- props.hasUnit ? '11px 40px 11px 10px' : '11px 5px 11px 10px'};
135
+ padding-top: 11px;
136
+ padding-bottom: 11px;
137
+ padding-left: 10px;
138
+ padding-right: ${(props) =>
139
+ props.slotSize
140
+ ? 'calc(' + props.slotSize + ' + 10px)'
141
+ : '5px'};
103
142
  border-radius: 4px;
104
143
  text-align: ${(props) => props.textAlign};
105
144
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'auto')};
@@ -110,12 +149,15 @@ const InputContainer = styled('input', inputProps)`
110
149
  : props.fontColor
111
150
  ? props.fontColor + ' !important'
112
151
  : props.theme.colors.black};
113
- width: ${(props) => (props.inputWidth ? props.inputWidth : '100%')};
152
+ background-color:${(props) => props.backgroundColor
153
+ ? props.backgroundColor+' !important'
154
+ : props.theme.colors.white};
155
+ width: ${(props) => (props.inputWidth && !props.hasLabelSlot ? props.inputWidth : '100%')};
114
156
  min-width: ${(props) => (props.minWidth ? props.minWidth : 'unset')};
115
157
  background-color: ${(props) =>
116
158
  props.isDisabled ? props.theme.colors.grey5 : '#fff'};
117
159
  box-sizing: border-box;
118
-
160
+ max-height: ${(props) => (props.inputHeight)};
119
161
  &::placeholder {
120
162
  color: ${(props) =>
121
163
  props.isError ? props.theme.colors.red : props.theme.colors.darkGray};
@@ -125,6 +167,15 @@ const InputContainer = styled('input', inputProps)`
125
167
  outline: none;
126
168
  }
127
169
  `
170
+ const IconProps = {
171
+ inputIconHeight: String
172
+ }
173
+
174
+ const Icon = styled('img', IconProps)`
175
+ position: absolute;
176
+ right: 10px;
177
+ top: 2px;
178
+ `
128
179
 
129
180
  const InputWrapper = styled.span`
130
181
  position: relative;
@@ -142,6 +193,7 @@ const UnitContainer = styled('span', inputProps)`
142
193
  right: 10px;
143
194
  top: 0;
144
195
  padding-left: 10px;
196
+ text-align: right;
145
197
  color: ${(props) =>
146
198
  props.isError
147
199
  ? props.theme.colors.red
@@ -150,17 +202,40 @@ const UnitContainer = styled('span', inputProps)`
150
202
  : props.theme.colors.mediumGray};
151
203
  `
152
204
 
153
- const ErrorMessage = styled.div`
154
- font-size: 14px;
155
- color: ${(props) => props.theme.colors.red};
205
+ const SlotContainer = styled('span', inputProps)`
206
+ text-align: right;
207
+ border-left: 1px solid
208
+ ${(props) =>
209
+ props.isError
210
+ ? props.theme.colors.red
211
+ : props.hasLength
212
+ ? props.theme.colors.black
213
+ : props.theme.colors.mediumGray};
156
214
  position: absolute;
157
- top: calc(100% + 1px);
215
+ width: ${(props) =>
216
+ props.slotSize ? 'calc(' + props.slotSize + ' - 10px)' : 'fit-content'};
217
+ right: 10px;
218
+ top: 0;
219
+ padding-left: 10px;
220
+ color: ${(props) =>
221
+ props.isError
222
+ ? props.theme.colors.red
223
+ : props.hasLength
224
+ ? props.theme.colors.black
225
+ : props.theme.colors.mediumGray};
158
226
  `
159
227
 
160
- const LabelWrapper = styled.div`
228
+ const LabelWrapper = styled('div',inputProps)`
161
229
  display: flex;
162
230
  gap: 10px;
163
231
  margin-bottom: 8px;
232
+ cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
233
+ `
234
+ const LabelSlotWrapper = styled('div',inputProps)`
235
+ display: flex;
236
+ gap: 10px;
237
+ align-items:center;
238
+ cursor: ${(props) => (props.isInteractive?'ew-resize':'auto')};
164
239
  `
165
240
 
166
241
  const LabelText = styled.div`
@@ -177,13 +252,18 @@ export default {
177
252
  UnitContainer,
178
253
  ErrorMessage,
179
254
  LabelWrapper,
255
+ LabelSlotWrapper,
180
256
  LabelText,
181
- InfoText
257
+ InfoText,
258
+ Icon,
259
+ SlotContainer,
182
260
  },
261
+ inheritAttrs: false,
183
262
  data() {
184
263
  return {
185
264
  textInput: '',
186
- isFocused: false
265
+ isFocused: false,
266
+ warningIcon: warningIcon,
187
267
  }
188
268
  },
189
269
  props: {
@@ -203,6 +283,10 @@ export default {
203
283
  required: false,
204
284
  default: null
205
285
  },
286
+ inputHeight:{
287
+ required:false,
288
+ default:null
289
+ },
206
290
  value: {
207
291
  required: true,
208
292
  default: null
@@ -211,6 +295,10 @@ export default {
211
295
  required: false,
212
296
  default: false
213
297
  },
298
+ alignItems: {
299
+ required: false,
300
+ default: "vertical",
301
+ },
214
302
  errorMessage: {
215
303
  required: false,
216
304
  default: 'Please insert a correct number'
@@ -243,6 +331,14 @@ export default {
243
331
  required: false,
244
332
  default: '13px'
245
333
  },
334
+ isInteractive: {
335
+ required: false,
336
+ default: false
337
+ },
338
+ interactionStep:{
339
+ required:false,
340
+ default:1
341
+ },
246
342
  labelText: {
247
343
  required: false,
248
344
  default: null
@@ -253,7 +349,7 @@ export default {
253
349
  },
254
350
  labelInfoAlign: {
255
351
  required: false,
256
- default: 'right'
352
+ default: 'left'
257
353
  },
258
354
  minNumber: {
259
355
  required: false,
@@ -263,14 +359,51 @@ export default {
263
359
  required: false,
264
360
  default: null
265
361
  },
362
+ backgroundColor: {
363
+ required: false,
364
+ default: null
365
+ },
266
366
  numberToStringEnabled: {
267
367
  required: false,
268
368
  default: true
369
+ },
370
+ inputIcon: {
371
+ require: false,
372
+ type: Boolean,
373
+ default: false
374
+ },
375
+ inputIconImage: {
376
+ require: false,
377
+ type: String,
378
+ default: ''
379
+ },
380
+ inputIconImageClass: {
381
+ require: false,
382
+ type: Array,
383
+ default: () => []
384
+ },
385
+ slotSize: {
386
+ required: false
387
+ }
388
+ },
389
+ computed: {
390
+ displayedPlaceholder() {
391
+ if (this.placeholder) return this.placeholder
392
+ return `${this.minNumber || 0} ${this.unitName ? this.unitName : ''}`
393
+ },
394
+ hasSlot() {
395
+ return !!this.$slots.default
396
+ },
397
+ hasLabelSlot(){
398
+ return !!this.$slots.label
399
+ },
400
+ computedSlotSize() {
401
+ return this.slotSize || this.$slots['default'][0].elm.clientWidth
269
402
  }
270
403
  },
271
404
  methods: {
272
405
  onChangeHandler(event) {
273
- if (isNaN(event)) {
406
+ if (isNaN(event) || event=="") {
274
407
  event = this.minNumber || this.minNumber === 0 ? this.minNumber : event
275
408
  }
276
409
  this.$emit('input-change', event)
@@ -305,9 +438,15 @@ export default {
305
438
  value: evaluated,
306
439
  numberPrecision: this.numberPrecision
307
440
  })
441
+ }else if(typeof evaluated === 'number'){
442
+ evaluated=evaluated.toFixed(this.numberPrecision)
308
443
  }
309
444
  return evaluated
310
445
  },
446
+ onInput(value){
447
+ let evaluatedInput = this.onEvaluateCode(value)
448
+ this.$emit('on-input',evaluatedInput)
449
+ },
311
450
  onInputBlur(e) {
312
451
  this.isFocused = false
313
452
  let value = e.target.value
@@ -321,11 +460,11 @@ export default {
321
460
  })
322
461
  }
323
462
  let adjustedMinValue =
324
- value && value.length
325
- ? value
463
+ evaluatedInput && evaluatedInput.length
464
+ ? evaluatedInput
326
465
  : this.minNumber || this.minNumber === 0
327
466
  ? this.minNumber
328
- : ''
467
+ : ''
329
468
  this.$emit('input-blur', adjustedMinValue)
330
469
  },
331
470
  focusInput() {
@@ -336,6 +475,7 @@ export default {
336
475
  this.$nextTick(() => {
337
476
  this.$refs.inputField1.$el.select()
338
477
  })
478
+ this.$emit('input-focus')
339
479
  },
340
480
  formatWithCurrency(value) {
341
481
  let adjustedMinValue =
@@ -352,6 +492,7 @@ export default {
352
492
  })
353
493
  : adjustedMinValue
354
494
  let unit = this.showLinearUnitName ? '' : this.unitName
495
+ //return input + ' ' + unit
355
496
  return input + ' ' + unit
356
497
  } else if (!adjustedMinValue && adjustedMinValue !== 0) {
357
498
  return ''
@@ -363,7 +504,31 @@ export default {
363
504
  })
364
505
  : adjustedMinValue
365
506
  }
366
- }
507
+ },
508
+ initInteraction(e) {
509
+ window.addEventListener('mousemove', this.interact, false);
510
+ window.addEventListener('mouseup', this.stopInteract, false);
511
+ e.preventDefault()
512
+ },
513
+ interact(e) {
514
+ e.preventDefault()
515
+ let value=parseInt(this.value || 0)
516
+
517
+ value+=parseFloat(this.interactionStep)*parseInt(e.movementX)
518
+ this.$emit('on-input',value)
519
+
520
+ this.textInput=numberToString({
521
+ value:
522
+ value && value.length ? value : this.minNumber,
523
+ numberPrecision: this.numberPrecision
524
+ })
525
+ //this.value=value
526
+ },
527
+ stopInteract(e) {
528
+ e.preventDefault()
529
+ window.removeEventListener('mousemove', this.interact, false);
530
+ window.removeEventListener('mouseup', this.stopInteract, false);
531
+ },
367
532
  },
368
533
  created() {
369
534
  if (this.value) {
@@ -387,4 +552,4 @@ export default {
387
552
  }
388
553
  }
389
554
  }
390
- </script>
555
+ </script>
@@ -10,7 +10,7 @@
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>
@@ -22,6 +22,7 @@
22
22
  :minWidth="minWidth"
23
23
  :value="value"
24
24
  @input="onChangeHandler"
25
+ @blur="onInputBlur"
25
26
  :noBorder="noBorder"
26
27
  :disabled="disabled"
27
28
  :isDisabled="disabled"
@@ -41,7 +42,6 @@
41
42
  </icon-wrapper>
42
43
  </icon-container>
43
44
  </input-wrapper>
44
- <error-message v-if="isError">{{ errorMessage }}</error-message>
45
45
  </container>
46
46
  </template>
47
47
 
@@ -54,7 +54,12 @@ const Container = styled.div`
54
54
  width: 100%;
55
55
  position: relative;
56
56
  `
57
-
57
+ const InputErrorWrapper = styled.div`
58
+ display: inline-grid;
59
+ grid-template-row: auto auto;
60
+ grid-gap: 0px;
61
+ align-items: center;
62
+ `
58
63
  const labelAttrs = { fontSize: String }
59
64
  const InputLabel = styled('div', labelAttrs)`
60
65
  font-weight: bold;
@@ -154,6 +159,7 @@ export default {
154
159
  // placeholder="Company name"
155
160
  // :value="companyName"
156
161
  // @input-change="onInputChange({ value: $event, type: 'companyName' })"
162
+ // @input-blur="onInputBlur($event)"
157
163
  // :isError="checkErrors()"
158
164
  // :errorMessage="This is my error message"
159
165
  // infoTextAlign="right" // left by default
@@ -172,6 +178,7 @@ export default {
172
178
  ErrorMessage,
173
179
  InfoText,
174
180
  InputLabel,
181
+ InputErrorWrapper,
175
182
  LabelWrapper,
176
183
  Icon,
177
184
  IconWrapper,
@@ -241,6 +248,9 @@ export default {
241
248
  onChangeHandler($event) {
242
249
  this.$emit('input-change', $event)
243
250
  },
251
+ onInputBlur($event) {
252
+ this.$emit('input-blur', $event.target.value)
253
+ },
244
254
  toggleShowPassword() {
245
255
  this.inputTypeData =
246
256
  this.inputTypeData === 'password' ? 'text' : 'password'
@@ -12,7 +12,7 @@
12
12
  />
13
13
  <span class="checkmark"></span>
14
14
  <label-text :isDisabled="item.disabled">{{ item.label }}</label-text>
15
- <info-text v-if="item.infoText" :text="item.infoText" size="16" />
15
+ <info-text v-if="item.infoText" :text="item.infoText" size="16px" />
16
16
  </label-container>
17
17
  <image-container v-if="item.img">
18
18
  <radio-image :src="item.img" />
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="16"
13
+ size="16px"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-wrapper>
@@ -23,6 +23,7 @@
23
23
  :disabled="isDisabled"
24
24
  :fontSize="fontSize"
25
25
  @input="onChangeHandler"
26
+ :resize="resize"
26
27
  />
27
28
  </input-wrapper>
28
29
  <error-message v-if="isError && errorText">{{ errorText }}</error-message>
@@ -174,7 +175,11 @@ export default {
174
175
  },
175
176
  inputWidth: {
176
177
  required: false,
177
- default: null
178
+ default: null,
179
+ },
180
+ resize:{
181
+ required:false,
182
+ default: "none"
178
183
  }
179
184
  },
180
185
  methods: {
@@ -10,7 +10,7 @@
10
10
  v-if="infoTextMessage"
11
11
  :text="infoTextMessage"
12
12
  borderColor="#ccc"
13
- size="14"
13
+ size="14px"
14
14
  :alignText="infoTextAlign"
15
15
  />
16
16
  </label-container>
@@ -46,7 +46,7 @@
46
46
  v-if="infoTextMessage"
47
47
  :text="infoTextMessage"
48
48
  borderColor="#ccc"
49
- size="14"
49
+ size="14px"
50
50
  :alignText="infoTextAlign"
51
51
  />
52
52
  </label-container>
@@ -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: fixed;
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: {
@@ -6,7 +6,7 @@
6
6
  <info-text
7
7
  :text="infoText"
8
8
  v-if="!!infoText"
9
- size="14"
9
+ size="14px"
10
10
  borderColor="#ccc"
11
11
  :alignText="alignInfoText"
12
12
  />
@@ -4,6 +4,9 @@ export const stringToNumber = ({
4
4
  allowNegative
5
5
  }) => {
6
6
  // This is for saving. It converts our input string to a readable number
7
+ if (value === undefined) {
8
+ value = ''
9
+ }
7
10
  let newVal = value.toString()
8
11
  const selectedLang = localStorage.getItem('lang')
9
12
  // The first replace will replace not allowed characters with a blank
@@ -91,6 +94,8 @@ export const numberToString = ({ value, numberPrecision }) => {
91
94
  ? 'fr-fr'
92
95
  : localStorage.getItem('lang')
93
96
  : 'en-US'
97
+ if(selectedLang=="null"){selectedLang='en-US'}
98
+ value=parseFloat(value)
94
99
  return value.toLocaleString(selectedLang, {
95
100
  minimumFractionDigits: numberPrecision,
96
101
  maximumFractionDigits: numberPrecision