UNPKG

@progress/kendo-vue-data-tools

Version:
9 lines (8 loc) 2.18 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),u=require("@progress/kendo-data-query"),p=require("./GroupToolbar.js"),c=require("@progress/kendo-vue-intl"),n=require("../messages/main.js"),h=require("./Expression.js"),s=o.defineComponent({name:"KendoFilterGroup",emits:{change:null,remove:null},props:{filter:{type:Object,required:!0},fields:{type:Array,required:!0},defaultGroupFilter:{type:Object,required:!0}},inject:{kendoLocalizationService:{default:null}},render(){const e=c.provideLocalizationService(this),{fields:t,filter:r,filterRender:l}=this.$props;return r.filters.length>0?o.createVNode("ul",{class:"k-filter-lines",role:"group"},[r.filters.map(function(i,a){return o.createVNode("li",{key:a,class:"k-filter-item",role:"treeitem"},[u.isCompositeFilterDescriptor(i)?[o.createVNode(p.GroupToolbar,{filter:i,fields:t,ariaLabel:e.toLanguageString(n.filterGroupFilterAriaLabel,n.messages[n.filterGroupFilterAriaLabel]),onChange:this.onChange,onRemove:this.onRemove,defaultGroupFilter:this.$props.defaultGroupFilter},null),o.createVNode(s,{filter:i,fields:t,onChange:this.onChange,onRemove:this.onRemove,defaultGroupFilter:this.$props.defaultGroupFilter},null)]:o.createVNode(h.Expression,{filter:i,fields:t,onChange:this.onChange,onRemove:this.onRemove},null)])},this)]):null},methods:{replaceFilter(e,t){const r=this.$props.filter,l=r.filters.map(i=>i===e?t:i);return{...r,filters:l}},onChange(e){const r={nextFilter:this.replaceFilter(e.prevFilter,e.nextFilter),prevFilter:this.$props.filter,event:e.event,target:this};this.$emit("change",r)},onRemove(e){const t=this.$props.filter,r=t.filters.filter(i=>i!==e.filter),l={nextFilter:{...t,filters:r},prevFilter:t,event:e.event,target:this};this.$emit("change",l)}}});exports.GroupFilter=s;