@luftborn/custom-elements 2.5.5 → 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 -3
- package/demo/index.min.js +14 -2
- package/demo/index.min.js.map +1 -1
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.d.ts +1 -0
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js +14 -2
- package/dist/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/CustomFormatDateFieldElement/CustomFormatDateFieldElement.ts +15 -4
package/demo/index.min.js
CHANGED
|
@@ -3032,7 +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.
|
|
3035
|
+
_this.closeDatePicker();
|
|
3036
3036
|
});
|
|
3037
3037
|
this.datepicker.addEventListener('click', function () {
|
|
3038
3038
|
_this.showDatePicker();
|
|
@@ -3040,6 +3040,11 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3040
3040
|
this.display.addEventListener('click', function () {
|
|
3041
3041
|
_this.showDatePicker();
|
|
3042
3042
|
});
|
|
3043
|
+
document.addEventListener('click', function (event) {
|
|
3044
|
+
if (!_this.contains(event.target)) {
|
|
3045
|
+
_this.closeDatePicker();
|
|
3046
|
+
}
|
|
3047
|
+
});
|
|
3043
3048
|
if (this.required) {
|
|
3044
3049
|
this.date.setAttribute('required', '');
|
|
3045
3050
|
}
|
|
@@ -3097,11 +3102,18 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
|
|
|
3097
3102
|
}
|
|
3098
3103
|
}
|
|
3099
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
|
+
};
|
|
3100
3112
|
CustomFormatDateFieldElement = __decorate([
|
|
3101
3113
|
(0, custom_element_decorator_1.default)({
|
|
3102
3114
|
selector: 'custom-format-date-element',
|
|
3103
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>",
|
|
3104
|
-
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",
|
|
3105
3117
|
useShadow: true,
|
|
3106
3118
|
})
|
|
3107
3119
|
], CustomFormatDateFieldElement);
|