@3mo/data-grid 0.5.13 → 0.5.14
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.
- package/dist/CsvGenerator.d.ts.map +1 -1
- package/dist/CsvGenerator.js +19 -6
- package/dist/DataGrid.js +5 -5
- package/dist/DataGridCell.js +40 -40
- package/dist/DataGridHeader.js +90 -90
- package/dist/DataGridHeaderSeparator.js +45 -45
- package/dist/DataGridSidePanel.js +108 -108
- package/dist/columns/DataGridColumnBoolean.js +9 -9
- package/dist/columns/DataGridColumnText.js +5 -5
- package/dist/columns/date-time/DataGridColumnDateTimeBase.js +9 -9
- package/dist/columns/number/DataGridColumnCurrency.js +9 -9
- package/dist/columns/number/DataGridColumnNumber.js +5 -5
- package/dist/columns/number/DataGridColumnPercent.js +6 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -31,133 +31,133 @@ let DataGridSidePanel = class DataGridSidePanel extends Component {
|
|
|
31
31
|
this.dataGrid.requestUpdate();
|
|
32
32
|
await this.dataGrid.updateComplete;
|
|
33
33
|
};
|
|
34
|
-
return html `
|
|
35
|
-
<mo-checkbox ${style({ height: '30px' })}
|
|
36
|
-
label=${column.heading}
|
|
37
|
-
?selected=${column.hidden === false}
|
|
38
|
-
@change=${change}
|
|
39
|
-
></mo-checkbox>
|
|
34
|
+
return html `
|
|
35
|
+
<mo-checkbox ${style({ height: '30px' })}
|
|
36
|
+
label=${column.heading}
|
|
37
|
+
?selected=${column.hidden === false}
|
|
38
|
+
@change=${change}
|
|
39
|
+
></mo-checkbox>
|
|
40
40
|
`;
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
static get styles() {
|
|
44
|
-
return css `
|
|
45
|
-
:host {
|
|
46
|
-
display: inline-block !important;
|
|
47
|
-
transition: 250ms;
|
|
48
|
-
width: 100%;
|
|
49
|
-
height: 100%;
|
|
50
|
-
transform-origin: right center;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:host(:not([hidden])) {
|
|
54
|
-
border-inline-start: var(--mo-data-grid-border);
|
|
55
|
-
background: var(--mo-color-transparent-gray-1);
|
|
56
|
-
opacity: 1;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
:host([hidden]) {
|
|
60
|
-
opacity: 0;
|
|
61
|
-
transform: scale(0, 1);
|
|
62
|
-
width: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#flexHeading {
|
|
66
|
-
border-top: var(--mo-data-grid-border);
|
|
67
|
-
border-bottom: var(--mo-data-grid-border);
|
|
68
|
-
height: var(--mo-data-grid-header-height);
|
|
69
|
-
padding-inline-start: 14px;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
mo-scroller {
|
|
73
|
-
overflow-x: hidden;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
mo-section {
|
|
77
|
-
padding: 10px 14px 20px;
|
|
78
|
-
border-bottom: var(--mo-data-grid-border);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
mo-section::part(heading) {
|
|
82
|
-
font-size: min(1em, 14px);
|
|
83
|
-
letter-spacing: 0.15px;
|
|
84
|
-
}
|
|
44
|
+
return css `
|
|
45
|
+
:host {
|
|
46
|
+
display: inline-block !important;
|
|
47
|
+
transition: 250ms;
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
transform-origin: right center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host(:not([hidden])) {
|
|
54
|
+
border-inline-start: var(--mo-data-grid-border);
|
|
55
|
+
background: var(--mo-color-transparent-gray-1);
|
|
56
|
+
opacity: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([hidden]) {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transform: scale(0, 1);
|
|
62
|
+
width: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#flexHeading {
|
|
66
|
+
border-top: var(--mo-data-grid-border);
|
|
67
|
+
border-bottom: var(--mo-data-grid-border);
|
|
68
|
+
height: var(--mo-data-grid-header-height);
|
|
69
|
+
padding-inline-start: 14px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
mo-scroller {
|
|
73
|
+
overflow-x: hidden;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
mo-section {
|
|
77
|
+
padding: 10px 14px 20px;
|
|
78
|
+
border-bottom: var(--mo-data-grid-border);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
mo-section::part(heading) {
|
|
82
|
+
font-size: min(1em, 14px);
|
|
83
|
+
letter-spacing: 0.15px;
|
|
84
|
+
}
|
|
85
85
|
`;
|
|
86
86
|
}
|
|
87
87
|
get template() {
|
|
88
|
-
return html `
|
|
89
|
-
<mo-flex ${style({ height: '100%' })}>
|
|
90
|
-
${this.dataGrid.hasToolbar || this.dataGrid.hasFilters === false ? html.nothing : html `
|
|
91
|
-
<mo-tab-bar ${style({ height: '60px' })}
|
|
92
|
-
value=${ifDefined(this.dataGrid.sidePanelTab)}
|
|
93
|
-
@change=${(e) => this.dataGrid.navigateToSidePanelTab(e.detail ?? DataGridSidePanelTab.Settings)}
|
|
94
|
-
>
|
|
95
|
-
<mo-tab value=${DataGridSidePanelTab.Filters}>
|
|
96
|
-
<mo-icon icon='filter_list'></mo-icon>
|
|
97
|
-
${t('Extended Filters')}
|
|
98
|
-
</mo-tab>
|
|
99
|
-
<mo-tab value=${DataGridSidePanelTab.Settings}>
|
|
100
|
-
<mo-icon icon='settings'></mo-icon>
|
|
101
|
-
${t('Settings')}
|
|
102
|
-
</mo-tab>
|
|
103
|
-
</mo-tab-bar>
|
|
104
|
-
`}
|
|
105
|
-
|
|
106
|
-
${this.dataGrid.hasToolbar === false && this.dataGrid.hasFilters === true ? html.nothing : html `
|
|
107
|
-
<mo-flex id='flexHeading' direction='horizontal' alignItems='center'>
|
|
108
|
-
<mo-heading typography='heading6' ${style({ flex: '1', color: 'var(--mo-color-on-surface)' })}>${t(this.dataGrid.sidePanelTab === DataGridSidePanelTab.Filters ? 'Extended Filters' : 'Settings')}</mo-heading>
|
|
109
|
-
<mo-icon-button icon='close' dense
|
|
110
|
-
${tooltip(t('Close'))}
|
|
111
|
-
${style({ cursor: 'pointer', color: 'var(--mo-color-gray)' })}
|
|
112
|
-
@click=${() => this.dataGrid.navigateToSidePanelTab(undefined)}
|
|
113
|
-
></mo-icon-button>
|
|
114
|
-
</mo-flex>
|
|
115
|
-
`}
|
|
116
|
-
|
|
117
|
-
<mo-scroller ${style({ flex: '1' })}>
|
|
118
|
-
${this.dataGrid.sidePanelTab === DataGridSidePanelTab.Filters ? this.filtersTemplate : this.settingsTemplate}
|
|
119
|
-
</mo-scroller>
|
|
120
|
-
</mo-flex>
|
|
88
|
+
return html `
|
|
89
|
+
<mo-flex ${style({ height: '100%' })}>
|
|
90
|
+
${this.dataGrid.hasToolbar || this.dataGrid.hasFilters === false ? html.nothing : html `
|
|
91
|
+
<mo-tab-bar ${style({ height: '60px' })}
|
|
92
|
+
value=${ifDefined(this.dataGrid.sidePanelTab)}
|
|
93
|
+
@change=${(e) => this.dataGrid.navigateToSidePanelTab(e.detail ?? DataGridSidePanelTab.Settings)}
|
|
94
|
+
>
|
|
95
|
+
<mo-tab value=${DataGridSidePanelTab.Filters}>
|
|
96
|
+
<mo-icon icon='filter_list'></mo-icon>
|
|
97
|
+
${t('Extended Filters')}
|
|
98
|
+
</mo-tab>
|
|
99
|
+
<mo-tab value=${DataGridSidePanelTab.Settings}>
|
|
100
|
+
<mo-icon icon='settings'></mo-icon>
|
|
101
|
+
${t('Settings')}
|
|
102
|
+
</mo-tab>
|
|
103
|
+
</mo-tab-bar>
|
|
104
|
+
`}
|
|
105
|
+
|
|
106
|
+
${this.dataGrid.hasToolbar === false && this.dataGrid.hasFilters === true ? html.nothing : html `
|
|
107
|
+
<mo-flex id='flexHeading' direction='horizontal' alignItems='center'>
|
|
108
|
+
<mo-heading typography='heading6' ${style({ flex: '1', color: 'var(--mo-color-on-surface)' })}>${t(this.dataGrid.sidePanelTab === DataGridSidePanelTab.Filters ? 'Extended Filters' : 'Settings')}</mo-heading>
|
|
109
|
+
<mo-icon-button icon='close' dense
|
|
110
|
+
${tooltip(t('Close'))}
|
|
111
|
+
${style({ cursor: 'pointer', color: 'var(--mo-color-gray)' })}
|
|
112
|
+
@click=${() => this.dataGrid.navigateToSidePanelTab(undefined)}
|
|
113
|
+
></mo-icon-button>
|
|
114
|
+
</mo-flex>
|
|
115
|
+
`}
|
|
116
|
+
|
|
117
|
+
<mo-scroller ${style({ flex: '1' })}>
|
|
118
|
+
${this.dataGrid.sidePanelTab === DataGridSidePanelTab.Filters ? this.filtersTemplate : this.settingsTemplate}
|
|
119
|
+
</mo-scroller>
|
|
120
|
+
</mo-flex>
|
|
121
121
|
`;
|
|
122
122
|
}
|
|
123
123
|
get filtersTemplate() {
|
|
124
|
-
return html `
|
|
125
|
-
<mo-flex gap='14px' style='padding: 14px'>
|
|
126
|
-
<slot name='filter'></slot>
|
|
127
|
-
</mo-flex>
|
|
124
|
+
return html `
|
|
125
|
+
<mo-flex gap='14px' style='padding: 14px'>
|
|
126
|
+
<slot name='filter'></slot>
|
|
127
|
+
</mo-flex>
|
|
128
128
|
`;
|
|
129
129
|
}
|
|
130
130
|
get settingsTemplate() {
|
|
131
|
-
return html `
|
|
132
|
-
<mo-flex>
|
|
133
|
-
<slot name='settings'></slot>
|
|
134
|
-
|
|
135
|
-
<mo-section heading=${t('Design')}>
|
|
136
|
-
<mo-flex gap='16px'>
|
|
137
|
-
<mo-field-select label=${t('Font Size')} ${bind(this, 'dataGrid', { keyPath: 'cellFontSize' })}>
|
|
131
|
+
return html `
|
|
132
|
+
<mo-flex>
|
|
133
|
+
<slot name='settings'></slot>
|
|
134
|
+
|
|
135
|
+
<mo-section heading=${t('Design')}>
|
|
136
|
+
<mo-flex gap='16px'>
|
|
137
|
+
<mo-field-select label=${t('Font Size')} ${bind(this, 'dataGrid', { keyPath: 'cellFontSize' })}>
|
|
138
138
|
${Array.from({ length: 5 }).map((_, i) => {
|
|
139
139
|
const value = 0.8 + i * 0.1;
|
|
140
140
|
return html `<mo-option value=${value}>${(value * 100).formatAsPercent()}</mo-option>`;
|
|
141
|
-
})}
|
|
142
|
-
</mo-field-select>
|
|
143
|
-
<mo-field-select label=${t('Row Height')} ${bind(this, 'dataGrid', { keyPath: 'rowHeight' })}>
|
|
141
|
+
})}
|
|
142
|
+
</mo-field-select>
|
|
143
|
+
<mo-field-select label=${t('Row Height')} ${bind(this, 'dataGrid', { keyPath: 'rowHeight' })}>
|
|
144
144
|
${Array.from({ length: 7 }).map((_, i) => {
|
|
145
145
|
const value = 30 + i * 5;
|
|
146
146
|
return html `<mo-option value=${value}>${value}px</mo-option>`;
|
|
147
|
-
})}
|
|
148
|
-
</mo-field-select>
|
|
149
|
-
</mo-flex>
|
|
150
|
-
</mo-section>
|
|
151
|
-
|
|
152
|
-
<mo-section .heading=${html `
|
|
153
|
-
${t('Columns')}
|
|
154
|
-
<span style='color: var(--mo-color-gray)'>
|
|
155
|
-
${this.dataGrid.visibleColumns.length.format()}/${this.dataGrid.columns.length.format()}
|
|
156
|
-
</span>
|
|
157
|
-
`}>
|
|
158
|
-
${this.dataGrid.columns.map(this.getColumnTemplate)}
|
|
159
|
-
</mo-section>
|
|
160
|
-
</mo-flex>
|
|
147
|
+
})}
|
|
148
|
+
</mo-field-select>
|
|
149
|
+
</mo-flex>
|
|
150
|
+
</mo-section>
|
|
151
|
+
|
|
152
|
+
<mo-section .heading=${html `
|
|
153
|
+
${t('Columns')}
|
|
154
|
+
<span style='color: var(--mo-color-gray)'>
|
|
155
|
+
${this.dataGrid.visibleColumns.length.format()}/${this.dataGrid.columns.length.format()}
|
|
156
|
+
</span>
|
|
157
|
+
`}>
|
|
158
|
+
${this.dataGrid.columns.map(this.getColumnTemplate)}
|
|
159
|
+
</mo-section>
|
|
160
|
+
</mo-flex>
|
|
161
161
|
`;
|
|
162
162
|
}
|
|
163
163
|
};
|
|
@@ -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 autofocus
|
|
31
|
-
?selected=${value}
|
|
32
|
-
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
33
|
-
></mo-checkbox>
|
|
29
|
+
return html `
|
|
30
|
+
<mo-checkbox autofocus
|
|
31
|
+
?selected=${value}
|
|
32
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
33
|
+
></mo-checkbox>
|
|
34
34
|
`;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
@@ -8,11 +8,11 @@ let DataGridColumnText = class DataGridColumnText extends DataGridColumn {
|
|
|
8
8
|
return html `${value ?? ''}`;
|
|
9
9
|
}
|
|
10
10
|
getEditContentTemplate(value, data) {
|
|
11
|
-
return html `
|
|
12
|
-
<mo-field-text dense label=${this.heading} autofocus
|
|
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} autofocus
|
|
13
|
+
value=${ifDefined(value)}
|
|
14
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
15
|
+
></mo-field-text>
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -14,15 +14,15 @@ export class DataGridColumnDateTimeBase extends DataGridColumn {
|
|
|
14
14
|
return this.formatOptions ?? this.constructor.defaultFormatOptions;
|
|
15
15
|
}
|
|
16
16
|
getEditContentTemplate(value, data) {
|
|
17
|
-
return html `
|
|
18
|
-
${staticHtml `
|
|
19
|
-
<${this.fieldTag} dense autofocus
|
|
20
|
-
?pickerHidden=${this.pickerHidden}
|
|
21
|
-
label=${this.heading}
|
|
22
|
-
.value=${value}
|
|
23
|
-
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
24
|
-
></${this.fieldTag}>
|
|
25
|
-
`}
|
|
17
|
+
return html `
|
|
18
|
+
${staticHtml `
|
|
19
|
+
<${this.fieldTag} dense autofocus
|
|
20
|
+
?pickerHidden=${this.pickerHidden}
|
|
21
|
+
label=${this.heading}
|
|
22
|
+
.value=${value}
|
|
23
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
24
|
+
></${this.fieldTag}>
|
|
25
|
+
`}
|
|
26
26
|
`;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -18,18 +18,18 @@ let DataGridColumnCurrency = DataGridColumnCurrency_1 = class DataGridColumnCurr
|
|
|
18
18
|
return html `${this.getNumber(value)?.formatAsCurrency(this.currency) ?? html.nothing}`;
|
|
19
19
|
}
|
|
20
20
|
getEditContentTemplate(value, data) {
|
|
21
|
-
return html `
|
|
22
|
-
<mo-field-currency dense autofocus
|
|
23
|
-
.currency=${this.currency}
|
|
24
|
-
label=${this.heading}
|
|
25
|
-
value=${ifDefined(value)}
|
|
26
|
-
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
27
|
-
></mo-field-currency>
|
|
21
|
+
return html `
|
|
22
|
+
<mo-field-currency dense autofocus
|
|
23
|
+
.currency=${this.currency}
|
|
24
|
+
label=${this.heading}
|
|
25
|
+
value=${ifDefined(value)}
|
|
26
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
27
|
+
></mo-field-currency>
|
|
28
28
|
`;
|
|
29
29
|
}
|
|
30
30
|
getSumTemplate(sum) {
|
|
31
|
-
return html `
|
|
32
|
-
<span style='font-weight: 500'>${sum.formatAsCurrency(this.currency)}</span>
|
|
31
|
+
return html `
|
|
32
|
+
<span style='font-weight: 500'>${sum.formatAsCurrency(this.currency)}</span>
|
|
33
33
|
`;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
@@ -8,11 +8,11 @@ let DataGridColumnNumber = class DataGridColumnNumber extends DataGridColumnNumb
|
|
|
8
8
|
return html `${this.getNumber(value)?.format() ?? html.nothing}`;
|
|
9
9
|
}
|
|
10
10
|
getEditContentTemplate(value, data) {
|
|
11
|
-
return html `
|
|
12
|
-
<mo-field-number dense label=${this.heading} autofocus
|
|
13
|
-
value=${ifDefined(value)}
|
|
14
|
-
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
15
|
-
></mo-field-number>
|
|
11
|
+
return html `
|
|
12
|
+
<mo-field-number dense label=${this.heading} autofocus
|
|
13
|
+
value=${ifDefined(value)}
|
|
14
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
15
|
+
></mo-field-number>
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
18
|
getSumTemplate(sum) {
|
|
@@ -8,12 +8,12 @@ let DataGridColumnPercent = class DataGridColumnPercent extends DataGridColumnNu
|
|
|
8
8
|
return html `${this.getNumber(value)?.formatAsPercent() ?? html.nothing}`;
|
|
9
9
|
}
|
|
10
10
|
getEditContentTemplate(value, data) {
|
|
11
|
-
return html `
|
|
12
|
-
<mo-field-percent dense autofocus
|
|
13
|
-
label=${this.heading}
|
|
14
|
-
value=${ifDefined(value)}
|
|
15
|
-
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
16
|
-
></mo-field-percent>
|
|
11
|
+
return html `
|
|
12
|
+
<mo-field-percent dense autofocus
|
|
13
|
+
label=${this.heading}
|
|
14
|
+
value=${ifDefined(value)}
|
|
15
|
+
@change=${(e) => this.handleEdit(e.detail, data)}
|
|
16
|
+
></mo-field-percent>
|
|
17
17
|
`;
|
|
18
18
|
}
|
|
19
19
|
getSumTemplate(sum) {
|