@everchron/ec-shards 0.8.13 → 0.8.14
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/dist/ec-shards.common.js +71 -87
- package/dist/ec-shards.common.js.map +1 -1
- package/dist/ec-shards.css +1 -1
- package/dist/ec-shards.umd.js +71 -87
- package/dist/ec-shards.umd.js.map +1 -1
- package/dist/ec-shards.umd.min.js +2 -2
- package/dist/ec-shards.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/folder-selector/folder-selector.vue +131 -0
- package/src/components/input-search/input-search.vue +5 -0
- package/src/components/scroll-container/scroll-container.vue +34 -72
- package/src/stories/folder-selector/folder-selector.stories.js +40 -0
- package/src/stories/scroll-container/scroll-container.stories.js +10 -0
package/package.json
CHANGED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ecs-folder-selector" :class="[framed ? 'ecs-folder-selector-border' : '']" :style="{height: isFullHeight}">
|
|
3
|
+
<div v-if="searchable || create" class="ecs-folder-selector-header">
|
|
4
|
+
<ecs-input-search v-if="searchable" v-model="searchInputValue" @input="searchInput" type="naked" :show-clear="showClear" class="ecs-folder-selector-search" placeholder="Search for folders..." />
|
|
5
|
+
<ecs-button v-if="create" @click="handleAddFolder" icon="folder-new" size="sml" class="ecs-folder-selector-add">Add Folder</ecs-button>
|
|
6
|
+
</div>
|
|
7
|
+
<ecs-scroll-container :height="height" :padding="framed ? '8px' : '0'" borderless>
|
|
8
|
+
<!-- @slot Should always contain an EcsTreeList with the selectable options. -->
|
|
9
|
+
<slot v-if="$slots.default"></slot>
|
|
10
|
+
<div v-else class="empty-list">{{ emptyMessage }}</div>
|
|
11
|
+
</ecs-scroll-container>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import EcsInputSearch from '../input-search/input-search'
|
|
17
|
+
import EcsScrollContainer from '../scroll-container/scroll-container'
|
|
18
|
+
import EcsButton from '../button/button'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
components: {
|
|
22
|
+
EcsInputSearch,
|
|
23
|
+
EcsScrollContainer,
|
|
24
|
+
EcsButton
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
props: {
|
|
28
|
+
/** Determines if the folder selector control has a search bar to filter by folder name. */
|
|
29
|
+
searchable: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
/** Determines if the folder selector control has an Add Folder button to create a new folder on the fly. */
|
|
34
|
+
create: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
/** Determines if the folder selector should have a border and paddings. */
|
|
39
|
+
framed: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
/** Determines the maximum height of the scrollable area. Note: when `searchable` or `create` are set, the header bar adds around 40 pixels to the defined `height`. */
|
|
44
|
+
height: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: '100%'
|
|
47
|
+
},
|
|
48
|
+
emptyMessage: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'There are no folders in the Master File.'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
data () {
|
|
55
|
+
return {
|
|
56
|
+
searchInputValue: ''
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
computed: {
|
|
61
|
+
showClear() {
|
|
62
|
+
return this.searchInputValue.length > 0;
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
isFullHeight() {
|
|
66
|
+
if(this.height === '100%') {
|
|
67
|
+
return '100%'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
methods: {
|
|
73
|
+
searchInput(e) {
|
|
74
|
+
/** Emitted when the value of the search input is changed. Passes the current search input field value. */
|
|
75
|
+
this.$emit('search', this.searchInputValue)
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
handleAddFolder() {
|
|
79
|
+
/** Emitted on clicking the add folder button. */
|
|
80
|
+
this.$emit('add', $event)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<style lang="scss" scoped>
|
|
87
|
+
@import "../tokens/tokens";
|
|
88
|
+
@import "../mixins/svg-uri";
|
|
89
|
+
|
|
90
|
+
.ecs-folder-selector{
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
|
|
95
|
+
&-header{
|
|
96
|
+
display: flex;
|
|
97
|
+
align-content: center;
|
|
98
|
+
padding-top: 4px;
|
|
99
|
+
padding-bottom: 4px;
|
|
100
|
+
margin-bottom: 4px;
|
|
101
|
+
padding-right: 2px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&-search{
|
|
105
|
+
flex: 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-add{
|
|
109
|
+
margin-left: 16px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&-border{
|
|
113
|
+
border-radius: 6px;
|
|
114
|
+
border: 1px solid #D7DAE1;
|
|
115
|
+
|
|
116
|
+
.ecs-folder-selector-header{
|
|
117
|
+
padding-left: 8px;
|
|
118
|
+
padding-right: 8px;
|
|
119
|
+
margin: 0;
|
|
120
|
+
border-bottom: 1px solid #ECEDF2;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.empty-list{
|
|
125
|
+
padding: 8px 4px;
|
|
126
|
+
color: #858E9E;
|
|
127
|
+
font-size: 14px;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
131
|
+
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
</div>
|
|
2
|
+
<div class="ecs-scroll-container"
|
|
3
|
+
:style="{ maxHeight: height, padding: padding }"
|
|
4
|
+
:class="[borderless ? '' : 'ecs-scroll-container-border',
|
|
5
|
+
hideShadows ? '' : 'ecs-scroll-container-shadows']">
|
|
6
|
+
<slot></slot>
|
|
8
7
|
</div>
|
|
9
8
|
</template>
|
|
10
9
|
|
|
@@ -16,37 +15,21 @@
|
|
|
16
15
|
height: {
|
|
17
16
|
type: String,
|
|
18
17
|
default: "300px"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.isScrolledBottom = true
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
methods: {
|
|
39
|
-
onScroll ({ target: { scrollTop, clientHeight, scrollHeight }}) {
|
|
40
|
-
if (scrollTop + clientHeight >= scrollHeight) {
|
|
41
|
-
this.isScrolledBottom = true
|
|
42
|
-
} else {
|
|
43
|
-
this.isScrolledBottom = false
|
|
44
|
-
}
|
|
45
|
-
if (scrollTop == 0) {
|
|
46
|
-
this.isScrolledTop = true
|
|
47
|
-
} else {
|
|
48
|
-
this.isScrolledTop = false
|
|
49
|
-
}
|
|
18
|
+
},
|
|
19
|
+
/** Hides the shadows at the top and bottom on scroll. */
|
|
20
|
+
hideShadows: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
/** Hides the outer border of the scroll container. */
|
|
25
|
+
borderless: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
/** Inner padding of the scroll container, in pixels. */
|
|
30
|
+
padding: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: '8px'
|
|
50
33
|
}
|
|
51
34
|
}
|
|
52
35
|
}
|
|
@@ -57,46 +40,25 @@
|
|
|
57
40
|
@import "../mixins/svg-uri";
|
|
58
41
|
|
|
59
42
|
.ecs-scroll-container{
|
|
60
|
-
border-radius: 6px;
|
|
61
|
-
border: 1px solid $gray-4;
|
|
62
43
|
position: relative;
|
|
44
|
+
overflow: auto;
|
|
63
45
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
&:after{
|
|
71
|
-
content: "";
|
|
72
|
-
pointer-events: none;
|
|
73
|
-
position: absolute;
|
|
74
|
-
height: 10px;
|
|
75
|
-
width: 100%;
|
|
76
|
-
opacity: 1;
|
|
77
|
-
transition: .3s;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&:before{
|
|
81
|
-
top: 0;
|
|
82
|
-
left: 0;
|
|
83
|
-
border-radius: 6px 6px 0 0;
|
|
84
|
-
background-image: linear-gradient(180deg, rgba(53,63,82,0.07) 0%, rgba(53,63,82,0) 100%);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:after{
|
|
88
|
-
bottom: 0;
|
|
89
|
-
left: 0;
|
|
90
|
-
border-radius: 0 0 6px 6px;
|
|
91
|
-
background-image: linear-gradient(180deg, rgba(53,63,82,0) 0%, rgba(53,63,82,0.07) 100%);
|
|
92
|
-
}
|
|
46
|
+
&-shadows{
|
|
47
|
+
background:
|
|
48
|
+
linear-gradient(#FFF 30%, rgba(255, 255, 255, 0)),
|
|
49
|
+
linear-gradient(rgba(255, 255, 255, 0), #FFF 70%) 0 100%,
|
|
50
|
+
linear-gradient( 180deg,rgba(110, 116, 146, 0.07) 0%,rgba(110, 116, 146, 0) 100%),
|
|
51
|
+
linear-gradient(180deg,rgba(110, 116, 146, 0) 0%,rgba(110, 116, 146, 0.07) 100%) 0 100%;
|
|
93
52
|
|
|
94
|
-
|
|
95
|
-
|
|
53
|
+
background-color: #FFF;
|
|
54
|
+
background-repeat: no-repeat;
|
|
55
|
+
background-size: 100% 40px, 100% 40px, 100% 6px, 100% 6px;
|
|
56
|
+
background-attachment: local, local, scroll, scroll;
|
|
96
57
|
}
|
|
97
58
|
|
|
98
|
-
|
|
99
|
-
|
|
59
|
+
&-border{
|
|
60
|
+
border-radius: 6px;
|
|
61
|
+
border: 1px solid $gray-4;
|
|
100
62
|
}
|
|
101
63
|
}
|
|
102
64
|
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import EcsFolderSelector from '@components/folder-selector/folder-selector';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Input/Folder Selector',
|
|
5
|
+
component: EcsFolderSelector
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const folderSelector = () => ({
|
|
9
|
+
components: { EcsFolderSelector },
|
|
10
|
+
methods: {
|
|
11
|
+
searchValue(value) {
|
|
12
|
+
console.log(value)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
template: `<div style="height:400px">
|
|
16
|
+
<ecs-folder-selector framed searchable create @search="searchValue">
|
|
17
|
+
Folder Tree List Slot
|
|
18
|
+
</ecs-folder-selector>
|
|
19
|
+
</div>`,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const folderSelectorWithoutBorder = () => ({
|
|
23
|
+
components: { EcsFolderSelector },
|
|
24
|
+
template: `<ecs-folder-selector searchable create height="300px">
|
|
25
|
+
Folder Tree List Slot
|
|
26
|
+
</ecs-folder-selector>`,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const folderSelectorNoCreate = () => ({
|
|
30
|
+
components: { EcsFolderSelector },
|
|
31
|
+
template: `<ecs-folder-selector framed searchable height="300px">
|
|
32
|
+
Folder Tree List Slot
|
|
33
|
+
</ecs-folder-selector>`,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const folderSelectorEmptySlot = () => ({
|
|
37
|
+
components: { EcsFolderSelector },
|
|
38
|
+
template: `<ecs-folder-selector framed searchable height="300px">
|
|
39
|
+
</ecs-folder-selector>`,
|
|
40
|
+
});
|
|
@@ -9,3 +9,13 @@ export const scrollContainer = () => ({
|
|
|
9
9
|
components: { EcsScrollContainer },
|
|
10
10
|
template: `<ecs-scroll-container><div style="height:400px">content</div></ecs-scroll-container>`,
|
|
11
11
|
});
|
|
12
|
+
|
|
13
|
+
export const scrollContainerWithoutBorders = () => ({
|
|
14
|
+
components: { EcsScrollContainer },
|
|
15
|
+
template: `<ecs-scroll-container borderless><div style="height:400px">content</div></ecs-scroll-container>`,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const scrollContainerWithoutShadows = () => ({
|
|
19
|
+
components: { EcsScrollContainer },
|
|
20
|
+
template: `<ecs-scroll-container hide-shadows><div style="height:400px">content</div></ecs-scroll-container>`,
|
|
21
|
+
});
|