@openg2p/registry-widgets 0.1.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/LICENSE +373 -0
- package/README.md +294 -0
- package/dist/components/FilePreviewModal.d.ts +9 -0
- package/dist/components/FilePreviewModal.d.ts.map +1 -0
- package/dist/components/PanelRenderer.d.ts +18 -0
- package/dist/components/PanelRenderer.d.ts.map +1 -0
- package/dist/components/SectionRenderer.d.ts +29 -0
- package/dist/components/SectionRenderer.d.ts.map +1 -0
- package/dist/components/SectionsContainer.d.ts +26 -0
- package/dist/components/SectionsContainer.d.ts.map +1 -0
- package/dist/components/WidgetProvider.d.ts +17 -0
- package/dist/components/WidgetProvider.d.ts.map +1 -0
- package/dist/components/WidgetRenderer.d.ts +9 -0
- package/dist/components/WidgetRenderer.d.ts.map +1 -0
- package/dist/hooks/useBaseWidget.d.ts +30 -0
- package/dist/hooks/useBaseWidget.d.ts.map +1 -0
- package/dist/hooks/useWidgetTranslation.d.ts +16 -0
- package/dist/hooks/useWidgetTranslation.d.ts.map +1 -0
- package/dist/i18n/config.d.ts +21 -0
- package/dist/i18n/config.d.ts.map +1 -0
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +1306 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +5930 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +6000 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/WidgetRegistry.d.ts +40 -0
- package/dist/registry/WidgetRegistry.d.ts.map +1 -0
- package/dist/registry/defaultWidgets.d.ts +6 -0
- package/dist/registry/defaultWidgets.d.ts.map +1 -0
- package/dist/store/index.d.ts +11 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/widgetSlice.d.ts +20 -0
- package/dist/store/widgetSlice.d.ts.map +1 -0
- package/dist/types/index.d.ts +293 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/conditions.d.ts +20 -0
- package/dist/utils/conditions.d.ts.map +1 -0
- package/dist/utils/dataSource.d.ts +27 -0
- package/dist/utils/dataSource.d.ts.map +1 -0
- package/dist/utils/dateInput.d.ts +32 -0
- package/dist/utils/dateInput.d.ts.map +1 -0
- package/dist/utils/datetimeInput.d.ts +37 -0
- package/dist/utils/datetimeInput.d.ts.map +1 -0
- package/dist/utils/filePreview.d.ts +8 -0
- package/dist/utils/filePreview.d.ts.map +1 -0
- package/dist/utils/fileSerialization.d.ts +40 -0
- package/dist/utils/fileSerialization.d.ts.map +1 -0
- package/dist/utils/formatting.d.ts +18 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/numberInput.d.ts +31 -0
- package/dist/utils/numberInput.d.ts.map +1 -0
- package/dist/utils/pathUtils.d.ts +23 -0
- package/dist/utils/pathUtils.d.ts.map +1 -0
- package/dist/utils/schemaTranslation.d.ts +23 -0
- package/dist/utils/schemaTranslation.d.ts.map +1 -0
- package/dist/utils/textInput.d.ts +21 -0
- package/dist/utils/textInput.d.ts.map +1 -0
- package/dist/utils/validation.d.ts +11 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validationPatterns.d.ts +17 -0
- package/dist/utils/validationPatterns.d.ts.map +1 -0
- package/dist/widgets/ArrayWidget.d.ts +29 -0
- package/dist/widgets/ArrayWidget.d.ts.map +1 -0
- package/dist/widgets/BooleanWidget.d.ts +35 -0
- package/dist/widgets/BooleanWidget.d.ts.map +1 -0
- package/dist/widgets/CheckboxWidget.d.ts +56 -0
- package/dist/widgets/CheckboxWidget.d.ts.map +1 -0
- package/dist/widgets/CurrencyInputWidget.d.ts +24 -0
- package/dist/widgets/CurrencyInputWidget.d.ts.map +1 -0
- package/dist/widgets/DateInputWidget.d.ts +42 -0
- package/dist/widgets/DateInputWidget.d.ts.map +1 -0
- package/dist/widgets/DateTimeInputWidget.d.ts +42 -0
- package/dist/widgets/DateTimeInputWidget.d.ts.map +1 -0
- package/dist/widgets/DisplayWidget.d.ts +11 -0
- package/dist/widgets/DisplayWidget.d.ts.map +1 -0
- package/dist/widgets/FileInputWidget.d.ts +24 -0
- package/dist/widgets/FileInputWidget.d.ts.map +1 -0
- package/dist/widgets/IterableAccordionWidget.d.ts +30 -0
- package/dist/widgets/IterableAccordionWidget.d.ts.map +1 -0
- package/dist/widgets/NumberInputWidget.d.ts +47 -0
- package/dist/widgets/NumberInputWidget.d.ts.map +1 -0
- package/dist/widgets/PhoneInputWidget.d.ts +22 -0
- package/dist/widgets/PhoneInputWidget.d.ts.map +1 -0
- package/dist/widgets/ProfileWidget.d.ts +50 -0
- package/dist/widgets/ProfileWidget.d.ts.map +1 -0
- package/dist/widgets/RadioWidget.d.ts +44 -0
- package/dist/widgets/RadioWidget.d.ts.map +1 -0
- package/dist/widgets/SelectWidget.d.ts +23 -0
- package/dist/widgets/SelectWidget.d.ts.map +1 -0
- package/dist/widgets/SimpleTableWidget.d.ts +32 -0
- package/dist/widgets/SimpleTableWidget.d.ts.map +1 -0
- package/dist/widgets/TableWidget.d.ts +46 -0
- package/dist/widgets/TableWidget.d.ts.map +1 -0
- package/dist/widgets/TextAreaWidget.d.ts +40 -0
- package/dist/widgets/TextAreaWidget.d.ts.map +1 -0
- package/dist/widgets/TextInputWidget.d.ts +48 -0
- package/dist/widgets/TextInputWidget.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +19 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1306 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as _reduxjs_toolkit from '@reduxjs/toolkit';
|
|
3
|
+
import * as redux_thunk from 'redux-thunk';
|
|
4
|
+
import * as redux from 'redux';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
|
+
import React$1, { ReactNode } from 'react';
|
|
7
|
+
import * as i18next from 'i18next';
|
|
8
|
+
import i18next__default from 'i18next';
|
|
9
|
+
export { default as i18n } from 'i18next';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Widget data path can be a string (single path) or object (multi-path)
|
|
13
|
+
*/
|
|
14
|
+
type WidgetDataPath = string | Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Data source types
|
|
17
|
+
*/
|
|
18
|
+
type DataSourceType = 'static' | 'api' | 'schema';
|
|
19
|
+
/**
|
|
20
|
+
* Static data source configuration
|
|
21
|
+
*/
|
|
22
|
+
interface StaticDataSource {
|
|
23
|
+
type: 'static';
|
|
24
|
+
options: Array<{
|
|
25
|
+
value: string | number;
|
|
26
|
+
label: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* API data source configuration
|
|
31
|
+
*/
|
|
32
|
+
interface ApiDataSource {
|
|
33
|
+
type: 'api';
|
|
34
|
+
url: string;
|
|
35
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
36
|
+
dependsOn?: string;
|
|
37
|
+
valueKey?: string;
|
|
38
|
+
labelKey?: string;
|
|
39
|
+
headers?: Record<string, string>;
|
|
40
|
+
body?: Record<string, any>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Schema reference data source configuration
|
|
44
|
+
*/
|
|
45
|
+
interface SchemaDataSource {
|
|
46
|
+
type: 'schema';
|
|
47
|
+
path: string;
|
|
48
|
+
valueKey?: string;
|
|
49
|
+
labelKey?: string;
|
|
50
|
+
}
|
|
51
|
+
type DataSource = StaticDataSource | ApiDataSource | SchemaDataSource;
|
|
52
|
+
/**
|
|
53
|
+
* Allowed character types for text input
|
|
54
|
+
*/
|
|
55
|
+
type CharacterType = 'any' | 'alphabetic' | 'alphanumeric' | 'numeric' | 'numeric-decimal' | 'custom';
|
|
56
|
+
/**
|
|
57
|
+
* Case control options
|
|
58
|
+
*/
|
|
59
|
+
type CaseControl = 'none' | 'lowercase' | 'uppercase' | 'capitalize';
|
|
60
|
+
/**
|
|
61
|
+
* Input mask configuration
|
|
62
|
+
*/
|
|
63
|
+
interface InputMask {
|
|
64
|
+
pattern: string;
|
|
65
|
+
type?: 'static' | 'phone' | 'national-id' | 'custom';
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validation type options for common patterns
|
|
70
|
+
*/
|
|
71
|
+
type ValidationType = 'email' | 'phone' | 'url';
|
|
72
|
+
/**
|
|
73
|
+
* Validation configuration
|
|
74
|
+
*/
|
|
75
|
+
interface WidgetValidation {
|
|
76
|
+
required?: boolean;
|
|
77
|
+
validationType?: ValidationType;
|
|
78
|
+
pattern?: string;
|
|
79
|
+
patternMessage?: string;
|
|
80
|
+
minLength?: number;
|
|
81
|
+
maxLength?: number;
|
|
82
|
+
min?: number;
|
|
83
|
+
max?: number;
|
|
84
|
+
custom?: string;
|
|
85
|
+
zodSchema?: z.ZodSchema;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Numeric type options
|
|
89
|
+
*/
|
|
90
|
+
type NumericType = 'integer' | 'decimal';
|
|
91
|
+
/**
|
|
92
|
+
* Rounding mode for decimal numbers
|
|
93
|
+
*/
|
|
94
|
+
type RoundingMode = 'round' | 'truncate';
|
|
95
|
+
/**
|
|
96
|
+
* Text alignment options
|
|
97
|
+
*/
|
|
98
|
+
type TextAlign = 'left' | 'right';
|
|
99
|
+
/**
|
|
100
|
+
* Boolean representation options
|
|
101
|
+
*/
|
|
102
|
+
type BooleanRepresentation = 'true-false' | 'yes-no' | 'on-off' | 'custom';
|
|
103
|
+
/**
|
|
104
|
+
* Boolean control type options
|
|
105
|
+
*/
|
|
106
|
+
type BooleanControlType = 'checkbox' | 'radio' | 'toggle';
|
|
107
|
+
/**
|
|
108
|
+
* Format configuration
|
|
109
|
+
*/
|
|
110
|
+
interface WidgetFormat {
|
|
111
|
+
dateFormat?: string;
|
|
112
|
+
currency?: string;
|
|
113
|
+
locale?: string;
|
|
114
|
+
decimals?: number;
|
|
115
|
+
pattern?: string;
|
|
116
|
+
inputType?: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'file';
|
|
117
|
+
characterType?: CharacterType;
|
|
118
|
+
customCharset?: string;
|
|
119
|
+
caseControl?: CaseControl;
|
|
120
|
+
mask?: InputMask;
|
|
121
|
+
showCharCounter?: boolean;
|
|
122
|
+
rows?: number;
|
|
123
|
+
numericType?: NumericType;
|
|
124
|
+
decimalPlaces?: number;
|
|
125
|
+
roundingMode?: RoundingMode;
|
|
126
|
+
thousandSeparator?: string;
|
|
127
|
+
decimalSeparator?: string;
|
|
128
|
+
textAlign?: TextAlign;
|
|
129
|
+
allowSigned?: boolean;
|
|
130
|
+
formatOnBlur?: boolean;
|
|
131
|
+
booleanRepresentation?: BooleanRepresentation;
|
|
132
|
+
booleanControlType?: BooleanControlType;
|
|
133
|
+
booleanTrueLabel?: string;
|
|
134
|
+
booleanFalseLabel?: string;
|
|
135
|
+
allowUnset?: boolean;
|
|
136
|
+
layout?: 'vertical' | 'horizontal' | 'grid';
|
|
137
|
+
sortOptions?: boolean;
|
|
138
|
+
inputMethod?: 'picker' | 'manual' | 'hybrid';
|
|
139
|
+
dateConstraint?: 'any' | 'past-only' | 'future-only';
|
|
140
|
+
dateTimeFormat?: string;
|
|
141
|
+
dateTimeConstraint?: 'any' | 'past-only' | 'future-only';
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Condition operators
|
|
145
|
+
*/
|
|
146
|
+
type ConditionOperator = 'equals' | 'notEquals' | 'notEmpty' | 'empty' | 'greaterThan' | 'lessThan' | 'contains' | 'notContains';
|
|
147
|
+
/**
|
|
148
|
+
* Condition configuration
|
|
149
|
+
*/
|
|
150
|
+
interface WidgetCondition {
|
|
151
|
+
field: string;
|
|
152
|
+
operator: ConditionOperator;
|
|
153
|
+
value?: any;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Widget options for conditional behavior
|
|
157
|
+
*/
|
|
158
|
+
interface WidgetOptions {
|
|
159
|
+
action?: 'show' | 'hide' | 'enable' | 'disable';
|
|
160
|
+
condition?: WidgetCondition;
|
|
161
|
+
minDate?: string;
|
|
162
|
+
maxDate?: string;
|
|
163
|
+
showCalendar?: boolean;
|
|
164
|
+
[key: string]: any;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Base widget configuration
|
|
168
|
+
*/
|
|
169
|
+
interface BaseWidgetConfig {
|
|
170
|
+
widget: string;
|
|
171
|
+
'widget-type'?: 'input' | 'layout' | 'table' | 'group';
|
|
172
|
+
'widget-label'?: string;
|
|
173
|
+
'widget-id': string;
|
|
174
|
+
'widget-orientation'?: 'horizontal' | 'vertical';
|
|
175
|
+
'widget-data-path'?: WidgetDataPath;
|
|
176
|
+
'widget-data-default'?: any;
|
|
177
|
+
'widget-required'?: boolean;
|
|
178
|
+
'widget-readonly'?: boolean;
|
|
179
|
+
'widget-data-validation'?: WidgetValidation;
|
|
180
|
+
'widget-data-format'?: WidgetFormat;
|
|
181
|
+
'widget-data-source'?: DataSource;
|
|
182
|
+
'widget-data-options'?: WidgetOptions;
|
|
183
|
+
'widget-data-placeholder'?: string;
|
|
184
|
+
'widget-data-helptext'?: string;
|
|
185
|
+
'widget-data-tooltip'?: string;
|
|
186
|
+
widgets?: BaseWidgetConfig[];
|
|
187
|
+
'widget-item'?: BaseWidgetConfig;
|
|
188
|
+
'widget-data-columns'?: Array<{
|
|
189
|
+
'column-key': string;
|
|
190
|
+
'widget-label': string;
|
|
191
|
+
widget?: string;
|
|
192
|
+
'widget-type'?: string;
|
|
193
|
+
'widget-data-path'?: string;
|
|
194
|
+
'widget-data-default'?: any;
|
|
195
|
+
'widget-data-format'?: WidgetFormat;
|
|
196
|
+
'widget-data-validation'?: WidgetValidation;
|
|
197
|
+
'widget-data-source'?: DataSource;
|
|
198
|
+
'widget-data-placeholder'?: string;
|
|
199
|
+
'widget-required'?: boolean;
|
|
200
|
+
'widget-readonly'?: boolean;
|
|
201
|
+
[key: string]: any;
|
|
202
|
+
}>;
|
|
203
|
+
'widget-data-operations'?: {
|
|
204
|
+
add?: boolean;
|
|
205
|
+
remove?: boolean;
|
|
206
|
+
edit?: boolean;
|
|
207
|
+
};
|
|
208
|
+
'widget-data-add-label'?: string;
|
|
209
|
+
'widget-data-collapsed'?: boolean;
|
|
210
|
+
'widget-column-span'?: number;
|
|
211
|
+
_comment?: string;
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Panel configuration - a layout container that can contain nested panels or widgets
|
|
216
|
+
*/
|
|
217
|
+
interface PanelConfig {
|
|
218
|
+
'panel-id': string;
|
|
219
|
+
'panel-orientation'?: 'horizontal' | 'vertical';
|
|
220
|
+
'panel-column-span'?: number;
|
|
221
|
+
panels?: PanelConfig[];
|
|
222
|
+
widgets?: BaseWidgetConfig[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Supporting document configuration
|
|
226
|
+
*/
|
|
227
|
+
interface SupportingDocumentConfig {
|
|
228
|
+
'document-data-path': string;
|
|
229
|
+
'document-type'?: string;
|
|
230
|
+
'document-required'?: boolean;
|
|
231
|
+
'document-label'?: string;
|
|
232
|
+
'document-accept'?: string;
|
|
233
|
+
'document-max-size'?: number;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Section configuration
|
|
237
|
+
*/
|
|
238
|
+
interface SectionConfig {
|
|
239
|
+
'section-id': string;
|
|
240
|
+
'section-title'?: string;
|
|
241
|
+
'section-editable'?: boolean;
|
|
242
|
+
'section-column-span'?: number;
|
|
243
|
+
'section-supporting-documents'?: SupportingDocumentConfig[];
|
|
244
|
+
panels: PanelConfig[];
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* UI Schema structure
|
|
248
|
+
*/
|
|
249
|
+
interface UISchema {
|
|
250
|
+
sections: SectionConfig[];
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Widget value type
|
|
254
|
+
*/
|
|
255
|
+
type WidgetValue = any;
|
|
256
|
+
/**
|
|
257
|
+
* Widget state in Redux store
|
|
258
|
+
*/
|
|
259
|
+
interface WidgetState {
|
|
260
|
+
values: Record<string, WidgetValue>;
|
|
261
|
+
errors: Record<string, string[]>;
|
|
262
|
+
touched: Record<string, boolean>;
|
|
263
|
+
loading: Record<string, boolean>;
|
|
264
|
+
dataSources: Record<string, any[]>;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Widget context value
|
|
268
|
+
*/
|
|
269
|
+
interface WidgetContextValue {
|
|
270
|
+
widgetId: string;
|
|
271
|
+
value: WidgetValue;
|
|
272
|
+
error: string[];
|
|
273
|
+
touched: boolean;
|
|
274
|
+
loading: boolean;
|
|
275
|
+
onChange: (value: WidgetValue) => void;
|
|
276
|
+
onBlur: () => void;
|
|
277
|
+
setError: (errors: string[]) => void;
|
|
278
|
+
getFieldValue: (path: string) => any;
|
|
279
|
+
getDataSource: (widgetId: string) => any[];
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Custom widget render function
|
|
283
|
+
*/
|
|
284
|
+
type WidgetRenderFunction = (config: BaseWidgetConfig, context: WidgetContextValue) => React.ReactNode;
|
|
285
|
+
/**
|
|
286
|
+
* Widget registry entry
|
|
287
|
+
*/
|
|
288
|
+
interface WidgetRegistryEntry {
|
|
289
|
+
widget: string;
|
|
290
|
+
component: React.ComponentType<any> | WidgetRenderFunction;
|
|
291
|
+
defaultProps?: Record<string, any>;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* API adapter function type
|
|
295
|
+
*/
|
|
296
|
+
type ApiAdapter = (url: string, options: {
|
|
297
|
+
method?: string;
|
|
298
|
+
headers?: Record<string, string>;
|
|
299
|
+
body?: any;
|
|
300
|
+
params?: Record<string, any>;
|
|
301
|
+
}) => Promise<any>;
|
|
302
|
+
|
|
303
|
+
declare const createWidgetStore: () => _reduxjs_toolkit.EnhancedStore<{
|
|
304
|
+
widget: WidgetState;
|
|
305
|
+
}, redux.UnknownAction, _reduxjs_toolkit.Tuple<[redux.StoreEnhancer<{
|
|
306
|
+
dispatch: redux_thunk.ThunkDispatch<{
|
|
307
|
+
widget: WidgetState;
|
|
308
|
+
}, undefined, redux.UnknownAction>;
|
|
309
|
+
}>, redux.StoreEnhancer]>>;
|
|
310
|
+
type WidgetStore = ReturnType<typeof createWidgetStore>;
|
|
311
|
+
type WidgetRootState = ReturnType<WidgetStore['getState']>;
|
|
312
|
+
type WidgetDispatch = WidgetStore['dispatch'];
|
|
313
|
+
|
|
314
|
+
declare const setValue: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
315
|
+
widgetId: string;
|
|
316
|
+
value: WidgetValue;
|
|
317
|
+
}, "widget/setValue">;
|
|
318
|
+
declare const setValues: _reduxjs_toolkit.ActionCreatorWithPayload<Record<string, any>, "widget/setValues">;
|
|
319
|
+
declare const setError: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
320
|
+
widgetId: string;
|
|
321
|
+
errors: string[];
|
|
322
|
+
}, "widget/setError">;
|
|
323
|
+
declare const setTouched: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
324
|
+
widgetId: string;
|
|
325
|
+
touched: boolean;
|
|
326
|
+
}, "widget/setTouched">;
|
|
327
|
+
declare const setLoading: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
328
|
+
widgetId: string;
|
|
329
|
+
loading: boolean;
|
|
330
|
+
}, "widget/setLoading">;
|
|
331
|
+
declare const setDataSource: _reduxjs_toolkit.ActionCreatorWithPayload<{
|
|
332
|
+
widgetId: string;
|
|
333
|
+
data: any[];
|
|
334
|
+
}, "widget/setDataSource">;
|
|
335
|
+
declare const resetWidget: _reduxjs_toolkit.ActionCreatorWithPayload<string, "widget/resetWidget">;
|
|
336
|
+
declare const resetAll: _reduxjs_toolkit.ActionCreatorWithoutPayload<"widget/resetAll">;
|
|
337
|
+
|
|
338
|
+
interface UseBaseWidgetOptions {
|
|
339
|
+
config: BaseWidgetConfig;
|
|
340
|
+
apiAdapter?: ApiAdapter;
|
|
341
|
+
schemaData?: Record<string, any>;
|
|
342
|
+
onValueChange?: (widgetId: string, value: any) => void;
|
|
343
|
+
}
|
|
344
|
+
declare const useBaseWidget: (options: UseBaseWidgetOptions) => {
|
|
345
|
+
widgetId: string;
|
|
346
|
+
value: any;
|
|
347
|
+
formattedValue: any;
|
|
348
|
+
error: string[];
|
|
349
|
+
touched: boolean;
|
|
350
|
+
loading: boolean;
|
|
351
|
+
isVisible: boolean;
|
|
352
|
+
isEnabled: boolean;
|
|
353
|
+
onChange: (newValue: any, validate?: boolean) => void;
|
|
354
|
+
onBlur: () => void;
|
|
355
|
+
setError: (errors: string[]) => {
|
|
356
|
+
payload: {
|
|
357
|
+
widgetId: string;
|
|
358
|
+
errors: string[];
|
|
359
|
+
};
|
|
360
|
+
type: "widget/setError";
|
|
361
|
+
};
|
|
362
|
+
getFieldValue: (path: string) => any;
|
|
363
|
+
dataSourceOptions: any[];
|
|
364
|
+
config: BaseWidgetConfig;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
interface WidgetRendererProps extends Omit<UseBaseWidgetOptions, 'config'> {
|
|
368
|
+
config: BaseWidgetConfig;
|
|
369
|
+
defaultComponent?: React$1.ComponentType<any>;
|
|
370
|
+
}
|
|
371
|
+
declare const WidgetRenderer: ({ config, apiAdapter: propApiAdapter, schemaData: propSchemaData, onValueChange, defaultComponent, }: WidgetRendererProps) => react_jsx_runtime.JSX.Element | null;
|
|
372
|
+
|
|
373
|
+
interface WidgetProviderProps {
|
|
374
|
+
store?: WidgetStore;
|
|
375
|
+
apiAdapter?: ApiAdapter;
|
|
376
|
+
schemaData?: Record<string, any>;
|
|
377
|
+
translate?: (key: string, options?: any) => string;
|
|
378
|
+
children: ReactNode;
|
|
379
|
+
}
|
|
380
|
+
declare const useWidgetContext: () => {
|
|
381
|
+
apiAdapter?: ApiAdapter;
|
|
382
|
+
schemaData?: Record<string, any>;
|
|
383
|
+
translate?: (key: string, options?: any) => string;
|
|
384
|
+
};
|
|
385
|
+
declare const WidgetProvider: ({ store, apiAdapter, schemaData, translate, children, }: WidgetProviderProps) => react_jsx_runtime.JSX.Element;
|
|
386
|
+
|
|
387
|
+
interface PanelRendererProps {
|
|
388
|
+
panel: PanelConfig;
|
|
389
|
+
apiAdapter?: UseBaseWidgetOptions['apiAdapter'];
|
|
390
|
+
schemaData?: UseBaseWidgetOptions['schemaData'];
|
|
391
|
+
onValueChange?: UseBaseWidgetOptions['onValueChange'];
|
|
392
|
+
isEditMode?: boolean;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Renders a panel with its nested panels or widgets
|
|
396
|
+
*
|
|
397
|
+
* Panels can contain:
|
|
398
|
+
* - Nested panels (for layout composition)
|
|
399
|
+
* - Widgets (for actual form inputs/controls)
|
|
400
|
+
*/
|
|
401
|
+
declare const PanelRenderer: ({ panel, apiAdapter, schemaData, onValueChange, isEditMode, }: PanelRendererProps) => react_jsx_runtime.JSX.Element;
|
|
402
|
+
|
|
403
|
+
type SectionMode = 'RegistryView' | 'CRView';
|
|
404
|
+
interface SectionsContainerProps {
|
|
405
|
+
sections: SectionConfig[];
|
|
406
|
+
apiAdapter?: UseBaseWidgetOptions['apiAdapter'];
|
|
407
|
+
schemaData?: UseBaseWidgetOptions['schemaData'];
|
|
408
|
+
onValueChange?: UseBaseWidgetOptions['onValueChange'];
|
|
409
|
+
className?: string;
|
|
410
|
+
onSectionSave?: (changes: SectionChanges) => Promise<void> | void;
|
|
411
|
+
hideEditButton?: boolean;
|
|
412
|
+
mode?: SectionMode;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Container component that renders multiple sections
|
|
416
|
+
*
|
|
417
|
+
* Layout behavior:
|
|
418
|
+
* - Uses CSS Grid for proper alignment
|
|
419
|
+
* - Each grid column = 200px (one vertical panel width)
|
|
420
|
+
* - Sections span columns based on their total vertical panel count
|
|
421
|
+
* - All sections align to the same grid, ensuring right-side alignment
|
|
422
|
+
* - Handles nested structure: multiple horizontal panels, each with multiple vertical panels
|
|
423
|
+
*/
|
|
424
|
+
declare const SectionsContainer: ({ sections, apiAdapter, schemaData, onValueChange, className, onSectionSave, hideEditButton, mode, }: SectionsContainerProps) => react_jsx_runtime.JSX.Element;
|
|
425
|
+
|
|
426
|
+
interface SectionChanges {
|
|
427
|
+
section_id: string;
|
|
428
|
+
section_schema: SectionConfig;
|
|
429
|
+
old_section_value: unknown;
|
|
430
|
+
new_section_value: unknown;
|
|
431
|
+
}
|
|
432
|
+
interface SectionRendererProps {
|
|
433
|
+
section: SectionConfig;
|
|
434
|
+
apiAdapter?: UseBaseWidgetOptions['apiAdapter'];
|
|
435
|
+
schemaData?: UseBaseWidgetOptions['schemaData'];
|
|
436
|
+
onValueChange?: UseBaseWidgetOptions['onValueChange'];
|
|
437
|
+
gridColumnSpan?: number;
|
|
438
|
+
onSectionSave?: (changes: SectionChanges) => Promise<void> | void;
|
|
439
|
+
hideEditButton?: boolean;
|
|
440
|
+
mode?: SectionMode;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Renders a section with its panels
|
|
444
|
+
*
|
|
445
|
+
* Layout behavior:
|
|
446
|
+
* - Section width is based on max 3 panels (or more on high resolution)
|
|
447
|
+
* - Panels wrap when they exceed available width
|
|
448
|
+
* - Sections can sit side-by-side if there's space
|
|
449
|
+
*/
|
|
450
|
+
declare const SectionRenderer: ({ section, apiAdapter, schemaData, onValueChange, gridColumnSpan, onSectionSave, hideEditButton, mode, }: SectionRendererProps) => react_jsx_runtime.JSX.Element;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Register all default/generic widgets
|
|
454
|
+
* This is called automatically when the package is imported
|
|
455
|
+
*/
|
|
456
|
+
declare const registerDefaultWidgets: () => void;
|
|
457
|
+
|
|
458
|
+
declare class WidgetRegistry {
|
|
459
|
+
private widgets;
|
|
460
|
+
/**
|
|
461
|
+
* Register a widget
|
|
462
|
+
*/
|
|
463
|
+
register(entry: WidgetRegistryEntry): void;
|
|
464
|
+
/**
|
|
465
|
+
* Register multiple widgets
|
|
466
|
+
*/
|
|
467
|
+
registerMany(entries: WidgetRegistryEntry[]): void;
|
|
468
|
+
/**
|
|
469
|
+
* Get widget entry
|
|
470
|
+
*/
|
|
471
|
+
get(widgetName: string): WidgetRegistryEntry | undefined;
|
|
472
|
+
/**
|
|
473
|
+
* Check if widget is registered
|
|
474
|
+
*/
|
|
475
|
+
has(widgetName: string): boolean;
|
|
476
|
+
/**
|
|
477
|
+
* Get all registered widgets
|
|
478
|
+
*/
|
|
479
|
+
getAll(): WidgetRegistryEntry[];
|
|
480
|
+
/**
|
|
481
|
+
* Unregister a widget
|
|
482
|
+
*/
|
|
483
|
+
unregister(widgetName: string): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Clear all widgets
|
|
486
|
+
*/
|
|
487
|
+
clear(): void;
|
|
488
|
+
/**
|
|
489
|
+
* Render widget component
|
|
490
|
+
*/
|
|
491
|
+
render(config: BaseWidgetConfig, context: any, defaultComponent?: React$1.ComponentType<any>): React$1.ReactNode;
|
|
492
|
+
}
|
|
493
|
+
declare const widgetRegistry: WidgetRegistry;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Generic text input widget with advanced features
|
|
497
|
+
* Supports all text-based inputs via configuration (text, email, password, number, tel, url, etc.)
|
|
498
|
+
*
|
|
499
|
+
* Features:
|
|
500
|
+
* - Allowed character types (any, alphabetic, alphanumeric, numeric, numeric-decimal, custom)
|
|
501
|
+
* - Case control (none, lowercase, uppercase, capitalize)
|
|
502
|
+
* - Length constraints with live character counter
|
|
503
|
+
* - Regular expression validation with custom messages
|
|
504
|
+
* - Input masking (static and dynamic)
|
|
505
|
+
* - Placeholder text with i18n support
|
|
506
|
+
*
|
|
507
|
+
* Usage in schema:
|
|
508
|
+
* {
|
|
509
|
+
* "widget": "text",
|
|
510
|
+
* "widget-type": "input",
|
|
511
|
+
* "widget-label": "Field Label",
|
|
512
|
+
* "widget-id": "fieldId",
|
|
513
|
+
* "widget-data-path": "person.name",
|
|
514
|
+
* "widget-data-format": {
|
|
515
|
+
* "inputType": "email",
|
|
516
|
+
* "characterType": "alphanumeric",
|
|
517
|
+
* "caseControl": "lowercase",
|
|
518
|
+
* "mask": {
|
|
519
|
+
* "pattern": "XXX-XXX-XXXX",
|
|
520
|
+
* "type": "static"
|
|
521
|
+
* },
|
|
522
|
+
* "showCharCounter": true
|
|
523
|
+
* },
|
|
524
|
+
* "widget-data-validation": {
|
|
525
|
+
* "validationType": "email", // Predefined type: "email", "phone", or "url"
|
|
526
|
+
* // OR use custom pattern:
|
|
527
|
+
* // "pattern": "^[a-z0-9]+$",
|
|
528
|
+
* // "patternMessage": "Only lowercase alphanumeric characters allowed",
|
|
529
|
+
* "minLength": 5,
|
|
530
|
+
* "maxLength": 20
|
|
531
|
+
* },
|
|
532
|
+
* "widget-required": true,
|
|
533
|
+
* "widget-data-placeholder": "Enter your value"
|
|
534
|
+
* }
|
|
535
|
+
*/
|
|
536
|
+
interface TextInputWidgetProps {
|
|
537
|
+
config: BaseWidgetConfig;
|
|
538
|
+
}
|
|
539
|
+
declare const TextInputWidget: ({ config }: TextInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Number input widget with advanced numeric features
|
|
543
|
+
*
|
|
544
|
+
* Features:
|
|
545
|
+
* - Numeric type (integer/decimal, signed/unsigned)
|
|
546
|
+
* - Decimal precision control (0-6 places, rounding/truncation)
|
|
547
|
+
* - Value range validation (min/max)
|
|
548
|
+
* - Regular expression validation with custom messages
|
|
549
|
+
* - Maximum character limit
|
|
550
|
+
* - Numeric masking and formatting (thousand/decimal separators)
|
|
551
|
+
* - Text alignment (right by default, configurable)
|
|
552
|
+
* - Key input restrictions
|
|
553
|
+
*
|
|
554
|
+
* Usage in schema:
|
|
555
|
+
* {
|
|
556
|
+
* "widget": "number",
|
|
557
|
+
* "widget-type": "input",
|
|
558
|
+
* "widget-label": "Amount",
|
|
559
|
+
* "widget-id": "amount",
|
|
560
|
+
* "widget-data-path": "transaction.amount",
|
|
561
|
+
* "widget-data-format": {
|
|
562
|
+
* "numericType": "decimal",
|
|
563
|
+
* "decimalPlaces": 2,
|
|
564
|
+
* "roundingMode": "round",
|
|
565
|
+
* "thousandSeparator": ",",
|
|
566
|
+
* "decimalSeparator": ".",
|
|
567
|
+
* "textAlign": "right",
|
|
568
|
+
* "allowSigned": true,
|
|
569
|
+
* "formatOnBlur": true
|
|
570
|
+
* },
|
|
571
|
+
* "widget-data-validation": {
|
|
572
|
+
* "min": 0,
|
|
573
|
+
* "max": 10000,
|
|
574
|
+
* "pattern": "^[0-9]+(\\.[0-9]{1,2})?$",
|
|
575
|
+
* "patternMessage": "Invalid number format"
|
|
576
|
+
* },
|
|
577
|
+
* "widget-required": true,
|
|
578
|
+
* "widget-data-placeholder": "Enter amount"
|
|
579
|
+
* }
|
|
580
|
+
*/
|
|
581
|
+
interface NumberInputWidgetProps {
|
|
582
|
+
config: BaseWidgetConfig;
|
|
583
|
+
}
|
|
584
|
+
declare const NumberInputWidget: ({ config }: NumberInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Boolean widget with advanced features
|
|
588
|
+
*
|
|
589
|
+
* Features:
|
|
590
|
+
* - Boolean representation (true/false, yes/no, on/off, custom labels)
|
|
591
|
+
* - Control type (checkbox, radio buttons, toggle/switch)
|
|
592
|
+
* - Default value (true, false, unset/null)
|
|
593
|
+
* - Required vs optional
|
|
594
|
+
* - Layout options (horizontal/vertical)
|
|
595
|
+
*
|
|
596
|
+
* Usage in schema:
|
|
597
|
+
* {
|
|
598
|
+
* "widget": "boolean",
|
|
599
|
+
* "widget-type": "input",
|
|
600
|
+
* "widget-label": "Is Married",
|
|
601
|
+
* "widget-id": "married",
|
|
602
|
+
* "widget-data-path": "person.married",
|
|
603
|
+
* "widget-data-default": false,
|
|
604
|
+
* "widget-data-format": {
|
|
605
|
+
* "booleanRepresentation": "yes-no",
|
|
606
|
+
* "booleanControlType": "radio",
|
|
607
|
+
* "allowUnset": true
|
|
608
|
+
* },
|
|
609
|
+
* "widget-data-validation": {},
|
|
610
|
+
* "widget-required": false,
|
|
611
|
+
* "widget-orientation": "horizontal"
|
|
612
|
+
* }
|
|
613
|
+
*/
|
|
614
|
+
interface BooleanWidgetProps {
|
|
615
|
+
config: BaseWidgetConfig;
|
|
616
|
+
}
|
|
617
|
+
declare const BooleanWidget: ({ config }: BooleanWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Date input widget with advanced features
|
|
621
|
+
*
|
|
622
|
+
* Features:
|
|
623
|
+
* - Configurable date format (DD/MM/YYYY, MM/DD/YYYY, YYYY-MM-DD, etc.)
|
|
624
|
+
* - Default value (none / today)
|
|
625
|
+
* - Date constraints (minDate, maxDate, any/past only/future only)
|
|
626
|
+
* - Required vs optional
|
|
627
|
+
* - Input method (date picker / manual / hybrid)
|
|
628
|
+
* - Placeholder text
|
|
629
|
+
* - Read-only & disabled
|
|
630
|
+
* - Canonical stored format (ISO 8601)
|
|
631
|
+
*
|
|
632
|
+
* Usage in schema:
|
|
633
|
+
* {
|
|
634
|
+
* "widget": "date",
|
|
635
|
+
* "widget-type": "input",
|
|
636
|
+
* "widget-label": "Date of Birth",
|
|
637
|
+
* "widget-id": "dob",
|
|
638
|
+
* "widget-data-path": "person.dob",
|
|
639
|
+
* "widget-data-default": "today",
|
|
640
|
+
* "widget-data-format": {
|
|
641
|
+
* "dateFormat": "DD/MM/YYYY",
|
|
642
|
+
* "inputMethod": "hybrid",
|
|
643
|
+
* "dateConstraint": "past-only"
|
|
644
|
+
* },
|
|
645
|
+
* "widget-data-options": {
|
|
646
|
+
* "minDate": "1900-01-01",
|
|
647
|
+
* "maxDate": "today"
|
|
648
|
+
* },
|
|
649
|
+
* "widget-data-validation": {},
|
|
650
|
+
* "widget-required": true,
|
|
651
|
+
* "widget-data-placeholder": "DD/MM/YYYY"
|
|
652
|
+
* }
|
|
653
|
+
*/
|
|
654
|
+
interface DateInputWidgetProps {
|
|
655
|
+
config: BaseWidgetConfig;
|
|
656
|
+
}
|
|
657
|
+
declare const DateInputWidget: ({ config }: DateInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* DateTime input widget with advanced features
|
|
661
|
+
*
|
|
662
|
+
* Features:
|
|
663
|
+
* - Configurable datetime format (DD/MM/YYYY HH:mm, MM/DD/YYYY HH:mm:ss, etc.)
|
|
664
|
+
* - Default value (none / now)
|
|
665
|
+
* - DateTime constraints (minDateTime, maxDateTime, any/past only/future only)
|
|
666
|
+
* - Required vs optional
|
|
667
|
+
* - Input method (datetime picker / manual / hybrid)
|
|
668
|
+
* - Placeholder text
|
|
669
|
+
* - Read-only & disabled
|
|
670
|
+
* - Canonical stored format (ISO 8601 with time)
|
|
671
|
+
*
|
|
672
|
+
* Usage in schema:
|
|
673
|
+
* {
|
|
674
|
+
* "widget": "datetime",
|
|
675
|
+
* "widget-type": "input",
|
|
676
|
+
* "widget-label": "Appointment Time",
|
|
677
|
+
* "widget-id": "appointment",
|
|
678
|
+
* "widget-data-path": "appointment.datetime",
|
|
679
|
+
* "widget-data-default": "now",
|
|
680
|
+
* "widget-data-format": {
|
|
681
|
+
* "dateTimeFormat": "DD/MM/YYYY HH:mm",
|
|
682
|
+
* "inputMethod": "picker",
|
|
683
|
+
* "dateTimeConstraint": "future-only"
|
|
684
|
+
* },
|
|
685
|
+
* "widget-data-options": {
|
|
686
|
+
* "minDateTime": "2024-01-01T00:00",
|
|
687
|
+
* "maxDateTime": "now"
|
|
688
|
+
* },
|
|
689
|
+
* "widget-data-validation": {},
|
|
690
|
+
* "widget-required": true,
|
|
691
|
+
* "widget-data-placeholder": "DD/MM/YYYY HH:mm"
|
|
692
|
+
* }
|
|
693
|
+
*/
|
|
694
|
+
interface DateTimeInputWidgetProps {
|
|
695
|
+
config: BaseWidgetConfig;
|
|
696
|
+
}
|
|
697
|
+
declare const DateTimeInputWidget: ({ config }: DateTimeInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Select/Dropdown widget with data source support
|
|
701
|
+
*
|
|
702
|
+
* Usage in schema:
|
|
703
|
+
* {
|
|
704
|
+
* "widget": "select",
|
|
705
|
+
* "widget-type": "input",
|
|
706
|
+
* "widget-label": "Country",
|
|
707
|
+
* "widget-id": "country",
|
|
708
|
+
* "widget-data-path": "address.country",
|
|
709
|
+
* "widget-data-source": {
|
|
710
|
+
* "type": "static" | "api" | "schema",
|
|
711
|
+
* ...
|
|
712
|
+
* }
|
|
713
|
+
* }
|
|
714
|
+
*/
|
|
715
|
+
interface SelectWidgetProps {
|
|
716
|
+
config: BaseWidgetConfig;
|
|
717
|
+
}
|
|
718
|
+
declare const SelectWidget: ({ config }: SelectWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Radio button widget with advanced features
|
|
722
|
+
*
|
|
723
|
+
* Features:
|
|
724
|
+
* - Static list of options
|
|
725
|
+
* - Dynamic options (from API / dataset)
|
|
726
|
+
* - Ordered options (preserve order or sort)
|
|
727
|
+
* - Option label & value separation
|
|
728
|
+
* - Display label
|
|
729
|
+
* - Stored value
|
|
730
|
+
* - Default selection (pre-selected option or unset)
|
|
731
|
+
* - Required vs optional
|
|
732
|
+
* - Layout options (vertical, horizontal, grid)
|
|
733
|
+
*
|
|
734
|
+
* Usage in schema:
|
|
735
|
+
* {
|
|
736
|
+
* "widget": "radio",
|
|
737
|
+
* "widget-type": "input",
|
|
738
|
+
* "widget-label": "Gender",
|
|
739
|
+
* "widget-id": "gender",
|
|
740
|
+
* "widget-data-path": "person.gender",
|
|
741
|
+
* "widget-data-default": "male",
|
|
742
|
+
* "widget-data-source": {
|
|
743
|
+
* "type": "static",
|
|
744
|
+
* "options": [
|
|
745
|
+
* { "value": "male", "label": "Male" },
|
|
746
|
+
* { "value": "female", "label": "Female" },
|
|
747
|
+
* { "value": "other", "label": "Other" }
|
|
748
|
+
* ]
|
|
749
|
+
* },
|
|
750
|
+
* "widget-data-format": {
|
|
751
|
+
* "layout": "vertical",
|
|
752
|
+
* "sortOptions": false
|
|
753
|
+
* },
|
|
754
|
+
* "widget-required": true
|
|
755
|
+
* }
|
|
756
|
+
*/
|
|
757
|
+
interface RadioWidgetProps {
|
|
758
|
+
config: BaseWidgetConfig;
|
|
759
|
+
}
|
|
760
|
+
declare const RadioWidget: ({ config }: RadioWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Checkbox widget with advanced features
|
|
764
|
+
*
|
|
765
|
+
* Features:
|
|
766
|
+
* - Single checkbox (boolean) - when no data source
|
|
767
|
+
* - Multiple checkboxes (array) - when data source provided
|
|
768
|
+
* - Static list of options
|
|
769
|
+
* - Dynamic options (from API / dataset)
|
|
770
|
+
* - Ordered options (preserve order or sort)
|
|
771
|
+
* - Option label & value separation
|
|
772
|
+
* - Display label
|
|
773
|
+
* - Stored value (array for multi-select)
|
|
774
|
+
* - Default selection (pre-selected options or empty array)
|
|
775
|
+
* - Required vs optional (at least one must be selected if required)
|
|
776
|
+
* - Layout options (vertical, horizontal, grid)
|
|
777
|
+
*
|
|
778
|
+
* Usage in schema (single checkbox):
|
|
779
|
+
* {
|
|
780
|
+
* "widget": "checkbox",
|
|
781
|
+
* "widget-type": "input",
|
|
782
|
+
* "widget-label": "I agree to terms",
|
|
783
|
+
* "widget-id": "agree",
|
|
784
|
+
* "widget-data-path": "form.agree",
|
|
785
|
+
* "widget-data-default": false
|
|
786
|
+
* }
|
|
787
|
+
*
|
|
788
|
+
* Usage in schema (multiple checkboxes):
|
|
789
|
+
* {
|
|
790
|
+
* "widget": "checkbox",
|
|
791
|
+
* "widget-type": "input",
|
|
792
|
+
* "widget-label": "Interests",
|
|
793
|
+
* "widget-id": "interests",
|
|
794
|
+
* "widget-data-path": "person.interests",
|
|
795
|
+
* "widget-data-default": ["sports"],
|
|
796
|
+
* "widget-data-source": {
|
|
797
|
+
* "type": "static",
|
|
798
|
+
* "options": [
|
|
799
|
+
* { "value": "sports", "label": "Sports" },
|
|
800
|
+
* { "value": "music", "label": "Music" },
|
|
801
|
+
* { "value": "reading", "label": "Reading" }
|
|
802
|
+
* ]
|
|
803
|
+
* },
|
|
804
|
+
* "widget-data-format": {
|
|
805
|
+
* "layout": "vertical",
|
|
806
|
+
* "sortOptions": false
|
|
807
|
+
* },
|
|
808
|
+
* "widget-required": true
|
|
809
|
+
* }
|
|
810
|
+
*/
|
|
811
|
+
interface CheckboxWidgetProps {
|
|
812
|
+
config: BaseWidgetConfig;
|
|
813
|
+
}
|
|
814
|
+
declare const CheckboxWidget: ({ config }: CheckboxWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* File input widget
|
|
818
|
+
*
|
|
819
|
+
* Usage in schema:
|
|
820
|
+
* {
|
|
821
|
+
* "widget": "file",
|
|
822
|
+
* "widget-type": "input",
|
|
823
|
+
* "widget-label": "Upload Document",
|
|
824
|
+
* "widget-id": "document",
|
|
825
|
+
* "widget-data-path": "form.document",
|
|
826
|
+
* "widget-data-options": {
|
|
827
|
+
* "accept": ".pdf,.doc,.docx",
|
|
828
|
+
* "multiple": false,
|
|
829
|
+
* "maxSize": 5242880 // 5MB in bytes
|
|
830
|
+
* }
|
|
831
|
+
* }
|
|
832
|
+
*/
|
|
833
|
+
interface FileInputWidgetProps {
|
|
834
|
+
config: BaseWidgetConfig;
|
|
835
|
+
}
|
|
836
|
+
declare const FileInputWidget: ({ config }: FileInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Simple table widget for structured data
|
|
840
|
+
*
|
|
841
|
+
* Usage in schema:
|
|
842
|
+
* {
|
|
843
|
+
* "widget": "simple-table",
|
|
844
|
+
* "widget-type": "table",
|
|
845
|
+
* "widget-label": "Education History",
|
|
846
|
+
* "widget-id": "educationHistory",
|
|
847
|
+
* "widget-data-path": "education.history",
|
|
848
|
+
* "widget-data-columns": [
|
|
849
|
+
* {
|
|
850
|
+
* "column-key": "degree",
|
|
851
|
+
* "widget-label": "Degree",
|
|
852
|
+
* "widget": "text",
|
|
853
|
+
* "widget-data-path": "degree"
|
|
854
|
+
* }
|
|
855
|
+
* ],
|
|
856
|
+
* "widget-data-operations": {
|
|
857
|
+
* "add": true,
|
|
858
|
+
* "remove": true,
|
|
859
|
+
* "edit": true
|
|
860
|
+
* }
|
|
861
|
+
* }
|
|
862
|
+
*/
|
|
863
|
+
interface SimpleTableWidgetProps {
|
|
864
|
+
config: BaseWidgetConfig;
|
|
865
|
+
}
|
|
866
|
+
declare const SimpleTableWidget: ({ config }: SimpleTableWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Array widget for simple repeating values
|
|
870
|
+
*
|
|
871
|
+
* Usage in schema:
|
|
872
|
+
* {
|
|
873
|
+
* "widget": "array-widget",
|
|
874
|
+
* "widget-type": "group",
|
|
875
|
+
* "widget-label": "Skills",
|
|
876
|
+
* "widget-id": "skills",
|
|
877
|
+
* "widget-data-path": "person.skills",
|
|
878
|
+
* "widget-item": {
|
|
879
|
+
* "widget": "text",
|
|
880
|
+
* "widget-type": "input",
|
|
881
|
+
* "widget-label": "Skill"
|
|
882
|
+
* },
|
|
883
|
+
* "widget-data-add-label": "Add Skill",
|
|
884
|
+
* "widget-data-operations": {
|
|
885
|
+
* "add": true,
|
|
886
|
+
* "remove": true
|
|
887
|
+
* }
|
|
888
|
+
* }
|
|
889
|
+
*/
|
|
890
|
+
interface ArrayWidgetProps {
|
|
891
|
+
config: BaseWidgetConfig;
|
|
892
|
+
}
|
|
893
|
+
declare const ArrayWidget: ({ config }: ArrayWidgetProps) => react_jsx_runtime.JSX.Element | null;
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Iterable accordion widget - expandable/collapsible container for widgets
|
|
897
|
+
*
|
|
898
|
+
* Usage in schema:
|
|
899
|
+
* {
|
|
900
|
+
* "widget": "iterable-accordion",
|
|
901
|
+
* "widget-type": "group",
|
|
902
|
+
* "widget-label": "Advanced Options",
|
|
903
|
+
* "widget-id": "advancedOptions",
|
|
904
|
+
* "widget-data-path": "person.notes",
|
|
905
|
+
* "widget-data-collapsed": true,
|
|
906
|
+
* "widget-item": {
|
|
907
|
+
* "widget": "text",
|
|
908
|
+
* "widget-type": "input",
|
|
909
|
+
* "widget-label": "Additional Notes",
|
|
910
|
+
* "widget-id": "notes",
|
|
911
|
+
* ...
|
|
912
|
+
* }
|
|
913
|
+
* }
|
|
914
|
+
*
|
|
915
|
+
* Note: widget-item can be any widget config. If it has nested widgets property,
|
|
916
|
+
* those will be rendered as well.
|
|
917
|
+
*/
|
|
918
|
+
interface IterableAccordionWidgetProps {
|
|
919
|
+
config: BaseWidgetConfig;
|
|
920
|
+
}
|
|
921
|
+
declare const IterableAccordionWidget: ({ config }: IterableAccordionWidgetProps) => react_jsx_runtime.JSX.Element | null;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Phone input widget with formatting
|
|
925
|
+
*
|
|
926
|
+
* Usage in schema:
|
|
927
|
+
* {
|
|
928
|
+
* "widget": "phone",
|
|
929
|
+
* "widget-type": "input",
|
|
930
|
+
* "widget-label": "Phone",
|
|
931
|
+
* "widget-id": "phone",
|
|
932
|
+
* "widget-data-path": "person.phone",
|
|
933
|
+
* "widget-data-format": {
|
|
934
|
+
* "pattern": "(XXX) XXX-XXXX"
|
|
935
|
+
* }
|
|
936
|
+
* }
|
|
937
|
+
*/
|
|
938
|
+
interface PhoneInputWidgetProps {
|
|
939
|
+
config: BaseWidgetConfig;
|
|
940
|
+
}
|
|
941
|
+
declare const PhoneInputWidget: ({ config }: PhoneInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
942
|
+
|
|
943
|
+
/**
|
|
944
|
+
* Currency input widget with formatting
|
|
945
|
+
*
|
|
946
|
+
* Usage in schema:
|
|
947
|
+
* {
|
|
948
|
+
* "widget": "currency",
|
|
949
|
+
* "widget-type": "input",
|
|
950
|
+
* "widget-label": "Salary",
|
|
951
|
+
* "widget-id": "salary",
|
|
952
|
+
* "widget-data-path": "person.salary",
|
|
953
|
+
* "widget-data-format": {
|
|
954
|
+
* "currency": "USD",
|
|
955
|
+
* "locale": "en-US",
|
|
956
|
+
* "decimals": 2
|
|
957
|
+
* }
|
|
958
|
+
* }
|
|
959
|
+
*/
|
|
960
|
+
interface CurrencyInputWidgetProps {
|
|
961
|
+
config: BaseWidgetConfig;
|
|
962
|
+
}
|
|
963
|
+
declare const CurrencyInputWidget: ({ config }: CurrencyInputWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* Display widget for readonly text display
|
|
967
|
+
* Used for displaying information in a card layout
|
|
968
|
+
*/
|
|
969
|
+
interface DisplayWidgetProps {
|
|
970
|
+
config: BaseWidgetConfig;
|
|
971
|
+
}
|
|
972
|
+
declare const DisplayWidget: ({ config }: DisplayWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Table widget with record-level inline editing
|
|
976
|
+
*
|
|
977
|
+
* Usage in schema:
|
|
978
|
+
* {
|
|
979
|
+
* "widget": "table",
|
|
980
|
+
* "widget-type": "table",
|
|
981
|
+
* "widget-label": "Education History",
|
|
982
|
+
* "widget-id": "educationHistory",
|
|
983
|
+
* "widget-data-path": "education.history",
|
|
984
|
+
* "widget-data-columns": [
|
|
985
|
+
* {
|
|
986
|
+
* "column-key": "degree",
|
|
987
|
+
* "widget-label": "Degree",
|
|
988
|
+
* "widget": "text",
|
|
989
|
+
* "widget-type": "input",
|
|
990
|
+
* "widget-data-path": "degree",
|
|
991
|
+
* "widget-data-format": {...}
|
|
992
|
+
* },
|
|
993
|
+
* {
|
|
994
|
+
* "column-key": "year",
|
|
995
|
+
* "widget-label": "Year",
|
|
996
|
+
* "widget": "number",
|
|
997
|
+
* "widget-type": "input",
|
|
998
|
+
* "widget-data-path": "year"
|
|
999
|
+
* }
|
|
1000
|
+
* ],
|
|
1001
|
+
* "widget-data-operations": {
|
|
1002
|
+
* "add": true,
|
|
1003
|
+
* "remove": true,
|
|
1004
|
+
* "edit": true
|
|
1005
|
+
* },
|
|
1006
|
+
* "widget-data-api": {
|
|
1007
|
+
* "add": { "url": "/api/records", "method": "POST" },
|
|
1008
|
+
* "edit": { "url": "/api/records/{id}", "method": "PUT" },
|
|
1009
|
+
* "delete": { "url": "/api/records/{id}", "method": "DELETE" }
|
|
1010
|
+
* }
|
|
1011
|
+
* }
|
|
1012
|
+
*/
|
|
1013
|
+
interface TableWidgetProps {
|
|
1014
|
+
config: BaseWidgetConfig;
|
|
1015
|
+
}
|
|
1016
|
+
declare const TableWidget: ({ config }: TableWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Profile widget for displaying user identity information
|
|
1020
|
+
* Displays an image/avatar, display name, and ID in a vertical layout
|
|
1021
|
+
*
|
|
1022
|
+
* This is a display widget that groups related profile fields together.
|
|
1023
|
+
* Recommended widget-type: 'group' (groups related data fields)
|
|
1024
|
+
* Alternative: 'layout' (for display-only, no value storage)
|
|
1025
|
+
*
|
|
1026
|
+
* Configuration (Recommended - Multi-path data binding):
|
|
1027
|
+
*
|
|
1028
|
+
* - widget-data-path: Object with keys 'image', 'name', 'id' mapping to data paths
|
|
1029
|
+
* Example: { "image": "person.photo", "name": "person.name", "id": "person.id" }
|
|
1030
|
+
*
|
|
1031
|
+
* Alternative (Individual path properties - fallback):
|
|
1032
|
+
* - widget-image-path?: string - Data path for the image/photo (e.g., "person.photo")
|
|
1033
|
+
* - widget-name-path?: string - Data path for the display name (e.g., "person.name")
|
|
1034
|
+
* - widget-id-path?: string - Data path for the ID (e.g., "person.id")
|
|
1035
|
+
*
|
|
1036
|
+
* Format options:
|
|
1037
|
+
* - widget-data-format: Optional format configuration
|
|
1038
|
+
* - imageSize?: number - Size of the avatar image in pixels (default: 80)
|
|
1039
|
+
* - nameColor?: string - Color for the name text (default: '#ED7C22')
|
|
1040
|
+
* - showIdLabel?: boolean - Whether to show "ID :" label (default: true)
|
|
1041
|
+
*
|
|
1042
|
+
* Example usage (Recommended):
|
|
1043
|
+
* ```json
|
|
1044
|
+
* {
|
|
1045
|
+
* "widget": "profile",
|
|
1046
|
+
* "widget-type": "group",
|
|
1047
|
+
* "widget-id": "user-profile",
|
|
1048
|
+
* "widget-data-path": {
|
|
1049
|
+
* "image": "photo",
|
|
1050
|
+
* "name": "display_name",
|
|
1051
|
+
* "id": "national_id"
|
|
1052
|
+
* },
|
|
1053
|
+
* "widget-data-format": {
|
|
1054
|
+
* "imageSize": 80,
|
|
1055
|
+
* "nameColor": "#ED7C22",
|
|
1056
|
+
* "showIdLabel": true
|
|
1057
|
+
* }
|
|
1058
|
+
* }
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
interface ProfileWidgetProps {
|
|
1062
|
+
config: BaseWidgetConfig;
|
|
1063
|
+
}
|
|
1064
|
+
declare const ProfileWidget: ({ config }: ProfileWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* TextArea widget for multi-line text input
|
|
1068
|
+
* Supports 2 rows by default with configurable rows
|
|
1069
|
+
*
|
|
1070
|
+
* Features:
|
|
1071
|
+
* - Multi-line text input
|
|
1072
|
+
* - Character type filtering (any, alphabetic, alphanumeric, numeric, etc.)
|
|
1073
|
+
* - Case control (none, lowercase, uppercase, capitalize)
|
|
1074
|
+
* - Length constraints with live character counter
|
|
1075
|
+
* - Regular expression validation with custom messages
|
|
1076
|
+
* - Placeholder text with i18n support
|
|
1077
|
+
*
|
|
1078
|
+
* Usage in schema:
|
|
1079
|
+
* {
|
|
1080
|
+
* "widget": "textarea",
|
|
1081
|
+
* "widget-type": "input",
|
|
1082
|
+
* "widget-label": "Description",
|
|
1083
|
+
* "widget-id": "description",
|
|
1084
|
+
* "widget-data-path": "person.description",
|
|
1085
|
+
* "widget-data-format": {
|
|
1086
|
+
* "characterType": "any",
|
|
1087
|
+
* "caseControl": "none",
|
|
1088
|
+
* "showCharCounter": true,
|
|
1089
|
+
* "rows": 2
|
|
1090
|
+
* },
|
|
1091
|
+
* "widget-data-validation": {
|
|
1092
|
+
* "minLength": 10,
|
|
1093
|
+
* "maxLength": 500
|
|
1094
|
+
* },
|
|
1095
|
+
* "widget-required": true,
|
|
1096
|
+
* "widget-data-placeholder": "Enter description"
|
|
1097
|
+
* }
|
|
1098
|
+
*/
|
|
1099
|
+
interface TextAreaWidgetProps {
|
|
1100
|
+
config: BaseWidgetConfig;
|
|
1101
|
+
}
|
|
1102
|
+
declare const TextAreaWidget: ({ config }: TextAreaWidgetProps) => react_jsx_runtime.JSX.Element;
|
|
1103
|
+
|
|
1104
|
+
/**
|
|
1105
|
+
* Get value from object using dot notation path
|
|
1106
|
+
* Safely handles nested paths like "person.name" or "address.street.number"
|
|
1107
|
+
*/
|
|
1108
|
+
declare const getValueByPath: (obj: any, path: string) => any;
|
|
1109
|
+
/**
|
|
1110
|
+
* Set value in object using dot notation path
|
|
1111
|
+
* Safely creates nested objects as needed
|
|
1112
|
+
*/
|
|
1113
|
+
declare const setValueByPath: (obj: any, path: string, value: any) => any;
|
|
1114
|
+
/**
|
|
1115
|
+
* Parse widget data path (can be string or object)
|
|
1116
|
+
*/
|
|
1117
|
+
declare const parseDataPath: (dataPath: string | Record<string, string> | undefined) => string | Record<string, string> | null;
|
|
1118
|
+
/**
|
|
1119
|
+
* Get value from widget state using data path
|
|
1120
|
+
*/
|
|
1121
|
+
declare const getWidgetValue: (values: Record<string, any>, dataPath: string | Record<string, string> | undefined, widgetId: string) => any;
|
|
1122
|
+
/**
|
|
1123
|
+
* Set value in widget state using data path
|
|
1124
|
+
*/
|
|
1125
|
+
declare const setWidgetValue: (currentValues: Record<string, any>, dataPath: string | Record<string, string> | undefined, widgetId: string, value: any) => Record<string, any>;
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* Validate value against validation rules
|
|
1129
|
+
*/
|
|
1130
|
+
declare const validateWidget: (value: any, validation: WidgetValidation | undefined, required?: boolean) => string[];
|
|
1131
|
+
/**
|
|
1132
|
+
* Create Zod schema from validation config
|
|
1133
|
+
*/
|
|
1134
|
+
declare const createZodSchema: (validation: WidgetValidation | undefined, required?: boolean) => z.ZodSchema | null;
|
|
1135
|
+
|
|
1136
|
+
/**
|
|
1137
|
+
* Format date value
|
|
1138
|
+
*/
|
|
1139
|
+
declare const formatDate: (value: any, format: WidgetFormat | undefined) => string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Format currency value
|
|
1142
|
+
*/
|
|
1143
|
+
declare const formatCurrency: (value: any, format: WidgetFormat | undefined) => string;
|
|
1144
|
+
/**
|
|
1145
|
+
* Format phone number
|
|
1146
|
+
*/
|
|
1147
|
+
declare const formatPhone: (value: any, format: WidgetFormat | undefined) => string;
|
|
1148
|
+
/**
|
|
1149
|
+
* Format value based on widget format config
|
|
1150
|
+
*/
|
|
1151
|
+
declare const formatValue: (value: any, format: WidgetFormat | undefined, widgetType?: string) => string;
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Evaluate condition against field value
|
|
1155
|
+
*/
|
|
1156
|
+
declare const evaluateCondition: (condition: WidgetCondition, allValues: Record<string, any>) => boolean;
|
|
1157
|
+
/**
|
|
1158
|
+
* Check if widget should be visible based on conditions
|
|
1159
|
+
*/
|
|
1160
|
+
declare const shouldShowWidget: (options: {
|
|
1161
|
+
action?: string;
|
|
1162
|
+
condition?: WidgetCondition;
|
|
1163
|
+
} | undefined, allValues: Record<string, any>) => boolean;
|
|
1164
|
+
/**
|
|
1165
|
+
* Check if widget should be enabled based on conditions
|
|
1166
|
+
*/
|
|
1167
|
+
declare const shouldEnableWidget: (options: {
|
|
1168
|
+
action?: string;
|
|
1169
|
+
condition?: WidgetCondition;
|
|
1170
|
+
} | undefined, allValues: Record<string, any>) => boolean;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Get static data source options
|
|
1174
|
+
*/
|
|
1175
|
+
declare const getStaticDataSource: (dataSource: Extract<DataSource, {
|
|
1176
|
+
type: "static";
|
|
1177
|
+
}>) => any[];
|
|
1178
|
+
/**
|
|
1179
|
+
* Get API data source options
|
|
1180
|
+
*/
|
|
1181
|
+
declare const getApiDataSource: (dataSource: Extract<DataSource, {
|
|
1182
|
+
type: "api";
|
|
1183
|
+
}>, allValues: Record<string, any>, apiAdapter: ApiAdapter | undefined) => Promise<any[]>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Get schema reference data source options
|
|
1186
|
+
*/
|
|
1187
|
+
declare const getSchemaDataSource: (dataSource: Extract<DataSource, {
|
|
1188
|
+
type: "schema";
|
|
1189
|
+
}>, schemaData: Record<string, any>) => any[];
|
|
1190
|
+
/**
|
|
1191
|
+
* Transform data source options to { value, label } format
|
|
1192
|
+
*/
|
|
1193
|
+
declare const transformDataSourceOptions: (data: any[], valueKey?: string, labelKey?: string) => Array<{
|
|
1194
|
+
value: any;
|
|
1195
|
+
label: string;
|
|
1196
|
+
}>;
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Filter input value based on allowed character type
|
|
1200
|
+
*/
|
|
1201
|
+
declare const filterByCharacterType: (value: string, characterType?: CharacterType, customCharset?: string) => string;
|
|
1202
|
+
/**
|
|
1203
|
+
* Apply case transformation to text
|
|
1204
|
+
*/
|
|
1205
|
+
declare const applyCaseControl: (value: string, caseControl?: CaseControl) => string;
|
|
1206
|
+
/**
|
|
1207
|
+
* Apply input mask to value
|
|
1208
|
+
*/
|
|
1209
|
+
declare const applyMask: (value: string, mask: InputMask) => {
|
|
1210
|
+
displayValue: string;
|
|
1211
|
+
rawValue: string;
|
|
1212
|
+
};
|
|
1213
|
+
/**
|
|
1214
|
+
* Remove mask from value to get raw value
|
|
1215
|
+
*/
|
|
1216
|
+
declare const removeMask: (value: string, mask: InputMask) => string;
|
|
1217
|
+
|
|
1218
|
+
/**
|
|
1219
|
+
* Format number with thousand and decimal separators
|
|
1220
|
+
*/
|
|
1221
|
+
declare const formatNumber: (value: number | string, format: WidgetFormat | undefined) => string;
|
|
1222
|
+
/**
|
|
1223
|
+
* Parse formatted number string to number
|
|
1224
|
+
*/
|
|
1225
|
+
declare const parseNumber: (value: string, format: WidgetFormat | undefined) => number | null;
|
|
1226
|
+
/**
|
|
1227
|
+
* Apply decimal precision with rounding or truncation
|
|
1228
|
+
*/
|
|
1229
|
+
declare const applyDecimalPrecision: (value: number, format: WidgetFormat | undefined) => number;
|
|
1230
|
+
/**
|
|
1231
|
+
* Validate numeric value against constraints
|
|
1232
|
+
*/
|
|
1233
|
+
declare const validateNumericValue: (value: number | null, format: WidgetFormat | undefined, validation?: {
|
|
1234
|
+
min?: number;
|
|
1235
|
+
max?: number;
|
|
1236
|
+
pattern?: string;
|
|
1237
|
+
patternMessage?: string;
|
|
1238
|
+
}) => string[];
|
|
1239
|
+
/**
|
|
1240
|
+
* Check if a key is allowed for numeric input
|
|
1241
|
+
*/
|
|
1242
|
+
declare const isAllowedKey: (key: string, format: WidgetFormat | undefined, currentValue: string, event?: React.KeyboardEvent<HTMLInputElement>) => boolean;
|
|
1243
|
+
/**
|
|
1244
|
+
* Calculate character count including separators and sign
|
|
1245
|
+
*/
|
|
1246
|
+
declare const getFormattedNumberLength: (value: number | string | null, format: WidgetFormat | undefined) => number;
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Initialize i18n for the widget library
|
|
1250
|
+
* Can be customized by passing custom resources or configuration
|
|
1251
|
+
*
|
|
1252
|
+
* If no resources are provided, it will attempt to automatically load translations
|
|
1253
|
+
* from the consuming project's locale directory.
|
|
1254
|
+
*
|
|
1255
|
+
* If options are provided and the default instance is already initialized,
|
|
1256
|
+
* creates a new i18n instance to avoid reinitialization issues.
|
|
1257
|
+
*/
|
|
1258
|
+
declare const initI18n: (options?: {
|
|
1259
|
+
resources?: Record<string, any>;
|
|
1260
|
+
lng?: string;
|
|
1261
|
+
fallbackLng?: string;
|
|
1262
|
+
debug?: boolean;
|
|
1263
|
+
loadPath?: string | string[];
|
|
1264
|
+
autoLoad?: boolean;
|
|
1265
|
+
}) => Promise<i18next.i18n>;
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Custom hook for widget translations
|
|
1269
|
+
* Provides translation function with widget-specific namespace and fallback support
|
|
1270
|
+
*/
|
|
1271
|
+
declare const useWidgetTranslation: () => {
|
|
1272
|
+
t: (keyOrString: string | undefined | null, options?: {
|
|
1273
|
+
defaultValue?: string;
|
|
1274
|
+
[key: string]: any;
|
|
1275
|
+
}) => string;
|
|
1276
|
+
translate: (keyOrString: string | undefined | null, options?: {
|
|
1277
|
+
defaultValue?: string;
|
|
1278
|
+
[key: string]: any;
|
|
1279
|
+
}) => string;
|
|
1280
|
+
translateConfig: (value: string | undefined | null, fallback?: string) => string;
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
/**
|
|
1284
|
+
* Recursively translate widget configuration using translation keys
|
|
1285
|
+
* This utility helps transform a schema with translation keys into translated strings
|
|
1286
|
+
*
|
|
1287
|
+
* @param widgetConfig - Widget configuration that may contain translation keys
|
|
1288
|
+
* @param translate - Translation function (from useWidgetTranslation or i18next)
|
|
1289
|
+
* @returns Translated widget configuration
|
|
1290
|
+
*/
|
|
1291
|
+
declare const translateWidgetConfig: (widgetConfig: BaseWidgetConfig, translate: (key: string, options?: any) => string) => BaseWidgetConfig;
|
|
1292
|
+
/**
|
|
1293
|
+
* Recursively translate panel configuration
|
|
1294
|
+
*/
|
|
1295
|
+
declare const translatePanelConfig: (panel: PanelConfig, translate: (key: string, options?: any) => string) => PanelConfig;
|
|
1296
|
+
/**
|
|
1297
|
+
* Translate entire UI Schema
|
|
1298
|
+
*
|
|
1299
|
+
* @param schema - UI Schema with potential translation keys
|
|
1300
|
+
* @param translate - Translation function
|
|
1301
|
+
* @returns Translated UI Schema
|
|
1302
|
+
*/
|
|
1303
|
+
declare const translateUISchema: (schema: UISchema, translate: (key: string, options?: any) => string) => UISchema;
|
|
1304
|
+
|
|
1305
|
+
export { ArrayWidget, BooleanWidget, CheckboxWidget, CurrencyInputWidget, DateInputWidget, DateTimeInputWidget, DisplayWidget, FileInputWidget, IterableAccordionWidget, NumberInputWidget, PanelRenderer, PhoneInputWidget, ProfileWidget, RadioWidget, SectionRenderer, SectionsContainer, SelectWidget, SimpleTableWidget, TableWidget, TextAreaWidget, TextInputWidget, WidgetProvider, WidgetRenderer, applyCaseControl, applyDecimalPrecision, applyMask, createWidgetStore, createZodSchema, evaluateCondition, filterByCharacterType, formatCurrency, formatDate, formatNumber, formatPhone, formatValue, getApiDataSource, getFormattedNumberLength, getSchemaDataSource, getStaticDataSource, getValueByPath, getWidgetValue, initI18n, isAllowedKey, parseDataPath, parseNumber, registerDefaultWidgets, removeMask, resetAll, resetWidget, setDataSource, setError, setLoading, setTouched, setValue, setValueByPath, setValues, setWidgetValue, shouldEnableWidget, shouldShowWidget, transformDataSourceOptions, translatePanelConfig, translateUISchema, translateWidgetConfig, useBaseWidget, useWidgetContext, useWidgetTranslation, validateNumericValue, validateWidget, widgetRegistry };
|
|
1306
|
+
export type { ApiAdapter, ApiDataSource, BaseWidgetConfig, BooleanControlType, BooleanRepresentation, CaseControl, CharacterType, ConditionOperator, DataSource, DataSourceType, InputMask, NumericType, PanelConfig, RoundingMode, SchemaDataSource, SectionChanges, SectionConfig, SectionMode, SectionsContainerProps, StaticDataSource, SupportingDocumentConfig, TextAlign, UISchema, UseBaseWidgetOptions, ValidationType, WidgetCondition, WidgetContextValue, WidgetDataPath, WidgetDispatch, WidgetFormat, WidgetOptions, WidgetRegistryEntry, WidgetRenderFunction, WidgetRootState, WidgetState, WidgetStore, WidgetValidation, WidgetValue };
|