Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/KeyValue/KeyValue.es",["module","exports","require","data-engine-js-components-web","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es","../Text/Text.es","../hooks/useSyncValue.es"],(function(e,a,r){var n;window;{Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var t=r("data-engine-js-components-web"),l=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var a=i();if(a&&a.has(e))return a.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var l=n?Object.getOwnPropertyDescriptor(e,t):null;l&&(l.get||l.set)?Object.defineProperty(r,t,l):r[t]=e[t]}r.default=e,a&&a.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("../FieldBase/ReactFieldBase.es"),u=(n=r("../Text/Text.es"))&&n.__esModule?n:{default:n},c=r("../hooks/useSyncValue.es");function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function s(){return(s=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,a){if(null==e)return{};var r,n,t=function(e,a){if(null==e)return{};var r,n,t={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],a.indexOf(r)>=0||(t[r]=e[r]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[n],a.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(t[r]=e[r])}return t}const e=e=>{let{allowSpecialCharacters:a,className:r,disabled:n,onChange:o,value:u}=e,c=d(e,["allowSpecialCharacters","className","disabled","onChange","value"]);return l.default.createElement("div",{className:"active form-text key-value-editor"},l.default.createElement("label",{className:"control-label key-value-label"},"key-value-reference-input"===r?Liferay.Language.get("field-reference"):Liferay.Language.get("field-name"),":"),l.default.createElement("input",s({},c,{className:"".concat(n?"disabled ":"").concat(r),onChange:({target:{value:e}})=>o(a?e:(0,t.normalizeFieldName)(e)),readOnly:n,tabIndex:n?"-1":"0",type:"text",value:u})))},y=a=>{let{allowSpecialCharacters:r,editingLanguageId:n,generateKeyword:i,keyword:f,keywordReadOnly:y,name:p,onBlur:g,onChange:m,onFocus:b,onKeywordBlur:v,onKeywordChange:w,onReferenceBlur:h,onReferenceChange:O,placeholder:C,readOnly:j,reference:k,required:B,showKeyword:L=!1,showLabel:K,spritemap:S,value:x,visible:F}=a,N=d(a,["allowSpecialCharacters","editingLanguageId","generateKeyword","keyword","keywordReadOnly","name","onBlur","onChange","onFocus","onKeywordBlur","onKeywordChange","onReferenceBlur","onReferenceChange","placeholder","readOnly","reference","required","showKeyword","showLabel","spritemap","value","visible"]);const[P,R]=(0,c.useSyncValue)(f),E=(0,l.useRef)(i);return l.default.createElement(o.FieldBase,s({},N,{name:p,readOnly:j,required:B,showLabel:K,spritemap:S,visible:F}),l.default.createElement(u.default,{editingLanguageId:n,name:"keyValueLabel".concat(p),onBlur:g,onChange:({target:{value:e}})=>{m(e),E.current&&w(r?e:(0,t.normalizeFieldName)(e),!0)},onFocus:b,placeholder:C,readOnly:j,required:B,showLabel:K,spritemap:S,syncDelay:!1,value:x,visible:F}),L&&l.default.createElement(e,{allowSpecialCharacters:r,className:"key-value-input",disabled:y,onBlur:v,onChange:e=>{E.current=!1,w(e,!1),R(e)},value:P}),l.default.createElement(e,{allowSpecialCharacters:r,className:"key-value-reference-input",onBlur:h,onChange:O,value:k}))};y.displayName="KeyValue";var f=y;a.default=f}}));
//# sourceMappingURL=KeyValue.es.js.map