From cd0a2422738365dea3c6b495b2b1dd9260982d0a Mon Sep 17 00:00:00 2001 From: Javier Martin Montull Date: Sun, 23 Apr 2017 16:03:27 +0200 Subject: [PATCH] @Output naming styling * Renames @Output to follow convention from https://angular.io/docs/ts/latest/guide/style-guide.html#!#05-16 --- README.md | 4 ++-- example/app/app.component.html | 2 +- .../add-field-dropdown.component.spec.ts | 4 ++-- src/add-field-dropdown/add-field-dropdown.component.ts | 4 ++-- src/autocomplete-input/autocomplete-input.component.html | 4 ++-- src/autocomplete-input/autocomplete-input.component.ts | 8 ++++---- src/complex-list-field/complex-list-field.component.html | 2 +- src/json-editor.component.html | 6 +++--- src/json-editor.component.ts | 4 ++-- src/list-action-group/list-action-group.component.html | 6 +++--- src/list-action-group/list-action-group.component.ts | 4 ++-- src/object-field/object-field.component.html | 2 +- src/primitive-field/primitive-field.component.html | 4 ++-- .../primitive-list-field.component.html | 2 +- src/searchable-dropdown/searchable-dropdown.component.ts | 5 ++--- src/sub-record/sub-record.component.ts | 4 ++-- src/table-list-field/table-list-field.component.html | 4 ++-- 17 files changed, 34 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index a343047b..f7fb1a84 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,13 @@ Then add it to your module's `imports`. ### Use ```html - + ``` - `config` : configuration object. See [configuration docs](https://inveniosoftware-contrib.github.io/ng2-json-editor/docs/interfaces/_json_editor_config_.jsoneditorconfig.html) for options. - `schema` : valid json-schema for the record. See [json schema limitations](#json-schema-limitations) - `record` : valid json to be edited. -- `onRecordChange` emitted when record change, `$event` is the edited record. +- `recordChange` emitted when record change, `$event` is the edited record. - `errorMap (={})`: errors for individual parts of the record (format should be [errors-map.json](./example/assets/mock-data/error-map.json) - `templates: { [templateName: string]: TemplateRef }`: Templates with name, to be used by configured fields for example autocomplete result item. diff --git a/example/app/app.component.html b/example/app/app.component.html index 6af600c2..6f7e50f0 100644 --- a/example/app/app.component.html +++ b/example/app/app.component.html @@ -13,7 +13,7 @@ \ No newline at end of file diff --git a/src/add-field-dropdown/add-field-dropdown.component.spec.ts b/src/add-field-dropdown/add-field-dropdown.component.spec.ts index bb1f8efd..fab97af2 100644 --- a/src/add-field-dropdown/add-field-dropdown.component.spec.ts +++ b/src/add-field-dropdown/add-field-dropdown.component.spec.ts @@ -99,8 +99,8 @@ describe('AddFieldToObjectDropdownComponent', () => { showDropdownButton.dispatchEvent(new Event('click')); let anchor = nativeEl.querySelector('li a') as HTMLAnchorElement; expect(component.fields.has(anchor.textContent)).toBeFalsy(); - spyOn(component.onFieldAdd, 'emit'); + spyOn(component.fieldAdd, 'emit'); anchor.dispatchEvent(new Event('click')); - expect(component.onFieldAdd.emit).toHaveBeenCalledWith(anchor.textContent); + expect(component.fieldAdd.emit).toHaveBeenCalledWith(anchor.textContent); }); }); diff --git a/src/add-field-dropdown/add-field-dropdown.component.ts b/src/add-field-dropdown/add-field-dropdown.component.ts index b4a7a97a..a601e414 100644 --- a/src/add-field-dropdown/add-field-dropdown.component.ts +++ b/src/add-field-dropdown/add-field-dropdown.component.ts @@ -39,7 +39,7 @@ export class AddFieldDropdownComponent { @Input() fields: Set; @Input() pathString: string; - @Output() onFieldAdd: EventEmitter = new EventEmitter(); + @Output() fieldAdd: EventEmitter = new EventEmitter(); expression = ''; @@ -58,7 +58,7 @@ export class AddFieldDropdownComponent { } onFieldSelect(field: string) { - this.onFieldAdd.emit(field); + this.fieldAdd.emit(field); let newFieldPathString = `${this.pathString}${this.pathUtilService.separator}${field}`; this.domUtilService.focusAndSelectFirstEditableChildById(newFieldPathString); diff --git a/src/autocomplete-input/autocomplete-input.component.html b/src/autocomplete-input/autocomplete-input.component.html index 2674b312..b4fcf970 100644 --- a/src/autocomplete-input/autocomplete-input.component.html +++ b/src/autocomplete-input/autocomplete-input.component.html @@ -1,6 +1,6 @@
-
\ No newline at end of file diff --git a/src/autocomplete-input/autocomplete-input.component.ts b/src/autocomplete-input/autocomplete-input.component.ts index 9f2cab1f..43c8ae8f 100644 --- a/src/autocomplete-input/autocomplete-input.component.ts +++ b/src/autocomplete-input/autocomplete-input.component.ts @@ -45,9 +45,9 @@ export class AutocompleteInputComponent implements OnInit { @Input() tabIndex: number; @Input() placeholder: string; - @Output() onValueChange: EventEmitter = new EventEmitter(); - @Output() onKeypress: EventEmitter = new EventEmitter(); - @Output() onBlur: EventEmitter = new EventEmitter(); + @Output() valueChange: EventEmitter = new EventEmitter(); + @Output() keypress: EventEmitter = new EventEmitter(); + @Output() blur: EventEmitter = new EventEmitter(); dataSource: Observable | Array; typeaheadOptionField: string; @@ -78,7 +78,7 @@ export class AutocompleteInputComponent implements OnInit { onModelChange(value: string) { this.value = value; - this.onValueChange.emit(value); + this.valueChange.emit(value); } onCompletionSelect(completionItem: AutocompletionResult) { diff --git a/src/complex-list-field/complex-list-field.component.html b/src/complex-list-field/complex-list-field.component.html index ba71d2ae..aff9d548 100644 --- a/src/complex-list-field/complex-list-field.component.html +++ b/src/complex-list-field/complex-list-field.component.html @@ -49,7 +49,7 @@ - + diff --git a/src/json-editor.component.html b/src/json-editor.component.html index 0ec8f36c..dffdf5aa 100644 --- a/src/json-editor.component.html +++ b/src/json-editor.component.html @@ -1,7 +1,7 @@