@dxos/lit-grid 0.8.4-main.c1de068 → 0.8.4-main.f5c0578
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/src/dx-grid-axis-resize-handle.d.ts.map +1 -1
- package/dist/src/dx-grid-axis-resize-handle.js +3 -5
- package/dist/src/dx-grid-axis-resize-handle.js.map +1 -1
- package/dist/src/dx-grid-multiselect-cell.d.ts.map +1 -1
- package/dist/src/dx-grid-multiselect-cell.js +2 -1
- package/dist/src/dx-grid-multiselect-cell.js.map +1 -1
- package/dist/src/dx-grid.d.ts +2 -2
- package/dist/src/dx-grid.d.ts.map +1 -1
- package/dist/src/dx-grid.js +70 -92
- package/dist/src/dx-grid.js.map +1 -1
- package/dist/src/dx-grid.lit-stories.js +15 -18
- package/dist/src/dx-grid.lit-stories.js.map +1 -1
- package/dist/src/playwright/dx-grid.spec.js.map +1 -1
- package/dist/src/testing/dx-grid-manager.d.ts.map +1 -1
- package/dist/src/testing/dx-grid-manager.js.map +1 -1
- package/dist/src/util.d.ts +4 -1
- package/dist/src/util.d.ts.map +1 -1
- package/dist/src/util.js +11 -11
- package/dist/src/util.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/dx-grid-axis-resize-handle.ts +1 -1
- package/src/dx-grid-multiselect-cell.ts +2 -1
- package/src/dx-grid.pcss +1 -0
- package/src/dx-grid.ts +31 -24
- package/src/playwright/dx-grid.spec.ts +1 -1
- package/src/testing/dx-grid-manager.ts +1 -1
- package/src/util.ts +13 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/lit-grid",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.f5c0578",
|
|
4
4
|
"description": "A grid Web Component using Lit",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"lit": "^3.2.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@dxos/random": "0.8.4-main.
|
|
43
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
42
|
+
"@dxos/random": "0.8.4-main.f5c0578",
|
|
43
|
+
"@dxos/test-utils": "0.8.4-main.f5c0578"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -6,7 +6,7 @@ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
|
6
6
|
import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
|
|
7
7
|
import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
|
|
8
8
|
import { type CleanupFn, type DragLocationHistory } from '@atlaskit/pragmatic-drag-and-drop/types';
|
|
9
|
-
import {
|
|
9
|
+
import { LitElement, html } from 'lit';
|
|
10
10
|
import { customElement, property } from 'lit/decorators.js';
|
|
11
11
|
import { ref } from 'lit/directives/ref.js';
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { LitElement, html } from 'lit';
|
|
6
6
|
import { customElement, property } from 'lit/decorators.js';
|
|
7
7
|
|
|
8
8
|
export type DxGridSelectValue = {
|
|
@@ -31,6 +31,7 @@ export class DxGridMultiselectCell extends LitElement {
|
|
|
31
31
|
aria-haspopup="dialog"
|
|
32
32
|
class="dx-grid__cell__multiselect"
|
|
33
33
|
data-dx-grid-accessory="invoke-multiselect"
|
|
34
|
+
data-dx-grid-action="accessory"
|
|
34
35
|
>
|
|
35
36
|
${this.values.length > 0
|
|
36
37
|
? this.values.map(({ label }) => html`<span class="dx-grid__cell__multiselect__value">${label}</span>`)
|
package/src/dx-grid.pcss
CHANGED
package/src/dx-grid.ts
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { LitElement, html, nothing } from 'lit';
|
|
6
|
-
import { customElement,
|
|
7
|
-
import {
|
|
6
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
7
|
+
import { type Ref, createRef, ref } from 'lit/directives/ref.js';
|
|
8
8
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
9
|
-
import {
|
|
9
|
+
import { html as staticHtml, unsafeStatic } from 'lit/static-html.js';
|
|
10
10
|
|
|
11
11
|
import { defaultColSize, defaultRowSize } from './defs';
|
|
12
|
-
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
13
12
|
import './dx-grid-axis-resize-handle';
|
|
14
13
|
import {
|
|
15
|
-
type DxGridAxisMetaProps,
|
|
16
|
-
type DxGridAxisSizes,
|
|
17
|
-
type DxGridPlaneCellIndex,
|
|
18
|
-
type DxGridCellValue,
|
|
19
14
|
DxAxisResize,
|
|
20
15
|
type DxAxisResizeInternal,
|
|
21
16
|
DxEditRequest,
|
|
17
|
+
type DxGridAnnotatedPanEvent,
|
|
18
|
+
type DxGridAxis,
|
|
22
19
|
type DxGridAxisMeta,
|
|
20
|
+
type DxGridAxisMetaProps,
|
|
21
|
+
type DxGridAxisSizes,
|
|
22
|
+
type DxGridCellValue,
|
|
23
23
|
type DxGridCells,
|
|
24
24
|
DxGridCellsSelect,
|
|
25
25
|
type DxGridFixedPlane,
|
|
@@ -29,36 +29,35 @@ import {
|
|
|
29
29
|
type DxGridFrozenRowsPlane,
|
|
30
30
|
type DxGridMode,
|
|
31
31
|
type DxGridPlane,
|
|
32
|
+
type DxGridPlaneCellIndex,
|
|
32
33
|
type DxGridPlaneCells,
|
|
33
34
|
type DxGridPlaneRange,
|
|
34
35
|
type DxGridPlaneRecord,
|
|
35
36
|
type DxGridPointer,
|
|
36
37
|
type DxGridPosition,
|
|
37
|
-
type DxGridAxis,
|
|
38
|
-
type DxGridSelectionProps,
|
|
39
|
-
type DxGridAnnotatedPanEvent,
|
|
40
38
|
type DxGridRange,
|
|
39
|
+
type DxGridSelectionProps,
|
|
41
40
|
separator,
|
|
42
41
|
} from './types';
|
|
43
42
|
import {
|
|
44
|
-
toCellIndex,
|
|
45
|
-
gap,
|
|
46
|
-
resizeTolerance,
|
|
47
|
-
sizeColMin,
|
|
48
|
-
sizeColMax,
|
|
49
|
-
sizeRowMin,
|
|
50
|
-
sizeRowMax,
|
|
51
|
-
shouldSelect,
|
|
52
|
-
selectionProps,
|
|
53
43
|
cellSelected,
|
|
54
44
|
closestAction,
|
|
55
45
|
closestCell,
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
gap,
|
|
47
|
+
isReadonly,
|
|
48
|
+
isSameCell,
|
|
49
|
+
resizeTolerance,
|
|
58
50
|
resolveColPlane,
|
|
59
51
|
resolveFrozenPlane,
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
resolveRowPlane,
|
|
53
|
+
selectionProps,
|
|
54
|
+
shouldSelect,
|
|
55
|
+
sizeColMax,
|
|
56
|
+
sizeColMin,
|
|
57
|
+
sizeRowMax,
|
|
58
|
+
sizeRowMin,
|
|
59
|
+
targetIsPlane,
|
|
60
|
+
toCellIndex,
|
|
62
61
|
} from './util';
|
|
63
62
|
|
|
64
63
|
@customElement('dx-grid')
|
|
@@ -481,6 +480,13 @@ export class DxGrid extends LitElement {
|
|
|
481
480
|
event.preventDefault();
|
|
482
481
|
this.dispatchEditRequest();
|
|
483
482
|
break;
|
|
483
|
+
case 'Backspace':
|
|
484
|
+
case 'Delete':
|
|
485
|
+
if (!event.defaultPrevented) {
|
|
486
|
+
event.preventDefault();
|
|
487
|
+
this.dispatchEditRequest('');
|
|
488
|
+
}
|
|
489
|
+
break;
|
|
484
490
|
default:
|
|
485
491
|
if (event.key.length === 1 && event.key.match(/\P{Cc}/u) && !(event.metaKey || event.ctrlKey)) {
|
|
486
492
|
this.dispatchEditRequest(event.key);
|
|
@@ -1608,6 +1614,7 @@ export {
|
|
|
1608
1614
|
parseCellIndex,
|
|
1609
1615
|
toPlaneCellIndex,
|
|
1610
1616
|
cellQuery,
|
|
1617
|
+
accessoryHandlesPointerdownAttrs,
|
|
1611
1618
|
} from './util';
|
|
1612
1619
|
|
|
1613
1620
|
export const commentedClassName = 'dx-grid__cell--commented';
|
package/src/util.ts
CHANGED
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import { defaultRowSize } from './defs';
|
|
6
6
|
import {
|
|
7
|
-
type
|
|
7
|
+
type DxGridAxis,
|
|
8
8
|
type DxGridCellIndex,
|
|
9
|
-
type DxGridPosition,
|
|
10
|
-
type DxGridPointer,
|
|
11
|
-
type DxGridSelectionProps,
|
|
12
|
-
type DxGridPositionNullable,
|
|
13
|
-
type DxGridPlane,
|
|
14
|
-
type DxGridFrozenRowsPlane,
|
|
15
9
|
type DxGridFrozenColsPlane,
|
|
16
10
|
type DxGridFrozenPlane,
|
|
17
|
-
type
|
|
11
|
+
type DxGridFrozenRowsPlane,
|
|
12
|
+
type DxGridPlane,
|
|
13
|
+
type DxGridPlaneCellIndex,
|
|
18
14
|
type DxGridPlanePosition,
|
|
15
|
+
type DxGridPointer,
|
|
16
|
+
type DxGridPosition,
|
|
17
|
+
type DxGridPositionNullable,
|
|
19
18
|
type DxGridReadonlyValue,
|
|
19
|
+
type DxGridSelectionProps,
|
|
20
20
|
separator,
|
|
21
21
|
} from './types';
|
|
22
22
|
|
|
@@ -25,7 +25,7 @@ export const toPlaneCellIndex = (cellCoords: Partial<DxGridPosition> & DxGridPla
|
|
|
25
25
|
|
|
26
26
|
export function parseCellIndex(index: DxGridCellIndex): DxGridPosition;
|
|
27
27
|
export function parseCellIndex(index: DxGridPlaneCellIndex): DxGridPlanePosition;
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
export function parseCellIndex(index: DxGridPlaneCellIndex | DxGridCellIndex): DxGridPlanePosition | DxGridPosition {
|
|
30
30
|
const coords = index.split(separator);
|
|
31
31
|
if (coords.length === 3) {
|
|
@@ -123,6 +123,10 @@ export const closestAction = (target: EventTarget | null): { action: string | nu
|
|
|
123
123
|
return { actionEl, action: actionEl?.getAttribute('data-dx-grid-action') ?? null };
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
+
export const accessoryHandlesPointerdownAttrs = {
|
|
127
|
+
'data-dx-grid-action': 'accessory',
|
|
128
|
+
};
|
|
129
|
+
|
|
126
130
|
export const closestCell = (target: EventTarget | null, actionEl?: HTMLElement | null): DxGridPositionNullable => {
|
|
127
131
|
let cellElement = actionEl;
|
|
128
132
|
if (!cellElement) {
|