@sankhyalabs/ezui 1.1.4 → 1.1.8
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/README.md +72 -72
- package/dist/{ezui/DataUnit-285bec19.js → cjs/DataUnit-28b290cb.js} +382 -369
- package/dist/{ezui/index-919090de.js → cjs/RequestMetadata-2cd01e8a.js} +4 -383
- package/dist/cjs/ez-action-chip.cjs.entry.js +52 -0
- package/dist/cjs/ez-button_14.cjs.entry.js +3341 -0
- package/dist/cjs/ez-label-chip.cjs.entry.js +131 -0
- package/dist/cjs/ez-modal.cjs.entry.js +115 -0
- package/dist/cjs/ez-number-input.cjs.entry.js +248 -0
- package/dist/cjs/ez-time-input.cjs.entry.js +180 -0
- package/dist/cjs/ezui.cjs.js +19 -0
- package/dist/cjs/form-metadata.cjs.entry.js +74 -0
- package/dist/cjs/index-9403fe8f.js +1322 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.css +82 -0
- package/dist/collection/components/ez-action-chip/ez-action-chip.js +109 -0
- package/dist/collection/components/ez-button/ez-button.css +94 -0
- package/dist/collection/components/ez-button/ez-button.js +125 -0
- package/dist/collection/components/ez-calendar/ez-calendar.css +210 -0
- package/dist/collection/components/ez-calendar/ez-calendar.js +215 -0
- package/dist/collection/components/ez-check/ez-check.css +266 -0
- package/dist/collection/components/ez-check/ez-check.js +168 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.css +68 -0
- package/dist/collection/components/ez-collapsable-box/ez-collapsable-box.js +108 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box-interfaces.js +2 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +167 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +363 -0
- package/dist/collection/components/ez-date-input/ez-date-input.css +39 -0
- package/dist/collection/components/ez-date-input/ez-date-input.js +172 -0
- package/dist/collection/components/ez-form/ez-form.css +19 -0
- package/dist/collection/components/ez-form/ez-form.js +368 -0
- package/dist/collection/components/ez-form/store/Form.actions.js +132 -0
- package/dist/collection/components/ez-form/store/Form.reducer.js +194 -0
- package/dist/collection/components/ez-form/store/Form.selectors.js +44 -0
- package/dist/collection/components/ez-form/subcomponents/DataUnit.js +207 -0
- package/dist/collection/components/ez-form/subcomponents/FormMetadata.js +16 -0
- package/dist/collection/components/ez-form/subcomponents/css/place-holder.css +24 -0
- package/dist/collection/components/ez-form/subcomponents/form-metadata.js +173 -0
- package/dist/collection/components/ez-form/subcomponents/place-holder.js +14 -0
- package/dist/collection/components/ez-form/subcomponents/structure/Field.js +71 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FieldSet.js +27 -0
- package/dist/collection/components/ez-form/subcomponents/structure/FormSheet.js +40 -0
- package/dist/collection/components/ez-form/subcomponents/structure/NavigationBar.js +27 -0
- package/dist/collection/components/ez-icon/ez-icon.css +37 -0
- package/dist/collection/components/ez-icon/ez-icon.js +56 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.css +117 -0
- package/dist/collection/components/ez-label-chip/ez-label-chip.js +276 -0
- package/dist/collection/components/ez-modal/ez-modal.css +87 -0
- package/dist/collection/components/ez-modal/ez-modal.js +224 -0
- package/dist/collection/components/ez-number-input/ez-number-input.css +144 -0
- package/dist/collection/components/ez-number-input/ez-number-input.js +465 -0
- package/dist/collection/components/ez-popover/ez-popover.css +39 -0
- package/dist/collection/components/ez-popover/ez-popover.js +323 -0
- package/dist/collection/components/ez-search/ez-search.css +296 -0
- package/dist/{ezui/ez-search.entry.js → collection/components/ez-search/ez-search.js} +527 -334
- package/dist/collection/components/ez-tabselector/ez-tabselector.css +126 -0
- package/dist/{ezui/ez-tabselector.entry.js → collection/components/ez-tabselector/ez-tabselector.js} +283 -209
- package/dist/collection/components/ez-text-area/ez-text-area.css +140 -0
- package/dist/collection/components/ez-text-area/ez-text-area.js +267 -0
- package/dist/collection/components/ez-text-input/ez-text-input.css +170 -0
- package/dist/collection/components/ez-text-input/ez-text-input.js +395 -0
- package/dist/collection/components/ez-time-input/ez-time-input.css +155 -0
- package/dist/collection/components/ez-time-input/ez-time-input.js +326 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/servidor.js +101 -0
- package/dist/collection/utils/FloatingManager.js +16 -0
- package/dist/collection/utils/utils.js +6 -0
- package/dist/custom-elements/index.js +5071 -0
- package/dist/esm/DataUnit-69e518fa.js +378 -0
- package/dist/esm/RequestMetadata-c265c9d5.js +527 -0
- package/dist/{ezui → esm}/ez-action-chip.entry.js +42 -42
- package/dist/esm/ez-button_14.entry.js +3324 -0
- package/dist/{ezui → esm}/ez-label-chip.entry.js +121 -121
- package/dist/{ezui → esm}/ez-modal.entry.js +105 -96
- package/dist/{ezui → esm}/ez-number-input.entry.js +238 -238
- package/dist/{ezui → esm}/ez-time-input.entry.js +170 -170
- package/dist/esm/ezui.js +17 -0
- package/dist/{ezui → esm}/form-metadata.entry.js +66 -66
- package/dist/esm/index-95bb3fd9.js +1293 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/ezui/ezui.esm.js +1 -122
- package/dist/ezui/index.esm.js +0 -1
- package/dist/ezui/p-10ef58b3.js +1 -0
- package/dist/ezui/p-185c57f4.js +1 -0
- package/dist/ezui/p-22b82efb.entry.js +1 -0
- package/dist/ezui/p-77fdb4fd.entry.js +1 -0
- package/dist/ezui/p-9dfccb16.js +1 -0
- package/dist/ezui/p-b0974f4f.entry.js +1 -0
- package/dist/ezui/p-db11c600.entry.js +1 -0
- package/dist/ezui/p-dd4331b7.entry.js +1 -0
- package/dist/ezui/p-f6fd31ab.entry.js +1 -0
- package/dist/ezui/p-fa260f22.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/ez-action-chip/ez-action-chip.d.ts +16 -16
- package/dist/types/components/ez-button/ez-button.d.ts +20 -20
- package/dist/types/components/ez-calendar/ez-calendar.d.ts +42 -42
- package/dist/types/components/ez-check/ez-check.d.ts +32 -32
- package/dist/types/components/ez-collapsable-box/ez-collapsable-box.d.ts +18 -18
- package/dist/types/components/ez-combo-box/ez-combo-box-interfaces.d.ts +4 -4
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +68 -68
- package/dist/types/components/ez-date-input/ez-date-input.d.ts +31 -31
- package/dist/types/components/ez-form/ez-form.d.ts +31 -27
- package/dist/types/components/ez-form/store/Form.actions.d.ts +111 -104
- package/dist/types/components/ez-form/store/Form.reducer.d.ts +20 -11
- package/dist/types/components/ez-form/store/Form.selectors.d.ts +14 -13
- package/dist/types/components/ez-form/subcomponents/DataUnit.d.ts +55 -48
- package/dist/types/components/ez-form/subcomponents/FormMetadata.d.ts +41 -41
- package/dist/types/components/ez-form/subcomponents/form-metadata.d.ts +15 -15
- package/dist/types/components/ez-form/subcomponents/place-holder.d.ts +3 -3
- package/dist/types/components/ez-form/subcomponents/structure/Field.d.ts +10 -10
- package/dist/types/components/ez-form/subcomponents/structure/FieldSet.d.ts +12 -12
- package/dist/types/components/ez-form/subcomponents/structure/FormSheet.d.ts +13 -13
- package/dist/types/components/ez-form/subcomponents/structure/NavigationBar.d.ts +17 -7
- package/dist/types/components/ez-icon/ez-icon.d.ts +5 -5
- package/dist/types/components/ez-label-chip/ez-label-chip.d.ts +40 -40
- package/dist/types/components/ez-modal/ez-modal.d.ts +32 -26
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +73 -73
- package/dist/types/components/ez-popover/ez-popover.d.ts +52 -52
- package/dist/types/components/ez-search/ez-search.d.ts +95 -95
- package/dist/types/components/ez-tabselector/ez-tabselector.d.ts +31 -31
- package/dist/types/components/ez-text-area/ez-text-area.d.ts +49 -49
- package/dist/types/components/ez-text-input/ez-text-input.d.ts +64 -64
- package/dist/types/components/ez-time-input/ez-time-input.d.ts +53 -53
- package/dist/types/components.d.ts +8 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +2 -2
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +13 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +114 -114
- package/react/components.d.ts +22 -0
- package/react/components.js +25 -0
- package/react/components.js.map +1 -0
- package/react/react-component-lib/createComponent.d.ts +10 -0
- package/react/react-component-lib/createComponent.js +59 -0
- package/react/react-component-lib/createComponent.js.map +1 -0
- package/react/react-component-lib/createOverlayComponent.d.ts +20 -0
- package/react/react-component-lib/createOverlayComponent.js +89 -0
- package/react/react-component-lib/createOverlayComponent.js.map +1 -0
- package/react/react-component-lib/index.d.ts +2 -0
- package/react/react-component-lib/index.js +3 -0
- package/react/react-component-lib/index.js.map +1 -0
- package/react/react-component-lib/interfaces.d.ts +29 -0
- package/react/react-component-lib/interfaces.js +1 -0
- package/react/react-component-lib/interfaces.js.map +1 -0
- package/react/react-component-lib/utils/attachProps.d.ts +12 -0
- package/react/react-component-lib/utils/attachProps.js +96 -0
- package/react/react-component-lib/utils/attachProps.js.map +1 -0
- package/react/react-component-lib/utils/case.d.ts +2 -0
- package/react/react-component-lib/utils/case.js +7 -0
- package/react/react-component-lib/utils/case.js.map +1 -0
- package/react/react-component-lib/utils/dev.d.ts +2 -0
- package/react/react-component-lib/utils/dev.js +13 -0
- package/react/react-component-lib/utils/dev.js.map +1 -0
- package/react/react-component-lib/utils/index.d.ts +7 -0
- package/react/react-component-lib/utils/index.js +21 -0
- package/react/react-component-lib/utils/index.js.map +1 -0
- package/dist/ezui/app-globals-0f993ce5.js +0 -3
- package/dist/ezui/css-shim-003e9264.js +0 -4
- package/dist/ezui/dom-1b195079.js +0 -73
- package/dist/ezui/ez-button.entry.js +0 -47
- package/dist/ezui/ez-calendar.entry.js +0 -102
- package/dist/ezui/ez-check.entry.js +0 -62
- package/dist/ezui/ez-collapsable-box.entry.js +0 -32
- package/dist/ezui/ez-combo-box.entry.js +0 -181
- package/dist/ezui/ez-date-input.entry.js +0 -77
- package/dist/ezui/ez-form.entry.js +0 -1907
- package/dist/ezui/ez-icon.entry.js +0 -17
- package/dist/ezui/ez-popover.entry.js +0 -112
- package/dist/ezui/ez-text-area.entry.js +0 -105
- package/dist/ezui/ez-text-input.entry.js +0 -202
- package/dist/ezui/index-39044be2.js +0 -2832
- package/dist/ezui/place-holder.entry.js +0 -15
- package/dist/ezui/shadow-css-c1ad5fdc.js +0 -383
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, i as Host } from './index-39044be2.js';
|
|
2
|
-
|
|
3
|
-
const ezCollapsableBoxCss = ":host{--collapsable-box--height:42px;--collapsable-box--font-size:var(--title--medium, 14px);--collapsable-box--font-family:var(--font-pattern, Arial);--collapsable-box--font-weight:var(--text-weight--large, 600);--collapsable-box--color:var(--title--primary);--collapsable-box__btn--path:path(\"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\");--collapsable-box__btn--fill:var(--collapsable-box--color);--collapsable-box__btn--width:10px;--collapsable-box__btn--height:16px;display:flex;flex-wrap:wrap;width:100%}.collapsable-box__title{width:100%;display:flex;box-sizing:border-box}.collapsable-box__label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%;font-family:var(--collapsable-box--font-family);font-size:var(--collapsable-box--font-size);font-weight:var(--collapsable-box--font-weight);color:var(--collapsable-box--color)}.collapsable-box__btn{outline:none;border:none;background-color:unset;cursor:pointer;padding:1px 6px}.collapsable-box__btn::after{content:'';display:flex;clip-path:var(--collapsable-box__btn--path);background-color:var( --collapsable-box__btn--fill);width:var(--collapsable-box__btn--width);height:var(--collapsable-box__btn--height);transition:transform var(--transition);transform:rotate(90deg)}.collapsable-box__btn--collapsed::after{transform:rotate(0deg)}";
|
|
4
|
-
|
|
5
|
-
const EzCollapsableBox = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
registerInstance(this, hostRef);
|
|
8
|
-
this.ezChange = createEvent(this, "ezChange", 7);
|
|
9
|
-
/**
|
|
10
|
-
* Valor externalizado que garante a exibição ou não do componente
|
|
11
|
-
*/
|
|
12
|
-
this.value = false;
|
|
13
|
-
}
|
|
14
|
-
observeValue() {
|
|
15
|
-
this.ezChange.emit();
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Esconde ou revela o conteúdo do componente
|
|
19
|
-
*/
|
|
20
|
-
async showHide() {
|
|
21
|
-
this.value = !this.value;
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
24
|
-
return (h(Host, null, h("div", { class: "collapsable-box__title" }, h("button", { class: this.value ? "collapsable-box__btn collapsable-box__btn--collapsed" : "collapsable-box__btn", onClick: () => this.showHide() }), h("label", { class: "collapsable-box__label", title: this.label }, this.label)), !this.value ? h("slot", null) : null));
|
|
25
|
-
}
|
|
26
|
-
static get watchers() { return {
|
|
27
|
-
"value": ["observeValue"]
|
|
28
|
-
}; }
|
|
29
|
-
};
|
|
30
|
-
EzCollapsableBox.style = ezCollapsableBoxCss;
|
|
31
|
-
|
|
32
|
-
export { EzCollapsableBox as ez_collapsable_box };
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, i as Host, g as getElement } from './index-39044be2.js';
|
|
2
|
-
|
|
3
|
-
const ezComboBoxCss = ":host{--cx--height:42px;--cx--width:100%;--cx__icon--width:48px;--cx--border-radius:var(--border--radius-medium, 12px);--cx--border-radius-small:var(--border--radius-small, 6px);--cx--font-size:var(--text--medium, 14px);--cx--font-family:var(--font-pattern, Arial);--cx--font-weight--large:var(--text-weight--large, 500);--cx--font-weight--medium:var(--text-weight--medium, 400);--cx--space--medium:var(--space--medium, 12px);--cx--space--small:var(--space--small, 6px);--cx--shadow:var(--shadow, 0px 0px 16px 0px rgba(0, 38, 111, .12));--cx--background-color--xlight:var(--background--xlight,#fff);--cx__input--background-color:var(--background--medium, #e0e0e0);--cx__input--border:var(--border--medium, 2px solid);--cx__input--border-color:var(--cx__input--background-color);--cx__input--focus--border-color:var(--color--primary, #008561);--cx__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--cx__input--disabled--color:var(--text--disable, #AFB6C0);--cx__input--error--border-color:#CC2936;--cx__label--color:var(--title--primary, #919191);--cx__message_box--font-size:var(--text--small, 12px);--cx__message_box--info--color:var(--color--success, #22085d);--cx__message_box--error--color:var(--color--error, #FF0000);--cx__list-text--primary:var(--text--primary,#626e82);--cx__list-text--secondary:var(--text--secondary,#a2abb9);--cx__list-height:calc(var(--cx--font-size) + var(--cx--space--medium));display:flex;flex-wrap:wrap;position:relative;width:var(--cx--width)}ez-text-input{--it__input--background-color:var(--cx__input--background-color, #FFFFFF);--it__input--border-color:var(--cx__input--border-color, #DCE0E8)}.invisible{visibility:hidden}.list-container{scroll-behavior:smooth;z-index:var(--cx__list-z-index);padding:var(--cx--space--small);background:var(--cx--background-color--xlight);border-radius:var(--cx--border-radius);width:100%;overflow:auto;box-sizing:border-box;max-height:calc(4*var(--cx__list-height) + 2*var(--cx--space--small))}li{list-style-type:none;border-radius:var(--cx--border-radius-small);padding:0 var(--cx--space--small);display:flex;justify-content:space-between;align-items:center}li:hover{background-color:var(--background--medium)}.--li--preselected{background-color:var(--background--strong)}.--li__spanlabel{color:var(--cx__list-text--primary);border-radius:var(--cx--border-radius-small);padding:0 var(--cx--space--small);height:var(--cx__list-height);font-weight:var(--cx--font-weight--large);font-family:var(--cx--font-family);line-height:var(--cx__list-height);vertical-align:middle;text-overflow:ellipsis;width:80%;min-width:30px;overflow-x:hidden;text-align:left}.--li__spanlabel--full-width{color:var(--cx__list-text--primary);border-radius:var(--cx--border-radius-small);padding:0 var(--cx--space--small);height:var(--cx__list-height);font-weight:var(--cx--font-weight--large);font-family:var(--cx--font-family);line-height:var(--cx__list-height);vertical-align:middle;text-overflow:ellipsis;width:100%;min-width:30px;overflow-x:hidden;text-align:left}.--li__spanvalue{color:var(--cx__list-text--secondary);border-radius:var(--cx--border-radius-small);padding:0 var(--cx--space--small);height:var(--cx__list-height);font-weight:var(--cx--font-weight--medium);font-family:var(--cx--font-family);line-height:var(--cx__list-height);vertical-align:middle;text-overflow:ellipsis;width:20%;min-width:20px;overflow-x:hidden;text-align:left}.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(--text--primary, #008561);width:16px;height:16px;clip-path:path(\"M 1.8585859,3.0707069 7.9999998,9.2121212 14.141414,3.0707069 16,5.0101006 7.9999998,12.929293 0,4.9292932 Z\")}.btn-open-options:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-options:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}";
|
|
4
|
-
|
|
5
|
-
const EzComboBox = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
registerInstance(this, hostRef);
|
|
8
|
-
this.ezChange = createEvent(this, "ezChange", 7);
|
|
9
|
-
this._inputLabelValue = '';
|
|
10
|
-
/**
|
|
11
|
-
* Valor associado ao componente. Este é o valor que o componente recebe ao selecionar uma opção do combobox.
|
|
12
|
-
* Pode ser Label ou Value de acordo com a opção "labelasindex"
|
|
13
|
-
* Caso seja atribuído um valor ao componente que não esteja na relação das options, este vai lançar msg de erro
|
|
14
|
-
* (executo pala valor undefined)
|
|
15
|
-
*/
|
|
16
|
-
this.value = undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Label é o título do campo
|
|
19
|
-
*/
|
|
20
|
-
this.label = undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Deixa o campo disponível ou não para digitação.
|
|
23
|
-
*/
|
|
24
|
-
this.enabled = true;
|
|
25
|
-
/**
|
|
26
|
-
* Ajusta a opção de mostrar o "value" para cada "label". Como default "value" não está presente (showvalue = false)
|
|
27
|
-
*/
|
|
28
|
-
this.showvalue = false;
|
|
29
|
-
}
|
|
30
|
-
//---------------------------------------------
|
|
31
|
-
// Public methods
|
|
32
|
-
//---------------------------------------------
|
|
33
|
-
/**
|
|
34
|
-
* Faz o foco no componente de textarea
|
|
35
|
-
*/
|
|
36
|
-
async setFocus() {
|
|
37
|
-
this._textInput.setFocus();
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Remove o foco no componente de textarea
|
|
41
|
-
*/
|
|
42
|
-
async setBlur() {
|
|
43
|
-
this._textInput.setBlur();
|
|
44
|
-
}
|
|
45
|
-
updateValue() {
|
|
46
|
-
const selectedOption = this.options.filter(opt => opt.value === this.value);
|
|
47
|
-
if (selectedOption && selectedOption.length > 0) {
|
|
48
|
-
this._textInput.value = selectedOption[0].label;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
this.value = null;
|
|
52
|
-
this._textInput.value = '';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
setErrorMessage() {
|
|
56
|
-
this._textInput.errormessage = this.errormessage;
|
|
57
|
-
}
|
|
58
|
-
showOptions() {
|
|
59
|
-
if (this.enabled) {
|
|
60
|
-
this._criteria = undefined;
|
|
61
|
-
const top = this._textInput.errormessage ? '0px' : '-17px';
|
|
62
|
-
this._popover.show(top);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
updateSelection() {
|
|
66
|
-
const selectedOption = this.options.filter(opt => opt.label === this._textInput.value);
|
|
67
|
-
this.selectOption((selectedOption && selectedOption.length > 0) ? selectedOption[0] : null);
|
|
68
|
-
}
|
|
69
|
-
selectOption(opt) {
|
|
70
|
-
this._popover.hide();
|
|
71
|
-
this.value = opt ? opt.value : null;
|
|
72
|
-
this.ezChange.emit();
|
|
73
|
-
}
|
|
74
|
-
buildItem(opt, index) {
|
|
75
|
-
const className = index === this._preSelection ? "--li--preselected" : "";
|
|
76
|
-
return h("li", { class: className, key: opt.value, id: 'item_' + opt.value, onMouseDown: () => this.selectOption(opt) }, this.highlightMatch(opt.label), this.showvalue ? h("span", { class: '--li__spanvalue' }, opt.value) : null);
|
|
77
|
-
}
|
|
78
|
-
highlightMatch(label) {
|
|
79
|
-
const spanClassName = this.showvalue ? '--li__spanlabel' : '--li__spanlabel--full-width';
|
|
80
|
-
if (this._criteria) {
|
|
81
|
-
const criteriaLength = this._criteria.length;
|
|
82
|
-
const matchStart = label.toUpperCase().indexOf(this._criteria);
|
|
83
|
-
if (matchStart > -1) {
|
|
84
|
-
const strLabelStart = label.substr(0, matchStart);
|
|
85
|
-
const strLabelEnd = label.substr(matchStart + criteriaLength);
|
|
86
|
-
const strMatch = label.substr(matchStart, criteriaLength);
|
|
87
|
-
return (h("span", { class: spanClassName }, strLabelStart, h("strong", null, strMatch), strLabelEnd));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return (h("span", { class: spanClassName }, label));
|
|
91
|
-
}
|
|
92
|
-
matchOptions() {
|
|
93
|
-
this.showOptions();
|
|
94
|
-
this._criteria = this._textInput.value.toLocaleUpperCase();
|
|
95
|
-
this.filterOptions();
|
|
96
|
-
}
|
|
97
|
-
filterOptions() {
|
|
98
|
-
this._preSelection = undefined;
|
|
99
|
-
let opts = (this.options || []);
|
|
100
|
-
if (this._criteria) {
|
|
101
|
-
opts = opts.filter(opt => opt.label.toLocaleUpperCase().indexOf(this._criteria) > -1);
|
|
102
|
-
}
|
|
103
|
-
this._visibleOptions = [{ value: '', label: '' }].concat(opts);
|
|
104
|
-
}
|
|
105
|
-
nextOption() {
|
|
106
|
-
this.showOptions();
|
|
107
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.min(this._preSelection + 1, this._visibleOptions.length - 1);
|
|
108
|
-
this.scrollToOption(this._visibleOptions[this._preSelection]);
|
|
109
|
-
}
|
|
110
|
-
previousOption() {
|
|
111
|
-
this._preSelection = this._preSelection === undefined ? 0 : Math.max(this._preSelection - 1, 0);
|
|
112
|
-
this.scrollToOption(this._visibleOptions[this._preSelection]);
|
|
113
|
-
}
|
|
114
|
-
scrollToOption(opt) {
|
|
115
|
-
const liElem = this.el.shadowRoot.querySelector(`li#item_${opt.value}`);
|
|
116
|
-
if (liElem) {
|
|
117
|
-
const parent = liElem.parentElement;
|
|
118
|
-
const parentRect = parent.getBoundingClientRect();
|
|
119
|
-
const itemRect = liElem.getBoundingClientRect();
|
|
120
|
-
if (itemRect.bottom > parentRect.bottom || itemRect.top < parentRect.top) {
|
|
121
|
-
liElem.scrollIntoView();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
selectCurrentOption() {
|
|
126
|
-
if (this._preSelection !== undefined) {
|
|
127
|
-
this.selectOption(this._visibleOptions[this._preSelection]);
|
|
128
|
-
this._preSelection = undefined;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
keyDownHandler(event) {
|
|
132
|
-
switch (event.key) {
|
|
133
|
-
case "ArrowDown":
|
|
134
|
-
this.nextOption();
|
|
135
|
-
break;
|
|
136
|
-
case "ArrowUp":
|
|
137
|
-
this.previousOption();
|
|
138
|
-
break;
|
|
139
|
-
case "Enter":
|
|
140
|
-
this.selectCurrentOption();
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
event.stopPropagation();
|
|
144
|
-
}
|
|
145
|
-
//---------------------------------------------
|
|
146
|
-
// Lifecycle web component
|
|
147
|
-
//---------------------------------------------
|
|
148
|
-
componentWillLoad() {
|
|
149
|
-
if (this.options === undefined) {
|
|
150
|
-
this.options = [];
|
|
151
|
-
const optionsTags = this.el.querySelectorAll('option');
|
|
152
|
-
if (optionsTags) {
|
|
153
|
-
optionsTags.forEach(e => {
|
|
154
|
-
let label = e.innerText;
|
|
155
|
-
let value = e.getAttribute('value');
|
|
156
|
-
if (!value) {
|
|
157
|
-
value = label;
|
|
158
|
-
}
|
|
159
|
-
this.options.push({ label, value });
|
|
160
|
-
e.hidden = true;
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
this.filterOptions();
|
|
165
|
-
}
|
|
166
|
-
componentDidLoad() {
|
|
167
|
-
this.updateValue();
|
|
168
|
-
}
|
|
169
|
-
render() {
|
|
170
|
-
return (h(Host, null, h("ez-text-input", { ref: (el) => this._textInput = el, value: this._inputLabelValue, enabled: this.enabled, onInput: () => this.matchOptions(), onClick: () => this.showOptions(), onFocusout: () => this.updateSelection(), onEzChange: event => event.stopPropagation(), onKeyDown: event => this.keyDownHandler(event), label: this.label, errormessage: this.errormessage }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-options", slot: "rightIcon", onClick: () => this.showOptions() })), h("ez-popover", { boxwidth: "100%", ref: el => this._popover = el, autoclose: true }, h("div", { class: "list-container" }, this._visibleOptions.map((opt, index) => this.buildItem(opt, index))))));
|
|
171
|
-
}
|
|
172
|
-
;
|
|
173
|
-
get el() { return getElement(this); }
|
|
174
|
-
static get watchers() { return {
|
|
175
|
-
"value": ["updateValue"],
|
|
176
|
-
"errormessage": ["setErrorMessage"]
|
|
177
|
-
}; }
|
|
178
|
-
};
|
|
179
|
-
EzComboBox.style = ezComboBoxCss;
|
|
180
|
-
|
|
181
|
-
export { EzComboBox as ez_combo_box };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, e as createEvent, h, i as Host } from './index-39044be2.js';
|
|
2
|
-
import { D as DateUtils } from './index-919090de.js';
|
|
3
|
-
|
|
4
|
-
const ezDateInputCss = ":host{display:block;width:100%;--it__input--background-color:var(--background--medium, #e0e0e0);--it__input--border-color:var(--it__input--background-color)}.text-input{--it__input--background-color:inherit;--it__input--border-color:inherit}.btn-open-cal{outline:none;border:none;background-color:unset;cursor:pointer}.btn-open-cal:disabled{cursor:unset}.btn-open-cal::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:15px;height:16px;clip-path:path(\"M 3.171875,5.25 C 2.6485088,5.25 2.21875,5.6797588 2.21875,6.203125 2.21875,6.7264912 2.6485088,7.15625 3.171875,7.15625 3.6952412,7.15625 4.125,6.7264912 4.125,6.203125 4.125,5.6797588 3.6952412,5.25 3.171875,5.25 Z m 2.875,0 C 5.5235088,5.25 5.09375,5.6797588 5.09375,6.203125 5.09375,6.7264912 5.5235088,7.15625 6.046875,7.15625 6.5702412,7.15625 7,6.7264912 7,6.203125 7,5.6797588 6.5702412,5.25 6.046875,5.25 Z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.9511719,-0.4297588 0.9511719,-0.953125 C 9.8730469,5.6797588 9.4452412,5.25 8.921875,5.25 Z m 2.873047,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.953125 0.953125,0.953125 0.523366,0 0.953125,-0.4297588 0.953125,-0.953125 C 12.748047,5.6797588 12.318288,5.25 11.794922,5.25 Z M 3.171875,8.1230469 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 0.5233662,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297588,0.9531251 0.953125,0.9531251 C 6.5702412,10.029297 7,9.5995381 7,9.0761719 7,8.5528057 6.5702412,8.1230469 6.046875,8.1230469 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.4297587,0.9531251 0.953125,0.9531251 0.5233661,0 0.9531249,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.4297588 -0.953125,0.953125 0,0.5233662 0.429759,0.9531251 0.953125,0.9531251 0.523367,0 0.953125,-0.4297589 0.953125,-0.9531251 0,-0.5233662 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.171875,10.998047 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 0.5233662,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.875,0 c -0.5233662,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297588,0.953125 0.953125,0.953125 C 6.5702412,12.904297 7,12.474538 7,11.951172 7,11.427806 6.5702412,10.998047 6.046875,10.998047 Z m 2.8554688,0 c -0.5233663,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.4297587,0.953125 0.953125,0.953125 0.5233661,0 0.9531249,-0.429759 0.953125,-0.953125 0,-0.523366 -0.4297588,-0.953125 -0.953125,-0.953125 z m 2.9003902,0 c -0.523366,0 -0.953125,0.429759 -0.953125,0.953125 0,0.523366 0.429759,0.953125 0.953125,0.953125 0.523367,0 0.953125,-0.429759 0.953125,-0.953125 0,-0.523366 -0.429758,-0.953125 -0.953125,-0.953125 z M 3.5,0 c -0.554,0 -1,0.446 -1,1 v 0.050781 C 1.0853217,1.2909766 0,2.5186658 0,4 v 9 c 0,1.652487 1.3475134,3 3,3 h 9 c 1.652487,0 3,-1.347513 3,-3 V 4 C 15,2.5186658 13.914678,1.2909766 12.5,1.0507812 V 1 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 c 0,-0.554 -0.446,-1 -1,-1 -0.554,0 -1,0.446 -1,1 h -2 C 4.5,0.446 4.054,0 3.5,0 Z m 1,2.0996094 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 v -0.640625 h 2 v 0.640625 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 V 2.1738281 C 13.311725,2.3905225 13.900391,3.11278 13.900391,4 v 9 c 0,1.062113 -0.838278,1.900391 -1.900391,1.900391 H 3 C 1.9378864,14.900391 1.0996094,14.062113 1.0996094,13 V 4 C 1.0996094,3.11278 1.6882747,2.3905225 2.5,2.1738281 v 0.5664063 c 0,0.554 0.446,1 1,1 0.554,0 1,-0.446 1,-1 z\")}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}";
|
|
5
|
-
|
|
6
|
-
const EzDateInput = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.ezChange = createEvent(this, "ezChange", 7);
|
|
10
|
-
/**
|
|
11
|
-
* Deixa o campo disponível ou não para uso.
|
|
12
|
-
*/
|
|
13
|
-
this.enabled = true;
|
|
14
|
-
}
|
|
15
|
-
setLabel() {
|
|
16
|
-
this._textInput.label = this.label;
|
|
17
|
-
}
|
|
18
|
-
setErrorMessage() {
|
|
19
|
-
this._textInput.errormessage = this.errormessage;
|
|
20
|
-
}
|
|
21
|
-
applyValueToInput() {
|
|
22
|
-
this._textInput.value = this.getTextValue(this.value);
|
|
23
|
-
}
|
|
24
|
-
changeValue(newValue) {
|
|
25
|
-
newValue = newValue == null ? null : DateUtils.clearTime(newValue);
|
|
26
|
-
this._textInput.errormessage = "";
|
|
27
|
-
if (this.getTextValue(newValue) !== this.getTextValue(this.value)) {
|
|
28
|
-
this.value = newValue;
|
|
29
|
-
this.ezChange.emit();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
showCalendar() {
|
|
33
|
-
this.parseDate();
|
|
34
|
-
this._calendar.value = this.value;
|
|
35
|
-
//FIXME: Provavelmente isso fará com que o popup abra em uma
|
|
36
|
-
//posição errada no futuro. Preferi fazer simples no começo,
|
|
37
|
-
//porque não quis onerar o text input com essa funcionalidade...
|
|
38
|
-
const top = this._textInput.errormessage ? '0px' : '-17px';
|
|
39
|
-
this._calendar.show(top);
|
|
40
|
-
}
|
|
41
|
-
hideCalendar() {
|
|
42
|
-
this.changeValue(this._calendar.value);
|
|
43
|
-
this._calendar.hide();
|
|
44
|
-
}
|
|
45
|
-
parseDate() {
|
|
46
|
-
const strValue = this._textInput.value;
|
|
47
|
-
const parsedDate = DateUtils.strToDate(strValue);
|
|
48
|
-
if (parsedDate || !strValue) {
|
|
49
|
-
if (this.value === parsedDate) {
|
|
50
|
-
this.changeValue(this.value);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this.changeValue(parsedDate);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
this._textInput.errormessage = "O valor digitado não é uma data válida";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
getTextValue(d) {
|
|
61
|
-
return d ? new Intl.DateTimeFormat('pt-BR').format(d) : null;
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
return (h(Host, null, h("ez-text-input", { class: "text-input", ref: elem => this._textInput = elem, onBlur: () => this.parseDate(), onKeyDown: event => {
|
|
65
|
-
if (event.key === 'H' || event.key === 'h')
|
|
66
|
-
this.changeValue(new Date());
|
|
67
|
-
}, label: this.label, onEzChange: event => event.stopPropagation(), value: this.getTextValue(this.value), restrict: "0123456789/", enabled: this.enabled, errormessage: this.errormessage }, h("button", { disabled: !this.enabled, tabindex: -1, class: "btn-open-cal", onClick: () => this.showCalendar(), slot: "leftIcon" })), h("ez-calendar", { onEzChange: (event) => { this.hideCalendar(); event.stopPropagation(); }, floating: true, ref: elem => this._calendar = elem })));
|
|
68
|
-
}
|
|
69
|
-
static get watchers() { return {
|
|
70
|
-
"label": ["setLabel"],
|
|
71
|
-
"errormessage": ["setErrorMessage"],
|
|
72
|
-
"value": ["applyValueToInput"]
|
|
73
|
-
}; }
|
|
74
|
-
};
|
|
75
|
-
EzDateInput.style = ezDateInputCss;
|
|
76
|
-
|
|
77
|
-
export { EzDateInput as ez_date_input };
|