@wcardinal/wcardinal-ui 0.414.0 → 0.415.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/types/wcardinal/ui/d-table-category-cell.d.ts +3 -20
- package/dist/types/wcardinal/ui/d-table-category-column-impl.d.ts +1 -2
- package/dist/types/wcardinal/ui/d-table-category-container-impl.d.ts +1 -1
- package/dist/types/wcardinal/ui/d-table-cell-edge.d.ts +69 -0
- package/dist/types/wcardinal/ui/d-table-column-impl.d.ts +2 -0
- package/dist/types/wcardinal/ui/d-table-column.d.ts +2 -0
- package/dist/types/wcardinal/ui/d-table-header-cell.d.ts +3 -19
- package/dist/wcardinal/ui/d-table-category-cell.js +5 -207
- package/dist/wcardinal/ui/d-table-category-cell.js.map +1 -1
- package/dist/wcardinal/ui/d-table-category-column-impl.js +19 -34
- package/dist/wcardinal/ui/d-table-category-column-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-table-category-container-impl.js +14 -7
- package/dist/wcardinal/ui/d-table-category-container-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-table-cell-edge.js +557 -0
- package/dist/wcardinal/ui/d-table-cell-edge.js.map +1 -0
- package/dist/wcardinal/ui/d-table-column-impl.js +2 -0
- package/dist/wcardinal/ui/d-table-column-impl.js.map +1 -1
- package/dist/wcardinal/ui/d-table-column.js.map +1 -1
- package/dist/wcardinal/ui/d-table-header-cell.js +6 -200
- package/dist/wcardinal/ui/d-table-header-cell.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +558 -407
- package/dist/wcardinal-ui.js +558 -407
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { InteractionEvent
|
|
1
|
+
import { InteractionEvent } from "pixi.js";
|
|
2
2
|
import { DImage, DImageOptions, DThemeImage } from "./d-image";
|
|
3
3
|
import { DTableCategoryColumn } from "./d-table-category-column";
|
|
4
4
|
import { DBaseStateSet } from "./d-base-state-set";
|
|
5
|
+
import { DTableCellEdge } from "./d-table-cell-edge";
|
|
5
6
|
export interface DTableCategoryCellCategory {
|
|
6
7
|
readonly children: DTableCategoryCell[];
|
|
7
8
|
readonly state: DBaseStateSet;
|
|
@@ -11,35 +12,17 @@ export interface DTableCategoryCellOptions<THEME extends DThemeTableCategoryCell
|
|
|
11
12
|
export interface DThemeTableCategoryCell extends DThemeImage<string | null> {
|
|
12
13
|
getEdgeWidth(): number;
|
|
13
14
|
}
|
|
14
|
-
export declare const DTableCategoryCellEdge: {
|
|
15
|
-
readonly NONE: 0;
|
|
16
|
-
readonly LEFT: 1;
|
|
17
|
-
readonly RIGHT: 2;
|
|
18
|
-
readonly BOTH: 3;
|
|
19
|
-
};
|
|
20
|
-
export type DTableCategoryCellEdge = (typeof DTableCategoryCellEdge)[keyof typeof DTableCategoryCellEdge];
|
|
21
15
|
export declare class DTableCategoryCell<THEME extends DThemeTableCategoryCell = DThemeTableCategoryCell, OPTIONS extends DTableCategoryCellOptions<THEME> = DTableCategoryCellOptions<THEME>> extends DImage<string | null, THEME, OPTIONS> {
|
|
22
16
|
protected _category: DTableCategoryCellCategory;
|
|
23
17
|
protected _column: DTableCategoryColumn;
|
|
24
18
|
protected _columnIndex: number;
|
|
25
|
-
protected
|
|
26
|
-
protected _onHoveredBound?: (e: InteractionEvent) => void;
|
|
27
|
-
protected _resizableEdges?: DTableCategoryCellEdge;
|
|
28
|
-
protected _edgeSize: number;
|
|
29
|
-
protected _wasResizing: boolean;
|
|
19
|
+
protected _edge: DTableCellEdge<DTableCategoryCell>;
|
|
30
20
|
constructor(category: DTableCategoryCellCategory, columnIndex: number, column: DTableCategoryColumn, options?: OPTIONS);
|
|
31
21
|
get column(): DTableCategoryColumn;
|
|
32
22
|
get columnIndex(): number;
|
|
33
23
|
get category(): DTableCategoryCellCategory;
|
|
34
24
|
protected onDown(e: InteractionEvent): void;
|
|
35
|
-
protected findLeftResizableCell(columnIndex: number): DTableCategoryCell | null;
|
|
36
|
-
protected findRightResizableCellOfWeight(columnIndex: number): DTableCategoryCell | null;
|
|
37
|
-
protected checkIfEdgeResizable(columnIndex: number): boolean;
|
|
38
|
-
protected getResizableEdges(): DTableCategoryCellEdge;
|
|
39
25
|
protected onOver(e: InteractionEvent): void;
|
|
40
26
|
protected onOut(e: InteractionEvent): void;
|
|
41
|
-
protected onHovered(e: InteractionEvent): void;
|
|
42
|
-
protected toClickPosition(e: InteractionEvent): number;
|
|
43
|
-
protected onDownEdge(onDownPoint: number, columnIndex: number, interactionManager: InteractionManager): void;
|
|
44
27
|
protected getType(): string;
|
|
45
28
|
}
|
|
@@ -9,11 +9,10 @@ export declare class DTableCategoryColumnImpl<ROW_VALUE, CELL_VALUE, DIALOG_VALU
|
|
|
9
9
|
protected _isLocked: boolean;
|
|
10
10
|
offset: number;
|
|
11
11
|
protected _columns: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>[];
|
|
12
|
-
|
|
12
|
+
readonly resizable: boolean;
|
|
13
13
|
protected _onResizeBound: (column: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>) => void;
|
|
14
14
|
constructor(index: number, column: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>);
|
|
15
15
|
protected onResize(): void;
|
|
16
|
-
get resizable(): boolean;
|
|
17
16
|
get weight(): number | undefined;
|
|
18
17
|
set weight(weight: number);
|
|
19
18
|
get minWeight(): number;
|
|
@@ -7,6 +7,6 @@ export declare class DTableCategoryContainerImpl<ROW_VALUE, CELL_VALUE, DIALOG_V
|
|
|
7
7
|
readonly items: DTableCategory[];
|
|
8
8
|
constructor(columns: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>[], frozen: number, options?: DTableCategoryOptions);
|
|
9
9
|
protected toCount(columns: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>[]): number;
|
|
10
|
-
protected
|
|
10
|
+
protected isEqual(index: number, a: string | string[] | undefined, b: string | string[] | undefined): boolean;
|
|
11
11
|
protected toColumns(index: number, columns: DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG>[], frozen: number): DTableCategoryColumn[];
|
|
12
12
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { DisplayObject, IPointData, InteractionEvent, InteractionManager, Point, utils } from "pixi.js";
|
|
2
|
+
import { DBaseStateSet } from "./d-base-state-set";
|
|
3
|
+
import { DApplicationTarget } from "./d-application-like";
|
|
4
|
+
export declare const DTableCellEdgeHovered: {
|
|
5
|
+
readonly NONE: 0;
|
|
6
|
+
readonly LEFT: 1;
|
|
7
|
+
readonly RIGHT: 2;
|
|
8
|
+
readonly BOTH: 3;
|
|
9
|
+
};
|
|
10
|
+
export type DTableCellEdgeHovered = (typeof DTableCellEdgeHovered)[keyof typeof DTableCellEdgeHovered];
|
|
11
|
+
export type DTableCellEdgeData0<CELL> = [0, CELL];
|
|
12
|
+
export type DTableCellEdgeData1<CELL> = [1, CELL, CELL];
|
|
13
|
+
export type DTableCellEdgeData2<CELL> = [2, CELL, CELL, CELL[]];
|
|
14
|
+
export type DTableCellEdgeData3<CELL> = [3, CELL, CELL, CELL[]];
|
|
15
|
+
export type DTableCellEdgeData<CELL> = DTableCellEdgeData0<CELL> | DTableCellEdgeData1<CELL> | DTableCellEdgeData2<CELL> | DTableCellEdgeData3<CELL>;
|
|
16
|
+
export interface DTableCellEdgeRow<CELL> {
|
|
17
|
+
readonly state: DBaseStateSet;
|
|
18
|
+
readonly children: CELL[];
|
|
19
|
+
}
|
|
20
|
+
export interface DTableCellEdgeColumn {
|
|
21
|
+
weight?: number;
|
|
22
|
+
readonly minWeight: number;
|
|
23
|
+
width?: number;
|
|
24
|
+
readonly minWidth: number;
|
|
25
|
+
readonly resizable: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface DTableCellEdgeCell extends DApplicationTarget, utils.EventEmitter {
|
|
28
|
+
readonly state: DBaseStateSet;
|
|
29
|
+
readonly column: DTableCellEdgeColumn;
|
|
30
|
+
readonly columnIndex: number;
|
|
31
|
+
readonly cursor: string;
|
|
32
|
+
readonly width: number;
|
|
33
|
+
readonly weight: number;
|
|
34
|
+
toLocal(position: IPointData, from?: DisplayObject, point?: Point, skipUpdate?: boolean): Point;
|
|
35
|
+
}
|
|
36
|
+
export declare class DTableCellEdge<CELL extends DTableCellEdgeCell> {
|
|
37
|
+
protected _row: DTableCellEdgeRow<CELL>;
|
|
38
|
+
protected _cell: CELL;
|
|
39
|
+
protected _columnIndex: number;
|
|
40
|
+
protected _checkWork?: Point;
|
|
41
|
+
protected _onHoveredBound?: (e: InteractionEvent) => void;
|
|
42
|
+
protected _left?: DTableCellEdgeData<CELL> | null;
|
|
43
|
+
protected _right?: DTableCellEdgeData<CELL> | null;
|
|
44
|
+
protected _size: number;
|
|
45
|
+
protected _dragged: boolean;
|
|
46
|
+
protected _minWidth: number;
|
|
47
|
+
constructor(row: DTableCellEdgeRow<CELL>, cell: CELL, columnIndex: number, size: number);
|
|
48
|
+
protected findResizableCell(columnIndex: number, direction: boolean, weight: boolean | null): CELL | null;
|
|
49
|
+
protected findCells(columnIndex: number, direction: boolean, weight: boolean): CELL[];
|
|
50
|
+
protected calcData(columnIndex: number): DTableCellEdgeData<CELL> | null;
|
|
51
|
+
get left(): DTableCellEdgeData<CELL> | null;
|
|
52
|
+
get right(): DTableCellEdgeData<CELL> | null;
|
|
53
|
+
onDown(e: InteractionEvent): boolean;
|
|
54
|
+
protected onDown_(onDownPoint: number, data: DTableCellEdgeData<CELL>, interactionManager: InteractionManager): void;
|
|
55
|
+
onOver(e: InteractionEvent): void;
|
|
56
|
+
onOut(e: InteractionEvent): void;
|
|
57
|
+
protected onHovered(e: InteractionEvent): void;
|
|
58
|
+
protected toX(e: InteractionEvent): number;
|
|
59
|
+
protected onDown0(onDownPoint: number, data: DTableCellEdgeData0<CELL>, interactionManager: InteractionManager): void;
|
|
60
|
+
protected onDown1(onDownPoint: number, data: DTableCellEdgeData1<CELL>, interactionManager: InteractionManager): void;
|
|
61
|
+
protected onDown2(onDownPoint: number, data: DTableCellEdgeData2<CELL>, interactionManager: InteractionManager): void;
|
|
62
|
+
protected onDown2a(onDownPoint: number, data: DTableCellEdgeData2<CELL>, interactionManager: InteractionManager): void;
|
|
63
|
+
protected onDown2b(onDownPoint: number, data: DTableCellEdgeData2<CELL>, interactionManager: InteractionManager): void;
|
|
64
|
+
protected onDown3(onDownPoint: number, data: DTableCellEdgeData3<CELL>, interactionManager: InteractionManager): void;
|
|
65
|
+
protected onDown3a(onDownPoint: number, data: DTableCellEdgeData3<CELL>, interactionManager: InteractionManager): void;
|
|
66
|
+
protected onDown3b(onDownPoint: number, data: DTableCellEdgeData3<CELL>, interactionManager: InteractionManager): void;
|
|
67
|
+
protected newOnUp(onMove: (e: InteractionEvent) => void, interactionManager: InteractionManager): () => void;
|
|
68
|
+
isClicked(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): boolean;
|
|
69
|
+
}
|
|
@@ -16,7 +16,9 @@ import { DTableColumnUpdate } from "./d-table-column-update";
|
|
|
16
16
|
import { DTableHeaderCellOptions, DThemeTableHeaderCell } from "./d-table-header-cell";
|
|
17
17
|
export declare class DTableColumnImpl<ROW_VALUE, CELL_VALUE, DIALOG_VALUE = CELL_VALUE, DIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE> = DTableColumnSelectingDialog<DIALOG_VALUE>> extends utils.EventEmitter implements DTableColumn<ROW_VALUE, CELL_VALUE, DIALOG_VALUE, DIALOG> {
|
|
18
18
|
protected _weight?: number;
|
|
19
|
+
readonly minWeight: number;
|
|
19
20
|
protected _width?: number;
|
|
21
|
+
readonly minWidth: number;
|
|
20
22
|
readonly resizable: boolean;
|
|
21
23
|
readonly type: DTableColumnType;
|
|
22
24
|
readonly label: string;
|
|
@@ -73,7 +73,9 @@ export interface DTableColumnOptions<ROW_VALUE, CELL_VALUE = any, DIALOG_VALUE =
|
|
|
73
73
|
}
|
|
74
74
|
export interface DTableColumn<ROW_VALUE, CELL_VALUE = unknown, DIALOG_VALUE = CELL_VALUE, DIALOG extends DTableColumnSelectingDialog<DIALOG_VALUE> = DTableColumnSelectingDialog<DIALOG_VALUE>> extends utils.EventEmitter {
|
|
75
75
|
weight?: number;
|
|
76
|
+
minWeight: number;
|
|
76
77
|
width?: number;
|
|
78
|
+
minWidth: number;
|
|
77
79
|
readonly resizable: boolean;
|
|
78
80
|
readonly type: DTableColumnType;
|
|
79
81
|
label: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { InteractionEvent,
|
|
1
|
+
import { InteractionEvent, Point } from "pixi.js";
|
|
2
2
|
import { DImage, DImageOptions, DThemeImage } from "./d-image";
|
|
3
3
|
import { DTableColumn } from "./d-table-column";
|
|
4
4
|
import { DTableDataComparator, DTableDataSorter } from "./d-table-data-sorter";
|
|
5
5
|
import { DTableHeaderTable } from "./d-table-header";
|
|
6
6
|
import { DTableHeaderCellCheck, DTableHeaderCellCheckOptions } from "./d-table-header-cell-check";
|
|
7
7
|
import { DBaseStateSet } from "./d-base-state-set";
|
|
8
|
+
import { DTableCellEdge } from "./d-table-cell-edge";
|
|
8
9
|
export interface DTableHeaderCellHeader<ROW> {
|
|
9
10
|
readonly table: DTableHeaderTable<ROW> | null;
|
|
10
11
|
readonly children: DTableHeaderCell<ROW>[];
|
|
@@ -16,13 +17,6 @@ export interface DTableHeaderCellOptions<ROW, THEME extends DThemeTableHeaderCel
|
|
|
16
17
|
export interface DThemeTableHeaderCell extends DThemeImage<string | null> {
|
|
17
18
|
getEdgeWidth(): number;
|
|
18
19
|
}
|
|
19
|
-
export declare const DTableHeaderCellEdge: {
|
|
20
|
-
readonly NONE: 0;
|
|
21
|
-
readonly LEFT: 1;
|
|
22
|
-
readonly RIGHT: 2;
|
|
23
|
-
readonly BOTH: 3;
|
|
24
|
-
};
|
|
25
|
-
export type DTableHeaderCellEdge = (typeof DTableHeaderCellEdge)[keyof typeof DTableHeaderCellEdge];
|
|
26
20
|
export declare class DTableHeaderCell<ROW, THEME extends DThemeTableHeaderCell = DThemeTableHeaderCell, OPTIONS extends DTableHeaderCellOptions<ROW, THEME> = DTableHeaderCellOptions<ROW, THEME>> extends DImage<string | null, THEME, OPTIONS> {
|
|
27
21
|
protected _sorter?: DTableDataSorter<ROW>;
|
|
28
22
|
protected _onSorterChangeBound?: () => void;
|
|
@@ -31,30 +25,20 @@ export declare class DTableHeaderCell<ROW, THEME extends DThemeTableHeaderCell =
|
|
|
31
25
|
protected _columnIndex: number;
|
|
32
26
|
protected _check: DTableHeaderCellCheck<ROW>;
|
|
33
27
|
protected _checkWork?: Point;
|
|
34
|
-
protected
|
|
35
|
-
protected _resizableEdges?: DTableHeaderCellEdge;
|
|
36
|
-
protected _edgeSize: number;
|
|
37
|
-
protected _wasResizing: boolean;
|
|
28
|
+
protected _edge: DTableCellEdge<DTableHeaderCell<ROW>>;
|
|
38
29
|
constructor(header: DTableHeaderCellHeader<ROW>, columnIndex: number, column: DTableColumn<ROW>, options?: OPTIONS);
|
|
39
30
|
get column(): DTableColumn<ROW>;
|
|
40
31
|
get columnIndex(): number;
|
|
41
32
|
get header(): DTableHeaderCellHeader<ROW>;
|
|
42
33
|
get check(): DTableHeaderCellCheck<ROW>;
|
|
43
34
|
protected onDown(e: InteractionEvent): void;
|
|
44
|
-
protected findLeftResizableCell(columnIndex: number): DTableHeaderCell<ROW> | null;
|
|
45
|
-
protected findRightResizableCellOfWeight(columnIndex: number): DTableHeaderCell<ROW> | null;
|
|
46
|
-
protected checkIfEdgeResizable(columnIndex: number): boolean;
|
|
47
|
-
protected getResizableEdges(): DTableHeaderCellEdge;
|
|
48
35
|
protected onOver(e: InteractionEvent): void;
|
|
49
36
|
protected onOut(e: InteractionEvent): void;
|
|
50
|
-
protected onHovered(e: InteractionEvent): void;
|
|
51
|
-
protected onDownEdge(onDownPoint: number, columnIndex: number, interactionManager: InteractionManager): void;
|
|
52
37
|
get sorter(): DTableDataSorter<ROW> | null;
|
|
53
38
|
get comparator(): DTableDataComparator<ROW> | null;
|
|
54
39
|
protected onSorterChange(): void;
|
|
55
40
|
protected toClickPosition(e: InteractionEvent): number;
|
|
56
41
|
protected isCheckClicked(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): boolean;
|
|
57
|
-
protected isEdgeClicked(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): boolean;
|
|
58
42
|
protected onClick(e: InteractionEvent): void;
|
|
59
43
|
activate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void;
|
|
60
44
|
protected onActivate(e?: InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent): void;
|
|
@@ -3,17 +3,8 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { __extends } from "tslib";
|
|
6
|
-
import { Point } from "pixi.js";
|
|
7
6
|
import { DImage } from "./d-image";
|
|
8
|
-
import {
|
|
9
|
-
import { DApplications } from "./d-applications";
|
|
10
|
-
import { UtilPointerEvent } from "./util/util-pointer-event";
|
|
11
|
-
export var DTableCategoryCellEdge = {
|
|
12
|
-
NONE: 0,
|
|
13
|
-
LEFT: 1,
|
|
14
|
-
RIGHT: 2,
|
|
15
|
-
BOTH: 3
|
|
16
|
-
};
|
|
7
|
+
import { DTableCellEdge } from "./d-table-cell-edge";
|
|
17
8
|
var DTableCategoryCell = /** @class */ (function (_super) {
|
|
18
9
|
__extends(DTableCategoryCell, _super);
|
|
19
10
|
function DTableCategoryCell(category, columnIndex, column, options) {
|
|
@@ -21,8 +12,7 @@ var DTableCategoryCell = /** @class */ (function (_super) {
|
|
|
21
12
|
_this._category = category;
|
|
22
13
|
_this._columnIndex = columnIndex;
|
|
23
14
|
_this._column = column;
|
|
24
|
-
_this.
|
|
25
|
-
_this._wasResizing = false;
|
|
15
|
+
_this._edge = new DTableCellEdge(_this._category, _this, columnIndex, _this.theme.getEdgeWidth());
|
|
26
16
|
return _this;
|
|
27
17
|
}
|
|
28
18
|
Object.defineProperty(DTableCategoryCell.prototype, "column", {
|
|
@@ -47,209 +37,17 @@ var DTableCategoryCell = /** @class */ (function (_super) {
|
|
|
47
37
|
configurable: true
|
|
48
38
|
});
|
|
49
39
|
DTableCategoryCell.prototype.onDown = function (e) {
|
|
50
|
-
|
|
51
|
-
if (edges != null) {
|
|
52
|
-
this._wasResizing = true;
|
|
53
|
-
var layer = DApplications.getLayer(this);
|
|
54
|
-
if (layer != null) {
|
|
55
|
-
var interactionManager = layer.renderer.plugins.interaction;
|
|
56
|
-
var columnIndex = this._columnIndex;
|
|
57
|
-
if (edges === DTableCategoryCellEdge.LEFT) {
|
|
58
|
-
this.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this.onDownEdge(e.data.global.x, columnIndex, interactionManager);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this._wasResizing = false;
|
|
40
|
+
if (!this._edge.onDown(e)) {
|
|
67
41
|
_super.prototype.onDown.call(this, e);
|
|
68
42
|
}
|
|
69
43
|
};
|
|
70
|
-
DTableCategoryCell.prototype.findLeftResizableCell = function (columnIndex) {
|
|
71
|
-
var children = this._category.children;
|
|
72
|
-
var childrenLength = children.length;
|
|
73
|
-
for (var i = columnIndex; 0 <= i; --i) {
|
|
74
|
-
var child = children[childrenLength - i - 1];
|
|
75
|
-
if (child.column.resizable) {
|
|
76
|
-
return child;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
};
|
|
81
|
-
DTableCategoryCell.prototype.findRightResizableCellOfWeight = function (columnIndex) {
|
|
82
|
-
var children = this._category.children;
|
|
83
|
-
var childrenLength = children.length;
|
|
84
|
-
for (var i = columnIndex + 1; i < childrenLength; ++i) {
|
|
85
|
-
var child = children[childrenLength - i - 1];
|
|
86
|
-
var childColumn = child.column;
|
|
87
|
-
if (childColumn.resizable) {
|
|
88
|
-
var childColumnWeight = childColumn.weight;
|
|
89
|
-
if (childColumnWeight != null) {
|
|
90
|
-
return child;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return null;
|
|
95
|
-
};
|
|
96
|
-
DTableCategoryCell.prototype.checkIfEdgeResizable = function (columnIndex) {
|
|
97
|
-
var target = this.findLeftResizableCell(columnIndex);
|
|
98
|
-
if (target != null) {
|
|
99
|
-
if (target.column.weight != null) {
|
|
100
|
-
return this.findRightResizableCellOfWeight(target.columnIndex) != null;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
107
|
-
};
|
|
108
|
-
DTableCategoryCell.prototype.getResizableEdges = function () {
|
|
109
|
-
var result = this._resizableEdges;
|
|
110
|
-
if (result == null) {
|
|
111
|
-
var columnIndex = this._columnIndex;
|
|
112
|
-
if (this.checkIfEdgeResizable(columnIndex - 1)) {
|
|
113
|
-
if (this.checkIfEdgeResizable(columnIndex)) {
|
|
114
|
-
result = DTableCategoryCellEdge.BOTH;
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
result = DTableCategoryCellEdge.LEFT;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
if (this.checkIfEdgeResizable(columnIndex)) {
|
|
122
|
-
result = DTableCategoryCellEdge.RIGHT;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
result = DTableCategoryCellEdge.NONE;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
this._resizableEdges = result;
|
|
129
|
-
}
|
|
130
|
-
return result;
|
|
131
|
-
};
|
|
132
44
|
DTableCategoryCell.prototype.onOver = function (e) {
|
|
133
|
-
var _this = this;
|
|
134
|
-
var _a;
|
|
135
45
|
_super.prototype.onOver.call(this, e);
|
|
136
|
-
|
|
137
|
-
var onHoveredBound = ((_a = this._onHoveredBound) !== null && _a !== void 0 ? _a : (this._onHoveredBound = function (event) {
|
|
138
|
-
_this.onHovered(event);
|
|
139
|
-
}));
|
|
140
|
-
this.on(UtilPointerEvent.move, onHoveredBound);
|
|
141
|
-
// Since the cursor is set by InteractionManager before this method is called,
|
|
142
|
-
// the cursor need to be overriden.
|
|
143
|
-
this.onHovered(e);
|
|
144
|
-
var layer = DApplications.getLayer(this);
|
|
145
|
-
if (layer != null) {
|
|
146
|
-
layer.renderer.plugins.interaction.cursor = this.cursor;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
46
|
+
this._edge.onOver(e);
|
|
149
47
|
};
|
|
150
48
|
DTableCategoryCell.prototype.onOut = function (e) {
|
|
151
49
|
_super.prototype.onOut.call(this, e);
|
|
152
|
-
|
|
153
|
-
if (onHoveredBound != null) {
|
|
154
|
-
this.state.remove(DTableState.HOVERED_ON_EDGE);
|
|
155
|
-
this.off(UtilPointerEvent.move, onHoveredBound);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
DTableCategoryCell.prototype.onHovered = function (e) {
|
|
159
|
-
var width = this.width;
|
|
160
|
-
var x = this.toClickPosition(e);
|
|
161
|
-
var edgeSize = this._edgeSize;
|
|
162
|
-
if (0 <= x && x <= edgeSize) {
|
|
163
|
-
if (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {
|
|
164
|
-
this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
this.state.remove(DTableState.HOVERED_ON_EDGE);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
else if (width - edgeSize <= x && x <= width) {
|
|
171
|
-
if (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {
|
|
172
|
-
this.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
this.state.remove(DTableState.HOVERED_ON_EDGE);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
this.state.remove(DTableState.HOVERED_ON_EDGE);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
DTableCategoryCell.prototype.toClickPosition = function (e) {
|
|
183
|
-
var _a;
|
|
184
|
-
var checkWork = ((_a = this._checkWork) !== null && _a !== void 0 ? _a : (this._checkWork = new Point()));
|
|
185
|
-
return e.data.getLocalPosition(this, checkWork).x;
|
|
186
|
-
};
|
|
187
|
-
DTableCategoryCell.prototype.onDownEdge = function (onDownPoint, columnIndex, interactionManager) {
|
|
188
|
-
// Find the resizable cell
|
|
189
|
-
var left = this.findLeftResizableCell(columnIndex);
|
|
190
|
-
if (left == null) {
|
|
191
|
-
// No resizable cell
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
var category = this._category;
|
|
195
|
-
var leftColumn = left.column;
|
|
196
|
-
var leftOldWidth = left.width;
|
|
197
|
-
var leftOldWeight = left.weight;
|
|
198
|
-
if (leftColumn.weight == null) {
|
|
199
|
-
category.state.add(DTableState.RESIZING);
|
|
200
|
-
var leftMinWidth_1 = leftColumn.minWidth;
|
|
201
|
-
var onMove_1 = function (e) {
|
|
202
|
-
leftColumn.width = Math.max(leftMinWidth_1, leftOldWidth + e.data.global.x - onDownPoint);
|
|
203
|
-
};
|
|
204
|
-
var onUp_1 = function (e) {
|
|
205
|
-
category.state.remove(DTableState.RESIZING);
|
|
206
|
-
interactionManager.off(UtilPointerEvent.move, onMove_1);
|
|
207
|
-
interactionManager.off(UtilPointerEvent.up, onUp_1);
|
|
208
|
-
interactionManager.off(UtilPointerEvent.upoutside, onUp_1);
|
|
209
|
-
interactionManager.off(UtilPointerEvent.cancel, onUp_1);
|
|
210
|
-
};
|
|
211
|
-
interactionManager.on(UtilPointerEvent.move, onMove_1);
|
|
212
|
-
interactionManager.on(UtilPointerEvent.up, onUp_1);
|
|
213
|
-
interactionManager.on(UtilPointerEvent.upoutside, onUp_1);
|
|
214
|
-
interactionManager.on(UtilPointerEvent.cancel, onUp_1);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
var right = this.findRightResizableCellOfWeight(left.columnIndex);
|
|
218
|
-
if (right == null) {
|
|
219
|
-
// No right resizable cell found
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
var rightColumn_1 = right.column;
|
|
223
|
-
var rightOldWeight = right.weight;
|
|
224
|
-
var rightOldWidth = right.width;
|
|
225
|
-
var totalWidth_1 = leftOldWidth + rightOldWidth;
|
|
226
|
-
var totalWeight_1 = leftOldWeight + rightOldWeight;
|
|
227
|
-
var leftMinWeight_1 = leftColumn.minWeight;
|
|
228
|
-
var rightMinWeight = rightColumn_1.minWeight;
|
|
229
|
-
var leftMaxWeight_1 = totalWeight_1 - rightMinWeight;
|
|
230
|
-
if (totalWidth_1 <= 0 || leftMaxWeight_1 <= leftMinWeight_1) {
|
|
231
|
-
// The left and right resizable cells doesn't non-zero width
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
category.state.add(DTableState.RESIZING);
|
|
235
|
-
var onMove_2 = function (e) {
|
|
236
|
-
var leftNewWidth = Math.max(0, Math.min(totalWidth_1, leftOldWidth + e.data.global.x - onDownPoint));
|
|
237
|
-
var leftNewWeight = Math.max(leftMinWeight_1, Math.min(leftMaxWeight_1, totalWeight_1 * (leftNewWidth / totalWidth_1)));
|
|
238
|
-
leftColumn.weight = leftNewWeight;
|
|
239
|
-
rightColumn_1.weight = totalWeight_1 - leftNewWeight;
|
|
240
|
-
};
|
|
241
|
-
var onUp_2 = function (e) {
|
|
242
|
-
category.state.remove(DTableState.RESIZING);
|
|
243
|
-
interactionManager.off(UtilPointerEvent.move, onMove_2);
|
|
244
|
-
interactionManager.off(UtilPointerEvent.up, onUp_2);
|
|
245
|
-
interactionManager.off(UtilPointerEvent.upoutside, onUp_2);
|
|
246
|
-
interactionManager.off(UtilPointerEvent.cancel, onUp_2);
|
|
247
|
-
};
|
|
248
|
-
interactionManager.on(UtilPointerEvent.move, onMove_2);
|
|
249
|
-
interactionManager.on(UtilPointerEvent.up, onUp_2);
|
|
250
|
-
interactionManager.on(UtilPointerEvent.upoutside, onUp_2);
|
|
251
|
-
interactionManager.on(UtilPointerEvent.cancel, onUp_2);
|
|
252
|
-
}
|
|
50
|
+
this._edge.onOut(e);
|
|
253
51
|
};
|
|
254
52
|
DTableCategoryCell.prototype.getType = function () {
|
|
255
53
|
return "DTableCategoryCell";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-table-category-cell.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-category-cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAwC,KAAK,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,MAAM,EAA8B,MAAM,WAAW,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAe7D,MAAM,CAAC,IAAM,sBAA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C,CAAC;YACF,IAAM,MAAI,GAAG,UAAC,CAAmB;gBAChC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBAC5C,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAM,CAAC,CAAC;gBACtD,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAI,CAAC,CAAC;gBAClD,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAI,CAAC,CAAC;gBACzD,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAI,CAAC,CAAC;YACvD,CAAC,CAAC;YACF,kBAAkB,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAM,CAAC,CAAC;YACrD,kBAAkB,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAI,CAAC,CAAC;YACjD,kBAAkB,CAAC,EAAE,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAI,CAAC,CAAC;YACxD,kBAAkB,CAAC,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAI,CAAC,CAAC;SACrD;IACF,CAAC;IAES,oCAAO,GAAjB;QACC,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IACF,yBAAC;AAAD,CAAC,AAtQD,CAGU,MAAM,GAmQf","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { InteractionEvent, InteractionManager, Point } from \"pixi.js\";\nimport { DImage, DImageOptions, DThemeImage } from \"./d-image\";\nimport { DTableCategoryColumn } from \"./d-table-category-column\";\nimport { DTableState } from \"./d-table-state\";\nimport { DApplications } from \"./d-applications\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { UtilPointerEvent } from \"./util/util-pointer-event\";\n\nexport interface DTableCategoryCellCategory {\n\treadonly children: DTableCategoryCell[];\n\treadonly state: DBaseStateSet;\n}\n\nexport interface DTableCategoryCellOptions<\n\tTHEME extends DThemeTableCategoryCell = DThemeTableCategoryCell\n> extends DImageOptions<string | null, THEME> {}\n\nexport interface DThemeTableCategoryCell extends DThemeImage<string | null> {\n\tgetEdgeWidth(): number;\n}\n\nexport const DTableCategoryCellEdge = {\n\tNONE: 0,\n\tLEFT: 1,\n\tRIGHT: 2,\n\tBOTH: 3\n} as const;\n\nexport type DTableCategoryCellEdge =\n\t(typeof DTableCategoryCellEdge)[keyof typeof DTableCategoryCellEdge];\n\nexport class DTableCategoryCell<\n\tTHEME extends DThemeTableCategoryCell = DThemeTableCategoryCell,\n\tOPTIONS extends DTableCategoryCellOptions<THEME> = DTableCategoryCellOptions<THEME>\n> extends DImage<string | null, THEME, OPTIONS> {\n\tprotected _category: DTableCategoryCellCategory;\n\tprotected _column: DTableCategoryColumn;\n\tprotected _columnIndex: number;\n\n\tprotected _checkWork?: Point;\n\tprotected _onHoveredBound?: (e: InteractionEvent) => void;\n\tprotected _resizableEdges?: DTableCategoryCellEdge;\n\tprotected _edgeSize: number;\n\tprotected _wasResizing: boolean;\n\n\tconstructor(\n\t\tcategory: DTableCategoryCellCategory,\n\t\tcolumnIndex: number,\n\t\tcolumn: DTableCategoryColumn,\n\t\toptions?: OPTIONS\n\t) {\n\t\tsuper(options);\n\n\t\tthis._category = category;\n\t\tthis._columnIndex = columnIndex;\n\t\tthis._column = column;\n\t\tthis._edgeSize = this.theme.getEdgeWidth();\n\t\tthis._wasResizing = false;\n\t}\n\n\tget column(): DTableCategoryColumn {\n\t\treturn this._column;\n\t}\n\n\tget columnIndex(): number {\n\t\treturn this._columnIndex;\n\t}\n\n\tget category(): DTableCategoryCellCategory {\n\t\treturn this._category;\n\t}\n\n\tprotected override onDown(e: InteractionEvent): void {\n\t\tconst edges = this.state.valueOf(DTableState.HOVERED_ON_EDGE);\n\t\tif (edges != null) {\n\t\t\tthis._wasResizing = true;\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer != null) {\n\t\t\t\tconst interactionManager = layer.renderer.plugins.interaction;\n\t\t\t\tconst columnIndex = this._columnIndex;\n\t\t\t\tif (edges === DTableCategoryCellEdge.LEFT) {\n\t\t\t\t\tthis.onDownEdge(e.data.global.x, columnIndex - 1, interactionManager);\n\t\t\t\t} else {\n\t\t\t\t\tthis.onDownEdge(e.data.global.x, columnIndex, interactionManager);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tthis._wasResizing = false;\n\t\t\tsuper.onDown(e);\n\t\t}\n\t}\n\n\tprotected findLeftResizableCell(columnIndex: number): DTableCategoryCell | null {\n\t\tconst children = this._category.children;\n\t\tconst childrenLength = children.length;\n\t\tfor (let i = columnIndex; 0 <= i; --i) {\n\t\t\tconst child = children[childrenLength - i - 1];\n\t\t\tif (child.column.resizable) {\n\t\t\t\treturn child;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected findRightResizableCellOfWeight(columnIndex: number): DTableCategoryCell | null {\n\t\tconst children = this._category.children;\n\t\tconst childrenLength = children.length;\n\t\tfor (let i = columnIndex + 1; i < childrenLength; ++i) {\n\t\t\tconst child = children[childrenLength - i - 1];\n\t\t\tconst childColumn = child.column;\n\t\t\tif (childColumn.resizable) {\n\t\t\t\tconst childColumnWeight = childColumn.weight;\n\t\t\t\tif (childColumnWeight != null) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected checkIfEdgeResizable(columnIndex: number): boolean {\n\t\tconst target = this.findLeftResizableCell(columnIndex);\n\t\tif (target != null) {\n\t\t\tif (target.column.weight != null) {\n\t\t\t\treturn this.findRightResizableCellOfWeight(target.columnIndex) != null;\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tprotected getResizableEdges(): DTableCategoryCellEdge {\n\t\tlet result = this._resizableEdges;\n\t\tif (result == null) {\n\t\t\tconst columnIndex = this._columnIndex;\n\t\t\tif (this.checkIfEdgeResizable(columnIndex - 1)) {\n\t\t\t\tif (this.checkIfEdgeResizable(columnIndex)) {\n\t\t\t\t\tresult = DTableCategoryCellEdge.BOTH;\n\t\t\t\t} else {\n\t\t\t\t\tresult = DTableCategoryCellEdge.LEFT;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.checkIfEdgeResizable(columnIndex)) {\n\t\t\t\t\tresult = DTableCategoryCellEdge.RIGHT;\n\t\t\t\t} else {\n\t\t\t\t\tresult = DTableCategoryCellEdge.NONE;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._resizableEdges = result;\n\t\t}\n\t\treturn result;\n\t}\n\n\tprotected override onOver(e: InteractionEvent): void {\n\t\tsuper.onOver(e);\n\n\t\tif (this.getResizableEdges() !== DTableCategoryCellEdge.NONE) {\n\t\t\tconst onHoveredBound = (this._onHoveredBound ??= (event: InteractionEvent): void => {\n\t\t\t\tthis.onHovered(event);\n\t\t\t});\n\t\t\tthis.on(UtilPointerEvent.move, onHoveredBound);\n\n\t\t\t// Since the cursor is set by InteractionManager before this method is called,\n\t\t\t// the cursor need to be overriden.\n\t\t\tthis.onHovered(e);\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer != null) {\n\t\t\t\tlayer.renderer.plugins.interaction.cursor = this.cursor;\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected override onOut(e: InteractionEvent): void {\n\t\tsuper.onOut(e);\n\n\t\tconst onHoveredBound = this._onHoveredBound;\n\t\tif (onHoveredBound != null) {\n\t\t\tthis.state.remove(DTableState.HOVERED_ON_EDGE);\n\t\t\tthis.off(UtilPointerEvent.move, onHoveredBound);\n\t\t}\n\t}\n\n\tprotected onHovered(e: InteractionEvent): void {\n\t\tconst width = this.width;\n\t\tconst x = this.toClickPosition(e);\n\t\tconst edgeSize = this._edgeSize;\n\t\tif (0 <= x && x <= edgeSize) {\n\t\t\tif (this.getResizableEdges() & DTableCategoryCellEdge.LEFT) {\n\t\t\t\tthis.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.LEFT);\n\t\t\t} else {\n\t\t\t\tthis.state.remove(DTableState.HOVERED_ON_EDGE);\n\t\t\t}\n\t\t} else if (width - edgeSize <= x && x <= width) {\n\t\t\tif (this.getResizableEdges() & DTableCategoryCellEdge.RIGHT) {\n\t\t\t\tthis.state.add(DTableState.HOVERED_ON_EDGE, DTableCategoryCellEdge.RIGHT);\n\t\t\t} else {\n\t\t\t\tthis.state.remove(DTableState.HOVERED_ON_EDGE);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.state.remove(DTableState.HOVERED_ON_EDGE);\n\t\t}\n\t}\n\n\tprotected toClickPosition(e: InteractionEvent): number {\n\t\tconst checkWork = (this._checkWork ??= new Point());\n\t\treturn e.data.getLocalPosition(this, checkWork).x;\n\t}\n\n\tprotected onDownEdge(\n\t\tonDownPoint: number,\n\t\tcolumnIndex: number,\n\t\tinteractionManager: InteractionManager\n\t): void {\n\t\t// Find the resizable cell\n\t\tconst left = this.findLeftResizableCell(columnIndex);\n\t\tif (left == null) {\n\t\t\t// No resizable cell\n\t\t\treturn;\n\t\t}\n\n\t\tconst category = this._category;\n\t\tconst leftColumn = left.column;\n\t\tconst leftOldWidth = left.width;\n\t\tconst leftOldWeight = left.weight;\n\t\tif (leftColumn.weight == null) {\n\t\t\tcategory.state.add(DTableState.RESIZING);\n\t\t\tconst leftMinWidth = leftColumn.minWidth;\n\t\t\tconst onMove = (e: InteractionEvent): void => {\n\t\t\t\tleftColumn.width = Math.max(\n\t\t\t\t\tleftMinWidth,\n\t\t\t\t\tleftOldWidth + e.data.global.x - onDownPoint\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst onUp = (e: InteractionEvent) => {\n\t\t\t\tcategory.state.remove(DTableState.RESIZING);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.move, onMove);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.up, onUp);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.upoutside, onUp);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.cancel, onUp);\n\t\t\t};\n\t\t\tinteractionManager.on(UtilPointerEvent.move, onMove);\n\t\t\tinteractionManager.on(UtilPointerEvent.up, onUp);\n\t\t\tinteractionManager.on(UtilPointerEvent.upoutside, onUp);\n\t\t\tinteractionManager.on(UtilPointerEvent.cancel, onUp);\n\t\t} else {\n\t\t\tconst right = this.findRightResizableCellOfWeight(left.columnIndex);\n\t\t\tif (right == null) {\n\t\t\t\t// No right resizable cell found\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst rightColumn = right.column;\n\t\t\tconst rightOldWeight = right.weight;\n\t\t\tconst rightOldWidth = right.width;\n\t\t\tconst totalWidth = leftOldWidth + rightOldWidth;\n\t\t\tconst totalWeight = leftOldWeight + rightOldWeight;\n\t\t\tconst leftMinWeight = leftColumn.minWeight;\n\t\t\tconst rightMinWeight = rightColumn.minWeight;\n\t\t\tconst leftMaxWeight = totalWeight - rightMinWeight;\n\t\t\tif (totalWidth <= 0 || leftMaxWeight <= leftMinWeight) {\n\t\t\t\t// The left and right resizable cells doesn't non-zero width\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcategory.state.add(DTableState.RESIZING);\n\t\t\tconst onMove = (e: InteractionEvent): void => {\n\t\t\t\tconst leftNewWidth = Math.max(\n\t\t\t\t\t0,\n\t\t\t\t\tMath.min(totalWidth, leftOldWidth + e.data.global.x - onDownPoint)\n\t\t\t\t);\n\t\t\t\tconst leftNewWeight = Math.max(\n\t\t\t\t\tleftMinWeight,\n\t\t\t\t\tMath.min(leftMaxWeight, totalWeight * (leftNewWidth / totalWidth))\n\t\t\t\t);\n\t\t\t\tleftColumn.weight = leftNewWeight;\n\t\t\t\trightColumn.weight = totalWeight - leftNewWeight;\n\t\t\t};\n\t\t\tconst onUp = (e: InteractionEvent) => {\n\t\t\t\tcategory.state.remove(DTableState.RESIZING);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.move, onMove);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.up, onUp);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.upoutside, onUp);\n\t\t\t\tinteractionManager.off(UtilPointerEvent.cancel, onUp);\n\t\t\t};\n\t\t\tinteractionManager.on(UtilPointerEvent.move, onMove);\n\t\t\tinteractionManager.on(UtilPointerEvent.up, onUp);\n\t\t\tinteractionManager.on(UtilPointerEvent.upoutside, onUp);\n\t\t\tinteractionManager.on(UtilPointerEvent.cancel, onUp);\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTableCategoryCell\";\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-table-category-cell.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-table-category-cell.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,MAAM,EAA8B,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAerD;IAGU,sCAAqC;IAM9C,4BACC,QAAoC,EACpC,WAAmB,EACnB,MAA4B,EAC5B,OAAiB;QAJlB,YAMC,kBAAM,OAAO,CAAC,SAWd;QATA,KAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,KAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,KAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,KAAI,CAAC,KAAK,GAAG,IAAI,cAAc,CAC9B,KAAI,CAAC,SAAS,EACd,KAAI,EACJ,WAAW,EACX,KAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CACzB,CAAC;;IACH,CAAC;IAED,sBAAI,sCAAM;aAAV;YACC,OAAO,IAAI,CAAC,OAAO,CAAC;QACrB,CAAC;;;OAAA;IAED,sBAAI,2CAAW;aAAf;YACC,OAAO,IAAI,CAAC,YAAY,CAAC;QAC1B,CAAC;;;OAAA;IAED,sBAAI,wCAAQ;aAAZ;YACC,OAAO,IAAI,CAAC,SAAS,CAAC;QACvB,CAAC;;;OAAA;IAEkB,mCAAM,GAAzB,UAA0B,CAAmB;QAC5C,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;YAC1B,iBAAM,MAAM,YAAC,CAAC,CAAC,CAAC;SAChB;IACF,CAAC;IAEkB,mCAAM,GAAzB,UAA0B,CAAmB;QAC5C,iBAAM,MAAM,YAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;IAEkB,kCAAK,GAAxB,UAAyB,CAAmB;QAC3C,iBAAM,KAAK,YAAC,CAAC,CAAC,CAAC;QACf,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAES,oCAAO,GAAjB;QACC,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IACF,yBAAC;AAAD,CAAC,AA3DD,CAGU,MAAM,GAwDf","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { InteractionEvent } from \"pixi.js\";\nimport { DImage, DImageOptions, DThemeImage } from \"./d-image\";\nimport { DTableCategoryColumn } from \"./d-table-category-column\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { DTableCellEdge } from \"./d-table-cell-edge\";\n\nexport interface DTableCategoryCellCategory {\n\treadonly children: DTableCategoryCell[];\n\treadonly state: DBaseStateSet;\n}\n\nexport interface DTableCategoryCellOptions<\n\tTHEME extends DThemeTableCategoryCell = DThemeTableCategoryCell\n> extends DImageOptions<string | null, THEME> {}\n\nexport interface DThemeTableCategoryCell extends DThemeImage<string | null> {\n\tgetEdgeWidth(): number;\n}\n\nexport class DTableCategoryCell<\n\tTHEME extends DThemeTableCategoryCell = DThemeTableCategoryCell,\n\tOPTIONS extends DTableCategoryCellOptions<THEME> = DTableCategoryCellOptions<THEME>\n> extends DImage<string | null, THEME, OPTIONS> {\n\tprotected _category: DTableCategoryCellCategory;\n\tprotected _column: DTableCategoryColumn;\n\tprotected _columnIndex: number;\n\tprotected _edge: DTableCellEdge<DTableCategoryCell>;\n\n\tconstructor(\n\t\tcategory: DTableCategoryCellCategory,\n\t\tcolumnIndex: number,\n\t\tcolumn: DTableCategoryColumn,\n\t\toptions?: OPTIONS\n\t) {\n\t\tsuper(options);\n\n\t\tthis._category = category;\n\t\tthis._columnIndex = columnIndex;\n\t\tthis._column = column;\n\t\tthis._edge = new DTableCellEdge<DTableCategoryCell>(\n\t\t\tthis._category,\n\t\t\tthis,\n\t\t\tcolumnIndex,\n\t\t\tthis.theme.getEdgeWidth()\n\t\t);\n\t}\n\n\tget column(): DTableCategoryColumn {\n\t\treturn this._column;\n\t}\n\n\tget columnIndex(): number {\n\t\treturn this._columnIndex;\n\t}\n\n\tget category(): DTableCategoryCellCategory {\n\t\treturn this._category;\n\t}\n\n\tprotected override onDown(e: InteractionEvent): void {\n\t\tif (!this._edge.onDown(e)) {\n\t\t\tsuper.onDown(e);\n\t\t}\n\t}\n\n\tprotected override onOver(e: InteractionEvent): void {\n\t\tsuper.onOver(e);\n\t\tthis._edge.onOver(e);\n\t}\n\n\tprotected override onOut(e: InteractionEvent): void {\n\t\tsuper.onOut(e);\n\t\tthis._edge.onOut(e);\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTableCategoryCell\";\n\t}\n}\n"]}
|
|
@@ -28,7 +28,7 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
28
28
|
_this._isLocked = false;
|
|
29
29
|
_this.offset = 0.0;
|
|
30
30
|
_this._columns = [column];
|
|
31
|
-
_this.
|
|
31
|
+
_this.resizable = column.resizable;
|
|
32
32
|
var onResizeBound = function () {
|
|
33
33
|
_this.onResize();
|
|
34
34
|
};
|
|
@@ -68,21 +68,13 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
Object.defineProperty(DTableCategoryColumnImpl.prototype, "resizable", {
|
|
72
|
-
get: function () {
|
|
73
|
-
return 0 < this._nresizable;
|
|
74
|
-
},
|
|
75
|
-
enumerable: false,
|
|
76
|
-
configurable: true
|
|
77
|
-
});
|
|
78
71
|
Object.defineProperty(DTableCategoryColumnImpl.prototype, "weight", {
|
|
79
72
|
get: function () {
|
|
80
73
|
return this._weight;
|
|
81
74
|
},
|
|
82
75
|
set: function (weight) {
|
|
83
76
|
var oldWeight = this._weight;
|
|
84
|
-
|
|
85
|
-
if (0 < nresizable && oldWeight != null && oldWeight !== weight) {
|
|
77
|
+
if (oldWeight != null && oldWeight !== weight) {
|
|
86
78
|
var columns = this._columns;
|
|
87
79
|
var columnsLength = columns.length;
|
|
88
80
|
var minWeight = this.minWeight;
|
|
@@ -90,22 +82,22 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
90
82
|
if (this._weight !== newWeight) {
|
|
91
83
|
this._isLocked = true;
|
|
92
84
|
if (minWeight < oldWeight) {
|
|
93
|
-
|
|
85
|
+
// TODO: IMPROVE THIS
|
|
86
|
+
var columnWeightRatio = newWeight / oldWeight;
|
|
94
87
|
for (var i = 0; i < columnsLength; ++i) {
|
|
95
88
|
var column = columns[i];
|
|
96
89
|
var columnWeight = column.weight;
|
|
97
|
-
if (
|
|
98
|
-
column.weight = columnWeight * columnWeightRatio;
|
|
90
|
+
if (columnWeight != null) {
|
|
91
|
+
column.weight = Math.max(column.minWeight, columnWeight * columnWeightRatio);
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
94
|
}
|
|
102
95
|
else {
|
|
103
|
-
var newColumnWeight = (newWeight - minWeight) / this._nresizable;
|
|
104
96
|
for (var i = 0; i < columnsLength; ++i) {
|
|
105
97
|
var column = columns[i];
|
|
106
98
|
var columnWeight = column.weight;
|
|
107
|
-
if (
|
|
108
|
-
column.weight =
|
|
99
|
+
if (columnWeight != null) {
|
|
100
|
+
column.weight = column.minWeight;
|
|
109
101
|
}
|
|
110
102
|
}
|
|
111
103
|
}
|
|
@@ -125,8 +117,8 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
125
117
|
for (var i = 0; i < columnsLength; ++i) {
|
|
126
118
|
var column = columns[i];
|
|
127
119
|
var columnWeight = column.weight;
|
|
128
|
-
if (
|
|
129
|
-
result +=
|
|
120
|
+
if (columnWeight != null) {
|
|
121
|
+
result += column.minWeight;
|
|
130
122
|
}
|
|
131
123
|
}
|
|
132
124
|
return result;
|
|
@@ -140,8 +132,7 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
140
132
|
},
|
|
141
133
|
set: function (width) {
|
|
142
134
|
var oldWidth = this._width;
|
|
143
|
-
|
|
144
|
-
if (0 < nresizable && oldWidth != null && oldWidth !== width) {
|
|
135
|
+
if (oldWidth != null && oldWidth !== width) {
|
|
145
136
|
var columns = this._columns;
|
|
146
137
|
var columnsLength = columns.length;
|
|
147
138
|
var minWidth = this.minWidth;
|
|
@@ -149,22 +140,22 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
149
140
|
if (oldWidth !== newWidth) {
|
|
150
141
|
this._isLocked = true;
|
|
151
142
|
if (minWidth < oldWidth) {
|
|
152
|
-
|
|
143
|
+
// TODO: IMPROVE THIS
|
|
144
|
+
var columnWidthRatio = newWidth / oldWidth;
|
|
153
145
|
for (var i = 0; i < columnsLength; ++i) {
|
|
154
146
|
var column = columns[i];
|
|
155
147
|
var columnWidth = column.width;
|
|
156
|
-
if (
|
|
157
|
-
column.width = columnWidth * columnWidthRatio;
|
|
148
|
+
if (columnWidth != null) {
|
|
149
|
+
column.width = Math.max(column.minWidth, columnWidth * columnWidthRatio);
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
152
|
}
|
|
161
153
|
else {
|
|
162
|
-
var newColumnWidth = (newWidth - minWidth) / this._nresizable;
|
|
163
154
|
for (var i = 0; i < columnsLength; ++i) {
|
|
164
155
|
var column = columns[i];
|
|
165
156
|
var columnWidth = column.width;
|
|
166
|
-
if (
|
|
167
|
-
column.width =
|
|
157
|
+
if (columnWidth != null) {
|
|
158
|
+
column.width = column.minWidth;
|
|
168
159
|
}
|
|
169
160
|
}
|
|
170
161
|
}
|
|
@@ -184,8 +175,8 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
184
175
|
for (var i = 0; i < columnsLength; ++i) {
|
|
185
176
|
var column = columns[i];
|
|
186
177
|
var columnWidth = column.width;
|
|
187
|
-
if (
|
|
188
|
-
result +=
|
|
178
|
+
if (columnWidth != null) {
|
|
179
|
+
result += column.minWidth;
|
|
189
180
|
}
|
|
190
181
|
}
|
|
191
182
|
return result;
|
|
@@ -199,9 +190,6 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
199
190
|
var weight = column.weight;
|
|
200
191
|
if (weight != null) {
|
|
201
192
|
this._weight += weight;
|
|
202
|
-
if (column.resizable) {
|
|
203
|
-
this._nresizable += 1;
|
|
204
|
-
}
|
|
205
193
|
column.on("resize", this._onResizeBound);
|
|
206
194
|
}
|
|
207
195
|
}
|
|
@@ -209,9 +197,6 @@ var DTableCategoryColumnImpl = /** @class */ (function (_super) {
|
|
|
209
197
|
var width = column.width;
|
|
210
198
|
if (width != null) {
|
|
211
199
|
this._width += width;
|
|
212
|
-
if (column.resizable) {
|
|
213
|
-
this._nresizable += 1;
|
|
214
|
-
}
|
|
215
200
|
column.on("resize", this._onResizeBound);
|
|
216
201
|
}
|
|
217
202
|
}
|