UNPKG

accessibleprimevue

Version:

Note: This is the forked version of the Primefaces/PrimeVue repository. Since V3 has reached its EOL this is use to fix identified accessibility bugs in the v3 version of primevue. PrimeVue is an open source UI library for Vue featuring a rich set of 80+

2 lines (1 loc) 10.2 kB
"use strict";var e=require("primevue/base/style"),t=require("primevue/utils"),n=require("vue");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e);function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function r(e,t){return c(e)||d(e,t)||a(e,t)||u()}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(e,t){if(e){if("string"==typeof e)return v(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function d(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,l,r,u=[],a=!0,v=!1;try{if(l=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(i=l.call(n)).done)&&(u.push(i.value),u.length!==t);a=!0);}catch(e){v=!0,o=e}finally{try{if(!a&&null!=n.return&&(r=n.return(),Object(r)!==r))return}finally{if(v)throw o}}return u}}function c(e){if(Array.isArray(e))return e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){g(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function g(e,t,n){var i;return(t="symbol"==l(i=p(t,"string"))?i:String(i))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e,t){if("object"!=l(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=l(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var b={_getMeta:function(){return[t.ObjectUtils.isObject(arguments.length<=0?void 0:arguments[0])||arguments.length<=0?void 0:arguments[0],t.ObjectUtils.getItemValue(t.ObjectUtils.isObject(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:arguments.length<=1?void 0:arguments[1])]},_getConfig:function(e,t){var n,i,o;return null===(n=(null==e||null===(i=e.instance)||void 0===i?void 0:i.$primevue)||(null==t||null===(o=t.ctx)||void 0===o||null===(o=o.appContext)||void 0===o||null===(o=o.config)||void 0===o||null===(o=o.globalProperties)||void 0===o?void 0:o.$primevue))||void 0===n?void 0:n.config},_getOptionValue:function(e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.ObjectUtils.toFlatCase(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"").split("."),o=i.shift();return o?t.ObjectUtils.isObject(e)?b._getOptionValue(t.ObjectUtils.getItemValue(e[Object.keys(e).find((function(e){return t.ObjectUtils.toFlatCase(e)===o}))||""],n),i.join("."),n):void 0:t.ObjectUtils.getItemValue(e,n)},_getPTValue:function(){var e,n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=function(){var e=b._getOptionValue.apply(b,arguments);return t.ObjectUtils.isString(e)||t.ObjectUtils.isArray(e)?{class:e}:e},a=(null===(e=i.binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.ptOptions)||(null===(n=i.$primevueConfig)||void 0===n?void 0:n.ptOptions)||{},v=a.mergeSections,d=void 0===v||v,c=a.mergeProps,s=void 0!==c&&c,g=!(arguments.length>4&&void 0!==arguments[4])||arguments[4]?b._useDefaultPT(i,i.defaultPT(),u,l,r):void 0,p=b._usePT(i,b._getPT(o,i.$name),u,l,f(f({},r),{},{global:g||{}})),y=b._getPTDatasets(i,l);return d||!d&&p?s?b._mergeProps(i,s,g,p,y):f(f(f({},g),p),y):f(f({},p),y)},_getPTDatasets:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i="data-pc-";return f(f({},"root"===n&&g({},"".concat(i,"name"),t.ObjectUtils.toFlatCase(e.$name))),{},g({},"".concat(i,"section"),t.ObjectUtils.toFlatCase(n)))},_getPT:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,o=function(e){var o,l=i?i(e):e,r=t.ObjectUtils.toFlatCase(n);return null!==(o=null==l?void 0:l[r])&&void 0!==o?o:l};return null!=e&&e.hasOwnProperty("_usept")?{_usept:e._usept,originalValue:o(e.originalValue),value:o(e.value)}:o(e)},_usePT:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,r=function(e){return i(e,o,l)};if(null!=n&&n.hasOwnProperty("_usept")){var u,a=n._usept||(null===(u=e.$primevueConfig)||void 0===u?void 0:u.ptOptions)||{},v=a.mergeSections,d=void 0===v||v,c=a.mergeProps,s=void 0!==c&&c,g=r(n.originalValue),p=r(n.value);if(void 0===g&&void 0===p)return;return t.ObjectUtils.isString(p)?p:t.ObjectUtils.isString(g)?g:d||!d&&p?s?b._mergeProps(e,s,g,p):f(f({},g),p):p}return r(n)},_useDefaultPT:function(){return b._usePT(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},arguments.length>2?arguments[2]:void 0,arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0)},_hook:function(e,n,i,o,l,r){var u,a,v="on".concat(t.ObjectUtils.toCapitalCase(n)),d=b._getConfig(o,l),c=null==i?void 0:i.$instance,s=b._usePT(c,b._getPT(null==o||null===(u=o.value)||void 0===u?void 0:u.pt,e),b._getOptionValue,"hooks.".concat(v)),f=b._useDefaultPT(c,null==d||null===(a=d.pt)||void 0===a||null===(a=a.directives)||void 0===a?void 0:a[e],b._getOptionValue,"hooks.".concat(v)),g={el:i,binding:o,vnode:l,prevVnode:r};null==s||s(c,g),null==f||f(c,g)},_mergeProps:function(){for(var e=arguments.length>1?arguments[1]:void 0,i=arguments.length,o=new Array(i>2?i-2:0),l=2;l<i;l++)o[l-2]=arguments[l];return t.ObjectUtils.isFunction(e)?e.apply(void 0,o):n.mergeProps.apply(void 0,o)},_extend:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=function(i,o,l,r,u){var a,v;o._$instances=o._$instances||{};var d=b._getConfig(l,r),c=o._$instances[e]||{},s=t.ObjectUtils.isEmpty(c)?f(f({},n),null==n?void 0:n.methods):{};o._$instances[e]=f(f({},c),{},{$name:e,$host:o,$binding:l,$modifiers:null==l?void 0:l.modifiers,$value:null==l?void 0:l.value,$el:c.$el||o||void 0,$style:f({classes:void 0,inlineStyles:void 0,loadStyle:function(){}},null==n?void 0:n.style),$primevueConfig:d,defaultPT:function(){return b._getPT(null==d?void 0:d.pt,void 0,(function(t){var n;return null==t||null===(n=t.directives)||void 0===n?void 0:n[e]}))},isUnstyled:function(){var e,t;return void 0!==(null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.unstyled)?null===(t=o.$instance)||void 0===t||null===(t=t.$binding)||void 0===t||null===(t=t.value)||void 0===t?void 0:t.unstyled:null==d?void 0:d.unstyled},ptm:function(){var e;return b._getPTValue(o.$instance,null===(e=o.$instance)||void 0===e||null===(e=e.$binding)||void 0===e||null===(e=e.value)||void 0===e?void 0:e.pt,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",f({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}))},ptmo:function(){return b._getPTValue(o.$instance,arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},!1)},cx:function(){var e,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null!==(e=o.$instance)&&void 0!==e&&e.isUnstyled()?void 0:b._getOptionValue(null===(t=o.$instance)||void 0===t||null===(t=t.$style)||void 0===t?void 0:t.classes,n,f({},i))},sx:function(){var e;return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?b._getOptionValue(null===(e=o.$instance)||void 0===e||null===(e=e.$style)||void 0===e?void 0:e.inlineStyles,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",f({},arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})):void 0}},s),o.$instance=o._$instances[e],null===(a=(v=o.$instance)[i])||void 0===a||a.call(v,o,l,r,u),o["$".concat(e)]=o.$instance,b._hook(e,i,o,l,r,u)};return{created:function(e,t,n,o){i("created",e,t,n,o)},beforeMount:function(e,t,n,l){var r,u,a,v,d=b._getConfig(t,n);o.default.loadStyle({nonce:null==d||null===(r=d.csp)||void 0===r?void 0:r.nonce}),(null===(u=e.$instance)||void 0===u||!u.isUnstyled())&&(null===(a=e.$instance)||void 0===a||null===(a=a.$style)||void 0===a||a.loadStyle({nonce:null==d||null===(v=d.csp)||void 0===v?void 0:v.nonce})),i("beforeMount",e,t,n,l)},mounted:function(e,t,n,l){var r,u,a,v,d=b._getConfig(t,n);o.default.loadStyle({nonce:null==d||null===(r=d.csp)||void 0===r?void 0:r.nonce}),(null===(u=e.$instance)||void 0===u||!u.isUnstyled())&&(null===(a=e.$instance)||void 0===a||null===(a=a.$style)||void 0===a||a.loadStyle({nonce:null==d||null===(v=d.csp)||void 0===v?void 0:v.nonce})),i("mounted",e,t,n,l)},beforeUpdate:function(e,t,n,o){i("beforeUpdate",e,t,n,o)},updated:function(e,t,n,o){i("updated",e,t,n,o)},beforeUnmount:function(e,t,n,o){i("beforeUnmount",e,t,n,o)},unmounted:function(e,t,n,o){i("unmounted",e,t,n,o)}}},extend:function(){var e=r(b._getMeta.apply(b,arguments),2),t=e[1];return f({extend:function(){var e=r(b._getMeta.apply(b,arguments),2),n=e[1];return b.extend(e[0],f(f(f({},t),null==t?void 0:t.methods),n))}},b._extend(e[0],t))}};module.exports=b;