@everchron/ec-shards 3.1.5 → 3.2.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "3.1.5",
3
+ "version": "3.2.0",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -1,65 +1,66 @@
1
1
  <template>
2
2
  <div class="ecs-pagination" :class="[ floating ? 'ecs-pagination-floating' : '' ]">
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">
3
+ <div class="ecs-pagination-nav">
4
+ <ecs-button-toolbar-group>
5
+ <ecs-button-toolbar
6
+ @click="$emit('prevPage', $event)"
7
+ :disabled="loading || currentPage === 1"
8
+ icon="back"
9
+ data-test="pagination-previous-button">
10
+ Previous Page
11
+ </ecs-button-toolbar>
12
+ <ecs-button-toolbar
13
+ @click="$emit('nextPage', $event)"
14
+ :disabled="loading || currentPage === totalPages"
15
+ icon="next"
16
+ icon-position="right"
17
+ data-test="pagination-next-button">
18
+ Next Page
19
+ </ecs-button-toolbar>
20
+ </ecs-button-toolbar-group>
21
+
22
+ <div class="ecs-pagination-dropdown">
23
+ <span>Page</span>
24
+ <div @click="toggleDropdown" class="ecs-pagination-dropdown-button" :class="[dropdownShown ? 'active' : '', totalPages ? '' : 'disabled']">
25
+ <template v-if="currentPage">{{ currentPage }}</template>
26
+ <template v-else>-</template>
27
+
28
+ <transition name="dropdown">
29
+ <div v-if="dropdownShown && totalPages" class="ecs-pagination-select scrollbar scrollbar-sml">
30
+ <ecs-popover-list>
31
+ <ecs-popover-list-item
32
+ @click="$emit('update:page', n), hideDropdown"
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>
33
46
  <!-- @slot Slot for a sheet tab bar. -->
34
47
  <slot name="tabs"></slot>
35
48
  </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>
48
49
  </div>
49
50
  </template>
50
51
 
51
52
  <script>
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'
53
+ import EcsButtonToolbarGroup from '../button-toolbar-group/button-toolbar-group'
54
+ import EcsButtonToolbar from '../button-toolbar/button-toolbar'
55
+ import EcsPopoverList from '../popover-list/popover-list'
56
+ import EcsPopoverListItem from '../popover-list-item/popover-list-item'
56
57
 
57
58
  export default {
58
59
  components: {
59
- EcsButton,
60
- EcsSelect,
61
- EcsFlexRow,
62
- EcsIcon
60
+ EcsButtonToolbarGroup,
61
+ EcsButtonToolbar,
62
+ EcsPopoverList,
63
+ EcsPopoverListItem
63
64
  },
64
65
 
65
66
  props: {
@@ -68,12 +69,6 @@
68
69
  type: Boolean,
69
70
  default: false
70
71
  },
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
- },
77
72
  /** Briefly disables all controls while ongoing navigation. */
78
73
  loading: {
79
74
  type: Boolean,
@@ -86,53 +81,23 @@
86
81
  /** The total pages of the index. */
87
82
  totalPages: {
88
83
  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]
123
84
  }
124
85
  },
125
86
 
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
87
+ data() {
88
+ return {
89
+ dropdownShown: false
90
+ }
91
+ },
92
+
93
+ methods: {
94
+ toggleDropdown(){
95
+ if(this.totalPages)
96
+ this.dropdownShown = !this.dropdownShown
97
+ },
98
+
99
+ hideDropdown(){
100
+ this.dropdownShown = false
136
101
  }
137
102
  }
138
103
  }
@@ -151,9 +116,6 @@
151
116
  box-shadow: 0 -1px 0 $color-gray-4;
152
117
  position: relative;
153
118
  z-index: 2;
154
- font-size: $type-scale-2-font-size;
155
- line-height: $type-scale-2-line-height;
156
- color: $color-gray-15;
157
119
 
158
120
  &-floating{
159
121
  border-radius: $border-radius-small;
@@ -161,63 +123,94 @@
161
123
  }
162
124
 
163
125
  &-nav{
126
+ display: flex;
127
+ align-items: center;
164
128
  height: 40px;
165
-
166
- .ecs-form-select{
167
- width: 52px;
168
- }
129
+ margin-right: 24px;
169
130
  }
170
131
 
171
- &-tabs{
172
- flex: 1;
132
+ .ecs-toolbar-button-group{
133
+ margin-right: 32px;
173
134
  }
174
135
 
175
- &-items{
176
- padding-right: $spacing-5;
177
-
178
- .ecs-form-select{
179
- width: 52px;
180
- }
136
+ .ecs-toolbar-button-icon{
137
+ font-size: $type-scale-2-font-size;
181
138
  }
182
139
 
183
- &-range{
184
- padding-left: $spacing-15;
140
+ &-dropdown{
141
+ display: flex;
142
+ align-items: center;
185
143
  font-size: $type-scale-2-font-size;
186
- line-height: $type-scale-2-line-height;
187
- color: $color-gray-10;
144
+ color: $color-gray-9;
188
145
 
189
- > span{
190
- font-weight: $font-weight-medium;
191
- color: $color-gray-14;
146
+ .total{
147
+ color: $color-gray-15;
192
148
  }
193
- }
194
149
 
195
- &-controls{
196
- margin-left: $spacing-10;
197
- }
150
+ &-button{
151
+ background: #FFF;
152
+ display: flex;
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
+ }
198
171
 
199
- .separator{
200
- width: 1px;
201
- background: $color-gray-4;
202
- height: $spacing-20;
203
- }
172
+ &:hover{
173
+ border: 1px solid $color-gray-4;
174
+ box-shadow: 0 1px 1px rgba($color-gray-4, .25);
175
+ }
176
+
177
+ &.active{
178
+ border: 1px solid $color-gray-5;
179
+ box-shadow: 0 1px 0 rgba($color-gray-2, .1) inset;
180
+ background: rgba($color-gray-5, .1);
181
+ }
204
182
 
205
- .ecs-spinner{
206
- margin-left: $spacing-5;
183
+ &.disabled{
184
+ border: 1px solid $color-gray-3;
185
+ box-shadow: none;
186
+ cursor: not-allowed;
187
+ color: $color-gray-7;
188
+ }
189
+ }
207
190
  }
208
191
 
209
- .push-right{
210
- margin-left: auto;
211
- padding-right: $spacing-10;
192
+ &-select{
193
+ position: absolute;
194
+ left: 0;
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;
212
203
  }
213
204
  }
214
205
 
215
- .fade-enter-active, .fade-leave-active {
216
- transition: all .15s;
206
+ .dropdown-enter-active,
207
+ .dropdown-leave-active {
208
+ transition: all .3s;
217
209
  }
218
210
 
219
- .fade-enter, .fade-leave-to {
211
+ .dropdown-enter,
212
+ .dropdown-leave-to {
220
213
  opacity: 0;
221
- transform: scale(.2);
214
+ transform: translateY(10px);
222
215
  }
223
216
  </style>
@@ -6,6 +6,12 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 3.2.0 (11 January 2023)
10
+
11
+ ### Fixes
12
+
13
+ Reverted all EcsPagination updates and moved these changes to the @next branch, until infinite scroll feature can be implemented. This means 3.2.0 can be used again as a stable release for current application development.
14
+
9
15
  ## Version 3.1.5 (undefined)
10
16
 
11
17
  ### Features
@@ -35,33 +35,3 @@ 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
- });