@3mo/data-grid 0.4.15 → 0.4.16

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,161 +37,161 @@ 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
- @auxclick=${(e) => e.button !== 1 ? void 0 : this.handleContentMiddleClick()}
138
- @contextmenu=${(e) => this.openContextMenu(e)}
139
- >
140
- ${this.rowTemplate}
141
- </mo-grid>
142
- <slot id='detailsContainer'>${this.detailsOpen ? this.detailsTemplate : html.nothing}</slot>
133
+ return html `
134
+ <mo-grid id='contentContainer'
135
+ @click=${() => this.handleContentClick()}
136
+ @dblclick=${() => this.handleContentDoubleClick()}
137
+ @auxclick=${(e) => e.button !== 1 ? void 0 : this.handleContentMiddleClick()}
138
+ @contextmenu=${(e) => this.openContextMenu(e)}
139
+ >
140
+ ${this.rowTemplate}
141
+ </mo-grid>
142
+ <slot id='detailsContainer'>${this.detailsOpen ? this.detailsTemplate : html.nothing}</slot>
143
143
  `;
144
144
  }
145
145
  get detailsExpanderTemplate() {
146
146
  var _a, _b;
147
- return this.dataGrid.hasDetails === false ? html.nothing : html `
148
- <mo-flex justifyContent='center' alignItems='center' ${style({ width: 'var(--mo-data-grid-column-details-width)' })}
149
- @click=${(e) => e.stopPropagation()}
150
- @dblclick=${(e) => e.stopPropagation()}
151
- >
152
- ${this.hasDetails === false ? html.nothing : html `
153
- <mo-icon-button id='detailsExpanderIconButton' ${style({ color: 'var(--mo-color-foreground)' })}
154
- icon=${getComputedStyle(this).direction === 'rtl' ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
155
- ?disabled=${((_b = (_a = this.dataGrid).hasDataDetail) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
156
- @click=${() => this.toggleDetails()}
157
- ></mo-icon-button>
158
- `}
159
- </mo-flex>
147
+ return this.dataGrid.hasDetails === false ? html.nothing : html `
148
+ <mo-flex justifyContent='center' alignItems='center' ${style({ width: 'var(--mo-data-grid-column-details-width)' })}
149
+ @click=${(e) => e.stopPropagation()}
150
+ @dblclick=${(e) => e.stopPropagation()}
151
+ >
152
+ ${this.hasDetails === false ? html.nothing : html `
153
+ <mo-icon-button id='detailsExpanderIconButton' ${style({ color: 'var(--mo-color-foreground)' })}
154
+ icon=${getComputedStyle(this).direction === 'rtl' ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
155
+ ?disabled=${((_b = (_a = this.dataGrid).hasDataDetail) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
156
+ @click=${() => this.toggleDetails()}
157
+ ></mo-icon-button>
158
+ `}
159
+ </mo-flex>
160
160
  `;
161
161
  }
162
162
  get selectionTemplate() {
163
163
  var _a, _b;
164
- return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
165
- <mo-flex id='selectionContainer' ${style({ width: 'var(--mo-data-grid-column-selection-width)' })} justifyContent='center' alignItems='center'
166
- @click=${(e) => e.stopPropagation()}
167
- @dblclick=${(e) => e.stopPropagation()}
168
- >
169
- <mo-checkbox
170
- tabindex='-1'
171
- ?disabled=${((_b = (_a = this.dataGrid).isDataSelectable) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
172
- ?selected=${this.selected}
173
- @change=${(e) => this.setSelection(e.detail)}
174
- ></mo-checkbox>
175
- </mo-flex>
164
+ return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
165
+ <mo-flex id='selectionContainer' ${style({ width: 'var(--mo-data-grid-column-selection-width)' })} justifyContent='center' alignItems='center'
166
+ @click=${(e) => e.stopPropagation()}
167
+ @dblclick=${(e) => e.stopPropagation()}
168
+ >
169
+ <mo-checkbox
170
+ tabindex='-1'
171
+ ?disabled=${((_b = (_a = this.dataGrid).isDataSelectable) === null || _b === void 0 ? void 0 : _b.call(_a, this.data)) === false}
172
+ ?selected=${this.selected}
173
+ @change=${(e) => this.setSelection(e.detail)}
174
+ ></mo-checkbox>
175
+ </mo-flex>
176
176
  `;
177
177
  }
178
178
  getCellTemplate(column) {
179
- return column.hidden ? html.nothing : html `
180
- <mo-data-grid-cell
181
- .row=${this}
182
- .column=${column}
183
- .value=${getValueByKeyPath(this.data, column.dataSelector)}
184
- ></mo-data-grid-cell>
179
+ return column.hidden ? html.nothing : html `
180
+ <mo-data-grid-cell
181
+ .row=${this}
182
+ .column=${column}
183
+ .value=${getValueByKeyPath(this.data, column.dataSelector)}
184
+ ></mo-data-grid-cell>
185
185
  `;
186
186
  }
187
187
  get contextMenuIconButtonTemplate() {
188
- return this.dataGrid.hasContextMenu === false ? html.nothing : html `
189
- <mo-flex justifyContent='center' alignItems='center'
190
- @click=${this.openContextMenu}
191
- @dblclick=${(e) => e.stopPropagation()}
192
- >
193
- <mo-icon-button id='contextMenuIconButton' icon='more_vert'></mo-icon-button>
194
- </mo-flex>
188
+ return this.dataGrid.hasContextMenu === false ? html.nothing : html `
189
+ <mo-flex justifyContent='center' alignItems='center'
190
+ @click=${this.openContextMenu}
191
+ @dblclick=${(e) => e.stopPropagation()}
192
+ >
193
+ <mo-icon-button id='contextMenuIconButton' icon='more_vert'></mo-icon-button>
194
+ </mo-flex>
195
195
  `;
196
196
  }
197
197
  get detailsTemplate() {