@gzmjs/table 0.1.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/055-table/00-base.d.ts +127 -0
- package/dist/055-table/05-colWidthSetter.d.ts +13 -0
- package/dist/055-table/10-cell.d.ts +14 -0
- package/dist/055-table/16-row.d.ts +31 -0
- package/dist/055-table/17-rows.d.ts +21 -0
- package/dist/055-table/18-aggs.d.ts +16 -0
- package/dist/055-table/20-col.d.ts +197 -0
- package/dist/055-table/22-colgroup.d.ts +112 -0
- package/dist/055-table/25-cols.d.ts +25 -0
- package/dist/055-table/35-snapshot.d.ts +34 -0
- package/dist/055-table/46-tht-options.d.ts +37 -0
- package/dist/055-table/47-head-tail.d.ts +27 -0
- package/dist/055-table/48-col-head.d.ts +20 -0
- package/dist/055-table/48-col-tail.d.ts +20 -0
- package/dist/055-table/51-check.d.ts +89 -0
- package/dist/055-table/52-serial.d.ts +20 -0
- package/dist/055-table/53-action.d.ts +53 -0
- package/dist/055-table/54-menu.d.ts +27 -0
- package/dist/055-table/60-list.d.ts +41 -0
- package/dist/055-table/62-table.d.ts +175 -0
- package/dist/index.d.ts +10 -0
- package/dist/table.es.js +2969 -0
- package/dist/table.es.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { TableCol } from './20-col';
|
|
2
|
+
import { TableColGroup } from './22-colgroup';
|
|
3
|
+
import { TableColCheckbox } from './51-check';
|
|
4
|
+
/**
|
|
5
|
+
* Table 相关标签的层次结构
|
|
6
|
+
*/
|
|
7
|
+
export declare const tableViewTagName = "GZM-TABLE";
|
|
8
|
+
export declare const tableListTagName = "GZM-TABLE-LIST";
|
|
9
|
+
export declare const tableColStartTagName = "GZM-TABLE-COL-START";
|
|
10
|
+
export declare const tableColHeadTagName = "GZM-TABLE-COL-HEAD";
|
|
11
|
+
export declare const tableColMiddleTagName = "GZM-TABLE-COL-MIDDLE";
|
|
12
|
+
export declare const tableColsTagName = "GZM-TABLE-COLS";
|
|
13
|
+
export declare const tableColGroupTagName = "GZM-TABLE-COL-GROUP";
|
|
14
|
+
export declare const tableColTagName = "GZM-TABLE-COL";
|
|
15
|
+
export declare const tableColEndTagName = "GZM-TABLE-COL-END";
|
|
16
|
+
export declare const tableColTailTagName = "GZM-TABLE-COL-TAIL";
|
|
17
|
+
export declare const tableRowsTagName = "GZM-TABLE-ROWS";
|
|
18
|
+
export declare const tableRowTagName = "GZM-TABLE-ROW";
|
|
19
|
+
export declare const tableRowStartTagName = "GZM-TABLE-ROW-START";
|
|
20
|
+
export declare const tableRowMiddleTagName = "GZM-TABLE-ROW-MIDDLE";
|
|
21
|
+
export declare const tableRowEndTagName = "GZM-TABLE-ROW-END";
|
|
22
|
+
export declare const tableCellTagName = "GZM-TABLE-CELL";
|
|
23
|
+
export declare const tableAggsTagName = "GZM-TABLE-AGGS";
|
|
24
|
+
export declare const tableAggStartTagName = "GZM-TABLE-AGG-START";
|
|
25
|
+
export declare const tableAggMiddleTagName = "GZM-TABLE-AGG-MIDDLE";
|
|
26
|
+
export declare const tableAggEndTagName = "GZM-TABLE-AGG-END";
|
|
27
|
+
export declare const tableAggTagName = "GZM-TABLE-AGG";
|
|
28
|
+
/**
|
|
29
|
+
* 列的宽度设置
|
|
30
|
+
*/
|
|
31
|
+
export declare const tableColWidthSetterTagName = "GZM-TABLE-COL-WIDTH-SETTER";
|
|
32
|
+
export declare const tableColCheckTagName = "GZM-TABLE-COL-CHECK";
|
|
33
|
+
export declare const tableRowCheckTagName = "GZM-TABLE-ROW-CHECK";
|
|
34
|
+
export declare const tableColSerialTagName = "GZM-TABLE-COL-SERIAL";
|
|
35
|
+
export declare const tableRowSerialTagName = "GZM-TABLE-ROW-SERIAL";
|
|
36
|
+
export declare const tableColActionTagName = "GZM-TABLE-COL-ACTION";
|
|
37
|
+
export declare const tableRowActionTagName = "GZM-TABLE-ROW-ACTION";
|
|
38
|
+
export declare const tableColMenuTagName = "GZM-TABLE-COL-MENU";
|
|
39
|
+
export declare const tableRowMenuTagName = "GZM-TABLE-ROW-MENU";
|
|
40
|
+
export declare const styleSheet: CSSStyleSheet;
|
|
41
|
+
export declare const texts: {
|
|
42
|
+
zh: {
|
|
43
|
+
readonly agg: "统计";
|
|
44
|
+
readonly noAgg: "无统计";
|
|
45
|
+
readonly sort: "行排序";
|
|
46
|
+
readonly noSort: "无排序";
|
|
47
|
+
readonly autoWidth: "自动宽度";
|
|
48
|
+
readonly minWidth: "最小宽度";
|
|
49
|
+
readonly maxWidth: "最大宽度";
|
|
50
|
+
readonly pxWidth: "指定宽度";
|
|
51
|
+
readonly textWrap: "文本换行";
|
|
52
|
+
readonly autoWrap: "自动换行";
|
|
53
|
+
readonly noWrap: "禁止换行";
|
|
54
|
+
readonly mustWrap: "强制换行";
|
|
55
|
+
readonly textAlign: "文本对齐";
|
|
56
|
+
readonly startAlign: "左对齐";
|
|
57
|
+
readonly endAlign: "右对齐";
|
|
58
|
+
readonly centerAlign: "居中对齐";
|
|
59
|
+
readonly justifyAlign: "两侧对齐";
|
|
60
|
+
readonly COUNT: "计数";
|
|
61
|
+
readonly MAX: "最大值";
|
|
62
|
+
readonly MIN: "最小值";
|
|
63
|
+
readonly AVG: "平均值";
|
|
64
|
+
readonly SUM: "合计";
|
|
65
|
+
readonly STDDEV_POP: "总体标准差";
|
|
66
|
+
readonly STDDEV_SAMP: "样本标准差";
|
|
67
|
+
readonly VAR_POP: "总体方差";
|
|
68
|
+
readonly VAR_SAMP: "样本方差";
|
|
69
|
+
readonly toggleCheck: "全选 / 全不选";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
export declare function getTexts($ele: TableCol | TableColGroup | TableColCheckbox): {
|
|
73
|
+
readonly agg: string;
|
|
74
|
+
readonly noAgg: string;
|
|
75
|
+
readonly sort: string;
|
|
76
|
+
readonly noSort: string;
|
|
77
|
+
readonly autoWidth: string;
|
|
78
|
+
readonly minWidth: string;
|
|
79
|
+
readonly maxWidth: string;
|
|
80
|
+
readonly pxWidth: string;
|
|
81
|
+
readonly textWrap: string;
|
|
82
|
+
readonly autoWrap: string;
|
|
83
|
+
readonly noWrap: string;
|
|
84
|
+
readonly mustWrap: string;
|
|
85
|
+
readonly textAlign: string;
|
|
86
|
+
readonly startAlign: string;
|
|
87
|
+
readonly endAlign: string;
|
|
88
|
+
readonly centerAlign: string;
|
|
89
|
+
readonly justifyAlign: string;
|
|
90
|
+
readonly COUNT: string;
|
|
91
|
+
readonly MAX: string;
|
|
92
|
+
readonly MIN: string;
|
|
93
|
+
readonly AVG: string;
|
|
94
|
+
readonly SUM: string;
|
|
95
|
+
readonly STDDEV_POP: string;
|
|
96
|
+
readonly STDDEV_SAMP: string;
|
|
97
|
+
readonly VAR_POP: string;
|
|
98
|
+
readonly VAR_SAMP: string;
|
|
99
|
+
readonly toggleCheck: string;
|
|
100
|
+
} & {
|
|
101
|
+
readonly close: string;
|
|
102
|
+
readonly true: string;
|
|
103
|
+
readonly false: string;
|
|
104
|
+
readonly undefined: string;
|
|
105
|
+
readonly default: string;
|
|
106
|
+
readonly valueMissing: string;
|
|
107
|
+
readonly count: string;
|
|
108
|
+
readonly min: string;
|
|
109
|
+
readonly max: string;
|
|
110
|
+
readonly sum: string;
|
|
111
|
+
readonly avg: string;
|
|
112
|
+
readonly hide: string;
|
|
113
|
+
readonly del: string;
|
|
114
|
+
readonly asc: string;
|
|
115
|
+
readonly desc: string;
|
|
116
|
+
readonly ok: string;
|
|
117
|
+
readonly cancel: string;
|
|
118
|
+
readonly waiting: string;
|
|
119
|
+
readonly confirming: (...args: unknown[]) => string;
|
|
120
|
+
readonly completed: string;
|
|
121
|
+
readonly error: string;
|
|
122
|
+
readonly attention: string;
|
|
123
|
+
readonly noMenuSet: string;
|
|
124
|
+
readonly readonly: string;
|
|
125
|
+
} & {
|
|
126
|
+
bindHtmlElement: <P>(this: P, $ele: HTMLElement) => P;
|
|
127
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { tableColWidthSetterTagName } from './00-base';
|
|
2
|
+
import { TableCol } from './20-col';
|
|
3
|
+
declare class TableColWidthSetter extends HTMLElement {
|
|
4
|
+
#private;
|
|
5
|
+
get $range(): HTMLInputElement;
|
|
6
|
+
show($col: TableCol): void;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
[tableColWidthSetterTagName]: TableColWidthSetter;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TableRow } from './16-row';
|
|
2
|
+
import * as TB from './00-base';
|
|
3
|
+
export declare class TableCell extends HTMLElement {
|
|
4
|
+
/**
|
|
5
|
+
* 和 table-col.key 进行匹配
|
|
6
|
+
*/
|
|
7
|
+
accessor colKey: string | undefined;
|
|
8
|
+
get $row(): TableRow | null;
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
[TB.tableCellTagName]: TableCell;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AttributeHandlers } from '@gzmjs/ui-basic';
|
|
2
|
+
import { handleModelEvent, ModelEvent, ViewModel, ViewElement } from '@gzmjs/mvvm';
|
|
3
|
+
import { Snapshot } from './35-snapshot';
|
|
4
|
+
import * as TB from './00-base';
|
|
5
|
+
export interface TableRowOptions extends ViewModel<TableRow> {
|
|
6
|
+
data: object;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
afterActiveChanged?: ($row: TableRow) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const mutableAttributes: readonly ["active"];
|
|
12
|
+
export declare class TableRow extends ViewElement<TableRowOptions> implements AttributeHandlers<typeof mutableAttributes[number]> {
|
|
13
|
+
#private;
|
|
14
|
+
readonly $start: HTMLElement;
|
|
15
|
+
readonly $middle: HTMLElement;
|
|
16
|
+
readonly $end: HTMLElement;
|
|
17
|
+
setViewProperty(p: string, v: unknown): boolean;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
[handleModelEvent](source: unknown, evt: ModelEvent): boolean;
|
|
20
|
+
refresh(ss: Snapshot, refreshCellData?: boolean): void;
|
|
21
|
+
accessor active: boolean;
|
|
22
|
+
_active_set(): void;
|
|
23
|
+
get checked(): boolean;
|
|
24
|
+
set checked(v: boolean);
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
[TB.tableRowTagName]: TableRow;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Snapshot } from './35-snapshot';
|
|
2
|
+
import * as M from '@gzmjs/mvvm';
|
|
3
|
+
import * as TB from './00-base';
|
|
4
|
+
import * as TR from './16-row';
|
|
5
|
+
interface TableRowsOptions extends M.ViewListModel<TR.TableRowOptions, TR.TableRow, TableRows> {
|
|
6
|
+
tagName?: typeof TB.tableRowsTagName;
|
|
7
|
+
}
|
|
8
|
+
export declare class TableRows extends M.ViewListElement<TR.TableRowOptions, TR.TableRow, TableRowsOptions> {
|
|
9
|
+
protected _getViewItemTagName(): string;
|
|
10
|
+
[M.handleModelEvent](source: unknown, evt: M.ModelEvent): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 根据数据源排序
|
|
13
|
+
*/
|
|
14
|
+
sortDataSource(ss: Snapshot): boolean;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
[TB.tableRowsTagName]: TableRows;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Snapshot } from './35-snapshot';
|
|
2
|
+
import * as TB from './00-base';
|
|
3
|
+
export declare class TableAggs extends HTMLElement {
|
|
4
|
+
constructor();
|
|
5
|
+
readonly $start: HTMLElement;
|
|
6
|
+
readonly $middle: HTMLElement;
|
|
7
|
+
readonly $end: HTMLElement;
|
|
8
|
+
get $grid(): HTMLElement | null;
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
refresh(ss: Snapshot): void;
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
[TB.tableAggsTagName]: TableAggs;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { MiOptions } from '@gzmjs/menu';
|
|
2
|
+
import { TableCell } from './10-cell';
|
|
3
|
+
import * as B from '@gzmjs/ui-basic';
|
|
4
|
+
import * as M from '@gzmjs/mvvm';
|
|
5
|
+
export declare const sortAsc = "\u25B2";
|
|
6
|
+
export declare const sortDesc = "\u25BC";
|
|
7
|
+
declare const tableColSort: readonly ["", "▲", "▼"];
|
|
8
|
+
export type TableColSort = typeof tableColSort[number];
|
|
9
|
+
declare const tableColAlign: readonly ["start", "end", "center", "justify"];
|
|
10
|
+
export type TableColAlign = typeof tableColAlign[number];
|
|
11
|
+
export declare const TableColAggs: readonly ["count", "min", "max", "sum", "avg"];
|
|
12
|
+
interface TableColumnBtn {
|
|
13
|
+
/**
|
|
14
|
+
* 应该是 unicode 字符,且同一列中必须唯一。
|
|
15
|
+
*/
|
|
16
|
+
icon: string;
|
|
17
|
+
title: string;
|
|
18
|
+
onclick: ($col: TableCol, $btn: HTMLElement) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface TableColOptions extends M.ViewModel<TableCol> {
|
|
21
|
+
label: string;
|
|
22
|
+
/**
|
|
23
|
+
* 分组,多级组用 / 分开
|
|
24
|
+
*/
|
|
25
|
+
group?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
width?: string;
|
|
28
|
+
sort?: TableColSort;
|
|
29
|
+
align?: TableColAlign;
|
|
30
|
+
wrap?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* boolean 类型显示的内容
|
|
33
|
+
* listSource = createBoolTextList()
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* 定义了所有允许的聚合操作,如果不为空那么需要显示下拉菜单。
|
|
37
|
+
*/
|
|
38
|
+
aggs?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* 无论是否存在 aggs,都可以设置此属性。
|
|
41
|
+
*/
|
|
42
|
+
agg?: string;
|
|
43
|
+
/**
|
|
44
|
+
* 控制是否显示默认菜单
|
|
45
|
+
*/
|
|
46
|
+
noMenu?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 列 label 之后的其他按钮
|
|
49
|
+
*/
|
|
50
|
+
btns?: TableColumnBtn[];
|
|
51
|
+
/**
|
|
52
|
+
* 需要显示的字段
|
|
53
|
+
*/
|
|
54
|
+
valueMember: M.ObjMember | string | string[];
|
|
55
|
+
listSource?: M.ListSource<object>;
|
|
56
|
+
/**
|
|
57
|
+
* 对单元格内容的干涉,$cell 中已经有了内容
|
|
58
|
+
*/
|
|
59
|
+
setCellContent?: (ctx: {
|
|
60
|
+
$cell: TableCell;
|
|
61
|
+
$col: TableCol;
|
|
62
|
+
dataItem: object;
|
|
63
|
+
dataValue: M.ObjValue;
|
|
64
|
+
}) => void;
|
|
65
|
+
/**
|
|
66
|
+
* 列菜单显示之前,可以修改菜单项
|
|
67
|
+
*/
|
|
68
|
+
beforeMenuShow?: (mis: MiOptions[], vm: TableColOptions) => void;
|
|
69
|
+
}
|
|
70
|
+
export declare function createBoolTextList(trueText: string, falseText: string): M.ListSource<{
|
|
71
|
+
v: boolean;
|
|
72
|
+
d: string;
|
|
73
|
+
}>;
|
|
74
|
+
declare const mutableAttributes: readonly ["key", "label", "width", "hidden", "sort", "agg", "align"];
|
|
75
|
+
export declare class TableCol extends M.ViewElement<TableColOptions> implements B.AttributeHandlers<typeof mutableAttributes[number]> {
|
|
76
|
+
#private;
|
|
77
|
+
get $lbl(): HTMLElement;
|
|
78
|
+
/**
|
|
79
|
+
* $lbl 之后允许有多个按钮,最后两个是 agg 按钮和 menu 按钮,但有可能不生成。
|
|
80
|
+
* btns 按钮在 $lbl 和 agg 按钮之间
|
|
81
|
+
*/
|
|
82
|
+
set btns(v: TableColumnBtn[]);
|
|
83
|
+
$btns?: HTMLElement[];
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
disconnectedCallback(): void;
|
|
86
|
+
get visible(): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* 如果没有任何 group,那么每一列都应该调用 setRow(1)
|
|
89
|
+
*/
|
|
90
|
+
setRow(start: number): void;
|
|
91
|
+
get valueMember(): M.ObjMember | undefined;
|
|
92
|
+
set valueMember(v: M.ObjMember | string | string[]);
|
|
93
|
+
set listSource(_: unknown);
|
|
94
|
+
createCell(dataItem: object): TableCell;
|
|
95
|
+
_setCellData($cell: TableCell, dataItem?: object): void;
|
|
96
|
+
accessor key: string | undefined;
|
|
97
|
+
_key_set(): void;
|
|
98
|
+
accessor label: string | undefined;
|
|
99
|
+
_label_set(nv: string | null): void;
|
|
100
|
+
accessor width: string;
|
|
101
|
+
_width_set(): void;
|
|
102
|
+
accessor sort: TableColSort;
|
|
103
|
+
_sort_set(): void;
|
|
104
|
+
get isAscSort(): boolean;
|
|
105
|
+
accessor align: TableColAlign;
|
|
106
|
+
_align_set(nv: string | null): void;
|
|
107
|
+
get wrap(): boolean | undefined;
|
|
108
|
+
set wrap(v: boolean | undefined);
|
|
109
|
+
_wrap_set(nv: boolean | undefined): void;
|
|
110
|
+
accessor agg: string | undefined;
|
|
111
|
+
_agg_set(): void;
|
|
112
|
+
_hidden_set(): void;
|
|
113
|
+
/**
|
|
114
|
+
* 这个元素由列生成,但是不会作为列的子元素
|
|
115
|
+
*/
|
|
116
|
+
get $agg(): HTMLElement;
|
|
117
|
+
set aggValue(v: M.ObjValue);
|
|
118
|
+
$aggBtn?: HTMLElement;
|
|
119
|
+
/**
|
|
120
|
+
* model.aggs 中的属性设置,无需保存在成员中。只是检查按钮是否存在。
|
|
121
|
+
*/
|
|
122
|
+
set aggs(v: string[] | undefined);
|
|
123
|
+
get $menuBtn(): HTMLElement;
|
|
124
|
+
get noMenu(): boolean;
|
|
125
|
+
set noMenu(b: boolean);
|
|
126
|
+
handleClick(e: MouseEvent): void;
|
|
127
|
+
get T(): {
|
|
128
|
+
readonly agg: string;
|
|
129
|
+
readonly noAgg: string;
|
|
130
|
+
readonly sort: string;
|
|
131
|
+
readonly noSort: string;
|
|
132
|
+
readonly autoWidth: string;
|
|
133
|
+
readonly minWidth: string;
|
|
134
|
+
readonly maxWidth: string;
|
|
135
|
+
readonly pxWidth: string;
|
|
136
|
+
readonly textWrap: string;
|
|
137
|
+
readonly autoWrap: string;
|
|
138
|
+
readonly noWrap: string;
|
|
139
|
+
readonly mustWrap: string;
|
|
140
|
+
readonly textAlign: string;
|
|
141
|
+
readonly startAlign: string;
|
|
142
|
+
readonly endAlign: string;
|
|
143
|
+
readonly centerAlign: string;
|
|
144
|
+
readonly justifyAlign: string;
|
|
145
|
+
readonly COUNT: string;
|
|
146
|
+
readonly MAX: string;
|
|
147
|
+
readonly MIN: string;
|
|
148
|
+
readonly AVG: string;
|
|
149
|
+
readonly SUM: string;
|
|
150
|
+
readonly STDDEV_POP: string;
|
|
151
|
+
readonly STDDEV_SAMP: string;
|
|
152
|
+
readonly VAR_POP: string;
|
|
153
|
+
readonly VAR_SAMP: string;
|
|
154
|
+
readonly toggleCheck: string;
|
|
155
|
+
} & {
|
|
156
|
+
readonly close: string;
|
|
157
|
+
readonly true: string;
|
|
158
|
+
readonly false: string;
|
|
159
|
+
readonly undefined: string;
|
|
160
|
+
readonly default: string;
|
|
161
|
+
readonly valueMissing: string;
|
|
162
|
+
readonly count: string;
|
|
163
|
+
readonly min: string;
|
|
164
|
+
readonly max: string;
|
|
165
|
+
readonly sum: string;
|
|
166
|
+
readonly avg: string;
|
|
167
|
+
readonly hide: string;
|
|
168
|
+
readonly del: string;
|
|
169
|
+
readonly asc: string;
|
|
170
|
+
readonly desc: string;
|
|
171
|
+
readonly ok: string;
|
|
172
|
+
readonly cancel: string;
|
|
173
|
+
readonly waiting: string;
|
|
174
|
+
readonly confirming: (...args: unknown[]) => string;
|
|
175
|
+
readonly completed: string;
|
|
176
|
+
readonly error: string;
|
|
177
|
+
readonly attention: string;
|
|
178
|
+
readonly noMenuSet: string;
|
|
179
|
+
readonly readonly: string;
|
|
180
|
+
} & {
|
|
181
|
+
bindHtmlElement: <P>(this: P, $ele: HTMLElement) => P;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export interface NoticeOfCol {
|
|
185
|
+
colAdd?: boolean;
|
|
186
|
+
colDel?: boolean;
|
|
187
|
+
colWidth?: boolean;
|
|
188
|
+
colSort?: boolean;
|
|
189
|
+
colAgg?: boolean;
|
|
190
|
+
colHide?: boolean;
|
|
191
|
+
colRefresh?: boolean;
|
|
192
|
+
$col: TableCol;
|
|
193
|
+
}
|
|
194
|
+
export interface ColNoticeReceiver {
|
|
195
|
+
notify: (msg: NoticeOfCol) => void;
|
|
196
|
+
}
|
|
197
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { TableCol, ColNoticeReceiver, NoticeOfCol } from './20-col';
|
|
2
|
+
import * as B from '@gzmjs/ui-basic';
|
|
3
|
+
import * as TB from './00-base';
|
|
4
|
+
declare const mutableAttributes: readonly ["hidden"];
|
|
5
|
+
export declare class TableColGroup extends HTMLElement implements ColNoticeReceiver, B.AttributeHandlers<typeof mutableAttributes[number]> {
|
|
6
|
+
#private;
|
|
7
|
+
constructor();
|
|
8
|
+
readonly $div: HTMLDivElement;
|
|
9
|
+
readonly $lbl: HTMLElement;
|
|
10
|
+
readonly $menu: HTMLElement;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {Number} start
|
|
14
|
+
* @returns 所有下级可见列的数量
|
|
15
|
+
*/
|
|
16
|
+
setRow(start: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* 只属于这个 group 的列
|
|
19
|
+
*/
|
|
20
|
+
get $columns(): TableCol[];
|
|
21
|
+
/**
|
|
22
|
+
* 只属于这个 group 的下级 group
|
|
23
|
+
*/
|
|
24
|
+
get $groups(): TableColGroup[];
|
|
25
|
+
/**
|
|
26
|
+
* 当前列组是否显示
|
|
27
|
+
*/
|
|
28
|
+
get visible(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* 当直属于 table-cols,返回 1。
|
|
31
|
+
* grid-row-start 的值也是从 1 开始。
|
|
32
|
+
*/
|
|
33
|
+
get tier(): number;
|
|
34
|
+
connectedCallback(): void;
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
notify(n: NoticeOfColGroup | NoticeOfCol): void;
|
|
37
|
+
get label(): string;
|
|
38
|
+
set label(v: string);
|
|
39
|
+
_hidden_set(): void;
|
|
40
|
+
handleClick(e: MouseEvent): void;
|
|
41
|
+
get T(): {
|
|
42
|
+
readonly agg: string;
|
|
43
|
+
readonly noAgg: string;
|
|
44
|
+
readonly sort: string;
|
|
45
|
+
readonly noSort: string;
|
|
46
|
+
readonly autoWidth: string;
|
|
47
|
+
readonly minWidth: string;
|
|
48
|
+
readonly maxWidth: string;
|
|
49
|
+
readonly pxWidth: string;
|
|
50
|
+
readonly textWrap: string;
|
|
51
|
+
readonly autoWrap: string;
|
|
52
|
+
readonly noWrap: string;
|
|
53
|
+
readonly mustWrap: string;
|
|
54
|
+
readonly textAlign: string;
|
|
55
|
+
readonly startAlign: string;
|
|
56
|
+
readonly endAlign: string;
|
|
57
|
+
readonly centerAlign: string;
|
|
58
|
+
readonly justifyAlign: string;
|
|
59
|
+
readonly COUNT: string;
|
|
60
|
+
readonly MAX: string;
|
|
61
|
+
readonly MIN: string;
|
|
62
|
+
readonly AVG: string;
|
|
63
|
+
readonly SUM: string;
|
|
64
|
+
readonly STDDEV_POP: string;
|
|
65
|
+
readonly STDDEV_SAMP: string;
|
|
66
|
+
readonly VAR_POP: string;
|
|
67
|
+
readonly VAR_SAMP: string;
|
|
68
|
+
readonly toggleCheck: string;
|
|
69
|
+
} & {
|
|
70
|
+
readonly close: string;
|
|
71
|
+
readonly true: string;
|
|
72
|
+
readonly false: string;
|
|
73
|
+
readonly undefined: string;
|
|
74
|
+
readonly default: string;
|
|
75
|
+
readonly valueMissing: string;
|
|
76
|
+
readonly count: string;
|
|
77
|
+
readonly min: string;
|
|
78
|
+
readonly max: string;
|
|
79
|
+
readonly sum: string;
|
|
80
|
+
readonly avg: string;
|
|
81
|
+
readonly hide: string;
|
|
82
|
+
readonly del: string;
|
|
83
|
+
readonly asc: string;
|
|
84
|
+
readonly desc: string;
|
|
85
|
+
readonly ok: string;
|
|
86
|
+
readonly cancel: string;
|
|
87
|
+
readonly waiting: string;
|
|
88
|
+
readonly confirming: (...args: unknown[]) => string;
|
|
89
|
+
readonly completed: string;
|
|
90
|
+
readonly error: string;
|
|
91
|
+
readonly attention: string;
|
|
92
|
+
readonly noMenuSet: string;
|
|
93
|
+
readonly readonly: string;
|
|
94
|
+
} & {
|
|
95
|
+
bindHtmlElement: <P>(this: P, $ele: HTMLElement) => P;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
declare global {
|
|
99
|
+
interface HTMLElementTagNameMap {
|
|
100
|
+
[TB.tableColGroupTagName]: TableColGroup;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export interface NoticeOfColGroup {
|
|
104
|
+
groupAdd?: boolean;
|
|
105
|
+
groupDel?: boolean;
|
|
106
|
+
groupHide?: boolean;
|
|
107
|
+
$group: TableColGroup;
|
|
108
|
+
}
|
|
109
|
+
export interface ColGroupNoticeReceiver extends HTMLElement {
|
|
110
|
+
notify: (msg: NoticeOfColGroup | NoticeOfCol) => void;
|
|
111
|
+
}
|
|
112
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as M from '@gzmjs/mvvm';
|
|
2
|
+
import * as TB from './00-base';
|
|
3
|
+
import * as TC from './20-col';
|
|
4
|
+
import * as TG from './22-colgroup';
|
|
5
|
+
interface TcsOptions extends M.ViewListModel<TC.TableColOptions, TC.TableCol, TableCols> {
|
|
6
|
+
tagName?: typeof TB.tableColsTagName;
|
|
7
|
+
}
|
|
8
|
+
export declare class TableCols extends M.ViewGroupElement<TC.TableColOptions, TC.TableCol, TcsOptions> implements TG.ColGroupNoticeReceiver {
|
|
9
|
+
#private;
|
|
10
|
+
[M.handleModelEvent](source: unknown, evt: M.ModelEvent): boolean;
|
|
11
|
+
protected _getViewItemTagName(): string;
|
|
12
|
+
protected readonly groupElementTagName: string;
|
|
13
|
+
/**
|
|
14
|
+
* 同时还实现了生成 group 元素的功能
|
|
15
|
+
* 无需重写 _createGroupElement 和 _putGroupElement
|
|
16
|
+
*/
|
|
17
|
+
protected _tryGetGroupElement(vm: TC.TableColOptions): HTMLElement | null;
|
|
18
|
+
notify(n: TC.NoticeOfCol | TG.NoticeOfColGroup): void;
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
[TB.tableColsTagName]: TableCols;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TableList } from './60-list';
|
|
2
|
+
import { TableRow } from './16-row';
|
|
3
|
+
import { TableCol } from './20-col';
|
|
4
|
+
import { TableColGroup } from './22-colgroup';
|
|
5
|
+
import { TableColHeadOrTail } from './46-tht-options';
|
|
6
|
+
export declare class Snapshot {
|
|
7
|
+
#private;
|
|
8
|
+
constructor($t: TableList);
|
|
9
|
+
$t: TableList;
|
|
10
|
+
get $startColumns(): TableCol[];
|
|
11
|
+
get $startColumnsVisible(): TableCol[];
|
|
12
|
+
get $middleColumns(): TableCol[];
|
|
13
|
+
get $middleColumnsVisible(): TableCol[];
|
|
14
|
+
get $endColumns(): TableCol[];
|
|
15
|
+
get $endColumnsVisible(): TableCol[];
|
|
16
|
+
get $columns(): TableCol[];
|
|
17
|
+
get $columnsVisible(): TableCol[];
|
|
18
|
+
get $columnsNeedAgg(): TableCol[];
|
|
19
|
+
get $columnsWantSort(): TableCol[];
|
|
20
|
+
get $columnHeads(): TableColHeadOrTail[];
|
|
21
|
+
get $columnHeadsVisible(): TableColHeadOrTail[];
|
|
22
|
+
get $columnTails(): TableColHeadOrTail[];
|
|
23
|
+
get $columnTailsVisible(): TableColHeadOrTail[];
|
|
24
|
+
get $rows(): TableRow[];
|
|
25
|
+
get $rowsActive(): TableRow[];
|
|
26
|
+
/**
|
|
27
|
+
* 顶层 column 和 group
|
|
28
|
+
*/
|
|
29
|
+
get $visibleTopColumnsAndGroups(): (TableCol | TableColGroup)[];
|
|
30
|
+
/**
|
|
31
|
+
* 所有可见列所属的 group 的最大 level
|
|
32
|
+
*/
|
|
33
|
+
get groupsMaxTier(): number;
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { TableColCheckOptions } from './51-check';
|
|
2
|
+
import { TableColSerialNoOptions } from './52-serial';
|
|
3
|
+
import { TableColActionOptions } from './53-action';
|
|
4
|
+
import { TableColMenuOptions } from './54-menu';
|
|
5
|
+
import { TableRow } from './16-row';
|
|
6
|
+
export type ThtOptions = TableColCheckOptions | TableColSerialNoOptions | TableColActionOptions | TableColMenuOptions;
|
|
7
|
+
export interface NoticeOfHead {
|
|
8
|
+
headHide?: boolean;
|
|
9
|
+
headAdd?: boolean;
|
|
10
|
+
headDel?: boolean;
|
|
11
|
+
$head: TableColHeadOrTail;
|
|
12
|
+
}
|
|
13
|
+
export interface NoticeOfTail {
|
|
14
|
+
tailHide?: boolean;
|
|
15
|
+
tailAdd?: boolean;
|
|
16
|
+
tailDel?: boolean;
|
|
17
|
+
$tail: TableColHeadOrTail;
|
|
18
|
+
}
|
|
19
|
+
export interface TableHeadTailNoticeReceiver {
|
|
20
|
+
notify: (msg: NoticeOfHead | NoticeOfTail) => void;
|
|
21
|
+
}
|
|
22
|
+
export interface TableHeadTailBridge {
|
|
23
|
+
notifyHide: ($child: TableColHeadOrTail) => void;
|
|
24
|
+
notifyConnected: ($child: TableColHeadOrTail) => void;
|
|
25
|
+
notifyDisconnected: ($child: TableColHeadOrTail) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface TableColHeadOrTail extends HTMLElement {
|
|
28
|
+
readonly $agg: HTMLElement;
|
|
29
|
+
readonly width: string;
|
|
30
|
+
readonly dataAware: boolean;
|
|
31
|
+
readonly visible: boolean;
|
|
32
|
+
readonly rowTagName: string;
|
|
33
|
+
createInRow(): HTMLElement;
|
|
34
|
+
refresh($row: TableRow, $headOrTail: HTMLElement | null): void;
|
|
35
|
+
findInRow<InRow extends HTMLElement>($row: TableRow): InRow | null;
|
|
36
|
+
getAllInRow<InRow extends HTMLElement>(): InRow[];
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as M from '@gzmjs/mvvm';
|
|
2
|
+
import * as TR from './16-row';
|
|
3
|
+
import * as THT from './46-tht-options';
|
|
4
|
+
/**
|
|
5
|
+
* 这是一个基类
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class TableColHeadTailBase<T extends M.ViewModel<M.ViewElement<T>>> extends M.ViewElement<T> implements THT.TableColHeadOrTail {
|
|
8
|
+
#private;
|
|
9
|
+
protected _createUI(): void;
|
|
10
|
+
get $agg(): HTMLElement;
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
$p?: HTMLElement & THT.TableHeadTailBridge;
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
protected _clear(): void;
|
|
15
|
+
get width(): string;
|
|
16
|
+
get visible(): boolean;
|
|
17
|
+
get dataAware(): boolean;
|
|
18
|
+
_hidden_set(): void;
|
|
19
|
+
createInRow(): HTMLElement;
|
|
20
|
+
/**
|
|
21
|
+
* dataAware = true 时会被调用,由子类重写。
|
|
22
|
+
*/
|
|
23
|
+
refresh($row: TR.TableRow, $headOrTail: HTMLElement | null): void;
|
|
24
|
+
findInRow<InRow extends HTMLElement>($row: TR.TableRow): InRow | null;
|
|
25
|
+
getAllInRow<InRow extends HTMLElement>(): InRow[];
|
|
26
|
+
abstract get rowTagName(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TableColHeadTailBase } from './47-head-tail';
|
|
2
|
+
import * as M from '@gzmjs/mvvm';
|
|
3
|
+
import * as TB from './00-base';
|
|
4
|
+
import * as THT from './46-tht-options';
|
|
5
|
+
export interface TableColHeadOptions extends M.ViewListModel<THT.ThtOptions, TableColHeadTailBase<THT.ThtOptions>, TableColHead> {
|
|
6
|
+
tagName?: typeof TB.tableColHeadTagName;
|
|
7
|
+
}
|
|
8
|
+
export declare class TableColHead extends M.ViewListElement<THT.ThtOptions, TableColHeadTailBase<THT.ThtOptions>, TableColHeadOptions> implements THT.TableHeadTailBridge {
|
|
9
|
+
[M.handleModelEvent](source: unknown, evt: M.ModelEvent): boolean;
|
|
10
|
+
protected _getViewItemTagName(options: THT.ThtOptions): string;
|
|
11
|
+
get $list(): Element & THT.TableHeadTailNoticeReceiver | null;
|
|
12
|
+
notifyHide($child: THT.TableColHeadOrTail): void;
|
|
13
|
+
notifyConnected($child: THT.TableColHeadOrTail): void;
|
|
14
|
+
notifyDisconnected($child: THT.TableColHeadOrTail): void;
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
[TB.tableColHeadTagName]: TableColHead;
|
|
19
|
+
}
|
|
20
|
+
}
|