@sankhyalabs/ezui 5.22.0-dev.17 → 5.22.0-dev.19
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/ez-custom-form-input_2.cjs.entry.js +22 -23
- package/dist/cjs/ez-grid.cjs.entry.js +7 -0
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +22 -23
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +8 -0
- package/dist/custom-elements/index.js +29 -23
- package/dist/esm/ez-custom-form-input_2.entry.js +22 -23
- package/dist/esm/ez-grid.entry.js +7 -0
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-32e553e5.entry.js → p-5ee2dc4e.entry.js} +1 -1
- package/dist/ezui/p-e26f12dd.entry.js +1 -0
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +6 -6
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +1 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +2 -0
- package/package.json +1 -1
- package/dist/ezui/p-ecaa643e.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as s,c as e,g as o}from"./p-23a36bb6.js";import{C as n}from"./p-4607fb89.js";import{ObjectUtils as l,HTMLBuilder as h,StringUtils as a,ElementIDUtils as d}from"@sankhyalabs/core";import{A as r}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";const c=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){l.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){t.__record__id__!==i.__record__id__&&this.getContent()}getContent(){var t,s;const e=new Map;for(const t in this.formViewField.props)e.set(t,this.formViewField.props[t]);const o={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(s=this.formViewField.props)||void 0===s?void 0:s.options,props:this.formViewField.props?e:void 0,optionLoader:this.formViewField.optionLoader},source:n.FORM,detailContext:this.detailContext};let l=this.customEditor.getEditorElement(o);return l?l instanceof HTMLElement||"string"==typeof l?("string"==typeof l&&(l=h.parseElement(l)),l.setAttribute("value",this.value),void(this.gui=i("div",{key:a.generateUUID(),ref:t=>t&&t.appendChild(l)}))):(this.handleValue(l),void(this.gui=l)):(l=this.builderFallback(this.formViewField),this.handleValue(l),void(this.gui=l))}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return i(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},u=class{constructor(i){t(this,i),this.saveEdition=e(this,"saveEdition",7),this.cancelEdition=e(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var s,e;const o=null===(e=null===(s=this._inputElement)||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("input");if(null!=o){const s=this.getWidthValue(t);o.style.width=s+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const s=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+s:s}i.innerHTML=""}return 0}setStyledInput(){var t,i;let s="",e="",o="";null!=this.styled&&(s=this.styled.fontSize,e=this.styled.fontWeight,o=this.styled.fontFamily);const n=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=n&&(n.style.fontSize=s,n.style.fontWeight=e,n.style.fontFamily=o);const l=this._valueBasis;null!=l&&(l.style.fontSize=s,l.style.fontWeight=e,l.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):r.alert("Aviso","Não é possível salvar um campo em branco.").then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return d.addIDInfoIfNotExists(this._element,"input"),i(s,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":d.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};u.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{c as ez_custom_form_input,u as ez_text_edit}
|
|
@@ -27,12 +27,6 @@ export declare class EzCustomFormInput {
|
|
|
27
27
|
* Define os registros da linha selecionada.
|
|
28
28
|
*/
|
|
29
29
|
selectedRecord: Record;
|
|
30
|
-
watchValue(): void;
|
|
31
|
-
watchCustomEditor(): void;
|
|
32
|
-
watchFormViewField(newValue: IFormViewField | string, oldValue: IFormViewField): void;
|
|
33
|
-
watchDetailContext(): void;
|
|
34
|
-
watchBuilderFallback(): void;
|
|
35
|
-
watchSelectedRecord(newValue: Record | string, oldValue: Record): void;
|
|
36
30
|
/**
|
|
37
31
|
* Aplica foco no campo.
|
|
38
32
|
*/
|
|
@@ -45,6 +39,12 @@ export declare class EzCustomFormInput {
|
|
|
45
39
|
* Retorna se o conteúdo é inválido.
|
|
46
40
|
*/
|
|
47
41
|
isInvalid(): Promise<boolean>;
|
|
42
|
+
watchValue(): void;
|
|
43
|
+
watchCustomEditor(): void;
|
|
44
|
+
watchFormViewField(newValue: IFormViewField | string, oldValue: IFormViewField): void;
|
|
45
|
+
watchDetailContext(): void;
|
|
46
|
+
watchBuilderFallback(): void;
|
|
47
|
+
watchSelectedRecord(newValue: Record | string, oldValue: Record): void;
|
|
48
48
|
private getContent;
|
|
49
49
|
private setValue;
|
|
50
50
|
private getValue;
|
package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default class EzGridCustomCellEditor extends EzCellEditor {
|
|
|
10
10
|
private _params;
|
|
11
11
|
private _defaultGui;
|
|
12
12
|
private _value;
|
|
13
|
+
private _customGui;
|
|
13
14
|
init(params: ICellEditorParams & CustomParamsEditor): void;
|
|
14
15
|
private getDefaultGui;
|
|
15
16
|
getGui(): HTMLElement;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,c as e,g as o}from"./p-23a36bb6.js";import{C as n}from"./p-4607fb89.js";import{ObjectUtils as l,HTMLBuilder as h,StringUtils as a,ElementIDUtils as d}from"@sankhyalabs/core";import{A as c}from"./p-2187f86c.js";import"./p-ab574d59.js";import"./p-b853763b.js";const r=class{constructor(i){t(this,i),this.gui=void 0,this.customEditor=void 0,this.formViewField=void 0,this.value=void 0,this.detailContext=void 0,this.builderFallback=void 0,this.selectedRecord=void 0}watchValue(){this.handleValue(this.gui)}watchCustomEditor(){this.getContent()}watchFormViewField(t,i){l.equals(t,i)||this.getContent()}watchDetailContext(){this.getContent()}watchBuilderFallback(){this.getContent()}watchSelectedRecord(t,i){t.__record__id__!=i.__record__id__&&this.getContent()}async setFocus(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setFocus)||void 0===i||i.call(t)}async setBlur(){var t,i;null===(i=null===(t=this.gui)||void 0===t?void 0:t.setBlur)||void 0===i||i.call(t)}async isInvalid(){var t,i;return(null===(i=null===(t=this.gui)||void 0===t?void 0:t.isInvalid)||void 0===i?void 0:i.call(t))||!1}getContent(){var t,s;const e=new Map;for(const t in this.formViewField.props)e.set(t,this.formViewField.props[t]);const o={value:this.value,name:this.formViewField.name,currentEditor:this.builderFallback(this.formViewField),setValue:t=>this.setValue(t),getValue:this.getValue,record:this.selectedRecord,editorMetadata:{label:this.formViewField.label,hidden:!1===(null===(t=this.formViewField.props)||void 0===t?void 0:t.visible),userInterface:this.formViewField.userInterface,options:null===(s=this.formViewField.props)||void 0===s?void 0:s.options,props:this.formViewField.props?e:void 0,optionLoader:this.formViewField.optionLoader},source:n.FORM,detailContext:this.detailContext};let l=this.customEditor.getEditorElement(o);return l?l instanceof HTMLElement||"string"==typeof l?("string"==typeof l&&(l=h.parseElement(l)),this.value&&l.setAttribute("value","object"==typeof this.value?this.value.value:this.value),void(this.gui=i("div",{key:a.generateUUID(),ref:t=>t&&t.appendChild(l)}))):(this.handleValue(l),void(this.gui=l)):(l=this.builderFallback(this.formViewField),this.handleValue(l),void(this.gui=l))}setValue(t){this.value=t}getValue(){return this.value}handleValue(t){var i;null===(i=t.t)||void 0===i||i.forEach((t=>{t.i.value=this.value}))}componentWillLoad(){this.getContent()}render(){return i(s,null,this.gui)}static get watchers(){return{value:["watchValue"],customEditor:["watchCustomEditor"],formViewField:["watchFormViewField"],detailContext:["watchDetailContext"],builderFallback:["watchBuilderFallback"],selectedRecord:["watchSelectedRecord"]}}},u=class{constructor(i){t(this,i),this.saveEdition=e(this,"saveEdition",7),this.cancelEdition=e(this,"cancelEdition",7),this._newValue=void 0,this.value=void 0,this.styled=void 0}async applyFocusSelect(){this.calcSizeInput(this.value,!0)}calcSizeInput(t,i=!1){var s,e;const o=null===(e=null===(s=this._inputElement)||void 0===s?void 0:s.shadowRoot)||void 0===e?void 0:e.querySelector("input");if(null!=o){const s=this.getWidthValue(t);o.style.width=s+"px",i&&setTimeout((()=>o.select()),100)}}getWidthValue(t){if(null!=this._valueBasis){const i=this._valueBasis;if(null!=t){const s=2;return i.innerHTML=t,i.clientWidth>0?i.clientWidth+s:s}i.innerHTML=""}return 0}setStyledInput(){var t,i;let s="",e="",o="";null!=this.styled&&(s=this.styled.fontSize,e=this.styled.fontWeight,o=this.styled.fontFamily);const n=null===(i=null===(t=this._inputElement)||void 0===t?void 0:t.shadowRoot)||void 0===i?void 0:i.querySelector("input");null!=n&&(n.style.fontSize=s,n.style.fontWeight=e,n.style.fontFamily=o);const l=this._valueBasis;null!=l&&(l.style.fontSize=s,l.style.fontWeight=e,l.style.fontFamily=o)}handleSaveEdition(){this._newValue?this.saveEdition.emit({value:this.value,newValue:this._newValue}):c.alert("Aviso","Não é possível salvar um campo em branco.").then((()=>{this.setNewValue(this.value,!0)}))}handleCancelEdition(){this.cancelEdition.emit()}setNewValue(t,i=!1){this._newValue=t,this.calcSizeInput(this._newValue,i)}componentDidLoad(){this.applyFocusSelect(),this.setNewValue(this.value)}componentDidRender(){this.setStyledInput()}render(){return d.addIDInfoIfNotExists(this._element,"input"),i(s,null,i("span",{class:"text-edit__hidden-value",ref:t=>this._valueBasis=t}),i("ez-text-input",{"data-element-id":d.getInternalIDInfo("textInput"),onInput:()=>{this.calcSizeInput(this._newValue)},class:"text-edit__form-input",value:this._newValue,ref:t=>this._inputElement=t,mode:"slim",onEzChange:t=>this.setNewValue(null==t?void 0:t.detail),noBorder:!0}),i("ez-button",{class:"text-edit__icon-check",mode:"icon",iconName:"check",size:"small",onClick:()=>{this.handleSaveEdition()}}),i("ez-button",{class:"text-edit__icon-close",mode:"icon",iconName:"close",size:"small",onClick:()=>{this.handleCancelEdition()}}))}get _element(){return o(this)}};u.style=":host{display:flex;align-items:center;gap:5px}.text-edit__form-input{width:auto;--ez-text-input__input--padding:0px}.text-edit__hidden-value{visibility:hidden;position:absolute;white-space:nowrap;z-index:-1;top:0;left:0}";export{r as ez_custom_form_input,u as ez_text_edit}
|