nexheal-lib 0.0.2 → 0.0.3

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 (62) hide show
  1. package/.editorconfig +17 -0
  2. package/.vscode/extensions.json +4 -0
  3. package/.vscode/launch.json +20 -0
  4. package/.vscode/tasks.json +42 -0
  5. package/README.md +15 -19
  6. package/angular.json +36 -0
  7. package/package.json +47 -23
  8. package/projects/nexheal-lib/README.md +63 -0
  9. package/projects/nexheal-lib/ng-package.json +9 -0
  10. package/projects/nexheal-lib/package.json +12 -0
  11. package/projects/nexheal-lib/src/directives/clickoutside.directive.ts +34 -0
  12. package/projects/nexheal-lib/src/lib/controls/autocomplete-control/autocomplete-control.component.html +52 -0
  13. package/projects/nexheal-lib/src/lib/controls/autocomplete-control/autocomplete-control.component.scss +22 -0
  14. package/projects/nexheal-lib/src/lib/controls/autocomplete-control/autocomplete-control.component.spec.ts +22 -0
  15. package/projects/nexheal-lib/src/lib/controls/autocomplete-control/autocomplete-control.component.ts +367 -0
  16. package/projects/nexheal-lib/src/lib/controls/calendar-control/calendar-control.component.html +152 -0
  17. package/projects/nexheal-lib/src/lib/controls/calendar-control/calendar-control.component.scss +194 -0
  18. package/projects/nexheal-lib/src/lib/controls/calendar-control/calendar-control.component.spec.ts +22 -0
  19. package/projects/nexheal-lib/src/lib/controls/calendar-control/calendar-control.component.ts +759 -0
  20. package/projects/nexheal-lib/src/lib/controls/checkbox-control/checkbox-control.component.html +4 -0
  21. package/projects/nexheal-lib/src/lib/controls/checkbox-control/checkbox-control.component.spec.ts +22 -0
  22. package/projects/nexheal-lib/src/lib/controls/checkbox-control/checkbox-control.component.ts +94 -0
  23. package/projects/nexheal-lib/src/lib/controls/input-control/input-control.component.html +61 -0
  24. package/projects/nexheal-lib/src/lib/controls/input-control/input-control.component.scss +132 -0
  25. package/projects/nexheal-lib/src/lib/controls/input-control/input-control.component.spec.ts +22 -0
  26. package/projects/nexheal-lib/src/lib/controls/input-control/input-control.component.ts +202 -0
  27. package/projects/nexheal-lib/src/lib/controls/multiselect-control/multiselect-control.component.html +72 -0
  28. package/projects/nexheal-lib/src/lib/controls/multiselect-control/multiselect-control.component.scss +90 -0
  29. package/projects/nexheal-lib/src/lib/controls/multiselect-control/multiselect-control.component.spec.ts +22 -0
  30. package/projects/nexheal-lib/src/lib/controls/multiselect-control/multiselect-control.component.ts +482 -0
  31. package/projects/nexheal-lib/src/lib/controls/select-control/select-control.component.html +53 -0
  32. package/projects/nexheal-lib/src/lib/controls/select-control/select-control.component.scss +19 -0
  33. package/projects/nexheal-lib/src/lib/controls/select-control/select-control.component.spec.ts +22 -0
  34. package/projects/nexheal-lib/src/lib/controls/select-control/select-control.component.ts +375 -0
  35. package/projects/nexheal-lib/src/lib/controls/switch-control/switch-control.component.html +4 -0
  36. package/projects/nexheal-lib/src/lib/controls/switch-control/switch-control.component.scss +53 -0
  37. package/projects/nexheal-lib/src/lib/controls/switch-control/switch-control.component.spec.ts +22 -0
  38. package/projects/nexheal-lib/src/lib/controls/switch-control/switch-control.component.ts +93 -0
  39. package/projects/nexheal-lib/src/lib/controls/text-editor/text-editor.component.html +88 -0
  40. package/projects/nexheal-lib/src/lib/controls/text-editor/text-editor.component.scss +122 -0
  41. package/projects/nexheal-lib/src/lib/controls/text-editor/text-editor.component.spec.ts +22 -0
  42. package/projects/nexheal-lib/src/lib/controls/text-editor/text-editor.component.ts +314 -0
  43. package/projects/nexheal-lib/src/lib/controls/textarea-control/textarea-control.component.html +19 -0
  44. package/projects/nexheal-lib/src/lib/controls/textarea-control/textarea-control.component.scss +15 -0
  45. package/projects/nexheal-lib/src/lib/controls/textarea-control/textarea-control.component.spec.ts +22 -0
  46. package/projects/nexheal-lib/src/lib/controls/textarea-control/textarea-control.component.ts +83 -0
  47. package/projects/nexheal-lib/src/public-api.ts +13 -0
  48. package/projects/nexheal-lib/src/styles/nexheal.scss +1 -0
  49. package/projects/nexheal-lib/tsconfig.lib.json +18 -0
  50. package/projects/nexheal-lib/tsconfig.lib.prod.json +11 -0
  51. package/projects/nexheal-lib/tsconfig.spec.json +14 -0
  52. package/tsconfig.json +39 -0
  53. package/fesm2022/nexheal-lib.mjs +0 -2837
  54. package/fesm2022/nexheal-lib.mjs.map +0 -1
  55. package/index.d.ts +0 -498
  56. package/src/styles/fonts/icomoon.eot +0 -0
  57. package/src/styles/fonts/icomoon.svg +0 -46
  58. package/src/styles/fonts/icomoon.ttf +0 -0
  59. package/src/styles/fonts/icomoon.woff +0 -0
  60. package/src/styles/icon.css +0 -133
  61. package/src/styles/nexheal.scss +0 -2
  62. /package/{src → projects/nexheal-lib/src}/styles/_formcontrols.scss +0 -0
@@ -0,0 +1,375 @@
1
+ import { CommonModule } from "@angular/common";
2
+ import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnDestroy, ElementRef, ViewChild, SimpleChanges } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR, ControlValueAccessor, ReactiveFormsModule, FormControl } from "@angular/forms";
4
+ import { debounceTime, distinctUntilChanged, Subject, Subscription } from "rxjs";
5
+ import { createPopper, Instance as PopperInstance } from "@popperjs/core";
6
+ import { ClickOutsideDirective } from "../../../directives/clickoutside.directive";
7
+
8
+ @Component({
9
+ selector: "select-control",
10
+ standalone: true,
11
+ imports: [
12
+ CommonModule,
13
+ ReactiveFormsModule,
14
+ ClickOutsideDirective
15
+ ],
16
+ providers: [
17
+ {
18
+ provide: NG_VALUE_ACCESSOR,
19
+ useExisting: forwardRef(() => SelectControl),
20
+ multi: true,
21
+ },
22
+ ],
23
+ templateUrl: "./select-control.component.html",
24
+ styleUrls: ["./select-control.component.scss"],
25
+ })
26
+ export class SelectControl implements ControlValueAccessor, OnInit, OnDestroy {
27
+
28
+ private subscription: Subscription = new Subscription();
29
+
30
+ @Input() optionDisplayProperty: string = "displayname";
31
+ @Input() required: boolean = false;
32
+ @Input() placeholder!: string;
33
+ @Input() customClass!: string;
34
+ @Input() clearVal: boolean = true;
35
+ @Input() deFocus: boolean = true;
36
+ @Input() error: boolean = false;
37
+ @Input() errorMessage: string = "";
38
+ @Input() autocomplete: string = "";
39
+ @Input() inputLoader: boolean = false;
40
+ @Input() isAddNewItem: boolean = false;
41
+ @Output() optionSelected = new EventEmitter<any>();
42
+ @Output() selectionCleared = new EventEmitter<void>();
43
+ @Output() addNewItemClicked: EventEmitter<void> = new EventEmitter<void>();
44
+ @Output() blurEvent = new EventEmitter<void>();
45
+ @Output() optionPatched = new EventEmitter<any>();
46
+
47
+ @Input() title!: string;
48
+ private _options: any[] = [];
49
+ @Input()
50
+ set options(opts: any[]) {
51
+ this._options = opts;
52
+ this.filteredOptions = [...this._options];
53
+ this.highlightSelectedItem();
54
+ this.processValueBuffer();
55
+ }
56
+ get options(): any[] {
57
+ return this._options;
58
+ }
59
+ @Input()
60
+ get disabled(): boolean {
61
+ return this._disabled;
62
+ }
63
+ set disabled(value: boolean) {
64
+ this._disabled = value;
65
+ if (this.inputControl) {
66
+ if (value) {
67
+ this.inputControl.disable({ emitEvent: false });
68
+ } else {
69
+ this.inputControl.enable({ emitEvent: false });
70
+ }
71
+ }
72
+ }
73
+
74
+ @ViewChild("dropdown", { static: false }) dropdown!: ElementRef;
75
+ @ViewChild("input", { static: false }) input!: ElementRef;
76
+
77
+ filteredOptions: any[] = [];
78
+ keySearch: string = "";
79
+ selectedItem: any = null;
80
+ onSearch = new Subject<string>();
81
+ inputControl: FormControl = new FormControl({ value: "", disabled: false });
82
+ isDropdownOpen = false;
83
+ highlightedIndex: number | null = null;
84
+
85
+ private onChange: (value: any) => void = () => { };
86
+ private onTouched: () => void = () => { };
87
+ private valueBuffer: any = null;
88
+ private _disabled: boolean = false;
89
+ private dropdownInitialized = false;
90
+
91
+ private popperInstance!: PopperInstance;
92
+
93
+ ngOnInit() {
94
+ this.subscription = this.onSearch
95
+ .pipe(debounceTime(300), distinctUntilChanged())
96
+ .subscribe((searchText) => {
97
+ this.focusOption(searchText);
98
+ this.keySearch = "";
99
+ });
100
+
101
+ this.filteredOptions = this._options;
102
+
103
+ // Sync the input control value with the selected item
104
+ this.inputControl.valueChanges.subscribe((value) => {
105
+ this.onChange(value);
106
+ });
107
+ }
108
+
109
+ ngAfterViewChecked() {
110
+ if (this.isDropdownOpen && !this.dropdownInitialized) {
111
+ this.createPopperInstance();
112
+ this.dropdownInitialized = true;
113
+ }
114
+ }
115
+
116
+ ngOnChanges(changes: SimpleChanges) {
117
+ if (changes["options"]) {
118
+ this.filteredOptions = [...this._options];
119
+ this.highlightSelectedItem();
120
+ }
121
+ if (changes["disabled"]) {
122
+ this.disabled = changes["disabled"].currentValue;
123
+ }
124
+ }
125
+
126
+ ngOnDestroy() {
127
+ this.subscription.unsubscribe();
128
+ }
129
+
130
+ writeValue(value: any): void {
131
+ if (this.inputControl.disabled !== this.disabled) {
132
+ this.setDisabledState(this.disabled);
133
+ }
134
+ this.valueBuffer = value;
135
+ this.processValueBuffer();
136
+ }
137
+
138
+ processValueBuffer(): void {
139
+ if (
140
+ this.valueBuffer !== null &&
141
+ this._options &&
142
+ this._options.length > 0
143
+ ) {
144
+ // Try to match selected item by ID
145
+ const matchedItem = this._options.find(
146
+ (option) => option.id === this.valueBuffer
147
+ );
148
+
149
+ if (matchedItem) {
150
+ this.selectedItem = matchedItem;
151
+ const displayValue = matchedItem[this.optionDisplayProperty];
152
+ this.inputControl.setValue(displayValue, { emitEvent: false });
153
+ this.filteredOptions = [...this._options];
154
+ this.onTouched();
155
+ this.inputControl.markAsDirty();
156
+ this.optionPatched.emit(this.selectedItem);
157
+ } else {
158
+ // If not found, don't clear the field automatically
159
+ // You may choose to keep it or clear it. Here we clear it.
160
+ this.selectedItem = null;
161
+ this.inputControl.setValue("", { emitEvent: false });
162
+ this.highlightedIndex = null;
163
+ }
164
+ } else if (this.valueBuffer === null) {
165
+ this.selectedItem = null;
166
+ this.inputControl.setValue("", { emitEvent: false });
167
+ this.highlightedIndex = null;
168
+ }
169
+ }
170
+
171
+ registerOnChange(fn: any): void {
172
+ this.onChange = fn;
173
+ }
174
+ registerOnTouched(fn: any): void {
175
+ this.onTouched = fn;
176
+ }
177
+
178
+ // events
179
+ onBlur() {
180
+ this.blurEvent.emit();
181
+ this.onTouched();
182
+ setTimeout(() => {
183
+ this.isDropdownOpen = false;
184
+ }, 300);
185
+ }
186
+ onKeyDown(event: KeyboardEvent) {
187
+ const isAlphabetOrNumberKey = /^[a-zA-Z0-9]$/.test(event.key);
188
+ if (this.isDropdownOpen) {
189
+ switch (event.key) {
190
+ case "ArrowDown":
191
+ this.highlightNext();
192
+ event.preventDefault();
193
+ break;
194
+ case "ArrowUp":
195
+ this.highlightPrevious();
196
+ event.preventDefault();
197
+ break;
198
+ case "Enter":
199
+ if (this.highlightedIndex !== null) {
200
+ this.selectOption(this.filteredOptions[this.highlightedIndex]);
201
+ }
202
+ event.preventDefault();
203
+ break;
204
+ case "Escape":
205
+ this.isDropdownOpen = false;
206
+ break;
207
+ default:
208
+ if (isAlphabetOrNumberKey) {
209
+ this.keySearch += event.key.toString();
210
+ if (this.keySearch !== "") {
211
+ this.onSearch.next(this.keySearch);
212
+ }
213
+ }
214
+ break;
215
+ }
216
+ } else if (event.key === " ") {
217
+ this.toggleDropdown();
218
+ event.preventDefault();
219
+ }
220
+ }
221
+ setDisabledState(isDisabled: boolean): void {
222
+ this.disabled = isDisabled;
223
+ if (this.disabled) {
224
+ this.inputControl.disable({ emitEvent: false });
225
+ } else {
226
+ this.inputControl.enable({ emitEvent: false });
227
+ }
228
+ }
229
+ selectOption(option: any) {
230
+ if (this.selectedItem !== option) {
231
+ this.selectedItem = option;
232
+ this.isDropdownOpen = false;
233
+ const displayValue = this.selectedItem[this.optionDisplayProperty];
234
+ this.inputControl.setValue(displayValue, { emitEvent: false });
235
+ this.onChange(this.selectedItem.id);
236
+ this.onTouched();
237
+ this.inputControl.markAsDirty();
238
+ this.optionSelected.emit(this.selectedItem);
239
+ }
240
+ }
241
+
242
+ // highlight
243
+ highlightSelectedItem() {
244
+ const selectedIndex = this.filteredOptions.findIndex(
245
+ (option) => option === this.selectedItem
246
+ );
247
+ if (selectedIndex !== -1) {
248
+ this.highlightedIndex = selectedIndex;
249
+ this.scrollToHighlighted();
250
+ } else {
251
+ this.highlightedIndex = null;
252
+ }
253
+ }
254
+ highlightNext() {
255
+ if (
256
+ this.highlightedIndex === null ||
257
+ this.highlightedIndex === this.filteredOptions.length - 1
258
+ ) {
259
+ this.highlightedIndex = 0;
260
+ } else {
261
+ this.highlightedIndex++;
262
+ }
263
+ this.scrollToHighlighted();
264
+ }
265
+ highlightPrevious() {
266
+ if (this.highlightedIndex === null || this.highlightedIndex === 0) {
267
+ this.highlightedIndex = this.filteredOptions.length - 1;
268
+ } else {
269
+ this.highlightedIndex--;
270
+ }
271
+ this.scrollToHighlighted();
272
+ }
273
+ focusOption(value: string) {
274
+ const filterValue = value.toLowerCase();
275
+ let foundIndex = this._options.findIndex(
276
+ (option) =>
277
+ option[this.optionDisplayProperty]?.toLowerCase() === filterValue
278
+ );
279
+ if (foundIndex === -1) {
280
+ foundIndex = this._options.findIndex((option) =>
281
+ option[this.optionDisplayProperty]
282
+ ?.toLowerCase()
283
+ .startsWith(filterValue)
284
+ );
285
+ }
286
+ if (foundIndex === -1) {
287
+ foundIndex = this._options.findIndex((option) =>
288
+ option[this.optionDisplayProperty]?.toLowerCase().includes(filterValue)
289
+ );
290
+ }
291
+
292
+ if (foundIndex !== -1) {
293
+ this.highlightedIndex = foundIndex;
294
+ this.scrollToHighlighted();
295
+ } else {
296
+ this.highlightedIndex = null;
297
+ }
298
+ }
299
+ scrollToHighlighted() {
300
+ setTimeout(() => {
301
+ const container = document.querySelector(".option-list");
302
+ if (container) {
303
+ const highlighted = container.querySelector(".highlighted");
304
+ if (highlighted) {
305
+ highlighted.scrollIntoView({ block: "nearest" });
306
+ }
307
+ }
308
+ }, 0);
309
+ }
310
+
311
+ // actions
312
+ onAddNewItemClick(): void {
313
+ this.addNewItemClicked.emit();
314
+ }
315
+
316
+ // popper
317
+ createPopperInstance() {
318
+ if (this.dropdown) {
319
+ this.popperInstance = createPopper(
320
+ this.input.nativeElement,
321
+ this.dropdown.nativeElement,
322
+ {
323
+ placement: "bottom-start",
324
+ modifiers: [
325
+ {
326
+ name: "offset",
327
+ options: {
328
+ offset: [0, 1],
329
+ },
330
+ },
331
+ {
332
+ name: "flip",
333
+ options: {
334
+ fallbackPlacements: ["top-start", "bottom-start"],
335
+ },
336
+ },
337
+ ],
338
+ }
339
+ );
340
+ }
341
+ }
342
+
343
+ // toggle, open, hide, reset and clear
344
+ toggleDropdown() {
345
+ if (!this.inputControl.disabled) {
346
+ this.isDropdownOpen = !this.isDropdownOpen;
347
+ this.dropdownInitialized = false;
348
+ if (this.isDropdownOpen && this.selectedItem) {
349
+ this.highlightSelectedItem();
350
+ }
351
+ }
352
+ }
353
+ openDropdown(event: KeyboardEvent) {
354
+ if (event.ctrlKey && event.key === "Enter") {
355
+ this.toggleDropdown();
356
+ }
357
+ }
358
+ selectListOutsideClick(e: Event) {
359
+ this.isDropdownOpen = false;
360
+ }
361
+ hideDropdown() {
362
+ setTimeout(() => {
363
+ this.isDropdownOpen = false;
364
+ }, 200);
365
+ }
366
+ resetSelection() {
367
+ this.selectionCleared.emit();
368
+ this.selectedItem = null;
369
+ this.inputControl.setValue("", { emitEvent: false });
370
+ this.onChange(null);
371
+ this.onTouched();
372
+ this.valueBuffer = null;
373
+ this.isDropdownOpen = false;
374
+ }
375
+ }
@@ -0,0 +1,4 @@
1
+ <label class="switch-container" [ngClass]="customClass" #switchContainer>
2
+ <input type="checkbox" [formControl]="switchControl" (focus)="onFocus()" (blur)="onBlur()">
3
+ <span class="switch-slider"></span>
4
+ </label>
@@ -0,0 +1,53 @@
1
+ .switch-container {
2
+ top: 4px;
3
+ width: 32px;
4
+ height: 14px;
5
+ position: relative;
6
+ display: inline-block;
7
+ .switch-slider {
8
+ top: 0;
9
+ left: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ cursor: pointer;
13
+ transition: 0.4s;
14
+ position: absolute;
15
+ border-radius: 34px;
16
+ background-color: #cccccc;
17
+ &:before {
18
+ left: 0px;
19
+ content: "";
20
+ width: 18px;
21
+ bottom: -2px;
22
+ height: 18px;
23
+ transition: 0.4s;
24
+ position: absolute;
25
+ border-radius: 50%;
26
+ border: 1px solid #cccccc;
27
+ background-color: #ffffff;
28
+ }
29
+ }
30
+ input {
31
+ width: 0;
32
+ height: 0;
33
+ opacity: 0;
34
+ &:checked + .switch-slider {
35
+ background-color: #12ceb7;
36
+ &:before {
37
+ transform: translateX(14px);
38
+ border: 1px solid #12ceb7;
39
+ }
40
+ }
41
+ &:focus + .switch-slider {
42
+ box-shadow: 0 0 1px #12ceb7;
43
+ }
44
+ }
45
+ &.square {
46
+ .switch-slider {
47
+ border-radius: 0;
48
+ &:before {
49
+ border-radius: 0;
50
+ }
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SwitchControl } from './switch-control.component';
3
+
4
+ describe('SwitchControl', () => {
5
+ let component: SwitchControl;
6
+ let fixture: ComponentFixture<SwitchControl>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SwitchControl]
11
+ })
12
+ .compileComponents();
13
+
14
+ fixture = TestBed.createComponent(SwitchControl);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -0,0 +1,93 @@
1
+ import { Component, Input, Output, EventEmitter, forwardRef, Renderer2, ElementRef, ViewChild } from '@angular/core';
2
+ import { NG_VALUE_ACCESSOR, ControlValueAccessor, ReactiveFormsModule, FormControl } from '@angular/forms';
3
+ import { CommonModule } from '@angular/common';
4
+
5
+ @Component({
6
+ selector: 'switch-control',
7
+ standalone: true,
8
+ imports: [
9
+ CommonModule,
10
+ ReactiveFormsModule
11
+ ],
12
+ providers: [
13
+ {
14
+ provide: NG_VALUE_ACCESSOR,
15
+ useExisting: forwardRef(() => SwitchControl),
16
+ multi: true,
17
+ },
18
+ ],
19
+ templateUrl: './switch-control.component.html',
20
+ styleUrls: ['./switch-control.component.scss']
21
+ })
22
+ export class SwitchControl implements ControlValueAccessor {
23
+
24
+ @Input() title!: string;
25
+ @Input() customClass!: string;
26
+ @Input() set disabled(value: boolean) {
27
+ this._disabled = value;
28
+ this.setDisabledState(value);
29
+ }
30
+ @Input()
31
+ set checked(value: boolean) {
32
+ this._checked = value;
33
+ this.switchControl.setValue(value, { emitEvent: false }); // set without emitting
34
+ }
35
+ @Output() switchChange = new EventEmitter<boolean>();
36
+ @Output() blurEvent = new EventEmitter<void>();
37
+
38
+ @ViewChild('switchContainer') switchContainer!: ElementRef;
39
+
40
+ get checked(): boolean {
41
+ return this._checked;
42
+ }
43
+
44
+ private _checked: boolean = false;
45
+ private _disabled = false;
46
+ switchControl = new FormControl<boolean>({ value: false, disabled: this._disabled });
47
+
48
+ private onChange: any = () => { };
49
+ private onTouched: any = () => { };
50
+
51
+ constructor(
52
+ private _renderer: Renderer2,
53
+ private _elementRef: ElementRef
54
+ ) {
55
+ this.switchControl.valueChanges.subscribe(value => {
56
+ this.onChange(value ?? false);
57
+ this.onTouched();
58
+ this.switchChange.emit(value ?? false);
59
+ });
60
+ }
61
+
62
+ writeValue(value: any): void {
63
+ if (value !== undefined) {
64
+ this.switchControl.setValue(value, { emitEvent: false });
65
+ }
66
+ }
67
+
68
+ registerOnChange(fn: any): void {
69
+ this.onChange = fn;
70
+ }
71
+ registerOnTouched(fn: any): void {
72
+ this.onTouched = fn;
73
+ }
74
+
75
+ // events
76
+ onFocus() {
77
+ this.switchContainer.nativeElement.classList.add('focused');
78
+ }
79
+ onBlur() {
80
+ this.blurEvent.emit();
81
+ this.onTouched();
82
+ this.switchContainer.nativeElement.classList.remove('focused');
83
+ }
84
+ setDisabledState(isDisabled: boolean): void {
85
+ this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
86
+ if (isDisabled) {
87
+ this.switchControl.disable();
88
+ } else {
89
+ this.switchControl.enable();
90
+ }
91
+ }
92
+
93
+ }
@@ -0,0 +1,88 @@
1
+ <div class="text-editor">
2
+ <div class="toolbar">
3
+ <div class="toolbar-items">
4
+ <button type="button" (click)="applyInlineStyle('bold')" tooltip="Bold">
5
+ <i class="he he-bold"></i>
6
+ </button>
7
+ <button type="button" (click)="applyInlineStyle('italic')" tooltip="italic">
8
+ <i class="he he-italics"></i>
9
+ </button>
10
+ <button type="button" (click)="applyInlineStyle('underline')" tooltip="Underline">
11
+ <i class="he he-underline"></i>
12
+ </button>
13
+ </div>
14
+ <div class="toolbar-items" *ngIf="header">
15
+ <button type="button" (click)="applyBlockFormat('h1')" tooltip="Header 1">
16
+ <i class="he he-heading-1"></i>
17
+ </button>
18
+ <button type="button" (click)="applyBlockFormat('h2')" tooltip="Header 2">
19
+ <i class="he he-heading-2"></i>
20
+ </button>
21
+ </div>
22
+ <div class="toolbar-items more-gap">
23
+ <div class="input-wrap" tooltip="Text Color">
24
+ <i class="he he-text-drop"></i>
25
+ <input type="color" (change)="applyColor($event)" />
26
+ </div>
27
+ <div class="input-wrap" tooltip="Background Color">
28
+ <i class="he he-background-drop"></i>
29
+ <input type="color" (change)="applyHighlight($event)" />
30
+ </div>
31
+ </div>
32
+ <div class="toolbar-items">
33
+ <button type="button" (click)="setAlignment('left')" tooltip="Justify Left">
34
+ <i class="he he-left-align"></i>
35
+ </button>
36
+ <button type="button" (click)="setAlignment('center')" tooltip="Justify Center">
37
+ <i class="he he-center-align"></i>
38
+ </button>
39
+ <button type="button" (click)="setAlignment('right')" tooltip="Justify Right">
40
+ <i class="he he-right-align"></i>
41
+ </button>
42
+ <button type="button" (click)="setAlignment('justify')" tooltip="Justify Full">
43
+ <i class="he he-justify"></i>
44
+ </button>
45
+ </div>
46
+ <div class="toolbar-items">
47
+ <button type="button" tooltip="Indent">
48
+ <i class="he he-text-indent-left"></i>
49
+ </button>
50
+ <button type="button" tooltip="Outdent">
51
+ <i class="he he-text-indent-right"></i>
52
+ </button>
53
+ </div>
54
+ <div class="toolbar-items" *ngIf="media">
55
+ <button type="button" (click)="applyList('ul')" tooltip="Unordered list">
56
+ <i class="he he-unordered-list"></i>
57
+ </button>
58
+ <button type="button" (click)="applyList('ol')" tooltip="Ordered list">
59
+ <i class="he he-ordered-list"></i>
60
+ </button>
61
+ </div>
62
+ <div class="toolbar-items" *ngIf="link">
63
+ <button type="button" (click)="createLink()" tooltip="Link">
64
+ <i class="he he-link"></i>
65
+ </button>
66
+ <button type="button" (click)="insertImage()" tooltip="Image">
67
+ <i class="he he-image"></i>
68
+ </button>
69
+ </div>
70
+ <div class="toolbar-items">
71
+ <button type="button" (click)="undo()" tooltip="Undo">
72
+ <i class="he he-undo"></i>
73
+ </button>
74
+ <button type="button" (click)="redo()" tooltip="Redo">
75
+ <i class="he he-redo"></i>
76
+ </button>
77
+ </div>
78
+ <div class="toolbar-items">
79
+ <button type="button" (click)="clearFormatting()" tooltip="Clear Formatting">
80
+ <i class="he he-text-clear-format"></i>
81
+ </button>
82
+ </div>
83
+ </div>
84
+
85
+ <div #editor class="editor-content" contenteditable="true" (input)="onInput()" (blur)="onTouched()"
86
+ [attr.data-placeholder]="placeholder">
87
+ </div>
88
+ </div>