@simpleangularcontrols/sac-common 10.0.0-rc.12 → 10.0.0-rc.13

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.
Files changed (40) hide show
  1. package/bundles/simpleangularcontrols-sac-common.umd.js +356 -408
  2. package/bundles/simpleangularcontrols-sac-common.umd.js.map +1 -1
  3. package/bundles/simpleangularcontrols-sac-common.umd.min.js +1 -1
  4. package/bundles/simpleangularcontrols-sac-common.umd.min.js.map +1 -1
  5. package/common/basemodelcontrol.d.ts +4 -8
  6. package/controls/contextmenu/contextmenu.d.ts +26 -19
  7. package/controls/contextmenu/contextmenu.interface.d.ts +3 -0
  8. package/controls/contextmenu/contextmenuitem.d.ts +5 -0
  9. package/controls/contextmenu/contextmenuitembutton.d.ts +21 -20
  10. package/controls/treeview/treeview.d.ts +87 -121
  11. package/esm2015/common/basemodelcontrol.js +28 -24
  12. package/esm2015/controls/contextmenu/contextmenu.interface.js +1 -0
  13. package/esm2015/controls/contextmenu/contextmenu.interface.ngfactory.js +7 -0
  14. package/esm2015/controls/contextmenu/contextmenu.js +22 -23
  15. package/esm2015/controls/contextmenu/contextmenuitem.js +13 -2
  16. package/esm2015/controls/contextmenu/contextmenuitembutton.js +34 -25
  17. package/esm2015/controls/treeview/treeview.js +232 -247
  18. package/esm2015/interfaces/ISacIconService.js +1 -1
  19. package/esm2015/interfaces/treeviewaction.interface.js +1 -0
  20. package/esm2015/interfaces/treeviewaction.interface.ngfactory.js +7 -0
  21. package/esm2015/public_api.js +4 -5
  22. package/esm2015/services/sac-icon.service.js +25 -1
  23. package/fesm2015/simpleangularcontrols-sac-common.js +343 -389
  24. package/fesm2015/simpleangularcontrols-sac-common.js.map +1 -1
  25. package/interfaces/ISacIconService.d.ts +16 -0
  26. package/interfaces/treeviewaction.interface.d.ts +4 -0
  27. package/package.json +1 -1
  28. package/public_api.d.ts +3 -4
  29. package/services/sac-icon.service.d.ts +33 -1
  30. package/simpleangularcontrols-sac-common-10.0.0-rc.13.tgz +0 -0
  31. package/simpleangularcontrols-sac-common.metadata.json +1 -1
  32. package/controls/treeview/ngtreeitemaction.d.ts +0 -40
  33. package/controls/treeview/treeviewchild.d.ts +0 -12
  34. package/esm2015/controls/treeview/ngtreeitemaction.js +0 -60
  35. package/esm2015/controls/treeview/ngtreeitemaction.ngfactory.js +0 -7
  36. package/esm2015/controls/treeview/treeviewchild.js +0 -18
  37. package/esm2015/controls/treeview/treeviewchild.ngfactory.js +0 -7
  38. package/simpleangularcontrols-sac-common-10.0.0-rc.12.tgz +0 -0
  39. /package/controls/{treeview/ngtreeitemaction.ngfactory.d.ts → contextmenu/contextmenu.interface.ngfactory.d.ts} +0 -0
  40. /package/{controls/treeview/treeviewchild.ngfactory.d.ts → interfaces/treeviewaction.interface.ngfactory.d.ts} +0 -0
@@ -1,6 +1,3 @@
1
- import { Observable } from 'rxjs';
2
- import { AfterViewInit, Injector, OnInit } from '@angular/core';
3
- import { AbstractControl, ControlValueAccessor, FormControl, ValidationErrors, Validator } from '@angular/forms';
4
1
  import { SacFormLayoutCommon } from '../controls/layout/formlayout';
5
2
  import { ControlHeight } from '../enums/ControlHeight';
6
3
  import { ISacConfigurationService } from '../interfaces/ISacConfigurationService';
@@ -8,10 +5,13 @@ import { ISacIconService } from '../interfaces/ISacIconService';
8
5
  import { ISacLabelSizes } from '../interfaces/ISacLabelSizes';
9
6
  import { ISacLocalisationService } from '../interfaces/ISacLocalisationService';
10
7
  import { ISacValidationKeyService } from '../interfaces/ISacValidationKeyService';
8
+ import { Injector, OnInit } from '@angular/core';
9
+ import { AbstractControl, ControlValueAccessor, FormControl, ValidationErrors, Validator } from '@angular/forms';
10
+ import { Observable } from 'rxjs';
11
11
  /**
12
12
  * Abstract Klasse für SacBaseModelControl. Implements ControlValueAccessor, Validator, OnInit
13
13
  */
14
- export declare abstract class SacBaseModelControl<VALUE> implements ControlValueAccessor, Validator, OnInit, AfterViewInit {
14
+ export declare abstract class SacBaseModelControl<VALUE> implements ControlValueAccessor, Validator, OnInit {
15
15
  private readonly injector;
16
16
  /**
17
17
  * Inline Errors für das Control
@@ -200,10 +200,6 @@ export declare abstract class SacBaseModelControl<VALUE> implements ControlValue
200
200
  * Methode ergibt Error anhand von gegebenen Kriterien
201
201
  */
202
202
  GetErrorMessage(): Observable<string>;
203
- /**
204
- * In Angular 10 the Control Label for Reactive Forms can be set first time here. With Angular 13 is supported by init in OnInit
205
- */
206
- ngAfterViewInit(): void;
207
203
  /**
208
204
  * Init Event
209
205
  */
@@ -1,34 +1,36 @@
1
- import { ElementRef, Injector, NgZone, OnDestroy, Renderer2, TemplateRef } from '@angular/core';
2
1
  import { ISacIconService } from '../../interfaces/ISacIconService';
3
2
  import { PlacementArray } from '../../utilities/positioning';
3
+ import { ISacContextmenuCommon } from './contextmenu.interface';
4
+ import { SacContextmenuItemCommon } from './contextmenuitem';
5
+ import { AfterContentInit, ElementRef, Injector, NgZone, OnDestroy, QueryList, Renderer2, TemplateRef } from '@angular/core';
4
6
  /**
5
7
  * Base Context Menü Element. Die Logik wurde aus NG-BOOTSTRAP übernommen.
6
8
  */
7
- export declare class SacContextmenuCommon implements OnDestroy {
8
- private document;
9
- private ngZone;
10
- private elementRef;
11
- private renderer;
9
+ export declare class SacContextmenuCommon implements ISacContextmenuCommon, AfterContentInit, OnDestroy {
10
+ private readonly document;
11
+ private readonly ngZone;
12
+ private readonly elementRef;
13
+ private readonly renderer;
12
14
  /**
13
- * Button für Open/Close Event aus Template
15
+ * Button für Open/Close Event
14
16
  */
15
- private _anchorTemplate;
17
+ private readonly _anchor;
16
18
  /**
17
- * Button für Open/Close Event
19
+ * Button für Open/Close Event aus Template
18
20
  */
19
- private _anchor;
21
+ private readonly _anchorTemplate;
20
22
  /**
21
23
  * Container Element für Dropdown
22
24
  */
23
- private _menu;
25
+ private readonly _menu;
24
26
  /**
25
- * Body HTML Element
27
+ * Zone Subscription für Postitonierung des Elements
26
28
  */
27
- private bodyContainer;
29
+ private readonly zoneSubscription;
28
30
  /**
29
- * Zone Subscription für Postitonierung des Elements
31
+ * Body HTML Element
30
32
  */
31
- private zoneSubscription;
33
+ private bodyContainer;
32
34
  /**
33
35
  * icon service
34
36
  */
@@ -49,6 +51,10 @@ export declare class SacContextmenuCommon implements OnDestroy {
49
51
  * Definiert ob das Dropdown offen ist.
50
52
  */
51
53
  isopen: boolean;
54
+ /**
55
+ * All directly assigned context menu elements that are defined in the direct template for the context menu.
56
+ */
57
+ menuitems: QueryList<SacContextmenuItemCommon>;
52
58
  /**
53
59
  * The preferred placement of the dropdown.
54
60
  *
@@ -76,18 +82,19 @@ export declare class SacContextmenuCommon implements OnDestroy {
76
82
  * icon for default context menü button
77
83
  */
78
84
  get IconContextMenu(): string;
79
- /**
80
- * HostListener um das Dropdown zu schliessen wenn nicht auf das Element geklickt wird.
81
- */
82
- onClick(targetElement: any): void;
83
85
  /**
84
86
  * Schliesst das Dropdown
85
87
  */
86
88
  close(): void;
89
+ ngAfterContentInit(): void;
87
90
  /**
88
91
  * Event wenn Component entfernt wird.
89
92
  */
90
93
  ngOnDestroy(): void;
94
+ /**
95
+ * HostListener um das Dropdown zu schliessen wenn nicht auf das Element geklickt wird.
96
+ */
97
+ onClick(targetElement: any): void;
91
98
  /**
92
99
  * Öffnet das Dropdown / Zeigt das Menü an.
93
100
  */
@@ -0,0 +1,3 @@
1
+ export interface ISacContextmenuCommon {
2
+ close(): void;
3
+ }
@@ -1,5 +1,10 @@
1
+ import { ISacContextmenuCommon } from './contextmenu.interface';
1
2
  /**
2
3
  * Base Context Menu Item
3
4
  */
4
5
  export declare class SacContextmenuItemCommon {
6
+ /**
7
+ * Reference to the higher-level context menu. This property is always set automatically by the context menu. However, it may be necessary to set the reference manually.
8
+ */
9
+ contextmenu: ISacContextmenuCommon | null;
5
10
  }
@@ -1,16 +1,9 @@
1
- import { EventEmitter } from '@angular/core';
2
- import { SacContextmenuCommon } from './contextmenu';
3
1
  import { SacContextmenuItemCommon } from './contextmenuitem';
2
+ import { EventEmitter } from '@angular/core';
4
3
  /**
5
4
  * Base Context Menu Button Item
6
5
  */
7
6
  export declare class SacContextmenuItemButtonCommon extends SacContextmenuItemCommon {
8
- protected contextmenu: SacContextmenuCommon;
9
- /**
10
- * Constructor
11
- * @param contextmenu Instance of Context Menü.
12
- */
13
- constructor(contextmenu: SacContextmenuCommon);
14
7
  /**
15
8
  * Menu Item ist deaktiviert
16
9
  */
@@ -20,13 +13,17 @@ export declare class SacContextmenuItemButtonCommon extends SacContextmenuItemCo
20
13
  */
21
14
  protected _isicondisabled: boolean;
22
15
  /**
23
- * Icon für Menü
16
+ * Event wenn auf den Button geklickt wird
24
17
  */
25
- icon: string;
18
+ clicked: EventEmitter<void>;
26
19
  /**
27
20
  * css class for button styling
28
21
  */
29
22
  cssclass: string;
23
+ /**
24
+ * Icon für Menü
25
+ */
26
+ icon: string;
30
27
  /**
31
28
  * Input Property für Styling des Buttons. Definiert die Css Klassen des Buttons
32
29
  */
@@ -36,29 +33,33 @@ export declare class SacContextmenuItemButtonCommon extends SacContextmenuItemCo
36
33
  */
37
34
  image: string;
38
35
  /**
39
- * Menu Item ist deaktiviert
36
+ * name of button. used for generate id and name
40
37
  */
41
- set isdisabled(v: boolean | string);
38
+ name: string;
39
+ /**
40
+ * Text für Menü Item.
41
+ */
42
+ text: string;
43
+ /**
44
+ * Constructor
45
+ */
46
+ constructor();
42
47
  /**
43
48
  * Menu Item ist deaktiviert
44
49
  */
45
50
  get isdisabled(): boolean | string;
46
51
  /**
47
- * Icon Column in Menü ist deaktiviert
52
+ * Menu Item ist deaktiviert
48
53
  */
49
- set isicondisabled(v: boolean | string);
54
+ set isdisabled(v: boolean | string);
50
55
  /**
51
56
  * Icon Column in Menü ist deaktiviert
52
57
  */
53
58
  get isicondisabled(): boolean | string;
54
59
  /**
55
- * Text für Menü Item.
56
- */
57
- text: string;
58
- /**
59
- * Event wenn auf den Button geklickt wird
60
+ * Icon Column in Menü ist deaktiviert
60
61
  */
61
- clicked: EventEmitter<void>;
62
+ set isicondisabled(v: boolean | string);
62
63
  /**
63
64
  * Die Methode wird das cklickaction Emitter aktivieren
64
65
  */
@@ -1,185 +1,151 @@
1
- import { EventEmitter, OnInit, TemplateRef } from '@angular/core';
1
+ import { SacBaseModelControl } from '../../common/basemodelcontrol';
2
+ import { TreeviewAction } from '../../interfaces/treeviewaction.interface';
3
+ import { SacFormLayoutCommon } from '../layout/formlayout';
4
+ import { EventEmitter, Injector, TemplateRef } from '@angular/core';
5
+ import { AbstractControl, ValidationErrors } from '@angular/forms';
2
6
  /**
3
7
  * Basis Komponente für SacTreeView
4
8
  */
5
- export declare class SacTreeViewCommon implements OnInit {
9
+ export declare class SacTreeviewCommon extends SacBaseModelControl<any> {
6
10
  /**
7
- * Das Property enthielt boolean Wert und deffiniert, ob alle Items collapsed sind. Default value: undefined/null
11
+ * Event when Action is clicked on Node. An object of the type 'TreeviewAction' is returned. In the default case, 'action' in this object is always the value 'default'. The value can be changed via the 'templateaction'.
8
12
  */
9
- _collapseAll: boolean;
13
+ actionclicked: EventEmitter<TreeviewAction>;
10
14
  /**
11
- * Das Property enthielt boolean Wert und deffiniert, ob alle Items selected sind. Default value: undefined/null
15
+ * Property on the data object that contains the children of the structure element. Must be an array of objects. The default value is 'children'
12
16
  */
13
- private _selectAll;
17
+ attrchildren: string;
14
18
  /**
15
- * Das Property enthielt array of nodes. Default value: empty array [].
19
+ * Defines the property on the 'data' object with which the actions for a node can be deactivated. A 'disabled' property is used by default.
16
20
  */
17
- nodes: any[];
21
+ attrdisableaction: string;
18
22
  /**
19
- * Das Property enthielt node attribute: 'isCollapsed'. Es wird benutzt beim rendering. Für Expand/Collapsed Sicht des Node(Wert)
23
+ * Property on the 'data' object that stores the expanded state. Property must be of type boolean. Default is 'expanded'
20
24
  */
21
- collapseAttr: string;
25
+ attrexanded: string;
22
26
  /**
23
- * Das Property enthielt node attribute: 'isSelected'. Es wird benutzt beim Vorbereitung des Data des TreeView
27
+ * Property for saving the HoverState on the field. If the property is not present on the node, it is automatically created and removed again. The value can usually be left at the default value unless there is a conflict with a property on the node that is required for other purposes.
24
28
  */
25
- selectAttr: string;
29
+ attrhoverstate: string;
26
30
  /**
27
- * Das Property enthielt node attribute: 'isIndeterminate'. Es wird benutzt beim Vorbereitung des Data des TreeView
31
+ * Property on 'data' object, which contains the icon for the node. By default, the property is not set, which hides the icon in the node.
28
32
  */
29
- inDeterminateAttr: string;
33
+ attricon: string | null;
30
34
  /**
31
- * Providen data for tree.
35
+ * property on the 'data' object contains an ID of the node. The default is 'id'. If the property is set to NULL, the selectedId event is no longer triggered.
32
36
  */
33
- private _data;
37
+ attrid: string | null;
34
38
  /**
35
- * Getter für Data des TreeView
39
+ * Property on 'data' object, which contains the label for the node. Default is 'label'
36
40
  */
37
- get data(): any[];
41
+ attrlabel: string;
38
42
  /**
39
- * Input Property für Data des TreeView
43
+ * Property on 'data' object, which defines whether the node is selected or not. It should be ensured that only 1 node has the value for Selected set to true. Default is 'selected'.
40
44
  */
41
- set data(value: any[]);
45
+ attrselected: string;
42
46
  /**
43
- * Input Property für template des TreeView. Type: TemplateRef<any>.
47
+ * Event when a node is collapsed. Returns the node element as a parameter
44
48
  */
45
- template: TemplateRef<any>;
49
+ collabsed: EventEmitter<any>;
46
50
  /**
47
- * Die Directive erhält die actions für das TreeView
51
+ * The property contains an array of nodes. The data must already map the tree via child properties.
48
52
  */
49
- set treeviewTemplate(v: TemplateRef<any>);
53
+ data: any[];
50
54
  /**
51
- * Getter für das TreeView Template
55
+ * Activates the 'expand' and 'collabse' event even if a node has no children. This is helpful if node elements are to be reloaded at runtime.
52
56
  */
53
- get treeviewTemplate(): TemplateRef<any>;
57
+ enableasynchload: boolean | string;
54
58
  /**
55
- * Input property erhält Icon für das Template
59
+ * Activates Ellipsis on the node labels
56
60
  */
57
- fileicontemplate: TemplateRef<any>;
61
+ enableellipsis: boolean;
58
62
  /**
59
- * Setter property. Deffiniert das FileIcon für das TreeView
63
+ * Event when a node is expanded. Returns the node element as a parameter
60
64
  */
61
- set treefileicon(v: TemplateRef<any>);
65
+ expanded: EventEmitter<any>;
62
66
  /**
63
- * Getter property. Ergibt das FileIcon für das TreeView
67
+ * Defines whether an icon for the expanded/collapsed status should be displayed.
64
68
  */
65
- get treefileicon(): TemplateRef<any>;
69
+ expandedstate: boolean | string;
66
70
  /**
67
- * Input property für den Namen des TreeView. Type string. Default value: ""
71
+ * A node must be selected
68
72
  */
69
- name: string;
70
- /**
71
- * A flag indicating data is flatten in array and prepare is required.(Default
72
- * is false).
73
- */
74
- prepareData: boolean;
75
- /**
76
- * Attribute for Text in Tree
77
- */
78
- textAttr: string;
79
- /**
80
- * Name of ID property in input data.
81
- */
82
- idAttr: string;
83
- /**
84
- * Name of parent property in input data.
85
- */
86
- parentAttr: string;
87
- /**
88
- * Name of children list property in input data.
89
- */
90
- childrenAttr: string;
91
- /**
92
- * Title des Treeview
93
- */
94
- title: any;
95
- /**
96
- * Collapse or expand all parent nodes.
97
- */
98
- set collapseall(value: boolean);
99
- /**
100
- * Getter für das collapse property. Ergibt boolean Wert, ob die Items collapsed/expand sind.
101
- */
102
- get collapseall(): boolean;
103
- /**
104
- * Select or deselect all nodes.
105
- */
106
- set selectall(value: boolean);
107
- /**
108
- * Input property - setter. Deffiniert das ID des selektierten Item(node)
109
- */
110
- set selectedid(v: any);
73
+ isrequired: boolean;
111
74
  /**
112
- * Getter. Ergibt das ID des selektierten Item(node)
75
+ * Name of the TreeView control
113
76
  */
114
- get selectedId(): any;
115
- /**
116
- * Das Property erhält das selektierte Wert(node). Default value: undefined/null
117
- */
118
- private _selectedNode;
119
- /**
120
- * Setter für das selektierte Wert(node). Wenn aufgerufen das ID und TextAttr des selected Node wird emitted
121
- */
122
- set selectedNode(v: any);
123
- /**
124
- * Getter für das selektierte Wert(node). Ergibt das selektierte Wert(node).
125
- */
126
- get selectedNode(): any;
77
+ name: string;
127
78
  /**
128
- * Output Emitter. Emit das ID des selected Node.
79
+ * Event when a node is selected. Returns the id attribute as a parameter. The event is not triggered if 'attrid' is not set.
129
80
  */
130
- selectedidchange: EventEmitter<any>;
81
+ selected: EventEmitter<any>;
131
82
  /**
132
- * Output Emitter. Emit das TextAttr des selected Node.
83
+ * Event when a node is selected. Returns the node element as a parameter.
133
84
  */
134
- selectedtextchanged: EventEmitter<string>;
85
+ selectednode: EventEmitter<any>;
135
86
  /**
136
- * Output Emitter. Emit wenn ein Node selektiert wird.
87
+ * Defines that the action template is displayed independently of the selected state. If the value is 'true', the action template is displayed for every element.
137
88
  */
138
- selecteditem: EventEmitter<string>;
89
+ showactionalways: any;
139
90
  /**
140
- * A lifecycle hook that is called after Angular has initialized all data-bound properties of a directive.
141
- * Define an ngOnInit() method to handle any additional initialization tasks.
91
+ * Custom template for actions per node. Template parameters are: 'node'
142
92
  */
143
- ngOnInit(): void;
93
+ templateaction: TemplateRef<any>;
144
94
  /**
145
- * Funktion setzt alle parent items recusiv zum selected node
146
- * auf collapsed = false
95
+ * Custom template for the label area per node. Template parameters are: 'node' and 'label'
147
96
  */
148
- private openSelectedNode;
97
+ templatelabel: TemplateRef<any>;
149
98
  /**
150
- * Die Methode vorbereitet die Daten für das TreeView. Die Funktion sollte geändert werden abhängig von dem kommenden Daten (wenn array)
99
+ * Resource Key für Validation Message Required bei Control
151
100
  */
152
- private LoadTree;
101
+ validationmessagerequired: string;
153
102
  /**
154
- * Die Methode collapse/expand den selectierten Node
103
+ * Resource Key für Validation Message Required in Validation Summary
155
104
  */
156
- onCollapseClick(node: any): void;
105
+ validationmessagesummaryrequired: string;
157
106
  /**
158
- * Die Methode set den selektierten Node und emit es.
107
+ * Constructor
108
+ * @param injector Service Injector
159
109
  */
160
- onClick(node: any): void;
110
+ constructor(formlayout: SacFormLayoutCommon, injector: Injector);
111
+ get iconAction(): string;
161
112
  /**
162
- * Die Methode wird ein event mit Meldung zu Parent emit-en.
113
+ * CSS icon for folders in tree there are collabsed
114
+ * @returns css class with icon
163
115
  */
164
- sendMsgToParent(msg: any): void;
116
+ get iconFolderCollabsed(): string;
165
117
  /**
166
- * Die Methode wird alle Nodes collapse
118
+ * CSS icon class for folders without subfolders
119
+ * @returns css class with icon
167
120
  */
168
- collapseAllNode(command: any): void;
121
+ get iconFolderEmpty(): string;
169
122
  /**
170
- * Funktion gibt node aus der liste zurück, welches das Value auf dem gewünschten Attribut hat
171
- * Wenn node nicht gefunden wird, wird null zurück gegeben
172
- * @param data Liste der nodes
173
- * @param searchValue Das gesuchte value
174
- * @param attr Der namen des Attributs auf dem das value gesucht wird
123
+ * CSS icon for folders in tree there are expanded
124
+ * @returns css class with icon
175
125
  */
176
- private findNode;
126
+ get iconFolderOpen(): string;
177
127
  /**
178
- * Die Methode editiert (recursive) alle eingegebene Nodes abhängig von gegebenen Attibute und Value Kriterien.
128
+ * Creates an array of a certain size. Is required for a For in the UI, as Angular does not support counting loops
129
+ * @param size Size of the array
130
+ * @returns Array
179
131
  */
180
- private _recursiveEdit;
132
+ count(size: number): Array<void>;
133
+ getChildren(node: any): any[];
134
+ getStringField(node: any, fieldname: string): any;
135
+ hasChildren(node: any): boolean;
136
+ isDisabledState(node: any): boolean;
137
+ isExpandedState(node: any): boolean;
138
+ isHoverState(node: any): boolean;
139
+ isSelectedState(node: any): boolean;
181
140
  /**
182
- * Die Methode erstellt eine standarte Sicht-Liste von Nodes
141
+ * Method is called by clicking an action
142
+ * @param action action and node
183
143
  */
184
- private _getPreparedData;
144
+ onActionClicked(action: TreeviewAction): void;
145
+ onNodeClicked(node: any): void;
146
+ setHoverState(node: any, state: boolean): void;
147
+ setSelectedState(node: any): void;
148
+ validateData(c: AbstractControl): ValidationErrors | null;
149
+ private invertExpandedState;
150
+ private resetSelectedState;
185
151
  }