@uipath/apollo-wind 0.7.2-pr188.4865fad
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 +21 -0
- package/README.md +188 -0
- package/dist/components/forms/data-fetcher.cjs +250 -0
- package/dist/components/forms/data-fetcher.d.ts +173 -0
- package/dist/components/forms/data-fetcher.js +207 -0
- package/dist/components/forms/demo-mocks.cjs +1031 -0
- package/dist/components/forms/demo-mocks.d.ts +10 -0
- package/dist/components/forms/demo-mocks.js +997 -0
- package/dist/components/forms/field-renderer.cjs +595 -0
- package/dist/components/forms/field-renderer.d.ts +14 -0
- package/dist/components/forms/field-renderer.js +561 -0
- package/dist/components/forms/form-designer.cjs +2314 -0
- package/dist/components/forms/form-designer.d.ts +1 -0
- package/dist/components/forms/form-designer.js +2280 -0
- package/dist/components/forms/form-examples.cjs +962 -0
- package/dist/components/forms/form-examples.d.ts +46 -0
- package/dist/components/forms/form-examples.js +907 -0
- package/dist/components/forms/form-plugins.cjs +225 -0
- package/dist/components/forms/form-plugins.d.ts +11 -0
- package/dist/components/forms/form-plugins.js +176 -0
- package/dist/components/forms/form-schema.cjs +56 -0
- package/dist/components/forms/form-schema.d.ts +324 -0
- package/dist/components/forms/form-schema.js +13 -0
- package/dist/components/forms/form-state-viewer.cjs +498 -0
- package/dist/components/forms/form-state-viewer.d.ts +15 -0
- package/dist/components/forms/form-state-viewer.js +464 -0
- package/dist/components/forms/index.cjs +103 -0
- package/dist/components/forms/index.d.ts +13 -0
- package/dist/components/forms/index.js +9 -0
- package/dist/components/forms/metadata-form.cjs +400 -0
- package/dist/components/forms/metadata-form.d.ts +16 -0
- package/dist/components/forms/metadata-form.js +366 -0
- package/dist/components/forms/rules-engine.cjs +343 -0
- package/dist/components/forms/rules-engine.d.ts +99 -0
- package/dist/components/forms/rules-engine.js +293 -0
- package/dist/components/forms/schema-serializer.cjs +250 -0
- package/dist/components/forms/schema-serializer.d.ts +27 -0
- package/dist/components/forms/schema-serializer.js +213 -0
- package/dist/components/forms/schema-viewer.cjs +157 -0
- package/dist/components/forms/schema-viewer.d.ts +29 -0
- package/dist/components/forms/schema-viewer.js +117 -0
- package/dist/components/forms/validation-converter.cjs +154 -0
- package/dist/components/forms/validation-converter.d.ts +42 -0
- package/dist/components/forms/validation-converter.js +114 -0
- package/dist/components/ui/accordion.cjs +82 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +39 -0
- package/dist/components/ui/alert-dialog.cjs +126 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert-dialog.js +62 -0
- package/dist/components/ui/alert.cjs +77 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/alert.js +37 -0
- package/dist/components/ui/aspect-ratio.cjs +38 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +4 -0
- package/dist/components/ui/avatar.cjs +63 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/avatar.js +23 -0
- package/dist/components/ui/badge.cjs +63 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +26 -0
- package/dist/components/ui/breadcrumb.cjs +118 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/breadcrumb.js +66 -0
- package/dist/components/ui/button-group.cjs +68 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.js +28 -0
- package/dist/components/ui/button.cjs +78 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +41 -0
- package/dist/components/ui/calendar.cjs +144 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/calendar.js +107 -0
- package/dist/components/ui/card.cjs +89 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/card.js +40 -0
- package/dist/components/ui/checkbox.cjs +52 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.js +18 -0
- package/dist/components/ui/collapsible.cjs +45 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/combobox.cjs +102 -0
- package/dist/components/ui/combobox.d.ts +15 -0
- package/dist/components/ui/combobox.js +68 -0
- package/dist/components/ui/command.cjs +131 -0
- package/dist/components/ui/command.d.ts +80 -0
- package/dist/components/ui/command.js +73 -0
- package/dist/components/ui/context-menu.cjs +173 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/context-menu.js +97 -0
- package/dist/components/ui/data-table.cjs +292 -0
- package/dist/components/ui/data-table.d.ts +23 -0
- package/dist/components/ui/data-table.js +252 -0
- package/dist/components/ui/date-picker.cjs +118 -0
- package/dist/components/ui/date-picker.d.ts +21 -0
- package/dist/components/ui/date-picker.js +81 -0
- package/dist/components/ui/datetime-picker.cjs +154 -0
- package/dist/components/ui/datetime-picker.d.ts +9 -0
- package/dist/components/ui/datetime-picker.js +120 -0
- package/dist/components/ui/dialog.cjs +159 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +98 -0
- package/dist/components/ui/drawer.cjs +116 -0
- package/dist/components/ui/drawer.d.ts +18 -0
- package/dist/components/ui/drawer.js +55 -0
- package/dist/components/ui/dropdown-menu.cjs +174 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/dropdown-menu.js +98 -0
- package/dist/components/ui/editable-cell.cjs +256 -0
- package/dist/components/ui/editable-cell.d.ts +24 -0
- package/dist/components/ui/editable-cell.js +219 -0
- package/dist/components/ui/empty-state.cjs +73 -0
- package/dist/components/ui/empty-state.d.ts +16 -0
- package/dist/components/ui/empty-state.js +39 -0
- package/dist/components/ui/file-upload.cjs +236 -0
- package/dist/components/ui/file-upload.d.ts +10 -0
- package/dist/components/ui/file-upload.js +202 -0
- package/dist/components/ui/hover-card.cjs +55 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +15 -0
- package/dist/components/ui/index.cjs +546 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +55 -0
- package/dist/components/ui/input.cjs +45 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +11 -0
- package/dist/components/ui/label.cjs +47 -0
- package/dist/components/ui/label.d.ts +7 -0
- package/dist/components/ui/label.js +13 -0
- package/dist/components/ui/layout/column.cjs +84 -0
- package/dist/components/ui/layout/column.d.ts +21 -0
- package/dist/components/ui/layout/column.js +50 -0
- package/dist/components/ui/layout/grid.cjs +101 -0
- package/dist/components/ui/layout/grid.d.ts +22 -0
- package/dist/components/ui/layout/grid.js +67 -0
- package/dist/components/ui/layout/index.cjs +44 -0
- package/dist/components/ui/layout/index.d.ts +7 -0
- package/dist/components/ui/layout/index.js +4 -0
- package/dist/components/ui/layout/row.cjs +84 -0
- package/dist/components/ui/layout/row.d.ts +21 -0
- package/dist/components/ui/layout/row.js +50 -0
- package/dist/components/ui/layout/types.cjs +18 -0
- package/dist/components/ui/layout/types.d.ts +149 -0
- package/dist/components/ui/layout/types.js +0 -0
- package/dist/components/ui/layout/utils.cjs +324 -0
- package/dist/components/ui/layout/utils.d.ts +76 -0
- package/dist/components/ui/layout/utils.js +239 -0
- package/dist/components/ui/menubar.cjs +210 -0
- package/dist/components/ui/menubar.d.ts +28 -0
- package/dist/components/ui/menubar.js +131 -0
- package/dist/components/ui/multi-select.cjs +187 -0
- package/dist/components/ui/multi-select.d.ts +18 -0
- package/dist/components/ui/multi-select.js +153 -0
- package/dist/components/ui/navigation-menu.cjs +122 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/navigation-menu.js +64 -0
- package/dist/components/ui/pagination.cjs +131 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/pagination.js +79 -0
- package/dist/components/ui/popover.cjs +61 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/progress.cjs +51 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.cjs +61 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +24 -0
- package/dist/components/ui/resizable.cjs +60 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/resizable.js +20 -0
- package/dist/components/ui/scroll-area.cjs +67 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +30 -0
- package/dist/components/ui/search.cjs +153 -0
- package/dist/components/ui/search.d.ts +19 -0
- package/dist/components/ui/search.js +116 -0
- package/dist/components/ui/select.cjs +151 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/select.js +90 -0
- package/dist/components/ui/separator.cjs +47 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +13 -0
- package/dist/components/ui/sheet.cjs +142 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/sheet.js +81 -0
- package/dist/components/ui/skeleton.cjs +43 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +9 -0
- package/dist/components/ui/slider.cjs +63 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +29 -0
- package/dist/components/ui/sonner.cjs +76 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +39 -0
- package/dist/components/ui/spinner.cjs +78 -0
- package/dist/components/ui/spinner.d.ts +11 -0
- package/dist/components/ui/spinner.js +41 -0
- package/dist/components/ui/stats-card.cjs +102 -0
- package/dist/components/ui/stats-card.d.ts +15 -0
- package/dist/components/ui/stats-card.js +68 -0
- package/dist/components/ui/stepper.cjs +99 -0
- package/dist/components/ui/stepper.d.ts +14 -0
- package/dist/components/ui/stepper.js +65 -0
- package/dist/components/ui/switch.cjs +48 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +14 -0
- package/dist/components/ui/table.cjs +110 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +55 -0
- package/dist/components/ui/tabs.cjs +67 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +24 -0
- package/dist/components/ui/textarea.cjs +44 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.js +10 -0
- package/dist/components/ui/toggle-group.cjs +73 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle-group.js +36 -0
- package/dist/components/ui/toggle.cjs +71 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +34 -0
- package/dist/components/ui/tooltip.cjs +58 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +15 -0
- package/dist/examples/admin-layout-example.d.ts +92 -0
- package/dist/examples/app-shell-example.d.ts +52 -0
- package/dist/examples/dashboard-example.d.ts +11 -0
- package/dist/examples/data-management-example.d.ts +1 -0
- package/dist/examples/flow-editor-layout-example.d.ts +22 -0
- package/dist/examples/flow-start-example.d.ts +30 -0
- package/dist/examples/form-builder-example.d.ts +1 -0
- package/dist/examples/new-project-example.d.ts +30 -0
- package/dist/examples/settings-example.d.ts +1 -0
- package/dist/examples/vscode-example.d.ts +80 -0
- package/dist/index.cjs +830 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +67 -0
- package/dist/lib/index.cjs +42 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/utils.cjs +70 -0
- package/dist/lib/utils.d.ts +14 -0
- package/dist/lib/utils.js +30 -0
- package/dist/postcss.config.export.cjs +43 -0
- package/dist/postcss.config.export.js +9 -0
- package/dist/styles.css +6868 -0
- package/dist/tailwind.css +239 -0
- package/dist/tailwind.preset.cjs +77 -0
- package/dist/tailwind.preset.js +43 -0
- package/package.json +157 -0
- package/postcss.config.export.js +9 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
analyticsPlugin: ()=>analyticsPlugin,
|
|
28
|
+
auditPlugin: ()=>auditPlugin,
|
|
29
|
+
autoSavePlugin: ()=>autoSavePlugin,
|
|
30
|
+
formattingPlugin: ()=>formattingPlugin,
|
|
31
|
+
validationPlugin: ()=>validationPlugin,
|
|
32
|
+
workflowPlugin: ()=>workflowPlugin
|
|
33
|
+
});
|
|
34
|
+
const analyticsPlugin = {
|
|
35
|
+
name: 'analytics',
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
onFormInit: async (context)=>{
|
|
38
|
+
console.log('[Analytics] Form initialized:', context.schema.id);
|
|
39
|
+
},
|
|
40
|
+
onValueChange: (fieldName, value, _context)=>{
|
|
41
|
+
console.log('[Analytics] Field changed:', fieldName, value);
|
|
42
|
+
},
|
|
43
|
+
onSubmit: async (data, _context)=>{
|
|
44
|
+
console.log('[Analytics] Form submitted:', data);
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const autoSavePlugin = {
|
|
49
|
+
name: 'autoSave',
|
|
50
|
+
version: '1.0.0',
|
|
51
|
+
onFormInit: async (context)=>{
|
|
52
|
+
const draft = localStorage.getItem(`form_draft_${context.schema.id}`);
|
|
53
|
+
if (draft) {
|
|
54
|
+
const draftData = JSON.parse(draft);
|
|
55
|
+
Object.keys(draftData).forEach((key)=>{
|
|
56
|
+
context.form.setValue(key, draftData[key]);
|
|
57
|
+
});
|
|
58
|
+
console.log('[AutoSave] Draft restored');
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
onValueChange: (_fieldName, _value, context)=>{
|
|
62
|
+
const draftKey = `form_draft_${context.schema.id}`;
|
|
63
|
+
const win = window;
|
|
64
|
+
if (win.__autoSaveTimeout) clearTimeout(win.__autoSaveTimeout);
|
|
65
|
+
win.__autoSaveTimeout = setTimeout(()=>{
|
|
66
|
+
const values = context.form.getValues();
|
|
67
|
+
localStorage.setItem(draftKey, JSON.stringify(values));
|
|
68
|
+
console.log('[AutoSave] Draft saved');
|
|
69
|
+
}, 1000);
|
|
70
|
+
},
|
|
71
|
+
onSubmit: async (data, context)=>{
|
|
72
|
+
localStorage.removeItem(`form_draft_${context.schema.id}`);
|
|
73
|
+
console.log('[AutoSave] Draft cleared');
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const validationPlugin = {
|
|
78
|
+
name: 'validation',
|
|
79
|
+
version: '1.0.0',
|
|
80
|
+
validators: {
|
|
81
|
+
phone: {
|
|
82
|
+
pattern: '^\\+?[\\d\\s\\-()]+$',
|
|
83
|
+
messages: {
|
|
84
|
+
pattern: 'Invalid phone number format'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
strongPassword: {
|
|
88
|
+
minLength: 8,
|
|
89
|
+
pattern: '^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9]).+$',
|
|
90
|
+
messages: {
|
|
91
|
+
minLength: 'Password must be at least 8 characters',
|
|
92
|
+
pattern: 'Password must contain uppercase, lowercase, number, and special character'
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
creditCard: {
|
|
96
|
+
pattern: '^\\d{4}\\s?\\d{4}\\s?\\d{4}\\s?\\d{4}$',
|
|
97
|
+
messages: {
|
|
98
|
+
pattern: 'Invalid credit card number'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
url: {
|
|
102
|
+
url: true,
|
|
103
|
+
messages: {
|
|
104
|
+
url: 'Invalid URL format'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
postalCode: {
|
|
108
|
+
pattern: '^\\d{5}(-\\d{4})?$',
|
|
109
|
+
messages: {
|
|
110
|
+
pattern: 'Invalid US postal code'
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
onFieldRegister: (field, _context)=>{
|
|
115
|
+
if ('email' === field.type) console.log('[Validation] Email validation applied to:', field.name);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const workflowPlugin = {
|
|
119
|
+
name: 'workflow',
|
|
120
|
+
version: '1.0.0',
|
|
121
|
+
onFormInit: async (context)=>{
|
|
122
|
+
const win = window;
|
|
123
|
+
const workflowContext = win.__workflowContext;
|
|
124
|
+
if (workflowContext) {
|
|
125
|
+
console.log('[Workflow] Loading workflow context:', workflowContext);
|
|
126
|
+
if (workflowContext.variables) Object.entries(workflowContext.variables).forEach(([key, value])=>{
|
|
127
|
+
context.form.setValue(key, value);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
onSubmit: async (data, _context)=>{
|
|
132
|
+
console.log('[Workflow] Submitting to workflow engine');
|
|
133
|
+
const win = window;
|
|
134
|
+
const workflowContext = win.__workflowContext;
|
|
135
|
+
if (workflowContext?.submitEndpoint) try {
|
|
136
|
+
const response = await fetch(workflowContext.submitEndpoint, {
|
|
137
|
+
method: 'POST',
|
|
138
|
+
headers: {
|
|
139
|
+
'Content-Type': 'application/json'
|
|
140
|
+
},
|
|
141
|
+
body: JSON.stringify({
|
|
142
|
+
workflowId: workflowContext.workflowId,
|
|
143
|
+
activityId: workflowContext.activityId,
|
|
144
|
+
formData: data
|
|
145
|
+
})
|
|
146
|
+
});
|
|
147
|
+
if (!response.ok) throw new Error('Workflow submission failed');
|
|
148
|
+
return await response.json();
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.error('[Workflow] Submission error:', error);
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
return data;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const auditPlugin = {
|
|
157
|
+
name: 'audit',
|
|
158
|
+
version: '1.0.0',
|
|
159
|
+
onFormInit: async (_context)=>{
|
|
160
|
+
const win = window;
|
|
161
|
+
win.__fieldHistory = new Map();
|
|
162
|
+
console.log('[Audit] Audit trail initialized');
|
|
163
|
+
},
|
|
164
|
+
onValueChange: (fieldName, value, _context)=>{
|
|
165
|
+
const win = window;
|
|
166
|
+
const history = win.__fieldHistory;
|
|
167
|
+
if (!history) return;
|
|
168
|
+
if (!history.has(fieldName)) history.set(fieldName, []);
|
|
169
|
+
history.get(fieldName).push({
|
|
170
|
+
value,
|
|
171
|
+
timestamp: new Date().toISOString(),
|
|
172
|
+
user: win.__currentUser?.id || 'anonymous'
|
|
173
|
+
});
|
|
174
|
+
console.log('[Audit] Field history updated:', fieldName);
|
|
175
|
+
},
|
|
176
|
+
onSubmit: async (data, _context)=>{
|
|
177
|
+
const win = window;
|
|
178
|
+
const history = win.__fieldHistory;
|
|
179
|
+
return {
|
|
180
|
+
...data,
|
|
181
|
+
_audit: {
|
|
182
|
+
fieldHistory: history ? Object.fromEntries(history) : {},
|
|
183
|
+
submittedAt: new Date().toISOString(),
|
|
184
|
+
submittedBy: win.__currentUser?.id || 'anonymous'
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const formattingPlugin = {
|
|
190
|
+
name: 'formatting',
|
|
191
|
+
version: '1.0.0',
|
|
192
|
+
customConditions: {
|
|
193
|
+
isBusinessHours: (value)=>{
|
|
194
|
+
const hour = new Date(value).getHours();
|
|
195
|
+
return hour >= 9 && hour < 17;
|
|
196
|
+
},
|
|
197
|
+
isWeekend: (value)=>{
|
|
198
|
+
const day = new Date(value).getDay();
|
|
199
|
+
return 0 === day || 6 === day;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
onValueChange: (fieldName, _value, context)=>{
|
|
203
|
+
const field = context.schema.sections?.flatMap((s)=>s.fields).find((f)=>f.name === fieldName);
|
|
204
|
+
if (!field) return;
|
|
205
|
+
const error = context.errors[fieldName];
|
|
206
|
+
if (error) console.log('[Formatting] Error styling applied to:', fieldName);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
exports.analyticsPlugin = __webpack_exports__.analyticsPlugin;
|
|
210
|
+
exports.auditPlugin = __webpack_exports__.auditPlugin;
|
|
211
|
+
exports.autoSavePlugin = __webpack_exports__.autoSavePlugin;
|
|
212
|
+
exports.formattingPlugin = __webpack_exports__.formattingPlugin;
|
|
213
|
+
exports.validationPlugin = __webpack_exports__.validationPlugin;
|
|
214
|
+
exports.workflowPlugin = __webpack_exports__.workflowPlugin;
|
|
215
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
216
|
+
"analyticsPlugin",
|
|
217
|
+
"auditPlugin",
|
|
218
|
+
"autoSavePlugin",
|
|
219
|
+
"formattingPlugin",
|
|
220
|
+
"validationPlugin",
|
|
221
|
+
"workflowPlugin"
|
|
222
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
223
|
+
Object.defineProperty(exports, '__esModule', {
|
|
224
|
+
value: true
|
|
225
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormPlugin } from './form-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Example Plugins for the Metadata Form System
|
|
4
|
+
* Demonstrates extensibility through the plugin architecture
|
|
5
|
+
*/
|
|
6
|
+
export declare const analyticsPlugin: FormPlugin;
|
|
7
|
+
export declare const autoSavePlugin: FormPlugin;
|
|
8
|
+
export declare const validationPlugin: FormPlugin;
|
|
9
|
+
export declare const workflowPlugin: FormPlugin;
|
|
10
|
+
export declare const auditPlugin: FormPlugin;
|
|
11
|
+
export declare const formattingPlugin: FormPlugin;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
const analyticsPlugin = {
|
|
2
|
+
name: 'analytics',
|
|
3
|
+
version: '1.0.0',
|
|
4
|
+
onFormInit: async (context)=>{
|
|
5
|
+
console.log('[Analytics] Form initialized:', context.schema.id);
|
|
6
|
+
},
|
|
7
|
+
onValueChange: (fieldName, value, _context)=>{
|
|
8
|
+
console.log('[Analytics] Field changed:', fieldName, value);
|
|
9
|
+
},
|
|
10
|
+
onSubmit: async (data, _context)=>{
|
|
11
|
+
console.log('[Analytics] Form submitted:', data);
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const autoSavePlugin = {
|
|
16
|
+
name: 'autoSave',
|
|
17
|
+
version: '1.0.0',
|
|
18
|
+
onFormInit: async (context)=>{
|
|
19
|
+
const draft = localStorage.getItem(`form_draft_${context.schema.id}`);
|
|
20
|
+
if (draft) {
|
|
21
|
+
const draftData = JSON.parse(draft);
|
|
22
|
+
Object.keys(draftData).forEach((key)=>{
|
|
23
|
+
context.form.setValue(key, draftData[key]);
|
|
24
|
+
});
|
|
25
|
+
console.log('[AutoSave] Draft restored');
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
onValueChange: (_fieldName, _value, context)=>{
|
|
29
|
+
const draftKey = `form_draft_${context.schema.id}`;
|
|
30
|
+
const win = window;
|
|
31
|
+
if (win.__autoSaveTimeout) clearTimeout(win.__autoSaveTimeout);
|
|
32
|
+
win.__autoSaveTimeout = setTimeout(()=>{
|
|
33
|
+
const values = context.form.getValues();
|
|
34
|
+
localStorage.setItem(draftKey, JSON.stringify(values));
|
|
35
|
+
console.log('[AutoSave] Draft saved');
|
|
36
|
+
}, 1000);
|
|
37
|
+
},
|
|
38
|
+
onSubmit: async (data, context)=>{
|
|
39
|
+
localStorage.removeItem(`form_draft_${context.schema.id}`);
|
|
40
|
+
console.log('[AutoSave] Draft cleared');
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const validationPlugin = {
|
|
45
|
+
name: 'validation',
|
|
46
|
+
version: '1.0.0',
|
|
47
|
+
validators: {
|
|
48
|
+
phone: {
|
|
49
|
+
pattern: '^\\+?[\\d\\s\\-()]+$',
|
|
50
|
+
messages: {
|
|
51
|
+
pattern: 'Invalid phone number format'
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
strongPassword: {
|
|
55
|
+
minLength: 8,
|
|
56
|
+
pattern: '^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9]).+$',
|
|
57
|
+
messages: {
|
|
58
|
+
minLength: 'Password must be at least 8 characters',
|
|
59
|
+
pattern: 'Password must contain uppercase, lowercase, number, and special character'
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
creditCard: {
|
|
63
|
+
pattern: '^\\d{4}\\s?\\d{4}\\s?\\d{4}\\s?\\d{4}$',
|
|
64
|
+
messages: {
|
|
65
|
+
pattern: 'Invalid credit card number'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
url: {
|
|
69
|
+
url: true,
|
|
70
|
+
messages: {
|
|
71
|
+
url: 'Invalid URL format'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
postalCode: {
|
|
75
|
+
pattern: '^\\d{5}(-\\d{4})?$',
|
|
76
|
+
messages: {
|
|
77
|
+
pattern: 'Invalid US postal code'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
onFieldRegister: (field, _context)=>{
|
|
82
|
+
if ('email' === field.type) console.log('[Validation] Email validation applied to:', field.name);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const workflowPlugin = {
|
|
86
|
+
name: 'workflow',
|
|
87
|
+
version: '1.0.0',
|
|
88
|
+
onFormInit: async (context)=>{
|
|
89
|
+
const win = window;
|
|
90
|
+
const workflowContext = win.__workflowContext;
|
|
91
|
+
if (workflowContext) {
|
|
92
|
+
console.log('[Workflow] Loading workflow context:', workflowContext);
|
|
93
|
+
if (workflowContext.variables) Object.entries(workflowContext.variables).forEach(([key, value])=>{
|
|
94
|
+
context.form.setValue(key, value);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
onSubmit: async (data, _context)=>{
|
|
99
|
+
console.log('[Workflow] Submitting to workflow engine');
|
|
100
|
+
const win = window;
|
|
101
|
+
const workflowContext = win.__workflowContext;
|
|
102
|
+
if (workflowContext?.submitEndpoint) try {
|
|
103
|
+
const response = await fetch(workflowContext.submitEndpoint, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
headers: {
|
|
106
|
+
'Content-Type': 'application/json'
|
|
107
|
+
},
|
|
108
|
+
body: JSON.stringify({
|
|
109
|
+
workflowId: workflowContext.workflowId,
|
|
110
|
+
activityId: workflowContext.activityId,
|
|
111
|
+
formData: data
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
if (!response.ok) throw new Error('Workflow submission failed');
|
|
115
|
+
return await response.json();
|
|
116
|
+
} catch (error) {
|
|
117
|
+
console.error('[Workflow] Submission error:', error);
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
return data;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const auditPlugin = {
|
|
124
|
+
name: 'audit',
|
|
125
|
+
version: '1.0.0',
|
|
126
|
+
onFormInit: async (_context)=>{
|
|
127
|
+
const win = window;
|
|
128
|
+
win.__fieldHistory = new Map();
|
|
129
|
+
console.log('[Audit] Audit trail initialized');
|
|
130
|
+
},
|
|
131
|
+
onValueChange: (fieldName, value, _context)=>{
|
|
132
|
+
const win = window;
|
|
133
|
+
const history = win.__fieldHistory;
|
|
134
|
+
if (!history) return;
|
|
135
|
+
if (!history.has(fieldName)) history.set(fieldName, []);
|
|
136
|
+
history.get(fieldName).push({
|
|
137
|
+
value,
|
|
138
|
+
timestamp: new Date().toISOString(),
|
|
139
|
+
user: win.__currentUser?.id || 'anonymous'
|
|
140
|
+
});
|
|
141
|
+
console.log('[Audit] Field history updated:', fieldName);
|
|
142
|
+
},
|
|
143
|
+
onSubmit: async (data, _context)=>{
|
|
144
|
+
const win = window;
|
|
145
|
+
const history = win.__fieldHistory;
|
|
146
|
+
return {
|
|
147
|
+
...data,
|
|
148
|
+
_audit: {
|
|
149
|
+
fieldHistory: history ? Object.fromEntries(history) : {},
|
|
150
|
+
submittedAt: new Date().toISOString(),
|
|
151
|
+
submittedBy: win.__currentUser?.id || 'anonymous'
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const formattingPlugin = {
|
|
157
|
+
name: 'formatting',
|
|
158
|
+
version: '1.0.0',
|
|
159
|
+
customConditions: {
|
|
160
|
+
isBusinessHours: (value)=>{
|
|
161
|
+
const hour = new Date(value).getHours();
|
|
162
|
+
return hour >= 9 && hour < 17;
|
|
163
|
+
},
|
|
164
|
+
isWeekend: (value)=>{
|
|
165
|
+
const day = new Date(value).getDay();
|
|
166
|
+
return 0 === day || 6 === day;
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
onValueChange: (fieldName, _value, context)=>{
|
|
170
|
+
const field = context.schema.sections?.flatMap((s)=>s.fields).find((f)=>f.name === fieldName);
|
|
171
|
+
if (!field) return;
|
|
172
|
+
const error = context.errors[fieldName];
|
|
173
|
+
if (error) console.log('[Formatting] Error styling applied to:', fieldName);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
export { analyticsPlugin, auditPlugin, autoSavePlugin, formattingPlugin, validationPlugin, workflowPlugin };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
hasMinMaxStep: ()=>hasMinMaxStep,
|
|
28
|
+
hasOptions: ()=>hasOptions,
|
|
29
|
+
isCustomField: ()=>isCustomField,
|
|
30
|
+
isFileField: ()=>isFileField
|
|
31
|
+
});
|
|
32
|
+
function hasOptions(field) {
|
|
33
|
+
return 'select' === field.type || 'multiselect' === field.type || 'radio' === field.type;
|
|
34
|
+
}
|
|
35
|
+
function hasMinMaxStep(field) {
|
|
36
|
+
return 'number' === field.type || 'slider' === field.type;
|
|
37
|
+
}
|
|
38
|
+
function isFileField(field) {
|
|
39
|
+
return 'file' === field.type;
|
|
40
|
+
}
|
|
41
|
+
function isCustomField(field) {
|
|
42
|
+
return 'custom' === field.type;
|
|
43
|
+
}
|
|
44
|
+
exports.hasMinMaxStep = __webpack_exports__.hasMinMaxStep;
|
|
45
|
+
exports.hasOptions = __webpack_exports__.hasOptions;
|
|
46
|
+
exports.isCustomField = __webpack_exports__.isCustomField;
|
|
47
|
+
exports.isFileField = __webpack_exports__.isFileField;
|
|
48
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
49
|
+
"hasMinMaxStep",
|
|
50
|
+
"hasOptions",
|
|
51
|
+
"isCustomField",
|
|
52
|
+
"isFileField"
|
|
53
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
54
|
+
Object.defineProperty(exports, '__esModule', {
|
|
55
|
+
value: true
|
|
56
|
+
});
|