@everchron/ec-shards 4.4.3 → 5.0.1

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": "4.4.3",
3
+ "version": "5.0.1",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -4,7 +4,7 @@
4
4
  <div ref="resizer" class="ecs-data-grid-head-cell-inner" :style="[widthStyles, paddingStyles, resizeStyles]" :class="resizable ? 'resizable' : ''" :data-column="computedId" :data-test="computedId">
5
5
  <ecs-icon v-if="icon" :type="icon" size="20" color="#202127" :title="name" />
6
6
  <ecs-select v-else-if="select" @change="$emit('selection', $event.target.value)" type="invisible">
7
- <option v-for="(option, index) in select" :key="index" :value="option.value">{{ option.name }}</option>
7
+ <option v-for="(option, index) in select" :key="index" :selected="option.selected" :value="option.value">{{ option.name }}</option>
8
8
  </ecs-select>
9
9
  <div v-else class="ecs-data-grid-head-cell-text">
10
10
  {{ name }}
@@ -74,7 +74,7 @@
74
74
  type: Boolean,
75
75
  default: false
76
76
  },
77
- /** If passed, the head cell won't render the slot in the text, but a select menu with the passed options instead. This is useful when one column should be able to switch the data that is shown in it. For example, you could have a column with a selector in the head cell which allows you to switch between ECID, Bates Range, and Trial Exhibit No. The array needs to contain objects with `value` and `name`. */
77
+ /** If passed, the head cell won't render the slot in the text, but a select menu with the passed options instead. This is useful when one column should be able to switch the data that is shown in it. For example, you could have a column with a selector in the head cell which allows you to switch between ECID, Bates Range, and Trial Exhibit No. The array needs to contain objects with `value`, `name` and `selected`. */
78
78
  select: {
79
79
  type: Array
80
80
  },
@@ -129,7 +129,8 @@ import EcsToasts from "./toasts/toasts.vue"
129
129
  import EcsToolbar from "./toolbar/toolbar.vue"
130
130
  import EcsTranscriptState from "./transcript-state/transcript-state.vue"
131
131
  import EcsTreeList from "./tree-list/tree-list.vue"
132
- import EcsTreeListItem from "./tree-list-item/tree-list-item.vue"
132
+ import EcsTreeListItem from "./tree-list/tree-list-item.vue"
133
+ import EcsTreeListHeadline from "./tree-list/tree-list-headline.vue"
133
134
  import EcsVideo from "./video/video.vue"
134
135
 
135
136
  const Components = {
@@ -262,6 +263,7 @@ const Components = {
262
263
  EcsTranscriptState,
263
264
  EcsTreeList,
264
265
  EcsTreeListItem,
266
+ EcsTreeListHeadline,
265
267
  EcsVideo
266
268
  }
267
269
 
@@ -1,66 +1,65 @@
1
1
  <template>
2
2
  <div class="ecs-pagination" :class="[ floating ? 'ecs-pagination-floating' : '' ]">
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>
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 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'
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
- EcsButtonToolbarGroup,
61
- EcsButtonToolbar,
62
- EcsPopoverList,
63
- EcsPopoverListItem
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
- 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
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
- margin-right: 24px;
165
+
166
+ .ecs-form-select{
167
+ width: 52px;
168
+ }
130
169
  }
131
170
 
132
- .ecs-toolbar-button-group{
133
- margin-right: 32px;
171
+ &-tabs{
172
+ flex: 1;
134
173
  }
135
174
 
136
- .ecs-toolbar-button-icon{
137
- font-size: $type-scale-2-font-size;
175
+ &-items{
176
+ padding-right: $spacing-5;
177
+
178
+ .ecs-form-select{
179
+ width: 52px;
180
+ }
138
181
  }
139
182
 
140
- &-dropdown{
141
- display: flex;
142
- align-items: center;
183
+ &-range{
184
+ padding-left: $spacing-15;
143
185
  font-size: $type-scale-2-font-size;
144
- color: $color-gray-9;
186
+ line-height: $type-scale-2-line-height;
187
+ color: $color-gray-10;
145
188
 
146
- .total{
147
- color: $color-gray-15;
189
+ > span{
190
+ font-weight: $font-weight-medium;
191
+ color: $color-gray-14;
148
192
  }
193
+ }
149
194
 
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
- }
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
- &.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
- }
199
+ .separator{
200
+ width: 1px;
201
+ background: $color-gray-4;
202
+ height: $spacing-20;
203
+ }
182
204
 
183
- &.disabled{
184
- border: 1px solid $color-gray-3;
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
- &-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;
209
+ .push-right{
210
+ margin-left: auto;
211
+ padding-right: $spacing-10;
203
212
  }
204
213
  }
205
214
 
206
- .dropdown-enter-active,
207
- .dropdown-leave-active {
208
- transition: all .3s;
215
+ .fade-enter-active, .fade-leave-active {
216
+ transition: all .15s;
209
217
  }
210
218
 
211
- .dropdown-enter,
212
- .dropdown-leave-to {
219
+ .fade-enter, .fade-leave-to {
213
220
  opacity: 0;
214
- transform: translateY(10px);
221
+ transform: scale(.2);
215
222
  }
216
223
  </style>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div class="ecs-tree-view-headline">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <style lang="scss" scoped>
8
+ @import "../../tokens/build/scss/tokens.scss";
9
+ @import "../mixins/svg-uri";
10
+
11
+ .ecs-tree-view-headline{
12
+ color: $color-gray-10;
13
+ font-size: $type-scale-2-font-size;
14
+ line-height: $type-scale-2-line-height;
15
+ padding: $spacing-5 10px;
16
+ }
17
+ </style>
@@ -6,6 +6,12 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 3.4.0 (1 February 2023)
10
+
11
+ ### Features
12
+
13
+ - Added new EcsTreeListHeadline component
14
+
9
15
  ## Version 3.3.0 (12 January 2023)
10
16
 
11
17
  ### Features
@@ -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 60" :key="index" mouse-event="contextmenu" @click="(e) => handleClick(e, index)">
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
  },
@@ -29,7 +29,7 @@ export const headCellSelect = () => ({
29
29
  return {
30
30
  selectOptions: [
31
31
  { value: 'ecid', name: 'ECID' },
32
- { value: 'bates', name: 'Bates Range' },
32
+ { value: 'bates', name: 'Bates Range', selected: true },
33
33
  { value: 'trialex', name: 'Trial Exhibit'}
34
34
  ]
35
35
  }
@@ -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
+ });
@@ -1,4 +1,4 @@
1
- import EcsTreeListItem from '@components/tree-list-item/tree-list-item'
1
+ import EcsTreeListItem from '@components/tree-list/tree-list-item'
2
2
  import EcsTreeList from '@components/tree-list/tree-list'
3
3
 
4
4
  export default {
@@ -0,0 +1,21 @@
1
+ import EcsTreeListItem from '@components/tree-list/tree-list-item'
2
+ import EcsTreeListHeadline from '@components/tree-list/tree-list-headline'
3
+ import EcsTreeList from '@components/tree-list/tree-list'
4
+
5
+ export default {
6
+ title: 'Data/Tree List/Tree List Headline',
7
+ component: EcsTreeListHeadline
8
+ };
9
+
10
+ export const treeListHeadline = () => ({
11
+ components: { EcsTreeListItem, EcsTreeList, EcsTreeListHeadline },
12
+ template: `<ecs-tree-list>
13
+ <ecs-tree-list-headline>Headline</ecs-tree-list-headline>
14
+ <ecs-tree-list-item :after-label="13">
15
+ List Item
16
+ </ecs-tree-list-item>
17
+ <ecs-tree-list-item :after-label="13">
18
+ List Item
19
+ </ecs-tree-list-item>
20
+ </ecs-tree-list>`,
21
+ });
@@ -1,4 +1,4 @@
1
- import EcsTreeListItem from '@components/tree-list-item/tree-list-item'
1
+ import EcsTreeListItem from '@components/tree-list/tree-list-item'
2
2
  import EcsTreeList from '@components/tree-list/tree-list'
3
3
  import EcsButton from '@components/button/button'
4
4
  import EcsCheckbox from '@components/checkbox/checkbox'