@everymatrix/helper-filters 0.1.1 → 0.1.2

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,5 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h as h$2 } from './index-f5eea413.js';
2
- import '@everymatrix/helper-modal';
1
+ import { r as registerInstance, c as createEvent, h as h$2 } from './index-af82b143.js';
3
2
 
4
3
  const DEFAULT_LANGUAGE = 'en';
5
4
  const SUPPORTED_LANGUAGES = ['ro', 'en'];
@@ -14,8 +13,7 @@ const TRANSLATIONS = {
14
13
  filterDateRangePlaceholder: 'Date Range',
15
14
  filterModalButton: 'Search',
16
15
  filterFromCalendar: 'From',
17
- filterToCalendar: 'To',
18
- filterOrDate: 'or search by date'
16
+ filterToCalendar: 'To'
19
17
  },
20
18
  ro: {
21
19
  filterOpen: 'Filtrare',
@@ -25,8 +23,7 @@ const TRANSLATIONS = {
25
23
  filterTicketPlaceholder: 'Cauta ID bilet',
26
24
  filterDrawPlaceholder: 'Cauta ID draw',
27
25
  filterDateRangePlaceholder: 'Perioada',
28
- filterModalButton: 'Cauta',
29
- filterOrDate: 'sau cauta dupa data'
26
+ filterModalButton: 'Cauta'
30
27
  },
31
28
  };
32
29
  const translate$1 = (key, customLang) => {
@@ -22226,12 +22223,11 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
22226
22223
 
22227
22224
  customElements.define(DatePicker.is, DatePicker);
22228
22225
 
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}";
22226
+ 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}";
22230
22227
 
22231
22228
  const HelperFilters = class {
22232
22229
  constructor(hostRef) {
22233
22230
  registerInstance(this, hostRef);
22234
- this.filterDraw = createEvent(this, "filterDraw", 7);
22235
22231
  this.filterSelection = createEvent(this, "filterSelection", 7);
22236
22232
  this.filterSelectionReset = createEvent(this, "filterSelectionReset", 7);
22237
22233
  /**
@@ -22265,29 +22261,23 @@ const HelperFilters = class {
22265
22261
  this.showFilterModal = false;
22266
22262
  this.showClearButton = false;
22267
22263
  this.filterData = {};
22268
- this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
22269
- }
22270
- // reset field values each time the filter modal opens
22271
- componentDidRender() {
22272
- this.filterData.ticketDrawId = null;
22273
- this.filterData.filterFromCalendar = null;
22274
- this.filterData.filterToCalendar = null;
22275
- // @TODO: to way binding?
22276
- if (document.getElementById('#FilterById'))
22277
- document.getElementById('#FilterById').value = '';
22264
+ this.filterDataReset = { drawTicketId: '', filterFromCalendar: '', filterToCalendar: '' };
22278
22265
  }
22279
22266
  filterSelectionHandler(event) {
22280
- if (this.postMessage)
22267
+ if (this.postMessage) {
22281
22268
  window.postMessage({ type: 'filterSelection', event }, window.location.href);
22282
- if (this.filterData.ticketDrawId)
22283
- this.filterDraw.emit(event);
22284
- if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
22269
+ }
22270
+ else {
22285
22271
  this.filterSelection.emit(event);
22272
+ }
22286
22273
  }
22287
22274
  filterSelectionResetHandler(event) {
22288
- if (this.postMessage)
22275
+ if (this.postMessage) {
22289
22276
  window.postMessage({ type: 'filterSelectionReset', event }, window.location.href);
22290
- this.filterSelectionReset.emit(event);
22277
+ }
22278
+ else {
22279
+ this.filterSelectionReset.emit(event);
22280
+ }
22291
22281
  }
22292
22282
  modalCloseEvent() {
22293
22283
  this.showFilterModal = false;
@@ -22305,10 +22295,9 @@ const HelperFilters = class {
22305
22295
  resetSearch() {
22306
22296
  this.showClearButton = false;
22307
22297
  this.filterSelectionResetHandler(this.filterDataReset);
22308
- this.filterData = {};
22309
22298
  }
22310
- handleTicketDrawId(event) {
22311
- this.filterData.ticketDrawId = event.target.value;
22299
+ handleDrawTicketId(event) {
22300
+ this.filterData.drawTicketId = event.target.value;
22312
22301
  }
22313
22302
  handleFilterFrom(event) {
22314
22303
  this.filterData.filterFromCalendar = new Date(event.target.value).toISOString();
@@ -22317,9 +22306,46 @@ const HelperFilters = class {
22317
22306
  this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
22318
22307
  }
22319
22308
  render() {
22320
- 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))))));
22309
+ 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))))));
22321
22310
  }
22322
22311
  };
22323
22312
  HelperFilters.style = helperFiltersCss;
22324
22313
 
22325
- export { HelperFilters as helper_filters };
22314
+ /**
22315
+ * @name isMobile
22316
+ * @description A method that returns if the browser used to access the app is from a mobile device or not
22317
+ * @param {String} userAgent window.navigator.userAgent
22318
+ * @returns {Boolean} true or false
22319
+ */
22320
+ const isMobile = (userAgent) => {
22321
+ return !!(userAgent.toLowerCase().match(/android/i) ||
22322
+ userAgent.toLowerCase().match(/blackberry|bb/i) ||
22323
+ userAgent.toLowerCase().match(/iphone|ipad|ipod/i) ||
22324
+ userAgent.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i));
22325
+ };
22326
+
22327
+ 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}";
22328
+
22329
+ const HelperModal = class {
22330
+ constructor(hostRef) {
22331
+ registerInstance(this, hostRef);
22332
+ this.cancel = createEvent(this, "modalCloseEvent", 7);
22333
+ /**
22334
+ * Toggles if the helper is visible or not
22335
+ */
22336
+ this.visible = true;
22337
+ this.userAgent = window.navigator.userAgent;
22338
+ }
22339
+ handleHelperModalClose() {
22340
+ this.visible = false;
22341
+ this.cancel.emit();
22342
+ }
22343
+ ;
22344
+ render() {
22345
+ return ((this.visible &&
22346
+ h$2("div", { class: this.visible ? "HelperModalWrapper HelperModalVisible" : "HelperModalWrapper" }, h$2("div", { class: "HelperModalWrapper HelperModalVisible" }, h$2("div", { class: "HelperModalContent" + (isMobile(this.userAgent) ? ' HelperModalMobileContent' : '') }, h$2("span", { class: "HelperModalClose" + (isMobile(this.userAgent) ? ' HelperModalMobileClose' : ''), onClick: this.handleHelperModalClose.bind(this) }, "X"), h$2("slot", null))))));
22347
+ }
22348
+ };
22349
+ HelperModal.style = helperModalCss;
22350
+
22351
+ export { HelperFilters as helper_filters, HelperModal as helper_modal };
@@ -480,11 +480,14 @@ const patch = (oldVNode, newVNode) => {
480
480
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
481
481
  const oldChildren = oldVNode.$children$;
482
482
  const newChildren = newVNode.$children$;
483
+ const tag = newVNode.$tag$;
483
484
  const text = newVNode.$text$;
484
485
  if (text === null) {
485
486
  // element node
486
487
  {
487
- {
488
+ if (tag === 'slot')
489
+ ;
490
+ else {
488
491
  // either this is the first render of an element OR it's an update
489
492
  // AND we already know it's possible it could have changed
490
493
  // this updates the element's css classes, attrs, props, listeners, etc.
@@ -517,9 +520,14 @@ const patch = (oldVNode, newVNode) => {
517
520
  };
518
521
  const renderVdom = (hostRef, renderFnResults) => {
519
522
  const hostElm = hostRef.$hostElement$;
523
+ const cmpMeta = hostRef.$cmpMeta$;
520
524
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
521
525
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
522
526
  hostTagName = hostElm.tagName;
527
+ if (cmpMeta.$attrsToReflect$) {
528
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
529
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
530
+ }
523
531
  rootVnode.$tag$ = null;
524
532
  rootVnode.$flags$ |= 4 /* isHost */;
525
533
  hostRef.$vnode$ = rootVnode;
@@ -656,11 +664,7 @@ const postUpdateComponent = (hostRef) => {
656
664
  const tagName = hostRef.$cmpMeta$.$tagName$;
657
665
  const elm = hostRef.$hostElement$;
658
666
  const endPostUpdate = createTime('postUpdate', tagName);
659
- const instance = hostRef.$lazyInstance$ ;
660
667
  const ancestorComponent = hostRef.$ancestorComponent$;
661
- {
662
- safeCall(instance, 'componentDidRender');
663
- }
664
668
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
665
669
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
666
670
  {
@@ -870,6 +874,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
870
874
  .map(([propName, m]) => {
871
875
  const attrName = m[1] || propName;
872
876
  attrNameToPropName.set(attrName, propName);
877
+ if (m[0] & 512 /* ReflectAttr */) {
878
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
879
+ }
873
880
  return attrName;
874
881
  });
875
882
  }
@@ -1030,6 +1037,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1030
1037
  {
1031
1038
  cmpMeta.$listeners$ = compactMeta[3];
1032
1039
  }
1040
+ {
1041
+ cmpMeta.$attrsToReflect$ = [];
1042
+ }
1033
1043
  const tagName = cmpMeta.$tagName$;
1034
1044
  const HostElement = class extends HTMLElement {
1035
1045
  // StencilLazyHost
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-f5eea413.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-af82b143.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -10,7 +10,7 @@ const patchEsm = () => {
10
10
  const defineCustomElements = (win, options) => {
11
11
  if (typeof window === 'undefined') return Promise.resolve();
12
12
  return patchEsm().then(() => {
13
- return bootstrapLazy([["helper-filters",[[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);
13
+ return bootstrapLazy([["helper-filters_2",[[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);
14
14
  });
15
15
  };
16
16
 
@@ -1 +1 @@
1
- import{p as e,b as t}from"./p-645ae858.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-011c5248",[[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"]]]]]],e)));
1
+ import{p as e,b as t}from"./p-55654a54.js";(()=>{const t=import.meta.url,a={};return""!==t&&(a.resourcesUrl=new URL(".",t).href),e(a)})().then((e=>t([["p-3d3f7fda",[[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]}]]]],e)));