@everymatrix/helper-filters 0.0.3 → 0.1.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.
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-7f951fa0.js');
3
+ const index = require('./index-d16cebbc.js');
4
4
 
5
5
  /*
6
- Stencil Client Patch Browser v2.17.0 | MIT Licensed | https://stenciljs.com
6
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
7
7
  */
8
8
  const patchBrowser = () => {
9
9
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('helper-filters.cjs.js', document.baseURI).href));
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["helper-filters.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"]]]]]], options);
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
  });
@@ -2,8 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7f951fa0.js');
6
- require('@everymatrix/helper-modal');
5
+ const index = require('./index-d16cebbc.js');
7
6
 
8
7
  const DEFAULT_LANGUAGE = 'en';
9
8
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -18,7 +17,8 @@ const TRANSLATIONS = {
18
17
  filterDateRangePlaceholder: 'Date Range',
19
18
  filterModalButton: 'Search',
20
19
  filterFromCalendar: 'From',
21
- filterToCalendar: 'To'
20
+ filterToCalendar: 'To',
21
+ filterOrDate: 'or search by date'
22
22
  },
23
23
  ro: {
24
24
  filterOpen: 'Filtrare',
@@ -28,7 +28,8 @@ const TRANSLATIONS = {
28
28
  filterTicketPlaceholder: 'Cauta ID bilet',
29
29
  filterDrawPlaceholder: 'Cauta ID draw',
30
30
  filterDateRangePlaceholder: 'Perioada',
31
- filterModalButton: 'Cauta'
31
+ filterModalButton: 'Cauta',
32
+ filterOrDate: 'sau cauta dupa data'
32
33
  },
33
34
  };
34
35
  const translate$1 = (key, customLang) => {
@@ -22228,11 +22229,12 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
22228
22229
 
22229
22230
  customElements.define(DatePicker.is, DatePicker);
22230
22231
 
22231
- 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}";
22232
+ 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}";
22232
22233
 
22233
22234
  const HelperFilters = class {
22234
22235
  constructor(hostRef) {
22235
22236
  index.registerInstance(this, hostRef);
22237
+ this.filterDraw = index.createEvent(this, "filterDraw", 7);
22236
22238
  this.filterSelection = index.createEvent(this, "filterSelection", 7);
22237
22239
  this.filterSelectionReset = index.createEvent(this, "filterSelectionReset", 7);
22238
22240
  /**
@@ -22266,23 +22268,29 @@ const HelperFilters = class {
22266
22268
  this.showFilterModal = false;
22267
22269
  this.showClearButton = false;
22268
22270
  this.filterData = {};
22269
- this.filterDataReset = { drawTicketId: '', filterFromCalendar: '', filterToCalendar: '' };
22271
+ this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
22272
+ }
22273
+ // reset field values each time the filter modal opens
22274
+ componentDidRender() {
22275
+ this.filterData.ticketDrawId = null;
22276
+ this.filterData.filterFromCalendar = null;
22277
+ this.filterData.filterToCalendar = null;
22278
+ // @TODO: to way binding?
22279
+ if (document.getElementById('#FilterById'))
22280
+ document.getElementById('#FilterById').value = '';
22270
22281
  }
22271
22282
  filterSelectionHandler(event) {
22272
- if (this.postMessage) {
22283
+ if (this.postMessage)
22273
22284
  window.postMessage({ type: 'filterSelection', event }, window.location.href);
22274
- }
22275
- else {
22285
+ if (this.filterData.ticketDrawId)
22286
+ this.filterDraw.emit(event);
22287
+ if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
22276
22288
  this.filterSelection.emit(event);
22277
- }
22278
22289
  }
22279
22290
  filterSelectionResetHandler(event) {
22280
- if (this.postMessage) {
22291
+ if (this.postMessage)
22281
22292
  window.postMessage({ type: 'filterSelectionReset', event }, window.location.href);
22282
- }
22283
- else {
22284
- this.filterSelectionReset.emit(event);
22285
- }
22293
+ this.filterSelectionReset.emit(event);
22286
22294
  }
22287
22295
  modalCloseEvent() {
22288
22296
  this.showFilterModal = false;
@@ -22300,9 +22308,10 @@ const HelperFilters = class {
22300
22308
  resetSearch() {
22301
22309
  this.showClearButton = false;
22302
22310
  this.filterSelectionResetHandler(this.filterDataReset);
22311
+ this.filterData = {};
22303
22312
  }
22304
- handleDrawTicketId(event) {
22305
- this.filterData.drawTicketId = event.target.value;
22313
+ handleTicketDrawId(event) {
22314
+ this.filterData.ticketDrawId = event.target.value;
22306
22315
  }
22307
22316
  handleFilterFrom(event) {
22308
22317
  this.filterData.filterFromCalendar = new Date(event.target.value).toISOString();
@@ -22311,9 +22320,47 @@ const HelperFilters = class {
22311
22320
  this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
22312
22321
  }
22313
22322
  render() {
22314
- return (index.h("div", { class: "HelperFilters" }, index.h("div", { class: "FilterButtonsWrapper" }, index.h("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$1('filterOpen', this.language)), this.showClearButton ? index.h("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$1('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$1('filterModalTicketTitle', this.language) : translate$1('filterModalDrawTitle', this.language))), index.h("div", { class: "FilterModalBody" }, index.h("input", { type: "text", value: this.filterData.drawTicketId, onInput: (event) => this.handleDrawTicketId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate$1('filterTicketPlaceholder', this.language) : translate$1('filterDrawPlaceholder', this.language) }), index.h("div", { class: "FilterCalendarWrapper" }, index.h("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$1('filterFromCalendar', this.language), class: "VaadinDatePicker" }), index.h("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$1('filterToCalendar', this.language), class: "VaadinDatePicker" }))), index.h("div", { class: "FilterModalFooter" }, index.h("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$1('filterModalButton', this.language))))));
22323
+ return (index.h("div", { class: "HelperFilters" }, index.h("div", { class: "FilterButtonsWrapper" }, index.h("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$1('filterOpen', this.language)), this.showClearButton ? index.h("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$1('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$1('filterModalTicketTitle', this.language) : translate$1('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$1('filterTicketPlaceholder', this.language) : translate$1('filterDrawPlaceholder', this.language) }), index.h("p", null, translate$1('filterOrDate', this.language)), index.h("div", { class: "FilterCalendarWrapper" }, index.h("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$1('filterFromCalendar', this.language), class: "VaadinDatePicker" }), index.h("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$1('filterToCalendar', this.language), class: "VaadinDatePicker" }))), index.h("div", { class: "FilterModalFooter" }, index.h("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$1('filterModalButton', this.language))))));
22315
22324
  }
22316
22325
  };
22317
22326
  HelperFilters.style = helperFiltersCss;
22318
22327
 
22328
+ /**
22329
+ * @name isMobile
22330
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
22331
+ * @param {String} userAgent window.navigator.userAgent
22332
+ * @returns {Boolean} true or false
22333
+ */
22334
+ const isMobile = (userAgent) => {
22335
+ return !!(userAgent.toLowerCase().match(/android/i) ||
22336
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
22337
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
22338
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
22339
+ };
22340
+
22341
+ 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}";
22342
+
22343
+ const HelperModal = class {
22344
+ constructor(hostRef) {
22345
+ index.registerInstance(this, hostRef);
22346
+ this.cancel = index.createEvent(this, "modalCloseEvent", 7);
22347
+ /**
22348
+ * Toggles if the helper is visible or not
22349
+ */
22350
+ this.visible = true;
22351
+ this.userAgent = window.navigator.userAgent;
22352
+ }
22353
+ handleHelperModalClose() {
22354
+ this.visible = false;
22355
+ this.cancel.emit();
22356
+ }
22357
+ ;
22358
+ render() {
22359
+ return ((this.visible &&
22360
+ 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))))));
22361
+ }
22362
+ };
22363
+ HelperModal.style = helperModalCss;
22364
+
22319
22365
  exports.helper_filters = HelperFilters;
22366
+ exports.helper_modal = HelperModal;
@@ -105,7 +105,7 @@ const registerStyle = (scopeId, cssText, allowCS) => {
105
105
  };
106
106
  const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
107
107
  let scopeId = getScopeId(cmpMeta);
108
- const style = styles.get(scopeId);
108
+ let style = styles.get(scopeId);
109
109
  // if an element is NOT connected then getRootNode() will return the wrong root node
110
110
  // so the fallback is to always use the document for the root node in those cases
111
111
  styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
@@ -185,7 +185,7 @@ const h = (nodeName, vnodeData, ...children) => {
185
185
  let child = null;
186
186
  let simple = false;
187
187
  let lastSimple = false;
188
- const vNodeChildren = [];
188
+ let vNodeChildren = [];
189
189
  const walk = (c) => {
190
190
  for (let i = 0; i < c.length; i++) {
191
191
  child = c[i];
@@ -308,7 +308,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
308
308
  if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
309
309
  try {
310
310
  if (!elm.tagName.includes('-')) {
311
- const n = newValue == null ? '' : newValue;
311
+ let n = newValue == null ? '' : newValue;
312
312
  // Workaround for Safari, moving the <input> caret when re-assigning the same valued
313
313
  if (memberName === 'list') {
314
314
  isProp = false;
@@ -365,7 +365,7 @@ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
365
365
  };
366
366
  const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
367
367
  // tslint:disable-next-line: prefer-const
368
- const newVNode = newParentVNode.$children$[childIndex];
368
+ let newVNode = newParentVNode.$children$[childIndex];
369
369
  let i = 0;
370
370
  let elm;
371
371
  let childNode;
@@ -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;
@@ -678,7 +686,11 @@ const postUpdateComponent = (hostRef) => {
678
686
  const tagName = hostRef.$cmpMeta$.$tagName$;
679
687
  const elm = hostRef.$hostElement$;
680
688
  const endPostUpdate = createTime('postUpdate', tagName);
689
+ const instance = hostRef.$lazyInstance$ ;
681
690
  const ancestorComponent = hostRef.$ancestorComponent$;
691
+ {
692
+ safeCall(instance, 'componentDidRender');
693
+ }
682
694
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
683
695
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
684
696
  {
@@ -888,6 +900,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
888
900
  .map(([propName, m]) => {
889
901
  const attrName = m[1] || propName;
890
902
  attrNameToPropName.set(attrName, propName);
903
+ if (m[0] & 512 /* ReflectAttr */) {
904
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
905
+ }
891
906
  return attrName;
892
907
  });
893
908
  }
@@ -1048,6 +1063,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1048
1063
  {
1049
1064
  cmpMeta.$listeners$ = compactMeta[3];
1050
1065
  }
1066
+ {
1067
+ cmpMeta.$attrsToReflect$ = [];
1068
+ }
1051
1069
  const tagName = cmpMeta.$tagName$;
1052
1070
  const HostElement = class extends HTMLElement {
1053
1071
  // StencilLazyHost
@@ -1142,9 +1160,7 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1142
1160
  if (module) {
1143
1161
  return module[exportName];
1144
1162
  }
1145
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1146
1163
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1147
- /* @vite-ignore */
1148
1164
  /* webpackInclude: /\.entry\.js$/ */
1149
1165
  /* webpackExclude: /\.system\.entry\.js$/ */
1150
1166
  /* webpackMode: "lazy" */
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-7f951fa0.js');
5
+ const index = require('./index-d16cebbc.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.17.0 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -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-filters.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"]]]]]], options);
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
 
@@ -4,9 +4,16 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.17.0",
7
+ "version": "2.15.2",
8
8
  "typescriptVersion": "4.5.4"
9
9
  },
10
- "collections": [],
10
+ "collections": [
11
+ {
12
+ "name": "@everymatrix/helper-modal",
13
+ "tags": [
14
+ "helper-modal"
15
+ ]
16
+ }
17
+ ],
11
18
  "bundles": []
12
19
  }
@@ -111,4 +111,9 @@
111
111
  .FilterModalFooter .FilterModalButton:hover {
112
112
  background: #00958f;
113
113
  color: #FFF;
114
+ }
115
+ .FilterModalHeader p,
116
+ .FilterModalBody p,
117
+ .FilterModalFooter p {
118
+ margin: 5px 0;
114
119
  }
@@ -35,23 +35,30 @@ export class HelperFilters {
35
35
  this.showFilterModal = false;
36
36
  this.showClearButton = false;
37
37
  this.filterData = {};
38
- this.filterDataReset = { drawTicketId: '', filterFromCalendar: '', filterToCalendar: '' };
38
+ this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
39
+ }
40
+ // reset field values each time the filter modal opens
41
+ componentDidRender() {
42
+ this.filterData.ticketDrawId = null;
43
+ this.filterData.filterFromCalendar = null;
44
+ this.filterData.filterToCalendar = null;
45
+ // @TODO: to way binding?
46
+ if (document.getElementById('#FilterById'))
47
+ document.getElementById('#FilterById').value = '';
39
48
  }
40
49
  filterSelectionHandler(event) {
41
- if (this.postMessage) {
50
+ if (this.postMessage)
42
51
  window.postMessage({ type: 'filterSelection', event }, window.location.href);
43
- }
44
- else {
52
+ if (this.filterData.ticketDrawId)
53
+ this.filterDraw.emit(event);
54
+ if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
45
55
  this.filterSelection.emit(event);
46
- }
56
+ ;
47
57
  }
48
58
  filterSelectionResetHandler(event) {
49
- if (this.postMessage) {
59
+ if (this.postMessage)
50
60
  window.postMessage({ type: 'filterSelectionReset', event }, window.location.href);
51
- }
52
- else {
53
- this.filterSelectionReset.emit(event);
54
- }
61
+ this.filterSelectionReset.emit(event);
55
62
  }
56
63
  modalCloseEvent() {
57
64
  this.showFilterModal = false;
@@ -69,9 +76,10 @@ export class HelperFilters {
69
76
  resetSearch() {
70
77
  this.showClearButton = false;
71
78
  this.filterSelectionResetHandler(this.filterDataReset);
79
+ this.filterData = {};
72
80
  }
73
- handleDrawTicketId(event) {
74
- this.filterData.drawTicketId = event.target.value;
81
+ handleTicketDrawId(event) {
82
+ this.filterData.ticketDrawId = event.target.value;
75
83
  }
76
84
  handleFilterFrom(event) {
77
85
  this.filterData.filterFromCalendar = new Date(event.target.value).toISOString();
@@ -88,7 +96,8 @@ export class HelperFilters {
88
96
  h("div", { class: "FilterModalHeader" },
89
97
  h("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate('filterModalTicketTitle', this.language) : translate('filterModalDrawTitle', this.language))),
90
98
  h("div", { class: "FilterModalBody" },
91
- h("input", { type: "text", value: this.filterData.drawTicketId, onInput: (event) => this.handleDrawTicketId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate('filterTicketPlaceholder', this.language) : translate('filterDrawPlaceholder', this.language) }),
99
+ 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) }),
100
+ h("p", null, translate('filterOrDate', this.language)),
92
101
  h("div", { class: "FilterCalendarWrapper" },
93
102
  h("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate('filterFromCalendar', this.language), class: "VaadinDatePicker" }),
94
103
  h("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate('filterToCalendar', this.language), class: "VaadinDatePicker" }))),
@@ -238,6 +247,25 @@ export class HelperFilters {
238
247
  "filterDataReset": {}
239
248
  }; }
240
249
  static get events() { return [{
250
+ "method": "filterDraw",
251
+ "name": "filterDraw",
252
+ "bubbles": true,
253
+ "cancelable": true,
254
+ "composed": true,
255
+ "docs": {
256
+ "tags": [],
257
+ "text": ""
258
+ },
259
+ "complexType": {
260
+ "original": "HelperFilters",
261
+ "resolved": "HelperFilters",
262
+ "references": {
263
+ "HelperFilters": {
264
+ "location": "global"
265
+ }
266
+ }
267
+ }
268
+ }, {
241
269
  "method": "filterSelection",
242
270
  "name": "filterSelection",
243
271
  "bubbles": true,
@@ -11,7 +11,8 @@ const TRANSLATIONS = {
11
11
  filterDateRangePlaceholder: 'Date Range',
12
12
  filterModalButton: 'Search',
13
13
  filterFromCalendar: 'From',
14
- filterToCalendar: 'To'
14
+ filterToCalendar: 'To',
15
+ filterOrDate: 'or search by date'
15
16
  },
16
17
  ro: {
17
18
  filterOpen: 'Filtrare',
@@ -21,7 +22,8 @@ const TRANSLATIONS = {
21
22
  filterTicketPlaceholder: 'Cauta ID bilet',
22
23
  filterDrawPlaceholder: 'Cauta ID draw',
23
24
  filterDateRangePlaceholder: 'Perioada',
24
- filterModalButton: 'Cauta'
25
+ filterModalButton: 'Cauta',
26
+ filterOrDate: 'sau cauta dupa data'
25
27
  },
26
28
  };
27
29
  export const translate = (key, customLang) => {
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h as h$2 } from '@stencil/core/internal/client';
2
- import '@everymatrix/helper-modal';
2
+ import { d as defineCustomElement$2 } from './helper-modal2.js';
3
3
 
4
4
  const DEFAULT_LANGUAGE = 'en';
5
5
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -14,7 +14,8 @@ const TRANSLATIONS = {
14
14
  filterDateRangePlaceholder: 'Date Range',
15
15
  filterModalButton: 'Search',
16
16
  filterFromCalendar: 'From',
17
- filterToCalendar: 'To'
17
+ filterToCalendar: 'To',
18
+ filterOrDate: 'or search by date'
18
19
  },
19
20
  ro: {
20
21
  filterOpen: 'Filtrare',
@@ -24,7 +25,8 @@ const TRANSLATIONS = {
24
25
  filterTicketPlaceholder: 'Cauta ID bilet',
25
26
  filterDrawPlaceholder: 'Cauta ID draw',
26
27
  filterDateRangePlaceholder: 'Perioada',
27
- filterModalButton: 'Cauta'
28
+ filterModalButton: 'Cauta',
29
+ filterOrDate: 'sau cauta dupa data'
28
30
  },
29
31
  };
30
32
  const translate$1 = (key, customLang) => {
@@ -22224,13 +22226,14 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
22224
22226
 
22225
22227
  customElements.define(DatePicker.is, DatePicker);
22226
22228
 
22227
- 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}";
22229
+ 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}";
22228
22230
 
22229
22231
  const HelperFilters$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
22230
22232
  constructor() {
22231
22233
  super();
22232
22234
  this.__registerHost();
22233
22235
  this.__attachShadow();
22236
+ this.filterDraw = createEvent(this, "filterDraw", 7);
22234
22237
  this.filterSelection = createEvent(this, "filterSelection", 7);
22235
22238
  this.filterSelectionReset = createEvent(this, "filterSelectionReset", 7);
22236
22239
  /**
@@ -22264,23 +22267,29 @@ const HelperFilters$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
22264
22267
  this.showFilterModal = false;
22265
22268
  this.showClearButton = false;
22266
22269
  this.filterData = {};
22267
- this.filterDataReset = { drawTicketId: '', filterFromCalendar: '', filterToCalendar: '' };
22270
+ this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
22271
+ }
22272
+ // reset field values each time the filter modal opens
22273
+ componentDidRender() {
22274
+ this.filterData.ticketDrawId = null;
22275
+ this.filterData.filterFromCalendar = null;
22276
+ this.filterData.filterToCalendar = null;
22277
+ // @TODO: to way binding?
22278
+ if (document.getElementById('#FilterById'))
22279
+ document.getElementById('#FilterById').value = '';
22268
22280
  }
22269
22281
  filterSelectionHandler(event) {
22270
- if (this.postMessage) {
22282
+ if (this.postMessage)
22271
22283
  window.postMessage({ type: 'filterSelection', event }, window.location.href);
22272
- }
22273
- else {
22284
+ if (this.filterData.ticketDrawId)
22285
+ this.filterDraw.emit(event);
22286
+ if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
22274
22287
  this.filterSelection.emit(event);
22275
- }
22276
22288
  }
22277
22289
  filterSelectionResetHandler(event) {
22278
- if (this.postMessage) {
22290
+ if (this.postMessage)
22279
22291
  window.postMessage({ type: 'filterSelectionReset', event }, window.location.href);
22280
- }
22281
- else {
22282
- this.filterSelectionReset.emit(event);
22283
- }
22292
+ this.filterSelectionReset.emit(event);
22284
22293
  }
22285
22294
  modalCloseEvent() {
22286
22295
  this.showFilterModal = false;
@@ -22298,9 +22307,10 @@ const HelperFilters$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
22298
22307
  resetSearch() {
22299
22308
  this.showClearButton = false;
22300
22309
  this.filterSelectionResetHandler(this.filterDataReset);
22310
+ this.filterData = {};
22301
22311
  }
22302
- handleDrawTicketId(event) {
22303
- this.filterData.drawTicketId = event.target.value;
22312
+ handleTicketDrawId(event) {
22313
+ this.filterData.ticketDrawId = event.target.value;
22304
22314
  }
22305
22315
  handleFilterFrom(event) {
22306
22316
  this.filterData.filterFromCalendar = new Date(event.target.value).toISOString();
@@ -22309,7 +22319,7 @@ const HelperFilters$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
22309
22319
  this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
22310
22320
  }
22311
22321
  render() {
22312
- return (h$2("div", { class: "HelperFilters" }, h$2("div", { class: "FilterButtonsWrapper" }, h$2("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$1('filterOpen', this.language)), this.showClearButton ? h$2("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$1('filterClear', this.language)) : null), h$2("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal }, h$2("div", { class: "FilterModalHeader" }, h$2("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate$1('filterModalTicketTitle', this.language) : translate$1('filterModalDrawTitle', this.language))), h$2("div", { class: "FilterModalBody" }, h$2("input", { type: "text", value: this.filterData.drawTicketId, onInput: (event) => this.handleDrawTicketId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate$1('filterTicketPlaceholder', this.language) : translate$1('filterDrawPlaceholder', this.language) }), h$2("div", { class: "FilterCalendarWrapper" }, h$2("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$1('filterFromCalendar', this.language), class: "VaadinDatePicker" }), h$2("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$1('filterToCalendar', this.language), class: "VaadinDatePicker" }))), h$2("div", { class: "FilterModalFooter" }, h$2("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$1('filterModalButton', this.language))))));
22322
+ return (h$2("div", { class: "HelperFilters" }, h$2("div", { class: "FilterButtonsWrapper" }, h$2("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate$1('filterOpen', this.language)), this.showClearButton ? h$2("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate$1('filterClear', this.language)) : null), h$2("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal }, h$2("div", { class: "FilterModalHeader" }, h$2("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate$1('filterModalTicketTitle', this.language) : translate$1('filterModalDrawTitle', this.language))), h$2("div", { class: "FilterModalBody" }, h$2("input", { id: "FilterById", type: "text", value: this.filterData.ticketDrawId, onInput: (event) => this.handleTicketDrawId(event), class: "FilterModalSearch", placeholder: this.activateTicketSearch ? translate$1('filterTicketPlaceholder', this.language) : translate$1('filterDrawPlaceholder', this.language) }), h$2("p", null, translate$1('filterOrDate', this.language)), h$2("div", { class: "FilterCalendarWrapper" }, h$2("vaadin-date-picker", { value: this.filterData.filterFromCalendar, onChange: (event) => this.handleFilterFrom(event), placeholder: translate$1('filterFromCalendar', this.language), class: "VaadinDatePicker" }), h$2("vaadin-date-picker", { value: this.filterData.filterToCalendar, onChange: (event) => this.handleFilterTo(event), placeholder: translate$1('filterToCalendar', this.language), class: "VaadinDatePicker" }))), h$2("div", { class: "FilterModalFooter" }, h$2("button", { class: "FilterModalButton", onClick: () => this.filterSearch() }, translate$1('filterModalButton', this.language))))));
22313
22323
  }
22314
22324
  static get style() { return helperFiltersCss; }
22315
22325
  }, [1, "helper-filters", {
@@ -22329,13 +22339,18 @@ function defineCustomElement$1() {
22329
22339
  if (typeof customElements === "undefined") {
22330
22340
  return;
22331
22341
  }
22332
- const components = ["helper-filters"];
22342
+ const components = ["helper-filters", "helper-modal"];
22333
22343
  components.forEach(tagName => { switch (tagName) {
22334
22344
  case "helper-filters":
22335
22345
  if (!customElements.get(tagName)) {
22336
22346
  customElements.define(tagName, HelperFilters$1);
22337
22347
  }
22338
22348
  break;
22349
+ case "helper-modal":
22350
+ if (!customElements.get(tagName)) {
22351
+ defineCustomElement$2();
22352
+ }
22353
+ break;
22339
22354
  } });
22340
22355
  }
22341
22356
 
@@ -0,0 +1,6 @@
1
+ import { H as HelperModal$1, d as defineCustomElement$1 } from './helper-modal2.js';
2
+
3
+ const HelperModal = HelperModal$1;
4
+ const defineCustomElement = defineCustomElement$1;
5
+
6
+ export { HelperModal, defineCustomElement };