@decaf-ts/for-angular 0.0.8 → 0.0.9
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/lib/assets/i18n/en.json +10 -1
- package/dist/lib/components/empty-state/empty-state.component.d.ts +301 -0
- package/dist/lib/components/fieldset/fieldset.component.d.ts +199 -0
- package/dist/lib/components/filter/filter.component.d.ts +505 -0
- package/dist/lib/components/for-angular-components.module.d.ts +20 -0
- package/dist/lib/components/index.d.ts +16 -0
- package/dist/lib/components/layout/layout.component.d.ts +133 -0
- package/dist/lib/components/list/constants.d.ts +29 -0
- package/dist/lib/components/list/list.component.d.ts +849 -0
- package/dist/lib/components/list-item/list-item.component.d.ts +390 -0
- package/dist/lib/components/pagination/constants.d.ts +7 -0
- package/dist/lib/components/pagination/pagination.component.d.ts +264 -0
- package/dist/lib/components/searchbar/searchbar.component.d.ts +407 -0
- package/dist/lib/directives/collapsable.directive.d.ts +8 -0
- package/dist/lib/directives/index.d.ts +1 -0
- package/dist/lib/engine/NgxBaseComponent.d.ts +541 -0
- package/dist/lib/engine/index.d.ts +1 -0
- package/dist/lib/engine/types.d.ts +44 -0
- package/dist/lib/esm2022/components/crud-field/crud-field.component.mjs +8 -4
- package/dist/lib/esm2022/components/crud-form/crud-form.component.mjs +3 -3
- package/dist/lib/esm2022/components/empty-state/empty-state.component.mjs +348 -0
- package/dist/lib/esm2022/components/fieldset/fieldset.component.mjs +225 -0
- package/dist/lib/esm2022/components/filter/filter.component.mjs +689 -0
- package/dist/lib/esm2022/components/for-angular-components.module.mjs +71 -0
- package/dist/lib/esm2022/components/index.mjs +20 -0
- package/dist/lib/esm2022/components/layout/layout.component.mjs +176 -0
- package/dist/lib/esm2022/components/list/constants.mjs +6 -0
- package/dist/lib/esm2022/components/list/list.component.mjs +1236 -0
- package/dist/lib/esm2022/components/list-item/list-item.component.mjs +408 -0
- package/dist/lib/esm2022/components/pagination/constants.mjs +2 -0
- package/dist/lib/esm2022/components/pagination/pagination.component.mjs +323 -0
- package/dist/lib/esm2022/components/searchbar/searchbar.component.mjs +493 -0
- package/dist/lib/esm2022/directives/collapsable.directive.mjs +28 -0
- package/dist/lib/esm2022/directives/index.mjs +2 -0
- package/dist/lib/esm2022/engine/NgxBaseComponent.mjs +540 -0
- package/dist/lib/esm2022/engine/NgxCrudFormField.mjs +3 -1
- package/dist/lib/esm2022/engine/index.mjs +2 -1
- package/dist/lib/esm2022/engine/types.mjs +3 -1
- package/dist/lib/esm2022/helpers/index.mjs +13 -0
- package/dist/lib/esm2022/helpers/utils.mjs +415 -0
- package/dist/lib/esm2022/public-apis.mjs +5 -4
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs +6724 -1761
- package/dist/lib/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
- package/dist/lib/helpers/index.d.ts +12 -0
- package/dist/lib/helpers/utils.d.ts +253 -0
- package/dist/lib/public-apis.d.ts +4 -3
- package/package.json +2 -2
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { CrudOperations } from '@decaf-ts/db-decorators';
|
|
3
|
+
import { StringOrBoolean } from 'src/lib/engine/types';
|
|
4
|
+
import { NgxBaseComponent } from 'src/lib/engine/NgxBaseComponent';
|
|
5
|
+
import { ListItemCustomEvent } from 'src/lib/engine';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* @description A component for displaying a list item with various customization options.
|
|
9
|
+
* @summary The ListItemComponent is an Angular component that extends NgxBaseComponent. It provides a flexible and customizable list item interface with support for icons, buttons, and various text elements. The component also handles actions and navigation based on user interactions.
|
|
10
|
+
*
|
|
11
|
+
* @class
|
|
12
|
+
* @extends NgxBaseComponent
|
|
13
|
+
*
|
|
14
|
+
* @param {string} [lines='none'] - Determines the line style of the item. Can be 'inset', 'inseet', or 'none'.
|
|
15
|
+
* @param {Record<string, any>} item - The data item to be displayed in the list item.
|
|
16
|
+
* @param {string} icon - The name of the icon to be displayed.
|
|
17
|
+
* @param {'start' | 'end'} [iconSlot='start'] - The position of the icon within the item.
|
|
18
|
+
* @param {StringOrBoolean} [button=true] - Determines if the item should behave as a button.
|
|
19
|
+
* @param {string} [title] - The main title of the list item.
|
|
20
|
+
* @param {string} [description] - A description for the list item.
|
|
21
|
+
* @param {string} [info] - Additional information for the list item.
|
|
22
|
+
* @param {string} [subinfo] - Sub-information for the list item.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <ngx-decaf-list-item
|
|
26
|
+
* [item]="dataItem"
|
|
27
|
+
* icon="star"
|
|
28
|
+
* title="Item Title"
|
|
29
|
+
* description="Item Description"
|
|
30
|
+
* (clickEvent)="handleItemClick($event)">
|
|
31
|
+
* </ngx-decaf-list-item>
|
|
32
|
+
*
|
|
33
|
+
* @mermaid
|
|
34
|
+
* sequenceDiagram
|
|
35
|
+
* participant C as Component
|
|
36
|
+
* participant V as View
|
|
37
|
+
* participant U as User
|
|
38
|
+
* C->>V: Initialize component
|
|
39
|
+
* V->>U: Display list item
|
|
40
|
+
* U->>V: Click on item or action
|
|
41
|
+
* V->>C: Trigger handleAction()
|
|
42
|
+
* C->>C: Process action
|
|
43
|
+
* C->>V: Update view or navigate
|
|
44
|
+
*/
|
|
45
|
+
export declare class ListItemComponent extends NgxBaseComponent implements OnInit {
|
|
46
|
+
/**
|
|
47
|
+
* @description Reference to the action menu popover component.
|
|
48
|
+
* @summary ViewChild reference that provides access to the HTMLIonPopoverElement
|
|
49
|
+
* used for displaying action menus. This reference is used to programmatically
|
|
50
|
+
* control the popover, such as dismissing it when necessary.
|
|
51
|
+
*
|
|
52
|
+
* @type {HTMLIonPopoverElement}
|
|
53
|
+
* @memberOf ListItemComponent
|
|
54
|
+
*/
|
|
55
|
+
actionMenuComponent: HTMLIonPopoverElement;
|
|
56
|
+
/**
|
|
57
|
+
* @description Controls the display of lines around the list item.
|
|
58
|
+
* @summary Determines how lines are displayed around the list item borders.
|
|
59
|
+
* 'inset' shows lines with padding, 'full' shows full-width lines, and 'none'
|
|
60
|
+
* removes all lines. This affects the visual separation between list items.
|
|
61
|
+
*
|
|
62
|
+
* @type {'inset' | 'full' | 'none'}
|
|
63
|
+
* @default 'inset'
|
|
64
|
+
* @memberOf ListItemComponent
|
|
65
|
+
*/
|
|
66
|
+
lines: 'inset' | 'full' | 'none';
|
|
67
|
+
/**
|
|
68
|
+
* @description The data object associated with this list item.
|
|
69
|
+
* @summary Contains the raw data that this list item represents. This object
|
|
70
|
+
* is used to extract display information and for passing to event handlers
|
|
71
|
+
* when the item is interacted with. It overrides the base item property.
|
|
72
|
+
*
|
|
73
|
+
* @type {Record<string, unknown>}
|
|
74
|
+
* @memberOf ListItemComponent
|
|
75
|
+
*/
|
|
76
|
+
item: Record<string, unknown>;
|
|
77
|
+
/**
|
|
78
|
+
* @description The name of the icon to display in the list item.
|
|
79
|
+
* @summary Specifies which icon to display using Ionic's icon system.
|
|
80
|
+
* The icon name should correspond to an available Ionic icon or a custom
|
|
81
|
+
* icon that has been registered with the icon registry.
|
|
82
|
+
*
|
|
83
|
+
* @type {string}
|
|
84
|
+
* @memberOf ListItemComponent
|
|
85
|
+
*/
|
|
86
|
+
icon: string;
|
|
87
|
+
/**
|
|
88
|
+
* @description Position of the icon within the list item.
|
|
89
|
+
* @summary Determines whether the icon appears at the start (left in LTR languages)
|
|
90
|
+
* or end (right in LTR languages) of the list item. This affects the overall
|
|
91
|
+
* layout and visual hierarchy of the item content.
|
|
92
|
+
*
|
|
93
|
+
* @type {'start' | 'end'}
|
|
94
|
+
* @default 'start'
|
|
95
|
+
* @memberOf ListItemComponent
|
|
96
|
+
*/
|
|
97
|
+
iconSlot: 'start' | 'end';
|
|
98
|
+
/**
|
|
99
|
+
* @description Controls whether the list item behaves as a clickable button.
|
|
100
|
+
* @summary When set to true, the list item will have button-like behavior including
|
|
101
|
+
* hover effects, click handling, and appropriate accessibility attributes.
|
|
102
|
+
* When false, the item is displayed as static content without interactive behavior.
|
|
103
|
+
*
|
|
104
|
+
* @type {StringOrBoolean}
|
|
105
|
+
* @default true
|
|
106
|
+
* @memberOf ListItemComponent
|
|
107
|
+
*/
|
|
108
|
+
button: StringOrBoolean;
|
|
109
|
+
/**
|
|
110
|
+
* @description The main title text displayed in the list item.
|
|
111
|
+
* @summary Sets the primary text content that appears prominently in the list item.
|
|
112
|
+
* This is typically the most important information about the item and is displayed
|
|
113
|
+
* with emphasis in the component's visual hierarchy.
|
|
114
|
+
*
|
|
115
|
+
* @type {string}
|
|
116
|
+
* @memberOf ListItemComponent
|
|
117
|
+
*/
|
|
118
|
+
title?: string;
|
|
119
|
+
/**
|
|
120
|
+
* @description Secondary descriptive text for the list item.
|
|
121
|
+
* @summary Provides additional context or details about the item. This text
|
|
122
|
+
* is typically displayed below the title with less visual emphasis.
|
|
123
|
+
* Useful for providing context without cluttering the main title.
|
|
124
|
+
*
|
|
125
|
+
* @type {string}
|
|
126
|
+
* @memberOf ListItemComponent
|
|
127
|
+
*/
|
|
128
|
+
description?: string;
|
|
129
|
+
/**
|
|
130
|
+
* @description Additional information text for the list item.
|
|
131
|
+
* @summary Displays supplementary information that provides extra context
|
|
132
|
+
* about the item. This could include metadata, status information, or
|
|
133
|
+
* other relevant details that don't fit in the title or description.
|
|
134
|
+
*
|
|
135
|
+
* @type {string}
|
|
136
|
+
* @memberOf ListItemComponent
|
|
137
|
+
*/
|
|
138
|
+
info?: string;
|
|
139
|
+
/**
|
|
140
|
+
* @description Sub-information text displayed in the list item.
|
|
141
|
+
* @summary Provides tertiary level information that complements the info field.
|
|
142
|
+
* This is typically used for additional metadata or contextual details
|
|
143
|
+
* that are useful but not critical for understanding the item.
|
|
144
|
+
*
|
|
145
|
+
* @type {string}
|
|
146
|
+
* @memberOf ListItemComponent
|
|
147
|
+
*/
|
|
148
|
+
subinfo?: string;
|
|
149
|
+
/**
|
|
150
|
+
* @description Event emitter for list item click interactions.
|
|
151
|
+
* @summary Emits custom events when the list item is clicked or when actions
|
|
152
|
+
* are performed on it. The emitted event contains information about the action,
|
|
153
|
+
* the item data, and other relevant context for parent components to handle.
|
|
154
|
+
*
|
|
155
|
+
* @type {EventEmitter<ListItemCustomEvent>}
|
|
156
|
+
* @memberOf ListItemComponent
|
|
157
|
+
*/
|
|
158
|
+
clickEvent: EventEmitter<ListItemCustomEvent>;
|
|
159
|
+
/**
|
|
160
|
+
* @description Flag indicating whether slide items are currently enabled.
|
|
161
|
+
* @summary Controls the visibility of slide actions based on screen size and
|
|
162
|
+
* available operations. When true, users can swipe on the item to reveal
|
|
163
|
+
* action buttons for operations like edit and delete.
|
|
164
|
+
*
|
|
165
|
+
* @type {boolean}
|
|
166
|
+
* @default false
|
|
167
|
+
* @memberOf ListItemComponent
|
|
168
|
+
*/
|
|
169
|
+
showSlideItems: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* @description Current window width in pixels.
|
|
172
|
+
* @summary Stores the current browser window width which is used to determine
|
|
173
|
+
* responsive behavior, such as when to show or hide slide items based on
|
|
174
|
+
* screen size. Updated automatically on window resize events.
|
|
175
|
+
*
|
|
176
|
+
* @type {number}
|
|
177
|
+
* @memberOf ListItemComponent
|
|
178
|
+
*/
|
|
179
|
+
windowWidth: number;
|
|
180
|
+
/**
|
|
181
|
+
* @description Flag indicating whether the action menu popover is currently open.
|
|
182
|
+
* @summary Tracks the state of the action menu to prevent multiple instances
|
|
183
|
+
* from being opened simultaneously and to ensure proper cleanup when actions
|
|
184
|
+
* are performed. Used for managing the popover lifecycle.
|
|
185
|
+
*
|
|
186
|
+
* @type {boolean}
|
|
187
|
+
* @default false
|
|
188
|
+
* @memberOf ListItemComponent
|
|
189
|
+
*/
|
|
190
|
+
actionMenuOpen: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* @description Angular NavController service for handling navigation.
|
|
193
|
+
* @summary Injected service that provides methods for programmatic navigation
|
|
194
|
+
* within the Ionic application. Used for navigating to different routes when
|
|
195
|
+
* list item actions are performed or when the item itself is clicked.
|
|
196
|
+
*
|
|
197
|
+
* @private
|
|
198
|
+
* @type {NavController}
|
|
199
|
+
* @memberOf ListItemComponent
|
|
200
|
+
*/
|
|
201
|
+
private navController;
|
|
202
|
+
/**
|
|
203
|
+
* @description Creates an instance of ListItemComponent.
|
|
204
|
+
* @summary Initializes a new ListItemComponent by calling the parent class constructor
|
|
205
|
+
* with the component name for logging and identification purposes. Also registers
|
|
206
|
+
* all available Ionic icons to ensure they can be displayed in the component.
|
|
207
|
+
*
|
|
208
|
+
* @memberOf ListItemComponent
|
|
209
|
+
*/
|
|
210
|
+
constructor();
|
|
211
|
+
/**
|
|
212
|
+
* @description Initializes the component after Angular first displays the data-bound properties.
|
|
213
|
+
* @summary Sets up the component by determining slide item visibility, processing boolean inputs,
|
|
214
|
+
* building CSS class names based on properties, and capturing the current window width.
|
|
215
|
+
* This method prepares the component for user interaction by ensuring all properties are
|
|
216
|
+
* properly initialized and responsive behavior is configured.
|
|
217
|
+
*
|
|
218
|
+
* @mermaid
|
|
219
|
+
* sequenceDiagram
|
|
220
|
+
* participant A as Angular Lifecycle
|
|
221
|
+
* participant L as ListItemComponent
|
|
222
|
+
* participant W as Window
|
|
223
|
+
*
|
|
224
|
+
* A->>L: ngOnInit()
|
|
225
|
+
* L->>L: enableSlideItems()
|
|
226
|
+
* L->>L: Process button boolean
|
|
227
|
+
* L->>L: Build className with flex classes
|
|
228
|
+
* alt operations exist
|
|
229
|
+
* L->>L: Add 'action' class
|
|
230
|
+
* end
|
|
231
|
+
* L->>W: getWindowWidth()
|
|
232
|
+
* W-->>L: Return current width
|
|
233
|
+
* L->>L: Store windowWidth
|
|
234
|
+
*
|
|
235
|
+
* @return {Promise<void>}
|
|
236
|
+
* @memberOf ListItemComponent
|
|
237
|
+
*/
|
|
238
|
+
ngOnInit(): Promise<void>;
|
|
239
|
+
/**
|
|
240
|
+
* @description Handles user interactions and actions performed on the list item.
|
|
241
|
+
* @summary This method is the central action handler for list item interactions. It manages
|
|
242
|
+
* event propagation, dismisses open action menus, removes focus traps, and either emits
|
|
243
|
+
* events for parent components to handle or performs navigation based on the component's
|
|
244
|
+
* route configuration. This method supports both event-driven and navigation-driven architectures.
|
|
245
|
+
*
|
|
246
|
+
* @param {CrudOperations} action - The type of CRUD operation being performed
|
|
247
|
+
* @param {Event} event - The browser event that triggered the action
|
|
248
|
+
* @param {HTMLElement} [target] - Optional target element for the event
|
|
249
|
+
* @return {Promise<boolean|void>} A promise that resolves to navigation success or void for events
|
|
250
|
+
*
|
|
251
|
+
* @mermaid
|
|
252
|
+
* sequenceDiagram
|
|
253
|
+
* participant U as User
|
|
254
|
+
* participant L as ListItemComponent
|
|
255
|
+
* participant P as Parent Component
|
|
256
|
+
* participant N as NavController
|
|
257
|
+
* participant E as Event System
|
|
258
|
+
*
|
|
259
|
+
* U->>L: Perform action (click/swipe)
|
|
260
|
+
* L->>L: stopPropagation()
|
|
261
|
+
* alt actionMenuOpen
|
|
262
|
+
* L->>L: Dismiss action menu
|
|
263
|
+
* end
|
|
264
|
+
* L->>L: removeFocusTrap()
|
|
265
|
+
* alt No route configured
|
|
266
|
+
* L->>E: windowEventEmitter()
|
|
267
|
+
* L->>P: clickEvent.emit()
|
|
268
|
+
* else Route configured
|
|
269
|
+
* L->>N: redirect(action, uid)
|
|
270
|
+
* N-->>L: Return navigation result
|
|
271
|
+
* end
|
|
272
|
+
*
|
|
273
|
+
* @memberOf ListItemComponent
|
|
274
|
+
*/
|
|
275
|
+
handleAction(action: CrudOperations, event: Event, target?: HTMLElement): Promise<boolean | void>;
|
|
276
|
+
/**
|
|
277
|
+
* @description Responsive handler that enables or disables slide items based on screen size and operations.
|
|
278
|
+
* @summary This method is automatically called when the window is resized and also during component
|
|
279
|
+
* initialization. It determines whether slide actions should be available based on the current
|
|
280
|
+
* window width and the presence of UPDATE or DELETE operations. Slide items are typically hidden
|
|
281
|
+
* on larger screens where there's space for dedicated action buttons.
|
|
282
|
+
*
|
|
283
|
+
* @return {boolean} True if slide items should be shown, false otherwise
|
|
284
|
+
*
|
|
285
|
+
* @mermaid
|
|
286
|
+
* sequenceDiagram
|
|
287
|
+
* participant W as Window
|
|
288
|
+
* participant L as ListItemComponent
|
|
289
|
+
* participant U as UI
|
|
290
|
+
*
|
|
291
|
+
* W->>L: resize event
|
|
292
|
+
* L->>W: getWindowWidth()
|
|
293
|
+
* W-->>L: Return current width
|
|
294
|
+
* L->>L: Store windowWidth
|
|
295
|
+
* alt No operations OR width > 768px
|
|
296
|
+
* L->>U: showSlideItems = false
|
|
297
|
+
* else Operations include UPDATE/DELETE
|
|
298
|
+
* L->>U: showSlideItems = true
|
|
299
|
+
* end
|
|
300
|
+
* L-->>U: Return showSlideItems value
|
|
301
|
+
*
|
|
302
|
+
* @memberOf ListItemComponent
|
|
303
|
+
*/
|
|
304
|
+
enableSlideItems(): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* @description Animates and removes an element from the DOM.
|
|
307
|
+
* @summary This method applies CSS animation classes to create a smooth fade-out effect
|
|
308
|
+
* before removing the element from the DOM. The animation enhances user experience by
|
|
309
|
+
* providing visual feedback when items are deleted or removed from lists. The timing
|
|
310
|
+
* is coordinated with the CSS animation duration to ensure the element is removed
|
|
311
|
+
* after the animation completes.
|
|
312
|
+
*
|
|
313
|
+
* @param {HTMLElement} element - The DOM element to animate and remove
|
|
314
|
+
* @return {void}
|
|
315
|
+
*
|
|
316
|
+
* @mermaid
|
|
317
|
+
* sequenceDiagram
|
|
318
|
+
* participant L as ListItemComponent
|
|
319
|
+
* participant E as HTMLElement
|
|
320
|
+
* participant D as DOM
|
|
321
|
+
*
|
|
322
|
+
* L->>E: Add animation classes
|
|
323
|
+
* Note over E: uk-animation-fade, uk-animation-medium, uk-animation-reverse
|
|
324
|
+
* E->>E: Start fade animation
|
|
325
|
+
* L->>L: setTimeout(600ms)
|
|
326
|
+
* Note over L: Wait for animation to complete
|
|
327
|
+
* L->>D: element.remove()
|
|
328
|
+
* D->>D: Remove element from DOM
|
|
329
|
+
*
|
|
330
|
+
* @memberOf ListItemComponent
|
|
331
|
+
*/
|
|
332
|
+
removeElement(element: HTMLElement): void;
|
|
333
|
+
/**
|
|
334
|
+
* @description Navigates to a new route based on the specified action and item ID.
|
|
335
|
+
* @summary This method constructs a navigation URL using the component's route configuration,
|
|
336
|
+
* the specified action, and an item identifier. It uses Ionic's NavController to perform
|
|
337
|
+
* forward navigation with appropriate animations. This method is typically used for
|
|
338
|
+
* CRUD operations where each action (create, read, update, delete) has its own route.
|
|
339
|
+
*
|
|
340
|
+
* @param {string} action - The action to be performed (e.g., 'edit', 'view', 'delete')
|
|
341
|
+
* @param {string} [id] - The unique identifier of the item to be acted upon
|
|
342
|
+
* @return {Promise<boolean>} A promise that resolves to true if navigation was successful
|
|
343
|
+
*
|
|
344
|
+
* @mermaid
|
|
345
|
+
* sequenceDiagram
|
|
346
|
+
* participant L as ListItemComponent
|
|
347
|
+
* participant N as NavController
|
|
348
|
+
* participant R as Router
|
|
349
|
+
*
|
|
350
|
+
* L->>L: redirect(action, id)
|
|
351
|
+
* L->>L: Construct URL: /{route}/{action}/{id}
|
|
352
|
+
* L->>N: navigateForward(url)
|
|
353
|
+
* N->>R: Navigate to constructed URL
|
|
354
|
+
* R-->>N: Return navigation result
|
|
355
|
+
* N-->>L: Return boolean success
|
|
356
|
+
*
|
|
357
|
+
* @memberOf ListItemComponent
|
|
358
|
+
*/
|
|
359
|
+
redirect(action: string, id?: string): Promise<boolean>;
|
|
360
|
+
/**
|
|
361
|
+
* @description Presents the actions menu popover for the list item.
|
|
362
|
+
* @summary This method handles the display of a contextual action menu when triggered by user
|
|
363
|
+
* interaction (typically a long press or right-click). It stops event propagation to prevent
|
|
364
|
+
* unwanted side effects, removes any existing focus traps for accessibility, configures the
|
|
365
|
+
* popover with the triggering event, and opens the action menu. The menu typically contains
|
|
366
|
+
* available CRUD operations for the item.
|
|
367
|
+
*
|
|
368
|
+
* @param {Event} event - The event that triggered the action menu request
|
|
369
|
+
* @return {void}
|
|
370
|
+
*
|
|
371
|
+
* @mermaid
|
|
372
|
+
* sequenceDiagram
|
|
373
|
+
* participant U as User
|
|
374
|
+
* participant L as ListItemComponent
|
|
375
|
+
* participant P as Popover
|
|
376
|
+
* participant A as Accessibility
|
|
377
|
+
*
|
|
378
|
+
* U->>L: Trigger action menu (long press/right-click)
|
|
379
|
+
* L->>L: stopPropagation()
|
|
380
|
+
* L->>A: removeFocusTrap()
|
|
381
|
+
* L->>P: Set event reference
|
|
382
|
+
* L->>L: actionMenuOpen = true
|
|
383
|
+
* L->>P: Display popover with actions
|
|
384
|
+
*
|
|
385
|
+
* @memberOf ListItemComponent
|
|
386
|
+
*/
|
|
387
|
+
presentActionsMenu(event: Event): void;
|
|
388
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ListItemComponent, never>;
|
|
389
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ListItemComponent, "ngx-decaf-list-item", never, { "lines": { "alias": "lines"; "required": false; }; "item": { "alias": "item"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconSlot": { "alias": "iconSlot"; "required": false; }; "button": { "alias": "button"; "required": false; }; "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "info": { "alias": "info"; "required": false; }; "subinfo": { "alias": "subinfo"; "required": false; }; }, { "clickEvent": "clickEvent"; }, never, ["[slot='end']"], true, never>;
|
|
390
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { NgxBaseComponent } from 'src/lib/engine/NgxBaseComponent';
|
|
3
|
+
import { KeyValue, StringOrBoolean } from 'src/lib/engine';
|
|
4
|
+
import { PaginationCustomEvent } from './constants';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/**
|
|
7
|
+
* @description A pagination component for navigating through multiple pages of content.
|
|
8
|
+
* @summary This component provides a user interface for paginated content navigation,
|
|
9
|
+
* displaying page numbers and navigation controls. It supports customizable page counts,
|
|
10
|
+
* current page tracking, and emits events when users navigate between pages.
|
|
11
|
+
*
|
|
12
|
+
* The component intelligently handles large numbers of pages by showing a subset of page
|
|
13
|
+
* numbers with ellipses to indicate skipped pages, ensuring the UI remains clean and usable
|
|
14
|
+
* even with many pages.
|
|
15
|
+
*
|
|
16
|
+
* @mermaid
|
|
17
|
+
* sequenceDiagram
|
|
18
|
+
* participant U as User
|
|
19
|
+
* participant P as PaginationComponent
|
|
20
|
+
* participant E as External Component
|
|
21
|
+
*
|
|
22
|
+
* U->>P: Click page number
|
|
23
|
+
* P->>P: navigate(page)
|
|
24
|
+
* P->>P: handleClick(direction, page)
|
|
25
|
+
* P->>E: Emit clickEvent with PaginationCustomEvent
|
|
26
|
+
*
|
|
27
|
+
* U->>P: Click next button
|
|
28
|
+
* P->>P: next()
|
|
29
|
+
* P->>P: handleClick('next')
|
|
30
|
+
* P->>E: Emit clickEvent with PaginationCustomEvent
|
|
31
|
+
*
|
|
32
|
+
* U->>P: Click previous button
|
|
33
|
+
* P->>P: previous()
|
|
34
|
+
* P->>P: handleClick('previous')
|
|
35
|
+
* P->>E: Emit clickEvent with PaginationCustomEvent
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <ngx-decaf-pagination
|
|
39
|
+
* [pages]="10"
|
|
40
|
+
* [current]="3"
|
|
41
|
+
* (clickEvent)="handlePageChange($event)">
|
|
42
|
+
* </ngx-decaf-pagination>
|
|
43
|
+
*
|
|
44
|
+
* @extends {NgxBaseComponent}
|
|
45
|
+
* @implements {OnInit}
|
|
46
|
+
*/
|
|
47
|
+
export declare class PaginationComponent extends NgxBaseComponent implements OnInit {
|
|
48
|
+
/**
|
|
49
|
+
* @description Controls whether the component uses translation services.
|
|
50
|
+
* @summary When set to true, the component will attempt to use translation services
|
|
51
|
+
* for any text content. This allows for internationalization of the pagination component.
|
|
52
|
+
*
|
|
53
|
+
* @type {StringOrBoolean}
|
|
54
|
+
* @default true
|
|
55
|
+
* @memberOf PaginationComponent
|
|
56
|
+
*/
|
|
57
|
+
translatable: StringOrBoolean;
|
|
58
|
+
/**
|
|
59
|
+
* @description The total number of pages to display in the pagination component.
|
|
60
|
+
* @summary Specifies the total number of pages available for navigation. This is a required
|
|
61
|
+
* input that determines how many page numbers will be generated and displayed.
|
|
62
|
+
*
|
|
63
|
+
* @type {number}
|
|
64
|
+
* @required
|
|
65
|
+
* @memberOf PaginationComponent
|
|
66
|
+
*/
|
|
67
|
+
totalPages: number;
|
|
68
|
+
/**
|
|
69
|
+
* @description The currently active page number.
|
|
70
|
+
* @summary Specifies which page is currently active or selected. This value is used
|
|
71
|
+
* to highlight the current page in the UI and as a reference point for navigation.
|
|
72
|
+
*
|
|
73
|
+
* @type {number}
|
|
74
|
+
* @default 1
|
|
75
|
+
* @memberOf PaginationComponent
|
|
76
|
+
*/
|
|
77
|
+
current: number;
|
|
78
|
+
/**
|
|
79
|
+
* @description Array of page objects for rendering in the template.
|
|
80
|
+
* @summary Contains the processed page data used for rendering the pagination UI.
|
|
81
|
+
* Each object includes an index (page number) and text representation.
|
|
82
|
+
*
|
|
83
|
+
* @type {KeyValue[]}
|
|
84
|
+
* @memberOf PaginationComponent
|
|
85
|
+
*/
|
|
86
|
+
pages: KeyValue[];
|
|
87
|
+
/**
|
|
88
|
+
* @description The last page number in the pagination.
|
|
89
|
+
* @summary Stores the number of the last page for boundary checking during navigation.
|
|
90
|
+
*
|
|
91
|
+
* @type {number}
|
|
92
|
+
* @memberOf PaginationComponent
|
|
93
|
+
*/
|
|
94
|
+
last: number;
|
|
95
|
+
/**
|
|
96
|
+
* @description Event emitter for pagination navigation events.
|
|
97
|
+
* @summary Emits a custom event when users navigate between pages, either by clicking
|
|
98
|
+
* on page numbers or using the next/previous buttons. The event contains information
|
|
99
|
+
* about the navigation direction and the target page number.
|
|
100
|
+
*
|
|
101
|
+
* @type {EventEmitter<PaginationCustomEvent>}
|
|
102
|
+
* @memberOf PaginationComponent
|
|
103
|
+
*/
|
|
104
|
+
clickEvent: EventEmitter<PaginationCustomEvent>;
|
|
105
|
+
/**
|
|
106
|
+
* @constructor
|
|
107
|
+
* @description Initializes a new instance of the PaginationComponent.
|
|
108
|
+
* Calls the parent constructor with the component name for generate base locale string.
|
|
109
|
+
*/
|
|
110
|
+
constructor();
|
|
111
|
+
/**
|
|
112
|
+
* @description Initializes the component after Angular sets the input properties.
|
|
113
|
+
* @summary Sets up the component by initializing the locale settings based on the
|
|
114
|
+
* translatable property, generating the page numbers based on the total pages and
|
|
115
|
+
* current page, and storing the last page number for boundary checking.
|
|
116
|
+
*
|
|
117
|
+
* @mermaid
|
|
118
|
+
* sequenceDiagram
|
|
119
|
+
* participant A as Angular Lifecycle
|
|
120
|
+
* participant P as PaginationComponent
|
|
121
|
+
*
|
|
122
|
+
* A->>P: ngOnInit()
|
|
123
|
+
* P->>P: getLocale(translatable)
|
|
124
|
+
* P->>P: Set locale
|
|
125
|
+
* P->>P: getPages(data, current)
|
|
126
|
+
* P->>P: Set pages array
|
|
127
|
+
* P->>P: Set last page number
|
|
128
|
+
*
|
|
129
|
+
* @returns {void}
|
|
130
|
+
* @memberOf PaginationComponent
|
|
131
|
+
*/
|
|
132
|
+
ngOnInit(): void;
|
|
133
|
+
/**
|
|
134
|
+
* @description Handles click events on pagination controls.
|
|
135
|
+
* @summary Processes user interactions with the pagination component, updating the
|
|
136
|
+
* current page if specified and emitting an event with navigation details. This method
|
|
137
|
+
* is called when users click on page numbers or navigation buttons.
|
|
138
|
+
*
|
|
139
|
+
* @param {('next' | 'previous')} direction - The direction of navigation
|
|
140
|
+
* @param {number} [page] - Optional page number to navigate to directly
|
|
141
|
+
* @returns {void}
|
|
142
|
+
*
|
|
143
|
+
* @mermaid
|
|
144
|
+
* sequenceDiagram
|
|
145
|
+
* participant U as User
|
|
146
|
+
* participant P as PaginationComponent
|
|
147
|
+
* participant E as External Component
|
|
148
|
+
*
|
|
149
|
+
* U->>P: Click pagination control
|
|
150
|
+
* P->>P: handleClick(direction, page?)
|
|
151
|
+
* alt page is provided
|
|
152
|
+
* P->>P: Update current page
|
|
153
|
+
* end
|
|
154
|
+
* P->>E: Emit clickEvent with direction and page
|
|
155
|
+
*
|
|
156
|
+
* @memberOf PaginationComponent
|
|
157
|
+
*/
|
|
158
|
+
handleClick(direction: 'next' | 'previous', page?: number): void;
|
|
159
|
+
/**
|
|
160
|
+
* @description Generates the array of page objects for display.
|
|
161
|
+
* @summary Creates an array of page objects based on the total number of pages and
|
|
162
|
+
* the current page. For small page counts (≤5), all pages are shown. For larger page
|
|
163
|
+
* counts, a subset is shown with ellipses to indicate skipped pages. This ensures
|
|
164
|
+
* the pagination UI remains clean and usable even with many pages.
|
|
165
|
+
*
|
|
166
|
+
* @param {number} total - The total number of pages
|
|
167
|
+
* @param {number} [current] - The current active page (defaults to this.current)
|
|
168
|
+
* @returns {KeyValue[]} Array of page objects with index and text properties
|
|
169
|
+
*
|
|
170
|
+
* @mermaid
|
|
171
|
+
* flowchart TD
|
|
172
|
+
* A[Start] --> B{total <= 5?}
|
|
173
|
+
* B -->|Yes| C[Show all pages]
|
|
174
|
+
* B -->|No| D[Show first page]
|
|
175
|
+
* D --> E[Show last pages]
|
|
176
|
+
* E --> F[Add ellipses for skipped pages]
|
|
177
|
+
* C --> G[Return pages array]
|
|
178
|
+
* F --> G
|
|
179
|
+
*
|
|
180
|
+
* @memberOf PaginationComponent
|
|
181
|
+
*/
|
|
182
|
+
getPages(total: number, current?: number): KeyValue[];
|
|
183
|
+
/**
|
|
184
|
+
* @description Gets the current active page number.
|
|
185
|
+
* @summary Returns the current page number that is active in the pagination component.
|
|
186
|
+
* This method provides a way to access the current page state from outside the component.
|
|
187
|
+
*
|
|
188
|
+
* @returns {number} The current page number
|
|
189
|
+
* @memberOf PaginationComponent
|
|
190
|
+
*/
|
|
191
|
+
getCurrent(): number;
|
|
192
|
+
/**
|
|
193
|
+
* @description Navigates to the next page.
|
|
194
|
+
* @summary Increments the current page number if not at the last page and triggers
|
|
195
|
+
* the click event handler with 'next' direction. This method is typically called
|
|
196
|
+
* when the user clicks on the "next" button in the pagination UI.
|
|
197
|
+
*
|
|
198
|
+
* @returns {void}
|
|
199
|
+
*
|
|
200
|
+
* @mermaid
|
|
201
|
+
* sequenceDiagram
|
|
202
|
+
* participant U as User
|
|
203
|
+
* participant P as PaginationComponent
|
|
204
|
+
*
|
|
205
|
+
* U->>P: Click next button
|
|
206
|
+
* P->>P: next()
|
|
207
|
+
* alt page <= max pages
|
|
208
|
+
* P->>P: Increment current page
|
|
209
|
+
* P->>P: handleClick('next')
|
|
210
|
+
* end
|
|
211
|
+
*
|
|
212
|
+
* @memberOf PaginationComponent
|
|
213
|
+
*/
|
|
214
|
+
next(): void;
|
|
215
|
+
/**
|
|
216
|
+
* @description Navigates to the previous page.
|
|
217
|
+
* @summary Decrements the current page number if not at the first page and triggers
|
|
218
|
+
* the click event handler with 'previous' direction. This method is typically called
|
|
219
|
+
* when the user clicks on the "previous" button in the pagination UI.
|
|
220
|
+
*
|
|
221
|
+
* @returns {void}
|
|
222
|
+
*
|
|
223
|
+
* @mermaid
|
|
224
|
+
* sequenceDiagram
|
|
225
|
+
* participant U as User
|
|
226
|
+
* participant P as PaginationComponent
|
|
227
|
+
*
|
|
228
|
+
* U->>P: Click previous button
|
|
229
|
+
* P->>P: previous()
|
|
230
|
+
* alt page > 0
|
|
231
|
+
* P->>P: Decrement current page
|
|
232
|
+
* P->>P: handleClick('previous')
|
|
233
|
+
* end
|
|
234
|
+
*
|
|
235
|
+
* @memberOf PaginationComponent
|
|
236
|
+
*/
|
|
237
|
+
previous(): void;
|
|
238
|
+
/**
|
|
239
|
+
* @description Navigates to a specific page number.
|
|
240
|
+
* @summary Updates the current page to the specified page number and triggers
|
|
241
|
+
* the click event handler with the appropriate direction. This method is typically
|
|
242
|
+
* called when the user clicks directly on a page number in the pagination UI.
|
|
243
|
+
*
|
|
244
|
+
* @param {number | null} page - The page number to navigate to
|
|
245
|
+
* @returns {void}
|
|
246
|
+
*
|
|
247
|
+
* @mermaid
|
|
248
|
+
* sequenceDiagram
|
|
249
|
+
* participant U as User
|
|
250
|
+
* participant P as PaginationComponent
|
|
251
|
+
*
|
|
252
|
+
* U->>P: Click page number
|
|
253
|
+
* P->>P: navigate(page)
|
|
254
|
+
* alt page is not null and different from current
|
|
255
|
+
* P->>P: Determine direction (next/previous)
|
|
256
|
+
* P->>P: handleClick(direction, page)
|
|
257
|
+
* end
|
|
258
|
+
*
|
|
259
|
+
* @memberOf PaginationComponent
|
|
260
|
+
*/
|
|
261
|
+
navigate(page: number | null): void;
|
|
262
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PaginationComponent, never>;
|
|
263
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<PaginationComponent, "ngx-decaf-pagination", never, { "totalPages": { "alias": "totalPages"; "required": true; }; "current": { "alias": "current"; "required": false; }; }, { "clickEvent": "clickEvent"; }, never, never, true, never>;
|
|
264
|
+
}
|