@dmlibs/dm-cmps 0.1.0 → 0.1.1
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/fesm2022/dmlibs-dm-cmps.mjs +88 -14
- package/fesm2022/dmlibs-dm-cmps.mjs.map +1 -1
- package/package.json +1 -1
- package/types/dmlibs-dm-cmps.d.ts +229 -12
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import { FormControl } from '@angular/forms';
|
|
|
5
5
|
import { MatOptionSelectionChange } from '@angular/material/core';
|
|
6
6
|
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
7
7
|
import { TooltipPosition } from '@angular/material/tooltip';
|
|
8
|
+
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
|
|
8
9
|
import { MatMenuTrigger } from '@angular/material/menu';
|
|
9
10
|
import { CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
10
11
|
|
|
@@ -734,7 +735,7 @@ interface DmCellContext<T extends object> {
|
|
|
734
735
|
row: T;
|
|
735
736
|
column: DmTableColumn<T>;
|
|
736
737
|
}
|
|
737
|
-
type DmTableColumnType = 'date' | 'component' | 'tel' | 'mail' | 'link' | 'whatsapp' | 'customHtml' | 'actions' | 'input';
|
|
738
|
+
type DmTableColumnType = 'date' | 'component' | 'tel' | 'mail' | 'link' | 'whatsapp' | 'customHtml' | 'actions' | 'slideToggle' | 'input';
|
|
738
739
|
type DmTableInputColumnType = 'text' | 'number' | 'select' | 'checkbox';
|
|
739
740
|
interface DmTableInputCellSelectOption {
|
|
740
741
|
label: string;
|
|
@@ -808,6 +809,8 @@ interface DmTableColumnBase<T extends object> {
|
|
|
808
809
|
});
|
|
809
810
|
headerMenuItems?: DmTableColumnHeaderMenuItem<T>[];
|
|
810
811
|
headerMenuTooltip?: string;
|
|
812
|
+
slideToggleTooltip?: string | ((row: T) => string);
|
|
813
|
+
onSlideToggleChange?: (row: T, change: MatSlideToggleChange) => void;
|
|
811
814
|
}
|
|
812
815
|
type DmTableIndexColumn<T extends object> = {
|
|
813
816
|
type: '$index' | 'actions';
|
|
@@ -977,12 +980,11 @@ interface DmTableStyle {
|
|
|
977
980
|
};
|
|
978
981
|
};
|
|
979
982
|
scrollbar?: {
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
};
|
|
983
|
+
width?: string;
|
|
984
|
+
color?: string;
|
|
985
|
+
hoverColor?: string;
|
|
986
|
+
backgroundColor?: string;
|
|
987
|
+
borderRadius?: string;
|
|
986
988
|
};
|
|
987
989
|
}
|
|
988
990
|
interface DmTableClasses {
|
|
@@ -1014,11 +1016,222 @@ interface DmTableClasses {
|
|
|
1014
1016
|
button?: DmTableNgClass;
|
|
1015
1017
|
};
|
|
1016
1018
|
}
|
|
1019
|
+
interface DmTableInterface<T extends object> {
|
|
1020
|
+
/**
|
|
1021
|
+
* Table id - An unique identifier for the table, used to store the table state in the localStorage.
|
|
1022
|
+
* @default undefined
|
|
1023
|
+
*/
|
|
1024
|
+
tableId: InputSignal<string | undefined>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Table data source - An array of objects that will be displayed in the table.
|
|
1027
|
+
*/
|
|
1028
|
+
dataSource: InputSignal<T[]>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Table columns - An array of objects that define the columns of the table.
|
|
1031
|
+
*/
|
|
1032
|
+
columns: InputSignal<DmTableColumn<T>[]>;
|
|
1033
|
+
/**
|
|
1034
|
+
* No data message - The message to display when the table is empty.
|
|
1035
|
+
* @default 'אין נתונים להצגה'
|
|
1036
|
+
*/
|
|
1037
|
+
noDataMessage: InputSignal<string>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Enable search - Whether to enable search functionality.
|
|
1040
|
+
* @default false
|
|
1041
|
+
*/
|
|
1042
|
+
enableSearch: InputSignalWithTransform<boolean, unknown>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Search placeholder - The placeholder text to display in the search input.
|
|
1045
|
+
* @default 'חיפוש...'
|
|
1046
|
+
*/
|
|
1047
|
+
searchPlaceholder: InputSignal<string>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Clear search tooltip - The tooltip text to display when hovering over the clear search button.
|
|
1050
|
+
* @default 'נקה חיפוש'
|
|
1051
|
+
*/
|
|
1052
|
+
clearSearchTooltip: InputSignal<string>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Search input appearance - The appearance of the search input.
|
|
1055
|
+
* @default 'fill'
|
|
1056
|
+
*/
|
|
1057
|
+
searchInputAppearance: InputSignal<'fill' | 'outline'>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Filter predicate - A function that defines how to filter the table data.
|
|
1060
|
+
* when undefined, the default filter predicate will be used.
|
|
1061
|
+
* @default null
|
|
1062
|
+
*/
|
|
1063
|
+
filterPredicate: InputSignal<((row: T, filterText: string) => boolean) | null>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Action buttons - An array of objects that define the action buttons of the table.
|
|
1066
|
+
* - will be displayed on the left side above the table.
|
|
1067
|
+
* @default []
|
|
1068
|
+
*/
|
|
1069
|
+
actionButtons: InputSignal<DmTableActionButton<T>[]>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Enable pagination - Whether to enable pagination functionality.
|
|
1072
|
+
* @default false
|
|
1073
|
+
*/
|
|
1074
|
+
enablePagination: InputSignalWithTransform<boolean, unknown>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Auto pagination above rows count - The number of rows above which pagination will be enabled automatically.
|
|
1077
|
+
* @default 100
|
|
1078
|
+
*/
|
|
1079
|
+
autoPaginationAboveRowsCount: InputSignalWithTransform<number, unknown>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Paginator settings - An object that defines the paginator settings of the table.
|
|
1082
|
+
* @default null
|
|
1083
|
+
*/
|
|
1084
|
+
paginatorSettings: InputSignal<DmTablePaginatorSettings>;
|
|
1085
|
+
/**
|
|
1086
|
+
* Enable loading progressbar - whether to enable loading progressbar.
|
|
1087
|
+
* @default true
|
|
1088
|
+
*/
|
|
1089
|
+
enableLoadingProgressbar: InputSignalWithTransform<boolean, unknown>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Enable columns drag and drop - whether to enable columns drag and drop, to change columns order.
|
|
1092
|
+
* @default false
|
|
1093
|
+
*/
|
|
1094
|
+
enableColumnsDragAndDrop: InputSignalWithTransform<boolean, unknown>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Enable columns drag handle - if true, a drag handle will be displayed on the left side of the column header.
|
|
1097
|
+
* @default false
|
|
1098
|
+
*/
|
|
1099
|
+
enableColumnsDragHandle: InputSignalWithTransform<boolean, unknown>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Enable total row - whether to enable total row.
|
|
1102
|
+
* @default false
|
|
1103
|
+
*/
|
|
1104
|
+
enableTotalRow: InputSignalWithTransform<boolean, unknown>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Table style - An object that defines the style of the table.
|
|
1107
|
+
* ```
|
|
1108
|
+
* @default {
|
|
1109
|
+
tableWrapper: {
|
|
1110
|
+
'max-height': '800px',
|
|
1111
|
+
|
|
1112
|
+
width: 'calc(100% - 10px)',
|
|
1113
|
+
display: 'block',
|
|
1114
|
+
'overflow-x': 'auto',
|
|
1115
|
+
padding: '0 5px',
|
|
1116
|
+
},
|
|
1117
|
+
table: {
|
|
1118
|
+
root: {
|
|
1119
|
+
width: '100%',
|
|
1120
|
+
'border-collapse': 'collapse',
|
|
1121
|
+
'border-spacing': 0,
|
|
1122
|
+
'box-shadow': '0px 5px 5px -3px #003, 0 8px 10px 1px #00000024, 0 3px 14px 2px #0000001f',
|
|
1123
|
+
padding: 0,
|
|
1124
|
+
'font-size': '1rem',
|
|
1125
|
+
'border-radius': '8px',
|
|
1126
|
+
'page-break-inside': 'auto',
|
|
1127
|
+
},
|
|
1128
|
+
thead: {
|
|
1129
|
+
root: {
|
|
1130
|
+
'background-color': '#f5f5f5',
|
|
1131
|
+
},
|
|
1132
|
+
th: {
|
|
1133
|
+
padding: '20px 15px',
|
|
1134
|
+
'text-align': 'start',
|
|
1135
|
+
'max-width': 'none',
|
|
1136
|
+
},
|
|
1137
|
+
},
|
|
1138
|
+
tbody: {
|
|
1139
|
+
hovered_row_style: {
|
|
1140
|
+
tr: {
|
|
1141
|
+
'background-color': '#f5f5f5',
|
|
1142
|
+
},
|
|
1143
|
+
},
|
|
1144
|
+
even_row_style: {
|
|
1145
|
+
tr: {
|
|
1146
|
+
'background-color': '#ffffff',
|
|
1147
|
+
},
|
|
1148
|
+
},
|
|
1149
|
+
odd_row_style: {
|
|
1150
|
+
tr: {
|
|
1151
|
+
'background-color': '#fafafa',
|
|
1152
|
+
},
|
|
1153
|
+
},
|
|
1154
|
+
tr: {
|
|
1155
|
+
'border-bottom': '1px solid #e0e0e0',
|
|
1156
|
+
'page-break-inside': 'avoid',
|
|
1157
|
+
},
|
|
1158
|
+
td: {
|
|
1159
|
+
padding: '7px 15px',
|
|
1160
|
+
'text-align': 'start',
|
|
1161
|
+
'max-width': 'none',
|
|
1162
|
+
'text-overflow': 'ellipsis',
|
|
1163
|
+
overflow: 'hidden',
|
|
1164
|
+
'white-space': 'nowrap',
|
|
1165
|
+
},
|
|
1166
|
+
input: {
|
|
1167
|
+
background: 'white',
|
|
1168
|
+
border: '1px solid',
|
|
1169
|
+
'border-radius': '3px',
|
|
1170
|
+
},
|
|
1171
|
+
},
|
|
1172
|
+
tfoot: {
|
|
1173
|
+
root: {
|
|
1174
|
+
'background-color': '#f5f5f5',
|
|
1175
|
+
},
|
|
1176
|
+
td: {
|
|
1177
|
+
padding: '20px 15px',
|
|
1178
|
+
'text-align': 'start',
|
|
1179
|
+
'max-width': 'none',
|
|
1180
|
+
},
|
|
1181
|
+
},
|
|
1182
|
+
},
|
|
1183
|
+
paginator: {
|
|
1184
|
+
root: {
|
|
1185
|
+
'background-color': '#f5f5f5',
|
|
1186
|
+
},
|
|
1187
|
+
p: {
|
|
1188
|
+
'margin-bottom': '0',
|
|
1189
|
+
},
|
|
1190
|
+
},
|
|
1191
|
+
total_row_style: {},
|
|
1192
|
+
scrollbar: {},
|
|
1193
|
+
};
|
|
1194
|
+
```
|
|
1195
|
+
*/
|
|
1196
|
+
tableStyle: InputSignal<DmTableStyle>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Table classes - An object that defines the classes of the table.
|
|
1199
|
+
* @default undefined
|
|
1200
|
+
*/
|
|
1201
|
+
tableClasses: InputSignal<DmTableClasses | undefined>;
|
|
1202
|
+
/**
|
|
1203
|
+
* Row style function - A function that defines the style of the rows of the table.
|
|
1204
|
+
* @default null
|
|
1205
|
+
*/
|
|
1206
|
+
rowStyleFn: InputSignal<((row: T) => {
|
|
1207
|
+
[key: string]: any;
|
|
1208
|
+
}) | null>;
|
|
1209
|
+
/**
|
|
1210
|
+
* Edit columns visibility - whether to enable edit columns visibility.
|
|
1211
|
+
* @default false
|
|
1212
|
+
*/
|
|
1213
|
+
editColumnsVisibility: InputSignalWithTransform<boolean, unknown>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Edit columns visibility button - The button to display when edit columns visibility is enabled.
|
|
1216
|
+
* @default null
|
|
1217
|
+
*/
|
|
1218
|
+
editColumnsVisibilityButton: InputSignal<DmTableActionButton<T>>;
|
|
1219
|
+
/**
|
|
1220
|
+
* Edit columns visibility select all label - The label to display when select all is enabled.
|
|
1221
|
+
* @default 'הצג את כל העמודות'
|
|
1222
|
+
*/
|
|
1223
|
+
editColumnsVisibilitySelectAllLabel: InputSignal<string>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Get modified rows - A function that returns the modified rows of the table.
|
|
1226
|
+
* @returns {T[]} The modified rows of the table.
|
|
1227
|
+
*/
|
|
1228
|
+
getModifiedRows: () => T[];
|
|
1229
|
+
}
|
|
1017
1230
|
|
|
1018
|
-
declare class DmTable<T extends object> {
|
|
1231
|
+
declare class DmTable<T extends object> implements DmTableInterface<T> {
|
|
1019
1232
|
protected shiftKeyPressed: _angular_core.WritableSignal<boolean>;
|
|
1020
|
-
onShiftKeyDown(event: Event): void;
|
|
1021
|
-
onShiftKeyUp(event: Event): void;
|
|
1233
|
+
protected onShiftKeyDown(event: Event): void;
|
|
1234
|
+
protected onShiftKeyUp(event: Event): void;
|
|
1022
1235
|
protected DEFAULT_PAGINATOR_SETTINGS: DmTablePaginatorSettings;
|
|
1023
1236
|
protected DEFAULT_TABLE_STYLE: DmTableStyle;
|
|
1024
1237
|
tableId: _angular_core.InputSignal<string | undefined>;
|
|
@@ -1037,7 +1250,7 @@ declare class DmTable<T extends object> {
|
|
|
1037
1250
|
enablePagination: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1038
1251
|
autoPaginationAboveRowsCount: _angular_core.InputSignalWithTransform<number, unknown>;
|
|
1039
1252
|
paginatorSettings: _angular_core.InputSignal<any>;
|
|
1040
|
-
|
|
1253
|
+
enableLoadingProgressbar: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1041
1254
|
enableColumnsDragAndDrop: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1042
1255
|
enableColumnsDragHandle: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
1043
1256
|
enableTotalRow: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
@@ -1051,6 +1264,7 @@ declare class DmTable<T extends object> {
|
|
|
1051
1264
|
editColumnsVisibilitySelectAllLabel: _angular_core.InputSignal<string>;
|
|
1052
1265
|
protected columnsSortState: _angular_core.WritableSignal<DmCmpsDataSourceSort[]>;
|
|
1053
1266
|
protected mergedTableStyle: _angular_core.Signal<DmTableStyle>;
|
|
1267
|
+
private saveScrollbarStyle;
|
|
1054
1268
|
protected hoveredRowIndex: _angular_core.WritableSignal<number | null>;
|
|
1055
1269
|
protected datasource: _angular_core.WritableSignal<DmCmpsDataSource<T>>;
|
|
1056
1270
|
protected readonly runtimeColumns: _angular_core.Signal<DmTableRuntimeColumn<T>[]>;
|
|
@@ -1073,6 +1287,7 @@ declare class DmTable<T extends object> {
|
|
|
1073
1287
|
private reconcileColumns;
|
|
1074
1288
|
private setFilterPredicate;
|
|
1075
1289
|
protected createCellContext: (row: T, column: DmTableRuntimeColumn<T>) => DmCellContext<T>;
|
|
1290
|
+
protected resetRowCache(row: T): void;
|
|
1076
1291
|
protected resolveCellValue<T extends object>(row: T, column: DmTableRuntimeColumn<T>): any;
|
|
1077
1292
|
protected applySearchFilter(event: Event): void;
|
|
1078
1293
|
protected resetSearch(): void;
|
|
@@ -1114,8 +1329,10 @@ declare class DmTable<T extends object> {
|
|
|
1114
1329
|
protected inputCellSelectOptionChangeHandler(row: T, column: DmTableRuntimeColumn<T>, option: DmTableInputCellSelectOption, event: MatOptionSelectionChange): void;
|
|
1115
1330
|
protected inputCellChangeHandler(row: T, column: DmTableRuntimeColumn<T>, event: Event): void;
|
|
1116
1331
|
protected inputCellCheckboxChangeHandler(row: T, column: DmTableRuntimeColumn<T>, event: MatCheckboxChange): void;
|
|
1332
|
+
protected getSlideToggleTooltip(row: T, column: DmTableRuntimeColumn<T>): string;
|
|
1333
|
+
protected onSlideToggleChange(row: T, column: DmTableRuntimeColumn<T>, change: MatSlideToggleChange): void;
|
|
1117
1334
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DmTable<any>, never>;
|
|
1118
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DmTable<any>, "dm-table", never, { "tableId": { "alias": "tableId"; "required": false; "isSignal": true; }; "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "noDataMessage": { "alias": "noDataMessage"; "required": false; "isSignal": true; }; "enableSearch": { "alias": "enableSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "clearSearchTooltip": { "alias": "clearSearchTooltip"; "required": false; "isSignal": true; }; "searchInputAppearance": { "alias": "searchInputAppearance"; "required": false; "isSignal": true; }; "filterPredicate": { "alias": "filterPredicate"; "required": false; "isSignal": true; }; "actionButtons": { "alias": "actionButtons"; "required": false; "isSignal": true; }; "enablePrint": { "alias": "enablePrint"; "required": false; "isSignal": true; }; "printButton": { "alias": "printButton"; "required": false; "isSignal": true; }; "enablePagination": { "alias": "enablePagination"; "required": false; "isSignal": true; }; "autoPaginationAboveRowsCount": { "alias": "autoPaginationAboveRowsCount"; "required": false; "isSignal": true; }; "paginatorSettings": { "alias": "paginatorSettings"; "required": false; "isSignal": true; }; "
|
|
1335
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DmTable<any>, "dm-table", never, { "tableId": { "alias": "tableId"; "required": false; "isSignal": true; }; "dataSource": { "alias": "dataSource"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "noDataMessage": { "alias": "noDataMessage"; "required": false; "isSignal": true; }; "enableSearch": { "alias": "enableSearch"; "required": false; "isSignal": true; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; "isSignal": true; }; "clearSearchTooltip": { "alias": "clearSearchTooltip"; "required": false; "isSignal": true; }; "searchInputAppearance": { "alias": "searchInputAppearance"; "required": false; "isSignal": true; }; "filterPredicate": { "alias": "filterPredicate"; "required": false; "isSignal": true; }; "actionButtons": { "alias": "actionButtons"; "required": false; "isSignal": true; }; "enablePrint": { "alias": "enablePrint"; "required": false; "isSignal": true; }; "printButton": { "alias": "printButton"; "required": false; "isSignal": true; }; "enablePagination": { "alias": "enablePagination"; "required": false; "isSignal": true; }; "autoPaginationAboveRowsCount": { "alias": "autoPaginationAboveRowsCount"; "required": false; "isSignal": true; }; "paginatorSettings": { "alias": "paginatorSettings"; "required": false; "isSignal": true; }; "enableLoadingProgressbar": { "alias": "enableLoadingProgressbar"; "required": false; "isSignal": true; }; "enableColumnsDragAndDrop": { "alias": "enableColumnsDragAndDrop"; "required": false; "isSignal": true; }; "enableColumnsDragHandle": { "alias": "enableColumnsDragHandle"; "required": false; "isSignal": true; }; "enableTotalRow": { "alias": "enableTotalRow"; "required": false; "isSignal": true; }; "tableStyle": { "alias": "tableStyle"; "required": false; "isSignal": true; }; "tableClasses": { "alias": "tableClasses"; "required": false; "isSignal": true; }; "rowStyleFn": { "alias": "rowStyleFn"; "required": false; "isSignal": true; }; "editColumnsVisibility": { "alias": "editColumnsVisibility"; "required": false; "isSignal": true; }; "editColumnsVisibilityButton": { "alias": "editColumnsVisibilityButton"; "required": false; "isSignal": true; }; "editColumnsVisibilitySelectAllLabel": { "alias": "editColumnsVisibilitySelectAllLabel"; "required": false; "isSignal": true; }; "rowIdentifierField": { "alias": "rowIdentifierField"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1119
1336
|
}
|
|
1120
1337
|
|
|
1121
1338
|
export { DmCmpsDataSource, DmColorPicker, DmMatSelect, DmSpinner, DmSpinnerService, DmTable };
|