@exmg/exm-grid 1.0.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/README.md +501 -0
- package/assets/arrow-upward.svg +7 -0
- package/index.d.ts +14 -0
- package/index.js +15 -0
- package/package.json +58 -0
- package/src/search/exm-toolbar-search.d.ts +25 -0
- package/src/search/exm-toolbar-search.js +197 -0
- package/src/styles/exm-grid-base-toolbar-styles-css.d.ts +2 -0
- package/src/styles/exm-grid-base-toolbar-styles-css.js +4 -0
- package/src/styles/exm-grid-base-toolbar-styles.scss +89 -0
- package/src/styles/exm-grid-common-styles-css.d.ts +2 -0
- package/src/styles/exm-grid-common-styles-css.js +4 -0
- package/src/styles/exm-grid-common-styles.scss +1 -0
- package/src/styles/exm-grid-pagination-styles-css.d.ts +2 -0
- package/src/styles/exm-grid-pagination-styles-css.js +4 -0
- package/src/styles/exm-grid-pagination-styles.scss +69 -0
- package/src/styles/exm-grid-setting-selection-list-styles-css.d.ts +2 -0
- package/src/styles/exm-grid-setting-selection-list-styles-css.js +4 -0
- package/src/styles/exm-grid-setting-selection-list-styles.scss +8 -0
- package/src/styles/exm-grid-styles-css.d.ts +2 -0
- package/src/styles/exm-grid-styles-css.js +4 -0
- package/src/styles/exm-grid-styles.scss +387 -0
- package/src/table/exm-grid-base-toolbar.d.ts +23 -0
- package/src/table/exm-grid-base-toolbar.js +91 -0
- package/src/table/exm-grid-pagination.d.ts +37 -0
- package/src/table/exm-grid-pagination.js +190 -0
- package/src/table/exm-grid-setting-selection-list.d.ts +24 -0
- package/src/table/exm-grid-setting-selection-list.js +124 -0
- package/src/table/exm-grid-smart-toolbar.d.ts +31 -0
- package/src/table/exm-grid-smart-toolbar.js +138 -0
- package/src/table/exm-grid-toolbar-filters.d.ts +36 -0
- package/src/table/exm-grid-toolbar-filters.js +77 -0
- package/src/table/exm-grid-toolbar.d.ts +42 -0
- package/src/table/exm-grid-toolbar.js +283 -0
- package/src/table/exm-grid.d.ts +130 -0
- package/src/table/exm-grid.js +333 -0
- package/src/table/featrues/exm-column-sortable.d.ts +12 -0
- package/src/table/featrues/exm-column-sortable.js +50 -0
- package/src/table/featrues/exm-row-expandable.d.ts +9 -0
- package/src/table/featrues/exm-row-expandable.js +42 -0
- package/src/table/featrues/exm-row-selectable.d.ts +20 -0
- package/src/table/featrues/exm-row-selectable.js +204 -0
- package/src/table/featrues/exm-row-sortable.d.ts +9 -0
- package/src/table/featrues/exm-row-sortable.js +50 -0
- package/src/table/types/exm-grid-smart-toolbar-types.d.ts +17 -0
- package/src/table/types/exm-grid-smart-toolbar-types.js +6 -0
- package/src/table/types/exm-grid-toolbar-types.d.ts +55 -0
- package/src/table/types/exm-grid-toolbar-types.js +16 -0
- package/src/table/types/exm-grid-types.d.ts +15 -0
- package/src/table/types/exm-grid-types.js +2 -0
- package/src/table/utils/exm-query-selectors.d.ts +12 -0
- package/src/table/utils/exm-query-selectors.js +37 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class ExmgRowSortable {
|
|
2
|
+
constructor(qs) {
|
|
3
|
+
this.querySelectors = qs;
|
|
4
|
+
}
|
|
5
|
+
initFeature() {
|
|
6
|
+
this.querySelectors
|
|
7
|
+
.getTableBody()
|
|
8
|
+
.querySelectorAll('tr:not([data-initialized]) .grid-row-drag-handler, tr:not([data-initialized]).grid-row-drag-handler')
|
|
9
|
+
.forEach((element) => {
|
|
10
|
+
this.registerMouseListenersHideDetailOnStartDragging(element);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
updateFeature() {
|
|
14
|
+
this.initFeature();
|
|
15
|
+
}
|
|
16
|
+
getRowDetailQuerySelectorFactory(element) {
|
|
17
|
+
const row = element.closest('tr');
|
|
18
|
+
const rowId = row && row.getAttribute('data-row-key');
|
|
19
|
+
if (rowId) {
|
|
20
|
+
return () => this.querySelectors.getTableBody().querySelector(`tr[data-row-detail-key="${rowId}"]`) ||
|
|
21
|
+
undefined;
|
|
22
|
+
}
|
|
23
|
+
return () => undefined;
|
|
24
|
+
}
|
|
25
|
+
registerMouseListenersHideDetailOnStartDragging(element) {
|
|
26
|
+
const getRowDetail = this.getRowDetailQuerySelectorFactory(element);
|
|
27
|
+
if (element.closest('td')) {
|
|
28
|
+
// ignore click (won't eventually select row) when trigger is element embedded in table cell
|
|
29
|
+
element.addEventListener('click', (event) => event.stopPropagation());
|
|
30
|
+
}
|
|
31
|
+
element.addEventListener('mousedown', (event) => {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
const rowDetail = getRowDetail();
|
|
34
|
+
if (rowDetail && rowDetail.hasAttribute('data-is-row-expanded')) {
|
|
35
|
+
rowDetail.style.display = 'none';
|
|
36
|
+
const handlerMouseUp = () => {
|
|
37
|
+
const rowDetailToRevert = getRowDetail();
|
|
38
|
+
if (rowDetailToRevert && rowDetailToRevert.hasAttribute('data-is-row-expanded')) {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
rowDetailToRevert.style.display = null;
|
|
42
|
+
}
|
|
43
|
+
this.querySelectors.getTableBody().removeEventListener('mouseup', handlerMouseUp);
|
|
44
|
+
};
|
|
45
|
+
this.querySelectors.getTableBody().addEventListener('mouseup', handlerMouseUp);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=exm-row-sortable.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ActionWithCondition<TCondition extends BaseActionCondition = BaseActionCondition> {
|
|
2
|
+
id: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
condition?: TCondition;
|
|
7
|
+
}
|
|
8
|
+
export declare enum ActionConditionType {
|
|
9
|
+
AmountOfSelectedItemsRange = "amount_of_items_range"
|
|
10
|
+
}
|
|
11
|
+
export interface BaseActionCondition {
|
|
12
|
+
type?: ActionConditionType;
|
|
13
|
+
}
|
|
14
|
+
export interface ActionAmountSelectedItemsCondition extends BaseActionCondition {
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line no-shadow
|
|
2
|
+
export var ActionConditionType;
|
|
3
|
+
(function (ActionConditionType) {
|
|
4
|
+
ActionConditionType["AmountOfSelectedItemsRange"] = "amount_of_items_range";
|
|
5
|
+
})(ActionConditionType = ActionConditionType || (ActionConditionType = {}));
|
|
6
|
+
//# sourceMappingURL=exm-grid-smart-toolbar-types.js.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface Action {
|
|
2
|
+
id: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* ID MUST BE UNIQUE HERE
|
|
9
|
+
*/
|
|
10
|
+
export interface Filter<TConfig extends BaseFilterConfig = BaseFilterConfig> {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
config: TConfig;
|
|
15
|
+
}
|
|
16
|
+
export declare enum FilterConfigType {
|
|
17
|
+
SingleSelect = "single_select"
|
|
18
|
+
}
|
|
19
|
+
export interface BaseFilterConfig {
|
|
20
|
+
type?: FilterConfigType;
|
|
21
|
+
}
|
|
22
|
+
export interface FilterSingleSelectConfig extends BaseFilterConfig {
|
|
23
|
+
data: {
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
export interface Setting<TConfig extends BaseSettingConfig = BaseSettingConfig> {
|
|
29
|
+
id: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
dialogTitle?: string;
|
|
32
|
+
tooltip?: string;
|
|
33
|
+
config: TConfig;
|
|
34
|
+
}
|
|
35
|
+
export declare enum SettingConfigType {
|
|
36
|
+
SelectionList = "selection_list"
|
|
37
|
+
}
|
|
38
|
+
export declare enum SettingConfigId {
|
|
39
|
+
ColumnSelector = "column-selector"
|
|
40
|
+
}
|
|
41
|
+
export interface BaseSettingConfig {
|
|
42
|
+
type?: SettingConfigType;
|
|
43
|
+
}
|
|
44
|
+
export interface SettingSelectionListItem {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
selected?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface SettingSelectionListConfig extends BaseSettingConfig {
|
|
50
|
+
data: SettingSelectionListItem[];
|
|
51
|
+
}
|
|
52
|
+
export interface EventDetailGridToolbarSettingChanged {
|
|
53
|
+
id: string;
|
|
54
|
+
value: SettingSelectionListItem[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// eslint-disable-next-line no-shadow
|
|
2
|
+
export var FilterConfigType;
|
|
3
|
+
(function (FilterConfigType) {
|
|
4
|
+
FilterConfigType["SingleSelect"] = "single_select";
|
|
5
|
+
})(FilterConfigType = FilterConfigType || (FilterConfigType = {}));
|
|
6
|
+
// eslint-disable-next-line no-shadow
|
|
7
|
+
export var SettingConfigType;
|
|
8
|
+
(function (SettingConfigType) {
|
|
9
|
+
SettingConfigType["SelectionList"] = "selection_list";
|
|
10
|
+
})(SettingConfigType = SettingConfigType || (SettingConfigType = {}));
|
|
11
|
+
// eslint-disable-next-line no-shadow
|
|
12
|
+
export var SettingConfigId;
|
|
13
|
+
(function (SettingConfigId) {
|
|
14
|
+
SettingConfigId["ColumnSelector"] = "column-selector";
|
|
15
|
+
})(SettingConfigId = SettingConfigId || (SettingConfigId = {}));
|
|
16
|
+
//# sourceMappingURL=exm-grid-toolbar-types.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SORT_DIRECTION = 'ASC' | 'DESC';
|
|
2
|
+
export interface EventDetailSortChange {
|
|
3
|
+
column: string;
|
|
4
|
+
sortDirection?: SORT_DIRECTION;
|
|
5
|
+
}
|
|
6
|
+
export interface EventDetailSelectedRowsChange {
|
|
7
|
+
rows: HTMLTableRowElement[];
|
|
8
|
+
}
|
|
9
|
+
export interface EventDetailRowsOrderChanged<T extends any = any> {
|
|
10
|
+
items: T[];
|
|
11
|
+
}
|
|
12
|
+
export interface EventDetailRowsOrderUpdated {
|
|
13
|
+
sourceIndex: number;
|
|
14
|
+
targetIndex: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ExmgQuerySelectors {
|
|
2
|
+
private table;
|
|
3
|
+
private tableBody;
|
|
4
|
+
constructor(t: HTMLTableElement, tb: HTMLTableSectionElement);
|
|
5
|
+
getTable(): HTMLTableElement;
|
|
6
|
+
getTableBody(): HTMLElement;
|
|
7
|
+
getColumns(selector?: string): NodeListOf<HTMLElement>;
|
|
8
|
+
getColumn<T extends HTMLElement>(selector?: string): T | undefined;
|
|
9
|
+
getBodyRowSelector(selector?: string): string;
|
|
10
|
+
getBodyRows(): NodeListOf<HTMLTableRowElement>;
|
|
11
|
+
getBodyRowsNotInitialized(): NodeListOf<HTMLTableRowElement>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class ExmgQuerySelectors {
|
|
2
|
+
constructor(t, tb) {
|
|
3
|
+
this.table = t;
|
|
4
|
+
this.tableBody = tb;
|
|
5
|
+
}
|
|
6
|
+
getTable() {
|
|
7
|
+
if (!this.table) {
|
|
8
|
+
throw new Error('Element table not found. Slot hast to define <table>');
|
|
9
|
+
}
|
|
10
|
+
return this.table;
|
|
11
|
+
}
|
|
12
|
+
getTableBody() {
|
|
13
|
+
if (!this.tableBody) {
|
|
14
|
+
throw new Error('Element tbody not found. Slot hast to define <tbody class="grid-data">');
|
|
15
|
+
}
|
|
16
|
+
return this.tableBody;
|
|
17
|
+
}
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
getColumns(selector = 'th') {
|
|
20
|
+
return this.getTable().querySelectorAll(`.grid-columns ${selector}`);
|
|
21
|
+
}
|
|
22
|
+
getColumn(selector = 'th') {
|
|
23
|
+
return this.getTable().querySelector(`.grid-columns ${selector}`) || undefined;
|
|
24
|
+
}
|
|
25
|
+
getBodyRowSelector(selector = '') {
|
|
26
|
+
return `tr:not(.grid-row-detail)${selector}`;
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line
|
|
29
|
+
getBodyRows() {
|
|
30
|
+
return this.getTableBody().querySelectorAll(this.getBodyRowSelector());
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line
|
|
33
|
+
getBodyRowsNotInitialized() {
|
|
34
|
+
return this.getTableBody().querySelectorAll(this.getBodyRowSelector(':not([data-initialized])'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=exm-query-selectors.js.map
|