@everymatrix/helper-filters 0.1.5 → 0.1.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/dist/cjs/helper-filters.cjs.js +2 -2
- package/dist/cjs/helper-filters_2.cjs.entry.js +175 -0
- package/dist/cjs/{index-0c5bb1ff.js → index-d16cebbc.js} +15 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +8 -1
- package/dist/components/helper-filters.js +12 -22424
- package/dist/components/helper-modal.js +6 -0
- package/dist/components/helper-modal2.js +58 -0
- package/dist/esm/helper-filters.js +2 -2
- package/dist/esm/helper-filters_2.entry.js +170 -0
- package/dist/esm/{index-f5eea413.js → index-1b3528e3.js} +15 -1
- package/dist/esm/loader.js +2 -2
- package/dist/helper-filters/helper-filters.esm.js +1 -1
- package/dist/helper-filters/p-2cd626f1.js +1 -0
- package/dist/helper-filters/p-43dedb1d.entry.js +1 -0
- package/package.json +2 -2
- package/dist/cjs/helper-filters.cjs.entry.js +0 -22555
- package/dist/esm/helper-filters.entry.js +0 -22551
- package/dist/helper-filters/p-5018b398.entry.js +0 -2809
- package/dist/helper-filters/p-645ae858.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
3
|
+
const index = require('./index-d16cebbc.js');
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["helper-
|
|
18
|
+
return index.bootstrapLazy([["helper-filters_2.cjs",[[1,"helper-filters",{"showFilterId":[4,"show-filter-id"],"activateTicketSearch":[4,"activate-ticket-search"],"gameId":[1,"game-id"],"playerId":[1,"player-id"],"session":[1],"postMessage":[4,"post-message"],"language":[1],"showFilterModal":[32],"showClearButton":[32],"filterData":[32],"filterDataReset":[32]},[[0,"modalCloseEvent","modalCloseEvent"]]],[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]]], options);
|
|
19
19
|
});
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-d16cebbc.js');
|
|
6
|
+
require('@vaadin/date-picker');
|
|
7
|
+
|
|
8
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
9
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
10
|
+
const TRANSLATIONS = {
|
|
11
|
+
en: {
|
|
12
|
+
filterOpen: 'Filter',
|
|
13
|
+
filterClear: 'Clear',
|
|
14
|
+
filterModalTicketTitle: 'Ticket Results',
|
|
15
|
+
filterModalDrawTitle: 'Draws Results History',
|
|
16
|
+
filterTicketPlaceholder: 'Search for a ticket ID',
|
|
17
|
+
filterDrawPlaceholder: 'Search for a draw ID',
|
|
18
|
+
filterDateRangePlaceholder: 'Date Range',
|
|
19
|
+
filterModalButton: 'Search',
|
|
20
|
+
filterFromCalendar: 'From',
|
|
21
|
+
filterToCalendar: 'To',
|
|
22
|
+
filterOrDate: 'or search by date'
|
|
23
|
+
},
|
|
24
|
+
ro: {
|
|
25
|
+
filterOpen: 'Filtrare',
|
|
26
|
+
filterClear: 'Stergere',
|
|
27
|
+
filterModalTicketTitle: 'Rezultatele biletelor',
|
|
28
|
+
filterModalDrawTitle: 'Rezultatele draw-urilor',
|
|
29
|
+
filterTicketPlaceholder: 'Cauta ID bilet',
|
|
30
|
+
filterDrawPlaceholder: 'Cauta ID draw',
|
|
31
|
+
filterDateRangePlaceholder: 'Perioada',
|
|
32
|
+
filterModalButton: 'Cauta',
|
|
33
|
+
filterOrDate: 'sau cauta dupa data'
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const translate = (key, customLang) => {
|
|
37
|
+
const lang = customLang;
|
|
38
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const helperFiltersCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.FilterButtonsWrapper{display:flex;justify-content:flex-end;gap:5px}.FilterButtonsWrapper .FilterOpen{cursor:pointer;border-radius:4px;padding:8px 15px;width:max-content;border:1px solid #00958f;background:#00958f;color:#FFF;font-size:12px;transition:all 0.2s linear;text-align:center;letter-spacing:0}.FilterButtonsWrapper .FilterOpen:hover{background:#00958f;color:#FFF}.FilterButtonsWrapper .FilterClear{cursor:pointer;border-radius:4px;padding:8px 15px;width:max-content;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-align:center;letter-spacing:0}.FilterButtonsWrapper .FilterClear:hover{background:#00958f;color:#FFF}.FilterModalHeader,.FilterModalBody,.FilterModalFooter{display:flex;flex-direction:column;gap:5px;align-items:center;margin:20px 0}.FilterModalHeader .FilterModalTitle,.FilterModalBody .FilterModalTitle,.FilterModalFooter .FilterModalTitle{margin:0;padding:0;font-weight:700;font-size:16px;color:#009993;text-transform:uppercase}.FilterModalHeader .FilterModalSearch,.FilterModalBody .FilterModalSearch,.FilterModalFooter .FilterModalSearch{border-radius:4px;background:#e8ebef;color:#263445;width:100%;height:26px;max-width:280px;padding:5px;font-size:15px;border:none;outline:#009993}.FilterModalHeader .FilterCalendarWrapper,.FilterModalBody .FilterCalendarWrapper,.FilterModalFooter .FilterCalendarWrapper{display:flex;gap:5px}.FilterModalHeader .FilterCalendarWrapper .VaadinDatePicker,.FilterModalBody .FilterCalendarWrapper .VaadinDatePicker,.FilterModalFooter .FilterCalendarWrapper .VaadinDatePicker{width:50%;max-width:143px}.FilterModalHeader .FilterModalButton,.FilterModalBody .FilterModalButton,.FilterModalFooter .FilterModalButton{cursor:pointer;border-radius:4px;padding:8px 60px;width:max-content;margin:5px;border:1px solid #00958f;background:#00958f;color:#FFF;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.FilterModalHeader .FilterModalButton:hover,.FilterModalBody .FilterModalButton:hover,.FilterModalFooter .FilterModalButton:hover{background:#00958f;color:#FFF}.FilterModalHeader p,.FilterModalBody p,.FilterModalFooter p{margin:5px 0}";
|
|
42
|
+
|
|
43
|
+
const HelperFilters = class {
|
|
44
|
+
constructor(hostRef) {
|
|
45
|
+
index.registerInstance(this, hostRef);
|
|
46
|
+
this.filterDraw = index.createEvent(this, "filterDraw", 7);
|
|
47
|
+
this.filterSelection = index.createEvent(this, "filterSelection", 7);
|
|
48
|
+
this.filterSelectionReset = index.createEvent(this, "filterSelectionReset", 7);
|
|
49
|
+
/**
|
|
50
|
+
* Check if show the filter option by id
|
|
51
|
+
*/
|
|
52
|
+
this.showFilterId = true;
|
|
53
|
+
/**
|
|
54
|
+
* Choose if filter by draw ID or ticket ID. By default is draw ID.
|
|
55
|
+
*/
|
|
56
|
+
this.activateTicketSearch = false;
|
|
57
|
+
/**
|
|
58
|
+
* Game ID
|
|
59
|
+
*/
|
|
60
|
+
this.gameId = '';
|
|
61
|
+
/**
|
|
62
|
+
* Player ID
|
|
63
|
+
*/
|
|
64
|
+
this.playerId = '';
|
|
65
|
+
/**
|
|
66
|
+
* Session ID
|
|
67
|
+
*/
|
|
68
|
+
this.session = '';
|
|
69
|
+
/**
|
|
70
|
+
* Instead of customEvents the widget triggers postMessages
|
|
71
|
+
*/
|
|
72
|
+
this.postMessage = false;
|
|
73
|
+
/**
|
|
74
|
+
* Language
|
|
75
|
+
*/
|
|
76
|
+
this.language = 'en';
|
|
77
|
+
this.showFilterModal = false;
|
|
78
|
+
this.showClearButton = false;
|
|
79
|
+
this.filterData = {};
|
|
80
|
+
this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
|
|
81
|
+
}
|
|
82
|
+
// reset field values each time the filter modal opens
|
|
83
|
+
componentDidRender() {
|
|
84
|
+
this.filterData.ticketDrawId = null;
|
|
85
|
+
this.filterData.filterFromCalendar = null;
|
|
86
|
+
this.filterData.filterToCalendar = null;
|
|
87
|
+
// @TODO: to way binding?
|
|
88
|
+
if (document.getElementById('#FilterById'))
|
|
89
|
+
document.getElementById('#FilterById').value = '';
|
|
90
|
+
}
|
|
91
|
+
filterSelectionHandler(event) {
|
|
92
|
+
if (this.postMessage)
|
|
93
|
+
window.postMessage({ type: 'filterSelection', event }, window.location.href);
|
|
94
|
+
if (this.filterData.ticketDrawId)
|
|
95
|
+
this.filterDraw.emit(event);
|
|
96
|
+
if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
|
|
97
|
+
this.filterSelection.emit(event);
|
|
98
|
+
}
|
|
99
|
+
filterSelectionResetHandler(event) {
|
|
100
|
+
if (this.postMessage)
|
|
101
|
+
window.postMessage({ type: 'filterSelectionReset', event }, window.location.href);
|
|
102
|
+
this.filterSelectionReset.emit(event);
|
|
103
|
+
}
|
|
104
|
+
modalCloseEvent() {
|
|
105
|
+
this.showFilterModal = false;
|
|
106
|
+
}
|
|
107
|
+
// Toggle filter modal
|
|
108
|
+
toggleFilterModal() {
|
|
109
|
+
this.showFilterModal = true;
|
|
110
|
+
}
|
|
111
|
+
// Filter search
|
|
112
|
+
filterSearch() {
|
|
113
|
+
this.modalCloseEvent();
|
|
114
|
+
this.showClearButton = true;
|
|
115
|
+
this.filterSelectionHandler(this.filterData);
|
|
116
|
+
}
|
|
117
|
+
resetSearch() {
|
|
118
|
+
this.showClearButton = false;
|
|
119
|
+
this.filterSelectionResetHandler(this.filterDataReset);
|
|
120
|
+
this.filterData = {};
|
|
121
|
+
}
|
|
122
|
+
handleTicketDrawId(event) {
|
|
123
|
+
this.filterData.ticketDrawId = event.target.value;
|
|
124
|
+
}
|
|
125
|
+
handleFilterFrom(event) {
|
|
126
|
+
this.filterData.filterFromCalendar = new Date(event.target.value).toISOString();
|
|
127
|
+
}
|
|
128
|
+
handleFilterTo(event) {
|
|
129
|
+
this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
return (index.h("div", { class: "HelperFilters" }, index.h("div", { class: "FilterButtonsWrapper" }, index.h("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate('filterOpen', this.language)), this.showClearButton ? index.h("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate('filterClear', this.language)) : null), index.h("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal }, index.h("div", { class: "FilterModalHeader" }, index.h("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate('filterModalTicketTitle', this.language) : translate('filterModalDrawTitle', this.language))), index.h("div", { class: "FilterModalBody" }, index.h("input", { id: "FilterById", type: "text", value: this.filterData.ticketDrawId, onInput: (event) => this.handleTicketDrawId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate('filterTicketPlaceholder', this.language) : translate('filterDrawPlaceholder', this.language) }), index.h("p", null, translate('filterOrDate', this.language)), index.h("div", { class: "FilterCalendarWrapper" }, index.h("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate('filterFromCalendar', this.language), class: "VaadinDatePicker" }), index.h("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate('filterToCalendar', this.language), class: "VaadinDatePicker" }))), index.h("div", { class: "FilterModalFooter" }, index.h("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate('filterModalButton', this.language))))));
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
HelperFilters.style = helperFiltersCss;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @name isMobile
|
|
139
|
+
* @description A method that returns if the browser used to access the app is from a mobile device or not
|
|
140
|
+
* @param {String} userAgent window.navigator.userAgent
|
|
141
|
+
* @returns {Boolean} true or false
|
|
142
|
+
*/
|
|
143
|
+
const isMobile = (userAgent) => {
|
|
144
|
+
return !!(userAgent.toLowerCase().match(/android/i) ||
|
|
145
|
+
userAgent.toLowerCase().match(/blackberry|bb/i) ||
|
|
146
|
+
userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
|
|
147
|
+
userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const helperModalCss = ":host{display:block}.HelperModalWrapper{position:fixed;left:0;top:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.7);opacity:0;visibility:hidden;transform:scale(1.1);transition:visibility 0s linear 0.25s, opacity 0.25s 0s, transform 0.25s;z-index:1}.HelperModalVisible{opacity:1;visibility:visible;transform:scale(1);transition:visibility 0s linear 0s, opacity 0.25s 0s, transform 0.25s}.HelperModalContent{position:relative;border:solid 1px #848e97;box-shadow:2px 2px 2px rgba(0, 0, 0, 0.007);font-size:14px;padding:10px 10px 5px 10px;background-color:#fff;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);border-radius:4px;width:600px;max-height:600px;overflow-y:scroll}.HelperModalMobileContent{background:#FFF;top:50%;left:50%;transform:translate(-50%, -50%);border-radius:4px;width:80%;max-height:350px}.HelperModalClose{cursor:pointer;position:absolute;top:15px;right:15px;font-size:20px;color:#000}.HelperModalMobileClose{position:absolute;top:15px;right:15px;font-size:20px;color:#000}";
|
|
151
|
+
|
|
152
|
+
const HelperModal = class {
|
|
153
|
+
constructor(hostRef) {
|
|
154
|
+
index.registerInstance(this, hostRef);
|
|
155
|
+
this.cancel = index.createEvent(this, "modalCloseEvent", 7);
|
|
156
|
+
/**
|
|
157
|
+
* Toggles if the helper is visible or not
|
|
158
|
+
*/
|
|
159
|
+
this.visible = true;
|
|
160
|
+
this.userAgent = window.navigator.userAgent;
|
|
161
|
+
}
|
|
162
|
+
handleHelperModalClose() {
|
|
163
|
+
this.visible = false;
|
|
164
|
+
this.cancel.emit();
|
|
165
|
+
}
|
|
166
|
+
;
|
|
167
|
+
render() {
|
|
168
|
+
return ((this.visible &&
|
|
169
|
+
index.h("div", { class: this.visible ? "HelperModalWrapper HelperModalVisible" : "HelperModalWrapper" }, index.h("div", { class: "HelperModalWrapper HelperModalVisible" }, index.h("div", { class: "HelperModalContent" + (isMobile(this.userAgent) ? ' HelperModalMobileContent' : '') }, index.h("span", { class: "HelperModalClose" + (isMobile(this.userAgent) ? ' HelperModalMobileClose' : ''), onClick: this.handleHelperModalClose.bind(this) }, "X"), index.h("slot", null))))));
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
HelperModal.style = helperModalCss;
|
|
173
|
+
|
|
174
|
+
exports.helper_filters = HelperFilters;
|
|
175
|
+
exports.helper_modal = HelperModal;
|
|
@@ -502,11 +502,14 @@ const patch = (oldVNode, newVNode) => {
|
|
|
502
502
|
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
|
503
503
|
const oldChildren = oldVNode.$children$;
|
|
504
504
|
const newChildren = newVNode.$children$;
|
|
505
|
+
const tag = newVNode.$tag$;
|
|
505
506
|
const text = newVNode.$text$;
|
|
506
507
|
if (text === null) {
|
|
507
508
|
// element node
|
|
508
509
|
{
|
|
509
|
-
|
|
510
|
+
if (tag === 'slot')
|
|
511
|
+
;
|
|
512
|
+
else {
|
|
510
513
|
// either this is the first render of an element OR it's an update
|
|
511
514
|
// AND we already know it's possible it could have changed
|
|
512
515
|
// this updates the element's css classes, attrs, props, listeners, etc.
|
|
@@ -539,9 +542,14 @@ const patch = (oldVNode, newVNode) => {
|
|
|
539
542
|
};
|
|
540
543
|
const renderVdom = (hostRef, renderFnResults) => {
|
|
541
544
|
const hostElm = hostRef.$hostElement$;
|
|
545
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
|
542
546
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
543
547
|
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
544
548
|
hostTagName = hostElm.tagName;
|
|
549
|
+
if (cmpMeta.$attrsToReflect$) {
|
|
550
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
551
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
|
552
|
+
}
|
|
545
553
|
rootVnode.$tag$ = null;
|
|
546
554
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
547
555
|
hostRef.$vnode$ = rootVnode;
|
|
@@ -892,6 +900,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
892
900
|
.map(([propName, m]) => {
|
|
893
901
|
const attrName = m[1] || propName;
|
|
894
902
|
attrNameToPropName.set(attrName, propName);
|
|
903
|
+
if (m[0] & 512 /* ReflectAttr */) {
|
|
904
|
+
cmpMeta.$attrsToReflect$.push([propName, attrName]);
|
|
905
|
+
}
|
|
895
906
|
return attrName;
|
|
896
907
|
});
|
|
897
908
|
}
|
|
@@ -1052,6 +1063,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1052
1063
|
{
|
|
1053
1064
|
cmpMeta.$listeners$ = compactMeta[3];
|
|
1054
1065
|
}
|
|
1066
|
+
{
|
|
1067
|
+
cmpMeta.$attrsToReflect$ = [];
|
|
1068
|
+
}
|
|
1055
1069
|
const tagName = cmpMeta.$tagName$;
|
|
1056
1070
|
const HostElement = class extends HTMLElement {
|
|
1057
1071
|
// StencilLazyHost
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-d16cebbc.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
8
|
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["helper-
|
|
17
|
+
return index.bootstrapLazy([["helper-filters_2.cjs",[[1,"helper-filters",{"showFilterId":[4,"show-filter-id"],"activateTicketSearch":[4,"activate-ticket-search"],"gameId":[1,"game-id"],"playerId":[1,"player-id"],"session":[1],"postMessage":[4,"post-message"],"language":[1],"showFilterModal":[32],"showClearButton":[32],"filterData":[32],"filterDataReset":[32]},[[0,"modalCloseEvent","modalCloseEvent"]]],[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|