@sankhyalabs/sankhyablocks 1.1.23 → 1.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ApplicationUtils-05b74ee9.js +39 -0
- package/dist/cjs/AssetsUtils-bd004f63.js +24 -0
- package/dist/cjs/CSSVarsUtils-75ca9c64.js +19 -0
- package/dist/cjs/_commonjsHelpers-537d719a.js +20 -0
- package/dist/cjs/ez-action-chip.cjs.entry.js +27 -0
- package/dist/cjs/ez-application.cjs.entry.js +26 -0
- package/dist/cjs/ez-button_4.cjs.entry.js +660 -0
- package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
- package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
- package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
- package/dist/cjs/ez-dialog.cjs.entry.js +89 -0
- package/dist/cjs/ez-form.cjs.entry.js +785 -0
- package/dist/cjs/ez-grid.cjs.entry.js +110485 -0
- package/dist/cjs/ez-icon.cjs.entry.js +41 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +104 -0
- package/dist/cjs/ez-modal_2.cjs.entry.js +316 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
- package/dist/cjs/ez-popover.cjs.entry.js +120 -0
- package/dist/cjs/ez-popup.cjs.entry.js +48 -0
- package/dist/cjs/ez-search.cjs.entry.js +64 -0
- package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
- package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
- package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
- package/dist/cjs/ez-toast.cjs.entry.js +44 -0
- package/dist/cjs/ez-upload.cjs.entry.js +356 -0
- package/dist/cjs/index-6ac5268e.js +1769 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/sankhyablocks.cjs.js +2 -2
- package/dist/cjs/snk-application.cjs.entry.js +52 -1313
- package/dist/cjs/test-du.cjs.entry.js +76 -0
- package/dist/collection/collection-manifest.json +36 -1
- package/dist/collection/components/snk-application/snk-application.js +8 -4
- package/dist/{collection/temp → components}/ApplicationUtils.js +37 -31
- package/dist/components/AssetsUtils.js +22 -0
- package/dist/components/CSSVarsUtils.js +17 -0
- package/dist/components/_commonjsHelpers.js +17 -0
- package/dist/components/ez-action-chip.js +44 -0
- package/dist/components/ez-application.js +39 -0
- package/dist/components/ez-button.js +6 -0
- package/dist/components/ez-button2.js +105 -0
- package/dist/components/ez-calendar.js +6 -0
- package/dist/components/ez-calendar2.js +242 -0
- package/dist/components/ez-check.js +6 -0
- package/dist/components/ez-check2.js +94 -0
- package/dist/components/ez-collapsible-box.js +67 -0
- package/dist/components/ez-combo-box.js +6 -0
- package/dist/components/ez-combo-box2.js +311 -0
- package/dist/components/ez-date-input.js +135 -0
- package/dist/components/ez-date-time-input.js +179 -0
- package/dist/components/ez-dialog.js +124 -0
- package/dist/components/ez-form.js +6 -0
- package/dist/components/ez-form2.js +807 -0
- package/dist/components/ez-grid.js +110576 -0
- package/dist/components/ez-icon.js +6 -0
- package/dist/components/ez-icon2.js +56 -0
- package/dist/components/ez-label-chip.js +125 -0
- package/dist/components/ez-list.js +6 -0
- package/dist/components/ez-list2.js +523 -0
- package/dist/components/ez-modal.js +6 -0
- package/dist/components/ez-modal2.js +82 -0
- package/dist/components/ez-number-input.js +115 -0
- package/dist/components/ez-popover.js +145 -0
- package/dist/components/ez-popup.js +67 -0
- package/dist/components/ez-search.js +100 -0
- package/dist/components/ez-tabselector.js +6 -0
- package/dist/components/ez-tabselector2.js +213 -0
- package/dist/components/ez-text-area.js +137 -0
- package/dist/components/ez-text-input.js +6 -0
- package/dist/components/ez-text-input2.js +223 -0
- package/dist/components/ez-time-input.js +153 -0
- package/dist/components/ez-toast.js +64 -0
- package/dist/components/ez-upload.js +382 -0
- package/dist/components/grid-config.js +6 -0
- package/dist/components/grid-config2.js +318 -0
- package/dist/components/select-box.js +6 -0
- package/dist/components/select-box2.js +47 -0
- package/dist/components/snk-application.js +5 -1266
- package/dist/components/test-du.js +101 -0
- package/dist/esm/ApplicationUtils-e0b6d857.js +37 -0
- package/dist/esm/AssetsUtils-98074c9c.js +22 -0
- package/dist/esm/CSSVarsUtils-0787c3f3.js +17 -0
- package/dist/esm/_commonjsHelpers-9943807e.js +17 -0
- package/dist/esm/ez-action-chip.entry.js +23 -0
- package/dist/esm/ez-application.entry.js +22 -0
- package/dist/esm/ez-button_4.entry.js +653 -0
- package/dist/esm/ez-calendar.entry.js +219 -0
- package/dist/esm/ez-collapsible-box.entry.js +43 -0
- package/dist/esm/ez-combo-box.entry.js +274 -0
- package/dist/esm/ez-date-input.entry.js +98 -0
- package/dist/esm/ez-date-time-input.entry.js +141 -0
- package/dist/esm/ez-dialog.entry.js +85 -0
- package/dist/esm/ez-form.entry.js +781 -0
- package/dist/esm/ez-grid.entry.js +110481 -0
- package/dist/esm/ez-icon.entry.js +37 -0
- package/dist/esm/ez-label-chip.entry.js +100 -0
- package/dist/esm/ez-modal_2.entry.js +311 -0
- package/dist/esm/ez-number-input.entry.js +82 -0
- package/dist/esm/ez-popover.entry.js +116 -0
- package/dist/esm/ez-popup.entry.js +44 -0
- package/dist/esm/ez-search.entry.js +60 -0
- package/dist/esm/ez-tabselector.entry.js +194 -0
- package/dist/esm/ez-text-area.entry.js +110 -0
- package/dist/esm/ez-text-input.entry.js +197 -0
- package/dist/esm/ez-time-input.entry.js +114 -0
- package/dist/esm/ez-toast.entry.js +40 -0
- package/dist/esm/ez-upload.entry.js +352 -0
- package/dist/esm/index-df166135.js +1738 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/sankhyablocks.js +2 -2
- package/dist/esm/snk-application.entry.js +6 -1267
- package/dist/esm/test-du.entry.js +72 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-action-chip/ez-action-chip.css +67 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-application/ez-application.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-button/ez-button.css +180 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-calendar/ez-calendar.css +319 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-check/ez-check.css +327 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-collapsible-box/ez-collapsible-box.css +162 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-combo-box/ez-combo-box.css +217 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-input/ez-date-input.css +49 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-date-time-input/ez-date-time-input.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-dialog/ez-dialog.css +527 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-form/ez-form.css +5 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/ez-grid.css +31 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/gridconfig/grid-config.css +129 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-grid/subcomponents/select-box/select-box.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-icon/ez-icon.css +176 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-label-chip/ez-label-chip.css +139 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-list/ez-list.css +335 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-modal/ez-modal.css +358 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-number-input/ez-number-input.css +4 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popover/ez-popover.css +44 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-popup/ez-popup.css +405 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-search/ez-search.css +3 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-tabselector/ez-tabselector.css +138 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-area/ez-text-area.css +165 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-text-input/ez-text-input.css +196 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-time-input/ez-time-input.css +10 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-toast/ez-toast.css +127 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/ez-upload/ez-upload.css +568 -0
- package/dist/node_modules/@sankhyalabs/ezui/dist/collection/components/test-du/test-du.css +3 -0
- package/dist/sankhyablocks/p-08e1cded.entry.js +1 -0
- package/dist/sankhyablocks/p-0a77ac95.entry.js +57 -0
- package/dist/sankhyablocks/p-112455b1.js +1 -0
- package/dist/sankhyablocks/p-126c4aaa.entry.js +1 -0
- package/dist/sankhyablocks/p-1421b89a.entry.js +1 -0
- package/dist/sankhyablocks/p-1beadcaf.entry.js +1 -0
- package/dist/sankhyablocks/p-1c423f5d.entry.js +1 -0
- package/dist/sankhyablocks/p-28a0dbf0.entry.js +1 -0
- package/dist/sankhyablocks/p-4763d5c2.js +1 -0
- package/dist/sankhyablocks/p-4c66200a.entry.js +1 -0
- package/dist/sankhyablocks/p-5dc772be.entry.js +1 -0
- package/dist/sankhyablocks/p-5ff3e300.entry.js +1 -0
- package/dist/sankhyablocks/p-7122cec4.entry.js +1 -0
- package/dist/sankhyablocks/p-811b4b9d.js +1 -0
- package/dist/sankhyablocks/p-813fe4f7.js +1 -0
- package/dist/sankhyablocks/p-9b33a005.entry.js +1 -0
- package/dist/sankhyablocks/p-9e22ec87.entry.js +1 -0
- package/dist/sankhyablocks/p-9f7239df.entry.js +1 -0
- package/dist/sankhyablocks/p-9f7e6e48.js +1 -0
- package/dist/sankhyablocks/p-a47e0537.entry.js +1 -0
- package/dist/sankhyablocks/p-a9aba60a.entry.js +1 -0
- package/dist/sankhyablocks/p-afda7940.entry.js +1 -0
- package/dist/sankhyablocks/p-b3a83eaf.entry.js +1 -0
- package/dist/sankhyablocks/p-b96a8d40.entry.js +1 -0
- package/dist/sankhyablocks/p-c61c0e40.entry.js +1 -0
- package/dist/sankhyablocks/p-ca29d028.entry.js +1 -0
- package/dist/sankhyablocks/p-cd17abb1.entry.js +1 -0
- package/dist/sankhyablocks/p-d3a5366d.entry.js +369 -0
- package/dist/sankhyablocks/p-d5703a41.entry.js +1 -0
- package/dist/sankhyablocks/p-e5f77a59.entry.js +1 -0
- package/dist/sankhyablocks/p-e9e94d51.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-application/snk-application.d.ts +1 -1
- package/dist/types/components.d.ts +1 -1
- package/package.json +11 -3
- package/react/components.d.ts +29 -0
- package/react/components.js +29 -0
- package/react/components.js.map +1 -1
- package/dist/cjs/index-20a7d705.js +0 -733
- package/dist/esm/index-8d3572c4.js +0 -707
- package/dist/sankhyablocks/p-5fa264b9.js +0 -1
- package/dist/sankhyablocks/p-f3bdd8c3.entry.js +0 -57
- package/dist/types/temp/ApplicationUtils.d.ts +0 -7
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
|
|
8
|
+
const ezCalendarCss = ":host{--ez-calendar--font-family:var(--font-pattern, Arial);--ez-calendar--color:var(--title--primary, #626e82);--ez-calendar--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--ez-calendar__body--background-color:var(--background--xlight, #FFF);--ez-calendar__time--background-color:var(--background--xlight, #FAFAFA);--ez-calendar__body--padding:var(--space--medium, 12px) var(--space--small, 6px);--ez-calendar__body--border-radius:var(--border--radius-medium, 12px);--ez-calendar__body--shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-container--z-index:var(--more-visible, 2);--ez-calendar__header-line--stroke:1px;--ez-calendar__header-line--color:var(--color--strokes, #C0C0C0);--ez-calendar__nav-btn--fill:var(--text--primary, #008561);--ez-calendar__nav-btn--hover--fill:var(--color--primary, #350404);--ez-calendar__nav-btn--width:10px;--ez-calendar__nav-btn--height:16px;--ez-calendar__nav-btn--previous-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--ez-calendar__nav-btn--next-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-calendar__cell--margin:0px 1.5px;--ez-calendar__cell--width:var(--space--large, 24px);--ez-calendar__cell--padding:1.5px 0px;--ez-calendar__cell--border-radius:var(--border--radius-small, 6px);--ez-calendar__cell--over--background-color:var(--color--primary, #E2F4EF);--ez-calendar__cell--over--color:var(--color--primary-300, #008561);--ez-calendar__cell--outset--color:var(--color--disable-primary, #E5EAF0);--ez-calendar__cell--selected--background-color:var(--color--primary, #008561);--ez-calendar__cell--selected--color:var(--color--inverted, #FFF);--ez-calendar__btn-today--color:var(--color--primary);--ez-calendar__btn-today--hover--background-color:var(--color--primary-300, #E2F4EF);--ez-calendar__btn-today--border-radius:var(--border--radius-small, 6px);position:relative;display:flex;user-select:none}.calendar__container{display:flex;z-index:var(--more-visible, 2)}.calendar{z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-calendar__body--background-color);padding:var(--ez-calendar__body--padding);border-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__header{display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color)}.calendar__btn-next,.calendar__btn-previous{outline:none;border:none;background-color:unset;cursor:pointer;padding:0px}.calendar__btn-next::after,.calendar__btn-previous::after{content:'';display:flex;background-color:var(--ez-calendar__nav-btn--fill);width:var(--ez-calendar__nav-btn--width);height:var(--ez-calendar__nav-btn--height)}.calendar__btn-previous::after{-webkit-mask-image:var(--ez-calendar__nav-btn--previous-image);mask-image:var(--ez-calendar__nav-btn--previous-image)}.calendar__btn-next::after{-webkit-mask-image:var(--ez-calendar__nav-btn--next-image);mask-image:var(--ez-calendar__nav-btn--next-image)}.calendar__btn-next:hover::after,.calendar__btn-previous:hover::after{background-color:var(--ez-calendar__nav-btn--hover--fill)}.calendar__lbl-month{font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__line{display:flex;padding:0px;margin:0px}.calendar__cell{display:flex;justify-content:center;align-content:center;cursor:pointer;font-size:var(--text--extra-small, 10px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);padding:var(--ez-calendar__cell--padding);margin:var(--ez-calendar__cell--margin);min-width:var(--ez-calendar__cell--width);border-radius:var(--ez-calendar__cell--border-radius)}.calendar__cell:hover{background-color:var(--ez-calendar__cell--over--background-color);color:var(--ez-calendar__cell--over--color)}.calendar__cell--secondary{color:var(--ez-calendar__cell--outset--color)}.calendar__cell--unselectable:hover{background-color:unset;border-radius:unset;cursor:unset}.calendar__cell--unselectable{font-weight:var(--text-weight--large, 600);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.calendar__cell--selected,.calendar__cell--selected:hover{background-color:var(--ez-calendar__cell--selected--background-color);color:var(--ez-calendar__cell--selected--color)}.calendar__footer{display:flex;flex-direction:column}.calendar__btn-today{border:none;background-color:unset;cursor:pointer;font-weight:var(--text-weight--large, 600);font-size:var(--title--extra-small, 12px);padding:0px;font-family:var(--ez-calendar--font-family);text-shadow:var(--ez-calendar--text-shadow);color:var(--ez-calendar__btn-today--color);border-radius:var(--ez-calendar__btn-today--border-radius)}.calendar__btn-today:hover{background-color:var(--ez-calendar__btn-today--hover--background-color)}section{display:flex}.calendar-time{margin-left:-10px;display:flex;flex-direction:column;padding:12px 0px 0px 10px;background-color:var(--ez-calendar__time--background-color);border-top-right-radius:var(--ez-calendar__body--border-radius);border-bottom-right-radius:var(--ez-calendar__body--border-radius);box-shadow:var(--ez-calendar__body--shadow)}.calendar__column{height:136px;padding:0px;margin:0px;overflow:auto}.calendar__column::-webkit-scrollbar{width:0px;max-width:0px;min-width:0px}.calendar-time__header{padding-left:var(--space--small, 6px);padding-right:var(--space--small, 6px);display:flex;justify-content:space-between;padding-bottom:var(--space--small, 6px);margin:0px var(--space--, 12px) var(--space--small, 6px) var(--space--, 12px);font-weight:var(--text-weight--extra-large, 700);font-size:var(--title--small, 14px);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow);border-bottom:solid var(--ez-calendar__header-line--stroke) var(--ez-calendar__header-line--color);font-family:var(--ez-calendar--font-family);color:var(--ez-calendar--color);text-shadow:var(--ez-calendar--text-shadow)}.separatorTime{color:#A2ABB9;padding:0px 1px;line-height:16px;font-size:17px;font-weight:normal}.endHidden{-webkit-mask-image:linear-gradient(180deg, #000 calc(100% - 48px), transparent 100%)}.calendar__column .calendar__cell{margin:0px;padding:1.5px 1.5px}";
|
|
9
|
+
|
|
10
|
+
const EzCalendar = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
14
|
+
this._firstRender = true;
|
|
15
|
+
this._todayLabel = "Hoje";
|
|
16
|
+
this._weekDayLabels = ["D", "S", "T", "Q", "Q", "S", "S"];
|
|
17
|
+
this._monthLabels = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
|
18
|
+
this._hoursLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"];
|
|
19
|
+
this._minutosLabel = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59"];
|
|
20
|
+
/**
|
|
21
|
+
* A data selecionada no calendário
|
|
22
|
+
*/
|
|
23
|
+
this.value = new Date();
|
|
24
|
+
/**
|
|
25
|
+
* No modo floating o calendário só se tornará visível
|
|
26
|
+
* quando o método show() for acionado.
|
|
27
|
+
*/
|
|
28
|
+
this.floating = false;
|
|
29
|
+
/**
|
|
30
|
+
* Exibe ou não as horas e minutos no calendario
|
|
31
|
+
*/
|
|
32
|
+
this.time = false;
|
|
33
|
+
/**
|
|
34
|
+
* Exibe ou não os segundos no calendario
|
|
35
|
+
*/
|
|
36
|
+
this.showSeconds = false;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Usado no modo floating. Faz com que o componente seja exibido.
|
|
40
|
+
* É possível determinar ajustes de posicionamento através dos parâmetros
|
|
41
|
+
* top, left, bottom e right. Esses parâmetros devem ser informados como
|
|
42
|
+
* strings no formato css.
|
|
43
|
+
*/
|
|
44
|
+
async show(top, left, bottom, right) {
|
|
45
|
+
if (this.floating) {
|
|
46
|
+
this._floatingID = core.FloatingManager.float(this._box, this._container, { autoClose: true, top, left, bottom, right });
|
|
47
|
+
window.requestAnimationFrame(() => {
|
|
48
|
+
this._box.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
49
|
+
});
|
|
50
|
+
this.scroll();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Método necessário para ajustar o posicionamento do calendar acima ou abaixo do ez-date-input conforme a disponibilidade de espaço.
|
|
55
|
+
*/
|
|
56
|
+
async fitVertical(topOffset, bottomOffset) {
|
|
57
|
+
const neededHeight = this._container.getBoundingClientRect().bottom + this._calendarHeight;
|
|
58
|
+
const availableBottom = (window.innerHeight || document.documentElement.clientHeight) > neededHeight;
|
|
59
|
+
if (availableBottom) {
|
|
60
|
+
this.show(topOffset + "px", undefined, "unset");
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
this.show("unset", undefined, bottomOffset + "px");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Usado no modo floating. Faz com que o componente seja ocultado.
|
|
68
|
+
*/
|
|
69
|
+
async hide() {
|
|
70
|
+
if (this._floatingID !== undefined) {
|
|
71
|
+
core.FloatingManager.close(this._floatingID);
|
|
72
|
+
this._floatingID = undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
valueChanged() {
|
|
76
|
+
if (this.value) {
|
|
77
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
78
|
+
this._currentPosition.setDate(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getMonthLabel() {
|
|
82
|
+
return this._monthLabels[this._currentPosition.getMonth()] + " " + this._currentPosition.getFullYear();
|
|
83
|
+
}
|
|
84
|
+
isSelectedDate(d) {
|
|
85
|
+
if (this.value) {
|
|
86
|
+
return this.value.getDate() == d.getDate() && this.value.getMonth() == d.getMonth() && this.value.getFullYear() == d.getFullYear();
|
|
87
|
+
}
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
changeMonth(offset) {
|
|
91
|
+
this._currentPosition.setMonth(this._currentPosition.getMonth() + offset);
|
|
92
|
+
index.forceUpdate(this);
|
|
93
|
+
}
|
|
94
|
+
selectDate(d) {
|
|
95
|
+
let newDate = d;
|
|
96
|
+
if (this.value && (this.time || this.showSeconds)) {
|
|
97
|
+
newDate.setHours(this.value.getHours());
|
|
98
|
+
newDate.setMinutes(this.value.getMinutes());
|
|
99
|
+
if (this.showSeconds) {
|
|
100
|
+
newDate.setSeconds(this.value.getSeconds());
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
newDate.setSeconds(0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
this.value = newDate;
|
|
107
|
+
this.ezChange.emit(this.value);
|
|
108
|
+
}
|
|
109
|
+
selectHours(hour) {
|
|
110
|
+
if (!this.value) {
|
|
111
|
+
this.value = new Date();
|
|
112
|
+
}
|
|
113
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), hour, this.value.getMinutes(), this.value.getSeconds());
|
|
114
|
+
this.ezChange.emit(this.value);
|
|
115
|
+
}
|
|
116
|
+
selectMinutes(minute) {
|
|
117
|
+
if (!this.value) {
|
|
118
|
+
this.value = new Date();
|
|
119
|
+
}
|
|
120
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), minute, this.value.getSeconds());
|
|
121
|
+
this.ezChange.emit(this.value);
|
|
122
|
+
}
|
|
123
|
+
selectSeconds(second) {
|
|
124
|
+
if (!this.value) {
|
|
125
|
+
this.value = new Date();
|
|
126
|
+
}
|
|
127
|
+
this.value = new Date(this.value.getFullYear(), this.value.getMonth(), this.value.getDate(), this.value.getHours(), this.value.getMinutes(), second);
|
|
128
|
+
this.ezChange.emit(this.value);
|
|
129
|
+
}
|
|
130
|
+
updateScroll(element) {
|
|
131
|
+
if (element) {
|
|
132
|
+
const { scrollHeight, clientHeight, scrollTop } = element;
|
|
133
|
+
const remainingScroll = scrollHeight - clientHeight - Math.ceil(scrollTop);
|
|
134
|
+
if (remainingScroll > 0) {
|
|
135
|
+
element.classList.add("endHidden");
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
element.classList.remove("endHidden");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
componentDidRender() {
|
|
143
|
+
if (this.floating && this._firstRender) {
|
|
144
|
+
this._calendarHeight = this._box.clientHeight;
|
|
145
|
+
this._box.remove();
|
|
146
|
+
this._firstRender = false;
|
|
147
|
+
}
|
|
148
|
+
this.updateScroll(this._hoursScroll);
|
|
149
|
+
this.updateScroll(this._minutesScroll);
|
|
150
|
+
this.updateScroll(this._secondsScroll);
|
|
151
|
+
}
|
|
152
|
+
componentDidLoad() {
|
|
153
|
+
this.scroll();
|
|
154
|
+
}
|
|
155
|
+
scroll() {
|
|
156
|
+
if (this.time || this.showSeconds) {
|
|
157
|
+
this._hoursScroll.scrollTop = this._hoursSelect.offsetTop - 64;
|
|
158
|
+
this._minutesScroll.scrollTop = this._minutesSelect.offsetTop - 64;
|
|
159
|
+
this.updateScroll(this._hoursScroll);
|
|
160
|
+
this.updateScroll(this._minutesScroll);
|
|
161
|
+
if (this.showSeconds) {
|
|
162
|
+
this._secondsScroll.scrollTop = this._secondsSelect.offsetTop - 64;
|
|
163
|
+
this.updateScroll(this._secondsScroll);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
render() {
|
|
168
|
+
if (this._currentPosition == null) {
|
|
169
|
+
this._currentPosition = new Date();
|
|
170
|
+
if (this.value) {
|
|
171
|
+
this._currentPosition.setTime(this.value.getTime());
|
|
172
|
+
}
|
|
173
|
+
this._currentPosition.setDate(1);
|
|
174
|
+
}
|
|
175
|
+
const firstDate = new Date();
|
|
176
|
+
firstDate.setTime(this._currentPosition.getTime());
|
|
177
|
+
firstDate.setDate(1 - firstDate.getDay());
|
|
178
|
+
return (index.h("section", { ref: elem => this._container = elem }, index.h("div", { ref: elem => this._box = elem, class: "calendar__container" }, index.h("div", { class: "calendar" }, index.h("div", { class: "calendar__header" }, index.h("button", { class: "calendar__btn-previous", onClick: () => this.changeMonth(-1) }), index.h("label", { class: "calendar__lbl-month" }, this.getMonthLabel()), index.h("button", { class: "calendar__btn-next", onClick: () => this.changeMonth(1) })), index.h("div", { class: "calendar__body" }, index.h("div", { class: "calendar__line" }, this._weekDayLabels.map(day => index.h("div", { class: "calendar__cell calendar__cell--unselectable" }, day))), [0, 7, 14, 21, 28, 35].map(offset => index.h("div", { class: "calendar__line" }, [0, 1, 2, 3, 4, 5, 6].map(index$1 => {
|
|
179
|
+
const date = new Date();
|
|
180
|
+
date.setTime(firstDate.getTime());
|
|
181
|
+
date.setDate(date.getDate() + offset + index$1);
|
|
182
|
+
let classNames = "calendar__cell";
|
|
183
|
+
if (this._currentPosition.getMonth() != date.getMonth()) {
|
|
184
|
+
classNames += " calendar__cell--secondary";
|
|
185
|
+
}
|
|
186
|
+
else if (this.isSelectedDate(date)) {
|
|
187
|
+
classNames += " calendar__cell--selected";
|
|
188
|
+
}
|
|
189
|
+
return index.h("div", { class: classNames, onClick: () => this.selectDate(date) }, date.getDate());
|
|
190
|
+
})))), index.h("div", { class: "calendar__footer" }, index.h("button", { class: "calendar__btn-today", onClick: () => this.selectDate(new Date()) }, this._todayLabel))), (this.time || this.showSeconds) &&
|
|
191
|
+
index.h("div", { class: "calendar-time" }, index.h("div", { class: "calendar-time__header" }, index.h("div", null, "H"), index.h("div", { class: "separatorTime" }, ":"), index.h("div", null, "M"), this.showSeconds &&
|
|
192
|
+
index.h("div", { class: "separatorTime" }, ":"), this.showSeconds &&
|
|
193
|
+
index.h("div", null, "S")), index.h("div", { class: "calendar__body ", style: { display: 'flex', paddingLeft: '12px', paddingRight: '12px' } }, index.h("div", { class: "calendar__column", ref: elem => this._hoursScroll = elem, onScroll: () => this.updateScroll(this._hoursScroll) }, this._hoursLabel.map((offset, index$1) => {
|
|
194
|
+
if (index$1 === this.value.getHours()) {
|
|
195
|
+
return (index.h("div", { style: { display: 'flex' }, ref: elem => this._hoursSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectHours(index$1) }, offset), index.h("div", { class: "separatorTime" }, ":")));
|
|
199
|
+
}
|
|
200
|
+
})), index.h("div", { class: "calendar__column", ref: elem => this._minutesScroll = elem, onScroll: () => this.updateScroll(this._minutesScroll) }, this._minutosLabel.map((offset, index$1) => {
|
|
201
|
+
if (index$1 === this.value.getMinutes()) {
|
|
202
|
+
return (index.h("div", { style: { display: 'flex' }, ref: elem => this._minutesSelect = elem }, index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
return (index.h("div", { style: { display: 'flex' } }, index.h("div", { class: "calendar__cell", onClick: () => this.selectMinutes(index$1) }, offset), this.showSeconds && index.h("div", { class: "separatorTime" }, ":")));
|
|
206
|
+
}
|
|
207
|
+
})), this.showSeconds &&
|
|
208
|
+
index.h("div", { class: "calendar__column", ref: elem => this._secondsScroll = elem, onScroll: () => this.updateScroll(this._secondsScroll) }, this._minutosLabel.map((offset, index$1) => {
|
|
209
|
+
if (index$1 === this.value.getSeconds()) {
|
|
210
|
+
return (index.h("div", { class: "calendar__cell calendar__cell--selected", onClick: () => this.selectSeconds(index$1), ref: elem => this._secondsSelect = elem }, offset));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
return (index.h("div", { class: "calendar__cell", onClick: () => this.selectSeconds(index$1) }, offset));
|
|
214
|
+
}
|
|
215
|
+
})))))));
|
|
216
|
+
}
|
|
217
|
+
static get watchers() { return {
|
|
218
|
+
"value": ["valueChanged"]
|
|
219
|
+
}; }
|
|
220
|
+
};
|
|
221
|
+
EzCalendar.style = ezCalendarCss;
|
|
222
|
+
|
|
223
|
+
exports.ez_calendar = EzCalendar;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
|
|
7
|
+
const ezCollapsibleBoxCss = ":host{--ez-collapsible-box--height:42px;--ez-collapsible-box--font-size:var(--title--medium, 14px);--ez-collapsible-box--font-family:var(--font-pattern, Arial);--ez-collapsible-box--font-weight:var(--text-weight--large, 600);--ez-collapsible-box--color:var(--title--primary);--ez-collapsible-box__btn--image--xsmall:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"12px\" width=\"7.5px\"><path d=\"M 0,10.56 4.5967752,6.0000006 0,1.3800006 1.4516132,0 7.5,6.0000006 1.4516132,12 Z\"/></svg>');--ez-collapsible-box__btn--image--small:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"14px\" width=\"8.68px\"><path d=\"M 0,12.32 5.3200012,7.0000007 0,1.6100007 1.6800004,0 8.68,7.0000007 1.6800004,14 Z\"/></svg>');--ez-collapsible-box__btn--image--medium:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--ez-collapsible-box__btn--image--large:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"18px\" width=\"11.25px\"><path d=\"M 0,15.84 6.8951628,9.0000009 0,2.0700009 2.1774198,0 11.25,9.0000009 2.1774198,18 Z\"/></svg>');--ez-collapsible-box__btn--image--xlarge:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"20px\" width=\"12.5px\"><path d=\"M 0,17.6 7.661292,10.000001 0,2.300001 2.4193553,0 12.5,10.000001 2.4193553,20 Z\"/></svg>');--ez-collapsible-box__btn--fill:var(--ez-collapsible-box--color);--ez-collapsible-box__btn--width:10px;--ez-collapsible-box__btn--height:16px;display:flex;flex-wrap:wrap;width:100%}.collapsible-box__title{width:100%;align-self:center;display:flex;box-sizing:border-box}.collapsible-box__label{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;width:100%;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__label--icon-right{white-space:nowrap;overflow:hidden;cursor:pointer;text-overflow:ellipsis;font-family:var(--ez-collapsible-box--font-family);font-size:var(--ez-collapsible-box--font-size);font-weight:var(--ez-collapsible-box--font-weight);color:var(--ez-collapsible-box--color)}.collapsible-box__btn{outline:none;border:none;background-color:unset;cursor:pointer;padding:1px 6px}.collapsible-box__btn::after{content:'';display:flex;background-color:var(--ez-collapsible-box__btn--fill);width:var(--ez-collapsible-box__btn--width);height:var(--ez-collapsible-box__btn--height);transition:transform var(--transition);transform:rotate(90deg)}.collapsible-box__btn--xsmall::after{width:7.5px;height:12px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--xsmall);mask-image:var(--ez-collapsible-box__btn--image--xsmall)}.collapsible-box__btn--small::after{width:8.68px;height:14px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--small);mask-image:var(--ez-collapsible-box__btn--image--small)}.collapsible-box__btn--medium::after{width:10px;height:16px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--medium);mask-image:var(--ez-collapsible-box__btn--image--medium)}.collapsible-box__btn--large::after{width:11.25px;height:18px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--large);mask-image:var(--ez-collapsible-box__btn--image--large)}.collapsible-box__btn--xlarge::after{width:12.5px;height:20px;-webkit-mask-image:var(--ez-collapsible-box__btn--image--xlarge);mask-image:var(--ez-collapsible-box__btn--image--xlarge)}.collapsible-box__btn--collapsed::after{transform:rotate(0deg)}.font--xsmall{font-size:10px}.font--small{font-size:12px}.font--medium{font-size:14px}.font--large{font-size:16px}.font--xlarge{font-size:20px}";
|
|
8
|
+
|
|
9
|
+
const EzCollapsibleBox = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
13
|
+
/**
|
|
14
|
+
* Valor externalizado que garante a exibição ou não do componente
|
|
15
|
+
*/
|
|
16
|
+
this.value = false;
|
|
17
|
+
/**
|
|
18
|
+
* Define o tamanho do texto e do ícone do componente.
|
|
19
|
+
*/
|
|
20
|
+
this.headerSize = "small";
|
|
21
|
+
/**
|
|
22
|
+
* Define o local onde o ícone será renderizado.
|
|
23
|
+
*/
|
|
24
|
+
this.iconPlacement = "left";
|
|
25
|
+
}
|
|
26
|
+
observeValue() {
|
|
27
|
+
this.ezChange.emit(this.value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Esconde ou revela o conteúdo do componente
|
|
31
|
+
*/
|
|
32
|
+
async showHide() {
|
|
33
|
+
this.value = !this.value;
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h(index.Host, null, this.iconPlacement == "right" ?
|
|
37
|
+
index.h("div", { class: "collapsible-box__title" }, index.h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label), index.h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }))
|
|
38
|
+
:
|
|
39
|
+
index.h("div", { class: "collapsible-box__title" }, index.h("button", { class: this.value ? "collapsible-box__btn collapsible-box__btn--collapsed " + "collapsible-box__btn--" + this.headerSize : "collapsible-box__btn " + "collapsible-box__btn--" + this.headerSize, onClick: () => this.showHide() }), index.h("label", { class: (this.iconPlacement == "right" ? "collapsible-box__label--icon-right " : "collapsible-box__label ") + (this.headerSize ? "font--" + this.headerSize : ""), onClick: () => this.showHide(), title: this.label }, this.label)), !this.value ? index.h("slot", null) : null));
|
|
40
|
+
}
|
|
41
|
+
static get watchers() { return {
|
|
42
|
+
"value": ["observeValue"]
|
|
43
|
+
}; }
|
|
44
|
+
};
|
|
45
|
+
EzCollapsibleBox.style = ezCollapsibleBoxCss;
|
|
46
|
+
|
|
47
|
+
exports.ez_collapsible_box = EzCollapsibleBox;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6ac5268e.js');
|
|
6
|
+
const core = require('@sankhyalabs/core');
|
|
7
|
+
const CSSVarsUtils = require('./CSSVarsUtils-75ca9c64.js');
|
|
8
|
+
|
|
9
|
+
const ezComboBoxCss = ":host{--ez-combo-box--height:42px;--ez-combo-box--width:100%;--ez-combo-box__icon--width:48px;--ez-combo-box--border-radius:var(--border--radius-medium, 12px);--ez-combo-box--border-radius-small:var(--border--radius-small, 6px);--ez-combo-box--font-size:var(--text--medium, 14px);--ez-combo-box--font-family:var(--font-pattern, Arial);--ez-combo-box--font-weight--large:var(--text-weight--large, 500);--ez-combo-box--font-weight--medium:var(--text-weight--medium, 400);--ez-combo-box--background-color--xlight:var(--background--xlight, #fff);--ez-combo-box--background-medium:var(--background--medium, #f0f3f7);--ez-combo-box__input--background-color:var(--background--medium, #e0e0e0);--ez-combo-box__input--border:var(--border--medium, 2px solid);--ez-combo-box__input--border-color:var(--ez-combo-box__input--background-color);--ez-combo-box__input--focus--border-color:var(--color--primary, #008561);--ez-combo-box__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-combo-box__input--disabled--color:var(--text--disable, #AFB6C0);--ez-combo-box__input--error--border-color:#CC2936;--ez-combo-box__btn-search--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-search-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-search-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__btn-options--background-color:var(--text--primary, #626e82);--ez-combo-box__btn-options-disabled--background-color:var(--text--disable, #AFB6C0);--ez-combo-box__btn-options-hover--background-color:var(--color--primary, #4e4e4e);--ez-combo-box__label--color:var(--title--primary, #919191);--ez-combo-box__list-text--primary:var(--text--primary, #626e82);--ez-combo-box__list-height:calc(var(--ez-combo-box--font-size) + var(--ez-combo-box--space--medium));--ez-combo-box__drop-down-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"16px\"><path d=\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\"/></svg>');--ez-combo-box__search-image:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"22px\" width=\"22px\"><path d=\"m 9.4,2.3 c 4.1,0 7.4,3.2 7.4,7.2 0,1.8 -0.7,3.4 -1.8,4.7 l 0.3,0.3 h 0.9 l 5.7,5.6 -1.7,1.7 -5.7,-5.6 V 15.3 L 14.3,15 C 13,16.1 11.3,16.7 9.5,16.7 5.3,16.7 2,13.5 2,9.5 2,5.5 5.3,2.3 9.4,2.3 m 0,2.2 c -2.9,0 -5.1,2.2 -5.1,5 0,2.8 2.3,5 5.1,5 2.8,0 5.1,-2.2 5.1,-5 0,-2.8 -2.2,-5 -5.1,-5 z\"/></svg>');--ez-combo-box--space--medium:var(--space--medium, 12px);--ez-combo-box--space--small:var(--space--small, 6px);display:flex;flex-wrap:wrap;position:relative;width:var(--ez-combo-box--width)}.list-container{position:relative;width:100%}.options-list{box-sizing:border-box;width:100%;z-index:var(--more-visible, 2);display:flex;flex-direction:column;background-color:var(--ez-combo-box--background-color--xlight);padding:var(--ez-combo-box--space--small);border-radius:var(--ez-combo-box--border-radius);box-shadow:var(--shadow, 0px 0px 16px 0px #000);scroll-behavior:smooth;max-height:calc(4*var(--ez-combo-box__list-height) + 2*var(--ez-combo-box--space--small));overflow:auto}.item{text-align:left;display:flex;justify-content:space-between;align-items:center;border-radius:var(--ez-combo-box--border-radius-small);padding:0 var(--ez-combo-box--space--small);list-style-type:none;min-height:var(--ez-combo-box__list-height)}.item--label{text-align:left;flex-basis:85%;flex-grow:1;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.item--value{text-align:right;flex-basis:15%;flex-grow:0;color:var(--ez-combo-box__list-text--primary);font-weight:var(--ez-combo-box--font-weight--large);font-family:var(--ez-combo-box--font-family);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}li:hover{background-color:var(--ez-combo-box--background-medium)}.preselected{background-color:var(--background--medium)}.btn-open-options{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-options:disabled{cursor:unset}.btn-open-options::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-options--background-color);width:16px;height:16px;-webkit-mask-image:var(--ez-combo-box__drop-down-image);mask-image:var(--ez-combo-box__drop-down-image)}.btn-open-options:disabled:after{background-color:var(--ez-combo-box__btn-options-disabled--background-color)}.btn-open-options:enabled:hover::after{background-color:var(--ez-combo-box__btn-options-hover--background-color)}.btn-open-search{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-search:disabled{cursor:unset}.btn-open-search::after{content:'';display:flex;background-color:var(--ez-combo-box__btn-search--background-color);width:22px;height:22px;-webkit-mask-image:var(--ez-combo-box__search-image);mask-image:var(--ez-combo-box__search-image)}.btn-open-search:disabled:after{background-color:var(--ez-combo-box__btn-search-disabled--background-color)}.btn-open-search:enabled:hover::after{background-color:var(--ez-combo-box__btn-search-hover--background-color)}";
|
|
10
|
+
|
|
11
|
+
const EzComboBox = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
index.registerInstance(this, hostRef);
|
|
14
|
+
this.ezChange = index.createEvent(this, "ezChange", 7);
|
|
15
|
+
/**
|
|
16
|
+
* Deixa o campo disponível ou não para interação com usuário.
|
|
17
|
+
*/
|
|
18
|
+
this.enabled = true;
|
|
19
|
+
/**
|
|
20
|
+
* Ajusta a opção de mostrar o "value" ao selecionar uma opção. Por padrão não mostra.
|
|
21
|
+
*/
|
|
22
|
+
this.showSelectedValue = false;
|
|
23
|
+
/**
|
|
24
|
+
* Ajusta a opção de mostrar o "value" para cada opção. Por padrão não mostra
|
|
25
|
+
*/
|
|
26
|
+
this.showOptionValue = false;
|
|
27
|
+
/**
|
|
28
|
+
* Remove a opção vazia da lista de opções
|
|
29
|
+
*/
|
|
30
|
+
this.suppressEmptyOption = false;
|
|
31
|
+
/**
|
|
32
|
+
* Permite exibir a mensagem de erro.
|
|
33
|
+
*/
|
|
34
|
+
this.canShowError = true;
|
|
35
|
+
}
|
|
36
|
+
internalUpdate() {
|
|
37
|
+
if (this._inputElement) {
|
|
38
|
+
this._inputElement.value = this.getText();
|
|
39
|
+
}
|
|
40
|
+
this.hideOptions();
|
|
41
|
+
this._criteria = undefined;
|
|
42
|
+
this._preSelection = undefined;
|
|
43
|
+
this.updateVisibleOptions();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Realiza o foco no componente de seleção
|
|
47
|
+
*/
|
|
48
|
+
async setFocus() {
|
|
49
|
+
this._inputElement.setFocus();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Remove o foco no componente de seleção
|
|
53
|
+
*/
|
|
54
|
+
async setBlur() {
|
|
55
|
+
this._inputElement.setBlur();
|
|
56
|
+
}
|
|
57
|
+
getText() {
|
|
58
|
+
let text = "";
|
|
59
|
+
const selected = this.getSelectedOption();
|
|
60
|
+
if (selected) {
|
|
61
|
+
text = this.showSelectedValue ? `${selected.value} - ${selected.label}` : selected.label;
|
|
62
|
+
}
|
|
63
|
+
return text;
|
|
64
|
+
}
|
|
65
|
+
getSelectedOption() {
|
|
66
|
+
if (typeof this.value === "string" || this.value instanceof String) {
|
|
67
|
+
return this._visibleOptions.find(o => o.value === this.value);
|
|
68
|
+
}
|
|
69
|
+
return this.value;
|
|
70
|
+
}
|
|
71
|
+
updateVisibleOptions() {
|
|
72
|
+
let opts = this._source || [];
|
|
73
|
+
if (!this.searchMode && this._criteria) {
|
|
74
|
+
const upperCriteria = this._criteria.toUpperCase();
|
|
75
|
+
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(upperCriteria) > -1);
|
|
76
|
+
}
|
|
77
|
+
if (this.suppressEmptyOption) {
|
|
78
|
+
this._visibleOptions = opts;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
this._visibleOptions = [{ value: undefined, label: "" }].concat(opts);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
buildItem(opt, index$1) {
|
|
85
|
+
return index.h("li", { class: index$1 === this._preSelection ? "item preselected" : "item", id: `item_${opt.value}`, onMouseDown: () => this.selectOption(opt), onMouseOver: () => this._preSelection = undefined }, index.h("span", { class: "item--label", title: opt.label }, opt.label), this.showOptionValue ? index.h("span", { class: "item--value", title: opt.value }, opt.value) : undefined);
|
|
86
|
+
}
|
|
87
|
+
showOptions() {
|
|
88
|
+
if (!this.enabled) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
92
|
+
//posição errada no futuro. Preferi fazer simples no começo,
|
|
93
|
+
//porque não quis onerar o text input com essa funcionalidade...
|
|
94
|
+
const top = (this.errorMessage || !this.canShowError) ? "0px" : "-17px";
|
|
95
|
+
this._floatingID = core.FloatingManager.float(this._optionsList, this._listContainer, { autoClose: true, top });
|
|
96
|
+
window.requestAnimationFrame(() => {
|
|
97
|
+
this._optionsList.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
hideOptions() {
|
|
101
|
+
if (this._floatingID !== undefined) {
|
|
102
|
+
core.FloatingManager.close(this._floatingID);
|
|
103
|
+
}
|
|
104
|
+
this._floatingID = undefined;
|
|
105
|
+
}
|
|
106
|
+
isOptionsVisible() {
|
|
107
|
+
return this._floatingID !== undefined && core.FloatingManager.isFloating(this._floatingID);
|
|
108
|
+
}
|
|
109
|
+
nextOption() {
|
|
110
|
+
if (this.searchMode && !this.isOptionsVisible()) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.showOptions();
|
|
114
|
+
this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
|
|
115
|
+
this.scrollToOption(this._visibleOptions[this._preSelection], true);
|
|
116
|
+
}
|
|
117
|
+
previousOption() {
|
|
118
|
+
this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
|
|
119
|
+
this.scrollToOption(this._visibleOptions[this._preSelection], false);
|
|
120
|
+
}
|
|
121
|
+
scrollToOption(opt, down) {
|
|
122
|
+
window.requestAnimationFrame(() => {
|
|
123
|
+
const liElem = this._optionsList.querySelector(`li#item_${opt.value}`);
|
|
124
|
+
if (liElem) {
|
|
125
|
+
const parent = liElem.parentElement;
|
|
126
|
+
const parentRect = parent.getBoundingClientRect();
|
|
127
|
+
const itemRect = liElem.getBoundingClientRect();
|
|
128
|
+
if (down && itemRect.bottom > parentRect.bottom) {
|
|
129
|
+
parent.scrollTop = itemRect.top;
|
|
130
|
+
}
|
|
131
|
+
else if (!down && itemRect.top < parentRect.top) {
|
|
132
|
+
parent.scrollTop = 0;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
selectCurrentOption() {
|
|
138
|
+
if (this._preSelection !== undefined) {
|
|
139
|
+
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
140
|
+
this._preSelection = undefined;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
selectOption(opt) {
|
|
144
|
+
const currentOpt = this.getSelectedOption();
|
|
145
|
+
if (currentOpt !== opt) {
|
|
146
|
+
const adjustedOpt = !(opt === null || opt === void 0 ? void 0 : opt.value) ? undefined : opt;
|
|
147
|
+
this.value = adjustedOpt;
|
|
148
|
+
this.errorMessage = "";
|
|
149
|
+
this.ezChange.emit(adjustedOpt);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.internalUpdate();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
updateSource(source) {
|
|
156
|
+
if (source instanceof Promise) {
|
|
157
|
+
source.then(result => this.updateSource(result));
|
|
158
|
+
this.updateVisibleOptions();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this._source = source;
|
|
162
|
+
this.updateVisibleOptions();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
loadOptions(mode, argument = "") {
|
|
166
|
+
this._criteria = argument;
|
|
167
|
+
if (this.optionLoader) {
|
|
168
|
+
this.updateSource(this.optionLoader({ mode, argument }));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.updateSource(this.options);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
cancelPreselection() {
|
|
175
|
+
if (!this._inputElement.value && this.value) {
|
|
176
|
+
this.selectOption(undefined);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.internalUpdate();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//---------------------------------------------
|
|
183
|
+
// Lifecycle web component
|
|
184
|
+
//---------------------------------------------
|
|
185
|
+
componentWillLoad() {
|
|
186
|
+
if (this.options === undefined) {
|
|
187
|
+
this.options = [];
|
|
188
|
+
const optionsTags = this.el.querySelectorAll("option");
|
|
189
|
+
if (optionsTags) {
|
|
190
|
+
optionsTags.forEach(e => {
|
|
191
|
+
let label = e.innerText;
|
|
192
|
+
let value = e.getAttribute("value");
|
|
193
|
+
if (!value) {
|
|
194
|
+
value = label;
|
|
195
|
+
}
|
|
196
|
+
this.options.push({ label, value });
|
|
197
|
+
e.hidden = true;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (this.searchMode) {
|
|
202
|
+
this.updateSource([]);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
this.loadOptions("PRELOAD");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
componentDidRender() {
|
|
209
|
+
if (this._floatingID === undefined) {
|
|
210
|
+
this._optionsList.remove();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
componentDidLoad() {
|
|
214
|
+
CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this.el, this._inputElement);
|
|
215
|
+
}
|
|
216
|
+
//---------------------------------------------
|
|
217
|
+
// Event handlers
|
|
218
|
+
//---------------------------------------------
|
|
219
|
+
onTextInputChangeHandler(event) {
|
|
220
|
+
if (!this._criteria) {
|
|
221
|
+
this._inputElement.value = event.data;
|
|
222
|
+
}
|
|
223
|
+
const argument = event.target.value;
|
|
224
|
+
this._criteria = argument;
|
|
225
|
+
if (this._criteria) {
|
|
226
|
+
if (this.searchMode) {
|
|
227
|
+
if (this._changeDeboucingTimeout) {
|
|
228
|
+
window.clearTimeout(this._changeDeboucingTimeout);
|
|
229
|
+
}
|
|
230
|
+
this._changeDeboucingTimeout = window.setTimeout(() => {
|
|
231
|
+
this.loadOptions("PREDICTIVE", argument);
|
|
232
|
+
}, 200);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
this.updateVisibleOptions();
|
|
236
|
+
}
|
|
237
|
+
this.showOptions();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
onTextInputClickHandler() {
|
|
241
|
+
if (!this.searchMode) {
|
|
242
|
+
this.showOptions();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
keyDownHandler(event) {
|
|
246
|
+
switch (event.key) {
|
|
247
|
+
case "ArrowDown":
|
|
248
|
+
this.nextOption();
|
|
249
|
+
break;
|
|
250
|
+
case "ArrowUp":
|
|
251
|
+
this.previousOption();
|
|
252
|
+
break;
|
|
253
|
+
case "Enter":
|
|
254
|
+
this.selectCurrentOption();
|
|
255
|
+
break;
|
|
256
|
+
case "Escape":
|
|
257
|
+
this.cancelPreselection();
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
event.stopPropagation();
|
|
261
|
+
}
|
|
262
|
+
onTextInputFocusOutHandler() {
|
|
263
|
+
this.cancelPreselection();
|
|
264
|
+
}
|
|
265
|
+
render() {
|
|
266
|
+
return (index.h(index.Host, null, index.h("ez-text-input", { ref: elem => this._inputElement = elem, enabled: this.enabled, onInput: evt => this.onTextInputChangeHandler(evt), onClick: () => this.onTextInputClickHandler(), onFocusout: () => this.onTextInputFocusOutHandler(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, value: this.getText(), canShowError: this.canShowError, errorMessage: this.errorMessage }, this.searchMode ?
|
|
267
|
+
index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-search", onClick: () => { this.loadOptions("ADVANCED"); }, slot: "leftIcon" })
|
|
268
|
+
:
|
|
269
|
+
index.h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })), index.h("section", { class: "list-container", ref: elem => this._listContainer = elem }, index.h("div", { class: "options-list", ref: elem => this._optionsList = elem }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
|
|
270
|
+
}
|
|
271
|
+
get el() { return index.getElement(this); }
|
|
272
|
+
static get watchers() { return {
|
|
273
|
+
"value": ["internalUpdate"]
|
|
274
|
+
}; }
|
|
275
|
+
};
|
|
276
|
+
EzComboBox.style = ezComboBoxCss;
|
|
277
|
+
|
|
278
|
+
exports.ez_combo_box = EzComboBox;
|