Skip to content

Commit

Permalink
Merge pull request #270 from IgniteUI/dkamburov/fix-262
Browse files Browse the repository at this point in the history
 Update editor methods and change the way of defining method getters
  • Loading branch information
mpavlinov committed May 28, 2018
2 parents aa13a72 + 64db1dc commit 2a998d8
Show file tree
Hide file tree
Showing 10 changed files with 680 additions and 235 deletions.
17 changes: 8 additions & 9 deletions src/igcontrolbase/igcontrolbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,14 @@ export class IgControlBase<Model> implements DoCheck {
}
}

var propNames = Object.getOwnPropertyNames(jQuery.ui[this._widgetName].prototype);
for(var i = 0; i < propNames.length; i++) {
var name = propNames[i];
if(name.indexOf("_") !== 0 && typeof jQuery.ui[this._widgetName].prototype[name] === "function"
&& name !== "dataSource"){
Object.defineProperty(that, name, {
get: that.createMethodGetter(name)
});
}
var propNames = jQuery.ui[this._widgetName].prototype;
for(var name in propNames ) {
if(name.indexOf("_") !== 0 && typeof jQuery.ui[this._widgetName].prototype[name] === "function"
&& name !== "dataSource"){
Object.defineProperty(that, name, {
get: that.createMethodGetter(name)
});
}
}
//events binding
for (var propt in jQuery.ui[this._widgetName].prototype.events) {
Expand Down
76 changes: 65 additions & 11 deletions src/igeditors/igcheckboxeditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,77 @@ export class IgCheckboxEditorComponent extends IgEditorBase<IgCheckboxEditor> {
constructor(el: ElementRef, renderer: Renderer, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef, @Optional() public model: NgModel) { super(el, renderer, differs, kvalDiffers, cdr, model); }

/**
* Checks if the value in the editor is valid. Note: This function will not trigger automatic notifications.
* Checks if the value in the editor is valid. Note: This function will not trigger automatic notifications.
*/
public isValid(): boolean { return; } ;
public isValid(): boolean {return;};

/**
* Gets/Sets Current checked state/Value of the igCheckboxEditor that will be submitted by the HTML form.
* 1. If the [value](ui.igcheckboxeditor#options:value) option IS NOT defined, then 'value' method will match the checked state of the editor.
* This option is used when the checkbox is intended to operate as a Boolean editor. In that case the return type is bool.
* 2. If the [value](ui.igcheckboxeditor#options:value) option IS defined, then 'value' method will return the value that will be submitted when the editor is checked and the form is submitted.
* To get checked state regardless of the 'value' option, use $(".selector").igCheckboxEditor("option", "checked");
* Gets/Sets Current checked state/Value of the igCheckboxEditor that will be submitted by the HTML form.
* 1. If the [value](ui.igcheckboxeditor#options:value) option IS NOT defined, then 'value' method will match the checked state of the editor.
* This option is used when the checkbox is intended to operate as a Boolean editor. In that case the return type is bool.
* 2. If the [value](ui.igcheckboxeditor#options:value) option IS defined, then 'value' method will return the value that will be submitted when the editor is checked and the form is submitted.
* To get checked state regardless of the 'value' option, use $(".selector").igCheckboxEditor("option", "checked");
*
* @param newValue
* @param newValue
*/
public value(newValue: Object): string { return; } ;
public value(newValue: Object): string {return;};

/**
* Toggles the state of the checkbox.
* Toggles the state of the checkbox.
*/
public toggle(): void { return; } ;
public toggle(): void {return;};

/**
* Gets/Sets name attribute applied to the editor element.
*
* @param newValue The new input name.
*/
public inputName(newValue?: string): string {return;};

/**
* Gets the input element of the editor.
*/
public field(): string {return;};

/**
* Gets a reference to the jQuery element that wraps the editor.
*/
public editorContainer(): string {return;};

/**
* Gets whether the editor has focus.
*/
public hasFocus(): boolean {return;};

/**
* Sets focus to the editor after the specified delay.
*
* @param delay The delay before focusing the editor.
*/
public setFocus(delay?: number): void {return;};

/**
* Hides the editor.
*/
public hide(): void {return;};

/**
* Shows the editor.
*/
public show(): void {return;};

/**
* Gets a reference to [igValidator](ui.igvalidator) used by the editor.
*/
public validator(): Object {return;};

/**
* Triggers validation for the editor. If validatorOptions are set will also call validate on the [igValidator](ui.igvalidator).
*/
public validate(): boolean {return;};

/**
* Destroys the widget
*/
public destroy(): void {return;};
}
58 changes: 55 additions & 3 deletions src/igeditors/igcurrencyeditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,61 @@ export class IgCurrencyEditorComponent extends IgEditorBase<IgCurrencyEditor> {
constructor(el: ElementRef, renderer: Renderer, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef, @Optional() public model: NgModel) { super(el, renderer, differs, kvalDiffers, cdr, model); }

/**
* Gets/sets a string that is used as the currency symbol shown with the number in the input. The value provided as a param is propagated to the currencySymbol option and thus has the same priority as the option.
* Gets/sets a string that is used as the currency symbol shown with the number in the input. The value provided as a param is propagated to the currencySymbol option and thus has the same priority as the option.
*
* @param symbol New currency symbol.
* @param symbol New currency symbol.
*/
public currencySymbol(symbol?: Object): string { return; } ;
public currencySymbol(symbol?: Object): string {return;};

/**
* Gets/Sets editor value.
*
* @param newValue New editor value.
*/
public value(newValue?: number): number {return;};

/**
* Finds index of list item by text that matches with the search parameters.
*
* @param number The text to search for.
*/
public findListItemIndex(number: number): number {return;};
public getSelectedText(): void {return;};
public getSelectionStart(): void {return;};
public getSelectionEnd(): void {return;};

/**
* Increments value in editor according to the parameter or selects the previous item from the drop-down list if [isLimitedToListValues](ui.%%WidgetNameLowered%%#options:isLimitedToListValues) is enabled.
*
* @param delta Increments value.
*/
public spinUp(delta?: number): void {return;};

/**
* Decrements value in editor according to the parameter selects the next item from the drop-down list if [isLimitedToListValues](ui.%%WidgetNameLowered%%#options:isLimitedToListValues) is enabled.
*
* @param delta Decrement value.
*/
public spinDown(delta?: number): void {return;};

/**
* This method is deprecated in favor of [spinUp](ui.%%WidgetNameLowered%%#options:spinUp).
*/
public selectListIndexUp(): void {return;};

/**
* This method is deprecated in favor of [spinDown](ui.%%WidgetNameLowered%%#options:spinDown).
*/
public selectListIndexDown(): void {return;};

/**
* Gets current regional.
*/
public getRegionalOption(): string {return;};

/**
* Changes the the regional settings of widget element to the language specified in [options.regional](ui.ignumericeditor#options:regional)
* Note that this method is for rare scenarios, use [regional](ui.ignumericeditor#options:regional) option setter
*/
public changeRegional(): void {return;};
}
68 changes: 38 additions & 30 deletions src/igeditors/igdateeditor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,60 +12,68 @@ export class IgDateEditorComponent extends IgEditorBase<IgDateEditor> {
constructor(el: ElementRef, renderer: Renderer, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef, @Optional() public model: NgModel) { super(el, renderer, differs, kvalDiffers, cdr, model); }

/**
* Gets/Sets editor value.
*
* Note! This option doesn't use the displayInputFormat to extract the date
* Changes the the regional settings of widget element to the language specified in [options.regional](ui.igdateeditor#options:regional)
* Note that this method is for rare scenarios, use [regional](ui.igdateeditor#options:regional) option setter
*/
public changeRegional(): void {return;};

/**
* Gets/Sets editor value.
*
* Note! This option doesn't use the dateInputFormat to extract the date
*
* @param newValue New editor value. Date object can be set as value. String value can be passed and the editor will use the javascript Date object constructor to create date object and will use it for the comparison. MVC date format can be used too. For example Date(/"thicks"/).
* @param newValue New editor value. Date object can be set as value. String value can be passed and the editor will use the javascript Date object constructor to create date object and will use it for the comparison. MVC date format can be used too. For example Date(/"thicks"/).
*/
public value(newValue?: Object): Object { return; } ;
public value(newValue?: Date): Date {return;};

/**
* Gets selected date as a date object. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() method will not return date object and getSelectedDate() can be used to replace that functionality.
* Gets selected date as a date object. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() method will not return date object and getSelectedDate() can be used to replace that functionality.
*/
public getSelectedDate(): Object { return; } ;
public getSelectedDate(): Date {return;};

/**
* Sets selected date. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() cannot accept a date object as a new value and getSelectedDate() can be used to replace that functionality.
* Sets selected date. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() cannot accept a date object as a new value and getSelectedDate() can be used to replace that functionality.
*
* @param date
* @param date
*/
public selectDate(date: Object): void { return; } ;
public selectDate(date: Date): void {return;};

/**
* Increases the date or time period, depending on the current cursor position.
* Increases the date or time period, depending on the current cursor position.
*
* @param delta The increase delta.
* @param delta The increase delta.
*/
public spinUp(delta?: number): void { return; } ;
public spinUp(delta?: number): void {return;};

/**
* Decreases the date or time period, depending on the current cursor position.
* Decreases the date or time period, depending on the current cursor position.
*
* @param delta The decrease delta.
* @param delta The decrease delta.
*/
public spinDown(delta?: number): void { return; } ;
public spinDown(delta?: number): void {return;};

/**
* Returns a reference to the spin up UI element of the editor.
* Returns a reference to the spin up UI element of the editor.
*/
public spinUpButton(): string { return; } ;
public spinUpButton(): string {return;};

/**
* Returns a reference to the spin down UI element of the editor.
* Returns a reference to the spin down UI element of the editor.
*/
public spinDownButton(): string { return; } ;
public spinDownButton(): string {return;};

/**
* Checks if the value in the editor is valid. Note: This function will not trigger automatic notifications.
* Checks if the value in the editor is valid. Note: This function will not trigger automatic notifications.
*/
public isValid(): boolean { return; } ;
public dropDownButton(): void { return; } ;
public dropDownContainer(): void { return; } ;
public dropDownVisible(): void { return; } ;
public findListItemIndex(): void { return; } ;
public getSelectedListItem(): void { return; } ;
public selectedListIndex(): void { return; } ;
public isValid(): boolean {return;};
public dropDownButton(): void {return;};
public dropDownContainer(): void {return;};
public dropDownVisible(): void {return;};
public findListItemIndex(): void {return;};
public getSelectedListItem(): void {return;};
public selectedListIndex(): void {return;};
public showDropDown(): void {return;};
public hideDropDown(): void {return;};
}
89 changes: 73 additions & 16 deletions src/igeditors/igdatepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,95 @@ import { NgModel } from "@angular/forms";
})
export class IgDatePickerComponent extends IgEditorBase<IgDatePicker> {
constructor(el: ElementRef, renderer: Renderer, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef, @Optional() public model: NgModel) { super(el, renderer, differs, kvalDiffers, cdr, model); }
/**
* Changes the the regional settings of widget element to the language specified in [options.regional](ui.igdatepicker#options:regional)
* Note that this method is for rare scenarios, use [regional](ui.igdatepicker#options:regional) option setter
*/
public changeRegional(): void {return;};

/**
* Returns a reference to the jQuery calendar used as a picker selector
*/
public getCalendar(): string {return;};
public dropDownContainer(): void {return;};
public findListItemIndex(): void {return;};
public getSelectedListItem(): void {return;};
public selectedListIndex(): void {return;};

/**
* Shows the drop down list.
*/
public showDropDown(): void {return;};

/**
* Hides the drop down list.
*/
public hideDropDown(): void {return;};

/**
* Returns a reference to the calendar button UI element of the editor.
*/
public dropDownButton(): string {return;};

/**
* Returns the visibility state of the calendar.
*/
public dropDownVisible(): boolean {return;};

/**
* Destroys the widget
*/
public destroy(): void {return;};

/**
* Gets/Sets editor value.
*
* Note! This option doesn't use the dateInputFormat to extract the date
*
* @param newValue New editor value. Date object can be set as value. String value can be passed and the editor will use the javascript Date object constructor to create date object and will use it for the comparison. MVC date format can be used too. For example Date(/"thicks"/).
*/
public value(newValue?: Date): Date {return;};

/**
* Gets selected date as a date object. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() method will not return date object and getSelectedDate() can be used to replace that functionality.
*/
public getSelectedDate(): Date {return;};

/**
* Returns a reference to the jQuery calendar used as a picker selector
* Sets selected date. This method can be used when dataMode is set as either displayModeText or editModeText.
* In such cases the value() cannot accept a date object as a new value and getSelectedDate() can be used to replace that functionality.
*
* @param date
*/
public getCalendar(): string { return; } ;
public dropDownContainer(): void { return; } ;
public findListItemIndex(): void { return; } ;
public getSelectedListItem(): void { return; } ;
public selectedListIndex(): void { return; } ;
public selectDate(date: Date): void {return;};

/**
* Shows the drop down list.
* Increases the date or time period, depending on the current cursor position.
*
* @param delta The increase delta.
*/
public showDropDown(): void { return; } ;
public spinUp(delta?: number): void {return;};

/**
* Hides the drop down list.
* Decreases the date or time period, depending on the current cursor position.
*
* @param delta The decrease delta.
*/
public hideDropDown(): void { return; } ;
public spinDown(delta?: number): void {return;};

/**
* Returns a reference to the calendar button UI element of the editor.
* Returns a reference to the spin up UI element of the editor.
*/
public dropDownButton(): string { return; } ;
public spinUpButton(): string {return;};

/**
* Returns the visibility state of the calendar.
* Returns a reference to the spin down UI element of the editor.
*/
public dropDownVisible(): boolean { return; } ;
public spinDownButton(): string {return;};

/**
* Destroys the widget
* Checks if the value in the editor is valid. Note: This function will not trigger automatic notifications.
*/
public destroy(): void { return; } ;
public isValid(): boolean {return;};
}
Loading

0 comments on commit 2a998d8

Please sign in to comment.