@webilix/ngx-helper-m3 0.0.10 → 0.0.12

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.
@@ -1,4 +1,5 @@
1
1
  import { INgxHelperConfig } from '../ngx-helper.config';
2
+ import { INgxHelperValue } from './value/ngx-helper-value.interface';
2
3
  import * as i0 from "@angular/core";
3
4
  export interface IComponentConfig {
4
5
  readonly mobileWidth: number;
@@ -14,8 +15,18 @@ export interface IComponentConfig {
14
15
  };
15
16
  };
16
17
  }
18
+ export interface IValueComponentData {
19
+ readonly title: string;
20
+ readonly value: string;
21
+ readonly color?: string;
22
+ readonly action?: () => string[] | void;
23
+ readonly copyToClipboard?: boolean;
24
+ readonly ltr?: boolean;
25
+ readonly english?: boolean;
26
+ }
17
27
  export declare class ComponentService {
18
28
  getComponentConfig(config?: Partial<INgxHelperConfig>): IComponentConfig;
29
+ getValueData(values: INgxHelperValue[]): IValueComponentData[];
19
30
  static ɵfac: i0.ɵɵFactoryDeclaration<ComponentService, never>;
20
31
  static ɵprov: i0.ɵɵInjectableDeclaration<ComponentService>;
21
32
  }
@@ -2,7 +2,7 @@ import { EventEmitter, Injector, OnChanges, OnInit, SimpleChanges } from '@angul
2
2
  import { ActivatedRoute, Router } from '@angular/router';
3
3
  import { INgxHelperConfig } from '../../ngx-helper.config';
4
4
  import { ComponentService, IComponentConfig } from '../component.service';
5
- import { INgxHelperPageGroup } from './ngx-helper-page-group.interface';
5
+ import { INgxHelperPageGroup, INgxHelperPageGroupItem } from './ngx-helper-page-group.interface';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class NgxHelperPageGroupComponent implements OnInit, OnChanges {
8
8
  private readonly activatedRoute;
@@ -12,11 +12,12 @@ export declare class NgxHelperPageGroupComponent implements OnInit, OnChanges {
12
12
  private className;
13
13
  display: string;
14
14
  pageGroup: INgxHelperPageGroup;
15
- pageIndex: number;
15
+ pageId: string;
16
16
  data?: any;
17
- pageIndexChanged: EventEmitter<number>;
17
+ pageChanged: EventEmitter<INgxHelperPageGroupItem>;
18
18
  dataChanged: EventEmitter<any>;
19
19
  isMobile: boolean;
20
+ pages: string[];
20
21
  injector: Injector;
21
22
  sidebarWidth: string;
22
23
  componentConfig: IComponentConfig;
@@ -25,7 +26,8 @@ export declare class NgxHelperPageGroupComponent implements OnInit, OnChanges {
25
26
  ngOnChanges(changes: SimpleChanges): void;
26
27
  onResize(): void;
27
28
  setInjector(): void;
28
- setPage(index: number): void;
29
+ setPage(id: string): void;
30
+ triggerPageChanged(): void;
29
31
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxHelperPageGroupComponent, [null, null, null, { optional: true; }]>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<NgxHelperPageGroupComponent, "ngx-helper-page-group", never, { "pageGroup": { "alias": "pageGroup"; "required": true; }; "pageIndex": { "alias": "pageIndex"; "required": false; }; "data": { "alias": "data"; "required": false; }; }, { "pageIndexChanged": "pageIndexChanged"; "dataChanged": "dataChanged"; }, never, never, true, never>;
32
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxHelperPageGroupComponent, "ngx-helper-page-group", never, { "pageGroup": { "alias": "pageGroup"; "required": true; }; "pageId": { "alias": "pageId"; "required": false; }; "data": { "alias": "data"; "required": false; }; }, { "pageChanged": "pageChanged"; "dataChanged": "dataChanged"; }, never, never, true, never>;
31
33
  }
@@ -8,11 +8,14 @@ interface IPage {
8
8
  export interface INgxHelperPageGroup {
9
9
  readonly route?: string[];
10
10
  readonly header?: ComponentType<any>;
11
- readonly pages: IPage[];
11
+ readonly pages: {
12
+ [key: string]: IPage;
13
+ };
12
14
  readonly sidebarWidth?: string;
13
15
  }
14
16
  export interface INgxHelperPageGroupItem {
15
17
  readonly index: number;
18
+ readonly id: string;
16
19
  readonly title: string;
17
20
  readonly icon: string;
18
21
  }
@@ -1,7 +1,7 @@
1
1
  import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { Router } from '@angular/router';
3
3
  import { INgxHelperConfig } from '../../../ngx-helper.config';
4
- import { ComponentService } from '../../component.service';
4
+ import { ComponentService, IValueComponentData } from '../../component.service';
5
5
  import { INgxHelperValue } from '../ngx-helper-value.interface';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class NgxHelperValueBoxComponent implements OnInit, OnChanges {
@@ -20,18 +20,10 @@ export declare class NgxHelperValueBoxComponent implements OnInit, OnChanges {
20
20
  emptyText: string;
21
21
  gapSize: string;
22
22
  hideShadow: boolean;
23
- data: {
24
- title: string;
25
- value: string;
26
- action?: () => string[] | void;
27
- copyToClipboard?: boolean;
28
- ltr?: boolean;
29
- english?: boolean;
30
- }[];
23
+ data: IValueComponentData[];
31
24
  copyIndex?: number;
32
25
  private copyTimeout;
33
26
  private componentConfig;
34
- private pipeTransform;
35
27
  constructor(router: Router, componentService: ComponentService, config?: Partial<INgxHelperConfig> | undefined);
36
28
  ngOnInit(): void;
37
29
  ngOnChanges(changes: SimpleChanges): void;
@@ -1,25 +1,19 @@
1
1
  import { OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { Router } from '@angular/router';
3
+ import { ComponentService, IValueComponentData } from '../../component.service';
3
4
  import { INgxHelperValue } from '../ngx-helper-value.interface';
4
5
  import * as i0 from "@angular/core";
5
6
  export declare class NgxHelperValueListComponent implements OnChanges {
6
7
  private readonly router;
8
+ private readonly componentService;
7
9
  private className;
8
10
  values: INgxHelperValue[];
9
11
  titleWidth: string;
10
12
  emptyText: string;
11
- data: {
12
- title: string;
13
- value: string;
14
- action?: () => string[] | void;
15
- copyToClipboard?: boolean;
16
- ltr?: boolean;
17
- english?: boolean;
18
- }[];
13
+ data: IValueComponentData[];
19
14
  copyIndex?: number;
20
15
  private copyTimeout;
21
- private pipeTransform;
22
- constructor(router: Router);
16
+ constructor(router: Router, componentService: ComponentService);
23
17
  ngOnChanges(changes: SimpleChanges): void;
24
18
  onClick(action?: () => string[] | void): void;
25
19
  onCopy(event: Event, index: number): void;
@@ -71,6 +71,7 @@ export type NgxHelperValue = {
71
71
  export interface INgxHelperValue {
72
72
  readonly title: string;
73
73
  readonly value?: string | NgxHelperValue;
74
+ readonly color?: string;
74
75
  readonly action?: () => string[] | void;
75
76
  readonly copyToClipboard?: boolean;
76
77
  }
@@ -0,0 +1,9 @@
1
+ export interface INgxHelperHttpUploadConfig {
2
+ readonly method: 'POST' | 'PUT' | 'PATCH';
3
+ readonly header: {
4
+ [key: string]: any;
5
+ };
6
+ readonly body: {
7
+ [key: string]: any;
8
+ };
9
+ }
@@ -0,0 +1,16 @@
1
+ import { ApplicationRef, Injector } from '@angular/core';
2
+ import { HttpStatusCode } from '@angular/common/http';
3
+ import { INgxHelperHttpUploadConfig } from './ngx-helper-http.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class NgxHelperHttpService {
6
+ private readonly applicationRef;
7
+ private readonly injector;
8
+ private components;
9
+ constructor(applicationRef: ApplicationRef, injector: Injector);
10
+ private getId;
11
+ private updatePositions;
12
+ upload<R, E>(file: File, url: string, onSuccess: (response: R | undefined, status: HttpStatusCode) => void, onError: (error: E | undefined, status: HttpStatusCode) => void): void;
13
+ upload<R, E>(file: File, url: string, config: Partial<INgxHelperHttpUploadConfig>, onSuccess: (response: R, status: HttpStatusCode) => void, onError: (error: E, status: HttpStatusCode) => void): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxHelperHttpService, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxHelperHttpService>;
16
+ }
@@ -0,0 +1,21 @@
1
+ import { AfterViewInit } from '@angular/core';
2
+ import { HttpClient, HttpStatusCode } from '@angular/common/http';
3
+ import { INgxHelperHttpUploadConfig } from '../ngx-helper-http.interface';
4
+ import * as i0 from "@angular/core";
5
+ export declare class UploadComponent<R, E> implements AfterViewInit {
6
+ private readonly httpClient;
7
+ private className;
8
+ private host;
9
+ bottom: string;
10
+ id: string;
11
+ file: File;
12
+ url: string;
13
+ config: Partial<INgxHelperHttpUploadConfig>;
14
+ close: (type: 'RESPONSE' | 'ERROR', result: any, status: HttpStatusCode) => void;
15
+ progress: number;
16
+ constructor(httpClient: HttpClient);
17
+ ngAfterViewInit(): void;
18
+ upload(): void;
19
+ static ɵfac: i0.ɵɵFactoryDeclaration<UploadComponent<any, any>, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<UploadComponent<any, any>, "ng-component", never, {}, {}, never, never, true, never>;
21
+ }
package/ngx-helper-m3.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /* GLOBAL VALUES */
2
2
  :root {
3
- --ngx-helper-m3-toolbar-height: 40px;
3
+ --ngx-helper-m3-page-group-toolbar-height: 40px;
4
4
  }
5
5
 
6
6
  /* NGX HELPER CONFIRM */
@@ -79,6 +79,64 @@
79
79
  }
80
80
  }
81
81
 
82
+ /* NGX HELPER HTTP (UPLOAD / DOWNLOAD) */
83
+ .ngx-helper-m3-http {
84
+ position: fixed;
85
+ left: 1rem;
86
+
87
+ direction: ltr;
88
+ display: block;
89
+ height: 40px;
90
+ overflow: hidden;
91
+ width: calc(100vw - 4rem);
92
+ max-width: 250px;
93
+ transition: all 0.35s ease-out;
94
+ z-index: 5000;
95
+
96
+ border-radius: 8px;
97
+ border: 1px solid var(--outline-variant);
98
+ background-color: var(--surface-container);
99
+
100
+ .content {
101
+ display: flex;
102
+ align-items: center;
103
+ column-gap: 0.5rem;
104
+
105
+ height: 37px;
106
+ padding: 0 0.5rem;
107
+
108
+ .file {
109
+ flex: 1;
110
+
111
+ font-size: 90%;
112
+
113
+ text-align: left;
114
+ direction: ltr;
115
+
116
+ white-space: nowrap;
117
+ overflow: hidden;
118
+ text-overflow: ellipsis;
119
+ }
120
+ }
121
+
122
+ .progress-container {
123
+ width: 100%;
124
+ height: 3px;
125
+ background-color: var(--outline-variant);
126
+ position: relative;
127
+
128
+ .progress-value {
129
+ position: absolute;
130
+ top: 0;
131
+ bottom: 0;
132
+ left: 0;
133
+
134
+ background-color: var(--primary);
135
+ transition: all 0.35s ease-out;
136
+ }
137
+ }
138
+ }
139
+
82
140
  /* NGX HELPER VALUE LIST */
83
141
  .ngx-helper-m3-box {
84
142
  display: block;
@@ -158,6 +216,7 @@
158
216
  justify-content: center;
159
217
  column-gap: 0.25rem;
160
218
 
219
+ border-radius: 0;
161
220
  padding: 0 0.75rem;
162
221
  min-width: auto;
163
222
  height: 55px;
@@ -274,7 +333,8 @@
274
333
  flex: 1;
275
334
  display: block;
276
335
 
277
- header {
336
+ .header {
337
+ z-index: 1;
278
338
  background-color: var(--background);
279
339
 
280
340
  .spacer {
@@ -296,7 +356,7 @@
296
356
 
297
357
  box-sizing: border-box;
298
358
  background-color: var(--surface-container-high);
299
- height: calc(var(--ngx-helper-m3-toolbar-height));
359
+ height: calc(var(--ngx-helper-m3-page-group-toolbar-height));
300
360
  overflow: hidden;
301
361
  width: 100%;
302
362
  z-index: 2;
@@ -307,7 +367,7 @@
307
367
  column-gap: 0.25rem;
308
368
 
309
369
  padding: 0 1rem;
310
- height: var(--ngx-helper-m3-toolbar-height);
370
+ height: var(--ngx-helper-m3-page-group-toolbar-height);
311
371
  transition: all 0.3s ease-in-out;
312
372
 
313
373
  .title {
@@ -332,6 +392,7 @@
332
392
  }
333
393
 
334
394
  .page-group-spacer {
395
+ z-index: 1;
335
396
  height: 1rem;
336
397
  width: 100%;
337
398
  background-color: var(--background);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webilix/ngx-helper-m3",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "author": "Ali Amirnezhad",
5
5
  "description": "Helper library for Angular and Material 3",
6
6
  "repository": {
package/public-api.d.ts CHANGED
@@ -29,3 +29,5 @@ export * from './lib/confirm/confirm.interface';
29
29
  export * from './lib/confirm/confirm.service';
30
30
  export * from './lib/container/container.interface';
31
31
  export * from './lib/container/container.service';
32
+ export * from './lib/http/ngx-helper-http.interface';
33
+ export * from './lib/http/ngx-helper-http.service';
@@ -1,2 +0,0 @@
1
- import { NgxHelperValue } from './ngx-helper-value.interface';
2
- export declare const ltrValues: NgxHelperValue['type'][];