@sankhyalabs/sankhyablocks 1.4.0-beta.2 → 1.4.0-beta.4

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.
Files changed (152) hide show
  1. package/dist/cjs/{index-b0b676c5.js → index-6fcf07f3.js} +159 -1515
  2. package/dist/cjs/loader.cjs.js +2 -18
  3. package/dist/cjs/sankhyablocks.cjs.js +4 -116
  4. package/dist/cjs/snk-application.cjs.entry.js +53 -217
  5. package/dist/cjs/snk-crud.cjs.entry.js +9 -3
  6. package/dist/cjs/snk-data-unit.cjs.entry.js +23 -23
  7. package/dist/cjs/snk-filter-bar_5.cjs.entry.js +883 -0
  8. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  9. package/dist/cjs/snk-filter-detail.cjs.entry.js +32 -21
  10. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  11. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  12. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  13. package/dist/cjs/snk-filter-personalized.cjs.entry.js +23 -31
  14. package/dist/cjs/snk-filter-search.cjs.entry.js +3 -12
  15. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  16. package/dist/cjs/{snk-form.cjs.entry.js → snk-form_2.cjs.entry.js} +119 -5
  17. package/dist/cjs/snk-pesquisa.cjs.entry.js +5 -5
  18. package/dist/cjs/{taskbar-elements-283c737e.js → taskbar-elements-aedfeae6.js} +1 -1
  19. package/dist/cjs/teste-pesquisa.cjs.entry.js +5 -5
  20. package/dist/collection/components/snk-crud/snk-crud.js +29 -0
  21. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.js +0 -39
  22. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +0 -39
  23. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-detail.js +30 -36
  24. package/dist/collection/components/snk-filter-bar/filter-item/snk-filter-item.js +3 -14
  25. package/dist/collection/components/snk-filter-bar/filter-list/snk-filter-list.js +4 -12
  26. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +3 -3
  27. package/dist/components/index.js +0 -4
  28. package/dist/components/snk-application2.js +13 -177
  29. package/dist/components/snk-crud.js +9 -2
  30. package/dist/components/snk-data-unit.js +2 -2
  31. package/dist/components/snk-filter-bar2.js +4 -2
  32. package/dist/components/snk-filter-detail2.js +31 -21
  33. package/dist/components/snk-filter-item2.js +4 -15
  34. package/dist/components/snk-filter-list2.js +5 -13
  35. package/dist/components/snk-filter-modal2.js +4 -19
  36. package/dist/components/snk-filter-personalized.js +3 -13
  37. package/dist/components/snk-filter-search.js +2 -13
  38. package/dist/components/snk-form2.js +1 -1
  39. package/dist/components/snk-grid2.js +1 -1
  40. package/dist/components/snk-pesquisa2.js +1 -1
  41. package/dist/components/snk-taskbar2.js +1 -1
  42. package/dist/components/teste-pesquisa.js +1 -1
  43. package/dist/{sankhyablocks/index-2b4d2d14.js → esm/index-81dda3cf.js} +160 -1508
  44. package/dist/esm/loader.js +2 -18
  45. package/dist/esm/sankhyablocks.js +4 -116
  46. package/dist/esm/snk-application.entry.js +14 -178
  47. package/dist/esm/snk-crud.entry.js +8 -2
  48. package/dist/esm/snk-data-unit.entry.js +3 -3
  49. package/dist/esm/{snk-filter-bar.entry.js → snk-filter-bar_5.entry.js} +417 -4
  50. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  51. package/dist/esm/snk-filter-detail.entry.js +32 -21
  52. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  53. package/dist/esm/snk-filter-number.entry.js +1 -1
  54. package/dist/esm/snk-filter-period.entry.js +1 -1
  55. package/dist/esm/snk-filter-personalized.entry.js +3 -11
  56. package/dist/esm/snk-filter-search.entry.js +2 -11
  57. package/dist/esm/snk-filter-text.entry.js +1 -1
  58. package/dist/{sankhyablocks/snk-form.entry.js → esm/snk-form_2.entry.js} +117 -4
  59. package/dist/esm/snk-pesquisa.entry.js +2 -2
  60. package/dist/esm/{taskbar-elements-35d64ff9.js → taskbar-elements-38eb5d51.js} +1 -1
  61. package/dist/esm/teste-pesquisa.entry.js +2 -2
  62. package/dist/sankhyablocks/index.esm.js +0 -1
  63. package/dist/sankhyablocks/p-01823784.entry.js +1 -0
  64. package/dist/sankhyablocks/p-0352c0e2.entry.js +1 -0
  65. package/dist/sankhyablocks/p-07ebda01.entry.js +1 -0
  66. package/dist/sankhyablocks/p-46caa101.entry.js +1 -0
  67. package/dist/sankhyablocks/p-586e2522.js +1 -0
  68. package/dist/sankhyablocks/p-6f8303f3.entry.js +1 -0
  69. package/dist/sankhyablocks/p-746fc78b.entry.js +1 -0
  70. package/dist/sankhyablocks/p-77216252.entry.js +1 -0
  71. package/dist/sankhyablocks/p-86f15ffe.js +1 -0
  72. package/dist/sankhyablocks/p-8bbc0cbb.entry.js +74 -0
  73. package/dist/sankhyablocks/p-8f3c5709.entry.js +1 -0
  74. package/dist/sankhyablocks/p-97009a2c.entry.js +1 -0
  75. package/dist/sankhyablocks/p-9dd2b8cb.js +1 -0
  76. package/dist/sankhyablocks/p-aecf3e0a.entry.js +1 -0
  77. package/dist/sankhyablocks/p-c1c3b5d8.entry.js +1 -0
  78. package/dist/sankhyablocks/p-c9eec639.entry.js +1 -0
  79. package/dist/sankhyablocks/p-eea6444c.entry.js +1 -0
  80. package/dist/sankhyablocks/p-fac2b6a9.js +2 -0
  81. package/dist/sankhyablocks/p-fb705f81.entry.js +1 -0
  82. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -129
  83. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-personalized.d.ts +0 -2
  84. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +0 -2
  85. package/dist/types/components/snk-filter-bar/filter-item/snk-filter-detail.d.ts +1 -1
  86. package/dist/types/components/snk-filter-bar/filter-list/snk-filter-list.d.ts +1 -1
  87. package/dist/types/components.d.ts +4 -10
  88. package/package.json +1 -1
  89. package/react/components.d.ts +19 -0
  90. package/react/components.js +19 -0
  91. package/react/components.js.map +1 -1
  92. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  93. package/dist/cjs/css-shim-b8158822.js +0 -6
  94. package/dist/cjs/dom-36862b77.js +0 -75
  95. package/dist/cjs/index-84fe3b86.js +0 -20
  96. package/dist/cjs/index-93965c41.js +0 -141
  97. package/dist/cjs/index-e90ae303.js +0 -2408
  98. package/dist/cjs/shadow-css-346c0795.js +0 -389
  99. package/dist/cjs/snk-filter-bar.cjs.entry.js +0 -466
  100. package/dist/cjs/snk-filter-item.cjs.entry.js +0 -177
  101. package/dist/cjs/snk-filter-list.cjs.entry.js +0 -91
  102. package/dist/cjs/snk-filter-modal.cjs.entry.js +0 -37
  103. package/dist/cjs/snk-grid.cjs.entry.js +0 -79
  104. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -160
  105. package/dist/cjs/taskbar-processor-6bd0d35c.js +0 -47
  106. package/dist/components/index2.js +0 -2394
  107. package/dist/components/index3.js +0 -139
  108. package/dist/esm/app-globals-0f993ce5.js +0 -3
  109. package/dist/esm/css-shim-b3f2ee8d.js +0 -4
  110. package/dist/esm/dom-665d6011.js +0 -73
  111. package/dist/esm/index-2b4d2d14.js +0 -3262
  112. package/dist/esm/index-5992b7e6.js +0 -139
  113. package/dist/esm/index-c683b2b0.js +0 -2394
  114. package/dist/esm/index-c71285cb.js +0 -17
  115. package/dist/esm/shadow-css-b18e99d7.js +0 -387
  116. package/dist/esm/snk-filter-item.entry.js +0 -173
  117. package/dist/esm/snk-filter-list.entry.js +0 -87
  118. package/dist/esm/snk-filter-modal.entry.js +0 -33
  119. package/dist/esm/snk-form.entry.js +0 -129
  120. package/dist/esm/snk-grid.entry.js +0 -75
  121. package/dist/esm/snk-taskbar.entry.js +0 -156
  122. package/dist/esm/taskbar-processor-aa6772c9.js +0 -45
  123. package/dist/sankhyablocks/SnkMessageBuilder-35a20271.js +0 -199
  124. package/dist/sankhyablocks/app-globals-0f993ce5.js +0 -3
  125. package/dist/sankhyablocks/css-shim-b3f2ee8d.js +0 -4
  126. package/dist/sankhyablocks/dom-665d6011.js +0 -73
  127. package/dist/sankhyablocks/filter-item-type.enum-a79b2fa8.js +0 -14
  128. package/dist/sankhyablocks/index-5992b7e6.js +0 -139
  129. package/dist/sankhyablocks/index-c683b2b0.js +0 -2394
  130. package/dist/sankhyablocks/index-c71285cb.js +0 -17
  131. package/dist/sankhyablocks/shadow-css-b18e99d7.js +0 -387
  132. package/dist/sankhyablocks/snk-application.entry.js +0 -8166
  133. package/dist/sankhyablocks/snk-crud.entry.js +0 -66
  134. package/dist/sankhyablocks/snk-data-unit.entry.js +0 -268
  135. package/dist/sankhyablocks/snk-filter-bar.entry.js +0 -462
  136. package/dist/sankhyablocks/snk-filter-binary-select.entry.js +0 -43
  137. package/dist/sankhyablocks/snk-filter-detail.entry.js +0 -80
  138. package/dist/sankhyablocks/snk-filter-item.entry.js +0 -173
  139. package/dist/sankhyablocks/snk-filter-list.entry.js +0 -87
  140. package/dist/sankhyablocks/snk-filter-modal.entry.js +0 -33
  141. package/dist/sankhyablocks/snk-filter-multi-select.entry.js +0 -19
  142. package/dist/sankhyablocks/snk-filter-number.entry.js +0 -20
  143. package/dist/sankhyablocks/snk-filter-period.entry.js +0 -33
  144. package/dist/sankhyablocks/snk-filter-personalized.entry.js +0 -85
  145. package/dist/sankhyablocks/snk-filter-search.entry.js +0 -40
  146. package/dist/sankhyablocks/snk-filter-text.entry.js +0 -18
  147. package/dist/sankhyablocks/snk-grid.entry.js +0 -75
  148. package/dist/sankhyablocks/snk-pesquisa.entry.js +0 -311
  149. package/dist/sankhyablocks/snk-taskbar.entry.js +0 -156
  150. package/dist/sankhyablocks/taskbar-elements-35d64ff9.js +0 -90
  151. package/dist/sankhyablocks/taskbar-processor-aa6772c9.js +0 -45
  152. package/dist/sankhyablocks/teste-pesquisa.entry.js +0 -33
@@ -1,7 +1,9 @@
1
- import { r as registerInstance, h, f as Host, g as getElement } from './index-2b4d2d14.js';
2
- import { t as toString, b as DataType, O as ObjectUtils, S as StringUtils, E as ErrorException, A as ApplicationContext } from './index-c683b2b0.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-81dda3cf.js';
2
+ import { DataType, ObjectUtils, StringUtils, ErrorException, ApplicationContext, FloatingManager, ArrayUtils } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
- import { M as ModalAction } from './index-c71285cb.js';
4
+ import { ModalAction, ModalButtonStatus } from '@sankhyalabs/ezui/dist/collection/components/ez-modal-container';
5
+ import { toString } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
6
+ import { T as TaskbarElement, V as VisibleWhenForbidden, A as AuthorizationElements, b as buildElem, a as buildCustomButton } from './taskbar-elements-38eb5d51.js';
5
7
 
6
8
  const buildFilter = (item) => {
7
9
  switch (item.type) {
@@ -459,4 +461,415 @@ const SnkFilterBar = class {
459
461
  };
460
462
  SnkFilterBar.style = snkFilterBarCss;
461
463
 
462
- export { SnkFilterBar as snk_filter_bar };
464
+ const SnkFilterItem = class {
465
+ constructor(hostRef) {
466
+ registerInstance(this, hostRef);
467
+ this.filterChange = createEvent(this, "filterChange", 7);
468
+ this.innerClickCheck = (_floatingContainer, node) => {
469
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
470
+ return true;
471
+ }
472
+ this.detailIsVisible = false;
473
+ this.executeCloseCallback();
474
+ return false;
475
+ };
476
+ }
477
+ async showUp(open = false) {
478
+ return new Promise(resolve => {
479
+ this._filterItemElement.scrollIntoView({ behavior: "auto", block: "nearest", inline: "nearest" });
480
+ if (open) {
481
+ window.requestAnimationFrame(() => {
482
+ this._closeCallback = resolve;
483
+ this.showDetail();
484
+ });
485
+ }
486
+ });
487
+ }
488
+ showDetail() {
489
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, left: this.getScrollOffset(), useOverlay: true });
490
+ this.detailIsVisible = true;
491
+ }
492
+ getScrollOffset() {
493
+ return `${this._filterItemElement.getBoundingClientRect().left + 12}px`;
494
+ }
495
+ hideDetail() {
496
+ if (this._floatingID != undefined) {
497
+ FloatingManager.close(this._floatingID);
498
+ }
499
+ this._floatingID = undefined;
500
+ this.detailIsVisible = false;
501
+ this.executeCloseCallback();
502
+ }
503
+ executeCloseCallback() {
504
+ if (this._closeCallback) {
505
+ this._closeCallback();
506
+ this._closeCallback = undefined;
507
+ }
508
+ }
509
+ //---------------------------------------------
510
+ // Event handlers
511
+ //---------------------------------------------
512
+ clickListener(evt) {
513
+ if ([this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
514
+ if (evt.target === this._rightIconElement && this.config.value != undefined) {
515
+ this.filterChange.emit(Object.assign(Object.assign({}, this.config), { value: undefined }));
516
+ }
517
+ else {
518
+ if (this.detailIsVisible) {
519
+ this.hideDetail();
520
+ }
521
+ else {
522
+ this.showDetail();
523
+ }
524
+ }
525
+ evt.preventDefault();
526
+ evt.stopImmediatePropagation();
527
+ evt.stopPropagation();
528
+ }
529
+ }
530
+ mouseDownListener(evt) {
531
+ if (this.detailIsVisible && [this._chipElement, this._leftIconElement, this._rightIconElement].includes(evt.target)) {
532
+ evt.preventDefault();
533
+ evt.stopImmediatePropagation();
534
+ evt.stopPropagation();
535
+ }
536
+ }
537
+ getLabel() {
538
+ const { type, value, label, props } = this.config;
539
+ if (value) {
540
+ if (type === FilterItemType.BINARY_SELECT) {
541
+ const [optOne, optTwo] = props.options;
542
+ if (optOne.name === value) {
543
+ return optOne.label;
544
+ }
545
+ if (optTwo.name === value) {
546
+ return optTwo.label;
547
+ }
548
+ }
549
+ if (type === FilterItemType.MULTI_SELECT) {
550
+ const opt = props.options.find(opt => opt.value === value);
551
+ return `${label}: ${opt.label}`;
552
+ }
553
+ if (type === FilterItemType.PERIOD) {
554
+ let { end, start } = value;
555
+ if (typeof end === "string") {
556
+ end = new Date(end);
557
+ end.setMinutes(end.getMinutes() + end.getTimezoneOffset());
558
+ }
559
+ if (typeof start === "string") {
560
+ start = new Date(start);
561
+ start.setMinutes(start.getMinutes() + start.getTimezoneOffset());
562
+ }
563
+ const dateFormater = new Intl.DateTimeFormat("pt-BR");
564
+ if (end && start) {
565
+ return `${label}: ${dateFormater.format(start)} a ${dateFormater.format(end)}`;
566
+ }
567
+ else {
568
+ if (start) {
569
+ return `${label}: A partir de ${dateFormater.format(start)}`;
570
+ }
571
+ else if (end) {
572
+ return `${label}: Até ${dateFormater.format(end)}`;
573
+ }
574
+ else {
575
+ return label;
576
+ }
577
+ }
578
+ }
579
+ if (type === FilterItemType.SEARCH) {
580
+ return `${label}: ${value.value} - ${value.label}`;
581
+ }
582
+ if (type === FilterItemType.PERSONALIZED) {
583
+ return label;
584
+ }
585
+ return `${label}: ${value}`;
586
+ }
587
+ return label;
588
+ }
589
+ componentDidRender() {
590
+ if (this._floatingID == undefined) {
591
+ if (this._popover) {
592
+ this._popover.remove();
593
+ }
594
+ }
595
+ }
596
+ filterChangeListener() {
597
+ this.hideDetail();
598
+ }
599
+ getRightIconName() {
600
+ if (this.config.value != undefined) {
601
+ return "close";
602
+ }
603
+ return this.detailIsVisible ? "chevron-up" : "chevron-down";
604
+ }
605
+ getLeftIconName() {
606
+ switch (this.config.type) {
607
+ case FilterItemType.PERIOD:
608
+ return "calendar";
609
+ case FilterItemType.PERSONALIZED:
610
+ return "tune";
611
+ }
612
+ return undefined;
613
+ }
614
+ render() {
615
+ const leftIcon = this.getLeftIconName();
616
+ return (h(Host, null, h("ez-chip", { ref: ref => this._chipElement = ref, label: this.getLabel(), value: this.config.value != undefined }, leftIcon ? h("ez-icon", { ref: ref => this._leftIconElement = ref, iconName: leftIcon, class: "ez-padding-right--small", slot: "leftIcon" }) : undefined, h("ez-icon", { ref: ref => this._rightIconElement = ref, iconName: this.getRightIconName(), class: "ez-padding-left--small", slot: "rightIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("snk-filter-detail", { config: this.config, getMessage: this.getMessage, class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem, key: this.config.id }))));
617
+ }
618
+ get _filterItemElement() { return getElement(this); }
619
+ };
620
+
621
+ const SHOW_MORE_ITEM_NAME = "__SHOWMORE__";
622
+ const MAX_FILTERS = 5;
623
+ const SnkFilterList = class {
624
+ constructor(hostRef) {
625
+ registerInstance(this, hostRef);
626
+ this.snkItemSelected = createEvent(this, "snkItemSelected", 7);
627
+ this.innerClickCheck = (_floatingContainer, node) => {
628
+ if (node.id != FloatingManager.MODAL_ELEMENT_ID) {
629
+ return true;
630
+ }
631
+ this._detailIsVisible = false;
632
+ return false;
633
+ };
634
+ }
635
+ showList() {
636
+ this._floatingID = FloatingManager.float(this._popover, this._popoverContainer, { autoClose: true, innerClickTest: this.innerClickCheck, useOverlay: true });
637
+ this._detailIsVisible = true;
638
+ this._showAll = false;
639
+ this._filterArgument = "";
640
+ }
641
+ hideList() {
642
+ if (this._floatingID != undefined) {
643
+ FloatingManager.close(this._floatingID);
644
+ }
645
+ this._floatingID = undefined;
646
+ this._detailIsVisible = false;
647
+ }
648
+ buttonClick() {
649
+ if (this._detailIsVisible) {
650
+ this.hideList();
651
+ }
652
+ else {
653
+ this.showList();
654
+ }
655
+ }
656
+ componentDidRender() {
657
+ if (this._floatingID == undefined) {
658
+ if (this._popover) {
659
+ this._popover.remove();
660
+ }
661
+ }
662
+ }
663
+ buildItemElement(item) {
664
+ return (h("div", { class: "ez-col ez-col--sd-12 ez-align--middle ez-padding--small sc-snk-filter-bar snk-filter-bar__filter-list-item", onClick: () => this.itemSelected(item.name) }, item.iconName ? h("ez-icon", { iconName: item.iconName, size: "small", class: `ez-padding-right--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__icon ${item.iconClass || ""}` }) : undefined, h("div", { class: `ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-item__label ${item.labelClass || ""}` }, item.label)));
665
+ }
666
+ itemSelected(itemName) {
667
+ if (itemName === SHOW_MORE_ITEM_NAME) {
668
+ this._showAll = true;
669
+ }
670
+ else {
671
+ this.hideList();
672
+ this.snkItemSelected.emit(itemName);
673
+ }
674
+ }
675
+ getFilterItems() {
676
+ const items = this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items.filter(item => item.kind === "FILTER")) : [];
677
+ if (items.length === 0) {
678
+ return h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding--extra-small sc-snk-filter-bar snk-filter-bar__filter-list-items-container--empty" }, this.emptyText);
679
+ }
680
+ const hideItems = !this._filterArgument && !this._showAll && (items.length > MAX_FILTERS + 1);
681
+ if (hideItems) {
682
+ items.splice(MAX_FILTERS);
683
+ items.push({ kind: "INTERNAL", label: "Mostrar mais", iconName: "dots-horizontal", name: SHOW_MORE_ITEM_NAME, iconClass: "snk-filter-bar__filter-list-item__icon--secondary", labelClass: "snk-filter-bar__filter-list-item__label--secondary" });
684
+ }
685
+ return h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-list-items-container" }, items.map(item => this.buildItemElement(item)));
686
+ }
687
+ getFooterItems() {
688
+ return this.items.filter(item => item.kind === "FOOTER");
689
+ }
690
+ render() {
691
+ return (h(Host, { class: "ez-flex ez-flex--column" }, h("ez-button", { class: this.buttonClass, label: this.label, onClick: () => this.buttonClick(), mode: this.iconName ? "icon" : undefined, iconName: this.iconName, size: "small" }, h("slot", { name: "leftIcon" })), h("section", { class: "ez-margin-top--small sc-snk-filter-bar snk-filter__popover-container", ref: elem => this._popoverContainer = elem }, h("div", { class: "sc-snk-filter-bar snk-filter__popover ez-padding--small", ref: elem => this._popover = elem }, h("ez-filter-input", { ref: ref => this._filterInput = ref, mode: "slim", label: this.findFilterText, value: this._filterArgument, onEzChange: (evt) => this._filterArgument = evt.detail }), this.getFilterItems(), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), this.items ? this.getFooterItems().map(item => this.buildItemElement(item)) : undefined))));
692
+ }
693
+ get _element() { return getElement(this); }
694
+ };
695
+
696
+ const SnkFilterModal = class {
697
+ constructor(hostRef) {
698
+ registerInstance(this, hostRef);
699
+ }
700
+ updateValue(id, value) {
701
+ this.items = this.items.map(item => {
702
+ if (item.id === id) {
703
+ return Object.assign(Object.assign({}, item), { active: value });
704
+ }
705
+ return item;
706
+ });
707
+ }
708
+ getActiveFiltersMsg() {
709
+ const activeFilters = this.items.filter(item => item.active).length;
710
+ if (activeFilters === 0) {
711
+ return this.getMessage("snkFilterBar.noActiveFilters");
712
+ }
713
+ return this.getMessage(activeFilters > 1 ? "snkFilterBar.activeFilters" : "snkFilterBar.activeFilter", { ACTIVE_FILTERS: activeFilters });
714
+ }
715
+ getFilteredItems() {
716
+ return this.items ? ArrayUtils.applyStringFilter(this._filterArgument, this.items) : [];
717
+ }
718
+ render() {
719
+ const allowCancel = this.items.filter(item => item.active).length > 0;
720
+ return (h("ez-modal-container", { modalTitle: this.modalTitle, modalSubTitle: this.modalSubTitle, cancelButtonLabel: this.cancelButtonLabel, okButtonLabel: this.okButtonLabel, onEzModalAction: evt => this.processModalAction(evt.detail), cancelButtonStatus: allowCancel ? ModalButtonStatus.ENABLED : ModalButtonStatus.DISABLED }, h("div", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-content" }, h("div", null, this.useSearch ? h("ez-filter-input", { label: this.getMessage("snkFilterBar.modalFindFilter"), onEzChange: (evt) => this._filterArgument = evt.detail }) : undefined), this.getFilteredItems().length > 0 ? h("div", { class: "ez-text ez-text--medium ez-text--primary ez-padding-bottom--small" }, this.getActiveFiltersMsg()) : undefined, h("div", null, this.getFilteredItems().map(item => h("div", { class: "ez-padding--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item ez-align--middle ez-margin-bottom--small" }, h("ez-check", { class: "sc-snk-filter-bar snk-filter-bar__filter-modal-item__check", onEzChange: evt => this.updateValue(item.id, evt.detail), enabled: item.enabled, value: item.active, mode: "switch" }), h("div", { class: "ez-text ez-title--primary ez-text--medium ez-margin-left--medium sc-snk-filter-bar snk-filter-bar__filter-modal-item__label" }, item.label)))), h("div", { class: "ez-text ez-text--large ez-align--middle ez-text--secondary ez-text--center ez-padding-bottom--large" }, this.infoText))));
721
+ }
722
+ };
723
+
724
+ const snkTaskbarCss = ".sc-snk-taskbar-h{display:flex}";
725
+
726
+ const SnkTaskbar = class {
727
+ constructor(hostRef) {
728
+ registerInstance(this, hostRef);
729
+ this.actionClick = createEvent(this, "actionClick", 7);
730
+ this._titleKeyByElement = {
731
+ [TaskbarElement.UPDATE]: "snkTaskbar.titleUpdate",
732
+ [TaskbarElement.PREVIOUS]: "snkTaskbar.titlePrevious",
733
+ [TaskbarElement.NEXT]: "snkTaskbar.titleNext",
734
+ [TaskbarElement.REFRESH]: "snkTaskbar.titleRefresh",
735
+ [TaskbarElement.CLONE]: "snkTaskbar.titleClone",
736
+ [TaskbarElement.REMOVE]: "snkTaskbar.titleRemove",
737
+ [TaskbarElement.MORE_OPTIONS]: "snkTaskbar.titleMoreOptions",
738
+ [TaskbarElement.INSERT]: "snkTaskbar.titleInsert",
739
+ [TaskbarElement.CANCEL]: "snkTaskbar.titleCancel",
740
+ [TaskbarElement.SAVE]: "snkTaskbar.titleSave",
741
+ [TaskbarElement.GRID_MODE]: "snkTaskbar.titleGridMode",
742
+ [TaskbarElement.CONFIG_GRID]: "snkTaskbar.titleConfigGrid",
743
+ [TaskbarElement.FORM_MODE]: "snkTaskbar.titleFormMode"
744
+ };
745
+ }
746
+ observeButtons() {
747
+ this._definitions = undefined;
748
+ }
749
+ // Internal methods
750
+ elementsFromString(strButtons) {
751
+ const elements = [];
752
+ if (strButtons) {
753
+ strButtons.split(",").forEach(buttonName => {
754
+ buttonName = buttonName.trim();
755
+ if (VisibleWhenForbidden[buttonName] || this.isAllowed(buttonName)) {
756
+ elements.push(buttonName.trim());
757
+ }
758
+ });
759
+ }
760
+ return elements;
761
+ }
762
+ isAllowed(buttonName) {
763
+ if (AuthorizationElements[buttonName]) {
764
+ return this._permissions ? this._permissions.isSup || this._permissions[buttonName] : false;
765
+ }
766
+ return true;
767
+ }
768
+ /**
769
+ * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
770
+ * através de um pequeno modulo na estrutura da aplicação:
771
+ * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
772
+ * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-taskbar.msg.ts"
773
+ */
774
+ getTitle(element) {
775
+ let key;
776
+ if (this.isAllowed(element)) {
777
+ key = this._titleKeyByElement[element];
778
+ }
779
+ else {
780
+ key = "snkTaskbar.forbidden";
781
+ }
782
+ return key ? this._application.messagesBuilder.getMessage(key, {}) : "";
783
+ }
784
+ elementClick(elem) {
785
+ if (this.dataUnit) {
786
+ switch (elem) {
787
+ case TaskbarElement.PREVIOUS:
788
+ this.dataUnit.previousRecord();
789
+ break;
790
+ case TaskbarElement.NEXT:
791
+ this.dataUnit.nextRecord();
792
+ break;
793
+ case TaskbarElement.REFRESH:
794
+ this.dataUnit.loadData();
795
+ break;
796
+ case TaskbarElement.CLONE:
797
+ this.dataUnit.copySelected();
798
+ break;
799
+ case TaskbarElement.REMOVE:
800
+ this.dataUnit.removeSelectedRecords();
801
+ break;
802
+ case TaskbarElement.INSERT:
803
+ this.dataUnit.addRecord();
804
+ break;
805
+ case TaskbarElement.CANCEL:
806
+ this.dataUnit.cancelEdition();
807
+ break;
808
+ case TaskbarElement.SAVE:
809
+ this.dataUnit.saveData();
810
+ break;
811
+ }
812
+ }
813
+ this.actionClick.emit(elem);
814
+ }
815
+ isEnabled(elem) {
816
+ if (!this.isAllowed(elem)) {
817
+ return false;
818
+ }
819
+ return !(this.disabledButtons && this.disabledButtons.includes(elem));
820
+ }
821
+ getElement(index, def) {
822
+ let className = def === this.primaryButton ? "ez-button--primary " : "";
823
+ if (index > 1) {
824
+ className += "ez-padding-left--medium";
825
+ }
826
+ if (TaskbarElement[def.toString()]) {
827
+ return buildElem(def, className, elem => this.getTitle(elem), elem => this.elementClick(elem), elem => this.isEnabled(elem), this.actionsList);
828
+ }
829
+ else {
830
+ return buildCustomButton(def, className, elem => this.elementClick(elem), elem => this.isEnabled(elem));
831
+ }
832
+ }
833
+ // Lifecycle
834
+ componentWillLoad() {
835
+ this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
836
+ if (this._application) {
837
+ this._application.getAllAccess().then(access => this._permissions = access);
838
+ }
839
+ else {
840
+ this._permissions = {};
841
+ }
842
+ }
843
+ componentWillRender() {
844
+ if (this._definitions == undefined && this._permissions) {
845
+ this._definitions = this.elementsFromString(this.buttons);
846
+ }
847
+ }
848
+ render() {
849
+ if (this._definitions === undefined) {
850
+ return undefined;
851
+ }
852
+ let index = 0;
853
+ return (h(Host, null, this._definitions.map((elem) => {
854
+ if (elem === TaskbarElement.DIVIDER) {
855
+ index = 0;
856
+ }
857
+ else {
858
+ index++;
859
+ }
860
+ if (TaskbarElement[elem]) {
861
+ return this.getElement(index, TaskbarElement[elem]);
862
+ }
863
+ if (this.customButtons.has(elem)) {
864
+ return this.getElement(index, this.customButtons.get(elem));
865
+ }
866
+ return h("slot", { name: elem });
867
+ })));
868
+ }
869
+ static get watchers() { return {
870
+ "buttons": ["observeButtons"]
871
+ }; }
872
+ };
873
+ SnkTaskbar.style = snkTaskbarCss;
874
+
875
+ export { SnkFilterBar as snk_filter_bar, SnkFilterItem as snk_filter_item, SnkFilterList as snk_filter_list, SnkFilterModal as snk_filter_modal, SnkTaskbar as snk_taskbar };
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, f as Host } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, h, H as Host } from './index-81dda3cf.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
3
 
4
4
  const SnkFilterBinarySelect = class {
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, e as createEvent, h, f as Host } from './index-2b4d2d14.js';
2
- import { A as ApplicationUtils } from './index-5992b7e6.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-81dda3cf.js';
2
+ import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
4
 
5
5
  const SnkFilterDetail = class {
@@ -41,39 +41,50 @@ const SnkFilterDetail = class {
41
41
  }
42
42
  apply() {
43
43
  var _a;
44
+ let value = this._editor["value"];
44
45
  let isValid = true;
45
- const value = this._editor["value"];
46
- /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
47
- if (value != undefined && this.config.type === FilterItemType.PERSONALIZED) {
46
+ if (this.config.type === FilterItemType.PERSONALIZED) {
48
47
  const params = ((_a = this.config.props.personalizedFilter) === null || _a === void 0 ? void 0 : _a.parameters) || [];
49
- if (params.length > 1) {
50
- if (params.length > value.length) {
51
- isValid = false;
52
- }
53
- else {
54
- value.forEach(item => {
55
- if (item == undefined) {
56
- isValid = false;
57
- }
58
- });
59
- }
48
+ const paramsCount = params.length;
49
+ if (paramsCount === 0) {
50
+ //Valor do filtro personalizado sem parametros deve ser um array vazio
51
+ value = [];
60
52
  }
61
- if (!isValid) {
62
- this.keepOpened = true;
63
- ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.").then(() => setTimeout(() => this.keepOpened = false, 1));
53
+ else {
54
+ isValid = this.validateAllFilled(paramsCount, value);
64
55
  }
65
56
  }
66
- /* WARNING: Temporário.*/
67
57
  if (isValid) {
68
58
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: value }));
69
59
  }
70
60
  }
61
+ /* WARNING: Temporário. Isso só está sendo feito até desconsiderar os parametros não informados para PersonalizedFilter*/
62
+ validateAllFilled(paramsCount, value) {
63
+ let isValid = true;
64
+ if (value != undefined && paramsCount > 1) {
65
+ if (paramsCount > value.length) {
66
+ isValid = false;
67
+ }
68
+ else {
69
+ value.forEach(item => {
70
+ if (item == undefined) {
71
+ isValid = false;
72
+ }
73
+ });
74
+ }
75
+ }
76
+ if (!isValid) {
77
+ ApplicationUtils.alert("Filtro parcialmente preenchido", "Favor completar todas as informações do filtro.");
78
+ }
79
+ return isValid;
80
+ }
81
+ /* WARNING: Temporário.*/
71
82
  clear() {
72
83
  this.changeConfig(Object.assign(Object.assign({}, this.config), { value: undefined }));
73
84
  }
74
85
  render() {
75
86
  const ContentEditor = this.getContentEditor();
76
- return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config, fix: () => this.keepOpened = true, unfix: () => this.keepOpened = false }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
87
+ return (h(Host, null, h("div", { class: "col ez-col--sd-12 ez-align--right ez-padding-medium ez-flex--align-items-center" }, h("div", { class: "ez-text ez-title ez-title--small ez-padding--small sc-snk-filter-bar snk-filter-item__editor-header" }, this.config.detailTitle), this.getPopUpHeaderButtons()), h(ContentEditor, { ref: ref => this._editor = ref, value: this.config.value, config: this.config }), h("hr", { class: "sc-snk-filter-bar snk-filter__popover-rule" }), h("div", { class: "ez-col ez-col--sd-12 ez-align--right" }, h("ez-button", { label: this.getMessage("snkFilterBar.cleanFilter"), onClick: () => this.clear(), size: "small" }), h("ez-button", { label: this.getMessage("snkFilterBar.applyFilter"), onClick: () => this.apply(), size: "small", class: "ez-button--primary ez-padding-left--medium" }))));
77
88
  }
78
89
  };
79
90
 
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, h } from './index-81dda3cf.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
3
 
4
4
  const SnkFilterMultiSelect = class {
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, h } from './index-81dda3cf.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
3
 
4
4
  const SnkFilterPeriod = class {
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, h } from './index-81dda3cf.js';
2
2
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
3
3
 
4
4
  const SnkFilterPeriod = class {
@@ -1,5 +1,6 @@
1
- import { r as registerInstance, h, f as Host } from './index-2b4d2d14.js';
2
- import { U as UserInterface, c as convertType, A as ApplicationContext } from './index-c683b2b0.js';
1
+ import { r as registerInstance, h, H as Host } from './index-81dda3cf.js';
2
+ import { UserInterface, ApplicationContext } from '@sankhyalabs/core';
3
+ import { convertType } from '@sankhyalabs/core/dist/dataunit/metadata/DataType';
3
4
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
5
 
5
6
  const SnkFilterPersonalized = class {
@@ -30,21 +31,12 @@ const SnkFilterPersonalized = class {
30
31
  }
31
32
  doSearch(mode, argument, param) {
32
33
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
33
- if (this.fix) {
34
- this.fix();
35
- }
36
34
  return new Promise((resolve, reject) => {
37
35
  application.executePreparedSearch(mode, argument, param.searchContext)
38
36
  .then(result => {
39
37
  resolve(result);
40
- if (this.unfix) {
41
- this.unfix();
42
- }
43
38
  }).catch(reason => {
44
39
  reject(reason);
45
- if (this.unfix) {
46
- this.unfix();
47
- }
48
40
  });
49
41
  });
50
42
  }
@@ -1,5 +1,5 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
2
- import { A as ApplicationContext } from './index-c683b2b0.js';
1
+ import { r as registerInstance, h } from './index-81dda3cf.js';
2
+ import { ApplicationContext } from '@sankhyalabs/core';
3
3
  import { F as FilterItemType } from './filter-item-type.enum-a79b2fa8.js';
4
4
 
5
5
  const SnkFilterSearch = class {
@@ -11,21 +11,12 @@ const SnkFilterSearch = class {
11
11
  }
12
12
  doSearch(mode, argument) {
13
13
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
14
- if (this.fix) {
15
- this.fix();
16
- }
17
14
  return new Promise((resolve, reject) => {
18
15
  application.executePreparedSearch(mode, argument, this.config.props.searchContext)
19
16
  .then(result => {
20
17
  resolve(result);
21
- if (this.unfix) {
22
- this.unfix();
23
- }
24
18
  }).catch(reason => {
25
19
  reject(reason);
26
- if (this.unfix) {
27
- this.unfix();
28
- }
29
20
  });
30
21
  });
31
22
  }
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-2b4d2d14.js';
1
+ import { r as registerInstance, h } from './index-81dda3cf.js';
2
2
 
3
3
  const SnkFilterText = class {
4
4
  constructor(hostRef) {