Liferay.Loader.define("style-book-web@2.0.76/js/StylebookEntryActionDropdownPropsTransformer",["module","exports","require","frontend-js-web","./openDeleteStyleBookModal"],(function(e,t,o){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function propsTransformer(t){let{actions:o,portletNamespace:r}=t,n=function _objectWithoutProperties(e,t){if(null==e)return{};var o,r,n=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(t,["actions","portletNamespace"]);const _onClick=(t,o)=>{var n;const a=null===(n=o.data)||void 0===n?void 0:n.action;a&&(t.preventDefault(),e[a](o.data,r))};return _objectSpread(_objectSpread({},n),{},{actions:(o||[]).map((e=>{var t;return _objectSpread(_objectSpread({},e),{},{items:null===(t=e.items)||void 0===t?void 0:t.map((e=>_objectSpread(_objectSpread({},e),{},{onClick:t=>_onClick(t,e)}))),onClick:e.items?()=>{}:t=>_onClick(t,e)})}))})};var r=o("frontend-js-web"),n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(o("./openDeleteStyleBookModal"));function ownKeys(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(o),!0).forEach((function(t){_defineProperty(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function _defineProperty(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const e={copyStyleBookEntry({copyStyleBookEntryURL:e}){submitForm(document.hrefFm,e)},deleteStyleBookEntry({deleteStyleBookEntryURL:e}){(0,n.default)({onDelete:()=>{submitForm(document.hrefFm,e)}})},deleteStyleBookEntryPreview({deleteStyleBookEntryPreviewURL:e}){submitForm(document.hrefFm,e)},discardDraftStyleBookEntry({discardDraftStyleBookEntryURL:e}){submitForm(document.hrefFm,e)},markAsDefaultStyleBookEntry({markAsDefaultStyleBookEntryURL:e,message:t}){(0,r.openConfirmModal)({message:t,onConfirm:t=>{t&&submitForm(document.hrefFm,e)}})},renameStyleBookEntry({styleBookEntryId:e,styleBookEntryName:t,updateStyleBookEntryURL:o},n){(0,r.openSimpleInputModal)({dialogTitle:Liferay.Language.get("rename-style-book"),formSubmitURL:o,idFieldName:"id",idFieldValue:e,mainFieldLabel:Liferay.Language.get("name"),mainFieldName:"name",mainFieldPlaceholder:Liferay.Language.get("name"),mainFieldValue:t,namespace:n})},updateStyleBookEntryPreview({itemSelectorURL:e,styleBookEntryId:t},o){(0,r.openSelectionModal)({onSelect:e=>{if(e){const n=JSON.parse(e.value),a=document.getElementById("".concat(o,"styleBookEntryPreviewFm"));a&&((0,r.setFormValues)(a,{fileEntryId:n.fileEntryId,styleBookEntryId:t}),submitForm(a))}},selectEventName:"".concat(o,"changePreview"),title:Liferay.Language.get("style-book-thumbnail"),url:e})}}}}));
//# sourceMappingURL=StylebookEntryActionDropdownPropsTransformer.js.map