@factor_ec/ui 1.0.13 → 1.0.17

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 (123) hide show
  1. package/esm2020/factor_ec-ui.mjs +5 -0
  2. package/esm2020/lib/display/avatar/avatar.component.mjs +74 -0
  3. package/esm2020/lib/display/content/content.component.mjs +19 -0
  4. package/esm2020/lib/display/display.module.mjs +66 -0
  5. package/esm2020/lib/display/icon/icon.component.mjs +97 -0
  6. package/esm2020/lib/display/image/image.component.mjs +80 -0
  7. package/esm2020/lib/display/message/message.component.mjs +30 -0
  8. package/esm2020/lib/display/message.service.mjs +58 -0
  9. package/esm2020/lib/display/observe-intersecting.directive.mjs +43 -0
  10. package/esm2020/lib/display/progress/progress.component.mjs +42 -0
  11. package/esm2020/lib/display/progress.service.mjs +50 -0
  12. package/esm2020/lib/inputs/inputs.module.mjs +24 -0
  13. package/esm2020/lib/inputs/rating/rating.component.mjs +73 -0
  14. package/esm2020/lib/models/action.mjs +2 -0
  15. package/esm2020/lib/models/content.mjs +2 -0
  16. package/esm2020/lib/models/icon.mjs +2 -0
  17. package/esm2020/lib/models/message-options.mjs +2 -0
  18. package/esm2020/lib/models/module-configuration.mjs +2 -0
  19. package/esm2020/lib/models/ui-configuration.mjs +2 -0
  20. package/esm2020/lib/navigation/list/list.component.mjs +70 -0
  21. package/esm2020/lib/navigation/navbar/navbar.component.mjs +74 -0
  22. package/esm2020/lib/navigation/navigation.module.mjs +55 -0
  23. package/esm2020/lib/navigation/searchbox/searchbox.component.mjs +109 -0
  24. package/esm2020/lib/navigation/toolbar/toolbar.component.mjs +53 -0
  25. package/esm2020/lib/ui.module.mjs +47 -0
  26. package/esm2020/public-api.mjs +22 -0
  27. package/fesm2015/factor_ec-ui.mjs +1002 -0
  28. package/fesm2015/factor_ec-ui.mjs.map +1 -0
  29. package/fesm2020/factor_ec-ui.mjs +993 -0
  30. package/fesm2020/factor_ec-ui.mjs.map +1 -0
  31. package/index.d.ts +5 -0
  32. package/lib/display/avatar/avatar.component.d.ts +22 -0
  33. package/lib/display/content/content.component.d.ts +7 -0
  34. package/lib/display/display.module.d.ts +17 -0
  35. package/lib/display/icon/icon.component.d.ts +24 -0
  36. package/lib/display/image/image.component.d.ts +15 -0
  37. package/lib/display/message/message.component.d.ts +11 -0
  38. package/lib/display/message.service.d.ts +15 -0
  39. package/lib/display/observe-intersecting.directive.d.ts +16 -0
  40. package/lib/display/progress/progress.component.d.ts +15 -0
  41. package/lib/display/progress.service.d.ts +15 -0
  42. package/lib/inputs/inputs.module.d.ts +8 -0
  43. package/lib/inputs/rating/rating.component.d.ts +23 -0
  44. package/{src/lib/models/action.ts → lib/models/action.d.ts} +1 -1
  45. package/{src/lib/models/content.ts → lib/models/content.d.ts} +1 -1
  46. package/{src/lib/models/icon.ts → lib/models/icon.d.ts} +1 -1
  47. package/{src/lib/models/message-options.ts → lib/models/message-options.d.ts} +1 -2
  48. package/lib/models/module-configuration.d.ts +6 -0
  49. package/lib/models/ui-configuration.d.ts +7 -0
  50. package/lib/navigation/list/list.component.d.ts +21 -0
  51. package/lib/navigation/navbar/navbar.component.d.ts +23 -0
  52. package/lib/navigation/navigation.module.d.ts +15 -0
  53. package/lib/navigation/searchbox/searchbox.component.d.ts +34 -0
  54. package/lib/navigation/toolbar/toolbar.component.d.ts +18 -0
  55. package/lib/ui.module.d.ts +13 -0
  56. package/package.json +23 -3
  57. package/{src/public-api.ts → public-api.d.ts} +0 -4
  58. package/.browserslistrc +0 -16
  59. package/karma.conf.js +0 -44
  60. package/ng-package.json +0 -7
  61. package/src/lib/display/avatar/avatar.component.html +0 -1
  62. package/src/lib/display/avatar/avatar.component.scss +0 -20
  63. package/src/lib/display/avatar/avatar.component.spec.ts +0 -23
  64. package/src/lib/display/avatar/avatar.component.ts +0 -69
  65. package/src/lib/display/content/content.component.html +0 -4
  66. package/src/lib/display/content/content.component.scss +0 -0
  67. package/src/lib/display/content/content.component.spec.ts +0 -23
  68. package/src/lib/display/content/content.component.ts +0 -15
  69. package/src/lib/display/display.module.ts +0 -41
  70. package/src/lib/display/icon/icon.component.html +0 -4
  71. package/src/lib/display/icon/icon.component.scss +0 -47
  72. package/src/lib/display/icon/icon.component.spec.ts +0 -23
  73. package/src/lib/display/icon/icon.component.ts +0 -88
  74. package/src/lib/display/image/image.component.html +0 -2
  75. package/src/lib/display/image/image.component.scss +0 -53
  76. package/src/lib/display/image/image.component.spec.ts +0 -23
  77. package/src/lib/display/image/image.component.ts +0 -71
  78. package/src/lib/display/message/message.component.html +0 -33
  79. package/src/lib/display/message/message.component.scss +0 -25
  80. package/src/lib/display/message/message.component.spec.ts +0 -23
  81. package/src/lib/display/message/message.component.ts +0 -24
  82. package/src/lib/display/message.service.spec.ts +0 -16
  83. package/src/lib/display/message.service.ts +0 -58
  84. package/src/lib/display/observe-intersecting.directive.spec.ts +0 -8
  85. package/src/lib/display/observe-intersecting.directive.ts +0 -34
  86. package/src/lib/display/progress/progress.component.html +0 -6
  87. package/src/lib/display/progress/progress.component.scss +0 -121
  88. package/src/lib/display/progress/progress.component.spec.ts +0 -23
  89. package/src/lib/display/progress/progress.component.ts +0 -36
  90. package/src/lib/display/progress.service.spec.ts +0 -16
  91. package/src/lib/display/progress.service.ts +0 -51
  92. package/src/lib/inputs/inputs.module.ts +0 -17
  93. package/src/lib/inputs/rating/rating.component.html +0 -13
  94. package/src/lib/inputs/rating/rating.component.scss +0 -61
  95. package/src/lib/inputs/rating/rating.component.spec.ts +0 -25
  96. package/src/lib/inputs/rating/rating.component.ts +0 -66
  97. package/src/lib/models/action-group.ts +0 -9
  98. package/src/lib/models/module-configuration.ts +0 -6
  99. package/src/lib/models/ui-configuration.ts +0 -7
  100. package/src/lib/navigation/list/list.component.html +0 -52
  101. package/src/lib/navigation/list/list.component.scss +0 -93
  102. package/src/lib/navigation/list/list.component.spec.ts +0 -23
  103. package/src/lib/navigation/list/list.component.ts +0 -56
  104. package/src/lib/navigation/navbar/navbar.component.html +0 -23
  105. package/src/lib/navigation/navbar/navbar.component.scss +0 -202
  106. package/src/lib/navigation/navbar/navbar.component.spec.ts +0 -23
  107. package/src/lib/navigation/navbar/navbar.component.ts +0 -57
  108. package/src/lib/navigation/navigation.module.ts +0 -34
  109. package/src/lib/navigation/searchbox/searchbox.component.html +0 -34
  110. package/src/lib/navigation/searchbox/searchbox.component.scss +0 -37
  111. package/src/lib/navigation/searchbox/searchbox.component.spec.ts +0 -23
  112. package/src/lib/navigation/searchbox/searchbox.component.ts +0 -94
  113. package/src/lib/navigation/toolbar/toolbar.component.html +0 -43
  114. package/src/lib/navigation/toolbar/toolbar.component.scss +0 -29
  115. package/src/lib/navigation/toolbar/toolbar.component.spec.ts +0 -23
  116. package/src/lib/navigation/toolbar/toolbar.component.ts +0 -43
  117. package/src/lib/scss/breakpoints.scss +0 -123
  118. package/src/lib/scss/variables.scss +0 -8
  119. package/src/lib/ui.module.ts +0 -34
  120. package/src/test.ts +0 -27
  121. package/tsconfig.lib.json +0 -15
  122. package/tsconfig.lib.prod.json +0 -10
  123. package/tsconfig.spec.json +0 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factor_ec/ui",
3
- "version": "1.0.13",
3
+ "version": "1.0.17",
4
4
  "license": "CC-BY-NC-ND-4.0",
5
5
  "author": "Factor",
6
6
  "private": false,
@@ -12,5 +12,25 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "tslib": "^2.3.0"
15
- }
16
- }
15
+ },
16
+ "module": "fesm2015/factor_ec-ui.mjs",
17
+ "es2020": "fesm2020/factor_ec-ui.mjs",
18
+ "esm2020": "esm2020/factor_ec-ui.mjs",
19
+ "fesm2020": "fesm2020/factor_ec-ui.mjs",
20
+ "fesm2015": "fesm2015/factor_ec-ui.mjs",
21
+ "typings": "index.d.ts",
22
+ "exports": {
23
+ "./package.json": {
24
+ "default": "./package.json"
25
+ },
26
+ ".": {
27
+ "types": "./index.d.ts",
28
+ "esm2020": "./esm2020/factor_ec-ui.mjs",
29
+ "es2020": "./fesm2020/factor_ec-ui.mjs",
30
+ "es2015": "./fesm2015/factor_ec-ui.mjs",
31
+ "node": "./fesm2015/factor_ec-ui.mjs",
32
+ "default": "./fesm2020/factor_ec-ui.mjs"
33
+ }
34
+ },
35
+ "sideEffects": false
36
+ }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of ui
3
- */
4
-
5
1
  export * from './lib/display/avatar/avatar.component';
6
2
  export * from './lib/display/icon/icon.component';
7
3
  export * from './lib/display/image/image.component';
package/.browserslistrc DELETED
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
package/karma.conf.js DELETED
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/ui'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ui",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- }
7
- }
@@ -1 +0,0 @@
1
- <div *ngIf="!loaded">{{ initials }}</div>
@@ -1,20 +0,0 @@
1
- :host {
2
- --default-size: var(--size, 3rem);
3
- display: inline-flex;
4
- align-items: center;
5
- justify-content: center;
6
- color: #fff;
7
- background-size: cover;
8
- background-repeat: no-repeat;
9
- border-radius: calc(var(--default-size) / 2);
10
- font-size: calc(var(--default-size) - (var(--default-size) * 0.6));
11
- min-width: var(--default-size);
12
- min-height: var(--default-size);
13
- cursor: default;
14
- user-select: none;
15
- }
16
-
17
- div {
18
- font-size: 1em;
19
- line-height: 1em;
20
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { AvatarComponent } from './avatar.component';
4
-
5
- describe('AvatarComponent', () => {
6
- let component: AvatarComponent;
7
- let fixture: ComponentFixture<AvatarComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ AvatarComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(AvatarComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,69 +0,0 @@
1
- import { Component, HostBinding, Input, OnInit } from '@angular/core';
2
- import { ColorService } from '@factor_ec/utils';
3
-
4
- @Component({
5
- selector: 'ft-avatar',
6
- templateUrl: './avatar.component.html',
7
- styleUrls: ['./avatar.component.scss']
8
- })
9
- export class AvatarComponent implements OnInit {
10
- _label!: string;
11
- _src!: string;
12
- @Input()
13
- color!: string;
14
- initials!: string;
15
- loaded!: boolean;
16
- @Input()
17
- class: string = '';
18
- @Input()
19
- set src(value: string | undefined) {
20
- if (value && value.trim()!='') {
21
- this._src = value;
22
- let image = new Image();
23
- image.src = value;
24
- image.onload = () => {
25
- if ("decode" in image) {
26
- image.decode().then(() => {
27
- this.loaded = true;
28
- });
29
- } else {
30
- console.error('Image.decode not available.');
31
- }
32
- };
33
- }
34
- }
35
- @Input()
36
- set label(value: string) {
37
- this._label = value;
38
- this.initials = this.getInitials(value);
39
- }
40
- @HostBinding('style.background-color')
41
- get backgroundColor(): string {
42
- return this.color || this.colorService.hex(this._label);
43
- }
44
- @HostBinding('style.background-image')
45
- get backgroundImage(): string {
46
- return this._src ? `url(${this._src})` : '';
47
- }
48
- @HostBinding('class')
49
- get hostClasses(): string {
50
- return [
51
- 'ft-avatar',
52
- this.class
53
- ].join(' ');
54
- }
55
-
56
- constructor(
57
- private colorService: ColorService
58
- ) { }
59
-
60
- ngOnInit() {
61
-
62
- }
63
- getInitials(value: string): string {
64
- let allInitials: string[] = value.match(/\b\w/g) || [];
65
- let initials: string = ((allInitials.shift() || '') + (allInitials.pop() || '')).toUpperCase();
66
- return initials;
67
- }
68
-
69
- }
@@ -1,4 +0,0 @@
1
- <ng-container [ngSwitch]="data.message?.type">
2
- <div *ngSwitchCase="'html'" [innerHTML]="data.message?.content"></div>
3
- <ng-container *ngSwitchDefault>{{ data.message?.content }}</ng-container>
4
- </ng-container>
File without changes
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ContentComponent } from './content.component';
4
-
5
- describe('ContentComponent', () => {
6
- let component: ContentComponent;
7
- let fixture: ComponentFixture<ContentComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ContentComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ContentComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,15 +0,0 @@
1
- import { Component, Inject } from '@angular/core';
2
- import { MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
3
-
4
- @Component({
5
- selector: 'lib-content',
6
- templateUrl: './content.component.html',
7
- styleUrls: ['./content.component.scss']
8
- })
9
- export class ContentComponent {
10
-
11
- constructor(
12
- @Inject(MAT_SNACK_BAR_DATA) public data: any
13
- ) { }
14
-
15
- }
@@ -1,41 +0,0 @@
1
- import { NgModule } from '@angular/core';
2
- import { CommonModule } from '@angular/common';
3
- import { MatButtonModule } from '@angular/material/button';
4
- import { MatDialogModule } from '@angular/material/dialog';
5
- import { MatSnackBarModule } from '@angular/material/snack-bar';
6
-
7
- import { AvatarComponent } from './avatar/avatar.component';
8
- import { IconComponent } from './icon/icon.component';
9
- import { ImageComponent } from './image/image.component';
10
- import { ProgressComponent } from './progress/progress.component';
11
- import { ObserveIntersectingDirective } from './observe-intersecting.directive';
12
- import { MessageComponent } from './message/message.component';
13
- import { ContentComponent } from './content/content.component';
14
-
15
- @NgModule({
16
- declarations: [
17
- AvatarComponent,
18
- IconComponent,
19
- ImageComponent,
20
- ProgressComponent,
21
- ObserveIntersectingDirective,
22
- MessageComponent,
23
- ContentComponent
24
- ],
25
- exports: [
26
- AvatarComponent,
27
- IconComponent,
28
- ImageComponent,
29
- ProgressComponent,
30
- ObserveIntersectingDirective,
31
- MessageComponent,
32
- ContentComponent
33
- ],
34
- imports: [
35
- CommonModule,
36
- MatButtonModule,
37
- MatDialogModule,
38
- MatSnackBarModule
39
- ]
40
- })
41
- export class DisplayModule { }
@@ -1,4 +0,0 @@
1
- <svg *ngIf="!src; else imageTemplate"><use attr.xlink:href="{{ url }}" attr.href="{{ url }}" /></svg>
2
- <ng-template #imageTemplate>
3
- <img [src]="src" />
4
- </ng-template>
@@ -1,47 +0,0 @@
1
- :host {
2
- line-height: 0;
3
- display: inline-block;
4
- &[size="1"],
5
- &.ft-icon--1 {
6
- font-size: 1rem;
7
- }
8
- &[size="2"],
9
- &.ft-icon--2 {
10
- font-size: 1.5rem;
11
- }
12
- &[size="3"],
13
- &.ft-icon--3 {
14
- font-size: 2rem;
15
- }
16
- &[size="4"],
17
- &.ft-icon--4 {
18
- font-size: 3rem;
19
- }
20
- &[size="5"],
21
- &.ft-icon--5 {
22
- font-size: 4.5rem;
23
- }
24
- &[size="6"],
25
- &.ft-icon--6 {
26
- font-size: 8rem;
27
- }
28
- &[size="7"],
29
- &.ft-icon--7 {
30
- font-size: 16rem;
31
- }
32
- &[size="8"],
33
- &.ft-icon--8 {
34
- font-size: 32rem;
35
- }
36
- }
37
- svg {
38
- width: 1em;
39
- height: 1em;
40
- vertical-align: middle;
41
- fill: currentColor;
42
- }
43
- img {
44
- height: 1em;
45
- vertical-align: middle;
46
- }
47
-
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { IconComponent } from './icon.component';
4
-
5
- describe('IconComponent', () => {
6
- let component: IconComponent;
7
- let fixture: ComponentFixture<IconComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ IconComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(IconComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,88 +0,0 @@
1
- import { Component, OnInit, Input, Inject, HostBinding } from '@angular/core';
2
- import { UiConfiguration } from '../../models/ui-configuration';
3
-
4
- @Component({
5
- selector: 'ft-icon',
6
- templateUrl: './icon.component.html',
7
- styleUrls: ['./icon.component.scss']
8
- })
9
- export class IconComponent implements OnInit {
10
- _collection!: string;
11
- _name!: string;
12
- _mode!: 'inline' | 'external';
13
- _path!: string;
14
- @Input()
15
- class: string = '';
16
- @Input()
17
- set collection(collection: string) {
18
- this._collection = collection;
19
- this.update();
20
- }
21
- @Input()
22
- set mode(mode: 'inline' | 'external') {
23
- this._mode = mode;
24
- this.update();
25
- }
26
- @Input()
27
- set name(name: string) {
28
- this._name = name;
29
- this.update();
30
- }
31
- @Input()
32
- set path(path: string) {
33
- this._path = path;
34
- this.update();
35
- }
36
- @Input()
37
- size!: string;
38
- @Input()
39
- src!: string;
40
- url!: string;
41
- @HostBinding('class')
42
- get hostClasses(): string {
43
- return [
44
- 'ft-icon',
45
- this.class
46
- ].join(' ');
47
- }
48
-
49
- constructor(
50
- @Inject('FactorUiConfiguration') private configuration: UiConfiguration
51
- ) { }
52
-
53
- ngOnInit() {
54
- this.update();
55
- }
56
- private update() {
57
- // Set the default collection if the mode is external
58
- if (!this._collection) {
59
- if (this.configuration.icon && this.configuration.icon.collection) {
60
- this._collection = this.configuration.icon.collection;
61
- } else if (this._mode === 'external') {
62
- this._collection = 'icons';
63
- }
64
- }
65
- if (!this._mode) {
66
- if (this.configuration.icon && this.configuration.icon.mode) {
67
- this._mode = this.configuration.icon.mode;
68
- } else {
69
- this._mode = 'external';
70
- }
71
- }
72
- if (this._mode === 'external') {
73
- // If the icon mode is external
74
- if (!this._path) {
75
- if (this.configuration.icon && this.configuration.icon.path) {
76
- this._path = this.configuration.icon.path;
77
- } else {
78
- this._path = 'assets';
79
- }
80
- }
81
- this.url = `${ this._path }/${ this._collection }.svg#${this._name}`;
82
- } else {
83
- // If the icon mode is inline
84
- const name = this._collection && this._collection !== 'unset' ? `${this._collection}--${this._name}` : this._name;
85
- this.url = `#${name}`;
86
- }
87
- }
88
- }
@@ -1,2 +0,0 @@
1
- <img *ngIf="shown" [src]="src" />
2
- <ft-icon name="warning" size="2" *ngIf="error"></ft-icon>
@@ -1,53 +0,0 @@
1
- :host {
2
- display: inline-block;
3
- overflow: hidden;
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- &.ft-image--loading {
8
- background-color: rgba(0, 0, 0, 0.03);
9
- position: relative;
10
- overflow: hidden;
11
- &::after {
12
- content: "";
13
- display: block;
14
- background-color: rgba(0, 0, 0, 0.02);
15
- position: absolute;
16
- top: 0;
17
- bottom: 0;
18
- width: 100%;
19
- height: 100%;
20
- transform: translateX(0);
21
- animation: 1.5s placeholder-loading ease-in-out infinite;
22
- }
23
- }
24
- &.ft-image--error {
25
- background-color: rgba(255, 0, 0, 0.03);
26
- ft-icon {
27
- color: var(--danger);
28
- }
29
- }
30
- }
31
- img {
32
- position: relative;
33
- z-index: 1;
34
- max-width: 100%;
35
- max-height: 100%;
36
- animation: fade-in 0.3s;
37
- }
38
- @keyframes fade-in {
39
- from {
40
- opacity: 0;
41
- }
42
- to {
43
- opacity: 1;
44
- }
45
- }
46
- @keyframes placeholder-loading {
47
- 0% {
48
- transform: translateX(-100%);
49
- }
50
- 100% {
51
- transform: translateX(100%);
52
- }
53
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ImageComponent } from './image.component';
4
-
5
- describe('ImageComponent', () => {
6
- let component: ImageComponent;
7
- let fixture: ComponentFixture<ImageComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ ImageComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ImageComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,71 +0,0 @@
1
- import { Component, OnInit, Input, HostBinding, ElementRef } from '@angular/core';
2
-
3
- @Component({
4
- selector: 'ft-image',
5
- templateUrl: './image.component.html',
6
- styleUrls: ['./image.component.scss']
7
- })
8
- export class ImageComponent implements OnInit {
9
- @Input()
10
- class: string = '';
11
- @HostBinding('class.ft-image--error')
12
- error!: boolean;
13
- @HostBinding('class.ft-image--loading')
14
- loading: boolean = false;
15
- @Input()
16
- src!: string;
17
- shown: boolean = false;
18
-
19
- constructor(
20
- private element: ElementRef
21
- ) { }
22
-
23
- ngOnInit() {
24
- if ("IntersectionObserver" in window) {
25
- let elementObserver = new IntersectionObserver((entries, observer) => {
26
- entries.forEach((entry) => {
27
- if (entry.isIntersecting) {
28
- let image = new Image();
29
- image.src = this.src;
30
- setTimeout(() => {
31
- if (!this.shown && !this.error) {
32
- this.loading = true;
33
- }
34
- }, 100);
35
- image.onerror = () => {
36
- this.error = true;
37
- this.loading = false;
38
- };
39
- image.onload = () => {
40
- if ("decode" in image) {
41
- image.decode().then(() => {
42
- this.loading = false;
43
- this.shown = true;
44
- });
45
- } else {
46
- this.loading = false;
47
- this.shown = true;
48
- }
49
- };
50
- elementObserver.unobserve(this.element.nativeElement);
51
- }
52
- });
53
- }, {
54
- rootMargin: "0px 0px 200px 0px"
55
- });
56
- elementObserver.observe(this.element.nativeElement);
57
- } else {
58
- console.error('IntersectionObserver not available.');
59
- this.loading = false;
60
- this.shown = true;
61
- }
62
- }
63
- @HostBinding('class')
64
- get hostClasses(): string {
65
- return [
66
- 'ft-image',
67
- this.class
68
- ].join(' ');
69
- }
70
-
71
- }
@@ -1,33 +0,0 @@
1
- <h1 mat-dialog-title class="ft-message__title" *ngIf="data.options?.title">
2
- <ft-icon *ngIf="data.options?.titleIcon" [name]="data.options?.titleIcon?.name"
3
- [collection]="data.options?.titleIcon?.collection" [ngClass]="data.options?.titleIcon?.class"
4
- [size]="data.options?.titleIcon?.size || 2"></ft-icon>
5
- <div>{{ data.options?.title }}</div>
6
- </h1>
7
- <div mat-dialog-content class="ft-message__content" [ngClass]="data.options?.class">
8
- <ft-icon *ngIf="data.options?.icon" [name]="data.options?.icon?.name" [collection]="data.options?.icon?.collection"
9
- [ngClass]="data.options?.icon?.class" [size]="data.options?.icon?.size || 2"></ft-icon>
10
- <ng-container [ngSwitch]="data.message?.type">
11
- <div *ngSwitchCase="'html'" [innerHTML]="data.message?.content"></div>
12
- <ng-container *ngSwitchDefault>{{ data.message?.content }}</ng-container>
13
- </ng-container>
14
- </div>
15
- <div mat-dialog-actions class="ft-message__actions" *ngIf="data.options.actionsVisible">
16
- <ng-container *ngIf="data.options?.actions?.length > 0; else acceptTemplate">
17
- <ng-container *ngFor="let action of data.options?.actions; let i = index">
18
- <ng-container [ngSwitch]="action.type">
19
- <button type="button" *ngSwitchCase="'raised'" mat-raised-button [color]="action.metadata?.color"
20
- (click)="select(action.value)" autofocus>{{ action.label }}</button>
21
- <button type="button" *ngSwitchCase="'flat'" mat-flat-button [color]="action.metadata?.color"
22
- (click)="select(action.value)" autofocus>{{ action.label }}</button>
23
- <button type="button" *ngSwitchCase="'stroked'" mat-stroked-button [color]="action.metadata?.color"
24
- (click)="select(action.value)" autofocus>{{ action.label }}</button>
25
- <button type="button" *ngSwitchDefault mat-button [color]="action.metadata?.color"
26
- (click)="select(action.value)">{{ action.label }}</button>
27
- </ng-container>
28
- </ng-container>
29
- </ng-container>
30
- </div>
31
- <ng-template #acceptTemplate>
32
- <button type="button" mat-stroked-button color="primary" autofocus (click)="select('-1')" i18n>Accept</button>
33
- </ng-template>