@klippa/ngx-enhancy-forms 7.1.4 → 7.2.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 +57 -2
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +2 -2
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
- package/esm2015/klippa-ngx-enhancy-forms.js +2 -1
- package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +4 -3
- package/esm2015/lib/elements/file-input/file-input.component.js +52 -0
- package/esm2015/lib/elements/text-input/text-input.component.js +2 -2
- package/esm2015/lib/ngx-enhancy-forms.module.js +4 -1
- package/esm2015/lib/util/values.js +2 -2
- package/fesm2015/klippa-ngx-enhancy-forms.js +55 -4
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.d.ts +1 -0
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/date-time-picker/date-time-picker.component.d.ts +1 -1
- package/lib/elements/file-input/file-input.component.d.ts +8 -0
- package/lib/elements/text-input/text-input.component.d.ts +1 -1
- package/lib/util/values.d.ts +1 -1
- package/package.json +1 -1
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
return s.substring(0, length) + '...';
|
|
33
33
|
}
|
|
34
34
|
function arrayIsSetAndFilled(arr) {
|
|
35
|
-
return arr !== null && arr !== undefined && arr.length > 0;
|
|
35
|
+
return Array.isArray(arr) && arr !== null && arr !== undefined && arr.length > 0;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
var invalidFieldsSymbol = Symbol('Not all fields are valid');
|
|
@@ -1413,7 +1413,7 @@
|
|
|
1413
1413
|
_this.minutesTouched = false;
|
|
1414
1414
|
_this.isSelected = function (d) {
|
|
1415
1415
|
if (_this.multiple) {
|
|
1416
|
-
return _this.selectedDates.some(function (e) { return
|
|
1416
|
+
return _this.selectedDates.some(function (e) { return dateFns.isSameDay(e, d); }) ? 'selected' : '';
|
|
1417
1417
|
}
|
|
1418
1418
|
return '';
|
|
1419
1419
|
};
|
|
@@ -1596,6 +1596,7 @@
|
|
|
1596
1596
|
this.hours = '';
|
|
1597
1597
|
this.minutes = '';
|
|
1598
1598
|
this.openPickerOnDate = null;
|
|
1599
|
+
this.selectedDates = [];
|
|
1599
1600
|
}
|
|
1600
1601
|
}
|
|
1601
1602
|
};
|
|
@@ -1719,6 +1720,57 @@
|
|
|
1719
1720
|
},] }
|
|
1720
1721
|
];
|
|
1721
1722
|
|
|
1723
|
+
var FileInputComponent = /** @class */ (function (_super) {
|
|
1724
|
+
__extends(FileInputComponent, _super);
|
|
1725
|
+
function FileInputComponent() {
|
|
1726
|
+
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
1727
|
+
_this.isLoading = false;
|
|
1728
|
+
_this.clearable = false;
|
|
1729
|
+
return _this;
|
|
1730
|
+
}
|
|
1731
|
+
FileInputComponent.prototype.onChange = function (files) {
|
|
1732
|
+
var result = [];
|
|
1733
|
+
for (var i = 0; i < files.length; i++) {
|
|
1734
|
+
result.push(files.item(i));
|
|
1735
|
+
}
|
|
1736
|
+
this.setInnerValueAndNotify(result);
|
|
1737
|
+
};
|
|
1738
|
+
FileInputComponent.prototype.getFileNames = function () {
|
|
1739
|
+
if (Array.isArray(this.innerValue)) {
|
|
1740
|
+
return this.innerValue.map(function (e) { return e.name; }).join(', ');
|
|
1741
|
+
}
|
|
1742
|
+
else if (this.innerValue instanceof File) {
|
|
1743
|
+
return this.innerValue.name;
|
|
1744
|
+
}
|
|
1745
|
+
return null;
|
|
1746
|
+
};
|
|
1747
|
+
FileInputComponent.prototype.shouldShowClearButton = function () {
|
|
1748
|
+
if (this.multiple) {
|
|
1749
|
+
if (arrayIsSetAndFilled(this.innerValue)) {
|
|
1750
|
+
return true;
|
|
1751
|
+
}
|
|
1752
|
+
return false;
|
|
1753
|
+
}
|
|
1754
|
+
if (isValueSet(this.innerValue)) {
|
|
1755
|
+
return true;
|
|
1756
|
+
}
|
|
1757
|
+
return false;
|
|
1758
|
+
};
|
|
1759
|
+
return FileInputComponent;
|
|
1760
|
+
}(MultipleValueAccessorBase));
|
|
1761
|
+
FileInputComponent.decorators = [
|
|
1762
|
+
{ type: core.Component, args: [{
|
|
1763
|
+
selector: 'klp-form-file-input',
|
|
1764
|
+
template: "<div class=\"componentContainer\">\n\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\">\n\t\tUpload a file\n\t\t<input type=\"file\" (change)=\"onChange($event.target.files)\" [multiple]=\"multiple\">\n\t</klp-form-button>\n\t<div class=\"fileName\">\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",
|
|
1765
|
+
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }],
|
|
1766
|
+
styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{align-items:center;display:flex}.uploadButton{flex:0 0 auto;position:relative}.uploadButton 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}"]
|
|
1767
|
+
},] }
|
|
1768
|
+
];
|
|
1769
|
+
FileInputComponent.propDecorators = {
|
|
1770
|
+
isLoading: [{ type: core.Input }],
|
|
1771
|
+
clearable: [{ type: core.Input }]
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1722
1774
|
var NgxEnhancyFormsModule = /** @class */ (function () {
|
|
1723
1775
|
function NgxEnhancyFormsModule() {
|
|
1724
1776
|
}
|
|
@@ -1749,6 +1801,7 @@
|
|
|
1749
1801
|
SortableItemsComponent,
|
|
1750
1802
|
TextInputComponent,
|
|
1751
1803
|
ToggleComponent,
|
|
1804
|
+
FileInputComponent,
|
|
1752
1805
|
FormCaptionComponent,
|
|
1753
1806
|
FormElementComponent,
|
|
1754
1807
|
FormErrorComponent,
|
|
@@ -1772,6 +1825,7 @@
|
|
|
1772
1825
|
SortableItemsComponent,
|
|
1773
1826
|
TextInputComponent,
|
|
1774
1827
|
ToggleComponent,
|
|
1828
|
+
FileInputComponent,
|
|
1775
1829
|
FormCaptionComponent,
|
|
1776
1830
|
FormElementComponent,
|
|
1777
1831
|
FormErrorComponent,
|
|
@@ -1824,6 +1878,7 @@
|
|
|
1824
1878
|
exports.invalidFieldsSymbol = invalidFieldsSymbol;
|
|
1825
1879
|
exports.matDateFormatsFactory = matDateFormatsFactory;
|
|
1826
1880
|
exports["ɵa"] = MaterialModule;
|
|
1881
|
+
exports["ɵb"] = FileInputComponent;
|
|
1827
1882
|
|
|
1828
1883
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1829
1884
|
|