@momentum-ui/web-components 2.13.15 → 2.13.17
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/chunks/md-10.js +1 -1
- package/dist/chunks/md-14.js +1 -1
- package/dist/chunks/md-17.js +1 -1
- package/dist/chunks/md-22.js +1 -1
- package/dist/chunks/md-23.js +1 -1
- package/dist/chunks/md-27.js +35 -26
- package/dist/chunks/md-29.js +1 -1
- package/dist/chunks/md-30.js +1 -1
- package/dist/chunks/md-34.js +1 -1
- package/dist/chunks/md-41.js +1 -1
- package/dist/chunks/md-46.js +1 -1
- package/dist/chunks/md-47.js +1 -1
- package/dist/chunks/md-48.js +1 -1
- package/dist/chunks/md-49.js +1 -1
- package/dist/chunks/md-50.js +1 -1
- package/dist/chunks/md-51.js +1 -1
- package/dist/chunks/md-53.js +1 -1
- package/dist/chunks/md-57.js +1 -1
- package/dist/chunks/md-64.js +1 -1
- package/dist/chunks/md-66.js +1 -1
- package/dist/chunks/md-68.js +1 -1
- package/dist/chunks/md-7.js +1 -1
- package/dist/chunks/md-71.js +1 -1
- package/dist/chunks/md-73.js +1 -1
- package/dist/chunks/md-74.js +1 -1
- package/dist/chunks/md-78.js +1 -1
- package/dist/chunks/md-80.js +1 -1
- package/dist/chunks/md-81.js +1 -1
- package/dist/chunks/md-82.js +1 -1
- package/dist/chunks/md-83.js +1 -1
- package/dist/chunks/md-84.js +1 -1
- package/dist/comp/md-alert-banner-entry.js +1 -1
- package/dist/comp/md-avatar-entry.js +1 -1
- package/dist/comp/md-breadcrumb-entry.js +1 -1
- package/dist/comp/md-card-entry.js +1 -1
- package/dist/comp/md-chat-message-entry.js +1 -1
- package/dist/comp/md-combobox-entry.js +1 -1
- package/dist/comp/md-date-range-picker-entry.js +1 -1
- package/dist/comp/md-date-time-picker-entry.js +1 -1
- package/dist/comp/md-datepicker-entry.js +1 -1
- package/dist/comp/md-dropdown-entry.js +1 -1
- package/dist/comp/md-editable-field-entry.js +1 -1
- package/dist/comp/md-icon-entry.js +1 -1
- package/dist/comp/md-input-entry.js +1 -1
- package/dist/comp/md-label-entry.js +1 -1
- package/dist/comp/md-loading-entry.js +1 -1
- package/dist/comp/md-meeting-alert-entry.js +1 -1
- package/dist/comp/md-phone-input-entry.js +1 -1
- package/dist/comp/md-slider-entry.js +1 -1
- package/dist/comp/md-table-entry.js +1 -1
- package/dist/comp/md-tabs-entry.js +1 -1
- package/dist/comp/md-timepicker-entry.js +1 -1
- package/dist/comp/md-toggle-switch-entry.js +1 -1
- package/dist/index-entry.js +2 -2
- package/dist/types/components/avatar/Avatar.constants.d.ts +1 -2
- package/dist/types/components/avatar/Avatar.d.ts +2 -0
- package/dist/types/components/avatar/Presence.utils.d.ts +1 -0
- package/dist/types/components/combobox/ComboBox.d.ts +1 -1
- package/package.json +3 -3
package/dist/chunks/md-73.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[73],{120:function(d,e,m){"use strict";m.r(e),m.d(e,"modalType",(function(){return f})),m.d(e,"Modal",(function(){return p}));m(16),m(13);var o=m(1),a=m(7),l=m(6),t=m(5),i=m(0),n=m(3),r=m(4),s=m(2),h=i.css`.md-modal{color:var(--md-primary-text-color,#121212);display:block;height:100vh;left:0;margin:0 auto;position:fixed;right:0;visibility:visible;width:100vw;width:100vw;max-height:none;top:auto}.md-modal .md-modal__content{height:auto;min-height:0;max-height:none}.md-modal .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal .md-modal__title{color:var(--md-primary-text-color,#707070)}.md-modal:focus{box-shadow:none}.md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1rem;line-height:1.5rem;width:100%;flex-shrink:0;padding-bottom:1rem;padding-left:calc(1rem/2);padding-right:calc(1rem/2)}.md-modal__header h2{font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.md-modal__header .md-modal__title{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.md-modal__header .md-modal__message{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:.875rem;line-height:1.5rem;width:100%;color:var(--modal-main-text-color,#545454);flex-flow:row wrap;text-align:center}.md-modal__header .md-modal__close{align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:center;border:0;position:absolute}.md-modal__content{background-color:var(--modal-main-bg-color,#fff);box-shadow:0 8px 16px 0 rgba(0,0,0,.16);border:1px solid var(--modal-main-border-color,#dedede);display:flex;flex-direction:column}.md-modal__flex-container{display:flex;flex:1 1 0%;flex-direction:column;max-height:inherit;min-height:inherit;padding:var(--modal-main-padding,1.5rem 1rem);width:100%}.md-modal__body{align-items:stretch;align-self:stretch;background:var(--modal-main-bg-color,#fff);display:flex;flex:1 1 auto;flex-direction:column;margin:0;overflow-x:hidden;overflow-y:auto;padding-left:calc(1rem/2);padding-right:calc(1rem/2)}.md-modal__body--padding{padding:0 2rem}.md-modal__footer{align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:flex-end;flex-shrink:0;padding-left:calc(1rem/2);padding-right:calc(1rem/2);padding-top:1rem;width:100%}.md-modal__footer md-button:not(:first-of-type){margin-left:.75rem}.md-modal__footer ::slotted(md-button){margin-left:.75rem}.md-modal.md-modal--full{width:100vw;max-height:none;top:auto}.md-modal.md-modal--full .md-modal__content{height:100vh;min-height:0;max-height:none}.md-modal.md-modal--full .md-modal__content{border-radius:0}.md-modal.md-modal--full .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:2.25rem;line-height:3rem;width:100%}.md-modal.md-modal--full .md-modal__header .md-modal__message{font-size:1.25rem;line-height:2rem;padding-top:1.25rem}.md-modal.md-modal--full .md-modal__header .md-modal__close{height:1.25rem;right:1.5rem;top:auto;width:1.25rem}.md-modal.md-modal--full .md-modal__header .md-modal__close::before{font-size:1.25rem}.md-modal.md-modal--full .md-modal__footer{padding-bottom:1.5rem;padding-top:1.5rem}.md-modal.md-modal--large{width:60rem;max-height:none;top:auto}.md-modal.md-modal--large .md-modal__content{min-height:45rem;max-height:none}.md-modal.md-modal--large .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal.md-modal--large .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1.625rem;line-height:2rem;width:100%}.md-modal.md-modal--large .md-modal__header .md-modal__message{font-size:1rem;line-height:1.5rem;text-align:left}.md-modal.md-modal--large .md-modal__header .md-modal__close{height:1rem;right:1rem;top:auto;width:1rem}.md-modal.md-modal--large .md-modal__header .md-modal__close::before{font-size:1rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--large{width:40rem;max-height:none;top:auto}.md-modal.md-modal--large .md-modal__content{min-height:30rem;max-height:none}.md-modal.md-modal--large .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1rem;line-height:1.5rem;width:100%}.md-modal.md-modal--large .md-modal__header .md-modal__message{font-size:.875rem;line-height:1.5rem;text-align:center}.md-modal.md-modal--large .md-modal__header .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--large .md-modal__header .md-modal__close::before{font-size:.875rem}}@media only screen and (max-height:50em){.md-modal.md-modal--large .md-modal__content{min-height:auto}}.md-modal.md-modal--default,.md-modal.md-modal--medium{width:40rem;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:30rem;max-height:none}.md-modal.md-modal--default .md-modal__close,.md-modal.md-modal--medium .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--default .md-modal__close::before,.md-modal.md-modal--medium .md-modal__close::before{font-size:.875rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--default,.md-modal.md-modal--medium{width:40rem;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:30rem;max-height:none}}@media only screen and (max-height:50em){.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:auto}}.md-modal.md-modal--small{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--small .md-modal__content{min-height:23.75rem;max-height:none}.md-modal.md-modal--small .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--small .md-modal__close::before{font-size:.875rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--small{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--small .md-modal__content{min-height:23.75rem;max-height:none}}.md-modal.md-modal--dialog{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--dialog .md-modal__content{height:auto;min-height:0;max-height:none}.md-modal.md-modal--dialog .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal.md-modal--dialog .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--dialog .md-modal__close::before{font-size:.875rem}.md-modal.md-modal--dialog .md-modal__content{flex-direction:row}.md-modal.md-modal--dialog .md-modal__content .md-modal__header{align-items:flex-start;padding:0 0 .75rem 0}.md-modal.md-modal--dialog .md-modal__content .md-modal__title{font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:16px;line-height:1.5rem}.md-modal.md-modal--dialog .md-modal__content .md-modal__body{margin-bottom:1.5rem;text-align:left}.md-modal.md-modal--dialog .md-modal__content .md-modal__body>*{font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;line-height:1.375rem}.md-modal.md-modal--dialog .md-modal__content .md-modal__footer{display:flex;justify-content:flex-end;padding:0}.md-modal.md-modal--default,.md-modal.md-modal--dialog,.md-modal.md-modal--full,.md-modal.md-modal--large,.md-modal.md-modal--medium,.md-modal.md-modal--small{display:flex;flex-direction:column;justify-content:center}@media only screen and (max-width:40em){.md-modal.md-modal--default.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--dialog.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--full.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--large.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--medium.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--small.md-modal--dialog .md-modal__flex-container{min-height:calc(100vh - 1.5rem*2)}}@media only screen and (max-width:40em){.md-modal.md-modal--default,.md-modal.md-modal--dialog,.md-modal.md-modal--full,.md-modal.md-modal--large,.md-modal.md-modal--medium,.md-modal.md-modal--small{width:100vw;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--dialog .md-modal__content,.md-modal.md-modal--full .md-modal__content,.md-modal.md-modal--large .md-modal__content,.md-modal.md-modal--medium .md-modal__content,.md-modal.md-modal--small .md-modal__content{height:100vh;min-height:0;max-height:none}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--dialog .md-modal__content,.md-modal.md-modal--full .md-modal__content,.md-modal.md-modal--large .md-modal__content,.md-modal.md-modal--medium .md-modal__content,.md-modal.md-modal--small .md-modal__content{border-radius:0}.md-modal.md-modal--default .md-modal__flex-container,.md-modal.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--full .md-modal__flex-container,.md-modal.md-modal--large .md-modal__flex-container,.md-modal.md-modal--medium .md-modal__flex-container,.md-modal.md-modal--small .md-modal__flex-container{min-height:100vh}.md-modal.md-modal--default .md-modal__header,.md-modal.md-modal--dialog .md-modal__header,.md-modal.md-modal--full .md-modal__header,.md-modal.md-modal--large .md-modal__header,.md-modal.md-modal--medium .md-modal__header,.md-modal.md-modal--small .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:.875rem;line-height:1.5rem;width:100%}.md-modal.md-modal--default .md-modal__header .md-modal__message,.md-modal.md-modal--dialog .md-modal__header .md-modal__message,.md-modal.md-modal--full .md-modal__header .md-modal__message,.md-modal.md-modal--large .md-modal__header .md-modal__message,.md-modal.md-modal--medium .md-modal__header .md-modal__message,.md-modal.md-modal--small .md-modal__header .md-modal__message{font-size:.875rem;line-height:1.5rem;padding-top:.75rem}.md-modal.md-modal--default .md-modal__header .md-modal__close,.md-modal.md-modal--dialog .md-modal__header .md-modal__close,.md-modal.md-modal--full .md-modal__header .md-modal__close,.md-modal.md-modal--large .md-modal__header .md-modal__close,.md-modal.md-modal--medium .md-modal__header .md-modal__close,.md-modal.md-modal--small .md-modal__header .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--default .md-modal__header .md-modal__close::before,.md-modal.md-modal--dialog .md-modal__header .md-modal__close::before,.md-modal.md-modal--full .md-modal__header .md-modal__close::before,.md-modal.md-modal--large .md-modal__header .md-modal__close::before,.md-modal.md-modal--medium .md-modal__header .md-modal__close::before,.md-modal.md-modal--small .md-modal__header .md-modal__close::before{font-size:.875rem}.md-modal.md-modal--default .md-modal__footer,.md-modal.md-modal--dialog .md-modal__footer,.md-modal.md-modal--full .md-modal__footer,.md-modal.md-modal--large .md-modal__footer,.md-modal.md-modal--medium .md-modal__footer,.md-modal.md-modal--small .md-modal__footer{padding:var(--modal-main-padding,1.5rem 1rem);padding-right:1.5rem}.md-modal.md-modal--default .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--dialog .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--full .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--large .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--medium .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--small .md-modal__footer md-button:not(:first-of-type){margin-left:1rem}}.md-modal__backdrop{background:rgba(0,0,0,.45);bottom:0;display:block;left:0;position:fixed;right:0;top:0;z-index:1040}.md-modal__backdrop .md-modal_overlay{bottom:0;position:absolute;top:0;width:100%}.md-close{color:#545454;float:right;font-size:21px;font-weight:700;line-height:1;text-shadow:0 1px 0 #fff}.md-close:focus,.md-close:hover{color:#064157;cursor:pointer;text-decoration:none}.md-close{background:rgba(0,0,0,0);border-radius:0;cursor:pointer;font-weight:400;min-width:initial;padding:0}.md-close::before{font-family:momentum-ui-icons;vertical-align:middle}.md-close:hover{color:#005e7d}.fade{opacity:0;transition:opacity .15s linear}.fade.in{opacity:1}`,c=function(d,e,m,o){var a,l=arguments.length,t=l<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,m):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)t=Reflect.decorate(d,e,m,o);else for(var i=d.length-1;i>=0;i--)(a=d[i])&&(t=(l<3?a(t):l>3?a(e,m,t):a(e,m))||t);return l>3&&t&&Object.defineProperty(e,m,t),t},_=function(d,e,m,o){return new(m||(m=Promise))((function(a,l){function t(d){try{n(o.next(d))}catch(d){l(d)}}function i(d){try{n(o.throw(d))}catch(d){l(d)}}function n(d){var e;d.done?a(d.value):(e=d.value,e instanceof m?e:new m((function(d){d(e)}))).then(t,i)}n((o=o.apply(d,e||[])).next())}))};const f=["default","full","large","small","dialog"];var p;!function(d){let e=class extends(Object(a.b)(i.LitElement)){constructor(){super(...arguments),this.show=!1,this.headerLabel="",this.headerMessage="",this.htmlId="",this.ariaLabel="modal",this.ariaLabelClose="Close Modal",this.ariaLabelCancel="Cancel Modal",this.ariaLabelSubmit="Submit Modal",this.ariaDescription="",this.showCloseButton=!1,this.backdropClickExit=!1,this.noExitOnEsc=!1,this.size="default",this.closeBtnName="",this.hideFooter=!1,this.hideHeader=!1,this.disableInitialFocus=!1,this.animating=!1,this.handleCloseOutside=d=>{d.code===o.b.Escape&&(d.preventDefault(),this.show&&!this.noExitOnEsc&&(this.show=!1))}}static get styles(){return[t.a,h]}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleCloseOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleCloseOutside)}update(d){super.update(d),d.has("show")&&(this.show?this.modalFadeIn():!0===d.get("show")&&this.modalFadeOut())}notifyModalClose(){this.dispatchEvent(new CustomEvent("close-modal",{composed:!0,bubbles:!0}))}focusInsideModal(){var d;(null===(d=this.focusableElements)||void 0===d?void 0:d.length)&&this.setInitialFocus()}handleKeyDown(d){d.code!==o.b.Enter&&d.code!==o.b.Space||this.show&&(this.show=!0)}transitionPromise(d){return new Promise(e=>{const m=()=>{d.removeEventListener("transitionend",m),this.activateFocusTrap(),this.setFocusableElements(),requestAnimationFrame(()=>{e()})},o=()=>{d.removeEventListener("transitioncancel",o),this.deactivateFocusTrap(),this.modalFadeOut(),e()};d.addEventListener("transitionend",m),d.addEventListener("transitioncancel",o),setTimeout(()=>{this.animating=!0},13)})}modalFadeIn(){return _(this,void 0,void 0,(function*(){this.backDrop&&(yield this.transitionPromise(this.backDrop),this.disableInitialFocus||this.focusInsideModal())}))}modalFadeOut(){this.animating=!1,this.deactivateFocusTrap(),this.notifyModalClose()}handleCloseBackdrop(){this.backdropClickExit&&(this.show=!1)}hideModal(){this.animating=!1,this.show=!1}topCloseBtnTemplate(){return i.html`
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[73],{120:function(d,e,m){"use strict";m.r(e),m.d(e,"modalType",(function(){return f})),m.d(e,"Modal",(function(){return p}));m(16),m(15);var o=m(1),a=m(7),l=m(6),t=m(5),i=m(0),n=m(3),r=m(4),s=m(2),h=i.css`.md-modal{color:var(--md-primary-text-color,#121212);display:block;height:100vh;left:0;margin:0 auto;position:fixed;right:0;visibility:visible;width:100vw;width:100vw;max-height:none;top:auto}.md-modal .md-modal__content{height:auto;min-height:0;max-height:none}.md-modal .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal .md-modal__title{color:var(--md-primary-text-color,#707070)}.md-modal:focus{box-shadow:none}.md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1rem;line-height:1.5rem;width:100%;flex-shrink:0;padding-bottom:1rem;padding-left:calc(1rem/2);padding-right:calc(1rem/2)}.md-modal__header h2{font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.md-modal__header .md-modal__title{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%}.md-modal__header .md-modal__message{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:.875rem;line-height:1.5rem;width:100%;color:var(--modal-main-text-color,#545454);flex-flow:row wrap;text-align:center}.md-modal__header .md-modal__close{align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:center;border:0;position:absolute}.md-modal__content{background-color:var(--modal-main-bg-color,#fff);box-shadow:0 8px 16px 0 rgba(0,0,0,.16);border:1px solid var(--modal-main-border-color,#dedede);display:flex;flex-direction:column}.md-modal__flex-container{display:flex;flex:1 1 0%;flex-direction:column;max-height:inherit;min-height:inherit;padding:var(--modal-main-padding,1.5rem 1rem);width:100%}.md-modal__body{align-items:stretch;align-self:stretch;background:var(--modal-main-bg-color,#fff);display:flex;flex:1 1 auto;flex-direction:column;margin:0;overflow-x:hidden;overflow-y:auto;padding-left:calc(1rem/2);padding-right:calc(1rem/2)}.md-modal__body--padding{padding:0 2rem}.md-modal__footer{align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:flex-end;flex-shrink:0;padding-left:calc(1rem/2);padding-right:calc(1rem/2);padding-top:1rem;width:100%}.md-modal__footer md-button:not(:first-of-type){margin-left:.75rem}.md-modal__footer ::slotted(md-button){margin-left:.75rem}.md-modal.md-modal--full{width:100vw;max-height:none;top:auto}.md-modal.md-modal--full .md-modal__content{height:100vh;min-height:0;max-height:none}.md-modal.md-modal--full .md-modal__content{border-radius:0}.md-modal.md-modal--full .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:2.25rem;line-height:3rem;width:100%}.md-modal.md-modal--full .md-modal__header .md-modal__message{font-size:1.25rem;line-height:2rem;padding-top:1.25rem}.md-modal.md-modal--full .md-modal__header .md-modal__close{height:1.25rem;right:1.5rem;top:auto;width:1.25rem}.md-modal.md-modal--full .md-modal__header .md-modal__close::before{font-size:1.25rem}.md-modal.md-modal--full .md-modal__footer{padding-bottom:1.5rem;padding-top:1.5rem}.md-modal.md-modal--large{width:60rem;max-height:none;top:auto}.md-modal.md-modal--large .md-modal__content{min-height:45rem;max-height:none}.md-modal.md-modal--large .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal.md-modal--large .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1.625rem;line-height:2rem;width:100%}.md-modal.md-modal--large .md-modal__header .md-modal__message{font-size:1rem;line-height:1.5rem;text-align:left}.md-modal.md-modal--large .md-modal__header .md-modal__close{height:1rem;right:1rem;top:auto;width:1rem}.md-modal.md-modal--large .md-modal__header .md-modal__close::before{font-size:1rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--large{width:40rem;max-height:none;top:auto}.md-modal.md-modal--large .md-modal__content{min-height:30rem;max-height:none}.md-modal.md-modal--large .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:1rem;line-height:1.5rem;width:100%}.md-modal.md-modal--large .md-modal__header .md-modal__message{font-size:.875rem;line-height:1.5rem;text-align:center}.md-modal.md-modal--large .md-modal__header .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--large .md-modal__header .md-modal__close::before{font-size:.875rem}}@media only screen and (max-height:50em){.md-modal.md-modal--large .md-modal__content{min-height:auto}}.md-modal.md-modal--default,.md-modal.md-modal--medium{width:40rem;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:30rem;max-height:none}.md-modal.md-modal--default .md-modal__close,.md-modal.md-modal--medium .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--default .md-modal__close::before,.md-modal.md-modal--medium .md-modal__close::before{font-size:.875rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--default,.md-modal.md-modal--medium{width:40rem;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:30rem;max-height:none}}@media only screen and (max-height:50em){.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--medium .md-modal__content{min-height:auto}}.md-modal.md-modal--small{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--small .md-modal__content{min-height:23.75rem;max-height:none}.md-modal.md-modal--small .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--small .md-modal__close::before{font-size:.875rem}@media only screen and (min-width:40.0625em)and (max-width:64em){.md-modal.md-modal--small{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--small .md-modal__content{min-height:23.75rem;max-height:none}}.md-modal.md-modal--dialog{width:27.5rem;max-height:none;top:auto}.md-modal.md-modal--dialog .md-modal__content{height:auto;min-height:0;max-height:none}.md-modal.md-modal--dialog .md-modal__content{border-radius:var(--modal-main-radius,.5rem)}.md-modal.md-modal--dialog .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--dialog .md-modal__close::before{font-size:.875rem}.md-modal.md-modal--dialog .md-modal__content{flex-direction:row}.md-modal.md-modal--dialog .md-modal__content .md-modal__header{align-items:flex-start;padding:0 0 .75rem 0}.md-modal.md-modal--dialog .md-modal__content .md-modal__title{font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:16px;line-height:1.5rem}.md-modal.md-modal--dialog .md-modal__content .md-modal__body{margin-bottom:1.5rem;text-align:left}.md-modal.md-modal--dialog .md-modal__content .md-modal__body>*{font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;line-height:1.375rem}.md-modal.md-modal--dialog .md-modal__content .md-modal__footer{display:flex;justify-content:flex-end;padding:0}.md-modal.md-modal--default,.md-modal.md-modal--dialog,.md-modal.md-modal--full,.md-modal.md-modal--large,.md-modal.md-modal--medium,.md-modal.md-modal--small{display:flex;flex-direction:column;justify-content:center}@media only screen and (max-width:40em){.md-modal.md-modal--default.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--dialog.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--full.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--large.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--medium.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--small.md-modal--dialog .md-modal__flex-container{min-height:calc(100vh - 1.5rem*2)}}@media only screen and (max-width:40em){.md-modal.md-modal--default,.md-modal.md-modal--dialog,.md-modal.md-modal--full,.md-modal.md-modal--large,.md-modal.md-modal--medium,.md-modal.md-modal--small{width:100vw;max-height:none;top:auto}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--dialog .md-modal__content,.md-modal.md-modal--full .md-modal__content,.md-modal.md-modal--large .md-modal__content,.md-modal.md-modal--medium .md-modal__content,.md-modal.md-modal--small .md-modal__content{height:100vh;min-height:0;max-height:none}.md-modal.md-modal--default .md-modal__content,.md-modal.md-modal--dialog .md-modal__content,.md-modal.md-modal--full .md-modal__content,.md-modal.md-modal--large .md-modal__content,.md-modal.md-modal--medium .md-modal__content,.md-modal.md-modal--small .md-modal__content{border-radius:0}.md-modal.md-modal--default .md-modal__flex-container,.md-modal.md-modal--dialog .md-modal__flex-container,.md-modal.md-modal--full .md-modal__flex-container,.md-modal.md-modal--large .md-modal__flex-container,.md-modal.md-modal--medium .md-modal__flex-container,.md-modal.md-modal--small .md-modal__flex-container{min-height:100vh}.md-modal.md-modal--default .md-modal__header,.md-modal.md-modal--dialog .md-modal__header,.md-modal.md-modal--full .md-modal__header,.md-modal.md-modal--large .md-modal__header,.md-modal.md-modal--medium .md-modal__header,.md-modal.md-modal--small .md-modal__header{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:.875rem;line-height:1.5rem;width:100%}.md-modal.md-modal--default .md-modal__header .md-modal__message,.md-modal.md-modal--dialog .md-modal__header .md-modal__message,.md-modal.md-modal--full .md-modal__header .md-modal__message,.md-modal.md-modal--large .md-modal__header .md-modal__message,.md-modal.md-modal--medium .md-modal__header .md-modal__message,.md-modal.md-modal--small .md-modal__header .md-modal__message{font-size:.875rem;line-height:1.5rem;padding-top:.75rem}.md-modal.md-modal--default .md-modal__header .md-modal__close,.md-modal.md-modal--dialog .md-modal__header .md-modal__close,.md-modal.md-modal--full .md-modal__header .md-modal__close,.md-modal.md-modal--large .md-modal__header .md-modal__close,.md-modal.md-modal--medium .md-modal__header .md-modal__close,.md-modal.md-modal--small .md-modal__header .md-modal__close{height:.875rem;right:.75rem;top:auto;width:.875rem}.md-modal.md-modal--default .md-modal__header .md-modal__close::before,.md-modal.md-modal--dialog .md-modal__header .md-modal__close::before,.md-modal.md-modal--full .md-modal__header .md-modal__close::before,.md-modal.md-modal--large .md-modal__header .md-modal__close::before,.md-modal.md-modal--medium .md-modal__header .md-modal__close::before,.md-modal.md-modal--small .md-modal__header .md-modal__close::before{font-size:.875rem}.md-modal.md-modal--default .md-modal__footer,.md-modal.md-modal--dialog .md-modal__footer,.md-modal.md-modal--full .md-modal__footer,.md-modal.md-modal--large .md-modal__footer,.md-modal.md-modal--medium .md-modal__footer,.md-modal.md-modal--small .md-modal__footer{padding:var(--modal-main-padding,1.5rem 1rem);padding-right:1.5rem}.md-modal.md-modal--default .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--dialog .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--full .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--large .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--medium .md-modal__footer md-button:not(:first-of-type),.md-modal.md-modal--small .md-modal__footer md-button:not(:first-of-type){margin-left:1rem}}.md-modal__backdrop{background:rgba(0,0,0,.45);bottom:0;display:block;left:0;position:fixed;right:0;top:0;z-index:1040}.md-modal__backdrop .md-modal_overlay{bottom:0;position:absolute;top:0;width:100%}.md-close{color:#545454;float:right;font-size:21px;font-weight:700;line-height:1;text-shadow:0 1px 0 #fff}.md-close:focus,.md-close:hover{color:#064157;cursor:pointer;text-decoration:none}.md-close{background:rgba(0,0,0,0);border-radius:0;cursor:pointer;font-weight:400;min-width:initial;padding:0}.md-close::before{font-family:momentum-ui-icons;vertical-align:middle}.md-close:hover{color:#005e7d}.fade{opacity:0;transition:opacity .15s linear}.fade.in{opacity:1}`,c=function(d,e,m,o){var a,l=arguments.length,t=l<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,m):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)t=Reflect.decorate(d,e,m,o);else for(var i=d.length-1;i>=0;i--)(a=d[i])&&(t=(l<3?a(t):l>3?a(e,m,t):a(e,m))||t);return l>3&&t&&Object.defineProperty(e,m,t),t},_=function(d,e,m,o){return new(m||(m=Promise))((function(a,l){function t(d){try{n(o.next(d))}catch(d){l(d)}}function i(d){try{n(o.throw(d))}catch(d){l(d)}}function n(d){var e;d.done?a(d.value):(e=d.value,e instanceof m?e:new m((function(d){d(e)}))).then(t,i)}n((o=o.apply(d,e||[])).next())}))};const f=["default","full","large","small","dialog"];var p;!function(d){let e=class extends(Object(a.b)(i.LitElement)){constructor(){super(...arguments),this.show=!1,this.headerLabel="",this.headerMessage="",this.htmlId="",this.ariaLabel="modal",this.ariaLabelClose="Close Modal",this.ariaLabelCancel="Cancel Modal",this.ariaLabelSubmit="Submit Modal",this.ariaDescription="",this.showCloseButton=!1,this.backdropClickExit=!1,this.noExitOnEsc=!1,this.size="default",this.closeBtnName="",this.hideFooter=!1,this.hideHeader=!1,this.disableInitialFocus=!1,this.animating=!1,this.handleCloseOutside=d=>{d.code===o.b.Escape&&(d.preventDefault(),this.show&&!this.noExitOnEsc&&(this.show=!1))}}static get styles(){return[t.a,h]}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this.handleCloseOutside)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this.handleCloseOutside)}update(d){super.update(d),d.has("show")&&(this.show?this.modalFadeIn():!0===d.get("show")&&this.modalFadeOut())}notifyModalClose(){this.dispatchEvent(new CustomEvent("close-modal",{composed:!0,bubbles:!0}))}focusInsideModal(){var d;(null===(d=this.focusableElements)||void 0===d?void 0:d.length)&&this.setInitialFocus()}handleKeyDown(d){d.code!==o.b.Enter&&d.code!==o.b.Space||this.show&&(this.show=!0)}transitionPromise(d){return new Promise(e=>{const m=()=>{d.removeEventListener("transitionend",m),this.activateFocusTrap(),this.setFocusableElements(),requestAnimationFrame(()=>{e()})},o=()=>{d.removeEventListener("transitioncancel",o),this.deactivateFocusTrap(),this.modalFadeOut(),e()};d.addEventListener("transitionend",m),d.addEventListener("transitioncancel",o),setTimeout(()=>{this.animating=!0},13)})}modalFadeIn(){return _(this,void 0,void 0,(function*(){this.backDrop&&(yield this.transitionPromise(this.backDrop),this.disableInitialFocus||this.focusInsideModal())}))}modalFadeOut(){this.animating=!1,this.deactivateFocusTrap(),this.notifyModalClose()}handleCloseBackdrop(){this.backdropClickExit&&(this.show=!1)}hideModal(){this.animating=!1,this.show=!1}topCloseBtnTemplate(){return i.html`
|
|
2
2
|
${this.showCloseButton?i.html`
|
|
3
3
|
<md-button
|
|
4
4
|
hasRemoveStyle
|
package/dist/chunks/md-74.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[74],{121:function(t,i,e){"use strict";e.r(i),e.d(i,"Pagination",(function(){return a}));e(16),e(
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[74],{121:function(t,i,e){"use strict";e.r(i),e.d(i,"Pagination",(function(){return a}));e(16),e(15);var a,n=e(6),o=e(5),r=e(0),s=e(3),l=r.css`:host(:focus){box-shadow:none;outline:0!important}:host(md-pagination) .md-pagination{color:var(--pagination-nav-color,#545454);display:flex;padding:0;position:relative}:host(md-pagination) .md-pagination-container{align-content:center;align-items:center;display:flex;flex-flow:column nowrap;justify-content:center;flex:0 1 100%}:host(md-pagination) .md-pagination-list{margin:0;padding:0;list-style:none;align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:center;font-size:.875rem;line-height:1;color:var(--pagination-color,#949494)}:host(md-pagination) .md-pagination-list li:not(.page-ellipsis){align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:center;border-radius:.875rem;cursor:pointer;height:1.25rem;margin:0 .125rem;min-width:1.25rem;padding:.25rem}:host(md-pagination) .md-pagination-list li:not(.page-ellipsis):hover{background:var(--pagination-bg-hover,#007aa3);color:var(--pagination-color-current,#fff)}:host(md-pagination) .md-pagination-list li:not(.page-ellipsis):focus{box-shadow:0 0 0 .125rem var(--md-default-focus-outline-color,#005e7d)}:host(md-pagination) .md-pagination-list li:not(.page-ellipsis)[aria-current=true]{background:var(--pagination-bg-current,#00a0d1);color:var(--pagination-color-current,#fff);cursor:default;pointer-events:none}:host(md-pagination) .md-pagination-nav{cursor:pointer}:host(md-pagination) .md-pagination-nav:disabled{cursor:default}:host(md-pagination) .md-pagination-dots{margin:0;padding:0;list-style:none;align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:center}:host(md-pagination) .md-pagination-dots li{display:block;overflow:hidden;text-indent:-9999px;background:var(--pagination-dots-color,#ccc);border-radius:50%;cursor:pointer;height:.5rem;margin:.25rem;width:.5rem}:host(md-pagination) .md-pagination-dots li:hover,:host(md-pagination) .md-pagination-dots li[aria-current=true]{background:var(--pagination-dots-color-current,#00a0d1)}:host([focus-visible]){box-shadow:0 0 0 .125rem var(--md-default-focus-outline-color,#005e7d)}@media(forced-colors:active){:host(md-pagination) .md-pagination-nav:focus,:host(md-pagination) .md-pagination-nav:hover{outline:1px solid Highlight}:host(md-pagination) .md-pagination-list li:not(.page-ellipsis):hover,:host(md-pagination) .md-pagination-list li:not(.page-ellipsis)[aria-current=true]{forced-color-adjust:none;background-color:Highlight;color:Canvas}:host(md-pagination) .md-pagination-dots li{background-color:GrayText}:host(md-pagination) .md-pagination-dots li:hover,:host(md-pagination) .md-pagination-dots li[aria-current=true]{forced-color-adjust:none;background-color:Highlight;color:Canvas}}`,g=function(t,i,e,a){var n,o=arguments.length,r=o<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,e):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,i,e,a);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(r=(o<3?n(r):o>3?n(i,e,r):n(i,e))||r);return o>3&&r&&Object.defineProperty(i,e,r),r};!function(t){let i=class extends r.LitElement{constructor(){super(...arguments),this._currentPage=1,this.hasDots=!1,this.onlyDots=!1,this.noNavigation=!1,this.totalPage=0,this.visiblePage=3}get currentPage(){return this._currentPage}set currentPage(t){const i=this._currentPage;this._currentPage=t,this.notifyPageChange(i,t),this.requestUpdate("currentPage",i)}static get styles(){return[o.a,l]}computePrevious(t){1!==t&&t!==this.currentPage&&(this.currentPage-=1)}computeNext(t){t<=this.totalPage&&t!==this.currentPage&&(this.currentPage+=1)}computeFirst(){this.currentPage>=1&&(this.currentPage=1)}computeLast(){this.currentPage>=1&&(this.currentPage=this.totalPage)}computeCurrent(t){this.currentPage=t}notifyPageChange(t,i){this.dispatchEvent(new CustomEvent("page-change",{composed:!0,bubbles:!0,detail:{oldPage:t,newPage:i}}))}get hasPreviousPage(){return this.currentPage<=1}get hasNextPage(){return this.currentPage>=this.totalPage}computePageList(t){if(this.totalPage>this.visiblePage&&t){const[t,i,e]=[this.currentPage-1,this.currentPage,this.currentPage+1];let a=[];if(i<=this.visiblePage-1)return a=[...Array(this.visiblePage)].map((t,i)=>1+i),a.push("..."),a.push(this.totalPage),a;if(this.totalPage-i<=this.visiblePage-2){a=[],a.push(1),a.push("...");const t=[...Array(this.visiblePage)].map((t,i)=>this.totalPage-this.visiblePage+1+i);return a.concat(t)}return[1,"...",t,i,e,"...",this.totalPage]}return[...Array(this.totalPage)].map((t,i)=>1+i)}pagesTemplate(t){return this.computePageList(t).map(t=>"..."===t?r.html` <li class="page-ellipsis">${t}</li> `:r.html`
|
|
2
2
|
<li @click=${()=>this.computeCurrent(t)} aria-current=${t===this.currentPage}>
|
|
3
3
|
${t}
|
|
4
4
|
</li>
|
package/dist/chunks/md-78.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[78],{123:function(e,t,i){"use strict";i.r(t),i.d(t,"Slider",(function(){return r}));var r,s=i(1),o=i(7),n=i(6),d=i(5),a=i(0),l=i(3),h=i(2),c=i(
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[78],{123:function(e,t,i){"use strict";i.r(t),i.d(t,"Slider",(function(){return r}));var r,s=i(1),o=i(7),n=i(6),d=i(5),a=i(0),l=i(3),h=i(2),c=i(14),m=i(8),p=a.css`:host(:focus){box-shadow:none;outline:0!important}:host(md-slider){display:flex;flex:1 1 auto;padding:1.25rem 0}:host(md-slider) .md-slider{border-radius:.25rem;display:flex;flex:1 1 auto;height:1.25rem;margin-right:1.25rem;position:relative;width:calc(100% - 1.25rem)}:host(md-slider) .md-slider__bar{position:absolute;top:50%;transform:translateY(-50%);background-color:var(--slider-background-bar,#ccc);border-radius:.125rem;cursor:pointer;height:.125rem;left:0;right:-1.25rem;z-index:0}:host(md-slider) .md-slider__selection{position:absolute;top:50%;transform:translateY(-50%);background-color:var(--slider-background-selection,#00a0d1);border-radius:.125rem;height:.125rem;left:0;transition:left 50ms,right 50ms;z-index:1}:host(md-slider) .md-slider__pointer{position:absolute;top:50%;transform:translateY(-50%);border-radius:.25rem;cursor:grabbing;height:1.25rem;transition:left 50ms,right 50ms;width:1.25rem;z-index:2}:host(md-slider) .md-slider__pointer::after{background-color:var(--slider-background-pointer,#fff);border-radius:50%;box-shadow:0 2px 6px rgba(0,0,0,.16);content:"";height:100%;position:absolute;width:100%;border:1px solid var(--slider-background-pointerBorder)}@media screen and (-ms-high-contrast:active){:host(md-slider) .md-slider__pointer::after{filter:brightness(1) contrast(1) saturate(1.5)}}:host(md-slider) .md-slider__hashlabel{align-content:center;align-items:center;display:flex;flex-flow:row nowrap;justify-content:space-between;bottom:-1.25rem;color:var(--slider-label,#545454);font-size:14px;left:0;line-height:14px;position:absolute;right:-1.25rem;white-space:nowrap}:host(md-slider) .md-slider__value{color:var(--slider-label,#545454);font-size:14px;line-height:14px;position:absolute;right:-1.25rem;top:-1.25rem}:host([disabled]) .md-slider__bar{cursor:not-allowed;background-color:var(--slider-background-disabled-bar,var(--slider-background-bar,#ccc))}:host([disabled]) .md-slider__pointer{cursor:not-allowed}:host([disabled]) .md-slider__pointer::after{background-color:var(--slider-background-disabled-pointer,#ccc)}:host([disabled]) .md-slider__selection{background-color:var(--slider-background-disabled-selection,#949494)}:host([focus-visible]:not([disabled])) .md-slider__pointer::after{box-shadow:var(--slider-background-focus-shadow,0 0 0 8px rgba(0,160,209,.4))}:host([no-pointer][focus-visible]:not([disabled])) .md-slider{box-shadow:var(--slider-background-focus-shadow,0 0 0 2px var(--slider-background-focus-selection,#007aa3),0 2px 6px rgba(0,0,0,.16))}:host(:hover:not([disabled])) .md-slider__pointer::after{background-color:var(--slider-background-hover-pointer,#c9f4ff)}:host([no-pointer]) .md-slider{margin-right:0!important}:host([no-pointer]) .md-slider__bar,:host([no-pointer]) .md-slider__value{right:0}:host([no-pointer]) .md-slider__pointer{display:none}@media(forced-colors:active){:host(md-slider) .md-slider__bar{background-color:CanvasText}:host(md-slider) .md-slider__selection{background-color:Highlight}:host(md-slider) .md-slider__pointer::after{background-color:Highlight}:host(:hover:not([disabled])) .md-slider__pointer::after{background-color:Highlight}:host([no-pointer][focus-visible]:not([disabled])) .md-slider{outline:1px solid Highlight}:host([focus-visible]:not([disabled])) .md-slider__pointer{outline:2px solid Highlight}:host([disabled]) .md-slider__pointer::after{background-color:GrayText}}`,u=function(e,t,i,r){var s,o=arguments.length,n=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,r);else for(var d=e.length-1;d>=0;d--)(s=e[d])&&(n=(o<3?s(n):o>3?s(t,i,n):s(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};!function(e){let t=class extends(Object(o.a)(a.LitElement)){constructor(){super(...arguments),this._disabled=!1,this._now=0,this.min=0,this.max=100,this.hideValue=!1,this.text=0,this.label="slider",this.step=0,this.dragging=!1}get now(){return this._now}set now(e){const t=this._now;e<this.min||e>this.max?console.warn("Please select correct value"):(this._now=Math.round(e),this.requestUpdate("now",t))}get disabled(){return this._disabled}set disabled(e){const t=this._disabled;this._disabled=e,this.setAttribute("aria-disabled",""+e),this.tabIndex=e?-1:0,this.requestUpdate("disabled",t)}get pointerPosition(){const e=this.max-this.min;return(this.now-this.min)/e*100}calculateHandlePosition(e){const{width:t,left:i}=this.getBoundingClientRect(),{clientX:r}=e,s=(r-i)/t;return this.min+(this.max-this.min)*s}moveSliderTo(e){this.disabled||(e>this.max?this.now=this.max:e<this.min?this.now=this.min:this.now=e)}trackMouseEvent(){if(!this.currentMouseEvent||!this.dragging)return;const e=this.calculateHandlePosition(this.currentMouseEvent);this.moveSliderTo(e),requestAnimationFrame(()=>{this.trackMouseEvent()})}ticksTemplate(){const{min:e,max:t,step:i}=this,r=Math.round((t-e)/i),s=new Array(r+1).fill(0,0,r+1).map((t,r)=>e+r*i).filter(i=>i>=e&&i<=t);return a.html`
|
|
2
2
|
<div class="md-slider__hashlabel">${Object(c.repeat)(s,e=>a.html` <div class="tick">${e}</div> `)}</div>
|
|
3
3
|
`}displayValueTemplate(){return a.html` <span class="md-slider__value"> ${this.now} </span> `}notifyChanges(){this.dispatchEvent(new CustomEvent("slider-change",{bubbles:!0,composed:!0,detail:{value:this.now}}))}handleMouseDown(e){if(e.preventDefault(),this.disabled)return;const t=e=>{this.currentMouseEvent=e},i=e=>{this.focus(),this.currentMouseEvent=e,document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),requestAnimationFrame(()=>{this.dragging=!1,this.notifyChanges()})};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i),this.focus(),this.dragging=!0,this.currentMouseEvent=e,requestAnimationFrame(()=>{this.trackMouseEvent()})}handleKeyDown(e){const{code:t}=e;switch(t){case s.b.ArrowLeft:case s.b.ArrowDown:this.moveSliderTo(this.now-1);break;case s.b.ArrowRight:case s.b.ArrowUp:this.moveSliderTo(this.now+1);break;case s.b.Home:this.moveSliderTo(this.min);break;case s.b.End:this.moveSliderTo(this.max)}const i=()=>{document.removeEventListener("keyup",i),this.notifyChanges()};document.addEventListener("keyup",i)}get sliderPointerStyleMap(){return{left:this.pointerPosition+"%"}}get sliderSelectionStyleMap(){return{right:`calc(100% - ${this.pointerPosition}%)`}}static get styles(){return[d.a,p]}firstUpdated(e){super.firstUpdated(e),this.setAttribute("tabindex",this.disabled?"-1":"0")}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("mousedown",this.handleMouseDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("mousedown",this.handleMouseDown)}render(){return a.html`
|
|
4
4
|
<div class="md-slider">
|
package/dist/chunks/md-80.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[80],{103:function(e,t,o){"use strict";o.r(t),o.d(t,"TableAdvanced",(function(){return w}));o(16),o(13),o(30);var r=o(6),i=o(34),a=o(5),l=o(0),d=o(3),s=o(4),n=o(2),c=o(83),h=o(32),p=o.n(h),b=l.css`:host{display:block}.md-table-advanced{width:100%}table{border-collapse:separate;border-spacing:0;max-width:100%;position:relative;width:100%}table.sticky-header{height:100%}table.sticky-header thead th:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border-left:0;border-top:0;position:sticky;top:0;z-index:1}table.sticky-header thead th::before{border-top:1px solid var(--table-advanced-border-color,#dedede);bottom:0;content:" ";left:0;position:absolute;top:0;width:100%}table.sticky-header thead tr:last-child th{top:2.5rem}table.sticky-header thead tr:last-child th::before{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-top:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead tr:first-child th{height:calc(2.5rem + .0625rem*2);top:0}table.sticky-header thead tr:first-child th::before{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-top:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead tr:focus{outline:0}table.sticky-header thead tr:focus th:first-child{border-left:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th:last-child{border-right:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th::before{border-bottom:2px solid var(--md-focus-border-color);border-top:2px solid var(--md-focus-border-color)}thead th:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}thead th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border:1px solid var(--table-advanced-border-color,#dedede);border-left:0;color:var(--md-secondary-text-color);font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;height:2.5rem;max-width:0;padding:0 .375rem;position:relative;text-align:left}thead th .filter{display:inline-block;height:auto;margin-top:calc(.25rem/2)}thead th .resize{background-color:rgba(0,0,0,0);cursor:col-resize;height:100%;left:calc(-.25rem/2);position:absolute;top:0;width:.25rem;z-index:1}thead .head-inner-cell{align-items:center;display:flex;min-width:.875rem}thead .head-inner-cell .filter-wrap{align-items:center;display:inline-flex;flex:1;justify-content:flex-end}thead .head-inner-cell .filter-icon{color:var(--md-secondary-text-color);cursor:pointer;display:inline-block;height:1.5rem;min-width:1.25rem;position:relative;z-index:1}thead .head-inner-cell .filter-icon::part(button){padding:.25rem;text-align:center;width:1.5rem}thead .head-inner-cell .filter-icon:hover{background-color:var(--table-advanced-filter-hover-bg-color,#ededed)}thead .head-inner-cell .filter-icon:active{background-color:var(--table-advanced-filter-pressed-bg-color,#dedede)}thead .head-inner-cell span{display:inline-block;overflow:hidden;padding-right:calc(.25rem*1.25);text-overflow:ellipsis;white-space:nowrap;width:100%}thead .head-inner-cell .sortable{background:rgba(0,0,0,0);border:0;color:var(--md-secondary-text-color);display:inline-block;min-width:calc(1rem*2.5);overflow:hidden;padding-right:calc(.25rem*4);text-overflow:ellipsis;white-space:nowrap;width:auto}thead md-menu-overlay::part(overlay){top:-.375rem;white-space:normal}@supports(-moz-appearance:none){thead md-menu-overlay::part(overlay){top:-.25rem;white-space:normal}}thead .drag-area-col{cursor:grab;display:block;height:calc(.25rem*10);left:.25rem;position:absolute;right:.25rem;top:0;z-index:1}thead .drag-area-col.drag{border:2px dashed var(--table-advanced-filter-border-color,#ccc);opacity:1}thead .drag-area-col.over{background-color:#a87ff1;height:100%;opacity:.1}thead .sortable{cursor:pointer;position:relative;z-index:1}thead .sortable::after,thead .sortable::before{border:.25rem solid transparent;content:"";display:block;height:0;opacity:.3;position:absolute;right:.25rem;top:50%;width:0}thead .sortable::before{border-bottom-color:var(--md-secondary-text-color);margin-top:-9px}thead .sortable::after{border-top-color:var(--md-secondary-text-color);margin-top:1px}thead .sortable.ascending::after{opacity:1}thead .sortable.descending::before{opacity:1}.filter-active{display:inline-block;height:1.25rem;text-align:center;vertical-align:bottom;width:1.25rem}.filter-active::part(icon){line-height:.875rem}.filter-menu{background-color:var(--table-advanced-filter-bg-color,#fff);padding:calc(.25rem*3);position:relative;z-index:1}.filter-menu select{background-color:var(--table-advanced-filter-bg-color,#fff);border:1px solid var(--table-advanced-filter-border-color,#ccc);color:var(--md-secondary-text-color);min-height:calc(.875rem*1.8);width:100%}.filter-menu input{background-color:var(--table-advanced-filter-bg-color,#fff);border:1px solid var(--table-advanced-filter-border-color,#ccc);color:var(--md-secondary-text-color);margin-top:calc(.25rem*2);width:100%}tbody tr{position:relative}tbody tr td:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}tbody tr td{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-right:1px solid var(--table-advanced-border-color,#dedede);font-size:14px;height:2.5rem;max-width:0;padding:calc(.25rem*1.5);position:relative}tbody tr th:first-child{border-top:1px solid var(--table-advanced-border-color,#dedede)}tbody tr th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-right:1px solid var(--table-advanced-border-color,#dedede);font-size:14px;max-width:0;padding:0 calc(.25rem*4);position:relative;text-align:left}tbody tr .inner-cell{display:flex;white-space:nowrap;align-items:center}tbody tr .inner-cell .warn-icon{display:inline-block;margin-left:.25rem;max-height:1.25rem;position:relative;vertical-align:middle;z-index:0}tbody tr .inner-cell md-icon::part(icon){line-height:1.25rem}tbody tr .inner-cell span{align-self:center;display:inline-block;flex:1;overflow:hidden;padding:0 .25rem;text-overflow:ellipsis;vertical-align:middle}tbody tr .drag-handle{cursor:grab;float:left;margin-right:calc(.25rem*1.5)}tbody tr .drag-area{height:50%;left:0;opacity:.3;position:absolute;right:0}tbody tr .drag-area.top{top:0}tbody tr .drag-area.bottom{background-color:rgba(0,0,0,0);bottom:0}tbody tr.ghost{opacity:.3}tbody tr:hover{background-color:var(--table-advanced-hover-bg-color,#f7f7f7)}tbody tr:hover td,tbody tr:hover th{background-color:var(--table-advanced-hover-bg-color,#f7f7f7)}tbody tr.selected,tbody tr:active{background-color:var(--table-advanced-selected-bg-color,#ededed)}tbody tr.selected td,tbody tr.selected th,tbody tr:active td,tbody tr:active th{background-color:var(--table-advanced-selected-bg-color,#ededed)}button.row-collapsible{display:inline-flex;align-items:center;justify-content:center;height:1.25rem;width:1.25rem;margin-right:calc(.25rem*1.5);background-color:rgba(0,0,0,0);border:1px solid var(--table-advanced-border-color);border-radius:2px}button.row-collapsible:hover{background-color:var(--table-advanced-filter-hover-bg-color,#ededed);border:0}button.row-collapsible:active{background-color:var(--table-advanced-filter-pressed-bg-color);border:0}`;function g(e=250){return function(t,o,r){let i;return function(e,t){if(e.descriptor=e.descriptor||Object.getOwnPropertyDescriptor(e.target,e.key),"function"!=typeof e.descriptor.value)return console.warn(e.key,"Decorator must be used on function"),e.descriptor;const o=e.descriptor.value,r=e.target.constructor.name;return e.descriptor.value=function(...e){return t.call(this,o,e,r)},e.descriptor}({target:t,key:o,descriptor:r},(function(t,o){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t.apply(this,o)},e)}))}}class u{constructor(e,t){this.target=e,this.eventName=t}emit(e,t={bubbles:!0,composed:!0,cancelable:!1}){this.target.dispatchEvent(new CustomEvent(this.eventName,Object.assign({detail:e},t)))}}const m=new WeakMap,f=Object(d.directive)(e=>t=>{if(!(t instanceof d.NodePart))throw new Error("templateCallback can only be used in text bindings");const o=m.get(t);if(void 0!==o&&e.template===o.template&&t.value===o.fragment)return;const r=document.importNode(e.template.content,!0);e.cb({content:e.content,row:e.row,col:e.col,insertIndex:e.insertIndex,fragment:r}),t.setValue(r),m.set(t,{template:e.template,fragment:r})});var v;!function(e){const t={placeholder:"Filter..."};e.OPTIONS={equals:{label:"Equals",input:t,predicate:(e,t)=>e==t},notEqual:{label:"Not equal",input:t,predicate:(e,t)=>e!=t},contains:{label:"Contains",input:t,predicate:(e,t)=>e.includes(t)},notContains:{label:"Not contains",input:t,predicate:(e,t)=>!e.includes(t)},startsWith:{label:"Starts with",input:t,predicate:(e,t)=>e.startsWith(t)},endsWith:{label:"Ends with",input:t,predicate:(e,t)=>e.endsWith(t)},lessThan:{label:"Less than",input:t,predicate:(e,t)=>e<t},lessThanOrEquals:{label:"Less than or equals",input:t,predicate:(e,t)=>e<=t},greaterThan:{label:"Greater than",input:t,predicate:(e,t)=>e>t},greaterThanOrEquals:{label:"Greater than or equals",input:t,predicate:(e,t)=>e>=t}},e.optionsString=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.contains,e.OPTIONS.notContains,e.OPTIONS.startsWith,e.OPTIONS.endsWith],e.optionsNumber=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.lessThan,e.OPTIONS.lessThanOrEquals,e.OPTIONS.greaterThan,e.OPTIONS.greaterThanOrEquals]}(v||(v={}));var y=function(e,t,o,r){var i,a=arguments.length,l=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(l=(a<3?i(l):a>3?i(t,o,l):i(t,o))||l);return a>3&&l&&Object.defineProperty(t,o,l),l};const x=document.createElement("img");var w;x.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",function(e){let t=class extends(Object(i.a)(l.LitElement)){constructor(){super(...arguments),this.isRowFocusable="true",this.error="",this.COLS=[],this.ROWS=[],this.updCols=()=>this.requestUpdate("COLS"),this.updRows=()=>this.requestUpdate("ROWS"),this.dragRow=-1,this.dropRow=-1,this.drops=[],this.dragRowElem=null,this.dragCol=-1,this.dropCol=-1,this.isResizing=!1,this.isSelectable=!1,this.selected={},this.expandedRowIdx={},this.dragover=e=>e.preventDefault(),this.eX=0,this.onResize=(e,t)=>{var o;if(-1!=this.dragCol||-1!=this.dragRow)return;this.isResizing=!0;const r=e.target;null===(o=e.dataTransfer)||void 0===o||o.setDragImage(x,0,0);const i=this.COLS.map(e=>this.shadowRoot.querySelector("th.col-index-"+e.index));this.COLS.forEach((e,t)=>e.width=i[t].offsetWidth+"px"),this.updCols();const a=e.x;this.eX=e.x;let l=-1,d=-1,s=-1;const n=this.COLS[t.index-1],c=i[t.index],h=i[t.index-1],p=c.offsetWidth,b=h.offsetWidth,g=()=>{const e=this.eX;if(l!=e&&0!=e){l=e;const o=l-a;d=p-o,s=b+o,t.width=d+"px",n.width=s+"px",this.updCols()}},u=e=>this.eX=e.x,m=()=>{this.isResizing=!1,r.removeEventListener("drag",g),r.removeEventListener("dragend",m),document.removeEventListener("dragover",u)};r.addEventListener("drag",g),r.addEventListener("dragend",m),document.addEventListener("dragover",u)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dragover",this.dragover)}connectedCallback(){super.connectedCallback(),document.addEventListener("dragover",this.dragover),this.updateTableConfig(),this.updateTableData(),this.populateTable()}update(e){super.update(e),e.has("data")&&(this.updateTableData(),this.updateDataInTable())}updateTableData(){if("string"==typeof this.data)try{this.tableData=JSON.parse(this.data)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the config json")}else this.tableData=Object.assign({},this.data)}updateTableConfig(){if("string"==typeof this.config)try{this.tableConfig=JSON.parse(this.config)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the data json")}else this.tableConfig=Object.assign({},this.config)}populateColumns(){var e;let t=0;const o=(e,o)=>{var r,i,a,l;const d=e.filters||(null===(i=null===(r=this.tableConfig.default)||void 0===r?void 0:r.col)||void 0===i?void 0:i.filters),s=d?"forString"==d?v.optionsString:"forNumber"==d?v.optionsNumber:d.length?d:null:null;this.COLS.push({options:Object.assign({},e),index:t++,group:o,sort:"default",sorter:e.sorter||(null===(l=null===(a=this.tableConfig.default)||void 0===a?void 0:a.col)||void 0===l?void 0:l.sorter),isCollapsable:this.tableConfig.cols.collapse==e.id,filter:s?{list:s,selectedIndex:0,input:"",active:!1,menuVisible:!1}:void 0})};this.tableConfig.cols.define.forEach(e=>{"children"in e?e.children.forEach(t=>o(t,{name:e.groupName,length:e.children.length})):o(e)}),this.isSelectable=!!this.tableConfig.rows&&"none"!=(null===(e=this.tableConfig.rows)||void 0===e?void 0:e.selectable)}populateData(){const e=this.COLS.length;if("csv"in this.tableData){const e=p.a.parse(this.tableData.csv,{skipEmptyLines:!0,transform:e=>e.trim()});if(e.errors)return void(this.error="PARSE ERROR:\n"+JSON.stringify(e.errors,null,2));{const t=e.data;this.ROWS=t.map(e=>e.map(e=>({text:e})))}}else if("list2d"in this.tableData)this.ROWS=this.tableData.list2d.map(e=>e.map(e=>({text:e})));else{for(;this.tableData.list.length>e;)this.ROWS.push(this.tableData.list.splice(0,e).map(e=>({text:e})));0!=this.tableData.list.length&&this.ROWS.push(this.tableData.list.map(e=>({text:e})))}0!=this.ROWS.length||(this.error="DATA ERROR: Data is empty")}validateData(){const e=this.COLS.length;this.ROWS.reduce((e,t)=>e+t.length,0)%e==0?this.ROWS.forEach((t,o)=>{const r=t.length;r!=e&&(this.error=`DATA ERROR: Total number of cols (=${e}) and data[${o}] length (=${r}) mismatch`)}):this.error=this.error="DATA ERROR: Data length mismatch. You must provide (numberOfRows * numberOfColumns) amount of data values."}populateTemplate(){const e=this.tableConfig.cellTemplates,t=Object.keys(e||{});e&&t.length&&this.ROWS.forEach((t,o)=>{t.forEach((t,r)=>{for(const i in e){const a=t.text.indexOf(i);if(-1!=a){const l=e[i],d=this.querySelector("#"+l.templateName);if(null==d){console.warn(`cellTemplates["${i}"]: Missing '${l.templateName}' template.`);continue}let s=t.text.replace(i,"");l.contentCb&&(s=l.contentCb({col:r,row:o,content:s,insertIndex:a})),this.ROWS[o][r]={text:s,template:{template:d,templateCb:l.templateCb,insertIndex:"replace"==l.contentUse?-1:a}};break}}})})}setDefaultFilterAndSort(){var e,t;const o=null===(e=this.tableConfig.default)||void 0===e?void 0:e.sort;if(o){const e=this.COLS.find(e=>e.options.id==o.colId);e?this.sort(e,o.order):console.warn(`Cant find ${o.colId} col - for sorting`)}const r=null===(t=this.tableConfig.default)||void 0===t?void 0:t.filter;if(r){const e=this.COLS.find(e=>e.options.id==r.colId);e?e.filter?(e.filter.selectedIndex=r.selectedIndex,e.filter.input=r.input,this.updCols(),this.filter(e)):console.warn(`Cant find filters on ${r.colId} col`):console.warn(`Cant find ${r.colId} col - for filtering`)}}populateTable(){this.populateColumns(),this.populateData(),this.validateData(),this.setDefaultFilterAndSort(),this.populateTemplate()}updateDataInTable(){this.populateData(),this.validateData(),this.populateTemplate()}onDropRow(){this.dragRow!=this.dropRow&&this.drops.push([this.dragRow,this.dropRow]),this.dragRow=-1,this.dropRow=-1,this.dragRowElem&&(this.dragRowElem.setAttribute("draggable","false"),this.dragRowElem=null)}onDropCol(){if(this.dragCol!=this.dropCol){const e=this.COLS[this.dragCol],t=this.COLS[this.dropCol],o=e.group,r=t.group,i=e.index,a=t.index;e.group=r,t.group=o,e.index=a,t.index=i,this.COLS[this.dragCol]=t,this.COLS[this.dropCol]=e,this.ROWS.forEach(e=>{const t=e[this.dragCol],o=e[this.dropCol];e[this.dragCol]=o,e[this.dropCol]=t}),this.updCols(),this.updRows()}this.dragCol=-1,this.dropCol=-1}sort(e,t){e.sorter&&(this.clearSelection(),this.drops=[],this.COLS.forEach(o=>{o.options.id==e.options.id?o.sort=t||("default"==o.sort?"ascending":"ascending"==o.sort?"descending":"default"):o.sort="default"}),this.updCols(),this.requestUpdate(),this["md-table-advanced-change"].emit({type:"sort",order:e.sort}))}filter(e){if(!e.filter)return;this.clearSelection(),this.drops=[];const t=e.filter.input.trim(),o=e.filter.list[e.filter.selectedIndex];e.filter.active=!!t,this.requestUpdate(),t?this["md-table-advanced-change"].emit({type:"filter-on",filter:o,input:t}):this["md-table-advanced-change"].emit({type:"filter-off",filter:e.filter.list[e.filter.selectedIndex]})}selectRow(e){var t;const o=e.row.idx,r=this.selected.hasOwnProperty(o);"multiple"==(null===(t=this.tableConfig.rows)||void 0===t?void 0:t.selectable)?(e.metaKey?r?delete this.selected[o]:this.selected[o]=!0:e.shiftKey||(this.selected={[o]:!0}),this["md-table-advanced-change"].emit({type:"multi-select",rows:Object.keys(this.selected).map(e=>+e)})):r?this.clearSelection():(this.selected={[o]:!0},this["md-table-advanced-change"].emit({type:"select",index:o})),this.requestUpdate("selected")}clearSelection(){this.selected={},this.requestUpdate("selected")}collapseToggle(e,t){e.stopPropagation(),this.expandedRowIdx[t]?(delete this.expandedRowIdx[t],this["md-table-advanced-change"].emit({type:"collapse",row:t})):(this.expandedRowIdx[t]=!0,this["md-table-advanced-change"].emit({type:"expand",row:t})),this.clearSelection(),this.requestUpdate()}render(){if(this.error)return l.html` <div>${this.error}</div> `;const{head:e}=this.tableConfig,t=Object(s.classMap)({"sticky-header":!!this.tableConfig.isStickyHeader});return l.html`
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[80],{103:function(e,t,o){"use strict";o.r(t),o.d(t,"TableAdvanced",(function(){return w}));o(16),o(15),o(30);var r=o(6),i=o(34),a=o(5),l=o(0),d=o(3),s=o(4),n=o(2),c=o(83),h=o(32),p=o.n(h),b=l.css`:host{display:block}.md-table-advanced{width:100%}table{border-collapse:separate;border-spacing:0;max-width:100%;position:relative;width:100%}table.sticky-header{height:100%}table.sticky-header thead th:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border-left:0;border-top:0;position:sticky;top:0;z-index:1}table.sticky-header thead th::before{border-top:1px solid var(--table-advanced-border-color,#dedede);bottom:0;content:" ";left:0;position:absolute;top:0;width:100%}table.sticky-header thead tr:last-child th{top:2.5rem}table.sticky-header thead tr:last-child th::before{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-top:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead tr:first-child th{height:calc(2.5rem + .0625rem*2);top:0}table.sticky-header thead tr:first-child th::before{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-top:1px solid var(--table-advanced-border-color,#dedede)}table.sticky-header thead tr:focus{outline:0}table.sticky-header thead tr:focus th:first-child{border-left:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th:last-child{border-right:2px solid var(--md-focus-border-color)}table.sticky-header thead tr:focus th::before{border-bottom:2px solid var(--md-focus-border-color);border-top:2px solid var(--md-focus-border-color)}thead th:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}thead th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border:1px solid var(--table-advanced-border-color,#dedede);border-left:0;color:var(--md-secondary-text-color);font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;height:2.5rem;max-width:0;padding:0 .375rem;position:relative;text-align:left}thead th .filter{display:inline-block;height:auto;margin-top:calc(.25rem/2)}thead th .resize{background-color:rgba(0,0,0,0);cursor:col-resize;height:100%;left:calc(-.25rem/2);position:absolute;top:0;width:.25rem;z-index:1}thead .head-inner-cell{align-items:center;display:flex;min-width:.875rem}thead .head-inner-cell .filter-wrap{align-items:center;display:inline-flex;flex:1;justify-content:flex-end}thead .head-inner-cell .filter-icon{color:var(--md-secondary-text-color);cursor:pointer;display:inline-block;height:1.5rem;min-width:1.25rem;position:relative;z-index:1}thead .head-inner-cell .filter-icon::part(button){padding:.25rem;text-align:center;width:1.5rem}thead .head-inner-cell .filter-icon:hover{background-color:var(--table-advanced-filter-hover-bg-color,#ededed)}thead .head-inner-cell .filter-icon:active{background-color:var(--table-advanced-filter-pressed-bg-color,#dedede)}thead .head-inner-cell span{display:inline-block;overflow:hidden;padding-right:calc(.25rem*1.25);text-overflow:ellipsis;white-space:nowrap;width:100%}thead .head-inner-cell .sortable{background:rgba(0,0,0,0);border:0;color:var(--md-secondary-text-color);display:inline-block;min-width:calc(1rem*2.5);overflow:hidden;padding-right:calc(.25rem*4);text-overflow:ellipsis;white-space:nowrap;width:auto}thead md-menu-overlay::part(overlay){top:-.375rem;white-space:normal}@supports(-moz-appearance:none){thead md-menu-overlay::part(overlay){top:-.25rem;white-space:normal}}thead .drag-area-col{cursor:grab;display:block;height:calc(.25rem*10);left:.25rem;position:absolute;right:.25rem;top:0;z-index:1}thead .drag-area-col.drag{border:2px dashed var(--table-advanced-filter-border-color,#ccc);opacity:1}thead .drag-area-col.over{background-color:#a87ff1;height:100%;opacity:.1}thead .sortable{cursor:pointer;position:relative;z-index:1}thead .sortable::after,thead .sortable::before{border:.25rem solid transparent;content:"";display:block;height:0;opacity:.3;position:absolute;right:.25rem;top:50%;width:0}thead .sortable::before{border-bottom-color:var(--md-secondary-text-color);margin-top:-9px}thead .sortable::after{border-top-color:var(--md-secondary-text-color);margin-top:1px}thead .sortable.ascending::after{opacity:1}thead .sortable.descending::before{opacity:1}.filter-active{display:inline-block;height:1.25rem;text-align:center;vertical-align:bottom;width:1.25rem}.filter-active::part(icon){line-height:.875rem}.filter-menu{background-color:var(--table-advanced-filter-bg-color,#fff);padding:calc(.25rem*3);position:relative;z-index:1}.filter-menu select{background-color:var(--table-advanced-filter-bg-color,#fff);border:1px solid var(--table-advanced-filter-border-color,#ccc);color:var(--md-secondary-text-color);min-height:calc(.875rem*1.8);width:100%}.filter-menu input{background-color:var(--table-advanced-filter-bg-color,#fff);border:1px solid var(--table-advanced-filter-border-color,#ccc);color:var(--md-secondary-text-color);margin-top:calc(.25rem*2);width:100%}tbody tr{position:relative}tbody tr td:first-child{border-left:1px solid var(--table-advanced-border-color,#dedede)}tbody tr td{border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-right:1px solid var(--table-advanced-border-color,#dedede);font-size:14px;height:2.5rem;max-width:0;padding:calc(.25rem*1.5);position:relative}tbody tr th:first-child{border-top:1px solid var(--table-advanced-border-color,#dedede)}tbody tr th{background-color:var(--table-advanced-header-bg-color,#f7f7f7);border-bottom:1px solid var(--table-advanced-border-color,#dedede);border-right:1px solid var(--table-advanced-border-color,#dedede);font-size:14px;max-width:0;padding:0 calc(.25rem*4);position:relative;text-align:left}tbody tr .inner-cell{display:flex;white-space:nowrap;align-items:center}tbody tr .inner-cell .warn-icon{display:inline-block;margin-left:.25rem;max-height:1.25rem;position:relative;vertical-align:middle;z-index:0}tbody tr .inner-cell md-icon::part(icon){line-height:1.25rem}tbody tr .inner-cell span{align-self:center;display:inline-block;flex:1;overflow:hidden;padding:0 .25rem;text-overflow:ellipsis;vertical-align:middle}tbody tr .drag-handle{cursor:grab;float:left;margin-right:calc(.25rem*1.5)}tbody tr .drag-area{height:50%;left:0;opacity:.3;position:absolute;right:0}tbody tr .drag-area.top{top:0}tbody tr .drag-area.bottom{background-color:rgba(0,0,0,0);bottom:0}tbody tr.ghost{opacity:.3}tbody tr:hover{background-color:var(--table-advanced-hover-bg-color,#f7f7f7)}tbody tr:hover td,tbody tr:hover th{background-color:var(--table-advanced-hover-bg-color,#f7f7f7)}tbody tr.selected,tbody tr:active{background-color:var(--table-advanced-selected-bg-color,#ededed)}tbody tr.selected td,tbody tr.selected th,tbody tr:active td,tbody tr:active th{background-color:var(--table-advanced-selected-bg-color,#ededed)}button.row-collapsible{display:inline-flex;align-items:center;justify-content:center;height:1.25rem;width:1.25rem;margin-right:calc(.25rem*1.5);background-color:rgba(0,0,0,0);border:1px solid var(--table-advanced-border-color);border-radius:2px}button.row-collapsible:hover{background-color:var(--table-advanced-filter-hover-bg-color,#ededed);border:0}button.row-collapsible:active{background-color:var(--table-advanced-filter-pressed-bg-color);border:0}`;function g(e=250){return function(t,o,r){let i;return function(e,t){if(e.descriptor=e.descriptor||Object.getOwnPropertyDescriptor(e.target,e.key),"function"!=typeof e.descriptor.value)return console.warn(e.key,"Decorator must be used on function"),e.descriptor;const o=e.descriptor.value,r=e.target.constructor.name;return e.descriptor.value=function(...e){return t.call(this,o,e,r)},e.descriptor}({target:t,key:o,descriptor:r},(function(t,o){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t.apply(this,o)},e)}))}}class u{constructor(e,t){this.target=e,this.eventName=t}emit(e,t={bubbles:!0,composed:!0,cancelable:!1}){this.target.dispatchEvent(new CustomEvent(this.eventName,Object.assign({detail:e},t)))}}const m=new WeakMap,f=Object(d.directive)(e=>t=>{if(!(t instanceof d.NodePart))throw new Error("templateCallback can only be used in text bindings");const o=m.get(t);if(void 0!==o&&e.template===o.template&&t.value===o.fragment)return;const r=document.importNode(e.template.content,!0);e.cb({content:e.content,row:e.row,col:e.col,insertIndex:e.insertIndex,fragment:r}),t.setValue(r),m.set(t,{template:e.template,fragment:r})});var v;!function(e){const t={placeholder:"Filter..."};e.OPTIONS={equals:{label:"Equals",input:t,predicate:(e,t)=>e==t},notEqual:{label:"Not equal",input:t,predicate:(e,t)=>e!=t},contains:{label:"Contains",input:t,predicate:(e,t)=>e.includes(t)},notContains:{label:"Not contains",input:t,predicate:(e,t)=>!e.includes(t)},startsWith:{label:"Starts with",input:t,predicate:(e,t)=>e.startsWith(t)},endsWith:{label:"Ends with",input:t,predicate:(e,t)=>e.endsWith(t)},lessThan:{label:"Less than",input:t,predicate:(e,t)=>e<t},lessThanOrEquals:{label:"Less than or equals",input:t,predicate:(e,t)=>e<=t},greaterThan:{label:"Greater than",input:t,predicate:(e,t)=>e>t},greaterThanOrEquals:{label:"Greater than or equals",input:t,predicate:(e,t)=>e>=t}},e.optionsString=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.contains,e.OPTIONS.notContains,e.OPTIONS.startsWith,e.OPTIONS.endsWith],e.optionsNumber=[e.OPTIONS.equals,e.OPTIONS.notEqual,e.OPTIONS.lessThan,e.OPTIONS.lessThanOrEquals,e.OPTIONS.greaterThan,e.OPTIONS.greaterThanOrEquals]}(v||(v={}));var y=function(e,t,o,r){var i,a=arguments.length,l=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var d=e.length-1;d>=0;d--)(i=e[d])&&(l=(a<3?i(l):a>3?i(t,o,l):i(t,o))||l);return a>3&&l&&Object.defineProperty(t,o,l),l};const x=document.createElement("img");var w;x.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",function(e){let t=class extends(Object(i.a)(l.LitElement)){constructor(){super(...arguments),this.isRowFocusable="true",this.error="",this.COLS=[],this.ROWS=[],this.updCols=()=>this.requestUpdate("COLS"),this.updRows=()=>this.requestUpdate("ROWS"),this.dragRow=-1,this.dropRow=-1,this.drops=[],this.dragRowElem=null,this.dragCol=-1,this.dropCol=-1,this.isResizing=!1,this.isSelectable=!1,this.selected={},this.expandedRowIdx={},this.dragover=e=>e.preventDefault(),this.eX=0,this.onResize=(e,t)=>{var o;if(-1!=this.dragCol||-1!=this.dragRow)return;this.isResizing=!0;const r=e.target;null===(o=e.dataTransfer)||void 0===o||o.setDragImage(x,0,0);const i=this.COLS.map(e=>this.shadowRoot.querySelector("th.col-index-"+e.index));this.COLS.forEach((e,t)=>e.width=i[t].offsetWidth+"px"),this.updCols();const a=e.x;this.eX=e.x;let l=-1,d=-1,s=-1;const n=this.COLS[t.index-1],c=i[t.index],h=i[t.index-1],p=c.offsetWidth,b=h.offsetWidth,g=()=>{const e=this.eX;if(l!=e&&0!=e){l=e;const o=l-a;d=p-o,s=b+o,t.width=d+"px",n.width=s+"px",this.updCols()}},u=e=>this.eX=e.x,m=()=>{this.isResizing=!1,r.removeEventListener("drag",g),r.removeEventListener("dragend",m),document.removeEventListener("dragover",u)};r.addEventListener("drag",g),r.addEventListener("dragend",m),document.addEventListener("dragover",u)}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("dragover",this.dragover)}connectedCallback(){super.connectedCallback(),document.addEventListener("dragover",this.dragover),this.updateTableConfig(),this.updateTableData(),this.populateTable()}update(e){super.update(e),e.has("data")&&(this.updateTableData(),this.updateDataInTable())}updateTableData(){if("string"==typeof this.data)try{this.tableData=JSON.parse(this.data)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the config json")}else this.tableData=Object.assign({},this.data)}updateTableConfig(){if("string"==typeof this.config)try{this.tableConfig=JSON.parse(this.config)}catch(e){console.error("[INVALID_JSON_FORMAT] Please recheck the data json")}else this.tableConfig=Object.assign({},this.config)}populateColumns(){var e;let t=0;const o=(e,o)=>{var r,i,a,l;const d=e.filters||(null===(i=null===(r=this.tableConfig.default)||void 0===r?void 0:r.col)||void 0===i?void 0:i.filters),s=d?"forString"==d?v.optionsString:"forNumber"==d?v.optionsNumber:d.length?d:null:null;this.COLS.push({options:Object.assign({},e),index:t++,group:o,sort:"default",sorter:e.sorter||(null===(l=null===(a=this.tableConfig.default)||void 0===a?void 0:a.col)||void 0===l?void 0:l.sorter),isCollapsable:this.tableConfig.cols.collapse==e.id,filter:s?{list:s,selectedIndex:0,input:"",active:!1,menuVisible:!1}:void 0})};this.tableConfig.cols.define.forEach(e=>{"children"in e?e.children.forEach(t=>o(t,{name:e.groupName,length:e.children.length})):o(e)}),this.isSelectable=!!this.tableConfig.rows&&"none"!=(null===(e=this.tableConfig.rows)||void 0===e?void 0:e.selectable)}populateData(){const e=this.COLS.length;if("csv"in this.tableData){const e=p.a.parse(this.tableData.csv,{skipEmptyLines:!0,transform:e=>e.trim()});if(e.errors)return void(this.error="PARSE ERROR:\n"+JSON.stringify(e.errors,null,2));{const t=e.data;this.ROWS=t.map(e=>e.map(e=>({text:e})))}}else if("list2d"in this.tableData)this.ROWS=this.tableData.list2d.map(e=>e.map(e=>({text:e})));else{for(;this.tableData.list.length>e;)this.ROWS.push(this.tableData.list.splice(0,e).map(e=>({text:e})));0!=this.tableData.list.length&&this.ROWS.push(this.tableData.list.map(e=>({text:e})))}0!=this.ROWS.length||(this.error="DATA ERROR: Data is empty")}validateData(){const e=this.COLS.length;this.ROWS.reduce((e,t)=>e+t.length,0)%e==0?this.ROWS.forEach((t,o)=>{const r=t.length;r!=e&&(this.error=`DATA ERROR: Total number of cols (=${e}) and data[${o}] length (=${r}) mismatch`)}):this.error=this.error="DATA ERROR: Data length mismatch. You must provide (numberOfRows * numberOfColumns) amount of data values."}populateTemplate(){const e=this.tableConfig.cellTemplates,t=Object.keys(e||{});e&&t.length&&this.ROWS.forEach((t,o)=>{t.forEach((t,r)=>{for(const i in e){const a=t.text.indexOf(i);if(-1!=a){const l=e[i],d=this.querySelector("#"+l.templateName);if(null==d){console.warn(`cellTemplates["${i}"]: Missing '${l.templateName}' template.`);continue}let s=t.text.replace(i,"");l.contentCb&&(s=l.contentCb({col:r,row:o,content:s,insertIndex:a})),this.ROWS[o][r]={text:s,template:{template:d,templateCb:l.templateCb,insertIndex:"replace"==l.contentUse?-1:a}};break}}})})}setDefaultFilterAndSort(){var e,t;const o=null===(e=this.tableConfig.default)||void 0===e?void 0:e.sort;if(o){const e=this.COLS.find(e=>e.options.id==o.colId);e?this.sort(e,o.order):console.warn(`Cant find ${o.colId} col - for sorting`)}const r=null===(t=this.tableConfig.default)||void 0===t?void 0:t.filter;if(r){const e=this.COLS.find(e=>e.options.id==r.colId);e?e.filter?(e.filter.selectedIndex=r.selectedIndex,e.filter.input=r.input,this.updCols(),this.filter(e)):console.warn(`Cant find filters on ${r.colId} col`):console.warn(`Cant find ${r.colId} col - for filtering`)}}populateTable(){this.populateColumns(),this.populateData(),this.validateData(),this.setDefaultFilterAndSort(),this.populateTemplate()}updateDataInTable(){this.populateData(),this.validateData(),this.populateTemplate()}onDropRow(){this.dragRow!=this.dropRow&&this.drops.push([this.dragRow,this.dropRow]),this.dragRow=-1,this.dropRow=-1,this.dragRowElem&&(this.dragRowElem.setAttribute("draggable","false"),this.dragRowElem=null)}onDropCol(){if(this.dragCol!=this.dropCol){const e=this.COLS[this.dragCol],t=this.COLS[this.dropCol],o=e.group,r=t.group,i=e.index,a=t.index;e.group=r,t.group=o,e.index=a,t.index=i,this.COLS[this.dragCol]=t,this.COLS[this.dropCol]=e,this.ROWS.forEach(e=>{const t=e[this.dragCol],o=e[this.dropCol];e[this.dragCol]=o,e[this.dropCol]=t}),this.updCols(),this.updRows()}this.dragCol=-1,this.dropCol=-1}sort(e,t){e.sorter&&(this.clearSelection(),this.drops=[],this.COLS.forEach(o=>{o.options.id==e.options.id?o.sort=t||("default"==o.sort?"ascending":"ascending"==o.sort?"descending":"default"):o.sort="default"}),this.updCols(),this.requestUpdate(),this["md-table-advanced-change"].emit({type:"sort",order:e.sort}))}filter(e){if(!e.filter)return;this.clearSelection(),this.drops=[];const t=e.filter.input.trim(),o=e.filter.list[e.filter.selectedIndex];e.filter.active=!!t,this.requestUpdate(),t?this["md-table-advanced-change"].emit({type:"filter-on",filter:o,input:t}):this["md-table-advanced-change"].emit({type:"filter-off",filter:e.filter.list[e.filter.selectedIndex]})}selectRow(e){var t;const o=e.row.idx,r=this.selected.hasOwnProperty(o);"multiple"==(null===(t=this.tableConfig.rows)||void 0===t?void 0:t.selectable)?(e.metaKey?r?delete this.selected[o]:this.selected[o]=!0:e.shiftKey||(this.selected={[o]:!0}),this["md-table-advanced-change"].emit({type:"multi-select",rows:Object.keys(this.selected).map(e=>+e)})):r?this.clearSelection():(this.selected={[o]:!0},this["md-table-advanced-change"].emit({type:"select",index:o})),this.requestUpdate("selected")}clearSelection(){this.selected={},this.requestUpdate("selected")}collapseToggle(e,t){e.stopPropagation(),this.expandedRowIdx[t]?(delete this.expandedRowIdx[t],this["md-table-advanced-change"].emit({type:"collapse",row:t})):(this.expandedRowIdx[t]=!0,this["md-table-advanced-change"].emit({type:"expand",row:t})),this.clearSelection(),this.requestUpdate()}render(){if(this.error)return l.html` <div>${this.error}</div> `;const{head:e}=this.tableConfig,t=Object(s.classMap)({"sticky-header":!!this.tableConfig.isStickyHeader});return l.html`
|
|
2
2
|
<div class="md-table-advanced">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
<table class=${t} summary=${Object(n.ifDefined)(null==e?void 0:e.summary)}>
|
package/dist/chunks/md-81.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[81],{124:function(t,e,r){"use strict";r.r(e),r.d(e,"formatType",(function(){return h})),r.d(e,"Table",(function(){return m}));var o=r(6),a=r(5),l=r(0),d=r(3),i=r(
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[81],{124:function(t,e,r){"use strict";r.r(e),r.d(e,"formatType",(function(){return h})),r.d(e,"Table",(function(){return m}));var o=r(6),a=r(5),l=r(0),d=r(3),i=r(13),s=r(32),n=r.n(s),c=l.css`.md-table-container{width:100%}.md-table-container_stickly{height:100%;overflow-y:auto;position:relative}.md-table-container_stickly .md-table__header tr{background-color:rgba(0,0,0,0)}.md-table-container_stickly .md-table__header th{background-color:var(--table-header-bg-color,#f7f7f7);position:sticky;top:0}.md-table-container_stickly .md-table__header th:hover{background-color:var(--table-hover-bg-color,#ededed)}.md-table{border:1px solid var(--table-border-color,#dedede);border-collapse:collapse;width:100%}.md-table .md-table__header tr{background-color:var(--table-header-bg-color,#f7f7f7)}.md-table .md-table__header th{border-bottom:1px solid var(--table-border-color,#dedede);border-right:1px solid var(--table-border-color,#dedede);color:var(--table-text-color,#545454);font-size:12px;font-weight:700;padding-left:calc(.25rem*3);text-align:left}.md-table .md-table__header th:hover{background-color:var(--table-hover-bg-color,#ededed)}.md-table .md-table__header th:active{background-color:var(--table-pressed-bg-color,#dedede)}.md-table .md-table__header th a{color:var(--table-text-color,#545454)}.md-table .md-table__header th a.sortedAbc:after{content:"\\f1cc";display:inline-block;font-family:momentum-ui-icons;padding-left:.25rem;vertical-align:bottom}.md-table .md-table__header th a.sortedZyx:after{content:"\\f1cf";display:inline-block;font-family:momentum-ui-icons;padding-left:.25rem;vertical-align:bottom}.md-table .md-table__body tr{height:2.5rem}.md-table .md-table__body tr:hover{background-color:var(--table-hover-bg-color,#ededed)}.md-table .md-table__body tr:active{background-color:var(--table-pressed-bg-color,#dedede)}.md-table .md-table__body td{font-size:14px;min-width:calc(2.5rem*3.2);padding-left:calc(.25rem*3);vertical-align:middle}.md-table .md-table__body td span{display:inline-block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-height:calc(.25rem*6);width:calc(100% - .25rem)}.md-table .md-table__body td md-icon{padding-left:.25rem;vertical-align:bottom}.md-table .md-table__body td:last-child span{width:auto}.md-table tr{height:2.5rem}.md-table tr td{border-bottom:1px solid var(--table-border-color,#dedede);border-right:1px solid var(--table-border-color,#dedede);vertical-align:top}.md-table--stripped .md-table__body tr:nth-child(even){background-color:var(--table-stripped-bg-color,#ededed)}.md-table--stripped .md-table__body tr:nth-child(even):hover{background-color:var(--table-hover-bg-color,#ededed)}.md-table--clean tr td{border-right:unset}.md-table--no-borders{border:unset}.md-table--no-borders .md-table__header th,.md-table--no-borders tr td{border-bottom:unset;border-right:unset}`,b=function(t,e,r,o){var a,l=arguments.length,d=l<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)d=Reflect.decorate(t,e,r,o);else for(var i=t.length-1;i>=0;i--)(a=t[i])&&(d=(l<3?a(d):l>3?a(e,r,d):a(e,r))||d);return l>3&&d&&Object.defineProperty(e,r,d),d};const h=["number","default"];var m;!function(t){let e=class extends l.LitElement{constructor(){super(...arguments),this.tabledata="",this.zebra=!1,this.clean=!1,this.sorting=!1,this.nodata="No data Loaded",this.stickheader=!1,this.label="Table",this.noBorders=!1,this.format="default",this.warning=[],this.errors=[],this.sort={columnName:"",sortting:!1},this.csvData=void 0,this.config={quoteChar:'"',escapeChar:'""',header:!1,preview:0,comments:!1,step:void 0,complete:void 0,download:!1}}connectedCallback(){super.connectedCallback(),this.results=n.a.parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length),this.requestUpdate("tabledata"),this.linkCellItems()}get rowItem(){return this.rowTable}linkCellItems(){const t=this.rowTable;null==t||t.forEach((t,e)=>{this.warning.forEach(r=>{if(e+1===r.row){t.querySelectorAll('td[role="cell"').forEach((t,e)=>{e+1===r.col&&(t.classList.add("warning"),t.insertAdjacentHTML("beforeend",'<md-icon name="warning-regular" size="24" iconSet="momentumDesign" color="var(--md-alert-warning-text-color)"></md-icon>'))})}}),this.errors.forEach(r=>{if(e+1===r.row){t.querySelectorAll('td[role="cell"').forEach((t,e)=>{e+1===r.col&&(t.classList.add("error"),t.insertAdjacentHTML("beforeend",'<md-icon name="clear-bold" size="24" iconSet="momentumDesign" color="var(--md-alert-error-text-color)"></md-icon>'))})}})})}sortTab(t,e){const r=t.target,o=Array.from(this.csvData),a=this.headerRow.indexOf(e);e!==this.sort.columnName||!0!==this.sort.sortting?(o.sort((function(t,e){const r=t[a].toLowerCase(),o=e[a].toLowerCase();return r>o?1:r<o?-1:0})),this.sort.sortting=!0,r.classList.remove("sortedZyx"),r.classList.add("sortedAbc")):(o.reverse(),this.sort.sortting=!1,r.classList.remove("sortedAbc"),r.classList.add("sortedZyx")),this.sort.columnName=e,this.csvData=o,this.requestUpdate("csvData")}update(t){super.update(t),t.has("tabledata")&&(this.results=n.a.parse(this.tabledata,this.config),this.headerRow=this.results.data[0],this.csvData=this.results.data.slice(1,this.results.data.length),this.linkCellItems())}static get styles(){return[a.a,c]}get tableClassMap(){return{"md-table--clean":this.clean,"md-table--no-borders":this.noBorders,"md-table--stripped":this.zebra,"md-table--sorting":this.sorting}}render(){return l.html`
|
|
2
2
|
<div class=${"md-table-container "+(this.stickheader?"md-table-container_stickly":d.nothing)}>
|
|
3
3
|
${0!=this.csvData.length?l.html`
|
|
4
4
|
<table
|
package/dist/chunks/md-82.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[82],{101:function(e,t,i){"use strict";i.r(t),i.d(t,"MORE_MENU_TAB_COPY_ID_PREFIX",(function(){return y})),i.d(t,"Tabs",(function(){return g}));i(13),i(30);var s=i(1),a=i(7),n=i(5),l=i(0),d=i(4),o=i(15),r=i(8),b=i(70),h=i(22),c=i(31),u=i.n(c),p=i(64),m=i(39),v=i(45),T=function(e,t,i,s){var a,n=arguments.length,l=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var d=e.length-1;d>=0;d--)(a=e[d])&&(l=(n<3?a(l):n>3?a(t,i,l):a(t,i))||l);return n>3&&l&&Object.defineProperty(t,i,l),l},f=function(e,t,i,s){return new(i||(i=Promise))((function(a,n){function l(e){try{o(s.next(e))}catch(e){n(e)}}function d(e){try{o(s.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,d)}o((s=s.apply(e,t||[])).next())}))};const y="more-menu-copy-";var g;!function(e){let t=class extends(Object(a.c)(Object(a.d)(Object(a.e)(l.LitElement)))){constructor(){super(...arguments),this.justified=!1,this.overflowLabel="More Tabs",this.draggable=!1,this.direction="horizontal",this.moreItemsScrollLimit=Number.MAX_SAFE_INTEGER,this.delay=0,this.animation=100,this.ghostClass="",this.chosenClass="",this.forceFallback=!1,this.fallbackClass="",this.tabsId="",this.persistSelection=!1,this.compUniqueId="",this.type="Line",this.newMomentum=!1,this.isMoreTabMenuVisible=!1,this.isMoreTabMenuMeasured=!1,this.isMoreTabMenuOpen=!1,this.isMoreTabMenuSelected=!1,this.isMoreTabMenuScrollable=!1,this.moreTabMenuOffsetWidth=0,this.moreTabMenuMaxHeight=null,this.tabsViewportDataList=[],this.tabsFilteredAsVisibleList=[],this.tabsFilteredAsHiddenList=[],this.noTabsVisible=!1,this.defaultTabsOrderArray=[],this.tabsOrderPrefsArray=[],this.tabs=[],this.panels=[],this.tabsCopy=[],this.tabsHash={},this.tabsCopyHash={},this.tabsIdxHash={},this.tabsVisibleIdxHash={},this.tabsHiddenIdxHash={},this.visibleTabsSortableInstance=null,this.hiddenTabsSortableInstance=null,this.handleOnDragEnd=e=>f(this,void 0,void 0,(function*(){var t,i,s,a,n,l,d,o,r,b;e.stopPropagation();const h=e.oldIndex,c=e.newIndex,u=[...this.tabsFilteredAsVisibleList],p=[...this.tabsFilteredAsHiddenList],m=this.getDragDirection(e);if(void 0!==h&&void 0!==c){switch(m){case"visibleToHidden":{null===(i=null===(t=this.hiddenTabsContainerElement)||void 0===t?void 0:t.querySelector("#"+e.item.id))||void 0===i||i.remove();const s=u[h],a=p.slice(-1)[0],n=c===this.tabsFilteredAsHiddenList.length?c-1:c;p.splice(n,0,s),p.pop();const l=u.filter(t=>t.id!==this.getNormalizedTabId(e.item.id));l.push(a),this.tabsFilteredAsVisibleList=[...l],this.tabsFilteredAsHiddenList=[...p];break}case"visibleToVisible":{const e=u[h];u.splice(h,1),u.splice(c,0,e),this.tabsFilteredAsVisibleList=u,c===this.tabsFilteredAsVisibleList.length-1&&(null===(a=null===(s=this.visibleTabsContainerElement)||void 0===s?void 0:s.children[this.visibleTabsContainerElement.children.length-1])||void 0===a||a.remove());const t=this.visibleTabsContainerElement.children[h],i=this.visibleTabsContainerElement.children[c];if(!t||!i)return;null===(n=this.visibleTabsContainerElement)||void 0===n||n.replaceChild(i,t),null===(l=this.visibleTabsContainerElement)||void 0===l||l.insertBefore(t,i);break}case"hiddenToVisible":{null===(o=null===(d=this.visibleTabsContainerElement)||void 0===d?void 0:d.querySelector("#"+e.item.id))||void 0===o||o.remove();const t=p[h],i=u.slice(-1)[0];p.splice(h,1),p.splice(0,0,i);const s=c===this.tabsFilteredAsVisibleList.length?c-1:c;u.splice(s,0,t),u.pop(),this.tabsFilteredAsVisibleList=u,this.tabsFilteredAsHiddenList=p;break}case"hiddenToHidden":{const e=p[h];p.splice(h,1),p.splice(c,0,e),this.tabsFilteredAsHiddenList=p,c===this.tabsFilteredAsHiddenList.length-1&&(null===(b=null===(r=this.hiddenTabsContainerElement)||void 0===r?void 0:r.children[this.hiddenTabsContainerElement.children.length-1])||void 0===b||b.remove());break}}if(this.compUniqueId){const e=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],t=e.findIndex(e=>e.selected);this.storeSelectedTabIndex(t),this.tabsOrderPrefsArray=e.map(e=>e.name),localStorage.setItem(this.compUniqueId,this.tabsOrderPrefsArray.join(","))}}}))}generateOptions(){return{group:"shared",animation:10,swapThreshold:1,draggable:"md-tab",direction:this.direction,forceFallback:this.forceFallback,fallbackClass:this.fallbackClass,ghostClass:this.ghostClass,chosenClass:this.chosenClass,onEnd:this.handleOnDragEnd}}getCopyTabId(e){var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith(y))?`${y}${e.id}`:e.id}getAriaControlId(e){var t,i;if(null===(t=e.id)||void 0===t?void 0:t.startsWith(y))return`${y}${e.id}`;return"tab_panel_"+(null===(i=e.id)||void 0===i?void 0:i.substring(4))}getTabIndex(e){var t,i;return this.isMoreTabMenuVisible&&0===this.getCurrentIndex(null==e?void 0:e.id)&&this.selected>(null===(t=this.tabsFilteredAsVisibleList)||void 0===t?void 0:t.length)-1||(null===(i=this.tabsFilteredAsVisibleList[this.selected])||void 0===i?void 0:i.id)===e.id?0:-1}getNormalizedTabId(e){return e.replace(y,"")}static get styles(){return[n.a,m.a]}ensureTabsUpdateComplete(e){return f(this,void 0,void 0,(function*(){const t=e.map(e=>void 0!==e.updateComplete?e.updateComplete:null).filter(e=>null!==e);t.length&&(yield Promise.all(t))}))}measureTabsOffsetWidth(){return this.justified||"vertical"===this.direction?this.tabs.map(e=>{e.setAttribute("measuringrealwidth","");const t=e.closable?e.offsetWidth+v.TAB_CROSS_WIDTH:e.offsetWidth;return e.removeAttribute("measuringrealwidth"),t}):this.tabs.map(e=>e.closable?e.offsetWidth+v.TAB_CROSS_WIDTH:e.offsetWidth)}measureHiddenTabsCopiesOffsetHeight(){return this.tabsCopy.map(e=>e.offsetHeight)}manageOverflow(){var e,t;return f(this,void 0,void 0,(function*(){if("vertical"!==this.direction){let i;i=0===this.tabsFilteredAsVisibleList.length&&0===this.tabsFilteredAsHiddenList.length?[...this.tabs]:[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],i.forEach(e=>{var t,i,s,a,n;if((null===(t=e.children)||void 0===t?void 0:t.length)&&0===(null===(s=null===(i=e.children[0])||void 0===i?void 0:i.children)||void 0===s?void 0:s.length)){const t=null===(a=null==e?void 0:e.querySelector("slot"))||void 0===a?void 0:a.assignedNodes({flatten:!0})[0].cloneNode(!0);t&&(t.classList.add("tab-content"),null===(n=null==e?void 0:e.children[0])||void 0===n||n.appendChild(t))}});const s=i.length;if(this.tabsListElement&&s){const a=(null===(e=this.tabsSettingsElement)||void 0===e?void 0:e.offsetWidth)?this.tabsListElement.offsetWidth-(null===(t=this.tabsSettingsElement)||void 0===t?void 0:t.offsetWidth):this.tabsListElement.offsetWidth;yield this.ensureTabsUpdateComplete(this.tabs);const n=this.measureTabsOffsetWidth(),l=i.reduce((e,t,i)=>e+=n[i],0);if(l){yield this.setupMoreTab();let e=!0;a<l&&(e=!1);const t=[];let d=0;i.forEach((i,l)=>{d+=n[l];const o=!e&&d+(l<s-1?this.moreTabMenuOffsetWidth:0)>a;t.push({isTabInViewportHidden:o,tabOffsetWidth:n[l]})}),this.tabsViewportDataList=t,this.tabsViewportDataList.forEach((e,t)=>this.tabs[t].viewportHidden=e.isTabInViewportHidden),this.isMoreTabMenuVisible=!!this.tabsViewportDataList.find(e=>e.isTabInViewportHidden),this.tabsFilteredAsVisibleList=i.filter((e,t)=>!this.tabsViewportDataList[t].isTabInViewportHidden),this.tabsVisibleIdxHash=this.tabsFilteredAsVisibleList.reduce((e,t,i)=>(e[t.id]=i,e),{}),this.tabsFilteredAsHiddenList=i.filter((e,t)=>this.tabsViewportDataList[t].isTabInViewportHidden),this.tabsHiddenIdxHash=this.tabsFilteredAsHiddenList.reduce((e,t,i)=>(e[t.id]=i,e),{})}}this.updateIsMoreTabMenuSelected();const a=this.tabsFilteredAsHiddenList.find(e=>!e.disabled);this.updateHiddenIdPositiveTabIndex(a)}}))}updateIsMoreTabMenuSelected(){this.isMoreTabMenuSelected=!!this.tabsFilteredAsHiddenList.find(e=>e.selected)}updateHiddenIdPositiveTabIndex(e){this.tabHiddenIdPositiveTabIndex=e?e.id:void 0}sortTabsAndPanes(){if(!this.tabsOrderPrefsArray.length)return;const e=(e,t)=>{const i=e.getAttribute("name")||"",s=t.getAttribute("name")||"";return this.tabsOrderPrefsArray.indexOf(i)-this.tabsOrderPrefsArray.indexOf(s)};this.tabs.sort(e),this.panels.sort(e)}linkPanelsAndTabs(){return f(this,void 0,void 0,(function*(){this.sortTabsAndPanes();const{tabs:e,panels:t}=this;if(0===e.length||0===t.length)return void console.warn("The tabs or panels count should't be equal zero.");e.length!==t.length&&console.warn(`The amount of tabs (${e.length}) doesn't match the amount of panels (${t.length}).`),e.forEach((e,i)=>{const s=Object(h.nanoid)(10),a="tab_"+s,n="tab_panel_"+s;e.setAttribute("id",a),e.setAttribute("aria-controls",n),e.selected=this.selected===i,"vertical"===this.direction&&(e.vertical=!0);const l=t[i];l?(l.setAttribute("id",n),l.setAttribute("aria-labelledby",a),l.selected=this.selected===i,e.disabled&&(l.hidden=!0,l.selected=!1)):e.disabled=!0});let i=this.selected;for(;i<e.length&&e[i].disabled;)i++;i=i===e.length?0:i,e[i].selected=!0,t[i].selected=!0,this.tabsHash=this.tabs.reduce((e,t)=>(e[t.id]=t,e),{}),this.tabsIdxHash=this.tabs.reduce((e,t,i)=>(e[t.id]=i,e),{})}))}get slotItem(){return this.tabSlotElement}filterSlotted(){return this.tabSlotElement.assignedElements()}handleResize(e){const t=Object.create(null,{handleResize:{get:()=>super.handleResize}});return f(this,void 0,void 0,(function*(){t.handleResize&&t.handleResize.call(this,e),yield this.manageOverflow()}))}getDragDirection(e){return e.from===this.visibleTabsContainerElement&&e.to===this.hiddenTabsContainerElement?"visibleToHidden":e.from===this.visibleTabsContainerElement&&e.to===this.visibleTabsContainerElement?"visibleToVisible":e.from===this.hiddenTabsContainerElement&&e.to===this.visibleTabsContainerElement?"hiddenToVisible":e.from===this.hiddenTabsContainerElement&&e.to===this.hiddenTabsContainerElement?"hiddenToHidden":void 0}makeTabCopyFocus(e){e&&e.focus()}handleTabClick(e){const{id:t}=e.detail;this.handleNewSelectedTab(t)}handleNewSelectedTab(e){const t=this.tabsHash[this.getNormalizedTabId(e)];if(t&&!t.disabled){const e=this.tabsIdxHash[t.id];-1!==e&&this.updateSelectedTab(e);{const e=this.tabsCopyHash[this.getCopyTabId(t)];e&&this.makeTabCopyFocus(e),this.updateHiddenIdPositiveTabIndex(t)}}}handleTabCrossClick(e){const{id:t}=e.detail;this.handleTabCloseEvent(t)}handleTabCloseClick(e){const{id:t}=e.detail;this.handleTabCloseEvent(t)}handleTabCloseEvent(e){var t,i;const s=this.tabsHash[this.getNormalizedTabId(e)];if(s&&!s.disabled&&("auto"===s.closable||"custom"===s.closable)){const s=this.tabsFilteredAsVisibleList.findIndex(t=>this.getNormalizedTabId(t.id)===this.getNormalizedTabId(e));this.tabsFilteredAsVisibleList=this.tabsFilteredAsVisibleList.filter(t=>this.getNormalizedTabId(t.id)!==this.getNormalizedTabId(e)),null===(i=null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.querySelector("#"+e))||void 0===i||i.remove(),0!==this.tabsFilteredAsHiddenList.length&&(this.tabsFilteredAsVisibleList.push(this.tabsFilteredAsHiddenList[0]),this.tabsFilteredAsHiddenList.splice(0,1)),0===this.tabsFilteredAsHiddenList.length&&(this.isMoreTabMenuVisible=!1,this.isMoreTabMenuMeasured=!1),this.handleUpdatedSeletedTabAfterCross(s)}}handleUpdatedSeletedTabAfterCross(e){var t;let i=e;for(;i<this.tabsFilteredAsVisibleList.length&&(null===(t=this.tabsFilteredAsVisibleList[i])||void 0===t?void 0:t.disabled);)i++;if(void 0===this.tabsFilteredAsVisibleList[i]||e===this.tabsFilteredAsVisibleList.length)for(i=e-1;i>=0&&this.tabsFilteredAsVisibleList[i].disabled;)i--;if(-1!==i){const e=this.tabs.findIndex(e=>e.id===this.tabsFilteredAsVisibleList[i].id);this.updateSelectedTab(e)}else this.updateSelectedTab(i);this.noTabsVisible=0===this.tabsFilteredAsVisibleList.length&&0===this.tabsFilteredAsHiddenList.length,this.requestUpdate()}updateSelectedTab(e){const{tabs:t,panels:i}=this,s=this.tabs.findIndex(e=>e.hasAttribute("selected"));if(t&&i&&[s,e].forEach(e=>{const s=t[e];s&&s.toggleAttribute("selected");const a=i[e];if(a&&a.toggleAttribute("selected"),s){const e=this.tabsCopyHash[this.getCopyTabId(s)];e?(e.toggleAttribute("selected"),this.isMoreTabMenuSelected=!0):this.isMoreTabMenuSelected=!1}}),e>=0){this.dispatchSelectedChangedEvent(e);const i=("horizontal"===this.direction?[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList]:this.tabs).findIndex(i=>i.id===t[e].id);this.changeSelectedTabIdx(i)}}dispatchSelectedChangedEvent(e){const t=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],i=this.tabs[e].id,s=t.findIndex(e=>e.id===i),a=[];t.forEach(e=>{a.push(e.name)}),this.dispatchEvent(new CustomEvent("selected-changed",{detail:{value:s,tabsOrder:a},composed:!0,bubbles:!0}))}changeSelectedTabIdx(e){this.requestUpdate(),this.selected=e,this.updateComplete.then(()=>{var t,i,s,a;if(e<this.tabsFilteredAsVisibleList.length)null===(i=null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children[this.selected])||void 0===i||i.focus();else{const e=this.selected-this.tabsFilteredAsVisibleList.length;null===(a=null===(s=this.hiddenTabsContainerElement)||void 0===s?void 0:s.children[e])||void 0===a||a.focus();const t=this.tabsFilteredAsHiddenList[e];!(null==t?void 0:t.disabled)&&this.updateHiddenIdPositiveTabIndex(t)}}),this.updateIsMoreTabMenuSelected(),this.storeSelectedTabIndex(e)}storeSelectedTabIndex(e){this.persistSelection&&this.tabsId&&e>-1&&""!==this.tabsId.trim()&&sessionStorage.setItem(this.tabsId,""+e)}getCurrentIndex(e){var t,i;const s=(null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children.length)||0;for(let t=0;t<s;t++)if((null===(i=this.visibleTabsContainerElement)||void 0===i?void 0:i.children[t].id)===e)return t;return this.tabsVisibleIdxHash[e]}moveFocusToAdjacentTab(e,t){var i;const s=this.getCurrentIndex(e),a=null===(i=this.visibleTabsContainerElement)||void 0===i?void 0:i.children,n=(null==a?void 0:a.length)||0;if(!a||0===n)return;let l=0;"previous"===t?l=0===s?n-1:s-1:"next"===t?l=s===n-1?0:s+1:"fromMoreTabs"===t&&(l=this.selected>=n?0:this.selected),this.moveFocusToTab(a[l])}moveFocusToTab(e){Object(p.setTimeout)(()=>null==e?void 0:e.focus(),0)}handleOverlayClose(){this.menuOverlayElement&&(this.menuOverlayElement.isOpen=!1)}dispatchKeydownEvent(e,t){t&&this.dispatchEvent(new CustomEvent("tab-keydown",{detail:{id:t,key:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,srcEvent:e},bubbles:!0,composed:!0}))}handleTabKeydown(e){var t,i,a,n,l,d;let o;if(e.target!=this&&!this.tabs.find(t=>t.id===e.target.id))return!1;o=e.path?e.path[0].id:e.composedPath()?e.composedPath()[0].id:e.originalTarget.id;const r=this.getNormalizedTabId(o);this.dispatchKeydownEvent(e,r);const b=e.code,{shiftKey:h}=e,c=!!this.isMoreTabMenuVisible&&"tab-more"===r,u=c&&this.isMoreTabMenuVisible?this.moreTabMenuElement:this.tabsHash[this.getNormalizedTabId(r)],p=!this.isMoreTabMenuVisible||u&&this.tabsVisibleIdxHash[u.id]>-1,m=!!this.isMoreTabMenuVisible&&(u&&this.tabsHiddenIdxHash[u.id]>-1),v=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length-1:this.tabs.length-1,T=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length:-1,f=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length+this.tabsFilteredAsHiddenList.length-1:-1;switch(b){case s.b.Tab:c&&!this.isMoreTabMenuOpen&&h&&(e.preventDefault(),this.moveFocusToAdjacentTab(o,"fromMoreTabs"));break;case s.b.End:c||(p?(e.preventDefault(),this.moveFocusToTab(null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children[(null===(i=this.tabsFilteredAsVisibleList)||void 0===i?void 0:i.length)-1])):this.isMoreTabMenuOpen&&(e.preventDefault(),this.moveFocusToTab(null===(a=this.hiddenTabsContainerElement)||void 0===a?void 0:a.children[(null===(n=this.tabsFilteredAsHiddenList)||void 0===n?void 0:n.length)-1])));break;case s.b.Home:p?(e.preventDefault(),this.moveFocusToTab(null===(l=this.visibleTabsContainerElement)||void 0===l?void 0:l.children[0])):this.isMoreTabMenuOpen&&(e.preventDefault(),this.moveFocusToTab(null===(d=this.hiddenTabsContainerElement)||void 0===d?void 0:d.children[0]));break;case s.b.ArrowLeft:c||p&&(e.stopPropagation(),this.moveFocusToAdjacentTab(o,"previous"));break;case s.b.ArrowRight:c||p&&(e.stopPropagation(),this.moveFocusToAdjacentTab(o,"next"));break;case s.b.ArrowUp:if(c);else if(p&&"vertical"===this.direction)e.preventDefault(),this.changeSelectedTabIdx(0===this.selected?v:this.selected-1);else if(m){e.preventDefault();const t=this.selected===T?f:this.selected-1;this.changeSelectedTabIdx(t)}break;case s.b.ArrowDown:if(c);else if(p&&"vertical"===this.direction)e.preventDefault(),this.changeSelectedTabIdx(this.selected===v?0:this.selected+1);else if(m){e.preventDefault();const t=this.selected===f?T:this.selected+1;this.changeSelectedTabIdx(t)}break;case s.b.Enter:case s.b.NumpadEnter:case s.b.Space:if(c){const e=this.tabsFilteredAsHiddenList.filter(e=>!e.disabled),t=e.length?e.find(e=>e.selected)||e[0]:void 0;if(this.updateHiddenIdPositiveTabIndex(t),t){const e=this.tabsIdxHash[this.getNormalizedTabId(t.id)];-1!==e&&this.updateSelectedTab(e)}}else if(u&&!u.disabled){const t=this.tabsIdxHash[this.getNormalizedTabId(u.id)];-1!==t&&(e.preventDefault(),this.updateSelectedTab(t))}}}setupTabsEvents(){this.addEventListener("tab-click",this.handleTabClick),this.addEventListener("tab-cross-click",this.handleTabCrossClick),this.addEventListener("tab-close-click",this.handleTabCloseClick),this.addEventListener("keydown",this.handleTabKeydown),this.addEventListener("clear-tab-order-prefs",this.clearTabOrderPrefs)}teardownTabsEvents(){this.removeEventListener("tab-click",this.handleTabClick),this.removeEventListener("tab-cross-click",this.handleTabCrossClick),this.removeEventListener("tab-close-click",this.handleTabCloseClick),this.removeEventListener("keydown",this.handleTabKeydown),this.removeEventListener("clear-tab-order-prefs",this.clearTabOrderPrefs)}clearTabOrderPrefs(e){const{compUniqueId:t}=e.detail;t===this.compUniqueId&&(localStorage.removeItem(this.tabsId),sessionStorage.removeItem(this.tabsId),localStorage.removeItem(this.compUniqueId),this.tabsOrderPrefsArray=this.defaultTabsOrderArray,this.selected=0,this.initializeTabs(),this.dispatchSelectedChangedEvent(0))}setupPanelsAndTabs(){this.tabSlotElement&&(this.tabs=this.tabSlotElement.assignedElements()),this.panelSlotElement&&(this.panels=this.panelSlotElement.assignedElements()),this.defaultTabsOrderArray=this.tabs.map(e=>e.name)}setupMoreTab(){return f(this,void 0,void 0,(function*(){"vertical"!==this.direction&&this.moreTabMenuElement&&!this.isMoreTabMenuMeasured&&(this.moreTabMenuElement.classList.add("md-menu-overlay__more_tab--measuring"),yield this.moreTabMenuElement.updateComplete,this.moreTabMenuElement.offsetWidth&&(this.moreTabMenuOffsetWidth=this.moreTabMenuElement.offsetWidth,this.isMoreTabMenuMeasured=!0),this.moreTabMenuElement.classList.remove("md-menu-overlay__more_tab--measuring"))}))}initializeSortable(){this.visibleTabsContainerElement&&this.hiddenTabsContainerElement&&(this.visibleTabsSortableInstance=u.a.create(this.visibleTabsContainerElement,this.generateOptions()),this.hiddenTabsSortableInstance=u.a.create(this.hiddenTabsContainerElement,this.generateOptions()))}initializeTabs(){this.tabs=[],this.panels=[],this.tabsFilteredAsVisibleList=[],this.tabsFilteredAsHiddenList=[],this.isMoreTabMenuVisible=!1,this.setupPanelsAndTabs(),this.linkPanelsAndTabs(),this.draggable&&this.initializeSortable(),this.manageOverflow(),this.requestUpdate()}connectedCallback(){var e;if(super.connectedCallback(),this.setupTabsEvents(),this.persistSelection){if(!this.tabsId||""===this.tabsId.trim())return void console.error("Unique tabs-id attribute is mandatory for persist the selection of tab ");const e=localStorage.getItem(this.tabsId);this.selected=e&&parseInt(e)>-1?parseInt(e):this.selected}this.compUniqueId&&(this.tabsOrderPrefsArray=(null===(e=localStorage.getItem(this.compUniqueId))||void 0===e?void 0:e.split(","))||[])}selectTabFromStorage(){if(this.persistSelection){if(!this.tabsId||""===this.tabsId.trim())return void console.error("Unique tabs-id attribute is mandatory for persist the selection of tab ");const e=sessionStorage.getItem(this.tabsId);let t=0;if(e){const i=parseInt(e);t=i>-1?i:this.selected}const i=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList];i.length&&i[t].id?this.handleNewSelectedTab(i[t].id):this.selected=t}}disconnectedCallback(){super.disconnectedCallback(),this.teardownTabsEvents()}firstUpdated(e){super.firstUpdated(e),this.setupPanelsAndTabs(),this.linkPanelsAndTabs(),this.selectTabFromStorage()}updated(e){var t;if(super.updated(e),e.has("slotted")&&this.initializeTabs(),!this.draggable||this.visibleTabsSortableInstance||this.hiddenTabsSortableInstance||this.initializeSortable(),e.has("tabsFilteredAsHiddenList")&&(this.tabsCopy=Array.from((null===(t=this.tabsCopyHiddenListElements)||void 0===t?void 0:t.values())||[]),this.tabsCopyHash=this.tabsCopy.reduce((e,t)=>(e[t.id]=t,e),{})),(e.has("tabsFilteredAsVisibleList")||e.has("tabsFilteredAsHiddenList"))&&(this.tabsVisibleIdxHash=this.tabsFilteredAsVisibleList.reduce((e,t,i)=>(e[t.id]=i,e),{}),this.tabsHiddenIdxHash=this.tabsFilteredAsHiddenList.reduce((e,t,i)=>(e[t.id]=i,e),{})),e.has("isMoreTabMenuOpen")&&this.isMoreTabMenuVisible){const t=e.get("isMoreTabMenuOpen");this.isMoreTabMenuOpen&&!t&&(this.moreItemsScrollLimit<this.tabsCopy.length?(this.isMoreTabMenuScrollable=!0,this.moreTabMenuMaxHeight=this.measureHiddenTabsCopiesOffsetHeight().slice(0,this.moreItemsScrollLimit).reduce((e,t)=>e+=t,0)+"px"):(this.isMoreTabMenuScrollable=!1,this.moreTabMenuMaxHeight=null))}e.has("tabsId")&&this.selectTabFromStorage()}render(){return l.html`
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[82],{101:function(e,t,i){"use strict";i.r(t),i.d(t,"MORE_MENU_TAB_COPY_ID_PREFIX",(function(){return y})),i.d(t,"Tabs",(function(){return g}));i(15),i(30);var s=i(1),a=i(7),n=i(5),l=i(0),d=i(4),o=i(14),r=i(8),b=i(70),h=i(22),c=i(31),u=i.n(c),p=i(64),m=i(39),v=i(45),T=function(e,t,i,s){var a,n=arguments.length,l=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,i,s);else for(var d=e.length-1;d>=0;d--)(a=e[d])&&(l=(n<3?a(l):n>3?a(t,i,l):a(t,i))||l);return n>3&&l&&Object.defineProperty(t,i,l),l},f=function(e,t,i,s){return new(i||(i=Promise))((function(a,n){function l(e){try{o(s.next(e))}catch(e){n(e)}}function d(e){try{o(s.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(l,d)}o((s=s.apply(e,t||[])).next())}))};const y="more-menu-copy-";var g;!function(e){let t=class extends(Object(a.c)(Object(a.d)(Object(a.e)(l.LitElement)))){constructor(){super(...arguments),this.justified=!1,this.overflowLabel="More Tabs",this.draggable=!1,this.direction="horizontal",this.moreItemsScrollLimit=Number.MAX_SAFE_INTEGER,this.delay=0,this.animation=100,this.ghostClass="",this.chosenClass="",this.forceFallback=!1,this.fallbackClass="",this.tabsId="",this.persistSelection=!1,this.compUniqueId="",this.type="Line",this.newMomentum=!1,this.isMoreTabMenuVisible=!1,this.isMoreTabMenuMeasured=!1,this.isMoreTabMenuOpen=!1,this.isMoreTabMenuSelected=!1,this.isMoreTabMenuScrollable=!1,this.moreTabMenuOffsetWidth=0,this.moreTabMenuMaxHeight=null,this.tabsViewportDataList=[],this.tabsFilteredAsVisibleList=[],this.tabsFilteredAsHiddenList=[],this.noTabsVisible=!1,this.defaultTabsOrderArray=[],this.tabsOrderPrefsArray=[],this.tabs=[],this.panels=[],this.tabsCopy=[],this.tabsHash={},this.tabsCopyHash={},this.tabsIdxHash={},this.tabsVisibleIdxHash={},this.tabsHiddenIdxHash={},this.visibleTabsSortableInstance=null,this.hiddenTabsSortableInstance=null,this.handleOnDragEnd=e=>f(this,void 0,void 0,(function*(){var t,i,s,a,n,l,d,o,r,b;e.stopPropagation();const h=e.oldIndex,c=e.newIndex,u=[...this.tabsFilteredAsVisibleList],p=[...this.tabsFilteredAsHiddenList],m=this.getDragDirection(e);if(void 0!==h&&void 0!==c){switch(m){case"visibleToHidden":{null===(i=null===(t=this.hiddenTabsContainerElement)||void 0===t?void 0:t.querySelector("#"+e.item.id))||void 0===i||i.remove();const s=u[h],a=p.slice(-1)[0],n=c===this.tabsFilteredAsHiddenList.length?c-1:c;p.splice(n,0,s),p.pop();const l=u.filter(t=>t.id!==this.getNormalizedTabId(e.item.id));l.push(a),this.tabsFilteredAsVisibleList=[...l],this.tabsFilteredAsHiddenList=[...p];break}case"visibleToVisible":{const e=u[h];u.splice(h,1),u.splice(c,0,e),this.tabsFilteredAsVisibleList=u,c===this.tabsFilteredAsVisibleList.length-1&&(null===(a=null===(s=this.visibleTabsContainerElement)||void 0===s?void 0:s.children[this.visibleTabsContainerElement.children.length-1])||void 0===a||a.remove());const t=this.visibleTabsContainerElement.children[h],i=this.visibleTabsContainerElement.children[c];if(!t||!i)return;null===(n=this.visibleTabsContainerElement)||void 0===n||n.replaceChild(i,t),null===(l=this.visibleTabsContainerElement)||void 0===l||l.insertBefore(t,i);break}case"hiddenToVisible":{null===(o=null===(d=this.visibleTabsContainerElement)||void 0===d?void 0:d.querySelector("#"+e.item.id))||void 0===o||o.remove();const t=p[h],i=u.slice(-1)[0];p.splice(h,1),p.splice(0,0,i);const s=c===this.tabsFilteredAsVisibleList.length?c-1:c;u.splice(s,0,t),u.pop(),this.tabsFilteredAsVisibleList=u,this.tabsFilteredAsHiddenList=p;break}case"hiddenToHidden":{const e=p[h];p.splice(h,1),p.splice(c,0,e),this.tabsFilteredAsHiddenList=p,c===this.tabsFilteredAsHiddenList.length-1&&(null===(b=null===(r=this.hiddenTabsContainerElement)||void 0===r?void 0:r.children[this.hiddenTabsContainerElement.children.length-1])||void 0===b||b.remove());break}}if(this.compUniqueId){const e=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],t=e.findIndex(e=>e.selected);this.storeSelectedTabIndex(t),this.tabsOrderPrefsArray=e.map(e=>e.name),localStorage.setItem(this.compUniqueId,this.tabsOrderPrefsArray.join(","))}}}))}generateOptions(){return{group:"shared",animation:10,swapThreshold:1,draggable:"md-tab",direction:this.direction,forceFallback:this.forceFallback,fallbackClass:this.fallbackClass,ghostClass:this.ghostClass,chosenClass:this.chosenClass,onEnd:this.handleOnDragEnd}}getCopyTabId(e){var t;return(null===(t=e.id)||void 0===t?void 0:t.startsWith(y))?`${y}${e.id}`:e.id}getAriaControlId(e){var t,i;if(null===(t=e.id)||void 0===t?void 0:t.startsWith(y))return`${y}${e.id}`;return"tab_panel_"+(null===(i=e.id)||void 0===i?void 0:i.substring(4))}getTabIndex(e){var t,i;return this.isMoreTabMenuVisible&&0===this.getCurrentIndex(null==e?void 0:e.id)&&this.selected>(null===(t=this.tabsFilteredAsVisibleList)||void 0===t?void 0:t.length)-1||(null===(i=this.tabsFilteredAsVisibleList[this.selected])||void 0===i?void 0:i.id)===e.id?0:-1}getNormalizedTabId(e){return e.replace(y,"")}static get styles(){return[n.a,m.a]}ensureTabsUpdateComplete(e){return f(this,void 0,void 0,(function*(){const t=e.map(e=>void 0!==e.updateComplete?e.updateComplete:null).filter(e=>null!==e);t.length&&(yield Promise.all(t))}))}measureTabsOffsetWidth(){return this.justified||"vertical"===this.direction?this.tabs.map(e=>{e.setAttribute("measuringrealwidth","");const t=e.closable?e.offsetWidth+v.TAB_CROSS_WIDTH:e.offsetWidth;return e.removeAttribute("measuringrealwidth"),t}):this.tabs.map(e=>e.closable?e.offsetWidth+v.TAB_CROSS_WIDTH:e.offsetWidth)}measureHiddenTabsCopiesOffsetHeight(){return this.tabsCopy.map(e=>e.offsetHeight)}manageOverflow(){var e,t;return f(this,void 0,void 0,(function*(){if("vertical"!==this.direction){let i;i=0===this.tabsFilteredAsVisibleList.length&&0===this.tabsFilteredAsHiddenList.length?[...this.tabs]:[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],i.forEach(e=>{var t,i,s,a,n;if((null===(t=e.children)||void 0===t?void 0:t.length)&&0===(null===(s=null===(i=e.children[0])||void 0===i?void 0:i.children)||void 0===s?void 0:s.length)){const t=null===(a=null==e?void 0:e.querySelector("slot"))||void 0===a?void 0:a.assignedNodes({flatten:!0})[0].cloneNode(!0);t&&(t.classList.add("tab-content"),null===(n=null==e?void 0:e.children[0])||void 0===n||n.appendChild(t))}});const s=i.length;if(this.tabsListElement&&s){const a=(null===(e=this.tabsSettingsElement)||void 0===e?void 0:e.offsetWidth)?this.tabsListElement.offsetWidth-(null===(t=this.tabsSettingsElement)||void 0===t?void 0:t.offsetWidth):this.tabsListElement.offsetWidth;yield this.ensureTabsUpdateComplete(this.tabs);const n=this.measureTabsOffsetWidth(),l=i.reduce((e,t,i)=>e+=n[i],0);if(l){yield this.setupMoreTab();let e=!0;a<l&&(e=!1);const t=[];let d=0;i.forEach((i,l)=>{d+=n[l];const o=!e&&d+(l<s-1?this.moreTabMenuOffsetWidth:0)>a;t.push({isTabInViewportHidden:o,tabOffsetWidth:n[l]})}),this.tabsViewportDataList=t,this.tabsViewportDataList.forEach((e,t)=>this.tabs[t].viewportHidden=e.isTabInViewportHidden),this.isMoreTabMenuVisible=!!this.tabsViewportDataList.find(e=>e.isTabInViewportHidden),this.tabsFilteredAsVisibleList=i.filter((e,t)=>!this.tabsViewportDataList[t].isTabInViewportHidden),this.tabsVisibleIdxHash=this.tabsFilteredAsVisibleList.reduce((e,t,i)=>(e[t.id]=i,e),{}),this.tabsFilteredAsHiddenList=i.filter((e,t)=>this.tabsViewportDataList[t].isTabInViewportHidden),this.tabsHiddenIdxHash=this.tabsFilteredAsHiddenList.reduce((e,t,i)=>(e[t.id]=i,e),{})}}this.updateIsMoreTabMenuSelected();const a=this.tabsFilteredAsHiddenList.find(e=>!e.disabled);this.updateHiddenIdPositiveTabIndex(a)}}))}updateIsMoreTabMenuSelected(){this.isMoreTabMenuSelected=!!this.tabsFilteredAsHiddenList.find(e=>e.selected)}updateHiddenIdPositiveTabIndex(e){this.tabHiddenIdPositiveTabIndex=e?e.id:void 0}sortTabsAndPanes(){if(!this.tabsOrderPrefsArray.length)return;const e=(e,t)=>{const i=e.getAttribute("name")||"",s=t.getAttribute("name")||"";return this.tabsOrderPrefsArray.indexOf(i)-this.tabsOrderPrefsArray.indexOf(s)};this.tabs.sort(e),this.panels.sort(e)}linkPanelsAndTabs(){return f(this,void 0,void 0,(function*(){this.sortTabsAndPanes();const{tabs:e,panels:t}=this;if(0===e.length||0===t.length)return void console.warn("The tabs or panels count should't be equal zero.");e.length!==t.length&&console.warn(`The amount of tabs (${e.length}) doesn't match the amount of panels (${t.length}).`),e.forEach((e,i)=>{const s=Object(h.nanoid)(10),a="tab_"+s,n="tab_panel_"+s;e.setAttribute("id",a),e.setAttribute("aria-controls",n),e.selected=this.selected===i,"vertical"===this.direction&&(e.vertical=!0);const l=t[i];l?(l.setAttribute("id",n),l.setAttribute("aria-labelledby",a),l.selected=this.selected===i,e.disabled&&(l.hidden=!0,l.selected=!1)):e.disabled=!0});let i=this.selected;for(;i<e.length&&e[i].disabled;)i++;i=i===e.length?0:i,e[i].selected=!0,t[i].selected=!0,this.tabsHash=this.tabs.reduce((e,t)=>(e[t.id]=t,e),{}),this.tabsIdxHash=this.tabs.reduce((e,t,i)=>(e[t.id]=i,e),{})}))}get slotItem(){return this.tabSlotElement}filterSlotted(){return this.tabSlotElement.assignedElements()}handleResize(e){const t=Object.create(null,{handleResize:{get:()=>super.handleResize}});return f(this,void 0,void 0,(function*(){t.handleResize&&t.handleResize.call(this,e),yield this.manageOverflow()}))}getDragDirection(e){return e.from===this.visibleTabsContainerElement&&e.to===this.hiddenTabsContainerElement?"visibleToHidden":e.from===this.visibleTabsContainerElement&&e.to===this.visibleTabsContainerElement?"visibleToVisible":e.from===this.hiddenTabsContainerElement&&e.to===this.visibleTabsContainerElement?"hiddenToVisible":e.from===this.hiddenTabsContainerElement&&e.to===this.hiddenTabsContainerElement?"hiddenToHidden":void 0}makeTabCopyFocus(e){e&&e.focus()}handleTabClick(e){const{id:t}=e.detail;this.handleNewSelectedTab(t)}handleNewSelectedTab(e){const t=this.tabsHash[this.getNormalizedTabId(e)];if(t&&!t.disabled){const e=this.tabsIdxHash[t.id];-1!==e&&this.updateSelectedTab(e);{const e=this.tabsCopyHash[this.getCopyTabId(t)];e&&this.makeTabCopyFocus(e),this.updateHiddenIdPositiveTabIndex(t)}}}handleTabCrossClick(e){const{id:t}=e.detail;this.handleTabCloseEvent(t)}handleTabCloseClick(e){const{id:t}=e.detail;this.handleTabCloseEvent(t)}handleTabCloseEvent(e){var t,i;const s=this.tabsHash[this.getNormalizedTabId(e)];if(s&&!s.disabled&&("auto"===s.closable||"custom"===s.closable)){const s=this.tabsFilteredAsVisibleList.findIndex(t=>this.getNormalizedTabId(t.id)===this.getNormalizedTabId(e));this.tabsFilteredAsVisibleList=this.tabsFilteredAsVisibleList.filter(t=>this.getNormalizedTabId(t.id)!==this.getNormalizedTabId(e)),null===(i=null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.querySelector("#"+e))||void 0===i||i.remove(),0!==this.tabsFilteredAsHiddenList.length&&(this.tabsFilteredAsVisibleList.push(this.tabsFilteredAsHiddenList[0]),this.tabsFilteredAsHiddenList.splice(0,1)),0===this.tabsFilteredAsHiddenList.length&&(this.isMoreTabMenuVisible=!1,this.isMoreTabMenuMeasured=!1),this.handleUpdatedSeletedTabAfterCross(s)}}handleUpdatedSeletedTabAfterCross(e){var t;let i=e;for(;i<this.tabsFilteredAsVisibleList.length&&(null===(t=this.tabsFilteredAsVisibleList[i])||void 0===t?void 0:t.disabled);)i++;if(void 0===this.tabsFilteredAsVisibleList[i]||e===this.tabsFilteredAsVisibleList.length)for(i=e-1;i>=0&&this.tabsFilteredAsVisibleList[i].disabled;)i--;if(-1!==i){const e=this.tabs.findIndex(e=>e.id===this.tabsFilteredAsVisibleList[i].id);this.updateSelectedTab(e)}else this.updateSelectedTab(i);this.noTabsVisible=0===this.tabsFilteredAsVisibleList.length&&0===this.tabsFilteredAsHiddenList.length,this.requestUpdate()}updateSelectedTab(e){const{tabs:t,panels:i}=this,s=this.tabs.findIndex(e=>e.hasAttribute("selected"));if(t&&i&&[s,e].forEach(e=>{const s=t[e];s&&s.toggleAttribute("selected");const a=i[e];if(a&&a.toggleAttribute("selected"),s){const e=this.tabsCopyHash[this.getCopyTabId(s)];e?(e.toggleAttribute("selected"),this.isMoreTabMenuSelected=!0):this.isMoreTabMenuSelected=!1}}),e>=0){this.dispatchSelectedChangedEvent(e);const i=("horizontal"===this.direction?[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList]:this.tabs).findIndex(i=>i.id===t[e].id);this.changeSelectedTabIdx(i)}}dispatchSelectedChangedEvent(e){const t=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList],i=this.tabs[e].id,s=t.findIndex(e=>e.id===i),a=[];t.forEach(e=>{a.push(e.name)}),this.dispatchEvent(new CustomEvent("selected-changed",{detail:{value:s,tabsOrder:a},composed:!0,bubbles:!0}))}changeSelectedTabIdx(e){this.requestUpdate(),this.selected=e,this.updateComplete.then(()=>{var t,i,s,a;if(e<this.tabsFilteredAsVisibleList.length)null===(i=null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children[this.selected])||void 0===i||i.focus();else{const e=this.selected-this.tabsFilteredAsVisibleList.length;null===(a=null===(s=this.hiddenTabsContainerElement)||void 0===s?void 0:s.children[e])||void 0===a||a.focus();const t=this.tabsFilteredAsHiddenList[e];!(null==t?void 0:t.disabled)&&this.updateHiddenIdPositiveTabIndex(t)}}),this.updateIsMoreTabMenuSelected(),this.storeSelectedTabIndex(e)}storeSelectedTabIndex(e){this.persistSelection&&this.tabsId&&e>-1&&""!==this.tabsId.trim()&&sessionStorage.setItem(this.tabsId,""+e)}getCurrentIndex(e){var t,i;const s=(null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children.length)||0;for(let t=0;t<s;t++)if((null===(i=this.visibleTabsContainerElement)||void 0===i?void 0:i.children[t].id)===e)return t;return this.tabsVisibleIdxHash[e]}moveFocusToAdjacentTab(e,t){var i;const s=this.getCurrentIndex(e),a=null===(i=this.visibleTabsContainerElement)||void 0===i?void 0:i.children,n=(null==a?void 0:a.length)||0;if(!a||0===n)return;let l=0;"previous"===t?l=0===s?n-1:s-1:"next"===t?l=s===n-1?0:s+1:"fromMoreTabs"===t&&(l=this.selected>=n?0:this.selected),this.moveFocusToTab(a[l])}moveFocusToTab(e){Object(p.setTimeout)(()=>null==e?void 0:e.focus(),0)}handleOverlayClose(){this.menuOverlayElement&&(this.menuOverlayElement.isOpen=!1)}dispatchKeydownEvent(e,t){t&&this.dispatchEvent(new CustomEvent("tab-keydown",{detail:{id:t,key:e.code,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,srcEvent:e},bubbles:!0,composed:!0}))}handleTabKeydown(e){var t,i,a,n,l,d;let o;if(e.target!=this&&!this.tabs.find(t=>t.id===e.target.id))return!1;o=e.path?e.path[0].id:e.composedPath()?e.composedPath()[0].id:e.originalTarget.id;const r=this.getNormalizedTabId(o);this.dispatchKeydownEvent(e,r);const b=e.code,{shiftKey:h}=e,c=!!this.isMoreTabMenuVisible&&"tab-more"===r,u=c&&this.isMoreTabMenuVisible?this.moreTabMenuElement:this.tabsHash[this.getNormalizedTabId(r)],p=!this.isMoreTabMenuVisible||u&&this.tabsVisibleIdxHash[u.id]>-1,m=!!this.isMoreTabMenuVisible&&(u&&this.tabsHiddenIdxHash[u.id]>-1),v=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length-1:this.tabs.length-1,T=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length:-1,f=this.isMoreTabMenuVisible?this.tabsFilteredAsVisibleList.length+this.tabsFilteredAsHiddenList.length-1:-1;switch(b){case s.b.Tab:c&&!this.isMoreTabMenuOpen&&h&&(e.preventDefault(),this.moveFocusToAdjacentTab(o,"fromMoreTabs"));break;case s.b.End:c||(p?(e.preventDefault(),this.moveFocusToTab(null===(t=this.visibleTabsContainerElement)||void 0===t?void 0:t.children[(null===(i=this.tabsFilteredAsVisibleList)||void 0===i?void 0:i.length)-1])):this.isMoreTabMenuOpen&&(e.preventDefault(),this.moveFocusToTab(null===(a=this.hiddenTabsContainerElement)||void 0===a?void 0:a.children[(null===(n=this.tabsFilteredAsHiddenList)||void 0===n?void 0:n.length)-1])));break;case s.b.Home:p?(e.preventDefault(),this.moveFocusToTab(null===(l=this.visibleTabsContainerElement)||void 0===l?void 0:l.children[0])):this.isMoreTabMenuOpen&&(e.preventDefault(),this.moveFocusToTab(null===(d=this.hiddenTabsContainerElement)||void 0===d?void 0:d.children[0]));break;case s.b.ArrowLeft:c||p&&(e.stopPropagation(),this.moveFocusToAdjacentTab(o,"previous"));break;case s.b.ArrowRight:c||p&&(e.stopPropagation(),this.moveFocusToAdjacentTab(o,"next"));break;case s.b.ArrowUp:if(c);else if(p&&"vertical"===this.direction)e.preventDefault(),this.changeSelectedTabIdx(0===this.selected?v:this.selected-1);else if(m){e.preventDefault();const t=this.selected===T?f:this.selected-1;this.changeSelectedTabIdx(t)}break;case s.b.ArrowDown:if(c);else if(p&&"vertical"===this.direction)e.preventDefault(),this.changeSelectedTabIdx(this.selected===v?0:this.selected+1);else if(m){e.preventDefault();const t=this.selected===f?T:this.selected+1;this.changeSelectedTabIdx(t)}break;case s.b.Enter:case s.b.NumpadEnter:case s.b.Space:if(c){const e=this.tabsFilteredAsHiddenList.filter(e=>!e.disabled),t=e.length?e.find(e=>e.selected)||e[0]:void 0;if(this.updateHiddenIdPositiveTabIndex(t),t){const e=this.tabsIdxHash[this.getNormalizedTabId(t.id)];-1!==e&&this.updateSelectedTab(e)}}else if(u&&!u.disabled){const t=this.tabsIdxHash[this.getNormalizedTabId(u.id)];-1!==t&&(e.preventDefault(),this.updateSelectedTab(t))}}}setupTabsEvents(){this.addEventListener("tab-click",this.handleTabClick),this.addEventListener("tab-cross-click",this.handleTabCrossClick),this.addEventListener("tab-close-click",this.handleTabCloseClick),this.addEventListener("keydown",this.handleTabKeydown),this.addEventListener("clear-tab-order-prefs",this.clearTabOrderPrefs)}teardownTabsEvents(){this.removeEventListener("tab-click",this.handleTabClick),this.removeEventListener("tab-cross-click",this.handleTabCrossClick),this.removeEventListener("tab-close-click",this.handleTabCloseClick),this.removeEventListener("keydown",this.handleTabKeydown),this.removeEventListener("clear-tab-order-prefs",this.clearTabOrderPrefs)}clearTabOrderPrefs(e){const{compUniqueId:t}=e.detail;t===this.compUniqueId&&(localStorage.removeItem(this.tabsId),sessionStorage.removeItem(this.tabsId),localStorage.removeItem(this.compUniqueId),this.tabsOrderPrefsArray=this.defaultTabsOrderArray,this.selected=0,this.initializeTabs(),this.dispatchSelectedChangedEvent(0))}setupPanelsAndTabs(){this.tabSlotElement&&(this.tabs=this.tabSlotElement.assignedElements()),this.panelSlotElement&&(this.panels=this.panelSlotElement.assignedElements()),this.defaultTabsOrderArray=this.tabs.map(e=>e.name)}setupMoreTab(){return f(this,void 0,void 0,(function*(){"vertical"!==this.direction&&this.moreTabMenuElement&&!this.isMoreTabMenuMeasured&&(this.moreTabMenuElement.classList.add("md-menu-overlay__more_tab--measuring"),yield this.moreTabMenuElement.updateComplete,this.moreTabMenuElement.offsetWidth&&(this.moreTabMenuOffsetWidth=this.moreTabMenuElement.offsetWidth,this.isMoreTabMenuMeasured=!0),this.moreTabMenuElement.classList.remove("md-menu-overlay__more_tab--measuring"))}))}initializeSortable(){this.visibleTabsContainerElement&&this.hiddenTabsContainerElement&&(this.visibleTabsSortableInstance=u.a.create(this.visibleTabsContainerElement,this.generateOptions()),this.hiddenTabsSortableInstance=u.a.create(this.hiddenTabsContainerElement,this.generateOptions()))}initializeTabs(){this.tabs=[],this.panels=[],this.tabsFilteredAsVisibleList=[],this.tabsFilteredAsHiddenList=[],this.isMoreTabMenuVisible=!1,this.setupPanelsAndTabs(),this.linkPanelsAndTabs(),this.draggable&&this.initializeSortable(),this.manageOverflow(),this.requestUpdate()}connectedCallback(){var e;if(super.connectedCallback(),this.setupTabsEvents(),this.persistSelection){if(!this.tabsId||""===this.tabsId.trim())return void console.error("Unique tabs-id attribute is mandatory for persist the selection of tab ");const e=localStorage.getItem(this.tabsId);this.selected=e&&parseInt(e)>-1?parseInt(e):this.selected}this.compUniqueId&&(this.tabsOrderPrefsArray=(null===(e=localStorage.getItem(this.compUniqueId))||void 0===e?void 0:e.split(","))||[])}selectTabFromStorage(){if(this.persistSelection){if(!this.tabsId||""===this.tabsId.trim())return void console.error("Unique tabs-id attribute is mandatory for persist the selection of tab ");const e=sessionStorage.getItem(this.tabsId);let t=0;if(e){const i=parseInt(e);t=i>-1?i:this.selected}const i=[...this.tabsFilteredAsVisibleList,...this.tabsFilteredAsHiddenList];i.length&&i[t].id?this.handleNewSelectedTab(i[t].id):this.selected=t}}disconnectedCallback(){super.disconnectedCallback(),this.teardownTabsEvents()}firstUpdated(e){super.firstUpdated(e),this.setupPanelsAndTabs(),this.linkPanelsAndTabs(),this.selectTabFromStorage()}updated(e){var t;if(super.updated(e),e.has("slotted")&&this.initializeTabs(),!this.draggable||this.visibleTabsSortableInstance||this.hiddenTabsSortableInstance||this.initializeSortable(),e.has("tabsFilteredAsHiddenList")&&(this.tabsCopy=Array.from((null===(t=this.tabsCopyHiddenListElements)||void 0===t?void 0:t.values())||[]),this.tabsCopyHash=this.tabsCopy.reduce((e,t)=>(e[t.id]=t,e),{})),(e.has("tabsFilteredAsVisibleList")||e.has("tabsFilteredAsHiddenList"))&&(this.tabsVisibleIdxHash=this.tabsFilteredAsVisibleList.reduce((e,t,i)=>(e[t.id]=i,e),{}),this.tabsHiddenIdxHash=this.tabsFilteredAsHiddenList.reduce((e,t,i)=>(e[t.id]=i,e),{})),e.has("isMoreTabMenuOpen")&&this.isMoreTabMenuVisible){const t=e.get("isMoreTabMenuOpen");this.isMoreTabMenuOpen&&!t&&(this.moreItemsScrollLimit<this.tabsCopy.length?(this.isMoreTabMenuScrollable=!0,this.moreTabMenuMaxHeight=this.measureHiddenTabsCopiesOffsetHeight().slice(0,this.moreItemsScrollLimit).reduce((e,t)=>e+=t,0)+"px"):(this.isMoreTabMenuScrollable=!1,this.moreTabMenuMaxHeight=null))}e.has("tabsId")&&this.selectTabFromStorage()}render(){return l.html`
|
|
2
2
|
<div
|
|
3
3
|
part="tabs-list"
|
|
4
4
|
class="md-tab__list ${Object(d.classMap)({"md-tab__justified":this.justified&&!this.isMoreTabMenuVisible,"no-tabs-visible":this.noTabsVisible,"vertical-tab-list":"vertical"===this.direction,"tab-new-momentum":this.newMomentum})}"
|
package/dist/chunks/md-83.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[83],{125:function(t,e,i){"use strict";i.r(e),i.d(e,"TaskItem",(function(){return o}));i(53),i(
|
|
1
|
+
(window["momentum-web-components-[id]"]=window["momentum-web-components-[id]"]||[]).push([[83],{125:function(t,e,i){"use strict";i.r(e),i.d(e,"TaskItem",(function(){return o}));i(53),i(15);var o,a=i(6),n=i(5),s=i(0),m=i(3),r=i(4),c=s.css`:host{width:100%}.md-taskitem{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:stretch;border-radius:.5rem;color:var(--md-secondary-text-color);cursor:pointer;margin-bottom:4px;min-height:5rem;padding:.75rem;position:relative;width:auto;z-index:0}.md-taskitem.selected{background-color:var(--taskitem-pressed-bg-color,#fff);box-shadow:0 .125rem .25rem rgba(0,0,0,.16)}.md-taskitem.selected .md-taskitem__content_chat,.md-taskitem.selected .md-taskitem__content_popover_title,.md-taskitem.selected .md-taskitem__content_queue{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem.selected .md-taskitem__content_title.mainTitle{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem:hover{background-color:var(--taskitem-hover-bg-color,#fff)}.md-taskitem:hover .md-taskitem__content_chat,.md-taskitem:hover .md-taskitem__content_popover_title,.md-taskitem:hover .md-taskitem__content_queue{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem:hover .md-taskitem__content_title.mainTitle{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem:active{background-color:var(--taskitem-pressed-bg-color,#fff)}.md-taskitem:active .md-taskitem__content_chat,.md-taskitem:active .md-taskitem__content_popover_title,.md-taskitem:active .md-taskitem__content_queue{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem:active .md-taskitem__content_title.mainTitle{color:var(--taskitem-selected-text-color,#121212)}.md-taskitem:focus{background:var(--taskitem-focus-bg-color,#fff);box-shadow:none;outline:0}.md-taskitem:focus::after{box-shadow:0 0 0 .125rem var(--taskitem-focus-border-color,#007aa3)}.md-taskitem::after{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0;z-index:-1;border-radius:.5rem;margin:-.125rem}.md-taskitem__mediatype{margin-right:.5rem;position:relative;width:2.625rem}.md-taskitem__mediatype img{max-width:fit-content}.md-taskitem__mediatype .md-taskitem__status{align-items:center;display:inline-flex;justify-content:space-around;position:absolute;background:var(--taskitem-status-bg-color,#dedede);border-radius:50%;bottom:-4px;color:var(--taskitem-status-text-color,#121212);height:1.25rem;right:-4px;width:1.25rem}.md-taskitem__mediatype .md-taskitem__status md-icon{height:.75rem}.md-taskitem__mediatype .md-taskitem__status md-icon::part(icon){vertical-align:top}.md-taskitem__mediatype .md-taskitem__status.hold{background:var(--taskitem-status-pause-bg-color,#ffd98c)}.md-taskitem__content{align-content:stretch;align-items:flex-start;align-self:stretch;display:flex;flex:0 1 auto;flex-direction:column;justify-content:center;width:calc(100% - (2.625rem + 6.25rem))}.md-taskitem__content_popover_title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--taskitem-text-color,#545454);font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif);font-size:14px;line-height:.9375rem;margin-bottom:.5rem;width:100%}.md-taskitem__content_title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:16px;line-height:1.1875rem;margin-bottom:.5rem;width:100%}.md-taskitem__content_title.mainTitle{color:var(--taskitem-text-color,#545454);font-family:var(--brand-font-bold, "CiscoSansTT Bold", "Helvetica Neue", Helvetica, Arial, sans-serif)}.md-taskitem__content_inner{display:flex;flex:0 1 auto;width:100%}.md-taskitem__content_queue{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;line-height:.875rem;width:100%}.md-taskitem__content_chat{color:var(--taskitem-chat-text-color,#545454);display:flex;font-size:12px;line-height:.875rem;margin-top:.5rem;position:relative;width:100%}.md-taskitem__content_chat .new-chat_massages{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-right:2.5rem;width:calc(100% - .5rem)}.md-taskitem__addition{align-items:flex-end;display:flex;flex-direction:column;margin-left:.5rem;text-align:right;width:6.25rem}.md-taskitem__addition .new-chat-quantity{background:var(--taskitem-chat-quantity-bg-color,#9df);border-radius:9px;color:var(--taskitem-chat-quantity-text-color,#103c62);display:inline-block;font-size:10px;line-height:.875rem;min-width:18px;padding:.125rem .25rem;text-align:center}@media(forced-colors:active){.md-taskitem:focus{outline:1px solid Highlight}.md-taskitem.selected,.md-taskitem:hover{forced-color-adjust:none;outline:1px solid Highlight;background-color:Highlight;color:HighlightText;box-shadow:none}.md-taskitem:active{forced-color-adjust:none;outline:1px solid HighlightText;background-color:Highlight;color:HighlightText;box-shadow:none}.md-taskitem__addition .new-chat-quantity{forced-color-adjust:auto}}`,d=function(t,e,i,o){var a,n=arguments.length,s=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,o);else for(var m=t.length-1;m>=0;m--)(a=t[m])&&(s=(n<3?a(s):n>3?a(e,i,s):a(e,i))||s);return n>3&&s&&Object.defineProperty(e,i,s),s};!function(t){let e=class extends s.LitElement{constructor(){super(...arguments),this.mediaType="call",this.status="",this.popovertitle="",this.title="",this.queue="",this.accepted=!1,this.quantity=0,this.lastmessage="",this.selected=!1,this.customAriaLabel="",this.iconSrc="",this.tabIndexForContainer="0",this.renderTaskType=()=>{switch(this.mediaType.toLowerCase()){case"telephony":return s.html`
|
|
2
2
|
<md-badge color="green" circle>
|
|
3
3
|
<md-icon name="handset-filled" size="20" iconSet="momentumDesign"></md-icon>
|
|
4
4
|
</md-badge>
|