@3mo/data-grid 0.2.9 → 0.2.11

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.
@@ -24,117 +24,117 @@ let DataGridSidePanel = class DataGridSidePanel extends Component {
24
24
  this.dataGrid.requestUpdate();
25
25
  await this.dataGrid.updateComplete;
26
26
  };
27
- return html `
28
- <mo-checkbox ${style({ height: '30px' })}
29
- label=${column.heading}
30
- ?checked=${column.hidden === false}
31
- @change=${change}
32
- ></mo-checkbox>
27
+ return html `
28
+ <mo-checkbox ${style({ height: '30px' })}
29
+ label=${column.heading}
30
+ ?checked=${column.hidden === false}
31
+ @change=${change}
32
+ ></mo-checkbox>
33
33
  `;
34
34
  };
35
35
  }
36
36
  static get styles() {
37
- return css `
38
- :host {
39
- display: inline-block !important;
40
- transition: 250ms;
41
- width: 100%;
42
- height: 100%;
43
- transform-origin: right center;
44
- }
45
-
46
- :host(:not([hidden])) {
47
- border-inline-start: var(--mo-data-grid-border);
48
- background: var(--mo-color-transparent-gray-1);
49
- opacity: 1;
50
- }
51
-
52
- :host([hidden]) {
53
- opacity: 0;
54
- transform: scale(0, 1);
55
- width: 0;
56
- }
57
-
58
- #flexHeading {
59
- border-top: var(--mo-data-grid-border);
60
- border-bottom: var(--mo-data-grid-border);
61
- height: var(--mo-data-grid-header-height);
62
- padding-inline-start: 14px;
63
- }
64
-
65
- mo-scroller {
66
- width: calc(100% - calc(2 * 14px));
67
- padding: 0 14px;
68
- margin-top: 14px;
69
- overflow-x: hidden;
70
- }
71
-
72
- mo-scroller::part(container) {
73
- width: calc(100% - calc(2 * 14px));
74
- }
75
-
76
- mo-section mo-checkbox {
77
- margin-inline-start: -6px;
78
- }
79
-
80
- mo-section mo-icon-button {
81
- margin-inline-start: -10px;
82
- }
37
+ return css `
38
+ :host {
39
+ display: inline-block !important;
40
+ transition: 250ms;
41
+ width: 100%;
42
+ height: 100%;
43
+ transform-origin: right center;
44
+ }
45
+
46
+ :host(:not([hidden])) {
47
+ border-inline-start: var(--mo-data-grid-border);
48
+ background: var(--mo-color-transparent-gray-1);
49
+ opacity: 1;
50
+ }
51
+
52
+ :host([hidden]) {
53
+ opacity: 0;
54
+ transform: scale(0, 1);
55
+ width: 0;
56
+ }
57
+
58
+ #flexHeading {
59
+ border-top: var(--mo-data-grid-border);
60
+ border-bottom: var(--mo-data-grid-border);
61
+ height: var(--mo-data-grid-header-height);
62
+ padding-inline-start: 14px;
63
+ }
64
+
65
+ mo-scroller {
66
+ width: calc(100% - calc(2 * 14px));
67
+ padding: 0 14px;
68
+ margin-top: 14px;
69
+ overflow-x: hidden;
70
+ }
71
+
72
+ mo-scroller::part(container) {
73
+ width: calc(100% - calc(2 * 14px));
74
+ }
75
+
76
+ mo-section mo-checkbox {
77
+ margin-inline-start: -6px;
78
+ }
79
+
80
+ mo-section mo-icon-button {
81
+ margin-inline-start: -10px;
82
+ }
83
83
  `;
84
84
  }
85
85
  get template() {
86
- return html `
87
- <mo-flex ${style({ height: '100%' })}>
88
- ${this.dataGrid.hasToolbar || this.dataGrid.hasFilters === false ? nothing : html `
89
- <mo-tab-bar
90
- value=${ifDefined(this.dataGrid.sidePanelTab)}
91
- @change=${(e) => { var _a; return this.dataGrid.navigateToSidePanelTab((_a = e.detail) !== null && _a !== void 0 ? _a : "settings" /* DataGridSidePanelTab.Settings */); }}
92
- >
93
- <mo-tab icon='filter_list' value=${"filters" /* DataGridSidePanelTab.Filters */}></mo-tab>
94
- <mo-tab icon='settings' value=${"settings" /* DataGridSidePanelTab.Settings */}></mo-tab>
95
- </mo-tab-bar>
96
- `}
97
-
98
- ${this.dataGrid.hasToolbar === false && this.dataGrid.hasFilters === true ? nothing : html `
99
- <mo-flex id='flexHeading' direction='horizontal' alignItems='center'>
100
- <mo-heading typography='heading6' ${style({ width: '*', color: 'var(--mo-color-on-surface)' })}>${t(this.dataGrid.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? 'Extended Filters' : 'Settings')}</mo-heading>
101
- <mo-icon-button icon='close' dense
102
- ${tooltip(t('Close'))}
103
- ${style({ cursor: 'pointer', color: 'var(--mo-color-gray)' })}
104
- @click=${() => this.dataGrid.navigateToSidePanelTab(undefined)}
105
- ></mo-icon-button>
106
- </mo-flex>
107
- `}
108
-
109
- <mo-scroller ${style({ height: '*' })}>
110
- ${this.dataGrid.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? this.filtersTemplate : this.settingsTemplate}
111
- </mo-scroller>
112
- </mo-flex>
86
+ return html `
87
+ <mo-flex ${style({ height: '100%' })}>
88
+ ${this.dataGrid.hasToolbar || this.dataGrid.hasFilters === false ? nothing : html `
89
+ <mo-tab-bar
90
+ value=${ifDefined(this.dataGrid.sidePanelTab)}
91
+ @change=${(e) => { var _a; return this.dataGrid.navigateToSidePanelTab((_a = e.detail) !== null && _a !== void 0 ? _a : "settings" /* DataGridSidePanelTab.Settings */); }}
92
+ >
93
+ <mo-tab icon='filter_list' value=${"filters" /* DataGridSidePanelTab.Filters */}></mo-tab>
94
+ <mo-tab icon='settings' value=${"settings" /* DataGridSidePanelTab.Settings */}></mo-tab>
95
+ </mo-tab-bar>
96
+ `}
97
+
98
+ ${this.dataGrid.hasToolbar === false && this.dataGrid.hasFilters === true ? nothing : html `
99
+ <mo-flex id='flexHeading' direction='horizontal' alignItems='center'>
100
+ <mo-heading typography='heading6' ${style({ width: '*', color: 'var(--mo-color-on-surface)' })}>${t(this.dataGrid.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? 'Extended Filters' : 'Settings')}</mo-heading>
101
+ <mo-icon-button icon='close' dense
102
+ ${tooltip(t('Close'))}
103
+ ${style({ cursor: 'pointer', color: 'var(--mo-color-gray)' })}
104
+ @click=${() => this.dataGrid.navigateToSidePanelTab(undefined)}
105
+ ></mo-icon-button>
106
+ </mo-flex>
107
+ `}
108
+
109
+ <mo-scroller ${style({ height: '*' })}>
110
+ ${this.dataGrid.sidePanelTab === "filters" /* DataGridSidePanelTab.Filters */ ? this.filtersTemplate : this.settingsTemplate}
111
+ </mo-scroller>
112
+ </mo-flex>
113
113
  `;
114
114
  }
115
115
  get filtersTemplate() {
116
- return html `
117
- <mo-flex gap='14px'>
118
- <slot name='filter'></slot>
119
- </mo-flex>
116
+ return html `
117
+ <mo-flex gap='14px'>
118
+ <slot name='filter'></slot>
119
+ </mo-flex>
120
120
  `;
121
121
  }
122
122
  get settingsTemplate() {
123
- return html `
124
- <mo-flex gap='14px'>
125
- <slot name='settings'></slot>
126
-
127
- <mo-section heading=${t('Columns')}>
128
- ${this.dataGrid.columns.map(this.getColumnTemplate)}
129
- </mo-section>
130
-
131
- <mo-section heading='Tools'>
132
- <mo-icon-button icon='file_download'
133
- ${tooltip('Export as Excel file')}
134
- @click=${() => this.dataGrid.exportExcelFile()}
135
- ></mo-icon-button>
136
- </mo-section>
137
- </mo-flex>
123
+ return html `
124
+ <mo-flex gap='14px'>
125
+ <slot name='settings'></slot>
126
+
127
+ <mo-section heading=${t('Columns')}>
128
+ ${this.dataGrid.columns.map(this.getColumnTemplate)}
129
+ </mo-section>
130
+
131
+ <mo-section heading='Tools'>
132
+ <mo-icon-button icon='file_download'
133
+ ${tooltip('Export as Excel file')}
134
+ @click=${() => this.dataGrid.exportExcelFile()}
135
+ ></mo-icon-button>
136
+ </mo-section>
137
+ </mo-flex>
138
138
  `;
139
139
  }
140
140
  };
@@ -4,13 +4,13 @@ import { component, html, property, nothing } from '@a11d/lit';
4
4
  import { FieldSelect } from '@3mo/select-field';
5
5
  let FieldSelectDataGridPageSize = FieldSelectDataGridPageSize_1 = class FieldSelectDataGridPageSize extends FieldSelect {
6
6
  get optionsTemplate() {
7
- return html `
8
- ${!this.dataGrid || !this.dataGrid.supportsDynamicPageSize ? nothing : html `
9
- <mo-option value='auto'>Auto</mo-option>
10
- `}
11
- ${FieldSelectDataGridPageSize_1.data.map(size => html `
12
- <mo-option value=${size}>${size.format()}</mo-option>
13
- `)}
7
+ return html `
8
+ ${!this.dataGrid || !this.dataGrid.supportsDynamicPageSize ? nothing : html `
9
+ <mo-option value='auto'>Auto</mo-option>
10
+ `}
11
+ ${FieldSelectDataGridPageSize_1.data.map(size => html `
12
+ <mo-option value=${size}>${size.format()}</mo-option>
13
+ `)}
14
14
  `;
15
15
  }
16
16
  };
@@ -19,18 +19,18 @@ let DataGridColumnBoolean = class DataGridColumnBoolean extends DataGridColumn {
19
19
  }
20
20
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
21
  getContentTemplate(value, _data) {
22
- return html `
23
- <mo-flex justifyContent='center' ${style({ height: '100%' })}>
24
- <mo-icon icon=${value ? this.trueIcon : this.falseIcon} ${style({ color: value ? this.trueIconColor : this.falseIconColor })}></mo-icon>
25
- </mo-flex>
22
+ return html `
23
+ <mo-flex justifyContent='center' ${style({ height: '100%' })}>
24
+ <mo-icon icon=${value ? this.trueIcon : this.falseIcon} ${style({ color: value ? this.trueIconColor : this.falseIconColor })}></mo-icon>
25
+ </mo-flex>
26
26
  `;
27
27
  }
28
28
  getEditContentTemplate(value, data) {
29
- return html `
30
- <mo-checkbox label=${this.heading} data-focus
31
- ?checked=${value}
32
- @change=${(e) => this.handleEdit(e.detail === 'checked', data)}
33
- ></mo-checkbox>
29
+ return html `
30
+ <mo-checkbox label=${this.heading} data-focus
31
+ ?checked=${value}
32
+ @change=${(e) => this.handleEdit(e.detail === 'checked', data)}
33
+ ></mo-checkbox>
34
34
  `;
35
35
  }
36
36
  };
@@ -13,17 +13,17 @@ let DataGridColumnCurrency = class DataGridColumnCurrency extends DataGridColumn
13
13
  return html `${(value !== null && value !== void 0 ? value : 0).formatAsCurrency(this.currency)}`;
14
14
  }
15
15
  getEditContentTemplate(value, data) {
16
- return html `
17
- <mo-field-currency dense data-focus
18
- label=${this.heading}
19
- value=${ifDefined(value)}
20
- @change=${(e) => this.handleEdit(e.detail, data)}
21
- ></mo-field-currency>
16
+ return html `
17
+ <mo-field-currency dense data-focus
18
+ label=${this.heading}
19
+ value=${ifDefined(value)}
20
+ @change=${(e) => this.handleEdit(e.detail, data)}
21
+ ></mo-field-currency>
22
22
  `;
23
23
  }
24
24
  getSumTemplate(sum) {
25
- return html `
26
- <span ${style({ fontWeight: '500', color: 'var(--mo-color-accent)' })}>${sum.formatAsCurrency(this.currency)}</span>
25
+ return html `
26
+ <span ${style({ fontWeight: '500', color: 'var(--mo-color-accent)' })}>${sum.formatAsCurrency(this.currency)}</span>
27
27
  `;
28
28
  }
29
29
  };
@@ -16,13 +16,13 @@ let DataGridColumnDate = class DataGridColumnDate extends DataGridColumn {
16
16
  return html `${value ? (_a = value.formatAsDate()) !== null && _a !== void 0 ? _a : '' : ''}`;
17
17
  }
18
18
  getEditContentTemplate(value, data) {
19
- return html `
20
- <mo-field-date dense data-focus
21
- ?hideDatePicker=${this.hideDatePicker}
22
- label=${this.heading}
23
- .value=${value}
24
- @change=${(e) => this.handleEdit(e.detail, data)}
25
- ></mo-field-date>
19
+ return html `
20
+ <mo-field-date dense data-focus
21
+ ?hideDatePicker=${this.hideDatePicker}
22
+ label=${this.heading}
23
+ .value=${value}
24
+ @change=${(e) => this.handleEdit(e.detail, data)}
25
+ ></mo-field-date>
26
26
  `;
27
27
  }
28
28
  };
@@ -9,8 +9,8 @@ let DataGridColumnImage = class DataGridColumnImage extends DataGridColumn {
9
9
  }
10
10
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
11
11
  getContentTemplate(value, _data) {
12
- return !value ? nothing : html `
13
- <img style='vertical-align: middle' src=${value} onload='this.hidden = false' onerror='this.hidden = true'/>
12
+ return !value ? nothing : html `
13
+ <img style='vertical-align: middle' src=${value} onload='this.hidden = false' onerror='this.hidden = true'/>
14
14
  `;
15
15
  }
16
16
  };
@@ -9,11 +9,11 @@ let DataGridColumnNumber = class DataGridColumnNumber extends DataGridColumnNumb
9
9
  return html `${Number.isFinite(value) ? (_a = value === null || value === void 0 ? void 0 : value.format()) !== null && _a !== void 0 ? _a : nothing : nothing}`;
10
10
  }
11
11
  getEditContentTemplate(value, data) {
12
- return html `
13
- <mo-field-number dense label=${this.heading} data-focus
14
- value=${ifDefined(value)}
15
- @change=${(e) => this.handleEdit(e.detail, data)}
16
- ></mo-field-number>
12
+ return html `
13
+ <mo-field-number dense label=${this.heading} data-focus
14
+ value=${ifDefined(value)}
15
+ @change=${(e) => this.handleEdit(e.detail, data)}
16
+ ></mo-field-number>
17
17
  `;
18
18
  }
19
19
  getSumTemplate(sum) {
@@ -9,12 +9,12 @@ let DataGridColumnPercent = class DataGridColumnPercent extends DataGridColumnNu
9
9
  return html `${Number.isFinite(value) ? (_a = value === null || value === void 0 ? void 0 : value.formatAsPercent()) !== null && _a !== void 0 ? _a : nothing : nothing}`;
10
10
  }
11
11
  getEditContentTemplate(value, data) {
12
- return html `
13
- <mo-field-percent dense data-focus
14
- label=${this.heading}
15
- value=${ifDefined(value)}
16
- @change=${(e) => this.handleEdit(e.detail, data)}
17
- ></mo-field-percent>
12
+ return html `
13
+ <mo-field-percent dense data-focus
14
+ label=${this.heading}
15
+ value=${ifDefined(value)}
16
+ @change=${(e) => this.handleEdit(e.detail, data)}
17
+ ></mo-field-percent>
18
18
  `;
19
19
  }
20
20
  getSumTemplate(sum) {
@@ -8,11 +8,11 @@ let DataGridColumnText = class DataGridColumnText extends DataGridColumn {
8
8
  return html `${value !== null && value !== void 0 ? value : ''}`;
9
9
  }
10
10
  getEditContentTemplate(value, data) {
11
- return html `
12
- <mo-field-text dense label=${this.heading} data-focus
13
- value=${ifDefined(value)}
14
- @change=${(e) => this.handleEdit(e.detail, data)}
15
- ></mo-field-text>
11
+ return html `
12
+ <mo-field-text dense label=${this.heading} data-focus
13
+ value=${ifDefined(value)}
14
+ @change=${(e) => this.handleEdit(e.detail, data)}
15
+ ></mo-field-text>
16
16
  `;
17
17
  }
18
18
  };
@@ -11,29 +11,29 @@ let DataGridFooterSum = class DataGridFooterSum extends Component {
11
11
  this.heading = '';
12
12
  }
13
13
  static get styles() {
14
- return css `
15
- :host {
16
- display: flex;
17
- flex-direction: column;
18
- position: relative;
19
- max-height: 100%;
20
- line-height: 1em;
21
- }
22
-
23
- div {
24
- color: var(--mo-color-foreground-transparent);
25
- font-size: x-small;
26
- text-transform: uppercase;
27
- text-align: center;
28
- }
14
+ return css `
15
+ :host {
16
+ display: flex;
17
+ flex-direction: column;
18
+ position: relative;
19
+ max-height: 100%;
20
+ line-height: 1em;
21
+ }
22
+
23
+ div {
24
+ color: var(--mo-color-foreground-transparent);
25
+ font-size: x-small;
26
+ text-transform: uppercase;
27
+ text-align: center;
28
+ }
29
29
  `;
30
30
  }
31
31
  get template() {
32
- return html `
33
- <div>${this.heading}</div>
34
- <mo-flex direction='horizontal' justifyContent='center'>
35
- <slot></slot>
36
- </mo-flex>
32
+ return html `
33
+ <div>${this.heading}</div>
34
+ <mo-flex direction='horizontal' justifyContent='center'>
35
+ <slot></slot>
36
+ </mo-flex>
37
37
  `;
38
38
  }
39
39
  };
@@ -3,48 +3,48 @@ import { css, component, html } from '@a11d/lit';
3
3
  import { DataGridRow } from './DataGridRow.js';
4
4
  let DataGridDefaultRow = class DataGridDefaultRow extends DataGridRow {
5
5
  static get styles() {
6
- return css `
7
- ${super.styles}
8
-
9
- mo-grid {
10
- height: var(--mo-data-grid-row-height);
11
- grid-template-columns: var(--mo-data-grid-columns);
12
- column-gap: var(--mo-data-grid-columns-gap);
13
- }
14
-
15
- mo-flex {
16
- white-space: nowrap;
17
- text-overflow: ellipsis;
18
- overflow: hidden;
19
- }
20
-
21
- #selectionContainer {
22
- height: var(--mo-data-grid-row-height);
23
- }
24
-
25
- #detailsContainer [instanceof*=mo-data-grid] {
26
- --mo-data-grid-header-background: rgba(var(--mo-color-foreground-base), 0.04);
27
- --mo-data-grid-alternating-background: transparent;
28
- --mo-data-grid-content-min-height: 0px;
29
- }
30
-
31
- #detailsContainer [instanceof*=mo-data-grid]:not([headerHidden]) {
32
- background: var(--mo-color-transparent-gray-1);
33
- }
34
-
35
- :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid]:not([headerHidden]) {
36
- margin: 16px var(--mo-details-data-grid-start-margin);
37
- width: calc(100% - calc(var(--mo-details-data-grid-start-margin) * 2));
38
- }
39
-
40
- :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid] {
41
- padding: 0px !important;
42
- }
43
-
44
- :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid][headerHidden] {
45
- margin-inline-start: var(--mo-details-data-grid-start-margin);
46
- width: calc(100% - var(--mo-details-data-grid-start-margin));
47
- }
6
+ return css `
7
+ ${super.styles}
8
+
9
+ mo-grid {
10
+ height: var(--mo-data-grid-row-height);
11
+ grid-template-columns: var(--mo-data-grid-columns);
12
+ column-gap: var(--mo-data-grid-columns-gap);
13
+ }
14
+
15
+ mo-flex {
16
+ white-space: nowrap;
17
+ text-overflow: ellipsis;
18
+ overflow: hidden;
19
+ }
20
+
21
+ #selectionContainer {
22
+ height: var(--mo-data-grid-row-height);
23
+ }
24
+
25
+ #detailsContainer [instanceof*=mo-data-grid] {
26
+ --mo-data-grid-header-background: rgba(var(--mo-color-foreground-base), 0.04);
27
+ --mo-data-grid-alternating-background: transparent;
28
+ --mo-data-grid-content-min-height: 0px;
29
+ }
30
+
31
+ #detailsContainer [instanceof*=mo-data-grid]:not([headerHidden]) {
32
+ background: var(--mo-color-transparent-gray-1);
33
+ }
34
+
35
+ :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid]:not([headerHidden]) {
36
+ margin: 16px var(--mo-details-data-grid-start-margin);
37
+ width: calc(100% - calc(var(--mo-details-data-grid-start-margin) * 2));
38
+ }
39
+
40
+ :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid] {
41
+ padding: 0px !important;
42
+ }
43
+
44
+ :host-context(:not([hasDetails]):not([selectionMode=single]):not([selectionMode=multiple])) #detailsContainer > [instanceof*=mo-data-grid][headerHidden] {
45
+ margin-inline-start: var(--mo-details-data-grid-start-margin);
46
+ width: calc(100% - var(--mo-details-data-grid-start-margin));
47
+ }
48
48
  `;
49
49
  }
50
50
  updated(...parameters) {
@@ -55,11 +55,11 @@ let DataGridDefaultRow = class DataGridDefaultRow extends DataGridRow {
55
55
  }
56
56
  }
57
57
  get rowTemplate() {
58
- return html `
59
- ${this.detailsExpanderTemplate}
60
- ${this.selectionTemplate}
61
- ${this.dataGrid.columns.map(column => this.getCellTemplate(column))}
62
- ${this.contextMenuIconButtonTemplate}
58
+ return html `
59
+ ${this.detailsExpanderTemplate}
60
+ ${this.selectionTemplate}
61
+ ${this.dataGrid.columns.map(column => this.getCellTemplate(column))}
62
+ ${this.contextMenuIconButtonTemplate}
63
63
  `;
64
64
  }
65
65
  };