@klippa/ngx-enhancy-forms 9.5.0 → 9.6.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/bundles/klippa-ngx-enhancy-forms.umd.js +16 -3
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
- package/esm2015/lib/elements/file-input/file-input.component.js +18 -5
- package/esm2015/lib/form/form.component.js +1 -1
- package/fesm2015/klippa-ngx-enhancy-forms.js +16 -3
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/file-input/file-input.component.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1838,6 +1838,8 @@
|
|
|
1838
1838
|
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
1839
1839
|
_this.isLoading = false;
|
|
1840
1840
|
_this.clearable = false;
|
|
1841
|
+
_this.onlyShowUploadButton = false;
|
|
1842
|
+
_this.useFullParentSize = false;
|
|
1841
1843
|
return _this;
|
|
1842
1844
|
}
|
|
1843
1845
|
FileInputComponent.prototype.onChange = function (files) {
|
|
@@ -1846,6 +1848,8 @@
|
|
|
1846
1848
|
result.push(files.item(i));
|
|
1847
1849
|
}
|
|
1848
1850
|
this.setInnerValueAndNotify(result);
|
|
1851
|
+
// to make sure we can select the same file again
|
|
1852
|
+
this.fileInputEl.nativeElement.value = null;
|
|
1849
1853
|
};
|
|
1850
1854
|
FileInputComponent.prototype.getFileNames = function () {
|
|
1851
1855
|
if (Array.isArray(this.innerValue)) {
|
|
@@ -1857,6 +1861,9 @@
|
|
|
1857
1861
|
return null;
|
|
1858
1862
|
};
|
|
1859
1863
|
FileInputComponent.prototype.shouldShowClearButton = function () {
|
|
1864
|
+
if (this.onlyShowUploadButton) {
|
|
1865
|
+
return false;
|
|
1866
|
+
}
|
|
1860
1867
|
if (this.multiple) {
|
|
1861
1868
|
if (arrayIsSetAndFilled(this.innerValue)) {
|
|
1862
1869
|
return true;
|
|
@@ -1868,19 +1875,25 @@
|
|
|
1868
1875
|
}
|
|
1869
1876
|
return false;
|
|
1870
1877
|
};
|
|
1878
|
+
FileInputComponent.prototype.uploadFileClicked = function () {
|
|
1879
|
+
this.fileInputEl.nativeElement.click();
|
|
1880
|
+
};
|
|
1871
1881
|
return FileInputComponent;
|
|
1872
1882
|
}(MultipleValueAccessorBase));
|
|
1873
1883
|
FileInputComponent.decorators = [
|
|
1874
1884
|
{ type: core.Component, args: [{
|
|
1875
1885
|
selector: 'klp-form-file-input',
|
|
1876
|
-
template: "<div class=\"componentContainer\">\n\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\">\n\t\tUpload a file\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t</
|
|
1886
|
+
template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\tUpload a file\n\t\t</klp-form-button>\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#fileInput\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n",
|
|
1877
1887
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }],
|
|
1878
|
-
styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{align-items:center;display:flex}.
|
|
1888
|
+
styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{align-items:center;display:flex}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{bottom:0;cursor:pointer;left:0;opacity:0;position:absolute;right:0;top:0}.fileName{color:#515365;flex:1 1 0px;margin-left:.625rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.clearButton{flex:0 0 auto}"]
|
|
1879
1889
|
},] }
|
|
1880
1890
|
];
|
|
1881
1891
|
FileInputComponent.propDecorators = {
|
|
1882
1892
|
isLoading: [{ type: core.Input }],
|
|
1883
|
-
clearable: [{ type: core.Input }]
|
|
1893
|
+
clearable: [{ type: core.Input }],
|
|
1894
|
+
onlyShowUploadButton: [{ type: core.Input }],
|
|
1895
|
+
useFullParentSize: [{ type: core.Input }],
|
|
1896
|
+
fileInputEl: [{ type: core.ViewChild, args: ['fileInput',] }]
|
|
1884
1897
|
};
|
|
1885
1898
|
|
|
1886
1899
|
var SortableGroupedItemsComponent = /** @class */ (function (_super) {
|