@3mo/data-grid 0.2.5 → 0.2.6

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.
@@ -13,7 +13,7 @@ Localizer.register("de" /* LanguageCode.German */, {
13
13
  * @attr column
14
14
  * @attr row
15
15
  */
16
- let DataGridCell = class DataGridCell extends Component {
16
+ export let DataGridCell = class DataGridCell extends Component {
17
17
  constructor() {
18
18
  super(...arguments);
19
19
  this.editing = false;
@@ -98,46 +98,46 @@ let DataGridCell = class DataGridCell extends Component {
98
98
  }
99
99
  }
100
100
  static get styles() {
101
- return css `
102
- :host {
103
- position: relative;
104
- padding: 0px var(--mo-data-grid-cell-padding, 3px);
105
- user-select: none;
106
- line-height: var(--mo-data-grid-row-height);
107
- white-space: nowrap;
108
- overflow: hidden !important;
109
- text-overflow: ellipsis;
110
- font-size: small;
111
- }
112
-
113
- :host(:not([isEditing]):focus) {
114
- outline: 2px solid var(--mo-color-accent);
115
- }
116
-
117
- :host([isEditing]) {
118
- display: grid;
119
- }
120
-
121
- :host([alignment=end]) {
122
- text-align: end;
123
- }
124
-
125
- :host([alignment=start]) {
126
- text-align: start
127
- }
128
-
129
- :host([alignment=center]) {
130
- text-align: center;
131
- }
132
-
133
- :host > :first-child {
134
- line-height: var(--mo-data-grid-row-height);
135
- }
136
-
137
- :host([isEditing]) > :first-child {
138
- align-self: center;
139
- justify-self: stretch;
140
- }
101
+ return css `
102
+ :host {
103
+ position: relative;
104
+ padding: 0px var(--mo-data-grid-cell-padding, 3px);
105
+ user-select: none;
106
+ line-height: var(--mo-data-grid-row-height);
107
+ white-space: nowrap;
108
+ overflow: hidden !important;
109
+ text-overflow: ellipsis;
110
+ font-size: small;
111
+ }
112
+
113
+ :host(:not([isEditing]):focus) {
114
+ outline: 2px solid var(--mo-color-accent);
115
+ }
116
+
117
+ :host([isEditing]) {
118
+ display: grid;
119
+ }
120
+
121
+ :host([alignment=end]) {
122
+ text-align: end;
123
+ }
124
+
125
+ :host([alignment=start]) {
126
+ text-align: start
127
+ }
128
+
129
+ :host([alignment=center]) {
130
+ text-align: center;
131
+ }
132
+
133
+ :host > :first-child {
134
+ line-height: var(--mo-data-grid-row-height);
135
+ }
136
+
137
+ :host([isEditing]) > :first-child {
138
+ align-self: center;
139
+ justify-self: stretch;
140
+ }
141
141
  `;
142
142
  }
143
143
  get tooltip() {
@@ -196,4 +196,3 @@ __decorate([
196
196
  DataGridCell = __decorate([
197
197
  component('mo-data-grid-cell')
198
198
  ], DataGridCell);
199
- export { DataGridCell };
@@ -12,7 +12,7 @@ Localizer.register("fa" /* LanguageCode.Farsi */, {
12
12
  * @attr dataGrid
13
13
  * @attr page
14
14
  */
15
- let DataGridFooter = class DataGridFooter extends Component {
15
+ export let DataGridFooter = class DataGridFooter extends Component {
16
16
  constructor() {
17
17
  super(...arguments);
18
18
  this.page = 1;
@@ -20,43 +20,43 @@ let DataGridFooter = class DataGridFooter extends Component {
20
20
  this.manualPageSize = false;
21
21
  }
22
22
  static get styles() {
23
- return css `
24
- :host {
25
- grid-column: 1 / last-line;
26
- grid-row: 3;
27
- min-height: var(--mo-data-grid-footer-min-height);
28
- }
29
-
30
- :host(:not([hideTopBorder])) {
31
- border-top: var(--mo-data-grid-border);
32
- }
33
-
34
- img {
35
- height: 100%;
36
- transition: .25s;
37
- -webkit-filter: grayscale(100%);
38
- filter: grayscale(100%);
39
- }
40
-
41
- img:hover {
42
- -webkit-filter: grayscale(0%);
43
- filter: grayscale(0%);
44
- }
23
+ return css `
24
+ :host {
25
+ grid-column: 1 / last-line;
26
+ grid-row: 3;
27
+ min-height: var(--mo-data-grid-footer-min-height);
28
+ }
29
+
30
+ :host(:not([hideTopBorder])) {
31
+ border-top: var(--mo-data-grid-border);
32
+ }
33
+
34
+ img {
35
+ height: 100%;
36
+ transition: .25s;
37
+ -webkit-filter: grayscale(100%);
38
+ filter: grayscale(100%);
39
+ }
40
+
41
+ img:hover {
42
+ -webkit-filter: grayscale(0%);
43
+ filter: grayscale(0%);
44
+ }
45
45
  `;
46
46
  }
47
47
  get template() {
48
48
  this.toggleAttribute('hideTopBorder', this.dataGrid.hasFooter === false);
49
- return this.dataGrid.hasFooter === false ? nothing : html `
50
- <mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '6px' })}>
51
- <mo-flex direction='horizontal' alignItems='center' gap='1vw' ${style({ flexBasis: 'auto' })}>
52
- ${this.paginationTemplate}
53
- </mo-flex>
54
-
55
- <mo-flex direction='horizontal' alignItems='center' gap='8px' wrap='wrap-reverse' ${style({ textAlign: 'right', paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
56
- ${this.dataGrid.sumsTemplate}
57
- <slot name='sum'></slot>
58
- </mo-flex>
59
- </mo-flex>
49
+ return this.dataGrid.hasFooter === false ? nothing : html `
50
+ <mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '6px' })}>
51
+ <mo-flex direction='horizontal' alignItems='center' gap='1vw' ${style({ flexBasis: 'auto' })}>
52
+ ${this.paginationTemplate}
53
+ </mo-flex>
54
+
55
+ <mo-flex direction='horizontal' alignItems='center' gap='8px' wrap='wrap-reverse' ${style({ textAlign: 'right', paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
56
+ ${this.dataGrid.sumsTemplate}
57
+ <slot name='sum'></slot>
58
+ </mo-flex>
59
+ </mo-flex>
60
60
  `;
61
61
  }
62
62
  get paginationTemplate() {
@@ -70,51 +70,51 @@ let DataGridFooter = class DataGridFooter extends Component {
70
70
  `${(Math.min(from, to)).format()}-${to.format()}`,
71
71
  hasUnknownDataLength ? undefined : this.dataGrid.dataLength.format(),
72
72
  ].filter(Boolean).join(' / ');
73
- return !this.dataGrid.hasPagination ? nothing : html `
74
- <mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
75
- <mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
76
- ?disabled=${this.page === 1}
77
- @click=${() => this.setPage(1)}
78
- ></mo-icon-button>
79
-
80
- <mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
81
- ?disabled=${this.page === 1}
82
- @click=${() => this.setPage(this.page - 1)}
83
- ></mo-icon-button>
84
-
85
- <div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
86
- ${this.manualPagination ? html `
87
- <mo-field-number dense
88
- value=${this.page}
89
- @change=${(e) => this.handleManualPageChange(e.detail)}>
90
- </mo-field-number>
91
- ` : html `
92
- <div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
93
- `}
94
- </div>
95
-
96
- <mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
97
- ?disabled=${!this.dataGrid.hasNextPage}
98
- @click=${() => this.setPage(this.page + 1)}
99
- ></mo-icon-button>
100
-
101
- <mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
102
- ?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
103
- @click=${() => { var _a; return this.setPage((_a = this.dataGrid.maxPage) !== null && _a !== void 0 ? _a : 1); }}
104
- ></mo-icon-button>
105
- </mo-flex>
106
-
107
- <div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
108
- ${!this.manualPageSize ? html `
109
- <div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
110
- ` : html `
111
- <mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
112
- .dataGrid=${this.dataGrid}
113
- value=${ifDefined(this.dataGrid.pagination)}
114
- @change=${(e) => this.handlePaginationChange(e.detail)}>
115
- </mo-field-select-data-grid-page-size>
116
- `}
117
- </div>
73
+ return !this.dataGrid.hasPagination ? nothing : html `
74
+ <mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
75
+ <mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
76
+ ?disabled=${this.page === 1}
77
+ @click=${() => this.setPage(1)}
78
+ ></mo-icon-button>
79
+
80
+ <mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
81
+ ?disabled=${this.page === 1}
82
+ @click=${() => this.setPage(this.page - 1)}
83
+ ></mo-icon-button>
84
+
85
+ <div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
86
+ ${this.manualPagination ? html `
87
+ <mo-field-number dense
88
+ value=${this.page}
89
+ @change=${(e) => this.handleManualPageChange(e.detail)}>
90
+ </mo-field-number>
91
+ ` : html `
92
+ <div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
93
+ `}
94
+ </div>
95
+
96
+ <mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
97
+ ?disabled=${!this.dataGrid.hasNextPage}
98
+ @click=${() => this.setPage(this.page + 1)}
99
+ ></mo-icon-button>
100
+
101
+ <mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
102
+ ?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
103
+ @click=${() => { var _a; return this.setPage((_a = this.dataGrid.maxPage) !== null && _a !== void 0 ? _a : 1); }}
104
+ ></mo-icon-button>
105
+ </mo-flex>
106
+
107
+ <div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
108
+ ${!this.manualPageSize ? html `
109
+ <div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
110
+ ` : html `
111
+ <mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
112
+ .dataGrid=${this.dataGrid}
113
+ value=${ifDefined(this.dataGrid.pagination)}
114
+ @change=${(e) => this.handlePaginationChange(e.detail)}>
115
+ </mo-field-select-data-grid-page-size>
116
+ `}
117
+ </div>
118
118
  `;
119
119
  }
120
120
  handlePaginationChange(value) {
@@ -183,4 +183,3 @@ __decorate([
183
183
  DataGridFooter = __decorate([
184
184
  component('mo-data-grid-footer')
185
185
  ], DataGridFooter);
186
- export { DataGridFooter };
@@ -1,6 +1,6 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { component, Component, css, html, ifDefined, property, event, join, style, nothing } from '@a11d/lit';
3
- let DataGridHeader = class DataGridHeader extends Component {
3
+ export let DataGridHeader = class DataGridHeader extends Component {
4
4
  constructor() {
5
5
  super(...arguments);
6
6
  this.selection = 'unchecked';
@@ -38,32 +38,32 @@ let DataGridHeader = class DataGridHeader extends Component {
38
38
  this.dataGrid.selectionChange.unsubscribe(this.handleDataGridSelectionChange);
39
39
  }
40
40
  static get styles() {
41
- return css `
42
- :host {
43
- --mo-data-grid-header-separator-height: 15px;
44
- --mo-data-grid-header-separator-width: 2px;
45
- display: inherit;
46
- font-size: small;
47
- }
48
-
49
- #header {
50
- border-top: var(--mo-data-grid-border);
51
- border-bottom: var(--mo-data-grid-border);
52
- position: relative;
53
- height: var(--mo-data-grid-header-height);
54
- background: var(--mo-data-grid-header-background);
55
- }
56
-
57
- .headerContent {
58
- padding: 0 var(--mo-data-grid-cell-padding, 3px);
59
- display: inline-block;
60
- overflow: hidden !important;
61
- color: var(--mo-color-foreground);
62
- font-weight: 500;
63
- line-height: var(--mo-data-grid-header-height);
64
- white-space: nowrap;
65
- text-overflow: ellipsis;
66
- }
41
+ return css `
42
+ :host {
43
+ --mo-data-grid-header-separator-height: 15px;
44
+ --mo-data-grid-header-separator-width: 2px;
45
+ display: inherit;
46
+ font-size: small;
47
+ }
48
+
49
+ #header {
50
+ border-top: var(--mo-data-grid-border);
51
+ border-bottom: var(--mo-data-grid-border);
52
+ position: relative;
53
+ height: var(--mo-data-grid-header-height);
54
+ background: var(--mo-data-grid-header-background);
55
+ }
56
+
57
+ .headerContent {
58
+ padding: 0 var(--mo-data-grid-cell-padding, 3px);
59
+ display: inline-block;
60
+ overflow: hidden !important;
61
+ color: var(--mo-color-foreground);
62
+ font-weight: 500;
63
+ line-height: var(--mo-data-grid-header-height);
64
+ white-space: nowrap;
65
+ text-overflow: ellipsis;
66
+ }
67
67
  `;
68
68
  }
69
69
  get skeletonColumns() {
@@ -78,73 +78,73 @@ let DataGridHeader = class DataGridHeader extends Component {
78
78
  return this.dataGrid.dataColumnsWidths.join(' var(--mo-data-grid-columns-gap) ');
79
79
  }
80
80
  get template() {
81
- return html `
82
- <mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
83
- ${this.detailsExpanderTemplate}
84
- ${this.selectionTemplate}
85
- ${this.contentTemplate}
86
- ${this.moreTemplate}
87
- </mo-grid>
81
+ return html `
82
+ <mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
83
+ ${this.detailsExpanderTemplate}
84
+ ${this.selectionTemplate}
85
+ ${this.contentTemplate}
86
+ ${this.moreTemplate}
87
+ </mo-grid>
88
88
  `;
89
89
  }
90
90
  get detailsExpanderTemplate() {
91
- return this.dataGrid.hasDetails === false ? nothing : html `
92
- <mo-flex justifyContent='center' alignItems='center'>
93
- ${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? nothing : html `
94
- <mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
95
- ${style({ display: 'inherit' })}
96
- icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
97
- @click=${() => this.toggleAllDetails()}
98
- ></mo-icon-button>
99
- `}
100
- </mo-flex>
91
+ return this.dataGrid.hasDetails === false ? nothing : html `
92
+ <mo-flex justifyContent='center' alignItems='center'>
93
+ ${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? nothing : html `
94
+ <mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
95
+ ${style({ display: 'inherit' })}
96
+ icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
97
+ @click=${() => this.toggleAllDetails()}
98
+ ></mo-icon-button>
99
+ `}
100
+ </mo-flex>
101
101
  `;
102
102
  }
103
103
  get selectionTemplate() {
104
- return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? nothing : html `
105
- <mo-flex justifyContent='center' alignItems='center'>
106
- ${this.dataGrid.selectionMode !== "multiple" /* DataGridSelectionMode.Multiple */ ? nothing : html `
107
- <mo-checkbox ${style({ position: 'absolute' })} value=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
108
- `}
109
- </mo-flex>
104
+ return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? nothing : html `
105
+ <mo-flex justifyContent='center' alignItems='center'>
106
+ ${this.dataGrid.selectionMode !== "multiple" /* DataGridSelectionMode.Multiple */ ? nothing : html `
107
+ <mo-checkbox ${style({ position: 'absolute' })} value=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
108
+ `}
109
+ </mo-flex>
110
110
  `;
111
111
  }
112
112
  get contentTemplate() {
113
- return html `
114
- <mo-grid columns=${this.separatorAdjustedColumns}>
115
- ${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
116
- <mo-data-grid-header-separator
117
- .dataGrid=${this.dataGrid}
118
- .column=${this.dataGrid.visibleColumns[index]}
119
- @columnUpdate=${() => this.dataGrid.requestUpdate()}
120
- ></mo-data-grid-header-separator>
121
- `)}
122
- </mo-grid>
113
+ return html `
114
+ <mo-grid columns=${this.separatorAdjustedColumns}>
115
+ ${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
116
+ <mo-data-grid-header-separator
117
+ .dataGrid=${this.dataGrid}
118
+ .column=${this.dataGrid.visibleColumns[index]}
119
+ @columnUpdate=${() => this.dataGrid.requestUpdate()}
120
+ ></mo-data-grid-header-separator>
121
+ `)}
122
+ </mo-grid>
123
123
  `;
124
124
  }
125
125
  getHeaderCellTemplate(column) {
126
126
  const sortIcon = !this.dataGrid.sorting || !column.dataSelector || this.dataGrid.sorting.selector !== column.dataSelector ? undefined
127
127
  : this.dataGrid.sorting.strategy === "ascending" /* DataGridSortingStrategy.Ascending */ ? 'arrow_upward' : 'arrow_downward';
128
- return html `
129
- <mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
130
- ${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
131
- @click=${() => this.sort(column)}
132
- >
133
- <div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
134
-
135
- ${sortIcon === undefined ? nothing : html `
136
- <mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
137
- `}
138
- </mo-flex>
128
+ return html `
129
+ <mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
130
+ ${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
131
+ @click=${() => this.sort(column)}
132
+ >
133
+ <div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
134
+
135
+ ${sortIcon === undefined ? nothing : html `
136
+ <mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
137
+ `}
138
+ </mo-flex>
139
139
  `;
140
140
  }
141
141
  get moreTemplate() {
142
- return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? nothing : html `
143
- <mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
144
- <mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
145
- @click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : "settings" /* DataGridSidePanelTab.Settings */)}
146
- ></mo-icon-button>
147
- </mo-flex>
142
+ return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? nothing : html `
143
+ <mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
144
+ <mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
145
+ @click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : "settings" /* DataGridSidePanelTab.Settings */)}
146
+ ></mo-icon-button>
147
+ </mo-flex>
148
148
  `;
149
149
  }
150
150
  sort(column) {
@@ -187,4 +187,3 @@ __decorate([
187
187
  DataGridHeader = __decorate([
188
188
  component('mo-data-grid-header')
189
189
  ], DataGridHeader);
190
- export { DataGridHeader };
@@ -1,7 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { Component, component, property, html, css, state, event, eventListener, nothing, style } from '@a11d/lit';
3
3
  /** @fires columnUpdate {CustomEvent} */
4
- let DataGridHeaderSeparator = class DataGridHeaderSeparator extends Component {
4
+ export let DataGridHeaderSeparator = class DataGridHeaderSeparator extends Component {
5
5
  constructor() {
6
6
  super(...arguments);
7
7
  this.isResizing = false;
@@ -13,51 +13,51 @@ let DataGridHeaderSeparator = class DataGridHeaderSeparator extends Component {
13
13
  };
14
14
  }
15
15
  static get styles() {
16
- return css `
17
- div.separator {
18
- display: flex;
19
- align-items: center;
20
- justify-content: center;
21
- inset-inline-start: calc(var(--mo-data-grid-columns-gap) * -1);
22
- width: var(--mo-data-grid-columns-gap);
23
- height: 100%;
24
- cursor: col-resize;
25
- user-select: none;
26
- }
27
-
28
- .knob {
29
- height: var(--mo-data-grid-header-separator-height);
30
- width: var(--mo-data-grid-header-separator-width);
31
- border-radius: 100px;
32
- background-color: var(--mo-color-gray);
33
- transition: 0.2s;
34
- }
35
-
36
- .separator:hover .knob {
37
- --mo-data-grid-header-separator-height: 30px;
38
- --mo-data-grid-header-separator-width: 8px;
39
- background-color: var(--mo-color-accent);
40
- cursor: col-resize;
41
- }
42
-
43
- .resizerOverlay {
44
- position: fixed;
45
- top: 0;
46
- height: 100%;
47
- background: var(--mo-color-gray);
48
- width: 2px;
49
- }
16
+ return css `
17
+ div.separator {
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ inset-inline-start: calc(var(--mo-data-grid-columns-gap) * -1);
22
+ width: var(--mo-data-grid-columns-gap);
23
+ height: 100%;
24
+ cursor: col-resize;
25
+ user-select: none;
26
+ }
27
+
28
+ .knob {
29
+ height: var(--mo-data-grid-header-separator-height);
30
+ width: var(--mo-data-grid-header-separator-width);
31
+ border-radius: 100px;
32
+ background-color: var(--mo-color-gray);
33
+ transition: 0.2s;
34
+ }
35
+
36
+ .separator:hover .knob {
37
+ --mo-data-grid-header-separator-height: 30px;
38
+ --mo-data-grid-header-separator-width: 8px;
39
+ background-color: var(--mo-color-accent);
40
+ cursor: col-resize;
41
+ }
42
+
43
+ .resizerOverlay {
44
+ position: fixed;
45
+ top: 0;
46
+ height: 100%;
47
+ background: var(--mo-color-gray);
48
+ width: 2px;
49
+ }
50
50
  `;
51
51
  }
52
52
  get template() {
53
- return html `
54
- <div class='separator' @mousedown=${this.handleMouseDown}>
55
- <div class='knob'></div>
56
- </div>
57
-
58
- ${this.isResizing === false ? nothing : html `
59
- <div class='resizerOverlay' ${style({ marginInlineStart: `${this.delta}px` })}></div>
60
- `}
53
+ return html `
54
+ <div class='separator' @mousedown=${this.handleMouseDown}>
55
+ <div class='knob'></div>
56
+ </div>
57
+
58
+ ${this.isResizing === false ? nothing : html `
59
+ <div class='resizerOverlay' ${style({ marginInlineStart: `${this.delta}px` })}></div>
60
+ `}
61
61
  `;
62
62
  }
63
63
  handleMouseUp() {
@@ -126,4 +126,3 @@ __decorate([
126
126
  DataGridHeaderSeparator = __decorate([
127
127
  component('mo-data-grid-header-separator')
128
128
  ], DataGridHeaderSeparator);
129
- export { DataGridHeaderSeparator };
@@ -1,17 +1,16 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { component, css } from '@a11d/lit';
3
3
  import { ContextMenuItem } from '@3mo/context-menu';
4
- let DataGridPrimaryContextMenuItem = class DataGridPrimaryContextMenuItem extends ContextMenuItem {
4
+ export let DataGridPrimaryContextMenuItem = class DataGridPrimaryContextMenuItem extends ContextMenuItem {
5
5
  static get styles() {
6
- return css `
7
- ${super.styles}
8
- :host {
9
- font-weight: bold;
10
- }
6
+ return css `
7
+ ${super.styles}
8
+ :host {
9
+ font-weight: bold;
10
+ }
11
11
  `;
12
12
  }
13
13
  };
14
14
  DataGridPrimaryContextMenuItem = __decorate([
15
15
  component('mo-data-grid-primary-context-menu-item')
16
16
  ], DataGridPrimaryContextMenuItem);
17
- export { DataGridPrimaryContextMenuItem };