@everchron/ec-shards 7.0.2 → 7.1.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": "7.0.2",
3
+ "version": "7.1.0",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -0,0 +1,9 @@
1
+ <svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13.9167 18.25H9.58333C8.43406 18.25 7.33186 18.7065 6.5192 19.5192C5.70655 20.3319 5.25 21.4341 5.25 22.5833V23.6667" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M13.9167 13.9167C16.3099 13.9167 18.25 11.9766 18.25 9.58333C18.25 7.1901 16.3099 5.25 13.9167 5.25C11.5234 5.25 9.58333 7.1901 9.58333 9.58333C9.58333 11.9766 11.5234 13.9167 13.9167 13.9167Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M25.8333 19.875C25.8333 20.8806 25.4338 21.845 24.7228 22.5561C24.0117 23.2672 23.0473 23.6667 22.0417 23.6667C21.665 23.6614 21.2913 23.5994 20.9331 23.4827" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M22.0417 16.0834C23.0473 16.0834 24.0117 16.4829 24.7228 17.1939C25.4339 17.905 25.8333 18.8694 25.8333 19.875" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
6
+ <path d="M18.433 20.9804C18.3169 20.6232 18.2553 20.2506 18.25 19.875C18.25 18.8694 18.6495 17.905 19.3606 17.1939C20.0716 16.4829 21.0361 16.0834 22.0417 16.0834" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
7
+ <path d="M18.4329 20.9803L16.3783 23.0382C16.1898 23.2282 16.0838 23.4849 16.0833 23.7525V24.8228C16.0833 25.0908 16.1898 25.3478 16.3793 25.5373C16.5688 25.7268 16.8258 25.8333 17.0938 25.8333H18.1687C18.3016 25.8335 18.4331 25.8073 18.5557 25.7563C18.6783 25.7052 18.7896 25.6304 18.8831 25.5361L20.9332 23.4827" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>
8
+ <path d="M22.8 19.7509C22.7998 19.8991 22.7557 20.0441 22.6732 20.1673C22.5907 20.2905 22.4736 20.3864 22.3366 20.4431C22.1996 20.4997 22.0489 20.5145 21.9035 20.4855C21.7581 20.4566 21.6245 20.3852 21.5197 20.2803C21.4148 20.1755 21.3434 20.0419 21.3145 19.8965C21.2855 19.7511 21.3003 19.6004 21.3569 19.4634C21.4136 19.3264 21.5096 19.2093 21.6328 19.1268C21.756 19.0443 21.9009 19.0002 22.0491 19C22.1478 18.9999 22.2454 19.0192 22.3366 19.0569C22.4278 19.0946 22.5106 19.1499 22.5803 19.2197C22.6501 19.2894 22.7054 19.3722 22.7431 19.4634C22.7808 19.5546 22.8001 19.6522 22.8 19.7509Z" fill="currentColor"/>
9
+ </svg>
@@ -148,7 +148,7 @@
148
148
 
149
149
  mounted() {
150
150
  if (this.iconOnly && (!this.ariaLabel || this.ariaLabel.trim() === '')) {
151
- console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
151
+ //console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
152
152
  }
153
153
  }
154
154
  }
@@ -72,7 +72,7 @@
72
72
 
73
73
  mounted() {
74
74
  if (this.iconOnly && (!this.ariaLabel || this.ariaLabel.trim() === '')) {
75
- console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
75
+ //console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
76
76
  }
77
77
  }
78
78
  }
@@ -55,7 +55,7 @@
55
55
 
56
56
  mounted() {
57
57
  if (this.$slots.default === undefined && (!this.ariaLabel || this.ariaLabel.trim() === '')) {
58
- console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
58
+ //console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
59
59
  }
60
60
  }
61
61
  }
@@ -157,7 +157,7 @@
157
157
 
158
158
  mounted() {
159
159
  if (this.$slots.default === undefined && (!this.ariaLabel || this.ariaLabel.trim() === '')) {
160
- console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
160
+ //console.warn('Warning: ariaLabel must be provided on buttons with only an icon and no label.');
161
161
  }
162
162
  }
163
163
  }
@@ -57,7 +57,7 @@
57
57
  /** Sets the aria-label attribute to improve accessibility. */
58
58
  ariaLabel: {
59
59
  type: String,
60
- required: true
60
+ //required: true
61
61
  }
62
62
  }
63
63
  }
@@ -1,8 +1,19 @@
1
1
  <template>
2
- <div class="ecs-data-grid-cell" :style="[fixedStyles]" :class="[fixedLeft ? 'fixed-left' : '', fixedLeftLast ? 'fixed-left-last' : '', fixedRight ? 'fixed-right' : '']" role="cell">
2
+ <div
3
+ class="ecs-data-grid-cell"
4
+ :style="[fixedStyles]"
5
+ :class="[fixedLeft ? 'fixed-left' : '', fixedLeftLast ? 'fixed-left-last' : '', fixedRight ? 'fixed-right' : '']" role="cell">
6
+
3
7
  <div v-if="fixedRight" class="shadow" :class="fixedRight ? 'left' : ''" />
4
- <div class="ecs-data-grid-cell-inner" :style="[widthStyles, paddingStyles]" :data-column="computedId" :data-test="computedId">
8
+ <div
9
+ class="ecs-data-grid-cell-inner"
10
+ :style="[widthStyles, paddingStyles, styles]"
11
+ :data-column="computedId"
12
+ :data-test="computedId">
13
+
5
14
  <div v-if="firstNonStaticCell" class="first-cell-spacer" />
15
+ <div class="group-spacer"></div>
16
+ <ecs-button-collapse v-if="hasCollapse" @click="handleCollapseClick" :collapsed="isCollapsed" type="chevron" />
6
17
  <!-- @slot Tabe cell content slot. -->
7
18
  <slot></slot>
8
19
  </div>
@@ -12,10 +23,12 @@
12
23
 
13
24
  <script>
14
25
  import EcsAnimations from '../animations/animations'
26
+ import EcsButtonCollapse from '../button-collapse/button-collapse.vue'
15
27
 
16
28
  export default {
17
29
  components: {
18
- EcsAnimations
30
+ EcsAnimations,
31
+ EcsButtonCollapse
19
32
  },
20
33
 
21
34
  props: {
@@ -64,13 +77,28 @@
64
77
  /** Adds extra 8px padding-left to the first non-static column in the index. */
65
78
  firstNonStaticCell: {
66
79
  type: Boolean
67
- }
80
+ },
81
+ /** Adds a collapse button to the cell. */
82
+ hasCollapse: {
83
+ type: Boolean,
84
+ default: false
85
+ },
86
+ /** Sets the collapsed state of the cell. */
87
+ collapsed: {
88
+ type: Boolean,
89
+ default: false
90
+ },
91
+ /** Allows to set custom styles on the inner cell container (must be a style object). */
92
+ styles: {
93
+ type: Object
94
+ },
68
95
  },
69
96
 
70
97
  data () {
71
98
  return {
72
99
  cellWidth: 0,
73
- cellFixedLeftOffset: ''
100
+ cellFixedLeftOffset: '',
101
+ isCollapsed: this.collapsed
74
102
  }
75
103
  },
76
104
 
@@ -113,12 +141,22 @@
113
141
 
114
142
  setFixedLeftOffset(val){
115
143
  this.cellFixedLeftOffset = val
144
+ },
145
+
146
+ handleCollapseClick(){
147
+ /** Emitted when the collapse button is clicked. */
148
+ this.$parent.$emit('collapse')
149
+ this.isCollapsed = !this.isCollapsed
116
150
  }
117
151
  },
118
152
 
119
153
  watch: {
120
154
  width: function () {
121
155
  this.cellWidth = this.width
156
+ },
157
+
158
+ collapsed(val) {
159
+ this.isCollapsed = val
122
160
  }
123
161
  },
124
162
 
@@ -146,6 +184,11 @@
146
184
  font-size: $type-scale-3-font-size;
147
185
  line-height: $type-scale-3-line-height;
148
186
  }
187
+
188
+ .ecs-collapse-button{
189
+ margin-right: $spacing-10;
190
+ align-self: flex-start;
191
+ }
149
192
  }
150
193
 
151
194
  .shadow{
@@ -196,5 +239,32 @@
196
239
  flex-shrink: 0;
197
240
  width: $spacing-10;
198
241
  }
242
+
243
+ .group-spacer{
244
+ flex-shrink: 0;
245
+ }
246
+
247
+ .ecs-data-grid-row-group-rows{
248
+ .group-spacer{
249
+ width: 28px;
250
+ }
251
+
252
+ .ecs-data-grid-row-group-rows{
253
+ .group-spacer{
254
+ width: 56px;
255
+ }
256
+
257
+ .ecs-data-grid-row-group-rows{
258
+ .group-spacer{
259
+ width: 84px;
260
+ }
261
+ }
262
+ }
263
+ }
264
+
265
+ .ecs-data-grid-row > .ecs-data-grid-cell:not(:first-child) .group-spacer{
266
+ display: none;
267
+ }
268
+
199
269
  </style>
200
270
 
@@ -17,7 +17,7 @@
17
17
  /** Sets the aria-labeled-by attribute. Should match the ID of the tab button which controls this tab panel. */
18
18
  ariaLabeledBy: {
19
19
  type: String,
20
- required: true
20
+ //required: true
21
21
  }
22
22
  }
23
23
  }
@@ -8,7 +8,14 @@
8
8
  :aria-label="icon ? name : false">
9
9
 
10
10
  <div v-if="fixedRight" class="shadow" :class="fixedRight ? 'left' : ''" />
11
- <div ref="resizer" class="ecs-data-grid-head-cell-inner" :style="[widthStyles, paddingStyles, resizeStyles]" :class="resizable ? 'resizable' : ''" :data-column="computedId" :data-headname="beingResizedName" :data-test="computedId">
11
+ <div ref="resizer"
12
+ class="ecs-data-grid-head-cell-inner"
13
+ :style="[widthStyles, paddingStyles, resizeStyles, styles]"
14
+ :class="resizable ? 'resizable' : ''"
15
+ :data-column="computedId"
16
+ :data-headname="beingResizedName"
17
+ :data-test="computedId">
18
+
12
19
  <div v-if="firstNonStaticCell" class="first-cell-spacer" />
13
20
  <ecs-icon v-if="icon" :type="icon" size="20" color="#202127" :title="name" />
14
21
  <ecs-select v-else-if="select" @change="$emit('selection', $event.target.value)" type="invisible">
@@ -122,7 +129,11 @@
122
129
  firstNonStaticCell: {
123
130
  type: Boolean,
124
131
  default: false
125
- }
132
+ },
133
+ /** Allows to set custom styles on the inner cell container (must be a style object). */
134
+ styles: {
135
+ type: Object
136
+ },
126
137
  },
127
138
 
128
139
  data () {
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div class="ecs-data-grid-row-group" role="rowgroup">
3
+
4
+ <ecs-data-grid-row :type="headerRowType" @collapse="handleCollapse">
5
+ <!-- @slot All of the row group header row cells go here. -->
6
+ <slot name="cells"></slot>
7
+ </ecs-data-grid-row>
8
+
9
+ <div class="ecs-data-grid-row-group-rows" :class="isCollapsed ? 'collapsed' : 'expanded'" :aria-hidden="isCollapsed">
10
+ <!-- @slot All of the row group's rows go here. -->
11
+ <slot name="rows"></slot>
12
+ </div>
13
+ </div>
14
+ </template>
15
+
16
+ <script>
17
+ import EcsDataGridRow from './data-grid-row.vue'
18
+
19
+ export default {
20
+ components: {
21
+ EcsDataGridRow
22
+ },
23
+
24
+ props: {
25
+ /** Determines the state of the table row. */
26
+ state: {
27
+ type: String,
28
+ validator: v => ['default', 'selected', 'opened', 'added', 'droppable'].includes(v),
29
+ default: 'default'
30
+ },
31
+ /** Determines the style type of the row groups header row. */
32
+ headerRowType: {
33
+ type: String,
34
+ validator: v => ['default', 'header'].includes(v),
35
+ default: 'header'
36
+ },
37
+ /** Determines if the row group is collapsed or not. */
38
+ collapsed: {
39
+ type: Boolean,
40
+ default: false
41
+ }
42
+ },
43
+
44
+ data () {
45
+ return {
46
+ isCollapsed: this.collapsed
47
+ }
48
+ },
49
+
50
+ methods: {
51
+ handleCollapse(){
52
+ this.isCollapsed = !this.isCollapsed
53
+ }
54
+ },
55
+
56
+ watch: {
57
+ collapsed(val){
58
+ this.isCollapsed = val
59
+ }
60
+ }
61
+ }
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ @import "../../tokens/build/scss/tokens.scss";
66
+ @import "../mixins/svg-uri";
67
+
68
+ .ecs-data-grid-row-group{
69
+ &-rows{
70
+ &.collapsed{
71
+ display: none;
72
+ }
73
+ }
74
+ }
75
+ </style>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="ecs-data-grid-row" :class="state" ref="grid_row" role="row">
2
+ <div class="ecs-data-grid-row" :class="[state, type == 'header' ? 'header-row' : '']" ref="grid_row" role="row">
3
3
  <div v-if="state == 'droppable'" @click="handleDropzoneClick" class="ecs-data-grid-row-drop-zone" />
4
4
 
5
5
  <!-- @slot All of the row's cells go here. There should **never** be any other child component other than EcsDataGridCell be used. -->
@@ -18,6 +18,13 @@
18
18
  default: 'default'
19
19
  },
20
20
 
21
+ /** Determines the type of the table row. */
22
+ type: {
23
+ type: String,
24
+ validator: v => ['default', 'header'].includes(v),
25
+ default: 'default'
26
+ },
27
+
21
28
  /** Determines if listener should be added for listed mouse event. */
22
29
  mouseEvent: {
23
30
  type: String,
@@ -78,6 +85,11 @@
78
85
  background-color: $color-gray-10;
79
86
  }
80
87
 
88
+ &.header-row,
89
+ &.header-row .ecs-data-grid-cell{
90
+ background-color: $color-gray-2;
91
+ }
92
+
81
93
  &.selected{
82
94
  border-bottom-color: $color-blue-3;
83
95
  background-color: #F4F9FF;
@@ -33,6 +33,7 @@ import EcsDataCard from "./data-card/data-card.vue"
33
33
  import EcsDataCardList from "./data-card-list/data-card-list.vue"
34
34
  import EcsDataGrid from "./data-grid/data-grid.vue"
35
35
  import EcsDataGridRow from "./data-grid/data-grid-row.vue"
36
+ import EcsDataGridRowGroup from "./data-grid/data-grid-row-group.vue"
36
37
  import EcsDataGridHeadCell from "./data-grid/data-grid-head-cell.vue"
37
38
  import EcsDataGridGroup from "./data-grid/data-grid-group.vue"
38
39
  import EcsDataGridCell from "./data-grid/data-grid-cell.vue"
@@ -170,6 +171,7 @@ const Components = {
170
171
  EcsDataGrid,
171
172
  EcsDataGridGroup,
172
173
  EcsDataGridRow,
174
+ EcsDataGridRowGroup,
173
175
  EcsDataGridHeadCell,
174
176
  EcsDataGridCell,
175
177
  EcsDataList,
@@ -42,7 +42,7 @@
42
42
 
43
43
  mounted() {
44
44
  if (!this.ariaLabeledBy || this.ariaLabeledBy.trim() === '') {
45
- console.warn('Warning: ariaLabeledBy must be provided on tab panels, to improve accessibility.');
45
+ //console.warn('Warning: ariaLabeledBy must be provided on tab panels, to improve accessibility.');
46
46
  }
47
47
  }
48
48
  }
@@ -6,6 +6,13 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 7.1.0 (26 May 2023)
10
+
11
+ ### Features
12
+
13
+ - Added row groups feature to EcsDataGrid component
14
+ - Added user-key icon
15
+
9
16
  ## Version 7.0.1 (22 May 2023)
10
17
 
11
18
  ### Fixes
@@ -3,6 +3,7 @@ import EcsDataGridGroup from '@components/data-grid/data-grid-group';
3
3
  import EcsDataGridRow from '@components/data-grid/data-grid-row';
4
4
  import EcsDataGridHeadCell from '@components/data-grid/data-grid-head-cell';
5
5
  import EcsDataGridCell from '@components/data-grid/data-grid-cell';
6
+ import EcsButton from '@components/button/button';
6
7
 
7
8
  export default {
8
9
  title: 'Data/Data Grid/Head Cell',
@@ -75,3 +76,19 @@ export const headCellSorting = () => ({
75
76
  </template>
76
77
  </ecs-data-grid>`,
77
78
  });
79
+
80
+ export const headCellCustom = () => ({
81
+ components: { EcsDataGridHeadCell, EcsButton },
82
+ data() {
83
+ return {
84
+ customStyles: {
85
+ 'background-color': '#E9F3FF',
86
+ 'border-radius': '4px',
87
+ 'justify-content': 'center',
88
+ }
89
+ }
90
+ },
91
+ template: `<ecs-data-grid-head-cell name="Column" :min-width="200" :width="300" :styles="customStyles">
92
+ <ecs-button size="sml" icon="edit" icon-only />
93
+ </ecs-data-grid-head-cell>`
94
+ });
@@ -0,0 +1,78 @@
1
+ import EcsDataGrid from '@components/data-grid/data-grid';
2
+ import EcsDataGridRow from '@components/data-grid/data-grid-row';
3
+ import EcsDataGridHeadCell from '@components/data-grid/data-grid-head-cell';
4
+ import EcsDataGridCell from '@components/data-grid/data-grid-cell';
5
+ import EcsDataGridRowGroup from '@components/data-grid/data-grid-row-group';
6
+
7
+ export default {
8
+ title: 'Data/Data Grid/Row Group',
9
+ component: EcsDataGridRowGroup
10
+ };
11
+
12
+ export const nestedRowGroups = () => ({
13
+ components: { EcsDataGrid, EcsDataGridRowGroup, EcsDataGridRow, EcsDataGridHeadCell, EcsDataGridCell },
14
+ data() {
15
+ return {
16
+ setCollapse: false
17
+ };
18
+ },
19
+ template: `<div style="width: 100%; height: 500px">
20
+ <button @click="setCollapse = !setCollapse">Toggle All</button>
21
+ <ecs-data-grid :striped="false">
22
+ <template slot="head">
23
+ <ecs-data-grid-head-cell name="First Column" :width="400" fixed-left fixed-left-last />
24
+ <ecs-data-grid-head-cell name="Second Column" :width="500" />
25
+ <ecs-data-grid-head-cell name="Third Column" :width="200" />
26
+ </template>
27
+
28
+ <ecs-data-grid-row-group :collapsed="setCollapse">
29
+ <template slot="cells">
30
+ <ecs-data-grid-cell has-collapse :collapsed="setCollapse" column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
31
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
32
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
33
+ </template>
34
+
35
+ <template slot="rows">
36
+ <ecs-data-grid-row v-for="index in 3" :key="index">
37
+ <ecs-data-grid-cell column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
38
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
39
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
40
+ </ecs-data-grid-row>
41
+
42
+ <ecs-data-grid-row-group header-row-type="default" :collapsed="setCollapse">
43
+ <template slot="cells">
44
+ <ecs-data-grid-cell has-collapse :collapsed="setCollapse" column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
45
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
46
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
47
+ </template>
48
+
49
+ <template slot="rows">
50
+ <ecs-data-grid-row v-for="index in 3" :key="index">
51
+ <ecs-data-grid-cell column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
52
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
53
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
54
+ </ecs-data-grid-row>
55
+ </template>
56
+ </ecs-data-grid-row-group>
57
+ </template>
58
+ </ecs-data-grid-row-group>
59
+
60
+ <ecs-data-grid-row-group :collapsed="setCollapse">
61
+ <template slot="cells">
62
+ <ecs-data-grid-cell has-collapse :collapsed="setCollapse" column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
63
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
64
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
65
+ </template>
66
+
67
+ <template slot="rows">
68
+ <ecs-data-grid-row v-for="index in 3" :key="index">
69
+ <ecs-data-grid-cell column="first" :min-width="200" :width="400" fixed-left fixed-left-last>Selected State</ecs-data-grid-cell>
70
+ <ecs-data-grid-cell column="second" :min-width="300" :width="500">Second Column</ecs-data-grid-cell>
71
+ <ecs-data-grid-cell column="third" :min-width="140" :width="200">Third Column</ecs-data-grid-cell>
72
+ </ecs-data-grid-row>
73
+ </template>
74
+ </ecs-data-grid-row-group>
75
+ </ecs-data-grid>
76
+ </div>`,
77
+ });
78
+