@eturnity/eturnity_reusable_components 7.8.5 → 7.8.6-EPDM-7779.3

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/.eslintrc ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "extends": ["plugin:prettier/recommended", "plugin:vue/essential"],
3
+
4
+ "plugins": ["prettier"],
5
+
6
+ "rules": {
7
+ "prettier/prettier": "error",
8
+ "vue/no-parsing-error": "off",
9
+ "vue/no-side-effects-in-computed-properties": "off",
10
+ "vue/invalid-first-character-of-tag-name": "off"
11
+ },
12
+
13
+ "parserOptions": {
14
+ "ecmaVersion": 6,
15
+ "parser": "babel-eslint",
16
+ "sourceType": "module"
17
+ }
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "7.8.5",
3
+ "version": "7.8.6-EPDM-7779.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
package/src/App.vue CHANGED
@@ -136,8 +136,7 @@ export default {
136
136
  iconCollection,
137
137
  dropdownComponent,
138
138
  videoThumbnail,
139
- icon
140
- // infoCard
139
+ icon,
141
140
  },
142
141
  data() {
143
142
  return {
@@ -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>
@@ -47,6 +47,7 @@
47
47
  :showBorder="showBorder"
48
48
  :data-id="dataId"
49
49
  >
50
+ <draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
50
51
  <inputText
51
52
  v-if="isSearchBarVisible"
52
53
  ref="searchInput"
@@ -63,7 +64,7 @@
63
64
  @input-change="searchChange"
64
65
  @click.native.stop
65
66
  />
66
- <selector v-else>
67
+ <selector :selectWidth="selectWidth" v-else>
67
68
  <slot name="selector" :selectedValue="selectedValue"></slot>
68
69
  </selector>
69
70
  <Caret @click.stop="toggleCaretDropdown">
@@ -141,21 +142,29 @@ import styled from 'vue-styled-components'
141
142
  import InfoText from '../../infoText'
142
143
  import icon from '../../icon'
143
144
  import inputText from '../inputText'
145
+ import draggableInputHandle from '../../draggableInputHandle'
146
+
147
+ const CARET_WIDTH = '30px'
148
+ const PADDING = this.isDraggable ? '30px' : '15px'
149
+ const BORDER_WIDTH = '1px'
144
150
 
145
151
  const Caret = styled.div`
146
152
  display: flex;
147
153
  align-items: center;
148
154
  justify-content: center;
149
- width: 30px;
150
- min-width: 30px;
155
+ width: ${CARET_WIDTH};
156
+ min-width: ${CARET_WIDTH};
151
157
  height: 100%;
152
- align-items: stretch
158
+ align-items: stretch;
153
159
  cursor: pointer;
154
160
  margin-left: auto;
155
161
  `
156
162
 
157
- const Selector = styled.div`
158
- width: 100%;
163
+ const Selector = styled('div', { selectWidth: String })`
164
+ max-width: ${(props) => `calc(${props.selectWidth} - (${CARET_WIDTH} + ${PADDING} + (${BORDER_WIDTH} * 2)))`};
165
+ white-space: nowrap;
166
+ text-overflow: ellipsis;
167
+ overflow: hidden;
159
168
  `
160
169
 
161
170
  const labelAttrs = { fontSize: String, fontColor: String }
@@ -164,7 +173,7 @@ const InputLabel = styled('div', labelAttrs)`
164
173
  props.theme.colors[props.fontColor]
165
174
  ? props.theme.colors[props.fontColor]
166
175
  : props.fontColor};
167
- font-size: ${(props) => (props.fontSize ? props.fontSize : '13px')};
176
+ font-size: ${(props) => props.fontSize};
168
177
  font-weight: 700;
169
178
  `
170
179
  const optionalLabel = styled.span`
@@ -172,7 +181,7 @@ const optionalLabel = styled.span`
172
181
  `
173
182
  const inputProps = { selectWidth: String, optionWidth: String }
174
183
  const Container = styled('div', inputProps)`
175
- width: ${(props) => (props.selectWidth ? props.selectWidth : '100%')};
184
+ width: ${(props) => props.selectWidth};
176
185
  position: relative;
177
186
  display: inline-block;
178
187
  `
@@ -206,9 +215,8 @@ const selectButton = styled('div', selectButtonAttrs)`
206
215
  position: relative;
207
216
  box-sizing: border-box;
208
217
  border-radius: 4px;
209
- padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
218
+ ${(props) => (props.isSearchBarVisible ? '' : `padding-left: ${PADDING}` )};
210
219
  text-align: left;
211
- border-radius: 4px;
212
220
  min-height: ${(props) =>
213
221
  props.selectHeight
214
222
  ? props.selectHeight
@@ -223,7 +231,7 @@ const selectButton = styled('div', selectButtonAttrs)`
223
231
  ${({ showBorder, theme, hasError }) =>
224
232
  showBorder &&
225
233
  `
226
- border:1px solid ${hasError ? theme.colors.red : theme.colors.grey4}
234
+ border: ${BORDER_WIDTH} solid ${hasError ? theme.colors.red : theme.colors.grey4}
227
235
  `}
228
236
  background-color:${(props) =>
229
237
  props.disabled
@@ -236,12 +244,15 @@ const selectButton = styled('div', selectButtonAttrs)`
236
244
  ? props.theme.colors[props.fontColor]
237
245
  : props.fontColor};
238
246
  ${(props) => (props.disabled ? 'pointer-events: none' : '')};
247
+ overflow: hidden;
248
+ & >.handle{
249
+ border-right:${(props) =>props.hasError ? props.theme.colors.red : props.theme.colors.grey4} 1px solid;
250
+ }
239
251
  `
240
252
  const selectDropdownAttrs = {
241
253
  hoveredBgColor: String,
242
254
  bgColor: String,
243
255
  fontColor: String,
244
- selectWidth: String,
245
256
  optionWidth: String,
246
257
  hoveredIndex: Number,
247
258
  hoveredValue: Number | String,
@@ -252,7 +263,7 @@ const selectDropdown = styled('div', selectDropdownAttrs)`
252
263
  z-index:${(props) => (props.isActive ? '2' : '1')};
253
264
  position:absolute;
254
265
  top:5px;
255
- border:1px solid ${(props) => props.theme.colors.grey4}
266
+ border: ${BORDER_WIDTH} solid ${(props) => props.theme.colors.grey4};
256
267
  border-radius:4px;
257
268
  display: flex;
258
269
  flex-direction: column;
@@ -299,7 +310,7 @@ export default {
299
310
  },
300
311
  fontSize: {
301
312
  required: false,
302
- default: null
313
+ default: '13px'
303
314
  },
304
315
  label: {
305
316
  required: false
@@ -319,8 +330,9 @@ export default {
319
330
  required: false
320
331
  },
321
332
  selectWidth: {
333
+ type: String,
322
334
  required: false,
323
- default: null
335
+ default: '100%'
324
336
  },
325
337
  selectHeight: {
326
338
  type: String,
@@ -401,6 +413,10 @@ export default {
401
413
  dataId: {
402
414
  type: String,
403
415
  default: ''
416
+ },
417
+ isDraggable: {
418
+ type: Boolean,
419
+ default: false
404
420
  }
405
421
  },
406
422
 
@@ -418,7 +434,8 @@ export default {
418
434
  icon,
419
435
  Caret,
420
436
  Selector,
421
- inputText
437
+ inputText,
438
+ draggableInputHandle
422
439
  },
423
440
 
424
441
  data() {
@@ -498,9 +515,6 @@ export default {
498
515
  }
499
516
  })
500
517
  },
501
- onSelectSlotClick() {
502
- this.toggleDropdown()
503
- },
504
518
  clickOutside(event) {
505
519
  const dropdownRef = this.$refs.dropdown
506
520
  // we need to prevent closing on selecting an option, because in the case of
@@ -546,26 +560,21 @@ export default {
546
560
  this.$refs.dropdown.$el.scrollTop = topPos
547
561
  }
548
562
  }
563
+ },
564
+ clearSearch() {
565
+ this.textSearch = ''
549
566
  }
550
567
  },
551
568
  computed: {
552
569
  optionLength() {
553
570
  if (this.isDropdownOpen) {
554
- // this filterRef is needed to check for the # of children on Filter dropdowns
555
- const filterRef =
556
- this.$refs.dropdown.$children &&
557
- this.$refs.dropdown.$children.length > 1
558
- ? this.$refs.dropdown.$children
559
- : this.$refs.dropdown.$children[0].$children
560
- ? this.$refs.dropdown.$children[0].$children
561
- : this.$refs.dropdown.$children
562
- return filterRef.length
563
- } else {
564
- return 0
571
+ return this.$refs.dropdown.$el.childElementCount
565
572
  }
573
+
574
+ return 0
566
575
  },
567
576
  isSearchBarVisible() {
568
- return this.isSearchable && this.optionLength >= 5 && this.isDropdownOpen
577
+ return this.isSearchable && this.isDropdownOpen
569
578
  }
570
579
  },
571
580
  watch: {
@@ -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>
@@ -5,7 +5,7 @@
5
5
  :class="{ visible: isOpen, hidden: !isOpen }"
6
6
  :backdrop="backdrop"
7
7
  >
8
- <modal-container @click.stop>
8
+ <modal-container @click="onClickModalContainer">
9
9
  <spinner v-if="isLoading" size="50px" :limitedToModal="true" />
10
10
  <content-container :visible="!isLoading">
11
11
  <slot />
@@ -26,7 +26,7 @@
26
26
  // import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
27
27
  // This is a more flexible modal box, where the parent can decide how the body of the modal looks
28
28
  // To use:
29
- // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true">
29
+ // <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :isLoading="true" :hideClose="true" :stopPropagation="false">
30
30
  // <div>Data....</div>
31
31
  // </modal>
32
32
 
@@ -151,6 +151,10 @@ export default {
151
151
  position: {
152
152
  required: false,
153
153
  default: 'fixed'
154
+ },
155
+ stopPropagation: {
156
+ type: Boolean,
157
+ default: true
154
158
  }
155
159
  },
156
160
  beforeDestroy() {
@@ -164,6 +168,11 @@ export default {
164
168
  if (key === 'Escape') {
165
169
  this.onCloseModal()
166
170
  }
171
+ },
172
+ onClickModalContainer(event) {
173
+ if (this.stopPropagation) {
174
+ event.stopPropagation()
175
+ }
167
176
  }
168
177
  },
169
178
  watch: {