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