@progress/kendo-angular-inputs 19.3.0-develop.4 → 19.3.0-develop.6
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/common/formservice.service.d.ts +14 -0
- package/common/models/gutters.d.ts +22 -0
- package/common/models/responsive-breakpoints.d.ts +24 -0
- package/common/utils.d.ts +0 -4
- package/directives.d.ts +19 -1
- package/esm2022/common/formservice.service.mjs +21 -0
- package/esm2022/common/models/gutters.mjs +5 -0
- package/esm2022/common/models/responsive-breakpoints.mjs +5 -0
- package/esm2022/common/utils.mjs +0 -4
- package/esm2022/directives.mjs +24 -0
- package/esm2022/form/form.component.mjs +152 -0
- package/esm2022/form/formseparator.component.mjs +80 -0
- package/esm2022/form/utils.mjs +134 -0
- package/esm2022/form.module.mjs +46 -0
- package/esm2022/formfield/formfield.component.mjs +47 -5
- package/esm2022/formfieldset/formfieldset.component.mjs +175 -0
- package/esm2022/index.mjs +5 -0
- package/esm2022/inputs.module.mjs +26 -23
- package/esm2022/otpinput/otpinput.component.mjs +2 -2
- package/esm2022/package-metadata.mjs +2 -2
- package/esm2022/rangeslider/rangeslider.component.mjs +3 -0
- package/fesm2022/progress-kendo-angular-inputs.mjs +621 -15
- package/form/form.component.d.ts +70 -0
- package/form/formseparator.component.d.ts +32 -0
- package/form/utils.d.ts +57 -0
- package/form.module.d.ts +36 -0
- package/formfield/formfield.component.d.ts +19 -4
- package/formfieldset/formfieldset.component.d.ts +72 -0
- package/index.d.ts +6 -0
- package/inputs.module.d.ts +25 -22
- package/package.json +12 -12
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export declare class FormService {
|
|
11
|
+
formWidth: BehaviorSubject<number>;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormService, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FormService>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { ResponsiveFormBreakPoint } from './responsive-breakpoints';
|
|
6
|
+
/**
|
|
7
|
+
* Represents the gutters configuration for a form layout.
|
|
8
|
+
* It allows defining the spacing between the columns and rows of the form.
|
|
9
|
+
* Each property can be a number or an array of responsive breakpoints.
|
|
10
|
+
*/
|
|
11
|
+
export interface Gutters {
|
|
12
|
+
/**
|
|
13
|
+
* Defines the gutters for the columns in the form.
|
|
14
|
+
* Can be a number or an array of responsive breakpoints.
|
|
15
|
+
*/
|
|
16
|
+
cols?: number | ResponsiveFormBreakPoint[];
|
|
17
|
+
/**
|
|
18
|
+
* Defines the gutters for the rows in the form.
|
|
19
|
+
* Can be a number or an array of responsive breakpoints.
|
|
20
|
+
*/
|
|
21
|
+
rows?: number | ResponsiveFormBreakPoint[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* Allows to define responsive breakpoints for form controls.
|
|
7
|
+
* Each breakpoint can specify a minimum and/or maximum width, and a value that represents either the number of columns
|
|
8
|
+
* or the colspan/gutters for that breakpoint.
|
|
9
|
+
*/
|
|
10
|
+
export interface ResponsiveFormBreakPoint {
|
|
11
|
+
/**
|
|
12
|
+
* The minimum width for this breakpoint in pixels.
|
|
13
|
+
*/
|
|
14
|
+
minWidth?: number;
|
|
15
|
+
/**
|
|
16
|
+
* The maximum width for this breakpoint in pixels.
|
|
17
|
+
*/
|
|
18
|
+
maxWidth?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The value associated with this breakpoint.
|
|
21
|
+
* It can represent the number of columns or the colspan/gutters for the form control.
|
|
22
|
+
*/
|
|
23
|
+
value: number;
|
|
24
|
+
}
|
package/common/utils.d.ts
CHANGED
|
@@ -65,7 +65,3 @@ export declare const COMPONENT_TYPE: InjectionToken<ComponentType>;
|
|
|
65
65
|
* @hidden
|
|
66
66
|
*/
|
|
67
67
|
export type ComponentType = 'radio' | 'checkbox';
|
|
68
|
-
/**
|
|
69
|
-
* @hidden
|
|
70
|
-
*/
|
|
71
|
-
export declare const replaceMessagePlaceholder: (message: string, name: string, value: string) => string;
|
package/directives.d.ts
CHANGED
|
@@ -43,6 +43,9 @@ import { TextBoxComponent } from "./textbox/textbox.component";
|
|
|
43
43
|
import { TextBoxDirective } from "./textbox/textbox.directive";
|
|
44
44
|
import { OTPInputComponent } from "./otpinput/otpinput.component";
|
|
45
45
|
import { OTPInputCustomMessagesComponent } from "./otpinput/localization/custom-messages.component";
|
|
46
|
+
import { FormComponent } from "./form/form.component";
|
|
47
|
+
import { FormSeparatorComponent } from "./form/formseparator.component";
|
|
48
|
+
import { FormFieldSetComponent } from "./formfieldset/formfieldset.component";
|
|
46
49
|
/**
|
|
47
50
|
* Use the `KENDO_TEXTBOX` utility array to add all TextBox-related components and directives to a standalone Angular component.
|
|
48
51
|
*
|
|
@@ -178,6 +181,21 @@ export declare const KENDO_SWITCH: readonly [typeof SwitchComponent, typeof Swit
|
|
|
178
181
|
* ```
|
|
179
182
|
*/
|
|
180
183
|
export declare const KENDO_FORMFIELD: readonly [typeof FormFieldComponent, typeof HintComponent, typeof ErrorComponent];
|
|
184
|
+
/**
|
|
185
|
+
* Use the `KENDO_FORM` utility array to add all Form-related components and directives to a standalone Angular component.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* import { KENDO_FORM } from '@progress/kendo-angular-inputs';
|
|
190
|
+
* @Component({
|
|
191
|
+
* standalone: true,
|
|
192
|
+
* imports: [KENDO_FORM],
|
|
193
|
+
* template: `<form kendoForm>...</form>`
|
|
194
|
+
* })
|
|
195
|
+
* export class MyComponent {}
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export declare const KENDO_FORM: readonly [typeof FormComponent, typeof FormSeparatorComponent, typeof FormFieldSetComponent, typeof FormFieldComponent, typeof HintComponent, typeof ErrorComponent];
|
|
181
199
|
/**
|
|
182
200
|
* Use the `KENDO_SLIDER` utility array to add all Slider-related components and directives to a standalone Angular component.
|
|
183
201
|
*
|
|
@@ -312,4 +330,4 @@ export declare const KENDO_COLORGRADIENT: readonly [typeof ColorGradientComponen
|
|
|
312
330
|
* export class MyComponent {}
|
|
313
331
|
* ```
|
|
314
332
|
*/
|
|
315
|
-
export declare const KENDO_INPUTS: readonly [typeof TextBoxDirective, typeof TextBoxComponent, typeof InputSeparatorComponent, typeof TextBoxSuffixTemplateDirective, typeof TextBoxPrefixTemplateDirective, typeof TextBoxCustomMessagesComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof NumericTextBoxComponent, typeof NumericTextBoxCustomMessagesComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof MaskedTextBoxComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof TextAreaComponent, typeof TextAreaDirective, typeof TextAreaPrefixComponent, typeof TextAreaSuffixComponent, typeof SeparatorComponent, typeof CheckBoxComponent, typeof CheckBoxDirective, typeof RadioButtonComponent, typeof RadioButtonDirective, typeof SwitchComponent, typeof SwitchCustomMessagesComponent, typeof FormFieldComponent, typeof HintComponent, typeof ErrorComponent, typeof SliderComponent, typeof SliderCustomMessagesComponent, typeof LabelTemplateDirective, typeof RangeSliderComponent, typeof RangeSliderCustomMessagesComponent, typeof LabelTemplateDirective, typeof RatingComponent, typeof RatingItemTemplateDirective, typeof RatingHoveredItemTemplateDirective, typeof RatingSelectedItemTemplateDirective, typeof SignatureComponent, typeof SignatureCustomMessagesComponent, typeof ColorPickerComponent, typeof ColorPickerCustomMessagesComponent, typeof FlatColorPickerComponent, typeof ColorPickerCustomMessagesComponent, typeof ColorGradientComponent, typeof ColorPickerCustomMessagesComponent, typeof ColorPaletteComponent, typeof ColorPickerCustomMessagesComponent, typeof OTPInputComponent, typeof OTPInputCustomMessagesComponent];
|
|
333
|
+
export declare const KENDO_INPUTS: readonly [typeof TextBoxDirective, typeof TextBoxComponent, typeof InputSeparatorComponent, typeof TextBoxSuffixTemplateDirective, typeof TextBoxPrefixTemplateDirective, typeof TextBoxCustomMessagesComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof NumericTextBoxComponent, typeof NumericTextBoxCustomMessagesComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof MaskedTextBoxComponent, typeof PrefixTemplateDirective, typeof SuffixTemplateDirective, typeof SeparatorComponent, typeof TextAreaComponent, typeof TextAreaDirective, typeof TextAreaPrefixComponent, typeof TextAreaSuffixComponent, typeof SeparatorComponent, typeof CheckBoxComponent, typeof CheckBoxDirective, typeof RadioButtonComponent, typeof RadioButtonDirective, typeof SwitchComponent, typeof SwitchCustomMessagesComponent, typeof FormComponent, typeof FormSeparatorComponent, typeof FormFieldSetComponent, typeof FormFieldComponent, typeof HintComponent, typeof ErrorComponent, typeof FormFieldComponent, typeof HintComponent, typeof ErrorComponent, typeof SliderComponent, typeof SliderCustomMessagesComponent, typeof LabelTemplateDirective, typeof RangeSliderComponent, typeof RangeSliderCustomMessagesComponent, typeof LabelTemplateDirective, typeof RatingComponent, typeof RatingItemTemplateDirective, typeof RatingHoveredItemTemplateDirective, typeof RatingSelectedItemTemplateDirective, typeof SignatureComponent, typeof SignatureCustomMessagesComponent, typeof ColorPickerComponent, typeof ColorPickerCustomMessagesComponent, typeof FlatColorPickerComponent, typeof ColorPickerCustomMessagesComponent, typeof ColorGradientComponent, typeof ColorPickerCustomMessagesComponent, typeof ColorPaletteComponent, typeof ColorPickerCustomMessagesComponent, typeof OTPInputComponent, typeof OTPInputCustomMessagesComponent];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Injectable } from '@angular/core';
|
|
6
|
+
import { BehaviorSubject } from 'rxjs';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
export class FormService {
|
|
12
|
+
formWidth = new BehaviorSubject(null);
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
14
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, providedIn: 'root' });
|
|
15
|
+
}
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormService, decorators: [{
|
|
17
|
+
type: Injectable,
|
|
18
|
+
args: [{
|
|
19
|
+
providedIn: 'root',
|
|
20
|
+
}]
|
|
21
|
+
}] });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
package/esm2022/common/utils.mjs
CHANGED
|
@@ -86,7 +86,3 @@ export const getStylingClasses = (componentType, stylingOption, previousValue, n
|
|
|
86
86
|
* Used to differentiate between the Radio and CheckBox components in their base class.
|
|
87
87
|
*/
|
|
88
88
|
export const COMPONENT_TYPE = new InjectionToken('TYPE_TOKEN');
|
|
89
|
-
/**
|
|
90
|
-
* @hidden
|
|
91
|
-
*/
|
|
92
|
-
export const replaceMessagePlaceholder = (message, name, value) => message.replace(new RegExp(`{\\s*${name}\\s*}`, 'g'), value);
|
package/esm2022/directives.mjs
CHANGED
|
@@ -43,6 +43,9 @@ import { TextBoxComponent } from "./textbox/textbox.component";
|
|
|
43
43
|
import { TextBoxDirective } from "./textbox/textbox.directive";
|
|
44
44
|
import { OTPInputComponent } from "./otpinput/otpinput.component";
|
|
45
45
|
import { OTPInputCustomMessagesComponent } from "./otpinput/localization/custom-messages.component";
|
|
46
|
+
import { FormComponent } from "./form/form.component";
|
|
47
|
+
import { FormSeparatorComponent } from "./form/formseparator.component";
|
|
48
|
+
import { FormFieldSetComponent } from "./formfieldset/formfieldset.component";
|
|
46
49
|
/**
|
|
47
50
|
* Use the `KENDO_TEXTBOX` utility array to add all TextBox-related components and directives to a standalone Angular component.
|
|
48
51
|
*
|
|
@@ -221,6 +224,26 @@ export const KENDO_FORMFIELD = [
|
|
|
221
224
|
HintComponent,
|
|
222
225
|
ErrorComponent
|
|
223
226
|
];
|
|
227
|
+
/**
|
|
228
|
+
* Use the `KENDO_FORM` utility array to add all Form-related components and directives to a standalone Angular component.
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```typescript
|
|
232
|
+
* import { KENDO_FORM } from '@progress/kendo-angular-inputs';
|
|
233
|
+
* @Component({
|
|
234
|
+
* standalone: true,
|
|
235
|
+
* imports: [KENDO_FORM],
|
|
236
|
+
* template: `<form kendoForm>...</form>`
|
|
237
|
+
* })
|
|
238
|
+
* export class MyComponent {}
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
export const KENDO_FORM = [
|
|
242
|
+
FormComponent,
|
|
243
|
+
FormSeparatorComponent,
|
|
244
|
+
FormFieldSetComponent,
|
|
245
|
+
...KENDO_FORMFIELD
|
|
246
|
+
];
|
|
224
247
|
/**
|
|
225
248
|
* Use the `KENDO_SLIDER` utility array to add all Slider-related components and directives to a standalone Angular component.
|
|
226
249
|
*
|
|
@@ -391,6 +414,7 @@ export const KENDO_INPUTS = [
|
|
|
391
414
|
...KENDO_CHECKBOX,
|
|
392
415
|
...KENDO_RADIOBUTTON,
|
|
393
416
|
...KENDO_SWITCH,
|
|
417
|
+
...KENDO_FORM,
|
|
394
418
|
...KENDO_FORMFIELD,
|
|
395
419
|
...KENDO_SLIDER,
|
|
396
420
|
...KENDO_RANGESLIDER,
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { NgClass, NgIf } from '@angular/common';
|
|
6
|
+
import { Component, ElementRef, HostBinding, Input, ChangeDetectorRef } from '@angular/core';
|
|
7
|
+
import { ResizeSensorComponent, shouldShowValidationUI, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
|
|
8
|
+
import { calculateColumns, calculateGutters, generateColumnClass, generateGutterClasses, innerWidth } from './utils';
|
|
9
|
+
import { FormService } from '../common/formservice.service';
|
|
10
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
11
|
+
import { packageMetadata } from '../package-metadata';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "../common/formservice.service";
|
|
14
|
+
/**
|
|
15
|
+
* Represents the Kendo UI Form component for Angular.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* Supported children components are: {@link FormFieldComponent}, {@link FormSeparatorComponent}, and {@link FormFieldSetComponent}.
|
|
19
|
+
*/
|
|
20
|
+
export class FormComponent {
|
|
21
|
+
element;
|
|
22
|
+
cdr;
|
|
23
|
+
formService;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the orientation of the form.
|
|
26
|
+
*
|
|
27
|
+
* @default 'vertical'
|
|
28
|
+
*/
|
|
29
|
+
orientation = 'vertical';
|
|
30
|
+
/**
|
|
31
|
+
* Defines the number of columns in the form.
|
|
32
|
+
* Can be a number or an array of responsive breakpoints.
|
|
33
|
+
*/
|
|
34
|
+
cols;
|
|
35
|
+
/**
|
|
36
|
+
* Defines the gutters for the form.
|
|
37
|
+
* You can specify gutters for rows and columns.
|
|
38
|
+
*/
|
|
39
|
+
gutters;
|
|
40
|
+
/**
|
|
41
|
+
* @hidden
|
|
42
|
+
*/
|
|
43
|
+
columnsClass = '';
|
|
44
|
+
/**
|
|
45
|
+
* @hidden
|
|
46
|
+
*/
|
|
47
|
+
rowsGutterClass = '';
|
|
48
|
+
/**
|
|
49
|
+
* @hidden
|
|
50
|
+
*/
|
|
51
|
+
colsGutterClass = '';
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
showLicenseWatermark = false;
|
|
56
|
+
formClass = true;
|
|
57
|
+
get horizontalClass() {
|
|
58
|
+
return this.orientation === 'horizontal';
|
|
59
|
+
}
|
|
60
|
+
_formColumnsNumber;
|
|
61
|
+
_formGutters;
|
|
62
|
+
constructor(element, cdr, formService) {
|
|
63
|
+
this.element = element;
|
|
64
|
+
this.cdr = cdr;
|
|
65
|
+
this.formService = formService;
|
|
66
|
+
const isValid = validatePackage(packageMetadata);
|
|
67
|
+
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
|
68
|
+
}
|
|
69
|
+
ngAfterContentInit() {
|
|
70
|
+
this.applyColumns();
|
|
71
|
+
this.applyGutters();
|
|
72
|
+
this.formService.formWidth.next(innerWidth(this.element.nativeElement));
|
|
73
|
+
}
|
|
74
|
+
ngOnChanges(changes) {
|
|
75
|
+
if (changes['cols']) {
|
|
76
|
+
this.applyColumns();
|
|
77
|
+
}
|
|
78
|
+
else if (changes['gutters']) {
|
|
79
|
+
this.applyGutters();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
onResize() {
|
|
86
|
+
this.formService.formWidth.next(innerWidth(this.element.nativeElement));
|
|
87
|
+
const previousColumnsNumber = this._formColumnsNumber;
|
|
88
|
+
const previousGutters = this._formGutters;
|
|
89
|
+
this.applyColumns();
|
|
90
|
+
this.applyGutters();
|
|
91
|
+
if (previousColumnsNumber !== this._formColumnsNumber) {
|
|
92
|
+
this.cdr.detectChanges();
|
|
93
|
+
}
|
|
94
|
+
if (previousGutters?.cols !== this._formGutters?.cols || previousGutters?.rows !== this._formGutters?.rows) {
|
|
95
|
+
this.cdr.detectChanges();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
applyColumns() {
|
|
99
|
+
const containerWidth = innerWidth(this.element.nativeElement);
|
|
100
|
+
this._formColumnsNumber = calculateColumns(this.cols, containerWidth);
|
|
101
|
+
this.updateColumnClasses();
|
|
102
|
+
}
|
|
103
|
+
applyGutters() {
|
|
104
|
+
const containerWidth = innerWidth(this.element.nativeElement);
|
|
105
|
+
this._formGutters = calculateGutters(this.gutters, containerWidth);
|
|
106
|
+
this.updateGutterClasses();
|
|
107
|
+
}
|
|
108
|
+
updateColumnClasses() {
|
|
109
|
+
this.columnsClass = generateColumnClass(this._formColumnsNumber);
|
|
110
|
+
}
|
|
111
|
+
updateGutterClasses() {
|
|
112
|
+
const gutterClasses = generateGutterClasses(this._formGutters);
|
|
113
|
+
this.rowsGutterClass = gutterClasses.rows;
|
|
114
|
+
this.colsGutterClass = gutterClasses.cols;
|
|
115
|
+
}
|
|
116
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.FormService }], target: i0.ɵɵFactoryTarget.Component });
|
|
117
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FormComponent, isStandalone: true, selector: "form[kendoForm]", inputs: { orientation: "orientation", cols: "cols", gutters: "gutters" }, host: { properties: { "class.k-form": "this.formClass", "class.k-form-horizontal": "this.horizontalClass" } }, exportAs: ["kendoForm"], usesOnChanges: true, ngImport: i0, template: `
|
|
118
|
+
<div class="k-form-layout k-d-grid" [ngClass]="[columnsClass, rowsGutterClass, colsGutterClass]">
|
|
119
|
+
<ng-content></ng-content>
|
|
120
|
+
</div>
|
|
121
|
+
<kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
|
|
122
|
+
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
|
123
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]" }] });
|
|
124
|
+
}
|
|
125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormComponent, decorators: [{
|
|
126
|
+
type: Component,
|
|
127
|
+
args: [{
|
|
128
|
+
exportAs: 'kendoForm',
|
|
129
|
+
selector: 'form[kendoForm]',
|
|
130
|
+
template: `
|
|
131
|
+
<div class="k-form-layout k-d-grid" [ngClass]="[columnsClass, rowsGutterClass, colsGutterClass]">
|
|
132
|
+
<ng-content></ng-content>
|
|
133
|
+
</div>
|
|
134
|
+
<kendo-resize-sensor (resize)="onResize()"></kendo-resize-sensor>
|
|
135
|
+
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark"></div>
|
|
136
|
+
`,
|
|
137
|
+
standalone: true,
|
|
138
|
+
imports: [NgClass, NgIf, ResizeSensorComponent, WatermarkOverlayComponent],
|
|
139
|
+
}]
|
|
140
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.FormService }]; }, propDecorators: { orientation: [{
|
|
141
|
+
type: Input
|
|
142
|
+
}], cols: [{
|
|
143
|
+
type: Input
|
|
144
|
+
}], gutters: [{
|
|
145
|
+
type: Input
|
|
146
|
+
}], formClass: [{
|
|
147
|
+
type: HostBinding,
|
|
148
|
+
args: ['class.k-form']
|
|
149
|
+
}], horizontalClass: [{
|
|
150
|
+
type: HostBinding,
|
|
151
|
+
args: ['class.k-form-horizontal']
|
|
152
|
+
}] } });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, ElementRef, HostBinding, Input, Renderer2 } from '@angular/core';
|
|
6
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
7
|
+
import { packageMetadata } from '../package-metadata';
|
|
8
|
+
import { calculateColSpan, generateColSpanClass } from './utils';
|
|
9
|
+
import { Subscription } from 'rxjs';
|
|
10
|
+
import { FormService } from '../common/formservice.service';
|
|
11
|
+
import { filter } from 'rxjs/operators';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "../common/formservice.service";
|
|
14
|
+
/**
|
|
15
|
+
* Represents the Kendo UI Form Separator component for Angular.
|
|
16
|
+
*/
|
|
17
|
+
export class FormSeparatorComponent {
|
|
18
|
+
renderer;
|
|
19
|
+
hostElement;
|
|
20
|
+
formService;
|
|
21
|
+
hostClass = true;
|
|
22
|
+
/**
|
|
23
|
+
* Defines the colspan for the separator element related to the parent Form component columns.
|
|
24
|
+
* Can be a number or an array of responsive breakpoints.
|
|
25
|
+
*/
|
|
26
|
+
colSpan;
|
|
27
|
+
_formWidth = null;
|
|
28
|
+
_colSpanClass = null;
|
|
29
|
+
_previousColSpan = null;
|
|
30
|
+
subscriptions = new Subscription();
|
|
31
|
+
constructor(renderer, hostElement, formService) {
|
|
32
|
+
this.renderer = renderer;
|
|
33
|
+
this.hostElement = hostElement;
|
|
34
|
+
this.formService = formService;
|
|
35
|
+
validatePackage(packageMetadata);
|
|
36
|
+
this.subscriptions.add(this.formService.formWidth.pipe(filter((width) => width !== null)).subscribe((width) => {
|
|
37
|
+
this._formWidth = width;
|
|
38
|
+
this.updateColSpanClass();
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
ngOnChanges(changes) {
|
|
42
|
+
if (changes['colSpan']) {
|
|
43
|
+
this.updateColSpanClass();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
ngOnDestroy() {
|
|
47
|
+
this.subscriptions.unsubscribe();
|
|
48
|
+
}
|
|
49
|
+
updateColSpanClass() {
|
|
50
|
+
const hostElement = this.hostElement.nativeElement;
|
|
51
|
+
const newColSpan = calculateColSpan(this.colSpan, this._formWidth);
|
|
52
|
+
if (newColSpan !== this._previousColSpan) {
|
|
53
|
+
const newClass = generateColSpanClass(newColSpan);
|
|
54
|
+
if (this._colSpanClass) {
|
|
55
|
+
this.renderer.removeClass(hostElement, this._colSpanClass);
|
|
56
|
+
}
|
|
57
|
+
if (newClass) {
|
|
58
|
+
this.renderer.addClass(hostElement, newClass);
|
|
59
|
+
}
|
|
60
|
+
this._colSpanClass = newClass;
|
|
61
|
+
this._previousColSpan = newColSpan;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSeparatorComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1.FormService }], target: i0.ɵɵFactoryTarget.Component });
|
|
65
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FormSeparatorComponent, isStandalone: true, selector: "kendo-form-separator", inputs: { colSpan: "colSpan" }, host: { properties: { "class.k-form-separator": "this.hostClass" } }, exportAs: ["kendoFormSeparator"], usesOnChanges: true, ngImport: i0, template: ``, isInline: true });
|
|
66
|
+
}
|
|
67
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormSeparatorComponent, decorators: [{
|
|
68
|
+
type: Component,
|
|
69
|
+
args: [{
|
|
70
|
+
exportAs: 'kendoFormSeparator',
|
|
71
|
+
selector: 'kendo-form-separator',
|
|
72
|
+
template: ``,
|
|
73
|
+
standalone: true,
|
|
74
|
+
}]
|
|
75
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1.FormService }]; }, propDecorators: { hostClass: [{
|
|
76
|
+
type: HostBinding,
|
|
77
|
+
args: ['class.k-form-separator']
|
|
78
|
+
}], colSpan: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}] } });
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export function innerWidth(element) {
|
|
9
|
+
let width = element.clientWidth;
|
|
10
|
+
const style = getComputedStyle(element);
|
|
11
|
+
width -= (parseFloat(style.paddingLeft) || 0) + (parseFloat(style.borderLeftWidth) || 0);
|
|
12
|
+
width -= (parseFloat(style.paddingRight) || 0) + (parseFloat(style.borderRightWidth) || 0);
|
|
13
|
+
return width;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export function processBreakpoints(breakpoints, containerWidth) {
|
|
19
|
+
if (!breakpoints?.length || containerWidth === null) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
for (const [index, breakpoint] of breakpoints.entries()) {
|
|
23
|
+
const minBreakpointWidth = breakpoint.minWidth || breakpoints[index - 1]?.maxWidth + 1 || 0;
|
|
24
|
+
const maxBreakpointWidth = breakpoint.maxWidth || breakpoints[index + 1]?.minWidth - 1 || Infinity;
|
|
25
|
+
if (containerWidth >= minBreakpointWidth && containerWidth <= maxBreakpointWidth) {
|
|
26
|
+
return breakpoint.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export const calculateColumns = (cols, containerWidth) => {
|
|
35
|
+
if (!cols) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (Array.isArray(cols) && cols.length > 0) {
|
|
39
|
+
return processBreakpoints(cols, containerWidth);
|
|
40
|
+
}
|
|
41
|
+
else if (typeof cols === 'number') {
|
|
42
|
+
return cols;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* @hidden
|
|
48
|
+
*
|
|
49
|
+
* Calculates gutters for rows and columns based on responsive breakpoints or fixed values
|
|
50
|
+
*/
|
|
51
|
+
export const calculateGutters = (gutters, containerWidth) => {
|
|
52
|
+
if (!gutters) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (typeof gutters === 'number') {
|
|
56
|
+
return { cols: gutters, rows: gutters };
|
|
57
|
+
}
|
|
58
|
+
else if (Array.isArray(gutters)) {
|
|
59
|
+
const processedGutters = processBreakpoints(gutters, containerWidth);
|
|
60
|
+
return processedGutters !== null ? { cols: processedGutters, rows: processedGutters } : null;
|
|
61
|
+
}
|
|
62
|
+
else if (typeof gutters === 'object') {
|
|
63
|
+
const gutterObject = gutters;
|
|
64
|
+
const result = { rows: null, cols: null };
|
|
65
|
+
if (gutterObject.cols !== undefined && gutterObject.cols !== null) {
|
|
66
|
+
if (typeof gutterObject.cols === 'number') {
|
|
67
|
+
result.cols = gutterObject.cols;
|
|
68
|
+
}
|
|
69
|
+
else if (Array.isArray(gutterObject.cols)) {
|
|
70
|
+
result.cols = processBreakpoints(gutterObject.cols, containerWidth) || null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
result.cols = null;
|
|
75
|
+
}
|
|
76
|
+
if (gutterObject.rows !== undefined) {
|
|
77
|
+
if (typeof gutterObject.rows === 'number') {
|
|
78
|
+
result.rows = gutterObject.rows;
|
|
79
|
+
}
|
|
80
|
+
else if (Array.isArray(gutterObject.rows)) {
|
|
81
|
+
result.rows = processBreakpoints(gutterObject.rows, containerWidth) || null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
result.rows = null;
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* @hidden
|
|
93
|
+
*
|
|
94
|
+
* Calculates column span value based on responsive breakpoints or fixed number
|
|
95
|
+
*/
|
|
96
|
+
export const calculateColSpan = (colSpan, containerWidth) => {
|
|
97
|
+
if (!colSpan) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (typeof colSpan === 'number') {
|
|
101
|
+
return colSpan;
|
|
102
|
+
}
|
|
103
|
+
else if (Array.isArray(colSpan) && colSpan.length > 0) {
|
|
104
|
+
return processBreakpoints(colSpan, containerWidth);
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* @hidden
|
|
110
|
+
*
|
|
111
|
+
* Generates CSS class names for columns
|
|
112
|
+
*/
|
|
113
|
+
export const generateColumnClass = (columnsNumber) => {
|
|
114
|
+
return columnsNumber && columnsNumber > 0 ? `k-grid-cols-${columnsNumber}` : '';
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* @hidden
|
|
118
|
+
*
|
|
119
|
+
* Generates CSS class names for gutters
|
|
120
|
+
*/
|
|
121
|
+
export const generateGutterClasses = (gutters) => {
|
|
122
|
+
return {
|
|
123
|
+
rows: gutters?.rows ? `k-gap-y-${gutters.rows}` : '',
|
|
124
|
+
cols: gutters?.cols ? `k-gap-x-${gutters.cols}` : ''
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* @hidden
|
|
129
|
+
*
|
|
130
|
+
* Generates CSS class name for column span
|
|
131
|
+
*/
|
|
132
|
+
export const generateColSpanClass = (colSpan) => {
|
|
133
|
+
return colSpan ? `k-col-span-${colSpan}` : '';
|
|
134
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { NgModule } from '@angular/core';
|
|
6
|
+
import { KENDO_FORM } from './directives';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
import * as i1 from "./form/form.component";
|
|
9
|
+
import * as i2 from "./form/formseparator.component";
|
|
10
|
+
import * as i3 from "./formfieldset/formfieldset.component";
|
|
11
|
+
import * as i4 from "./formfield/formfield.component";
|
|
12
|
+
import * as i5 from "./formfield/hint.component";
|
|
13
|
+
import * as i6 from "./formfield/error.component";
|
|
14
|
+
//IMPORTANT: NgModule export kept for backwards compatibility
|
|
15
|
+
/**
|
|
16
|
+
* Defines the [NgModule](link:site.data.urls.angular['ngmoduleapi']) for the FormField, Error, and Hint components.
|
|
17
|
+
*
|
|
18
|
+
* Use this module to add Form features to your NgModule-based Angular application.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { FormModule } from '@progress/kendo-angular-inputs';
|
|
23
|
+
* import { NgModule } from '@angular/core';
|
|
24
|
+
* import { BrowserModule } from '@angular/platform-browser';
|
|
25
|
+
* import { AppComponent } from './app.component';
|
|
26
|
+
*
|
|
27
|
+
* @NgModule({
|
|
28
|
+
* declarations: [AppComponent],
|
|
29
|
+
* imports: [BrowserModule, FormModule],
|
|
30
|
+
* bootstrap: [AppComponent]
|
|
31
|
+
* })
|
|
32
|
+
* export class AppModule {}
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export class FormModule {
|
|
36
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
37
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FormModule, imports: [i1.FormComponent, i2.FormSeparatorComponent, i3.FormFieldSetComponent, i4.FormFieldComponent, i5.HintComponent, i6.ErrorComponent], exports: [i1.FormComponent, i2.FormSeparatorComponent, i3.FormFieldSetComponent, i4.FormFieldComponent, i5.HintComponent, i6.ErrorComponent] });
|
|
38
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormModule, imports: [i1.FormComponent] });
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FormModule, decorators: [{
|
|
41
|
+
type: NgModule,
|
|
42
|
+
args: [{
|
|
43
|
+
imports: [...KENDO_FORM],
|
|
44
|
+
exports: [...KENDO_FORM]
|
|
45
|
+
}]
|
|
46
|
+
}] });
|