@3mo/data-grid 0.2.4 → 0.2.5

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