@huntsman-cancer-institute/input 16.0.1 → 17.0.1
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/date/date-base.d.ts +65 -65
- package/date/date-date-range.component.d.ts +32 -32
- package/date/date-date.component.d.ts +53 -53
- package/date/date-validator.d.ts +17 -17
- package/date/date.module.d.ts +16 -16
- package/dropdown/dropdown-index.d.ts +6 -6
- package/dropdown/dropdown-select-result.component.d.ts +23 -23
- package/dropdown/dropdown-select.component.d.ts +76 -76
- package/dropdown/dropdown.component.d.ts +40 -40
- package/dropdown/dropdown.module.d.ts +13 -13
- package/dropdown/dropdown.service.d.ts +51 -51
- package/dropdown/messages.d.ts +11 -11
- package/dropdown/select-item.d.ts +16 -16
- package/dropdown/template-dropdown.directive.d.ts +12 -12
- package/esm2022/date/date-base.mjs +114 -114
- package/esm2022/date/date-date-range.component.mjs +92 -92
- package/esm2022/date/date-date.component.mjs +189 -189
- package/esm2022/date/date-validator.mjs +40 -40
- package/esm2022/date/date.module.mjs +60 -60
- package/esm2022/dropdown/dropdown-index.mjs +5 -5
- package/esm2022/dropdown/dropdown-select-result.component.mjs +85 -85
- package/esm2022/dropdown/dropdown-select.component.mjs +360 -360
- package/esm2022/dropdown/dropdown.component.mjs +170 -170
- package/esm2022/dropdown/dropdown.module.mjs +50 -50
- package/esm2022/dropdown/dropdown.service.mjs +133 -133
- package/esm2022/dropdown/messages.mjs +9 -9
- package/esm2022/dropdown/select-item.mjs +11 -11
- package/esm2022/dropdown/template-dropdown.directive.mjs +26 -26
- package/esm2022/huntsman-cancer-institute-input.mjs +4 -4
- package/esm2022/index.mjs +19 -19
- package/esm2022/inline/inline.component.mjs +179 -179
- package/esm2022/inline/inline.module.mjs +28 -28
- package/esm2022/search/search.component.mjs +157 -157
- package/esm2022/search/search.module.mjs +32 -32
- package/esm2022/select/custom-combobox.component.mjs +531 -531
- package/esm2022/select/custom-multi-combobox.component.mjs +232 -232
- package/esm2022/select/md-multi-select.component.mjs +127 -127
- package/esm2022/select/md-select.component.mjs +107 -107
- package/esm2022/select/native-select.component.mjs +188 -188
- package/esm2022/select/select.module.mjs +83 -83
- package/fesm2022/huntsman-cancer-institute-input.mjs +2797 -2797
- package/fesm2022/huntsman-cancer-institute-input.mjs.map +1 -1
- package/index.d.ts +20 -20
- package/inline/inline.component.d.ts +66 -66
- package/inline/inline.module.d.ts +9 -9
- package/package.json +7 -7
- package/search/search.component.d.ts +42 -42
- package/search/search.module.d.ts +10 -10
- package/select/custom-combobox.component.d.ts +98 -98
- package/select/custom-multi-combobox.component.d.ts +50 -50
- package/select/md-multi-select.component.d.ts +32 -32
- package/select/md-select.component.d.ts +30 -30
- package/select/native-select.component.d.ts +37 -37
- package/select/select.module.d.ts +21 -21
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { EventEmitter, OnInit } from "@angular/core";
|
|
2
|
-
import { UntypedFormBuilder, UntypedFormGroup } from "@angular/forms";
|
|
3
|
-
import { Observable } from "rxjs";
|
|
4
|
-
import { DropdownService } from "./dropdown.service";
|
|
5
|
-
import { SelectItem } from "./select-item";
|
|
6
|
-
import { DropdownSelectComponent } from "./dropdown-select.component";
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
export declare class DropdownComponent implements OnInit {
|
|
9
|
-
private dropdownService;
|
|
10
|
-
private formBuilder;
|
|
11
|
-
dropdownForm: UntypedFormGroup;
|
|
12
|
-
getItems: (ids: any[]) => Observable<Object[]>;
|
|
13
|
-
listItems: (item: string) => Observable<Object[]>;
|
|
14
|
-
listItemsMax: (item: string, ids: any[]) => Observable<Object[]>;
|
|
15
|
-
entityToSelectItem: (entity: Object) => SelectItem;
|
|
16
|
-
count: number;
|
|
17
|
-
inputSingleData: Object;
|
|
18
|
-
inputMultiData: Object[];
|
|
19
|
-
modifiedData: Object[];
|
|
20
|
-
optionData: Object[];
|
|
21
|
-
displayField: string;
|
|
22
|
-
displayId: any;
|
|
23
|
-
dataUrl: string;
|
|
24
|
-
dropdownType: any;
|
|
25
|
-
placeholder: string;
|
|
26
|
-
isDisabled: boolean;
|
|
27
|
-
inputSingleDataChange: EventEmitter<any>;
|
|
28
|
-
inputMultiDataChange: EventEmitter<any>;
|
|
29
|
-
dropdownSingle: DropdownSelectComponent;
|
|
30
|
-
constructor(dropdownService: DropdownService, formBuilder: UntypedFormBuilder);
|
|
31
|
-
ngOnInit(): void;
|
|
32
|
-
onSelect(item: SelectItem): void;
|
|
33
|
-
onRemove(item: SelectItem): void;
|
|
34
|
-
reset(): void;
|
|
35
|
-
send(formJson: string): void;
|
|
36
|
-
private initDropdownItem;
|
|
37
|
-
private initDropdownForm;
|
|
38
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
|
|
39
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "hci-dropdown", never, { "inputSingleData": { "alias": "inputSingleData"; "required": false; }; "inputMultiData": { "alias": "inputMultiData"; "required": false; }; "modifiedData": { "alias": "modifiedData"; "required": false; }; "optionData": { "alias": "optionData"; "required": false; }; "displayField": { "alias": "displayField"; "required": false; }; "displayId": { "alias": "displayId"; "required": false; }; "dataUrl": { "alias": "dataUrl"; "required": false; }; "dropdownType": { "alias": "dropdownType"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; }, { "inputSingleDataChange": "inputSingleDataChange"; "inputMultiDataChange": "inputMultiDataChange"; }, never, never, false, never>;
|
|
40
|
-
}
|
|
1
|
+
import { EventEmitter, OnInit } from "@angular/core";
|
|
2
|
+
import { UntypedFormBuilder, UntypedFormGroup } from "@angular/forms";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { DropdownService } from "./dropdown.service";
|
|
5
|
+
import { SelectItem } from "./select-item";
|
|
6
|
+
import { DropdownSelectComponent } from "./dropdown-select.component";
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class DropdownComponent implements OnInit {
|
|
9
|
+
private dropdownService;
|
|
10
|
+
private formBuilder;
|
|
11
|
+
dropdownForm: UntypedFormGroup;
|
|
12
|
+
getItems: (ids: any[]) => Observable<Object[]>;
|
|
13
|
+
listItems: (item: string) => Observable<Object[]>;
|
|
14
|
+
listItemsMax: (item: string, ids: any[]) => Observable<Object[]>;
|
|
15
|
+
entityToSelectItem: (entity: Object) => SelectItem;
|
|
16
|
+
count: number;
|
|
17
|
+
inputSingleData: Object;
|
|
18
|
+
inputMultiData: Object[];
|
|
19
|
+
modifiedData: Object[];
|
|
20
|
+
optionData: Object[];
|
|
21
|
+
displayField: string;
|
|
22
|
+
displayId: any;
|
|
23
|
+
dataUrl: string;
|
|
24
|
+
dropdownType: any;
|
|
25
|
+
placeholder: string;
|
|
26
|
+
isDisabled: boolean;
|
|
27
|
+
inputSingleDataChange: EventEmitter<any>;
|
|
28
|
+
inputMultiDataChange: EventEmitter<any>;
|
|
29
|
+
dropdownSingle: DropdownSelectComponent;
|
|
30
|
+
constructor(dropdownService: DropdownService, formBuilder: UntypedFormBuilder);
|
|
31
|
+
ngOnInit(): void;
|
|
32
|
+
onSelect(item: SelectItem): void;
|
|
33
|
+
onRemove(item: SelectItem): void;
|
|
34
|
+
reset(): void;
|
|
35
|
+
send(formJson: string): void;
|
|
36
|
+
private initDropdownItem;
|
|
37
|
+
private initDropdownForm;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
|
|
39
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "hci-dropdown", never, { "inputSingleData": { "alias": "inputSingleData"; "required": false; }; "inputMultiData": { "alias": "inputMultiData"; "required": false; }; "modifiedData": { "alias": "modifiedData"; "required": false; }; "optionData": { "alias": "optionData"; "required": false; }; "displayField": { "alias": "displayField"; "required": false; }; "displayId": { "alias": "displayId"; "required": false; }; "dataUrl": { "alias": "dataUrl"; "required": false; }; "dropdownType": { "alias": "dropdownType"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; }, { "inputSingleDataChange": "inputSingleDataChange"; "inputMultiDataChange": "inputMultiDataChange"; }, never, never, false, never>;
|
|
40
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as i0 from "@angular/core";
|
|
2
|
-
import * as i1 from "./template-dropdown.directive";
|
|
3
|
-
import * as i2 from "./dropdown-select.component";
|
|
4
|
-
import * as i3 from "./dropdown.component";
|
|
5
|
-
import * as i4 from "./dropdown-select-result.component";
|
|
6
|
-
import * as i5 from "@angular/common";
|
|
7
|
-
import * as i6 from "@angular/forms";
|
|
8
|
-
import * as i7 from "@ng-bootstrap/ng-bootstrap";
|
|
9
|
-
export declare class DropdownModule {
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownModule, never>;
|
|
11
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DropdownModule, [typeof i1.TemplateDropdownDirective, typeof i2.DropdownSelectComponent, typeof i3.DropdownComponent, typeof i4.DropdownSelectResultComponent], [typeof i5.CommonModule, typeof i6.FormsModule, typeof i6.ReactiveFormsModule, typeof i7.NgbModule], [typeof i1.TemplateDropdownDirective, typeof i2.DropdownSelectComponent, typeof i3.DropdownComponent, typeof i4.DropdownSelectResultComponent]>;
|
|
12
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<DropdownModule>;
|
|
13
|
-
}
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./template-dropdown.directive";
|
|
3
|
+
import * as i2 from "./dropdown-select.component";
|
|
4
|
+
import * as i3 from "./dropdown.component";
|
|
5
|
+
import * as i4 from "./dropdown-select-result.component";
|
|
6
|
+
import * as i5 from "@angular/common";
|
|
7
|
+
import * as i6 from "@angular/forms";
|
|
8
|
+
import * as i7 from "@ng-bootstrap/ng-bootstrap";
|
|
9
|
+
export declare class DropdownModule {
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownModule, never>;
|
|
11
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DropdownModule, [typeof i1.TemplateDropdownDirective, typeof i2.DropdownSelectComponent, typeof i3.DropdownComponent, typeof i4.DropdownSelectResultComponent], [typeof i5.CommonModule, typeof i6.FormsModule, typeof i6.ReactiveFormsModule, typeof i7.NgbModule], [typeof i1.TemplateDropdownDirective, typeof i2.DropdownSelectComponent, typeof i3.DropdownComponent, typeof i4.DropdownSelectResultComponent]>;
|
|
12
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DropdownModule>;
|
|
13
|
+
}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { HttpClient } from "@angular/common/http";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare const DROPDOWN_TYPE: Readonly<{
|
|
5
|
-
INPUT_SINGLE: 0;
|
|
6
|
-
INPUT_MULTI: 1;
|
|
7
|
-
SELECT_SINGLE: 2;
|
|
8
|
-
SELECT_MULTI: 3;
|
|
9
|
-
SELECT_SINGLE_CUSTOM: 4;
|
|
10
|
-
SELECT_MULTI_CUSTOM: 5;
|
|
11
|
-
}>;
|
|
12
|
-
export declare class DropdownService {
|
|
13
|
-
private http;
|
|
14
|
-
private dictionaryEndpoint;
|
|
15
|
-
listField: string[];
|
|
16
|
-
DICTIONARY_ENDPOINT: string;
|
|
17
|
-
private headers;
|
|
18
|
-
private options;
|
|
19
|
-
sortFunction: (dropdownObj1: Object, dropdownObj2: Object) => number;
|
|
20
|
-
constructor(http: HttpClient, dictionaryEndpoint: string);
|
|
21
|
-
/**
|
|
22
|
-
* Get a list of data from the given object or url to set to the dropdown list.
|
|
23
|
-
* @param {string} urlStr
|
|
24
|
-
* @param {Object[]} dataObject
|
|
25
|
-
* @param {string} displayField
|
|
26
|
-
* @returns {any[]}
|
|
27
|
-
*/
|
|
28
|
-
setData(urlStr: string, dataObject: Object[], displayField: string): any[];
|
|
29
|
-
listData(pattern: string, dataSet: any[], maxResults?: number): Observable<Object[]>;
|
|
30
|
-
/**
|
|
31
|
-
* Get the max list data
|
|
32
|
-
* @param {string} pattern
|
|
33
|
-
* @param {number} maxResults
|
|
34
|
-
* @param {any[]} dataSet
|
|
35
|
-
* @returns {Observable<{count: number; results: Object[]}>}
|
|
36
|
-
*/
|
|
37
|
-
listDataMax(pattern: string, maxResults: number, dataSet: any[]): Observable<{
|
|
38
|
-
count: number;
|
|
39
|
-
results: Object[];
|
|
40
|
-
}>;
|
|
41
|
-
/**
|
|
42
|
-
* Push the selected items to a list to show in the input text area.
|
|
43
|
-
* @param {any[]} ids
|
|
44
|
-
* @param {any[]} dataSet
|
|
45
|
-
* @returns {Observable<Object[]>}
|
|
46
|
-
*/
|
|
47
|
-
getItems(ids: any[], dataSet: any[]): Observable<Object[]>;
|
|
48
|
-
getDataList(urlStr: string): Observable<any>;
|
|
49
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownService, never>;
|
|
50
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<DropdownService>;
|
|
51
|
-
}
|
|
1
|
+
import { HttpClient } from "@angular/common/http";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare const DROPDOWN_TYPE: Readonly<{
|
|
5
|
+
INPUT_SINGLE: 0;
|
|
6
|
+
INPUT_MULTI: 1;
|
|
7
|
+
SELECT_SINGLE: 2;
|
|
8
|
+
SELECT_MULTI: 3;
|
|
9
|
+
SELECT_SINGLE_CUSTOM: 4;
|
|
10
|
+
SELECT_MULTI_CUSTOM: 5;
|
|
11
|
+
}>;
|
|
12
|
+
export declare class DropdownService {
|
|
13
|
+
private http;
|
|
14
|
+
private dictionaryEndpoint;
|
|
15
|
+
listField: string[];
|
|
16
|
+
DICTIONARY_ENDPOINT: string;
|
|
17
|
+
private headers;
|
|
18
|
+
private options;
|
|
19
|
+
sortFunction: (dropdownObj1: Object, dropdownObj2: Object) => number;
|
|
20
|
+
constructor(http: HttpClient, dictionaryEndpoint: string);
|
|
21
|
+
/**
|
|
22
|
+
* Get a list of data from the given object or url to set to the dropdown list.
|
|
23
|
+
* @param {string} urlStr
|
|
24
|
+
* @param {Object[]} dataObject
|
|
25
|
+
* @param {string} displayField
|
|
26
|
+
* @returns {any[]}
|
|
27
|
+
*/
|
|
28
|
+
setData(urlStr: string, dataObject: Object[], displayField: string): any[];
|
|
29
|
+
listData(pattern: string, dataSet: any[], maxResults?: number): Observable<Object[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get the max list data
|
|
32
|
+
* @param {string} pattern
|
|
33
|
+
* @param {number} maxResults
|
|
34
|
+
* @param {any[]} dataSet
|
|
35
|
+
* @returns {Observable<{count: number; results: Object[]}>}
|
|
36
|
+
*/
|
|
37
|
+
listDataMax(pattern: string, maxResults: number, dataSet: any[]): Observable<{
|
|
38
|
+
count: number;
|
|
39
|
+
results: Object[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Push the selected items to a list to show in the input text area.
|
|
43
|
+
* @param {any[]} ids
|
|
44
|
+
* @param {any[]} dataSet
|
|
45
|
+
* @returns {Observable<Object[]>}
|
|
46
|
+
*/
|
|
47
|
+
getItems(ids: any[], dataSet: any[]): Observable<Object[]>;
|
|
48
|
+
getDataList(urlStr: string): Observable<any>;
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownService, never>;
|
|
50
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DropdownService>;
|
|
51
|
+
}
|
package/dropdown/messages.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A model of common messages for dropdown components.
|
|
3
|
-
*
|
|
4
|
-
* @since 5.0.0
|
|
5
|
-
*/
|
|
6
|
-
export declare class Messages {
|
|
7
|
-
static readonly PARTIAL_COUNT_VAR = "%PARTIAL_COUNT%";
|
|
8
|
-
static readonly TOTAL_COUNT_VAR = "%TOTAL_COUNT%";
|
|
9
|
-
moreResultsMsg?: string;
|
|
10
|
-
noResultsMsg?: string;
|
|
11
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* A model of common messages for dropdown components.
|
|
3
|
+
*
|
|
4
|
+
* @since 5.0.0
|
|
5
|
+
*/
|
|
6
|
+
export declare class Messages {
|
|
7
|
+
static readonly PARTIAL_COUNT_VAR = "%PARTIAL_COUNT%";
|
|
8
|
+
static readonly TOTAL_COUNT_VAR = "%TOTAL_COUNT%";
|
|
9
|
+
moreResultsMsg?: string;
|
|
10
|
+
noResultsMsg?: string;
|
|
11
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: A model of common data for dropdown components.
|
|
3
|
-
* @since 5.0.0
|
|
4
|
-
*/
|
|
5
|
-
export interface SelectItem {
|
|
6
|
-
id: any;
|
|
7
|
-
text: string;
|
|
8
|
-
entity?: any;
|
|
9
|
-
}
|
|
10
|
-
export declare const KEY_CODE: Readonly<{
|
|
11
|
-
DOWN_ARROW: 40;
|
|
12
|
-
UP_ARROW: 38;
|
|
13
|
-
ENTER: 13;
|
|
14
|
-
TAB: 9;
|
|
15
|
-
DELETE: 8;
|
|
16
|
-
}>;
|
|
1
|
+
/**
|
|
2
|
+
* @description: A model of common data for dropdown components.
|
|
3
|
+
* @since 5.0.0
|
|
4
|
+
*/
|
|
5
|
+
export interface SelectItem {
|
|
6
|
+
id: any;
|
|
7
|
+
text: string;
|
|
8
|
+
entity?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare const KEY_CODE: Readonly<{
|
|
11
|
+
DOWN_ARROW: 40;
|
|
12
|
+
UP_ARROW: 38;
|
|
13
|
+
ENTER: 13;
|
|
14
|
+
TAB: 9;
|
|
15
|
+
DELETE: 8;
|
|
16
|
+
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TemplateRef } from "@angular/core";
|
|
2
|
-
import { DropdownSelectComponent } from "./dropdown-select.component";
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
/**
|
|
5
|
-
* A customized template for Dropdown list items.
|
|
6
|
-
*/
|
|
7
|
-
export declare class TemplateDropdownDirective<T> {
|
|
8
|
-
private templateRef;
|
|
9
|
-
constructor(templateRef: TemplateRef<T>, host: DropdownSelectComponent);
|
|
10
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TemplateDropdownDirective<any>, [null, { host: true; }]>;
|
|
11
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateDropdownDirective<any>, "[appTemplateDropdown]", never, {}, {}, never, never, false, never>;
|
|
12
|
-
}
|
|
1
|
+
import { TemplateRef } from "@angular/core";
|
|
2
|
+
import { DropdownSelectComponent } from "./dropdown-select.component";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* A customized template for Dropdown list items.
|
|
6
|
+
*/
|
|
7
|
+
export declare class TemplateDropdownDirective<T> {
|
|
8
|
+
private templateRef;
|
|
9
|
+
constructor(templateRef: TemplateRef<T>, host: DropdownSelectComponent);
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TemplateDropdownDirective<any>, [null, { host: true; }]>;
|
|
11
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TemplateDropdownDirective<any>, "[appTemplateDropdown]", never, {}, {}, never, never, false, never>;
|
|
12
|
+
}
|
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
3
|
-
*
|
|
4
|
-
* Extending class works like in Java except that decorators are only scanned in the child class. In this case,
|
|
5
|
-
* we want variables like inputData to be available to all inline components that extend this class; however, we want
|
|
6
|
-
* this variable to be an @Input.
|
|
7
|
-
* What we can do here is define "inputData: Object" here and in the extending class, define "@Input inputData: Object".
|
|
8
|
-
*
|
|
9
|
-
* The two way binding to the component is inputData. To allow non-saving modification to this data, we copy
|
|
10
|
-
* it to modifiedData. The wrapped component such as input/select/... then use modifiedData as their ngModel.
|
|
11
|
-
* When we cancel out of editing, modifiedData is ignored and replaced with inputData. When editing is saved, inputData
|
|
12
|
-
* is replaced with modifiedData.
|
|
13
|
-
*
|
|
14
|
-
* @since 1.0.0
|
|
15
|
-
*/
|
|
16
|
-
import { ElementRef, Injectable } from "@angular/core";
|
|
17
|
-
import * as i0 from "@angular/core";
|
|
18
|
-
export class DateBase {
|
|
19
|
-
constructor(elementRef) {
|
|
20
|
-
this.state = 0;
|
|
21
|
-
this._el = elementRef.nativeElement;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Listen to clicks on the document. If the state is in edit mode and there is a click outside the element,
|
|
25
|
-
* then save it.
|
|
26
|
-
*
|
|
27
|
-
* @param event
|
|
28
|
-
*/
|
|
29
|
-
handleOutsideEvent(event) {
|
|
30
|
-
if (this.state !== 1) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
let targetCmpt = null;
|
|
34
|
-
try {
|
|
35
|
-
// Catch exception if target is not an element
|
|
36
|
-
targetCmpt = event.target;
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
this.save();
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
let inside = false;
|
|
43
|
-
do {
|
|
44
|
-
if (targetCmpt === this._el) {
|
|
45
|
-
inside = true;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
targetCmpt = targetCmpt.parentElement;
|
|
49
|
-
} while (targetCmpt);
|
|
50
|
-
if (!inside) {
|
|
51
|
-
this.save();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Updates the modifiedData (working data) to the bound data.
|
|
56
|
-
*/
|
|
57
|
-
updateInternalDataFromModel() {
|
|
58
|
-
this.modifiedData = this.inputData;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Updates the bound data with the working data.
|
|
62
|
-
*/
|
|
63
|
-
updateModelFromInternalData() {
|
|
64
|
-
this.inputData = this.modifiedData;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* When user chooses to edit, change state to show edit dialog.
|
|
68
|
-
*/
|
|
69
|
-
startEdit() {
|
|
70
|
-
this.modifiedData = this.inputData;
|
|
71
|
-
this.state = 1;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Generic actions to change state based on key input. Escape will cancel out of the edit
|
|
75
|
-
* without saving, enter will save and exit.
|
|
76
|
-
*
|
|
77
|
-
* @param event
|
|
78
|
-
*/
|
|
79
|
-
onKeyDown(event) {
|
|
80
|
-
if (event.key === "escape") {
|
|
81
|
-
this.cancel();
|
|
82
|
-
}
|
|
83
|
-
else if (event.key === "enter") {
|
|
84
|
-
this.save();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
*
|
|
89
|
-
* @param newValue
|
|
90
|
-
*/
|
|
91
|
-
onChange(newValue) {
|
|
92
|
-
this.modifiedData = newValue;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Replace the bound data with the working data and exit editing mode.
|
|
96
|
-
*/
|
|
97
|
-
save() {
|
|
98
|
-
this.updateModelFromInternalData();
|
|
99
|
-
this.state = 0;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Don't update the bound data and exit the editing mode.
|
|
103
|
-
*/
|
|
104
|
-
cancel() {
|
|
105
|
-
this.updateInternalDataFromModel();
|
|
106
|
-
this.state = 0;
|
|
107
|
-
}
|
|
108
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
109
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
110
|
-
}
|
|
111
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
112
|
-
type: Injectable
|
|
113
|
-
}], ctorParameters:
|
|
114
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016 Huntsman Cancer Institute at the University of Utah, Confidential and Proprietary
|
|
3
|
+
*
|
|
4
|
+
* Extending class works like in Java except that decorators are only scanned in the child class. In this case,
|
|
5
|
+
* we want variables like inputData to be available to all inline components that extend this class; however, we want
|
|
6
|
+
* this variable to be an @Input.
|
|
7
|
+
* What we can do here is define "inputData: Object" here and in the extending class, define "@Input inputData: Object".
|
|
8
|
+
*
|
|
9
|
+
* The two way binding to the component is inputData. To allow non-saving modification to this data, we copy
|
|
10
|
+
* it to modifiedData. The wrapped component such as input/select/... then use modifiedData as their ngModel.
|
|
11
|
+
* When we cancel out of editing, modifiedData is ignored and replaced with inputData. When editing is saved, inputData
|
|
12
|
+
* is replaced with modifiedData.
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
import { ElementRef, Injectable } from "@angular/core";
|
|
17
|
+
import * as i0 from "@angular/core";
|
|
18
|
+
export class DateBase {
|
|
19
|
+
constructor(elementRef) {
|
|
20
|
+
this.state = 0;
|
|
21
|
+
this._el = elementRef.nativeElement;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Listen to clicks on the document. If the state is in edit mode and there is a click outside the element,
|
|
25
|
+
* then save it.
|
|
26
|
+
*
|
|
27
|
+
* @param event
|
|
28
|
+
*/
|
|
29
|
+
handleOutsideEvent(event) {
|
|
30
|
+
if (this.state !== 1) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let targetCmpt = null;
|
|
34
|
+
try {
|
|
35
|
+
// Catch exception if target is not an element
|
|
36
|
+
targetCmpt = event.target;
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
this.save();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let inside = false;
|
|
43
|
+
do {
|
|
44
|
+
if (targetCmpt === this._el) {
|
|
45
|
+
inside = true;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
targetCmpt = targetCmpt.parentElement;
|
|
49
|
+
} while (targetCmpt);
|
|
50
|
+
if (!inside) {
|
|
51
|
+
this.save();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Updates the modifiedData (working data) to the bound data.
|
|
56
|
+
*/
|
|
57
|
+
updateInternalDataFromModel() {
|
|
58
|
+
this.modifiedData = this.inputData;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Updates the bound data with the working data.
|
|
62
|
+
*/
|
|
63
|
+
updateModelFromInternalData() {
|
|
64
|
+
this.inputData = this.modifiedData;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* When user chooses to edit, change state to show edit dialog.
|
|
68
|
+
*/
|
|
69
|
+
startEdit() {
|
|
70
|
+
this.modifiedData = this.inputData;
|
|
71
|
+
this.state = 1;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Generic actions to change state based on key input. Escape will cancel out of the edit
|
|
75
|
+
* without saving, enter will save and exit.
|
|
76
|
+
*
|
|
77
|
+
* @param event
|
|
78
|
+
*/
|
|
79
|
+
onKeyDown(event) {
|
|
80
|
+
if (event.key === "escape") {
|
|
81
|
+
this.cancel();
|
|
82
|
+
}
|
|
83
|
+
else if (event.key === "enter") {
|
|
84
|
+
this.save();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param newValue
|
|
90
|
+
*/
|
|
91
|
+
onChange(newValue) {
|
|
92
|
+
this.modifiedData = newValue;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Replace the bound data with the working data and exit editing mode.
|
|
96
|
+
*/
|
|
97
|
+
save() {
|
|
98
|
+
this.updateModelFromInternalData();
|
|
99
|
+
this.state = 0;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Don't update the bound data and exit the editing mode.
|
|
103
|
+
*/
|
|
104
|
+
cancel() {
|
|
105
|
+
this.updateInternalDataFromModel();
|
|
106
|
+
this.state = 0;
|
|
107
|
+
}
|
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DateBase, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
109
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DateBase }); }
|
|
110
|
+
}
|
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.2", ngImport: i0, type: DateBase, decorators: [{
|
|
112
|
+
type: Injectable
|
|
113
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
114
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZS1iYXNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvaW5wdXQvc3JjL2RhdGUvZGF0ZS1iYXNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7OztHQWNHO0FBQ0gsT0FBTyxFQUFDLFVBQVUsRUFBRSxVQUFVLEVBQUMsTUFBTSxlQUFlLENBQUM7O0FBR3JELE1BQU0sT0FBZ0IsUUFBUTtJQVE1QixZQUFZLFVBQXNCO1FBSmxDLFVBQUssR0FBVyxDQUFDLENBQUM7UUFLaEIsSUFBSSxDQUFDLEdBQUcsR0FBRyxVQUFVLENBQUMsYUFBYSxDQUFDO0lBQ3RDLENBQUM7SUFFRDs7Ozs7T0FLRztJQUNJLGtCQUFrQixDQUFDLEtBQVk7UUFDcEMsSUFBSSxJQUFJLENBQUMsS0FBSyxLQUFLLENBQUMsRUFBRSxDQUFDO1lBQ3JCLE9BQU87UUFDVCxDQUFDO1FBQ0QsSUFBSSxVQUFVLEdBQWdCLElBQUksQ0FBQztRQUVuQyxJQUFJLENBQUM7WUFDSCw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