@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.
- package/README.md +60 -0
- package/common.d.ts +4 -0
- package/common.js +4 -0
- package/dist/ej2-form-renderer.umd.min.js +11 -0
- package/dist/ej2-form-renderer.umd.min.js.map +1 -0
- package/dist/es6/ej2-form-renderer.es2015.js +6787 -0
- package/dist/es6/ej2-form-renderer.es2015.js.map +1 -0
- package/dist/es6/ej2-form-renderer.es5.js +7055 -0
- package/dist/es6/ej2-form-renderer.es5.js.map +1 -0
- package/dist/global/ej2-form-renderer.min.js +11 -0
- package/dist/global/ej2-form-renderer.min.js.map +1 -0
- package/dist/global/index.d.ts +14 -0
- package/form-renderer.d.ts +4 -0
- package/form-renderer.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/package.json +41 -0
- package/src/common/checkbox-group.d.ts +55 -0
- package/src/common/checkbox-group.js +241 -0
- package/src/common/conditional-rule-engine.d.ts +241 -0
- package/src/common/conditional-rule-engine.js +505 -0
- package/src/common/custom-validation-engine.d.ts +57 -0
- package/src/common/custom-validation-engine.js +152 -0
- package/src/common/datagrid-component.d.ts +156 -0
- package/src/common/datagrid-component.js +410 -0
- package/src/common/expressions/dependency-tracker.d.ts +29 -0
- package/src/common/expressions/dependency-tracker.js +137 -0
- package/src/common/expressions/expression-engine.d.ts +94 -0
- package/src/common/expressions/expression-engine.js +514 -0
- package/src/common/expressions/expression-parser.d.ts +40 -0
- package/src/common/expressions/expression-parser.js +270 -0
- package/src/common/expressions/grid-expressions.d.ts +24 -0
- package/src/common/expressions/grid-expressions.js +92 -0
- package/src/common/expressions/index.d.ts +4 -0
- package/src/common/expressions/index.js +4 -0
- package/src/common/index.d.ts +10 -0
- package/src/common/index.js +10 -0
- package/src/common/json-converter.d.ts +945 -0
- package/src/common/json-converter.js +1110 -0
- package/src/common/minmax-rule-engine.d.ts +105 -0
- package/src/common/minmax-rule-engine.js +380 -0
- package/src/common/option-fetcher.d.ts +30 -0
- package/src/common/option-fetcher.js +139 -0
- package/src/common/parser.d.ts +98 -0
- package/src/common/parser.js +788 -0
- package/src/common/static-html-renderer.d.ts +45 -0
- package/src/common/static-html-renderer.js +77 -0
- package/src/common/utils.d.ts +116 -0
- package/src/common/utils.js +484 -0
- package/src/form-renderer/form-renderer-model.d.ts +65 -0
- package/src/form-renderer/form-renderer.d.ts +425 -0
- package/src/form-renderer/form-renderer.js +2277 -0
- package/src/form-renderer/index.d.ts +6 -0
- package/src/form-renderer/index.js +5 -0
- package/src/form-renderer/render-form-field.d.ts +31 -0
- package/src/form-renderer/render-form-field.js +816 -0
- package/src/form-renderer/types/form-schema.d.ts +452 -0
- package/src/form-renderer/types/form-schema.js +32 -0
- package/src/global.js +1 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/styles/bds-lite.css +599 -0
- package/styles/bds-lite.scss +2 -0
- package/styles/bds.css +599 -0
- package/styles/bds.scss +2 -0
- package/styles/bootstrap-dark-lite.css +608 -0
- package/styles/bootstrap-dark-lite.scss +2 -0
- package/styles/bootstrap-dark.css +608 -0
- package/styles/bootstrap-dark.scss +2 -0
- package/styles/bootstrap-lite.css +595 -0
- package/styles/bootstrap-lite.scss +2 -0
- package/styles/bootstrap.css +595 -0
- package/styles/bootstrap.scss +2 -0
- package/styles/bootstrap4-lite.css +595 -0
- package/styles/bootstrap4-lite.scss +2 -0
- package/styles/bootstrap4.css +595 -0
- package/styles/bootstrap4.scss +2 -0
- package/styles/bootstrap5-dark-lite.css +595 -0
- package/styles/bootstrap5-dark-lite.scss +2 -0
- package/styles/bootstrap5-dark.css +595 -0
- package/styles/bootstrap5-dark.scss +2 -0
- package/styles/bootstrap5-lite.css +595 -0
- package/styles/bootstrap5-lite.scss +2 -0
- package/styles/bootstrap5.3-lite.css +679 -0
- package/styles/bootstrap5.3-lite.scss +2 -0
- package/styles/bootstrap5.3.css +679 -0
- package/styles/bootstrap5.3.scss +2 -0
- package/styles/bootstrap5.css +595 -0
- package/styles/bootstrap5.scss +2 -0
- package/styles/fabric-dark-lite.css +608 -0
- package/styles/fabric-dark-lite.scss +2 -0
- package/styles/fabric-dark.css +608 -0
- package/styles/fabric-dark.scss +2 -0
- package/styles/fabric-lite.css +595 -0
- package/styles/fabric-lite.scss +2 -0
- package/styles/fabric.css +595 -0
- package/styles/fabric.scss +2 -0
- package/styles/fluent-dark-lite.css +595 -0
- package/styles/fluent-dark-lite.scss +2 -0
- package/styles/fluent-dark.css +595 -0
- package/styles/fluent-dark.scss +2 -0
- package/styles/fluent-lite.css +595 -0
- package/styles/fluent-lite.scss +2 -0
- package/styles/fluent.css +595 -0
- package/styles/fluent.scss +2 -0
- package/styles/fluent2-lite.css +681 -0
- package/styles/fluent2-lite.scss +2 -0
- package/styles/fluent2.css +681 -0
- package/styles/fluent2.scss +2 -0
- package/styles/form-renderer/_all.scss +2 -0
- package/styles/form-renderer/_bds-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap-dark-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap4-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap5-dark-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap5-definition.scss +8 -0
- package/styles/form-renderer/_bootstrap5.3-definition.scss +8 -0
- package/styles/form-renderer/_fabric-dark-definition.scss +8 -0
- package/styles/form-renderer/_fabric-definition.scss +8 -0
- package/styles/form-renderer/_fluent-dark-definition.scss +8 -0
- package/styles/form-renderer/_fluent-definition.scss +8 -0
- package/styles/form-renderer/_fluent2-definition.scss +8 -0
- package/styles/form-renderer/_highcontrast-definition.scss +8 -0
- package/styles/form-renderer/_highcontrast-light-definition.scss +8 -0
- package/styles/form-renderer/_layout.scss +480 -0
- package/styles/form-renderer/_material-dark-definition.scss +8 -0
- package/styles/form-renderer/_material-definition.scss +8 -0
- package/styles/form-renderer/_material3-dark-definition.scss +8 -0
- package/styles/form-renderer/_material3-definition.scss +8 -0
- package/styles/form-renderer/_mixin.scss +26 -0
- package/styles/form-renderer/_tailwind-dark-definition.scss +8 -0
- package/styles/form-renderer/_tailwind-definition.scss +8 -0
- package/styles/form-renderer/_tailwind3-definition.scss +8 -0
- package/styles/form-renderer/_theme.scss +69 -0
- package/styles/form-renderer/_variables.scss +2 -0
- package/styles/form-renderer/bds.css +599 -0
- package/styles/form-renderer/bds.scss +2 -0
- package/styles/form-renderer/bootstrap-dark.css +608 -0
- package/styles/form-renderer/bootstrap-dark.scss +2 -0
- package/styles/form-renderer/bootstrap.css +595 -0
- package/styles/form-renderer/bootstrap.scss +2 -0
- package/styles/form-renderer/bootstrap4.css +595 -0
- package/styles/form-renderer/bootstrap4.scss +2 -0
- package/styles/form-renderer/bootstrap5-dark.css +595 -0
- package/styles/form-renderer/bootstrap5-dark.scss +2 -0
- package/styles/form-renderer/bootstrap5.3.css +679 -0
- package/styles/form-renderer/bootstrap5.3.scss +2 -0
- package/styles/form-renderer/bootstrap5.css +595 -0
- package/styles/form-renderer/bootstrap5.scss +2 -0
- package/styles/form-renderer/fabric-dark.css +608 -0
- package/styles/form-renderer/fabric-dark.scss +2 -0
- package/styles/form-renderer/fabric.css +595 -0
- package/styles/form-renderer/fabric.scss +2 -0
- package/styles/form-renderer/fluent-dark.css +595 -0
- package/styles/form-renderer/fluent-dark.scss +2 -0
- package/styles/form-renderer/fluent.css +595 -0
- package/styles/form-renderer/fluent.scss +2 -0
- package/styles/form-renderer/fluent2.css +681 -0
- package/styles/form-renderer/fluent2.scss +2 -0
- package/styles/form-renderer/highcontrast-light.css +595 -0
- package/styles/form-renderer/highcontrast-light.scss +2 -0
- package/styles/form-renderer/highcontrast.css +608 -0
- package/styles/form-renderer/highcontrast.scss +2 -0
- package/styles/form-renderer/material-dark.css +608 -0
- package/styles/form-renderer/material-dark.scss +2 -0
- package/styles/form-renderer/material.css +595 -0
- package/styles/form-renderer/material.scss +2 -0
- package/styles/form-renderer/material3-dark.css +677 -0
- package/styles/form-renderer/material3-dark.scss +2 -0
- package/styles/form-renderer/material3.css +679 -0
- package/styles/form-renderer/material3.scss +2 -0
- package/styles/form-renderer/tailwind-dark.css +595 -0
- package/styles/form-renderer/tailwind-dark.scss +2 -0
- package/styles/form-renderer/tailwind.css +595 -0
- package/styles/form-renderer/tailwind.scss +2 -0
- package/styles/form-renderer/tailwind3.css +669 -0
- package/styles/form-renderer/tailwind3.scss +2 -0
- package/styles/highcontrast-light-lite.css +595 -0
- package/styles/highcontrast-light-lite.scss +2 -0
- package/styles/highcontrast-light.css +595 -0
- package/styles/highcontrast-light.scss +2 -0
- package/styles/highcontrast-lite.css +608 -0
- package/styles/highcontrast-lite.scss +2 -0
- package/styles/highcontrast.css +608 -0
- package/styles/highcontrast.scss +2 -0
- package/styles/material-dark-lite.css +608 -0
- package/styles/material-dark-lite.scss +2 -0
- package/styles/material-dark.css +608 -0
- package/styles/material-dark.scss +2 -0
- package/styles/material-lite.css +595 -0
- package/styles/material-lite.scss +2 -0
- package/styles/material.css +595 -0
- package/styles/material.scss +2 -0
- package/styles/material3-dark-lite.css +677 -0
- package/styles/material3-dark-lite.scss +2 -0
- package/styles/material3-dark.css +677 -0
- package/styles/material3-dark.scss +2 -0
- package/styles/material3-lite.css +679 -0
- package/styles/material3-lite.scss +2 -0
- package/styles/material3.css +679 -0
- package/styles/material3.scss +2 -0
- package/styles/tailwind-dark-lite.css +595 -0
- package/styles/tailwind-dark-lite.scss +2 -0
- package/styles/tailwind-dark.css +595 -0
- package/styles/tailwind-dark.scss +2 -0
- package/styles/tailwind-lite.css +595 -0
- package/styles/tailwind-lite.scss +2 -0
- package/styles/tailwind.css +595 -0
- package/styles/tailwind.scss +2 -0
- package/styles/tailwind3-lite.css +669 -0
- package/styles/tailwind3-lite.scss +2 -0
- package/styles/tailwind3.css +669 -0
- package/styles/tailwind3.scss +2 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { TextBox, NumericTextBox, MaskedTextBox, Uploader, TextArea, Slider, ColorPicker, Rating, Signature } from '@syncfusion/ej2-inputs';
|
|
13
|
+
import { CheckBox, RadioButton, Switch, Button } from '@syncfusion/ej2-buttons';
|
|
14
|
+
import { SplitButton } from '@syncfusion/ej2-splitbuttons';
|
|
15
|
+
import { DropDownList, MultiSelect, CheckBoxSelection, VirtualScroll } from '@syncfusion/ej2-dropdowns';
|
|
16
|
+
import { DatePicker, DateTimePicker, TimePicker, DateRangePicker, Islamic } from '@syncfusion/ej2-calendars';
|
|
17
|
+
import { Message } from '@syncfusion/ej2-notifications';
|
|
18
|
+
import { ImageEditor } from '@syncfusion/ej2-image-editor';
|
|
19
|
+
import { RichTextEditor, Toolbar, HtmlEditor, Link, QuickToolbar, Image as RTEImage, Count, Table, EmojiPicker, SlashMenu, CodeBlock, ClipBoardCleanup, AutoFormat, ImportExport, PasteCleanup } from '@syncfusion/ej2-richtexteditor';
|
|
20
|
+
import { createElement } from '@syncfusion/ej2-base';
|
|
21
|
+
import { mapButtonStyleToClass, mapPositionToJustifyContent, resolveButtonType, resolveConditionalData, resolveOptions } from '../common/utils';
|
|
22
|
+
import { OptionFetcher } from '../common/option-fetcher';
|
|
23
|
+
import { CheckboxGroup } from '../common/checkbox-group';
|
|
24
|
+
import { DataGridComponent } from '../common/datagrid-component';
|
|
25
|
+
import { ConditionalRuleEngine } from '../common/conditional-rule-engine';
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
var normalizeAttributes = function (attributes) {
|
|
30
|
+
if (!attributes) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
if (Array.isArray(attributes)) {
|
|
34
|
+
return attributes.reduce(function (acc, item) {
|
|
35
|
+
if (item && item.key && item.value !== undefined) {
|
|
36
|
+
acc[item.key] = item.value;
|
|
37
|
+
}
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
}
|
|
41
|
+
return attributes;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
var applyHostId = function (el, id) {
|
|
47
|
+
if (el && id) {
|
|
48
|
+
el.setAttribute('id', id);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Renders a single form field component (vanilla EJ2 TS) and returns the
|
|
53
|
+
* instantiated EJ2 component instance (or host element). The host owns DOM
|
|
54
|
+
* attachment and ref tracking.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
export var renderFormField = function (options) {
|
|
59
|
+
var component = options.component, value = options.value, onChange = options.onChange, onBlur = options.onBlur, onClick = options.onClick, _a = options.hasError, hasError = _a === void 0 ? false : _a, locale = options.locale, formState = options.formState, settings = options.settings, components = options.components, enableRtl = options.enableRtl, ref = options.ref, l10n = options.l10n;
|
|
60
|
+
var initializedGrids = options.initializedGrids || new Set();
|
|
61
|
+
var target = options.target;
|
|
62
|
+
var commonProps = {
|
|
63
|
+
floatLabelType: (component.floatLabelType || 'Never'),
|
|
64
|
+
placeholder: component.placeholder || '',
|
|
65
|
+
enabled: !component.disabled
|
|
66
|
+
};
|
|
67
|
+
var createValidationHandlers = function (getValue) {
|
|
68
|
+
var validateOn = component.validateOn || 'Change';
|
|
69
|
+
var handlers = {};
|
|
70
|
+
if (!validateOn || validateOn === 'Change') {
|
|
71
|
+
handlers.change = function (args) { return onChange(getValue(args)); };
|
|
72
|
+
handlers.blur = function () { if (onBlur) {
|
|
73
|
+
onBlur();
|
|
74
|
+
} };
|
|
75
|
+
}
|
|
76
|
+
if (validateOn === 'Blur') {
|
|
77
|
+
handlers.change = function (args) { return onChange(getValue(args)); };
|
|
78
|
+
handlers.blur = function () { if (onBlur) {
|
|
79
|
+
onBlur();
|
|
80
|
+
} };
|
|
81
|
+
}
|
|
82
|
+
return handlers;
|
|
83
|
+
};
|
|
84
|
+
var htmlAttrs = normalizeAttributes(component.htmlAttributes);
|
|
85
|
+
if (component.required) {
|
|
86
|
+
htmlAttrs['aria-required'] = 'true';
|
|
87
|
+
}
|
|
88
|
+
var errorClass = hasError ? 'e-error' : '';
|
|
89
|
+
var cssClass = ((component.cssClass || '') + " " + errorClass + " " + (component.size === 'Small' ? ' e-small' : component.size === 'Bigger' ? ' e-bigger' : '')).trim();
|
|
90
|
+
switch (component.type) {
|
|
91
|
+
case 'textbox': {
|
|
92
|
+
var tb = new TextBox(__assign({ id: component.name, type: component.multiline ? 'hidden' : (component.textboxType ? component.textboxType : 'text'), name: component.id, enableRtl: enableRtl, locale: locale, floatLabelType: commonProps.floatLabelType, placeholder: commonProps.placeholder, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue || ''), multiline: component.multiline, showClearButton: component.showClearButton, autocomplete: component.autocomplete === false || component.autocomplete === undefined ? 'off' : 'on', readonly: component.readOnly || false, cssClass: cssClass, htmlAttributes: htmlAttrs, appendTemplate: component.suffix, prependTemplate: component.prefix }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
93
|
+
if (target) {
|
|
94
|
+
tb.appendTo(target);
|
|
95
|
+
}
|
|
96
|
+
ref(tb);
|
|
97
|
+
return tb;
|
|
98
|
+
}
|
|
99
|
+
case 'textarea': {
|
|
100
|
+
var ta = new TextArea(__assign({ id: component.name, name: component.id, enableRtl: enableRtl, locale: locale, floatLabelType: commonProps.floatLabelType, placeholder: commonProps.placeholder, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue || ''), cols: component.cols || 200, rows: component.textareaRows || 4, showClearButton: component.showClearButton || false, readonly: component.readOnly || false, maxLength: component.maxLength || 255, cssClass: cssClass, htmlAttributes: htmlAttrs, appendTemplate: component.suffix, prependTemplate: component.prefix, resizeMode: 'Vertical' }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
101
|
+
if (target) {
|
|
102
|
+
ta.appendTo(target);
|
|
103
|
+
}
|
|
104
|
+
ref(ta);
|
|
105
|
+
return ta;
|
|
106
|
+
}
|
|
107
|
+
case 'number': {
|
|
108
|
+
var numValue = value === '' ? undefined : value;
|
|
109
|
+
var ntb = new NumericTextBox({
|
|
110
|
+
locale: locale,
|
|
111
|
+
enableRtl: enableRtl,
|
|
112
|
+
floatLabelType: commonProps.floatLabelType,
|
|
113
|
+
placeholder: commonProps.placeholder,
|
|
114
|
+
enabled: commonProps.enabled,
|
|
115
|
+
value: numValue !== undefined ? numValue : (component.defaultValue || undefined),
|
|
116
|
+
decimals: component.decimals || 2,
|
|
117
|
+
currency: component.currency,
|
|
118
|
+
format: component.numberFormat || 'n2',
|
|
119
|
+
step: component.step || 1,
|
|
120
|
+
min: component.minValue || undefined,
|
|
121
|
+
max: component.maxValue || undefined,
|
|
122
|
+
readonly: component.readOnly || false,
|
|
123
|
+
showClearButton: component.showClearButton || false,
|
|
124
|
+
cssClass: cssClass,
|
|
125
|
+
htmlAttributes: htmlAttrs,
|
|
126
|
+
appendTemplate: component.suffix,
|
|
127
|
+
prependTemplate: component.prefix,
|
|
128
|
+
change: function (args) { return onChange(args.value); }
|
|
129
|
+
});
|
|
130
|
+
if (target) {
|
|
131
|
+
applyHostId(target, component.name);
|
|
132
|
+
target.setAttribute('name', component.id);
|
|
133
|
+
ntb.appendTo(target);
|
|
134
|
+
}
|
|
135
|
+
ref(ntb);
|
|
136
|
+
return ntb;
|
|
137
|
+
}
|
|
138
|
+
case 'checkbox': {
|
|
139
|
+
var checkboxLabel = component.label && component.required
|
|
140
|
+
? component.label + " *"
|
|
141
|
+
: component.label;
|
|
142
|
+
var cb = new CheckBox({
|
|
143
|
+
locale: locale,
|
|
144
|
+
name: component.id,
|
|
145
|
+
enableRtl: enableRtl,
|
|
146
|
+
label: checkboxLabel,
|
|
147
|
+
labelPosition: component.checkboxLabelPosition,
|
|
148
|
+
checked: ((component.checked !== undefined && component.checked !== null ? component.checked : false) || (value !== undefined && value !== null ? value : false)),
|
|
149
|
+
indeterminate: component.indeterminate || false,
|
|
150
|
+
disabled: component.disabled,
|
|
151
|
+
cssClass: cssClass,
|
|
152
|
+
htmlAttributes: htmlAttrs,
|
|
153
|
+
change: function (args) { return onChange(args.checked); }
|
|
154
|
+
});
|
|
155
|
+
if (target) {
|
|
156
|
+
applyHostId(target, component.name);
|
|
157
|
+
cb.appendTo(target);
|
|
158
|
+
}
|
|
159
|
+
ref(cb);
|
|
160
|
+
return cb;
|
|
161
|
+
}
|
|
162
|
+
case 'checkboxGroup': {
|
|
163
|
+
var fetchedCheckboxOptions_1 = [];
|
|
164
|
+
OptionFetcher.fetch(component.options, component.id, formState ? formState.values : undefined, components)
|
|
165
|
+
.then(function (res) {
|
|
166
|
+
if (res.id === component.id && res.options.length > 0) {
|
|
167
|
+
fetchedCheckboxOptions_1.push.apply(fetchedCheckboxOptions_1, res.options);
|
|
168
|
+
group_1.setOptions(fetchedCheckboxOptions_1);
|
|
169
|
+
}
|
|
170
|
+
}).catch(function () { });
|
|
171
|
+
var resolvedCheckboxOptions = resolveOptions(component.options, fetchedCheckboxOptions_1);
|
|
172
|
+
var finalCheckboxOptions = resolvedCheckboxOptions.length > 0
|
|
173
|
+
? resolvedCheckboxOptions
|
|
174
|
+
: (component.options || ['Option 1']);
|
|
175
|
+
var group_1 = new CheckboxGroup({
|
|
176
|
+
component: __assign({}, component, { options: finalCheckboxOptions }),
|
|
177
|
+
formState: formState,
|
|
178
|
+
value: value,
|
|
179
|
+
enableRtl: enableRtl,
|
|
180
|
+
onChange: function (v) { return onChange(v); },
|
|
181
|
+
optionRef: options.ref,
|
|
182
|
+
target: target,
|
|
183
|
+
ref: ref
|
|
184
|
+
});
|
|
185
|
+
if (target) {
|
|
186
|
+
applyHostId(target, component.name);
|
|
187
|
+
}
|
|
188
|
+
group_1.render(target);
|
|
189
|
+
return group_1;
|
|
190
|
+
}
|
|
191
|
+
case 'radio': {
|
|
192
|
+
var radioOptions = Array.isArray(component.options) ? component.options : ['Option 1'];
|
|
193
|
+
var wrapper_1 = createElement('div', {
|
|
194
|
+
id: component.name + "-group",
|
|
195
|
+
className: "e-radio-group " + errorClass
|
|
196
|
+
});
|
|
197
|
+
var rbInstances = [];
|
|
198
|
+
radioOptions.forEach(function (option, idx) {
|
|
199
|
+
var optionValue = option;
|
|
200
|
+
var optionText = option;
|
|
201
|
+
var row = createElement('div');
|
|
202
|
+
row.style.marginBottom = '8px';
|
|
203
|
+
wrapper_1.appendChild(row);
|
|
204
|
+
var rbHost = createElement('input', {
|
|
205
|
+
id: component.name + "_" + idx + "_" + optionValue,
|
|
206
|
+
attrs: { type: 'radio' }
|
|
207
|
+
});
|
|
208
|
+
row.appendChild(rbHost);
|
|
209
|
+
var rb = new RadioButton({
|
|
210
|
+
name: component.id,
|
|
211
|
+
label: optionText,
|
|
212
|
+
enableRtl: enableRtl,
|
|
213
|
+
locale: locale,
|
|
214
|
+
disabled: component.disabled,
|
|
215
|
+
value: optionValue,
|
|
216
|
+
htmlAttributes: htmlAttrs,
|
|
217
|
+
labelPosition: component.fieldLabelPosition,
|
|
218
|
+
checked: component.defaultValue === optionValue || value === optionValue,
|
|
219
|
+
cssClass: cssClass,
|
|
220
|
+
change: function (args) {
|
|
221
|
+
if (args.value === optionValue) {
|
|
222
|
+
onChange(optionValue);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
rb.appendTo(rbHost);
|
|
227
|
+
ref(rb, idx);
|
|
228
|
+
if (options.ref && typeof options.ref === 'function') {
|
|
229
|
+
options.ref(rb, idx);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
if (target) {
|
|
233
|
+
target.appendChild(wrapper_1);
|
|
234
|
+
}
|
|
235
|
+
return rbInstances;
|
|
236
|
+
}
|
|
237
|
+
case 'dropdown': {
|
|
238
|
+
// Same Vanilla TS fetch adaptation as checkboxGroup (see above).
|
|
239
|
+
var fetchedDropdownOptions_1 = [];
|
|
240
|
+
OptionFetcher.fetch(component.options, component.id, formState ? formState.values : undefined, components)
|
|
241
|
+
.then(function (res) {
|
|
242
|
+
if (res.id === component.id && res.options.length > 0) {
|
|
243
|
+
fetchedDropdownOptions_1.push.apply(fetchedDropdownOptions_1, res.options);
|
|
244
|
+
ddl_1.dataSource = fetchedDropdownOptions_1;
|
|
245
|
+
}
|
|
246
|
+
}).catch(function () { });
|
|
247
|
+
var resolvedDropdownOptions = resolveOptions(component.options, fetchedDropdownOptions_1);
|
|
248
|
+
var finalDropdownOptions = resolvedDropdownOptions.length > 0
|
|
249
|
+
? resolvedDropdownOptions
|
|
250
|
+
: (component.options || ['Option 1']);
|
|
251
|
+
if (component.conditions && component.conditions.choiceBasedField) {
|
|
252
|
+
finalDropdownOptions = ConditionalRuleEngine.getChoiceBasedOptions(component.conditions.choiceBasedField, finalDropdownOptions, formState ? formState.values : undefined, component.conditions.choiceBasedField.primaryFieldId);
|
|
253
|
+
if (finalDropdownOptions.length > 0 && value != null && finalDropdownOptions.indexOf(value) === -1) {
|
|
254
|
+
if (formState) {
|
|
255
|
+
formState.values[component.id] = null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
var ddl_1 = new DropDownList(__assign({ id: component.name, name: component.id, floatLabelType: commonProps.floatLabelType, placeholder: commonProps.placeholder, enabled: commonProps.enabled, locale: locale, enableRtl: enableRtl, cssClass: cssClass, dataSource: finalDropdownOptions, value: formState.values[component.id] !== undefined ? formState.values[component.id] : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), showClearButton: component.showClearButton || false, readonly: component.readOnly || false, enableVirtualization: component.enableVirtualization || false, popupHeight: component.popupHeight || '300px', popupWidth: component.popupWidth || '100%', htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
260
|
+
// Inject services (VirtualScroll) for the virtualization path.
|
|
261
|
+
DropDownList.Inject(VirtualScroll);
|
|
262
|
+
if (target) {
|
|
263
|
+
ddl_1.appendTo(target);
|
|
264
|
+
}
|
|
265
|
+
ref(ddl_1);
|
|
266
|
+
return ddl_1;
|
|
267
|
+
}
|
|
268
|
+
case 'multiselect': {
|
|
269
|
+
var fetchedMultiSelectOptions_1 = [];
|
|
270
|
+
OptionFetcher.fetch(component.options, component.id, formState ? formState.values : undefined, components)
|
|
271
|
+
.then(function (res) {
|
|
272
|
+
if (res.id === component.id && res.options.length > 0) {
|
|
273
|
+
fetchedMultiSelectOptions_1.push.apply(fetchedMultiSelectOptions_1, res.options);
|
|
274
|
+
ms_1.dataSource = fetchedMultiSelectOptions_1;
|
|
275
|
+
}
|
|
276
|
+
}).catch(function () { });
|
|
277
|
+
var resolvedMultiSelectOptions = resolveOptions(component.options, fetchedMultiSelectOptions_1);
|
|
278
|
+
var finalMultiSelectOptions = resolvedMultiSelectOptions.length > 0
|
|
279
|
+
? resolvedMultiSelectOptions
|
|
280
|
+
: (component.options || ['Option 1']);
|
|
281
|
+
var ms_1 = new MultiSelect(__assign({ name: component.id, enableRtl: enableRtl, locale: locale, floatLabelType: commonProps.floatLabelType, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), placeholder: component.placeholder, dataSource: finalMultiSelectOptions, fields: { text: 'text', value: 'value' }, showClearButton: component.showClearButton || false, readonly: component.readOnly || false, allowCustomValue: component.allowCustomValue || false, addTagOnBlur: component.addTagOnBlur || false, delimiterChar: component.delimiterChar || ',', showSelectAll: component.showSelectAll || false, mode: component.showSelectAll ? 'CheckBox' : (component.visualMode ? component.visualMode : undefined), selectAllText: component.selectAllText, unSelectAllText: component.unSelectAllText, showDropDownIcon: component.showDropDownIcon !== false, enableVirtualization: component.enableVirtualization || false, popupHeight: component.popupHeight || '300px', popupWidth: component.popupWidth || '100%', cssClass: cssClass, htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
282
|
+
MultiSelect.Inject(CheckBoxSelection, VirtualScroll);
|
|
283
|
+
if (target) {
|
|
284
|
+
ms_1.appendTo(target);
|
|
285
|
+
}
|
|
286
|
+
ref(ms_1);
|
|
287
|
+
return ms_1;
|
|
288
|
+
}
|
|
289
|
+
case 'date': {
|
|
290
|
+
var dp = new DatePicker(__assign({ floatLabelType: commonProps.floatLabelType, id: component.name, name: component.id, enableRtl: enableRtl, locale: locale, placeholder: commonProps.placeholder, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), format: component.format || 'MM/dd/yyyy', readOnly: component.readOnly || false, showClearButton: component.showClearButton === undefined ? false : component.showClearButton, showTodayButton: component.showTodayButton !== false ? true : false, calendarMode: component.calendarMode || 'Gregorian', dayHeaderFormat: component.dayHeaderFormat || 'Short', depth: component.depth || 'Month', start: component.start || 'Month', firstDayOfWeek: component.firstDayOfWeek || 0, min: component.minDate ? new Date(component.minDate) : undefined, max: component.maxDate ? new Date(component.maxDate) : undefined, cssClass: cssClass, htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
291
|
+
DatePicker.Inject(Islamic);
|
|
292
|
+
if (target) {
|
|
293
|
+
dp.appendTo(target);
|
|
294
|
+
}
|
|
295
|
+
ref(dp);
|
|
296
|
+
return dp;
|
|
297
|
+
}
|
|
298
|
+
case 'dateTime': {
|
|
299
|
+
var dtp = new DateTimePicker(__assign({ id: component.name, floatLabelType: commonProps.floatLabelType, placeholder: commonProps.placeholder, enabled: commonProps.enabled, locale: locale, enableRtl: enableRtl, name: component.id, dayHeaderFormat: component.dayHeaderFormat || 'Short', value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), format: component.format || 'MM/dd/yyyy hh:mm a', showClearButton: component.showClearButton === undefined ? false : component.showClearButton, showTodayButton: component.showTodayButton !== false ? true : false, depth: component.depth || 'Month', start: component.start || 'Month', step: component.step || 1, readonly: component.readOnly || false, min: component.minDate ? new Date(component.minDate) : undefined, max: component.maxDate ? new Date(component.maxDate) : undefined, minTime: component.minTime ? new Date("2000-01-01 " + component.minTime) : undefined, maxTime: component.maxTime ? new Date("2000-01-01 " + component.maxTime) : undefined, enableMask: false, cssClass: cssClass, htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
300
|
+
DateTimePicker.Inject(Islamic);
|
|
301
|
+
if (target) {
|
|
302
|
+
dtp.appendTo(target);
|
|
303
|
+
}
|
|
304
|
+
ref(dtp);
|
|
305
|
+
return dtp;
|
|
306
|
+
}
|
|
307
|
+
case 'time': {
|
|
308
|
+
var tp = new TimePicker(__assign({ id: component.name, locale: locale, name: component.id, enableRtl: enableRtl, floatLabelType: commonProps.floatLabelType, placeholder: commonProps.placeholder, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), format: component.format || 'hh:mm a', showClearButton: component.showClearButton === undefined ? false : component.showClearButton, step: component.step || 30, readonly: component.readOnly || false, min: component.minTime ? new Date("2000-01-01 " + component.minTime) : undefined, max: component.maxTime ? new Date("2000-01-01 " + component.maxTime) : undefined, enableMask: false, cssClass: cssClass, htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
309
|
+
if (target) {
|
|
310
|
+
tp.appendTo(target);
|
|
311
|
+
}
|
|
312
|
+
ref(tp);
|
|
313
|
+
return tp;
|
|
314
|
+
}
|
|
315
|
+
case 'dateRange': {
|
|
316
|
+
var drp = new DateRangePicker(__assign({ id: component.name, locale: locale, enableRtl: enableRtl, name: component.id, floatLabelType: commonProps.floatLabelType, dayHeaderFormat: component.dayHeaderFormat || 'Short', placeholder: commonProps.placeholder, enabled: commonProps.enabled, value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : null), depth: component.depth || 'Month', start: component.start || 'Month', min: component.minDate ? new Date(component.minDate) : undefined, max: component.maxDate ? new Date(component.maxDate) : undefined, format: component.format || 'MM/dd/yyyy', separator: component.separator || ' - ', showClearButton: component.showClearButton === undefined ? false : component.showClearButton, readonly: component.readOnly || false, cssClass: cssClass, htmlAttributes: htmlAttrs }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
317
|
+
if (target) {
|
|
318
|
+
drp.appendTo(target);
|
|
319
|
+
}
|
|
320
|
+
ref(drp);
|
|
321
|
+
return drp;
|
|
322
|
+
}
|
|
323
|
+
case 'switch': {
|
|
324
|
+
var sw = new Switch({
|
|
325
|
+
locale: locale,
|
|
326
|
+
enableRtl: enableRtl,
|
|
327
|
+
value: component.defaultValue,
|
|
328
|
+
name: component.id,
|
|
329
|
+
checked: ((component.checked !== undefined && component.checked !== null ? component.checked : false) || (value !== undefined && value !== null ? value : false)),
|
|
330
|
+
disabled: component.disabled,
|
|
331
|
+
onLabel: component.onLabel || '',
|
|
332
|
+
offLabel: component.offLabel || '',
|
|
333
|
+
cssClass: cssClass,
|
|
334
|
+
htmlAttributes: htmlAttrs,
|
|
335
|
+
change: function (args) { return onChange(args.checked); }
|
|
336
|
+
});
|
|
337
|
+
if (target) {
|
|
338
|
+
applyHostId(target, component.name);
|
|
339
|
+
sw.appendTo(target);
|
|
340
|
+
}
|
|
341
|
+
ref(sw);
|
|
342
|
+
return sw;
|
|
343
|
+
}
|
|
344
|
+
case 'button': {
|
|
345
|
+
var groupButtons = (component.buttonsGroups || component.buttons || []);
|
|
346
|
+
if (groupButtons && groupButtons.length > 0) {
|
|
347
|
+
var groupStyleObj = {
|
|
348
|
+
display: 'flex',
|
|
349
|
+
flexWrap: 'wrap',
|
|
350
|
+
alignItems: 'center',
|
|
351
|
+
gap: component.gap || '8px',
|
|
352
|
+
justifyContent: mapPositionToJustifyContent(component.position),
|
|
353
|
+
width: component.width || undefined
|
|
354
|
+
};
|
|
355
|
+
var groupContainer_1 = createElement('div', {
|
|
356
|
+
id: component.name,
|
|
357
|
+
attrs: {
|
|
358
|
+
role: 'group',
|
|
359
|
+
'aria-label': component.label || 'Button Group',
|
|
360
|
+
className: cssClass + " " + (enableRtl ? 'e-rtl' : '')
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
Object.assign(groupContainer_1.style, groupStyleObj);
|
|
364
|
+
var btnInstances_1 = [];
|
|
365
|
+
groupButtons.forEach(function (btnDef, idx) {
|
|
366
|
+
var btnId = component.name + "_" + idx;
|
|
367
|
+
var btnCssClass = [mapButtonStyleToClass(btnDef.style)].filter(Boolean).join(' ');
|
|
368
|
+
btnCssClass += component.size === 'Small' ? ' e-small' : component.size === 'Bigger' ? ' e-bigger' : '';
|
|
369
|
+
var resolvedGroupType = resolveButtonType(btnDef.type);
|
|
370
|
+
var btnHost = createElement('button', {
|
|
371
|
+
id: String(btnId),
|
|
372
|
+
attrs: { name: String(btnId), type: resolvedGroupType }
|
|
373
|
+
});
|
|
374
|
+
groupContainer_1.appendChild(btnHost);
|
|
375
|
+
var btnInst = new Button({
|
|
376
|
+
locale: locale,
|
|
377
|
+
enableRtl: enableRtl,
|
|
378
|
+
cssClass: btnCssClass,
|
|
379
|
+
disabled: btnDef.disabled || false,
|
|
380
|
+
content: btnDef.label || "Button " + (idx + 1),
|
|
381
|
+
iconCss: btnDef.iconCss,
|
|
382
|
+
iconPosition: btnDef.iconPosition
|
|
383
|
+
});
|
|
384
|
+
btnInst.appendTo(btnHost);
|
|
385
|
+
btnInst.element.onclick = function (event) {
|
|
386
|
+
if (onClick) {
|
|
387
|
+
onClick(event);
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
ref(btnInst, idx);
|
|
391
|
+
btnInstances_1.push(btnInst);
|
|
392
|
+
if (options.ref && typeof options.ref === 'function') {
|
|
393
|
+
options.ref(btnInst, idx);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
if (target) {
|
|
397
|
+
target.appendChild(groupContainer_1);
|
|
398
|
+
}
|
|
399
|
+
return btnInstances_1;
|
|
400
|
+
}
|
|
401
|
+
// Fallback: single ButtonComponent when no group is configured.
|
|
402
|
+
var resolvedButtonType = resolveButtonType(component.buttonType);
|
|
403
|
+
var buttonCssClassList = [
|
|
404
|
+
mapButtonStyleToClass(component.style),
|
|
405
|
+
resolvedButtonType === 'submit' ? 'submit-btn form-submit-type' : '',
|
|
406
|
+
resolvedButtonType === 'reset' ? 'form-reset-type' : '',
|
|
407
|
+
component.cssClass || 'e-primary',
|
|
408
|
+
component.size === 'Small' ? ' e-small' : component.size === 'Bigger' ? ' e-bigger' : ''
|
|
409
|
+
].filter(Boolean).join(' ') || 'e-primary';
|
|
410
|
+
var buttonContainerStyle = {
|
|
411
|
+
display: 'flex',
|
|
412
|
+
justifyContent: mapPositionToJustifyContent(component.position),
|
|
413
|
+
width: component.width || '100%'
|
|
414
|
+
};
|
|
415
|
+
var container = createElement('div', {
|
|
416
|
+
id: component.name + "-container"
|
|
417
|
+
});
|
|
418
|
+
Object.assign(container.style, buttonContainerStyle);
|
|
419
|
+
var btnHost = createElement('button', {
|
|
420
|
+
id: component.name,
|
|
421
|
+
attrs: { type: resolvedButtonType }
|
|
422
|
+
});
|
|
423
|
+
container.appendChild(btnHost);
|
|
424
|
+
var btnInst = new Button({
|
|
425
|
+
enableRtl: enableRtl,
|
|
426
|
+
locale: locale,
|
|
427
|
+
cssClass: buttonCssClassList,
|
|
428
|
+
disabled: component.disabled,
|
|
429
|
+
iconCss: component.iconCss,
|
|
430
|
+
iconPosition: component.iconPosition,
|
|
431
|
+
content: component.label,
|
|
432
|
+
});
|
|
433
|
+
btnInst.appendTo(btnHost);
|
|
434
|
+
ref(btnInst);
|
|
435
|
+
btnInst.element.onclick = function (event) {
|
|
436
|
+
if (onClick) {
|
|
437
|
+
onClick(event);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
if (target) {
|
|
441
|
+
target.appendChild(container);
|
|
442
|
+
}
|
|
443
|
+
return btnInst;
|
|
444
|
+
}
|
|
445
|
+
case 'splitButton': {
|
|
446
|
+
var splitButtonCssClassList = [
|
|
447
|
+
component.style === 'primary' ? 'e-primary' : '',
|
|
448
|
+
component.style === 'flat' ? '' : '',
|
|
449
|
+
component.style === 'information' ? 'e-info' : '',
|
|
450
|
+
component.style === 'error' ? 'e-danger' : '',
|
|
451
|
+
component.style === 'success' ? 'e-success' : '',
|
|
452
|
+
component.style === 'warning' ? 'e-warning' : '',
|
|
453
|
+
component.cssClass || ''
|
|
454
|
+
].filter(Boolean).join(' ') || undefined;
|
|
455
|
+
var splitButtonContainerStyle = {
|
|
456
|
+
display: 'flex',
|
|
457
|
+
justifyContent: mapPositionToJustifyContent(component.position)
|
|
458
|
+
};
|
|
459
|
+
var container = createElement('div', {
|
|
460
|
+
id: component.name + "-container",
|
|
461
|
+
attrs: { 'aria-label': 'Splitbutton' }
|
|
462
|
+
});
|
|
463
|
+
Object.assign(container.style, splitButtonContainerStyle);
|
|
464
|
+
var items = (component.options && component.options.length > 0
|
|
465
|
+
? component.options.map(function (option, index) { return ( /* eslint-disable-next-line */{
|
|
466
|
+
text: option,
|
|
467
|
+
id: component.id + "_option_" + index
|
|
468
|
+
}); })
|
|
469
|
+
: [/* eslint-disable-next-line */ { text: 'Option 1', id: component.id + "_option_0" }]);
|
|
470
|
+
var sbHost = createElement('button', {
|
|
471
|
+
id: component.name
|
|
472
|
+
});
|
|
473
|
+
container.appendChild(sbHost);
|
|
474
|
+
var sb = new SplitButton({
|
|
475
|
+
locale: locale,
|
|
476
|
+
enableRtl: enableRtl,
|
|
477
|
+
content: component.label || 'Split Button',
|
|
478
|
+
items: items,
|
|
479
|
+
cssClass: splitButtonCssClassList,
|
|
480
|
+
disabled: component.disabled,
|
|
481
|
+
iconCss: component.iconCss,
|
|
482
|
+
iconPosition: component.iconPosition || 'Left',
|
|
483
|
+
click: function (args) {
|
|
484
|
+
if (onClick) {
|
|
485
|
+
onClick(__assign({}, args));
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
select: function (args) {
|
|
489
|
+
if (onClick) {
|
|
490
|
+
onClick(__assign({}, args, { selectedItem: args.item.text }));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
sb.appendTo(sbHost);
|
|
495
|
+
if (target) {
|
|
496
|
+
target.appendChild(container);
|
|
497
|
+
}
|
|
498
|
+
ref(sb);
|
|
499
|
+
return sb;
|
|
500
|
+
}
|
|
501
|
+
case 'signature': {
|
|
502
|
+
var canvas = createElement('canvas', {
|
|
503
|
+
id: component.name
|
|
504
|
+
});
|
|
505
|
+
var sig = new Signature({
|
|
506
|
+
enableRtl: enableRtl,
|
|
507
|
+
locale: locale,
|
|
508
|
+
backgroundColor: component.backgroundColor || '',
|
|
509
|
+
strokeColor: component.strokeColor || '',
|
|
510
|
+
maxStrokeWidth: component.maxValue,
|
|
511
|
+
minStrokeWidth: component.minValue,
|
|
512
|
+
velocity: component.velocity,
|
|
513
|
+
disabled: component.disabled,
|
|
514
|
+
change: function () { return onChange(component.name); }
|
|
515
|
+
});
|
|
516
|
+
if (target) {
|
|
517
|
+
sig.appendTo(canvas);
|
|
518
|
+
target.appendChild(canvas);
|
|
519
|
+
}
|
|
520
|
+
ref(sig);
|
|
521
|
+
return sig;
|
|
522
|
+
}
|
|
523
|
+
case 'rating': {
|
|
524
|
+
var rt = new Rating({
|
|
525
|
+
enableRtl: enableRtl,
|
|
526
|
+
locale: locale,
|
|
527
|
+
value: value !== undefined ? value : (component.defaultValue || 0),
|
|
528
|
+
disabled: component.disabled,
|
|
529
|
+
cssClass: cssClass,
|
|
530
|
+
allowReset: component.allowReset,
|
|
531
|
+
itemsCount: component.itemsCount,
|
|
532
|
+
min: component.minValue,
|
|
533
|
+
precision: component.precision,
|
|
534
|
+
readOnly: component.readOnly,
|
|
535
|
+
showTooltip: component.showRatingTooltip || false,
|
|
536
|
+
showLabel: component.showRatingLabel,
|
|
537
|
+
labelPosition: component.showRatingLabel ? component.ratingLabelPosition : undefined,
|
|
538
|
+
valueChanged: function (args) { return onChange(args.value); }
|
|
539
|
+
});
|
|
540
|
+
if (target) {
|
|
541
|
+
applyHostId(target, component.name);
|
|
542
|
+
target.setAttribute('name', component.id);
|
|
543
|
+
rt.appendTo(target);
|
|
544
|
+
}
|
|
545
|
+
ref(rt);
|
|
546
|
+
return rt;
|
|
547
|
+
}
|
|
548
|
+
case 'colorPicker': {
|
|
549
|
+
var cp = new ColorPicker({
|
|
550
|
+
enableRtl: enableRtl,
|
|
551
|
+
locale: locale,
|
|
552
|
+
value: value !== undefined ? value : (component.defaultValue || ''),
|
|
553
|
+
disabled: component.disabled,
|
|
554
|
+
enableOpacity: component.enableOpacity,
|
|
555
|
+
showButtons: component.showButtons,
|
|
556
|
+
showRecentColors: component.showRecentColors,
|
|
557
|
+
noColor: component.showNoColor,
|
|
558
|
+
cssClass: cssClass,
|
|
559
|
+
change: function (args) { return onChange(args.value); }
|
|
560
|
+
});
|
|
561
|
+
if (target) {
|
|
562
|
+
applyHostId(target, component.name);
|
|
563
|
+
cp.appendTo(target);
|
|
564
|
+
}
|
|
565
|
+
ref(cp);
|
|
566
|
+
return cp;
|
|
567
|
+
}
|
|
568
|
+
case 'inputMask': {
|
|
569
|
+
var im = new MaskedTextBox(__assign({ id: component.name, name: component.id, enableRtl: enableRtl, floatLabelType: component.floatLabelType || 'Never', placeholder: component.placeholder || '', enabled: !component.disabled, locale: locale, value: value !== undefined ? value : (component.defaultValue || ''), mask: component.mask || '000-000-0000', promptChar: component.promptChar || '_', customCharacters: component.customCharacters, readOnly: component.readOnly || false, showClearButton: component.showClearButton !== false, cssClass: cssClass, htmlAttributes: htmlAttrs, appendTemplate: component.suffix, prependTemplate: component.prefix }, createValidationHandlers(function (args) { return args.value || ''; })));
|
|
570
|
+
if (target) {
|
|
571
|
+
im.appendTo(target);
|
|
572
|
+
}
|
|
573
|
+
ref(im);
|
|
574
|
+
return im;
|
|
575
|
+
}
|
|
576
|
+
case 'rangeSlider': {
|
|
577
|
+
var sl = new Slider({
|
|
578
|
+
enableRtl: enableRtl,
|
|
579
|
+
locale: locale,
|
|
580
|
+
value: value !== undefined ? value : (component.defaultValue !== undefined && component.defaultValue !== null ? component.defaultValue : 0),
|
|
581
|
+
min: component.minValue || 0,
|
|
582
|
+
max: component.maxValue || 100,
|
|
583
|
+
step: component.step || 1,
|
|
584
|
+
cssClass: cssClass,
|
|
585
|
+
enabled: !component.disabled,
|
|
586
|
+
readonly: component.readOnly,
|
|
587
|
+
showButtons: component.showButtons,
|
|
588
|
+
change: function (args) { return onChange(args.value); }
|
|
589
|
+
});
|
|
590
|
+
if (target) {
|
|
591
|
+
applyHostId(target, component.name);
|
|
592
|
+
sl.appendTo(target);
|
|
593
|
+
}
|
|
594
|
+
ref(sl);
|
|
595
|
+
return sl;
|
|
596
|
+
}
|
|
597
|
+
case 'fileUpload': {
|
|
598
|
+
var up = new Uploader({
|
|
599
|
+
enableRtl: enableRtl,
|
|
600
|
+
locale: locale,
|
|
601
|
+
type: 'file',
|
|
602
|
+
enabled: !component.disabled,
|
|
603
|
+
allowedExtensions: component.allowExtensions,
|
|
604
|
+
asyncSettings: { saveUrl: component.saveUrl, removeUrl: component.removeUrl },
|
|
605
|
+
buttons: component.buttons || {
|
|
606
|
+
'browse': 'Choose File',
|
|
607
|
+
'clear': 'Clear All',
|
|
608
|
+
'upload': 'Upload All'
|
|
609
|
+
},
|
|
610
|
+
maxFileSize: component.maxValue,
|
|
611
|
+
minFileSize: component.minValue,
|
|
612
|
+
multiple: !!component.allowMultiple,
|
|
613
|
+
showFileList: component.showFileList,
|
|
614
|
+
htmlAttributes: htmlAttrs,
|
|
615
|
+
cssClass: cssClass,
|
|
616
|
+
change: function (args) { return onChange(args.file); }
|
|
617
|
+
});
|
|
618
|
+
if (target) {
|
|
619
|
+
applyHostId(target, component.name);
|
|
620
|
+
up.appendTo(target);
|
|
621
|
+
}
|
|
622
|
+
ref(up);
|
|
623
|
+
return up;
|
|
624
|
+
}
|
|
625
|
+
case 'imageEditor': {
|
|
626
|
+
var ieHost = createElement('div', {
|
|
627
|
+
id: component.name,
|
|
628
|
+
attrs: { 'data-field': component.id }
|
|
629
|
+
});
|
|
630
|
+
var ie_1;
|
|
631
|
+
setTimeout(function () {
|
|
632
|
+
ie_1 = new ImageEditor({
|
|
633
|
+
locale: locale,
|
|
634
|
+
enableRtl: enableRtl,
|
|
635
|
+
disabled: component.disabled,
|
|
636
|
+
cssClass: cssClass,
|
|
637
|
+
height: (component.height != null ? component.height : '350px').toString(),
|
|
638
|
+
width: (component.width != null ? component.width : '100%').toString(),
|
|
639
|
+
editComplete: function () { return onChange(component.name); },
|
|
640
|
+
fileOpened: function () { return onChange(component.name); }
|
|
641
|
+
}, "#" + component.name);
|
|
642
|
+
}, 100);
|
|
643
|
+
if (target) {
|
|
644
|
+
target.appendChild(ieHost);
|
|
645
|
+
}
|
|
646
|
+
ref(ie_1);
|
|
647
|
+
return ie_1;
|
|
648
|
+
}
|
|
649
|
+
case 'message': {
|
|
650
|
+
var msg = new Message({
|
|
651
|
+
locale: locale,
|
|
652
|
+
enableRtl: enableRtl,
|
|
653
|
+
severity: component.severity || component.messageType || 'info',
|
|
654
|
+
variant: component.variant,
|
|
655
|
+
content: component.content || 'Message',
|
|
656
|
+
showCloseIcon: component.showCloseIcon,
|
|
657
|
+
showIcon: ((component.showIcon === undefined ? false : component.showIcon) || false),
|
|
658
|
+
cssClass: cssClass
|
|
659
|
+
});
|
|
660
|
+
if (target) {
|
|
661
|
+
applyHostId(target, component.name);
|
|
662
|
+
msg.appendTo(target);
|
|
663
|
+
}
|
|
664
|
+
ref(msg);
|
|
665
|
+
return msg;
|
|
666
|
+
}
|
|
667
|
+
case 'dataGrid': {
|
|
668
|
+
var dg_1 = component;
|
|
669
|
+
var conditionalDataResult = resolveConditionalData(dg_1.conditions, (formState && formState.values) || {});
|
|
670
|
+
var conditionalData_1 = conditionalDataResult ? conditionalDataResult.dataSource : undefined;
|
|
671
|
+
var conditionalColumns = conditionalDataResult ? conditionalDataResult.columns : undefined;
|
|
672
|
+
var effectiveDataSource = conditionalData_1 || dg_1.dataSource;
|
|
673
|
+
var fetchedDataSource = [];
|
|
674
|
+
OptionFetcher.fetch(conditionalData_1 || dg_1.dataSource, dg_1.id, formState && formState.values, components).then(function (res) {
|
|
675
|
+
if (res.id === dg_1.id && res.options.length > 0) {
|
|
676
|
+
var newDataSource = resolveOptions(conditionalData_1 || dg_1.dataSource, res.options, fetchedLookupDataSource_1);
|
|
677
|
+
gridComp_1.setDataSource(newDataSource);
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
var fetchedLookupDataSource_1 = [];
|
|
681
|
+
var resolvedDataSource = conditionalData_1
|
|
682
|
+
? resolveOptions(conditionalData_1, fetchedDataSource, fetchedLookupDataSource_1)
|
|
683
|
+
: resolveOptions(dg_1.dataSource, fetchedDataSource, fetchedLookupDataSource_1);
|
|
684
|
+
var finalDataSource = resolvedDataSource.length > 0 ? resolvedDataSource : (dg_1.dataSource !== undefined && dg_1.dataSource !== null ? dg_1.dataSource : []);
|
|
685
|
+
var finalColumns = conditionalColumns && conditionalColumns.length > 0 ? conditionalColumns : (dg_1.columns !== undefined && dg_1.columns !== null ? dg_1.columns : []);
|
|
686
|
+
var gridHost = target || createElement('div', {
|
|
687
|
+
id: dg_1.name,
|
|
688
|
+
className: dg_1.cssClass
|
|
689
|
+
});
|
|
690
|
+
if (target) {
|
|
691
|
+
applyHostId(target, component.name);
|
|
692
|
+
}
|
|
693
|
+
var gridComp_1 = new DataGridComponent({
|
|
694
|
+
locale: locale,
|
|
695
|
+
name: dg_1.name || '',
|
|
696
|
+
columns: finalColumns,
|
|
697
|
+
enableRtl: enableRtl,
|
|
698
|
+
dataSource: (finalDataSource !== undefined && finalDataSource.length > 0) ? finalDataSource : value,
|
|
699
|
+
height: (dg_1.height != null ? dg_1.height : '200px'),
|
|
700
|
+
width: (dg_1.width != null ? dg_1.width : '100%'),
|
|
701
|
+
pageSize: dg_1.pageSize || 6,
|
|
702
|
+
allowPaging: dg_1.allowPaging !== false,
|
|
703
|
+
allowFiltering: dg_1.allowFiltering,
|
|
704
|
+
allowAdding: dg_1.allowAdding !== false,
|
|
705
|
+
allowEditing: dg_1.allowEditing !== false,
|
|
706
|
+
allowDeleting: dg_1.allowDeleting !== false,
|
|
707
|
+
onDataChange: function (data) { return onChange(data); },
|
|
708
|
+
cssClass: cssClass,
|
|
709
|
+
target: gridHost,
|
|
710
|
+
ref: ref
|
|
711
|
+
});
|
|
712
|
+
gridComp_1.render(gridHost);
|
|
713
|
+
if (!initializedGrids.has(component.id) && formState && Array.isArray(finalDataSource)) {
|
|
714
|
+
formState.values[component.id] = finalDataSource;
|
|
715
|
+
gridComp_1.isInitialized = true;
|
|
716
|
+
initializedGrids.add(component.id);
|
|
717
|
+
}
|
|
718
|
+
if (typeof options.ref === 'function') {
|
|
719
|
+
options.ref(gridComp_1);
|
|
720
|
+
}
|
|
721
|
+
else if (options.ref) {
|
|
722
|
+
options.ref.current = gridComp_1;
|
|
723
|
+
}
|
|
724
|
+
return target || gridHost;
|
|
725
|
+
}
|
|
726
|
+
case 'richTextEditor': {
|
|
727
|
+
var toolbarSettings = {
|
|
728
|
+
items: [
|
|
729
|
+
'Undo', 'Redo', '|', 'Bold', 'Italic', 'Underline', 'StrikeThrough', 'InlineCode', '|',
|
|
730
|
+
'CreateLink', 'Image', 'CreateTable', 'CodeBlock', 'HorizontalLine', 'Blockquote', 'EmojiPicker', '|',
|
|
731
|
+
'LineHeight', 'Formats', 'Alignments', '|', 'BulletFormatList', 'NumberFormatList', 'Checklist', '|',
|
|
732
|
+
'Outdent', 'Indent', '|', 'FontColor', 'BackgroundColor', 'FontName', 'FontSize', '|',
|
|
733
|
+
'LowerCase', 'UpperCase', 'SuperScript', 'SubScript', '|', 'SourceCode', '|'
|
|
734
|
+
]
|
|
735
|
+
};
|
|
736
|
+
if (component.enableImportFromWord && component.enableImportFromWord.enabled) {
|
|
737
|
+
toolbarSettings.items.push('ImportWord');
|
|
738
|
+
}
|
|
739
|
+
if (component.enableExportToWord && component.enableExportToWord.enabled) {
|
|
740
|
+
toolbarSettings.items.push('ExportWord');
|
|
741
|
+
}
|
|
742
|
+
if (component.enableExportToPdf && component.enableExportToPdf.enabled) {
|
|
743
|
+
toolbarSettings.items.push('ExportPdf');
|
|
744
|
+
}
|
|
745
|
+
toolbarSettings.items.push('Print');
|
|
746
|
+
var hasValidService = function (config) {
|
|
747
|
+
return !!config && config.enabled && typeof config.serviceUrl === 'string' && config.serviceUrl.trim() !== '';
|
|
748
|
+
};
|
|
749
|
+
var importWord = hasValidService(component.enableImportFromWord)
|
|
750
|
+
? {
|
|
751
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
752
|
+
serviceUrl: /^(https?:)?\/\//i.test(component.enableImportFromWord ? component.enableImportFromWord.serviceUrl : '')
|
|
753
|
+
? (component.enableImportFromWord ? component.enableImportFromWord.serviceUrl : '')
|
|
754
|
+
: (settings && settings.hostUrl ? settings.hostUrl : '').replace(/\/+$/, '') + "/" + (component.enableImportFromWord ? component.enableImportFromWord.serviceUrl : '').replace(/^\/+/, '')
|
|
755
|
+
}
|
|
756
|
+
: undefined;
|
|
757
|
+
var exportWord = hasValidService(component.enableExportToWord)
|
|
758
|
+
? {
|
|
759
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
760
|
+
serviceUrl: /^(https?:)?\/\//i.test(component.enableExportToWord ? component.enableExportToWord.serviceUrl : '')
|
|
761
|
+
? (component.enableExportToWord ? component.enableExportToWord.serviceUrl : '')
|
|
762
|
+
: (settings && settings.hostUrl ? settings.hostUrl : '').replace(/\/+$/, '') + "/" + (component.enableExportToWord ? component.enableExportToWord.serviceUrl : '').replace(/^\/+/, ''),
|
|
763
|
+
fileName: 'RichTextEditor.docx',
|
|
764
|
+
stylesheet: "\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "
|
|
765
|
+
}
|
|
766
|
+
: undefined;
|
|
767
|
+
var exportPdf = hasValidService(component.enableExportToPdf)
|
|
768
|
+
? {
|
|
769
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
770
|
+
serviceUrl: /^(https?:)?\/\//i.test(component.enableExportToPdf ? component.enableExportToPdf.serviceUrl : '')
|
|
771
|
+
? (component.enableExportToPdf ? component.enableExportToPdf.serviceUrl : '')
|
|
772
|
+
: (settings && settings.hostUrl ? settings.hostUrl : '').replace(/\/+$/, '') + "/" + (component.enableExportToPdf ? component.enableExportToPdf.serviceUrl : '').replace(/^\/+/, ''),
|
|
773
|
+
fileName: 'RichTextEditor.pdf',
|
|
774
|
+
stylesheet: "\n .e-rte-content {\n font-size: 1em;\n font-weight: 400;\n margin: 0;\n }\n "
|
|
775
|
+
}
|
|
776
|
+
: undefined;
|
|
777
|
+
var rte = new RichTextEditor({
|
|
778
|
+
locale: locale,
|
|
779
|
+
toolbarSettings: toolbarSettings,
|
|
780
|
+
enableRtl: enableRtl,
|
|
781
|
+
value: value !== undefined ? value : (component.defaultValue || ''),
|
|
782
|
+
placeholder: component.placeholder || '',
|
|
783
|
+
enabled: !component.disabled,
|
|
784
|
+
readonly: component.readOnly || false,
|
|
785
|
+
maxLength: component.maxLength || undefined,
|
|
786
|
+
cssClass: cssClass || undefined,
|
|
787
|
+
height: component.height || '300px',
|
|
788
|
+
width: component.width || '100%',
|
|
789
|
+
htmlAttributes: htmlAttrs,
|
|
790
|
+
importWord: importWord,
|
|
791
|
+
exportPdf: exportPdf,
|
|
792
|
+
exportWord: exportWord,
|
|
793
|
+
change: function (args) { return onChange(args.value); }
|
|
794
|
+
});
|
|
795
|
+
RichTextEditor.Inject(Toolbar, Link, HtmlEditor, QuickToolbar, RTEImage, Count, Table, EmojiPicker, PasteCleanup, SlashMenu, CodeBlock, ClipBoardCleanup, AutoFormat, ImportExport);
|
|
796
|
+
rte.appendTo(target);
|
|
797
|
+
ref(rte);
|
|
798
|
+
return rte;
|
|
799
|
+
}
|
|
800
|
+
default: {
|
|
801
|
+
var msg = new Message({
|
|
802
|
+
locale: locale,
|
|
803
|
+
enableRtl: enableRtl,
|
|
804
|
+
severity: 'Warning',
|
|
805
|
+
content: l10n.getConstant('unsupportedComponent') + " : " + component.type,
|
|
806
|
+
cssClass: cssClass
|
|
807
|
+
});
|
|
808
|
+
if (target) {
|
|
809
|
+
applyHostId(target, component.name);
|
|
810
|
+
msg.appendTo(target);
|
|
811
|
+
}
|
|
812
|
+
ref(msg);
|
|
813
|
+
return msg;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
};
|