@exmg/exm-grid 1.1.36 → 1.2.0
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/.rollup.cache/root/repo/packages/exm-grid/dist/index.d.ts +14 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/index.js +14 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/search/exm-toolbar-search.d.ts +25 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/search/exm-toolbar-search.js +88 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-base-toolbar-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-base-toolbar-styles-css.js +98 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-common-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-common-styles-css.js +104 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-pagination-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-pagination-styles-css.js +104 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-setting-selection-list-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-setting-selection-list-styles-css.js +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-styles-css.js +414 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-base-toolbar.d.ts +23 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-base-toolbar.js +94 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-pagination.d.ts +37 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-pagination.js +153 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.d.ts +24 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.js +124 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-smart-toolbar.d.ts +31 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-smart-toolbar.js +138 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-filters.d.ts +36 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-filters.js +77 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar.d.ts +41 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar.js +198 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid.d.ts +130 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid.js +333 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-column-sortable.d.ts +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-column-sortable.js +50 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-expandable.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-expandable.js +42 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-selectable.d.ts +20 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-selectable.js +204 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-sortable.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-sortable.js +50 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.d.ts +17 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.js +6 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-toolbar-types.d.ts +55 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-toolbar-types.js +16 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-types.d.ts +15 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/utils/exm-query-selectors.d.ts +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/utils/exm-query-selectors.js +37 -0
- package/dist/index.js +3 -3
- package/dist/search/exm-toolbar-search.js +6 -5
- package/dist/styles/exm-grid-base-toolbar-styles-css.js +5 -2
- package/dist/styles/exm-grid-common-styles-css.js +5 -2
- package/dist/styles/exm-grid-pagination-styles-css.js +5 -2
- package/dist/styles/exm-grid-setting-selection-list-styles-css.js +5 -2
- package/dist/styles/exm-grid-styles-css.js +5 -2
- package/dist/table/exm-grid-base-toolbar.js +5 -3
- package/dist/table/exm-grid-pagination.js +5 -3
- package/dist/table/exm-grid-setting-selection-list.js +5 -3
- package/dist/table/exm-grid-smart-toolbar.js +8 -6
- package/dist/table/exm-grid-toolbar-filters.js +6 -4
- package/dist/table/exm-grid-toolbar.js +6 -4
- package/dist/table/exm-grid.js +7 -5
- package/dist/table/featrues/exm-column-sortable.js +4 -2
- package/dist/table/featrues/exm-row-expandable.js +4 -2
- package/dist/table/featrues/exm-row-selectable.js +4 -2
- package/dist/table/featrues/exm-row-sortable.js +4 -2
- package/dist/table/types/exm-grid-smart-toolbar-types.js +5 -3
- package/dist/table/types/exm-grid-toolbar-types.js +9 -7
- package/dist/table/utils/exm-query-selectors.js +4 -2
- package/package.json +4 -4
- /package/{dist → .rollup.cache/root/repo/packages/exm-grid/dist}/table/exm-grid-toolbar-css.js +0 -0
- /package/{dist → .rollup.cache/root/repo/packages/exm-grid/dist}/table/types/exm-grid-types.js +0 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
5
|
+
import '@material/web/iconbutton/icon-button.js';
|
|
6
|
+
import '@material/web/icon/icon.js';
|
|
7
|
+
import './exm-grid-toolbar-filters.js';
|
|
8
|
+
import { style } from '../styles/exm-grid-pagination-styles-css.js';
|
|
9
|
+
/**
|
|
10
|
+
* ### Styling
|
|
11
|
+
* The following custom properties are available for styling:
|
|
12
|
+
*
|
|
13
|
+
* Custom property | Description | Default
|
|
14
|
+
* ----------------|-------------|----------
|
|
15
|
+
* `--exm-theme-table-pagination-bg-color` | pagination background color | `var(--mdc-theme-surface, #ffffff);`
|
|
16
|
+
* `--exm-theme-table-pagination-color` | pagination foreground (mostly text) color | `var(--mdc-theme-on-surface, #02182b);`
|
|
17
|
+
*/
|
|
18
|
+
let ExmGridPagination = class ExmGridPagination extends ExmgElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.pageSizeLabel = 'Rows per page:';
|
|
22
|
+
this.pageSizeOptions = [10, 20, 30];
|
|
23
|
+
this.pageSize = this.pageSizeOptions[0];
|
|
24
|
+
this.pageIndex = 0;
|
|
25
|
+
this.itemCount = 0;
|
|
26
|
+
}
|
|
27
|
+
renderPageSizeLabel() {
|
|
28
|
+
return html ` ${this.pageSizeLabel} `;
|
|
29
|
+
}
|
|
30
|
+
renderPageSizeOptions() {
|
|
31
|
+
const items = (this.pageSizeOptions || []).map((item) => ({ label: `${item}`, value: `${item}` }));
|
|
32
|
+
return html `
|
|
33
|
+
<exm-grid-toolbar-filters
|
|
34
|
+
id="pageSizeOptions"
|
|
35
|
+
selected="${this.pageSize}"
|
|
36
|
+
.items=${items}
|
|
37
|
+
@exm-grid-toolbar-filter-changed="${this.handleOnPageSizeChanged}"
|
|
38
|
+
></exm-grid-toolbar-filters>
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
renderPageRangeLabel() {
|
|
42
|
+
if (this.itemCount > 0) {
|
|
43
|
+
return html `
|
|
44
|
+
<span>
|
|
45
|
+
${this.pageIndex * this.pageSize + 1}- ${Math.min((this.pageIndex + 1) * this.pageSize, this.itemCount)} of
|
|
46
|
+
${this.itemCount}
|
|
47
|
+
</span>
|
|
48
|
+
`;
|
|
49
|
+
}
|
|
50
|
+
return html ` <span>${this.pageIndex * this.pageSize + 1}-${(this.pageIndex + 1) * this.pageSize}</span> `;
|
|
51
|
+
}
|
|
52
|
+
renderPageRangeActions() {
|
|
53
|
+
return html ` ${this.renderPrevPage()} ${this.renderNextPage()} `;
|
|
54
|
+
}
|
|
55
|
+
renderPrevPage() {
|
|
56
|
+
const enabled = this.pageIndex > 0;
|
|
57
|
+
return html `
|
|
58
|
+
<md-icon-button
|
|
59
|
+
id="prevPageBtn"
|
|
60
|
+
?disabled="${!enabled}"
|
|
61
|
+
class="actions"
|
|
62
|
+
title="Previous page"
|
|
63
|
+
@click="${enabled ? this.handleOnClickPrev : undefined}"
|
|
64
|
+
><md-icon>navigate_before</md-icon></md-icon-button
|
|
65
|
+
>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
renderNextPage() {
|
|
69
|
+
const enabled = this.itemCount && this.itemCount > (this.pageIndex + 1) * this.pageSize;
|
|
70
|
+
return html `
|
|
71
|
+
<md-icon-button
|
|
72
|
+
id="nextPageBtn"
|
|
73
|
+
?disabled="${!enabled}"
|
|
74
|
+
class="actions"
|
|
75
|
+
title="Next page"
|
|
76
|
+
@click="${enabled ? this.handleOnClickNext : undefined}"
|
|
77
|
+
><md-icon>navigate_next</md-icon></md-icon-button
|
|
78
|
+
>
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
fireEventPageChanged(page) {
|
|
82
|
+
this.dispatchEvent(new CustomEvent('exm-grid-pagination-page-changed', { bubbles: true, composed: true, detail: { page } }));
|
|
83
|
+
}
|
|
84
|
+
handleOnClickPrev(e) {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
this.pageIndex = this.pageIndex - 1;
|
|
87
|
+
this.fireEventPageChanged(this.pageIndex);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
handleOnClickNext(e) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
this.pageIndex = this.pageIndex + 1;
|
|
93
|
+
this.fireEventPageChanged(this.pageIndex);
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
handleOnPageSizeChanged(e) {
|
|
97
|
+
const { value } = e.detail;
|
|
98
|
+
if (typeof value !== 'undefined') {
|
|
99
|
+
this.pageSize = parseInt(value, 10);
|
|
100
|
+
this.pageIndex = 0;
|
|
101
|
+
this.dispatchEvent(new CustomEvent('exm-grid-pagination-page-size-changed', {
|
|
102
|
+
bubbles: true,
|
|
103
|
+
composed: true,
|
|
104
|
+
detail: { pageSize: this.pageSize, page: this.pageIndex },
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
render() {
|
|
109
|
+
// tslint:disable:max-line-length
|
|
110
|
+
return html `
|
|
111
|
+
<style>
|
|
112
|
+
:host {
|
|
113
|
+
md-icon-button {
|
|
114
|
+
fill: var(--md-sys-color-on-surface);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
118
|
+
<div class="wrapper">
|
|
119
|
+
<div class="page-size">
|
|
120
|
+
<div class="page-size-label">${this.renderPageSizeLabel()}</div>
|
|
121
|
+
<div class="page-size-options">${this.renderPageSizeOptions()}</div>
|
|
122
|
+
</div>
|
|
123
|
+
<div class="page-range">
|
|
124
|
+
<div class="page-range-label">${this.renderPageRangeLabel()}</div>
|
|
125
|
+
<div class="page-range-actions">${this.renderPageRangeActions()}</div>
|
|
126
|
+
</div>
|
|
127
|
+
<div></div>
|
|
128
|
+
</div>
|
|
129
|
+
`;
|
|
130
|
+
// tslint:enable:max-line-length
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
ExmGridPagination.styles = [style];
|
|
134
|
+
__decorate([
|
|
135
|
+
property({ type: String, attribute: 'page-size-label' })
|
|
136
|
+
], ExmGridPagination.prototype, "pageSizeLabel", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ type: Array, attribute: 'page-size-options' })
|
|
139
|
+
], ExmGridPagination.prototype, "pageSizeOptions", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ type: Number, attribute: 'page-size' })
|
|
142
|
+
], ExmGridPagination.prototype, "pageSize", void 0);
|
|
143
|
+
__decorate([
|
|
144
|
+
property({ type: Number, attribute: 'page-index' })
|
|
145
|
+
], ExmGridPagination.prototype, "pageIndex", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
property({ type: Number, attribute: 'item-count' })
|
|
148
|
+
], ExmGridPagination.prototype, "itemCount", void 0);
|
|
149
|
+
ExmGridPagination = __decorate([
|
|
150
|
+
customElement('exm-grid-pagination')
|
|
151
|
+
], ExmGridPagination);
|
|
152
|
+
export { ExmGridPagination };
|
|
153
|
+
//# sourceMappingURL=exm-grid-pagination.js.map
|
package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
2
|
+
import '@material/web/menu/menu.js';
|
|
3
|
+
import '@material/web/menu/menu-item.js';
|
|
4
|
+
import '@material/web/icon/icon.js';
|
|
5
|
+
import '@material/web/iconbutton/icon-button.js';
|
|
6
|
+
import { SettingSelectionListItem } from './types/exm-grid-toolbar-types.js';
|
|
7
|
+
export declare class ExmGridSettingSelectionList extends ExmgElement {
|
|
8
|
+
tooltip: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
settingData: SettingSelectionListItem[];
|
|
11
|
+
private menu?;
|
|
12
|
+
private dispatchSettingsChanged;
|
|
13
|
+
private handleListAction;
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
protected firstUpdated(): Promise<void>;
|
|
16
|
+
private saveSettingsListToLocalStorage;
|
|
17
|
+
private getSettingsListFromLocalStorage;
|
|
18
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'exm-grid-setting-selection-list': ExmGridSettingSelectionList;
|
|
23
|
+
}
|
|
24
|
+
}
|
package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
5
|
+
import '@material/web/menu/menu.js';
|
|
6
|
+
import '@material/web/menu/menu-item.js';
|
|
7
|
+
import '@material/web/icon/icon.js';
|
|
8
|
+
import '@material/web/iconbutton/icon-button.js';
|
|
9
|
+
import { style } from '../styles/exm-grid-setting-selection-list-styles-css.js';
|
|
10
|
+
let ExmGridSettingSelectionList = class ExmGridSettingSelectionList extends ExmgElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.tooltip = '';
|
|
14
|
+
this.icon = 'filter_list';
|
|
15
|
+
this.settingData = [];
|
|
16
|
+
}
|
|
17
|
+
dispatchSettingsChanged() {
|
|
18
|
+
this.dispatchEvent(new CustomEvent('exm-grid-setting-changed', {
|
|
19
|
+
bubbles: true,
|
|
20
|
+
composed: true,
|
|
21
|
+
detail: {
|
|
22
|
+
value: [...this.settingData],
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
handleListAction(id) {
|
|
27
|
+
const index = this.settingData.findIndex((d) => d.id === id);
|
|
28
|
+
this.settingData[index].selected = !this.settingData[index].selected;
|
|
29
|
+
this.settingData = [...this.settingData];
|
|
30
|
+
this.saveSettingsListToLocalStorage();
|
|
31
|
+
this.dispatchSettingsChanged();
|
|
32
|
+
}
|
|
33
|
+
async firstUpdated() {
|
|
34
|
+
await this.updateComplete;
|
|
35
|
+
this.getSettingsListFromLocalStorage();
|
|
36
|
+
}
|
|
37
|
+
saveSettingsListToLocalStorage() {
|
|
38
|
+
const key = `columnSettingsV2:${window.location.pathname}`;
|
|
39
|
+
const value = this.settingData;
|
|
40
|
+
// .filter((d) => d.selected)
|
|
41
|
+
// .map((d) => d.id)
|
|
42
|
+
// .join(',');
|
|
43
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
44
|
+
return JSON.stringify(value);
|
|
45
|
+
}
|
|
46
|
+
getSettingsListFromLocalStorage() {
|
|
47
|
+
const key = `columnSettingsV2:${window.location.pathname}`;
|
|
48
|
+
let value = localStorage.getItem(key);
|
|
49
|
+
if (!value) {
|
|
50
|
+
value = this.saveSettingsListToLocalStorage();
|
|
51
|
+
}
|
|
52
|
+
const storageSettings = JSON.parse(value);
|
|
53
|
+
for (const setting of this.settingData) {
|
|
54
|
+
const ss = storageSettings === null || storageSettings === void 0 ? void 0 : storageSettings.find((s) => s.id === setting.id);
|
|
55
|
+
// setting not found in storage add
|
|
56
|
+
if (!ss) {
|
|
57
|
+
storageSettings === null || storageSettings === void 0 ? void 0 : storageSettings.push(setting);
|
|
58
|
+
}
|
|
59
|
+
// do not update checked state from settingsData if exists in storage
|
|
60
|
+
}
|
|
61
|
+
const toBeDeleted = [];
|
|
62
|
+
for (const storageSetting of storageSettings || []) {
|
|
63
|
+
const ss = this.settingData.find((s) => s.id === storageSetting.id);
|
|
64
|
+
// setting not found in settingdate -> remove entry from storage
|
|
65
|
+
if (!ss) {
|
|
66
|
+
toBeDeleted.push(storageSetting.id);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
for (const id of toBeDeleted) {
|
|
70
|
+
const index = storageSettings === null || storageSettings === void 0 ? void 0 : storageSettings.findIndex((s) => s.id === id);
|
|
71
|
+
if (index && index > -1) {
|
|
72
|
+
storageSettings === null || storageSettings === void 0 ? void 0 : storageSettings.splice(index, 1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
this.settingData = [...(storageSettings || [])];
|
|
76
|
+
this.saveSettingsListToLocalStorage();
|
|
77
|
+
this.dispatchSettingsChanged();
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
return html `
|
|
81
|
+
<md-icon-button
|
|
82
|
+
id="filterBtn"
|
|
83
|
+
@click=${() => this.menu.show()}
|
|
84
|
+
aria-controls="menu"
|
|
85
|
+
class="mdc-icon-button material-icons action"
|
|
86
|
+
title="${this.tooltip}"
|
|
87
|
+
data-mdc-ripple-is-unbounded="true"
|
|
88
|
+
><md-icon>${this.icon}</md-icon></md-icon-button
|
|
89
|
+
>
|
|
90
|
+
|
|
91
|
+
<md-menu
|
|
92
|
+
id="menu"
|
|
93
|
+
menu-corner="start-end"
|
|
94
|
+
anchor="filterBtn"
|
|
95
|
+
role="listbox"
|
|
96
|
+
aria-label="Column filter options"
|
|
97
|
+
multi
|
|
98
|
+
@action="${this.handleListAction}"
|
|
99
|
+
>
|
|
100
|
+
${this.settingData.map((item) => html ` <md-menu-item type="option" keep-open ?selected=${item.selected}>
|
|
101
|
+
<div slot="headline" @click=${() => this.handleListAction(item.id)}>${item.title}</div>
|
|
102
|
+
</md-menu-item>`)}
|
|
103
|
+
</md-menu>
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
ExmGridSettingSelectionList.styles = [style];
|
|
108
|
+
__decorate([
|
|
109
|
+
property({ type: String })
|
|
110
|
+
], ExmGridSettingSelectionList.prototype, "tooltip", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
property({ type: String })
|
|
113
|
+
], ExmGridSettingSelectionList.prototype, "icon", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property({ type: Array })
|
|
116
|
+
], ExmGridSettingSelectionList.prototype, "settingData", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
query('#menu')
|
|
119
|
+
], ExmGridSettingSelectionList.prototype, "menu", void 0);
|
|
120
|
+
ExmGridSettingSelectionList = __decorate([
|
|
121
|
+
customElement('exm-grid-setting-selection-list')
|
|
122
|
+
], ExmGridSettingSelectionList);
|
|
123
|
+
export { ExmGridSettingSelectionList };
|
|
124
|
+
//# sourceMappingURL=exm-grid-setting-selection-list.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
2
|
+
import './exm-grid-toolbar.js';
|
|
3
|
+
import { Filter, Setting, SettingSelectionListItem } from './types/exm-grid-toolbar-types.js';
|
|
4
|
+
import { ActionWithCondition } from './types/exm-grid-smart-toolbar-types.js';
|
|
5
|
+
export declare class ExmGridSmartToolbar extends ExmgElement {
|
|
6
|
+
description: string;
|
|
7
|
+
actions: ActionWithCondition[];
|
|
8
|
+
filters: Filter[];
|
|
9
|
+
settings: Setting[];
|
|
10
|
+
amountOfSelectedItems: number;
|
|
11
|
+
showColumnFilter: boolean;
|
|
12
|
+
columnFilterButtonTooltip: string;
|
|
13
|
+
columnFilterDialogTitle: string;
|
|
14
|
+
columnFilterColumns: SettingSelectionListItem[];
|
|
15
|
+
searchEnabled: boolean;
|
|
16
|
+
searchPlaceholder: string;
|
|
17
|
+
disableSeperator: boolean;
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
private getActions;
|
|
20
|
+
private shouldActionBeVisible;
|
|
21
|
+
private isActionAmountSelectedItemsCondition;
|
|
22
|
+
private checkAmountOfSelectedItemsRangeCondition;
|
|
23
|
+
private getFilters;
|
|
24
|
+
private getSettings;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
}
|
|
27
|
+
declare global {
|
|
28
|
+
interface HTMLElementTagNameMap {
|
|
29
|
+
'exm-grid-smart-toolbar': ExmGridSmartToolbar;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
5
|
+
import './exm-grid-toolbar.js';
|
|
6
|
+
import { SettingConfigId, SettingConfigType, } from './types/exm-grid-toolbar-types.js';
|
|
7
|
+
import { ActionConditionType, } from './types/exm-grid-smart-toolbar-types.js';
|
|
8
|
+
let ExmGridSmartToolbar = class ExmGridSmartToolbar extends ExmgElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.description = '';
|
|
12
|
+
this.actions = [];
|
|
13
|
+
this.filters = [];
|
|
14
|
+
this.settings = [];
|
|
15
|
+
this.amountOfSelectedItems = 0;
|
|
16
|
+
this.showColumnFilter = false;
|
|
17
|
+
this.columnFilterButtonTooltip = 'Column selection';
|
|
18
|
+
this.columnFilterDialogTitle = 'Select columns';
|
|
19
|
+
this.columnFilterColumns = [];
|
|
20
|
+
this.searchEnabled = false;
|
|
21
|
+
this.searchPlaceholder = 'Search';
|
|
22
|
+
this.disableSeperator = false;
|
|
23
|
+
}
|
|
24
|
+
getActions() {
|
|
25
|
+
return this.actions.filter((action) => {
|
|
26
|
+
return this.shouldActionBeVisible(action);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
shouldActionBeVisible(action) {
|
|
30
|
+
if (this.isActionAmountSelectedItemsCondition(action)) {
|
|
31
|
+
return this.checkAmountOfSelectedItemsRangeCondition(action);
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
isActionAmountSelectedItemsCondition(action) {
|
|
36
|
+
return !!action.condition && action.condition.type === ActionConditionType.AmountOfSelectedItemsRange;
|
|
37
|
+
}
|
|
38
|
+
checkAmountOfSelectedItemsRangeCondition(action) {
|
|
39
|
+
const condition = action.condition;
|
|
40
|
+
const min = condition.min;
|
|
41
|
+
if (min !== undefined && this.amountOfSelectedItems < min) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const max = condition.max;
|
|
45
|
+
if (max !== undefined && this.amountOfSelectedItems > max) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
getFilters() {
|
|
51
|
+
return this.filters.map((filter) => {
|
|
52
|
+
return {
|
|
53
|
+
...filter,
|
|
54
|
+
disabled: this.amountOfSelectedItems > 0,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
getSettings() {
|
|
59
|
+
if (!this.showColumnFilter) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
return [
|
|
63
|
+
{
|
|
64
|
+
id: SettingConfigId.ColumnSelector,
|
|
65
|
+
dialogTitle: this.columnFilterDialogTitle,
|
|
66
|
+
tooltip: this.columnFilterButtonTooltip,
|
|
67
|
+
icon: 'filter_list',
|
|
68
|
+
config: {
|
|
69
|
+
type: SettingConfigType.SelectionList,
|
|
70
|
+
data: this.columnFilterColumns,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return html `
|
|
77
|
+
<exm-grid-toolbar
|
|
78
|
+
searchPlaceholder=${this.searchPlaceholder}
|
|
79
|
+
.searchEnabled=${this.searchEnabled}
|
|
80
|
+
.actions="${this.getActions()}"
|
|
81
|
+
description="${this.description}"
|
|
82
|
+
.filters="${this.getFilters()}"
|
|
83
|
+
.settings="${this.getSettings()}"
|
|
84
|
+
?disableSeperator=${this.disableSeperator}
|
|
85
|
+
>
|
|
86
|
+
<slot name="extra" slot="extra"></slot>
|
|
87
|
+
</exm-grid-toolbar>
|
|
88
|
+
`;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
ExmGridSmartToolbar.styles = [
|
|
92
|
+
css `
|
|
93
|
+
:host {
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
`,
|
|
97
|
+
];
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: String })
|
|
100
|
+
], ExmGridSmartToolbar.prototype, "description", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
property({ type: Array })
|
|
103
|
+
], ExmGridSmartToolbar.prototype, "actions", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property({ type: Array })
|
|
106
|
+
], ExmGridSmartToolbar.prototype, "filters", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Array })
|
|
109
|
+
], ExmGridSmartToolbar.prototype, "settings", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: Number, attribute: 'amount-of-selected-items' })
|
|
112
|
+
], ExmGridSmartToolbar.prototype, "amountOfSelectedItems", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: Boolean, attribute: 'show-column-filter' })
|
|
115
|
+
], ExmGridSmartToolbar.prototype, "showColumnFilter", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: String, attribute: 'column-filter-button-tooltip' })
|
|
118
|
+
], ExmGridSmartToolbar.prototype, "columnFilterButtonTooltip", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: String, attribute: 'column-filter-dialog-title' })
|
|
121
|
+
], ExmGridSmartToolbar.prototype, "columnFilterDialogTitle", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: Array, attribute: 'column-filter-columns' })
|
|
124
|
+
], ExmGridSmartToolbar.prototype, "columnFilterColumns", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property({ type: Boolean })
|
|
127
|
+
], ExmGridSmartToolbar.prototype, "searchEnabled", void 0);
|
|
128
|
+
__decorate([
|
|
129
|
+
property({ type: String })
|
|
130
|
+
], ExmGridSmartToolbar.prototype, "searchPlaceholder", void 0);
|
|
131
|
+
__decorate([
|
|
132
|
+
property({ type: Boolean })
|
|
133
|
+
], ExmGridSmartToolbar.prototype, "disableSeperator", void 0);
|
|
134
|
+
ExmGridSmartToolbar = __decorate([
|
|
135
|
+
customElement('exm-grid-smart-toolbar')
|
|
136
|
+
], ExmGridSmartToolbar);
|
|
137
|
+
export { ExmGridSmartToolbar };
|
|
138
|
+
//# sourceMappingURL=exm-grid-smart-toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import("lit").CSSResult;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base';
|
|
2
|
+
import '@material/web/menu/menu.js';
|
|
3
|
+
import '@material/web/menu/menu-item.js';
|
|
4
|
+
import '@material/web/button/text-button.js';
|
|
5
|
+
import { Menu } from '@material/web/menu/menu.js';
|
|
6
|
+
export interface FilterItem {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
interface Token {
|
|
11
|
+
id: number | string;
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EventSelectPayload {
|
|
15
|
+
value: string;
|
|
16
|
+
item: Element;
|
|
17
|
+
token: Token;
|
|
18
|
+
}
|
|
19
|
+
export declare class ExmGridToolbarFilters extends ExmgElement {
|
|
20
|
+
/**
|
|
21
|
+
* Gets or sets the selected element. The default is to use the index of the item.
|
|
22
|
+
* @type {string}
|
|
23
|
+
*/
|
|
24
|
+
selected?: string;
|
|
25
|
+
items: FilterItem[];
|
|
26
|
+
menu?: Menu;
|
|
27
|
+
/**
|
|
28
|
+
* Set to true to disable this input.
|
|
29
|
+
*/
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
static styles: import("lit").CSSResult[];
|
|
32
|
+
selectedLabel(): string;
|
|
33
|
+
_handleMenuClick(value: string): void;
|
|
34
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { ExmgElement } from '@exmg/lit-base';
|
|
3
|
+
import { html, css } from 'lit';
|
|
4
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
5
|
+
import '@material/web/menu/menu.js';
|
|
6
|
+
import '@material/web/menu/menu-item.js';
|
|
7
|
+
import '@material/web/button/text-button.js';
|
|
8
|
+
let ExmGridToolbarFilters = class ExmGridToolbarFilters extends ExmgElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.items = [];
|
|
12
|
+
/**
|
|
13
|
+
* Set to true to disable this input.
|
|
14
|
+
*/
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
}
|
|
17
|
+
selectedLabel() {
|
|
18
|
+
var _a;
|
|
19
|
+
const item = (_a = this.items) === null || _a === void 0 ? void 0 : _a.find((i) => i.value === this.selected);
|
|
20
|
+
return item ? item.label : 'No Filter Selected';
|
|
21
|
+
}
|
|
22
|
+
_handleMenuClick(value) {
|
|
23
|
+
if (this.selected !== value) {
|
|
24
|
+
this.selected = value;
|
|
25
|
+
this.fire('exm-grid-toolbar-filter-changed', { value });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
render() {
|
|
29
|
+
var _a;
|
|
30
|
+
return html `
|
|
31
|
+
<span style="position: relative;">
|
|
32
|
+
<md-text-button
|
|
33
|
+
id="filterBtn"
|
|
34
|
+
aria-controls="menu"
|
|
35
|
+
@click=${() => this.menu.show()}
|
|
36
|
+
?disabled=${this.disabled}
|
|
37
|
+
trailing-icon
|
|
38
|
+
>${this.selectedLabel()} <md-icon slot="icon">expand_more</md-icon></md-text-button
|
|
39
|
+
>
|
|
40
|
+
<md-menu id="menu" menu-corner="start-start" anchor="filterBtn" role="listbox" aria-label="Filter options">
|
|
41
|
+
${(_a = this.items) === null || _a === void 0 ? void 0 : _a.map((i) => html `<md-menu-item
|
|
42
|
+
type="option"
|
|
43
|
+
id="${i.value}"
|
|
44
|
+
?selected=${i.value === this.selected}
|
|
45
|
+
@click=${() => this._handleMenuClick(i.value)}
|
|
46
|
+
>
|
|
47
|
+
<div slot="headline">${i.label}</div></md-menu-item
|
|
48
|
+
>`)}
|
|
49
|
+
</md-menu>
|
|
50
|
+
</span>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
ExmGridToolbarFilters.styles = [
|
|
55
|
+
css `
|
|
56
|
+
:host {
|
|
57
|
+
display: block;
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
];
|
|
61
|
+
__decorate([
|
|
62
|
+
property({ type: String })
|
|
63
|
+
], ExmGridToolbarFilters.prototype, "selected", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ type: Array })
|
|
66
|
+
], ExmGridToolbarFilters.prototype, "items", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
query('md-menu')
|
|
69
|
+
], ExmGridToolbarFilters.prototype, "menu", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property({ type: Boolean })
|
|
72
|
+
], ExmGridToolbarFilters.prototype, "disabled", void 0);
|
|
73
|
+
ExmGridToolbarFilters = __decorate([
|
|
74
|
+
customElement('exm-grid-toolbar-filters')
|
|
75
|
+
], ExmGridToolbarFilters);
|
|
76
|
+
export { ExmGridToolbarFilters };
|
|
77
|
+
//# sourceMappingURL=exm-grid-toolbar-filters.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import '@material/web/iconbutton/icon-button.js';
|
|
4
|
+
import './exm-grid-toolbar-filters.js';
|
|
5
|
+
import './exm-grid-base-toolbar.js';
|
|
6
|
+
import './exm-grid-setting-selection-list.js';
|
|
7
|
+
import '../search/exm-toolbar-search.js';
|
|
8
|
+
import { Action, Filter, Setting } from './types/exm-grid-toolbar-types.js';
|
|
9
|
+
export declare class ExmGridToolbar extends ExmgElement {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
description: string;
|
|
12
|
+
actions: Action[];
|
|
13
|
+
filters: Filter[];
|
|
14
|
+
settings: Setting[];
|
|
15
|
+
searchEnabled: boolean;
|
|
16
|
+
searchPlaceholder: string;
|
|
17
|
+
disableSeperator: boolean;
|
|
18
|
+
private emitActionExecutedEvent;
|
|
19
|
+
private emitFilterChangedEvent;
|
|
20
|
+
private saveFilterInLocalStorage;
|
|
21
|
+
private getFilterFromLocalStorage;
|
|
22
|
+
private emitSettingChangedEvent;
|
|
23
|
+
private renderActions;
|
|
24
|
+
private renderSearch;
|
|
25
|
+
private renderDescription;
|
|
26
|
+
private renderFilters;
|
|
27
|
+
private renderFilter;
|
|
28
|
+
private isFilterSingleSelectConfig;
|
|
29
|
+
private getSelectedFilter;
|
|
30
|
+
private renderSingleSelectFilter;
|
|
31
|
+
private renderSettings;
|
|
32
|
+
private renderSetting;
|
|
33
|
+
private isSettingSelectionListConfig;
|
|
34
|
+
private renderSelectionListSetting;
|
|
35
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
36
|
+
}
|
|
37
|
+
declare global {
|
|
38
|
+
interface HTMLElementTagNameMap {
|
|
39
|
+
'exm-grid-toolbar': ExmGridToolbar;
|
|
40
|
+
}
|
|
41
|
+
}
|