@decaf-ts/ui-decorators 0.6.20 → 0.7.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.
Files changed (108) hide show
  1. package/lib/cjs/index.js.map +1 -0
  2. package/lib/{model → cjs/model}/Renderable.js.map +1 -1
  3. package/lib/cjs/model/decorators.js.map +1 -0
  4. package/lib/cjs/model/index.js.map +1 -0
  5. package/lib/{model → cjs/model}/model.js.map +1 -1
  6. package/lib/cjs/model/overrides.js.map +1 -0
  7. package/lib/cjs/overrides/ModelBuilderExtensions.js.map +1 -0
  8. package/lib/cjs/overrides/index.js.map +1 -0
  9. package/lib/cjs/ui/DecafComponent.js.map +1 -0
  10. package/lib/cjs/ui/DecafEventHandler.js.map +1 -0
  11. package/lib/cjs/ui/DecafTranslateService.js.map +1 -0
  12. package/lib/cjs/ui/Rendering.js.map +1 -0
  13. package/lib/cjs/ui/UIValidator.js.map +1 -0
  14. package/lib/cjs/ui/constants.js.map +1 -0
  15. package/lib/cjs/ui/decorators.js.map +1 -0
  16. package/lib/cjs/ui/errors.js.map +1 -0
  17. package/lib/cjs/ui/index.js.map +1 -0
  18. package/lib/cjs/ui/interfaces.js.map +1 -0
  19. package/lib/cjs/ui/overrides.js.map +1 -0
  20. package/lib/cjs/ui/types.js.map +1 -0
  21. package/lib/cjs/ui/utils.js.map +1 -0
  22. package/lib/{ui → cjs/ui}/validator.js.map +1 -1
  23. package/package.json +12 -6
  24. package/lib/index.d.ts +0 -19
  25. package/lib/index.js.map +0 -1
  26. package/lib/model/Renderable.d.ts +0 -18
  27. package/lib/model/decorators.d.ts +0 -318
  28. package/lib/model/decorators.js.map +0 -1
  29. package/lib/model/index.d.ts +0 -4
  30. package/lib/model/index.js.map +0 -1
  31. package/lib/model/model.d.ts +0 -31
  32. package/lib/model/overrides.d.ts +0 -9
  33. package/lib/model/overrides.js.map +0 -1
  34. package/lib/overrides/ModelBuilderExtensions.d.ts +0 -16
  35. package/lib/overrides/ModelBuilderExtensions.js.map +0 -1
  36. package/lib/overrides/index.d.ts +0 -5
  37. package/lib/overrides/index.js.map +0 -1
  38. package/lib/ui/DecafComponent.d.ts +0 -293
  39. package/lib/ui/DecafComponent.js.map +0 -1
  40. package/lib/ui/DecafEventHandler.d.ts +0 -43
  41. package/lib/ui/DecafEventHandler.js.map +0 -1
  42. package/lib/ui/DecafTranslateService.d.ts +0 -5
  43. package/lib/ui/DecafTranslateService.js.map +0 -1
  44. package/lib/ui/Rendering.d.ts +0 -202
  45. package/lib/ui/Rendering.js.map +0 -1
  46. package/lib/ui/UIValidator.d.ts +0 -6
  47. package/lib/ui/UIValidator.js.map +0 -1
  48. package/lib/ui/constants.d.ts +0 -355
  49. package/lib/ui/constants.js.map +0 -1
  50. package/lib/ui/decorators.d.ts +0 -482
  51. package/lib/ui/decorators.js.map +0 -1
  52. package/lib/ui/errors.d.ts +0 -32
  53. package/lib/ui/errors.js.map +0 -1
  54. package/lib/ui/index.d.ts +0 -11
  55. package/lib/ui/index.js.map +0 -1
  56. package/lib/ui/interfaces.d.ts +0 -64
  57. package/lib/ui/interfaces.js.map +0 -1
  58. package/lib/ui/overrides.d.ts +0 -1
  59. package/lib/ui/overrides.js.map +0 -1
  60. package/lib/ui/types.d.ts +0 -186
  61. package/lib/ui/types.js.map +0 -1
  62. package/lib/ui/utils.d.ts +0 -27
  63. package/lib/ui/utils.js.map +0 -1
  64. package/lib/ui/validator.d.ts +0 -9
  65. /package/lib/{index.cjs → cjs/index.cjs} +0 -0
  66. /package/lib/{model → cjs/model}/Renderable.cjs +0 -0
  67. /package/lib/{model → cjs/model}/decorators.cjs +0 -0
  68. /package/lib/{model → cjs/model}/index.cjs +0 -0
  69. /package/lib/{model → cjs/model}/model.cjs +0 -0
  70. /package/lib/{model → cjs/model}/overrides.cjs +0 -0
  71. /package/lib/{overrides → cjs/overrides}/ModelBuilderExtensions.cjs +0 -0
  72. /package/lib/{overrides → cjs/overrides}/index.cjs +0 -0
  73. /package/lib/{ui → cjs/ui}/DecafComponent.cjs +0 -0
  74. /package/lib/{ui → cjs/ui}/DecafEventHandler.cjs +0 -0
  75. /package/lib/{ui → cjs/ui}/DecafTranslateService.cjs +0 -0
  76. /package/lib/{ui → cjs/ui}/Rendering.cjs +0 -0
  77. /package/lib/{ui → cjs/ui}/UIValidator.cjs +0 -0
  78. /package/lib/{ui → cjs/ui}/constants.cjs +0 -0
  79. /package/lib/{ui → cjs/ui}/decorators.cjs +0 -0
  80. /package/lib/{ui → cjs/ui}/errors.cjs +0 -0
  81. /package/lib/{ui → cjs/ui}/index.cjs +0 -0
  82. /package/lib/{ui → cjs/ui}/interfaces.cjs +0 -0
  83. /package/lib/{ui → cjs/ui}/overrides.cjs +0 -0
  84. /package/lib/{ui → cjs/ui}/types.cjs +0 -0
  85. /package/lib/{ui → cjs/ui}/utils.cjs +0 -0
  86. /package/lib/{ui → cjs/ui}/validator.cjs +0 -0
  87. /package/lib/{esm → types}/index.d.ts +0 -0
  88. /package/lib/{esm → types}/model/Renderable.d.ts +0 -0
  89. /package/lib/{esm → types}/model/decorators.d.ts +0 -0
  90. /package/lib/{esm → types}/model/index.d.ts +0 -0
  91. /package/lib/{esm → types}/model/model.d.ts +0 -0
  92. /package/lib/{esm → types}/model/overrides.d.ts +0 -0
  93. /package/lib/{esm → types}/overrides/ModelBuilderExtensions.d.ts +0 -0
  94. /package/lib/{esm → types}/overrides/index.d.ts +0 -0
  95. /package/lib/{esm → types}/ui/DecafComponent.d.ts +0 -0
  96. /package/lib/{esm → types}/ui/DecafEventHandler.d.ts +0 -0
  97. /package/lib/{esm → types}/ui/DecafTranslateService.d.ts +0 -0
  98. /package/lib/{esm → types}/ui/Rendering.d.ts +0 -0
  99. /package/lib/{esm → types}/ui/UIValidator.d.ts +0 -0
  100. /package/lib/{esm → types}/ui/constants.d.ts +0 -0
  101. /package/lib/{esm → types}/ui/decorators.d.ts +0 -0
  102. /package/lib/{esm → types}/ui/errors.d.ts +0 -0
  103. /package/lib/{esm → types}/ui/index.d.ts +0 -0
  104. /package/lib/{esm → types}/ui/interfaces.d.ts +0 -0
  105. /package/lib/{esm → types}/ui/overrides.d.ts +0 -0
  106. /package/lib/{esm → types}/ui/types.d.ts +0 -0
  107. /package/lib/{esm → types}/ui/utils.d.ts +0 -0
  108. /package/lib/{esm → types}/ui/validator.d.ts +0 -0
@@ -1,482 +0,0 @@
1
- import { UIKeys } from "./constants";
2
- import { CrudOperationKeys, UIEventName, UIFunctionLike, UILayoutCol } from "./types";
3
- /**
4
- * @description Decorator that hides a property during specific CRUD operations
5
- * @summary Controls property visibility based on operation type
6
- * This decorator allows you to specify which CRUD operations should hide a property
7
- * in the UI. The property will only be visible during operations not specified.
8
- *
9
- * @param operations - The CRUD operations during which the property should be hidden
10
- * @return {Function} A property decorator function
11
- *
12
- * @function hideOn
13
- * @category Property Decorators
14
- *
15
- * @example
16
- * // Hide the password field during READ operations
17
- * class User {
18
- * @attribute()
19
- * username: string;
20
- *
21
- * @attribute()
22
- * @hideOn(OperationKeys.READ)
23
- * password: string;
24
- * }
25
- *
26
- * @mermaid
27
- * sequenceDiagram
28
- * participant Model
29
- * participant hideOn
30
- * participant RenderingEngine
31
- * participant UI
32
- * Model->>hideOn: Apply to property
33
- * hideOn->>Model: Add hidden metadata
34
- * RenderingEngine->>Model: Check if property should be hidden
35
- * Model->>RenderingEngine: Return hidden operations
36
- * RenderingEngine->>UI: Render or hide based on current operation
37
- */
38
- export declare function hideOn(...operations: CrudOperationKeys[]): (object: any, propertyKey?: any) => void;
39
- /**
40
- * @description Decorator that sets the order of a UI element
41
- * @summary Specifies the rendering order for UI components
42
- * This decorator applies metadata to the property or class, indicating its order in the UI rendering sequence.
43
- *
44
- * @param {number} [order=1] The order value for the UI element (default is 1)
45
- * @return {Function} A property or class decorator function
46
- *
47
- * @function uiorder
48
- * @category Property Decorators
49
- *
50
- * @example
51
- * // Set order for a field
52
- * @uiorder(2)
53
- * fieldName: string;
54
- *
55
- * // Set order for a class
56
- * @uiorder(1)
57
- * class UserProfile { ... }
58
- *
59
- * @mermaid
60
- * sequenceDiagram
61
- * participant System
62
- * participant uiorder
63
- * participant property
64
- * System->>uiorder:do(property)
65
- * uiorder->>property: sets order metadata
66
- * uiorder->>System: returns decorated property
67
- */
68
- export declare function uiorder(order?: number | typeof UIKeys.FIRST | typeof UIKeys.LAST): (object: any, propertyKey?: any) => void;
69
- /**
70
- * @description Decorator that completely hides a property in all UI operations
71
- * @summary Makes a property invisible in all CRUD operations
72
- * This decorator is a convenience wrapper around hideOn that hides a property
73
- * during all CRUD operations (CREATE, READ, UPDATE, DELETE).
74
- *
75
- * @return {Function} A property decorator function
76
- *
77
- * @function hidden
78
- * @category Property Decorators
79
- *
80
- * @example
81
- * // Completely hide the internalId field in the UI
82
- * class Product {
83
- * @attribute()
84
- * name: string;
85
- *
86
- * @attribute()
87
- * @hidden()
88
- * internalId: string;
89
- * }
90
- *
91
- * @mermaid
92
- * sequenceDiagram
93
- * participant Model
94
- * participant hidden
95
- * participant hideOn
96
- * participant RenderingEngine
97
- * Model->>hidden: Apply to property
98
- * hidden->>hideOn: Call with all operations
99
- * hideOn->>Model: Add hidden metadata
100
- * RenderingEngine->>Model: Check if property should be hidden
101
- * Model->>RenderingEngine: Return all operations
102
- * RenderingEngine->>UI: Always hide property
103
- */
104
- export declare function hidden(): (object: any, propertyKey?: any) => void;
105
- /**
106
- * @description Decorator that specifies how a property should be rendered as a UI element
107
- * @summary Maps a model property to a specific UI element with custom properties
108
- * This decorator allows you to define which HTML element or component should be used
109
- * to render a specific property, along with any additional properties to pass to that element.
110
- *
111
- * @param {string} tag The HTML element or component tag name to use for rendering
112
- * @param {Record<string, any>} [props] Additional properties to pass to the element
113
- * @param {boolean} [serialize=false] Whether the property should be serialized
114
- * @return {Function} A property decorator function
115
- *
116
- * @function uielement
117
- * @category Property Decorators
118
- *
119
- * @example
120
- * // Render a property as a text input
121
- * class LoginForm {
122
- * @attribute()
123
- * @uielement('input', { type: 'text', placeholder: 'Enter username' })
124
- * username: string;
125
- *
126
- * @attribute()
127
- * @uielement('input', { type: 'password', placeholder: 'Enter password' })
128
- * password: string;
129
- *
130
- * @attribute()
131
- * @uielement('button', { class: 'btn-primary' })
132
- * submit: string = 'Login';
133
- * }
134
- *
135
- * @mermaid
136
- * sequenceDiagram
137
- * participant Model
138
- * participant uielement
139
- * participant RenderingEngine
140
- * participant UI
141
- * Model->>uielement: Apply to property
142
- * uielement->>Model: Add element metadata
143
- * RenderingEngine->>Model: Get element metadata
144
- * Model->>RenderingEngine: Return tag and props
145
- * RenderingEngine->>UI: Render with specified element
146
- */
147
- export declare function uielement(tag: string | Record<string, any>, props?: Record<string, any>, serialize?: boolean): (original: any, propertyKey?: any) => void;
148
- /**
149
- * @description Decorator that maps a model property to a UI component property
150
- * @summary Specifies how a property should be passed to a UI component
151
- * This decorator allows you to define how a model property should be mapped to
152
- * a property of the UI component when rendering. It requires the class to be
153
- * decorated with @uimodel.
154
- *
155
- * @param {string} [propName] The name of the property to pass to the component (defaults to the property key)
156
- * @param {boolean} [stringify=false] Whether to stringify the property value
157
- * @return {Function} A property decorator function
158
- *
159
- * @function uiprop
160
- * @category Property Decorators
161
- *
162
- * @example
163
- * // Map model properties to component properties
164
- * @uimodel('user-profile')
165
- * class UserProfile {
166
- * @attribute()
167
- * @uiprop() // Will be passed as 'fullName' to the component
168
- * fullName: string;
169
- *
170
- * @attribute()
171
- * @uiprop('userEmail') // Will be passed as 'userEmail' to the component
172
- * email: string;
173
- *
174
- * @attribute()
175
- * @uiprop('userData', true) // Will be passed as stringified JSON
176
- * userData: Record<string, any>;
177
- * }
178
- *
179
- * @mermaid
180
- * sequenceDiagram
181
- * participant Model
182
- * participant uiprop
183
- * participant RenderingEngine
184
- * participant Component
185
- * Model->>uiprop: Apply to property
186
- * uiprop->>Model: Add prop metadata
187
- * RenderingEngine->>Model: Get prop metadata
188
- * Model->>RenderingEngine: Return prop name and stringify flag
189
- * RenderingEngine->>Component: Pass property with specified name
190
- */
191
- export declare function uiprop(propName?: string | undefined, stringify?: boolean): (target: any, propertyKey?: any) => void;
192
- /**
193
- * @description Decorator that maps a nested model property to a UI component property.
194
- * @summary Defines how a parent component should render the child model when nested.
195
- *
196
- * This decorator is used to decorate properties that are nested models.
197
- * When applied, it allows overriding the default tag of the child model with the provided one,
198
- * enabling different rendering behavior when the model acts as a child (nested)
199
- * compared to when it is rendered as the parent model.
200
- *
201
- * It requires the class to be decorated with `@uimodel`.
202
- *
203
- * @param {string} clazz The model class name to pass to the component (defaults to the property key).
204
- * @param {string} tag The HTML element or component tag name to override the UI tag of the nested model
205
- * @param {Record<string, any>} [props] Additional properties to pass to the element
206
- * @param {boolean} [serialize=false] Whether the property should be serialized
207
- * @return {Function} A property decorator function.
208
- *
209
- * @function uichild
210
- * @category Property Decorators
211
- *
212
- * @example
213
- * // Map a nested model to a component property with a different tag when nested
214
- * @uimodel('address-component')
215
- * class Address {
216
- * @attribute()
217
- * street: string;
218
- *
219
- * @attribute()
220
- * city: string;
221
- * }
222
- *
223
- * @uimodel('user-profile')
224
- * class UserProfile {
225
- * @attribute()
226
- * @uichild(Address.name, 'address-child-component')
227
- * address: Address;
228
- * }
229
- *
230
- * // In this example, the Address model has the default tag 'address-component' when rendered as a root component,
231
- * // but when used inside UserProfile, it is rendered with the overridden tag 'address-child-component'
232
- *
233
- * @mermaid
234
- * sequenceDiagram
235
- * participant Model
236
- * participant uichild
237
- * participant RenderingEngine
238
- * participant Component
239
- * Model->>uichild: Apply to property
240
- * uichild->>Model: Add child metadata
241
- * RenderingEngine->>Model: Get child metadata
242
- * Model->>RenderingEngine: Return prop name, stringify flag, and child tag override
243
- * RenderingEngine->>Component: Pass property with specified name and render with overridden tag if nested
244
- */
245
- export declare function uichild(clazz: string, tag: string, props?: Record<string, any>, isArray?: boolean, serialize?: boolean): (target: any, propertyKey?: any) => void;
246
- /**
247
- * @description Decorator that maps a model property to a list item component
248
- * @summary Specifies how a property should be rendered in a list context
249
- * This decorator allows you to define how a model property containing a list
250
- * should be rendered. It requires the class to be decorated with @uilistmodel.
251
- *
252
- * @param {string} [propName] The name of the property to pass to the list component (defaults to the property key)
253
- * @param {Record<string, any>} [props] Additional properties to pass to the list container
254
- * @return {Function} A property decorator function
255
- *
256
- * @function uilistprop
257
- * @category Property Decorators
258
- *
259
- * @example
260
- * // Define a list property with custom rendering
261
- * @uimodel('todo-list')
262
- * class TodoList {
263
- * @attribute()
264
- * title: string;
265
- *
266
- * @attribute()
267
- * @uilistprop('items', { class: 'todo-items-container' })
268
- * items: TodoItem[];
269
- * }
270
- *
271
- * @uilistmodel('li', { class: 'todo-item' })
272
- * class TodoItem extends Model {
273
- * @attribute()
274
- * text: string;
275
- *
276
- * @attribute()
277
- * completed: boolean;
278
- * }
279
- *
280
- * @mermaid
281
- * sequenceDiagram
282
- * participant Model
283
- * participant uilistprop
284
- * participant RenderingEngine
285
- * participant ListContainer
286
- * participant ListItems
287
- * Model->>uilistprop: Apply to property
288
- * uilistprop->>Model: Add list prop metadata
289
- * RenderingEngine->>Model: Get list prop metadata
290
- * Model->>RenderingEngine: Return prop name and container props
291
- * RenderingEngine->>ListContainer: Create container with props
292
- * RenderingEngine->>ListItems: Render each item using @uilistmodel
293
- * ListContainer->>RenderingEngine: Return rendered list
294
- */
295
- export declare function uilistprop(propName?: string | undefined, props?: Record<string, any>): (target: any, propertyKey?: any) => void;
296
- /**
297
- * @description Decorator that positions a property in a specific grid layout position
298
- * @summary Specifies the column and row position for a property in a UI layout grid
299
- * This decorator allows you to define the specific position of a property within
300
- * a grid-based layout system. It specifies which column and row the property
301
- * should occupy when rendered in the UI.
302
- *
303
- * @param {number} col The column position in the grid layout
304
- * @param {number} [row=1] The row position in the grid layout (defaults to 1)
305
- * @param {Record<string, any>} [props={}] Additional properties to pass to the layout item
306
- * @return {Function} A property decorator function
307
- *
308
- * @function uilayoutprop
309
- * @category Property Decorators
310
- *
311
- * @example
312
- * // Position properties in a grid layout
313
- * @uilayout('user-form', 2, 3) // 2 columns, 3 rows
314
- * @model()
315
- * class UserForm {
316
- * @attribute()
317
- * @uilayoutprop(1, 1) // One column, first row
318
- * firstName: string;
319
- *
320
- * @attribute()
321
- * @uilayoutprop(2, 1) // One column, first row
322
- * lastName: string;
323
- *
324
- * @attribute()
325
- * @uilayoutprop(1, 2) // One column, second row
326
- * email: string;
327
- *
328
- * @attribute()
329
- * @uilayoutprop(2, 3) // All columns, third row
330
- * bio: string;
331
- * }
332
- *
333
- * @mermaid
334
- * sequenceDiagram
335
- * participant Model
336
- * participant uilayoutprop
337
- * participant RenderingEngine
338
- * participant LayoutContainer
339
- * Model->>uilayoutprop: Apply to property
340
- * uilayoutprop->>Model: Add layout item metadata
341
- * RenderingEngine->>Model: Get layout item metadata
342
- * Model->>RenderingEngine: Return column, row, and props
343
- * RenderingEngine->>LayoutContainer: Position element at grid coordinates
344
- * LayoutContainer->>RenderingEngine: Return positioned element
345
- */
346
- export declare function uilayoutprop(col?: UILayoutCol, row?: number): (target: any, propertyKey?: any) => void;
347
- /**
348
- * @description Decorator that assigns a property to a specific page in multi-page forms
349
- * @summary Specifies which page a property should appear on in paginated UI layouts
350
- * This decorator applies metadata to the property, indicating which page number it belongs to
351
- * in a multi-page form or wizard. Properties with the same page number are grouped together
352
- * and rendered on the same page. This is typically used in conjunction with @uisteppedmodel to
353
- * organize large forms into manageable sections.
354
- *
355
- * @param {number} [page=1] The page number where the property should appear (default is 1)
356
- * @return {Function} A property decorator function
357
- *
358
- * @function uipageprop
359
- * @category Property Decorators
360
- *
361
- * @example
362
- * // Create a multi-step registration form with page-based layout
363
- * @uisteppedmodel('registration-form', 2, true)
364
- * @model()
365
- * class RegistrationForm {
366
- * // Page 1: Personal Information
367
- * @attribute()
368
- * @uipageprop(1)
369
- * firstName: string;
370
- *
371
- * @attribute()
372
- * @uipageprop(1)
373
- * lastName: string;
374
- *
375
- * @attribute()
376
- * @uipageprop(1)
377
- * dateOfBirth: Date;
378
- *
379
- * // Page 2: Contact Information
380
- * @attribute()
381
- * @uipageprop(2)
382
- * email: string;
383
- *
384
- * @attribute()
385
- * @uipageprop(2)
386
- * phone: string;
387
- *
388
- * // Page 3: Confirmation
389
- * @attribute()
390
- * @uipageprop(3)
391
- * acceptTerms: boolean;
392
- * }
393
- *
394
- * @mermaid
395
- * sequenceDiagram
396
- * participant Model
397
- * participant uipageprop
398
- * participant RenderingEngine
399
- * participant PaginationController
400
- * participant UI
401
- * Model->>uipageprop: Apply to property
402
- * uipageprop->>Model: Add page metadata
403
- * RenderingEngine->>Model: Get page metadata
404
- * Model->>RenderingEngine: Return page number
405
- * RenderingEngine->>PaginationController: Group properties by page
406
- * PaginationController->>UI: Render current page properties
407
- */
408
- export declare function uipageprop(page?: number): (original: any, propertyKey?: any) => void;
409
- /**
410
- * A decorator factory that binds a UI event to a specified handler function.
411
- * This is used to attach event handlers to specific lifecycle events of a `DecafComponent`,
412
- * such as `render` | `initialize` | `handleClick` | `refresh`
413
- *
414
- * @param event - The name of the lifecycle event to bind the handler to.
415
- * Must be one of the keys in `Pick<DecafComponent, 'render' | 'initialize'>`.
416
- * @param handler - The function to be executed when the specified event occurs.
417
- *
418
- * @returns A decorator function that applies the event-handler binding to the target object.
419
- *
420
- * @example
421
- * ```typescript
422
- * class MyComponent {
423
- * @uion('render', () => console.log('Rendering...'))
424
- * someProperty: string;
425
- * }
426
- * ```
427
- */
428
- export declare function uion(event: UIEventName | Record<string, UIFunctionLike>, handler: UIFunctionLike): (original: object, propertyKey?: string) => void;
429
- /**
430
- * A decorator function that associates a UI click handler with the 'handleClick' event.
431
- *
432
- * @param handler - A function that conforms to the `UIFunctionLike` type, which will be executed
433
- * when the 'handleClick' event is triggered.
434
- * @returns A decorated function that binds the handler to the 'handleClick' event.
435
- */
436
- export declare function uionclick(handler: UIFunctionLike): (original: object, propertyKey?: string) => void;
437
- /**
438
- * A decorator function that associates a UI rendering handler with the 'render' event.
439
- *
440
- * @param handler - A function that conforms to the `UIFunctionLike` type, which will be executed
441
- * when the 'render' event is triggered.
442
- * @returns A decorated function that binds the handler to the 'render' event.
443
- */
444
- export declare function uionrender(handler: UIFunctionLike): (original: object, propertyKey?: string) => void;
445
- /**
446
- * @description Decorator that marks a property as a column in a UI table
447
- * @summary Controls column ordering and optional value parsing for table props
448
- * Use this decorator to register list properties as table columns, define the
449
- * sequence in which they appear, and optionally provide a parser that formats
450
- * the value before rendering.
451
- *
452
- * @param {number} sequence The display order for the column (lower means first)
453
- * @param {UIFunctionLike} [valueParserFn] Optional formatter executed per cell
454
- * @return {Function} A property decorator function
455
- *
456
- * @function uitablecol
457
- * @category Property Decorators
458
- *
459
- * @example
460
- * class Order {
461
- * @attribute()
462
- * @uitablecol(1)
463
- * orderNumber: string;
464
- *
465
- * @attribute()
466
- * @uitablecol(2, (value) => `$${value?.toFixed(2)}`)
467
- * total: number;
468
- * }
469
- *
470
- * @mermaid
471
- * sequenceDiagram
472
- * participant Model
473
- * participant uitablecol
474
- * participant RenderingEngine
475
- * participant Table
476
- * Model->>uitablecol: Apply to property
477
- * uitablecol->>Model: Store column metadata
478
- * RenderingEngine->>Model: Retrieve column props
479
- * Model->>RenderingEngine: Return order and parser
480
- * RenderingEngine->>Table: Render column in sequence
481
- */
482
- export declare function uitablecol(sequence?: number | typeof UIKeys.FIRST | typeof UIKeys.LAST, valueParserFn?: UIFunctionLike): (target: any, propertyKey?: any) => void;
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/ui/decorators.ts"],"names":[],"mappings":";;AAkDA,wBAOC;AA+BD,0BASC;AAqCD,wBAOC;AA4CD,8BAuBC;AA6CD,wBAcC;AAwDD,0BA4BC;AAmDD,gCAcC;AAoDD,oCAaC;AA+DD,gCAOC;AAqBD,oBASC;AASD,8BAEC;AASD,gCAEC;AAuCD,gCAiBC;AAnpBD,+CAAqC;AACrC,qDAAoD;AAWpD,2DAAwD;AACxD,uCAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG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C,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;aAC7C;SACF,CAAC;QACF,IAAA,yBAAY,EAAC,IAAA,yBAAiB,EAAC,WAAW,EAAE,kBAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,CACvE,MAAM,EACN,WAAW,CACZ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,32 +0,0 @@
1
- import { InternalError } from "@decaf-ts/db-decorators";
2
- /**
3
- * @description Error thrown when a rendering operation fails
4
- * @summary Specialized error for rendering failures in UI components
5
- * This error is thrown when the rendering engine encounters an error while
6
- * attempting to render a UI component or model.
7
- *
8
- * @param {string|Error} msg The error message or original error
9
- *
10
- * @class RenderingError
11
- * @extends BaseError
12
- * @category Errors
13
- *
14
- * @example
15
- * // Throwing a rendering error
16
- * try {
17
- * // Rendering code that might fail
18
- * if (!component.canRender()) {
19
- * throw new RenderingError('Component cannot be rendered');
20
- * }
21
- * } catch (error) {
22
- * console.error('Rendering failed:', error.message);
23
- * }
24
- */
25
- export declare class RenderingError extends InternalError {
26
- /**
27
- * @description Creates a new RenderingError instance
28
- * @summary Initializes the error with a message or original error
29
- * @param {string|Error} msg The error message or original error
30
- */
31
- constructor(msg: string | Error);
32
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/ui/errors.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAExD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,cAAe,SAAQ,6BAAa;IAC/C;;;;OAIG;IACH,YAAY,GAAmB;QAC7B,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACF;AATD,wCASC"}
package/lib/ui/index.d.ts DELETED
@@ -1,11 +0,0 @@
1
- export * from "./constants";
2
- export * from "./decorators";
3
- export * from "./errors";
4
- export * from "./interfaces";
5
- export * from "./Rendering";
6
- export * from "./types";
7
- export * from "./utils";
8
- export * from "./UIValidator";
9
- export * from "./DecafComponent";
10
- export * from "./DecafEventHandler";
11
- export * from "./DecafTranslateService";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":";AAAA,wBAAwB;AACxB,+BAA+B;;;;;;;;;;;;;;;;AAE/B,kDAA4B;AAC5B,mDAA6B;AAC7B,+CAAyB;AACzB,mDAA6B;AAC7B,kDAA4B;AAC5B,8CAAwB;AACxB,8CAAwB;AACxB,oDAA8B;AAC9B,uDAAiC;AACjC,0DAAoC;AACpC,8DAAwC"}
@@ -1,64 +0,0 @@
1
- /**
2
- * @description Interfaces for UI form components
3
- * @summary Defines interfaces for form fields with CRUD operations
4
- * This module contains interfaces that extend basic field properties with
5
- * CRUD operation information for form generation.
6
- * @module ui/interfaces
7
- * @memberOf module:ui-decorators
8
- */
9
- import { FieldProperties } from "./types";
10
- import { CrudOperations } from "@decaf-ts/db-decorators";
11
- /**
12
- * @description Form field interface with CRUD operation information
13
- * @summary Extends basic field properties with a specific CRUD operation
14
- * This interface represents a form field that is associated with a specific
15
- * CRUD operation (Create, Read, Update, Delete). It combines all the standard
16
- * field properties with an operation property.
17
- *
18
- * @interface CrudFormField
19
- * @extends FieldProperties
20
- * @memberOf module:ui-decorators
21
- *
22
- * @property {CrudOperations} operation - The CRUD operation associated with this field
23
- */
24
- export interface CrudFormField extends FieldProperties {
25
- /**
26
- * @description The CRUD operation associated with this field
27
- * @summary Specifies which operation (Create, Read, Update, Delete) this field is for
28
- */
29
- operation: CrudOperations;
30
- }
31
- /**
32
- * @description Interface for defining a page/step in a multi-step form or wizard
33
- * @summary Provides metadata for individual pages in stepped model forms
34
- * This interface represents a single page or step in a multi-step form workflow.
35
- * It allows defining optional title and description metadata for each page,
36
- * which can be used to display step indicators, progress bars, or navigation labels.
37
- * Used in conjunction with the @uisteppedmodel decorator.
38
- *
39
- * @interface IPagedComponentProperties
40
- * @memberOf module:ui-decorators
41
- *
42
- * @property {string} [title] - Optional title for the page/step (e.g., "Personal Information")
43
- * @property {string} [description] - Optional description providing additional context for the page
44
- *
45
- * @example
46
- * // Define pages for a multi-step wizard
47
- * const wizardPages: IPagedComponentProperties[] = [
48
- * { title: 'Personal Info', description: 'Enter your basic details' },
49
- * { title: 'Contact', description: 'Provide your contact information' },
50
- * { title: 'Review', description: 'Review and confirm your information' }
51
- * ];
52
- *
53
- * @uisteppedmodel('div', wizardPages, true)
54
- * class RegistrationWizard extends Model {
55
- * // Properties with @uipageprop decorators
56
- * }
57
- */
58
- export interface IPagedComponentProperties {
59
- title?: string;
60
- description?: string;
61
- pages?: number | IPagedComponentProperties[];
62
- rows?: number | string[];
63
- cols?: number | string[];
64
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/ui/interfaces.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG"}
@@ -1 +0,0 @@
1
- import "./validator";
@@ -1 +0,0 @@
1
- {"version":3,"file":"overrides.js","sourceRoot":"","sources":["../../src/ui/overrides.ts"],"names":[],"mappings":";;AAAA,yEAA2D;AAC3D,2BAAqB;AAEpB,gCAAiB,CAAC,UAAU,GAAG,UAAU,OAAe,EAAE,GAAG,IAAW;IACvE,IAAK,gCAAiB,CAAC,gBAAgB;QACrC,OAAQ,gCAAiB,CAAC,gBAAgB,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;IACzE,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC,CAAC"}