@syncfusion/ej2-form-renderer 34.2.2

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 (214) hide show
  1. package/README.md +60 -0
  2. package/common.d.ts +4 -0
  3. package/common.js +4 -0
  4. package/dist/ej2-form-renderer.umd.min.js +11 -0
  5. package/dist/ej2-form-renderer.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-form-renderer.es2015.js +6787 -0
  7. package/dist/es6/ej2-form-renderer.es2015.js.map +1 -0
  8. package/dist/es6/ej2-form-renderer.es5.js +7055 -0
  9. package/dist/es6/ej2-form-renderer.es5.js.map +1 -0
  10. package/dist/global/ej2-form-renderer.min.js +11 -0
  11. package/dist/global/ej2-form-renderer.min.js.map +1 -0
  12. package/dist/global/index.d.ts +14 -0
  13. package/form-renderer.d.ts +4 -0
  14. package/form-renderer.js +4 -0
  15. package/index.d.ts +4 -0
  16. package/index.js +4 -0
  17. package/license +10 -0
  18. package/package.json +41 -0
  19. package/src/common/checkbox-group.d.ts +55 -0
  20. package/src/common/checkbox-group.js +241 -0
  21. package/src/common/conditional-rule-engine.d.ts +241 -0
  22. package/src/common/conditional-rule-engine.js +505 -0
  23. package/src/common/custom-validation-engine.d.ts +57 -0
  24. package/src/common/custom-validation-engine.js +152 -0
  25. package/src/common/datagrid-component.d.ts +156 -0
  26. package/src/common/datagrid-component.js +410 -0
  27. package/src/common/expressions/dependency-tracker.d.ts +29 -0
  28. package/src/common/expressions/dependency-tracker.js +137 -0
  29. package/src/common/expressions/expression-engine.d.ts +94 -0
  30. package/src/common/expressions/expression-engine.js +514 -0
  31. package/src/common/expressions/expression-parser.d.ts +40 -0
  32. package/src/common/expressions/expression-parser.js +270 -0
  33. package/src/common/expressions/grid-expressions.d.ts +24 -0
  34. package/src/common/expressions/grid-expressions.js +92 -0
  35. package/src/common/expressions/index.d.ts +4 -0
  36. package/src/common/expressions/index.js +4 -0
  37. package/src/common/index.d.ts +10 -0
  38. package/src/common/index.js +10 -0
  39. package/src/common/json-converter.d.ts +945 -0
  40. package/src/common/json-converter.js +1110 -0
  41. package/src/common/minmax-rule-engine.d.ts +105 -0
  42. package/src/common/minmax-rule-engine.js +380 -0
  43. package/src/common/option-fetcher.d.ts +30 -0
  44. package/src/common/option-fetcher.js +139 -0
  45. package/src/common/parser.d.ts +98 -0
  46. package/src/common/parser.js +788 -0
  47. package/src/common/static-html-renderer.d.ts +45 -0
  48. package/src/common/static-html-renderer.js +77 -0
  49. package/src/common/utils.d.ts +116 -0
  50. package/src/common/utils.js +484 -0
  51. package/src/form-renderer/form-renderer-model.d.ts +65 -0
  52. package/src/form-renderer/form-renderer.d.ts +425 -0
  53. package/src/form-renderer/form-renderer.js +2277 -0
  54. package/src/form-renderer/index.d.ts +6 -0
  55. package/src/form-renderer/index.js +5 -0
  56. package/src/form-renderer/render-form-field.d.ts +31 -0
  57. package/src/form-renderer/render-form-field.js +816 -0
  58. package/src/form-renderer/types/form-schema.d.ts +452 -0
  59. package/src/form-renderer/types/form-schema.js +32 -0
  60. package/src/global.js +1 -0
  61. package/src/index.d.ts +4 -0
  62. package/src/index.js +4 -0
  63. package/styles/bds-lite.css +599 -0
  64. package/styles/bds-lite.scss +2 -0
  65. package/styles/bds.css +599 -0
  66. package/styles/bds.scss +2 -0
  67. package/styles/bootstrap-dark-lite.css +608 -0
  68. package/styles/bootstrap-dark-lite.scss +2 -0
  69. package/styles/bootstrap-dark.css +608 -0
  70. package/styles/bootstrap-dark.scss +2 -0
  71. package/styles/bootstrap-lite.css +595 -0
  72. package/styles/bootstrap-lite.scss +2 -0
  73. package/styles/bootstrap.css +595 -0
  74. package/styles/bootstrap.scss +2 -0
  75. package/styles/bootstrap4-lite.css +595 -0
  76. package/styles/bootstrap4-lite.scss +2 -0
  77. package/styles/bootstrap4.css +595 -0
  78. package/styles/bootstrap4.scss +2 -0
  79. package/styles/bootstrap5-dark-lite.css +595 -0
  80. package/styles/bootstrap5-dark-lite.scss +2 -0
  81. package/styles/bootstrap5-dark.css +595 -0
  82. package/styles/bootstrap5-dark.scss +2 -0
  83. package/styles/bootstrap5-lite.css +595 -0
  84. package/styles/bootstrap5-lite.scss +2 -0
  85. package/styles/bootstrap5.3-lite.css +679 -0
  86. package/styles/bootstrap5.3-lite.scss +2 -0
  87. package/styles/bootstrap5.3.css +679 -0
  88. package/styles/bootstrap5.3.scss +2 -0
  89. package/styles/bootstrap5.css +595 -0
  90. package/styles/bootstrap5.scss +2 -0
  91. package/styles/fabric-dark-lite.css +608 -0
  92. package/styles/fabric-dark-lite.scss +2 -0
  93. package/styles/fabric-dark.css +608 -0
  94. package/styles/fabric-dark.scss +2 -0
  95. package/styles/fabric-lite.css +595 -0
  96. package/styles/fabric-lite.scss +2 -0
  97. package/styles/fabric.css +595 -0
  98. package/styles/fabric.scss +2 -0
  99. package/styles/fluent-dark-lite.css +595 -0
  100. package/styles/fluent-dark-lite.scss +2 -0
  101. package/styles/fluent-dark.css +595 -0
  102. package/styles/fluent-dark.scss +2 -0
  103. package/styles/fluent-lite.css +595 -0
  104. package/styles/fluent-lite.scss +2 -0
  105. package/styles/fluent.css +595 -0
  106. package/styles/fluent.scss +2 -0
  107. package/styles/fluent2-lite.css +681 -0
  108. package/styles/fluent2-lite.scss +2 -0
  109. package/styles/fluent2.css +681 -0
  110. package/styles/fluent2.scss +2 -0
  111. package/styles/form-renderer/_all.scss +2 -0
  112. package/styles/form-renderer/_bds-definition.scss +8 -0
  113. package/styles/form-renderer/_bootstrap-dark-definition.scss +8 -0
  114. package/styles/form-renderer/_bootstrap-definition.scss +8 -0
  115. package/styles/form-renderer/_bootstrap4-definition.scss +8 -0
  116. package/styles/form-renderer/_bootstrap5-dark-definition.scss +8 -0
  117. package/styles/form-renderer/_bootstrap5-definition.scss +8 -0
  118. package/styles/form-renderer/_bootstrap5.3-definition.scss +8 -0
  119. package/styles/form-renderer/_fabric-dark-definition.scss +8 -0
  120. package/styles/form-renderer/_fabric-definition.scss +8 -0
  121. package/styles/form-renderer/_fluent-dark-definition.scss +8 -0
  122. package/styles/form-renderer/_fluent-definition.scss +8 -0
  123. package/styles/form-renderer/_fluent2-definition.scss +8 -0
  124. package/styles/form-renderer/_highcontrast-definition.scss +8 -0
  125. package/styles/form-renderer/_highcontrast-light-definition.scss +8 -0
  126. package/styles/form-renderer/_layout.scss +480 -0
  127. package/styles/form-renderer/_material-dark-definition.scss +8 -0
  128. package/styles/form-renderer/_material-definition.scss +8 -0
  129. package/styles/form-renderer/_material3-dark-definition.scss +8 -0
  130. package/styles/form-renderer/_material3-definition.scss +8 -0
  131. package/styles/form-renderer/_mixin.scss +26 -0
  132. package/styles/form-renderer/_tailwind-dark-definition.scss +8 -0
  133. package/styles/form-renderer/_tailwind-definition.scss +8 -0
  134. package/styles/form-renderer/_tailwind3-definition.scss +8 -0
  135. package/styles/form-renderer/_theme.scss +69 -0
  136. package/styles/form-renderer/_variables.scss +2 -0
  137. package/styles/form-renderer/bds.css +599 -0
  138. package/styles/form-renderer/bds.scss +2 -0
  139. package/styles/form-renderer/bootstrap-dark.css +608 -0
  140. package/styles/form-renderer/bootstrap-dark.scss +2 -0
  141. package/styles/form-renderer/bootstrap.css +595 -0
  142. package/styles/form-renderer/bootstrap.scss +2 -0
  143. package/styles/form-renderer/bootstrap4.css +595 -0
  144. package/styles/form-renderer/bootstrap4.scss +2 -0
  145. package/styles/form-renderer/bootstrap5-dark.css +595 -0
  146. package/styles/form-renderer/bootstrap5-dark.scss +2 -0
  147. package/styles/form-renderer/bootstrap5.3.css +679 -0
  148. package/styles/form-renderer/bootstrap5.3.scss +2 -0
  149. package/styles/form-renderer/bootstrap5.css +595 -0
  150. package/styles/form-renderer/bootstrap5.scss +2 -0
  151. package/styles/form-renderer/fabric-dark.css +608 -0
  152. package/styles/form-renderer/fabric-dark.scss +2 -0
  153. package/styles/form-renderer/fabric.css +595 -0
  154. package/styles/form-renderer/fabric.scss +2 -0
  155. package/styles/form-renderer/fluent-dark.css +595 -0
  156. package/styles/form-renderer/fluent-dark.scss +2 -0
  157. package/styles/form-renderer/fluent.css +595 -0
  158. package/styles/form-renderer/fluent.scss +2 -0
  159. package/styles/form-renderer/fluent2.css +681 -0
  160. package/styles/form-renderer/fluent2.scss +2 -0
  161. package/styles/form-renderer/highcontrast-light.css +595 -0
  162. package/styles/form-renderer/highcontrast-light.scss +2 -0
  163. package/styles/form-renderer/highcontrast.css +608 -0
  164. package/styles/form-renderer/highcontrast.scss +2 -0
  165. package/styles/form-renderer/material-dark.css +608 -0
  166. package/styles/form-renderer/material-dark.scss +2 -0
  167. package/styles/form-renderer/material.css +595 -0
  168. package/styles/form-renderer/material.scss +2 -0
  169. package/styles/form-renderer/material3-dark.css +677 -0
  170. package/styles/form-renderer/material3-dark.scss +2 -0
  171. package/styles/form-renderer/material3.css +679 -0
  172. package/styles/form-renderer/material3.scss +2 -0
  173. package/styles/form-renderer/tailwind-dark.css +595 -0
  174. package/styles/form-renderer/tailwind-dark.scss +2 -0
  175. package/styles/form-renderer/tailwind.css +595 -0
  176. package/styles/form-renderer/tailwind.scss +2 -0
  177. package/styles/form-renderer/tailwind3.css +669 -0
  178. package/styles/form-renderer/tailwind3.scss +2 -0
  179. package/styles/highcontrast-light-lite.css +595 -0
  180. package/styles/highcontrast-light-lite.scss +2 -0
  181. package/styles/highcontrast-light.css +595 -0
  182. package/styles/highcontrast-light.scss +2 -0
  183. package/styles/highcontrast-lite.css +608 -0
  184. package/styles/highcontrast-lite.scss +2 -0
  185. package/styles/highcontrast.css +608 -0
  186. package/styles/highcontrast.scss +2 -0
  187. package/styles/material-dark-lite.css +608 -0
  188. package/styles/material-dark-lite.scss +2 -0
  189. package/styles/material-dark.css +608 -0
  190. package/styles/material-dark.scss +2 -0
  191. package/styles/material-lite.css +595 -0
  192. package/styles/material-lite.scss +2 -0
  193. package/styles/material.css +595 -0
  194. package/styles/material.scss +2 -0
  195. package/styles/material3-dark-lite.css +677 -0
  196. package/styles/material3-dark-lite.scss +2 -0
  197. package/styles/material3-dark.css +677 -0
  198. package/styles/material3-dark.scss +2 -0
  199. package/styles/material3-lite.css +679 -0
  200. package/styles/material3-lite.scss +2 -0
  201. package/styles/material3.css +679 -0
  202. package/styles/material3.scss +2 -0
  203. package/styles/tailwind-dark-lite.css +595 -0
  204. package/styles/tailwind-dark-lite.scss +2 -0
  205. package/styles/tailwind-dark.css +595 -0
  206. package/styles/tailwind-dark.scss +2 -0
  207. package/styles/tailwind-lite.css +595 -0
  208. package/styles/tailwind-lite.scss +2 -0
  209. package/styles/tailwind.css +595 -0
  210. package/styles/tailwind.scss +2 -0
  211. package/styles/tailwind3-lite.css +669 -0
  212. package/styles/tailwind3-lite.scss +2 -0
  213. package/styles/tailwind3.css +669 -0
  214. package/styles/tailwind3.scss +2 -0
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * filename: index.d.ts
3
+ * version : 34.2.2
4
+ * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
+ * Use of this code is subject to the terms of our license.
6
+ * A copy of the current license can be obtained at any time by e-mailing
7
+ * licensing@syncfusion.com. Any infringement will be prosecuted under
8
+ * applicable laws.
9
+ */
10
+ import * as _formrenderer from '@syncfusion/ej2-form-renderer';
11
+
12
+ export declare namespace ej {
13
+ const formrenderer: typeof _formrenderer;
14
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * form-renderer
3
+ */
4
+ export * from './src/form-renderer/index';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * form-renderer
3
+ */
4
+ export * from './src/form-renderer/index';
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * index
3
+ */
4
+ export * from './src/index';
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ /**
2
+ * index
3
+ */
4
+ export * from './src/index';
package/license ADDED
@@ -0,0 +1,10 @@
1
+ Essential JS 2 library is available under the Syncfusion Essential Studio program, and can be licensed either under the Syncfusion Community License Program or the Syncfusion commercial license.
2
+
3
+ To be qualified for the Syncfusion Community License Program you must have a gross revenue of less than one (1) million U.S. dollars ($1,000,000.00 USD) per year and have less than five (5) developers in your organization, and agree to be bound by Syncfusion’s terms and conditions.
4
+
5
+ Customers who do not qualify for the community license can contact sales@syncfusion.com for commercial licensing options.
6
+
7
+ Under no circumstances can you use this product without (1) either a Community License or a commercial license and (2) without agreeing and abiding by Syncfusion’s license containing all terms and conditions.
8
+
9
+ The Syncfusion license that contains the terms and conditions can be found at
10
+ https://www.syncfusion.com/content/downloads/syncfusion_license.pdf
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@syncfusion/ej2-form-renderer",
3
+ "version": "34.2.2",
4
+ "description": "A package of Essential JS 2 Form Renderer which can render feature-rich Syncfusion components as a form.",
5
+ "author": "Syncfusion Inc.",
6
+ "license": "SEE LICENSE IN license",
7
+ "main": "./dist/ej2-form-renderer.umd.min.js",
8
+ "module": "./index.js",
9
+ "es2015": "./dist/es6/ej2-form-renderer.es5.js",
10
+ "dependencies": {
11
+ "@syncfusion/ej2-buttons": "~34.2.2",
12
+ "@syncfusion/ej2-calendars": "~34.2.2",
13
+ "@syncfusion/ej2-dropdowns": "~34.2.2",
14
+ "@syncfusion/ej2-grids": "~34.2.2",
15
+ "@syncfusion/ej2-image-editor": "~34.2.2",
16
+ "@syncfusion/ej2-inputs": "~34.2.2",
17
+ "@syncfusion/ej2-navigations": "~34.2.2",
18
+ "@syncfusion/ej2-notifications": "~34.2.2",
19
+ "@syncfusion/ej2-richtexteditor": "~34.2.2",
20
+ "@syncfusion/ej2-splitbuttons": "~34.2.2"
21
+ },
22
+ "devDependencies": {},
23
+ "keywords": [
24
+ "syncfusion",
25
+ "ej2",
26
+ "react",
27
+ "form",
28
+ "form-renderer",
29
+ "dynamic-forms",
30
+ "json-forms",
31
+ "schema-forms",
32
+ "ui-components"
33
+ ],
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/syncfusion/ej2-javascript-ui-controls.git"
37
+ },
38
+ "typings": "index.d.ts",
39
+ "sideEffects": false,
40
+ "homepage": "https://www.syncfusion.com/javascript-ui-controls"
41
+ }
@@ -0,0 +1,55 @@
1
+ import { FormNode } from '../form-renderer/types/form-schema';
2
+ /**
3
+ * @private
4
+ * Options for `CheckboxGroup`.
5
+ */
6
+ export interface CheckboxGroupOptions {
7
+ component: FormNode;
8
+ formState?: any;
9
+ value?: string[];
10
+ onChange?: (value: string[]) => void;
11
+ optionRef?: (el: any, idx?: number) => void;
12
+ enableRtl?: boolean;
13
+ target?: HTMLElement;
14
+ ref?: any;
15
+ }
16
+ /**
17
+ * @private
18
+ */
19
+ export declare class CheckboxGroup {
20
+ private component;
21
+ private formState;
22
+ private onChangeCb;
23
+ private optionRef;
24
+ private enableRtl;
25
+ private target;
26
+ private container;
27
+ private itemsContainer;
28
+ private checkboxes;
29
+ private ref;
30
+ constructor(options: CheckboxGroupOptions);
31
+ private getSelectedItems;
32
+ private valueProp;
33
+ /** Used in non-formState mode to seed the initial value. */
34
+ setValue(value: string[]): void;
35
+ private handleCheckboxChange;
36
+ /**
37
+ * Compose the size CSS class for the CheckBox.
38
+ */
39
+ private readonly sizeCssClass;
40
+ /**
41
+ * Build and append the group DOM tree. Returns the container element.
42
+ */
43
+ render(target?: HTMLElement): HTMLElement;
44
+ /**
45
+ * Re-render the selection state from the current model value. Used by
46
+ * the host after a programmatic value change.
47
+ */
48
+ refreshSelection(): void;
49
+ /**
50
+ * Destroy all child EJ2 instances and detach the container.
51
+ */
52
+ destroy(): void;
53
+ setOptions(options: any[]): void;
54
+ }
55
+ export default CheckboxGroup;
@@ -0,0 +1,241 @@
1
+ import { CheckBox } from '@syncfusion/ej2-buttons';
2
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
3
+ /**
4
+ * @private
5
+ */
6
+ var resolveAttributes = function (attributes) {
7
+ if (!attributes) {
8
+ return {};
9
+ }
10
+ if (Array.isArray(attributes)) {
11
+ return attributes.reduce(function (acc, item) {
12
+ if (item && item.key && item.value !== undefined) {
13
+ acc[item.key] = item.value;
14
+ }
15
+ return acc;
16
+ }, {});
17
+ }
18
+ return attributes;
19
+ };
20
+ /**
21
+ * @private
22
+ */
23
+ var CheckboxGroup = /** @class */ (function () {
24
+ function CheckboxGroup(options) {
25
+ this.checkboxes = [];
26
+ this.component = options.component;
27
+ this.formState = options.formState;
28
+ this.onChangeCb = options.onChange;
29
+ this.optionRef = options.optionRef;
30
+ this.enableRtl = options.enableRtl;
31
+ this.target = options.target;
32
+ this.container = null;
33
+ this.itemsContainer = null;
34
+ this.ref = options.ref;
35
+ }
36
+ CheckboxGroup.prototype.getSelectedItems = function () {
37
+ var resolvedValue = (this.formState
38
+ ? this.formState.values[this.component.id]
39
+ : (isNullOrUndefined(this.valueProp()) ? this.component.defaultValue : this.valueProp()));
40
+ return Array.isArray(resolvedValue) ? resolvedValue : [];
41
+ };
42
+ CheckboxGroup.prototype.valueProp = function () {
43
+ // Used only when `formState` is absent — read the `value` option.
44
+ return this._value;
45
+ };
46
+ /** Used in non-formState mode to seed the initial value. */
47
+ CheckboxGroup.prototype.setValue = function (value) {
48
+ this._value = value;
49
+ };
50
+ CheckboxGroup.prototype.handleCheckboxChange = function (option, checked) {
51
+ var selectedItems = this.getSelectedItems();
52
+ var newValue = checked
53
+ ? selectedItems.concat([option]) : selectedItems.filter(function (i) { return i !== option; });
54
+ if (this.formState) {
55
+ this.onChangeCb(newValue);
56
+ }
57
+ };
58
+ Object.defineProperty(CheckboxGroup.prototype, "sizeCssClass", {
59
+ /**
60
+ * Compose the size CSS class for the CheckBox.
61
+ */
62
+ get: function () {
63
+ var base = this.component.cssClass || '';
64
+ var sizeMod = this.component.size === 'Small'
65
+ ? ' e-small'
66
+ : this.component.size === 'Bigger'
67
+ ? ' e-bigger'
68
+ : '';
69
+ return "" + base + sizeMod;
70
+ },
71
+ enumerable: true,
72
+ configurable: true
73
+ });
74
+ /**
75
+ * Build and append the group DOM tree. Returns the container element.
76
+ */
77
+ CheckboxGroup.prototype.render = function (target) {
78
+ var _this = this;
79
+ var component = this.component;
80
+ var groupLabel = component.label && component.required
81
+ ? component.label + " *"
82
+ : (component.label || '');
83
+ var host = target || this.target;
84
+ // Outer container
85
+ var container = document.createElement('div');
86
+ container.className = ("checkbox-group " + (component.cssClass || '')).trim();
87
+ container.setAttribute('role', 'group');
88
+ container.setAttribute('aria-label', groupLabel);
89
+ container.title = component.tooltip || '';
90
+ var htmlAttrs = resolveAttributes(component.htmlAttributes);
91
+ Object.keys(htmlAttrs).forEach(function (key) {
92
+ // Apply additional htmlAttributes to the container (matches spread).
93
+ if (key !== 'class' && key !== 'className' && key !== 'style') {
94
+ container.setAttribute(key, String(htmlAttrs[key]));
95
+ }
96
+ });
97
+ var containerStyle = "display:flex;flex-direction:" + (component.layoutDirection === 'row' ? 'row' : 'column') + ";" +
98
+ ("gap:" + (component.gap || '8px') + ";align-items:flex-start;");
99
+ container.setAttribute('style', containerStyle);
100
+ // Items container
101
+ var itemsContainer = document.createElement('div');
102
+ itemsContainer.className = 'checkbox-group-items';
103
+ var itemsStyle = "display:flex;flex-direction:" + (component.layoutDirection === 'row' ? 'row' : 'column') + ";" +
104
+ ("flex-wrap:wrap;gap:" + (component.gap || '2px') + ";width:100%;");
105
+ itemsContainer.setAttribute('style', itemsStyle);
106
+ var options = Array.isArray(component.options) ? component.options : ['Option 1'];
107
+ var selectedItems = this.getSelectedItems();
108
+ options.forEach(function (option, idx) {
109
+ var optionValue = typeof option === 'string'
110
+ ? option
111
+ : (option.value != null ? option.value : (option.label != null ? option.label : option.key));
112
+ var optionLabel = typeof option === 'string'
113
+ ? option
114
+ : (option.label != null ? option.label : (option.value != null ? option.value : String(optionValue)));
115
+ var wrapper = document.createElement('div');
116
+ itemsContainer.appendChild(wrapper);
117
+ var checkBox = new CheckBox({
118
+ label: optionLabel,
119
+ enableRtl: _this.enableRtl,
120
+ checked: selectedItems.indexOf(optionValue) !== -1,
121
+ disabled: !!component.disabled,
122
+ labelPosition: component.checkboxLabelPosition || 'After',
123
+ cssClass: _this.sizeCssClass.trim(),
124
+ htmlAttributes: htmlAttrs,
125
+ change: function (e) {
126
+ _this.handleCheckboxChange(optionValue, e.checked);
127
+ }
128
+ });
129
+ checkBox.appendTo(wrapper);
130
+ _this.ref(checkBox, idx);
131
+ // Set the id mirroring `${component.id}_${idx}` after appendTo so
132
+ // EJ2 preserves the wrapper id semantics.
133
+ var inputEl = wrapper.querySelector('input[type="checkbox"]');
134
+ if (inputEl) {
135
+ inputEl.id = _this.component.id + "_" + idx;
136
+ }
137
+ // Ref callback — provide the EJ2 instance + index.
138
+ if (_this.optionRef) {
139
+ _this.optionRef(checkBox, idx);
140
+ }
141
+ _this.checkboxes.push(checkBox);
142
+ });
143
+ container.appendChild(itemsContainer);
144
+ if (host) {
145
+ host.appendChild(container);
146
+ }
147
+ this.container = container;
148
+ this.itemsContainer = itemsContainer;
149
+ return container;
150
+ };
151
+ /**
152
+ * Re-render the selection state from the current model value. Used by
153
+ * the host after a programmatic value change.
154
+ */
155
+ CheckboxGroup.prototype.refreshSelection = function () {
156
+ var _this = this;
157
+ var selectedItems = this.getSelectedItems();
158
+ var options = Array.isArray(this.component.options) ? this.component.options : ['Option 1'];
159
+ options.forEach(function (option, idx) {
160
+ var optionValue = typeof option === 'string'
161
+ ? option
162
+ : (option.value != null ? option.value : (option.label != null ? option.label : option.key));
163
+ var checkBox = _this.checkboxes[idx];
164
+ if (checkBox) {
165
+ checkBox.checked = selectedItems.indexOf(optionValue) !== -1;
166
+ }
167
+ });
168
+ };
169
+ /**
170
+ * Destroy all child EJ2 instances and detach the container.
171
+ */
172
+ CheckboxGroup.prototype.destroy = function () {
173
+ for (var _i = 0, _a = this.checkboxes; _i < _a.length; _i++) {
174
+ var cb = _a[_i];
175
+ try {
176
+ cb.destroy();
177
+ }
178
+ catch (e) { /* ignore */ }
179
+ }
180
+ this.checkboxes = [];
181
+ if (this.container && this.container.parentNode) {
182
+ this.container.parentNode.removeChild(this.container);
183
+ }
184
+ this.container = null;
185
+ this.itemsContainer = null;
186
+ };
187
+ CheckboxGroup.prototype.setOptions = function (options) {
188
+ var _this = this;
189
+ this.component.options = options;
190
+ if (!this.itemsContainer) {
191
+ return;
192
+ }
193
+ for (var _i = 0, _a = this.checkboxes; _i < _a.length; _i++) {
194
+ var cb = _a[_i];
195
+ try {
196
+ cb.destroy();
197
+ }
198
+ catch (_b) {
199
+ }
200
+ }
201
+ this.checkboxes = [];
202
+ while (this.itemsContainer.firstChild) {
203
+ this.itemsContainer.removeChild(this.itemsContainer.firstChild);
204
+ }
205
+ var selectedItems = this.getSelectedItems();
206
+ options.forEach(function (option, idx) {
207
+ var optionValue = typeof option === 'string'
208
+ ? option
209
+ : (option.value || option.label || option.key);
210
+ var optionLabel = typeof option === 'string'
211
+ ? option
212
+ : (option.label || option.value || String(optionValue));
213
+ var wrapper = document.createElement('div');
214
+ _this.itemsContainer.appendChild(wrapper);
215
+ var checkBox = new CheckBox({
216
+ label: optionLabel,
217
+ enableRtl: _this.enableRtl,
218
+ checked: selectedItems.indexOf(optionValue) !== -1,
219
+ disabled: !!_this.component.disabled,
220
+ labelPosition: _this.component.checkboxLabelPosition || 'After',
221
+ cssClass: _this.sizeCssClass.trim(),
222
+ change: function (e) {
223
+ _this.handleCheckboxChange(optionValue, e.checked);
224
+ }
225
+ });
226
+ checkBox.appendTo(wrapper);
227
+ _this.ref(checkBox, idx);
228
+ var inputEl = wrapper.querySelector('input[type="checkbox"]');
229
+ if (inputEl) {
230
+ inputEl.id = _this.component.id + "_" + idx;
231
+ }
232
+ if (_this.optionRef) {
233
+ _this.optionRef(checkBox, idx);
234
+ }
235
+ _this.checkboxes.push(checkBox);
236
+ });
237
+ };
238
+ return CheckboxGroup;
239
+ }());
240
+ export { CheckboxGroup };
241
+ export default CheckboxGroup;
@@ -0,0 +1,241 @@
1
+ import { ConditionType, ConditionRule, ConditionalDataRule, ChoiceBasedFieldRule } from '../form-renderer/types/form-schema';
2
+ /**
3
+ * Form field value type (aligned with FormValidator)
4
+ *
5
+ * @private
6
+ */
7
+ export declare type FormValueType = string | number | boolean | Date | bigint | symbol | File | FileList | string[] | number[] | any | null | undefined;
8
+ /**
9
+ * ConditionalRuleEngine class
10
+ * @private
11
+ */
12
+ export declare class ConditionalRuleEngine {
13
+ /**
14
+ * Evaluate a conditional rule against form values
15
+ *
16
+ * Handles both simple rules (field operator value) and composite rules (AND/OR).
17
+ * Returns false for malformed rules.
18
+ *
19
+ * @param rule - ConditionalRule or CompositeConditionalRule
20
+ * @param formValues - Current form field values (key = field name, value = field value)
21
+ * @returns true if condition met, false otherwise
22
+ * @private
23
+ * @example
24
+ * ```typescript
25
+ * const rule = { field: 'age', operator: 'greaterThan', value: 18 };
26
+ * const isAdult = ConditionalRuleEngine.evaluateCondition(rule, { age: 25 });
27
+ * // isAdult = true
28
+ * ```
29
+ */
30
+ static evaluateCondition(rule: ConditionType, formValues: Record<string, FormValueType>): boolean;
31
+ /**
32
+ * Evaluate simple field comparison rule
33
+ *
34
+ * Supports operators: equal, notEqual, greaterThan, lessThan, greaterThanOrEqual,
35
+ * lessThanOrEqual, in, notIn, contains, notContains.
36
+ *
37
+ * Handles both camelCase (greaterThan) and lowercase (greaterthan) operator formats
38
+ * for compatibility with QueryBuilder output.
39
+ *
40
+ * @param rule - Simple conditional rule with field, operator, value
41
+ * @param formValues - Current form field values
42
+ * @returns true if comparison is true, false otherwise
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const rule = { field: 'email', operator: 'contains', value: '@' };
47
+ * const hasAt = evaluateSimpleRule(rule, { email: 'test@example.com' });
48
+ * // hasAt = true
49
+ * ```
50
+ */
51
+ private static evaluateSimpleRule;
52
+ /**
53
+ * Evaluate composite rule with AND/OR logic
54
+ *
55
+ * Recursively evaluates nested rules with AND (all must be true) or OR
56
+ * (at least one must be true) logic.
57
+ *
58
+ * @param rule - Composite rule with condition ('and'|'or') and rules array
59
+ * @param formValues - Current form field values
60
+ * @returns true if composite condition met, false otherwise
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const rule = {
65
+ * condition: 'and',
66
+ * rules: [
67
+ * { field: 'age', operator: 'greaterThan', value: 18 },
68
+ * { field: 'country', operator: 'equal', value: 'US' }
69
+ * ]
70
+ * };
71
+ * const isEligible = evaluateCompositeRule(rule, { age: 25, country: 'US' });
72
+ * // isEligible = true
73
+ * ```
74
+ */
75
+ private static evaluateCompositeRule;
76
+ /**
77
+ * Check if field should be visible
78
+ *
79
+ * Evaluates visibleWhen condition. Defaults to true (visible) if no condition
80
+ * is defined or on error.
81
+ *
82
+ * @param conditions - FormComponentConditions containing visibleWhen rule
83
+ * @param formValues - Current form field values
84
+ * @returns true if field should be visible, false if hidden
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const conditions = {
89
+ * visibleWhen: { field: 'showEmail', operator: 'equal', value: true }
90
+ * };
91
+ * const visible = isFieldVisible(conditions, { showEmail: true });
92
+ * // visible = true
93
+ * ```
94
+ */
95
+ static isFieldVisible(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): boolean;
96
+ /**
97
+ * Check if field should be read-only
98
+ *
99
+ * Evaluates readOnlyWhen condition. Defaults to false (editable) if no
100
+ * condition is defined or on error.
101
+ *
102
+ * @param conditions - FormComponentConditions containing readOnlyWhen rule
103
+ * @param formValues - Current form field values
104
+ * @returns true if field should be read-only, false if editable
105
+ *
106
+ * @example
107
+ * ```typescript
108
+ * const conditions = {
109
+ * readOnlyWhen: { field: 'isVerified', operator: 'equal', value: true }
110
+ * };
111
+ * const readOnly = isFieldReadOnly(conditions, { isVerified: true });
112
+ * // readOnly = true
113
+ * ```
114
+ */
115
+ static isFieldReadOnly(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): boolean;
116
+ /**
117
+ * Check if field should be disabled
118
+ *
119
+ * Evaluates disabledWhen condition. Defaults to false (enabled) if no
120
+ * condition is defined or on error.
121
+ *
122
+ * @param conditions - FormComponentConditions containing disabledWhen rule
123
+ * @param formValues - Current form field values
124
+ * @returns true if field should be disabled, false if enabled
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const conditions = {
129
+ * disabledWhen: { field: 'orderStatus', operator: 'equal', value: 'completed' }
130
+ * };
131
+ * const disabled = isFieldDisabled(conditions, { orderStatus: 'completed' });
132
+ * // disabled = true
133
+ * ```
134
+ */
135
+ static isFieldDisabled(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): boolean;
136
+ /**
137
+ * Check if field should be hidden
138
+ *
139
+ * Evaluates hideWhen condition. Defaults to false (visible) if no condition
140
+ * is defined or on error.
141
+ *
142
+ * @param conditions - FormComponentConditions containing hideWhen rule
143
+ * @param formValues - Current form field values
144
+ * @returns true if field should be hidden, false if visible
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * const conditions = {
149
+ * hideWhen: { field: 'hideEmail', operator: 'equal', value: true }
150
+ * };
151
+ * const hidden = isFieldHidden(conditions, { hideEmail: true });
152
+ * // hidden = true
153
+ * ```
154
+ */
155
+ static isFieldHidden(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): boolean;
156
+ /**
157
+ * Check if field should be required
158
+ *
159
+ * Evaluates requiredWhen condition. Defaults to false (not required) if no condition
160
+ * is defined or on error.
161
+ *
162
+ * @param conditions - FormComponentConditions containing requiredWhen rule
163
+ * @param formValues - Current form field values
164
+ * @returns true if field should be required, false if optional
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const conditions = {
169
+ * requiredWhen: { field: 'requireDetails', operator: 'equal', value: true }
170
+ * };
171
+ * const required = isFieldRequired(conditions, { requireDetails: true });
172
+ * // required = true
173
+ * ```
174
+ */
175
+ static isFieldRequired(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): boolean;
176
+ /**
177
+ * Get value to set for field if condition is met
178
+ *
179
+ * Evaluates setValueWhen condition and returns the value to assign if true.
180
+ * Returns undefined if no condition is defined, condition not met, or on error.
181
+ *
182
+ * @param conditions - FormComponentConditions containing setValueWhen rule
183
+ * @param formValues - Current form field values
184
+ * @returns The value to set if condition met, undefined otherwise
185
+ *
186
+ * @example
187
+ * ```typescript
188
+ * const conditions = {
189
+ * setValueWhen: {
190
+ * condition: { field: 'country', operator: 'equal', value: 'US' },
191
+ * value: 'United States'
192
+ * }
193
+ * };
194
+ * const value = getConditionalValue(conditions, { country: 'US' });
195
+ * // value = 'United States'
196
+ * ```
197
+ */
198
+ static getConditionalValue(conditions: ConditionRule | undefined, formValues: Record<string, FormValueType>): any;
199
+ /**
200
+ * Evaluate conditional data availability
201
+ * Returns true if any conditional data rule's condition is met
202
+ *
203
+ * @param conditionalDataRules - Array of ConditionalDataRule objects
204
+ * @param formValues - Current form field values
205
+ * @returns Index of first matching rule, or -1 if none match
206
+ */
207
+ static evaluateConditionalDataRules(conditionalDataRules: ConditionalDataRule[] | undefined, formValues: Record<string, FormValueType>): number;
208
+ /**
209
+ * Get filtered options for a dependent dropdown based on choice-based field rule
210
+ *
211
+ * If choiceBasedField rule exists and primary field has a value,
212
+ * return only the mapped dependent options for that primary value.
213
+ * Otherwise return all options.
214
+ *
215
+ * @param rule - ChoiceBasedFieldRule configuration
216
+ * @param allDependentOptions - Complete list of dependent field options
217
+ * @param formValues - Current form values
218
+ * @param primaryFieldId - ID of primary field
219
+ * @returns Filtered options array
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * const rule = {
224
+ * primaryFieldId: 'dept-id',
225
+ * choiceMapping: {
226
+ * 'Marketing': ['Markers', 'Sticky Notes'],
227
+ * 'Finance': ['Calculator']
228
+ * }
229
+ * };
230
+ *
231
+ * const filtered = ConditionalRuleEngine.getChoiceBasedOptions(
232
+ * rule,
233
+ * ['Markers', 'Sticky Notes', 'Calculator'],
234
+ * { 'dept-id': 'Marketing' },
235
+ * 'dept-id'
236
+ * );
237
+ * // Returns: ['Markers', 'Sticky Notes']
238
+ * ```
239
+ */
240
+ static getChoiceBasedOptions(rule: ChoiceBasedFieldRule, allDependentOptions: string[], formValues: Record<string, FormValueType>, primaryFieldId: string): string[];
241
+ }