@luftborn/custom-elements 2.5.6 → 2.5.7
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 +15 -6
- package/demo/index.min.js +14 -5
- package/demo/index.min.js.map +1 -1
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.d.ts +1 -0
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js +14 -5
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.ts +15 -7
package/demo/index.min.js
CHANGED
|
@@ -3032,10 +3032,7 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3032
3032
|
this.date.addEventListener('change', function () {
|
|
3033
3033
|
_this.display.value = _this.formatDate();
|
|
3034
3034
|
_this.change(null);
|
|
3035
|
-
_this.
|
|
3036
|
-
setTimeout(function () {
|
|
3037
|
-
_this.date.hidden = false;
|
|
3038
|
-
}, 0);
|
|
3035
|
+
_this.closeDatePicker();
|
|
3039
3036
|
});
|
|
3040
3037
|
this.datepicker.addEventListener('click', function () {
|
|
3041
3038
|
_this.showDatePicker();
|
|
@@ -3043,6 +3040,11 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3043
3040
|
this.display.addEventListener('click', function () {
|
|
3044
3041
|
_this.showDatePicker();
|
|
3045
3042
|
});
|
|
3043
|
+
document.addEventListener('click', function (event) {
|
|
3044
|
+
if (!_this.contains(event.target)) {
|
|
3045
|
+
_this.closeDatePicker();
|
|
3046
|
+
}
|
|
3047
|
+
});
|
|
3046
3048
|
if (this.required) {
|
|
3047
3049
|
this.date.setAttribute('required', '');
|
|
3048
3050
|
}
|
|
@@ -3100,11 +3102,18 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3100
3102
|
}
|
|
3101
3103
|
}
|
|
3102
3104
|
};
|
|
3105
|
+
CustomFormatDateFieldElement.prototype.closeDatePicker = function () {
|
|
3106
|
+
var _this = this;
|
|
3107
|
+
this.date.hidden = true;
|
|
3108
|
+
setTimeout(function () {
|
|
3109
|
+
_this.date.hidden = false;
|
|
3110
|
+
}, 0);
|
|
3111
|
+
};
|
|
3103
3112
|
CustomFormatDateFieldElement = __decorate([
|
|
3104
3113
|
(0, custom_element_decorator_1.default)({
|
|
3105
3114
|
selector: 'custom-format-date-element',
|
|
3106
3115
|
template: "\n\t\t<div class=\"wrapper\">\n\t\t\t<input type=\"text\" id=\"display-field\" readonly />\n\t\t\t<svg id=\"picker-trigger\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"2\" y=\"4\" width=\"20\" height=\"18\" rx=\"1\" fill=\"#000\"/><rect x=\"4\" y=\"8\" width=\"16\" height=\"12\" fill=\"white\"/><path d=\"M4 10H20\" stroke=\"#000\" stroke-width=\"1\"/><circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"#F44336\"/><rect x=\"6\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/><rect x=\"15\" y=\"2\" width=\"3\" height=\"4\" rx=\".5\" fill=\"#000\"/></svg>\n\t\t\t<input type=\"date\" id=\"date-field\" />\n\t\t</div>",
|
|
3107
|
-
style: "\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 2px;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field {\n\t\t\topacity: 0;\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t#display-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 10px;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\twidth: 15px;\n\t\t\theight: 15px;\n\t\t\tposition:absolute;\n\t\t\tright: 2px;\n\t\t\ttop: 15%;\n\t\t}\n\t
|
|
3116
|
+
style: "\n\t\t:host{\n\t\t\twidth:100%;\n\t\t}\n\t\t.wrapper{\n\t\t\tdisplay:flex;\n\t\t\tposition: relative;\n\t\t}\n\t\tinput{\n\t\t\tbox-sizing: border-box;\n\t\t\twidth: 100% !important;\n\t\t\tborder: none;\n\t\t\tbackground-color: #f1f4ff;\n\t\t\tmargin: 2px;\n\t\t\tresize: none;\n\t\t}\n\t\t#date-field {\n\t\t\topacity: 0;\n\t\t\tposition: absolute;\n\t\t\tz-index: -1;\n\t\t\tpointer-events: none;\n\t\t}\n\t\t#display-field::after {\n\t\t\tcontent: url('path/to/datepicker-icon.png'); /* Path to your datepicker icon */\n\t\t\tcursor: pointer;\n\t\t\tright: 10px;\n\t\t}\n\t\t#picker-trigger {\n\t\t\tcursor: pointer;\n\t\t\twidth: 15px;\n\t\t\theight: 15px;\n\t\t\tposition:absolute;\n\t\t\tright: 2px;\n\t\t\ttop: 15%;\n\t\t}\n\t",
|
|
3108
3117
|
useShadow: true,
|
|
3109
3118
|
})
|
|
3110
3119
|
], CustomFormatDateFieldElement);
|