@wolkabout/commons 0.1.10 → 0.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolkabout/commons",
3
- "version": "0.1.10",
3
+ "version": "0.2.0",
4
4
  "peerDependencies": {
5
5
  "@angular/cdk": "21.2.0",
6
6
  "@angular/common": "21.2.0",
@@ -1096,6 +1096,36 @@ declare class NestedListDataControl<ItemType> {
1096
1096
  persist(id: string | null): void;
1097
1097
  }
1098
1098
 
1099
+ interface StandardListItem<ItemType> {
1100
+ id: string;
1101
+ name: string;
1102
+ icon: string | number | LoadedIcon | SvgIcon;
1103
+ rightIcon?: string | number | LoadedIcon | SvgIcon;
1104
+ data: ItemType;
1105
+ }
1106
+ declare abstract class StandardListDataSource<ItemType> {
1107
+ page: number;
1108
+ isPaged: boolean;
1109
+ isLastPage: boolean;
1110
+ /**
1111
+ * Loads the initial data from the backend.
1112
+ */
1113
+ abstract loadData(): Observable<ItemType[]>;
1114
+ /**
1115
+ * Sets the id of the item that should be selected as soon as the data loads.
1116
+ */
1117
+ abstract initialSelection(): string[] | string | null;
1118
+ /**
1119
+ * Generalized the item and prepares it for display.
1120
+ */
1121
+ abstract prepareItem(item: ItemType): StandardListItem<ItemType>;
1122
+ sortingFunction(item1: StandardListItem<ItemType>, item2: StandardListItem<ItemType>): number;
1123
+ /**
1124
+ * If isPaged is set to true, implement this method, gets next page from the backend.
1125
+ */
1126
+ nextPage(): Observable<ItemType[]>;
1127
+ }
1128
+
1099
1129
  interface SearchAction {
1100
1130
  name: string;
1101
1131
  icon: SvgIcon;
@@ -1107,6 +1137,8 @@ interface SearchAction {
1107
1137
  }
1108
1138
  declare class NestedListViewComponent<ItemType> {
1109
1139
  private destroyRef;
1140
+ onKeyDown(event: KeyboardEvent): void;
1141
+ onKeyUp(event: KeyboardEvent): void;
1110
1142
  dataSource: _angular_core.InputSignal<NestedListDataSource<ItemType>>;
1111
1143
  dataControl: _angular_core.InputSignal<NestedListDataControl<ItemType>>;
1112
1144
  width: _angular_core.InputSignal<"quarter" | "full" | "third" | "half">;
@@ -1115,11 +1147,15 @@ declare class NestedListViewComponent<ItemType> {
1115
1147
  searchActions: _angular_core.InputSignal<SearchAction[]>;
1116
1148
  defaultSearchAction: _angular_core.Signal<SearchAction | undefined>;
1117
1149
  otherSearchActions: _angular_core.Signal<SearchAction[]>;
1150
+ enableMultiSelect: _angular_core.InputSignal<boolean>;
1151
+ ctrlPressed: _angular_core.WritableSignal<boolean>;
1152
+ shiftPressed: _angular_core.WritableSignal<boolean>;
1118
1153
  widthClass: _angular_core.Signal<"w-full" | "w-1/4" | "w-1/3" | "w-1/2">;
1119
1154
  selectionConfirmationAction: _angular_core.InputSignal<() => Observable<boolean>>;
1120
1155
  loadingBreadcrumbs: _angular_core.WritableSignal<boolean>;
1121
1156
  loadingChildren: _angular_core.WritableSignal<boolean>;
1122
1157
  selectedItem: _angular_core.WritableSignal<NestedListItem<ItemType> | null>;
1158
+ selectedItems: _angular_core.WritableSignal<NestedListItem<ItemType>[]>;
1123
1159
  hideSearch: _angular_core.InputSignal<boolean>;
1124
1160
  nameSearchControl: FormControl<string | null>;
1125
1161
  searchTerm: _angular_core.Signal<string | null | undefined>;
@@ -1133,6 +1169,7 @@ declare class NestedListViewComponent<ItemType> {
1133
1169
  children: _angular_core.WritableSignal<NestedListItem<ItemType>[]>;
1134
1170
  filteredChildren: _angular_core.Signal<NestedListItem<ItemType>[]>;
1135
1171
  itemSelected: _angular_core.OutputEmitterRef<ItemType | null>;
1172
+ itemsSelected: _angular_core.OutputEmitterRef<ItemType[]>;
1136
1173
  private countsMap;
1137
1174
  private readonly currentScopes;
1138
1175
  constructor(destroyRef: DestroyRef);
@@ -1144,9 +1181,12 @@ declare class NestedListViewComponent<ItemType> {
1144
1181
  shouldDisableBreadcrumbClick(item: NestedListItem<ItemType>): boolean | "" | null | undefined;
1145
1182
  private buildCountsMap;
1146
1183
  private adjustCount;
1184
+ toggleSelectAll(): void;
1185
+ isChildSelected(item: StandardListItem<ItemType>): boolean;
1186
+ isBreadcrumbSelected(item: StandardListItem<ItemType>): boolean;
1147
1187
  private refreshCount;
1148
1188
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NestedListViewComponent<any>, never>;
1149
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<NestedListViewComponent<any>, "app-nested-list-view", never, { "dataSource": { "alias": "dataSource"; "required": true; "isSignal": true; }; "dataControl": { "alias": "dataControl"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "disableThresholdId": { "alias": "disableThresholdId"; "required": false; "isSignal": true; }; "isColoredInput": { "alias": "isColoredInput"; "required": false; "isSignal": true; }; "searchActions": { "alias": "searchActions"; "required": false; "isSignal": true; }; "selectionConfirmationAction": { "alias": "selectionConfirmationAction"; "required": false; "isSignal": true; }; "hideSearch": { "alias": "hideSearch"; "required": false; "isSignal": true; }; "rootButtonText": { "alias": "rootButtonText"; "required": false; "isSignal": true; }; "enableDrag": { "alias": "enableDrag"; "required": false; "isSignal": true; }; }, { "dragging": "dragging"; "itemSelected": "itemSelected"; }, never, ["[app-no-items-message]", "[app-actions]", "[app-details]"], true, never>;
1189
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NestedListViewComponent<any>, "app-nested-list-view", never, { "dataSource": { "alias": "dataSource"; "required": true; "isSignal": true; }; "dataControl": { "alias": "dataControl"; "required": true; "isSignal": true; }; "width": { "alias": "width"; "required": false; "isSignal": true; }; "disableThresholdId": { "alias": "disableThresholdId"; "required": false; "isSignal": true; }; "isColoredInput": { "alias": "isColoredInput"; "required": false; "isSignal": true; }; "searchActions": { "alias": "searchActions"; "required": false; "isSignal": true; }; "enableMultiSelect": { "alias": "enableMultiSelect"; "required": false; "isSignal": true; }; "selectionConfirmationAction": { "alias": "selectionConfirmationAction"; "required": false; "isSignal": true; }; "hideSearch": { "alias": "hideSearch"; "required": false; "isSignal": true; }; "rootButtonText": { "alias": "rootButtonText"; "required": false; "isSignal": true; }; "enableDrag": { "alias": "enableDrag"; "required": false; "isSignal": true; }; }, { "dragging": "dragging"; "itemSelected": "itemSelected"; "itemsSelected": "itemsSelected"; }, never, ["[app-no-items-message]", "[app-actions]", "[app-details]", "[app-bulk-actions]"], true, never>;
1150
1190
  }
1151
1191
 
1152
1192
  declare class PdfViewerComponent {
@@ -1158,36 +1198,6 @@ declare class PdfViewerComponent {
1158
1198
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<PdfViewerComponent, "app-pdf-viewer", never, { "value": { "alias": "value"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
1159
1199
  }
1160
1200
 
1161
- interface StandardListItem<ItemType> {
1162
- id: string;
1163
- name: string;
1164
- icon: string | number | LoadedIcon | SvgIcon;
1165
- rightIcon?: string | number | LoadedIcon | SvgIcon;
1166
- data: ItemType;
1167
- }
1168
- declare abstract class StandardListDataSource<ItemType> {
1169
- page: number;
1170
- isPaged: boolean;
1171
- isLastPage: boolean;
1172
- /**
1173
- * Loads the initial data from the backend.
1174
- */
1175
- abstract loadData(): Observable<ItemType[]>;
1176
- /**
1177
- * Sets the id of the item that should be selected as soon as the data loads.
1178
- */
1179
- abstract initialSelection(): string[] | string | null;
1180
- /**
1181
- * Generalized the item and prepares it for display.
1182
- */
1183
- abstract prepareItem(item: ItemType): StandardListItem<ItemType>;
1184
- sortingFunction(item1: StandardListItem<ItemType>, item2: StandardListItem<ItemType>): number;
1185
- /**
1186
- * If isPaged is set to true, implement this method, gets next page from the backend.
1187
- */
1188
- nextPage(): Observable<ItemType[]>;
1189
- }
1190
-
1191
1201
  interface PartialUpdate<ItemType> {
1192
1202
  id: string;
1193
1203
  update: (oldItem: ItemType) => ItemType;
@@ -1203,10 +1213,10 @@ declare class StandardListDataControl<ItemType> {
1203
1213
  constructor(storageKey?: string);
1204
1214
  readonly selectItem: (id: string) => void;
1205
1215
  readonly deselectItem: () => void;
1206
- readonly updateItem: (item: ItemType) => void;
1216
+ readonly updateItem: (item: ItemType | ItemType[]) => void;
1207
1217
  readonly updateItemPartially: (id: string, update: (oldItem: ItemType) => ItemType) => void;
1208
1218
  readonly addItem: (item: ItemType) => void;
1209
- readonly removeItem: (id: string) => void;
1219
+ readonly removeItem: (id: string | string[]) => void;
1210
1220
  /**
1211
1221
  * Internal event hook. Do not use outside the Standard List Component
1212
1222
  */
@@ -1214,7 +1224,7 @@ declare class StandardListDataControl<ItemType> {
1214
1224
  /**
1215
1225
  * Internal event hook. Do not use outside of the Standard List Component
1216
1226
  */
1217
- get itemUpdated$(): Observable<ItemType>;
1227
+ get itemUpdated$(): Observable<ItemType[]>;
1218
1228
  /**
1219
1229
  * Internal event hook. Do not use outside of the Standard List Component
1220
1230
  */
@@ -1226,7 +1236,7 @@ declare class StandardListDataControl<ItemType> {
1226
1236
  /**
1227
1237
  * Internal event hook. Do not use outside the Standard List Component
1228
1238
  */
1229
- get itemRemoved$(): Observable<string>;
1239
+ get itemRemoved$(): Observable<string[]>;
1230
1240
  /**
1231
1241
  * Internal event hook. Do not use outside the Standard List Component
1232
1242
  */
@@ -1234,13 +1244,18 @@ declare class StandardListDataControl<ItemType> {
1234
1244
  }
1235
1245
 
1236
1246
  declare class StandardListViewComponent<ItemType> {
1247
+ onKeyDown(event: KeyboardEvent): void;
1248
+ onKeyUp(event: KeyboardEvent): void;
1237
1249
  dataSource: _angular_core.InputSignal<StandardListDataSource<ItemType>>;
1238
1250
  dataControl: _angular_core.InputSignal<StandardListDataControl<ItemType>>;
1239
1251
  position: _angular_core.InputSignal<"inner" | "outer">;
1240
1252
  isColoredInput: _angular_core.InputSignal<boolean>;
1253
+ enableMultiSelect: _angular_core.InputSignal<boolean>;
1254
+ ctrlPressed: _angular_core.WritableSignal<boolean>;
1255
+ shiftPressed: _angular_core.WritableSignal<boolean>;
1241
1256
  loadingData: _angular_core.WritableSignal<boolean>;
1242
1257
  loadingPage: _angular_core.WritableSignal<boolean>;
1243
- selectedItem: _angular_core.WritableSignal<StandardListItem<ItemType> | null>;
1258
+ selectedItems: _angular_core.WritableSignal<StandardListItem<ItemType>[]>;
1244
1259
  hideSearch: _angular_core.InputSignal<boolean>;
1245
1260
  hideDetails: _angular_core.InputSignal<boolean>;
1246
1261
  hidePadding: _angular_core.InputSignal<boolean>;
@@ -1250,13 +1265,16 @@ declare class StandardListViewComponent<ItemType> {
1250
1265
  items: _angular_core.WritableSignal<StandardListItem<ItemType>[]>;
1251
1266
  filteredItems: _angular_core.Signal<StandardListItem<ItemType>[]>;
1252
1267
  itemSelected: _angular_core.OutputEmitterRef<ItemType | null>;
1268
+ itemsSelected: _angular_core.OutputEmitterRef<ItemType[]>;
1253
1269
  itemTemplate: _angular_core.Signal<TemplateRef<any> | undefined>;
1254
1270
  constructor(destroyRef: DestroyRef);
1255
- selectItem(item: StandardListItem<ItemType>): void;
1271
+ selectItems(item: StandardListItem<ItemType>): void;
1256
1272
  selectEmpty(): void;
1273
+ isSelected(item: StandardListItem<ItemType>): boolean;
1274
+ toggleSelectAll(): void;
1257
1275
  loadMore(): void;
1258
1276
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StandardListViewComponent<any>, never>;
1259
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<StandardListViewComponent<any>, "app-standard-list-view", never, { "dataSource": { "alias": "dataSource"; "required": true; "isSignal": true; }; "dataControl": { "alias": "dataControl"; "required": true; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "isColoredInput": { "alias": "isColoredInput"; "required": false; "isSignal": true; }; "hideSearch": { "alias": "hideSearch"; "required": false; "isSignal": true; }; "hideDetails": { "alias": "hideDetails"; "required": false; "isSignal": true; }; "hidePadding": { "alias": "hidePadding"; "required": false; "isSignal": true; }; }, { "itemSelected": "itemSelected"; }, ["itemTemplate"], ["[app-no-items-message]", "[app-actions]", "[app-details]"], true, never>;
1277
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StandardListViewComponent<any>, "app-standard-list-view", never, { "dataSource": { "alias": "dataSource"; "required": true; "isSignal": true; }; "dataControl": { "alias": "dataControl"; "required": true; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "isColoredInput": { "alias": "isColoredInput"; "required": false; "isSignal": true; }; "enableMultiSelect": { "alias": "enableMultiSelect"; "required": false; "isSignal": true; }; "hideSearch": { "alias": "hideSearch"; "required": false; "isSignal": true; }; "hideDetails": { "alias": "hideDetails"; "required": false; "isSignal": true; }; "hidePadding": { "alias": "hidePadding"; "required": false; "isSignal": true; }; }, { "itemSelected": "itemSelected"; "itemsSelected": "itemsSelected"; }, ["itemTemplate"], ["[app-no-items-message]", "[app-actions]", "[app-details]", "[app-bulk-actions]"], true, never>;
1260
1278
  }
1261
1279
 
1262
1280
  declare const LAST_ACTIVE_TAB_KEY = "WOLK_LAST_ACTIVE_TAB";