bootstrap-vue-next 0.25.9 → 0.25.11
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/{BAlert-Q-bAHt4X.mjs → BAlert-DRD6Q3cQ.mjs} +5 -4
- package/dist/{BAlert-Q-bAHt4X.mjs.map → BAlert-DRD6Q3cQ.mjs.map} +1 -1
- package/dist/BAlert-P_IB7iko.js +2 -0
- package/dist/{BAlert-CFrrDdHt.js.map → BAlert-P_IB7iko.js.map} +1 -1
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-DLW4Bi3B.js +2 -0
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-DLW4Bi3B.js.map +1 -0
- package/dist/{BPagination.vue_vue_type_script_setup_true_lang-CkE7syzG.mjs → BPagination.vue_vue_type_script_setup_true_lang-zRHVG-iF.mjs} +49 -34
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-zRHVG-iF.mjs.map +1 -0
- package/dist/{BToastOrchestrator.vue_vue_type_style_index_0_lang-CS58dgbJ.mjs → BToastOrchestrator.vue_vue_type_style_index_0_lang-DzwoIRAO.mjs} +4 -3
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-DzwoIRAO.mjs.map +1 -0
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-JeP55Rpn.js +2 -0
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-JeP55Rpn.js.map +1 -0
- package/dist/bootstrap-vue-next.css +1 -1
- package/dist/bootstrap-vue-next.mjs +4 -4
- package/dist/bootstrap-vue-next.umd.js +1 -1
- package/dist/{index-BaAUr2Mt.mjs → index-Ckv10UB0.mjs} +4 -4
- package/dist/{index-BaAUr2Mt.mjs.map → index-Ckv10UB0.mjs.map} +1 -1
- package/dist/{index-Cj7oqCSZ.js → index-DsBqp3u3.js} +2 -2
- package/dist/index-DsBqp3u3.js.map +1 -0
- package/dist/src/components/BAlert/index.mjs +1 -1
- package/dist/src/components/BAlert/index.umd.js +1 -1
- package/dist/src/components/BPagination/index.mjs +1 -1
- package/dist/src/components/BPagination/index.umd.js +1 -1
- package/dist/src/components/BToast/index.mjs +1 -1
- package/dist/src/components/BToast/index.umd.js +1 -1
- package/dist/src/components/index.mjs +3 -3
- package/dist/src/components/index.umd.js +1 -1
- package/dist/src/composables/useCountdownHover.d.mts +4 -0
- package/dist/src/composables/useCountdownHover.d.ts +4 -0
- package/dist/useCountdownHover-C90kBVrr.js +2 -0
- package/dist/{useCountdownHover-CqJoFmwr.js.map → useCountdownHover-C90kBVrr.js.map} +1 -1
- package/dist/{useCountdownHover-BA5Bp2xo.mjs → useCountdownHover-CW4HHqec.mjs} +2 -1
- package/dist/{useCountdownHover-BA5Bp2xo.mjs.map → useCountdownHover-CW4HHqec.mjs.map} +1 -1
- package/package.json +1 -1
- package/src/components/BFormSpinbutton/_spinbutton.scss +4 -0
- package/src/styles/styles.scss +9 -0
- package/dist/BAlert-CFrrDdHt.js +0 -2
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-CkE7syzG.mjs.map +0 -1
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-QNBZEvvR.js +0 -2
- package/dist/BPagination.vue_vue_type_script_setup_true_lang-QNBZEvvR.js.map +0 -1
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-C1UC8xQT.js +0 -2
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-C1UC8xQT.js.map +0 -1
- package/dist/BToastOrchestrator.vue_vue_type_style_index_0_lang-CS58dgbJ.mjs.map +0 -1
- package/dist/index-Cj7oqCSZ.js.map +0 -1
- package/dist/useCountdownHover-CqJoFmwr.js +0 -2
|
@@ -2,7 +2,7 @@ import { defineComponent, mergeModels, useSlots, ref, useModel, computed, watchE
|
|
|
2
2
|
import { _ as _sfc_main$1 } from "./BTransition.vue_vue_type_style_index_0_lang-X5a8jq3A.mjs";
|
|
3
3
|
import { _ as _sfc_main$3 } from "./BCloseButton.vue_vue_type_script_setup_true_lang-8cgz9_uq.mjs";
|
|
4
4
|
import { _ as _sfc_main$2 } from "./BButton.vue_vue_type_script_setup_true_lang-BdSl6KfQ.mjs";
|
|
5
|
-
import { u as useCountdown, a as useCountdownHover } from "./useCountdownHover-
|
|
5
|
+
import { u as useCountdown, a as useCountdownHover } from "./useCountdownHover-CW4HHqec.mjs";
|
|
6
6
|
import { u as useDefaults } from "./useDefaults-6tLPt05C.mjs";
|
|
7
7
|
import { i as isEmptySlot } from "./dom-B-SQyhbA.mjs";
|
|
8
8
|
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.mjs";
|
|
@@ -57,7 +57,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
57
|
element,
|
|
58
58
|
computed(() => ({
|
|
59
59
|
noHoverPause: props.noHoverPause,
|
|
60
|
-
noResumeOnHoverLeave: props.noResumeOnHoverLeave
|
|
60
|
+
noResumeOnHoverLeave: props.noResumeOnHoverLeave,
|
|
61
|
+
modelValueIgnoresHover: typeof modelValue.value === "boolean"
|
|
61
62
|
})),
|
|
62
63
|
{ pause, resume }
|
|
63
64
|
);
|
|
@@ -123,8 +124,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
123
124
|
};
|
|
124
125
|
}
|
|
125
126
|
});
|
|
126
|
-
const BAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
127
|
+
const BAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-2f3988be"]]);
|
|
127
128
|
export {
|
|
128
129
|
BAlert as B
|
|
129
130
|
};
|
|
130
|
-
//# sourceMappingURL=BAlert-
|
|
131
|
+
//# sourceMappingURL=BAlert-DRD6Q3cQ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BAlert-
|
|
1
|
+
{"version":3,"file":"BAlert-DRD6Q3cQ.mjs","sources":["../src/components/BAlert/BAlert.vue"],"sourcesContent":["<template>\n <BTransition :no-fade=\"!props.fade\" :trans-props=\"{enterToClass: 'show'}\">\n <div\n v-if=\"isAlertVisible\"\n ref=\"element\"\n class=\"alert\"\n role=\"alert\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n :class=\"computedClasses\"\n >\n <slot />\n <template v-if=\"props.dismissible\">\n <BButton v-if=\"hasCloseSlot || props.closeContent\" v-bind=\"closeAttrs\" @click=\"hide\">\n <slot name=\"close\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton v-else :aria-label=\"props.closeLabel\" v-bind=\"closeAttrs\" @click=\"hide\" />\n </template>\n </div>\n </BTransition>\n</template>\n\n<script setup lang=\"ts\">\nimport BTransition from '../BTransition.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BButton from '../BButton/BButton.vue'\nimport type {BAlertProps} from '../../types/ComponentProps'\nimport {computed, ref, watchEffect} from 'vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {isEmptySlot} from '../../utils/dom'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n fade: false,\n immediate: true,\n interval: 'requestAnimationFrame',\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n showOnPause: true,\n variant: 'info',\n})\n\nconst props = useDefaults(_props, 'BAlert')\n\nconst emit = defineEmits<{\n 'close': []\n 'close-countdown': [value: number]\n 'closed': []\n}>()\n\nconst slots = defineSlots<{\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n close?: (props: Record<string, never>) => any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default?: (props: Record<string, never>) => any\n}>()\n\nconst element = ref<HTMLElement | null>(null)\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\n\nconst hasCloseSlot = computed(() => !isEmptySlot(slots.close))\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst computedClasses = computed(() => ({\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible,\n}))\n\nconst closeClasses = computed(() => [props.closeClass, {'btn-close-custom': hasCloseSlot.value}])\n\nconst {\n isActive,\n pause,\n resume,\n stop,\n isPaused,\n restart,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && props.immediate,\n})\nuseCountdownHover(\n element,\n computed(() => ({\n noHoverPause: props.noHoverPause,\n noResumeOnHoverLeave: props.noResumeOnHoverLeave,\n modelValueIgnoresHover: typeof modelValue.value === 'boolean',\n })),\n {pause, resume}\n)\n\nconst isAlertVisible = computed(() =>\n typeof modelValue.value === 'boolean'\n ? modelValue.value\n : isActive.value || (props.showOnPause && isPaused.value)\n)\n\nconst closeAttrs = computed(() => ({\n variant: hasCloseSlot.value ? props.closeVariant : undefined,\n class: closeClasses.value,\n}))\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst hide = () => {\n emit('close')\n\n if (typeof modelValue.value === 'boolean') {\n modelValue.value = false\n } else {\n modelValue.value = 0\n stop()\n }\n\n emit('closed')\n}\n\ndefineExpose({\n pause,\n resume,\n stop,\n restart,\n})\n</script>\n\n<style lang=\"scss\" scoped>\n.btn-close-custom {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n margin: var(--bs-alert-padding-y) var(--bs-alert-padding-x);\n}\n</style>\n"],"names":["_useSlots","_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,UAAM,SAAS;AAeT,UAAA,QAAQ,YAAY,QAAQ,QAAQ;AAE1C,UAAM,OAAO;AAMb,UAAM,QAAQA;AAOR,UAAA,UAAU,IAAwB,IAAI;AAEtC,UAAA,aAAaC,8BAA2E;AAE9F,UAAM,eAAe,SAAS,MAAM,CAAC,YAAY,MAAM,KAAK,CA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ACA;AAAA,MACA;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),o=require("./BTransition.vue_vue_type_style_index_0_lang-dOw0_NRO.js"),l=require("./BCloseButton.vue_vue_type_script_setup_true_lang-DN7lP-29.js"),t=require("./BButton.vue_vue_type_script_setup_true_lang-CJw5OVdo.js"),a=require("./useCountdownHover-C90kBVrr.js"),s=require("./useDefaults-DA3S59IE.js"),u=require("./dom-C-F8jHop.js"),r=require("./_plugin-vue_export-helper-CC_fc8JW.js"),n=e.defineComponent({__name:"BAlert",props:e.mergeModels({closeClass:{default:void 0},closeContent:{default:void 0},closeLabel:{default:"Close"},closeVariant:{default:"secondary"},dismissible:{type:Boolean,default:!1},fade:{type:Boolean,default:!1},immediate:{type:Boolean,default:!0},interval:{default:"requestAnimationFrame"},noHoverPause:{type:Boolean,default:!1},noResumeOnHoverLeave:{type:Boolean,default:!1},showOnPause:{type:Boolean,default:!0},variant:{default:"info"}},{modelValue:{type:[Boolean,Number],default:!1},modelModifiers:{}}),emits:e.mergeModels(["close","close-countdown","closed"],["update:modelValue"]),setup(r,{expose:n,emit:i}){const d=r,c=s.useDefaults(d,"BAlert"),m=i,p=e.useSlots(),v=e.ref(null),f=e.useModel(r,"modelValue"),_=e.computed((()=>!u.isEmptySlot(p.close))),B=e.computed((()=>"boolean"==typeof f.value?0:f.value)),y=e.computed((()=>({[`alert-${c.variant}`]:null!==c.variant,"alert-dismissible":c.dismissible}))),C=e.computed((()=>[c.closeClass,{"btn-close-custom":_.value}])),{isActive:k,pause:b,resume:g,stop:w,isPaused:q,restart:H,value:V}=a.useCountdown(B,c.interval,{immediate:"number"==typeof f.value&&c.immediate});a.useCountdownHover(v,e.computed((()=>({noHoverPause:c.noHoverPause,noResumeOnHoverLeave:c.noResumeOnHoverLeave,modelValueIgnoresHover:"boolean"==typeof f.value}))),{pause:b,resume:g});const x=e.computed((()=>"boolean"==typeof f.value?f.value:k.value||c.showOnPause&&q.value)),P=e.computed((()=>({variant:_.value?c.closeVariant:void 0,class:C.value})));e.watchEffect((()=>{m("close-countdown",V.value)}));const h=()=>{m("close"),"boolean"==typeof f.value?f.value=!1:(f.value=0,w()),m("closed")};return n({pause:b,resume:g,stop:w,restart:H}),(a,s)=>(e.openBlock(),e.createBlock(o._sfc_main,{"no-fade":!e.unref(c).fade,"trans-props":{enterToClass:"show"}},{default:e.withCtx((()=>[x.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"element",ref:v,class:e.normalizeClass(["alert",y.value]),role:"alert","aria-live":"polite","aria-atomic":"true"},[e.renderSlot(a.$slots,"default",{},void 0,!0),e.unref(c).dismissible?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_.value||e.unref(c).closeContent?(e.openBlock(),e.createBlock(t._sfc_main,e.mergeProps({key:0},P.value,{onClick:h}),{default:e.withCtx((()=>[e.renderSlot(a.$slots,"close",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(c).closeContent),1)]),!0)])),_:3},16)):(e.openBlock(),e.createBlock(l._sfc_main,e.mergeProps({key:1,"aria-label":e.unref(c).closeLabel},P.value,{onClick:h}),null,16,["aria-label"]))],64)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)])),_:3},8,["no-fade"]))}}),i=r._export_sfc(n,[["__scopeId","data-v-2f3988be"]]);exports.BAlert=i;
|
|
2
|
+
//# sourceMappingURL=BAlert-P_IB7iko.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BAlert-
|
|
1
|
+
{"version":3,"file":"BAlert-P_IB7iko.js","sources":["../src/components/BAlert/BAlert.vue"],"sourcesContent":["<template>\n <BTransition :no-fade=\"!props.fade\" :trans-props=\"{enterToClass: 'show'}\">\n <div\n v-if=\"isAlertVisible\"\n ref=\"element\"\n class=\"alert\"\n role=\"alert\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n :class=\"computedClasses\"\n >\n <slot />\n <template v-if=\"props.dismissible\">\n <BButton v-if=\"hasCloseSlot || props.closeContent\" v-bind=\"closeAttrs\" @click=\"hide\">\n <slot name=\"close\">\n {{ props.closeContent }}\n </slot>\n </BButton>\n <BCloseButton v-else :aria-label=\"props.closeLabel\" v-bind=\"closeAttrs\" @click=\"hide\" />\n </template>\n </div>\n </BTransition>\n</template>\n\n<script setup lang=\"ts\">\nimport BTransition from '../BTransition.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BButton from '../BButton/BButton.vue'\nimport type {BAlertProps} from '../../types/ComponentProps'\nimport {computed, ref, watchEffect} from 'vue'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {isEmptySlot} from '../../utils/dom'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\n\nconst _props = withDefaults(defineProps<Omit<BAlertProps, 'modelValue'>>(), {\n closeClass: undefined,\n closeContent: undefined,\n closeLabel: 'Close',\n closeVariant: 'secondary',\n dismissible: false,\n fade: false,\n immediate: true,\n interval: 'requestAnimationFrame',\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n showOnPause: true,\n variant: 'info',\n})\n\nconst props = useDefaults(_props, 'BAlert')\n\nconst emit = defineEmits<{\n 'close': []\n 'close-countdown': [value: number]\n 'closed': []\n}>()\n\nconst slots = defineSlots<{\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n close?: (props: Record<string, never>) => any\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default?: (props: Record<string, never>) => any\n}>()\n\nconst element = ref<HTMLElement | null>(null)\n\nconst modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})\n\nconst hasCloseSlot = computed(() => !isEmptySlot(slots.close))\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst computedClasses = computed(() => ({\n [`alert-${props.variant}`]: props.variant !== null,\n 'alert-dismissible': props.dismissible,\n}))\n\nconst closeClasses = computed(() => [props.closeClass, {'btn-close-custom': hasCloseSlot.value}])\n\nconst {\n isActive,\n pause,\n resume,\n stop,\n isPaused,\n restart,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number' && props.immediate,\n})\nuseCountdownHover(\n element,\n computed(() => ({\n noHoverPause: props.noHoverPause,\n noResumeOnHoverLeave: props.noResumeOnHoverLeave,\n modelValueIgnoresHover: typeof modelValue.value === 'boolean',\n })),\n {pause, resume}\n)\n\nconst isAlertVisible = computed(() =>\n typeof modelValue.value === 'boolean'\n ? modelValue.value\n : isActive.value || (props.showOnPause && isPaused.value)\n)\n\nconst closeAttrs = computed(() => ({\n variant: hasCloseSlot.value ? props.closeVariant : undefined,\n class: closeClasses.value,\n}))\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst hide = () => {\n emit('close')\n\n if (typeof modelValue.value === 'boolean') {\n modelValue.value = false\n } else {\n modelValue.value = 0\n stop()\n }\n\n emit('closed')\n}\n\ndefineExpose({\n pause,\n resume,\n stop,\n restart,\n})\n</script>\n\n<style lang=\"scss\" scoped>\n.btn-close-custom {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n margin: var(--bs-alert-padding-y) var(--bs-alert-padding-x);\n}\n</style>\n"],"names":["_props","__props","props","useDefaults","emit","__emit","slots","_useSlots","element","ref","modelValue","_useModel","hasCloseSlot","computed","isEmptySlot","close","countdownLength","value","computedClasses","variant","dismissible","closeClasses","closeClass","isActive","pause","resume","stop","isPaused","restart","remainingMs","useCountdown","interval","immediate","useCountdownHover","noHoverPause","noResumeOnHoverLeave","modelValueIgnoresHover","isAlertVisible","showOnPause","closeAttrs","closeVariant","class","watchEffect","hide","__expose"],"mappings":"kjCAmCA,MAAMA,EAASC,EAeTC,EAAQC,EAAAA,YAAYH,EAAQ,UAE5BI,EAAOC,EAMPC,EAAQC,EAAAA,WAORC,EAAUC,MAAwB,MAElCC,EAAaC,EAAAA,yBAEbC,EAAeC,EAAAA,UAAS,KAAOC,EAAYA,YAAAR,EAAMS,SACjDC,EAAkBH,EAAAA,UAAS,IACH,kBAArBH,EAAWO,MAAsB,EAAIP,EAAWO,QAGnDC,EAAkBL,EAAAA,UAAS,KAAO,CACtC,CAAC,SAASX,EAAMiB,WAA8B,OAAlBjB,EAAMiB,QAClC,oBAAqBjB,EAAMkB,gBAGvBC,EAAeR,EAAAA,UAAS,IAAM,CAACX,EAAMoB,WAAY,CAAC,mBAAoBV,EAAaK,WAEnFM,SACJA,EAAAC,MACAA,EAAAC,OACAA,EAAAC,KACAA,EAAAC,SACAA,EAAAC,QACAA,EACAX,MAAOY,GACLC,eAAad,EAAiBd,EAAM6B,SAAU,CAChDC,UAAuC,iBAArBtB,EAAWO,OAAsBf,EAAM8B,YAE3DC,EAAAA,kBACEzB,EACAK,EAAAA,UAAS,KAAO,CACdqB,aAAchC,EAAMgC,aACpBC,qBAAsBjC,EAAMiC,qBAC5BC,uBAAoD,kBAArB1B,EAAWO,UAE5C,CAACO,QAAOC,WAGV,MAAMY,EAAiBxB,EAAAA,UAAS,IACF,kBAArBH,EAAWO,MACdP,EAAWO,MACXM,EAASN,OAAUf,EAAMoC,aAAeX,EAASV,QAGjDsB,EAAa1B,EAAAA,UAAS,KAAO,CACjCM,QAASP,EAAaK,MAAQf,EAAMsC,kBAAe,EACnDC,MAAOpB,EAAaJ,UAGtByB,EAAAA,aAAY,KACLtC,EAAA,kBAAmByB,EAAYZ,MAAK,IAG3C,MAAM0B,EAAO,KACXvC,EAAK,SAE2B,kBAArBM,EAAWO,MACpBP,EAAWO,OAAQ,GAEnBP,EAAWO,MAAQ,OAIrBb,EAAK,SAAQ,SAGFwC,EAAA,CACXpB,QACAC,SACAC,OACAE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),a=require("./classes-CXBJXuVd.js"),l=require("./useAlignment-BTUJZ_9x.js"),t=require("./useDefaults-DA3S59IE.js"),s=require("./index-BthPTI3K.js"),u=["aria-disabled","aria-label"],o=e.defineComponent({__name:"BPagination",props:e.mergeModels({align:{default:"start"},ariaControls:{default:void 0},ariaLabel:{default:"Pagination"},disabled:{type:Boolean,default:!1},ellipsisClass:{default:void 0},ellipsisText:{default:"…"},firstClass:{default:void 0},firstNumber:{type:Boolean,default:!1},firstText:{default:"«"},hideEllipsis:{type:Boolean,default:!1},hideGotoEndButtons:{type:Boolean,default:!1},labelFirstPage:{default:"Go to first page"},labelLastPage:{default:"Go to last page"},labelNextPage:{default:"Go to next page"},labelPage:{default:"Go to page"},labelPrevPage:{default:"Go to previous page"},lastClass:{default:void 0},lastNumber:{type:Boolean,default:!1},lastText:{default:"»"},limit:{default:5},nextClass:{default:void 0},nextText:{default:"›"},pageClass:{default:void 0},perPage:{default:20},pills:{type:Boolean,default:!1},prevClass:{default:void 0},prevText:{default:"‹"},size:{default:void 0},totalRows:{default:0}},{modelValue:{default:1},modelModifiers:{}}),emits:e.mergeModels(["page-click"],["update:modelValue"]),setup(o,{emit:i}){const n=-2,d=-3,r=o,v=t.useDefaults(r,"BPagination"),p=i,c=e.useModel(o,"modelValue"),m=s.useToNumber((()=>v.limit),{nanToZero:!0,method:"parseInt"}),f=s.useToNumber((()=>v.perPage),{nanToZero:!0,method:"parseInt"}),g=s.useToNumber((()=>v.totalRows),{nanToZero:!0,method:"parseInt"}),b=s.useToNumber(c,{nanToZero:!0,method:"parseInt"}),x=e.computed((()=>Math.max(f.value||20,1))),h=e.computed((()=>Math.max(g.value||0,0))),P=e.computed((()=>Math.ceil(h.value/x.value))),k=e.computed((()=>"fill"===v.align)),B=e.computed((()=>"fill"===v.align?"start":v.align)),N=l.useAlignment(B),V=e=>e===b.value,C=e=>v.disabled||V(e)||b.value<1||e<1||e>P.value,T=e.computed((()=>C(1))),y=e.computed((()=>C(b.value-1))),w=e.computed((()=>C(P.value))),M=e.computed((()=>C(b.value+1))),E=({page:e,classVal:a,dis:l,slotName:t,textValue:s,tabIndex:u,label:o,position:i,isActive:n,role:d,hidden:r,isSmHidden:p})=>({li:{class:["page-item",{active:n,disabled:l,"bv-d-sm-down-none":p,"flex-fill":k.value,"d-flex":k.value&&!l},a],role:d,"aria-hidden":r},button:{is:l?"span":"button",class:["page-link","text-center",{"flex-grow-1":!l&&k.value}],"aria-label":o,"aria-controls":v.ariaControls||void 0,"aria-disabled":!!l||void 0,"aria-posinset":i,"aria-setsize":i?P.value:void 0,role:"menuitem",type:l?void 0:"button",tabindex:l?void 0:u},text:{name:t,active:n,value:s??e,page:e,disabled:l,index:e-1,content:s?void 0:e},clickHandler:a=>L(a,e)}),S=({page:e,classVal:a,dis:l,slotName:t,textValue:s,label:u})=>E({page:e,classVal:a,dis:l,slotName:t,textValue:s,label:u,tabIndex:"-1"}),_=(e,a)=>{return E({page:e,dis:v.disabled,classVal:v.pageClass,slotName:"page",label:v.labelPage?`${v.labelPage} ${e}`:void 0,tabIndex:(l=e,(v.disabled?null:V(l)?"0":"-1")??void 0),position:e,isActive:V(e),isSmHidden:a});var l},z=e.computed((()=>S({page:1,dis:T.value,classVal:v.firstClass,slotName:"first-text",textValue:v.firstText,label:v.labelFirstPage}))),G=e.computed((()=>S({page:Math.max(b.value-1,1),dis:y.value,classVal:v.prevClass,slotName:"prev-text",textValue:v.prevText,label:v.labelPrevPage}))),I=e.computed((()=>S({page:Math.min(b.value+1,P.value),dis:M.value,classVal:v.nextClass,slotName:"next-text",textValue:v.nextText,label:v.labelNextPage}))),A=e.computed((()=>S({page:P.value,dis:w.value,classVal:v.lastClass,slotName:"last-text",textValue:v.lastText,label:v.labelLastPage}))),$=e.computed((()=>({li:{class:["page-item","disabled","text-center","bv-d-sm-down-none",k.value?"flex-fill":"",v.ellipsisClass],role:"separator"},span:{class:["page-link"]}}))),q=e.computed((()=>[N.value,{[`pagination-${v.size}`]:void 0!==v.size,"b-pagination-pills":v.pills}])),D=e.computed((()=>({pageSize:x.value,totalRows:g.value,numberOfPages:P.value}))),L=(e,l)=>{if(l===b.value)return;const t=new a.BvEvent("page-click",{cancelable:!0,target:e.target});p("page-click",t,l),t.defaultPrevented||(c.value=l)};e.watch(b,(e=>{const a=((e,a)=>{const l=e||1;return l>a?a:l<1?1:l})(e,P.value);a!==c.value&&(c.value=a)})),e.watch(D,((e,a)=>{(a.pageSize!==e.pageSize&&a.totalRows===e.totalRows||a.numberOfPages!==e.numberOfPages&&b.value>a.numberOfPages)&&(c.value=1)}));const R=e.computed((()=>v.hideGotoEndButtons&&!v.firstNumber?1:0)),j=e.computed((()=>v.hideGotoEndButtons&&!v.lastNumber?1:0)),H=e.computed((()=>R.value?0:1)),O=e.computed((()=>j.value?0:1)),Z=e.computed((()=>v.firstNumber?1:0)),F=e.computed((()=>v.lastNumber?1:0)),J=e.computed((()=>Math.floor(m.value/2))),K=e.computed((()=>{const{value:e}=b,a=Q.value.map((e=>{switch(e){case-1:return{id:e,...z.value};case n:return{id:e,...G.value};case d:return{id:e,...I.value};case-4:return{id:e,...A.value};case-5:case-6:return{id:e,...$.value};default:return{id:e,..._(e)}}}));if(P.value>3){if(e>P.value-J.value-F.value){const e=2+H.value;a[e]={id:a[e].id,..._(a[e].id,!0)}}if(e<=J.value+Z.value){const e=a.length-(3+O.value);a[e]={id:a[e].id,..._(a[e].id,!0)}}}return a})),Q=e.computed((()=>{const e=P.value,{value:a}=b,l=m.value,t=v.hideEllipsis||l<=3;if(e<l+Z.value+F.value)return[Z.value||R.value?null:-1,n,...Array.from({length:e},((e,a)=>a+1)),d,F.value||j.value?null:-4].filter((e=>null!==e));const s=Array.from({length:l+4-(R.value+j.value)});if(R.value?s[0]=n:Z.value?(s[0]=n,s[1]=1):(s[0]=-1,s[1]=n),j.value?s[s.length-1]=d:F.value?(s[s.length-1]=d,s[s.length-2]=e):(s[s.length-1]=-4,s[s.length-2]=d),a<=J.value+Z.value){for(let e=1;e<=l;e++)s[e+1-R.value]=e+Z.value;t||(s[s.length-(2+O.value)]=-6)}if(a>e-J.value-F.value){const a=e-(l-1)-F.value;for(let e=0;e<l;e++)s[e+2-R.value]=a+e;t||(s[1+H.value]=-5)}if(!s[2]){const e=a-Math.floor(l/2);for(let a=0;a<l;a++)s[a+2-R.value]=e+a;t||(s[1+H.value]=-5,s[s.length-(2+O.value)]=-6)}return s.filter((e=>null!==e))}));return(a,l)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["pagination",q.value]),role:"menubar","aria-disabled":e.unref(v).disabled,"aria-label":e.unref(v).ariaLabel||void 0},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(K.value,(l=>(e.openBlock(),e.createElementBlock("li",e.mergeProps({key:`page-${l.id}`,ref_for:!0},l.li),[-5===l.id||-6===l.id?(e.openBlock(),e.createElementBlock("span",e.mergeProps({key:0,ref_for:!0},$.value.span),[e.renderSlot(a.$slots,"ellipsis-text",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(v).ellipsisText||"..."),1)]))],16)):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.button.is),e.mergeProps({key:1,ref_for:!0},l.button,{onClick:l.clickHandler}),{default:e.withCtx((()=>[e.renderSlot(a.$slots,l.text.name,{disabled:l.text.disabled,page:l.text.page,index:l.text.index,active:l.text.active,content:l.text.value},(()=>[e.createTextVNode(e.toDisplayString(l.text.value),1)]))])),_:2},1040,["onClick"]))],16)))),128))],10,u))}});exports._sfc_main=o;
|
|
2
|
+
//# sourceMappingURL=BPagination.vue_vue_type_script_setup_true_lang-DLW4Bi3B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BPagination.vue_vue_type_script_setup_true_lang-DLW4Bi3B.js","sources":["../src/components/BPagination/BPagination.vue"],"sourcesContent":["<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n >\n <template v-for=\"page in pages\" :key=\"`page-${page.id}`\">\n <li v-bind=\"page.li\">\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component v-bind=\"page.button\" :is=\"page.button.is\" v-else @click=\"page.clickHandler\">\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </template>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, watch} from 'vue'\nimport type {BPaginationProps} from '../../types/ComponentProps'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\n// This is necessary because type inference isn't succeeding for the pages computed\ninterface PageButton {\n id: number\n li: Record<string, unknown>\n button: Record<string, unknown>\n text: Record<string, unknown>\n clickHandler: (e: Readonly<MouseEvent>) => void\n}\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n hideEllipsis: false,\n hideGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\n\nconst emit = defineEmits<{\n 'page-click': [event: BvEvent, pageNumber: number]\n}>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({default: 1})\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === modelValueNumber.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n modelValueNumber.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(modelValueNumber.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(modelValueNumber.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n dis,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n role,\n hidden,\n isSmHidden,\n}: {\n page: number\n dis: boolean\n classVal: ClassValue\n slotName: string\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n role?: string\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n 'disabled': dis,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !dis,\n },\n classVal,\n ],\n role,\n 'aria-hidden': hidden,\n },\n button: {\n 'is': dis ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !dis && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': dis ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': dis ? undefined : 'button',\n 'tabindex': dis ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled: dis,\n index: page - 1,\n content: textValue ? undefined : page,\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n dis,\n slotName,\n textValue,\n label,\n}: {\n page: number\n dis: boolean\n classVal: ClassValue\n slotName: string\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, dis, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n dis: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n dis: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(modelValueNumber.value - 1, 1),\n dis: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(modelValueNumber.value + 1, numberOfPages.value),\n dis: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n dis: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === modelValueNumber.value) return\n\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nwatch(modelValueNumber, (newValue) => {\n const sanitizeCurrentPage = (value: number, numberOfPages: number) => {\n const page = value || 1\n return page > numberOfPages ? numberOfPages : page < 1 ? 1 : page\n }\n const calculatedValue = sanitizeCurrentPage(newValue, numberOfPages.value)\n if (calculatedValue === modelValue.value) return\n modelValue.value = calculatedValue\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n } else if (\n newValue.numberOfPages !== oldValue.numberOfPages &&\n modelValueNumber.value > newValue.numberOfPages\n ) {\n // If `numberOfPages` changes and is less than\n // the `currentPage` number, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst hideFirstButton = computed(() => (props.hideGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst hideLastButton = computed(() => (props.hideGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (hideFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (hideLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = modelValueNumber\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n els[idx] = {id: els[idx].id, ...getPageButtonProps(els[idx].id, true)}\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n els[idx] = {id: els[idx].id, ...getPageButtonProps(els[idx].id, true)}\n }\n }\n\n return els as PageButton[]\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = modelValueNumber\n const limit = limitNumber.value\n const hideEllipsis = props.hideEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all of the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - hideEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !hideFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !hideLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All of the remaining cases result in an array that is exactly limit + 4 - hideEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (hideFirstButton.value + hideLastButton.value)})\n if (!hideFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!hideLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the begginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - hideFirstButton.value] = index + firstPage.value\n }\n\n if (!hideEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - hideFirstButton.value] = start + index\n }\n\n if (!hideEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to ceck that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - hideFirstButton.value] = start + index\n }\n\n if (!hideEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n"],"names":["PREV_BUTTON","NEXT_BUTTON","_props","__props","props","useDefaults","emit","__emit","modelValue","_useModel","limitNumber","useToNumber","limit","nanToZero","method","perPageNumber","perPage","totalRowsNumber","totalRows","modelValueNumber","perPageSanitized","computed","Math","max","value","totalRowsSanitized","numberOfPages","ceil","computedFill","align","justifyAlign","alignment","useAlignment","isActivePage","pageNumber","checkDisabled","num","disabled","firstDisabled","prevDisabled","lastDisabled","nextDisabled","getBaseButtonProps","page","classVal","dis","slotName","textValue","tabIndex","label","position","isActive","role","hidden","isSmHidden","li","class","active","button","is","ariaControls","type","tabindex","text","name","index","content","clickHandler","e","pageClick","getButtonProps","getPageButtonProps","pageClass","labelPage","firstButtonProps","firstClass","firstText","labelFirstPage","prevButtonProps","prevClass","prevText","labelPrevPage","nextButtonProps","min","nextClass","nextText","labelNextPage","lastButtonProps","lastClass","lastText","labelLastPage","ellipsisProps","ellipsisClass","span","computedWrapperClasses","size","pills","pagination","pageSize","event","clickEvent","BvEvent","cancelable","target","defaultPrevented","newValue","calculatedValue","sanitizeCurrentPage","watch","oldValue","hideFirstButton","hideGotoEndButtons","firstNumber","hideLastButton","lastNumber","showFirstButton","showLastButton","firstPage","lastPage","halfLimit","floor","pages","els","elements","map","p","id","idx","length","hideEllipsis","Array","from","_","filter","x","buttons","start"],"mappings":"+gCAkfyB,+HACE,4HAtc3B,MAGMA,GAAc,EACdC,GAAc,EAcdC,EAASC,EA+BTC,EAAQC,EAAAA,YAAYH,EAAQ,eAE5BI,EAAOC,EAIPC,EAAaC,EAAAA,yBAEbC,EAAcC,EAAAA,aAAY,IAAMP,EAAMQ,OAAO,CAACC,WAAW,EAAMC,OAAQ,aACvEC,EAAgBJ,EAAAA,aAAY,IAAMP,EAAMY,SAAS,CAACH,WAAW,EAAMC,OAAQ,aAC3EG,EAAkBN,EAAAA,aAAY,IAAMP,EAAMc,WAAW,CAACL,WAAW,EAAMC,OAAQ,aAC/EK,EAAmBR,cAAYH,EAAY,CAACK,WAAW,EAAMC,OAAQ,aAErEM,EAAmBC,YAAS,IAAMC,KAAKC,IAAIR,EAAcS,OAuYtC,GAvYiE,KACpFC,EAAqBJ,YAAS,IAAMC,KAAKC,IAAIN,EAAgBO,OAuYxC,EAvYqE,KAE1FE,EAAgBL,YAAS,IAAMC,KAAKK,KAAKF,EAAmBD,MAAQJ,EAAiBI,SACrFI,EAAeP,EAAAA,UAAS,IAAsB,SAAhBjB,EAAMyB,QAEpCC,EAAeT,YAAS,IAAuB,SAAhBjB,EAAMyB,MAAmB,QAAUzB,EAAMyB,QAExEE,EAAYC,eAAaF,GAEzBG,EAAgBC,GAAuBA,IAAef,EAAi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AAgB3F,QA9ZX,EAgarB,CAGI,IAAC+G,EAAQ,GAAI,CAEf,MAAMC,EAAQhH,EAAQF,KAAKkG,MAAM5G,EAAQ,GACzC,IAAA,IAASqD,EAAQ,EAAGA,EAAQrD,EAAOqD,IACjCsE,EAAQtE,EAAQ,EAAI6C,EAAgBtF,OAASgH,EAAQvE,EAGlDgE,IACKM,EAAA,EAAIpB,EAAgB3F,QA3aX,EA4ajB+G,EAAQA,EAAQP,QAAU,EAAIZ,EAAe5F,SA3a7B,EA6apB,CAYA,OAAO+G,EAAQF,QAAQC,GAAY,OAANA,GAAU,sXA1blB,WACD"}
|
|
@@ -84,7 +84,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
84
84
|
position,
|
|
85
85
|
isActive,
|
|
86
86
|
role,
|
|
87
|
-
hidden
|
|
87
|
+
hidden,
|
|
88
|
+
isSmHidden
|
|
88
89
|
}) => ({
|
|
89
90
|
li: {
|
|
90
91
|
"class": [
|
|
@@ -92,6 +93,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
92
93
|
{
|
|
93
94
|
"active": isActive,
|
|
94
95
|
"disabled": dis,
|
|
96
|
+
"bv-d-sm-down-none": isSmHidden,
|
|
95
97
|
"flex-fill": computedFill.value,
|
|
96
98
|
"d-flex": computedFill.value && !dis
|
|
97
99
|
},
|
|
@@ -131,7 +133,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
131
133
|
textValue,
|
|
132
134
|
label
|
|
133
135
|
}) => getBaseButtonProps({ page, classVal, dis, slotName, textValue, label, tabIndex: "-1" });
|
|
134
|
-
const getPageButtonProps = (page) => getBaseButtonProps({
|
|
136
|
+
const getPageButtonProps = (page, isSmHidden) => getBaseButtonProps({
|
|
135
137
|
page,
|
|
136
138
|
dis: props.disabled,
|
|
137
139
|
classVal: props.pageClass,
|
|
@@ -139,7 +141,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
139
141
|
label: props.labelPage ? `${props.labelPage} ${page}` : void 0,
|
|
140
142
|
tabIndex: getTabIndex(page) ?? void 0,
|
|
141
143
|
position: page,
|
|
142
|
-
isActive: isActivePage(page)
|
|
144
|
+
isActive: isActivePage(page),
|
|
145
|
+
isSmHidden
|
|
143
146
|
});
|
|
144
147
|
const firstButtonProps = computed(
|
|
145
148
|
() => getButtonProps({
|
|
@@ -187,7 +190,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
187
190
|
"page-item",
|
|
188
191
|
"disabled",
|
|
189
192
|
"text-center",
|
|
190
|
-
"bv-d-
|
|
193
|
+
"bv-d-sm-down-none",
|
|
191
194
|
computedFill.value ? "flex-fill" : "",
|
|
192
195
|
props.ellipsisClass
|
|
193
196
|
],
|
|
@@ -235,8 +238,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
235
238
|
modelValue.value = 1;
|
|
236
239
|
}
|
|
237
240
|
});
|
|
238
|
-
const
|
|
239
|
-
|
|
241
|
+
const hideFirstButton = computed(() => props.hideGotoEndButtons && !props.firstNumber ? 1 : 0);
|
|
242
|
+
const hideLastButton = computed(() => props.hideGotoEndButtons && !props.lastNumber ? 1 : 0);
|
|
243
|
+
const showFirstButton = computed(() => hideFirstButton.value ? 0 : 1);
|
|
244
|
+
const showLastButton = computed(() => hideLastButton.value ? 0 : 1);
|
|
245
|
+
const firstPage = computed(() => props.firstNumber ? 1 : 0);
|
|
246
|
+
const lastPage = computed(() => props.lastNumber ? 1 : 0);
|
|
247
|
+
const halfLimit = computed(() => Math.floor(limitNumber.value / 2));
|
|
248
|
+
const pages = computed(() => {
|
|
249
|
+
const { value } = modelValueNumber;
|
|
250
|
+
const els = elements.value.map((p) => {
|
|
240
251
|
switch (p) {
|
|
241
252
|
case FIRST_BUTTON:
|
|
242
253
|
return { id: p, ...firstButtonProps.value };
|
|
@@ -252,31 +263,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
252
263
|
default:
|
|
253
264
|
return { id: p, ...getPageButtonProps(p) };
|
|
254
265
|
}
|
|
255
|
-
})
|
|
256
|
-
|
|
266
|
+
});
|
|
267
|
+
if (numberOfPages.value > 3) {
|
|
268
|
+
if (value > numberOfPages.value - halfLimit.value - lastPage.value) {
|
|
269
|
+
const idx = 2 + showFirstButton.value;
|
|
270
|
+
els[idx] = { id: els[idx].id, ...getPageButtonProps(els[idx].id, true) };
|
|
271
|
+
}
|
|
272
|
+
if (value <= halfLimit.value + firstPage.value) {
|
|
273
|
+
const idx = els.length - (3 + showLastButton.value);
|
|
274
|
+
els[idx] = { id: els[idx].id, ...getPageButtonProps(els[idx].id, true) };
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return els;
|
|
278
|
+
});
|
|
257
279
|
const elements = computed(() => {
|
|
258
280
|
const pages2 = numberOfPages.value;
|
|
259
281
|
const { value } = modelValueNumber;
|
|
260
282
|
const limit = limitNumber.value;
|
|
261
|
-
const firstPage = props.firstNumber ? 1 : 0;
|
|
262
|
-
const lastPage = props.lastNumber ? 1 : 0;
|
|
263
283
|
const hideEllipsis = props.hideEllipsis || limit <= ELLIPSIS_THRESHOLD;
|
|
264
|
-
|
|
265
|
-
const hideLastButton = props.hideGotoEndButtons && !props.lastNumber ? 1 : 0;
|
|
266
|
-
const showFirstButton = hideFirstButton ? 0 : 1;
|
|
267
|
-
const showLastButton = hideLastButton ? 0 : 1;
|
|
268
|
-
if (pages2 < limit + firstPage + lastPage) {
|
|
284
|
+
if (pages2 < limit + firstPage.value + lastPage.value) {
|
|
269
285
|
return [
|
|
270
|
-
!firstPage && !hideFirstButton ? FIRST_BUTTON : null,
|
|
286
|
+
!firstPage.value && !hideFirstButton.value ? FIRST_BUTTON : null,
|
|
271
287
|
PREV_BUTTON,
|
|
272
288
|
...Array.from({ length: pages2 }, (_, index) => index + 1),
|
|
273
289
|
NEXT_BUTTON,
|
|
274
|
-
!lastPage && !hideLastButton ? LAST_BUTTON : null
|
|
290
|
+
!lastPage.value && !hideLastButton.value ? LAST_BUTTON : null
|
|
275
291
|
].filter((x) => x !== null);
|
|
276
292
|
}
|
|
277
|
-
const buttons = Array.from({ length: limit + 4 - (hideFirstButton + hideLastButton) });
|
|
278
|
-
if (!hideFirstButton) {
|
|
279
|
-
if (!firstPage) {
|
|
293
|
+
const buttons = Array.from({ length: limit + 4 - (hideFirstButton.value + hideLastButton.value) });
|
|
294
|
+
if (!hideFirstButton.value) {
|
|
295
|
+
if (!firstPage.value) {
|
|
280
296
|
buttons[0] = FIRST_BUTTON;
|
|
281
297
|
buttons[1] = PREV_BUTTON;
|
|
282
298
|
} else {
|
|
@@ -286,8 +302,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
286
302
|
} else {
|
|
287
303
|
buttons[0] = PREV_BUTTON;
|
|
288
304
|
}
|
|
289
|
-
if (!hideLastButton) {
|
|
290
|
-
if (!lastPage) {
|
|
305
|
+
if (!hideLastButton.value) {
|
|
306
|
+
if (!lastPage.value) {
|
|
291
307
|
buttons[buttons.length - 1] = LAST_BUTTON;
|
|
292
308
|
buttons[buttons.length - 2] = NEXT_BUTTON;
|
|
293
309
|
} else {
|
|
@@ -297,32 +313,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
297
313
|
} else {
|
|
298
314
|
buttons[buttons.length - 1] = NEXT_BUTTON;
|
|
299
315
|
}
|
|
300
|
-
|
|
301
|
-
if (value <= halfLimit + firstPage) {
|
|
316
|
+
if (value <= halfLimit.value + firstPage.value) {
|
|
302
317
|
for (let index = 1; index <= limit; index++) {
|
|
303
|
-
buttons[index + 1 - hideFirstButton] = index + firstPage;
|
|
318
|
+
buttons[index + 1 - hideFirstButton.value] = index + firstPage.value;
|
|
304
319
|
}
|
|
305
320
|
if (!hideEllipsis) {
|
|
306
|
-
buttons[buttons.length - (2 + showLastButton)] = LAST_ELLIPSIS;
|
|
321
|
+
buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS;
|
|
307
322
|
}
|
|
308
323
|
}
|
|
309
|
-
if (value > pages2 - halfLimit - lastPage) {
|
|
310
|
-
const start = pages2 - (limit - 1) - lastPage;
|
|
324
|
+
if (value > pages2 - halfLimit.value - lastPage.value) {
|
|
325
|
+
const start = pages2 - (limit - 1) - lastPage.value;
|
|
311
326
|
for (let index = 0; index < limit; index++) {
|
|
312
|
-
buttons[index + 2 - hideFirstButton] = start + index;
|
|
327
|
+
buttons[index + 2 - hideFirstButton.value] = start + index;
|
|
313
328
|
}
|
|
314
329
|
if (!hideEllipsis) {
|
|
315
|
-
buttons[1 + showFirstButton] = FIRST_ELLIPSIS;
|
|
330
|
+
buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS;
|
|
316
331
|
}
|
|
317
332
|
}
|
|
318
333
|
if (!buttons[2]) {
|
|
319
334
|
const start = value - Math.floor(limit / 2);
|
|
320
335
|
for (let index = 0; index < limit; index++) {
|
|
321
|
-
buttons[index + 2 - hideFirstButton] = start + index;
|
|
336
|
+
buttons[index + 2 - hideFirstButton.value] = start + index;
|
|
322
337
|
}
|
|
323
338
|
if (!hideEllipsis) {
|
|
324
|
-
buttons[1 + showFirstButton] = FIRST_ELLIPSIS;
|
|
325
|
-
buttons[buttons.length - (2 + showLastButton)] = LAST_ELLIPSIS;
|
|
339
|
+
buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS;
|
|
340
|
+
buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS;
|
|
326
341
|
}
|
|
327
342
|
}
|
|
328
343
|
return buttons.filter((x) => x !== null);
|
|
@@ -374,4 +389,4 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
374
389
|
export {
|
|
375
390
|
_sfc_main as _
|
|
376
391
|
};
|
|
377
|
-
//# sourceMappingURL=BPagination.vue_vue_type_script_setup_true_lang-
|
|
392
|
+
//# sourceMappingURL=BPagination.vue_vue_type_script_setup_true_lang-zRHVG-iF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BPagination.vue_vue_type_script_setup_true_lang-zRHVG-iF.mjs","sources":["../src/components/BPagination/BPagination.vue"],"sourcesContent":["<template>\n <ul\n class=\"pagination\"\n :class=\"computedWrapperClasses\"\n role=\"menubar\"\n :aria-disabled=\"props.disabled\"\n :aria-label=\"props.ariaLabel || undefined\"\n >\n <template v-for=\"page in pages\" :key=\"`page-${page.id}`\">\n <li v-bind=\"page.li\">\n <span\n v-if=\"page.id === FIRST_ELLIPSIS || page.id === LAST_ELLIPSIS\"\n v-bind=\"ellipsisProps.span\"\n >\n <slot name=\"ellipsis-text\">\n {{ props.ellipsisText || '...' }}\n </slot>\n </span>\n <component v-bind=\"page.button\" :is=\"page.button.is\" v-else @click=\"page.clickHandler\">\n <slot\n :name=\"page.text.name\"\n :disabled=\"page.text.disabled\"\n :page=\"page.text.page\"\n :index=\"page.text.index\"\n :active=\"page.text.active\"\n :content=\"page.text.value\"\n >\n {{ page.text.value }}\n </slot>\n </component>\n </li>\n </template>\n </ul>\n</template>\n\n<script setup lang=\"ts\">\nimport {BvEvent} from '../../utils'\nimport {computed, watch} from 'vue'\nimport type {BPaginationProps} from '../../types/ComponentProps'\nimport {useAlignment} from '../../composables/useAlignment'\nimport {useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ClassValue} from '../../types/AnyValuedAttributes'\n\n// Threshold of limit size when we start/stop showing ellipsis\nconst ELLIPSIS_THRESHOLD = 3\n\nconst FIRST_BUTTON = -1\nconst PREV_BUTTON = -2\nconst NEXT_BUTTON = -3\nconst LAST_BUTTON = -4\nconst FIRST_ELLIPSIS = -5\nconst LAST_ELLIPSIS = -6\n\n// This is necessary because type inference isn't succeeding for the pages computed\ninterface PageButton {\n id: number\n li: Record<string, unknown>\n button: Record<string, unknown>\n text: Record<string, unknown>\n clickHandler: (e: Readonly<MouseEvent>) => void\n}\n\nconst _props = withDefaults(defineProps<Omit<BPaginationProps, 'modelValue'>>(), {\n align: 'start',\n ariaControls: undefined,\n ariaLabel: 'Pagination',\n disabled: false,\n ellipsisClass: undefined,\n ellipsisText: '\\u2026',\n firstClass: undefined,\n firstNumber: false,\n firstText: '\\u00AB',\n hideEllipsis: false,\n hideGotoEndButtons: false,\n labelFirstPage: 'Go to first page',\n labelLastPage: 'Go to last page',\n labelNextPage: 'Go to next page',\n labelPage: 'Go to page',\n labelPrevPage: 'Go to previous page',\n lastClass: undefined,\n lastNumber: false,\n lastText: '\\u00BB',\n limit: 5,\n nextClass: undefined,\n nextText: '\\u203A',\n pageClass: undefined,\n perPage: DEFAULT_PER_PAGE,\n pills: false,\n prevClass: undefined,\n prevText: '\\u2039',\n size: undefined,\n totalRows: DEFAULT_TOTAL_ROWS,\n})\nconst props = useDefaults(_props, 'BPagination')\n\nconst emit = defineEmits<{\n 'page-click': [event: BvEvent, pageNumber: number]\n}>()\n\nconst modelValue = defineModel<Exclude<BPaginationProps['modelValue'], undefined>>({default: 1})\n\nconst limitNumber = useToNumber(() => props.limit, {nanToZero: true, method: 'parseInt'})\nconst perPageNumber = useToNumber(() => props.perPage, {nanToZero: true, method: 'parseInt'})\nconst totalRowsNumber = useToNumber(() => props.totalRows, {nanToZero: true, method: 'parseInt'})\nconst modelValueNumber = useToNumber(modelValue, {nanToZero: true, method: 'parseInt'})\n\nconst perPageSanitized = computed(() => Math.max(perPageNumber.value || DEFAULT_PER_PAGE, 1))\nconst totalRowsSanitized = computed(() => Math.max(totalRowsNumber.value || DEFAULT_TOTAL_ROWS, 0))\n// Use Active to on page-item to denote active tab\nconst numberOfPages = computed(() => Math.ceil(totalRowsSanitized.value / perPageSanitized.value))\nconst computedFill = computed(() => props.align === 'fill')\n// This doesn't use the computedFill util because TS cannot infer that it would never be 'fill'\nconst justifyAlign = computed(() => (props.align === 'fill' ? 'start' : props.align))\n\nconst alignment = useAlignment(justifyAlign)\n\nconst isActivePage = (pageNumber: number) => pageNumber === modelValueNumber.value\nconst getTabIndex = (num: number) => (props.disabled ? null : isActivePage(num) ? '0' : '-1')\n\nconst checkDisabled = (num: number) =>\n props.disabled ||\n isActivePage(num) ||\n modelValueNumber.value < 1 ||\n // Check if the number is out of bounds\n num < 1 ||\n num > numberOfPages.value\n\nconst firstDisabled = computed(() => checkDisabled(1))\nconst prevDisabled = computed(() => checkDisabled(modelValueNumber.value - 1))\nconst lastDisabled = computed(() => checkDisabled(numberOfPages.value))\nconst nextDisabled = computed(() => checkDisabled(modelValueNumber.value + 1))\n\nconst getBaseButtonProps = ({\n page,\n classVal,\n dis,\n slotName,\n textValue,\n tabIndex,\n label,\n position,\n isActive,\n role,\n hidden,\n isSmHidden,\n}: {\n page: number\n dis: boolean\n classVal: ClassValue\n slotName: string\n textValue?: string\n tabIndex?: string\n label?: string\n position?: number\n isActive?: boolean\n role?: string\n hidden?: boolean\n isSmHidden?: boolean\n}) => ({\n li: {\n 'class': [\n 'page-item',\n {\n 'active': isActive,\n 'disabled': dis,\n 'bv-d-sm-down-none': isSmHidden,\n 'flex-fill': computedFill.value,\n 'd-flex': computedFill.value && !dis,\n },\n classVal,\n ],\n role,\n 'aria-hidden': hidden,\n },\n button: {\n 'is': dis ? 'span' : 'button',\n 'class': ['page-link', 'text-center', {'flex-grow-1': !dis && computedFill.value}],\n 'aria-label': label,\n 'aria-controls': props.ariaControls || undefined,\n 'aria-disabled': dis ? true : undefined,\n 'aria-posinset': position,\n 'aria-setsize': position ? numberOfPages.value : undefined,\n 'role': 'menuitem',\n 'type': dis ? undefined : 'button',\n 'tabindex': dis ? undefined : tabIndex,\n },\n text: {\n name: slotName,\n active: isActive,\n value: textValue ?? page,\n page,\n disabled: dis,\n index: page - 1,\n content: textValue ? undefined : page,\n },\n clickHandler: (e: Readonly<MouseEvent>) => pageClick(e, page),\n})\n\nconst getButtonProps = ({\n page,\n classVal,\n dis,\n slotName,\n textValue,\n label,\n}: {\n page: number\n dis: boolean\n classVal: ClassValue\n slotName: string\n textValue?: string\n label: string\n}) => getBaseButtonProps({page, classVal, dis, slotName, textValue, label, tabIndex: '-1'})\n\nconst getPageButtonProps = (page: number, isSmHidden?: boolean) =>\n getBaseButtonProps({\n page,\n dis: props.disabled,\n classVal: props.pageClass,\n slotName: 'page',\n label: props.labelPage ? `${props.labelPage} ${page}` : undefined,\n tabIndex: getTabIndex(page) ?? undefined,\n position: page,\n isActive: isActivePage(page),\n isSmHidden,\n })\n\nconst firstButtonProps = computed(() =>\n getButtonProps({\n page: 1,\n dis: firstDisabled.value,\n classVal: props.firstClass,\n slotName: 'first-text',\n textValue: props.firstText,\n label: props.labelFirstPage,\n })\n)\nconst prevButtonProps = computed(() =>\n getButtonProps({\n page: Math.max(modelValueNumber.value - 1, 1),\n dis: prevDisabled.value,\n classVal: props.prevClass,\n slotName: 'prev-text',\n textValue: props.prevText,\n label: props.labelPrevPage,\n })\n)\nconst nextButtonProps = computed(() =>\n getButtonProps({\n page: Math.min(modelValueNumber.value + 1, numberOfPages.value),\n dis: nextDisabled.value,\n classVal: props.nextClass,\n slotName: 'next-text',\n textValue: props.nextText,\n label: props.labelNextPage,\n })\n)\nconst lastButtonProps = computed(() =>\n getButtonProps({\n page: numberOfPages.value,\n dis: lastDisabled.value,\n classVal: props.lastClass,\n slotName: 'last-text',\n textValue: props.lastText,\n label: props.labelLastPage,\n })\n)\n\nconst ellipsisProps = computed(() => ({\n li: {\n class: [\n 'page-item',\n 'disabled',\n 'text-center',\n 'bv-d-sm-down-none',\n computedFill.value ? 'flex-fill' : '',\n props.ellipsisClass,\n ],\n role: 'separator',\n },\n span: {\n class: ['page-link'],\n },\n}))\n\nconst computedWrapperClasses = computed(() => [\n alignment.value,\n {\n [`pagination-${props.size}`]: props.size !== undefined,\n 'b-pagination-pills': props.pills,\n },\n])\n\nconst pagination = computed(() => ({\n pageSize: perPageSanitized.value,\n totalRows: totalRowsNumber.value,\n numberOfPages: numberOfPages.value,\n}))\n\nconst pageClick = (event: Readonly<MouseEvent>, pageNumber: number) => {\n if (pageNumber === modelValueNumber.value) return\n\n const clickEvent = new BvEvent('page-click', {\n cancelable: true,\n target: event.target,\n })\n emit('page-click', clickEvent, pageNumber)\n\n if (clickEvent.defaultPrevented) return\n\n modelValue.value = pageNumber\n\n // nextTick(() => {\n // if (isVisible(target) && un_element.contains(target)) {\n // attemptFocus(target)\n //} else {\n //this.focusCurrent()\n //}\n // })\n}\n\nwatch(modelValueNumber, (newValue) => {\n const sanitizeCurrentPage = (value: number, numberOfPages: number) => {\n const page = value || 1\n return page > numberOfPages ? numberOfPages : page < 1 ? 1 : page\n }\n const calculatedValue = sanitizeCurrentPage(newValue, numberOfPages.value)\n if (calculatedValue === modelValue.value) return\n modelValue.value = calculatedValue\n})\n\nwatch(pagination, (oldValue, newValue) => {\n if (newValue.pageSize !== oldValue.pageSize && newValue.totalRows === oldValue.totalRows) {\n // If the page size changes, reset to page 1\n modelValue.value = 1\n } else if (\n newValue.numberOfPages !== oldValue.numberOfPages &&\n modelValueNumber.value > newValue.numberOfPages\n ) {\n // If `numberOfPages` changes and is less than\n // the `currentPage` number, reset to page 1\n modelValue.value = 1\n }\n})\n\nconst hideFirstButton = computed(() => (props.hideGotoEndButtons && !props.firstNumber ? 1 : 0))\nconst hideLastButton = computed(() => (props.hideGotoEndButtons && !props.lastNumber ? 1 : 0))\nconst showFirstButton = computed(() => (hideFirstButton.value ? 0 : 1))\nconst showLastButton = computed(() => (hideLastButton.value ? 0 : 1))\nconst firstPage = computed(() => (props.firstNumber ? 1 : 0))\nconst lastPage = computed(() => (props.lastNumber ? 1 : 0))\nconst halfLimit = computed(() => Math.floor(limitNumber.value / 2))\n\nconst pages = computed(() => {\n const {value} = modelValueNumber\n\n const els = elements.value.map((p) => {\n switch (p) {\n case FIRST_BUTTON:\n return {id: p, ...firstButtonProps.value}\n case PREV_BUTTON:\n return {id: p, ...prevButtonProps.value}\n case NEXT_BUTTON:\n return {id: p, ...nextButtonProps.value}\n case LAST_BUTTON:\n return {id: p, ...lastButtonProps.value}\n case FIRST_ELLIPSIS:\n case LAST_ELLIPSIS:\n return {id: p, ...ellipsisProps.value}\n default:\n return {id: p, ...getPageButtonProps(p)}\n }\n })\n\n if (numberOfPages.value > 3) {\n if (value > numberOfPages.value - halfLimit.value - lastPage.value) {\n const idx = 2 + showFirstButton.value\n els[idx] = {id: els[idx].id, ...getPageButtonProps(els[idx].id, true)}\n }\n\n if (value <= halfLimit.value + firstPage.value) {\n const idx = els.length - (3 + showLastButton.value)\n els[idx] = {id: els[idx].id, ...getPageButtonProps(els[idx].id, true)}\n }\n }\n\n return els as PageButton[]\n})\n\nconst elements = computed(() => {\n // The idea here is to create an array of all the buttons on the page control.\n // This way we can keep the invariants in one place and the template code just\n // iterates over the array.\n\n const pages = numberOfPages.value\n const {value} = modelValueNumber\n const limit = limitNumber.value\n const hideEllipsis = props.hideEllipsis || limit <= ELLIPSIS_THRESHOLD\n\n // The first case is when all of the page buttons fit on the control, this is\n // the simplest case and the only one that will create an array smaller than\n // Limit + 4 - hideEndButtons * 2 (the [first, last,] prev, next buttons)\n\n if (pages < limit + firstPage.value + lastPage.value) {\n return [\n !firstPage.value && !hideFirstButton.value ? FIRST_BUTTON : null,\n PREV_BUTTON,\n ...Array.from({length: pages}, (_, index) => index + 1),\n NEXT_BUTTON,\n !lastPage.value && !hideLastButton.value ? LAST_BUTTON : null,\n ].filter((x) => x !== null) as number[]\n }\n\n // All of the remaining cases result in an array that is exactly limit + 4 - hideEndButtons * 2 in length, so create\n // the array upfront and set up the beginning and end buttons, then fill the rest for each case\n\n const buttons = Array.from({length: limit + 4 - (hideFirstButton.value + hideLastButton.value)})\n if (!hideFirstButton.value) {\n if (!firstPage.value) {\n buttons[0] = FIRST_BUTTON\n buttons[1] = PREV_BUTTON\n } else {\n buttons[0] = PREV_BUTTON\n buttons[1] = 1\n }\n } else {\n buttons[0] = PREV_BUTTON\n }\n\n if (!hideLastButton.value) {\n if (!lastPage.value) {\n buttons[buttons.length - 1] = LAST_BUTTON\n buttons[buttons.length - 2] = NEXT_BUTTON\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n buttons[buttons.length - 2] = pages\n }\n } else {\n buttons[buttons.length - 1] = NEXT_BUTTON\n }\n\n // The next case is where the page buttons start at the begginning, with\n // no ellipsis at the beginning, but one at the end\n\n if (value <= halfLimit.value + firstPage.value) {\n for (let index = 1; index <= limit; index++) {\n buttons[index + 1 - hideFirstButton.value] = index + firstPage.value\n }\n\n if (!hideEllipsis) {\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n // And then we have the case where the page buttons go up to the end, with no\n // ellipsis at the end, but one at the beginning\n\n if (value > pages - halfLimit.value - lastPage.value) {\n const start = pages - (limit - 1) - lastPage.value\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - hideFirstButton.value] = start + index\n }\n\n if (!hideEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n }\n }\n\n // Finally we have the case where we have ellipsis at both ends\n if (!buttons[2]) {\n // Is there a more elegant way to ceck that we're in the final case?\n const start = value - Math.floor(limit / 2)\n for (let index = 0; index < limit; index++) {\n buttons[index + 2 - hideFirstButton.value] = start + index\n }\n\n if (!hideEllipsis) {\n buttons[1 + showFirstButton.value] = FIRST_ELLIPSIS\n buttons[buttons.length - (2 + showLastButton.value)] = LAST_ELLIPSIS\n }\n }\n\n //Enable sanity check for debugging purposes\n // for (let i = 0; i < buttons.length; i++) {\n // if (!buttons[i]) {\n // // eslint-disable-next-line no-console\n // console.log(\n // `Failed: button == ${i}, limit=${limit}, pages=${pages}, firstPage=${firstPage}, lastPage=${lastPage}, value=${value}`\n // )\n // }\n // }\n\n return buttons.filter((x) => x !== null) as number[]\n})\n</script>\n\n<script lang=\"ts\">\nconst DEFAULT_PER_PAGE = 20\nconst DEFAULT_TOTAL_ROWS = 0\n</script>\n"],"names":["_useModel","numberOfPages","pages"],"mappings":";;;;;;AAkfA,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAtc3B,UAAM,qBAAqB;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ACT,kBAAA,IAAI,gBAAgB,KAAK,IAAI;AACrC,kBAAQ,QAAQ,UAAU,IAAI,eAAe,MAAM,IAAI;AAAA,QACzD;AAAA,MACF;AAYA,aAAO,QAAQ,OAAO,CAAC,MAAM,MAAM,IAAI;AAAA,IAAA,CACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,7 +6,7 @@ import { _ as _sfc_main$4 } from "./BCloseButton.vue_vue_type_script_setup_true_
|
|
|
6
6
|
import { _ as _sfc_main$2 } from "./BLink.vue_vue_type_script_setup_true_lang-BRxz8_Ki.mjs";
|
|
7
7
|
import { _ as _sfc_main$5 } from "./BProgress.vue_vue_type_script_setup_true_lang-BjivaLyP.mjs";
|
|
8
8
|
import { a as BvTriggerableEvent } from "./classes-IC0yVJlq.mjs";
|
|
9
|
-
import { u as useCountdown, a as useCountdownHover } from "./useCountdownHover-
|
|
9
|
+
import { u as useCountdown, a as useCountdownHover } from "./useCountdownHover-CW4HHqec.mjs";
|
|
10
10
|
import { u as useColorVariantClasses } from "./useColorVariantClasses-ZDE19TZw.mjs";
|
|
11
11
|
import { _ as _sfc_main$6 } from "./ConditionalTeleport.vue_vue_type_script_lang-CQcJzK9g.mjs";
|
|
12
12
|
import { useToastController } from "./src/composables/useToastController/index.mjs";
|
|
@@ -85,7 +85,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
85
85
|
element,
|
|
86
86
|
computed(() => ({
|
|
87
87
|
noHoverPause: props.noHoverPause,
|
|
88
|
-
noResumeOnHoverLeave: props.noResumeOnHoverLeave
|
|
88
|
+
noResumeOnHoverLeave: props.noResumeOnHoverLeave,
|
|
89
|
+
modelValueIgnoresHover: typeof modelValue.value === "boolean"
|
|
89
90
|
})),
|
|
90
91
|
{ pause, resume }
|
|
91
92
|
);
|
|
@@ -314,4 +315,4 @@ export {
|
|
|
314
315
|
_sfc_main$1 as _,
|
|
315
316
|
_sfc_main as a
|
|
316
317
|
};
|
|
317
|
-
//# sourceMappingURL=BToastOrchestrator.vue_vue_type_style_index_0_lang-
|
|
318
|
+
//# sourceMappingURL=BToastOrchestrator.vue_vue_type_style_index_0_lang-DzwoIRAO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BToastOrchestrator.vue_vue_type_style_index_0_lang-DzwoIRAO.mjs","sources":["../src/components/BToast/BToast.vue","../src/utils/positionClasses.ts","../src/components/BToast/BToastOrchestrator.vue"],"sourcesContent":["<template>\n <BTransition\n :no-fade=\"props.noFade\"\n v-bind=\"props.transProps\"\n @before-enter=\"onBeforeEnter\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-if=\"isToastVisible\"\n :id=\"props.id\"\n ref=\"element\"\n class=\"toast\"\n :class=\"[props.toastClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isToastVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isToastVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isToastVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"$slots.title || props.title\"\n class=\"toast-header\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" :hide=\"hideFn\">\n <strong class=\"me-auto\">\n {{ props.title }}\n </strong>\n </slot>\n <BCloseButton v-if=\"!props.noCloseButton\" @click=\"hideFn('close')\" />\n </component>\n <template v-if=\"$slots.default || props.body\">\n <component\n :is=\"computedTag\"\n class=\"toast-body\"\n style=\"display: block\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink ? hideFn() : () => {}\"\n >\n <slot :hide=\"hideFn\">\n {{ props.body }}\n </slot>\n </component>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </BTransition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, ref, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BToastProps} from '../../types/ComponentProps'\nimport BTransition from '../BTransition.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {BvTriggerableEvent} from '../../utils'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useColorVariantClasses} from '../../composables/useColorVariantClasses'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\n\nconst _props = withDefaults(defineProps<Omit<BToastProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n interval: 'requestAnimationFrame',\n isStatus: false,\n noCloseButton: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n showOnPause: true,\n solid: false,\n textVariant: null,\n title: undefined,\n toastClass: undefined,\n transProps: undefined,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n variant: undefined,\n // End link props\n})\nconst props = useDefaults(_props, 'BToast')\n\nconst emit = defineEmits<{\n 'close': [value: BvTriggerableEvent]\n 'close-countdown': [value: number]\n 'hide': [value: BvTriggerableEvent]\n 'hidden': [value: BvTriggerableEvent]\n 'show': [value: BvTriggerableEvent]\n 'shown': [value: BvTriggerableEvent]\n 'show-prevented': []\n 'hide-prevented': []\n}>()\n\nconst element = ref<HTMLElement | null>(null)\n\nconst modelValue = defineModel<Exclude<BToastProps['modelValue'], undefined>>({default: false})\n\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number',\n})\nuseCountdownHover(\n element,\n computed(() => ({\n noHoverPause: props.noHoverPause,\n noResumeOnHoverLeave: props.noResumeOnHoverLeave,\n modelValueIgnoresHover: typeof modelValue.value === 'boolean',\n })),\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isToastVisible = computed(() =>\n typeof modelValue.value === 'boolean'\n ? modelValue.value\n : isActive.value || (props.showOnPause && isPaused.value)\n)\n\nconst colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n colorClasses.value,\n {\n show: isToastVisible.value,\n },\n])\n\nconst buildTriggerableEvent = (\n type: string,\n opts: Readonly<Partial<BvTriggerableEvent>> = {}\n): BvTriggerableEvent =>\n new BvTriggerableEvent(type, {\n cancelable: false,\n target: element.value || null,\n relatedTarget: null,\n trigger: null,\n ...opts,\n componentId: props.id,\n })\n\nconst showFn = () => {\n const event = buildTriggerableEvent('show', {cancelable: true})\n emit('show', event)\n if (event.defaultPrevented) {\n if (modelValue.value) modelValue.value = false\n emit('show-prevented')\n return\n }\n if (!modelValue.value) modelValue.value = true\n}\nconst hideFn = (trigger = '') => {\n const event = buildTriggerableEvent('hide', {cancelable: trigger !== '', trigger})\n\n emit('hide', event)\n\n if (trigger === 'close') {\n emit('close', event)\n }\n\n if (event.defaultPrevented) {\n emit('hide-prevented')\n if (!modelValue.value) modelValue.value = true\n return\n }\n\n if (typeof modelValue.value === 'boolean') {\n modelValue.value = false\n } else {\n modelValue.value = 0\n stop()\n }\n}\n\nconst onBeforeEnter = () => {\n showFn()\n}\nconst onAfterEnter = () => {\n emit('shown', buildTriggerableEvent('shown'))\n}\nconst onAfterLeave = () => {\n emit('hidden', buildTriggerableEvent('hidden'))\n}\n\n// isActive in the composable will cause the toast to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false && !!modelValue.value) {\n hideFn()\n }\n})\n\ndefineExpose({\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n","import type {ContainerPosition} from '../types/Alignment'\n\nexport const positionClasses = {\n 'top-start': 'top-0 start-0',\n 'top-center': 'top-0 start-50 translate-middle-x',\n 'top-end': 'top-0 end-0',\n 'middle-start': 'top-50 start-0 translate-middle-y',\n 'middle-center': 'top-50 start-50 translate-middle',\n 'middle-end': 'top-50 end-0 translate-middle-y',\n 'bottom-start': 'bottom-0 start-0',\n 'bottom-center': 'bottom-0 start-50 translate-middle-x',\n 'bottom-end': 'bottom-0 end-0',\n} as const satisfies Record<ContainerPosition, string>\n","<template>\n <ConditionalTeleport :to=\"props.teleportTo\" :disabled=\"props.teleportDisabled\">\n <div id=\"__BVID__toaster-container\" v-bind=\"$attrs\">\n <div\n v-for=\"(value, key) in positionClasses\"\n :key=\"key\"\n :class=\"value\"\n class=\"toast-container position-fixed p-3\"\n >\n <TransitionGroup name=\"b-list\">\n <component\n :is=\"toast.component ?? BToast\"\n v-for=\"toast in tools.toasts?.value.filter((el) => el.props.pos === key)\"\n :key=\"toast.props._self\"\n v-bind=\"toast.props\"\n :model-value=\"toast.props._modelValue\"\n :trans-props=\"{...toast.props.transProps, appear: true}\"\n @update:model-value=\"tools.leave?.(toast.props._self)\"\n @hide=\"tools.remove?.(toast.props._self)\"\n />\n <!-- I think it's only coincidence that hide works, It's not tied to the lifecycle of a transition -->\n <!-- I think actually removes the el before the transition ends, But it's just not noticeable as it's \"fading\" -->\n <!-- It _should_ be @hidden -- as hidden is when the transition has ended. But transition in transition groups isn't \"okay\" -->\n </TransitionGroup>\n </div>\n </div>\n </ConditionalTeleport>\n</template>\n\n<script setup lang=\"ts\">\nimport {watch} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {positionClasses} from '../../utils/positionClasses'\nimport type {BToastOrchestratorProps} from '../../types/ComponentProps'\nimport BToast from './BToast.vue'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {useToastController} from '../../composables/useToastController'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<BToastOrchestratorProps>(), {\n teleportDisabled: false,\n teleportTo: 'body',\n appendToast: false,\n})\nconst props = useDefaults(_props, 'BToastOrchestrator')\n\nconst tools = useToastController()\n\nwatch(\n () => props.appendToast,\n (value) => {\n tools._setIsAppend?.(value)\n },\n {immediate: true}\n)\n\ndefineExpose({\n ...tools,\n})\n</script>\n\n<style lang=\"scss\">\n/*\nIf you remove the last element in the list, the animation goes farther to the right then normal.\nI don't know why\nI kind of like it though, and even if I didn't, I don't know how to get rid of it.\nGetting the transitions to work here was basically all trial and error.\nI think it's because it's \"moving\", but I don't know where it's moving to\n*/\n.b-list-move,\n.b-list-enter-active,\n.b-list-leave-active {\n transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);\n}\n.b-list-enter-from,\n.b-list-leave-to {\n opacity: 0; // TODO this should be the responsibility of the child\n}\n.b-list-leave-active {\n position: fixed;\n}\n</style>\n"],"names":["_useModel","BLink"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,UAAM,SAAS;AA6CT,UAAA,QAAQ,YAAY,QAAQ,QAAQ;AAE1C,UAAM,OAAO;AAWP,UAAA,UAAU,IAAwB,IAAI;AAEtC,UAAA,aAAaA,8BAA2E;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AChB;;;;;;;;;;;;AC8BA,UAAM,SAAS;AAKT,UAAA,QAAQ,YAAY,QAAQ,oBAAoB;AAEtD,UAAM,QAAQ;AAEd;AAAA,MACE,MAAM,MAAM;AAAA,MACZ,CAAC,UAAU;;AACT,oBAAM,iBAAN,+BAAqB;AAAA,MACvB;AAAA,MACA,EAAC,WAAW,KAAI;AAAA,IAAA;AAGL,aAAA;AAAA,MACX,GAAG;AAAA,IAAA,CACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),t=require("./useDefaults-DA3S59IE.js"),o=require("./useBLinkHelper-BxI4evA6.js"),a=require("./BTransition.vue_vue_type_style_index_0_lang-dOw0_NRO.js"),l=require("./BCloseButton.vue_vue_type_script_setup_true_lang-DN7lP-29.js"),r=require("./BLink.vue_vue_type_script_setup_true_lang-DMKCmIIu.js"),s=require("./BProgress.vue_vue_type_script_setup_true_lang-D97WgK6P.js"),n=require("./classes-CXBJXuVd.js"),u=require("./useCountdownHover-C90kBVrr.js"),d=require("./useColorVariantClasses-CE658Sm0.js"),i=require("./ConditionalTeleport.vue_vue_type_script_lang-IRCRuUE1.js"),p=require("./src/composables/useToastController/index.umd.js"),v=["id","role","aria-live","aria-atomic"],c={class:"me-auto"},f=e.defineComponent({__name:"BToast",props:e.mergeModels({body:{default:void 0},bodyClass:{default:void 0},headerClass:{default:void 0},headerTag:{default:"div"},id:{default:void 0},interval:{default:"requestAnimationFrame"},isStatus:{type:Boolean,default:!1},noCloseButton:{type:Boolean,default:!1},noFade:{type:Boolean,default:!1},noHoverPause:{type:Boolean,default:!1},noResumeOnHoverLeave:{type:Boolean,default:!1},progressProps:{default:void 0},showOnPause:{type:Boolean,default:!0},solid:{type:Boolean,default:!1},title:{default:void 0},toastClass:{default:void 0},transProps:{default:void 0},variant:{default:void 0},bgVariant:{default:null},textVariant:{default:null},active:{type:Boolean,default:void 0},activeClass:{default:void 0},disabled:{type:Boolean,default:void 0},exactActiveClass:{default:void 0},href:{default:void 0},icon:{type:Boolean,default:void 0},noRel:{type:Boolean,default:void 0},opacity:{default:void 0},opacityHover:{default:void 0},rel:{default:void 0},replace:{type:Boolean,default:void 0},routerComponentName:{default:void 0},stretched:{type:Boolean,default:!1},target:{default:void 0},to:{default:void 0},underlineOffset:{default:void 0},underlineOffsetHover:{default:void 0},underlineOpacity:{default:void 0},underlineOpacityHover:{default:void 0},underlineVariant:{default:void 0}},{modelValue:{type:[Boolean,Number],default:!1},modelModifiers:{}}),emits:e.mergeModels(["close","close-countdown","hide","hidden","show","shown","show-prevented","hide-prevented"],["update:modelValue"]),setup(i,{expose:p,emit:f}){const m=i,_=t.useDefaults(m,"BToast"),y=f,B=e.ref(null),h=e.useModel(i,"modelValue"),{computedLink:g,computedLinkProps:C}=o.useBLinkHelper(_),k=e.computed((()=>"boolean"==typeof h.value?0:h.value)),{isActive:b,pause:w,restart:P,resume:V,stop:x,isPaused:T,value:H}=u.useCountdown(k,_.interval,{immediate:"number"==typeof h.value});u.useCountdownHover(B,e.computed((()=>({noHoverPause:_.noHoverPause,noResumeOnHoverLeave:_.noResumeOnHoverLeave,modelValueIgnoresHover:"boolean"==typeof h.value}))),{pause:w,resume:V}),e.watchEffect((()=>{y("close-countdown",H.value)}));const q=e.computed((()=>g.value?r._sfc_main:"div")),j=e.computed((()=>"boolean"==typeof h.value?h.value:b.value||_.showOnPause&&T.value)),D=d.useColorVariantClasses(_),L=e.computed((()=>[D.value,{show:j.value}])),N=(e,t={})=>new n.BvTriggerableEvent(e,{cancelable:!1,target:B.value||null,relatedTarget:null,trigger:null,...t,componentId:_.id}),O=(e="")=>{const t=N("hide",{cancelable:""!==e,trigger:e});if(y("hide",t),"close"===e&&y("close",t),t.defaultPrevented)return y("hide-prevented"),void(h.value||(h.value=!0));"boolean"==typeof h.value?h.value=!1:(h.value=0,x())},E=()=>{(()=>{const e=N("show",{cancelable:!0});if(y("show",e),e.defaultPrevented)return h.value&&(h.value=!1),void y("show-prevented");h.value||(h.value=!0)})()},A=()=>{y("shown",N("shown"))},S=()=>{y("hidden",N("hidden"))};return e.watch(b,(e=>{!1===e&&!1===T.value&&h.value&&O()})),p({pause:w,restart:P,resume:V,stop:x}),(t,o)=>(e.openBlock(),e.createBlock(a._sfc_main,e.mergeProps({"no-fade":e.unref(_).noFade},e.unref(_).transProps,{onBeforeEnter:E,onAfterEnter:A,onAfterLeave:S}),{default:e.withCtx((()=>[j.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:e.unref(_).id,ref_key:"element",ref:B,class:e.normalizeClass(["toast",[e.unref(_).toastClass,L.value]]),tabindex:"0",role:j.value?e.unref(_).isStatus?"status":"alert":void 0,"aria-live":j.value?e.unref(_).isStatus?"polite":"assertive":void 0,"aria-atomic":!!j.value||void 0},[t.$slots.title||e.unref(_).title?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(_).headerTag),{key:0,class:e.normalizeClass(["toast-header",e.unref(_).headerClass])},{default:e.withCtx((()=>[e.renderSlot(t.$slots,"title",{hide:O},(()=>[e.createElementVNode("strong",c,e.toDisplayString(e.unref(_).title),1)])),e.unref(_).noCloseButton?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l._sfc_main,{key:0,onClick:o[0]||(o[0]=e=>O("close"))}))])),_:3},8,["class"])):e.createCommentVNode("",!0),t.$slots.default||e.unref(_).body?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(q.value),e.mergeProps({key:1,class:["toast-body",e.unref(_).bodyClass],style:{display:"block"}},e.unref(C),{onClick:o[1]||(o[1]=t=>e.unref(g)?O():()=>{})}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{hide:O},(()=>[e.createTextVNode(e.toDisplayString(e.unref(_).body),1)]))])),_:3},16,["class"])):e.createCommentVNode("",!0),"number"==typeof h.value&&void 0!==e.unref(_).progressProps?(e.openBlock(),e.createBlock(s._sfc_main,{key:2,animated:e.unref(_).progressProps.animated,precision:e.unref(_).progressProps.precision,"show-progress":e.unref(_).progressProps.showProgress,"show-value":e.unref(_).progressProps.showValue,striped:e.unref(_).progressProps.striped,variant:e.unref(_).progressProps.variant,max:h.value,value:e.unref(H),height:"4px"},null,8,["animated","precision","show-progress","show-value","striped","variant","max","value"])):e.createCommentVNode("",!0)],10,v)):e.createCommentVNode("",!0)])),_:3},16,["no-fade"]))}}),m={"top-start":"top-0 start-0","top-center":"top-0 start-50 translate-middle-x","top-end":"top-0 end-0","middle-start":"top-50 start-0 translate-middle-y","middle-center":"top-50 start-50 translate-middle","middle-end":"top-50 end-0 translate-middle-y","bottom-start":"bottom-0 start-0","bottom-center":"bottom-0 start-50 translate-middle-x","bottom-end":"bottom-0 end-0"},_=e.defineComponent({inheritAttrs:!1,__name:"BToastOrchestrator",props:{appendToast:{type:Boolean,default:!1},teleportDisabled:{type:Boolean,default:!1},teleportTo:{default:"body"}},setup(o,{expose:a}){const l=o,r=t.useDefaults(l,"BToastOrchestrator"),s=p.useToastController();return e.watch((()=>r.appendToast),(e=>{var t;null==(t=s._setIsAppend)||t.call(s,e)}),{immediate:!0}),a({...s}),(t,o)=>(e.openBlock(),e.createBlock(i._sfc_main,{to:e.unref(r).teleportTo,disabled:e.unref(r).teleportDisabled},{default:e.withCtx((()=>[e.createElementVNode("div",e.mergeProps({id:"__BVID__toaster-container"},t.$attrs),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),((t,o)=>(e.openBlock(),e.createElementBlock("div",{key:o,class:e.normalizeClass([t,"toast-container position-fixed p-3"])},[e.createVNode(e.TransitionGroup,{name:"b-list"},{default:e.withCtx((()=>{var t;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(null==(t=e.unref(s).toasts)?void 0:t.value.filter((e=>e.props.pos===o)),(t=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component??f),e.mergeProps({key:t.props._self,ref_for:!0},t.props,{"model-value":t.props._modelValue,"trans-props":{...t.props.transProps,appear:!0},"onUpdate:modelValue":o=>{var a,l;return null==(l=(a=e.unref(s)).leave)?void 0:l.call(a,t.props._self)},onHide:o=>{var a,l;return null==(l=(a=e.unref(s)).remove)?void 0:l.call(a,t.props._self)}}),null,16,["model-value","trans-props","onUpdate:modelValue","onHide"])))),128))]})),_:2},1024)],2)))),128))],16)])),_:1},8,["to","disabled"]))}});exports._sfc_main=f,exports._sfc_main$1=_;
|
|
2
|
+
//# sourceMappingURL=BToastOrchestrator.vue_vue_type_style_index_0_lang-JeP55Rpn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BToastOrchestrator.vue_vue_type_style_index_0_lang-JeP55Rpn.js","sources":["../src/components/BToast/BToast.vue","../src/utils/positionClasses.ts","../src/components/BToast/BToastOrchestrator.vue"],"sourcesContent":["<template>\n <BTransition\n :no-fade=\"props.noFade\"\n v-bind=\"props.transProps\"\n @before-enter=\"onBeforeEnter\"\n @after-enter=\"onAfterEnter\"\n @after-leave=\"onAfterLeave\"\n >\n <div\n v-if=\"isToastVisible\"\n :id=\"props.id\"\n ref=\"element\"\n class=\"toast\"\n :class=\"[props.toastClass, computedClasses]\"\n tabindex=\"0\"\n :role=\"!isToastVisible ? undefined : props.isStatus ? 'status' : 'alert'\"\n :aria-live=\"!isToastVisible ? undefined : props.isStatus ? 'polite' : 'assertive'\"\n :aria-atomic=\"!isToastVisible ? undefined : true\"\n >\n <component\n :is=\"props.headerTag\"\n v-if=\"$slots.title || props.title\"\n class=\"toast-header\"\n :class=\"props.headerClass\"\n >\n <slot name=\"title\" :hide=\"hideFn\">\n <strong class=\"me-auto\">\n {{ props.title }}\n </strong>\n </slot>\n <BCloseButton v-if=\"!props.noCloseButton\" @click=\"hideFn('close')\" />\n </component>\n <template v-if=\"$slots.default || props.body\">\n <component\n :is=\"computedTag\"\n class=\"toast-body\"\n style=\"display: block\"\n :class=\"props.bodyClass\"\n v-bind=\"computedLinkProps\"\n @click=\"computedLink ? hideFn() : () => {}\"\n >\n <slot :hide=\"hideFn\">\n {{ props.body }}\n </slot>\n </component>\n </template>\n <BProgress\n v-if=\"typeof modelValue === 'number' && props.progressProps !== undefined\"\n :animated=\"props.progressProps.animated\"\n :precision=\"props.progressProps.precision\"\n :show-progress=\"props.progressProps.showProgress\"\n :show-value=\"props.progressProps.showValue\"\n :striped=\"props.progressProps.striped\"\n :variant=\"props.progressProps.variant\"\n :max=\"modelValue\"\n :value=\"remainingMs\"\n height=\"4px\"\n />\n </div>\n </BTransition>\n</template>\n\n<script setup lang=\"ts\">\nimport {computed, ref, watch, watchEffect} from 'vue'\nimport {useBLinkHelper} from '../../composables/useBLinkHelper'\nimport type {BToastProps} from '../../types/ComponentProps'\nimport BTransition from '../BTransition.vue'\nimport BCloseButton from '../BButton/BCloseButton.vue'\nimport BLink from '../BLink/BLink.vue'\nimport BProgress from '../BProgress/BProgress.vue'\nimport {BvTriggerableEvent} from '../../utils'\nimport {useCountdown} from '../../composables/useCountdown'\nimport {useColorVariantClasses} from '../../composables/useColorVariantClasses'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useCountdownHover} from '../../composables/useCountdownHover'\n\nconst _props = withDefaults(defineProps<Omit<BToastProps, 'modelValue'>>(), {\n bgVariant: null,\n body: undefined,\n bodyClass: undefined,\n headerClass: undefined,\n headerTag: 'div',\n id: undefined,\n interval: 'requestAnimationFrame',\n isStatus: false,\n noCloseButton: false,\n noFade: false,\n noHoverPause: false,\n noResumeOnHoverLeave: false,\n progressProps: undefined,\n showOnPause: true,\n solid: false,\n textVariant: null,\n title: undefined,\n toastClass: undefined,\n transProps: undefined,\n // Link props\n // All others use defaults\n noRel: undefined,\n active: undefined,\n activeClass: undefined,\n disabled: undefined,\n exactActiveClass: undefined,\n href: undefined,\n icon: undefined,\n opacity: undefined,\n opacityHover: undefined,\n stretched: false,\n rel: undefined,\n replace: undefined,\n routerComponentName: undefined,\n target: undefined,\n to: undefined,\n underlineOffset: undefined,\n underlineOffsetHover: undefined,\n underlineOpacity: undefined,\n underlineOpacityHover: undefined,\n underlineVariant: undefined,\n variant: undefined,\n // End link props\n})\nconst props = useDefaults(_props, 'BToast')\n\nconst emit = defineEmits<{\n 'close': [value: BvTriggerableEvent]\n 'close-countdown': [value: number]\n 'hide': [value: BvTriggerableEvent]\n 'hidden': [value: BvTriggerableEvent]\n 'show': [value: BvTriggerableEvent]\n 'shown': [value: BvTriggerableEvent]\n 'show-prevented': []\n 'hide-prevented': []\n}>()\n\nconst element = ref<HTMLElement | null>(null)\n\nconst modelValue = defineModel<Exclude<BToastProps['modelValue'], undefined>>({default: false})\n\nconst {computedLink, computedLinkProps} = useBLinkHelper(props)\n\n// TODO solid is never used\nconst countdownLength = computed(() =>\n typeof modelValue.value === 'boolean' ? 0 : modelValue.value\n)\n\nconst {\n isActive,\n pause,\n restart,\n resume,\n stop,\n isPaused,\n value: remainingMs,\n} = useCountdown(countdownLength, props.interval, {\n immediate: typeof modelValue.value === 'number',\n})\nuseCountdownHover(\n element,\n computed(() => ({\n noHoverPause: props.noHoverPause,\n noResumeOnHoverLeave: props.noResumeOnHoverLeave,\n modelValueIgnoresHover: typeof modelValue.value === 'boolean',\n })),\n {pause, resume}\n)\n\nwatchEffect(() => {\n emit('close-countdown', remainingMs.value)\n})\n\nconst computedTag = computed(() => (computedLink.value ? BLink : 'div'))\n\nconst isToastVisible = computed(() =>\n typeof modelValue.value === 'boolean'\n ? modelValue.value\n : isActive.value || (props.showOnPause && isPaused.value)\n)\n\nconst colorClasses = useColorVariantClasses(props)\nconst computedClasses = computed(() => [\n colorClasses.value,\n {\n show: isToastVisible.value,\n },\n])\n\nconst buildTriggerableEvent = (\n type: string,\n opts: Readonly<Partial<BvTriggerableEvent>> = {}\n): BvTriggerableEvent =>\n new BvTriggerableEvent(type, {\n cancelable: false,\n target: element.value || null,\n relatedTarget: null,\n trigger: null,\n ...opts,\n componentId: props.id,\n })\n\nconst showFn = () => {\n const event = buildTriggerableEvent('show', {cancelable: true})\n emit('show', event)\n if (event.defaultPrevented) {\n if (modelValue.value) modelValue.value = false\n emit('show-prevented')\n return\n }\n if (!modelValue.value) modelValue.value = true\n}\nconst hideFn = (trigger = '') => {\n const event = buildTriggerableEvent('hide', {cancelable: trigger !== '', trigger})\n\n emit('hide', event)\n\n if (trigger === 'close') {\n emit('close', event)\n }\n\n if (event.defaultPrevented) {\n emit('hide-prevented')\n if (!modelValue.value) modelValue.value = true\n return\n }\n\n if (typeof modelValue.value === 'boolean') {\n modelValue.value = false\n } else {\n modelValue.value = 0\n stop()\n }\n}\n\nconst onBeforeEnter = () => {\n showFn()\n}\nconst onAfterEnter = () => {\n emit('shown', buildTriggerableEvent('shown'))\n}\nconst onAfterLeave = () => {\n emit('hidden', buildTriggerableEvent('hidden'))\n}\n\n// isActive in the composable will cause the toast to hide when the countdown is done\nwatch(isActive, (newValue) => {\n if (newValue === false && isPaused.value === false && !!modelValue.value) {\n hideFn()\n }\n})\n\ndefineExpose({\n pause,\n restart,\n resume,\n stop,\n})\n</script>\n","import type {ContainerPosition} from '../types/Alignment'\n\nexport const positionClasses = {\n 'top-start': 'top-0 start-0',\n 'top-center': 'top-0 start-50 translate-middle-x',\n 'top-end': 'top-0 end-0',\n 'middle-start': 'top-50 start-0 translate-middle-y',\n 'middle-center': 'top-50 start-50 translate-middle',\n 'middle-end': 'top-50 end-0 translate-middle-y',\n 'bottom-start': 'bottom-0 start-0',\n 'bottom-center': 'bottom-0 start-50 translate-middle-x',\n 'bottom-end': 'bottom-0 end-0',\n} as const satisfies Record<ContainerPosition, string>\n","<template>\n <ConditionalTeleport :to=\"props.teleportTo\" :disabled=\"props.teleportDisabled\">\n <div id=\"__BVID__toaster-container\" v-bind=\"$attrs\">\n <div\n v-for=\"(value, key) in positionClasses\"\n :key=\"key\"\n :class=\"value\"\n class=\"toast-container position-fixed p-3\"\n >\n <TransitionGroup name=\"b-list\">\n <component\n :is=\"toast.component ?? BToast\"\n v-for=\"toast in tools.toasts?.value.filter((el) => el.props.pos === key)\"\n :key=\"toast.props._self\"\n v-bind=\"toast.props\"\n :model-value=\"toast.props._modelValue\"\n :trans-props=\"{...toast.props.transProps, appear: true}\"\n @update:model-value=\"tools.leave?.(toast.props._self)\"\n @hide=\"tools.remove?.(toast.props._self)\"\n />\n <!-- I think it's only coincidence that hide works, It's not tied to the lifecycle of a transition -->\n <!-- I think actually removes the el before the transition ends, But it's just not noticeable as it's \"fading\" -->\n <!-- It _should_ be @hidden -- as hidden is when the transition has ended. But transition in transition groups isn't \"okay\" -->\n </TransitionGroup>\n </div>\n </div>\n </ConditionalTeleport>\n</template>\n\n<script setup lang=\"ts\">\nimport {watch} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {positionClasses} from '../../utils/positionClasses'\nimport type {BToastOrchestratorProps} from '../../types/ComponentProps'\nimport BToast from './BToast.vue'\nimport ConditionalTeleport from '../ConditionalTeleport.vue'\nimport {useToastController} from '../../composables/useToastController'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst _props = withDefaults(defineProps<BToastOrchestratorProps>(), {\n teleportDisabled: false,\n teleportTo: 'body',\n appendToast: false,\n})\nconst props = useDefaults(_props, 'BToastOrchestrator')\n\nconst tools = useToastController()\n\nwatch(\n () => props.appendToast,\n (value) => {\n tools._setIsAppend?.(value)\n },\n {immediate: true}\n)\n\ndefineExpose({\n ...tools,\n})\n</script>\n\n<style lang=\"scss\">\n/*\nIf you remove the last element in the list, the animation goes farther to the right then normal.\nI don't know why\nI kind of like it though, and even if I didn't, I don't know how to get rid of it.\nGetting the transitions to work here was basically all trial and error.\nI think it's because it's \"moving\", but I don't know where it's moving to\n*/\n.b-list-move,\n.b-list-enter-active,\n.b-list-leave-active {\n transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);\n}\n.b-list-enter-from,\n.b-list-leave-to {\n opacity: 0; // TODO this should be the responsibility of the child\n}\n.b-list-leave-active {\n position: fixed;\n}\n</style>\n"],"names":["_props","__props","props","useDefaults","emit","__emit","element","ref","modelValue","_useModel","computedLink","computedLinkProps","useBLinkHelper","countdownLength","computed","value","isActive","pause","restart","resume","stop","isPaused","remainingMs","useCountdown","interval","immediate","useCountdownHover","noHoverPause","noResumeOnHoverLeave","modelValueIgnoresHover","watchEffect","computedTag","BLink","isToastVisible","showOnPause","colorClasses","useColorVariantClasses","computedClasses","show","buildTriggerableEvent","type","opts","BvTriggerableEvent","cancelable","target","relatedTarget","trigger","componentId","id","hideFn","event","defaultPrevented","onBeforeEnter","onAfterEnter","onAfterLeave","newValue","__expose","positionClasses","tools","useToastController","vue","watch","appendToast","_a","_setIsAppend","call"],"mappings":"yuEA4EA,MAAMA,EAASC,EA6CTC,EAAQC,EAAAA,YAAYH,EAAQ,UAE5BI,EAAOC,EAWPC,EAAUC,MAAwB,MAElCC,EAAaC,EAAAA,0BAEbC,aAACA,EAAcC,kBAAAA,GAAqBC,iBAAeV,GAGnDW,EAAkBC,EAAAA,UAAS,IACH,kBAArBN,EAAWO,MAAsB,EAAIP,EAAWO,SAGnDC,SACJA,EAAAC,MACAA,EAAAC,QACAA,EAAAC,OACAA,EAAAC,KACAA,EAAAC,SACAA,EACAN,MAAOO,GACLC,eAAaV,EAAiBX,EAAMsB,SAAU,CAChDC,UAAuC,iBAArBjB,EAAWO,QAE/BW,EAAAA,kBACEpB,EACAQ,EAAAA,UAAS,KAAO,CACda,aAAczB,EAAMyB,aACpBC,qBAAsB1B,EAAM0B,qBAC5BC,uBAAoD,kBAArBrB,EAAWO,UAE5C,CAACE,QAAOE,WAGVW,EAAAA,aAAY,KACL1B,EAAA,kBAAmBkB,EAAYP,MAAK,IAGrC,MAAAgB,EAAcjB,EAAAA,UAAS,IAAOJ,EAAaK,MAAQiB,EAAAA,UAAQ,QAE3DC,EAAiBnB,EAAAA,UAAS,IACF,kBAArBN,EAAWO,MACdP,EAAWO,MACXC,EAASD,OAAUb,EAAMgC,aAAeb,EAASN,QAGjDoB,EAAeC,yBAAuBlC,GACtCmC,EAAkBvB,EAAAA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