@eturnity/eturnity_reusable_components 1.2.20 → 1.2.22-EPDM-5202.0
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
|
@@ -48,9 +48,10 @@ const InputLabel = styled("div", labelAttrs)`
|
|
|
48
48
|
|
|
49
49
|
const LabelWrapper = styled.div`
|
|
50
50
|
display: inline-grid;
|
|
51
|
-
grid-template-columns: auto
|
|
51
|
+
grid-template-columns: auto auto;
|
|
52
52
|
grid-gap: 12px;
|
|
53
53
|
align-items: center;
|
|
54
|
+
justify-content: start;
|
|
54
55
|
`
|
|
55
56
|
|
|
56
57
|
const inputProps = {
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
@click.stop
|
|
11
11
|
:top="getItemLocation('top')"
|
|
12
12
|
:right="getItemLocation('right')"
|
|
13
|
-
:containerWidth="childOpen ?
|
|
13
|
+
:containerWidth="childOpen ? 440 : 240"
|
|
14
|
+
ref="dropdownContainer"
|
|
14
15
|
>
|
|
15
16
|
<loading-container v-if="isLoading">
|
|
16
17
|
<spinner />
|
|
@@ -26,13 +27,13 @@
|
|
|
26
27
|
@click.stop="
|
|
27
28
|
onSelect({
|
|
28
29
|
item: child,
|
|
29
|
-
hasChildren: hasChildren(child)
|
|
30
|
+
hasChildren: hasChildren(child)
|
|
30
31
|
})
|
|
31
32
|
"
|
|
32
33
|
@keyup.enter.stop="
|
|
33
34
|
onSelect({
|
|
34
35
|
item: child,
|
|
35
|
-
hasChildren: hasChildren(child)
|
|
36
|
+
hasChildren: hasChildren(child)
|
|
36
37
|
})
|
|
37
38
|
"
|
|
38
39
|
>
|
|
@@ -51,7 +52,10 @@
|
|
|
51
52
|
@mouseover="onItemHover({ index, item })"
|
|
52
53
|
:isDisabled="item.disabled"
|
|
53
54
|
>
|
|
54
|
-
<arrow-left
|
|
55
|
+
<arrow-left
|
|
56
|
+
:hasChildren="hasChildren(item)"
|
|
57
|
+
v-if="hasChildren(item)"
|
|
58
|
+
/>
|
|
55
59
|
<span>
|
|
56
60
|
{{ item.name }}
|
|
57
61
|
</span>
|
|
@@ -117,8 +121,8 @@
|
|
|
117
121
|
// },
|
|
118
122
|
// ],
|
|
119
123
|
|
|
120
|
-
import styled from
|
|
121
|
-
import Spinner from
|
|
124
|
+
import styled from 'vue-styled-components'
|
|
125
|
+
import Spinner from '../spinner'
|
|
122
126
|
|
|
123
127
|
const PageContainer = styled.div`
|
|
124
128
|
display: grid;
|
|
@@ -155,11 +159,11 @@ const DotItem = styled.div`
|
|
|
155
159
|
`
|
|
156
160
|
|
|
157
161
|
const dropdownAttrs = { top: Number, right: Number, containerWidth: Number }
|
|
158
|
-
const DropdownContainer = styled(
|
|
162
|
+
const DropdownContainer = styled('div', dropdownAttrs)`
|
|
159
163
|
z-index: 99;
|
|
160
164
|
height: 200px;
|
|
161
|
-
top: ${(props) => props.top +
|
|
162
|
-
left: ${(props) => props.right - props.containerWidth +
|
|
165
|
+
top: ${(props) => props.top + 'px'};
|
|
166
|
+
left: ${(props) => props.right - props.containerWidth + 'px'};
|
|
163
167
|
position: absolute;
|
|
164
168
|
display: grid;
|
|
165
169
|
grid-template-columns: auto auto;
|
|
@@ -180,19 +184,21 @@ const OptionsContainer = styled.div`
|
|
|
180
184
|
border: 1px solid ${(props) => props.theme.colors.grey3};
|
|
181
185
|
display: grid;
|
|
182
186
|
grid-template-columns: 1fr;
|
|
183
|
-
min-width:
|
|
187
|
+
min-width: 220px;
|
|
188
|
+
max-width: 220px;
|
|
184
189
|
width: max-content;
|
|
185
190
|
border-radius: 4px;
|
|
186
191
|
background-color: #fff;
|
|
187
192
|
max-height: 220px;
|
|
188
193
|
overflow: auto;
|
|
189
194
|
height: max-content;
|
|
195
|
+
white-space: normal;
|
|
190
196
|
`
|
|
191
197
|
|
|
192
198
|
const optionAttrs = { isDisabled: Boolean }
|
|
193
|
-
const OptionItem = styled(
|
|
199
|
+
const OptionItem = styled('div', optionAttrs)`
|
|
194
200
|
padding: 12px;
|
|
195
|
-
cursor: ${(props) => (props.isDisabled ?
|
|
201
|
+
cursor: ${(props) => (props.isDisabled ? 'not-allowed' : 'pointer')};
|
|
196
202
|
font-size: 13px;
|
|
197
203
|
position: relative;
|
|
198
204
|
|
|
@@ -222,7 +228,7 @@ const OptionChild = styled.div`
|
|
|
222
228
|
`
|
|
223
229
|
|
|
224
230
|
const arrowAttrs = { hasChildren: Boolean }
|
|
225
|
-
const ArrowLeft = styled(
|
|
231
|
+
const ArrowLeft = styled('span', arrowAttrs)`
|
|
226
232
|
border: solid #9f9f9f;
|
|
227
233
|
border-width: 0 1.5px 1.5px 0;
|
|
228
234
|
display: inline-block;
|
|
@@ -230,16 +236,18 @@ const ArrowLeft = styled("span", arrowAttrs)`
|
|
|
230
236
|
margin-bottom: 1px;
|
|
231
237
|
transform: rotate(135deg);
|
|
232
238
|
margin-right: 3px;
|
|
233
|
-
visibility: ${(props) => (props.hasChildren ?
|
|
239
|
+
visibility: ${(props) => (props.hasChildren ? 'visible' : 'hidden')};
|
|
234
240
|
`
|
|
235
241
|
|
|
236
242
|
const childAttrs = { isOpen: Boolean }
|
|
237
|
-
const ChildrenContainer = styled(
|
|
243
|
+
const ChildrenContainer = styled('div', childAttrs)`
|
|
238
244
|
border: ${(props) =>
|
|
239
|
-
props.isOpen ?
|
|
245
|
+
props.isOpen ? '1px solid' + props.theme.colors.grey3 : 'none'};
|
|
240
246
|
display: grid;
|
|
241
247
|
grid-template-columns: 1fr;
|
|
242
248
|
min-width: 200px;
|
|
249
|
+
max-width: 200px;
|
|
250
|
+
white-space: normal;
|
|
243
251
|
width: max-content;
|
|
244
252
|
border-radius: 4px;
|
|
245
253
|
background-color: #fff;
|
|
@@ -250,7 +258,7 @@ const ChildrenContainer = styled("div", childAttrs)`
|
|
|
250
258
|
`
|
|
251
259
|
|
|
252
260
|
export default {
|
|
253
|
-
name:
|
|
261
|
+
name: 'three-dots',
|
|
254
262
|
components: {
|
|
255
263
|
PageContainer,
|
|
256
264
|
ButtonContainer,
|
|
@@ -262,22 +270,23 @@ export default {
|
|
|
262
270
|
ArrowLeft,
|
|
263
271
|
DropdownContainer,
|
|
264
272
|
Spinner,
|
|
265
|
-
LoadingContainer
|
|
273
|
+
LoadingContainer
|
|
266
274
|
},
|
|
267
275
|
props: {
|
|
268
276
|
options: {
|
|
269
|
-
required: true
|
|
277
|
+
required: true
|
|
270
278
|
},
|
|
271
279
|
isLoading: {
|
|
272
280
|
required: false,
|
|
273
|
-
default: false
|
|
274
|
-
}
|
|
281
|
+
default: false
|
|
282
|
+
}
|
|
275
283
|
},
|
|
276
284
|
data() {
|
|
277
285
|
return {
|
|
278
286
|
isOpen: false,
|
|
279
287
|
hoverItem: null,
|
|
280
288
|
childOpen: null,
|
|
289
|
+
containerWidth: 16
|
|
281
290
|
}
|
|
282
291
|
},
|
|
283
292
|
methods: {
|
|
@@ -285,15 +294,15 @@ export default {
|
|
|
285
294
|
this.isOpen = !this.isOpen
|
|
286
295
|
|
|
287
296
|
if (this.isOpen) {
|
|
288
|
-
document.addEventListener(
|
|
297
|
+
document.addEventListener('click', this.clickOutside)
|
|
289
298
|
} else {
|
|
290
|
-
document.removeEventListener(
|
|
299
|
+
document.removeEventListener('click', this.clickOutside)
|
|
291
300
|
}
|
|
292
301
|
},
|
|
293
302
|
getItemLocation(value) {
|
|
294
303
|
let ref = this.$refs.dropdownItem
|
|
295
304
|
let location = ref.$el.getBoundingClientRect()[value]
|
|
296
|
-
if (value ===
|
|
305
|
+
if (value === 'top') {
|
|
297
306
|
location = location + window.scrollY
|
|
298
307
|
}
|
|
299
308
|
return location
|
|
@@ -310,7 +319,7 @@ export default {
|
|
|
310
319
|
if (hasChildren || item.disabled) {
|
|
311
320
|
return
|
|
312
321
|
}
|
|
313
|
-
this.$emit(
|
|
322
|
+
this.$emit('on-select', item)
|
|
314
323
|
this.isOpen = false
|
|
315
324
|
},
|
|
316
325
|
clickOutside(event) {
|
|
@@ -318,7 +327,7 @@ export default {
|
|
|
318
327
|
return
|
|
319
328
|
}
|
|
320
329
|
this.toggleButton()
|
|
321
|
-
}
|
|
322
|
-
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
323
332
|
}
|
|
324
333
|
</script>
|