@sankhyalabs/ezui 1.1.161 → 1.2.0-beta.1
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-4a223c7a.js → ApplicationUtils-483c0a9e.js} +26 -7
- package/dist/cjs/CSSVarsUtils-09b431cc.js +55 -0
- package/dist/cjs/DialogType-a1e288e6.js +8 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +101 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +8 -4
- package/dist/cjs/ez-date-input.cjs.entry.js +6 -6
- package/dist/cjs/ez-date-time-input.cjs.entry.js +7 -7
- package/dist/cjs/ez-dialog.cjs.entry.js +33 -14
- package/dist/cjs/ez-filter-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-form.cjs.entry.js +101 -86
- package/dist/cjs/ez-grid-config.cjs.entry.js +3 -2
- package/dist/cjs/ez-grid.cjs.entry.js +97155 -92841
- package/dist/cjs/ez-number-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-popover.cjs.entry.js +6 -0
- package/dist/cjs/ez-radio-button.cjs.entry.js +49 -0
- package/dist/cjs/ez-search.cjs.entry.js +1 -1
- package/dist/cjs/ez-time-input.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +2 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/ez-actions-button/ez-actions-button.css +49 -0
- package/dist/collection/components/ez-actions-button/ez-actions-button.js +177 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.css +31 -0
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +4 -1
- package/dist/collection/components/ez-date-input/ez-date-input.js +5 -3
- package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +6 -6
- package/dist/collection/components/ez-dialog/DialogType.js +6 -0
- package/dist/collection/components/ez-dialog/ez-dialog.css +9 -1
- package/dist/collection/components/ez-dialog/ez-dialog.js +53 -26
- package/dist/collection/components/ez-form/DataBinder.js +46 -18
- package/dist/collection/components/ez-form/ez-form.js +75 -68
- package/dist/collection/components/ez-form/fieldbuilder/tpl/TextInput.tpl.js +2 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +24 -165
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +71 -44
- package/dist/collection/components/ez-grid/controller/ag-grid/template/HeaderColumnTemplate.js +4 -4
- package/dist/collection/components/ez-grid/ez-grid.js +36 -321
- package/dist/collection/components/ez-grid/subcomponents/ez-grid-config/ez-grid-config.js +2 -1
- package/dist/collection/components/ez-popover/ez-popover.js +6 -0
- package/dist/collection/components/ez-radio-button/ez-radio-button.css +204 -0
- package/dist/collection/components/ez-radio-button/ez-radio-button.js +160 -0
- package/dist/collection/utils/ApplicationUtils.js +25 -7
- package/dist/collection/utils/CSSVarsUtils.js +34 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/custom-elements/index.d.ts +12 -6
- package/dist/custom-elements/index.js +97132 -92676
- package/dist/esm/{ApplicationUtils-35350d20.js → ApplicationUtils-5f87ae60.js} +26 -7
- package/dist/esm/CSSVarsUtils-499b75c2.js +53 -0
- package/dist/esm/DialogType-72afa679.js +8 -0
- package/dist/esm/ez-actions-button.entry.js +97 -0
- package/dist/esm/ez-combo-box.entry.js +8 -4
- package/dist/esm/ez-date-input.entry.js +6 -6
- package/dist/esm/ez-date-time-input.entry.js +7 -7
- package/dist/esm/ez-dialog.entry.js +33 -14
- package/dist/esm/ez-filter-input.entry.js +1 -1
- package/dist/esm/ez-form.entry.js +101 -86
- package/dist/esm/ez-grid-config.entry.js +3 -2
- package/dist/esm/ez-grid.entry.js +96694 -92380
- package/dist/esm/ez-number-input.entry.js +1 -1
- package/dist/esm/ez-popover.entry.js +6 -0
- package/dist/esm/ez-radio-button.entry.js +45 -0
- package/dist/esm/ez-search.entry.js +1 -1
- package/dist/esm/ez-time-input.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +2 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/p-0b099e95.entry.js +1 -0
- package/dist/ezui/{p-ff7b4b13.entry.js → p-240a76f1.entry.js} +1 -1
- package/dist/ezui/p-3263a002.js +1 -0
- package/dist/ezui/p-787fbdfe.js +1 -0
- package/dist/ezui/p-78fc16d7.entry.js +1 -0
- package/dist/ezui/{p-4c3d136c.entry.js → p-7d29e829.entry.js} +1 -1
- package/dist/ezui/p-898b9906.js +1 -0
- package/dist/ezui/p-8aaca58b.entry.js +1 -0
- package/dist/ezui/p-99440dbc.entry.js +1 -0
- package/dist/ezui/p-a7064bc1.entry.js +1 -0
- package/dist/ezui/{p-53bbba8e.entry.js → p-ad071710.entry.js} +1 -1
- package/dist/ezui/p-b0195dae.entry.js +1 -0
- package/dist/ezui/p-ba2bfa01.entry.js +1 -0
- package/dist/ezui/p-bedef638.entry.js +1 -0
- package/dist/ezui/p-d1bc45bd.entry.js +1 -0
- package/dist/ezui/{p-003d53b1.entry.js → p-d75c3aae.entry.js} +1 -1
- package/dist/ezui/p-e5c572c1.entry.js +304 -0
- package/dist/ezui/p-f4819fa3.entry.js +1 -0
- package/dist/types/components/ez-actions-button/ez-actions-button.d.ts +37 -0
- package/dist/types/components/ez-dialog/DialogType.d.ts +5 -0
- package/dist/types/components/ez-dialog/ez-dialog.d.ts +22 -3
- package/dist/types/components/ez-form/DataBinder.d.ts +6 -1
- package/dist/types/components/ez-form/ez-form.d.ts +27 -3
- package/dist/types/components/ez-form/fieldbuilder/tpl/TextInput.tpl.d.ts +2 -1
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +0 -85
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +2 -23
- package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +14 -11
- package/dist/types/components/ez-grid/ez-grid.d.ts +8 -66
- package/dist/types/components/ez-radio-button/ez-radio-button.d.ts +36 -0
- package/dist/types/components.d.ts +129 -76
- package/dist/types/utils/ApplicationUtils.d.ts +4 -1
- package/dist/types/utils/CSSVarsUtils.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +5 -5
- package/react/components.d.ts +2 -1
- package/react/components.js +2 -1
- package/react/components.js.map +1 -1
- package/dist/cjs/CSSVarsUtils-1034b7b6.js +0 -21
- package/dist/cjs/test-du.cjs.entry.js +0 -103
- package/dist/collection/components/test-du/test-du.css +0 -3
- package/dist/collection/components/test-du/test-du.js +0 -104
- package/dist/collection/utils/interfaces/PageableComponent.js +0 -1
- package/dist/esm/CSSVarsUtils-eb4c5af6.js +0 -19
- package/dist/esm/test-du.entry.js +0 -99
- package/dist/ezui/p-0cd386db.js +0 -1
- package/dist/ezui/p-403de0a4.entry.js +0 -1
- package/dist/ezui/p-4c3cd534.entry.js +0 -1
- package/dist/ezui/p-6668c3b0.entry.js +0 -1
- package/dist/ezui/p-7fd6deec.entry.js +0 -1
- package/dist/ezui/p-8be1a4d6.entry.js +0 -1
- package/dist/ezui/p-8d73594f.entry.js +0 -369
- package/dist/ezui/p-933a7475.js +0 -1
- package/dist/ezui/p-988ff301.entry.js +0 -1
- package/dist/ezui/p-cf56d3e8.entry.js +0 -1
- package/dist/ezui/p-da156da3.entry.js +0 -1
- package/dist/ezui/p-ec7b7e26.entry.js +0 -1
- package/dist/types/components/test-du/test-du.d.ts +0 -9
- package/dist/types/utils/interfaces/PageableComponent.d.ts +0 -12
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h } from './index-b21f0a10.js';
|
|
2
|
-
import { ApplicationContext, DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
|
|
3
|
-
import { A as ApplicationUtils } from './ApplicationUtils-35350d20.js';
|
|
4
|
-
|
|
5
|
-
const testDuCss = ":host{display:block}";
|
|
6
|
-
|
|
7
|
-
let TestDu = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
}
|
|
11
|
-
componentWillLoad() {
|
|
12
|
-
ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", "http://localhost:8080/mge/ez.uploading");
|
|
13
|
-
this.dataUnit = new DataUnit("testes_com_formulario");
|
|
14
|
-
this.dataUnit.subscribe(() => this.isDirty = this.dataUnit.isDirty());
|
|
15
|
-
this.dataUnit.metadata = {
|
|
16
|
-
name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
|
|
17
|
-
label: "Parceiro",
|
|
18
|
-
fields: [
|
|
19
|
-
{
|
|
20
|
-
name: "CODPARC",
|
|
21
|
-
label: "Parceiro",
|
|
22
|
-
dataType: DataType.NUMBER,
|
|
23
|
-
userInterface: UserInterface.INTEGERNUMBER,
|
|
24
|
-
defaultValue: 666,
|
|
25
|
-
required: false,
|
|
26
|
-
properties: {}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "RECDESP",
|
|
30
|
-
label: "Receita/Despesa",
|
|
31
|
-
dataType: DataType.TEXT,
|
|
32
|
-
userInterface: UserInterface.OPTIONSELECTOR,
|
|
33
|
-
required: true,
|
|
34
|
-
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: "P",
|
|
38
|
-
label: "pera",
|
|
39
|
-
dataType: DataType.TEXT,
|
|
40
|
-
userInterface: UserInterface.OPTIONSELECTOR,
|
|
41
|
-
properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
|
|
42
|
-
},
|
|
43
|
-
]
|
|
44
|
-
};
|
|
45
|
-
this.formConfig = [
|
|
46
|
-
{
|
|
47
|
-
name: "CODPARC",
|
|
48
|
-
label: "Parceiro",
|
|
49
|
-
dataType: DataType.NUMBER,
|
|
50
|
-
userInterface: UserInterface.INTEGERNUMBER,
|
|
51
|
-
defaultValue: 666,
|
|
52
|
-
required: false,
|
|
53
|
-
properties: {}
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
name: "RECDESP",
|
|
57
|
-
label: "Receita/Despesa",
|
|
58
|
-
dataType: DataType.TEXT,
|
|
59
|
-
userInterface: UserInterface.OPTIONSELECTOR,
|
|
60
|
-
required: true,
|
|
61
|
-
properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
|
|
62
|
-
}
|
|
63
|
-
];
|
|
64
|
-
this.dataUnit.dataLoader = () => new Promise(accept => accept({
|
|
65
|
-
records: [{
|
|
66
|
-
__record__id__: "1321321321321321",
|
|
67
|
-
CODPARC: 10,
|
|
68
|
-
NOMEPARC: "Parceiro 10",
|
|
69
|
-
P: "M",
|
|
70
|
-
L: "Bagaço",
|
|
71
|
-
LI: "Azedo"
|
|
72
|
-
}],
|
|
73
|
-
limit: 0,
|
|
74
|
-
offset: 2,
|
|
75
|
-
total: 100,
|
|
76
|
-
hasMore: true
|
|
77
|
-
}));
|
|
78
|
-
this.dataUnit.saveLoader = (_dataUnit, changes) => {
|
|
79
|
-
const savedRecords = [];
|
|
80
|
-
changes.forEach(change => {
|
|
81
|
-
savedRecords.push(Object.assign(Object.assign({}, change.record), change.updatingFields));
|
|
82
|
-
});
|
|
83
|
-
return Promise.resolve(savedRecords);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
save() {
|
|
87
|
-
this.dataUnit.saveData().catch(e => {
|
|
88
|
-
if (e.kind === "WAITING_CHANGE_ERROR") {
|
|
89
|
-
ApplicationUtils.alert(`Alterando campo ${e.fieldName}`, e.message);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
return (h("div", null, h("button", { onClick: () => this.dataUnit.addRecord() }, "Novo"), h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"), h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"), h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig })));
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
TestDu.style = testDuCss;
|
|
98
|
-
|
|
99
|
-
export { TestDu as test_du };
|
package/dist/ezui/p-0cd386db.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
class t{static async showDialog(n,e,a=null,l,o=!1,c){return c&&(c=Object.assign(Object.assign({},t.defaultMessageOptions),c)),new Promise((t=>{let r=document.querySelector("ez-dialog");r||(r=document.createElement("ez-dialog"),window.document.body.appendChild(r)),r.show(n,e,o,l,a,c.labelCancel,c.labelConfirm,c.btnConfirmDanger).then((n=>t(n)))}))}static async alert(n,e,a=null,l=t.defaultMessageOptions){return t.showDialog(n,e,a,!1,!1,l)}static async error(n,e,a=null,l=t.defaultMessageOptions){return t.showDialog(n,e,a,!1,!0,l)}static async confirm(n,e,a=null,l=!1,o=t.defaultMessageOptions){return t.showDialog(n,e,a,!0,l,o)}static async info(n,e=t.defaultMessageOptions){let a=document.querySelector("ez-toast");a||(a=document.createElement("ez-toast"),window.document.body.appendChild(a)),a.show(n,4e3,!1,e.canClose)}}t.defaultMessageOptions={canClose:!0,labelCancel:"Não",labelConfirm:"Sim",btnConfirmDanger:!1};export{t as A}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,r as t,c as i,f as n,H as s,g as r}from"./p-139ed2f6.js";import{UserInterface as o,Action as a,WaitingChangeException as l,ApplicationContext as c,DataUnitAction as d,DataUnit as h}from"@sankhyalabs/core";import{A as u}from"./p-0cd386db.js";const f=({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-text-input",{label:i,"data-field-name":t,key:t}));function b(t,i,n,s=!1){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-align--middle ez-padding-horizontal--small ez-padding-bottom--large"},e("ez-check",{enabled:!n,label:i,mode:s?"switch":"regular","data-field-name":t,key:t}))}function p(t,i,n,s,r){return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-number-input",{enabled:!n,label:i,precision:s,prettyPrecision:r,"data-field-name":t,key:t}))}const m=new Map;m.set(o.LONGTEXT,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small",key:t},e("ez-text-area",{enabled:!n,label:i,"data-field-name":t})))),m.set(o.CHECKBOX,(e=>b(e.name,e.label,e.readOnly,!1))),m.set(o.SWITCH,(e=>b(e.name,e.label,e.readOnly,!0))),m.set(o.OPTIONSELECTOR,(({name:t,label:i,readOnly:n,required:s},r)=>{const o=null==r?void 0:r.options;let a;if("string"==typeof o){const e=JSON.parse(o);a=Object.keys(e).map((t=>({value:t,label:e[t]})))}else a=o;return e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-combo-box",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t,options:a}))})),m.set(o.SEARCH,(({name:t,label:i,readOnly:n,required:s})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-search",{enabled:!n,suppressEmptyOption:s,label:i,"data-field-name":t,key:t})))),m.set(o.FILE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-padding-horizontal--small"},e("ez-upload",{enabled:!n,label:i,"data-field-name":t,key:t})))),m.set(o.DATE,(({name:t,label:i,readOnly:n})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-input",{enabled:!n,label:i,"data-field-name":t,key:t})))),m.set(o.TIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-time-input",{label:i,"data-field-name":t,key:t})))),m.set(o.DATETIME,(({name:t,label:i})=>e("div",{class:"ez-col ez-col--sd-12 ez-col--tb-3 ez-padding-horizontal--small"},e("ez-date-time-input",{label:i,"data-field-name":t,key:t})))),m.set(o.DECIMALNUMBER,(({name:e,label:t,readOnly:i},n)=>{const s=Number((null==n?void 0:n.precision)||2);return p(e,t,i,s,Number((null==n?void 0:n.prettyPrecision)||s))})),m.set(o.INTEGERNUMBER,(({name:e,label:t,readOnly:i})=>p(e,t,i,0,0)));const v=e=>{const t=e.descriptor,i=Object.assign({},e.config);let n,s;return t&&(i.label||(i.label=t.label),i.name||(i.name=t.name),void 0===i.required&&(i.required=t.required),void 0===i.readOnly&&(i.readOnly=t.readOnly),s=t.properties,n=m.get(t.userInterface)),i.required&&(i.label=`* ${i.label} (obrigatório)`),n||(n=f),n(i,s)},z=({source:t})=>"items"in t?e("ez-collapsible-box",{label:t.label,"header-size":"large"},t.items.map((e=>v(e)))):v(t),y=({store:t,source:i})=>e("div",{class:"dynamic-content ez-box__container"},e("div",{class:"ez-row ez-padding-vertical--small"},i.items.map((i=>e(z,{store:t,source:i})))));class g{constructor(){this._sheets=new Map,this._requiredFields=[],this._cleanOnCopyFields=[],this._defaultValues={}}getSheet(e){return this._sheets.get(e)}getAllSheets(){return this._sheets}addSheet(e){this._sheets.set(e.name,e),this._requiredFields=this._requiredFields.concat(e.requiredFields),this._cleanOnCopyFields=this._cleanOnCopyFields.concat(e.cleanOnCopyFields),this._defaultValues=e.defaultValues}getRequiredFields(){return this._requiredFields}getCleanOnCopyFields(){return this._cleanOnCopyFields}getDefaultValues(){return this._defaultValues}}function _(e,t){return"__main"==e[0].label?-1:(e[0].order||1e4)-(t[0].order||1e4)}function w(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var O="function"==typeof Symbol&&Symbol.observable||"@@observable",E=function(){return Math.random().toString(36).substring(7).split("").join(".")},A={INIT:"@@redux/INIT"+E(),REPLACE:"@@redux/REPLACE"+E(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+E()}};function C(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function x(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(w(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(w(1));return i(x)(e,t)}if("function"!=typeof e)throw new Error(w(2));var s=e,r=t,o=[],a=o,l=!1;function c(){a===o&&(a=o.slice())}function d(){if(l)throw new Error(w(3));return r}function h(e){if("function"!=typeof e)throw new Error(w(4));if(l)throw new Error(w(5));var t=!0;return c(),a.push(e),function(){if(t){if(l)throw new Error(w(6));t=!1,c();var i=a.indexOf(e);a.splice(i,1),o=null}}}function u(e){if(!C(e))throw new Error(w(7));if(void 0===e.type)throw new Error(w(8));if(l)throw new Error(w(9));try{l=!0,r=s(r,e)}finally{l=!1}for(var t=o=a,i=0;i<t.length;i++)(0,t[i])();return e}function f(e){if("function"!=typeof e)throw new Error(w(10));s=e,u({type:A.REPLACE})}function b(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(w(11));function i(){e.next&&e.next(d())}return i(),{unsubscribe:t(i)}}})[O]=function(){return this},e}return u({type:A.INIT}),(n={dispatch:u,subscribe:h,getState:d,replaceReducer:f})[O]=b,n}const R={};function j(e=R,t){switch(t.type){case k.METADATA_LOADED:return Object.assign(Object.assign({},e),{formMetadata:t.payload});case k.CHANGE_TAB:return Object.assign(Object.assign({},e),{currentSheet:t.payload});default:return e}}function N(e){return e.formMetadata}var k;!function(e){e.METADATA_LOADED="FORM/METADATA_LOADED",e.CHANGE_TAB="FORM/CHANGE_TAB"}(k||(k={}));class D{constructor(e){this.onDataUnitEvent=e=>{var t;switch(e.type){case a.DATA_LOADED:case a.DATA_SAVED:case a.RECORDS_REMOVED:case a.RECORDS_ADDED:case a.RECORDS_COPIED:case a.DATA_CHANGED:case a.EDITION_CANCELED:case a.CHANGE_UNDONE:case a.CHANGE_REDONE:case a.SELECTION_CHANGED:case a.NEXT_SELECTED:case a.PREVIOUS_SELECTED:null===(t=this._fields)||void 0===t||t.forEach((t=>{this.updateValue(t.fieldName,t.field,e.type===a.EDITION_CANCELED)}))}},this._fields=new Map,this._dataUnit=e,this._dataUnit.subscribe(this.onDataUnitEvent)}bind(e){e.forEach((e=>{this.updateBind(e.dataset.fieldName,e)}))}onDisconnectedCallback(){this._dataUnit.unsubscribe(this.onDataUnitEvent)}updateValue(e,t,i=!1){var n;t.value=this._dataUnit.getFieldValue(e),i&&(null===(n=t.errorMessage)||void 0===n?void 0:n.trim())&&(t.errorMessage="")}updateBind(e,t){const i=this._fields.get(e);i&&i.destroy(),this.updateValue(e,t),this._fields.set(e,P.create(e,t,((e,t)=>this.changeStarted(e,t)),(e=>this.cancelWaitingChange(e)),((e,t)=>this.setFieldValue(e,t)))),this.bindSearchOptionsLoader(e,t),this.applyEzUploadContext(e,t)}changeStarted(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),!t.blocking&&null==t.promise){const i=this._fields.get(e);i&&(t.promise=new Promise(((e,t)=>{i.waitingChangePromiseResolve=e,i.waitingChangePromiseReject=t})))}this._dataUnit.startChange(e,t)}cancelWaitingChange(e){if(this._dataUnit.waitingForChange(e)){this._dataUnit.cancelWaitingChange(e);const t=this._fields.get(e);t&&t.rejectWaitingChange(new l("Change canceled",e))}}setFieldValue(e,t){if(0===this._dataUnit.records.length&&this._dataUnit.addRecord(),this._dataUnit.setFieldValue(e,t),this._dataUnit.waitingForChange(e)){const t=this._fields.get(e);t&&t.acceptWaitingChange()}}bindSearchOptionsLoader(e,t){if("EZ-SEARCH"===t.nodeName&&null==t.optionLoader){const i=c.getContextValue("__EZUI__SEARCH__OPTION__LOADER__");i&&(t.optionLoader=t=>i(t,e,this._dataUnit))}}applyEzUploadContext(e,t){var i,n;if("EZ-UPLOAD"===t.nodeName){t.urlUpload=c.getContextValue("__EZUI__UPLOAD__ADD__URL__"),t.urlDelete=c.getContextValue("__EZUI__UPLOAD__DEL__URL__");const s=this._dataUnit.getField(e),r=null===(i=s.properties)||void 0===i?void 0:i.DESTINATION;r&&(t.requestHeaders={XTRAINF:`{"destination": "${r}"}`}),t.maxFiles=(null===(n=s.properties)||void 0===n?void 0:n.MAX_FILES)||0}}}class P{constructor(){this.startChangeEventName="ezStartChange",this.cancelWaitingChangeEventName="ezCancelWaitingChange",this.changeEventName="ezChange"}destroy(){this.field.removeEventListener(this.startChangeEventName,this.startChangeListener),this.field.removeEventListener(this.cancelWaitingChangeEventName,this.cancelWaitingChangeListener),this.field.removeEventListener(this.changeEventName,this.changeListener)}acceptWaitingChange(){this.waitingChangePromiseResolve&&(this.waitingChangePromiseResolve(),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}rejectWaitingChange(e){this.waitingChangePromiseReject&&(this.waitingChangePromiseReject(e),this.waitingChangePromiseReject=void 0,this.waitingChangePromiseResolve=void 0)}static create(e,t,i,n,s){const r=new P;return r.field=t,r.fieldName=e,r.startChangeListener=t=>{i(e,t.detail)},r.field.addEventListener(r.startChangeEventName,r.startChangeListener),r.cancelWaitingChangeListener=()=>{n(e)},r.field.addEventListener(r.cancelWaitingChangeEventName,r.cancelWaitingChangeListener),r.changeListener=t=>{s(e,t.detail)},r.field.addEventListener(r.changeEventName,r.changeListener),r}}let S=class{constructor(e){t(this,e),this.ezReady=i(this,"ezReady",7),this.onDataUnitAction=e=>{e.type===a.METADATA_LOADED&&this.processMetadata()}}submit(){return Promise.resolve()}cancel(){return Promise.resolve()}validate(){return new Promise((async(e,t)=>{const i=N(this._store.getState()),n=this._staticFields.filter((e=>e.dataset.required)).map((e=>e.dataset.fieldName)).concat(i.getRequiredFields());let s=!1;const r=this.dataUnit.getModifiedRecords();for(let e=0;e<r.length;e++)if(!this.validateRequired(n,r[e])){s=!0;break}s||await this.validateError()||(s=!0),s?t():e()}))}observeConfig(){this.processMetadata()}async validateError(){var e;const t=[],i=null===(e=this._element)||void 0===e?void 0:e.querySelectorAll("[data-field-name]");if(i&&i.length>0)for(let e=0;e<i.length;e++){const n=i[e];n&&n.isInvalid&&await n.isInvalid()&&n.dataset&&t.push(n.dataset.fieldName)}const n=0===t.length;return n||u.info("Há pelo menos um campo com conteúdo inválido."),n}validateRequired(e,t){const i=[];e.forEach((e=>{const n=t[e],s=this._element.querySelector(`[data-field-name=${e}]`);s&&(s.errorMessage="",null!=n&&""!==n||(i.push(e),s.errorMessage="Essa informação é obrigatória"))}));const n=0===i.length;return n||u.info("Há pelo menos um campo obrigatório não preenchido."),n}getDynamicContent(){var t;const i=N(this._store.getState());if(!i)return null;const n=(s=null===(t=this._store)||void 0===t?void 0:t.getState()).currentSheet?s.formMetadata.getSheet(s.currentSheet):Array.from(s.formMetadata.getAllSheets().values())[0];var s;if(!n)return null;const r=Array.from(i.getAllSheets().values()),o=[];return r.length>1&&o.push(e("ez-tabselector",{onEzChange:e=>this._store.dispatch(function(e){return{type:k.CHANGE_TAB,payload:e.tabKey}}(e.detail)),selectedTab:n.name},r.map((t=>e("ez-tab",{tabKey:t.name,label:t.label}))))),o.push(e(y,{store:this._store,source:n})),o}processMetadata(){if(!this.isStatic()&&this.dataUnit){const e=this.config&&this.config.length>0?((e,t)=>{const i=new Map,n=[],s=[],r={};e.forEach((e=>{var o,a,l;if(!1!==e.visible){const c=function(e,t){return("string"==typeof e?Array.from(t.keys()).find((t=>t.label===e)):e)||{label:e,visible:!0}}(e.tab||"__main",i),d=t.getField(e.name);if(d&&c.visible){i.has(c)||i.set(c,new Map);const t=i.get(c);(void 0===e.required?d.required:e.required)&&n.push(e.name),(void 0===e.cleanOnCopy?(null===(o=d.properties)||void 0===o?void 0:o.cleanOnCopy)||(null===(a=d.properties)||void 0===a?void 0:a.autoNum):e.cleanOnCopy)&&s.push(e.name),(void 0===e.defaultValue?null===(l=d.properties)||void 0===l?void 0:l.defaultValue:e.defaultValue)&&(r[e.name]=e.defaultValue);const h={config:e,descriptor:d},u=e.group;if(u){const e=`group::${u}`;t.has(e)?t.get(e).items.push(h):t.set(e,{label:u,items:[h]})}else t.set(e.name,h)}}}));const o=new g;return Array.from(i.entries()).sort(_).forEach((([e,t])=>{o.addSheet({label:"__main"===e.label?"Principal":e.label,name:e.label,items:Array.from(t.values()),requiredFields:n,cleanOnCopyFields:s,defaultValues:r})})),o})(this.config,this.dataUnit):(()=>{var e;const t=this.dataUnit.metadata,i=new g;if(t){const n=null===(e=t.fields)||void 0===e?void 0:e.filter((e=>!1!==e.visible));let s={};n.filter((e=>e.defaultValue)).map((e=>s[e.name]=e.defaultValue)),i.addSheet({label:t.label,name:t.name,items:n.map((e=>({descriptor:e}))),requiredFields:n.filter((e=>e.required)).map((e=>e.name)),cleanOnCopyFields:n.filter((e=>{var t,i;return(null===(t=e.properties)||void 0===t?void 0:t.cleanOnCopy)||(null===(i=e.properties)||void 0===i?void 0:i.autoNum)})).map((e=>e.name)),defaultValues:s})}return i})();this._store.dispatch({type:k.METADATA_LOADED,payload:e})}}isStatic(){var e;return(null===(e=this._staticFields)||void 0===e?void 0:e.length)>0}interceptAction(e){if(e.type===a.RECORDS_COPIED){const t=N(this._store.getState()).getCleanOnCopyFields();if(t)return new d(a.RECORDS_COPIED,e.payload.map((e=>{const i=Object.assign({},e);return t.forEach((e=>delete i[e])),i})))}if(e.type===a.RECORDS_ADDED){const t=N(this._store.getState()).getDefaultValues();if(t)return new d(a.RECORDS_ADDED,e.payload.map((e=>{const i=Object.assign({},e);for(const e in t)i[e]=this.dataUnit.valueFromString(e,t[e]);return i})))}return e}componentWillLoad(){void 0===this.dataUnit&&(this.dataUnit=new h("ez-form")),this.dataUnit.addInterceptor(this),this.dataUnit.subscribe(this.onDataUnitAction),this._dataBinder=new D(this.dataUnit),this._store=x(j),this._store.subscribe((()=>n(this))),this._staticFields=Array.from(this._element.querySelectorAll("[data-field-name]")),this.processMetadata()}componentDidRender(){this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]"))),this.ezReady.emit()}disconnectedCallback(){this.dataUnit.unsubscribe(this.onDataUnitAction),this.dataUnit.removeInterceptor(this),this._dataBinder.onDisconnectedCallback()}render(){return e(s,null,this.isStatic()?null:this.getDynamicContent())}get _element(){return r(this)}static get watchers(){return{config:["observeConfig"]}}};S.style="ez-form{display:flex;flex-direction:column;width:100%}.dynamic-content ez-collapsible-box{--ez-collapsible-box__header--padding-right:var(--space-small, 6px);--ez-collapsible-box__header--padding-left:var(--space-small, 6px)}";export{S as ez_form}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,h as a}from"./p-139ed2f6.js";import{ApplicationContext as t,DataUnit as r,DataType as s,UserInterface as i}from"@sankhyalabs/core";import{A as o}from"./p-0cd386db.js";let n=class{constructor(a){e(this,a)}componentWillLoad(){t.setContextValue("__EZUI__UPLOAD__ADD__URL__","http://localhost:8080/mge/ez.uploading"),this.dataUnit=new r("testes_com_formulario"),this.dataUnit.subscribe((()=>this.isDirty=this.dataUnit.isDirty())),this.dataUnit.metadata={name:"dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",label:"Parceiro",fields:[{name:"CODPARC",label:"Parceiro",dataType:s.NUMBER,userInterface:i.INTEGERNUMBER,defaultValue:666,required:!1,properties:{}},{name:"RECDESP",label:"Receita/Despesa",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,required:!0,properties:{options:'{"-1": "Despesa", "1": "Receita"}'}},{name:"P",label:"pera",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,properties:{options:'{"M": "Madura", "V": "Verde", "P": "Passada"}'}}]},this.formConfig=[{name:"CODPARC",label:"Parceiro",dataType:s.NUMBER,userInterface:i.INTEGERNUMBER,defaultValue:666,required:!1,properties:{}},{name:"RECDESP",label:"Receita/Despesa",dataType:s.TEXT,userInterface:i.OPTIONSELECTOR,required:!0,properties:{options:'{"-1": "Despesa", "1": "Receita"}'}}],this.dataUnit.dataLoader=()=>new Promise((e=>e({records:[{__record__id__:"1321321321321321",CODPARC:10,NOMEPARC:"Parceiro 10",P:"M",L:"Bagaço",LI:"Azedo"}],limit:0,offset:2,total:100,hasMore:!0}))),this.dataUnit.saveLoader=(e,a)=>{const t=[];return a.forEach((e=>{t.push(Object.assign(Object.assign({},e.record),e.updatingFields))})),Promise.resolve(t)}}save(){this.dataUnit.saveData().catch((e=>{"WAITING_CHANGE_ERROR"===e.kind&&o.alert(`Alterando campo ${e.fieldName}`,e.message)}))}render(){return a("div",null,a("button",{onClick:()=>this.dataUnit.addRecord()},"Novo"),a("button",{onClick:()=>this.dataUnit.loadData()},"Carregar"),a("button",{onClick:()=>this.save(),disabled:!this.isDirty},"Salvar"),a("ez-form",{dataUnit:this.dataUnit,config:this.formConfig}))}};n.style=":host{display:block}";export{n as test_du}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,H as s,g as n}from"./p-139ed2f6.js";import{TimeFormatter as a,DateUtils as o}from"@sankhyalabs/core";import{C as r}from"./p-933a7475.js";let h=class{constructor(e){t(this,e),this.ezChange=i(this,"ezChange",7),this.ezStartChange=i(this,"ezStartChange",7),this.ezCancelWaitingChange=i(this,"ezCancelWaitingChange",7),this._focused=!1,this.enabled=!0,this.showSeconds=!1,this.mode="regular"}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,i){if(this._textInput&&t!=i){const e=this.validateValue(t),s=this.validateValue(i);if((null==e?void 0:e.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(e)||"";!this.getParsedDateTime(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===e?void 0:e)}}}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}handleKeyDown(t){const i=this._textInput.shadowRoot.querySelector("input");if("H"===t.key||"h"===t.key)this.changeValue(new Date);else if(t.shiftKey&&"Tab"===t.key){if(i.selectionStart>0){let e=i.value.lastIndexOf(" ",i.selectionStart);-1!==e&&(i.setSelectionRange(0,e),t.preventDefault())}}else if("Tab"===t.key&&i.value.length!==i.selectionEnd){let e=i.value.indexOf(" ",i.selectionEnd);e=-1===e?i.selectionEnd:e+1,i.setSelectionRange(e,i.value.length),t.preventDefault()}}handleFocus(){const t=this._textInput.shadowRoot.querySelector("input");if(t.selectionStart!==t.selectionEnd){let i=t.value.indexOf(" ",t.selectionStart);i=-1===i?t.value.length:i,t.setSelectionRange(0,i)}}handleClick(){const t=this._textInput.shadowRoot.querySelector("input");let i=t.value.lastIndexOf(" ",t.selectionEnd);i=-1===i?0:i+1,i=i>t.selectionEnd?0:i;let e=0===i?t.value.indexOf(" "):t.value.length;t.setSelectionRange(i,e)}changeValue(t){const i=this.validateValue(this.value),e=this.validateValue(t);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this.value=e)}showCalendar(){this._calendar.fitVertical(this.errorMessage||"slim"===this.mode?0:-19,this._elem.clientHeight),this._calendar.style.visibility="inherit"}getParsedDateTime(t){var i,e;if(void 0===t&&(t=(null===(e=null===(i=this._textInput)||void 0===i?void 0:i.value)||void 0===e?void 0:e.trim())||""),!t)return;const s=t.split(" "),n=s.length>0?s[0]:t,r=a.prepareValue(s[1]?s[1]:"",this.showSeconds);return o.strToDate(n+(r&&" "+r))}handleBlur(){var t,i;const e=(null===(i=null===(t=this._textInput)||void 0===t?void 0:t.value)||void 0===i?void 0:i.trim())||"",s=this.getParsedDateTime();if(s||!e){this.errorMessage="";const t=this.validateValue(this.value),i=this.validateValue(s);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}getTextValue(t){return t?new Intl.DateTimeFormat("pt-BR",this.showSeconds?{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).format(t):void 0}validateValue(t){return t instanceof Date&&!isNaN(t.valueOf())?t:void 0}handleInput(){const t=this.getParsedDateTime(),i=this.validateValue(this.value),e=this.validateValue(t);(null==i?void 0:i.getTime())!==(null==e?void 0:e.getTime())&&(this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}componentDidLoad(){r.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return e(s,null,e("ez-text-input",{ref:t=>this._textInput=t,"data-slave-mode":"true",label:this.label,restrict:"0123456789/: ",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode,onKeyDown:t=>{this.handleKeyDown(t)},onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),onFocus:()=>this.handleFocus(),onClick:()=>this.handleClick()},e("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),e("ez-calendar",{onEzChange:t=>{this.changeValue(this._calendar.value),t.stopPropagation()},floating:!0,ref:t=>this._calendar=t,time:!0,showSeconds:this.showSeconds}))}get _elem(){return n(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};h.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="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"/></svg>\')}.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;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{h as ez_date_time_input}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,H as s,g as a}from"./p-139ed2f6.js";import{DateUtils as n}from"@sankhyalabs/core";import{C as o}from"./p-933a7475.js";let r=class{constructor(i){t(this,i),this.ezChange=e(this,"ezChange",7),this.ezStartChange=e(this,"ezStartChange",7),this.ezCancelWaitingChange=e(this,"ezCancelWaitingChange",7),this._focused=!1,this.enabled=!0,this.mode="regular"}observeLabel(){this._textInput&&(this._textInput.label=this.label)}observeErrorMessage(){var t;this._textInput&&(this._textInput.errorMessage=this.errorMessage,(null===(t=this.errorMessage)||void 0===t?void 0:t.trim())||this.setInputValue())}observeValue(t,e){if(this._textInput&&t!=e){const i=this.validateValue(t),s=this.validateValue(e);if((null==i?void 0:i.getTime())!==(null==s?void 0:s.getTime())){const t=this.getTextValue(i)||"";!n.strToDate(t)&&this._focused||(this._textInput.value||"")===t||(this._textInput.value=t,this._focused=!1,this.errorMessage=""),this.ezChange.emit(null===i?void 0:i)}}}async setFocus(){this._textInput.setFocus()}async setBlur(){this._textInput.setBlur()}async isInvalid(){return"string"==typeof this.errorMessage&&""!==this.errorMessage.trim()}changeValue(t){const e=this.validateValue(this.value),i=this.validateValue(t);(null==e?void 0:e.getTime())!==(null==i?void 0:i.getTime())&&(this.value=i)}showCalendar(){this.handleBlur(),this._calendar.value=this.value,this._calendar.fitVertical(this.errorMessage||"slim"===this.mode?0:-19,this._elem.clientHeight)}hideCalendar(){this.changeValue(this._calendar.value),this._calendar.hide()}handleBlur(){const t=this._textInput.value,e=n.strToDate(t);if(e||!t){this.errorMessage="";const t=this.validateValue(this.value),i=this.validateValue(e);(null==t?void 0:t.getTime())===(null==i?void 0:i.getTime())?(i&&(this._textInput.value=this.getTextValue(i)||"",this._focused=!1),this.ezCancelWaitingChange.emit()):this.changeValue(i)}else this.changeValue(void 0),this.ezCancelWaitingChange.emit(),this.errorMessage="O valor digitado não é uma data válida"}getTextValue(t){return t?new Intl.DateTimeFormat("pt-BR").format(t):void 0}handleInput(){const t=n.strToDate(this._textInput.value),e=this.validateValue(this.value),i=this.validateValue(t);(null==e?void 0:e.getTime())!==(null==i?void 0:i.getTime())&&(this._focused=!0,this.ezStartChange.emit({waitmessage:"",blocking:!1}))}validateValue(t){return t instanceof Date&&!isNaN(t.valueOf())?n.clearTime(t):void 0}setInputValue(){const t=this.getTextValue(this.value)||"";(this._textInput.value||"")!==t&&(this._textInput.value=t)}componentDidLoad(){o.applyVarsTextInput(this._elem,this._textInput),this.setInputValue()}render(){return i(s,null,i("ez-text-input",{ref:t=>this._textInput=t,"data-slave-mode":"true",onKeyDown:t=>{"H"!==t.key&&"h"!==t.key||this.changeValue(new Date)},label:this.label,onBlur:()=>this.handleBlur(),onInput:()=>this.handleInput(),restrict:"0123456789/",enabled:this.enabled,errorMessage:this.errorMessage,mode:this.mode},i("button",{disabled:!this.enabled,tabindex:-1,class:"btn-open-cal",onClick:()=>this.showCalendar(),slot:"leftIcon"})),i("ez-calendar",{onEzChange:t=>{this.hideCalendar(),t.stopPropagation()},floating:!0,ref:t=>this._calendar=t}))}get _elem(){return a(this)}static get watchers(){return{label:["observeLabel"],errorMessage:["observeErrorMessage"],value:["observeValue"]}}};r.style=':host{display:block;width:100%;--ez-date-input__input--background-color:var(--background--medium, #e0e0e0);--ez-date-input__input--border-color:var(--ez-date-input__input--background-color);--ez-date-input__calendar-image:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="16px" width="15px"><path d="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"/></svg>\')}.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;-webkit-mask-image:var(--ez-date-input__calendar-image);mask-image:var(--ez-date-input__calendar-image)}.btn-open-cal:disabled:after{background-color:var(--text--disable, #AFB6C0)}.btn-open-cal:enabled:hover::after{background-color:var(--color--primary, #4e4e4e)}ez-text-input{--text-input__input--background-color:var(--ez-date-input__input--background-color, #FFFFFF);--text-input__input--border-color:var(--ez-date-input__input--border-color, #DCE0E8)}';export{r as ez_date_input}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,h as i,H as e,g as s}from"./p-139ed2f6.js";import{FloatingManager as r}from"@sankhyalabs/core";let h=class{constructor(i){t(this,i),this.ezVisibilityChange=o(this,"ezVisibilityChange",7),this._firstRender=!0,this.autoClose=!0,this.top="0px",this.left="0px",this.bottom="0px",this.right="0px",this.boxWidth="fit-content",this.innerClickTest=(t,o,i)=>{const e=[t];this.innerElement&&("string"==typeof this.innerElement?e.push(document.querySelector(`#${this.innerElement}`)):this.innerElement.forEach((t=>{e.push(document.querySelector(`#${t}`))})));for(var s=0;s<e.length;s++){let t=e[s];if(null!=t){if(t.contains(o))return!0;if(i&&"nodeType"in(null==i?void 0:i.target)&&t.contains(i.target))return!0;if(t.shadowRoot&&t.shadowRoot.contains(o))return!0;if(t=this._host,t.lastElementChild.shadowRoot?t.lastElementChild.shadowRoot.contains(o):t.contains(o))return!0}}return!1},this.backClickListener=()=>{this.ezVisibilityChange.emit(!1)}}observeOpened(t,o){t!=o&&this.ezVisibilityChange.emit(t)}async updatePosition(t=this.top,o=this.left,i=this.bottom,e=this.right){r.updateFloatPosition(this._box,this._container,{autoClose:this.autoClose,top:t,left:o,bottom:i,right:e,innerClickTest:this.innerClickTest,backClickListener:this.backClickListener})}async show(t=this.top,o=this.left,i=this.bottom,e=this.right){this._floatingID=r.float(this._box,this._container,{autoClose:this.autoClose,top:t,left:o,bottom:i,right:e,innerClickTest:this.innerClickTest,backClickListener:this.backClickListener}),this.opened=!0}async hide(){void 0!==this._floatingID&&(r.close(this._floatingID),this._floatingID=void 0,this.opened=!1)}componentDidRender(){this._firstRender&&(this._box.remove(),this._firstRender=!1)}render(){return i(e,null,i("section",{ref:t=>this._container=t},i("div",{class:"popover__box "+("fit-content"===this.boxWidth?"popover__box--fit-content":"popover__box--full-width"),ref:t=>this._box=t},i("slot",null))))}get _host(){return s(this)}static get watchers(){return{opened:["observeOpened"]}}};h.style=":host{--ez-popover__box--border-radius:var(--border--radius-medium, 12px);--ez-popover__box--box-shadow:var(--shadow, 0px 0px 16px 0px #000);--ez-popover__box--background-color:var(--background--xlight, #fff);--ez-popover__box--z-index:var(--more-visible, 1);position:relative;display:flex;user-select:none}.popover__box{z-index:var(--ez-popover__box--z-index);display:flex;flex-direction:column;height:fit-content;background-color:var(--ez-popover__box--background-color);border-radius:var(--ez-popover__box--border-radius);box-shadow:var(--ez-popover__box--box-shadow)}.popover__box--fit-content{width:fit-content}.popover__box--full-width{width:100%}";export{h as ez_popover}
|