@everymatrix/helper-filters 0.1.5 → 0.1.20

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.
@@ -263,6 +263,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
263
263
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
264
264
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
265
265
  }
266
+ else if (memberName === 'ref') {
267
+ // minifier will clean this up
268
+ if (newValue) {
269
+ newValue(elm);
270
+ }
271
+ }
266
272
  else if ((!isProp ) &&
267
273
  memberName[0] === 'o' &&
268
274
  memberName[1] === 'n') {
@@ -419,6 +425,7 @@ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
419
425
  for (; startIdx <= endIdx; ++startIdx) {
420
426
  if ((vnode = vnodes[startIdx])) {
421
427
  elm = vnode.$elm$;
428
+ callNodeRefs(vnode);
422
429
  // remove the vnode's element from the dom
423
430
  elm.remove();
424
431
  }
@@ -502,11 +509,14 @@ const patch = (oldVNode, newVNode) => {
502
509
  const elm = (newVNode.$elm$ = oldVNode.$elm$);
503
510
  const oldChildren = oldVNode.$children$;
504
511
  const newChildren = newVNode.$children$;
512
+ const tag = newVNode.$tag$;
505
513
  const text = newVNode.$text$;
506
514
  if (text === null) {
507
515
  // element node
508
516
  {
509
- {
517
+ if (tag === 'slot')
518
+ ;
519
+ else {
510
520
  // either this is the first render of an element OR it's an update
511
521
  // AND we already know it's possible it could have changed
512
522
  // this updates the element's css classes, attrs, props, listeners, etc.
@@ -537,11 +547,22 @@ const patch = (oldVNode, newVNode) => {
537
547
  elm.data = text;
538
548
  }
539
549
  };
550
+ const callNodeRefs = (vNode) => {
551
+ {
552
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
553
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
554
+ }
555
+ };
540
556
  const renderVdom = (hostRef, renderFnResults) => {
541
557
  const hostElm = hostRef.$hostElement$;
558
+ const cmpMeta = hostRef.$cmpMeta$;
542
559
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
543
560
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
544
561
  hostTagName = hostElm.tagName;
562
+ if (cmpMeta.$attrsToReflect$) {
563
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
564
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
565
+ }
545
566
  rootVnode.$tag$ = null;
546
567
  rootVnode.$flags$ |= 4 /* isHost */;
547
568
  hostRef.$vnode$ = rootVnode;
@@ -892,6 +913,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
892
913
  .map(([propName, m]) => {
893
914
  const attrName = m[1] || propName;
894
915
  attrNameToPropName.set(attrName, propName);
916
+ if (m[0] & 512 /* ReflectAttr */) {
917
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
918
+ }
895
919
  return attrName;
896
920
  });
897
921
  }
@@ -1052,6 +1076,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1052
1076
  {
1053
1077
  cmpMeta.$listeners$ = compactMeta[3];
1054
1078
  }
1079
+ {
1080
+ cmpMeta.$attrsToReflect$ = [];
1081
+ }
1055
1082
  const tagName = cmpMeta.$tagName$;
1056
1083
  const HostElement = class extends HTMLElement {
1057
1084
  // StencilLazyHost
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-0c5bb1ff.js');
5
+ const index = require('./index-4be1aa12.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-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],"quickFiltersActive":[4,"quick-filters-active"],"clientStyling":[1,"client-styling"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showFilterModal":[32],"showClearButton":[32],"filterData":[32],"filterDataReset":[32],"limitStylingAppends":[32]},[[0,"modalCloseEvent","modalCloseEvent"]]],[1,"helper-modal",{"titleModal":[1,"title-modal"],"visible":[1540]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -7,6 +7,13 @@
7
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
  }
@@ -32,28 +32,56 @@ export class HelperFilters {
32
32
  * Language
33
33
  */
34
34
  this.language = 'en';
35
+ /**
36
+ * Notifies if the quick filters from tickets are active
37
+ */
38
+ this.quickFiltersActive = false;
39
+ /**
40
+ * Client custom styling via string
41
+ */
42
+ this.clientStyling = '';
43
+ /**
44
+ * Client custom styling via url content
45
+ */
46
+ this.clientStylingUrlContent = '';
35
47
  this.showFilterModal = false;
36
48
  this.showClearButton = false;
37
49
  this.filterData = {};
38
50
  this.filterDataReset = { ticketDrawId: '', filterFromCalendar: '', filterToCalendar: '' };
51
+ this.limitStylingAppends = false;
52
+ this.setClientStyling = () => {
53
+ let sheet = document.createElement('style');
54
+ sheet.innerHTML = this.clientStyling;
55
+ this.stylingContainer.prepend(sheet);
56
+ };
57
+ this.setClientStylingURL = () => {
58
+ let cssFile = document.createElement('style');
59
+ setTimeout(() => {
60
+ cssFile.innerHTML = this.clientStylingUrlContent;
61
+ this.stylingContainer.prepend(cssFile);
62
+ }, 1);
63
+ };
39
64
  }
40
65
  // reset field values each time the filter modal opens
41
66
  componentDidRender() {
42
- this.filterData.ticketDrawId = null;
43
- this.filterData.filterFromCalendar = null;
44
- this.filterData.filterToCalendar = null;
45
67
  // @TODO: to way binding?
46
68
  if (document.getElementById('#FilterById'))
47
69
  document.getElementById('#FilterById').value = '';
70
+ // start custom styling area
71
+ if (!this.limitStylingAppends && this.stylingContainer) {
72
+ if (this.clientStyling)
73
+ this.setClientStyling();
74
+ if (this.clientStylingUrlContent)
75
+ this.setClientStylingURL();
76
+ this.limitStylingAppends = true;
77
+ }
78
+ // end custom styling area
48
79
  }
49
80
  filterSelectionHandler(event) {
50
81
  if (this.postMessage)
51
82
  window.postMessage({ type: 'filterSelection', event }, window.location.href);
52
- if (this.filterData.ticketDrawId)
53
- this.filterDraw.emit(event);
54
- if (this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
83
+ if (this.filterData.ticketDrawId || this.filterData.filterFromCalendar || this.filterData.filterToCalendar)
55
84
  this.filterSelection.emit(event);
56
- ;
57
85
  }
58
86
  filterSelectionResetHandler(event) {
59
87
  if (this.postMessage)
@@ -88,11 +116,14 @@ export class HelperFilters {
88
116
  this.filterData.filterToCalendar = new Date(event.target.value).toISOString();
89
117
  }
90
118
  render() {
91
- return (h("div", { class: "HelperFilters" },
119
+ return (h("div", { class: "HelperFilters", ref: el => this.stylingContainer = el },
92
120
  h("div", { class: "FilterButtonsWrapper" },
93
121
  h("button", { class: "FilterOpen", onClick: () => this.toggleFilterModal() }, translate('filterOpen', this.language)),
94
- this.showClearButton ? h("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate('filterClear', this.language)) : null),
95
- h("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal },
122
+ (this.showClearButton || this.quickFiltersActive) ?
123
+ h("button", { class: "FilterClear", onClick: () => this.resetSearch() }, translate('filterClear', this.language))
124
+ :
125
+ null),
126
+ h("helper-modal", { "title-modal": "Filter Modal", visible: this.showFilterModal, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent },
96
127
  h("div", { class: "FilterModalHeader" },
97
128
  h("h3", { class: "FilterModalTitle" }, this.activateTicketSearch ? translate('filterModalTicketTitle', this.language) : translate('filterModalDrawTitle', this.language))),
98
129
  h("div", { class: "FilterModalBody" },
@@ -238,13 +269,68 @@ export class HelperFilters {
238
269
  "attribute": "language",
239
270
  "reflect": false,
240
271
  "defaultValue": "'en'"
272
+ },
273
+ "quickFiltersActive": {
274
+ "type": "boolean",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "boolean",
278
+ "resolved": "boolean",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Notifies if the quick filters from tickets are active"
286
+ },
287
+ "attribute": "quick-filters-active",
288
+ "reflect": false,
289
+ "defaultValue": "false"
290
+ },
291
+ "clientStyling": {
292
+ "type": "string",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "string",
296
+ "resolved": "string",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Client custom styling via string"
304
+ },
305
+ "attribute": "client-styling",
306
+ "reflect": false,
307
+ "defaultValue": "''"
308
+ },
309
+ "clientStylingUrlContent": {
310
+ "type": "string",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "string",
314
+ "resolved": "string",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": false,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "Client custom styling via url content"
322
+ },
323
+ "attribute": "client-styling-url-content",
324
+ "reflect": false,
325
+ "defaultValue": "''"
241
326
  }
242
327
  }; }
243
328
  static get states() { return {
244
329
  "showFilterModal": {},
245
330
  "showClearButton": {},
246
331
  "filterData": {},
247
- "filterDataReset": {}
332
+ "filterDataReset": {},
333
+ "limitStylingAppends": {}
248
334
  }; }
249
335
  static get events() { return [{
250
336
  "method": "filterDraw",