@luftborn/custom-elements 2.5.7 → 2.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/demo/index.js +29 -6
- package/demo/index.min.js +28 -5
- package/demo/index.min.js.map +1 -1
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.d.ts +2 -0
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js +22 -4
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js.map +1 -1
- package/dist/elements/DropDownList/DropDownListElement.d.ts +1 -0
- package/dist/elements/DropDownList/DropDownListElement.js +6 -1
- package/dist/elements/DropDownList/DropDownListElement.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.ts +19 -2
- package/src/elements/DropDownList/DropDownListElement.ts +13 -3
package/demo/index.min.js
CHANGED
|
@@ -3001,7 +3001,22 @@ var CustomEvents_1 = require("../../framework/CustomEvents");
|
|
|
3001
3001
|
var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
3002
3002
|
__extends(CustomFormatDateFieldElement, _super);
|
|
3003
3003
|
function CustomFormatDateFieldElement() {
|
|
3004
|
-
|
|
3004
|
+
var _this = _super.call(this) || this;
|
|
3005
|
+
_this.defaultDateFormat = 'yyyy-mm-dd';
|
|
3006
|
+
_this.supportedDateFormats = [
|
|
3007
|
+
'ddmmyyyy',
|
|
3008
|
+
'mmddyyyy',
|
|
3009
|
+
'dd/mm/yyyy',
|
|
3010
|
+
'mm/dd/yyyy',
|
|
3011
|
+
'dd-mm-yyyy',
|
|
3012
|
+
'mm-dd-yyyy',
|
|
3013
|
+
'yyyy-mm-dd',
|
|
3014
|
+
'yyyy-dd-mm',
|
|
3015
|
+
'Month dd, yyyy',
|
|
3016
|
+
'mm/dd/yy',
|
|
3017
|
+
'dd/mm/yy',
|
|
3018
|
+
];
|
|
3019
|
+
return _this;
|
|
3005
3020
|
}
|
|
3006
3021
|
Object.defineProperty(CustomFormatDateFieldElement.prototype, "value", {
|
|
3007
3022
|
get: function () {
|
|
@@ -3054,9 +3069,13 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3054
3069
|
if (this.min) {
|
|
3055
3070
|
this.date.setAttribute('min', this.min);
|
|
3056
3071
|
}
|
|
3057
|
-
if (this.dateFormat) {
|
|
3072
|
+
if (this.dateFormat && this.supportedDateFormats.includes(this.dateFormat)) {
|
|
3058
3073
|
this.display.placeholder = this.dateFormat;
|
|
3059
3074
|
}
|
|
3075
|
+
else {
|
|
3076
|
+
this.display.placeholder = this.defaultDateFormat;
|
|
3077
|
+
this.dateFormat = this.defaultDateFormat;
|
|
3078
|
+
}
|
|
3060
3079
|
};
|
|
3061
3080
|
CustomFormatDateFieldElement.prototype.change = function ($event) {
|
|
3062
3081
|
var _a;
|
|
@@ -3071,7 +3090,6 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3071
3090
|
this.onValidate.emit(new CustomEvents_1.CustomElementEventArgs(this.value, 'validate'));
|
|
3072
3091
|
};
|
|
3073
3092
|
CustomFormatDateFieldElement.prototype.formatDate = function () {
|
|
3074
|
-
var _a;
|
|
3075
3093
|
var date = this.date.valueAsDate;
|
|
3076
3094
|
var year = date.getFullYear();
|
|
3077
3095
|
var month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
@@ -3090,7 +3108,7 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3090
3108
|
'mm/dd/yy': month + "/" + day + "/" + year.toString().slice(-2),
|
|
3091
3109
|
'dd/mm/yy': day + "/" + month + "/" + year.toString().slice(-2),
|
|
3092
3110
|
};
|
|
3093
|
-
return
|
|
3111
|
+
return dateFormats[this.dateFormat];
|
|
3094
3112
|
};
|
|
3095
3113
|
CustomFormatDateFieldElement.prototype.showDatePicker = function () {
|
|
3096
3114
|
if ((!!window.ApplePaySetupFeature || !!window.safari)) {
|
|
@@ -3328,7 +3346,8 @@ var DropDownListElement = /** @class */ (function (_super) {
|
|
|
3328
3346
|
__extends(DropDownListElement, _super);
|
|
3329
3347
|
function DropDownListElement() {
|
|
3330
3348
|
var _this = _super.call(this) || this;
|
|
3331
|
-
_this.optionTemplate = "\n
|
|
3349
|
+
_this.optionTemplate = "\n\t\t<option value='{0}'>\n\t\t{1}\n\t\t</option>";
|
|
3350
|
+
_this.placeholderOptionTemplate = "\n\t\t<option selected disabled>\n\t\t{0}\n\t\t</option>";
|
|
3332
3351
|
return _this;
|
|
3333
3352
|
}
|
|
3334
3353
|
Object.defineProperty(DropDownListElement.prototype, "value", {
|
|
@@ -3365,6 +3384,10 @@ var DropDownListElement = /** @class */ (function (_super) {
|
|
|
3365
3384
|
DropDownListElement.prototype.addOptions = function () {
|
|
3366
3385
|
var _this = this;
|
|
3367
3386
|
this.select.innerHTML = "";
|
|
3387
|
+
if (this.placeholder) {
|
|
3388
|
+
this.select.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(this.placeholderOptionTemplate, this.placeholder));
|
|
3389
|
+
}
|
|
3390
|
+
;
|
|
3368
3391
|
this.options.forEach(function (element, index) {
|
|
3369
3392
|
_this.select.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.optionTemplate, element, element));
|
|
3370
3393
|
});
|