@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,343 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ RuleBuilder: ()=>RuleBuilder,
37
+ RulesEngine: ()=>RulesEngine,
38
+ ExpressionBuilder: ()=>ExpressionBuilder
39
+ });
40
+ const external_jsep_namespaceObject = require("jsep");
41
+ var external_jsep_default = /*#__PURE__*/ __webpack_require__.n(external_jsep_namespaceObject);
42
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
43
+ class RulesEngine {
44
+ static evaluateConditions(conditions, values, operator = 'AND') {
45
+ if (0 === conditions.length) return true;
46
+ const results = conditions.map((condition)=>RulesEngine.evaluateCondition(condition, values));
47
+ return 'AND' === operator ? results.every(Boolean) : results.some(Boolean);
48
+ }
49
+ static evaluateCondition(condition, values) {
50
+ const fieldValue = (0, index_cjs_namespaceObject.get)(values, condition.when);
51
+ if (condition.custom) {
52
+ const result = RulesEngine.evaluateExpression(condition.custom, values);
53
+ return 'boolean' == typeof result ? result : Boolean(result);
54
+ }
55
+ if (void 0 !== condition.is) return fieldValue === condition.is;
56
+ if (void 0 !== condition.isNot) return fieldValue !== condition.isNot;
57
+ if (void 0 !== condition.in) return condition.in.includes(fieldValue);
58
+ if (void 0 !== condition.notIn) return !condition.notIn.includes(fieldValue);
59
+ if (void 0 !== condition.matches) {
60
+ const regex = new RegExp(condition.matches);
61
+ return regex.test(String(fieldValue));
62
+ }
63
+ return false;
64
+ }
65
+ static applyRules(rules, values, _context) {
66
+ const state = {};
67
+ for (const rule of rules){
68
+ const conditionsMet = RulesEngine.evaluateConditions(rule.conditions, values, rule.operator);
69
+ if (conditionsMet) {
70
+ if (void 0 !== rule.effects.visible) state.visible = rule.effects.visible;
71
+ if (void 0 !== rule.effects.disabled) state.disabled = rule.effects.disabled;
72
+ if (void 0 !== rule.effects.required) state.required = rule.effects.required;
73
+ if (void 0 !== rule.effects.value) state.value = rule.effects.value;
74
+ }
75
+ }
76
+ return state;
77
+ }
78
+ static evaluateExpression(expression, values) {
79
+ try {
80
+ const ast = external_jsep_default()(expression);
81
+ return RulesEngine.evaluateNode(ast, values);
82
+ } catch (error) {
83
+ console.error('Expression evaluation error:', error);
84
+ return false;
85
+ }
86
+ }
87
+ static evaluateNode(node, values) {
88
+ switch(node.type){
89
+ case 'Literal':
90
+ return node.value;
91
+ case 'Identifier':
92
+ return (0, index_cjs_namespaceObject.get)(values, node.name);
93
+ case 'BinaryExpression':
94
+ {
95
+ const binary = node;
96
+ const left = RulesEngine.evaluateNode(binary.left, values);
97
+ const right = RulesEngine.evaluateNode(binary.right, values);
98
+ switch(binary.operator){
99
+ case '==':
100
+ return left == right;
101
+ case '===':
102
+ return left === right;
103
+ case '!=':
104
+ return left != right;
105
+ case '!==':
106
+ return left !== right;
107
+ case '<':
108
+ return left < right;
109
+ case '>':
110
+ return left > right;
111
+ case '<=':
112
+ return left <= right;
113
+ case '>=':
114
+ return left >= right;
115
+ case '&&':
116
+ return left && right;
117
+ case '||':
118
+ return left || right;
119
+ case '+':
120
+ return left + right;
121
+ case '-':
122
+ return left - right;
123
+ case '*':
124
+ return left * right;
125
+ case '/':
126
+ return left / right;
127
+ case '%':
128
+ return left % right;
129
+ default:
130
+ throw new Error(`Unsupported operator: ${binary.operator}`);
131
+ }
132
+ }
133
+ case 'UnaryExpression':
134
+ {
135
+ const unary = node;
136
+ const arg = RulesEngine.evaluateNode(unary.argument, values);
137
+ switch(unary.operator){
138
+ case '!':
139
+ return !arg;
140
+ case '-':
141
+ return -arg;
142
+ case '+':
143
+ return +arg;
144
+ default:
145
+ throw new Error(`Unsupported unary operator: ${unary.operator}`);
146
+ }
147
+ }
148
+ case 'MemberExpression':
149
+ {
150
+ const member = node;
151
+ const obj = RulesEngine.evaluateNode(member.object, values);
152
+ const prop = member.computed ? RulesEngine.evaluateNode(member.property, values) : member.property.name;
153
+ return obj?.[prop];
154
+ }
155
+ case 'ConditionalExpression':
156
+ {
157
+ const cond = node;
158
+ return RulesEngine.evaluateNode(cond.test, values) ? RulesEngine.evaluateNode(cond.consequent, values) : RulesEngine.evaluateNode(cond.alternate, values);
159
+ }
160
+ default:
161
+ throw new Error(`Unsupported expression type: ${node.type}`);
162
+ }
163
+ }
164
+ static isFieldVisible(rules, values) {
165
+ if (!rules || 0 === rules.length) return true;
166
+ const ruleResult = RulesEngine.applyRules(rules, values, {});
167
+ const hasShowRule = rules.some((rule)=>rule.effects?.visible === true);
168
+ rules.some((rule)=>rule.effects?.visible === false);
169
+ if (void 0 !== ruleResult.visible) return ruleResult.visible;
170
+ if (hasShowRule) return false;
171
+ return true;
172
+ }
173
+ static buildDependencyGraph(rules) {
174
+ const graph = new Map();
175
+ for (const rule of rules)for (const condition of rule.conditions){
176
+ if (!graph.has(condition.when)) graph.set(condition.when, new Set());
177
+ graph.get(condition.when).add(rule.id);
178
+ }
179
+ return graph;
180
+ }
181
+ }
182
+ class ExpressionBuilder {
183
+ static equals(field, value) {
184
+ return `${field} == ${JSON.stringify(value)}`;
185
+ }
186
+ static notEquals(field, value) {
187
+ return `${field} != ${JSON.stringify(value)}`;
188
+ }
189
+ static greaterThan(field, value) {
190
+ return `${field} > ${value}`;
191
+ }
192
+ static lessThan(field, value) {
193
+ return `${field} < ${value}`;
194
+ }
195
+ static greaterThanOrEqual(field, value) {
196
+ return `${field} >= ${value}`;
197
+ }
198
+ static lessThanOrEqual(field, value) {
199
+ return `${field} <= ${value}`;
200
+ }
201
+ static isEmpty(field) {
202
+ return `!${field} || ${field} == ''`;
203
+ }
204
+ static isNotEmpty(field) {
205
+ return `${field} && ${field} != ''`;
206
+ }
207
+ static and(...expressions) {
208
+ return `(${expressions.join(' && ')})`;
209
+ }
210
+ static or(...expressions) {
211
+ return `(${expressions.join(' || ')})`;
212
+ }
213
+ static not(expression) {
214
+ return `!(${expression})`;
215
+ }
216
+ static between(field, min, max) {
217
+ return `${field} >= ${min} && ${field} <= ${max}`;
218
+ }
219
+ static sum(fields) {
220
+ return fields.map((f)=>`(${f} || 0)`).join(' + ');
221
+ }
222
+ static product(fields) {
223
+ return fields.map((f)=>`(${f} || 0)`).join(' * ');
224
+ }
225
+ static average(fields) {
226
+ const sum = ExpressionBuilder.sum(fields);
227
+ return `(${sum}) / ${fields.length}`;
228
+ }
229
+ static inArray(field, values) {
230
+ const checks = values.map((v)=>`${field} == ${JSON.stringify(v)}`);
231
+ return ExpressionBuilder.or(...checks);
232
+ }
233
+ }
234
+ class RuleBuilder {
235
+ rule;
236
+ constructor(id){
237
+ this.rule = {
238
+ id,
239
+ conditions: [],
240
+ operator: 'AND',
241
+ effects: {}
242
+ };
243
+ }
244
+ when(field) {
245
+ return new ConditionBuilder(this, field);
246
+ }
247
+ withCustomExpression(expression) {
248
+ this.rule.conditions.push({
249
+ when: '',
250
+ custom: expression
251
+ });
252
+ return this;
253
+ }
254
+ useOperator(operator) {
255
+ this.rule.operator = operator;
256
+ return this;
257
+ }
258
+ show() {
259
+ this.rule.effects.visible = true;
260
+ return this;
261
+ }
262
+ hide() {
263
+ this.rule.effects.visible = false;
264
+ return this;
265
+ }
266
+ enable() {
267
+ this.rule.effects.disabled = false;
268
+ return this;
269
+ }
270
+ disable() {
271
+ this.rule.effects.disabled = true;
272
+ return this;
273
+ }
274
+ require() {
275
+ this.rule.effects.required = true;
276
+ return this;
277
+ }
278
+ optional() {
279
+ this.rule.effects.required = false;
280
+ return this;
281
+ }
282
+ setValue(value) {
283
+ this.rule.effects.value = value;
284
+ return this;
285
+ }
286
+ build() {
287
+ return this.rule;
288
+ }
289
+ }
290
+ class ConditionBuilder {
291
+ ruleBuilder;
292
+ field;
293
+ constructor(ruleBuilder, field){
294
+ this.ruleBuilder = ruleBuilder;
295
+ this.field = field;
296
+ }
297
+ is(value) {
298
+ this.ruleBuilder['rule'].conditions.push({
299
+ when: this.field,
300
+ is: value
301
+ });
302
+ return this.ruleBuilder;
303
+ }
304
+ isNot(value) {
305
+ this.ruleBuilder['rule'].conditions.push({
306
+ when: this.field,
307
+ isNot: value
308
+ });
309
+ return this.ruleBuilder;
310
+ }
311
+ in(values) {
312
+ this.ruleBuilder['rule'].conditions.push({
313
+ when: this.field,
314
+ in: values
315
+ });
316
+ return this.ruleBuilder;
317
+ }
318
+ notIn(values) {
319
+ this.ruleBuilder['rule'].conditions.push({
320
+ when: this.field,
321
+ notIn: values
322
+ });
323
+ return this.ruleBuilder;
324
+ }
325
+ matches(pattern) {
326
+ this.ruleBuilder['rule'].conditions.push({
327
+ when: this.field,
328
+ matches: pattern
329
+ });
330
+ return this.ruleBuilder;
331
+ }
332
+ }
333
+ exports.ExpressionBuilder = __webpack_exports__.ExpressionBuilder;
334
+ exports.RuleBuilder = __webpack_exports__.RuleBuilder;
335
+ exports.RulesEngine = __webpack_exports__.RulesEngine;
336
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
337
+ "ExpressionBuilder",
338
+ "RuleBuilder",
339
+ "RulesEngine"
340
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
341
+ Object.defineProperty(exports, '__esModule', {
342
+ value: true
343
+ });
@@ -0,0 +1,99 @@
1
+ import type { FieldRule, FieldCondition, FormContext, FieldOption } from './form-schema';
2
+ /**
3
+ * Rules Engine - Evaluates conditions and applies effects using jsep
4
+ * Powers show/hide, enable/disable, validation changes, etc.
5
+ * Uses jsep for safe expression parsing with minimal evaluator
6
+ */
7
+ export declare class RulesEngine {
8
+ /**
9
+ * Evaluate if conditions are met
10
+ */
11
+ static evaluateConditions(conditions: FieldCondition[], values: Record<string, unknown>, operator?: 'AND' | 'OR'): boolean;
12
+ /**
13
+ * Evaluate a single condition
14
+ */
15
+ static evaluateCondition(condition: FieldCondition, values: Record<string, unknown>): boolean;
16
+ /**
17
+ * Apply all rules for a field and return the resulting state
18
+ */
19
+ static applyRules(rules: FieldRule[], values: Record<string, unknown>, _context: FormContext): {
20
+ visible?: boolean;
21
+ disabled?: boolean;
22
+ required?: boolean;
23
+ value?: unknown;
24
+ options?: FieldOption[];
25
+ };
26
+ /**
27
+ * Evaluate custom expression using jsep
28
+ *
29
+ * Supports expressions like:
30
+ * - "age > 18"
31
+ * - "quantity * price"
32
+ * - "status == 'active' && role == 'admin'"
33
+ * - "total >= 100 ? 'discount' : 'regular'"
34
+ */
35
+ static evaluateExpression(expression: string, values: Record<string, unknown>): unknown;
36
+ /**
37
+ * Minimal AST evaluator - only supports operators needed for form rules
38
+ */
39
+ private static evaluateNode;
40
+ /**
41
+ * Determine if a field is visible based on its rules and current form values
42
+ * Extracted for reuse in validation and field rendering
43
+ */
44
+ static isFieldVisible(rules: FieldRule[] | undefined, values: Record<string, unknown>): boolean;
45
+ /**
46
+ * Build a dependency graph for optimized field watching
47
+ */
48
+ static buildDependencyGraph(rules: FieldRule[]): Map<string, Set<string>>;
49
+ }
50
+ /**
51
+ * Expression Builder - Helper for creating common expressions
52
+ */
53
+ export declare class ExpressionBuilder {
54
+ static equals(field: string, value: unknown): string;
55
+ static notEquals(field: string, value: unknown): string;
56
+ static greaterThan(field: string, value: number): string;
57
+ static lessThan(field: string, value: number): string;
58
+ static greaterThanOrEqual(field: string, value: number): string;
59
+ static lessThanOrEqual(field: string, value: number): string;
60
+ static isEmpty(field: string): string;
61
+ static isNotEmpty(field: string): string;
62
+ static and(...expressions: string[]): string;
63
+ static or(...expressions: string[]): string;
64
+ static not(expression: string): string;
65
+ static between(field: string, min: number, max: number): string;
66
+ static sum(fields: string[]): string;
67
+ static product(fields: string[]): string;
68
+ static average(fields: string[]): string;
69
+ static inArray(field: string, values: unknown[]): string;
70
+ }
71
+ /**
72
+ * Rule Builder - Fluent API for creating rules
73
+ */
74
+ export declare class RuleBuilder {
75
+ private rule;
76
+ constructor(id: string);
77
+ when(field: string): ConditionBuilder;
78
+ withCustomExpression(expression: string): this;
79
+ useOperator(operator: 'AND' | 'OR'): this;
80
+ show(): this;
81
+ hide(): this;
82
+ enable(): this;
83
+ disable(): this;
84
+ require(): this;
85
+ optional(): this;
86
+ setValue(value: unknown): this;
87
+ build(): FieldRule;
88
+ }
89
+ declare class ConditionBuilder {
90
+ private ruleBuilder;
91
+ private field;
92
+ constructor(ruleBuilder: RuleBuilder, field: string);
93
+ is(value: unknown): RuleBuilder;
94
+ isNot(value: unknown): RuleBuilder;
95
+ in(values: unknown[]): RuleBuilder;
96
+ notIn(values: unknown[]): RuleBuilder;
97
+ matches(pattern: string): RuleBuilder;
98
+ }
99
+ export {};