관리-도구
편집 파일: Table.dpnj7vzp.js
import{u as J}from"./index.jlplx4ex.js";import{n as j}from"./numbers.busvl4mt.js";import{C as Q,b as x,d as X}from"./Caret.hnvbzqgq.js";import"./translations.b896ab1m.js";import{o as s,c as n,F as m,J as k,a as r,t as d,Q as I,_ as L,k as h,l as P,x as C,G as _,E as A,q as B,S as E,H as W,v,C as R,b as i,m as N,j as Y,B as Z,$ as q}from"./runtime-dom.esm-bundler.h3clfjuw.js";import{_ as S}from"./_plugin-vue_export-helper.oebm7xum.js";import{_ as w}from"./default-i18n.hohxoesu.js";import{C as $}from"./Tooltip.jx4casvt.js";import{T as ee}from"./Slide.dop8j51m.js";const te="all-in-one-seo-pack",se={emits:["process-additional-filters","change"],props:{additionalFilters:{type:Array,required:!0},selectedFilters:{type:Object,default(){return{}}}},data(){return{strings:{filter:w("Filter",te)}}},methods:{setInitialOptions(){this.additionalFilters.forEach(t=>{this.selectedFilters[t.name]||(this.selectedFilters[t.name]=t.options[0].value)})}},beforeMount(){this.setInitialOptions()},updated(){this.setInitialOptions()}},le={class:"aioseo-wp-additional-filters alignleft actions"},ae={class:"screen-reader-text"},ne=["name","onUpdate:modelValue","onChange"],oe=["value","innerHTML"];function ie(t,l,e,g,o,u){return s(),n("div",le,[(s(!0),n(m,null,k(e.additionalFilters,(c,f)=>(s(),n(m,{key:f},[r("label",ae,d(c.label),1),I(r("select",{name:c.name,"onUpdate:modelValue":y=>e.selectedFilters[c.name]=y,onChange:y=>t.$emit("change",{name:c.name,selectedValue:y.target.value})},[(s(!0),n(m,null,k(c.options,(y,O)=>(s(),n("option",{key:O,value:y.value,innerHTML:y.label},null,8,oe))),128))],40,ne),[[L,e.selectedFilters[c.name]]])],64))),128)),r("button",{class:"button action",onClick:l[0]||(l[0]=c=>t.$emit("process-additional-filters",e.selectedFilters))},d(o.strings.filter),1)])}const re=S(se,[["render",ie]]),M="all-in-one-seo-pack",ue={emits:["process-bulk-action"],props:{bulkOptions:{type:Array,required:!0},disableTable:Boolean},data(){return{bulkAction:"-1",strings:{bulkActions:w("Bulk Actions",M),apply:w("Apply",M)}}},watch:{bulkOptions(t){t.find(l=>l.value===this.bulkAction)===void 0&&(this.bulkAction="-1")}}},ce={class:"aioseo-wp-bulk-actions alignleft actions bulkactions"},de=["disabled"],be={value:"-1"},me=["value"],he=["disabled"];function ge(t,l,e,g,o,u){return s(),n("div",ce,[I(r("select",{"onUpdate:modelValue":l[0]||(l[0]=c=>o.bulkAction=c),disabled:e.disableTable},[r("option",be,d(o.strings.bulkActions),1),(s(!0),n(m,null,k(e.bulkOptions,(c,f)=>(s(),n("option",{key:f,value:c.value},d(c.label),9,me))),128))],8,de),[[L,o.bulkAction]]),r("button",{class:"button action",onClick:l[1]||(l[1]=c=>o.bulkAction!=="-1"?t.$emit("process-bulk-action",o.bulkAction):null),disabled:e.disableTable},d(o.strings.apply),9,he)])}const _e=S(ue,[["render",ge]]),pe="all-in-one-seo-pack",ke={props:{modelValue:Number,disableTable:Boolean},data(){return{items:[5,10,20,25,50,100],itemsPerPage:20,strings:{itemsPerPage:w("items per page",pe)}}},watch:{itemsPerPage(t){this.$emit("update:modelValue",t)}},mounted(){this.itemsPerPage=this.modelValue}},fe={class:"aioseo-wp-items-per-page alignleft"},ye=["disabled"],ve=["value"];function Pe(t,l,e,g,o,u){return s(),n("div",fe,[r("label",null,[I(r("select",{"onUpdate:modelValue":l[0]||(l[0]=c=>o.itemsPerPage=c),disabled:e.disableTable},[(s(!0),n(m,null,k(o.items,(c,f)=>(s(),n("option",{key:f,value:c},d(c),9,ve))),128))],8,ye),[[L,o.itemsPerPage]]),r("span",null,d(o.strings.itemsPerPage),1)])])}const we=S(ke,[["render",Pe]]),U="all-in-one-seo-pack",Te={emits:["paginate"],props:{totals:{type:Object,required:!0},initialPageNumber:{type:Number,default(){return 1}},disableTable:Boolean},data(){return{numbers:j,pageNumber:1,strings:{of:w("of",U),items:w("items",U)}}},watch:{initialPageNumber(t){t!==this.pageNumber&&(this.pageNumber=t)}},methods:{toPage(t){this.pageNumber=t,this.$emit("paginate",parseInt(t))}},created(){this.pageNumber=this.initialPageNumber}},Ne={class:"tablenav-pages pagination"},Ce={class:"displaying-num"},Ae={class:"pagination-links"},Fe={class:"paging-input"},Se=["max","disabled"],Be={class:"tablenav-paging-text"};function Re(t,l,e,g,o,u){return s(),n("div",Ne,[r("span",Ce,d(o.numbers.numberFormat(e.totals.total))+" "+d(o.strings.items),1),r("span",Ae,[(s(),h(B(o.pageNumber===1?"span":"a"),{href:"#",class:_(o.pageNumber===1?"tablenav-pages-navspan button disabled":"first-page button"),onClick:l[0]||(l[0]=A(c=>o.pageNumber===1?null:u.toPage(1),["prevent"]))},{default:P(()=>[C(" « ")]),_:1},8,["class"])),(s(),h(B(o.pageNumber===1?"span":"a"),{href:"#",class:_(o.pageNumber===1?"tablenav-pages-navspan button disabled":"prev-page button"),onClick:l[1]||(l[1]=A(c=>o.pageNumber===1?null:u.toPage(o.pageNumber-1),["prevent"]))},{default:P(()=>[C(" ‹ ")]),_:1},8,["class"])),r("span",Fe,[I(r("input",{class:"current-page",type:"number",name:"paged","onUpdate:modelValue":l[2]||(l[2]=c=>o.pageNumber=c),size:"2",min:1,max:e.totals.pages||1,step:1,"aria-describedby":"table-paging",onKeyup:l[3]||(l[3]=W(c=>u.toPage(o.pageNumber),["enter"])),disabled:!e.totals.pages||e.disableTable},null,40,Se),[[E,o.pageNumber]]),r("span",Be,d(o.strings.of)+" "+d(e.totals.pages||0),1)]),(s(),h(B(o.pageNumber===e.totals.pages||!e.totals.pages?"span":"a"),{href:"#",class:_(o.pageNumber===e.totals.pages||!e.totals.pages?"tablenav-pages-navspan button disabled":"next-page button"),onClick:l[4]||(l[4]=A(c=>o.pageNumber===e.totals.pages||!e.totals.pages?null:u.toPage(o.pageNumber+1),["prevent"]))},{default:P(()=>[C(" › ")]),_:1},8,["class"])),(s(),h(B(o.pageNumber===e.totals.pages||!e.totals.pages?"span":"a"),{href:"#",class:_(o.pageNumber===e.totals.pages||!e.totals.pages?"tablenav-pages-navspan button disabled":"last-page button"),onClick:l[5]||(l[5]=A(c=>o.pageNumber===e.totals.pages||!e.totals.pages?null:u.toPage(e.totals.pages),["prevent"]))},{default:P(()=>[C(" » ")]),_:1},8,["class"]))])])}const Ie=S(Te,[["render",Re]]),Oe={emits:["sort-column"],components:{CoreTooltip:$},props:{column:{type:Object,required:!0},disableTable:Boolean,allowTooltipIcon:Boolean}},He={key:0,class:"aioseo-table-header-tooltip-icon"},Le=r("span",{class:"sorting-indicator"},null,-1);function Ve(t,l,e,g,o,u){const c=v("core-tooltip");return s(),n("th",{scope:"col",style:Y({width:e.column.width}),class:_(["aioseo-manage-column manage-column",[{sortable:!e.disableTable&&e.column.sortable,asc:e.column.sortDir==="asc"&&e.column.sortable,desc:e.column.sortDir==="desc"&&e.column.sortable,sorted:e.column.sortable&&e.column.sorted},e.column.slug]])},[e.allowTooltipIcon&&e.column.tooltipIcon?(s(),n("div",He,[R(c,{class:"action",type:"action"},{tooltip:P(()=>[C(d(e.column.label),1)]),default:P(()=>[(s(),h(B(e.column.tooltipIcon)))]),_:1})])):i("",!0),!e.allowTooltipIcon||!e.column.tooltipIcon?(s(),n(m,{key:1},[e.column.sortable?(s(),n("a",{key:0,href:"#",onClick:l[0]||(l[0]=A(f=>t.$emit("sort-column",e.column,f),["prevent"]))},[r("span",null,d(e.column.label),1),Le])):i("",!0),e.column.sortable?i("",!0):(s(),n(m,{key:1},[t.$slots.headerFooter?N(t.$slots,"headerFooter",{key:0}):i("",!0),t.$slots.headerFooter?i("",!0):(s(),n(m,{key:1},[C(d(e.column.label),1)],64))],64))],64)):i("",!0)],6)}const qe=S(Oe,[["render",Ve]]),H="all-in-one-seo-pack",Me={emits:["sort-column","process-bulk-action","paginate","search","filter-table","process-change-items-per-page","process-additional-filters","additional-filter-option-selected"],setup(){return{rootStore:J()}},components:{CoreAlert:Q,CoreLoader:x,CoreWpAdditionalFilters:re,CoreWpBulkActions:_e,CoreWpItemsPerPage:we,CoreWpPagination:Ie,CoreWpTableHeaderFooter:qe,TransitionSlide:ee},props:{columns:{type:Array,required:!0},rows:{type:Array,required:!0},filters:{type:Array,required:!1},totals:{type:Object,required:!1},loading:Boolean,showSearch:{type:Boolean,default(){return!0}},showBulkActions:{type:Boolean,default(){return!0}},showPagination:{type:Boolean,default(){return!0}},showTableFooter:{type:Boolean,default(){return!0}},showHeader:{type:Boolean,default(){return!0}},searchLabel:{type:String,default(){return w("Search",H)}},initialPageNumber:{type:Number,default(){return 1}},initialItemsPerPage:{type:Number,default(){return 20}},initialSearchTerm:{type:String,default(){return""}},noResultsLabel:{type:String},bulkOptions:Array,additionalFilters:Array,selectedFilters:Object,itemsPerPageFilter:String,blurRows:Boolean,disableTable:Boolean,showItemsPerPage:Boolean},data(){return{numbers:j,itemsPerPage:null,searchTerm:"",pageNumber:1,activeRow:null,strings:{items:w("items",H),noResults:w("No items found.",H)}}},watch:{initialPageNumber(t){this.pageNumber=t},pageNumber(t){if(Math.abs(t)!==t){this.pageNumber=Math.floor(t);return}if(this.totals&&t>this.totals.pages){this.pageNumber=this.totals.pages;return}1>t&&(this.pageNumber=1)},itemsPerPage(t,l){l!==null&&this.processChangeItemsPerPage()}},computed:{filteredColumns(){return this.columns.filter(t=>"show"in t?t.show:!0)},noResults(){return this.noResultsLabel||this.strings.noResults},shouldHideCheckbox(){var t,l,e,g,o,u;return((e=(l=(t=this.rootStore)==null?void 0:t.aioseo)==null?void 0:l.screen)==null?void 0:e.blockEditor)||((u=(o=(g=this.rootStore)==null?void 0:g.aioseoBrokenLinkChecker)==null?void 0:o.screen)==null?void 0:u.blockEditor)}},methods:{showFilterCount(t){return Object.prototype.hasOwnProperty.call(t,"count")},editRow(t){if(t===null||this.activeRow===t){this.activeRow=null;return}this.activeRow=t},processSearch(){X(()=>{this.editRow(-1),this.$emit("search",this.searchTerm)},100)},processChangeItemsPerPage(){this.$emit("process-change-items-per-page",this.itemsPerPage)},processBulkAction(t){this.$emit("process-bulk-action",{action:t,selectedRows:this.selectedItems()}),this.editRow(-1),!this.bulkOptions.find(l=>l.value===t&&(l==null?void 0:l.resetSelection)===!1)&&this.resetSelectedItems()},processPaginate(t){this.pageNumber=t,this.editRow(-1),this.$emit("paginate",t,this.searchTerm)},processFilter(t){this.pageNumber=1,this.searchTerm="",this.editRow(-1),this.$emit("filter-table",t)},processAdditionalFilters(t){this.pageNumber=1,this.searchTerm="",this.editRow(-1),this.$emit("process-additional-filters",{filters:t,searchTerm:this.searchTerm,pageNumber:this.pageNumber})},selectedItems(){const t=this.$refs.table.querySelectorAll("tbody tr.main-row"),l=[];return t.forEach(e=>{const g=e.querySelector("th.check-column input");g&&g.checked&&l.push(e.dataset.rowId)}),l},resetSelectedItems(){const t=this.$refs.table.querySelectorAll(".check-column input:checked");t&&t.forEach(l=>l.checked=!1)}},created(){this.pageNumber=this.initialPageNumber,this.searchTerm=this.initialSearchTerm,this.itemsPerPage=this.initialItemsPerPage}},Ue={class:"aioseo-wp-table"},je={key:0,class:"aioseo-wp-table-header"},Ee={key:0,class:"subsubsub"},We=["onClick"],De={key:0},ze={key:0},Ke={key:0,class:"separator"},Ge={key:1,class:"search-box"},Je=["disabled"],Qe=["value","disabled"],xe={class:"tablenav top"},Xe={key:2,class:"alignleft"},Ye=["onClick","tabindex"],Ze=r("br",{class:"clear"},null,-1),$e={class:"wp-table"},et={key:0,class:"manage-column column-cb check-column"},tt=["disabled"],st={key:0,id:"the-list"},lt={key:0,class:"loader-overlay-table"},at={key:0},nt=["colspan"],ot=["data-row-id","data-row-index"],it={key:0,scope:"row",class:"check-column"},rt=["disabled"],ut=["colspan"],ct={key:1},dt=["colspan"],bt={class:"border"},mt={key:1},ht=["colspan"],gt=["colspan"],_t={class:"no-results"},pt={key:0},kt={key:1},ft={key:0,class:"manage-column column-cb check-column"},yt=["disabled"],vt={key:1,class:"tablenav bottom"},Pt=r("div",{class:"alignleft actions"},null,-1),wt=r("br",{class:"clear"},null,-1);function Tt(t,l,e,g,o,u){const c=v("core-wp-bulk-actions"),f=v("core-wp-additional-filters"),y=v("core-wp-pagination"),O=v("core-wp-table-header-footer"),D=v("core-loader"),V=v("core-alert"),z=v("transition-slide"),K=v("core-wp-items-per-page");return s(),n("div",Ue,[e.showHeader?(s(),n("div",je,[t.$slots.filters?i("",!0):(s(),n("ul",Ee,[(s(!0),n(m,null,k(e.filters,(a,b)=>(s(),n("li",{key:b,class:_(a.slug)},[r("span",{class:_(["name",{active:a.active}])},[!a.active&&!e.disableTable?(s(),n("a",{key:0,href:"#",onClick:A(T=>u.processFilter(a),["prevent"])},[C(d(a.name)+" ",1),u.showFilterCount(a)?(s(),n("span",De," ("+d(o.numbers.numberFormat(a.count))+")",1)):i("",!0)],8,We)):i("",!0),a.active||e.disableTable?(s(),n(m,{key:1},[C(d(a.name)+" ",1),u.showFilterCount(a)?(s(),n("span",ze," ("+d(o.numbers.numberFormat(a.count))+")",1)):i("",!0)],64)):i("",!0)],2),b+1<e.filters.length?(s(),n("span",Ke,"|")):i("",!0)],2))),128))])),e.showSearch?(s(),n("p",Ge,[I(r("input",{type:"search",id:"post-search-input",name:"s","onUpdate:modelValue":l[0]||(l[0]=a=>o.searchTerm=a),onKeyup:l[1]||(l[1]=W((...a)=>u.processSearch&&u.processSearch(...a),["enter"])),onSearch:l[2]||(l[2]=(...a)=>u.processSearch&&u.processSearch(...a)),disabled:e.disableTable},null,40,Je),[[E,o.searchTerm]]),r("input",{type:"submit",id:"search-submit",class:"button",value:e.searchLabel,onClick:l[3]||(l[3]=A((...a)=>u.processSearch&&u.processSearch(...a),["prevent"])),disabled:e.disableTable},null,8,Qe)])):i("",!0),r("div",xe,[N(t.$slots,"tablenav"),e.showBulkActions&&e.bulkOptions&&e.bulkOptions.length?(s(),h(c,{key:0,"bulk-options":e.bulkOptions,onProcessBulkAction:u.processBulkAction,"disable-table":e.disableTable},null,8,["bulk-options","onProcessBulkAction","disable-table"])):i("",!0),e.additionalFilters&&e.additionalFilters.length?(s(),h(f,{key:1,"additional-filters":e.additionalFilters,"selected-filters":e.selectedFilters,onChange:l[4]||(l[4]=a=>t.$emit("additional-filter-option-selected",a)),onProcessAdditionalFilters:u.processAdditionalFilters},null,8,["additional-filters","selected-filters","onProcessAdditionalFilters"])):i("",!0),t.$slots.filters&&e.filters.length?(s(),n("div",Xe,[(s(!0),n(m,null,k(e.filters,(a,b)=>(s(),n("a",{key:b,onClick:A(T=>u.processFilter(a),["prevent"]),href:"#",tabindex:a.active?-1:0},[N(t.$slots,"filters",Z({ref_for:!0},a))],8,Ye))),128))])):i("",!0),e.showPagination?(s(),h(y,{key:3,totals:e.totals,"initial-page-number":o.pageNumber,"disable-table":e.disableTable,onPaginate:u.processPaginate},null,8,["totals","initial-page-number","disable-table","onPaginate"])):i("",!0),Ze])])):i("",!0),r("div",$e,[r("table",{class:_(["wp-list-table widefat fixed",{blurred:e.blurRows}]),ref:"table",cellpadding:"0",cellspacing:"0","aria-label":"Paginated Table"},[r("thead",null,[r("tr",null,[e.showBulkActions?(s(),n("td",et,[u.shouldHideCheckbox?i("",!0):(s(),n("input",{key:0,type:"checkbox",disabled:e.loading||e.disableTable},null,8,tt))])):i("",!0),(s(!0),n(m,null,k(e.columns,(a,b)=>(s(),h(O,{key:b,column:a,"disable-table":e.disableTable,onSortColumn:(T,F)=>t.$emit("sort-column",T,F),"allow-tooltip-icon":""},q({_:2},[t.$slots[a.slug+"HeaderFooter"]?{name:"headerFooter",fn:P(()=>[N(t.$slots,a.slug+"HeaderFooter",{area:"header"})]),key:"0"}:void 0]),1032,["column","disable-table","onSortColumn"]))),128))])]),e.rows?(s(),n("tbody",st,[e.loading?(s(),n("div",lt,[R(D)])):i("",!0),(s(!0),n(m,null,k(e.rows,(a,b)=>{var T,F;return s(),n(m,{key:b},[a.alert&&((T=a.alert)==null?void 0:T.position)==="top"?(s(),n("tr",at,[r("td",{colspan:u.filteredColumns.length+1},[R(V,{type:a.alert.color||"blue",innerHTML:a.alert.description},null,8,["type","innerHTML"])],8,nt)])):i("",!0),r("tr",{class:_(["main-row",{even:b%2===0,enabled:a.enabled||!a.hasOwnProperty("enabled")}]),"data-row-id":a.rowIndex&&a[a.rowIndex]||a.id||a.url||b,"data-row-index":b},[e.showBulkActions?(s(),n("th",it,[a.preventBulkAction?i("",!0):(s(),n("input",{key:0,type:"checkbox",disabled:e.disableTable},null,8,rt))])):i("",!0),(s(!0),n(m,null,k(u.filteredColumns,(p,G)=>(s(),n("td",{class:_(["manage-column",p.slug]),key:G,colspan:p!=null&&p.colspan?p.colspan:1},[t.$slots[p.slug]?N(t.$slots,p.slug,{key:0,row:a,column:a[p.slug],editRow:u.editRow,index:b,editRowActive:o.activeRow===b}):i("",!0),t.$slots[p.slug]?i("",!0):(s(),n("span",ct,d(a[p.slug]),1))],10,ut))),128))],10,ot),r("tr",{class:_(["edit-row",{even:b%2===0}])},[r("td",{colspan:e.showBulkActions?e.columns.length+1:e.columns.length,class:"edit-row-content"},[R(z,{tag:"div",class:"wrapper",active:b===o.activeRow},{default:P(()=>[r("div",bt,[N(t.$slots,"edit-row",{row:a,index:b,editRow:u.editRow})])]),_:2},1032,["active"])],8,dt)],2),a.alert&&((F=a.alert)==null?void 0:F.position)==="bottom"?(s(),n("tr",mt,[r("td",{colspan:u.filteredColumns.length+1},[R(V,{type:a.alert.color||"blue",innerHTML:a.alert.description},null,8,["type","innerHTML"])],8,ht)])):i("",!0)],64)}),128)),e.rows.length?i("",!0):(s(),n("td",{key:1,colspan:e.showBulkActions?e.columns.length+1:e.columns.length},[r("div",_t,[e.loading?i("",!0):(s(),n("span",pt,d(u.noResults),1))])],8,gt))])):i("",!0),e.showTableFooter?(s(),n("tfoot",kt,[r("tr",null,[e.showBulkActions?(s(),n("td",ft,[r("input",{type:"checkbox",disabled:e.loading||e.disableTable},null,8,yt)])):i("",!0),(s(!0),n(m,null,k(e.columns,(a,b)=>(s(),h(O,{key:b,column:a,"disable-table":e.disableTable,onSortColumn:(T,F)=>t.$emit("sort-column",T,F)},q({_:2},[t.$slots[a.slug+"HeaderFooter"]?{name:"headerFooter",fn:P(()=>[N(t.$slots,a.slug+"HeaderFooter",{area:"footer"})]),key:"0"}:void 0]),1032,["column","disable-table","onSortColumn"]))),128))])])):i("",!0)],2),N(t.$slots,"cta")]),e.showTableFooter?(s(),n("div",vt,[e.showBulkActions&&e.bulkOptions&&e.bulkOptions.length?(s(),h(c,{key:0,"bulk-options":e.bulkOptions,onProcessBulkAction:u.processBulkAction,"disable-table":e.disableTable},null,8,["bulk-options","onProcessBulkAction","disable-table"])):i("",!0),e.showItemsPerPage?(s(),h(K,{key:1,modelValue:o.itemsPerPage,"onUpdate:modelValue":l[5]||(l[5]=a=>o.itemsPerPage=a),"disable-table":e.disableTable},null,8,["modelValue","disable-table"])):i("",!0),Pt,e.showPagination?(s(),h(y,{key:2,totals:e.totals,"initial-page-number":o.pageNumber,"disable-table":e.disableTable,onPaginate:u.processPaginate},null,8,["totals","initial-page-number","disable-table","onPaginate"])):i("",!0),wt])):i("",!0)])}const Ht=S(Me,[["render",Tt]]);export{Ht as C};