UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

6 lines (5 loc) 3.39 kB
var p=Object.defineProperty;var a=(o,e)=>p(o,"name",{value:e,configurable:!0});var l,c=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var v=o.length-1;v>=0;v--)(r=o[v])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};import{component as f,watch as g}from"jodit/esm/core/decorators/index.js";import{assert as d}from"jodit/esm/core/helpers/utils/assert.js";import{Icon as x,UIButtonGroup as h,UIGroup as w,UISelect as m}from"jodit/esm/core/ui/index.js";let u=(l=class extends w{className(){return"UIBrowserSettings"}render(){return`<div> <div class="${this.getFullElName("close")}">${x.get("cancel")}</div> <div class="${this.getFullElName("title")}">~Settings~</div> <div class="${this.getFullElName("options")}"></div> </div>`}appendChildToContainer(e){const t=this.getElm("options");d(t!=null,"options element does not exists"),t.appendChild(e)}afterSetMod(e,t){e==="hidden"&&t===!1&&this.generateSettings(),super.afterSetMod(e,t)}constructor(e,t){super(e),this.state=t;const i=this.getElm("close");d(i!=null,"close element does not exists"),e.e.on(i,"click",()=>{this.state.showSettings=!1})}onChangeView(){const e=this.getElm("tile-size");e&&(e.style.display=this.state.view==="tiles"?"block":"none")}generateSettings(){this.clear();const{j:e}=this;this.append([new h(e,{label:"Theme",name:"theme",value:this.state.theme,radio:!0,options:[{value:"default",text:"Light"},{value:"dark",text:"Dark"}],onChange:a(t=>{if(this.state.theme!=="default"&&this.state.theme!=="dark"){this.state.theme="default";return}this.state.theme=t[0].value},"onChange")}),new h(e,{label:"Show favorites",name:"showFavorites",value:this.state.showFavorites,radio:!0,options:[{value:!0,text:"Show"},{value:!1,text:"Hide"}],onChange:a(t=>{this.state.showFavorites=t[0].value},"onChange")}),new h(e,{label:"View",name:"view",value:this.state.view,radio:!0,options:[{value:"tiles",text:"Tiles"},{value:"list",text:"List"},{value:"compact",text:"Compact"}],onChange:a(t=>{this.state.view=t[0].value},"onChange")}),new h(e,{label:"Folders position",name:"foldersPosition",value:this.state.foldersPosition,radio:!0,options:[{value:"top",text:"Top"},{value:"bottom",text:"Bottom"},{value:"default",text:"Default"}],onChange:a(t=>{this.state.foldersPosition=t[0].value},"onChange")}),new m(e,{label:"Sort by",name:"sort-by",value:this.state.sortBy,options:[{value:"changed-asc",text:e.i18n("Sort by changed")+"(\u2B06)"},{value:"changed-desc",text:e.i18n("Sort by changed")+"(\u2B07)"},{value:"name-asc",text:e.i18n("Sort by name")+"(\u2B06)"},{value:"name-desc",text:e.i18n("Sort by name")+"(\u2B07)"},{value:"size-asc",text:e.i18n("Sort by size")+"(\u2B06)"},{value:"size-desc",text:e.i18n("Sort by size")+"(\u2B07)"}],onChange:a(t=>{this.state.sortBy=t},"onChange")}),new m(e,{label:"Tile size",name:"tile-size",value:this.state.tileSize,options:[{value:"xsmall",text:"Extra small"},{value:"small",text:"Small"},{value:"default",text:"Default"},{value:"large",text:"Large"},{value:"xlarge",text:"Extra large"}],onChange:a(t=>{this.state.tileSize=t},"onChange")})]),this.onChangeView()}},a(l,"UIBrowserSettings"),l);c([g("state.view")],u.prototype,"onChangeView",null),u=c([f],u);export{u as UIBrowserSettings};