@eturnity/eturnity_reusable_components 7.8.4 → 7.8.6

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.4",
3
+ "version": "7.8.6",
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>
@@ -46,7 +46,9 @@
46
46
  @keydown.native="onKeyDown"
47
47
  :showBorder="showBorder"
48
48
  :data-id="dataId"
49
- >
49
+ :isDraggable="isDraggable"
50
+ >
51
+ <draggableInputHandle v-if="isDraggable && !isSearchBarVisible" :height="selectHeight" />
50
52
  <inputText
51
53
  v-if="isSearchBarVisible"
52
54
  ref="searchInput"
@@ -141,6 +143,7 @@ import styled from 'vue-styled-components'
141
143
  import InfoText from '../../infoText'
142
144
  import icon from '../../icon'
143
145
  import inputText from '../inputText'
146
+ import draggableInputHandle from '../../draggableInputHandle'
144
147
 
145
148
  const Caret = styled.div`
146
149
  display: flex;
@@ -200,13 +203,14 @@ const selectButtonAttrs = {
200
203
  height: String,
201
204
  selectMinHeight: String,
202
205
  isSearchBarVisible: Boolean,
203
- showBorder: Boolean
206
+ showBorder: Boolean,
207
+ isDraggable: Boolean,
204
208
  }
205
209
  const selectButton = styled('div', selectButtonAttrs)`
206
210
  position: relative;
207
211
  box-sizing: border-box;
208
212
  border-radius: 4px;
209
- padding: ${(props) => (props.isSearchBarVisible ? '0' : '0px 0px 0 15px')};
213
+ padding-left:${(props) => (props.isSearchBarVisible ? '0' : props.isDraggable?'30px':'15px')};
210
214
  text-align: left;
211
215
  border-radius: 4px;
212
216
  min-height: ${(props) =>
@@ -236,6 +240,10 @@ const selectButton = styled('div', selectButtonAttrs)`
236
240
  ? props.theme.colors[props.fontColor]
237
241
  : props.fontColor};
238
242
  ${(props) => (props.disabled ? 'pointer-events: none' : '')};
243
+ overflow: hidden;
244
+ & >.handle{
245
+ border-right:${(props) =>props.hasError ? props.theme.colors.red : props.theme.colors.grey4} 1px solid;
246
+ }
239
247
  `
240
248
  const selectDropdownAttrs = {
241
249
  hoveredBgColor: String,
@@ -401,6 +409,10 @@ export default {
401
409
  dataId: {
402
410
  type: String,
403
411
  default: ''
412
+ },
413
+ isDraggable: {
414
+ type: Boolean,
415
+ default: false
404
416
  }
405
417
  },
406
418
 
@@ -418,7 +430,8 @@ export default {
418
430
  icon,
419
431
  Caret,
420
432
  Selector,
421
- inputText
433
+ inputText,
434
+ draggableInputHandle
422
435
  },
423
436
 
424
437
  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
  }