File "SettingsTable-1.0.13-470c0145.js"

Full Path: /home/vantageo/public_html/cache/cache/cache/.wp-cli/wp-content/plugins/wp-data-access/assets/dist/SettingsTable-1.0.13-470c0145.js
File size: 26.07 KB
MIME-type: text/plain
Charset: utf-8

import{r as L,j as e,bH as U,bW as G,bI as ce,l as x,cN as ie,ch as N,cd as V,bz as q,bR as S,cg as B,cO as ee,cP as _,M as I}from"./main-1.0.13.js";import{a as le,c as k,B as C,e as D,l as te,T as se}from"./main-1.0.13-4cbe632d.js";import{u as ue}from"./useStoreTable-1.0.13-383948b4.js";import{u as de}from"./useTableUpdater-1.0.13-f903232c.js";import{c as pe}from"./index-1.0.13-93f67fc3.js";import{A as T,a as A}from"./AccordionSummary-1.0.13-0885ed32.js";import{A as P,L as z}from"./Link-1.0.13-03de5435.js";import{F as d,a as u,T as J,S as re,C as he}from"./TextField-1.0.13-7258d491.js";import{R as Q}from"./RadioGroup-1.0.13-1d87a31c.js";import{F as c}from"./FormControlLabel-1.0.13-143a10df.js";import{R as O}from"./Radio-1.0.13-befab7cd.js";import{S as j}from"./settings-1.0.13-650559d5.js";import{D as xe,T as ae,a as W}from"./DefaultWhere-1.0.13-d139ab5a.js";import{g as je,h as me}from"./index.esm-1.0.13-0afa0259.js";import{M}from"./MenuItem-1.0.13-e7719456.js";import{I as fe}from"./iconBase-1.0.13-98e06aa9.js";import{M as ge}from"./Menu-1.0.13-2a06ef00.js";import{P as X}from"./PremiumFeature-1.0.13-d257b3ff.js";import{A as we}from"./AdminTheme-1.0.13-a1e60de2.js";import{C as H}from"./CssUnitTextField-1.0.13-9657903d.js";import{L as ve}from"./useMobilePicker-1.0.13-30bb98f7.js";import{B as ne}from"./useScreenSize-1.0.13-fa31f819.js";import"./Close-1.0.13-b137ce2f.js";import"./useSlot-1.0.13-62ad37b6.js";import"./DialogContent-1.0.13-5873ffb9.js";import"./Tabs-1.0.13-f71c8d5c.js";import"./InputAdornment-1.0.13-83724c3f.js";const Ce=({appId:r,tableSettings:n,metaData:s,updateTableSettings:t})=>{const i=le(),o=de(r),l=(f,p)=>{const a=pe(n);a.largeTableSupport.saved=f,a.largeTableSupport.actual=p,x.debug(a),i(ie({appId:r,tableSettings:a})),o(!0)},[m,w]=L.useState(!1);return e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Large table support"}),e.jsxs(P,{children:[e.jsx(d,{children:e.jsxs(Q,{sx:{flexDirection:"column"},children:[e.jsx(c,{control:e.jsx(O,{checked:(n==null?void 0:n.largeTableSupport.saved)===U.DISABLED,onChange:f=>{l(U.DISABLED,G.DISABLED),f.stopPropagation()}}),value:"disable",label:"Disable large table support"},"disable"),e.jsx(c,{control:e.jsx(O,{checked:(n==null?void 0:n.largeTableSupport.saved)===U.ENABLED,onChange:f=>{l(U.ENABLED,G.ENABLED),f.stopPropagation()}}),value:"enable",label:"Enable large table support"},"enable"),e.jsx(c,{control:e.jsx(O,{checked:(n==null?void 0:n.largeTableSupport.saved)===U.AUTO,onChange:f=>{const p=ce(s);l(U.AUTO,p),f.stopPropagation()}}),value:"auto",label:"Let the server decide (default)"},"auto")]})}),e.jsxs("fieldset",{className:"pp-fieldset",style:{display:n.largeTableSupport.actual===G.DISABLED?"none":"block",marginTop:"20px",marginBottom:"40px",padding:"20px"},children:[e.jsx("legend",{children:"Additional settings"}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:n.largeTableSupport.skipCount,onChange:(f,p)=>{t("largeTableSupport.skipCount",p),f.stopPropagation()}}),label:"Skip row count on filter updates"}),e.jsx(u,{children:"Skips all SQL count statements. Can boost performance for large tables dramatically. Results in a poorer user feedback."})]})]}),e.jsxs(u,{component:"div",sx:{marginTop:"20px",marginBottom:"10px","& ul":{margin:0,padding:"0 0 0 20px"}},children:[e.jsx(C,{children:e.jsxs(z,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>w(!m),children:[e.jsx(D,{}),"What does large table support do?"]})}),m&&e.jsxs("ul",{style:{marginTop:"20px",marginBottom:"30px",listStyle:"disc",padding:"0 40px"},children:[e.jsx("li",{children:"Enables row count estimation"}),e.jsx("li",{children:"Requires the user to press enter on search"}),e.jsx("li",{children:"Sets pagination to compact"}),e.jsx("li",{children:"Removes the last page pagination button"}),e.jsx("li",{children:"Reduces network traffic and server load"})]})]}),e.jsx(u,{children:"Please reload the table or page after adjusting large table support settings to ensure the correct row count is applied."})]})]})},be=({tableSettings:r,updateTableSettings:n})=>{var s,t;return e.jsxs(T,{disableGutters:!0,defaultExpanded:!1,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Responsiveness"}),e.jsx(P,{children:e.jsxs(d,{children:[e.jsxs(Q,{sx:{flexDirection:"row"},children:[e.jsx(c,{control:e.jsx(O,{checked:((s=r==null?void 0:r.design)==null?void 0:s.overflow)===N.RESPONSIVE,onChange:i=>{n("design.overflow",N.RESPONSIVE),i.stopPropagation()}}),value:"responsive",label:"Auto column hiding"},"responsive"),e.jsx(c,{control:e.jsx(O,{checked:((t=r==null?void 0:r.design)==null?void 0:t.overflow)!==N.RESPONSIVE,onChange:i=>{n("design.overflow",N.SCROLL),i.stopPropagation()}}),value:"scroll",label:"Horizontal scrollbar"},"scroll")]}),e.jsx(u,{children:"Behaviour when table content overflows available space."})]})})]})},Ee=({tableSettings:r,updateTableSettings:n})=>e.jsxs(T,{disableGutters:!0,defaultExpanded:!1,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Density"}),e.jsxs(P,{children:[e.jsxs(d,{children:[e.jsxs(Q,{sx:{display:"grid",gridTemplateColumns:"auto auto auto",alignItems:"center"},children:[e.jsx(c,{control:e.jsx(O,{checked:(r==null?void 0:r.design.density.default)===V.COMPACT,onChange:s=>{n("design.density.default",V.COMPACT),s.stopPropagation()}}),value:"compact",label:"Compact"},"compact"),e.jsx(c,{control:e.jsx(O,{checked:(r==null?void 0:r.design.density.default)===V.COMFORTABLE,onChange:s=>{n("design.density.default",V.COMFORTABLE),s.stopPropagation()}}),value:"comfortable",label:"Comfortable"},"comfortable"),e.jsx(c,{control:e.jsx(O,{checked:(r==null?void 0:r.design.density.default)===V.SPACIOUS,onChange:s=>{n("design.density.default",V.SPACIOUS),s.stopPropagation()}}),value:"spacious",label:"Spacious"},"spacious")]}),e.jsx(u,{children:"Default spacing on page load."})]}),e.jsx(d,{fullWidth:!0,sx:{marginTop:"20px"},children:e.jsx(c,{control:e.jsx(j,{checked:r==null?void 0:r.design.density.userCanChange,onChange:(s,t)=>{n("design.density.userCanChange",t),s.stopPropagation()}}),label:"Allow user to change density"})})]})]}),ye=({hasPrimaryKey:r,tableSettings:n,metaData:s,updateTableSettings:t})=>{var l,m,w,f,p,a,h,g,F,R;const[i,o]=L.useState(!1);return e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Row actions"}),e.jsxs(P,{children:[e.jsxs(C,{sx:{display:"grid"},children:[((l=s==null?void 0:s.privs)==null?void 0:l.insert)&&r&&e.jsxs(d,{children:[e.jsx(c,{control:e.jsx(j,{disabled:!((m=s==null?void 0:s.privs)!=null&&m.insert)||!r,checked:(w=n==null?void 0:n.transactions)==null?void 0:w.insert,onChange:(b,E)=>{t("transactions.insert",E),b.stopPropagation()}}),label:"Allow insert"}),e.jsx(u,{children:"Adds an insert button to the table toolbar."})]}),e.jsxs(d,{children:[e.jsx(c,{control:e.jsx(j,{checked:n==null?void 0:n.viewLink,onChange:(b,E)=>{t("viewLink",E),b.stopPropagation()}}),label:"Allow viewing"}),e.jsx(u,{children:"Adds a view icon to each row."})]}),e.jsxs(C,{sx:{display:"grid",gridTemplateColumns:"auto auto",alignItems:"center"},children:[e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:n==null?void 0:n.detailLink,disabled:((f=n==null?void 0:n.design)==null?void 0:f.overflow)!==N.RESPONSIVE,onChange:(b,E)=>{t("detailLink",E),b.stopPropagation()}}),label:"Allow detail panel viewing"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:!1,disabled:!0,onChange:(b,E)=>{t("detailPdf",E),b.stopPropagation()}}),label:"Add PDF export icon"})})]}),e.jsx(d,{children:e.jsxs(u,{children:["Adds an expand icon to each row, allowing users to view columns in a detail panel. This feature only functions when responsiveness is set to auto column hiding.",e.jsx(e.Fragment,{children:"The PDF export is a premium feature."})]})}),((p=s==null?void 0:s.privs)==null?void 0:p.update)&&r&&e.jsxs(d,{children:[e.jsx(c,{control:e.jsx(j,{disabled:!((a=s==null?void 0:s.privs)!=null&&a.update)||!r,checked:(h=n==null?void 0:n.transactions)==null?void 0:h.update,onChange:(b,E)=>{t("transactions.update",E),b.stopPropagation()}}),label:"Allow update"}),e.jsx(u,{children:"Adds an update icon to each table row."})]}),((g=s==null?void 0:s.privs)==null?void 0:g.delete)&&r&&e.jsxs(d,{children:[e.jsx(c,{control:e.jsx(j,{disabled:!((F=s==null?void 0:s.privs)!=null&&F.delete)||!r,checked:(R=n==null?void 0:n.transactions)==null?void 0:R.delete,onChange:(b,E)=>{t("transactions.delete",E),b.stopPropagation()}}),label:"Allow delete"}),e.jsx(u,{children:"Adds a delete icon to each table row."})]})]}),e.jsxs(u,{component:"div",sx:{marginTop:"30px"},children:[e.jsxs(z,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>o(!i),children:[e.jsx(D,{}),"What are row actions?"]}),i&&e.jsxs(C,{sx:{marginTop:"20px"},children:["Row actions enable users to perform specific actions on individual rows. The ",e.jsx("strong",{children:"view"})," action is always available. To perform transactions such as ",e.jsx("strong",{children:"insert"}),", ",e.jsx("strong",{children:"update"}),", and ",e.jsx("strong",{children:"delete"}),", the server requires a valid primary key. If these actions are not selectable, ensure that your table has a primary key defined. Note that transactions are not available for views."]})]})]})]})},ke=({appId:r,tableSettings:n,metaData:s,updateTableSettings:t})=>{var l,m,w,f,p,a;const[i,o]=L.useState(!1);return e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Bulk actions"}),e.jsxs(P,{children:[e.jsxs(C,{sx:{display:"grid"},children:[e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:!1,disabled:!0,onChange:(h,g)=>{h.stopPropagation()}}),label:"Export to PDF (premium feature)"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:(l=n==null?void 0:n.bulkActions)==null?void 0:l.csv,onChange:(h,g)=>{t("bulkActions.csv",g),h.stopPropagation()}}),label:"Export to CSV"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:(m=n==null?void 0:n.bulkActions)==null?void 0:m.json,onChange:(h,g)=>{t("bulkActions.json",g),h.stopPropagation()}}),label:"Export to JSON"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:!1,disabled:!0,onChange:(h,g)=>{h.stopPropagation()}}),label:"Export to Excel (premium feature)"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:(w=n==null?void 0:n.bulkActions)==null?void 0:w.xml,onChange:(h,g)=>{t("bulkActions.xml",g),h.stopPropagation()}}),label:"Export to XML"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:!q(r)&&!S(s)&&((f=n==null?void 0:n.bulkActions)==null?void 0:f.sql),disabled:q(r)||S(s),onChange:(h,g)=>{q(r)||t("bulkActions.sql",g),h.stopPropagation()}}),label:"Export to SQL"})}),e.jsx(d,{children:e.jsx(c,{control:e.jsx(j,{checked:(p=n==null?void 0:n.bulkActions)==null?void 0:p.delete,disabled:!((a=s==null?void 0:s.privs)!=null&&a.delete),onChange:(h,g)=>{t("bulkActions.delete",g),h.stopPropagation()}}),label:"Delete"})}),e.jsx(d,{children:e.jsx(u,{children:"Added to BULK ACTIONS button."})})]}),e.jsxs(u,{component:"div",sx:{marginTop:"30px"},children:[e.jsxs(z,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>o(!i),children:[e.jsx(D,{}),"What are bulk actions?"]}),i&&e.jsx(C,{sx:{marginTop:"20px"},children:"Bulk actions allow users to perform tasks on multiple rows simultaneously. Enabling this feature requires selecting at least one bulk action. Once enabled, row selection is added to the table, and a bulk actions button is included in the toolbar."})]})]})]})},Te=({tableSettings:r,updateTableSettings:n})=>e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Default where"}),e.jsx(P,{children:e.jsxs(d,{fullWidth:!0,children:[e.jsx(J,{value:r==null?void 0:r.defaultWhere,multiline:!0,fullWidth:!0,minRows:5,variant:"outlined",onClick:s=>{s.stopPropagation()},onChange:s=>{n("defaultWhere",s.target.value)}}),e.jsx(xe,{})]})})]}),oe=({tableColumns:r,orderByColumn:n,addActions:s,enableAddAction:t,onUpdate:i,onActions:o})=>{x.debug(r,n,s,t);const[l,m]=L.useState(null),w=!!l,f=a=>{m(a.currentTarget),a.stopPropagation()},p=()=>{m(null)};return e.jsxs(C,{sx:{display:"grid",gridTemplateColumns:s?"auto 100px 50px":"auto 100px",gridGap:"5px",marginBottom:"5px"},children:[e.jsxs(re,{MenuProps:{id:"pp-select-menu"},value:n.columnName,onChange:a=>{i({...n,columnName:a.target.value})},children:[e.jsx(M,{value:"",children:" "}),...r.map(a=>a.computedField!==void 0?null:e.jsx(M,{value:a.columnName,children:a.columnName}))]}),e.jsxs(re,{MenuProps:{id:"pp-select-menu"},value:n.order,onChange:a=>{i({...n,order:a.target.value==="desc"?"desc":"asc"})},children:[e.jsx(M,{value:"asc",children:"Asc"}),e.jsx(M,{value:"desc",children:"Desc"})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx(fe,{color:"primary",onClick:f,children:e.jsx(te,{})}),e.jsxs(ge,{anchorEl:l,open:w,onClose:p,sx:{zIndex:9999999999},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:[t&&e.jsxs(M,{onClick:()=>{o("add"),p()},children:[e.jsx(je,{}),e.jsx("span",{style:{marginLeft:"10px"},children:"Add column"})]}),e.jsxs(M,{onClick:()=>{o("delete"),p()},children:[e.jsx(me,{}),e.jsx("span",{style:{marginLeft:"10px"},children:"Delete column"})]})]})]})]})},Ae=({tableSettings:r,tableColumns:n,updateTableSettings:s})=>{const[t,i]=L.useState(r.defaultOrderBy.length===0);return e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Default order by"}),e.jsxs(P,{children:[Array.isArray(r.defaultOrderBy)&&e.jsxs(e.Fragment,{children:[...r.defaultOrderBy.map((o,l)=>e.jsx(oe,{tableColumns:n,orderByColumn:r.defaultOrderBy[l],addActions:!0,enableAddAction:r.defaultOrderBy.length===l+1&&!t,onUpdate:m=>{const w=[...r.defaultOrderBy];w[l]=m,s("defaultOrderBy",w)},onActions:m=>{if(m==="add")i(!0);else if(m==="delete"){const w=[...r.defaultOrderBy];w.splice(l,1),s("defaultOrderBy",w),i(w.length===0)}}},l))]}),t&&e.jsx(oe,{tableColumns:n,orderByColumn:{columnName:"",order:"asc"},addActions:r.defaultOrderBy.length>0,enableAddAction:!1,onUpdate:o=>{const l=[...r.defaultOrderBy];l.push({columnName:o.columnName,order:o.order}),s("defaultOrderBy",l),i(!1)},onActions:o=>{o==="delete"&&i(!1)}}),e.jsx(d,{fullWidth:!0,children:e.jsx(u,{children:"Defines the default ordering. The user can change the default ordering if sorting is enabled for one or more columns."})})]})]})},Pe=({tableStore:r,updateTableSettings:n})=>{var f,p,a,h,g,F,R,b,E,Y,Z,K,$;const s=r.table,i=r.state.masterDetailConditions!==void 0,[o,l]=L.useState(!1),[m,w]=L.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(T,{disableGutters:!0,defaultExpanded:!1,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Global filter"}),e.jsxs(P,{children:[e.jsxs(C,{children:[e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(f=s==null?void 0:s.searchSettings)==null?void 0:f.enableGlobalSearch,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Enable global filter"}),e.jsx(u,{children:"Adds a search box to the table header."})]}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(p=s==null?void 0:s.searchSettings)==null?void 0:p.forceSearch,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Show empty table on startup"}),e.jsx(u,{children:"Forces user to perform a search on page load."})]}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(a=s==null?void 0:s.searchSettings)==null?void 0:a.highlightMatches,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Highlight matches"}),e.jsx(u,{children:"Filter match highlighting."})]})]}),e.jsxs(u,{component:"div",sx:{marginTop:"30px"},children:[e.jsxs(z,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>l(!o),children:[e.jsx(D,{}),"What is a global filter?"]}),o&&e.jsx(C,{sx:{marginTop:"20px"},children:"The global filter enables users to perform wildcard searches across all searchable columns. It can be disabled entirely or selectively for specific columns. To disable the global filter for specific columns, navigate to the Table Builder's columns menu and deselect the searchable option."})]}),e.jsx(X,{single:!1})]})]}),e.jsxs(T,{disableGutters:!0,defaultExpanded:!1,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Column filters"}),e.jsxs(P,{children:[e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(h=s==null?void 0:s.searchSettings)==null?void 0:h.searchForm,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Enable column filters"}),e.jsx(u,{children:"Disable to hide all column filters."})]}),((g=s==null?void 0:s.searchSettings)==null?void 0:g.searchForm)===!0&&e.jsxs(e.Fragment,{children:[e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:((F=s==null?void 0:s.searchSettings)==null?void 0:F.searchFormAlwaysOpen)||((R=s==null?void 0:s.searchSettings)==null?void 0:R.forceInline),disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Show column filters on startup"}),e.jsx(u,{children:"Effective after next page load."})]}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(b=s==null?void 0:s.searchSettings)==null?void 0:b.searchFormAlwaysOpen,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Always show column filters"}),e.jsx(u,{children:"Disables the user's possibility to toggle column filtering."})]}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{checked:(E=s==null?void 0:s.searchSettings)==null?void 0:E.cascade,disabled:!0,onChange:(v,y)=>{x.debug(y),v.stopPropagation()}}),label:"Cascade drop-down lists"}),e.jsxs(u,{children:["Updates drop-down lists on search changes. ",e.jsx("span",{style:{...((Y=s==null?void 0:s.searchSettings)==null?void 0:Y.cascade)===!0&&{color:((K=(Z=we)==null?void 0:Z.palette)==null?void 0:K.error.main)??"red"}},children:"Enabling this feature may negatively impact performance, increase server load, and generate additional network traffic."})]})]}),e.jsx(C,{sx:{marginTop:"20px"},children:e.jsxs(d,{fullWidth:!0,children:[e.jsxs(ae,{fullWidth:!0,color:"primary",exclusive:!0,value:i?B.HEADER:($=s==null?void 0:s.searchSettings)==null?void 0:$.searchFormPosition,onChange:(v,y)=>{v.stopPropagation()},children:[e.jsx(W,{value:B.TOP,disabled:i,children:"Above"},B.TOP),e.jsx(W,{value:B.RIGHT,disabled:i,children:"Right"},B.RIGHT),e.jsx(W,{value:B.BOTTOM,disabled:i,children:"Below"},B.BOTTOM),e.jsx(W,{value:B.LEFT,disabled:i,children:"Left"},B.LEFT),e.jsx(W,{value:B.HEADER,children:"Header"},B.HEADER)]}),e.jsx(u,{children:"Position of the column filters relative to the data table."})]})}),e.jsxs(C,{sx:{marginTop:"30px","& .MuiFormControl-root":{width:"100%"}},children:[e.jsx(H,{label:"Column filters width",textField:{cssValue:s==null?void 0:s.searchSettings.searchFormWidth,cssUnit:s==null?void 0:s.searchSettings.searchFormWidthUnit},defaultValue:{cssValue:ee.searchFormWidth,cssUnit:ee.searchFormWidthUnit},updateSettings:v=>{x.debug(v)}}),e.jsx(d,{children:e.jsx(u,{children:"Exact filter width if column filters position is LEFT or RIGHT. Minimum filter width if column filters position is ABOVE or BELOW. Does not affect column filters width in HEADER."})})]})]}),e.jsxs(u,{component:"div",sx:{marginTop:"30px"},children:[e.jsxs(z,{sx:{textDecoration:"none",cursor:"pointer",display:"inline-flex","& svg":{fontSize:"1rem",marginRight:"2px"}},onClick:()=>w(!m),children:[e.jsx(D,{}),"What are column filters?"]}),m&&e.jsx(C,{sx:{marginTop:"20px"},children:"Column filters empower users to search within specific columns. You can activate these filters from the Table Builder's columns menu. Click on a column, open column actions, enable column filtering, and choose your preferred filter type."})]})]})]})]})},Be=({tableSettings:r,updateTableSettings:n})=>{const[s,t]=L.useState(void 0),i=o=>()=>{const l=r.pagination.rowsPerPage.filter(m=>m!==o);n("pagination.rowsPerPage",l)};return e.jsxs(T,{disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Pagination"}),e.jsxs(P,{children:[e.jsxs(d,{fullWidth:!0,sx:{marginBottom:"30px"},children:[e.jsxs(ae,{fullWidth:!0,color:"primary",exclusive:!0,value:r.pagination.position,onChange:(o,l)=>{l!==null&&n("pagination.position",l)},children:[e.jsx(W,{value:"bottom",children:"bottom"}),e.jsx(W,{value:"top",children:"top"}),e.jsx(W,{value:"both",children:"both"})]}),e.jsx(u,{children:"Pagination position."})]}),e.jsx(J,{fullWidth:!0,type:"number",label:"Default page size",value:r.pagination.defaultPageSize,disabled:!0,onChange:o=>{x.debug(o)},sx:{marginBottom:"30px"},helperText:"Effective after next table load."}),e.jsxs("fieldset",{className:"pp-fieldset",style:{width:"100%",margin:0,padding:0,marginBottom:"30px"},children:[e.jsx(d,{sx:{marginBottom:"10px"},children:e.jsx(u,{children:"Rows per page"})}),e.jsx(C,{sx:{width:"100%",display:"grid",gridTemplateColumns:"repeat(4, 25%)",justifyContent:"center",alignItems:"center",margin:0,padding:0,"& li":{margin:"0 10px 10px 10px",padding:0},"& li .MuiChip-label":{width:"40px",textAlign:"right",overflow:"visible"}},component:"ul",children:r.pagination.rowsPerPage.map((o,l)=>e.jsx(ve,{children:e.jsx(he,{disabled:!0,label:o,onDelete:i(o)})},l))}),e.jsx(d,{fullWidth:!0,children:e.jsx(u,{children:"Click the delete icon to remove a value or add a new values below."})}),e.jsxs(C,{sx:{margin:"10px",display:"grid",gridTemplateColumns:"auto auto auto",gap:"5px"},children:[e.jsx(J,{type:"number",label:"New value",value:s??"",disabled:!0,onChange:o=>{x.debug(o)}}),e.jsx(se,{title:"Add new value to list",children:e.jsx("span",{children:e.jsx(ne,{color:"primary",variant:"contained",disabled:!0,onClick:()=>{},children:"Add"})})}),e.jsx(se,{title:"Reset to default values",children:e.jsx("span",{children:e.jsx(ne,{color:"primary",variant:"outlined",disabled:!0,onClick:()=>{},children:"Reset"})})})]})]}),e.jsx(d,{fullWidth:!0,children:e.jsx(c,{control:e.jsx(j,{disabled:!0,checked:r.pagination.showFirstButton,onChange:(o,l)=>{x.debug(o,l)}}),label:"Show first button"})}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{disabled:!0,checked:r.pagination.showLastButton&&(r.largeTableSupport.actual===G.DISABLED||r.largeTableSupport.skipCount===!1),onChange:(o,l)=>{x.debug(o,l)}}),label:"Show last button"}),e.jsx(u,{children:"By default disabled with large table support and row count skipping."})]}),e.jsxs(d,{fullWidth:!0,children:[e.jsx(c,{control:e.jsx(j,{disabled:!0,checked:r.pagination.showCompactButtons||r.largeTableSupport.actual===G.ENABLED,onChange:(o,l)=>{x.debug(o,l)}}),label:"Show compact buttons"}),e.jsx(u,{children:"By default enabled when large table support is enabled."})]}),e.jsx(X,{single:!1})]})]})},Oe=({tableSettings:r,updateTableSettings:n})=>e.jsxs(T,{sx:{display:"none"},disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Processing"}),e.jsx(P,{children:e.jsxs(d,{children:[e.jsxs(Q,{sx:{flexDirection:"row"},children:[e.jsx(c,{control:e.jsx(O,{checked:(r==null?void 0:r.processing)===_.SERVERSIDE,onChange:s=>{n("processing",_.SERVERSIDE),s.stopPropagation()}}),value:"serverside",label:"Server-side"},"serverside"),e.jsx(c,{control:e.jsx(O,{checked:(r==null?void 0:r.processing)===_.CLIENTSIDE,onChange:s=>{n("processing",_.CLIENTSIDE),s.stopPropagation()}}),value:"clientside",label:"Client-side"},"clientside")]}),e.jsx(u,{children:"Use server-side for large tables and views, use client-side for quick analyses of small tables and views"})]})})]}),Le=({tableSettings:r,metaData:n,updateTableSettings:s})=>{var t;return!((t=n==null?void 0:n.privs)!=null&&t.update)||n.primary_key.length===0?null:e.jsxs(T,{defaultExpanded:!1,disableGutters:!0,children:[e.jsx(A,{expandIcon:e.jsx(k,{}),children:"Inline field settings"}),e.jsxs(P,{sx:{display:"grid"},children:[e.jsxs(d,{children:[e.jsxs(C,{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px",marginBottom:"10px"},children:[e.jsx(H,{label:"Padding top",textField:{cssValue:r.inlineEditing.spacing.fieldTop,cssUnit:r.inlineEditing.spacing.fieldTopUnit},defaultValue:{cssValue:I.table.inlineEditing.spacing.fieldTop,cssUnit:I.table.inlineEditing.spacing.fieldTopUnit},updateSettings:i=>{x.debug(i)}}),e.jsx(H,{label:"Padding bottom",textField:{cssValue:r.inlineEditing.spacing.fieldBottom,cssUnit:r.inlineEditing.spacing.fieldBottomUnit},defaultValue:{cssValue:I.table.inlineEditing.spacing.fieldBottom,cssUnit:I.table.inlineEditing.spacing.fieldBottomUnit},updateSettings:i=>{x.debug(i)}}),e.jsx(H,{label:"Padding left",textField:{cssValue:r.inlineEditing.spacing.fieldLeft,cssUnit:r.inlineEditing.spacing.fieldLeftUnit},defaultValue:{cssValue:I.table.inlineEditing.spacing.fieldLeft,cssUnit:I.table.inlineEditing.spacing.fieldLeftUnit},updateSettings:i=>{x.debug(i)}}),e.jsx(H,{label:"Padding right",textField:{cssValue:r.inlineEditing.spacing.fieldRight,cssUnit:r.inlineEditing.spacing.fieldRightUnit},defaultValue:{cssValue:I.table.inlineEditing.spacing.fieldRight,cssUnit:I.table.inlineEditing.spacing.fieldRightUnit},updateSettings:i=>{x.debug(i)}})]}),e.jsx(u,{children:"Space added to inline fields."})]}),e.jsx(X,{single:!1})]})]})},is=({appId:r,metaData:n})=>{x.debug(r);const s=le(),t=de(r),i=ue(r),o=i==null?void 0:i.table,l=i==null?void 0:i.columns,m=L.useMemo(()=>l.filter(a=>a.computedField!==void 0),[l]);x.debug("storeColumnSettings",m);const w=L.useMemo(()=>{const a=l.map(h=>h.columnName);return x.debug(a),n.primary_key.length>0&&n.primary_key.filter(h=>a.includes(h)).length===n.primary_key.length},[l,n.primary_key]);x.debug("hasPrimaryKey",w);const f=(a,h,g)=>{const[F,...R]=h.split(".");return{...a,[F]:R.length?f(a[F],R.join("."),g):g}},p=(a,h)=>{x.debug(a,h);const g=f(o,a,h);x.debug(g),s(ie({appId:r,tableSettings:g})),t(!0)};return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{appId:r,tableSettings:o,metaData:n,updateTableSettings:p}),e.jsx(Be,{tableSettings:o,updateTableSettings:p}),e.jsx(Pe,{tableStore:i,updateTableSettings:p}),e.jsx(Oe,{tableSettings:o,updateTableSettings:p}),e.jsx(ye,{hasPrimaryKey:w,tableSettings:o,metaData:n,updateTableSettings:p}),e.jsx(ke,{appId:r,tableSettings:o,metaData:n,updateTableSettings:p}),q(r)&&e.jsxs(e.Fragment,{children:[e.jsx(Te,{tableSettings:o,updateTableSettings:p}),e.jsx(Ae,{tableSettings:o,tableColumns:l,updateTableSettings:p})]}),e.jsx(be,{tableSettings:o,updateTableSettings:p}),e.jsx(Ee,{tableSettings:o,updateTableSettings:p}),e.jsx(Le,{tableSettings:o,updateTableSettings:p,metaData:n})]})};export{is as default};