gd-bs 6.6.70 → 6.6.71
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/build/components/form/control.js +5 -5
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +11 -11
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/form/control.ts +6 -5
- package/src/components/form/controlTypes.d.ts +11 -11
package/package.json
CHANGED
|
@@ -681,6 +681,12 @@ export class FormControl implements IFormControl {
|
|
|
681
681
|
let elControl = (this._cb || this._ddl || this._lb || this._tb) ? (this._cb || this._ddl || this._lb || this._tb).el : this._el;
|
|
682
682
|
let value = this.getValue();
|
|
683
683
|
|
|
684
|
+
// See if this is a checkbox
|
|
685
|
+
if(this._cb) {
|
|
686
|
+
// Update the value to the selected items
|
|
687
|
+
value = (value as ICheckboxGroupValue).selectedItems;
|
|
688
|
+
}
|
|
689
|
+
|
|
684
690
|
// See if this control is required
|
|
685
691
|
if (this._props.required) {
|
|
686
692
|
// See if a value doesn't exists
|
|
@@ -693,11 +699,6 @@ export class FormControl implements IFormControl {
|
|
|
693
699
|
// Set the flag
|
|
694
700
|
validation.isValid = value.length > 0;
|
|
695
701
|
}
|
|
696
|
-
// Else, see if this is a checkbox
|
|
697
|
-
else if (this._cb) {
|
|
698
|
-
// Set the flag
|
|
699
|
-
validation.isValid = (value as ICheckboxGroupValue).selectedItems ? true : false;
|
|
700
|
-
}
|
|
701
702
|
}
|
|
702
703
|
|
|
703
704
|
// See if an event exists
|
|
@@ -84,7 +84,7 @@ export interface IFormControlProps extends IBaseProps<IFormControl> {
|
|
|
84
84
|
onControlRendering?: (control: IFormControlProps) => void | PromiseLike<IFormControlProps>;
|
|
85
85
|
onControlRendered?: (control: IFormControl) => void | PromiseLike<IFormControl>;
|
|
86
86
|
onGetValue?: (control: IFormControlProps) => any;
|
|
87
|
-
onValidate?: (control: IFormControlProps,
|
|
87
|
+
onValidate?: (control: IFormControlProps, results: IFormControlValidationResult) => boolean | IFormControlValidationResult;
|
|
88
88
|
required?: boolean;
|
|
89
89
|
title?: string;
|
|
90
90
|
type?: number;
|
|
@@ -104,7 +104,7 @@ export interface IFormControlPropsCheckbox extends IFormControlProps {
|
|
|
104
104
|
onChange?: (selectedItem: ICheckboxGroupItem, allItems?: Array<ICheckboxGroupItem>, ev?: Event) => void;
|
|
105
105
|
onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
|
|
106
106
|
onGetValue?: (control: IFormControlPropsCheckbox) => any;
|
|
107
|
-
onValidate?: (control: IFormControlPropsCheckbox,
|
|
107
|
+
onValidate?: (control: IFormControlPropsCheckbox, results: IFormControlValidationResult<ICheckboxGroupItem>, allItems?: Array<ICheckboxGroupItem>) => boolean | IFormControlValidationResult<ICheckboxGroupItem>;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -116,7 +116,7 @@ export interface IFormControlPropsDropdown extends IFormControlProps {
|
|
|
116
116
|
onControlRendering?: (control: IFormControlPropsDropdown) => void | PromiseLike<IFormControlPropsDropdown>;
|
|
117
117
|
onGetValue?: (control: IFormControlPropsDropdown) => any;
|
|
118
118
|
onMenuRendering?: (props: IPopoverProps) => IPopoverProps;
|
|
119
|
-
onValidate?: (control: IFormControlPropsDropdown,
|
|
119
|
+
onValidate?: (control: IFormControlPropsDropdown, results: IFormControlValidationResult<IDropdownItem>) => boolean | IFormControlValidationResult<IDropdownItem>;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
@@ -140,7 +140,7 @@ export interface IFormControlPropsListBox extends IFormControlProps {
|
|
|
140
140
|
onChange?: (items: IDropdownItem, ev?: Event) => void;
|
|
141
141
|
onControlRendering?: (control: IFormControlPropsListBox) => void | PromiseLike<IFormControlPropsListBox>;
|
|
142
142
|
onGetValue?: (control: IFormControlPropsListBox) => any;
|
|
143
|
-
onValidate?: (control: IFormControlPropsListBox,
|
|
143
|
+
onValidate?: (control: IFormControlPropsListBox, results: IFormControlValidationResult<IDropdownItem>) => boolean | IFormControlValidationResult<IDropdownItem>;
|
|
144
144
|
placeholder?: string;
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -156,7 +156,7 @@ export interface IFormControlPropsMultiCheckbox extends IFormControlProps {
|
|
|
156
156
|
onChange?: (selectedItems: Array<ICheckboxGroupItem>, allItems?: Array<ICheckboxGroupItem>, ev?: Event) => void;
|
|
157
157
|
onControlRendering?: (control: IFormControlPropsCheckbox) => void | PromiseLike<IFormControlPropsCheckbox>;
|
|
158
158
|
onGetValue?: (control: IFormControlPropsCheckbox) => any;
|
|
159
|
-
onValidate?: (control: IFormControlPropsCheckbox,
|
|
159
|
+
onValidate?: (control: IFormControlPropsCheckbox, results: IFormControlValidationResult<Array<ICheckboxGroupItem>>, allItems?: Array<ICheckboxGroupItem>) => boolean | IFormControlValidationResult<Array<ICheckboxGroupItem>>;
|
|
160
160
|
renderRow?: boolean;
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -169,7 +169,7 @@ export interface IFormControlPropsMultiDropdown extends IFormControlProps {
|
|
|
169
169
|
onControlRendering?: (control: IFormControlPropsDropdown) => void | PromiseLike<IFormControlPropsDropdown>;
|
|
170
170
|
onGetValue?: (control: IFormControlPropsDropdown) => any;
|
|
171
171
|
onMenuRendering?: (props: IPopoverProps) => IPopoverProps;
|
|
172
|
-
onValidate?: (control: IFormControlPropsDropdown,
|
|
172
|
+
onValidate?: (control: IFormControlPropsDropdown, results: IFormControlValidationResult<Array<IDropdownItem>>) => boolean | IFormControlValidationResult<Array<IDropdownItem>>;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/**
|
|
@@ -193,7 +193,7 @@ export interface IFormControlPropsMultiListBox extends IFormControlProps {
|
|
|
193
193
|
onChange?: (items: Array<IDropdownItem>, ev?: Event) => void;
|
|
194
194
|
onControlRendering?: (control: IFormControlPropsListBox) => void | PromiseLike<IFormControlPropsListBox>;
|
|
195
195
|
onGetValue?: (control: IFormControlPropsListBox) => any;
|
|
196
|
-
onValidate?: (control: IFormControlPropsListBox,
|
|
196
|
+
onValidate?: (control: IFormControlPropsListBox, results: IFormControlValidationResult<Array<IDropdownItem>>) => boolean | IFormControlValidationResult<Array<IDropdownItem>>;
|
|
197
197
|
placeholder?: string;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -210,7 +210,7 @@ export interface IFormControlPropsNumberField extends IFormControlPropsTextField
|
|
|
210
210
|
min?: number;
|
|
211
211
|
onControlRendering?: (control: IFormControlPropsNumberField) => void | PromiseLike<IFormControlPropsNumberField>;
|
|
212
212
|
onGetValue?: (control: IFormControlPropsNumberField) => any;
|
|
213
|
-
onValidate?: (control: IFormControlPropsNumberField,
|
|
213
|
+
onValidate?: (control: IFormControlPropsNumberField, results: IFormControlValidationResult<string>) => boolean | IFormControlValidationResult<string>;
|
|
214
214
|
step?: number;
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -233,7 +233,7 @@ export interface IFormControlPropsTextField extends IFormControlProps {
|
|
|
233
233
|
onChange?: (value: string, ev?: Event) => void;
|
|
234
234
|
onControlRendering?: (control: IFormControlPropsTextField) => void | PromiseLike<IFormControlPropsTextField>;
|
|
235
235
|
onGetValue?: (control: IFormControlPropsTextField) => any;
|
|
236
|
-
onValidate?: (control: IFormControlPropsTextField,
|
|
236
|
+
onValidate?: (control: IFormControlPropsTextField, results: IFormControlValidationResult<string>) => boolean | IFormControlValidationResult<string>;
|
|
237
237
|
placeholder?: string;
|
|
238
238
|
prependedLabel?: string;
|
|
239
239
|
rows?: number;
|
|
@@ -271,9 +271,9 @@ export type IFormControlTypes = {
|
|
|
271
271
|
/**
|
|
272
272
|
* Form Control Validation Result
|
|
273
273
|
*/
|
|
274
|
-
export interface IFormControlValidationResult {
|
|
274
|
+
export interface IFormControlValidationResult<T = any> {
|
|
275
275
|
invalidMessage?: string;
|
|
276
276
|
isValid?: boolean;
|
|
277
277
|
validMessage?: string;
|
|
278
|
-
value?:
|
|
278
|
+
value?: T;
|
|
279
279
|
}
|