@eturnity/eturnity_reusable_components 7.4.4-EPDM-7260.2 → 7.4.4-EPDM-7260.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.4.4-EPDM-7260.2",
3
+ "version": "7.4.4-EPDM-7260.4",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -111,6 +111,7 @@ import iconCollection from '@/components/icon/iconCollection'
111
111
  import dropdownComponent from '@/components/dropdown'
112
112
  import videoThumbnail from '@/components/videoThumbnail'
113
113
  import icon from '@/components/icon'
114
+ // import infoCard from '@/components/infoCard'
114
115
  // import TableDropdown from "@/components/tableDropdown"
115
116
 
116
117
  const PageContainer = styled.div`
@@ -135,7 +136,7 @@ export default {
135
136
  iconCollection,
136
137
  dropdownComponent,
137
138
  videoThumbnail,
138
- icon
139
+ icon,
139
140
  },
140
141
  data() {
141
142
  return {
@@ -0,0 +1,3 @@
1
+ <svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.173 4.517L15.242 7.586L15.656 8L15.676 8L15.676 8.02L16.656 9L15.676 9.98L15.676 10L15.656 10L15.242 10.414L12.173 13.483L10.759 12.069L12.827 10L4.676 10L4.676 8L12.827 8L10.758 5.931L12.173 4.517ZM-6.99382e-07 2L-8.74228e-08 16L0 18L2 18L7 18L7 16L2 16L2 2L7 2L7 -3.0598e-07L2 -8.74228e-08L-7.86805e-07 0L-6.99382e-07 2Z" fill="#263238"/>
3
+ </svg>
@@ -13,6 +13,7 @@ const theme = {
13
13
  blue: '#48a2d0',
14
14
  red: '#ff5656',
15
15
  blue1: '#e4efff',
16
+ brightBlue: '#0068DE',
16
17
  grey1: '#666',
17
18
  grey2: '#c4c4c4',
18
19
  grey3: '#b2b9c5',
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <Handle :height = "height" class="handle">
3
+ <Dot></Dot>
4
+ <Dot></Dot>
5
+ <Dot></Dot>
6
+ </Handle>
7
+ </template>
8
+
9
+ <script>
10
+
11
+ import styled from 'vue-styled-components'
12
+
13
+ const Handle = styled('div',{ height : String })`
14
+ position:absolute;
15
+ left:0;
16
+ margin-right:10px;
17
+ display: flex;
18
+ align-items: stretch;
19
+ flex-direction: column;
20
+ justify-content: center;
21
+ width: 14px;
22
+ height:${props=> props.height};
23
+ padding: 0 5px;
24
+ background-color: #f3f3f7;
25
+ cursor: pointer;
26
+ align-items: center;
27
+ `
28
+ const Dot = styled.div`
29
+ display: inline-block;
30
+ width: 4px;
31
+ height: 4px;
32
+ margin:2px;
33
+ background-color: #0068de;
34
+ `
35
+
36
+ export default {
37
+ name: 'draggableInputHandle',
38
+ props:['height'],
39
+ components: {
40
+ Handle,
41
+ Dot
42
+ },
43
+ data() {
44
+ return {}
45
+ }
46
+ }
47
+ </script>
@@ -1,38 +1,36 @@
1
1
  <template>
2
- <info-container>
3
- <icon name="info" size="24px" />
4
- <InfoTextContainer>
5
- <slot />
6
- </InfoTextContainer>
7
- </info-container>
2
+ <info-container>
3
+ <icon name="info" size="24px" />
4
+ <text-container>
5
+ <slot />
6
+ </text-container>
7
+ </info-container>
8
8
  </template>
9
-
9
+
10
10
  <script>
11
11
  import styled from 'vue-styled-components'
12
- import icon from '../icon'
13
- const InfoContainer = styled('div')`
12
+ import Icon from '../icon'
13
+
14
+ const InfoContainer = styled.div`
14
15
  display: flex;
15
- align-items: flex-start;
16
16
  gap: 15px;
17
17
  padding: 20px;
18
- width: 500px;
19
- min-width: 450px;
20
- border: 1px dashed #dee2eb;
18
+ border: 1px dashed ${(props) => props.theme.colors.grey4};
21
19
  border-radius: 4px;
22
- margin:20px 0;
23
20
  `
24
21
 
25
- const InfoTextContainer = styled('div')`
22
+ const TextContainer = styled.div`
26
23
  font-size: 13px;
24
+ width: 100%;
27
25
  `
28
26
 
29
27
 
30
28
  export default {
31
- components:{
32
- icon,
33
- InfoTextContainer,
34
- InfoContainer
35
- },
36
- props:[]
29
+ name: 'InfoCard',
30
+ components: {
31
+ Icon,
32
+ InfoContainer,
33
+ TextContainer
34
+ }
37
35
  }
38
36
  </script>
@@ -58,6 +58,7 @@ const TextOverlay = styled('div', textAttrs)`
58
58
  max-width: 400px;
59
59
  font-size: 13px;
60
60
  font-weight: 400;
61
+ line-height: normal;
61
62
  border-radius: 4px;
62
63
  z-index: 99;
63
64
  color: ${(props) => props.theme.colors.white};
@@ -49,7 +49,9 @@
49
49
  @keydown.native="onKeyDown"
50
50
  :showBorder="showBorder"
51
51
  :data-id="dataId"
52
- >
52
+ :isDraggable="isDraggable"
53
+ >
54
+ <draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
53
55
  <inputText
54
56
  v-if="isSearchBarVisible"
55
57
  ref="searchInput"
@@ -145,6 +147,7 @@ import styled from 'vue-styled-components'
145
147
  import InfoText from '../../infoText'
146
148
  import icon from '../../icon'
147
149
  import inputText from '../inputText'
150
+ import draggableInputHandle from '../../draggableInputHandle'
148
151
 
149
152
  const Caret = styled.div`
150
153
  display: flex;
@@ -215,13 +218,14 @@ const selectButtonAttrs = {
215
218
  height: String,
216
219
  selectMinHeight: String,
217
220
  isSearchBarVisible: Boolean,
218
- showBorder: Boolean
221
+ showBorder: Boolean,
222
+ isDraggable: Boolean,
219
223
  }
220
224
  const selectButton = styled('div', selectButtonAttrs)`
221
225
  position: relative;
222
226
  box-sizing: border-box;
223
227
  border-radius: 4px;
224
- padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 10px')};
228
+ padding-left:${(props) => (props.isSearchBarVisible ? '0' : props.isDraggable?'30px':'15px')};
225
229
  text-align: left;
226
230
  border-radius: 4px;
227
231
  min-height: ${(props) =>
@@ -251,6 +255,10 @@ const selectButton = styled('div', selectButtonAttrs)`
251
255
  ? props.theme.colors[props.fontColor]
252
256
  : props.fontColor};
253
257
  ${(props) => (props.disabled ? 'pointer-events: none' : '')};
258
+ overflow: hidden;
259
+ & >.handle{
260
+ border-right:${(props) =>props.hasError ? props.theme.colors.red : props.theme.colors.grey4} 1px solid;
261
+ }
254
262
  `
255
263
  const selectDropdownAttrs = {
256
264
  hoveredBgColor: String,
@@ -428,6 +436,10 @@ export default {
428
436
  dataId: {
429
437
  type: String,
430
438
  default: ''
439
+ },
440
+ isDraggable: {
441
+ type: Boolean,
442
+ default: false
431
443
  }
432
444
  },
433
445
 
@@ -445,7 +457,8 @@ export default {
445
457
  icon,
446
458
  Caret,
447
459
  Selector,
448
- inputText
460
+ inputText,
461
+ draggableInputHandle
449
462
  },
450
463
 
451
464
  data() {
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <label-wrapper
3
+ :labelAlign="labelAlign">
4
+ <input-label
5
+ :labelFontColor="labelFontColor"
6
+ :fontSize="fontSize"
7
+ >
8
+ <slot></slot>
9
+ <optionalLabel v-if="labelOptional"
10
+ >({{ $gettext('Optional') }})</optionalLabel
11
+ ></input-label
12
+ >
13
+ <info-text
14
+ v-if="infoTextMessage"
15
+ :text="infoTextMessage"
16
+ borderColor="#ccc"
17
+ :size="fontSize ? fontSize : '16px'"
18
+ :alignArrow="infoTextAlign"
19
+ />
20
+ </label-wrapper>
21
+ </template>
22
+
23
+ <script>
24
+ import styled from 'vue-styled-components'
25
+ import InfoText from '../infoText'
26
+
27
+
28
+ const labelAttrs = { fontSize: String, labelFontColor: String }
29
+ const InputLabel = styled('div', labelAttrs)`
30
+ color: ${(props) =>
31
+ props.theme.colors[props.labelFontColor]
32
+ ? props.theme.colors[props.labelFontColor]
33
+ : props.labelFontColor
34
+ ? props.labelFontColor
35
+ : props.theme.colors.eturnityGrey};
36
+
37
+ font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
38
+ font-weight: 700;
39
+ `
40
+ const optionalLabel = styled.span`
41
+ font-weight: 300;
42
+ `
43
+
44
+ const LabelWrapper = styled('div',{labelAlign:String})`
45
+ ${props=>props.labelAlign=='horizontal'?
46
+ 'display: inline-grid;':
47
+ 'display: grid;'
48
+ }
49
+ ${props=>props.labelAlign=='horizontal'?
50
+ 'margin-right: 10px;':
51
+ 'margin-bottom: 8px;'
52
+ }
53
+ vertical-align: center;
54
+ grid-template-columns: auto auto;
55
+ grid-gap: 12px;
56
+ align-items: center;
57
+ justify-content: start;
58
+ `
59
+ export default {
60
+ // import labelText from "@eturnity/eturnity_reusable_components/src/components/label"
61
+ // To use:
62
+ // <label-text
63
+ // infoTextAlign="right" // left by default
64
+ // infoTextMessage="My info message"
65
+ // label="Question 5"
66
+ // />
67
+ name: 'input-text',
68
+ components: {
69
+ InfoText,
70
+ InputLabel,
71
+ LabelWrapper,
72
+ optionalLabel
73
+ },
74
+ data() {
75
+ return {
76
+ inputTypeData: 'text'
77
+ }
78
+ },
79
+ props: {
80
+ infoTextMessage: {
81
+ required: false
82
+ },
83
+ infoTextAlign: {
84
+ required: false
85
+ },
86
+ labelOptional: {
87
+ required: false,
88
+ default: false
89
+ },
90
+ fontSize: {
91
+ required: false,
92
+ default: null
93
+ },
94
+ labelFontColor: {
95
+ required: false,
96
+ default: 'black'
97
+ },
98
+ labelAlign: {
99
+ required: false,
100
+ default: 'vertical'
101
+ },
102
+ },
103
+ }
104
+ </script>
@@ -3,7 +3,6 @@
3
3
  :position="position"
4
4
  :isOpen="isOpen"
5
5
  :class="{ visible: isOpen, hidden: !isOpen }"
6
- @click.native="onOutsideClose()"
7
6
  :backdrop="backdrop"
8
7
  >
9
8
  <modal-container @click.stop>
@@ -27,7 +26,7 @@
27
26
  // import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
28
27
  // This is a more flexible modal box, where the parent can decide how the body of the modal looks
29
28
  // To use:
30
- // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
29
+ // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
31
30
  // <div>Data....</div>
32
31
  // </modal>
33
32
 
@@ -137,10 +136,6 @@ export default {
137
136
  required: true,
138
137
  default: false
139
138
  },
140
- preventOutsideClose: {
141
- required: false,
142
- default: false
143
- },
144
139
  isLoading: {
145
140
  required: false,
146
141
  default: false
@@ -158,20 +153,30 @@ export default {
158
153
  default: 'fixed'
159
154
  }
160
155
  },
156
+ beforeDestroy() {
157
+ window.removeEventListener('keydown', this.handleKeyDown)
158
+ },
161
159
  methods: {
162
160
  onCloseModal() {
163
161
  this.$emit('on-close')
164
162
  },
165
- onOutsideClose() {
166
- // If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
167
- if (!this.preventOutsideClose) {
168
- this.$emit('on-close')
163
+ handleKeyDown({ key }) {
164
+ if (key === 'Escape') {
165
+ this.onCloseModal()
169
166
  }
170
167
  }
171
168
  },
172
169
  watch: {
173
- isOpen: function (newVal) {
174
- document.body.style.overflow = newVal ? 'hidden' : ''
170
+ isOpen: {
171
+ immediate: true,
172
+ handler(isOpen) {
173
+ document.body.style.overflow = isOpen ? 'hidden' : ''
174
+ if (isOpen) {
175
+ window.addEventListener('keydown', this.handleKeyDown)
176
+ } else {
177
+ window.removeEventListener('keydown', this.handleKeyDown)
178
+ }
179
+ }
175
180
  }
176
181
  }
177
182
  }
@@ -7,7 +7,11 @@
7
7
  @click="fetchPage(paginationParams.previous)"
8
8
  >
9
9
  <arrowIconContainer>
10
- <icon name="arrow_left" color="#0068de" size="12px" />
10
+ <icon
11
+ name="arrow_left"
12
+ :color="getTheme.colors.brightBlue"
13
+ size="12px"
14
+ />
11
15
  </arrowIconContainer>
12
16
  <arrowText>{{ $gettext('back') }}</arrowText>
13
17
  </paginationLink>
@@ -55,7 +59,11 @@
55
59
  >
56
60
  <arrowText>{{ $gettext('forward') }}</arrowText>
57
61
  <arrowIconContainer>
58
- <icon name="arrow_right" color="#0068de" size="12px" />
62
+ <icon
63
+ name="arrow_right"
64
+ :color="getTheme.colors.brightBlue"
65
+ size="12px"
66
+ />
59
67
  </arrowIconContainer>
60
68
  </paginationLink>
61
69
  </paginationWrapper>
@@ -64,8 +72,10 @@
64
72
  <script>
65
73
  import styled from 'vue-styled-components'
66
74
  import icon from '../icon'
75
+ import theme from '@/assets/theme.js'
76
+
67
77
  const paginationWrapper = styled.nav`
68
- color: #0068de;
78
+ color: ${(props) => props.theme.brightBlue};
69
79
  font-size: 13px;
70
80
  display: flex;
71
81
  flex-wrap: wrap;
@@ -85,7 +95,7 @@ const paginationLink = styled.div`
85
95
 
86
96
  &.active {
87
97
  color: #fff;
88
- background-color: #0068de;
98
+ background-color: ${(props) => props.theme.brightBlue};
89
99
  padding: 7px 12px;
90
100
  border-radius: 4px;
91
101
  }
@@ -106,6 +116,11 @@ export default {
106
116
  arrowIconContainer
107
117
  },
108
118
  props: ['fetchPage', 'currentPage', 'paginationParams'],
119
+ computed: {
120
+ getTheme() {
121
+ return theme
122
+ }
123
+ },
109
124
  methods: {
110
125
  getNewProjects(num) {
111
126
  this.$emit('on-pagination-change', num)
@@ -179,8 +179,8 @@ export default {
179
179
  this.parentWidth = parentWidth
180
180
  this.parentHeight = parentHeight
181
181
 
182
- this.left = this.min * this.stepCount
183
- this.right = this.max * this.stepCount
182
+ this.left = this.min * this.pxPerStep
183
+ this.right = this.max * this.pxPerStep
184
184
  this.width = computeWidth(this.left, this.right)
185
185
  this.height = this.h !== 'auto' ? this.h : parentHeight
186
186
 
@@ -467,7 +467,7 @@ export default {
467
467
  removeEvent(document.documentElement, eventsFor.move, this.handleResize)
468
468
  },
469
469
  roundToNearestStep(value) {
470
- const val = value / this.stepCount
470
+ const val = value / this.pxPerStep
471
471
 
472
472
  const int = 1.0 / this.step
473
473
  return (Math.floor(val * int) / int).toFixed(2)
@@ -490,8 +490,11 @@ export default {
490
490
 
491
491
  return this.handles
492
492
  },
493
+ pxPerStep() {
494
+ return this.parentWidth / this.stepCount
495
+ },
493
496
  minWidthByPx() {
494
- return this.minWidth * this.stepCount
497
+ return this.minWidth * this.pxPerStep
495
498
  },
496
499
  computedWidth() {
497
500
  if (this.width === 'auto') {
@@ -473,16 +473,6 @@ export default {
473
473
  // Remove the global click event listener to prevent memory leaks
474
474
  document.removeEventListener('click', this.handleOutsideClick)
475
475
  document.removeEventListener('keydown', this.onKeyDownDelete)
476
- },
477
- mounted() {
478
- // TODO: remove
479
- // this.tariffItems.forEach((item) => {
480
- // item.tariff_time_mfr.forEach((tariff) => {
481
- // tariff.time_to = '12:00:00'
482
- // tariff.time_up_to = '12:00:00'
483
- // })
484
- // })
485
- console.log('mounted tariffItems', this.tariffItems)
486
476
  }
487
477
  }
488
478
  </script>
@@ -10,7 +10,7 @@
10
10
  ref="tableRef"
11
11
  :isPositionAbsolute="doesTableContainDraggables"
12
12
  >
13
- <table-wrapper :fullWidth="fullWidth">
13
+ <table-wrapper class="main-table-wrapper" :fullWidth="fullWidth">
14
14
  <spinner-wrapper v-if="isLoading">
15
15
  <spinner />
16
16
  </spinner-wrapper>
@@ -72,7 +72,7 @@ const TableWrapper = styled('div', wrapperAttrs)`
72
72
  overflow-y: hidden;
73
73
 
74
74
  ::-webkit-scrollbar {
75
- height: 5px; //height of the whole scrollbar area
75
+ height: 10px; //height of the whole scrollbar area
76
76
  }
77
77
 
78
78
  ::-webkit-scrollbar-track {
@@ -81,7 +81,7 @@ const TableWrapper = styled('div', wrapperAttrs)`
81
81
  }
82
82
 
83
83
  ::-webkit-scrollbar-thumb {
84
- border-bottom: 5px solid ${(props) => props.theme.colors.purple}; // width of the actual scrollbar
84
+ border-bottom: 10px solid ${(props) => props.theme.colors.brightBlue}; // width of the actual scrollbar
85
85
  border-radius: 4px;
86
86
  }
87
87
  `
@@ -42,10 +42,11 @@
42
42
  {{ child.name }}
43
43
  </option-child>
44
44
  </children-container>
45
- <options-container v-if="!isLoading">
45
+ <options-container v-if="!isLoading" :textWrap="textWrap">
46
46
  <option-item
47
47
  v-for="(item, index) in options"
48
48
  :key="item.value"
49
+ :data-id="item.dataId"
49
50
  tabindex="0"
50
51
  @click.stop="
51
52
  onSelect({ item: item, hasChildren: hasChildren(item) })
@@ -55,6 +56,7 @@
55
56
  "
56
57
  @mouseover="onItemHover({ index, item })"
57
58
  :isDisabled="item.disabled"
59
+ :title="item.title"
58
60
  >
59
61
  <arrow-left
60
62
  :hasChildren="hasChildren(item)"
@@ -74,9 +76,10 @@
74
76
  // import ThreeDots from "@eturnity/eturnity_reusable_components/src/components/threeDots"
75
77
  // To use:
76
78
  // <three-dots
79
+ // :isLoading="true"
77
80
  // :options="listOptions"
81
+ // @on-click="onClick($event)"
78
82
  // @on-select="onSelect($event)"
79
- // :isLoading="true"
80
83
  // />
81
84
  // options to pass:
82
85
  // listOptions: [
@@ -189,19 +192,18 @@ const LoadingContainer = styled.div`
189
192
  background: #fff;
190
193
  `
191
194
 
192
- const OptionsContainer = styled.div`
195
+ const OptionsContainerAttrs = { textWrap: Boolean }
196
+ const OptionsContainer = styled('div', OptionsContainerAttrs)`
193
197
  border: 1px solid ${(props) => props.theme.colors.grey3};
194
198
  display: grid;
195
199
  grid-template-columns: 1fr;
196
- min-width: 220px;
197
- max-width: 220px;
198
- width: max-content;
200
+ ${(props) => props.textWrap ? 'width: 220px' : 'width: max-content' };
199
201
  border-radius: 4px;
200
202
  background-color: #fff;
201
203
  max-height: 220px;
202
204
  overflow: auto;
203
205
  height: max-content;
204
- white-space: normal;
206
+ ${(props) => props.textWrap ? 'white-space: normal' : 'white-space: nowrap'};
205
207
  `
206
208
 
207
209
  const optionAttrs = { isDisabled: Boolean }
@@ -210,6 +212,8 @@ const OptionItem = styled('div', optionAttrs)`
210
212
  cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
211
213
  font-size: 13px;
212
214
  position: relative;
215
+ ${(props) => (props.isDisabled ? `background-color: ${ props.theme.colors.grey5 }!important` : '')};
216
+ ${(props) => (props.isDisabled ? `color: ${ props.theme.colors.grey2 }` : '')};
213
217
 
214
218
  &:hover {
215
219
  background-color: #ebeef4;
@@ -291,6 +295,10 @@ export default {
291
295
  isLoading: {
292
296
  required: false,
293
297
  default: false
298
+ },
299
+ textWrap: {
300
+ required: false,
301
+ default: true
294
302
  }
295
303
  },
296
304
  data() {
@@ -382,6 +390,7 @@ export default {
382
390
  },
383
391
  onSelect({ item, hasChildren }) {
384
392
  if (hasChildren || item.disabled) {
393
+ this.$emit('on-click', item)
385
394
  return
386
395
  }
387
396
  this.$emit('on-select', item)