@3mo/data-grid 0.15.3 → 0.16.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/dist/DataGridColumn.d.ts +8 -3
- package/dist/DataGridColumn.d.ts.map +1 -1
- package/dist/DataGridColumn.js +23 -0
- package/dist/DataGridColumnHeader.d.ts +23 -0
- package/dist/DataGridColumnHeader.d.ts.map +1 -0
- package/dist/DataGridColumnHeader.js +273 -0
- package/dist/DataGridHeader.d.ts +2 -2
- package/dist/DataGridHeader.d.ts.map +1 -1
- package/dist/DataGridHeader.js +12 -95
- package/dist/DataGridHeaderSeparator.d.ts.map +1 -1
- package/dist/DataGridHeaderSeparator.js +21 -30
- package/dist/columns/DataGridColumnComponent.d.ts +2 -1
- package/dist/columns/DataGridColumnComponent.d.ts.map +1 -1
- package/dist/columns/DataGridColumnComponent.js +1 -0
- package/dist/custom-elements.json +83 -28
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/DataGridColumn.d.ts
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { type HTMLTemplateResult } from '@a11d/lit';
|
|
2
2
|
import { equals } from '@a11d/equals';
|
|
3
|
-
import type { DataGrid } from './index.js';
|
|
3
|
+
import type { DataGrid, DataGridSortingStrategy } from './index.js';
|
|
4
4
|
import type * as CSS from 'csstype';
|
|
5
5
|
export type DataGridColumnAlignment = 'start' | 'center' | 'end';
|
|
6
6
|
export type DataGridColumnSticky = 'start' | 'both' | 'end';
|
|
7
|
+
export type DataGridColumnMenuItems = HTMLTemplateResult | Map<'sorting' | 'stickiness' | 'more', HTMLTemplateResult>;
|
|
7
8
|
export declare class DataGridColumn<TData, TValue = unknown> {
|
|
8
|
-
dataGrid
|
|
9
|
+
dataGrid: DataGrid<TData, any>;
|
|
9
10
|
dataSelector: KeyPath.Of<TData>;
|
|
10
11
|
heading: string;
|
|
11
12
|
description?: string;
|
|
12
13
|
width: CSS.DataType.TrackBreadth<(string & {}) | 0>;
|
|
13
14
|
alignment: DataGridColumnAlignment;
|
|
14
15
|
hidden: boolean;
|
|
15
|
-
|
|
16
|
+
hide(): void;
|
|
16
17
|
sticky?: DataGridColumnSticky;
|
|
18
|
+
toggleSticky(sticky: DataGridColumnSticky): void;
|
|
19
|
+
sortable: boolean;
|
|
17
20
|
private _sortDataSelector?;
|
|
18
21
|
get sortDataSelector(): object extends Required<TData> ? string : TData extends readonly any[] ? Extract<keyof TData, `${number}`> | Extract<keyof TData, string> | (Extract<keyof TData, `${number}`> extends infer T ? T extends Extract<keyof TData, `${number}`> ? T extends keyof TData ? `${T}.${object extends Required<TData[T]> ? string : TData[T] extends infer T_1 ? T_1 extends TData[T] ? T_1 extends readonly any[] ? Extract<keyof T_1, `${number}`> | Extract<keyof T_1, string> | (Extract<keyof T_1, `${number}`> extends infer T_2 ? T_2 extends Extract<keyof T_1, `${number}`> ? T_2 extends keyof T_1 ? never : never : never : never) : T_1 extends object ? Extract<keyof T_1, string> | (Extract<keyof T_1, string> extends infer T_3 ? T_3 extends Extract<keyof T_1, string> ? T_3 extends keyof T_1 ? never : never : never : never) : never : never : never}` : never : never : never) : TData extends object ? Extract<keyof TData, string> | (Extract<keyof TData, string> extends infer T_4 ? T_4 extends Extract<keyof TData, string> ? T_4 extends keyof TData ? `${T_4}.${object extends Required<TData[T_4]> ? string : TData[T_4] extends infer T_5 ? T_5 extends TData[T_4] ? T_5 extends readonly any[] ? Extract<keyof T_5, `${number}`> | Extract<keyof T_5, string> | (Extract<keyof T_5, `${number}`> extends infer T_6 ? T_6 extends Extract<keyof T_5, `${number}`> ? T_6 extends keyof T_5 ? never : never : never : never) : T_5 extends object ? Extract<keyof T_5, string> | (Extract<keyof T_5, string> extends infer T_7 ? T_7 extends Extract<keyof T_5, string> ? T_7 extends keyof T_5 ? never : never : never : never) : never : never : never}` : never : never : never) : never;
|
|
19
22
|
set sortDataSelector(value: object extends Required<TData> ? string : TData extends readonly any[] ? Extract<keyof TData, `${number}`> | Extract<keyof TData, string> | (Extract<keyof TData, `${number}`> extends infer T ? T extends Extract<keyof TData, `${number}`> ? T extends keyof TData ? `${T}.${object extends Required<TData[T]> ? string : TData[T] extends infer T_1 ? T_1 extends TData[T] ? T_1 extends readonly any[] ? Extract<keyof T_1, `${number}`> | Extract<keyof T_1, string> | (Extract<keyof T_1, `${number}`> extends infer T_2 ? T_2 extends Extract<keyof T_1, `${number}`> ? T_2 extends keyof T_1 ? never : never : never : never) : T_1 extends object ? Extract<keyof T_1, string> | (Extract<keyof T_1, string> extends infer T_3 ? T_3 extends Extract<keyof T_1, string> ? T_3 extends keyof T_1 ? never : never : never : never) : never : never : never}` : never : never : never) : TData extends object ? Extract<keyof TData, string> | (Extract<keyof TData, string> extends infer T_4 ? T_4 extends Extract<keyof TData, string> ? T_4 extends keyof TData ? `${T_4}.${object extends Required<TData[T_4]> ? string : TData[T_4] extends infer T_5 ? T_5 extends TData[T_4] ? T_5 extends readonly any[] ? Extract<keyof T_5, `${number}`> | Extract<keyof T_5, string> | (Extract<keyof T_5, `${number}`> extends infer T_6 ? T_6 extends Extract<keyof T_5, `${number}`> ? T_6 extends keyof T_5 ? never : never : never : never) : T_5 extends object ? Extract<keyof T_5, string> | (Extract<keyof T_5, string> extends infer T_7 ? T_7 extends Extract<keyof T_5, string> ? T_7 extends keyof T_5 ? never : never : never : never) : never : never : never}` : never : never : never) : never);
|
|
23
|
+
toggleSort(strategy?: DataGridSortingStrategy | null): void;
|
|
24
|
+
getMenuItemsTemplate?(): DataGridColumnMenuItems;
|
|
20
25
|
getContentTemplate?(value: TValue, data: TData): HTMLTemplateResult;
|
|
21
26
|
editable: boolean | Predicate<TData>;
|
|
22
27
|
getEditContentTemplate?(value: TValue, data: TData): HTMLTemplateResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridColumn.d.ts","sourceRoot":"","sources":["../DataGridColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"DataGridColumn.d.ts","sourceRoot":"","sources":["../DataGridColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAA;AAEnC,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEhE,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAE3D,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG,GAAG,CAAC,SAAS,GAAG,YAAY,GAAG,MAAM,EAAE,kBAAkB,CAAC,CAAA;AAErH,qBAAa,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAClD,QAAQ,EAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAC/B,YAAY,EAAG,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IAEhC,OAAO,EAAG,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAgB;IAEnE,SAAS,EAAE,uBAAuB,CAAU;IAE5C,MAAM,UAAQ;IACd,IAAI;IAKJ,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,YAAY,CAAC,MAAM,EAAE,oBAAoB;IAKzC,QAAQ,UAAO;IAEf,OAAO,CAAC,iBAAiB,CAAC,CAAmB;IAC7C,IAAI,gBAAgB,snDAAyD;IAC7E,IAAI,gBAAgB,CAAC,KAAK,mnDAAA,EAAoC;IAE9D,UAAU,CAAC,QAAQ,CAAC,EAAE,uBAAuB,GAAG,IAAI;IAkBpD,oBAAoB,CAAC,IAAI,uBAAuB;IAEhD,kBAAkB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,kBAAkB;IAEnE,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAQ;IAC5C,sBAAsB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,kBAAkB;IAEvE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB;gBAEpC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAI1D,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,OAAO;IAMpD,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC;IAIzD,OAAO,CAAC,cAAc,CAAC,CAAQ;IAC/B,IAAI,aAAa,WAAsC;IACvD,IAAI,aAAa,CAAC,KAAK,QAAA,EAGtB;IAED,OAAO,CAAC,aAAa,CAAQ;IAC7B,IAAI,YAAY,YAAgC;IAChD,IAAI,YAAY,CAAC,KAAK,SAAA,EAGrB;IAED,IAAI,iBAAiB,6FAIpB;IAED,IAAI,WAAW,mCAkBd;IAED,IAAI,uBAAuB,WA2B1B;IAED,kBAAkB,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC;IACxC,gBAAgB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;CAChE"}
|
package/dist/DataGridColumn.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { html, style } from '@a11d/lit';
|
|
2
2
|
import { equals } from '@a11d/equals';
|
|
3
3
|
export class DataGridColumn {
|
|
4
|
+
hide() {
|
|
5
|
+
this.hidden = true;
|
|
6
|
+
this.dataGrid.requestUpdate();
|
|
7
|
+
}
|
|
8
|
+
toggleSticky(sticky) {
|
|
9
|
+
this.sticky = this.sticky === sticky ? undefined : sticky;
|
|
10
|
+
this.dataGrid.requestUpdate();
|
|
11
|
+
}
|
|
4
12
|
get sortDataSelector() { return this._sortDataSelector || this.dataSelector; }
|
|
5
13
|
set sortDataSelector(value) { this._sortDataSelector = value; }
|
|
14
|
+
toggleSort(strategy) {
|
|
15
|
+
if (!this.sortable) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!!strategy && this.sortingDefinition?.strategy === strategy) {
|
|
19
|
+
strategy = null;
|
|
20
|
+
}
|
|
21
|
+
if (strategy === null) {
|
|
22
|
+
this.dataGrid.sortingController.reset();
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
this.dataGrid.sortingController.toggle(this.sortDataSelector, strategy);
|
|
26
|
+
}
|
|
27
|
+
this.dataGrid.requestUpdate();
|
|
28
|
+
}
|
|
6
29
|
constructor(column) {
|
|
7
30
|
this.width = 'max-content';
|
|
8
31
|
this.alignment = 'start';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, type HTMLTemplateResult } from '@a11d/lit';
|
|
2
|
+
import { ResizeController } from '@3mo/resize-observer';
|
|
3
|
+
import type { DataGridColumn } from './DataGridColumn.js';
|
|
4
|
+
export declare class DataGridColumnHeader extends Component {
|
|
5
|
+
column: DataGridColumn<unknown>;
|
|
6
|
+
menuOpen: boolean;
|
|
7
|
+
static get styles(): import("@a11d/lit").CSSResult;
|
|
8
|
+
readonly resizeController: ResizeController<Promise<void>>;
|
|
9
|
+
get template(): HTMLTemplateResult;
|
|
10
|
+
private get contentTemplate();
|
|
11
|
+
private get sortingTemplate();
|
|
12
|
+
private get menuTemplate();
|
|
13
|
+
private getSortingItemsTemplate;
|
|
14
|
+
private getStickinessItemsTemplate;
|
|
15
|
+
private getMoreItemsTemplate;
|
|
16
|
+
private get separatorTemplate();
|
|
17
|
+
}
|
|
18
|
+
declare global {
|
|
19
|
+
interface HTMLElementTagNameMap {
|
|
20
|
+
'mo-data-grid-column-header': DataGridColumnHeader;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=DataGridColumnHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataGridColumnHeader.d.ts","sourceRoot":"","sources":["../DataGridColumnHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAA+C,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAczD,qBACa,oBAAqB,SAAQ,SAAS;IACtB,MAAM,EAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAChB,QAAQ,UAAQ;IAE5D,WAAoB,MAAM,kCAqHzB;IAED,QAAQ,CAAC,gBAAgB,kCAOvB;IAEF,IAAa,QAAQ,uBA4BpB;IAED,OAAO,KAAK,eAAe,GAO1B;IAED,OAAO,KAAK,eAAe,GAU1B;IAED,OAAO,KAAK,YAAY,GAiBvB;IAED,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,0BAA0B;IAmBlC,OAAO,CAAC,oBAAoB;IAS5B,OAAO,KAAK,iBAAiB,GAS5B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,4BAA4B,EAAE,oBAAoB,CAAA;KAClD;CACD"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { bind, Component, component, css, html, join, property, style } from '@a11d/lit';
|
|
3
|
+
import { tooltip } from '@3mo/tooltip';
|
|
4
|
+
import { Localizer } from '@3mo/localization';
|
|
5
|
+
import { ResizeController } from '@3mo/resize-observer';
|
|
6
|
+
import { DataGridSortingStrategy } from './DataGridSortingController.js';
|
|
7
|
+
Localizer.dictionaries.add('de', {
|
|
8
|
+
'Sorting': 'Sortierung',
|
|
9
|
+
'Sort descending': 'Absteigend sortieren',
|
|
10
|
+
'Sort ascending': 'Aufsteigend sortieren',
|
|
11
|
+
'Stickiness': 'Fixierung',
|
|
12
|
+
'Stick to start': 'Anfang fixieren',
|
|
13
|
+
'Stick to both': 'Beide fixieren',
|
|
14
|
+
'Stick to end': 'Ende fixieren',
|
|
15
|
+
'Hide': 'Ausblenden',
|
|
16
|
+
});
|
|
17
|
+
let DataGridColumnHeader = class DataGridColumnHeader extends Component {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.menuOpen = false;
|
|
21
|
+
this.resizeController = new ResizeController(this, {
|
|
22
|
+
callback: async ([entry]) => {
|
|
23
|
+
// It is necessary to defer the callback to avoid
|
|
24
|
+
// this resize-observer triggering other resize-observers in a loop
|
|
25
|
+
await new Promise(r => requestIdleCallback(r));
|
|
26
|
+
this.column.widthInPixels = entry?.contentRect.width ?? 0;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
static get styles() {
|
|
31
|
+
return css `
|
|
32
|
+
:host {
|
|
33
|
+
display: flex;
|
|
34
|
+
position: relative;
|
|
35
|
+
padding: 0 var(--mo-data-grid-cell-padding);
|
|
36
|
+
transition: background 0.1s;
|
|
37
|
+
anchor-name: --mo-data-grid-column-header;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host(:hover) {
|
|
41
|
+
background: color-mix(in srgb, var(--mo-color-surface), var(--mo-color-gray) 8%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host([data-sticky]) {
|
|
45
|
+
position: sticky;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([data-sticky]) /*[data-sticking]*/ {
|
|
49
|
+
z-index: 6;
|
|
50
|
+
background: var(--mo-data-grid-sticky-part-color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
mo-data-grid-header-separator {
|
|
54
|
+
z-index: 5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([data-sticky]) /*[data-sticking]*/ mo-data-grid-header-separator {
|
|
58
|
+
z-index: 7;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
#container {
|
|
62
|
+
transition: margin-inline-end 0.1s;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
#content {
|
|
66
|
+
display: inline-block;
|
|
67
|
+
overflow: hidden !important;
|
|
68
|
+
color: var(--mo-color-foreground);
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
line-height: var(--mo-data-grid-header-height);
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
user-select: none;
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#sort {
|
|
78
|
+
position: relative;
|
|
79
|
+
|
|
80
|
+
&[data-preview] {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
mo-icon-button {
|
|
85
|
+
transition: 0.1s;
|
|
86
|
+
font-size: 20px;
|
|
87
|
+
color: var(--mo-color-accent);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
span {
|
|
91
|
+
position: absolute;
|
|
92
|
+
inset-inline-end: 0;
|
|
93
|
+
inset-block-end: 0;
|
|
94
|
+
color: var(--mo-color-accent);
|
|
95
|
+
border-radius: 50%;
|
|
96
|
+
width: fit-content;
|
|
97
|
+
user-select: none;
|
|
98
|
+
font-size: 0.8rem;
|
|
99
|
+
aspect-ratio: 1 / 1;
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host(:hover) #sort[data-preview] {
|
|
107
|
+
display: flex;
|
|
108
|
+
mo-icon-button {
|
|
109
|
+
color: var(--mo-color-gray);
|
|
110
|
+
opacity: 0.5;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#menu-icon {
|
|
115
|
+
position: absolute;
|
|
116
|
+
inset-inline-end: calc(var(--mo-data-grid-cell-padding) - 6px);
|
|
117
|
+
inset-block-start: 2px;
|
|
118
|
+
cursor: pointer;
|
|
119
|
+
opacity: 0;
|
|
120
|
+
font-size: 20px;
|
|
121
|
+
transition: 0.1s;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host(:hover), :host([menuOpen]) {
|
|
125
|
+
#container {
|
|
126
|
+
margin-inline-end: 20px;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
#menu-icon {
|
|
130
|
+
opacity: 1;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
mo-menu {
|
|
135
|
+
position-anchor: --mo-data-grid-column-header;
|
|
136
|
+
|
|
137
|
+
&::part(popover) {
|
|
138
|
+
margin-inline-start: 4px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
mo-heading {
|
|
142
|
+
padding: 0.5rem 1rem;
|
|
143
|
+
opacity: 0.5;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
get template() {
|
|
149
|
+
if (this.column.sticky && !this.column.intersecting) {
|
|
150
|
+
this.style.insetInline = this.column.stickyColumnInsetInline;
|
|
151
|
+
}
|
|
152
|
+
this.toggleAttribute('data-sticking', this.column.intersecting === false);
|
|
153
|
+
if (!this.column.sticky) {
|
|
154
|
+
this.removeAttribute('data-sticky');
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this.setAttribute('data-sticky', this.column.sticky);
|
|
158
|
+
}
|
|
159
|
+
const direction = this.column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal';
|
|
160
|
+
return html `
|
|
161
|
+
<mo-flex id='container' alignItems='center' gap='0.2rem'
|
|
162
|
+
direction=${direction}
|
|
163
|
+
@click=${() => this.column.toggleSort()}
|
|
164
|
+
@contextmenu=${(e) => { e.preventDefault(); this.menuOpen = true; }}
|
|
165
|
+
${style({ flex: '1', overflow: 'hidden', cursor: 'pointer' })}
|
|
166
|
+
>
|
|
167
|
+
${this.contentTemplate}
|
|
168
|
+
${this.sortingTemplate}
|
|
169
|
+
</mo-flex>
|
|
170
|
+
${this.menuTemplate}
|
|
171
|
+
${this.separatorTemplate}
|
|
172
|
+
`;
|
|
173
|
+
}
|
|
174
|
+
get contentTemplate() {
|
|
175
|
+
return html `
|
|
176
|
+
<div id='content'
|
|
177
|
+
${style({ textAlign: this.column.alignment })}
|
|
178
|
+
${!this.column.description ? html.nothing : tooltip(this.column.description)}
|
|
179
|
+
>${this.column.heading}</div>
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
get sortingTemplate() {
|
|
183
|
+
const sortingDefinition = this.column.sortingDefinition;
|
|
184
|
+
const sortIcon = sortingDefinition?.strategy === DataGridSortingStrategy.Ascending ? 'arrow_upward' : 'arrow_downward';
|
|
185
|
+
const sortingRank = !sortingDefinition || this.column.dataGrid.getSorting().length <= 1 ? undefined : sortingDefinition.rank;
|
|
186
|
+
return !this.column.sortable ? html.nothing : html `
|
|
187
|
+
<mo-flex id='sort' direction='horizontal' ?data-preview=${!sortingDefinition?.strategy}>
|
|
188
|
+
<mo-icon-button dense icon=${sortIcon}></mo-icon-button>
|
|
189
|
+
${!sortingRank ? html.nothing : html `<span>${sortingRank}</span>`}
|
|
190
|
+
</mo-flex>
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
get menuTemplate() {
|
|
194
|
+
const additionalItems = this.column.getMenuItemsTemplate?.();
|
|
195
|
+
return html `
|
|
196
|
+
<mo-popover-container placement='block-end' alignment='end' style='display: contents'>
|
|
197
|
+
<mo-icon-button dense id='menu-icon' icon='more_vert'></mo-icon-button>
|
|
198
|
+
|
|
199
|
+
<mo-menu slot='popover' .anchor=${this} target='menu-icon' ?open=${bind(this, 'menuOpen')}>
|
|
200
|
+
<mo-line></mo-line>
|
|
201
|
+
${join([
|
|
202
|
+
!this.column.sortable ? undefined : this.getSortingItemsTemplate(additionalItems instanceof Map ? additionalItems.get('sorting') : undefined),
|
|
203
|
+
// Hide stickiness items for now
|
|
204
|
+
true ? undefined : this.getStickinessItemsTemplate(additionalItems instanceof Map ? additionalItems.get('stickiness') : undefined),
|
|
205
|
+
this.getMoreItemsTemplate(additionalItems instanceof Map ? additionalItems.get('more') : additionalItems),
|
|
206
|
+
].filter(Boolean), html `<mo-line></mo-line>`)}
|
|
207
|
+
</mo-menu>
|
|
208
|
+
</mo-popover-container>
|
|
209
|
+
`;
|
|
210
|
+
}
|
|
211
|
+
getSortingItemsTemplate(additionalItems) {
|
|
212
|
+
return html `
|
|
213
|
+
<mo-heading typography='subtitle2'>${t('Sorting')}</mo-heading>
|
|
214
|
+
<mo-selectable-menu-item icon='arrow_downward'
|
|
215
|
+
?disabled=${this.column.sortable === false}
|
|
216
|
+
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Descending}
|
|
217
|
+
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Descending)}
|
|
218
|
+
>${t('Sort descending')}</mo-selectable-menu-item>
|
|
219
|
+
<mo-selectable-menu-item icon='arrow_upward'
|
|
220
|
+
?disabled=${this.column.sortable === false}
|
|
221
|
+
?selected=${this.column.sortingDefinition?.strategy === DataGridSortingStrategy.Ascending}
|
|
222
|
+
@click=${() => this.column.toggleSort(DataGridSortingStrategy.Ascending)}
|
|
223
|
+
>${t('Sort ascending')}</mo-selectable-menu-item>
|
|
224
|
+
${additionalItems}
|
|
225
|
+
`;
|
|
226
|
+
}
|
|
227
|
+
getStickinessItemsTemplate(additionalItems) {
|
|
228
|
+
return html `
|
|
229
|
+
<mo-heading typography='subtitle2'>${t('Stickiness')}</mo-heading>
|
|
230
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
231
|
+
?selected=${this.column.sticky === 'start'}
|
|
232
|
+
@click=${() => this.column.toggleSticky('start')}
|
|
233
|
+
>${t('Stick to start')}</mo-selectable-menu-item>
|
|
234
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
235
|
+
?selected=${this.column.sticky === 'both'}
|
|
236
|
+
@click=${() => this.column.toggleSticky('both')}
|
|
237
|
+
>${t('Stick to both')}</mo-selectable-menu-item>
|
|
238
|
+
<mo-selectable-menu-item icon='push_pin'
|
|
239
|
+
?selected=${this.column.sticky === 'end'}
|
|
240
|
+
@click=${() => this.column.toggleSticky('end')}
|
|
241
|
+
>${t('Stick to end')}</mo-selectable-menu-item>
|
|
242
|
+
${additionalItems}
|
|
243
|
+
`;
|
|
244
|
+
}
|
|
245
|
+
getMoreItemsTemplate(additionalItems) {
|
|
246
|
+
return html `
|
|
247
|
+
<mo-menu-item icon='visibility_off' @click=${() => this.column.hide()}>
|
|
248
|
+
${t('Hide')}
|
|
249
|
+
</mo-menu-item>
|
|
250
|
+
${additionalItems}
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
get separatorTemplate() {
|
|
254
|
+
const index = this.column.dataGrid.visibleColumns.indexOf(this.column);
|
|
255
|
+
return html `
|
|
256
|
+
<mo-data-grid-header-separator
|
|
257
|
+
?data-last=${this.column.dataGrid.visibleColumns.length - 1 === index}
|
|
258
|
+
.dataGrid=${this.column.dataGrid}
|
|
259
|
+
.column=${this.column.dataGrid.visibleColumns[index]}
|
|
260
|
+
></mo-data-grid-header-separator>
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
__decorate([
|
|
265
|
+
property({ type: Object })
|
|
266
|
+
], DataGridColumnHeader.prototype, "column", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
property({ type: Boolean, reflect: true })
|
|
269
|
+
], DataGridColumnHeader.prototype, "menuOpen", void 0);
|
|
270
|
+
DataGridColumnHeader = __decorate([
|
|
271
|
+
component('mo-data-grid-column-header')
|
|
272
|
+
], DataGridColumnHeader);
|
|
273
|
+
export { DataGridColumnHeader };
|
package/dist/DataGridHeader.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export declare class DataGridHeader<TData> extends Component {
|
|
|
5
5
|
readonly modeSelectionChange: EventDispatcher<string>;
|
|
6
6
|
dataGrid: DataGrid<TData, any>;
|
|
7
7
|
overlayOpen: boolean;
|
|
8
|
+
private readonly columnHeaders;
|
|
8
9
|
protected connected(): void;
|
|
9
10
|
protected disconnected(): void;
|
|
10
11
|
private readonly handleDataGridDataChange;
|
|
12
|
+
protected updated(...parameters: Parameters<Component['updated']>): void;
|
|
11
13
|
static get styles(): import("@a11d/lit").CSSResult;
|
|
12
14
|
protected get template(): import("lit-html").HTMLTemplateResult;
|
|
13
15
|
private get detailsExpanderTemplate();
|
|
@@ -15,11 +17,9 @@ export declare class DataGridHeader<TData> extends Component {
|
|
|
15
17
|
private get selection();
|
|
16
18
|
private readonly handleSelectionChange;
|
|
17
19
|
private get contentTemplate();
|
|
18
|
-
private readonly getHeaderCellTemplate;
|
|
19
20
|
private get fillerTemplate();
|
|
20
21
|
private get actionsTemplate();
|
|
21
22
|
private getResizeObserver;
|
|
22
|
-
private sort;
|
|
23
23
|
private toggleAllDetails;
|
|
24
24
|
}
|
|
25
25
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridHeader.d.ts","sourceRoot":"","sources":["../DataGridHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,
|
|
1
|
+
{"version":3,"file":"DataGridHeader.d.ts","sourceRoot":"","sources":["../DataGridHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAAqD,MAAM,WAAW,CAAA;AAGnG,OAAO,EAAyB,KAAK,QAAQ,EAAmD,MAAM,YAAY,CAAA;AAiBlH,qBACa,cAAc,CAAC,KAAK,CAAE,SAAQ,SAAS;IAC1C,QAAQ,CAAC,UAAU,EAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAC7C,QAAQ,CAAC,mBAAmB,EAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAEnC,QAAQ,EAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IACf,WAAW,UAAQ;IAEvB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA8B;cAEjF,SAAS;cAIT,YAAY;IAI/B,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAExC;cAEkB,OAAO,CAAC,GAAG,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAK1E,WAAoB,MAAM,kCAoDzB;IAED,cAAuB,QAAQ,0CAQ9B;IAED,OAAO,KAAK,uBAAuB,GAclC;IAED,OAAO,KAAK,iBAAiB,GAW5B;IAED,OAAO,KAAK,SAAS,GASpB;IAED,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAQrC;IAED,OAAO,KAAK,eAAe,GAM1B;IAED,OAAO,KAAK,cAAc,GAEzB;IAED,OAAO,KAAK,eAAe,GA0B1B;IAED,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,gBAAgB;CAIxB;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,qBAAqB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;KAC9C;CACD"}
|
package/dist/DataGridHeader.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { component, Component, css, html,
|
|
3
|
-
import { tooltip } from '@3mo/tooltip';
|
|
2
|
+
import { component, Component, css, html, property, event, style, live, queryAll } from '@a11d/lit';
|
|
4
3
|
import { observeResize } from '@3mo/resize-observer';
|
|
5
4
|
import { Localizer } from '@3mo/localization';
|
|
6
|
-
import { DataGridSelectability,
|
|
5
|
+
import { DataGridSelectability, DataGridSidePanelTab } from './index.js';
|
|
7
6
|
Localizer.dictionaries.add('en', {
|
|
8
7
|
'Actions for ${count:pluralityNumber} selected entries': [
|
|
9
8
|
'Actions for the selected entry',
|
|
@@ -33,44 +32,6 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
33
32
|
this.dataGrid.selectAll();
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
this.getHeaderCellTemplate = (column, index, columns) => {
|
|
37
|
-
const sortingDefinition = column.sortingDefinition;
|
|
38
|
-
const sortIcon = !sortingDefinition ? undefined : sortingDefinition.strategy === DataGridSortingStrategy.Ascending ? 'arrow_upward' : 'arrow_downward';
|
|
39
|
-
const sortingRank = !sortingDefinition || this.dataGrid.getSorting().length <= 1 ? undefined : sortingDefinition.rank;
|
|
40
|
-
const observeResizeDeferred = (callback) => observeResize((e, o) => {
|
|
41
|
-
// It is necessary to defer the callback to avoid
|
|
42
|
-
// this resize-observer triggering other resize-observers in a loop
|
|
43
|
-
requestIdleCallback(() => callback(e, o));
|
|
44
|
-
});
|
|
45
|
-
return html `
|
|
46
|
-
<mo-flex class='cell' alignItems='center' direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'}
|
|
47
|
-
data-sticky=${ifDefined(column.sticky)}
|
|
48
|
-
data-sticking=${column.intersecting === false}
|
|
49
|
-
${!column.sticky || column.intersecting ? html.nothing : style({ insetInline: column.stickyColumnInsetInline })}
|
|
50
|
-
${observeResizeDeferred(([entry]) => column.widthInPixels = entry?.contentRect.width ?? 0)}
|
|
51
|
-
>
|
|
52
|
-
<mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
|
|
53
|
-
${style({ overflow: 'hidden', cursor: 'pointer', flex: '1' })}
|
|
54
|
-
@click=${() => this.sort(column)}
|
|
55
|
-
>
|
|
56
|
-
<div class='headerContent'
|
|
57
|
-
${style({ width: '100%', textAlign: column.alignment })}
|
|
58
|
-
${!column.description ? html.nothing : tooltip(column.description)}
|
|
59
|
-
>${column.heading}</div>
|
|
60
|
-
|
|
61
|
-
${sortIcon === undefined ? html.nothing : html `
|
|
62
|
-
${!sortingRank ? html.nothing : html `<span class='sort-rank'>${sortingRank}</span>`}
|
|
63
|
-
<mo-icon ${style({ color: 'var(--mo-color-accent)', marginInline: '3px' })} icon=${ifDefined(sortIcon)}></mo-icon>
|
|
64
|
-
`}
|
|
65
|
-
</mo-flex>
|
|
66
|
-
<mo-data-grid-header-separator
|
|
67
|
-
?data-last=${columns.length - 1 === index}
|
|
68
|
-
.dataGrid=${this.dataGrid}
|
|
69
|
-
.column=${this.dataGrid.visibleColumns[index]}
|
|
70
|
-
></mo-data-grid-header-separator>
|
|
71
|
-
</mo-flex>
|
|
72
|
-
`;
|
|
73
|
-
};
|
|
74
35
|
}
|
|
75
36
|
connected() {
|
|
76
37
|
this.dataGrid.dataChange.subscribe(this.handleDataGridDataChange);
|
|
@@ -78,6 +39,10 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
78
39
|
disconnected() {
|
|
79
40
|
this.dataGrid.dataChange.unsubscribe(this.handleDataGridDataChange);
|
|
80
41
|
}
|
|
42
|
+
updated(...parameters) {
|
|
43
|
+
super.updated(...parameters);
|
|
44
|
+
this.columnHeaders.forEach(h => h.requestUpdate());
|
|
45
|
+
}
|
|
81
46
|
static get styles() {
|
|
82
47
|
return css `
|
|
83
48
|
:host {
|
|
@@ -95,53 +60,6 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
95
60
|
height: var(--mo-data-grid-header-height);
|
|
96
61
|
}
|
|
97
62
|
|
|
98
|
-
.headerContent {
|
|
99
|
-
padding: 0 var(--mo-data-grid-cell-padding);
|
|
100
|
-
display: inline-block;
|
|
101
|
-
overflow: hidden !important;
|
|
102
|
-
color: var(--mo-color-foreground);
|
|
103
|
-
font-weight: 500;
|
|
104
|
-
line-height: var(--mo-data-grid-header-height);
|
|
105
|
-
white-space: nowrap;
|
|
106
|
-
text-overflow: ellipsis;
|
|
107
|
-
user-select: none;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.sort-rank {
|
|
111
|
-
background: var(--mo-color-transparent-gray-3);
|
|
112
|
-
color: var(--mo-color-foreground);
|
|
113
|
-
border: 1px solid var(--mo-color-gray-transparent);
|
|
114
|
-
border-radius: 50%;
|
|
115
|
-
width: fit-content;
|
|
116
|
-
user-select: none;
|
|
117
|
-
height: 20px;
|
|
118
|
-
aspect-ratio: 1 / 1;
|
|
119
|
-
display: flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
justify-content: center;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.cell {
|
|
125
|
-
position: relative;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.cell[data-sticky] {
|
|
129
|
-
position: sticky;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.cell[data-sticky] /*[data-sticking]*/ {
|
|
133
|
-
z-index: 6;
|
|
134
|
-
background: var(--mo-data-grid-sticky-part-color);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
mo-data-grid-header-separator {
|
|
138
|
-
z-index: 5;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.cell[data-sticky] /*[data-sticking]*/ mo-data-grid-header-separator {
|
|
142
|
-
z-index: 7;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
63
|
.details, .selection, .actions, .context-menu {
|
|
146
64
|
position: sticky;
|
|
147
65
|
background: var(--mo-data-grid-sticky-part-color);
|
|
@@ -226,7 +144,9 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
226
144
|
}
|
|
227
145
|
get contentTemplate() {
|
|
228
146
|
return html `
|
|
229
|
-
${this.dataGrid.visibleColumns.map(
|
|
147
|
+
${this.dataGrid.visibleColumns.map(column => html `
|
|
148
|
+
<mo-data-grid-column-header .column=${column}></mo-data-grid-column-header>
|
|
149
|
+
`)}
|
|
230
150
|
`;
|
|
231
151
|
}
|
|
232
152
|
get fillerTemplate() {
|
|
@@ -261,12 +181,6 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
261
181
|
// @ts-expect-error Readonly property set here
|
|
262
182
|
return observeResize(([entry]) => this.dataGrid.columnsController[property] = entry?.contentRect.width ?? 0);
|
|
263
183
|
}
|
|
264
|
-
sort(column) {
|
|
265
|
-
if (column.sortable) {
|
|
266
|
-
this.dataGrid.sortingController.toggle(column.sortDataSelector);
|
|
267
|
-
this.requestUpdate();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
184
|
toggleAllDetails() {
|
|
271
185
|
this.dataGrid.toggleRowDetails();
|
|
272
186
|
this.requestUpdate();
|
|
@@ -284,6 +198,9 @@ __decorate([
|
|
|
284
198
|
__decorate([
|
|
285
199
|
property({ type: Boolean, reflect: true })
|
|
286
200
|
], DataGridHeader.prototype, "overlayOpen", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
queryAll('mo-data-grid-column-header')
|
|
203
|
+
], DataGridHeader.prototype, "columnHeaders", void 0);
|
|
287
204
|
DataGridHeader = __decorate([
|
|
288
205
|
component('mo-data-grid-header')
|
|
289
206
|
], DataGridHeader);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridHeaderSeparator.d.ts","sourceRoot":"","sources":["../DataGridHeaderSeparator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+D,MAAM,WAAW,CAAA;AAElG,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE/D,qBACa,uBAAwB,SAAQ,SAAS;IACzB,QAAQ,EAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAEnD,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,kBAAkB,CAAI;IAEvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAK;IAE7B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAQ;IAE5B,WAAoB,MAAM,
|
|
1
|
+
{"version":3,"file":"DataGridHeaderSeparator.d.ts","sourceRoot":"","sources":["../DataGridHeaderSeparator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA+D,MAAM,WAAW,CAAA;AAElG,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE/D,qBACa,uBAAwB,SAAQ,SAAS;IACzB,QAAQ,EAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAG,cAAc,CAAC,OAAO,CAAC,CAAA;IAEnD,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,kBAAkB,CAAI;IAEvC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAK;IAE7B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAQ;IAE5B,WAAoB,MAAM,kCA6CzB;IAED,cAAuB,QAAQ,0CAK9B;IAGD,SAAS,CAAC,eAAe;IAczB,SAAS,CAAC,iBAAiB,CAAC,CAAC,EAAE,YAAY,GAAG,UAAU;IAmBxD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAIjC;IAED,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAIjC;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,+BAA+B,EAAE,uBAAuB,CAAA;KACxD;CACD"}
|
|
@@ -22,43 +22,39 @@ let DataGridHeaderSeparator = class DataGridHeaderSeparator extends Component {
|
|
|
22
22
|
return css `
|
|
23
23
|
:host {
|
|
24
24
|
position: absolute;
|
|
25
|
-
inset-inline-end: -
|
|
25
|
+
inset-inline-end: -3px;
|
|
26
|
+
height: 100%;
|
|
27
|
+
width: 6px;
|
|
28
|
+
user-select: none;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
:host([
|
|
29
|
-
|
|
31
|
+
:host([disabled]) {
|
|
32
|
+
pointer-events: none;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: center;
|
|
36
|
-
inset-inline-start: -6px;
|
|
37
|
-
width: 6px;
|
|
38
|
-
height: 100%;
|
|
39
|
-
user-select: none;
|
|
35
|
+
:host([data-last]) {
|
|
36
|
+
inset-inline-end: 0px !important;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
width: var(--mo-data-grid-header-separator-width);
|
|
45
|
-
border-radius: 100px;
|
|
46
|
-
background-color: var(--mo-color-gray);
|
|
47
|
-
transition: 0.2s;
|
|
39
|
+
:host(:hover) {
|
|
40
|
+
cursor: col-resize;
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
.separator {
|
|
44
|
+
margin-inline: auto;
|
|
45
|
+
width: 1px;
|
|
46
|
+
height: 100%;
|
|
51
47
|
cursor: col-resize;
|
|
48
|
+
background-color: var(--mo-color-transparent-gray-3);
|
|
49
|
+
transition: 0.1s;
|
|
52
50
|
}
|
|
53
51
|
|
|
54
|
-
:host(:
|
|
55
|
-
|
|
56
|
-
--mo-data-grid-header-separator-width: 8px;
|
|
52
|
+
:host(:hover) .separator {
|
|
53
|
+
width: 100%;
|
|
57
54
|
background-color: var(--mo-color-accent);
|
|
58
|
-
cursor: col-resize;
|
|
59
55
|
}
|
|
60
56
|
|
|
61
|
-
|
|
57
|
+
.resizer {
|
|
62
58
|
position: fixed;
|
|
63
59
|
pointer-events: none;
|
|
64
60
|
top: 0;
|
|
@@ -70,13 +66,8 @@ let DataGridHeaderSeparator = class DataGridHeaderSeparator extends Component {
|
|
|
70
66
|
}
|
|
71
67
|
get template() {
|
|
72
68
|
return html `
|
|
73
|
-
<div class='separator' @pointerdown=${this.handlePointerDown} @dblclick=${this.handleDoubleClick}>
|
|
74
|
-
|
|
75
|
-
</div>
|
|
76
|
-
|
|
77
|
-
${this.isResizing === false ? html.nothing : html `
|
|
78
|
-
<div class='resizerOverlay' ${style({ insetInlineStart: `${this.pointerInlineStart}px` })}></div>
|
|
79
|
-
`}
|
|
69
|
+
<div class='separator' @pointerdown=${this.handlePointerDown} @dblclick=${this.handleDoubleClick}></div>
|
|
70
|
+
${!this.isResizing ? html.nothing : html `<div class='resizer' ${style({ insetInlineStart: `${this.pointerInlineStart}px` })}></div>`}
|
|
80
71
|
`;
|
|
81
72
|
}
|
|
82
73
|
handlePointerUp() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, type HTMLTemplateResult } from '@a11d/lit';
|
|
2
2
|
import { DataGrid } from '../DataGrid.js';
|
|
3
|
-
import { DataGridColumn, type DataGridColumnAlignment, type DataGridColumnSticky } from '../DataGridColumn.js';
|
|
3
|
+
import { DataGridColumn, type DataGridColumnAlignment, type DataGridColumnMenuItems, type DataGridColumnSticky } from '../DataGridColumn.js';
|
|
4
4
|
/**
|
|
5
5
|
* @attr width - The width of the column
|
|
6
6
|
* @attr hidden - Whether the column is hidden. The column can be made visible by the user in the settings panel if available.
|
|
@@ -26,6 +26,7 @@ export declare abstract class DataGridColumnComponent<TData, TValue> extends Com
|
|
|
26
26
|
nonSortable: boolean;
|
|
27
27
|
nonEditable: boolean | Predicate<TData>;
|
|
28
28
|
get column(): DataGridColumn<TData, TValue>;
|
|
29
|
+
protected getMenuItemsTemplate?(): DataGridColumnMenuItems;
|
|
29
30
|
abstract getContentTemplate(value: TValue | undefined, data: TData): HTMLTemplateResult;
|
|
30
31
|
abstract getEditContentTemplate?(value: TValue | undefined, data: TData): HTMLTemplateResult;
|
|
31
32
|
protected handleEdit(value: TValue | undefined, data: TData): void;
|