@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.
Files changed (254) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +188 -0
  3. package/dist/components/forms/data-fetcher.cjs +250 -0
  4. package/dist/components/forms/data-fetcher.d.ts +173 -0
  5. package/dist/components/forms/data-fetcher.js +207 -0
  6. package/dist/components/forms/demo-mocks.cjs +1031 -0
  7. package/dist/components/forms/demo-mocks.d.ts +10 -0
  8. package/dist/components/forms/demo-mocks.js +997 -0
  9. package/dist/components/forms/field-renderer.cjs +595 -0
  10. package/dist/components/forms/field-renderer.d.ts +14 -0
  11. package/dist/components/forms/field-renderer.js +561 -0
  12. package/dist/components/forms/form-designer.cjs +2314 -0
  13. package/dist/components/forms/form-designer.d.ts +1 -0
  14. package/dist/components/forms/form-designer.js +2280 -0
  15. package/dist/components/forms/form-examples.cjs +962 -0
  16. package/dist/components/forms/form-examples.d.ts +46 -0
  17. package/dist/components/forms/form-examples.js +907 -0
  18. package/dist/components/forms/form-plugins.cjs +225 -0
  19. package/dist/components/forms/form-plugins.d.ts +11 -0
  20. package/dist/components/forms/form-plugins.js +176 -0
  21. package/dist/components/forms/form-schema.cjs +56 -0
  22. package/dist/components/forms/form-schema.d.ts +324 -0
  23. package/dist/components/forms/form-schema.js +13 -0
  24. package/dist/components/forms/form-state-viewer.cjs +498 -0
  25. package/dist/components/forms/form-state-viewer.d.ts +15 -0
  26. package/dist/components/forms/form-state-viewer.js +464 -0
  27. package/dist/components/forms/index.cjs +103 -0
  28. package/dist/components/forms/index.d.ts +13 -0
  29. package/dist/components/forms/index.js +9 -0
  30. package/dist/components/forms/metadata-form.cjs +400 -0
  31. package/dist/components/forms/metadata-form.d.ts +16 -0
  32. package/dist/components/forms/metadata-form.js +366 -0
  33. package/dist/components/forms/rules-engine.cjs +343 -0
  34. package/dist/components/forms/rules-engine.d.ts +99 -0
  35. package/dist/components/forms/rules-engine.js +293 -0
  36. package/dist/components/forms/schema-serializer.cjs +250 -0
  37. package/dist/components/forms/schema-serializer.d.ts +27 -0
  38. package/dist/components/forms/schema-serializer.js +213 -0
  39. package/dist/components/forms/schema-viewer.cjs +157 -0
  40. package/dist/components/forms/schema-viewer.d.ts +29 -0
  41. package/dist/components/forms/schema-viewer.js +117 -0
  42. package/dist/components/forms/validation-converter.cjs +154 -0
  43. package/dist/components/forms/validation-converter.d.ts +42 -0
  44. package/dist/components/forms/validation-converter.js +114 -0
  45. package/dist/components/ui/accordion.cjs +82 -0
  46. package/dist/components/ui/accordion.d.ts +7 -0
  47. package/dist/components/ui/accordion.js +39 -0
  48. package/dist/components/ui/alert-dialog.cjs +126 -0
  49. package/dist/components/ui/alert-dialog.d.ts +20 -0
  50. package/dist/components/ui/alert-dialog.js +62 -0
  51. package/dist/components/ui/alert.cjs +77 -0
  52. package/dist/components/ui/alert.d.ts +8 -0
  53. package/dist/components/ui/alert.js +37 -0
  54. package/dist/components/ui/aspect-ratio.cjs +38 -0
  55. package/dist/components/ui/aspect-ratio.d.ts +3 -0
  56. package/dist/components/ui/aspect-ratio.js +4 -0
  57. package/dist/components/ui/avatar.cjs +63 -0
  58. package/dist/components/ui/avatar.d.ts +6 -0
  59. package/dist/components/ui/avatar.js +23 -0
  60. package/dist/components/ui/badge.cjs +63 -0
  61. package/dist/components/ui/badge.d.ts +9 -0
  62. package/dist/components/ui/badge.js +26 -0
  63. package/dist/components/ui/breadcrumb.cjs +118 -0
  64. package/dist/components/ui/breadcrumb.d.ts +19 -0
  65. package/dist/components/ui/breadcrumb.js +66 -0
  66. package/dist/components/ui/button-group.cjs +68 -0
  67. package/dist/components/ui/button-group.d.ts +14 -0
  68. package/dist/components/ui/button-group.js +28 -0
  69. package/dist/components/ui/button.cjs +78 -0
  70. package/dist/components/ui/button.d.ts +11 -0
  71. package/dist/components/ui/button.js +41 -0
  72. package/dist/components/ui/calendar.cjs +144 -0
  73. package/dist/components/ui/calendar.d.ts +8 -0
  74. package/dist/components/ui/calendar.js +107 -0
  75. package/dist/components/ui/card.cjs +89 -0
  76. package/dist/components/ui/card.d.ts +8 -0
  77. package/dist/components/ui/card.js +40 -0
  78. package/dist/components/ui/checkbox.cjs +52 -0
  79. package/dist/components/ui/checkbox.d.ts +6 -0
  80. package/dist/components/ui/checkbox.js +18 -0
  81. package/dist/components/ui/collapsible.cjs +45 -0
  82. package/dist/components/ui/collapsible.d.ts +5 -0
  83. package/dist/components/ui/collapsible.js +5 -0
  84. package/dist/components/ui/combobox.cjs +102 -0
  85. package/dist/components/ui/combobox.d.ts +15 -0
  86. package/dist/components/ui/combobox.js +68 -0
  87. package/dist/components/ui/command.cjs +131 -0
  88. package/dist/components/ui/command.d.ts +80 -0
  89. package/dist/components/ui/command.js +73 -0
  90. package/dist/components/ui/context-menu.cjs +173 -0
  91. package/dist/components/ui/context-menu.d.ts +27 -0
  92. package/dist/components/ui/context-menu.js +97 -0
  93. package/dist/components/ui/data-table.cjs +292 -0
  94. package/dist/components/ui/data-table.d.ts +23 -0
  95. package/dist/components/ui/data-table.js +252 -0
  96. package/dist/components/ui/date-picker.cjs +118 -0
  97. package/dist/components/ui/date-picker.d.ts +21 -0
  98. package/dist/components/ui/date-picker.js +81 -0
  99. package/dist/components/ui/datetime-picker.cjs +154 -0
  100. package/dist/components/ui/datetime-picker.d.ts +9 -0
  101. package/dist/components/ui/datetime-picker.js +120 -0
  102. package/dist/components/ui/dialog.cjs +159 -0
  103. package/dist/components/ui/dialog.d.ts +15 -0
  104. package/dist/components/ui/dialog.js +98 -0
  105. package/dist/components/ui/drawer.cjs +116 -0
  106. package/dist/components/ui/drawer.d.ts +18 -0
  107. package/dist/components/ui/drawer.js +55 -0
  108. package/dist/components/ui/dropdown-menu.cjs +174 -0
  109. package/dist/components/ui/dropdown-menu.d.ts +27 -0
  110. package/dist/components/ui/dropdown-menu.js +98 -0
  111. package/dist/components/ui/editable-cell.cjs +256 -0
  112. package/dist/components/ui/editable-cell.d.ts +24 -0
  113. package/dist/components/ui/editable-cell.js +219 -0
  114. package/dist/components/ui/empty-state.cjs +73 -0
  115. package/dist/components/ui/empty-state.d.ts +16 -0
  116. package/dist/components/ui/empty-state.js +39 -0
  117. package/dist/components/ui/file-upload.cjs +236 -0
  118. package/dist/components/ui/file-upload.d.ts +10 -0
  119. package/dist/components/ui/file-upload.js +202 -0
  120. package/dist/components/ui/hover-card.cjs +55 -0
  121. package/dist/components/ui/hover-card.d.ts +6 -0
  122. package/dist/components/ui/hover-card.js +15 -0
  123. package/dist/components/ui/index.cjs +546 -0
  124. package/dist/components/ui/index.d.ts +55 -0
  125. package/dist/components/ui/index.js +55 -0
  126. package/dist/components/ui/input.cjs +45 -0
  127. package/dist/components/ui/input.d.ts +5 -0
  128. package/dist/components/ui/input.js +11 -0
  129. package/dist/components/ui/label.cjs +47 -0
  130. package/dist/components/ui/label.d.ts +7 -0
  131. package/dist/components/ui/label.js +13 -0
  132. package/dist/components/ui/layout/column.cjs +84 -0
  133. package/dist/components/ui/layout/column.d.ts +21 -0
  134. package/dist/components/ui/layout/column.js +50 -0
  135. package/dist/components/ui/layout/grid.cjs +101 -0
  136. package/dist/components/ui/layout/grid.d.ts +22 -0
  137. package/dist/components/ui/layout/grid.js +67 -0
  138. package/dist/components/ui/layout/index.cjs +44 -0
  139. package/dist/components/ui/layout/index.d.ts +7 -0
  140. package/dist/components/ui/layout/index.js +4 -0
  141. package/dist/components/ui/layout/row.cjs +84 -0
  142. package/dist/components/ui/layout/row.d.ts +21 -0
  143. package/dist/components/ui/layout/row.js +50 -0
  144. package/dist/components/ui/layout/types.cjs +18 -0
  145. package/dist/components/ui/layout/types.d.ts +149 -0
  146. package/dist/components/ui/layout/types.js +0 -0
  147. package/dist/components/ui/layout/utils.cjs +324 -0
  148. package/dist/components/ui/layout/utils.d.ts +76 -0
  149. package/dist/components/ui/layout/utils.js +239 -0
  150. package/dist/components/ui/menubar.cjs +210 -0
  151. package/dist/components/ui/menubar.d.ts +28 -0
  152. package/dist/components/ui/menubar.js +131 -0
  153. package/dist/components/ui/multi-select.cjs +187 -0
  154. package/dist/components/ui/multi-select.d.ts +18 -0
  155. package/dist/components/ui/multi-select.js +153 -0
  156. package/dist/components/ui/navigation-menu.cjs +122 -0
  157. package/dist/components/ui/navigation-menu.d.ts +12 -0
  158. package/dist/components/ui/navigation-menu.js +64 -0
  159. package/dist/components/ui/pagination.cjs +131 -0
  160. package/dist/components/ui/pagination.d.ts +28 -0
  161. package/dist/components/ui/pagination.js +79 -0
  162. package/dist/components/ui/popover.cjs +61 -0
  163. package/dist/components/ui/popover.d.ts +7 -0
  164. package/dist/components/ui/popover.js +18 -0
  165. package/dist/components/ui/progress.cjs +51 -0
  166. package/dist/components/ui/progress.d.ts +4 -0
  167. package/dist/components/ui/progress.js +17 -0
  168. package/dist/components/ui/radio-group.cjs +61 -0
  169. package/dist/components/ui/radio-group.d.ts +5 -0
  170. package/dist/components/ui/radio-group.js +24 -0
  171. package/dist/components/ui/resizable.cjs +60 -0
  172. package/dist/components/ui/resizable.d.ts +23 -0
  173. package/dist/components/ui/resizable.js +20 -0
  174. package/dist/components/ui/scroll-area.cjs +67 -0
  175. package/dist/components/ui/scroll-area.d.ts +5 -0
  176. package/dist/components/ui/scroll-area.js +30 -0
  177. package/dist/components/ui/search.cjs +153 -0
  178. package/dist/components/ui/search.d.ts +19 -0
  179. package/dist/components/ui/search.js +116 -0
  180. package/dist/components/ui/select.cjs +151 -0
  181. package/dist/components/ui/select.d.ts +13 -0
  182. package/dist/components/ui/select.js +90 -0
  183. package/dist/components/ui/separator.cjs +47 -0
  184. package/dist/components/ui/separator.d.ts +4 -0
  185. package/dist/components/ui/separator.js +13 -0
  186. package/dist/components/ui/sheet.cjs +142 -0
  187. package/dist/components/ui/sheet.d.ts +25 -0
  188. package/dist/components/ui/sheet.js +81 -0
  189. package/dist/components/ui/skeleton.cjs +43 -0
  190. package/dist/components/ui/skeleton.d.ts +2 -0
  191. package/dist/components/ui/skeleton.js +9 -0
  192. package/dist/components/ui/slider.cjs +63 -0
  193. package/dist/components/ui/slider.d.ts +4 -0
  194. package/dist/components/ui/slider.js +29 -0
  195. package/dist/components/ui/sonner.cjs +76 -0
  196. package/dist/components/ui/sonner.d.ts +4 -0
  197. package/dist/components/ui/sonner.js +39 -0
  198. package/dist/components/ui/spinner.cjs +78 -0
  199. package/dist/components/ui/spinner.d.ts +11 -0
  200. package/dist/components/ui/spinner.js +41 -0
  201. package/dist/components/ui/stats-card.cjs +102 -0
  202. package/dist/components/ui/stats-card.d.ts +15 -0
  203. package/dist/components/ui/stats-card.js +68 -0
  204. package/dist/components/ui/stepper.cjs +99 -0
  205. package/dist/components/ui/stepper.d.ts +14 -0
  206. package/dist/components/ui/stepper.js +65 -0
  207. package/dist/components/ui/switch.cjs +48 -0
  208. package/dist/components/ui/switch.d.ts +4 -0
  209. package/dist/components/ui/switch.js +14 -0
  210. package/dist/components/ui/table.cjs +110 -0
  211. package/dist/components/ui/table.d.ts +10 -0
  212. package/dist/components/ui/table.js +55 -0
  213. package/dist/components/ui/tabs.cjs +67 -0
  214. package/dist/components/ui/tabs.d.ts +7 -0
  215. package/dist/components/ui/tabs.js +24 -0
  216. package/dist/components/ui/textarea.cjs +44 -0
  217. package/dist/components/ui/textarea.d.ts +4 -0
  218. package/dist/components/ui/textarea.js +10 -0
  219. package/dist/components/ui/toggle-group.cjs +73 -0
  220. package/dist/components/ui/toggle-group.d.ts +12 -0
  221. package/dist/components/ui/toggle-group.js +36 -0
  222. package/dist/components/ui/toggle.cjs +71 -0
  223. package/dist/components/ui/toggle.d.ts +12 -0
  224. package/dist/components/ui/toggle.js +34 -0
  225. package/dist/components/ui/tooltip.cjs +58 -0
  226. package/dist/components/ui/tooltip.d.ts +7 -0
  227. package/dist/components/ui/tooltip.js +15 -0
  228. package/dist/examples/admin-layout-example.d.ts +92 -0
  229. package/dist/examples/app-shell-example.d.ts +52 -0
  230. package/dist/examples/dashboard-example.d.ts +11 -0
  231. package/dist/examples/data-management-example.d.ts +1 -0
  232. package/dist/examples/flow-editor-layout-example.d.ts +22 -0
  233. package/dist/examples/flow-start-example.d.ts +30 -0
  234. package/dist/examples/form-builder-example.d.ts +1 -0
  235. package/dist/examples/new-project-example.d.ts +30 -0
  236. package/dist/examples/settings-example.d.ts +1 -0
  237. package/dist/examples/vscode-example.d.ts +80 -0
  238. package/dist/index.cjs +830 -0
  239. package/dist/index.d.ts +86 -0
  240. package/dist/index.js +67 -0
  241. package/dist/lib/index.cjs +42 -0
  242. package/dist/lib/index.d.ts +1 -0
  243. package/dist/lib/index.js +2 -0
  244. package/dist/lib/utils.cjs +70 -0
  245. package/dist/lib/utils.d.ts +14 -0
  246. package/dist/lib/utils.js +30 -0
  247. package/dist/postcss.config.export.cjs +43 -0
  248. package/dist/postcss.config.export.js +9 -0
  249. package/dist/styles.css +6868 -0
  250. package/dist/tailwind.css +239 -0
  251. package/dist/tailwind.preset.cjs +77 -0
  252. package/dist/tailwind.preset.js +43 -0
  253. package/package.json +157 -0
  254. package/postcss.config.export.js +9 -0
@@ -0,0 +1,293 @@
1
+ import jsep from "jsep";
2
+ import { get } from "../../lib/index.js";
3
+ class RulesEngine {
4
+ static evaluateConditions(conditions, values, operator = 'AND') {
5
+ if (0 === conditions.length) return true;
6
+ const results = conditions.map((condition)=>RulesEngine.evaluateCondition(condition, values));
7
+ return 'AND' === operator ? results.every(Boolean) : results.some(Boolean);
8
+ }
9
+ static evaluateCondition(condition, values) {
10
+ const fieldValue = get(values, condition.when);
11
+ if (condition.custom) {
12
+ const result = RulesEngine.evaluateExpression(condition.custom, values);
13
+ return 'boolean' == typeof result ? result : Boolean(result);
14
+ }
15
+ if (void 0 !== condition.is) return fieldValue === condition.is;
16
+ if (void 0 !== condition.isNot) return fieldValue !== condition.isNot;
17
+ if (void 0 !== condition.in) return condition.in.includes(fieldValue);
18
+ if (void 0 !== condition.notIn) return !condition.notIn.includes(fieldValue);
19
+ if (void 0 !== condition.matches) {
20
+ const regex = new RegExp(condition.matches);
21
+ return regex.test(String(fieldValue));
22
+ }
23
+ return false;
24
+ }
25
+ static applyRules(rules, values, _context) {
26
+ const state = {};
27
+ for (const rule of rules){
28
+ const conditionsMet = RulesEngine.evaluateConditions(rule.conditions, values, rule.operator);
29
+ if (conditionsMet) {
30
+ if (void 0 !== rule.effects.visible) state.visible = rule.effects.visible;
31
+ if (void 0 !== rule.effects.disabled) state.disabled = rule.effects.disabled;
32
+ if (void 0 !== rule.effects.required) state.required = rule.effects.required;
33
+ if (void 0 !== rule.effects.value) state.value = rule.effects.value;
34
+ }
35
+ }
36
+ return state;
37
+ }
38
+ static evaluateExpression(expression, values) {
39
+ try {
40
+ const ast = jsep(expression);
41
+ return RulesEngine.evaluateNode(ast, values);
42
+ } catch (error) {
43
+ console.error('Expression evaluation error:', error);
44
+ return false;
45
+ }
46
+ }
47
+ static evaluateNode(node, values) {
48
+ switch(node.type){
49
+ case 'Literal':
50
+ return node.value;
51
+ case 'Identifier':
52
+ return get(values, node.name);
53
+ case 'BinaryExpression':
54
+ {
55
+ const binary = node;
56
+ const left = RulesEngine.evaluateNode(binary.left, values);
57
+ const right = RulesEngine.evaluateNode(binary.right, values);
58
+ switch(binary.operator){
59
+ case '==':
60
+ return left == right;
61
+ case '===':
62
+ return left === right;
63
+ case '!=':
64
+ return left != right;
65
+ case '!==':
66
+ return left !== right;
67
+ case '<':
68
+ return left < right;
69
+ case '>':
70
+ return left > right;
71
+ case '<=':
72
+ return left <= right;
73
+ case '>=':
74
+ return left >= right;
75
+ case '&&':
76
+ return left && right;
77
+ case '||':
78
+ return left || right;
79
+ case '+':
80
+ return left + right;
81
+ case '-':
82
+ return left - right;
83
+ case '*':
84
+ return left * right;
85
+ case '/':
86
+ return left / right;
87
+ case '%':
88
+ return left % right;
89
+ default:
90
+ throw new Error(`Unsupported operator: ${binary.operator}`);
91
+ }
92
+ }
93
+ case 'UnaryExpression':
94
+ {
95
+ const unary = node;
96
+ const arg = RulesEngine.evaluateNode(unary.argument, values);
97
+ switch(unary.operator){
98
+ case '!':
99
+ return !arg;
100
+ case '-':
101
+ return -arg;
102
+ case '+':
103
+ return +arg;
104
+ default:
105
+ throw new Error(`Unsupported unary operator: ${unary.operator}`);
106
+ }
107
+ }
108
+ case 'MemberExpression':
109
+ {
110
+ const member = node;
111
+ const obj = RulesEngine.evaluateNode(member.object, values);
112
+ const prop = member.computed ? RulesEngine.evaluateNode(member.property, values) : member.property.name;
113
+ return obj?.[prop];
114
+ }
115
+ case 'ConditionalExpression':
116
+ {
117
+ const cond = node;
118
+ return RulesEngine.evaluateNode(cond.test, values) ? RulesEngine.evaluateNode(cond.consequent, values) : RulesEngine.evaluateNode(cond.alternate, values);
119
+ }
120
+ default:
121
+ throw new Error(`Unsupported expression type: ${node.type}`);
122
+ }
123
+ }
124
+ static isFieldVisible(rules, values) {
125
+ if (!rules || 0 === rules.length) return true;
126
+ const ruleResult = RulesEngine.applyRules(rules, values, {});
127
+ const hasShowRule = rules.some((rule)=>rule.effects?.visible === true);
128
+ rules.some((rule)=>rule.effects?.visible === false);
129
+ if (void 0 !== ruleResult.visible) return ruleResult.visible;
130
+ if (hasShowRule) return false;
131
+ return true;
132
+ }
133
+ static buildDependencyGraph(rules) {
134
+ const graph = new Map();
135
+ for (const rule of rules)for (const condition of rule.conditions){
136
+ if (!graph.has(condition.when)) graph.set(condition.when, new Set());
137
+ graph.get(condition.when).add(rule.id);
138
+ }
139
+ return graph;
140
+ }
141
+ }
142
+ class ExpressionBuilder {
143
+ static equals(field, value) {
144
+ return `${field} == ${JSON.stringify(value)}`;
145
+ }
146
+ static notEquals(field, value) {
147
+ return `${field} != ${JSON.stringify(value)}`;
148
+ }
149
+ static greaterThan(field, value) {
150
+ return `${field} > ${value}`;
151
+ }
152
+ static lessThan(field, value) {
153
+ return `${field} < ${value}`;
154
+ }
155
+ static greaterThanOrEqual(field, value) {
156
+ return `${field} >= ${value}`;
157
+ }
158
+ static lessThanOrEqual(field, value) {
159
+ return `${field} <= ${value}`;
160
+ }
161
+ static isEmpty(field) {
162
+ return `!${field} || ${field} == ''`;
163
+ }
164
+ static isNotEmpty(field) {
165
+ return `${field} && ${field} != ''`;
166
+ }
167
+ static and(...expressions) {
168
+ return `(${expressions.join(' && ')})`;
169
+ }
170
+ static or(...expressions) {
171
+ return `(${expressions.join(' || ')})`;
172
+ }
173
+ static not(expression) {
174
+ return `!(${expression})`;
175
+ }
176
+ static between(field, min, max) {
177
+ return `${field} >= ${min} && ${field} <= ${max}`;
178
+ }
179
+ static sum(fields) {
180
+ return fields.map((f)=>`(${f} || 0)`).join(' + ');
181
+ }
182
+ static product(fields) {
183
+ return fields.map((f)=>`(${f} || 0)`).join(' * ');
184
+ }
185
+ static average(fields) {
186
+ const sum = ExpressionBuilder.sum(fields);
187
+ return `(${sum}) / ${fields.length}`;
188
+ }
189
+ static inArray(field, values) {
190
+ const checks = values.map((v)=>`${field} == ${JSON.stringify(v)}`);
191
+ return ExpressionBuilder.or(...checks);
192
+ }
193
+ }
194
+ class RuleBuilder {
195
+ rule;
196
+ constructor(id){
197
+ this.rule = {
198
+ id,
199
+ conditions: [],
200
+ operator: 'AND',
201
+ effects: {}
202
+ };
203
+ }
204
+ when(field) {
205
+ return new ConditionBuilder(this, field);
206
+ }
207
+ withCustomExpression(expression) {
208
+ this.rule.conditions.push({
209
+ when: '',
210
+ custom: expression
211
+ });
212
+ return this;
213
+ }
214
+ useOperator(operator) {
215
+ this.rule.operator = operator;
216
+ return this;
217
+ }
218
+ show() {
219
+ this.rule.effects.visible = true;
220
+ return this;
221
+ }
222
+ hide() {
223
+ this.rule.effects.visible = false;
224
+ return this;
225
+ }
226
+ enable() {
227
+ this.rule.effects.disabled = false;
228
+ return this;
229
+ }
230
+ disable() {
231
+ this.rule.effects.disabled = true;
232
+ return this;
233
+ }
234
+ require() {
235
+ this.rule.effects.required = true;
236
+ return this;
237
+ }
238
+ optional() {
239
+ this.rule.effects.required = false;
240
+ return this;
241
+ }
242
+ setValue(value) {
243
+ this.rule.effects.value = value;
244
+ return this;
245
+ }
246
+ build() {
247
+ return this.rule;
248
+ }
249
+ }
250
+ class ConditionBuilder {
251
+ ruleBuilder;
252
+ field;
253
+ constructor(ruleBuilder, field){
254
+ this.ruleBuilder = ruleBuilder;
255
+ this.field = field;
256
+ }
257
+ is(value) {
258
+ this.ruleBuilder['rule'].conditions.push({
259
+ when: this.field,
260
+ is: value
261
+ });
262
+ return this.ruleBuilder;
263
+ }
264
+ isNot(value) {
265
+ this.ruleBuilder['rule'].conditions.push({
266
+ when: this.field,
267
+ isNot: value
268
+ });
269
+ return this.ruleBuilder;
270
+ }
271
+ in(values) {
272
+ this.ruleBuilder['rule'].conditions.push({
273
+ when: this.field,
274
+ in: values
275
+ });
276
+ return this.ruleBuilder;
277
+ }
278
+ notIn(values) {
279
+ this.ruleBuilder['rule'].conditions.push({
280
+ when: this.field,
281
+ notIn: values
282
+ });
283
+ return this.ruleBuilder;
284
+ }
285
+ matches(pattern) {
286
+ this.ruleBuilder['rule'].conditions.push({
287
+ when: this.field,
288
+ matches: pattern
289
+ });
290
+ return this.ruleBuilder;
291
+ }
292
+ }
293
+ export { ExpressionBuilder, RuleBuilder, RulesEngine };
@@ -0,0 +1,250 @@
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
+ schemaToJson: ()=>schemaToJson,
28
+ serializeSchema: ()=>serializeSchema
29
+ });
30
+ function serializeOptions(options) {
31
+ return options.map((opt)=>({
32
+ label: opt.label,
33
+ value: opt.value,
34
+ ...void 0 !== opt.disabled && {
35
+ disabled: opt.disabled
36
+ }
37
+ }));
38
+ }
39
+ function serializeValidationConfig(config) {
40
+ const result = {};
41
+ if (void 0 !== config.required) result.required = config.required;
42
+ if (void 0 !== config.minLength) result.minLength = config.minLength;
43
+ if (void 0 !== config.maxLength) result.maxLength = config.maxLength;
44
+ if (void 0 !== config.pattern) result.pattern = config.pattern;
45
+ if (void 0 !== config.email) result.email = config.email;
46
+ if (void 0 !== config.url) result.url = config.url;
47
+ if (void 0 !== config.min) result.min = config.min;
48
+ if (void 0 !== config.max) result.max = config.max;
49
+ if (void 0 !== config.integer) result.integer = config.integer;
50
+ if (void 0 !== config.positive) result.positive = config.positive;
51
+ if (void 0 !== config.negative) result.negative = config.negative;
52
+ if (void 0 !== config.minItems) result.minItems = config.minItems;
53
+ if (void 0 !== config.maxItems) result.maxItems = config.maxItems;
54
+ if (void 0 !== config.maxFileSize) result.maxFileSize = config.maxFileSize;
55
+ if (void 0 !== config.allowedTypes) result.allowedTypes = config.allowedTypes;
56
+ if (void 0 !== config.custom) result.custom = config.custom;
57
+ if (config.messages && Object.keys(config.messages).length > 0) {
58
+ const messages = {};
59
+ const m = config.messages;
60
+ if (m.required) messages.required = m.required;
61
+ if (m.minLength) messages.minLength = m.minLength;
62
+ if (m.maxLength) messages.maxLength = m.maxLength;
63
+ if (m.pattern) messages.pattern = m.pattern;
64
+ if (m.min) messages.min = m.min;
65
+ if (m.max) messages.max = m.max;
66
+ if (m.email) messages.email = m.email;
67
+ if (m.url) messages.url = m.url;
68
+ if (m.integer) messages.integer = m.integer;
69
+ if (m.positive) messages.positive = m.positive;
70
+ if (m.negative) messages.negative = m.negative;
71
+ if (m.minItems) messages.minItems = m.minItems;
72
+ if (m.maxItems) messages.maxItems = m.maxItems;
73
+ if (m.custom) messages.custom = m.custom;
74
+ if (Object.keys(messages).length > 0) result.messages = messages;
75
+ }
76
+ return result;
77
+ }
78
+ function serializeActions(actions) {
79
+ return actions.map((action)=>({
80
+ id: action.id,
81
+ type: action.type,
82
+ label: action.label,
83
+ ...action.variant && {
84
+ variant: action.variant
85
+ },
86
+ ...void 0 !== action.loading && {
87
+ loading: action.loading
88
+ },
89
+ ...void 0 !== action.disabled && {
90
+ disabled: action.disabled
91
+ },
92
+ ...action.conditions && {
93
+ conditions: action.conditions.map(serializeCondition)
94
+ }
95
+ }));
96
+ }
97
+ function serializeCondition(condition) {
98
+ const result = {
99
+ when: condition.when
100
+ };
101
+ if (void 0 !== condition.is) result.is = condition.is;
102
+ if (void 0 !== condition.isNot) result.isNot = condition.isNot;
103
+ if (void 0 !== condition.in) result.in = condition.in;
104
+ if (void 0 !== condition.notIn) result.notIn = condition.notIn;
105
+ if (void 0 !== condition.matches) result.matches = condition.matches;
106
+ if (void 0 !== condition.custom) result.custom = condition.custom;
107
+ return result;
108
+ }
109
+ function serializeRule(rule) {
110
+ const result = {
111
+ id: rule.id,
112
+ conditions: rule.conditions.map(serializeCondition)
113
+ };
114
+ if (rule.operator && 'AND' !== rule.operator) result.operator = rule.operator;
115
+ const effects = {};
116
+ if (void 0 !== rule.effects.visible) effects.visible = rule.effects.visible;
117
+ if (void 0 !== rule.effects.disabled) effects.disabled = rule.effects.disabled;
118
+ if (void 0 !== rule.effects.required) effects.required = rule.effects.required;
119
+ if (void 0 !== rule.effects.value) effects.value = rule.effects.value;
120
+ if (rule.effects.validate) effects.validate = serializeValidationConfig(rule.effects.validate);
121
+ if (rule.effects.options) effects.options = serializeDataSource(rule.effects.options);
122
+ result.effects = effects;
123
+ return result;
124
+ }
125
+ function serializeDataSource(dataSource) {
126
+ switch(dataSource.type){
127
+ case 'static':
128
+ return {
129
+ type: 'static',
130
+ options: serializeOptions(dataSource.options)
131
+ };
132
+ case 'fetch':
133
+ return {
134
+ type: 'fetch',
135
+ url: dataSource.url,
136
+ ...dataSource.method && {
137
+ method: dataSource.method
138
+ },
139
+ ...dataSource.transform && {
140
+ transform: dataSource.transform
141
+ },
142
+ ...dataSource.params && {
143
+ params: dataSource.params
144
+ }
145
+ };
146
+ case 'remote':
147
+ return {
148
+ type: 'remote',
149
+ endpoint: dataSource.endpoint,
150
+ ...dataSource.method && {
151
+ method: dataSource.method
152
+ },
153
+ ...dataSource.params && {
154
+ params: dataSource.params
155
+ },
156
+ ...dataSource.transform && {
157
+ transform: dataSource.transform
158
+ }
159
+ };
160
+ case 'computed':
161
+ return {
162
+ type: 'computed',
163
+ dependency: dataSource.dependency,
164
+ compute: dataSource.compute
165
+ };
166
+ }
167
+ }
168
+ function serializeField(field) {
169
+ const result = {
170
+ name: field.name,
171
+ type: field.type,
172
+ label: field.label
173
+ };
174
+ if (field.placeholder) result.placeholder = field.placeholder;
175
+ if (field.description) result.description = field.description;
176
+ if (void 0 !== field.defaultValue) result.defaultValue = field.defaultValue;
177
+ if (field.validation) result.validation = serializeValidationConfig(field.validation);
178
+ if (field.dataSource) result.dataSource = serializeDataSource(field.dataSource);
179
+ if (field.rules && field.rules.length > 0) result.rules = field.rules.map(serializeRule);
180
+ if (field.grid) result.grid = field.grid;
181
+ if (field.ariaLabel) result.ariaLabel = field.ariaLabel;
182
+ if (field.ariaDescribedBy) result.ariaDescribedBy = field.ariaDescribedBy;
183
+ if ('options' in field && field.options) result.options = serializeOptions(field.options);
184
+ if ('rows' in field && field.rows) result.rows = field.rows;
185
+ if ('min' in field && void 0 !== field.min) result.min = field.min;
186
+ if ('max' in field && void 0 !== field.max) result.max = field.max;
187
+ if ('step' in field && void 0 !== field.step) result.step = field.step;
188
+ if ('maxSelected' in field && field.maxSelected) result.maxSelected = field.maxSelected;
189
+ if ('accept' in field && field.accept) result.accept = field.accept;
190
+ if ('multiple' in field && field.multiple) result.multiple = field.multiple;
191
+ if ('maxSize' in field && field.maxSize) result.maxSize = field.maxSize;
192
+ if ('showPreview' in field && field.showPreview) result.showPreview = field.showPreview;
193
+ if ('use12Hour' in field && field.use12Hour) result.use12Hour = field.use12Hour;
194
+ if ('component' in field && field.component) result.component = field.component;
195
+ if ('componentProps' in field && field.componentProps) result.componentProps = field.componentProps;
196
+ return result;
197
+ }
198
+ function serializeSection(section) {
199
+ const result = {
200
+ id: section.id,
201
+ fields: section.fields.map(serializeField)
202
+ };
203
+ if (section.title) result.title = section.title;
204
+ if (section.description) result.description = section.description;
205
+ if (void 0 !== section.collapsible) result.collapsible = section.collapsible;
206
+ if (void 0 !== section.defaultExpanded) result.defaultExpanded = section.defaultExpanded;
207
+ if (section.conditions && section.conditions.length > 0) result.conditions = section.conditions.map(serializeCondition);
208
+ return result;
209
+ }
210
+ function serializeStep(step) {
211
+ const result = {
212
+ id: step.id,
213
+ title: step.title,
214
+ sections: step.sections.map(serializeSection)
215
+ };
216
+ if (step.description) result.description = step.description;
217
+ if (step.validation) result.validation = step.validation;
218
+ if (void 0 !== step.canSkip) result.canSkip = step.canSkip;
219
+ if (step.conditions && step.conditions.length > 0) result.conditions = step.conditions.map(serializeCondition);
220
+ return result;
221
+ }
222
+ function serializeSchema(schema) {
223
+ const result = {
224
+ id: schema.id,
225
+ title: schema.title
226
+ };
227
+ if (schema.description) result.description = schema.description;
228
+ if (schema.version) result.version = schema.version;
229
+ if (schema.initialData) result.initialData = schema.initialData;
230
+ if (schema.mode) result.mode = schema.mode;
231
+ if (schema.reValidateMode) result.reValidateMode = schema.reValidateMode;
232
+ if (schema.actions && schema.actions.length > 0) result.actions = serializeActions(schema.actions);
233
+ if (schema.layout) result.layout = schema.layout;
234
+ if (schema.metadata) result.metadata = schema.metadata;
235
+ if ('sections' in schema && schema.sections) result.sections = schema.sections.map(serializeSection);
236
+ if ('steps' in schema && schema.steps) result.steps = schema.steps.map(serializeStep);
237
+ return result;
238
+ }
239
+ function schemaToJson(schema, indent = 2) {
240
+ return JSON.stringify(serializeSchema(schema), null, indent);
241
+ }
242
+ exports.schemaToJson = __webpack_exports__.schemaToJson;
243
+ exports.serializeSchema = __webpack_exports__.serializeSchema;
244
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
245
+ "schemaToJson",
246
+ "serializeSchema"
247
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
248
+ Object.defineProperty(exports, '__esModule', {
249
+ value: true
250
+ });
@@ -0,0 +1,27 @@
1
+ import type { FormSchema } from './form-schema';
2
+ /**
3
+ * Schema Serializer - Converts FormSchema to JSON-safe format
4
+ *
5
+ * With ValidationConfig being JSON-serializable by design, this serializer
6
+ * now performs straightforward object-to-JSON conversion without complex
7
+ * Zod schema transformation.
8
+ *
9
+ * Output format:
10
+ * - Clean JSON that can be stored in databases
11
+ * - Can be transmitted over APIs
12
+ * - Fully round-trippable (JSON → FormSchema → JSON)
13
+ */
14
+ type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
15
+ type JsonObject = {
16
+ [key: string]: JsonValue;
17
+ };
18
+ type JsonArray = JsonValue[];
19
+ /**
20
+ * Serialize a FormSchema to JSON-safe format
21
+ */
22
+ export declare function serializeSchema(schema: FormSchema): JsonObject;
23
+ /**
24
+ * Convert schema to formatted JSON string
25
+ */
26
+ export declare function schemaToJson(schema: FormSchema, indent?: number): string;
27
+ export {};