@ni/spright-components 4.1.9 → 4.1.10
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.
|
@@ -3652,7 +3652,7 @@ const ev=Symbol("user dismissed"),nv=Mt`
|
|
|
3652
3652
|
</template>
|
|
3653
3653
|
`
|
|
3654
3654
|
class sv extends We{constructor(){super(...arguments),this.preventDismiss=!1,this.headerHidden=!1,this.footerHidden=!1,this.footerIsEmpty=!0}get open(){return void 0!==this.resolveShow}async show(){if(this.open)throw new Error("Dialog is already open")
|
|
3655
|
-
return this.dialogElement.showModal(),new Promise(((t,e)=>{this.resolveShow=t}))}close(t){if(!this.open)throw new Error("Dialog is not open")
|
|
3655
|
+
return this.dialogElement.showModal(),await new Promise(((t,e)=>{this.resolveShow=t}))}close(t){if(!this.open)throw new Error("Dialog is not open")
|
|
3656
3656
|
this.dialogElement.close(),this.doResolveShow(t)}slottedFooterElementsChanged(t,e){this.footerIsEmpty=!e?.length}cancelHandler(t){return this.preventDismiss?t.preventDefault():this.doResolveShow(ev),!0}closeHandler(t){t.target===this.dialogElement&&this.resolveShow&&this.doResolveShow(ev)}doResolveShow(t){if(!this.resolveShow)throw new Error("Do not call doResolveShow unless there is a promise to resolve")
|
|
3657
3657
|
this.resolveShow(t),this.resolveShow=void 0}}sv.UserDismissed=ev,t([ft({attribute:"prevent-dismiss",mode:"boolean"})],sv.prototype,"preventDismiss",void 0),t([ft({attribute:"header-hidden",mode:"boolean"})],sv.prototype,"headerHidden",void 0),t([ft({attribute:"footer-hidden",mode:"boolean"})],sv.prototype,"footerHidden",void 0),t([C],sv.prototype,"footerIsEmpty",void 0),t([C],sv.prototype,"slottedFooterElements",void 0),Ke(sv,wn)
|
|
3658
3658
|
const ov=sv.compose({baseName:"dialog",template:iv,styles:nv,baseClass:sv})
|
|
@@ -3803,7 +3803,7 @@ const rv=Mt`
|
|
|
3803
3803
|
</dialog>
|
|
3804
3804
|
`,lv="right"
|
|
3805
3805
|
class cv extends We{constructor(){super(...arguments),this.location=lv,this.preventDismiss=!1,this.closing=!1,this.animationEndHandlerFunction=()=>this.animationEndHandler()}get open(){return void 0!==this.resolveShow}async show(){if(this.open)throw new Error("Drawer is already open")
|
|
3806
|
-
return this.openDialog(),new Promise(((t,e)=>{this.resolveShow=t}))}close(t){if(!this.open||this.closing)throw new Error("Drawer is not open or already closing")
|
|
3806
|
+
return this.openDialog(),await new Promise(((t,e)=>{this.resolveShow=t}))}close(t){if(!this.open||this.closing)throw new Error("Drawer is not open or already closing")
|
|
3807
3807
|
this.closeReason=t,this.closeDialog()}cancelHandler(t){return t.preventDefault(),this.preventDismiss||(this.closeReason=ev,this.closeDialog()),!0}closeHandler(t){t.target===this.dialog&&this.resolveShow&&this.doResolveShow(ev)}doResolveShow(t){if(!this.resolveShow)throw new Error("Do not call doResolveShow unless there is a promise to resolve")
|
|
3808
3808
|
this.resolveShow(t),this.resolveShow=void 0}openDialog(){this.dialog.showModal(),this.triggerAnimation()}closeDialog(){this.closing=!0,this.triggerAnimation()}triggerAnimation(){this.dialog.offsetHeight,this.dialog.classList.add("animating"),this.closing&&this.dialog.classList.add("closing"),this.dialog.addEventListener(za,this.animationEndHandlerFunction)}animationEndHandler(){this.dialog.removeEventListener(za,this.animationEndHandlerFunction),this.dialog.classList.remove("animating"),this.closing&&(this.dialog.classList.remove("closing"),this.dialog.close(),this.closing=!1,this.doResolveShow(this.closeReason))}}cv.UserDismissed=ev,t([ft],cv.prototype,"location",void 0),t([ft({attribute:"prevent-dismiss",mode:"boolean"})],cv.prototype,"preventDismiss",void 0),Ke(cv,wn)
|
|
3809
3809
|
const dv=cv.compose({baseName:"drawer",template:av,styles:rv})
|
|
@@ -8684,7 +8684,7 @@ break
|
|
|
8684
8684
|
case"pattern":this.track("pattern")
|
|
8685
8685
|
break
|
|
8686
8686
|
case"buttonLabel":this.track("buttonLabel")}this.queueUpdate()}trackMentionElementsInstancesChanged(){this.track("pattern"),this.track("mappingConfigs"),this.track("buttonLabel"),this.queueUpdate()}queueUpdate(){this.richText.$fastController.isConnected&&(this.updateQueued||(this.updateQueued=!0,b.queueUpdate((()=>{this.richText.createConfig(),this.untrackAll(),this.updateQueued=!1}))))}}class sE{constructor(){this.invalidMentionConfiguration=!1,this.duplicateMentionConfiguration=!1}getValidity(){return{invalidMentionConfiguration:this.invalidMentionConfiguration,duplicateMentionConfiguration:this.duplicateMentionConfiguration}}isValid(){return Object.values(this.getValidity()).every((t=>!1===t))}validate(t){this.validateDuplicateMentionConfigurations(t),this.validateMentionConfigurations(t)}validateMentionConfigurations(t){return this.invalidMentionConfiguration=t.some((t=>!t.mentionInternals.validator.isValid())),!this.invalidMentionConfiguration}validateDuplicateMentionConfigurations(t){const e=t.map((t=>t.mentionInternals.character))
|
|
8687
|
-
return this.duplicateMentionConfiguration=e.length!==new Set(e).size,!this.duplicateMentionConfiguration}}async function oE(t){const e=t.map((async t=>t.matches(":not(:defined)")
|
|
8687
|
+
return this.duplicateMentionConfiguration=e.length!==new Set(e).size,!this.duplicateMentionConfiguration}}async function oE(t){const e=t.map((async t=>{t.matches(":not(:defined)")&&await customElements.whenDefined(t.localName)}))
|
|
8688
8688
|
await Promise.all(e)}class rE extends We{constructor(){super(...arguments),this.mentionInternalsNotifiers=[],this.childItems=[],this.richTextUpdateTracker=new iE(this),this.richTextValidator=new sE}get validity(){return this.richTextValidator.getValidity()}checkValidity(){return this.richTextValidator.isValid()}handleChange(t,e){t instanceof YD&&"string"==typeof e&&this.richTextUpdateTracker.trackMentionInternalsPropertyChanged(e)}createConfig(){this.validate(),this.richTextValidator.isValid()?(this.richTextUpdateTracker.updateMappingConfigs||this.richTextUpdateTracker.updatePattern)&&(this.configuration=new QD(this.mentionElements)):this.configuration=void 0}validate(){this.richTextValidator.validate(this.mentionElements)}childItemsChanged(t,e){void 0!==t&&this.updateMentionElementsFromChildItems()}async updateMentionElementsFromChildItems(){await oE(this.childItems),this.mentionElements=this.childItems.filter((t=>t instanceof XD)),this.observeMentionInternals(),this.richTextUpdateTracker.trackMentionElementsInstancesChanged()}observeMentionInternals(){this.removeMentionInternalsObservers()
|
|
8689
8689
|
for(const t of this.mentionElements){const e=x.getNotifier(t.mentionInternals)
|
|
8690
8690
|
e.subscribe(this),this.mentionInternalsNotifiers.push(e)}}removeMentionInternalsObservers(){this.mentionInternalsNotifiers.forEach((t=>{t.unsubscribe(this)})),this.mentionInternalsNotifiers=[]}}t([C],rE.prototype,"childItems",void 0),t([C],rE.prototype,"configuration",void 0)
|