shirkasoft-ui-components 1.3.0 → 1.3.2
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/fesm2022/shirkasoft-ui-components-file-upload.mjs +55 -3
- package/fesm2022/shirkasoft-ui-components-file-upload.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-price-input.mjs +196 -17
- package/fesm2022/shirkasoft-ui-components-price-input.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-timeline.mjs +4 -4
- package/fesm2022/shirkasoft-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs +6 -1
- package/fesm2022/shirkasoft-ui-components-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shirkasoft-ui-components-file-upload.d.ts +37 -3
- package/types/shirkasoft-ui-components-price-input.d.ts +59 -10
- package/types/shirkasoft-ui-components-timeline.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { OnDestroy } from '@angular/core';
|
|
2
3
|
|
|
3
4
|
interface FileUploadError {
|
|
4
5
|
type: 'size' | 'type';
|
|
5
6
|
message: string;
|
|
6
7
|
file: File;
|
|
7
8
|
}
|
|
9
|
+
interface ExistingFile {
|
|
10
|
+
id?: number | string;
|
|
11
|
+
name: string;
|
|
12
|
+
url?: string;
|
|
13
|
+
mimeType?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
}
|
|
8
16
|
/**
|
|
9
17
|
* Shirkasoft UI Components.
|
|
10
18
|
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
@@ -14,7 +22,7 @@ interface FileUploadError {
|
|
|
14
22
|
* Drag & drop file uploader with file type/size validation, image previews,
|
|
15
23
|
* multiple files support and localized error messages.
|
|
16
24
|
*/
|
|
17
|
-
declare class FileUploadComponent {
|
|
25
|
+
declare class FileUploadComponent implements OnDestroy {
|
|
18
26
|
protected getIcon: (name: any) => any;
|
|
19
27
|
private transloco;
|
|
20
28
|
/** Main label of the uploader. */
|
|
@@ -33,6 +41,10 @@ declare class FileUploadComponent {
|
|
|
33
41
|
changeFilesText: _angular_core.InputSignal<string>;
|
|
34
42
|
/** Enables selecting more than one file at once. */
|
|
35
43
|
multiple: _angular_core.InputSignal<boolean>;
|
|
44
|
+
/** Files already stored by the parent (read-only; the component only emits events). */
|
|
45
|
+
existingFiles: _angular_core.InputSignal<ExistingFile[]>;
|
|
46
|
+
/** How existing files are rendered. */
|
|
47
|
+
existingDisplay: _angular_core.InputSignal<"chips" | "tiles">;
|
|
36
48
|
/** Emitted with the currently selected files. */
|
|
37
49
|
fileSelected: _angular_core.OutputEmitterRef<File[]>;
|
|
38
50
|
/** Emitted when the last selected file is removed. */
|
|
@@ -41,6 +53,10 @@ declare class FileUploadComponent {
|
|
|
41
53
|
fileError: _angular_core.OutputEmitterRef<FileUploadError>;
|
|
42
54
|
/** Emitted when a file is near the size limit. */
|
|
43
55
|
fileWarning: _angular_core.OutputEmitterRef<FileUploadError>;
|
|
56
|
+
/** Emitted when an existing file is requested for download/view. */
|
|
57
|
+
existingFileAction: _angular_core.OutputEmitterRef<ExistingFile>;
|
|
58
|
+
/** Emitted when an existing file should be removed (parent deletes it). */
|
|
59
|
+
existingFileRemove: _angular_core.OutputEmitterRef<ExistingFile>;
|
|
44
60
|
/** Currently selected files. */
|
|
45
61
|
selectedFiles: _angular_core.WritableSignal<File[]>;
|
|
46
62
|
/** Localized error message displayed to the user. */
|
|
@@ -77,11 +93,29 @@ declare class FileUploadComponent {
|
|
|
77
93
|
changeFiles(): void;
|
|
78
94
|
/** Revokes every stored preview object URL. */
|
|
79
95
|
private clearPreviews;
|
|
96
|
+
/** Revokes pending preview URLs when the component is destroyed. */
|
|
97
|
+
ngOnDestroy(): void;
|
|
98
|
+
/** Emits the action (download/view) for an existing file. */
|
|
99
|
+
onExistingAction(file: ExistingFile): void;
|
|
100
|
+
/** Emits the removal request for an existing file. */
|
|
101
|
+
onExistingRemove(file: ExistingFile): void;
|
|
102
|
+
/** Whether an existing file is an image (by mime type or extension). */
|
|
103
|
+
isExistingImage(file: ExistingFile): boolean;
|
|
104
|
+
/** Resolves the extension of a file name. */
|
|
105
|
+
getExtension(name: string): string;
|
|
106
|
+
/** Icon + colored badge shown for non-image files, hinting at the type. */
|
|
107
|
+
getExistingBadge(file: ExistingFile): {
|
|
108
|
+
label: string;
|
|
109
|
+
color: string;
|
|
110
|
+
icon: string;
|
|
111
|
+
};
|
|
112
|
+
/** trackBy for existing files. */
|
|
113
|
+
trackExistingFile(file: ExistingFile): any;
|
|
80
114
|
/** Human readable size (B/KB/MB). */
|
|
81
115
|
private formatFileSize;
|
|
82
116
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FileUploadComponent, never>;
|
|
83
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileUploadComponent, "shk-file-upload", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "fileUploadText": { "alias": "fileUploadText"; "required": false; "isSignal": true; }; "fileRecommendation": { "alias": "fileRecommendation"; "required": false; "isSignal": true; }; "changeFilesText": { "alias": "changeFilesText"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, { "fileSelected": "fileSelected"; "fileRemoved": "fileRemoved"; "fileError": "fileError"; "fileWarning": "fileWarning"; }, never, never, true, never>;
|
|
117
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FileUploadComponent, "shk-file-upload", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "maxFileSize": { "alias": "maxFileSize"; "required": false; "isSignal": true; }; "maxFiles": { "alias": "maxFiles"; "required": false; "isSignal": true; }; "fileUploadText": { "alias": "fileUploadText"; "required": false; "isSignal": true; }; "fileRecommendation": { "alias": "fileRecommendation"; "required": false; "isSignal": true; }; "changeFilesText": { "alias": "changeFilesText"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "existingFiles": { "alias": "existingFiles"; "required": false; "isSignal": true; }; "existingDisplay": { "alias": "existingDisplay"; "required": false; "isSignal": true; }; }, { "fileSelected": "fileSelected"; "fileRemoved": "fileRemoved"; "fileError": "fileError"; "fileWarning": "fileWarning"; "existingFileAction": "existingFileAction"; "existingFileRemove": "existingFileRemove"; }, never, never, true, never>;
|
|
84
118
|
}
|
|
85
119
|
|
|
86
120
|
export { FileUploadComponent };
|
|
87
|
-
export type { FileUploadError };
|
|
121
|
+
export type { ExistingFile, FileUploadError };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, FormControl } from '@angular/forms';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Shirkasoft UI Components.
|
|
@@ -6,13 +7,21 @@ import * as _angular_core from '@angular/core';
|
|
|
6
7
|
* Belongs to Shirkasoft.
|
|
7
8
|
*/
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* Currency/percentage numeric input with reactive forms support.
|
|
11
|
+
*
|
|
12
|
+
* Binding modes (highest precedence first):
|
|
13
|
+
* - `control`: a FormControl (or use it inside a form with `formControlName`).
|
|
14
|
+
* - `value`/`valueChange` or `[(value)]`: two-way model signals.
|
|
15
|
+
*
|
|
16
|
+
* Text-based input (`type="text"` + `inputmode="decimal"`) with decimal
|
|
17
|
+
* precision control, min/max clamping on blur and thousands formatting.
|
|
11
18
|
*/
|
|
12
|
-
declare class PriceInputComponent {
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
19
|
+
declare class PriceInputComponent implements ControlValueAccessor {
|
|
20
|
+
/** Reactive control. When provided it takes precedence over `value`/`valueChange`. */
|
|
21
|
+
control: _angular_core.InputSignal<FormControl<number | null> | undefined>;
|
|
22
|
+
/** Numeric value (two-way), used when no `control` is bound. */
|
|
23
|
+
value: _angular_core.ModelSignal<number | null>;
|
|
24
|
+
/** Whether the input works as a percentage (two-way). */
|
|
16
25
|
isPercentage: _angular_core.ModelSignal<boolean>;
|
|
17
26
|
/** Label displayed above the field. */
|
|
18
27
|
label: _angular_core.InputSignal<string>;
|
|
@@ -22,20 +31,60 @@ declare class PriceInputComponent {
|
|
|
22
31
|
required: _angular_core.InputSignal<boolean>;
|
|
23
32
|
/** Disables the input. */
|
|
24
33
|
disabled: _angular_core.InputSignal<boolean>;
|
|
25
|
-
/** Minimum allowed value. */
|
|
34
|
+
/** Minimum allowed value (clamped on blur). */
|
|
26
35
|
min: _angular_core.InputSignal<number>;
|
|
27
|
-
/** Maximum allowed value. */
|
|
36
|
+
/** Maximum allowed value (clamped on blur). */
|
|
28
37
|
max: _angular_core.InputSignal<number>;
|
|
38
|
+
/** Maximum number of decimal places (0 = integer). */
|
|
39
|
+
decimals: _angular_core.InputSignal<number>;
|
|
40
|
+
/** Symbol shown in the mode toggle button when not a percentage. */
|
|
41
|
+
currency: _angular_core.InputSignal<string>;
|
|
42
|
+
/** Placeholder text of the native input. */
|
|
43
|
+
placeholder: _angular_core.InputSignal<string>;
|
|
44
|
+
/** Accessible label; falls back to `label`. */
|
|
45
|
+
ariaLabel: _angular_core.InputSignal<string>;
|
|
46
|
+
/** Blocks the minus sign from being typed. */
|
|
47
|
+
preventNegative: _angular_core.InputSignal<boolean>;
|
|
29
48
|
/** Shows the error styling on the field. */
|
|
30
49
|
showError: _angular_core.InputSignal<boolean>;
|
|
31
50
|
/** Message rendered when the field is in error state. */
|
|
32
51
|
errorMessage: _angular_core.InputSignal<string>;
|
|
52
|
+
private destroyRef;
|
|
53
|
+
/** Text currently shown in the input (raw while focused, formatted on blur). */
|
|
54
|
+
displayText: _angular_core.WritableSignal<string>;
|
|
55
|
+
/** Whether the native input currently has focus. */
|
|
56
|
+
focused: _angular_core.WritableSignal<boolean>;
|
|
57
|
+
/** Disabled state coming from the reactive control. */
|
|
58
|
+
private controlDisabled;
|
|
59
|
+
/** Prevents re-subscribing to the same form control. */
|
|
60
|
+
private ctrlSubscribed;
|
|
61
|
+
/** Effective disabled state combining the input and the form binding. */
|
|
62
|
+
isDisabled: _angular_core.Signal<boolean>;
|
|
63
|
+
/** Callbacks used by the ControlValueAccessor contract. */
|
|
64
|
+
private onChange;
|
|
65
|
+
private onTouched;
|
|
66
|
+
constructor();
|
|
33
67
|
/** Toggles between amount and percentage modes (unless disabled). */
|
|
34
68
|
toggleMode(): void;
|
|
35
|
-
/**
|
|
69
|
+
/** Selects the whole value on focus so the user can type over it. */
|
|
70
|
+
onFocus(event: FocusEvent): void;
|
|
71
|
+
/** Clamps, rounds and formats the value when the field loses focus. */
|
|
72
|
+
onBlur(): void;
|
|
73
|
+
/** Blocks characters that would break the numeric format. */
|
|
74
|
+
onKeydown(event: KeyboardEvent): void;
|
|
75
|
+
/** Sanitizes the raw input (digits + one separator + optional sign) and writes the value once. */
|
|
36
76
|
onInput(event: Event): void;
|
|
77
|
+
/** Writes the value to the effective binding source. */
|
|
78
|
+
private setValue;
|
|
79
|
+
private roundTo;
|
|
80
|
+
/** Formats a number with thousands separator and up to `decimals` places. */
|
|
81
|
+
private formatNumber;
|
|
82
|
+
writeValue(value: any): void;
|
|
83
|
+
registerOnChange(fn: any): void;
|
|
84
|
+
registerOnTouched(fn: any): void;
|
|
85
|
+
setDisabledState(isDisabled: boolean): void;
|
|
37
86
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<PriceInputComponent, never>;
|
|
38
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PriceInputComponent, "shk-price-input", never, { "value": { "alias": "value"; "required":
|
|
87
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<PriceInputComponent, "shk-price-input", never, { "control": { "alias": "control"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "isPercentage": { "alias": "isPercentage"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "inputId": { "alias": "inputId"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "decimals": { "alias": "decimals"; "required": false; "isSignal": true; }; "currency": { "alias": "currency"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "preventNegative": { "alias": "preventNegative"; "required": false; "isSignal": true; }; "showError": { "alias": "showError"; "required": false; "isSignal": true; }; "errorMessage": { "alias": "errorMessage"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "isPercentage": "isPercentageChange"; }, never, never, true, never>;
|
|
39
88
|
}
|
|
40
89
|
|
|
41
90
|
export { PriceInputComponent };
|
|
@@ -72,7 +72,7 @@ interface TimelineSubItemAction {
|
|
|
72
72
|
isVisible?: (item: TimelineItem, subItem: TimelineSubItem) => boolean;
|
|
73
73
|
isDisabled?: (item: TimelineItem, subItem: TimelineSubItem) => boolean;
|
|
74
74
|
}
|
|
75
|
-
type TimelineAlignment = 'left' | 'alternate';
|
|
75
|
+
type TimelineAlignment = 'left' | 'alternate' | 'split';
|
|
76
76
|
type TimelineMarkerSize = 'sm' | 'md' | 'lg';
|
|
77
77
|
declare const DEFAULT_MARKER_GRADIENTS: string[];
|
|
78
78
|
/** Supplier-type style palette used by the original wac-app timeline. */
|
|
@@ -86,7 +86,7 @@ declare class TimelineComponent {
|
|
|
86
86
|
protected getIcon: (name: any) => any;
|
|
87
87
|
/** Timeline data. */
|
|
88
88
|
items: _angular_core.InputSignal<TimelineItem[]>;
|
|
89
|
-
/** 'left' = line and markers on the left; 'alternate' = cards alternate around a centered line on lg
|
|
89
|
+
/** 'left' = line and markers on the left; 'alternate' = cards alternate around a centered line on lg+; 'split' = markers centered with days on the left and activities on the right. */
|
|
90
90
|
alignment: _angular_core.InputSignal<TimelineAlignment>;
|
|
91
91
|
/** Shows/hides the vertical connector line. */
|
|
92
92
|
showLine: _angular_core.InputSignal<boolean>;
|