@mezzanine-ui/core 0.8.1 → 0.9.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/package.json +1 -1
- package/table/_table-styles.scss +12 -0
- package/table/index.js +1 -1
- package/table/table.d.ts +13 -2
- package/table/table.js +31 -2
package/package.json
CHANGED
package/table/_table-styles.scss
CHANGED
|
@@ -103,6 +103,18 @@ $table-refresh-vertical-padding: 8px !default;
|
|
|
103
103
|
&__cellWrapper {
|
|
104
104
|
@include flexible;
|
|
105
105
|
}
|
|
106
|
+
|
|
107
|
+
&__expandedTableWrapper {
|
|
108
|
+
padding: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&__expandedTableRow {
|
|
112
|
+
background-color: palette.color(divider);
|
|
113
|
+
|
|
114
|
+
&:last-child {
|
|
115
|
+
border-bottom: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
&__empty {
|
package/table/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix } from './table.js';
|
|
1
|
+
export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix } from './table.js';
|
package/table/table.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export declare const tableClasses: {
|
|
|
12
12
|
readonly bodyRow: `${string}__row`;
|
|
13
13
|
readonly bodyRowHighlight: `${string}__row--highlight`;
|
|
14
14
|
readonly bodyRowCellWrapper: `${string}__row__cellWrapper`;
|
|
15
|
+
readonly bodyRowExpandedTableWrapper: `${string}__row__expandedTableWrapper`;
|
|
16
|
+
readonly bodyRowExpandedTable: `${string}__row__expandedTable`;
|
|
17
|
+
readonly bodyRowExpandedTableRow: `${string}__row__expandedTableRow`;
|
|
15
18
|
readonly cell: string;
|
|
16
19
|
readonly cellEllipsis: `${string}__ellipsis`;
|
|
17
20
|
readonly selections: "mzn-table__selections";
|
|
@@ -42,7 +45,7 @@ export declare type TableColumn<SourceType> = {
|
|
|
42
45
|
headerClassName?: string;
|
|
43
46
|
width?: number;
|
|
44
47
|
sorter?(a: any, b: any): number;
|
|
45
|
-
onSorted?(
|
|
48
|
+
onSorted?(dataIndex: string, sortedType: string): void;
|
|
46
49
|
editable?: boolean;
|
|
47
50
|
setCellProps?(record: SourceType): TableRecord<unknown>;
|
|
48
51
|
/** @default true */
|
|
@@ -50,6 +53,7 @@ export declare type TableColumn<SourceType> = {
|
|
|
50
53
|
/** force display tooltip whenever content is hovered */
|
|
51
54
|
forceShownTooltipWhenHovered?: boolean;
|
|
52
55
|
};
|
|
56
|
+
export declare type ExpandedTableColumn = Omit<TableColumn<TableRecord<unknown>>, 'title' | 'renderTitle' | 'align' | 'headerClassName' | 'width' | 'sorter' | 'onSorted' | 'editable' | 'setCellProps'>;
|
|
53
57
|
export declare type TableFetchMore = {
|
|
54
58
|
callback?(): any;
|
|
55
59
|
isReachEnd?: boolean;
|
|
@@ -70,8 +74,12 @@ export interface TableRowSelection {
|
|
|
70
74
|
/** === Feature Expandable */
|
|
71
75
|
export interface TableExpandable<SourceType> {
|
|
72
76
|
className?: string;
|
|
73
|
-
expandedRowRender(record: SourceType):
|
|
77
|
+
expandedRowRender(record: SourceType): string | {
|
|
78
|
+
dataSource: TableDataSource[];
|
|
79
|
+
columns?: ExpandedTableColumn[];
|
|
80
|
+
};
|
|
74
81
|
rowExpandable?(record: SourceType): boolean;
|
|
82
|
+
onExpand?(record: SourceType, status: boolean): void;
|
|
75
83
|
}
|
|
76
84
|
/** === Feature Pagination */
|
|
77
85
|
export interface TablePagination {
|
|
@@ -101,3 +109,6 @@ export interface TableComponents {
|
|
|
101
109
|
cell?: any;
|
|
102
110
|
};
|
|
103
111
|
}
|
|
112
|
+
/** styling */
|
|
113
|
+
export declare function getColumnStyle(column: TableColumn<TableRecord<unknown>>): {};
|
|
114
|
+
export declare function getCellStyle(column: TableColumn<TableRecord<unknown>>): {};
|
package/table/table.js
CHANGED
|
@@ -12,6 +12,9 @@ const tableClasses = {
|
|
|
12
12
|
bodyRow: `${tableBodyPrefix}__row`,
|
|
13
13
|
bodyRowHighlight: `${tableBodyPrefix}__row--highlight`,
|
|
14
14
|
bodyRowCellWrapper: `${tableBodyPrefix}__row__cellWrapper`,
|
|
15
|
+
bodyRowExpandedTableWrapper: `${tableBodyPrefix}__row__expandedTableWrapper`,
|
|
16
|
+
bodyRowExpandedTable: `${tableBodyPrefix}__row__expandedTable`,
|
|
17
|
+
bodyRowExpandedTableRow: `${tableBodyPrefix}__row__expandedTableRow`,
|
|
15
18
|
cell: tableCellPrefix,
|
|
16
19
|
cellEllipsis: `${tableCellPrefix}__ellipsis`,
|
|
17
20
|
selections: `${tablePrefix}__selections`,
|
|
@@ -22,6 +25,32 @@ const tableClasses = {
|
|
|
22
25
|
paginationIndicator: `${tablePrefix}__pagination__indicator`,
|
|
23
26
|
paginationActions: `${tablePrefix}__pagination__actions`,
|
|
24
27
|
refresh: `${tablePrefix}__refresh`,
|
|
25
|
-
};
|
|
28
|
+
};
|
|
29
|
+
/** styling */
|
|
30
|
+
function getColumnStyle(column) {
|
|
31
|
+
if (!column)
|
|
32
|
+
return {};
|
|
33
|
+
let style = {};
|
|
34
|
+
if (column.width) {
|
|
35
|
+
style = {
|
|
36
|
+
...style,
|
|
37
|
+
width: column.width,
|
|
38
|
+
maxWidth: column.width,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return style;
|
|
42
|
+
}
|
|
43
|
+
function getCellStyle(column) {
|
|
44
|
+
if (!column)
|
|
45
|
+
return {};
|
|
46
|
+
let style = {};
|
|
47
|
+
if (column.align) {
|
|
48
|
+
style = {
|
|
49
|
+
...style,
|
|
50
|
+
justifyContent: column.align === 'center' ? column.align : `flex-${column.align}`,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return style;
|
|
54
|
+
}
|
|
26
55
|
|
|
27
|
-
export { tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix };
|
|
56
|
+
export { getCellStyle, getColumnStyle, tableBodyPrefix, tableCellPrefix, tableClasses, tableHeaderPrefix, tablePrefix };
|