@limetech/lime-web-components 6.4.1 → 6.5.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/CHANGELOG.md +8 -0
- package/dist/action/action.d.ts +305 -13
- package/dist/action/action.d.ts.map +1 -1
- package/dist/application/decorators/application.d.ts +57 -3
- package/dist/application/decorators/application.d.ts.map +1 -1
- package/dist/application/decorators/session.d.ts +44 -3
- package/dist/application/decorators/session.d.ts.map +1 -1
- package/dist/application/decorators/user.d.ts +47 -3
- package/dist/application/decorators/user.d.ts.map +1 -1
- package/dist/application/repository.d.ts +102 -5
- package/dist/application/repository.d.ts.map +1 -1
- package/dist/application/session.d.ts +105 -15
- package/dist/application/session.d.ts.map +1 -1
- package/dist/application/user.d.ts +122 -13
- package/dist/application/user.d.ts.map +1 -1
- package/dist/commandbus/commandbus.d.ts +364 -23
- package/dist/commandbus/commandbus.d.ts.map +1 -1
- package/dist/conditionregistry/conditionregistry.d.ts +310 -27
- package/dist/conditionregistry/conditionregistry.d.ts.map +1 -1
- package/dist/config/decorator.d.ts +50 -3
- package/dist/config/decorator.d.ts.map +1 -1
- package/dist/config/repository.d.ts +131 -10
- package/dist/config/repository.d.ts.map +1 -1
- package/dist/core/context.d.ts +94 -4
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/lime-web-component.d.ts +59 -3
- package/dist/core/lime-web-component.d.ts.map +1 -1
- package/dist/core/metadata.d.ts +113 -13
- package/dist/core/metadata.d.ts.map +1 -1
- package/dist/core/platform.d.ts +175 -14
- package/dist/core/platform.d.ts.map +1 -1
- package/dist/core/state.d.ts +138 -14
- package/dist/core/state.d.ts.map +1 -1
- package/dist/datetimeformatter/datetimeformatter.d.ts +97 -34
- package/dist/datetimeformatter/datetimeformatter.d.ts.map +1 -1
- package/dist/device/decorator.d.ts +56 -4
- package/dist/device/decorator.d.ts.map +1 -1
- package/dist/device/device.d.ts +51 -6
- package/dist/device/device.d.ts.map +1 -1
- package/dist/dialog/dialog.d.ts +155 -19
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/limeobject/file.d.ts +6 -0
- package/dist/limeobject/file.d.ts.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [6.5.0](https://github.com/Lundalogik/lime-web-components/compare/v6.4.1...v6.5.0) (2025-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **limeobject/file:** add id to LimeFile interface ([dda4484](https://github.com/Lundalogik/lime-web-components/commit/dda448437193f72d3591eae9b20212d23f5e361e))
|
|
8
|
+
|
|
1
9
|
## [6.4.1](https://github.com/Lundalogik/lime-web-components/compare/v6.4.0...v6.4.1) (2025-10-20)
|
|
2
10
|
|
|
3
11
|
|
package/dist/action/action.d.ts
CHANGED
|
@@ -2,52 +2,344 @@ import { AnyCommand, LimeObjectBulkCommand, LimeObjectCommand } from '../command
|
|
|
2
2
|
import { Condition } from '../conditionregistry';
|
|
3
3
|
import { Icon } from '../core';
|
|
4
4
|
/**
|
|
5
|
-
* Represents
|
|
5
|
+
* Represents a user-triggerable action that can be displayed in various UI contexts.
|
|
6
|
+
*
|
|
7
|
+
* Actions are the primary way to expose functionality to users through the UI.
|
|
8
|
+
* They can appear as:
|
|
9
|
+
* - Toolbar buttons
|
|
10
|
+
* - Dropdown menu options
|
|
11
|
+
* - Quick action buttons
|
|
12
|
+
*
|
|
13
|
+
* Each action wraps a command that executes when the action is triggered.
|
|
14
|
+
* Actions can be conditionally shown or hidden using {@link Condition}s, and they
|
|
15
|
+
* support rich metadata like icons, labels, and descriptions for better UX.
|
|
16
|
+
*
|
|
17
|
+
* The generic type parameter `T` allows you to specify the exact command type,
|
|
18
|
+
* enabling type-safe action definitions for specific contexts like single objects
|
|
19
|
+
* or bulk operations.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* Basic action with icon and label
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const actions = [
|
|
25
|
+
* {
|
|
26
|
+
* label: 'Save',
|
|
27
|
+
* icon: 'save',
|
|
28
|
+
* command: new SaveRecordCommand()
|
|
29
|
+
* },
|
|
30
|
+
* {
|
|
31
|
+
* label: 'Delete',
|
|
32
|
+
* icon: 'trash',
|
|
33
|
+
* command: new DeleteRecordCommand()
|
|
34
|
+
* }
|
|
35
|
+
* ];
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* Conditional action with icon-only display
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const canSendEmail = {
|
|
42
|
+
* id: 'contact.can-send-email',
|
|
43
|
+
* type: 'limeobject',
|
|
44
|
+
* evaluate: (contact) => contact.email && contact.email.length > 0
|
|
45
|
+
* };
|
|
46
|
+
*
|
|
47
|
+
* const sendEmailAction = {
|
|
48
|
+
* label: 'Send Email',
|
|
49
|
+
* icon: 'envelope',
|
|
50
|
+
* hideLabel: true,
|
|
51
|
+
* command: new SendEmailCommand(),
|
|
52
|
+
* condition: canSendEmail
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* Action with description and disabled state
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const exportAction = {
|
|
60
|
+
* label: 'Export to Excel',
|
|
61
|
+
* description: 'Download this record as an Excel spreadsheet',
|
|
62
|
+
* icon: 'file-excel',
|
|
63
|
+
* command: new ExportExcelCommand(),
|
|
64
|
+
* disabled: !object || !object.id
|
|
65
|
+
* };
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @see {@link LimeObjectAction} for single-object actions
|
|
69
|
+
* @see {@link LimeObjectBulkAction} for bulk actions
|
|
70
|
+
* @see {@link AnyCommand} for command types
|
|
71
|
+
* @see {@link Condition} for conditional visibility
|
|
72
|
+
*
|
|
6
73
|
* @beta
|
|
7
74
|
* @group Actions
|
|
8
75
|
*/
|
|
9
76
|
export interface Action<T extends AnyCommand = AnyCommand> {
|
|
10
77
|
/**
|
|
11
|
-
* The command to execute when the action is activated
|
|
78
|
+
* The command to execute when the action is activated.
|
|
79
|
+
*
|
|
80
|
+
* This command will be dispatched to the {@link CommandBus} when the user
|
|
81
|
+
* triggers the action. The command type determines what operation will be
|
|
82
|
+
* performed (e.g., save, delete, export, send email).
|
|
83
|
+
*
|
|
84
|
+
* @see {@link AnyCommand}
|
|
85
|
+
* @see {@link LimeObjectCommand}
|
|
86
|
+
* @see {@link LimeObjectBulkCommand}
|
|
12
87
|
*/
|
|
13
88
|
command: T;
|
|
14
89
|
/**
|
|
15
|
-
*
|
|
90
|
+
* Optional condition that determines whether the action is available.
|
|
91
|
+
*
|
|
92
|
+
* If provided, the condition's evaluate function will be called to determine
|
|
93
|
+
* if the action should be shown or enabled. If the condition evaluates to
|
|
94
|
+
* `false`, the action is typically hidden from the UI.
|
|
95
|
+
*
|
|
96
|
+
* This is particularly useful for:
|
|
97
|
+
* - Showing actions only for objects in specific states
|
|
98
|
+
* - Permission-based action visibility
|
|
99
|
+
* - Context-dependent action availability
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const canDelete: LimeObjectCondition = {
|
|
104
|
+
* id: 'record.can-delete',
|
|
105
|
+
* type: 'limeobject',
|
|
106
|
+
* evaluate: (obj) => !obj.locked
|
|
107
|
+
* };
|
|
108
|
+
*
|
|
109
|
+
* const deleteAction: LimeObjectAction = {
|
|
110
|
+
* label: 'Delete',
|
|
111
|
+
* command: new DeleteObjectCommand(),
|
|
112
|
+
* condition: canDelete
|
|
113
|
+
* };
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @see {@link Condition}
|
|
16
117
|
*/
|
|
17
118
|
condition?: Condition;
|
|
18
119
|
/**
|
|
19
|
-
* Icon
|
|
120
|
+
* Icon to display with the action.
|
|
121
|
+
*
|
|
122
|
+
* Can be either a string referencing an icon name from the platform's icon
|
|
123
|
+
* library, or an {@link Icon} object with additional properties like color.
|
|
124
|
+
*
|
|
125
|
+
* Icons help users quickly identify actions and improve visual scannability
|
|
126
|
+
* of action menus and toolbars.
|
|
127
|
+
*
|
|
128
|
+
* @see {@link Icon}
|
|
20
129
|
*/
|
|
21
130
|
icon?: string | Icon;
|
|
22
131
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
132
|
+
* Controls whether the action's label should be hidden in the UI.
|
|
133
|
+
*
|
|
134
|
+
* When `true`, only the icon is displayed, creating a more compact interface.
|
|
135
|
+
* However, the label should still be provided for:
|
|
136
|
+
* - Accessibility (screen readers)
|
|
137
|
+
* - Tooltips on hover
|
|
138
|
+
* - Alternative display contexts (e.g., dropdown menus)
|
|
139
|
+
*
|
|
140
|
+
* Icon-only actions work best in toolbars where space is limited and icons
|
|
141
|
+
* are easily recognizable.
|
|
26
142
|
*/
|
|
27
143
|
hideLabel?: boolean;
|
|
28
144
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
145
|
+
* Display label for the action.
|
|
146
|
+
*
|
|
147
|
+
* This text is shown to the user in menus, buttons, or tooltips. The label
|
|
148
|
+
* is automatically translated using the platform's {@link Translator} service,
|
|
149
|
+
* so you should provide translation keys rather than hardcoded strings.
|
|
150
|
+
*
|
|
151
|
+
* Even if `hideLabel` is true, you should still provide a label for
|
|
152
|
+
* accessibility and alternative display contexts.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link Translator}
|
|
31
155
|
*/
|
|
32
156
|
label?: string;
|
|
33
157
|
/**
|
|
34
|
-
* Additional
|
|
158
|
+
* Additional descriptive text explaining what the action does.
|
|
159
|
+
*
|
|
160
|
+
* Descriptions provide more context than labels alone and are typically
|
|
161
|
+
* displayed in:
|
|
162
|
+
* - Tooltips on hover
|
|
163
|
+
* - Help text in configuration dialogs
|
|
164
|
+
* - Extended menu descriptions
|
|
165
|
+
*
|
|
166
|
+
* Use descriptions to clarify the action's purpose or any side effects.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* {
|
|
171
|
+
* label: 'Export to Excel',
|
|
172
|
+
* description: 'Download all selected records as an Excel spreadsheet',
|
|
173
|
+
* command: { name: 'export-excel' }
|
|
174
|
+
* }
|
|
175
|
+
* ```
|
|
35
176
|
*/
|
|
36
177
|
description?: string;
|
|
37
178
|
/**
|
|
38
|
-
*
|
|
179
|
+
* Controls whether the action is disabled (grayed out but visible).
|
|
180
|
+
*
|
|
181
|
+
* When `true`, the action is shown in the UI but cannot be triggered.
|
|
182
|
+
* This is different from hiding the action entirely (using `condition`).
|
|
183
|
+
*
|
|
184
|
+
* Use disabled state to:
|
|
185
|
+
* - Indicate that an action exists but is temporarily unavailable
|
|
186
|
+
* - Show what actions would be available in different contexts
|
|
187
|
+
* - Provide better user feedback than simply hiding the action
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* {
|
|
192
|
+
* label: 'Save',
|
|
193
|
+
* icon: 'save',
|
|
194
|
+
* command: new SaveCommand(),
|
|
195
|
+
* disabled: !this.hasUnsavedChanges
|
|
196
|
+
* }
|
|
197
|
+
* ```
|
|
39
198
|
*/
|
|
40
199
|
disabled?: boolean;
|
|
41
200
|
}
|
|
42
201
|
/**
|
|
43
|
-
*
|
|
202
|
+
* Specialized action type for operations on a single {@link LimeObject}.
|
|
203
|
+
*
|
|
204
|
+
* LimeObject actions are used in contexts where the user interacts with a single
|
|
205
|
+
* business object instance (deal, contact, company, etc.).
|
|
206
|
+
*
|
|
207
|
+
* The command associated with this action type is {@link LimeObjectCommand},
|
|
208
|
+
* which provides type-safe access to object-specific payload properties.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* Actions for a contact detail view
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const sendEmailCommand = new SendEmailCommand();
|
|
214
|
+
* sendEmailCommand.context = { limetype: 'contact', id: contact.id };
|
|
215
|
+
*
|
|
216
|
+
* const scheduleMeetingCommand = new ScheduleMeetingCommand();
|
|
217
|
+
* scheduleMeetingCommand.context = { limetype: 'contact', id: contact.id };
|
|
218
|
+
*
|
|
219
|
+
* const addToCampaignCommand = new AddToCampaignCommand();
|
|
220
|
+
* addToCampaignCommand.context = { limetype: 'contact', id: contact.id };
|
|
221
|
+
*
|
|
222
|
+
* const actions = [
|
|
223
|
+
* {
|
|
224
|
+
* label: 'Send Email',
|
|
225
|
+
* icon: 'envelope',
|
|
226
|
+
* command: sendEmailCommand
|
|
227
|
+
* },
|
|
228
|
+
* {
|
|
229
|
+
* label: 'Schedule Meeting',
|
|
230
|
+
* icon: 'calendar',
|
|
231
|
+
* command: scheduleMeetingCommand
|
|
232
|
+
* },
|
|
233
|
+
* {
|
|
234
|
+
* label: 'Add to Campaign',
|
|
235
|
+
* icon: 'bullhorn',
|
|
236
|
+
* command: addToCampaignCommand
|
|
237
|
+
* }
|
|
238
|
+
* ];
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* Conditional action based on object state
|
|
243
|
+
* ```typescript
|
|
244
|
+
* const isDealOpen = {
|
|
245
|
+
* id: 'deal.is-open',
|
|
246
|
+
* type: 'limeobject',
|
|
247
|
+
* evaluate: (deal) => deal.dealstatus !== 'won' && deal.dealstatus !== 'lost'
|
|
248
|
+
* };
|
|
249
|
+
*
|
|
250
|
+
* const closeDealCommand = new CloseDealCommand();
|
|
251
|
+
* closeDealCommand.context = { limetype: 'deal', id: dealId };
|
|
252
|
+
*
|
|
253
|
+
* const closeDealAction = {
|
|
254
|
+
* label: 'Close Deal',
|
|
255
|
+
* icon: 'check-circle',
|
|
256
|
+
* description: 'Mark this deal as won or lost',
|
|
257
|
+
* command: closeDealCommand,
|
|
258
|
+
* condition: isDealOpen
|
|
259
|
+
* };
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @see {@link Action} for the base action type
|
|
263
|
+
* @see {@link LimeObjectCommand} for the command type
|
|
264
|
+
* @see {@link LimeObject} for the object structure
|
|
44
265
|
*
|
|
45
266
|
* @beta
|
|
46
267
|
* @group Actions
|
|
47
268
|
*/
|
|
48
269
|
export type LimeObjectAction = Action<LimeObjectCommand>;
|
|
49
270
|
/**
|
|
50
|
-
*
|
|
271
|
+
* Specialized action type for bulk operations on multiple {@link LimeObject}s.
|
|
272
|
+
*
|
|
273
|
+
* Bulk actions are used when the user selects multiple objects and wants to
|
|
274
|
+
* perform the same operation on all of them. These actions typically appear in:
|
|
275
|
+
* - List view toolbars (when items are selected)
|
|
276
|
+
* - Bulk action menus
|
|
277
|
+
* - Selection context menus
|
|
278
|
+
*
|
|
279
|
+
* The command associated with this action type is {@link LimeObjectBulkCommand},
|
|
280
|
+
* which uses a filter expression to specify which objects to operate on.
|
|
281
|
+
*
|
|
282
|
+
* Common use cases include:
|
|
283
|
+
* - Mass updates (change status, assign owner)
|
|
284
|
+
* - Bulk exports (download selected records)
|
|
285
|
+
* - Batch operations (send emails, delete records)
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* Bulk actions for a list view
|
|
289
|
+
* ```typescript
|
|
290
|
+
* const exportCommand = new BulkExportCommand();
|
|
291
|
+
* exportCommand.context = { limetype: 'contact' };
|
|
292
|
+
* exportCommand.filter = selectedObjectsFilter;
|
|
293
|
+
*
|
|
294
|
+
* const deleteCommand = new BulkDeleteCommand();
|
|
295
|
+
* deleteCommand.context = { limetype: 'contact' };
|
|
296
|
+
* deleteCommand.filter = selectedObjectsFilter;
|
|
297
|
+
*
|
|
298
|
+
* const sendEmailCommand = new BulkSendEmailCommand();
|
|
299
|
+
* sendEmailCommand.context = { limetype: 'contact' };
|
|
300
|
+
* sendEmailCommand.filter = selectedObjectsFilter;
|
|
301
|
+
*
|
|
302
|
+
* const bulkActions = [
|
|
303
|
+
* {
|
|
304
|
+
* label: 'Export to Excel',
|
|
305
|
+
* icon: 'file-excel',
|
|
306
|
+
* description: 'Download selected records as Excel spreadsheet',
|
|
307
|
+
* command: exportCommand
|
|
308
|
+
* },
|
|
309
|
+
* {
|
|
310
|
+
* label: 'Delete Selected',
|
|
311
|
+
* icon: 'trash',
|
|
312
|
+
* description: 'Permanently delete all selected records',
|
|
313
|
+
* command: deleteCommand
|
|
314
|
+
* },
|
|
315
|
+
* {
|
|
316
|
+
* label: 'Send Email',
|
|
317
|
+
* icon: 'envelope',
|
|
318
|
+
* description: 'Send email to all selected contacts',
|
|
319
|
+
* command: sendEmailCommand
|
|
320
|
+
* }
|
|
321
|
+
* ];
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* Conditional bulk action with minimum selection
|
|
326
|
+
* ```typescript
|
|
327
|
+
* const updateStatusCommand = new BulkUpdateStatusCommand();
|
|
328
|
+
* updateStatusCommand.context = { limetype: 'deal' };
|
|
329
|
+
* updateStatusCommand.filter = selectedObjectsFilter;
|
|
330
|
+
*
|
|
331
|
+
* const bulkUpdateAction = {
|
|
332
|
+
* label: 'Update Status',
|
|
333
|
+
* icon: 'edit',
|
|
334
|
+
* description: 'Change status for all selected records',
|
|
335
|
+
* command: updateStatusCommand,
|
|
336
|
+
* disabled: !selectedObjectsFilter
|
|
337
|
+
* };
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @see {@link Action} for the base action type
|
|
341
|
+
* @see {@link LimeObjectBulkCommand} for the command type
|
|
342
|
+
* @see {@link LimeObject} for the object structure
|
|
51
343
|
*
|
|
52
344
|
* @beta
|
|
53
345
|
* @group Actions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/action/action.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IACrD;;;;;;;;;;OAUG;IACH,OAAO,EAAE,CAAC,CAAC;IAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -1,9 +1,63 @@
|
|
|
1
1
|
import { StateOptions } from '../../core';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Decorator that subscribes to the application name from the {@link ApplicationRepository}.
|
|
4
|
+
*
|
|
5
|
+
* This decorator automatically updates the decorated property whenever the application
|
|
6
|
+
* name changes in the platform. It's the recommended approach over manual subscriptions
|
|
7
|
+
* as it handles subscription lifecycle automatically.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Configuration for state transformation and filtering via {@link StateOptions}
|
|
10
|
+
* @returns A PropertyDecorator that sets up automatic subscription to application name
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Subscribes to: {@link ApplicationRepository}
|
|
14
|
+
*
|
|
15
|
+
* Updates: The decorated property with the application name (`string`)
|
|
16
|
+
*
|
|
17
|
+
* Lifecycle: Automatically subscribes in `connectedCallback` and
|
|
18
|
+
* unsubscribes in `disconnectedCallback` of the component.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* @State()
|
|
23
|
+
* @SelectApplicationName()
|
|
24
|
+
* private appName: string;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Transform the application name
|
|
30
|
+
* @State()
|
|
31
|
+
* @SelectApplicationName({
|
|
32
|
+
* map: [(name) => name?.toUpperCase()]
|
|
33
|
+
* })
|
|
34
|
+
* private appNameUppercase: string;
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Only update when name is defined
|
|
40
|
+
* @State()
|
|
41
|
+
* @SelectApplicationName({
|
|
42
|
+
* filter: [(name) => name !== null && name !== undefined]
|
|
43
|
+
* })
|
|
44
|
+
* private validAppName: string;
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Combine map and filter for complex transformations
|
|
50
|
+
* @State()
|
|
51
|
+
* @SelectApplicationName({
|
|
52
|
+
* map: [
|
|
53
|
+
* (name) => name?.toLowerCase(),
|
|
54
|
+
* (name) => `${name} CRM`
|
|
55
|
+
* ],
|
|
56
|
+
* filter: [(formattedName) => formattedName?.length > 4]
|
|
57
|
+
* })
|
|
58
|
+
* private brandedName: string;
|
|
59
|
+
* ```
|
|
4
60
|
*
|
|
5
|
-
* @param options - options for the state selector
|
|
6
|
-
* @returns state decorator
|
|
7
61
|
* @public
|
|
8
62
|
* @group Application
|
|
9
63
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAGpB
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAGpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,qBAAqB,CACjC,OAAO,GAAE,YAAiB,GAC3B,iBAAiB,CAOnB"}
|
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
import { StateOptions } from '../../core';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Decorator that subscribes to the application session from the {@link ApplicationRepository}.
|
|
4
|
+
*
|
|
5
|
+
* This decorator automatically updates the decorated property whenever the session
|
|
6
|
+
* changes in the platform. The session contains authentication and authorization
|
|
7
|
+
* information. It's the recommended approach over manual subscriptions as it handles
|
|
8
|
+
* subscription lifecycle automatically.
|
|
9
|
+
*
|
|
10
|
+
* @param options - Configuration for state transformation and filtering via {@link StateOptions}
|
|
11
|
+
* @returns A PropertyDecorator that sets up automatic subscription to the session
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Subscribes to: {@link ApplicationRepository}
|
|
15
|
+
*
|
|
16
|
+
* Updates: The decorated property with the {@link Session} object
|
|
17
|
+
*
|
|
18
|
+
* Lifecycle: Automatically subscribes in `connectedCallback` and
|
|
19
|
+
* unsubscribes in `disconnectedCallback` of the component.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* @State()
|
|
24
|
+
* @SelectSession()
|
|
25
|
+
* private session: Session;
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Extract specific session property
|
|
31
|
+
* @State()
|
|
32
|
+
* @SelectSession({
|
|
33
|
+
* map: [(session) => session?.admin]
|
|
34
|
+
* })
|
|
35
|
+
* private isAdmin: boolean;
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // Filter for valid sessions only
|
|
41
|
+
* @State()
|
|
42
|
+
* @SelectSession({
|
|
43
|
+
* filter: [(session) => session !== null && session?.active === true]
|
|
44
|
+
* })
|
|
45
|
+
* private activeSession: Session;
|
|
46
|
+
* ```
|
|
4
47
|
*
|
|
5
|
-
* @param options - state decorator options
|
|
6
|
-
* @returns state decorator
|
|
7
48
|
* @public
|
|
8
49
|
* @group Application
|
|
9
50
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAIpB
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,YAAiB,GAAG,iBAAiB,CAO3E"}
|
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
import { StateOptions } from '../../core';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Decorator that subscribes to the currently logged in user from the {@link ApplicationRepository}.
|
|
4
|
+
*
|
|
5
|
+
* This decorator automatically updates the decorated property whenever the current user
|
|
6
|
+
* changes in the platform. It's the recommended approach over manual subscriptions as it
|
|
7
|
+
* handles subscription lifecycle automatically.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Configuration for state transformation and filtering via {@link StateOptions}
|
|
10
|
+
* @returns A PropertyDecorator that sets up automatic subscription to the current user
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Subscribes to: {@link ApplicationRepository}
|
|
14
|
+
*
|
|
15
|
+
* Updates: The decorated property with the {@link User} object
|
|
16
|
+
*
|
|
17
|
+
* Lifecycle: Automatically subscribes in `connectedCallback` and
|
|
18
|
+
* unsubscribes in `disconnectedCallback` of the component.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* @State()
|
|
23
|
+
* @SelectCurrentUser()
|
|
24
|
+
* private user: User;
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Extract user's full name
|
|
30
|
+
* @State()
|
|
31
|
+
* @SelectCurrentUser({
|
|
32
|
+
* map: [(user) => user?.fullname]
|
|
33
|
+
* })
|
|
34
|
+
* private userName: string;
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // Create initials with map transformations
|
|
40
|
+
* @State()
|
|
41
|
+
* @SelectCurrentUser({
|
|
42
|
+
* map: [
|
|
43
|
+
* (user) => user?.fullname,
|
|
44
|
+
* (name) => name?.split(' ').map(n => n[0]).join('').toUpperCase()
|
|
45
|
+
* ],
|
|
46
|
+
* filter: [(initials) => initials !== undefined]
|
|
47
|
+
* })
|
|
48
|
+
* private userInitials: string;
|
|
49
|
+
* ```
|
|
4
50
|
*
|
|
5
|
-
* @param options - state decorator options
|
|
6
|
-
* @returns state decorator
|
|
7
51
|
* @public
|
|
8
52
|
* @group Application
|
|
9
53
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAIpB
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/application/decorators/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,YAAY,EAEf,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,iBAAiB,CAC7B,OAAO,GAAE,YAAiB,GAC3B,iBAAiB,CAOnB"}
|