@dialpad/dialtone-vue 2.200.1 → 2.201.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-documentation.json +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +262 -260
- package/dist/dialtone-vue.js.map +1 -1
- package/dist/lib/filter-pill/filter-pill.cjs +2 -0
- package/dist/lib/filter-pill/filter-pill.cjs.map +1 -0
- package/dist/lib/filter-pill/filter-pill.js +245 -0
- package/dist/lib/filter-pill/filter-pill.js.map +1 -0
- package/dist/lib/filter-pill/index.cjs +2 -0
- package/dist/lib/filter-pill/index.cjs.map +1 -0
- package/dist/lib/filter-pill/index.js +5 -0
- package/dist/lib/filter-pill/index.js.map +1 -0
- package/dist/lib/pagination/pagination.cjs +1 -1
- package/dist/lib/pagination/pagination.cjs.map +1 -1
- package/dist/lib/pagination/pagination.js +8 -8
- package/dist/lib/pagination/pagination.js.map +1 -1
- package/dist/lib/popover/popover.cjs.map +1 -1
- package/dist/lib/popover/popover.js +3 -19
- package/dist/lib/popover/popover.js.map +1 -1
- package/dist/localization/en-US.cjs +2 -0
- package/dist/localization/en-US.cjs.map +1 -1
- package/dist/localization/en-US.js +2 -0
- package/dist/localization/en-US.js.map +1 -1
- package/dist/types/components/filter_pill/filter_pill.vue.d.ts +151 -0
- package/dist/types/components/filter_pill/filter_pill.vue.d.ts.map +1 -0
- package/dist/types/components/filter_pill/index.d.ts +2 -0
- package/dist/types/components/filter_pill/index.d.ts.map +1 -0
- package/dist/types/components/pagination/pagination.vue.d.ts.map +1 -1
- package/dist/types/components/popover/popover.vue.d.ts.map +1 -1
- package/dist/types/components/rich_text_editor/rich_text_editor.vue.d.ts +1 -1
- package/dist/types/components/split_button/split_button.vue.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/recipes/conversation_view/message_input/message_input.vue.d.ts +1 -1
- package/package.json +5 -5
package/dist/dialtone-vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialtone-vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dialtone-vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("@dialpad/dialtone-icons/vue2"),s=require("../../localization/index.cjs"),c=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),p=require("../button/button.cjs"),u=require("../popover/popover.cjs"),d=require("../checkbox/checkbox.cjs"),_=require("../checkbox-group/checkbox-group.cjs"),f=require("../button/button-constants.cjs"),n=require("../popover/popover-constants.cjs"),v={name:"DtFilterPill",components:{DtCheckboxGroup:_.default,DtCheckbox:d.default,DtPopover:u.default,DtButton:p.default,DtIconClose:r.DtIconClose,DtIconChevronDown:r.DtIconChevronDown},inheritAttrs:!1,props:{value:{type:Array,default:()=>[]},alphaTooltipText:{type:String,default:""},disabled:{type:Boolean,default:!1},hideClear:{type:Boolean,default:!1},label:{type:String,default:void 0},omegaTooltipText:{type:String,default:""},popoverAppendTo:{type:[HTMLElement,String],default:"body",validator:t=>n.POPOVER_APPEND_TO_VALUES.includes(t)||t instanceof HTMLElement},popoverFallbackPlacements:{type:Array,default:()=>["auto"]},popoverMaxHeight:{type:String,default:""},popoverMaxWidth:{type:String,default:""},popoverPadding:{type:String,default:"large",validator:t=>Object.keys(n.POPOVER_PADDING_CLASSES).some(e=>e===t)},popoverPlacement:{type:String,default:"bottom-start"},size:{type:String,default:"sm",validator:t=>Object.keys(f.BUTTON_SIZE_MODIFIERS).includes(t)}},emits:["clear","open","update:value"],data(){return{isOpen:!1,i18n:new s.DialtoneLocalization,filters:this.value}},computed:{buttonKind(){return this.isActive?"default":"muted"},clearButtonAriaLabel(){return this.omegaTooltipText||this.i18n.$t("DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL")},clearButtonTitle(){if(!this.omegaTooltipText)return this.clearButtonAriaLabel},activeFilters(){return this.filters.filter(t=>t.active).map(t=>t.name)},activeFilterList(){return this.activeFilters.length<=2?this.activeFilters.join(", "):this.activeFilters.slice(0,2).join(", ")+", + "+(this.activeFilters.length-2)},isActive(){return this.activeFilterList.length>0},hasClear(){return!this.hideClear&&this.activeFilterList.length>0}},watch:{isOpen(t){this.$emit("open",t)},filters(t){this.$emit("update:value",t)}},methods:{clearFilter(t){this.filters=this.filters.map(e=>(delete e.active,e)),this.$emit("clear",t)},updateFilters(t,e){this.filters=this.filters.map(i=>i.name!==t.name?i:{...i,active:e})}}};var h=function(){var e=this,i=e._self._c;return i("div",{staticClass:"d-filter-pill",attrs:{"data-qa":"dt-filter-pill"}},[i("dt-popover",{attrs:{"append-to":e.popoverAppendTo,"fallback-placements":e.popoverFallbackPlacements,"max-height":e.popoverMaxHeight,"max-width":e.popoverMaxWidth,modal:!1,padding:e.popoverPadding,placement:e.popoverPlacement},scopedSlots:e._u([{key:"anchor",fn:function({attrs:l}){return[i("dt-button",e._b({directives:[{name:"dt-tooltip",rawName:"v-dt-tooltip",value:e.alphaTooltipText,expression:"alphaTooltipText"}],class:["d-filter-pill__primary",{"d-filter-pill--selected":e.isActive,"d-filter-pill__primary--has-clear":e.hasClear}],attrs:{active:e.isActive,disabled:e.disabled,kind:e.buttonKind,size:e.size,"data-qa":"dt-filter-pill__button","icon-position":"right",importance:"outlined"},on:{click:function(a){e.isOpen=!0}},scopedSlots:e._u([{key:"icon",fn:function({iconSize:a}){return[i("dt-icon-chevron-down",{staticClass:"d-filter-pill__icon",attrs:{size:a,"data-qa":"dt-filter-pill__icon"}})]}}],null,!0)},"dt-button",l,!1),[i("span",{staticClass:"d-filter-pill__label"},[e._t("default",function(){return[i("span",{staticClass:"d-filter-pill__label-alpha",domProps:{textContent:e._s(e.label)}}),e.activeFilterList?i("span",{staticClass:"d-filter-pill__label-omega",domProps:{textContent:e._s(e.activeFilterList)}}):e._e()]})],2)])]}},{key:"content",fn:function({close:l}){return[e._t("content",function(){return[e.value.length?i("dt-checkbox-group",{attrs:{"selected-values":e.activeFilters,"aria-label":e.label,name:"contact-centers"}},e._l(e.filters,function(a){return i("dt-checkbox",{key:a.name,attrs:{label:a.name,value:a.name},on:{input:o=>e.updateFilters(a,o)}})}),1):e._e()]},{close:l})]}}],null,!0),model:{value:e.isOpen,callback:function(l){e.isOpen=l},expression:"isOpen"}}),e.hasClear?i("dt-button",{directives:[{name:"dt-tooltip",rawName:"v-dt-tooltip",value:e.omegaTooltipText,expression:"omegaTooltipText"}],class:["d-filter-pill__clear",{"d-filter-pill__clear--selected":e.isActive}],attrs:{active:e.isActive,"aria-label":e.clearButtonAriaLabel,disabled:e.disabled,kind:e.buttonKind,size:e.size,title:e.clearButtonTitle,"data-qa":"dt-filter-pill__clear-button",importance:"outlined"},on:{click:e.clearFilter},scopedSlots:e._u([{key:"icon",fn:function({iconSize:l}){return[i("dt-icon-close",{attrs:{size:l}})]}}],null,!1,2924703597)}):e._e()],1)},m=[],b=c.n(v,h,m);const g=b.exports;exports.default=g;
|
|
2
|
+
//# sourceMappingURL=filter-pill.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-pill.cjs","sources":["../../../components/filter_pill/filter_pill.vue"],"sourcesContent":["<template>\n <div\n class=\"d-filter-pill\"\n data-qa=\"dt-filter-pill\"\n >\n <dt-popover\n v-model=\"isOpen\"\n :append-to=\"popoverAppendTo\"\n :fallback-placements=\"popoverFallbackPlacements\"\n :max-height=\"popoverMaxHeight\"\n :max-width=\"popoverMaxWidth\"\n :modal=\"false\"\n :padding=\"popoverPadding\"\n :placement=\"popoverPlacement\"\n >\n <template #anchor=\"{ attrs }\">\n <dt-button\n v-dt-tooltip=\"alphaTooltipText\"\n v-bind=\"attrs\"\n :active=\"isActive\"\n :class=\"[\n 'd-filter-pill__primary',\n {\n 'd-filter-pill--selected': isActive,\n 'd-filter-pill__primary--has-clear': hasClear,\n },\n ]\"\n :disabled=\"disabled\"\n :kind=\"buttonKind\"\n :size=\"size\"\n data-qa=\"dt-filter-pill__button\"\n icon-position=\"right\"\n importance=\"outlined\"\n @click=\"isOpen = true\"\n >\n <span class=\"d-filter-pill__label\">\n <!-- @slot Allows you to override the label behavior -->\n <slot>\n <span\n class=\"d-filter-pill__label-alpha\"\n v-text=\"label\"\n />\n <span\n v-if=\"activeFilterList\"\n class=\"d-filter-pill__label-omega\"\n v-text=\"activeFilterList\"\n />\n </slot>\n </span>\n <template #icon=\"{ iconSize }\">\n <dt-icon-chevron-down\n :size=\"iconSize\"\n class=\"d-filter-pill__icon\"\n data-qa=\"dt-filter-pill__icon\"\n />\n </template>\n </dt-button>\n </template>\n <template #content=\"{ close }\">\n <!-- @slot Allows you to override the popover content, only use this if you need custom behavior -->\n <slot\n :close=\"close\"\n name=\"content\"\n >\n <dt-checkbox-group\n v-if=\"value.length\"\n :selected-values=\"activeFilters\"\n :aria-label=\"label\"\n name=\"contact-centers\"\n >\n <dt-checkbox\n v-for=\"filter in filters\"\n :key=\"filter.name\"\n :label=\"filter.name\"\n :value=\"filter.name\"\n @input=\"$event => updateFilters(filter, $event)\"\n />\n </dt-checkbox-group>\n </slot>\n </template>\n </dt-popover>\n <dt-button\n v-if=\"hasClear\"\n v-dt-tooltip=\"omegaTooltipText\"\n :active=\"isActive\"\n :aria-label=\"clearButtonAriaLabel\"\n :class=\"[\n 'd-filter-pill__clear',\n { 'd-filter-pill__clear--selected': isActive },\n ]\"\n :disabled=\"disabled\"\n :kind=\"buttonKind\"\n :size=\"size\"\n :title=\"clearButtonTitle\"\n data-qa=\"dt-filter-pill__clear-button\"\n importance=\"outlined\"\n @click=\"clearFilter\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close :size=\"iconSize\" />\n </template>\n </dt-button>\n </div>\n</template>\n\n<script>\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_PADDING_CLASSES } from '@/components/popover';\nimport { BUTTON_SIZE_MODIFIERS, DtButton } from '@/components/button';\nimport { DtIconChevronDown, DtIconClose } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\nimport { DtCheckbox } from '@/components/checkbox';\nimport { DtCheckboxGroup } from '@/components/checkbox_group';\n\nexport default {\n name: 'DtFilterPill',\n\n components: {\n DtCheckboxGroup,\n DtCheckbox,\n DtPopover,\n DtButton,\n DtIconClose,\n DtIconChevronDown,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Array of filters to display in the popover,\n * should be an array of objects with `name` and `active` properties\n */\n value: {\n type: Array,\n default: () => [],\n },\n\n /**\n * Text shown in tooltip when you hover the alpha button,\n * required if no content is passed to default slot\n */\n alphaTooltipText: {\n type: String,\n default: '',\n },\n\n /**\n * HTML disabled attribute\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Toggles the clear button visibility\n * @values true, false\n */\n hideClear: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Label of the button\n */\n label: {\n type: String,\n default: undefined,\n },\n\n /**\n * Text shown in tooltip when you hover the omega button,\n * required as it is an icon only button\n */\n omegaTooltipText: {\n type: String,\n default: '',\n },\n\n /**\n * Sets the element to which the\n * <a class=\"d-link\" href=\"https://dialtone.dialpad.com/components/popover.html#vue-api\" target=\"_blank\">popover component</a>\n * is going to append to\n * @values body, parent, root, HTMLElement\n */\n popoverAppendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"popoverPlacement\",\n * it will attempt to change it's direction to the \"popoverFallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n popoverFallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n popoverMaxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n popoverMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Padding size class for the popover content.\n * @values none, small, medium, large\n */\n popoverPadding: {\n type: String,\n default: 'large',\n validator: (padding) => {\n return Object.keys(POPOVER_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * <a class=\"d-link\" href=\"https://atomiks.github.io/tippyjs/v6/all-props/#placement\" target=\"_blank\">Tippy.js docs</a>\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n popoverPlacement: {\n type: String,\n default: 'bottom-start',\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'sm',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n },\n\n emits: [\n /**\n * Emitted when clicking the clear button\n *\n * @event clear\n * @type {Boolean | Array}\n */\n 'clear',\n\n /**\n * Emitted when popover is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'open',\n\n /**\n * Emitted when the active filters change\n * @type {Array}\n */\n 'update:value',\n ],\n\n data () {\n return {\n isOpen: false,\n i18n: new DialtoneLocalization(),\n filters: this.value,\n };\n },\n\n computed: {\n buttonKind () {\n return this.isActive ? 'default': 'muted';\n },\n\n clearButtonAriaLabel () {\n return this.omegaTooltipText || this.i18n.$t('DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL');\n },\n\n clearButtonTitle () {\n if (this.omegaTooltipText) return;\n\n return this.clearButtonAriaLabel\n },\n\n activeFilters () {\n return this.filters.filter(filter => filter.active).map(filter => filter.name);\n },\n\n activeFilterList () {\n if (this.activeFilters.length <= 2) {\n return this.activeFilters.join(', ');\n }\n\n return this.activeFilters.slice(0, 2).join(', ') + ', + ' + (this.activeFilters.length - 2);\n },\n\n isActive () {\n return this.activeFilterList.length > 0;\n },\n\n hasClear () {\n return !this.hideClear && this.activeFilterList.length > 0;\n },\n },\n\n watch: {\n isOpen (isOpen) {\n this.$emit('open', isOpen);\n },\n\n filters (filters) {\n this.$emit('update:value', filters);\n },\n },\n\n methods: {\n clearFilter ($event) {\n this.filters = this.filters.map(filter => {\n delete filter.active\n return filter;\n });\n this.$emit('clear', $event)\n },\n\n updateFilters (filter, isActive) {\n this.filters = this.filters.map(f => {\n if (f.name !== filter.name) return f;\n\n return {...f, active: isActive};\n })\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtCheckboxGroup","DtCheckbox","DtPopover","DtButton","DtIconClose","DtIconChevronDown","appendTo","POPOVER_APPEND_TO_VALUES","padding","POPOVER_PADDING_CLASSES","item","s","BUTTON_SIZE_MODIFIERS","DialtoneLocalization","filter","isOpen","filters","$event","isActive","f"],"mappings":"sfAiHAA,EAAA,CACA,KAAA,eAEA,WAAA,CACA,gBAAAC,EAAAA,QACA,WAAAC,EAAAA,QACA,UAAAC,EAAAA,QACA,SAAAC,EAAAA,QACA,YAAAC,EAAAA,YACA,kBAAAC,EAAAA,iBACA,EAEA,aAAA,GAEA,MAAA,CAKA,MAAA,CACA,KAAA,MACA,QAAA,IAAA,CAAA,CACA,EAMA,iBAAA,CACA,KAAA,OACA,QAAA,EACA,EAKA,SAAA,CACA,KAAA,QACA,QAAA,EACA,EAMA,UAAA,CACA,KAAA,QACA,QAAA,EACA,EAKA,MAAA,CACA,KAAA,OACA,QAAA,MACA,EAMA,iBAAA,CACA,KAAA,OACA,QAAA,EACA,EAQA,gBAAA,CACA,K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,QAAAC,EAAA,CACA,KAAA,MAAA,eAAAA,CAAA,CACA,CACA,EAEA,QAAA,CACA,YAAAC,EAAA,CACA,KAAA,QAAA,KAAA,QAAA,IAAAH,IACA,OAAAA,EAAA,OACAA,EACA,EACA,KAAA,MAAA,QAAAG,CAAA,CACA,EAEA,cAAAH,EAAAI,EAAA,CACA,KAAA,QAAA,KAAA,QAAA,IAAAC,GACAA,EAAA,OAAAL,EAAA,KAAAK,EAEA,CAAA,GAAAA,EAAA,OAAAD,CAAA,CACA,CACA,CACA,CACA"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { DtIconChevronDown as o, DtIconClose as n } from "@dialpad/dialtone-icons/vue2";
|
|
2
|
+
import { DialtoneLocalization as s } from "../../localization/index.js";
|
|
3
|
+
import { n as p } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
4
|
+
import c from "../button/button.js";
|
|
5
|
+
import d from "../popover/popover.js";
|
|
6
|
+
import u from "../checkbox/checkbox.js";
|
|
7
|
+
import f from "../checkbox-group/checkbox-group.js";
|
|
8
|
+
import { BUTTON_SIZE_MODIFIERS as m } from "../button/button-constants.js";
|
|
9
|
+
import { POPOVER_PADDING_CLASSES as v, POPOVER_APPEND_TO_VALUES as _ } from "../popover/popover-constants.js";
|
|
10
|
+
const h = {
|
|
11
|
+
name: "DtFilterPill",
|
|
12
|
+
components: {
|
|
13
|
+
DtCheckboxGroup: f,
|
|
14
|
+
DtCheckbox: u,
|
|
15
|
+
DtPopover: d,
|
|
16
|
+
DtButton: c,
|
|
17
|
+
DtIconClose: n,
|
|
18
|
+
DtIconChevronDown: o
|
|
19
|
+
},
|
|
20
|
+
inheritAttrs: !1,
|
|
21
|
+
props: {
|
|
22
|
+
/**
|
|
23
|
+
* Array of filters to display in the popover,
|
|
24
|
+
* should be an array of objects with `name` and `active` properties
|
|
25
|
+
*/
|
|
26
|
+
value: {
|
|
27
|
+
type: Array,
|
|
28
|
+
default: () => []
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Text shown in tooltip when you hover the alpha button,
|
|
32
|
+
* required if no content is passed to default slot
|
|
33
|
+
*/
|
|
34
|
+
alphaTooltipText: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* HTML disabled attribute
|
|
40
|
+
*/
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Toggles the clear button visibility
|
|
47
|
+
* @values true, false
|
|
48
|
+
*/
|
|
49
|
+
hideClear: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: !1
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Label of the button
|
|
55
|
+
*/
|
|
56
|
+
label: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: void 0
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Text shown in tooltip when you hover the omega button,
|
|
62
|
+
* required as it is an icon only button
|
|
63
|
+
*/
|
|
64
|
+
omegaTooltipText: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Sets the element to which the
|
|
70
|
+
* <a class="d-link" href="https://dialtone.dialpad.com/components/popover.html#vue-api" target="_blank">popover component</a>
|
|
71
|
+
* is going to append to
|
|
72
|
+
* @values body, parent, root, HTMLElement
|
|
73
|
+
*/
|
|
74
|
+
popoverAppendTo: {
|
|
75
|
+
type: [HTMLElement, String],
|
|
76
|
+
default: "body",
|
|
77
|
+
validator: (e) => _.includes(e) || e instanceof HTMLElement
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* If the dropdown does not fit in the direction described by "popoverPlacement",
|
|
81
|
+
* it will attempt to change it's direction to the "popoverFallbackPlacements".
|
|
82
|
+
*
|
|
83
|
+
* @values top, top-start, top-end,
|
|
84
|
+
* right, right-start, right-end,
|
|
85
|
+
* left, left-start, left-end,
|
|
86
|
+
* bottom, bottom-start, bottom-end,
|
|
87
|
+
* auto, auto-start, auto-end
|
|
88
|
+
* */
|
|
89
|
+
popoverFallbackPlacements: {
|
|
90
|
+
type: Array,
|
|
91
|
+
default: () => ["auto"]
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Determines maximum height for the popover before overflow.
|
|
95
|
+
* Possible units rem|px|em
|
|
96
|
+
*/
|
|
97
|
+
popoverMaxHeight: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: ""
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Determines maximum width for the popover before overflow.
|
|
103
|
+
* Possible units rem|px|%|em
|
|
104
|
+
*/
|
|
105
|
+
popoverMaxWidth: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: ""
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Padding size class for the popover content.
|
|
111
|
+
* @values none, small, medium, large
|
|
112
|
+
*/
|
|
113
|
+
popoverPadding: {
|
|
114
|
+
type: String,
|
|
115
|
+
default: "large",
|
|
116
|
+
validator: (e) => Object.keys(v).some((t) => t === e)
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* The direction the popover displays relative to the anchor.
|
|
120
|
+
* <a class="d-link" href="https://atomiks.github.io/tippyjs/v6/all-props/#placement" target="_blank">Tippy.js docs</a>
|
|
121
|
+
* @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end
|
|
122
|
+
*/
|
|
123
|
+
popoverPlacement: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: "bottom-start"
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* The size of the button.
|
|
129
|
+
* @values xs, sm, md, lg, xl
|
|
130
|
+
*/
|
|
131
|
+
size: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "sm",
|
|
134
|
+
validator: (e) => Object.keys(m).includes(e)
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
emits: [
|
|
138
|
+
/**
|
|
139
|
+
* Emitted when clicking the clear button
|
|
140
|
+
*
|
|
141
|
+
* @event clear
|
|
142
|
+
* @type {Boolean | Array}
|
|
143
|
+
*/
|
|
144
|
+
"clear",
|
|
145
|
+
/**
|
|
146
|
+
* Emitted when popover is shown or hidden
|
|
147
|
+
*
|
|
148
|
+
* @event opened
|
|
149
|
+
* @type {Boolean | Array}
|
|
150
|
+
*/
|
|
151
|
+
"open",
|
|
152
|
+
/**
|
|
153
|
+
* Emitted when the active filters change
|
|
154
|
+
* @type {Array}
|
|
155
|
+
*/
|
|
156
|
+
"update:value"
|
|
157
|
+
],
|
|
158
|
+
data() {
|
|
159
|
+
return {
|
|
160
|
+
isOpen: !1,
|
|
161
|
+
i18n: new s(),
|
|
162
|
+
filters: this.value
|
|
163
|
+
};
|
|
164
|
+
},
|
|
165
|
+
computed: {
|
|
166
|
+
buttonKind() {
|
|
167
|
+
return this.isActive ? "default" : "muted";
|
|
168
|
+
},
|
|
169
|
+
clearButtonAriaLabel() {
|
|
170
|
+
return this.omegaTooltipText || this.i18n.$t("DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL");
|
|
171
|
+
},
|
|
172
|
+
clearButtonTitle() {
|
|
173
|
+
if (!this.omegaTooltipText)
|
|
174
|
+
return this.clearButtonAriaLabel;
|
|
175
|
+
},
|
|
176
|
+
activeFilters() {
|
|
177
|
+
return this.filters.filter((e) => e.active).map((e) => e.name);
|
|
178
|
+
},
|
|
179
|
+
activeFilterList() {
|
|
180
|
+
return this.activeFilters.length <= 2 ? this.activeFilters.join(", ") : this.activeFilters.slice(0, 2).join(", ") + ", + " + (this.activeFilters.length - 2);
|
|
181
|
+
},
|
|
182
|
+
isActive() {
|
|
183
|
+
return this.activeFilterList.length > 0;
|
|
184
|
+
},
|
|
185
|
+
hasClear() {
|
|
186
|
+
return !this.hideClear && this.activeFilterList.length > 0;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
watch: {
|
|
190
|
+
isOpen(e) {
|
|
191
|
+
this.$emit("open", e);
|
|
192
|
+
},
|
|
193
|
+
filters(e) {
|
|
194
|
+
this.$emit("update:value", e);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
methods: {
|
|
198
|
+
clearFilter(e) {
|
|
199
|
+
this.filters = this.filters.map((t) => (delete t.active, t)), this.$emit("clear", e);
|
|
200
|
+
},
|
|
201
|
+
updateFilters(e, t) {
|
|
202
|
+
this.filters = this.filters.map((i) => i.name !== e.name ? i : { ...i, active: t });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
var b = function() {
|
|
207
|
+
var t = this, i = t._self._c;
|
|
208
|
+
return i("div", { staticClass: "d-filter-pill", attrs: { "data-qa": "dt-filter-pill" } }, [i("dt-popover", { attrs: { "append-to": t.popoverAppendTo, "fallback-placements": t.popoverFallbackPlacements, "max-height": t.popoverMaxHeight, "max-width": t.popoverMaxWidth, modal: !1, padding: t.popoverPadding, placement: t.popoverPlacement }, scopedSlots: t._u([{ key: "anchor", fn: function({ attrs: l }) {
|
|
209
|
+
return [i("dt-button", t._b({ directives: [{ name: "dt-tooltip", rawName: "v-dt-tooltip", value: t.alphaTooltipText, expression: "alphaTooltipText" }], class: [
|
|
210
|
+
"d-filter-pill__primary",
|
|
211
|
+
{
|
|
212
|
+
"d-filter-pill--selected": t.isActive,
|
|
213
|
+
"d-filter-pill__primary--has-clear": t.hasClear
|
|
214
|
+
}
|
|
215
|
+
], attrs: { active: t.isActive, disabled: t.disabled, kind: t.buttonKind, size: t.size, "data-qa": "dt-filter-pill__button", "icon-position": "right", importance: "outlined" }, on: { click: function(a) {
|
|
216
|
+
t.isOpen = !0;
|
|
217
|
+
} }, scopedSlots: t._u([{ key: "icon", fn: function({ iconSize: a }) {
|
|
218
|
+
return [i("dt-icon-chevron-down", { staticClass: "d-filter-pill__icon", attrs: { size: a, "data-qa": "dt-filter-pill__icon" } })];
|
|
219
|
+
} }], null, !0) }, "dt-button", l, !1), [i("span", { staticClass: "d-filter-pill__label" }, [t._t("default", function() {
|
|
220
|
+
return [i("span", { staticClass: "d-filter-pill__label-alpha", domProps: { textContent: t._s(t.label) } }), t.activeFilterList ? i("span", { staticClass: "d-filter-pill__label-omega", domProps: { textContent: t._s(t.activeFilterList) } }) : t._e()];
|
|
221
|
+
})], 2)])];
|
|
222
|
+
} }, { key: "content", fn: function({ close: l }) {
|
|
223
|
+
return [t._t("content", function() {
|
|
224
|
+
return [t.value.length ? i("dt-checkbox-group", { attrs: { "selected-values": t.activeFilters, "aria-label": t.label, name: "contact-centers" } }, t._l(t.filters, function(a) {
|
|
225
|
+
return i("dt-checkbox", { key: a.name, attrs: { label: a.name, value: a.name }, on: { input: (r) => t.updateFilters(a, r) } });
|
|
226
|
+
}), 1) : t._e()];
|
|
227
|
+
}, { close: l })];
|
|
228
|
+
} }], null, !0), model: { value: t.isOpen, callback: function(l) {
|
|
229
|
+
t.isOpen = l;
|
|
230
|
+
}, expression: "isOpen" } }), t.hasClear ? i("dt-button", { directives: [{ name: "dt-tooltip", rawName: "v-dt-tooltip", value: t.omegaTooltipText, expression: "omegaTooltipText" }], class: [
|
|
231
|
+
"d-filter-pill__clear",
|
|
232
|
+
{ "d-filter-pill__clear--selected": t.isActive }
|
|
233
|
+
], attrs: { active: t.isActive, "aria-label": t.clearButtonAriaLabel, disabled: t.disabled, kind: t.buttonKind, size: t.size, title: t.clearButtonTitle, "data-qa": "dt-filter-pill__clear-button", importance: "outlined" }, on: { click: t.clearFilter }, scopedSlots: t._u([{ key: "icon", fn: function({ iconSize: l }) {
|
|
234
|
+
return [i("dt-icon-close", { attrs: { size: l } })];
|
|
235
|
+
} }], null, !1, 2924703597) }) : t._e()], 1);
|
|
236
|
+
}, g = [], T = /* @__PURE__ */ p(
|
|
237
|
+
h,
|
|
238
|
+
b,
|
|
239
|
+
g
|
|
240
|
+
);
|
|
241
|
+
const O = T.exports;
|
|
242
|
+
export {
|
|
243
|
+
O as default
|
|
244
|
+
};
|
|
245
|
+
//# sourceMappingURL=filter-pill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-pill.js","sources":["../../../components/filter_pill/filter_pill.vue"],"sourcesContent":["<template>\n <div\n class=\"d-filter-pill\"\n data-qa=\"dt-filter-pill\"\n >\n <dt-popover\n v-model=\"isOpen\"\n :append-to=\"popoverAppendTo\"\n :fallback-placements=\"popoverFallbackPlacements\"\n :max-height=\"popoverMaxHeight\"\n :max-width=\"popoverMaxWidth\"\n :modal=\"false\"\n :padding=\"popoverPadding\"\n :placement=\"popoverPlacement\"\n >\n <template #anchor=\"{ attrs }\">\n <dt-button\n v-dt-tooltip=\"alphaTooltipText\"\n v-bind=\"attrs\"\n :active=\"isActive\"\n :class=\"[\n 'd-filter-pill__primary',\n {\n 'd-filter-pill--selected': isActive,\n 'd-filter-pill__primary--has-clear': hasClear,\n },\n ]\"\n :disabled=\"disabled\"\n :kind=\"buttonKind\"\n :size=\"size\"\n data-qa=\"dt-filter-pill__button\"\n icon-position=\"right\"\n importance=\"outlined\"\n @click=\"isOpen = true\"\n >\n <span class=\"d-filter-pill__label\">\n <!-- @slot Allows you to override the label behavior -->\n <slot>\n <span\n class=\"d-filter-pill__label-alpha\"\n v-text=\"label\"\n />\n <span\n v-if=\"activeFilterList\"\n class=\"d-filter-pill__label-omega\"\n v-text=\"activeFilterList\"\n />\n </slot>\n </span>\n <template #icon=\"{ iconSize }\">\n <dt-icon-chevron-down\n :size=\"iconSize\"\n class=\"d-filter-pill__icon\"\n data-qa=\"dt-filter-pill__icon\"\n />\n </template>\n </dt-button>\n </template>\n <template #content=\"{ close }\">\n <!-- @slot Allows you to override the popover content, only use this if you need custom behavior -->\n <slot\n :close=\"close\"\n name=\"content\"\n >\n <dt-checkbox-group\n v-if=\"value.length\"\n :selected-values=\"activeFilters\"\n :aria-label=\"label\"\n name=\"contact-centers\"\n >\n <dt-checkbox\n v-for=\"filter in filters\"\n :key=\"filter.name\"\n :label=\"filter.name\"\n :value=\"filter.name\"\n @input=\"$event => updateFilters(filter, $event)\"\n />\n </dt-checkbox-group>\n </slot>\n </template>\n </dt-popover>\n <dt-button\n v-if=\"hasClear\"\n v-dt-tooltip=\"omegaTooltipText\"\n :active=\"isActive\"\n :aria-label=\"clearButtonAriaLabel\"\n :class=\"[\n 'd-filter-pill__clear',\n { 'd-filter-pill__clear--selected': isActive },\n ]\"\n :disabled=\"disabled\"\n :kind=\"buttonKind\"\n :size=\"size\"\n :title=\"clearButtonTitle\"\n data-qa=\"dt-filter-pill__clear-button\"\n importance=\"outlined\"\n @click=\"clearFilter\"\n >\n <template #icon=\"{ iconSize }\">\n <dt-icon-close :size=\"iconSize\" />\n </template>\n </dt-button>\n </div>\n</template>\n\n<script>\nimport { DtPopover, POPOVER_APPEND_TO_VALUES, POPOVER_PADDING_CLASSES } from '@/components/popover';\nimport { BUTTON_SIZE_MODIFIERS, DtButton } from '@/components/button';\nimport { DtIconChevronDown, DtIconClose } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\nimport { DtCheckbox } from '@/components/checkbox';\nimport { DtCheckboxGroup } from '@/components/checkbox_group';\n\nexport default {\n name: 'DtFilterPill',\n\n components: {\n DtCheckboxGroup,\n DtCheckbox,\n DtPopover,\n DtButton,\n DtIconClose,\n DtIconChevronDown,\n },\n\n inheritAttrs: false,\n\n props: {\n /**\n * Array of filters to display in the popover,\n * should be an array of objects with `name` and `active` properties\n */\n value: {\n type: Array,\n default: () => [],\n },\n\n /**\n * Text shown in tooltip when you hover the alpha button,\n * required if no content is passed to default slot\n */\n alphaTooltipText: {\n type: String,\n default: '',\n },\n\n /**\n * HTML disabled attribute\n */\n disabled: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Toggles the clear button visibility\n * @values true, false\n */\n hideClear: {\n type: Boolean,\n default: false,\n },\n\n /**\n * Label of the button\n */\n label: {\n type: String,\n default: undefined,\n },\n\n /**\n * Text shown in tooltip when you hover the omega button,\n * required as it is an icon only button\n */\n omegaTooltipText: {\n type: String,\n default: '',\n },\n\n /**\n * Sets the element to which the\n * <a class=\"d-link\" href=\"https://dialtone.dialpad.com/components/popover.html#vue-api\" target=\"_blank\">popover component</a>\n * is going to append to\n * @values body, parent, root, HTMLElement\n */\n popoverAppendTo: {\n type: [HTMLElement, String],\n default: 'body',\n validator: appendTo => {\n return POPOVER_APPEND_TO_VALUES.includes(appendTo) ||\n (appendTo instanceof HTMLElement);\n },\n },\n\n /**\n * If the dropdown does not fit in the direction described by \"popoverPlacement\",\n * it will attempt to change it's direction to the \"popoverFallbackPlacements\".\n *\n * @values top, top-start, top-end,\n * right, right-start, right-end,\n * left, left-start, left-end,\n * bottom, bottom-start, bottom-end,\n * auto, auto-start, auto-end\n * */\n popoverFallbackPlacements: {\n type: Array,\n default: () => {\n return ['auto'];\n },\n },\n\n /**\n * Determines maximum height for the popover before overflow.\n * Possible units rem|px|em\n */\n popoverMaxHeight: {\n type: String,\n default: '',\n },\n\n /**\n * Determines maximum width for the popover before overflow.\n * Possible units rem|px|%|em\n */\n popoverMaxWidth: {\n type: String,\n default: '',\n },\n\n /**\n * Padding size class for the popover content.\n * @values none, small, medium, large\n */\n popoverPadding: {\n type: String,\n default: 'large',\n validator: (padding) => {\n return Object.keys(POPOVER_PADDING_CLASSES).some((item) => item === padding);\n },\n },\n\n /**\n * The direction the popover displays relative to the anchor.\n * <a class=\"d-link\" href=\"https://atomiks.github.io/tippyjs/v6/all-props/#placement\" target=\"_blank\">Tippy.js docs</a>\n * @values top, top-start, top-end, right, right-start, right-end, left, left-start, left-end, bottom, bottom-start, bottom-end, auto, auto-start, auto-end\n */\n popoverPlacement: {\n type: String,\n default: 'bottom-start',\n },\n\n /**\n * The size of the button.\n * @values xs, sm, md, lg, xl\n */\n size: {\n type: String,\n default: 'sm',\n validator: (s) => Object.keys(BUTTON_SIZE_MODIFIERS).includes(s),\n },\n },\n\n emits: [\n /**\n * Emitted when clicking the clear button\n *\n * @event clear\n * @type {Boolean | Array}\n */\n 'clear',\n\n /**\n * Emitted when popover is shown or hidden\n *\n * @event opened\n * @type {Boolean | Array}\n */\n 'open',\n\n /**\n * Emitted when the active filters change\n * @type {Array}\n */\n 'update:value',\n ],\n\n data () {\n return {\n isOpen: false,\n i18n: new DialtoneLocalization(),\n filters: this.value,\n };\n },\n\n computed: {\n buttonKind () {\n return this.isActive ? 'default': 'muted';\n },\n\n clearButtonAriaLabel () {\n return this.omegaTooltipText || this.i18n.$t('DIALTONE_FILTER_PILL_CLEAR_BUTTON_LABEL');\n },\n\n clearButtonTitle () {\n if (this.omegaTooltipText) return;\n\n return this.clearButtonAriaLabel\n },\n\n activeFilters () {\n return this.filters.filter(filter => filter.active).map(filter => filter.name);\n },\n\n activeFilterList () {\n if (this.activeFilters.length <= 2) {\n return this.activeFilters.join(', ');\n }\n\n return this.activeFilters.slice(0, 2).join(', ') + ', + ' + (this.activeFilters.length - 2);\n },\n\n isActive () {\n return this.activeFilterList.length > 0;\n },\n\n hasClear () {\n return !this.hideClear && this.activeFilterList.length > 0;\n },\n },\n\n watch: {\n isOpen (isOpen) {\n this.$emit('open', isOpen);\n },\n\n filters (filters) {\n this.$emit('update:value', filters);\n },\n },\n\n methods: {\n clearFilter ($event) {\n this.filters = this.filters.map(filter => {\n delete filter.active\n return filter;\n });\n this.$emit('clear', $event)\n },\n\n updateFilters (filter, isActive) {\n this.filters = this.filters.map(f => {\n if (f.name !== filter.name) return f;\n\n return {...f, active: isActive};\n })\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtCheckboxGroup","DtCheckbox","DtPopover","DtButton","DtIconClose","DtIconChevronDown","appendTo","POPOVER_APPEND_TO_VALUES","padding","POPOVER_PADDING_CLASSES","item","s","BUTTON_SIZE_MODIFIERS","DialtoneLocalization","filter","isOpen","filters","$event","isActive","f"],"mappings":";;;;;;;;;AAiHA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAA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AA,IACA;AAAA,IAEA,WAAA;AACA,aAAA,CAAA,KAAA,aAAA,KAAA,iBAAA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA,IACA,OAAAC,GAAA;AACA,WAAA,MAAA,QAAAA,CAAA;AAAA,IACA;AAAA,IAEA,QAAAC,GAAA;AACA,WAAA,MAAA,gBAAAA,CAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,SAAA;AAAA,IACA,YAAAC,GAAA;AACA,WAAA,UAAA,KAAA,QAAA,IAAA,CAAAH,OACA,OAAAA,EAAA,QACAA,EACA,GACA,KAAA,MAAA,SAAAG,CAAA;AAAA,IACA;AAAA,IAEA,cAAAH,GAAAI,GAAA;AACA,WAAA,UAAA,KAAA,QAAA,IAAA,CAAAC,MACAA,EAAA,SAAAL,EAAA,OAAAK,IAEA,EAAA,GAAAA,GAAA,QAAAD,EAAA,CACA;AAAA,IACA;AAAA,EACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@dialpad/dialtone-icons/vue2"),u=require("../../localization/index.cjs"),l=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),g=require("../button/button.cjs"),h={name:"DtPagination",components:{DtButton:g.default,DtIconChevronLeft:o.DtIconChevronLeft,DtIconChevronRight:o.DtIconChevronRight,DtIconMoreHorizontal:o.DtIconMoreHorizontal},props:{ariaLabel:{type:String,required:!0},totalPages:{type:Number,required:!0},activePage:{type:Number,default:1},maxVisible:{type:Number,default:5},hideEdges:{type:Boolean,default:!1}},emits:["change"],data(){return{currentPage:this.activePage,i18n:new u.DialtoneLocalization}},computed:{isFirstPage(){return this.currentPage===1},isLastPage(){return this.currentPage===this.totalPages},pages(){if(this.maxVisible===0)return[];if(this.totalPages<=this.maxVisible)return this.range(1,this.totalPages);let e=this.maxVisible-1,t=this.totalPages-e+1;if(this.hideEdges&&(e=e+1,t=t-1),this.currentPage<e){const n=[...this.range(1,e),"..."];return this.hideEdges||n.push(this.totalPages),n}if(this.currentPage>t){const n=["...",...this.range(t,this.totalPages)];return this.hideEdges||n.unshift(1),n}const i=this.maxVisible-(3-this.maxVisible%2),a=Math.floor(i/2);let r=this.currentPage-a,s=this.currentPage+a;this.hideEdges&&(r=r-1,s=s+1);const c=["...",...this.range(r,s),"..."];return this.hideEdges?c:[1,...c,this.totalPages]},prevAriaLabel(){return this.isFirstPage?this.i18n.$t("DIALTONE_PAGINATION_FIRST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_PREVIOUS_PAGE")},nextAriaLabel(){return this.isLastPage?this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_NEXT_PAGE")},pageNumberAriaLabel(){return e=>e===this.totalPages?`${this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE")} ${e}`:`${this.i18n.$t("DIALTONE_PAGINATION_PAGE_NUMBER",{page:e})}`}},watch:{activePage(){this.currentPage=this.activePage},totalPages(e){(this.currentPage>e||this.currentPage<=0)&&(this.currentPage=e)}},methods:{range(e,t){const i=[];e=e>0?e:1;for(let a=e;a<=t;a++)i.push(a);return i},changePage(e){this.currentPage=e,this.$emit("change",this.currentPage)}}};var d=function(){var t=this,i=t._self._c;return i("nav",{directives:[{name:"show",rawName:"v-show",value:t.totalPages>0,expression:"totalPages > 0"}],staticClass:"d-pagination",attrs:{"aria-label":t.ariaLabel}},[i("dt-button",{staticClass:"d-pagination__button",attrs:{"data-qa":"dt-pagination-prev","aria-label":t.prevAriaLabel,kind:"muted",importance:"clear",disabled:t.isFirstPage},on:{click:function(a){return t.changePage(t.currentPage-1)}},scopedSlots:t._u([{key:"icon",fn:function(){return[i("dt-icon-chevron-left",{attrs:{size:"300"}})]},proxy:!0}])}),t._l(t.pages,function(a,r){return i("div",{key:`page-${a}-${r}`,class:{"d-pagination__separator":isNaN(Number(a))}},[isNaN(Number(a))?i("div",{staticClass:"d-pagination__separator-icon",attrs:{"data-qa":"dt-pagination-separator"}},[i("dt-icon-more-horizontal",{attrs:{size:"300"}})],1):i("dt-button",{attrs:{"aria-label":t.pageNumberAriaLabel(a),kind:t.currentPage===a?"default":"muted",importance:t.currentPage===a?"primary":"clear","label-class":""},on:{click:function(s){return t.changePage(a)}}},[t._v(" "+t._s(a)+" ")])],1)}),i("dt-button",{staticClass:"d-pagination__button",attrs:{"data-qa":"dt-pagination-next","aria-label":t.nextAriaLabel,disabled:t.isLastPage,kind:"muted",importance:"clear"},on:{click:function(a){return t.changePage(t.currentPage+1)}},scopedSlots:t._u([{key:"icon",fn:function(){return[i("dt-icon-chevron-right",{attrs:{size:"300"}})]},proxy:!0}])})],2)},P=[],_=l.n(h,d,P);const b=_.exports;exports.default=b;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("@dialpad/dialtone-icons/vue2"),u=require("../../localization/index.cjs"),l=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),g=require("../button/button.cjs"),h={name:"DtPagination",components:{DtButton:g.default,DtIconChevronLeft:o.DtIconChevronLeft,DtIconChevronRight:o.DtIconChevronRight,DtIconMoreHorizontal:o.DtIconMoreHorizontal},props:{ariaLabel:{type:String,required:!0},totalPages:{type:Number,required:!0},activePage:{type:Number,default:1},maxVisible:{type:Number,default:5},hideEdges:{type:Boolean,default:!1}},emits:["change"],data(){return{currentPage:this.activePage,i18n:new u.DialtoneLocalization}},computed:{isFirstPage(){return this.currentPage===1},isLastPage(){return this.currentPage===this.totalPages},pages(){if(this.maxVisible===0)return[];if(this.totalPages<=this.maxVisible)return this.range(1,this.totalPages);let e=this.maxVisible-1,t=this.totalPages-e+1;if(this.hideEdges&&(e=e+1,t=t-1),this.currentPage<e){const n=[...this.range(1,e),"..."];return this.hideEdges||n.push(this.totalPages),n}if(this.currentPage>t){const n=["...",...this.range(t,this.totalPages)];return this.hideEdges||n.unshift(1),n}const i=this.maxVisible-(3-this.maxVisible%2),a=Math.floor(i/2);let r=this.currentPage-a,s=this.currentPage+a;this.hideEdges&&(r=r-1,s=s+1);const c=["...",...this.range(r,s),"..."];return this.hideEdges?c:[1,...c,this.totalPages]},prevAriaLabel(){return this.isFirstPage?this.i18n.$t("DIALTONE_PAGINATION_FIRST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_PREVIOUS_PAGE")},nextAriaLabel(){return this.isLastPage?this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE"):this.i18n.$t("DIALTONE_PAGINATION_NEXT_PAGE")},pageNumberAriaLabel(){return e=>e===this.totalPages?`${this.i18n.$t("DIALTONE_PAGINATION_LAST_PAGE")} ${e}`:`${this.i18n.$t("DIALTONE_PAGINATION_PAGE_NUMBER",{page:e})}`}},watch:{activePage(){this.currentPage=this.activePage},totalPages(e){(this.currentPage>e||this.currentPage<=0)&&(this.currentPage=e)}},methods:{range(e,t){const i=[];e=e>0?e:1;for(let a=e;a<=t;a++)i.push(a);return i},changePage(e){this.currentPage=e,this.$emit("change",this.currentPage)}}};var d=function(){var t=this,i=t._self._c;return i("nav",{directives:[{name:"show",rawName:"v-show",value:t.totalPages>0,expression:"totalPages > 0"}],staticClass:"d-pagination",attrs:{"aria-label":t.ariaLabel}},[i("dt-button",{staticClass:"d-pagination__button",attrs:{"data-qa":"dt-pagination-prev","aria-label":t.prevAriaLabel,kind:"muted",importance:"clear",disabled:t.isFirstPage},on:{click:function(a){return t.changePage(t.currentPage-1)}},scopedSlots:t._u([{key:"icon",fn:function(){return[i("dt-icon-chevron-left",{attrs:{size:"300"}})]},proxy:!0}])}),t._l(t.pages,function(a,r){return i("div",{key:`page-${a}-${r}`,class:{"d-pagination__separator":isNaN(Number(a))}},[isNaN(Number(a))?i("div",{staticClass:"d-pagination__separator-icon",attrs:{"data-qa":"dt-pagination-separator"}},[i("dt-icon-more-horizontal",{attrs:{size:"300"}})],1):i("dt-button",{staticClass:"d-pagination__item",attrs:{"aria-label":t.pageNumberAriaLabel(a),kind:t.currentPage===a?"default":"muted",importance:t.currentPage===a?"primary":"clear","label-class":"d-pagination__item-label"},on:{click:function(s){return t.changePage(a)}}},[t._v(" "+t._s(a)+" ")])],1)}),i("dt-button",{staticClass:"d-pagination__button",attrs:{"data-qa":"dt-pagination-next","aria-label":t.nextAriaLabel,disabled:t.isLastPage,kind:"muted",importance:"clear"},on:{click:function(a){return t.changePage(t.currentPage+1)}},scopedSlots:t._u([{key:"icon",fn:function(){return[i("dt-icon-chevron-right",{attrs:{size:"300"}})]},proxy:!0}])})],2)},P=[],_=l.n(h,d,P);const b=_.exports;exports.default=b;
|
|
2
2
|
//# sourceMappingURL=pagination.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.cjs","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pagination.cjs","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n class=\"d-pagination__item\"\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"d-pagination__item-label\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i"],"mappings":"gSA4EAA,EAAA,CACA,KAAA,eAEA,WAAA,CACA,SAAAC,EAAAA,QACA,kBAAAC,EAAAA,kBACA,mBAAAC,EAAAA,mBACA,qBAAAC,EAAAA,oBACA,EAEA,MAAA,CAIA,UAAA,CACA,KAAA,OACA,SAAA,EACA,EAKA,WAAA,CACA,KAAA,OACA,SAAA,EACA,EAKA,WAAA,CACA,KAAA,OACA,QAAA,CACA,EAOA,WAAA,CACA,KAAA,OACA,QAAA,CACA,EAOA,UAAA,CACA,KAAA,QACA,QAAA,EACA,CACA,EAEA,MAAA,CAOA,QACA,EAEA,MAAA,CACA,MAAA,CACA,YAAA,KAAA,WACA,KAAA,IAAAC,EAAAA,oBACA,CACA,EAEA,SAAA,CACA,aAAA,CACA,OAAA,KAAA,cAAA,CACA,EAEA,YAAA,CACA,OAAA,KAAA,cAAA,KAAA,UACA,EAGA,OAAA,CACA,GAAA,KAAA,aAAA,EACA,MAAA,CAAA,EAEA,GAAA,KAAA,YAAA,KAAA,WACA,OAAA,KAAA,MAAA,EAAA,KAAA,UAAA,EAGA,IAAAC,EAAA,KAAA,WAAA,EACAC,EAAA,KAAA,WAAAD,EAAA,EASA,GALA,KAAA,YACAA,EAAAA,EAAA,EACAC,EAAAA,EAAA,GAGA,KAAA,YAAAD,EAAA,CACA,MAAAE,EAAA,CAAA,GAAA,KAAA,MAAA,EAAAF,CAAA,EAAA,KAAA,EACA,OAAA,KAAA,WAEAE,EAAA,KAAA,KAAA,UAAA,EAEAA,CACA,CAEA,GAAA,KAAA,YAAAD,EAAA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ACA,CACA,CACA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DtIconMoreHorizontal as c, DtIconChevronRight as
|
|
2
|
-
import { DialtoneLocalization as
|
|
3
|
-
import { n as
|
|
1
|
+
import { DtIconMoreHorizontal as c, DtIconChevronRight as l, DtIconChevronLeft as u } from "@dialpad/dialtone-icons/vue2";
|
|
2
|
+
import { DialtoneLocalization as g } from "../../localization/index.js";
|
|
3
|
+
import { n as h } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
|
|
4
4
|
import d from "../button/button.js";
|
|
5
5
|
const P = {
|
|
6
6
|
name: "DtPagination",
|
|
7
7
|
components: {
|
|
8
8
|
DtButton: d,
|
|
9
|
-
DtIconChevronLeft:
|
|
10
|
-
DtIconChevronRight:
|
|
9
|
+
DtIconChevronLeft: u,
|
|
10
|
+
DtIconChevronRight: l,
|
|
11
11
|
DtIconMoreHorizontal: c
|
|
12
12
|
},
|
|
13
13
|
props: {
|
|
@@ -63,7 +63,7 @@ const P = {
|
|
|
63
63
|
data() {
|
|
64
64
|
return {
|
|
65
65
|
currentPage: this.activePage,
|
|
66
|
-
i18n: new
|
|
66
|
+
i18n: new g()
|
|
67
67
|
};
|
|
68
68
|
},
|
|
69
69
|
computed: {
|
|
@@ -132,7 +132,7 @@ var _ = function() {
|
|
|
132
132
|
} }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
133
133
|
return [i("dt-icon-chevron-left", { attrs: { size: "300" } })];
|
|
134
134
|
}, proxy: !0 }]) }), t._l(t.pages, function(a, r) {
|
|
135
|
-
return i("div", { key: `page-${a}-${r}`, class: { "d-pagination__separator": isNaN(Number(a)) } }, [isNaN(Number(a)) ? i("div", { staticClass: "d-pagination__separator-icon", attrs: { "data-qa": "dt-pagination-separator" } }, [i("dt-icon-more-horizontal", { attrs: { size: "300" } })], 1) : i("dt-button", { attrs: { "aria-label": t.pageNumberAriaLabel(a), kind: t.currentPage === a ? "default" : "muted", importance: t.currentPage === a ? "primary" : "clear", "label-class": "" }, on: { click: function(s) {
|
|
135
|
+
return i("div", { key: `page-${a}-${r}`, class: { "d-pagination__separator": isNaN(Number(a)) } }, [isNaN(Number(a)) ? i("div", { staticClass: "d-pagination__separator-icon", attrs: { "data-qa": "dt-pagination-separator" } }, [i("dt-icon-more-horizontal", { attrs: { size: "300" } })], 1) : i("dt-button", { staticClass: "d-pagination__item", attrs: { "aria-label": t.pageNumberAriaLabel(a), kind: t.currentPage === a ? "default" : "muted", importance: t.currentPage === a ? "primary" : "clear", "label-class": "d-pagination__item-label" }, on: { click: function(s) {
|
|
136
136
|
return t.changePage(a);
|
|
137
137
|
} } }, [t._v(" " + t._s(a) + " ")])], 1);
|
|
138
138
|
}), i("dt-button", { staticClass: "d-pagination__button", attrs: { "data-qa": "dt-pagination-next", "aria-label": t.nextAriaLabel, disabled: t.isLastPage, kind: "muted", importance: "clear" }, on: { click: function(a) {
|
|
@@ -140,7 +140,7 @@ var _ = function() {
|
|
|
140
140
|
} }, scopedSlots: t._u([{ key: "icon", fn: function() {
|
|
141
141
|
return [i("dt-icon-chevron-right", { attrs: { size: "300" } })];
|
|
142
142
|
}, proxy: !0 }]) })], 2);
|
|
143
|
-
}, p = [], m = /* @__PURE__ */
|
|
143
|
+
}, p = [], m = /* @__PURE__ */ h(
|
|
144
144
|
P,
|
|
145
145
|
_,
|
|
146
146
|
p
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"pagination.js","sources":["../../../components/pagination/pagination.vue"],"sourcesContent":["<template>\n <nav\n v-show=\"totalPages > 0\"\n :aria-label=\"ariaLabel\"\n class=\"d-pagination\"\n >\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-prev\"\n :aria-label=\"prevAriaLabel\"\n kind=\"muted\"\n importance=\"clear\"\n :disabled=\"isFirstPage\"\n @click=\"changePage(currentPage - 1)\"\n >\n <template #icon>\n <dt-icon-chevron-left\n size=\"300\"\n />\n </template>\n </dt-button>\n <div\n v-for=\"(page, index) in pages\"\n :key=\"`page-${page}-${index}`\"\n :class=\"{ 'd-pagination__separator': isNaN(Number(page)) }\"\n >\n <!-- eslint-disable vue/no-bare-strings-in-template -->\n <div\n v-if=\"isNaN(Number(page))\"\n class=\"d-pagination__separator-icon\"\n data-qa=\"dt-pagination-separator\"\n >\n <dt-icon-more-horizontal\n size=\"300\"\n />\n <!-- … -->\n </div>\n <dt-button\n v-else\n class=\"d-pagination__item\"\n :aria-label=\"pageNumberAriaLabel(page)\"\n :kind=\"currentPage === page ? 'default' : 'muted'\"\n :importance=\"currentPage === page ? 'primary' : 'clear'\"\n label-class=\"d-pagination__item-label\"\n @click=\"changePage(page)\"\n >\n {{ page }}\n </dt-button>\n </div>\n <dt-button\n class=\"d-pagination__button\"\n data-qa=\"dt-pagination-next\"\n :aria-label=\"nextAriaLabel\"\n :disabled=\"isLastPage\"\n kind=\"muted\"\n importance=\"clear\"\n @click=\"changePage(currentPage + 1)\"\n >\n <template #icon>\n <dt-icon-chevron-right\n size=\"300\"\n />\n </template>\n </dt-button>\n </nav>\n</template>\n\n<script>\nimport { DtButton } from '@/components/button';\nimport { DtIconChevronLeft, DtIconChevronRight, DtIconMoreHorizontal } from '@dialpad/dialtone-icons/vue2';\nimport { DialtoneLocalization } from '@/localization';\n\n/**\n * Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.\n * @see https://dialtone.dialpad.com/components/pagination.html\n */\nexport default {\n name: 'DtPagination',\n\n components: {\n DtButton,\n DtIconChevronLeft,\n DtIconChevronRight,\n DtIconMoreHorizontal,\n },\n\n props: {\n /**\n * Descriptive label for the pagination content.\n */\n ariaLabel: {\n type: String,\n required: true,\n },\n\n /**\n * The total number of the pages\n */\n totalPages: {\n type: Number,\n required: true,\n },\n\n /**\n * The active current page in the list of pages, defaults to the first page\n */\n activePage: {\n type: Number,\n default: 1,\n },\n\n /**\n * Determines the max pages to be shown in the list. Using an odd number is recommended.\n * If an even number is given, then it will be rounded down to the nearest odd number to always\n * keep current page in the middle when current page is in the mid-range.\n */\n maxVisible: {\n type: Number,\n default: 5,\n },\n\n /**\n * Sometimes you may need to hide start and end page number buttons when moving in between.\n * This prop will be used to hide the first and last page buttons when not near the edges.\n * This is useful when your backend does not support offset and you can only use cursor based pagination.\n */\n hideEdges: {\n type: Boolean,\n default: false,\n },\n },\n\n emits: [\n /**\n * Page change event\n *\n * @event change\n * @type {Number}\n */\n 'change',\n ],\n\n data () {\n return {\n currentPage: this.activePage,\n i18n: new DialtoneLocalization(),\n };\n },\n\n computed: {\n isFirstPage () {\n return this.currentPage === 1;\n },\n\n isLastPage () {\n return this.currentPage === this.totalPages;\n },\n\n // eslint-disable-next-line complexity\n pages () {\n if (this.maxVisible === 0) {\n return [];\n }\n if (this.totalPages <= this.maxVisible) {\n return this.range(1, this.totalPages);\n }\n\n let start = this.maxVisible - 1;\n let end = this.totalPages - start + 1;\n\n // if hideEdges is true, modify the start and\n // end to account for the hidden pages\n if (this.hideEdges) {\n start = start + 1;\n end = end - 1;\n }\n\n if (this.currentPage < start) {\n const pages = [...this.range(1, start), '...'];\n if (!this.hideEdges) {\n // add last page to the end\n pages.push(this.totalPages);\n }\n return pages;\n }\n\n if (this.currentPage > end) {\n const pages = ['...', ...this.range(end, this.totalPages)];\n if (!this.hideEdges) {\n // add first page to the beginning\n pages.unshift(1);\n }\n return pages;\n }\n\n // rounding to the nearest odd according to the maxlength to always show the page number in the middle.\n const total = this.maxVisible - (3 - this.maxVisible % 2);\n const centerIndex = Math.floor(total / 2);\n let left = this.currentPage - centerIndex;\n let right = this.currentPage + centerIndex;\n\n // if hideEdge is true, modify the left and right to account for the hidden pages\n if (this.hideEdges) {\n left = left - 1;\n right = right + 1;\n }\n\n const pages = ['...', ...this.range(left, right), '...'];\n if (!this.hideEdges) {\n return [1, ...pages, this.totalPages];\n }\n return pages;\n },\n\n prevAriaLabel () {\n return this.isFirstPage ? this.i18n.$t('DIALTONE_PAGINATION_FIRST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_PREVIOUS_PAGE');\n },\n\n nextAriaLabel () {\n return this.isLastPage ? this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE') : this.i18n.$t('DIALTONE_PAGINATION_NEXT_PAGE');\n },\n\n pageNumberAriaLabel () {\n return (page) => {\n return page === this.totalPages ? `${this.i18n.$t('DIALTONE_PAGINATION_LAST_PAGE')} ${page}` : `${this.i18n.$t('DIALTONE_PAGINATION_PAGE_NUMBER', { page })}`;\n };\n },\n },\n\n watch: {\n activePage () {\n this.currentPage = this.activePage;\n },\n\n totalPages (pages) {\n if (this.currentPage > pages || this.currentPage <= 0){\n this.currentPage = pages;\n }\n },\n },\n\n methods: {\n range (from, to) {\n const range = [];\n from = from > 0 ? from : 1;\n for (let i = from; i <= to; i++) {\n range.push(i);\n }\n return range;\n },\n\n changePage (page) {\n this.currentPage = page;\n this.$emit('change', this.currentPage);\n },\n },\n};\n</script>\n"],"names":["_sfc_main","DtButton","DtIconChevronLeft","DtIconChevronRight","DtIconMoreHorizontal","DialtoneLocalization","start","end","pages","total","centerIndex","left","right","page","from","to","range","i"],"mappings":";;;;AA4EA,MAAAA,IAAA;AAAA,EACA,MAAA;AAAA,EAEA,YAAA;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,sBAAAC;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA,IAIA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,YAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA,IAKA,YAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,YAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,WAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EAEA,OAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOA;AAAA,EACA;AAAA,EAEA,OAAA;AACA,WAAA;AAAA,MACA,aAAA,KAAA;AAAA,MACA,MAAA,IAAAC,EAAA;AAAA,IACA;AA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