@3mo/data-grid 0.2.9 → 0.2.10

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.
@@ -37,160 +37,160 @@ export class DataGridRow extends Component {
37
37
  return this.dataGrid.hasDetail(this.data);
38
38
  }
39
39
  static get styles() {
40
- return css `
41
- :host {
42
- display: block;
43
- position: relative;
44
- height: auto;
45
- width: 100%;
46
- }
47
-
48
- :host(:hover) {
49
- color: inherit;
50
- background: var(--mo-color-accent-transparent) !important;
51
- }
52
-
53
- :host(:hover) #contentContainer::before, #detailsContainer::before {
54
- content: '';
55
- width: 2px;
56
- height: 100%;
57
- top: 0;
58
- inset-inline-start: 0;
59
- position: absolute;
60
- background-color: var(--mo-color-accent);
61
- }
62
-
63
- :host([data-has-alternating-background]) {
64
- background: var(--mo-data-grid-alternating-background);
65
- }
66
-
67
- #contentContainer {
68
- cursor: pointer;
69
- transition: 250ms;
70
- }
71
-
72
- :host([detailsOpen]) #contentContainer {
73
- background: var(--mo-data-grid-row-background-on-opened-detail-element, var(--mo-color-accent-transparent));
74
- }
75
-
76
- :host([selected]) #contentContainer, :host([contextMenuOpen]) #contentContainer {
77
- background: var(--mo-data-grid-selection-background) !important;
78
- }
79
-
80
- :host([selected]:not(:last-of-type)) #contentContainer:after {
81
- content: '';
82
- position: absolute;
83
- bottom: 0;
84
- inset-inline-start: 0;
85
- width: 100%;
86
- border-bottom: 1px solid var(--mo-color-gray-transparent);
87
- }
88
-
89
- #contextMenuIconButton {
90
- transition: 250ms;
91
- opacity: 0.5;
92
- color: var(--mo-color-gray);
93
- }
94
-
95
- :host([selected]) #contextMenuIconButton, :host([contextMenuOpen]) #contextMenuIconButton {
96
- color: var(--mo-color-foreground);
97
- opacity: 1;
98
- }
99
-
100
- #contentContainer:hover #contextMenuIconButton {
101
- color: var(--mo-color-accent);
102
- opacity: 1;
103
- }
104
-
105
- #detailsExpanderIconButton {
106
- transition: 250ms;
107
- }
108
-
109
- #detailsExpanderIconButton:hover {
110
- color: var(--mo-color-accent);
111
- }
112
-
113
- :host([detailsOpen]) #detailsExpanderIconButton {
114
- transform: rotate(90deg);
115
- }
116
-
117
- #detailsContainer {
118
- display: inline-block;
119
- padding: 0;
120
- width: 100%;
121
- }
122
-
123
- #detailsContainer:empty {
124
- display: none;
125
- }
126
-
127
- #detailsContainer > :first-child {
128
- padding: 8px 0;
129
- }
40
+ return css `
41
+ :host {
42
+ display: block;
43
+ position: relative;
44
+ height: auto;
45
+ width: 100%;
46
+ }
47
+
48
+ :host(:hover) {
49
+ color: inherit;
50
+ background: var(--mo-color-accent-transparent) !important;
51
+ }
52
+
53
+ :host(:hover) #contentContainer::before, #detailsContainer::before {
54
+ content: '';
55
+ width: 2px;
56
+ height: 100%;
57
+ top: 0;
58
+ inset-inline-start: 0;
59
+ position: absolute;
60
+ background-color: var(--mo-color-accent);
61
+ }
62
+
63
+ :host([data-has-alternating-background]) {
64
+ background: var(--mo-data-grid-alternating-background);
65
+ }
66
+
67
+ #contentContainer {
68
+ cursor: pointer;
69
+ transition: 250ms;
70
+ }
71
+
72
+ :host([detailsOpen]) #contentContainer {
73
+ background: var(--mo-data-grid-row-background-on-opened-detail-element, var(--mo-color-accent-transparent));
74
+ }
75
+
76
+ :host([selected]) #contentContainer, :host([contextMenuOpen]) #contentContainer {
77
+ background: var(--mo-data-grid-selection-background) !important;
78
+ }
79
+
80
+ :host([selected]:not(:last-of-type)) #contentContainer:after {
81
+ content: '';
82
+ position: absolute;
83
+ bottom: 0;
84
+ inset-inline-start: 0;
85
+ width: 100%;
86
+ border-bottom: 1px solid var(--mo-color-gray-transparent);
87
+ }
88
+
89
+ #contextMenuIconButton {
90
+ transition: 250ms;
91
+ opacity: 0.5;
92
+ color: var(--mo-color-gray);
93
+ }
94
+
95
+ :host([selected]) #contextMenuIconButton, :host([contextMenuOpen]) #contextMenuIconButton {
96
+ color: var(--mo-color-foreground);
97
+ opacity: 1;
98
+ }
99
+
100
+ #contentContainer:hover #contextMenuIconButton {
101
+ color: var(--mo-color-accent);
102
+ opacity: 1;
103
+ }
104
+
105
+ #detailsExpanderIconButton {
106
+ transition: 250ms;
107
+ }
108
+
109
+ #detailsExpanderIconButton:hover {
110
+ color: var(--mo-color-accent);
111
+ }
112
+
113
+ :host([detailsOpen]) #detailsExpanderIconButton {
114
+ transform: rotate(90deg);
115
+ }
116
+
117
+ #detailsContainer {
118
+ display: inline-block;
119
+ padding: 0;
120
+ width: 100%;
121
+ }
122
+
123
+ #detailsContainer:empty {
124
+ display: none;
125
+ }
126
+
127
+ #detailsContainer > :first-child {
128
+ padding: 8px 0;
129
+ }
130
130
  `;
131
131
  }
132
132
  get template() {
133
- return html `
134
- <mo-grid id='contentContainer'
135
- @click=${() => this.handleContentClick()}
136
- @dblclick=${() => this.handleContentDoubleClick()}
137
- @contextmenu=${(e) => this.openContextMenu(e)}
138
- >
139
- ${this.rowTemplate}
140
- </mo-grid>
141
- <slot id='detailsContainer'>${this.detailsOpen ? this.detailsTemplate : nothing}</slot>
133
+ return html `
134
+ <mo-grid id='contentContainer'
135
+ @click=${() => this.handleContentClick()}
136
+ @dblclick=${() => this.handleContentDoubleClick()}
137
+ @contextmenu=${(e) => this.openContextMenu(e)}
138
+ >
139
+ ${this.rowTemplate}
140
+ </mo-grid>
141
+ <slot id='detailsContainer'>${this.detailsOpen ? this.detailsTemplate : nothing}</slot>
142
142
  `;
143
143
  }
144
144
  get detailsExpanderTemplate() {
145
145
  var _a, _b;
146
- return this.dataGrid.hasDetails === false ? nothing : html `
147
- <mo-flex justifyContent='center' alignItems='center' ${style({ width: 'var(--mo-data-grid-column-details-width)' })}
148
- @click=${(e) => e.stopPropagation()}
149
- @dblclick=${(e) => e.stopPropagation()}
150
- >
151
- ${this.hasDetails === false ? nothing : html `
152
- <mo-icon-button id='detailsExpanderIconButton' ${style({ color: 'var(--mo-color-foreground)' })}
153
- icon=${getComputedStyle(this).direction === 'rtl' ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
154
- ?disabled=${((_b = (_a = this.dataGrid).hasDataDetail) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
155
- @click=${() => this.toggleDetails()}
156
- ></mo-icon-button>
157
- `}
158
- </mo-flex>
146
+ return this.dataGrid.hasDetails === false ? nothing : html `
147
+ <mo-flex justifyContent='center' alignItems='center' ${style({ width: 'var(--mo-data-grid-column-details-width)' })}
148
+ @click=${(e) => e.stopPropagation()}
149
+ @dblclick=${(e) => e.stopPropagation()}
150
+ >
151
+ ${this.hasDetails === false ? nothing : html `
152
+ <mo-icon-button id='detailsExpanderIconButton' ${style({ color: 'var(--mo-color-foreground)' })}
153
+ icon=${getComputedStyle(this).direction === 'rtl' ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
154
+ ?disabled=${((_b = (_a = this.dataGrid).hasDataDetail) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
155
+ @click=${() => this.toggleDetails()}
156
+ ></mo-icon-button>
157
+ `}
158
+ </mo-flex>
159
159
  `;
160
160
  }
161
161
  get selectionTemplate() {
162
162
  var _a, _b;
163
- return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? nothing : html `
164
- <mo-flex id='selectionContainer' ${style({ width: 'var(--mo-data-grid-column-selection-width)' })} justifyContent='center' alignItems='center'
165
- @click=${(e) => e.stopPropagation()}
166
- @dblclick=${(e) => e.stopPropagation()}
167
- >
168
- <mo-checkbox
169
- tabindex='-1'
170
- ?disabled=${((_b = (_a = this.dataGrid).isDataSelectable) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
171
- ?checked=${this.selected}
172
- @change=${(e) => this.setSelection(e.detail === 'checked')}
173
- ></mo-checkbox>
174
- </mo-flex>
163
+ return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? nothing : html `
164
+ <mo-flex id='selectionContainer' ${style({ width: 'var(--mo-data-grid-column-selection-width)' })} justifyContent='center' alignItems='center'
165
+ @click=${(e) => e.stopPropagation()}
166
+ @dblclick=${(e) => e.stopPropagation()}
167
+ >
168
+ <mo-checkbox
169
+ tabindex='-1'
170
+ ?disabled=${((_b = (_a = this.dataGrid).isDataSelectable) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
171
+ ?checked=${this.selected}
172
+ @change=${(e) => this.setSelection(e.detail === 'checked')}
173
+ ></mo-checkbox>
174
+ </mo-flex>
175
175
  `;
176
176
  }
177
177
  getCellTemplate(column) {
178
- return column.hidden ? nothing : html `
179
- <mo-data-grid-cell
180
- .row=${this}
181
- .column=${column}
182
- .value=${getValueByKeyPath(this.data, column.dataSelector)}
183
- ></mo-data-grid-cell>
178
+ return column.hidden ? nothing : html `
179
+ <mo-data-grid-cell
180
+ .row=${this}
181
+ .column=${column}
182
+ .value=${getValueByKeyPath(this.data, column.dataSelector)}
183
+ ></mo-data-grid-cell>
184
184
  `;
185
185
  }
186
186
  get contextMenuIconButtonTemplate() {
187
- return this.dataGrid.hasContextMenu === false ? nothing : html `
188
- <mo-flex justifyContent='center' alignItems='center'
189
- @click=${this.openContextMenu}
190
- @dblclick=${(e) => e.stopPropagation()}
191
- >
192
- <mo-icon-button id='contextMenuIconButton' icon='more_vert'></mo-icon-button>
193
- </mo-flex>
187
+ return this.dataGrid.hasContextMenu === false ? nothing : html `
188
+ <mo-flex justifyContent='center' alignItems='center'
189
+ @click=${this.openContextMenu}
190
+ @dblclick=${(e) => e.stopPropagation()}
191
+ >
192
+ <mo-icon-button id='contextMenuIconButton' icon='more_vert'></mo-icon-button>
193
+ </mo-flex>
194
194
  `;
195
195
  }
196
196
  get detailsTemplate() {