@everchron/ec-shards 4.4.2 → 5.0.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/dist/ec-shards.common.js +783 -754
- package/dist/ec-shards.common.js.map +1 -1
- package/dist/ec-shards.css +1 -1
- package/dist/ec-shards.umd.js +783 -754
- 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/context-menu/context-menu.vue +5 -15
- package/src/components/pagination/pagination.vue +140 -133
- package/src/stories/context-menu/context-menu.stories.js +1 -2
- package/src/stories/pagination/pagination.stories.js +30 -0
package/package.json
CHANGED
|
@@ -48,16 +48,6 @@ export default {
|
|
|
48
48
|
/** If passed, an icon will appear. The list of available icon names can be found [here](https://github.com/everchron/ec-shards/tree/main/src/assets/icons). */
|
|
49
49
|
icon: {
|
|
50
50
|
type: String
|
|
51
|
-
},
|
|
52
|
-
/** Use the offset of the context menu appears in a scrollable container which does not start at the very top of the browser window. For example, pass the pixel height value of the everchron navigation bar and toolbar. */
|
|
53
|
-
offsetTop: {
|
|
54
|
-
type: Number,
|
|
55
|
-
default: 0
|
|
56
|
-
},
|
|
57
|
-
/** Use the offset of the context menu appears in a scrollable container which does not start at the very left of the browser window. For example, pass the pixel width value of a left hand sidebar. */
|
|
58
|
-
offsetLeft: {
|
|
59
|
-
type: Number,
|
|
60
|
-
default: 0
|
|
61
51
|
}
|
|
62
52
|
},
|
|
63
53
|
|
|
@@ -96,15 +86,15 @@ export default {
|
|
|
96
86
|
}
|
|
97
87
|
|
|
98
88
|
if (this.menuWidth + event.pageX >= window.innerWidth) {
|
|
99
|
-
this.left = event.pageX - this.menuWidth + 2
|
|
89
|
+
this.left = event.pageX - this.menuWidth + 2
|
|
100
90
|
} else {
|
|
101
|
-
this.left = event.pageX - 2
|
|
91
|
+
this.left = event.pageX - 2
|
|
102
92
|
}
|
|
103
93
|
|
|
104
94
|
if (this.menuHeight + event.pageY >= window.innerHeight) {
|
|
105
|
-
this.top = event.pageY - this.menuHeight + 2
|
|
95
|
+
this.top = event.pageY - this.menuHeight + 2
|
|
106
96
|
} else {
|
|
107
|
-
this.top = event.pageY - 2
|
|
97
|
+
this.top = event.pageY - 2
|
|
108
98
|
}
|
|
109
99
|
this.opened = true
|
|
110
100
|
},
|
|
@@ -160,7 +150,7 @@ export default {
|
|
|
160
150
|
padding: 0;
|
|
161
151
|
display: none;
|
|
162
152
|
list-style: none;
|
|
163
|
-
position:
|
|
153
|
+
position: fixed;
|
|
164
154
|
z-index: 1000000;
|
|
165
155
|
border-radius: $border-radius-medium;
|
|
166
156
|
background: rgba(255, 255, 255, 0.94);
|
|
@@ -1,66 +1,65 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ecs-pagination" :class="[ floating ? 'ecs-pagination-floating' : '' ]">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
<ecs-
|
|
6
|
-
@click="$emit('
|
|
7
|
-
:disabled="loading || currentPage === 1"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
data-test="pagination-next-button"
|
|
18
|
-
|
|
19
|
-
</ecs-
|
|
20
|
-
</
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
v-for="n in totalPages"
|
|
34
|
-
:key="n"
|
|
35
|
-
:selected="n === currentPage">
|
|
36
|
-
{{ n }}
|
|
37
|
-
</ecs-popover-list-item>
|
|
38
|
-
</ecs-popover-list>
|
|
39
|
-
</div>
|
|
40
|
-
</transition>
|
|
41
|
-
</div>
|
|
42
|
-
<span v-if="totalPages" class="total">of {{ totalPages }}</span>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
<div>
|
|
3
|
+
<ecs-flex-row :gap="8" class="ecs-pagination-nav" :style="{minWidth: tabsSpacing - 4 + 'px'}">
|
|
4
|
+
<template v-if="type == 'paginated'">
|
|
5
|
+
<ecs-flex-row>
|
|
6
|
+
<ecs-button @click="$emit('firstPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-double-left" icon-only type="secondary" title="First Page" data-test="pagination-first-button" />
|
|
7
|
+
<ecs-button @click="$emit('prevPage', $event)" :disabled="loading || currentPage === 1" icon="chevron-left" icon-only type="secondary" title="Previous Page" data-test="pagination-previous-button" />
|
|
8
|
+
</ecs-flex-row>
|
|
9
|
+
<ecs-flex-row :gap="4">
|
|
10
|
+
<span>Page</span>
|
|
11
|
+
<ecs-select @change="$emit('updatePage', $event.target.value)" :disabled="!totalPages" size="sml">
|
|
12
|
+
<option v-for="n in totalPages" :key="n" :value="n" :selected="n === currentPage">{{ n }}</option>
|
|
13
|
+
</ecs-select>
|
|
14
|
+
<span v-if="totalPages" class="total">of {{ totalPages }}</span>
|
|
15
|
+
</ecs-flex-row>
|
|
16
|
+
<ecs-flex-row>
|
|
17
|
+
<ecs-button @click="$emit('nextPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-right" icon-only type="secondary" title="Next Page" data-test="pagination-next-button" />
|
|
18
|
+
<ecs-button @click="$emit('lastPage', $event)" :disabled="loading || currentPage === totalPages" icon="chevron-double-right" icon-only type="secondary" title="Last Page" data-test="pagination-last-button" />
|
|
19
|
+
</ecs-flex-row>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-else-if="hasRange">
|
|
22
|
+
<span class="ecs-pagination-range">Showing entries <span>{{itemRangeFrom}} to {{itemRangeTo}}</span> of <span>{{itemRangeTotal}}</span></span>
|
|
23
|
+
</template>
|
|
24
|
+
<transition name="fade">
|
|
25
|
+
<ecs-flex-row v-if="loading" :gap="4" :class="$slots.tabs && type =='paginated' ? 'push-right' : ''">
|
|
26
|
+
<div v-if="!$slots.tabs && type =='paginated'" class="separator" />
|
|
27
|
+
<ecs-icon type="loading" spinning size="24" color="#858E9E" />
|
|
28
|
+
</ecs-flex-row>
|
|
29
|
+
</transition>
|
|
30
|
+
</ecs-flex-row>
|
|
31
|
+
|
|
32
|
+
<div class="ecs-pagination-tabs">
|
|
46
33
|
<!-- @slot Slot for a sheet tab bar. -->
|
|
47
34
|
<slot name="tabs"></slot>
|
|
48
35
|
</div>
|
|
36
|
+
|
|
37
|
+
<ecs-flex-row v-if="showItemsPerPage && type == 'paginated'" :gap="4" class="ecs-pagination-items">
|
|
38
|
+
<span>Items per page</span>
|
|
39
|
+
<ecs-select @change="$emit('itemsPerPage', $event.target.value)" :disabled="loading" size="sml">
|
|
40
|
+
<option v-for="n in itemsPerPage" :key="n" :value="n" :selected="n === itemsPerPageSelected">{{ n }}</option>
|
|
41
|
+
</ecs-select>
|
|
42
|
+
</ecs-flex-row>
|
|
43
|
+
|
|
44
|
+
<ecs-flex-row v-if="$slots.controls" :gap="4" class="ecs-pagination-controls">
|
|
45
|
+
<!-- @slot Slot for a additional controls, such as a settings button. -->
|
|
46
|
+
<slot name="controls"></slot>
|
|
47
|
+
</ecs-flex-row>
|
|
49
48
|
</div>
|
|
50
49
|
</template>
|
|
51
50
|
|
|
52
51
|
<script>
|
|
53
|
-
import
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import
|
|
52
|
+
import EcsButton from '../button/button'
|
|
53
|
+
import EcsSelect from '../select/select'
|
|
54
|
+
import EcsFlexRow from '../flex/flex-row'
|
|
55
|
+
import EcsIcon from '../icon/icon'
|
|
57
56
|
|
|
58
57
|
export default {
|
|
59
58
|
components: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
EcsButton,
|
|
60
|
+
EcsSelect,
|
|
61
|
+
EcsFlexRow,
|
|
62
|
+
EcsIcon
|
|
64
63
|
},
|
|
65
64
|
|
|
66
65
|
props: {
|
|
@@ -69,6 +68,12 @@
|
|
|
69
68
|
type: Boolean,
|
|
70
69
|
default: false
|
|
71
70
|
},
|
|
71
|
+
/** Determines which elements are visible in the pagination component. */
|
|
72
|
+
type: {
|
|
73
|
+
type: String,
|
|
74
|
+
validator: v => ['paginated', 'infinite'].includes(v),
|
|
75
|
+
default: 'paginated'
|
|
76
|
+
},
|
|
72
77
|
/** Briefly disables all controls while ongoing navigation. */
|
|
73
78
|
loading: {
|
|
74
79
|
type: Boolean,
|
|
@@ -81,23 +86,53 @@
|
|
|
81
86
|
/** The total pages of the index. */
|
|
82
87
|
totalPages: {
|
|
83
88
|
type: Number,
|
|
89
|
+
},
|
|
90
|
+
/** The width of the area left to the tab area in pixels. This is used to align the tab bar with a column in the table. Not needed when tabs aren't in use. */
|
|
91
|
+
tabsSpacing: {
|
|
92
|
+
type: Number,
|
|
93
|
+
default: 400
|
|
94
|
+
},
|
|
95
|
+
/** Determines if the selector for items per page should be shown. */
|
|
96
|
+
showItemsPerPage: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
/** The options to be show as selectable in the items per page dropdown. Requires an array with Numbers. Default: `[25, 50, 100]` */
|
|
101
|
+
itemsPerPage: {
|
|
102
|
+
type: Array,
|
|
103
|
+
default() {
|
|
104
|
+
return [25, 50, 100]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
/** The selected option in the items per page dropdown. */
|
|
108
|
+
itemsPerPageSelected: {
|
|
109
|
+
type: Number,
|
|
110
|
+
default: 100
|
|
111
|
+
},
|
|
112
|
+
/** Number of the visible item range (starting). */
|
|
113
|
+
itemRangeFrom: {
|
|
114
|
+
type: [Number, String]
|
|
115
|
+
},
|
|
116
|
+
/** Number of the visible item range (ending). */
|
|
117
|
+
itemRangeTo: {
|
|
118
|
+
type: [Number, String]
|
|
119
|
+
},
|
|
120
|
+
/** Number of the total items in the index. */
|
|
121
|
+
itemRangeTotal: {
|
|
122
|
+
type: [Number, String]
|
|
84
123
|
}
|
|
85
124
|
},
|
|
86
125
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
hideDropdown(){
|
|
100
|
-
this.dropdownShown = false
|
|
126
|
+
computed: {
|
|
127
|
+
hasRange() {
|
|
128
|
+
if (
|
|
129
|
+
this.itemRangeFrom &&
|
|
130
|
+
this.itemRangeTo &&
|
|
131
|
+
this.itemRangeTotal &&
|
|
132
|
+
this.itemRangeFrom !== '' &&
|
|
133
|
+
this.itemRangeTo !== '' &&
|
|
134
|
+
this.itemRangeTotal !== '')
|
|
135
|
+
return true
|
|
101
136
|
}
|
|
102
137
|
}
|
|
103
138
|
}
|
|
@@ -116,6 +151,9 @@
|
|
|
116
151
|
box-shadow: 0 -1px 0 $color-gray-4;
|
|
117
152
|
position: relative;
|
|
118
153
|
z-index: 2;
|
|
154
|
+
font-size: $type-scale-2-font-size;
|
|
155
|
+
line-height: $type-scale-2-line-height;
|
|
156
|
+
color: $color-gray-15;
|
|
119
157
|
|
|
120
158
|
&-floating{
|
|
121
159
|
border-radius: $border-radius-small;
|
|
@@ -123,94 +161,63 @@
|
|
|
123
161
|
}
|
|
124
162
|
|
|
125
163
|
&-nav{
|
|
126
|
-
display: flex;
|
|
127
|
-
align-items: center;
|
|
128
164
|
height: 40px;
|
|
129
|
-
|
|
165
|
+
|
|
166
|
+
.ecs-form-select{
|
|
167
|
+
width: 52px;
|
|
168
|
+
}
|
|
130
169
|
}
|
|
131
170
|
|
|
132
|
-
|
|
133
|
-
|
|
171
|
+
&-tabs{
|
|
172
|
+
flex: 1;
|
|
134
173
|
}
|
|
135
174
|
|
|
136
|
-
|
|
137
|
-
|
|
175
|
+
&-items{
|
|
176
|
+
padding-right: $spacing-5;
|
|
177
|
+
|
|
178
|
+
.ecs-form-select{
|
|
179
|
+
width: 52px;
|
|
180
|
+
}
|
|
138
181
|
}
|
|
139
182
|
|
|
140
|
-
&-
|
|
141
|
-
|
|
142
|
-
align-items: center;
|
|
183
|
+
&-range{
|
|
184
|
+
padding-left: $spacing-15;
|
|
143
185
|
font-size: $type-scale-2-font-size;
|
|
144
|
-
|
|
186
|
+
line-height: $type-scale-2-line-height;
|
|
187
|
+
color: $color-gray-10;
|
|
145
188
|
|
|
146
|
-
|
|
147
|
-
|
|
189
|
+
> span{
|
|
190
|
+
font-weight: $font-weight-medium;
|
|
191
|
+
color: $color-gray-14;
|
|
148
192
|
}
|
|
193
|
+
}
|
|
149
194
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
align-items: center;
|
|
154
|
-
border: 1px solid $color-gray-3;
|
|
155
|
-
padding: 0 8px;
|
|
156
|
-
height: 32px;
|
|
157
|
-
transition: .2s;
|
|
158
|
-
border-radius: $border-radius-small;
|
|
159
|
-
margin: 0 6px;
|
|
160
|
-
cursor: pointer;
|
|
161
|
-
position: relative;
|
|
162
|
-
color: $color-gray-15;
|
|
163
|
-
|
|
164
|
-
&:after{
|
|
165
|
-
content: "";
|
|
166
|
-
background: svg-uri('<svg xmlns="http://www.w3.org/2000/svg" width="8" height="5" viewBox="0 0 8 5"><polyline fill="none" stroke="#858E9E" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" points="0 0 3 3 6 0" transform="translate(1 .8)"/></svg>');
|
|
167
|
-
width: 8px;
|
|
168
|
-
height: 5px;
|
|
169
|
-
margin-left: 6px;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
&:hover{
|
|
173
|
-
border: 1px solid $color-gray-4;
|
|
174
|
-
box-shadow: 0 1px 1px rgba($color-gray-4, .25);
|
|
175
|
-
}
|
|
195
|
+
&-controls{
|
|
196
|
+
margin-left: $spacing-10;
|
|
197
|
+
}
|
|
176
198
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
199
|
+
.separator{
|
|
200
|
+
width: 1px;
|
|
201
|
+
background: $color-gray-4;
|
|
202
|
+
height: $spacing-20;
|
|
203
|
+
}
|
|
182
204
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
box-shadow: none;
|
|
186
|
-
cursor: not-allowed;
|
|
187
|
-
color: $color-gray-7;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
205
|
+
.ecs-spinner{
|
|
206
|
+
margin-left: $spacing-5;
|
|
190
207
|
}
|
|
191
208
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
right: auto;
|
|
196
|
-
bottom: 34px;
|
|
197
|
-
z-index: 1000;
|
|
198
|
-
background-color: #fff;
|
|
199
|
-
box-shadow: 0 0 0 1px rgba($color-gray-15, .08), 0 1px 3px 0 rgba($color-gray-15, 0.15);
|
|
200
|
-
border-radius: $border-radius-small;
|
|
201
|
-
max-height: 30vh;
|
|
202
|
-
overflow: auto;
|
|
209
|
+
.push-right{
|
|
210
|
+
margin-left: auto;
|
|
211
|
+
padding-right: $spacing-10;
|
|
203
212
|
}
|
|
204
213
|
}
|
|
205
214
|
|
|
206
|
-
.
|
|
207
|
-
.
|
|
208
|
-
transition: all .3s;
|
|
215
|
+
.fade-enter-active, .fade-leave-active {
|
|
216
|
+
transition: all .15s;
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
.
|
|
212
|
-
.dropdown-leave-to {
|
|
219
|
+
.fade-enter, .fade-leave-to {
|
|
213
220
|
opacity: 0;
|
|
214
|
-
transform:
|
|
221
|
+
transform: scale(.2);
|
|
215
222
|
}
|
|
216
223
|
</style>
|
|
@@ -21,7 +21,7 @@ export const contextMenu = () => ({
|
|
|
21
21
|
<ecs-data-grid-head-cell name="Fourth" :width="200" />
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
|
-
<ecs-data-grid-row v-for="index in
|
|
24
|
+
<ecs-data-grid-row v-for="index in 6" :key="index" mouse-event="contextmenu" @click="(e) => handleClick(e, index)">
|
|
25
25
|
<ecs-data-grid-cell column="first" :width="200">Right click me</ecs-data-grid-cell>
|
|
26
26
|
<ecs-data-grid-cell column="second" :width="200">Right click me</ecs-data-grid-cell>
|
|
27
27
|
<ecs-data-grid-cell column="third" :width="200">Right click me</ecs-data-grid-cell>
|
|
@@ -63,7 +63,6 @@ export const contextMenu = () => ({
|
|
|
63
63
|
},
|
|
64
64
|
methods: {
|
|
65
65
|
handleClick(event, item) {
|
|
66
|
-
console.log(this.$refs)
|
|
67
66
|
this.$refs.contextMenu.showMenu(event, item)
|
|
68
67
|
}
|
|
69
68
|
},
|
|
@@ -35,3 +35,33 @@ export const tabPagination = () => ({
|
|
|
35
35
|
</ecs-pagination>
|
|
36
36
|
</div>`,
|
|
37
37
|
});
|
|
38
|
+
|
|
39
|
+
export const infiniteScroll = () => ({
|
|
40
|
+
components: { EcsPagination, EcsTabBar, EcsTabButton },
|
|
41
|
+
template: `<div style="display:flex;flex-direction:column;height: 200px;justify-content: flex-end;">
|
|
42
|
+
<ecs-pagination type="infinite" :current-page="2" :total-pages="10">
|
|
43
|
+
<template slot="tabs">
|
|
44
|
+
<ecs-tab-bar type="sheet">
|
|
45
|
+
<ecs-tab-button show>Settings</ecs-tab-button>
|
|
46
|
+
<ecs-tab-button>Calendar</ecs-tab-button>
|
|
47
|
+
<ecs-tab-button>Versions</ecs-tab-button>
|
|
48
|
+
</ecs-tab-bar>
|
|
49
|
+
</template>
|
|
50
|
+
</ecs-pagination>
|
|
51
|
+
</div>`,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const infiniteScrollRange = () => ({
|
|
55
|
+
components: { EcsPagination, EcsTabBar, EcsTabButton },
|
|
56
|
+
template: `<div style="display:flex;flex-direction:column;height: 200px;justify-content: flex-end;">
|
|
57
|
+
<ecs-pagination type="infinite" :current-page="2" :total-pages="10" :itemRangeFrom="1" :itemRangeTo="10" :itemRangeTotal="90">
|
|
58
|
+
<template slot="tabs">
|
|
59
|
+
<ecs-tab-bar type="sheet">
|
|
60
|
+
<ecs-tab-button>Settings</ecs-tab-button>
|
|
61
|
+
<ecs-tab-button show>Calendar</ecs-tab-button>
|
|
62
|
+
<ecs-tab-button>Versions</ecs-tab-button>
|
|
63
|
+
</ecs-tab-bar>
|
|
64
|
+
</template>
|
|
65
|
+
</ecs-pagination>
|
|
66
|
+
</div>`,
|
|
67
|
+
});
|