@openremote/or-json-forms 1.22.0-snapshot.20260413090029 → 1.22.0
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/umd/index.js
CHANGED
|
@@ -523,7 +523,7 @@
|
|
|
523
523
|
flex-direction: column;
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
`}disconnectedCallback(){this.destroyEditor(),super.disconnectedCallback()}updated(e){super.updated(e),e.has("mode")&&(this.destroyEditor(),this.initEditor()),e.has("value")&&this._aceEditor&&(this._lastValue=void 0!==this.value?"string"==typeof this.value?this.value:JSON.stringify(this.value,null,2):"",this._aceEditor.setValue(this._lastValue))}render(){return G`
|
|
526
|
+
`}disconnectedCallback(){this.destroyEditor(),super.disconnectedCallback()}updated(e){super.updated(e),e.has("mode")&&(this.destroyEditor(),this.initEditor()),e.has("value")&&this._aceEditor&&(this._lastValue=void 0!==this.value?"string"==typeof this.value?this.value:JSON.stringify(this.value,null,2):"",this._aceEditor.setValue(this._lastValue)),e.has("readonly")&&this._aceEditor&&this._aceEditor.setReadOnly(!!this.readonly)}render(){return G`
|
|
527
527
|
<div id="ace-editor"></div>
|
|
528
528
|
`}destroyEditor(){this._aceEditor&&(this._aceEditor.destroy(),this._aceEditor=void 0)}initEditor(){this._aceElem&&(this._aceEditor=lL().edit(this._aceElem,{mode:this.mode,value:this._lastValue,useSoftTabs:!0,tabSize:2,readOnly:this.readonly,showPrintMargin:!1}),this._aceEditor.renderer.attachToShadowRoot(),this._aceEditor.getSession().on("changeAnnotation",()=>this._onEditorChange()),this._aceEditor.on("change",()=>this._onEditorEdit()))}_onEditorEdit(){this._editing||(this.dispatchEvent(new lM),this._editing=!0),this._changeTimer&&window.clearTimeout(this._changeTimer),this._changeTimer=window.setTimeout(()=>{this._changeTimer=void 0,this._editing&&this._onEditorChange()},600)}_onEditorChange(){this._editing=!1;let e=this.getValue()||"";if(this._lastValue!==e){this._lastValue=e;let t=this.validate();this.dispatchEvent(new lO(e,t))}}getValue(){if(this._aceEditor)return this._aceEditor.getValue()}validate(){if(!this._aceEditor)return!1;let e=this._aceEditor.getSession().getAnnotations();return!e||0===e.length}};lR([em({type:Boolean,attribute:!1})],lN.prototype,"readonly",void 0),lR([em({attribute:!1})],lN.prototype,"value",void 0),lR([em({type:String,attribute:!1})],lN.prototype,"mode",void 0),lR([eb("#ace-editor")],lN.prototype,"_aceElem",void 0),lN=lR([eh("or-ace-editor")],lN);var lD="mdc-dom-focus-sentinel",lP=function(){function e(e,t){void 0===t&&(t={}),this.root=e,this.options=t,this.elFocusedBeforeTrapFocus=null}return e.prototype.trapFocus=function(){var e=this.getFocusableElements(this.root);if(0===e.length)throw Error("FocusTrap: Element must have at least one focusable child.");this.elFocusedBeforeTrapFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.wrapTabFocus(this.root,e),this.options.skipInitialFocus||this.focusInitialElement(e,this.options.initialFocusEl)},e.prototype.releaseFocus=function(){[].slice.call(this.root.querySelectorAll("."+lD)).forEach(function(e){e.parentElement.removeChild(e)}),this.elFocusedBeforeTrapFocus&&this.elFocusedBeforeTrapFocus.focus()},e.prototype.wrapTabFocus=function(e,t){var n=this.createSentinel(),i=this.createSentinel();n.addEventListener("focus",function(){t.length>0&&t[t.length-1].focus()}),i.addEventListener("focus",function(){t.length>0&&t[0].focus()}),e.insertBefore(n,e.children[0]),e.appendChild(i)},e.prototype.focusInitialElement=function(e,t){var n=0;t&&(n=Math.max(e.indexOf(t),0)),e[n].focus()},e.prototype.getFocusableElements=function(e){return[].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button")).filter(function(e){var t="true"===e.getAttribute("aria-disabled")||null!=e.getAttribute("disabled")||null!=e.getAttribute("hidden")||"true"===e.getAttribute("aria-hidden"),n=e.tabIndex>=0&&e.getBoundingClientRect().width>0&&!e.classList.contains(lD)&&!t,i=!1;if(n){var r=getComputedStyle(e);i="none"===r.display||"hidden"===r.visibility}return n&&!i})},e.prototype.createSentinel=function(){var e=document.createElement("div");return e.setAttribute("tabindex","0"),e.setAttribute("aria-hidden","true"),e.classList.add(lD),e},e}(),lz={CLOSING:"mdc-dialog--closing",OPEN:"mdc-dialog--open",OPENING:"mdc-dialog--opening",SCROLLABLE:"mdc-dialog--scrollable",SCROLL_LOCK:"mdc-dialog-scroll-lock",STACKED:"mdc-dialog--stacked"},lF={ACTION_ATTRIBUTE:"data-mdc-dialog-action",BUTTON_DEFAULT_ATTRIBUTE:"data-mdc-dialog-button-default",BUTTON_SELECTOR:".mdc-dialog__button",CLOSED_EVENT:"MDCDialog:closed",CLOSE_ACTION:"close",CLOSING_EVENT:"MDCDialog:closing",CONTAINER_SELECTOR:".mdc-dialog__container",CONTENT_SELECTOR:".mdc-dialog__content",DESTROY_ACTION:"destroy",INITIAL_FOCUS_ATTRIBUTE:"data-mdc-dialog-initial-focus",OPENED_EVENT:"MDCDialog:opened",OPENING_EVENT:"MDCDialog:opening",SCRIM_SELECTOR:".mdc-dialog__scrim",SUPPRESS_DEFAULT_PRESS_SELECTOR:"textarea, .mdc-menu .mdc-list-item",SURFACE_SELECTOR:".mdc-dialog__surface"},lj={DIALOG_ANIMATION_CLOSE_TIME_MS:75,DIALOG_ANIMATION_OPEN_TIME_MS:150},lH=function(e){function t(n){var i=e.call(this,oQ(oQ({},t.defaultAdapter),n))||this;return i.isOpen_=!1,i.animationFrame_=0,i.animationTimer_=0,i.layoutFrame_=0,i.escapeKeyAction_=lF.CLOSE_ACTION,i.scrimClickAction_=lF.CLOSE_ACTION,i.autoStackButtons_=!0,i.areButtonsStacked_=!1,i.suppressDefaultPressSelector=lF.SUPPRESS_DEFAULT_PRESS_SELECTOR,i}return oq(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return lz},enumerable:!0,configurable:!0}),Object.defineProperty(t,"strings",{get:function(){return lF},enumerable:!0,configurable:!0}),Object.defineProperty(t,"numbers",{get:function(){return lj},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addBodyClass:function(){},addClass:function(){},areButtonsStacked:function(){return!1},clickDefaultButton:function(){},eventTargetMatches:function(){return!1},getActionFromEvent:function(){return""},getInitialFocusEl:function(){return null},hasClass:function(){return!1},isContentScrollable:function(){return!1},notifyClosed:function(){},notifyClosing:function(){},notifyOpened:function(){},notifyOpening:function(){},releaseFocus:function(){},removeBodyClass:function(){},removeClass:function(){},reverseButtons:function(){},trapFocus:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){this.adapter.hasClass(lz.STACKED)&&this.setAutoStackButtons(!1)},t.prototype.destroy=function(){this.isOpen_&&this.close(lF.DESTROY_ACTION),this.animationTimer_&&(clearTimeout(this.animationTimer_),this.handleAnimationTimerEnd_()),this.layoutFrame_&&(cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=0)},t.prototype.open=function(){var e=this;this.isOpen_=!0,this.adapter.notifyOpening(),this.adapter.addClass(lz.OPENING),this.runNextAnimationFrame_(function(){e.adapter.addClass(lz.OPEN),e.adapter.addBodyClass(lz.SCROLL_LOCK),e.layout(),e.animationTimer_=setTimeout(function(){e.handleAnimationTimerEnd_(),e.adapter.trapFocus(e.adapter.getInitialFocusEl()),e.adapter.notifyOpened()},lj.DIALOG_ANIMATION_OPEN_TIME_MS)})},t.prototype.close=function(e){var t=this;void 0===e&&(e=""),this.isOpen_&&(this.isOpen_=!1,this.adapter.notifyClosing(e),this.adapter.addClass(lz.CLOSING),this.adapter.removeClass(lz.OPEN),this.adapter.removeBodyClass(lz.SCROLL_LOCK),cancelAnimationFrame(this.animationFrame_),this.animationFrame_=0,clearTimeout(this.animationTimer_),this.animationTimer_=setTimeout(function(){t.adapter.releaseFocus(),t.handleAnimationTimerEnd_(),t.adapter.notifyClosed(e)},lj.DIALOG_ANIMATION_CLOSE_TIME_MS))},t.prototype.isOpen=function(){return this.isOpen_},t.prototype.getEscapeKeyAction=function(){return this.escapeKeyAction_},t.prototype.setEscapeKeyAction=function(e){this.escapeKeyAction_=e},t.prototype.getScrimClickAction=function(){return this.scrimClickAction_},t.prototype.setScrimClickAction=function(e){this.scrimClickAction_=e},t.prototype.getAutoStackButtons=function(){return this.autoStackButtons_},t.prototype.setAutoStackButtons=function(e){this.autoStackButtons_=e},t.prototype.getSuppressDefaultPressSelector=function(){return this.suppressDefaultPressSelector},t.prototype.setSuppressDefaultPressSelector=function(e){this.suppressDefaultPressSelector=e},t.prototype.layout=function(){var e=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){e.layoutInternal_(),e.layoutFrame_=0})},t.prototype.handleClick=function(e){if(this.adapter.eventTargetMatches(e.target,lF.SCRIM_SELECTOR)&&""!==this.scrimClickAction_)this.close(this.scrimClickAction_);else{var t=this.adapter.getActionFromEvent(e);t&&this.close(t)}},t.prototype.handleKeydown=function(e){var t="Enter"===e.key||13===e.keyCode;if(t&&!this.adapter.getActionFromEvent(e)){var n=e.composedPath?e.composedPath()[0]:e.target,i=!this.adapter.eventTargetMatches(n,this.suppressDefaultPressSelector);t&&i&&this.adapter.clickDefaultButton()}},t.prototype.handleDocumentKeydown=function(e){("Escape"===e.key||27===e.keyCode)&&""!==this.escapeKeyAction_&&this.close(this.escapeKeyAction_)},t.prototype.layoutInternal_=function(){this.autoStackButtons_&&this.detectStackedButtons_(),this.detectScrollableContent_()},t.prototype.handleAnimationTimerEnd_=function(){this.animationTimer_=0,this.adapter.removeClass(lz.OPENING),this.adapter.removeClass(lz.CLOSING)},t.prototype.runNextAnimationFrame_=function(e){var t=this;cancelAnimationFrame(this.animationFrame_),this.animationFrame_=requestAnimationFrame(function(){t.animationFrame_=0,clearTimeout(t.animationTimer_),t.animationTimer_=setTimeout(e,0)})},t.prototype.detectStackedButtons_=function(){this.adapter.removeClass(lz.STACKED);var e=this.adapter.areButtonsStacked();e&&this.adapter.addClass(lz.STACKED),e!==this.areButtonsStacked_&&(this.adapter.reverseButtons(),this.areButtonsStacked_=e)},t.prototype.detectScrollableContent_=function(){this.adapter.removeClass(lz.SCROLLABLE),this.adapter.isContentScrollable()&&this.adapter.addClass(lz.SCROLLABLE)},t}(o0),lB=lH.strings,lW=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return oq(t,e),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this.foundation.isOpen()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"escapeKeyAction",{get:function(){return this.foundation.getEscapeKeyAction()},set:function(e){this.foundation.setEscapeKeyAction(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scrimClickAction",{get:function(){return this.foundation.getScrimClickAction()},set:function(e){this.foundation.setScrimClickAction(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoStackButtons",{get:function(){return this.foundation.getAutoStackButtons()},set:function(e){this.foundation.setAutoStackButtons(e)},enumerable:!0,configurable:!0}),t.attachTo=function(e){return new t(e)},t.prototype.initialize=function(e){void 0===e&&(e=function(e,t){return new lP(e,t)});var t,n,i=this.root.querySelector(lB.CONTAINER_SELECTOR);if(!i)throw Error("Dialog component requires a "+lB.CONTAINER_SELECTOR+" container element");this.container_=i,this.content_=this.root.querySelector(lB.CONTENT_SELECTOR),this.buttons_=[].slice.call(this.root.querySelectorAll(lB.BUTTON_SELECTOR)),this.defaultButton_=this.root.querySelector("["+lB.BUTTON_DEFAULT_ATTRIBUTE+"]"),this.focusTrapFactory_=e,this.buttonRipples_=[];try{for(var r=oJ(this.buttons_),o=r.next();!o.done;o=r.next()){var a=o.value;this.buttonRipples_.push(new ap(a))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},t.prototype.initialSyncWithDOM=function(){var e,t=this;this.focusTrap_=(e=this.container_,(0,this.focusTrapFactory_)(e,{initialFocusEl:this.getInitialFocusEl_()||void 0})),this.handleClick_=this.foundation.handleClick.bind(this.foundation),this.handleKeydown_=this.foundation.handleKeydown.bind(this.foundation),this.handleDocumentKeydown_=this.foundation.handleDocumentKeydown.bind(this.foundation),this.handleLayout_=this.layout.bind(this);var n=["resize","orientationchange"];this.handleOpening_=function(){n.forEach(function(e){return window.addEventListener(e,t.handleLayout_)}),document.addEventListener("keydown",t.handleDocumentKeydown_)},this.handleClosing_=function(){n.forEach(function(e){return window.removeEventListener(e,t.handleLayout_)}),document.removeEventListener("keydown",t.handleDocumentKeydown_)},this.listen("click",this.handleClick_),this.listen("keydown",this.handleKeydown_),this.listen(lB.OPENING_EVENT,this.handleOpening_),this.listen(lB.CLOSING_EVENT,this.handleClosing_)},t.prototype.destroy=function(){this.unlisten("click",this.handleClick_),this.unlisten("keydown",this.handleKeydown_),this.unlisten(lB.OPENING_EVENT,this.handleOpening_),this.unlisten(lB.CLOSING_EVENT,this.handleClosing_),this.handleClosing_(),this.buttonRipples_.forEach(function(e){return e.destroy()}),e.prototype.destroy.call(this)},t.prototype.layout=function(){this.foundation.layout()},t.prototype.open=function(){this.foundation.open()},t.prototype.close=function(e){void 0===e&&(e=""),this.foundation.close(e)},t.prototype.getDefaultFoundation=function(){var e=this;return new lH({addBodyClass:function(e){return document.body.classList.add(e)},addClass:function(t){return e.root.classList.add(t)},areButtonsStacked:function(){var t,n;return t=e.buttons_,n=new Set,[].forEach.call(t,function(e){return n.add(e.offsetTop)}),n.size>1},clickDefaultButton:function(){return e.defaultButton_&&e.defaultButton_.click()},eventTargetMatches:function(e,t){return!!e&&o4(e,t)},getActionFromEvent:function(e){if(!e.target)return"";var t=o5(e.target,"["+lB.ACTION_ATTRIBUTE+"]");return t&&t.getAttribute(lB.ACTION_ATTRIBUTE)},getInitialFocusEl:function(){return e.getInitialFocusEl_()},hasClass:function(t){return e.root.classList.contains(t)},isContentScrollable:function(){var t;return!!(t=e.content_)&&t.scrollHeight>t.offsetHeight},notifyClosed:function(t){return e.emit(lB.CLOSED_EVENT,t?{action:t}:{})},notifyClosing:function(t){return e.emit(lB.CLOSING_EVENT,t?{action:t}:{})},notifyOpened:function(){return e.emit(lB.OPENED_EVENT,{})},notifyOpening:function(){return e.emit(lB.OPENING_EVENT,{})},releaseFocus:function(){return e.focusTrap_.releaseFocus()},removeBodyClass:function(e){return document.body.classList.remove(e)},removeClass:function(t){return e.root.classList.remove(t)},reverseButtons:function(){e.buttons_.reverse(),e.buttons_.forEach(function(e){e.parentElement.appendChild(e)})},trapFocus:function(){return e.focusTrap_.trapFocus()}})},t.prototype.getInitialFocusEl_=function(){return this.root.querySelector("["+lB.INITIAL_FOCUS_ATTRIBUTE+"]")},t}(o1),lV=function(e,t,n,i){var r,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(t,n,a):r(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};let lU=o(3384),lG=o(6612);class lK extends CustomEvent{constructor(){super(lK.NAME,{bubbles:!0,composed:!0})}}lK.NAME="or-mwc-dialog-opened";class lY extends CustomEvent{constructor(e){super(lY.NAME,{detail:e,bubbles:!0,composed:!0})}}function lX(e,t){return t||(t=lQ.DialogHostElement||document.body),e.setOpen(!0),e.addEventListener(lK.NAME,e=>{e.stopPropagation()}),e.addEventListener(lY.NAME,t=>{t.stopPropagation(),window.setTimeout(()=>{e.parentElement&&e.parentElement.removeChild(e)},0)}),t.append(e),e}lY.NAME="or-mwc-dialog-closed";let lq=c`
|
|
529
529
|
:host {
|