@net7/components 4.0.1 → 4.1.0
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/esm2020/lib/components/file-selector/file-selector.mjs +39 -0
- package/esm2020/lib/components/file-selector/file-selector.mock.mjs +5 -0
- package/esm2020/lib/components/input-text/input-text.mjs +13 -3
- package/esm2020/lib/dv-components-lib.module.mjs +5 -1
- package/esm2020/public-api.mjs +3 -1
- package/fesm2015/net7-components.mjs +55 -3
- package/fesm2015/net7-components.mjs.map +1 -1
- package/fesm2020/net7-components.mjs +55 -3
- package/fesm2020/net7-components.mjs.map +1 -1
- package/lib/components/file-selector/file-selector.d.ts +29 -0
- package/lib/components/file-selector/file-selector.mock.d.ts +2 -0
- package/lib/components/input-text/input-text.d.ts +2 -0
- package/lib/dv-components-lib.module.d.ts +35 -34
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/src/lib/styles/components/_file-selector.scss +29 -0
|
@@ -752,6 +752,40 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
752
752
|
type: Input
|
|
753
753
|
}] } });
|
|
754
754
|
|
|
755
|
+
//---------------------------
|
|
756
|
+
class FileSelectorComponent {
|
|
757
|
+
onFileSelected(eventTarget) {
|
|
758
|
+
if (!this.emit)
|
|
759
|
+
return;
|
|
760
|
+
const input = eventTarget;
|
|
761
|
+
const iterableFiles = Array.from(input.files);
|
|
762
|
+
Promise
|
|
763
|
+
.all(iterableFiles.map((file) => this.toBase64(file)))
|
|
764
|
+
.then((base64list) => {
|
|
765
|
+
this.emit('change', { target: eventTarget, files: input.files, base64: base64list });
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/** Obtain base64 string for upload and storage */
|
|
769
|
+
toBase64(file) {
|
|
770
|
+
return new Promise((resolve, reject) => {
|
|
771
|
+
const reader = new FileReader();
|
|
772
|
+
reader.onerror = (err) => reject(err);
|
|
773
|
+
reader.onload = () => resolve(reader.result);
|
|
774
|
+
reader.readAsDataURL(file);
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
FileSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: FileSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
779
|
+
FileSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: FileSelectorComponent, selector: "n7-file-selector", inputs: { data: "data", emit: "emit" }, ngImport: i0, template: "<ng-container *ngIf=\"data\">\n <!-- HIDDEN NATIVE INPUT ELEMENT -->\n <input type=\"file\"\n class=\"file-input\"\n [accept]=\"data.accept\"\n [multiple]=\"data.multiple\"\n (change)=\"onFileSelected($event.target)\"\n [ngStyle]=\"{'display': 'none'}\"\n #fileUpload>\n \n <!-- CAPTURES THE CLICKS ON THE INNER CONTENT -->\n <div class=\"n7-file-selector\"\n (click)=\"fileUpload.click()\">\n <ng-content>\n <!-- UI ELEMENTS FOR IMAGE UPLOAD -->\n </ng-content>\n </div>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
780
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: FileSelectorComponent, decorators: [{
|
|
781
|
+
type: Component,
|
|
782
|
+
args: [{ selector: 'n7-file-selector', template: "<ng-container *ngIf=\"data\">\n <!-- HIDDEN NATIVE INPUT ELEMENT -->\n <input type=\"file\"\n class=\"file-input\"\n [accept]=\"data.accept\"\n [multiple]=\"data.multiple\"\n (change)=\"onFileSelected($event.target)\"\n [ngStyle]=\"{'display': 'none'}\"\n #fileUpload>\n \n <!-- CAPTURES THE CLICKS ON THE INNER CONTENT -->\n <div class=\"n7-file-selector\"\n (click)=\"fileUpload.click()\">\n <ng-content>\n <!-- UI ELEMENTS FOR IMAGE UPLOAD -->\n </ng-content>\n </div>\n</ng-container>\n" }]
|
|
783
|
+
}], propDecorators: { data: [{
|
|
784
|
+
type: Input
|
|
785
|
+
}], emit: [{
|
|
786
|
+
type: Input
|
|
787
|
+
}] } });
|
|
788
|
+
|
|
755
789
|
//---------------------------
|
|
756
790
|
class InputSelectComponent {
|
|
757
791
|
onChange(inputPayload, value) {
|
|
@@ -1425,12 +1459,22 @@ class InputTextComponent {
|
|
|
1425
1459
|
return;
|
|
1426
1460
|
this.emit('change', { inputPayload, value });
|
|
1427
1461
|
}
|
|
1462
|
+
onBlur() {
|
|
1463
|
+
if (!this.emit)
|
|
1464
|
+
return;
|
|
1465
|
+
this.emit('blur');
|
|
1466
|
+
}
|
|
1467
|
+
onFocus() {
|
|
1468
|
+
if (!this.emit)
|
|
1469
|
+
return;
|
|
1470
|
+
this.emit('focus');
|
|
1471
|
+
}
|
|
1428
1472
|
}
|
|
1429
1473
|
InputTextComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: InputTextComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1430
|
-
InputTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: InputTextComponent, selector: "n7-input-text", inputs: { data: "data", emit: "emit" }, ngImport: i0, template: "<div *ngIf=\"data as input\"\n class=\"n7-input-text\">\n <label *ngIf=\"input.label\"\n class=\"n7-input-text__label\"\n for=\"{{ input.id }}\"\n [innerHTML]=\"input.label\">\n </label>\n <div class=\"n7-input-text__wrapper\"\n [ngClass]=\"{\n 'has-icon': !!input.icon\n }\">\n <input id=\"{{ input.id }}\"\n class=\"n7-input-text__text\"\n [ngClass]=\"input.classes\"\n [type]=\"input.type ? input.type : 'text'\"\n [attr.name]=\"input.name\"\n [value]=\"input.value || null\"\n [attr.placeholder]=\"input.placeholder\"\n [attr.autocomplete]=\"input.autocomplete\"\n [disabled]=\"input.disabled\"\n [required]=\"input.required\"\n [attr.max]=\"input.max\"\n [attr.min]=\"input.min\"\n [attr.maxlength]=\"input.maxlength\"\n [attr.minlength]=\"input.minlength\"\n (input)=\"onChange(input.inputPayload, $event.target.value)\"\n (keyup.enter)=\"onChange(input.enterPayload, $event.target.value)\">\n <span *ngIf=\"input.icon\"\n class=\"n7-input-text__icon {{input.icon || ''}}\"\n (click)=\"onChange(input.iconPayload)\">\n </span>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1474
|
+
InputTextComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: InputTextComponent, selector: "n7-input-text", inputs: { data: "data", emit: "emit" }, ngImport: i0, template: "<div *ngIf=\"data as input\"\n class=\"n7-input-text\">\n <label *ngIf=\"input.label\"\n class=\"n7-input-text__label\"\n for=\"{{ input.id }}\"\n [innerHTML]=\"input.label\">\n </label>\n <div class=\"n7-input-text__wrapper\"\n [ngClass]=\"{\n 'has-icon': !!input.icon\n }\">\n <input id=\"{{ input.id }}\"\n class=\"n7-input-text__text\"\n [ngClass]=\"input.classes\"\n [type]=\"input.type ? input.type : 'text'\"\n [attr.name]=\"input.name\"\n [value]=\"input.value || null\"\n [attr.placeholder]=\"input.placeholder\"\n [attr.autocomplete]=\"input.autocomplete\"\n [disabled]=\"input.disabled\"\n [required]=\"input.required\"\n [attr.max]=\"input.max\"\n [attr.min]=\"input.min\"\n [attr.maxlength]=\"input.maxlength\"\n [attr.minlength]=\"input.minlength\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (input)=\"onChange(input.inputPayload, $event.target.value)\"\n (keyup.enter)=\"onChange(input.enterPayload, $event.target.value)\">\n <span *ngIf=\"input.icon\"\n class=\"n7-input-text__icon {{input.icon || ''}}\"\n (click)=\"onChange(input.iconPayload)\">\n </span>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
1431
1475
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: InputTextComponent, decorators: [{
|
|
1432
1476
|
type: Component,
|
|
1433
|
-
args: [{ selector: 'n7-input-text', template: "<div *ngIf=\"data as input\"\n class=\"n7-input-text\">\n <label *ngIf=\"input.label\"\n class=\"n7-input-text__label\"\n for=\"{{ input.id }}\"\n [innerHTML]=\"input.label\">\n </label>\n <div class=\"n7-input-text__wrapper\"\n [ngClass]=\"{\n 'has-icon': !!input.icon\n }\">\n <input id=\"{{ input.id }}\"\n class=\"n7-input-text__text\"\n [ngClass]=\"input.classes\"\n [type]=\"input.type ? input.type : 'text'\"\n [attr.name]=\"input.name\"\n [value]=\"input.value || null\"\n [attr.placeholder]=\"input.placeholder\"\n [attr.autocomplete]=\"input.autocomplete\"\n [disabled]=\"input.disabled\"\n [required]=\"input.required\"\n [attr.max]=\"input.max\"\n [attr.min]=\"input.min\"\n [attr.maxlength]=\"input.maxlength\"\n [attr.minlength]=\"input.minlength\"\n (input)=\"onChange(input.inputPayload, $event.target.value)\"\n (keyup.enter)=\"onChange(input.enterPayload, $event.target.value)\">\n <span *ngIf=\"input.icon\"\n class=\"n7-input-text__icon {{input.icon || ''}}\"\n (click)=\"onChange(input.iconPayload)\">\n </span>\n </div>\n</div>\n" }]
|
|
1477
|
+
args: [{ selector: 'n7-input-text', template: "<div *ngIf=\"data as input\"\n class=\"n7-input-text\">\n <label *ngIf=\"input.label\"\n class=\"n7-input-text__label\"\n for=\"{{ input.id }}\"\n [innerHTML]=\"input.label\">\n </label>\n <div class=\"n7-input-text__wrapper\"\n [ngClass]=\"{\n 'has-icon': !!input.icon\n }\">\n <input id=\"{{ input.id }}\"\n class=\"n7-input-text__text\"\n [ngClass]=\"input.classes\"\n [type]=\"input.type ? input.type : 'text'\"\n [attr.name]=\"input.name\"\n [value]=\"input.value || null\"\n [attr.placeholder]=\"input.placeholder\"\n [attr.autocomplete]=\"input.autocomplete\"\n [disabled]=\"input.disabled\"\n [required]=\"input.required\"\n [attr.max]=\"input.max\"\n [attr.min]=\"input.min\"\n [attr.maxlength]=\"input.maxlength\"\n [attr.minlength]=\"input.minlength\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (input)=\"onChange(input.inputPayload, $event.target.value)\"\n (keyup.enter)=\"onChange(input.enterPayload, $event.target.value)\">\n <span *ngIf=\"input.icon\"\n class=\"n7-input-text__icon {{input.icon || ''}}\"\n (click)=\"onChange(input.iconPayload)\">\n </span>\n </div>\n</div>\n" }]
|
|
1434
1478
|
}], propDecorators: { data: [{
|
|
1435
1479
|
type: Input
|
|
1436
1480
|
}], emit: [{
|
|
@@ -1903,6 +1947,7 @@ const COMPONENTS = [
|
|
|
1903
1947
|
FacetComponent,
|
|
1904
1948
|
FacetHeaderComponent,
|
|
1905
1949
|
FacetYearRangeComponent,
|
|
1950
|
+
FileSelectorComponent,
|
|
1906
1951
|
FooterComponent,
|
|
1907
1952
|
HeaderComponent,
|
|
1908
1953
|
HeroComponent,
|
|
@@ -1953,6 +1998,7 @@ DvComponentsLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1953
1998
|
FacetComponent,
|
|
1954
1999
|
FacetHeaderComponent,
|
|
1955
2000
|
FacetYearRangeComponent,
|
|
2001
|
+
FileSelectorComponent,
|
|
1956
2002
|
FooterComponent,
|
|
1957
2003
|
HeaderComponent,
|
|
1958
2004
|
HeroComponent,
|
|
@@ -1998,6 +2044,7 @@ DvComponentsLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
1998
2044
|
FacetComponent,
|
|
1999
2045
|
FacetHeaderComponent,
|
|
2000
2046
|
FacetYearRangeComponent,
|
|
2047
|
+
FileSelectorComponent,
|
|
2001
2048
|
FooterComponent,
|
|
2002
2049
|
HeaderComponent,
|
|
2003
2050
|
HeroComponent,
|
|
@@ -3633,6 +3680,11 @@ const FACET_MOCK = {
|
|
|
3633
3680
|
}]
|
|
3634
3681
|
};
|
|
3635
3682
|
|
|
3683
|
+
const FILE_SELECTOR_MOCK = {
|
|
3684
|
+
accept: 'image/*',
|
|
3685
|
+
classes: 'file-selector-wrapper'
|
|
3686
|
+
};
|
|
3687
|
+
|
|
3636
3688
|
const FOOTER_MOCK = {
|
|
3637
3689
|
columns: [
|
|
3638
3690
|
{
|
|
@@ -5378,5 +5430,5 @@ const WIZARD_MOCK = {
|
|
|
5378
5430
|
* Generated bundle index. Do not edit.
|
|
5379
5431
|
*/
|
|
5380
5432
|
|
|
5381
|
-
export { ADVANCED_AUTOCOMPLETE_MOCK, ALERT_MOCK, AVATAR_MOCK, AdvancedAutocompleteComponent, AlertComponent, AnchorWrapperComponent, AvatarComponent, BREADCRUMBS_MOCK, BUBBLECHART_MOCK, BUTTON_MOCK, BreadcrumbsComponent, BubbleChartComponent, ButtonComponent, CAROUSEL_MOCK, CHART_MOCK, CONTENT_PLACEHOLDER_MOCK, CarouselComponent, ChartComponent, ContentPlaceholderComponent, DATA_WIDGET_MOCK, DATEPICKER_MOCK, DataWidgetComponent, DatepickerComponent, DvComponentsLibModule, FACET_HEADER_MOCK, FACET_MOCK, FACET_YEAR_RANGE_MOCK, FOOTER_MOCK, FacetComponent, FacetHeaderComponent, FacetYearRangeComponent, FooterComponent, HEADER_MOCK, HERO_MOCK, HISTOGRAM_RANGE_MOCK, HeaderComponent, HeroComponent, HistogramRangeComponent, ICON_MOCK, IMAGE_VIEWER_MOCK, IMAGE_VIEWER_TOOLS_MOCK, INNER_TITLE_MOCK, INPUT_CHECKBOX_MOCK, INPUT_LINK_MOCK, INPUT_SELECT_MOCK, INPUT_TEXTAREA_MOCK, INPUT_TEXT_MOCK, ITEM_PREVIEW_MOCK, IconComponent, ImageViewerComponent, ImageViewerToolsComponent, InnerTitleComponent, InputCheckboxComponent, InputLinkComponent, InputSelectComponent, InputTextComponent, InputTextareaComponent, ItemPreviewComponent, LOADER_MOCK, LoaderComponent, MAP_MOCK, METADATA_VIEWER_MOCK, MapComponent, MetadataViewerComponent, NAV_MOCK, NavComponent, PAGINATION_MOCK, PROGRESS_LINE_MOCK, PaginationComponent, ProgressLineComponent, SIDEBAR_HEADER_MOCK, SIGNUP_MOCK, SIMPLE_AUTOCOMPLETE_MOCK, SidebarHeaderComponent, SignupComponent, SimpleAutocompleteComponent, TABLE_MOCK, TAG_MOCK, TEXT_VIEWER_MOCK, TIMELINE_MOCK, TOAST_MOCK, TOOLTIP_CONTENT_MOCK, TREE_MOCK, TableComponent, TagComponent, TextViewerComponent, TimelineComponent, ToastComponent, TooltipContentComponent, TreeComponent, WIZARD_MOCK, WizardComponent };
|
|
5433
|
+
export { ADVANCED_AUTOCOMPLETE_MOCK, ALERT_MOCK, AVATAR_MOCK, AdvancedAutocompleteComponent, AlertComponent, AnchorWrapperComponent, AvatarComponent, BREADCRUMBS_MOCK, BUBBLECHART_MOCK, BUTTON_MOCK, BreadcrumbsComponent, BubbleChartComponent, ButtonComponent, CAROUSEL_MOCK, CHART_MOCK, CONTENT_PLACEHOLDER_MOCK, CarouselComponent, ChartComponent, ContentPlaceholderComponent, DATA_WIDGET_MOCK, DATEPICKER_MOCK, DataWidgetComponent, DatepickerComponent, DvComponentsLibModule, FACET_HEADER_MOCK, FACET_MOCK, FACET_YEAR_RANGE_MOCK, FILE_SELECTOR_MOCK, FOOTER_MOCK, FacetComponent, FacetHeaderComponent, FacetYearRangeComponent, FileSelectorComponent, FooterComponent, HEADER_MOCK, HERO_MOCK, HISTOGRAM_RANGE_MOCK, HeaderComponent, HeroComponent, HistogramRangeComponent, ICON_MOCK, IMAGE_VIEWER_MOCK, IMAGE_VIEWER_TOOLS_MOCK, INNER_TITLE_MOCK, INPUT_CHECKBOX_MOCK, INPUT_LINK_MOCK, INPUT_SELECT_MOCK, INPUT_TEXTAREA_MOCK, INPUT_TEXT_MOCK, ITEM_PREVIEW_MOCK, IconComponent, ImageViewerComponent, ImageViewerToolsComponent, InnerTitleComponent, InputCheckboxComponent, InputLinkComponent, InputSelectComponent, InputTextComponent, InputTextareaComponent, ItemPreviewComponent, LOADER_MOCK, LoaderComponent, MAP_MOCK, METADATA_VIEWER_MOCK, MapComponent, MetadataViewerComponent, NAV_MOCK, NavComponent, PAGINATION_MOCK, PROGRESS_LINE_MOCK, PaginationComponent, ProgressLineComponent, SIDEBAR_HEADER_MOCK, SIGNUP_MOCK, SIMPLE_AUTOCOMPLETE_MOCK, SidebarHeaderComponent, SignupComponent, SimpleAutocompleteComponent, TABLE_MOCK, TAG_MOCK, TEXT_VIEWER_MOCK, TIMELINE_MOCK, TOAST_MOCK, TOOLTIP_CONTENT_MOCK, TREE_MOCK, TableComponent, TagComponent, TextViewerComponent, TimelineComponent, ToastComponent, TooltipContentComponent, TreeComponent, WIZARD_MOCK, WizardComponent };
|
|
5382
5434
|
//# sourceMappingURL=net7-components.mjs.map
|