@questwork/vue-q-widget-vue3 3.1.0 → 3.1.1
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/q-widget.min.js +15 -13
- package/lib/models/controllerHelpers/controllerHelpers.js +2 -2
- package/package.json +11 -15
- package/vite.config.js +63 -6
package/dist/q-widget.min.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/*! For license information please see q-widget.min.js.LICENSE.txt */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})(this,function(y,r){"use strict";const m=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},P={name:"q-widget-q-modal",props:{modal:{type:Object,default:()=>({})}},data(){return{}},computed:{body(){return this.modal.body},css(){return this.modal.css},countdown(){return this.modal.countdown},label(){return this.modal.label},model(){return this.modal.model},onCancel(){return this.modal.onCancel},onClose(){return this.modal.onClose},onConfirm(){return this.modal.onConfirm},title(){return this.modal.title}},methods:{onFinish(){this.modal.onFinish()},qForm(t){this.modal.qForm(t)}}},U={class:"q-widget-q-modal __modal"};function K(t,e,n,o,i,s){const l=r.resolveComponent("q-modal",!0);return r.openBlock(),r.createElementBlock("div",U,[r.createVNode(l,{body:s.body,countdown:s.countdown,css:s.css,label:s.label,model:s.model,onCancel:s.onCancel,onClose:s.onClose,onConfirm:s.onConfirm,title:s.title,onOnFinish:s.onFinish,onQForm:s.qForm},null,8,["body","countdown","css","label","model","onCancel","onClose","onConfirm","title","onOnFinish","onQForm"])])}const j=m(P,[["render",K],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/QModal.vue"]]);function I({controller:t,state:e,saveControllerState:n}){const{saveStateKeys:o=[]}=t,i=o.reduce((s,l)=>({...s,...S({keys:l.split("."),obj:e})}),{});return n({data:i})}function S({keys:t,obj:e}){const n=t.shift();return{[n]:t.length===0?e[n]:S({keys:t,obj:e[n]})}}function C({component:t,message:e,modalConfig:n={}}){const{countdown:o,label:i,title:s,canClose:l=!0}=n,a={body:[{customComponentName:"q-modal-region-tool-html",html:e}],countdown:o,label:i,onClose:l?()=>{t.modal=null}:null,title:s||"Error"};t.modal=a}class z{static exec({config:e,keys:n,permissions:o}){Array.isArray(e)||console.log("can not handle these buttons");const i=n.shift();return n.length!==0&&console.log(`can not handle ${n.join(".")}`),T({buttons:e,key:i,permissions:o})}}function T({buttons:t,key:e,permissions:n}){return t.map(o=>{if(W(e,o)){const i=o.permissions||[];return{...o,permissions:[...i,...n]}}return o})}function W(t,e){const{buttonType:n,id:o,label:i}=e;return t===o||t===i||t===n}class M{static exec({config:e,keys:n,permissions:o}){return b({layout:e,keys:n,permissions:o})}}function b({layout:t,keys:e,permissions:n}){const o=e[0],{children:i,permissions:s}=t;if(G(o,t)){if(e.shift(),e.length===0)return{...t,permissions:[...s||[],...n]};if(Array.isArray(i))return{...t,children:i.map(l=>b({layout:l,keys:[...e],permissions:n}))};console.log(`can not handle ${e.join(".")}`)}return Array.isArray(i)?{...t,children:i.map(l=>b({layout:l,keys:[...e],permissions:n}))}:t}function G(t,e){const{id:n,name:o}=e;return t===n||t===o}class J{static exec({config:e,keys:n,permissions:o}){const i=n.shift();let s=null;switch(i){case"buttons":{s=z;break}case"layout":{s=M;break}default:{s=null;break}}return!s||typeof s.exec!="function"?e:{...e,[i]:s.exec({config:e[i],keys:[...n],permissions:o})}}}class Y{static exec({config:e,keys:n,permissions:o}){Array.isArray(e)||console.log("can not handle these actions");const i=n.shift();return n.length!==0&&console.log(`can not handle ${n.join(".")}`),X({actions:e,key:i,permissions:o})}}function X({actions:t,key:e,permissions:n}){return t.map(o=>{if(Z(e,o)){const i=o.permissions||[];return{...o,permissions:[...i,...n]}}return o})}function Z(t,e){const{id:n,label:o}=e;return t===n||t===o}class ee{static exec({config:e,keys:n,permissions:o}){const i=n.shift();switch(i){case"actions":return{...e,actions:te({actions:e[i],keys:n,permissions:o})};default:return e}}}function te({actions:t,keys:e,permissions:n}){Array.isArray(t)||console.log("can not handle these actions");const o=e.shift();return e.length!==0?(console.log(`can not handle ${e.join(".")}`),t):t.map(i=>{if(ne(o,i)){const s=i.permissions||[];return{...i,permissions:[...s,...n]}}return i})}function ne(t,e){const{id:n,label:o}=e;return t===n||t===o}class se{static exec({config:e,keys:n,permissions:o}){return Array.isArray(e)||console.log("can not handle these actions"),N({headers:e,keys:n,permissions:o})}}function N({headers:t,keys:e,permissions:n}){const o=e.shift();return t.map(i=>{if(re(o,i)){const{permissions:s,children:l}=i;return e.length!==0?Array.isArray(l)&&l.length>0?{...i,children:N({headers:l,keys:e,permissions:n})}:(console.log(`can not handle ${e.join(".")}`),i):{...i,permissions:[...s||[],...n]}}return i})}function re(t,e){const{id:n,label:o,key:i}=e;return t===n||t===o||t===i}class ie{static exec({config:e,keys:n,permissions:o}){const i=n.shift();let s=null;switch(i){case"actions":{s=Y;break}case"bulkAction":{s=ee;break}case"headers":{s=se;break}default:{s=null;break}}return!s||typeof s.exec!="function"?e:{...e,[i]:s.exec({config:e[i],keys:[...n],permissions:o})}}}const oe={ElementQForm:J,ElementQList:ie};function le({config:t,configPermissions:e=[],type:n}){return e.reduce((i,s)=>{const l=ae(n);if(!l||typeof l.exec!="function")return console.log("no config handler"),i;const{key:a,value:u}=s;return l.exec({config:i,keys:a.split("."),permissions:u})},t)}function ae(t){return oe[t]||null}function H(t){return`${t}-${Math.floor(Math.random()*1e9)}`}class q{constructor(e={}){this.css=e.css,this.configType="Config"}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function ce(t,e){const{button:n,klass:o}=t,{element:i}=e,s=i.getState()||{},{formData:l={}}=s;class a extends o{constructor(c){super(c),this.hidden=c.hidden||!1,this.permissionResult=c.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden&&super.isValid}static init(c,d){if(c instanceof a)return c;const g=c.permissions?d.permissionHandler(c.permissions,l):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},_=new a({...c,permissionResult:g});return _.isValid?_:null}permissionResultHandler(c){const{event:d,isAllowCreate:g,isAllowRead:_,isAllowUpdate:E,isAllowDelete:B}=c;d?typeof this[d]=="function"?this[d]({val:!0}):console.log(`do not have the event ${d}`):g&&_&&E&&B||this.setHidden({val:!0})}setDisabled({val:c}){this.disabled=c}setHidden({val:c}){this.hidden=c}}return a.init(n,e)}function de(t,e){const{layout:n,klass:o}=t,{element:i}=e,s=i.getState()||{},{formData:l={}}=s;class a extends o{constructor(d){super(d),this.permissionResult=d.permissions?e.permissionHandler(d.permissions,l):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},this.permissionResultHandler(this.permissionResult)}permissionResultHandler(d){const{event:g,isAllowCreate:_,isAllowRead:E,isAllowUpdate:B,isAllowDelete:kn}=d;g?typeof this[g]=="function"?this[g]({val:!0}):console.log(`do not have the event ${g}`):E?B||this.setPreview({val:!0}):this.setHidden({val:!0}),Array.isArray(this.children)&&this.children.forEach(hn=>{hn.permissionResultHandler(d)})}setDecoratorDisabled({val:d}){this.setDisabled({val:d})}setDecoratorHidden({val:d}){this.setHidden({val:d})}setDecoratorPreview({val:d}){this.setPreview({val:d})}}return a.init(n)}function ue(t){return e=>{const{type:n}=e;switch(n){case"button":return ce(e,t);case"node":return de(e,t);default:return null}}}class A extends q{constructor(e={}){super(e),this.configType="ElementQFormConfig",this.buttons=e.buttons,this.css=e.css||{},this.disabledForm=e.disabledForm||!1,this.eventName=e.eventName||{},this.formHandler=ue(e.helpers),this.layout=e.layout,this.previewForm=e.previewForm||!1,this.updateLayoutConfigs=e.updateLayoutConfigs||[]}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function me({helpers:t}){const{element:e}=t,{getClasses:n}=e.getHandlers(),{Cell:o}=t.qGrid;class i extends o{constructor(l){super(l),typeof l.hidden=="function"?this.permissionHidden=l.hidden(this.item.item,this):this.permissionHidden=l.hidden||!1,this.permissionResult=l.permissionResult,this.permissionResultHandler(this.permissionResult,l.customComponentName)}get isValid(){return this.permissionHidden===!1}static init(l){const{permissions:a}=l,u=a?t.permissionHandler(a):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},c=new this({...l,permissionResult:u});return c.isValid?c:null}permissionResultHandler(l,a){const{event:u,isAllowCreate:c,isAllowRead:d,isAllowUpdate:g,isAllowDelete:_}=l;if(u){typeof this[u]=="function"?this[u]({val:!0}):console.log(`do not have the event ${u}`);return}(!(a==="q-grid-body-row-cell-button")&&!d||!(c&&d&&g&&_))&&this.setHidden({val:!0})}setHidden({val:l}){this.permissionHidden=l}}return typeof n!="function"?{Cell:i}:n({helpers:{Cell:i,...t}})}class L extends q{constructor(e={}){super(e),this.configType="ElementQGridConfig",this.classes=me({helpers:e.helpers}),this.converter=he({helpers:e.helpers}),this.eventName=e.eventName,this.layout=e.layout,this.fillLastRow=e.fillLastRow,this.placeholder=e.placeholder,this.urlDelegate=e.urlDelegate}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function he({helpers:t}){const{element:e}=t,{converter:n}=e.getHandlers();if(typeof n!="function")return i=>i;const{QItem:o}=t.qGrid;return n({helpers:{QItem:o,...t}})}function fe({helpers:t}){const{QListBulkButton:e}=t.qList,{getValidation:n}=t.qUtilities;class o extends e{constructor(s){super(s),this.hidden=s.hidden||!1,this.permissionResult=s.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden}static init(s,l){if(s instanceof o)return s;const{restriction:a,permissions:u}=s,c=l.controller.getState();if(!n({rule:a,data:c}))return null;const d=u?l.permissionHandler(u):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},g=new o({...s,permissionResult:d});return g.isValid?g:null}static initFromArray(s,l){return Array.isArray(s)?s.map(a=>this.init(a,l)):[]}static initOnlyValidFromArray(s,l){return this.initFromArray(s,l).filter(a=>a)}permissionResultHandler(s){const{event:l,isAllowCreate:a,isAllowRead:u,isAllowUpdate:c,isAllowDelete:d}=s;l?typeof this[l]=="function"?this[l]({val:!0}):console.log(`do not have the event ${l}`):a&&u&&c&&d||this.setHidden({val:!0})}setHidden({val:s}){this.hidden=s}}return o}function ge({helpers:t}){const{QListButton:e}=t.qList;class n extends e{constructor(i){super(i),this.endpoint=O(i.endpoint,i.qRow),this.httpMethod=i.httpMethod,this.hidden=i.hidden||!1,this.permissionResult=i.permissionResult,this.permissionResultHandler(this.permissionResult),this.url=O(i.url,i.qRow)}get isValid(){return!this.hidden&&super.isValid}static init(i,s){if(i instanceof n)return i;const l=i.permissions?s.permissionHandler(i.permissions,i.qRow.get()):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=new n({...i,permissionResult:l});return a.isValid?a:null}static initFromArray(i,s){return Array.isArray(i)?i.map(l=>this.init(l,s)):[]}static initOnlyValidFromArray(i,s){return this.initFromArray(i,s).filter(l=>l)}permissionResultHandler(i){const{event:s,isAllowCreate:l,isAllowRead:a,isAllowUpdate:u,isAllowDelete:c}=i;s?typeof this[s]=="function"?this[s]({val:!0}):console.log(`do not have the event ${s}`):l&&a&&u&&c||this.setHidden({val:!0})}setHidden({val:i}){this.hidden=i}}return n}function O(t,e){if(!t)return"";const n=/\$\{(.+?)\}/g;return t.replace(n,(o,i)=>e.get(i.trim()))}function pe(){class t{constructor(n){Object.keys(n).forEach(o=>{this[o]=n[o]}),this.hidden=n.hidden||!1,this.permissionResult=n.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden}static init(n,o){if(n instanceof t)return n;const{children:i,permissions:s}=n,l=s?o.permissionHandler(s):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=new t({...n,children:Array.isArray(i)?this.initOnlyValidFromArray(i,o):null,permissionResult:l});return a.isValid?a:null}static initFromArray(n,o){return Array.isArray(n)?n.map(i=>this.init(i,o)):[]}static initOnlyValidFromArray(n,o){return this.initFromArray(n,o).filter(i=>i)}permissionResultHandler(n){const{event:o,isAllowCreate:i,isAllowRead:s,isAllowUpdate:l,isAllowDelete:a}=n;o?typeof this[o]=="function"?this[o]({val:!0}):console.log(`do not have the event ${o}`):s||this.setHidden({val:!0})}setHidden({val:n}){this.hidden=n}}return t}class x extends q{constructor(e={}){super(e),this.configType="ElementQListConfig",this.bulkAction=ye({bulkAction:e.bulkAction,helpers:e.helpers}),this.converter=Ce({actions:e.actions,helpers:e.helpers}),this.css=e.css,this.eventName=e.eventName,this.headers=_e({headers:e.headers,helpers:e.helpers}),this.listStyle=e.listStyle||"q-list-table",this.listShowFooter=e.showFooter||!1,this.listSortBys=e.sortBys,this.noDataMessage=e.noDataMessage}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function ye({bulkAction:t={},helpers:e}){const n=fe({helpers:e});return{...t,actions:n.initOnlyValidFromArray(t.actions,e)}}function _e({headers:t,helpers:e}){return pe().initOnlyValidFromArray(t,e)}function Ce({actions:t,helpers:e}){const{QRow:n}=e.qList,i={QListButton:ge({helpers:e}),QRow:n,...e},{element:s}=i,{converter:l}=s.getHandlers();return typeof l!="function"?a=>a:l({actions:t,helpers:i})}class R{constructor(e){this.permissionHandler=ke,Object.keys(e).forEach(n=>{this[n]=e[n]})}static init(e){const n=new R(e);return n.isValid?n:null}get isValid(){return f(this.getControllerState)&&f(this.getControllerUniqueKey)&&f(this.saveControllerState)&&f(this.startLoading)&&f(this.stopLoading)&&f(this.runChains)&&this.qForm&&f(this.qForm.NodeHelper)&&this.qGrid&&f(this.qGrid.QItem)&&f(this.qGrid.Cell)&&this.qList&&f(this.qList.QRow)&&f(this.qList.QListBulkButton)&&f(this.qList.QListButton)&&this.qUtilities&&f(this.qUtilities.convertString)&&f(this.qUtilities.getValidation)&&f(this.qUtilities.lodash)}}function f(t){return typeof t=="function"}function ke(){return{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0}}class ${constructor(e={}){this.id=e.id||H("node"),this.css=e.css||{},this.hidden=e.hidden||!1,this.nodeType="Node",this.permissionResult=e.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!!this.id&&!this.hidden}get isCreated(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}getElementState(){return this}getType(){return this.type}isExist(e){const{name:n}=this;return!!e.find(o=>n&&o.name===n)}permissionResultHandler(e){const{event:n,isAllowCreate:o,isAllowRead:i,isAllowUpdate:s,isAllowDelete:l}=e;n?typeof this[n]=="function"?this[n]({val:!0}):console.log(`do not have the event ${n}`):o&&i&&s&&l||this.setHidden({val:!0})}setHidden({val:e}){this.hidden=e}updateElementState(e){return this}}let k=class extends ${constructor(e={}){super(e),this.children=e.children||[],this.nodeType="Container"}getChildren(){return this.children}getValidChildren(){return this.getChildren().filter(e=>e)}getElementState(){return this.getValidChildren().reduce((e,n)=>({...e,...n.getElementState()}),{})}updateElementState(e){return this.getValidChildren().forEach(n=>n.updateElementState(e)),this}};class ve extends k{constructor(e={}){super(e),this.nodeType="ContainerBox"}}class we extends k{constructor(e={}){super(e),this.nodeType="ContainerColumn"}}class Ee extends k{constructor(e={}){super(e),this.nodeType="ContainerHeaderSticky"}}class be extends k{constructor(e={}){super(e),this.nodeType="ContainerRow"}}const qe={ContainerBox:ve,ContainerColumn:we,ContainerHeaderSticky:Ee,ContainerRow:be};let p=class extends ${constructor(e={}){super(e),this.configPermissions=e.configPermissions,this.name=e.name,this.nodeType=e.nodeType||"Element",this.state={},this.configHandler(e.config)}get isCreated(){return super.isCreated&&!!this.component}get isValid(){return super.isValid&&!!this.name}get hasConfigPermissions(){return!!this.configPermissions}get stateName(){return{...this.defaultStateName,...this.config.stateName}}addComponent(e){this.component=e}configHandler(e={}){this.hasConfigPermissions?this.config=le({config:e,configPermissions:this.configPermissions,type:this.nodeType}):this.config=e}getConfig(){return this.config||{}}getComponent(){return this.component}getElementName(){return this.name}getHandlers(){const e=this.getElementName(),{elementHandlers:n={}}=this.state;return n[e]||{}}getState(){return this.state}getElementState(){return Re(this.state,this.stateName)}onCreated({component:e,payload:n={}}){return this.addComponent(e),this.updateState(n),this}update(e){this.updateElementState(e)}updateState(e){this.state={...this.state,...e}}updateElementState(e){const n=$e(e,this.stateName);return this.updateState(n),this}};function Re(t,e){return Object.keys(e).reduce((n,o)=>{const i=e[o],s=t[o];return{...n,[i]:s}},{})}function $e(t,e){return Object.keys(e).reduce((n,o)=>{const i=e[o],s=t[i];return delete n[i],{...n,[o]:s}},t)}class Be extends p{constructor(e={}){super(e)}}class Se extends p{constructor(e={}){super(e),this.defaultStateName={axios:"axios",formData:"formData",formErrors:"formErrors",formNode:"formNode",pageKey:"pageKey",qForm:"qForm"}}getConfig(e){let n=this.config||{};if(this.state.qForm){const{lodash:o}=e.qUtilities,i=Ne(this.state.qForm);n=o.mergeWith(i,n||{},Q)}return typeof A=="function"?A.init({...n,helpers:{...e,element:this}}):{}}getFormCustomizer(){const{formCustomizer:e}=this.getHandlers();return typeof e=="function"?e:Q}}function Q(t,e){if(Array.isArray(t))return e||null;if(typeof e=="number"||typeof e=="boolean")return e;if(!e)return null}function Ne(t){const{buttons:e=[],layout:n={},trees:o=[]}=t||{};return{buttons:e,layout:n,trees:o}}class He extends p{constructor(e={}){super(e),this.defaultStateName={gridItems:"gridItems"}}getConfig(e){let n=this.config||{};return this.state.qGrid&&(n={...this.state.qGrid,...n}),typeof L=="function"?L.init({...n,helpers:{...e,element:this}}):{}}}class Ae extends p{constructor(e={}){super(e)}}class Le extends p{constructor(e={}){super(e)}}class Oe extends p{constructor(e={}){super(e)}}class xe extends p{constructor(e={}){super(e),this.defaultStateName={qList:"qList",qSorterKeys:"qSorterKeys",rows:"rows"}}getConfig(e){let n=this.config||{};return this.state.qList&&(n={...Qe(this.state.qList),...n}),typeof x=="function"?x.init({...n,helpers:{...e,element:this}}):{}}}function Qe(t){return{...t}}class De extends p{constructor(e={}){super(e),this.defaultStateName={currentPage:"currentPage",currentPageSize:"currentPageSize",totalRecords:"totalRecords"}}}class Ve extends p{constructor(e={}){super(e),this.defaultStateName={active:"active",tabLayout:"tabLayout"}}}const h={...qe,...{ElementQButton:Be,ElementQForm:Se,ElementQGrid:He,ElementQHtml:Ae,ElementQImport:Le,ElementQLabel:Oe,ElementQList:xe,ElementQPaginator:De,ElementQTab:Ve},Container:k,Element:p,Node:$};class Fe{static init({layout:e={},controllerHelpers:n={}}={}){return D({layout:e,nodes:[],controllerHelpers:n})}}function D({layout:t,nodes:e,controllerHelpers:n}){if(t instanceof h.Node)return t;const o={...t};return Array.isArray(o.children)&&(o.children=o.children.map(i=>D({layout:i,nodes:e,controllerHelpers:n}))),Pe(o,e,n)}function Pe(t,e,n){const{nodeType:o,permissions:i}=t||{};if(typeof h[o]=="function"){const{permissionHandler:s}=n,l=i?s(i):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=h[o].init({...t,permissionResult:l});return a?a.isExist(e)?null:(e.push(a),a):null}return null}class Ue{constructor(e={}){this.css=e.css||{},this.controllerHelpers=e.controllerHelpers,this.eventHandlers=e.eventHandlers||{},this.id=e.id||H("controller"),this.initialState=e.initialState,this.name=e.name,this.saveStateKeys=e.saveStateKeys||[],this.setLayout(e.layout,e.controllerHelpers)}get isValid(){return!!this.id&&!!this.layout}static init(e){const n=new this(e);return n.isValid?n:null}getElements(){return this.elements||[]}getElementByElementName(e){return this.elements.find(n=>n.getElementName()===e)}getState(){return{...this.getControllerState(),...this.layout.getElementState()}}getControllerState(){return this.state}setLayout(e,n){this.layout=Fe.init({layout:e,controllerHelpers:n})}setElements(e){this.elements=e}updateState(e){this.state={...this.state,...e},this.layout.updateElementState(this.state)}}const v={beforeCreate(){this.$options.components={...this.$options.components,QWidgetContainersContainer:r.defineAsyncComponent(()=>Promise.resolve().then(()=>pt)),QWidgetElementsElement:r.defineAsyncComponent(()=>Promise.resolve().then(()=>mn))}},methods:{currentContainer(t){return t instanceof h.Container?"q-widget-containers-container":t instanceof h.Element?"q-widget-elements-element":""}}},Ke={name:"q-widget-controller",components:{QModal:j},mixins:[v],provide(){return{helpers:{...this.controllerHelpers,controller:this.controller}}},props:{controller:{type:Object,default:()=>({})}},data(){return{isReady:!1,loadingCount:0,modal:null,renderKey:0}},computed:{controllerHelpers(){return this.controller.controllerHelpers},eventHandlers(){return this.controller.eventHandlers||{}},initControllerState(){return this.controller.initialState},node(){return this.controller.layout}},created(){this.init()},methods:{async init(){try{const{getControllerState:t}=this.controllerHelpers;let e=this.initControllerState;typeof t=="function"&&(e=await t({state:e}));const{onCreated:n}=this.eventHandlers;n&&(e=await this.runEventChains({state:e,event:n})),this.updateState(e)}catch(t){C({component:this,message:t.message})}finally{this.isReady=!0,this.reRenderElements()}},async callbackEmit({event:t,payload:e}){console.log("callbackEmit",t,e)},async callbackSubscribe(t,{event:e,payload:n,cb:o}){if(t===this.controllerHelpers.getControllerUniqueKey())try{const{key:i}=e,{controllerSubscribed:s}=this.eventHandlers,l=s[i];let a=this.controller.getState();l&&(a=await this.runEventChains({state:{...a,eventPayload:n},event:l})),typeof o=="function"&&await o({event:e,payload:a})}catch(i){C({component:this,message:i.message})}},getKey(t,e){return`${this.renderKey}-${t}-${e} `},getLoadingFunctions({scope:t=""}){const{startLoading:e,stopLoading:n}=this.controllerHelpers;switch(t){case"full":return{startLoading:e,stopLoading:n};case"none":return null;case"self":return{startLoading:this.startSelfLoading,stopLoading:this.stopSelfLoading};default:return{startLoading:e,stopLoading:n}}},async onEvent(t){try{const{eventName:e,element:n,payload:o}=t,{elementEvents:i={}}=this.eventHandlers,s=i[e];s?await this.runEventChains({state:{...this.controller.getState(),eventPayload:o,eventElement:n},event:s}):console.log(`can not find the event ${e}`)}catch(e){C({component:this,message:e.message,modalConfig:{title:"提示"}})}},async onElementCreated(t){try{this.controller.setElements(t);const e=this.eventHandlers.onElementCreated;e&&await this.runEventChains({state:this.controller.getState(),event:e})}catch(e){C({component:this,message:e.message})}},reRenderElements(){this.renderKey+=1},async runEventChains({event:t,state:e}){let n=e;const o=Ie({event:t}),i=this.getLoadingFunctions({scope:o});try{if(V({loadingFunctions:i,action:"start"}),t){const s={body:{...e},controller:this.controller,component:this,controllerHelpers:{...this.controllerHelpers,callbackEmit:this.callbackEmit,callbackSubscribe:this.callbackSubscribe,runEventChains:this.runEventChains,reRenderElements:this.reRenderElements,showError:C,updateState:this.updateState}},{runChains:l}=this.controllerHelpers,u=(await l({event:t,payload:s})).getResult();n={...n,...je(u)}}return console.log(n),n}catch(s){throw new Error(s.message)}finally{V({loadingFunctions:i,action:"stop"})}},startSelfLoading(){this.loadingCount+=1},stopSelfLoading(){this.loadingCount-=1},updateState(t){this.controller.updateState(t);const{saveControllerState:e}=this.controllerHelpers;typeof e=="function"&&I({controller:this.controller,state:t,saveControllerState:e})}}};function je(t={}){const{obj:e={}}=t,{body:n={}}=e;return n}function Ie({event:t={}}={}){return t.scope||"full"}function V({loadingFunctions:t,action:e}){if(t){const{startLoading:n,stopLoading:o}=t;switch(e){case"start":{n();break}case"stop":{o();break}}}}const ze={class:"q-widget-controller __controller"};function Te(t,e,n,o,i,s){const l=r.resolveComponent("q-modal");return r.openBlock(),r.createElementBlock("div",ze,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(s.node)),{key:i.renderKey,controllerReady:i.isReady,node:s.node,loadingCount:i.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"])),i.modal?(r.openBlock(),r.createBlock(l,{key:s.getKey("modal",i.modal),modal:i.modal},null,8,["modal"])):r.createCommentVNode("v-if",!0)])}const We={name:"q-widget",components:{QWidgetController:m(Ke,[["render",Te],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Controller.vue"]])},props:{content:{type:Object,default:()=>({})},contentHelpers:{type:Object,default:()=>({})},controller:{type:Object,default:()=>null},controllerHelpers:{type:Object,default:()=>null}},data(){return{controllerHelpersInstence:null,controllerInstence:null,error:null}},computed:{hasError(){return this.error}},created(){this.init()},methods:{init(){try{const t=this.controllerHelpers||this.contentHelpers;if(this.controllerHelpersInstence=R.init(t),!this.controllerHelpersInstence)throw new Error("invalid controller helpers");const e=this.controller||this.content;if(this.controllerInstence=Ue.init({...e,controllerHelpers:this.controllerHelpersInstence}),!this.controllerInstence)throw new Error("invalid controller")}catch(t){this.error=t.message||"invalid controller"}}}},Me={class:"q-widget"},Ge={key:1,class:"__error"};function Je(t,e,n,o,i,s){const l=r.resolveComponent("q-widget-controller");return r.openBlock(),r.createElementBlock("div",Me,[s.hasError?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createBlock(l,{key:0,controller:i.controllerInstence},null,8,["controller"])),s.hasError?(r.openBlock(),r.createElementBlock("div",Ge,r.toDisplayString(i.error),1)):r.createCommentVNode("v-if",!0)])}const w=m(We,[["render",Je],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/QWidget.vue"]]);function Ye(t){t.component(w.name,w)}w.install=Ye;const Xe={name:"q-widget-containers-box",mixins:[v],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},Ze={class:"q-widget-containers-box __outer-box"},et={class:"__inner-box"};function tt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",Ze,[r.createElementVNode("div",et,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("box",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])])}const nt=m(Xe,[["render",tt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Box.vue"]]),st={name:"q-widget-containers-column",mixins:[v],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},rt={class:"q-widget-containers-column __column"};function it(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",rt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("cloumn",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const ot=m(st,[["render",it],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Column.vue"]]),lt={name:"q-widget-containers-header-sticky",mixins:[v],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},at={class:"q-widget-containers-header-sticky __header __sticky --sticky-top"};function ct(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",at,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("header-sticky",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const dt=m(lt,[["render",ct],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/HeaderSticky.vue"]]),ut={name:"q-widget-containers-row",mixins:[v],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},mt={class:"q-widget-containers-row __row"};function ht(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",mt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("row",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const ft={name:"q-widget-containers-container",components:{QWidgetBoxContainer:nt,QWidgetColumnContainer:ot,QWidgetHeaderStickyContainer:dt,QWidgetRowContainer:m(ut,[["render",ht],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Row.vue"]])},props:{controllerReady:{type:Boolean,default:!1},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],data(){return{createdChildren:[]}},computed:{children(){return this.node.getValidChildren()||[]}},methods:{factoryInit(t){return t instanceof h.ContainerBox?"q-widget-box-container":t instanceof h.ContainerColumn?"q-widget-column-container":t instanceof h.ContainerHeaderSticky?"q-widget-header-sticky-container":t instanceof h.ContainerRow?"q-widget-row-container":""},getClass(t){return t.css||""},getKey(t,e){return`${t}-${e}`},onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){if(this.createdChildren.push(t),this.createdChildren.length===this.children.length){const e=this.createdChildren.reduce((n,o)=>[...n,...o],[]);this.$emit("onElementCreated",e)}}}};function gt(t,e,n,o,i,s){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.factoryInit(n.node)),{class:r.normalizeClass(s.getClass(n.node)),controllerReady:n.controllerReady,getKey:s.getKey,node:n.node,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["class","controllerReady","getKey","node","loadingCount","onOnEvent","onOnElementCreated"])}const pt=Object.freeze(Object.defineProperty({__proto__:null,default:m(ft,[["render",gt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Container.vue"]])},Symbol.toStringTag,{value:"Module"})),yt={name:"q-widget-elements-adapters-q-button",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],computed:{$button(){return this.$config.button||{}},$config(){return this.element.getConfig()},$event(){return this.$button.event||"onButtonClick"},$url(){return this.$button.url||""},button(){return{...this.$button,url:this.url}},url(){const t=this.$config.patternMatch||/\$\{(.+?)\}/g,{convertString:e}=this.helpers.qUtilities;return e(this.$url,t,this.state)},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onClick(t){const e={eventName:this.$event,payload:t};this.$emit("onEvent",e)}}},_t={key:1};function Ct(t,e,n,o,i,s){const l=r.resolveComponent("q-button",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-button q-widget-adapters-q-button __element __adapter __button __flex",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,class:"q-button",button:s.button,onClick:s.onClick,onOnChange:s.onClick,onUpload:s.onClick},null,8,["button","onClick","onOnChange","onUpload"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",_t,e[0]||(e[0]=[r.createElementVNode("div",{class:"button __loading-box"},[r.createElementVNode("div",{class:"skeleton"},[r.createElementVNode("div",{class:"skeleton__tr"},[r.createElementVNode("div",{class:"skeleton__td"})])])],-1)])))],2)}const kt=m(yt,[["render",Ct],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QButton.vue"]]),vt={name:"q-widget-elements-adapters-q-form",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{formErrors:[],formValue:null,initPageKey:"",isFormReady:!1}},computed:{$buttons(){return this.$config.buttons||[]},$config(){return this.element.getConfig(this.helpers)},$disabledForm(){return this.$config.disabledForm||!1},$eventName(){return this.$config.eventName||{}},$formCss(){return this.$config.css||{}},$formHandler(){return this.$config.formHandler},$layout(){return this.$config.layout},$previewForm(){return this.$config.previewForm||!1},axios(){return this.state.axios},elementHandlers(){return this.element.getHandlers()},customizer(){return this.element.getFormCustomizer()},displayLayout(){return this.getLayout()},formData(){return this.state.formData},isReady(){return this.loadingCount<=0&&this.controllerReady},pageKey(){return this.state.pageKey||this.initPageKey||""}},created(){this.controllerReady&&this.init()},methods:{init(){const{lodash:t}=this.helpers.qUtilities;this.formValue=t.cloneDeep(this.formData),this.isFormReady=!0},getClass(t){return t.css||""},getLayout(){const{NodeHelper:t}=this.helpers.qForm,{convertString:e,getValidation:n}=this.helpers.qUtilities;return Et({config:this.$config,convertString:e,getValidation:n,layout:this.$layout,NodeHelper:t,state:this.state})},onChange(t){const{node:e}=t;this.formErrors=[];const n=e.save({errors:this.formErrors}),{lodash:o}=this.helpers.qUtilities,i=o.mergeWith(this.formValue,n,this.customizer),l={eventName:this.$eventName.onFormChange||"onFormChange",payload:{...t,formData:i,errors:this.formErrors}};this.$emit("onEvent",l)},onClick(t){const{value:e,event:n}=t,{lodash:o}=this.helpers.qUtilities,i=o.mergeWith(this.formValue,e,this.customizer),s={eventName:n,payload:{...t,errors:this.formErrors,formData:i}};this.$emit("onEvent",s)},onCreated(t){const{pageKey:e,node:n}=t;this.initPageKey=e;const{afterSave:o}=this.elementHandlers;typeof o=="function"&&n.subscribe("afterSave",o({node:n,state:this.state})),this.formErrors=[],n.save({errors:this.formErrors}),this.element.onCreated({component:this,payload:{...t,formErrors:this.formErrors,formNode:n,pageKey:e}}),this.$emit("onCreated")}}};function wt(t,e,n,o){const i=/['"]\$\{(.+?)\}['"]/g;return JSON.parse(o(JSON.stringify(t),i,n))}function Et({config:t={},convertString:e,getValidation:n,layout:o,NodeHelper:i,state:s}){const l=bt({config:t,getValidation:n,layout:o,NodeHelper:i,state:s});return wt(l,t,s,e)}function bt({config:t={},getValidation:e,layout:n,NodeHelper:o,state:i}){let s=n;const{updateLayoutConfigs:l=[]}=t;return typeof o.updateNode=="function"&&l.forEach(a=>{const{key:u,value:c,type:d,restriction:g}=a;e({rule:g,data:i})&&(s=o.updateNode({keys:u.split("."),value:c,layout:s,type:d}))}),s}const qt={key:0,class:"__form __flex"},Rt={key:1};function $t(t,e,n,o,i,s){const l=r.resolveComponent("q-form",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-form q-widget-adapters-q-form __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createElementBlock("div",qt,[i.isFormReady?(r.openBlock(),r.createBlock(l,{key:0,axios:s.axios,buttons:s.$buttons,css:s.$formCss,disabledForm:s.$disabledForm,formHandler:s.$formHandler,layout:s.displayLayout,pageKey:s.pageKey,previewForm:s.$previewForm,value:i.formValue,onOnClick:s.onClick,onOnChange:s.onChange,onOnCreated:s.onCreated},null,8,["axios","buttons","css","disabledForm","formHandler","layout","pageKey","previewForm","value","onOnClick","onOnChange","onOnCreated"])):r.createCommentVNode("v-if",!0)])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Rt,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const Bt=m(vt,[["render",$t],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QForm.vue"]]),St={name:"q-widget-elements-adapters-q-grid",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{itemsData:[]}},computed:{$cellHandler(){return this.$config.cellHandler},$classes(){return this.$config.classes},$config(){return this.element.getConfig(this.helpers)},$converter(){return this.$config.converter},$eventName(){return this.$config.eventName||{}},$fillLastRow(){return this.$config.fillLastRow||!1},$gridCss(){return this.$config.css||""},$placeholder(){return this.$config.placeholder||null},$urlDelegate(){return this.$config.urlDelegate||""},gridItems(){return this.state.gridItems},isReady(){return this.loadingCount<=0&&this.controllerReady},layout(){return this.$config.layout}},created(){this.controllerReady&&this.init()},methods:{init(){this.itemsData=this.gridItems.map(this.$converter),this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onClickGridItem(t){const n={eventName:this.$eventName.onClickGridItem||"onClickGridItem",payload:t};this.$emit("onEvent",n)},onButtonClick(t){const n={eventName:this.$eventName.onClick||"onClick",payload:t};this.$emit("onEvent",n)}}},Nt={key:1};function Ht(t,e,n,o,i,s){const l=r.resolveComponent("q-grid",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-grid q-widget-adapters-q-grid __element __adapter __grid",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,cellHandler:s.$cellHandler,classes:s.$classes,css:s.$gridCss,fillLastRow:s.$fillLastRow,items:i.itemsData,layout:s.layout,placeholder:s.$placeholder,urlDelegate:s.$urlDelegate,onOnClick:s.onButtonClick,onOnClickGridItem:s.onClickGridItem},null,8,["cellHandler","classes","css","fillLastRow","items","layout","placeholder","urlDelegate","onOnClick","onOnClickGridItem"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Nt," Loading "))],2)}const At=m(St,[["render",Ht],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QGrid.vue"]]),Lt={name:"q-widget-elements-adapters-q-html",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],computed:{$config(){return this.element.getConfig()},$html(){const t=this.$config.patternMatch||/\$\{(.+?)\}/g,{convertString:e}=this.helpers.qUtilities;return e(this.$config.html,t,this.state)},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""}}},Ot=["innerHTML"],xt={key:1};function Qt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-html q-widget-adapters-q-html __element __adapter __html",s.getClass(n.element)])},[s.$html&&s.isReady?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__html",innerHTML:s.$html},null,8,Ot)):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",xt,[r.createCommentVNode(" loading ")]))],2)}const Dt=m(Lt,[["render",Qt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QHtml.vue"]]),Vt={name:"q-widget-elements-adapters-q-import",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],data(){return{elementState:{}}},computed:{$additionalListHeaders(){return this.$config.additionalListHeaders||[]},$config(){return this.element.getConfig()},$label(){return this.$config.label},$templateUrl(){return this.$config.templateUrl},elementHandlers(){return this.element.getHandlers()},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},formatRowData(t){return this.elementHandlers.formatRowData(t)},getClass(t){return t.css||""},setElementState(t){this.elementState={...this.elementState,...t}},showError(t={}){const{payload:e}=t;return this.elementHandlers.showError({payload:e,state:{...this.state,...this.elementState}})},showSuccess({payload:t}){return this.elementHandlers.showSuccess({payload:t,state:{...this.state,...this.elementState}})},validationHandler({payload:t}){return this.elementHandlers.validationHandler({payload:t,state:this.state,setElementState:this.setElementState})}}},Ft={key:1};function Pt(t,e,n,o,i,s){const l=r.resolveComponent("q-import",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-import q-widget-adapters-q-import __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,additionalListHeaders:s.$additionalListHeaders,formatRowData:s.formatRowData,label:s.$label,showError:s.showError,showSuccess:s.showSuccess,templateUrl:s.$templateUrl,validationHandler:s.validationHandler},null,8,["additionalListHeaders","formatRowData","label","showError","showSuccess","templateUrl","validationHandler"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Ft,e[0]||(e[0]=[r.createElementVNode("div",{class:"import __loading-box"},[r.createElementVNode("div",{class:"skeleton"},[r.createElementVNode("div",{class:"skeleton__tr"},[r.createElementVNode("div",{class:"skeleton__td"})])])],-1)])))],2)}const Ut=m(Vt,[["render",Pt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QImport.vue"]]),Kt={name:"q-widget-elements-adapters-q-label",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],computed:{$config(){return this.element.getConfig()},$label(){return this.$config.label||""},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""}}},jt={key:0},It={key:1};function zt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-label q-widget-adapters-q-label __element __label",s.getClass(n.element)])},[s.$label&&s.isReady?(r.openBlock(),r.createElementBlock("h2",jt,r.toDisplayString(s.$label),1)):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",It))],2)}const Tt=m(Kt,[["render",zt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QLabel.vue"]]),Wt={name:"q-widget-elements-adapters-q-list",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{listRows:[],paginatorLayout:null,ready:!1}},computed:{$config(){return this.element.getConfig(this.helpers)},$converter(){return this.$config.converter},$css(){return this.$config.css},$eventName(){return this.$config.eventName||{}},$listBulkAction(){return this.$config.bulkAction||{}},$listHeaders(){return this.$config.headers||[]},$listSortBys(){return this.$config.listSortBys||[]},$listShowFooter(){return this.$config.listShowFooter||!1},$listStyle(){return this.$config.listStyle||"q-list-table"},$noDataMessage(){return this.$config.noDataMessage||""},isReady(){return this.loadingCount<=0&&this.controllerReady},listSortKeys(){return this.state.qSorterKeys||[]},rows(){return this.state.rows||[]}},created(){this.controllerReady&&this.init()},methods:{init(){this.listRows=this.rows.map(this.$converter),this.element.onCreated({component:this}),this.$emit("onCreated"),this.ready=!0},converter(t){return t},getClass(t){return t.css||""},onClickList(t){const{action:e,qRow:n,row:o}=t,{qListButtonType:i}=e,s={eventName:i||"onListClick",payload:t};this.$emit("onEvent",s)},onClickListBulk(t){const{action:e,qRows:n,rows:o}=t,{qListButtonType:i}=e,s={eventName:i||"onListClickBulk",payload:t};this.$emit("onEvent",s)},onListHeaderClick(t){const{key:e}=t.header;if(F(e,this.$listSortBys)){const o=Mt(this.listSortKeys,e),i=Gt(this.$listSortBys,o),s={eventName:this.$eventName.onListClickHeader||"onListClickHeader",payload:{qSorterKeys:o,qSorter:i}};this.$emit("onEvent",s)}}}};function F(t,e){return t?e.find(n=>{const{key:o}=n;return t===o}):null}function Mt(t,e){let n=!1;const o=t.map(i=>{const{by:s,direction:l}=i;if(e===s){n=!0;const a=typeof l<"u"?Number(l)===1?-1:Number(l)===-1?0:1:1;return{...i,direction:a}}return i});return n?o.filter(i=>i.direction!==0):[...t,{by:e,direction:1}]}function Gt(t,e){return e.reduce((n,o)=>{const{by:i,direction:s}=o,l=F(i,t),{value:a=[]}=l;if(!l)return n;const u=a.map(c=>({...c,direction:s}));return n.push(...u),n},[])}const Jt={key:1};function Yt(t,e,n,o,i,s){const l=r.resolveComponent("q-list",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-list q-widget-adapters-q-list __element __adapter __list",s.getClass(n.element)])},[s.isReady&&i.ready?(r.openBlock(),r.createBlock(l,{key:0,bulkAction:s.$listBulkAction,css:s.$css,headers:s.$listHeaders,listStyle:s.$listStyle,noDataMessage:s.$noDataMessage,rows:i.listRows,showFooter:s.$listShowFooter,sortBys:s.$listSortBys,sortStatus:s.listSortKeys,onClick:s.onClickList,onOnClickBulk:s.onClickListBulk,onOnListHeaderClick:s.onListHeaderClick},null,8,["bulkAction","css","headers","listStyle","noDataMessage","rows","showFooter","sortBys","sortStatus","onClick","onOnClickBulk","onOnListHeaderClick"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Jt,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__hr"></div><div class="skeleton__section skeleton__section--table"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div></div>',1)])))],2)}const Xt=m(Wt,[["render",Yt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QList.vue"]]),Zt={name:"q-widget-elements-adapters-q-paginator",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{isPaginator:!1,paginatorLayout:null}},computed:{$config(){return this.element.getConfig()},$controlLabel(){return this.$config.controlLabel},$eventName(){return this.$config.eventName||{}},$paginatorLayout(){return this.$config.layout},$paginatorSizeOptions(){return this.$paginatorLayout.pageSizeOptions||[]},currentPage(){return this.state.currentPage},currentPageSize(){return this.state.currentPageSize},currentPageSizeOptionsIndex(){return this.$paginatorSizeOptions.indexOf(this.currentPageSize)},initPage(){return this.currentPage>=0?this.currentPage:this.$paginatorLayout.initPage},isReady(){return this.loadingCount<=0&&this.controllerReady},pageSizeOptionsIndex(){return this.currentPageSizeOptionsIndex>=0?this.currentPageSizeOptionsIndex:(this.onChangeRecPerPage(this.$paginatorSizeOptions[this.$paginatorLayout.pageSizeOptionsIdx],this.initPage),this.$paginatorLayout.pageSizeOptionsIndex)},totalRecords(){return this.state.totalRecords}},created(){this.controllerReady&&this.init()},mounted(){},methods:{init(){this.paginatorLayout={...this.$paginatorLayout,initPage:this.initPage,pageSizeOptionsIndex:this.pageSizeOptionsIndex},this.isPaginator=!0,this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onChangePageIdx(t){if(t!==this.currentPage){const n={eventName:this.$eventName.onChangePageIdx||"onChangePageIdx",payload:{currentPage:t}};this.$emit("onEvent",n)}},onChangeRecPerPage(t,e){const o={eventName:this.$eventName.onChangeRecPerPage||"onChangeRecPerPage",payload:{currentPageSize:t,currentPage:e}};this.$emit("onEvent",o)}}},en={key:1};function tn(t,e,n,o,i,s){const l=r.resolveComponent("q-paginator",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-paginator q-widget-adapters-q-paginator __element __adapter __paginator",s.getClass(n.element)])},[i.isPaginator&&s.isReady?(r.openBlock(),r.createBlock(l,{key:0,controlLabel:s.$controlLabel,layout:i.paginatorLayout,total:s.totalRecords,onChangeCurrentPage:s.onChangePageIdx,onChangePageSize:s.onChangeRecPerPage},null,8,["controlLabel","layout","total","onChangeCurrentPage","onChangePageSize"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",en,e[0]||(e[0]=[r.createStaticVNode('<div class="paginator __loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const nn=m(Zt,[["render",tn],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QPaginator.vue"]]),sn={name:"q-widget-elements-adapters-q-tab",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{active:{},renderKey:0,tabLayout:[]}},computed:{$config(){return this.element.getConfig()},$eventName(){return this.$config.eventName||{}},$tabLayout(){return this.$config.layout||[]},activeKey(){return this.active.key},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.tabLayout=[...this.$tabLayout],this.active=this.state.active||this.tabLayout[0]||{},this.element.onCreated({component:this,payload:{tabLayout:this.tabLayout}}),this.$emit("onCreated")},getClass(t){return t.css||""},onChangeTab(t){const n={eventName:this.$eventName.onChangeTab||"onTabChange",payload:{active:t}};this.$emit("onEvent",n)}}},rn={key:0,class:"__tabs __flex"},on=["href"],ln=["onClick"],an={key:1};function cn(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-tab q-widget-adapters-q-tab __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createElementBlock("div",rn,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.tabLayout,(l,a)=>(r.openBlock(),r.createElementBlock("div",{key:a,class:r.normalizeClass(["__pointer __tab",s.activeKey===l.key?"__active":""])},[l.url?(r.openBlock(),r.createElementBlock("a",{key:0,href:l.url},r.toDisplayString(l.label)+r.toDisplayString(Number.isNaN(Number(l.total))?"":`(${Number(l.total)})`),9,on)):r.createCommentVNode("v-if",!0),l.url?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",{key:1,onClick:u=>s.onChangeTab(l)},r.toDisplayString(l.label)+r.toDisplayString(Number.isNaN(Number(l.total))?"":`(${Number(l.total)})`),9,ln))],2))),128))])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",an,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const dn={name:"q-widget-elements-element",components:{QWidgetQButtonElement:kt,QWidgetQFormElement:Bt,QWidgetQGridElement:At,QWidgetQHtmlElement:Dt,QWidgetQImportElement:Ut,QWidgetQLabelElement:Tt,QWidgetQListElement:Xt,QWidgetQPaginatorElement:nn,QWidgetQTabElement:m(sn,[["render",cn],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QTab.vue"]])},props:{controllerReady:{type:Boolean,default:!1},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{elementName(){return this.element.getElementName()},element(){return this.node},state(){return this.element.getState()}},methods:{factoryInit(t){return t instanceof h.ElementQButton?"q-widget-q-button-element":t instanceof h.ElementQForm?"q-widget-q-form-element":t instanceof h.ElementQGrid?"q-widget-q-grid-element":t instanceof h.ElementQHtml?"q-widget-q-html-element":t instanceof h.ElementQImport?"q-widget-q-import-element":t instanceof h.ElementQLabel?"q-widget-q-label-element":t instanceof h.ElementQList?"q-widget-q-list-element":t instanceof h.ElementQPaginator?"q-widget-q-paginator-element":t instanceof h.ElementQTab?"q-widget-q-tab-element":""},onEvent(t){this.$emit("onEvent",{...t,element:this.element})},onElementCreated(){this.element.isCreated&&this.$emit("onElementCreated",[this.element])}}};function un(t,e,n,o,i,s){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.factoryInit(n.node)),{controllerReady:n.controllerReady,element:n.node,elementName:s.elementName,loadingCount:n.loadingCount,state:s.state,onOnCreated:s.onElementCreated,onOnEvent:s.onEvent},null,40,["controllerReady","element","elementName","loadingCount","state","onOnCreated","onOnEvent"])}const mn=Object.freeze(Object.defineProperty({__proto__:null,default:m(dn,[["render",un],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Element.vue"]])},Symbol.toStringTag,{value:"Module"}));return {QWidget:w};Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
;(function(y,r){
|
|
3
|
+
if (typeof exports == "object" && typeof module < "u") { // for commonjs
|
|
4
|
+
const returns = {}
|
|
5
|
+
r(returns, require("vue"));
|
|
6
|
+
module.exports = returns;
|
|
7
|
+
exports.QWidget = returns.QWidget;
|
|
8
|
+
}
|
|
9
|
+
else if (typeof define == "function" && define.amd) { // for amd
|
|
10
|
+
define(["exports", "vue"], r);
|
|
11
|
+
}
|
|
12
|
+
else { // for browser script tag
|
|
13
|
+
y = (typeof globalThis < "u") ? globalThis : y || self;
|
|
14
|
+
r(y.QWidget={},y.Vue);
|
|
15
|
+
}
|
|
16
|
+
})(this,function(y,r){"use strict";const m=(t,e)=>{const n=t.__vccOpts||t;for(const[o,i]of e)n[o]=i;return n},P={name:"q-widget-q-modal",props:{modal:{type:Object,default:()=>({})}},data(){return{}},computed:{body(){return this.modal.body},css(){return this.modal.css},countdown(){return this.modal.countdown},label(){return this.modal.label},model(){return this.modal.model},onCancel(){return this.modal.onCancel},onClose(){return this.modal.onClose},onConfirm(){return this.modal.onConfirm},title(){return this.modal.title}},methods:{onFinish(){this.modal.onFinish()},qForm(t){this.modal.qForm(t)}}},U={class:"q-widget-q-modal __modal"};function K(t,e,n,o,i,s){const l=r.resolveComponent("q-modal",!0);return r.openBlock(),r.createElementBlock("div",U,[r.createVNode(l,{body:s.body,countdown:s.countdown,css:s.css,label:s.label,model:s.model,onCancel:s.onCancel,onClose:s.onClose,onConfirm:s.onConfirm,title:s.title,onOnFinish:s.onFinish,onQForm:s.qForm},null,8,["body","countdown","css","label","model","onCancel","onClose","onConfirm","title","onOnFinish","onQForm"])])}const j=m(P,[["render",K],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/QModal.vue"]]);function I({controller:t,state:e,saveControllerState:n}){const{saveStateKeys:o=[]}=t,i=o.reduce((s,l)=>({...s,...S({keys:l.split("."),obj:e})}),{});return n({data:i})}function S({keys:t,obj:e}){const n=t.shift();return{[n]:t.length===0?e[n]:S({keys:t,obj:e[n]})}}function C({component:t,message:e,modalConfig:n={}}){const{countdown:o,label:i,title:s,canClose:l=!0}=n,a={body:[{customComponentName:"q-modal-region-tool-html",html:e}],countdown:o,label:i,onClose:l?()=>{t.modal=null}:null,title:s||"Error"};t.modal=a}class z{static exec({config:e,keys:n,permissions:o}){Array.isArray(e)||console.log("can not handle these buttons");const i=n.shift();return n.length!==0&&console.log(`can not handle ${n.join(".")}`),T({buttons:e,key:i,permissions:o})}}function T({buttons:t,key:e,permissions:n}){return t.map(o=>{if(W(e,o)){const i=o.permissions||[];return{...o,permissions:[...i,...n]}}return o})}function W(t,e){const{buttonType:n,id:o,label:i}=e;return t===o||t===i||t===n}class M{static exec({config:e,keys:n,permissions:o}){return b({layout:e,keys:n,permissions:o})}}function b({layout:t,keys:e,permissions:n}){const o=e[0],{children:i,permissions:s}=t;if(G(o,t)){if(e.shift(),e.length===0)return{...t,permissions:[...s||[],...n]};if(Array.isArray(i))return{...t,children:i.map(l=>b({layout:l,keys:[...e],permissions:n}))};console.log(`can not handle ${e.join(".")}`)}return Array.isArray(i)?{...t,children:i.map(l=>b({layout:l,keys:[...e],permissions:n}))}:t}function G(t,e){const{id:n,name:o}=e;return t===n||t===o}class J{static exec({config:e,keys:n,permissions:o}){const i=n.shift();let s=null;switch(i){case"buttons":{s=z;break}case"layout":{s=M;break}default:{s=null;break}}return!s||typeof s.exec!="function"?e:{...e,[i]:s.exec({config:e[i],keys:[...n],permissions:o})}}}class Y{static exec({config:e,keys:n,permissions:o}){Array.isArray(e)||console.log("can not handle these actions");const i=n.shift();return n.length!==0&&console.log(`can not handle ${n.join(".")}`),X({actions:e,key:i,permissions:o})}}function X({actions:t,key:e,permissions:n}){return t.map(o=>{if(Z(e,o)){const i=o.permissions||[];return{...o,permissions:[...i,...n]}}return o})}function Z(t,e){const{id:n,label:o}=e;return t===n||t===o}class ee{static exec({config:e,keys:n,permissions:o}){const i=n.shift();switch(i){case"actions":return{...e,actions:te({actions:e[i],keys:n,permissions:o})};default:return e}}}function te({actions:t,keys:e,permissions:n}){Array.isArray(t)||console.log("can not handle these actions");const o=e.shift();return e.length!==0?(console.log(`can not handle ${e.join(".")}`),t):t.map(i=>{if(ne(o,i)){const s=i.permissions||[];return{...i,permissions:[...s,...n]}}return i})}function ne(t,e){const{id:n,label:o}=e;return t===n||t===o}class se{static exec({config:e,keys:n,permissions:o}){return Array.isArray(e)||console.log("can not handle these actions"),H({headers:e,keys:n,permissions:o})}}function H({headers:t,keys:e,permissions:n}){const o=e.shift();return t.map(i=>{if(re(o,i)){const{permissions:s,children:l}=i;return e.length!==0?Array.isArray(l)&&l.length>0?{...i,children:H({headers:l,keys:e,permissions:n})}:(console.log(`can not handle ${e.join(".")}`),i):{...i,permissions:[...s||[],...n]}}return i})}function re(t,e){const{id:n,label:o,key:i}=e;return t===n||t===o||t===i}class ie{static exec({config:e,keys:n,permissions:o}){const i=n.shift();let s=null;switch(i){case"actions":{s=Y;break}case"bulkAction":{s=ee;break}case"headers":{s=se;break}default:{s=null;break}}return!s||typeof s.exec!="function"?e:{...e,[i]:s.exec({config:e[i],keys:[...n],permissions:o})}}}const oe={ElementQForm:J,ElementQList:ie};function le({config:t,configPermissions:e=[],type:n}){return e.reduce((i,s)=>{const l=ae(n);if(!l||typeof l.exec!="function")return console.log("no config handler"),i;const{key:a,value:u}=s;return l.exec({config:i,keys:a.split("."),permissions:u})},t)}function ae(t){return oe[t]||null}function N(t){return`${t}-${Math.floor(Math.random()*1e9)}`}class q{constructor(e={}){this.css=e.css,this.configType="Config"}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function ce(t,e){const{button:n,klass:o}=t,{element:i}=e,s=i.getState()||{},{formData:l={}}=s;class a extends o{constructor(c){super(c),this.hidden=c.hidden||!1,this.permissionResult=c.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden&&super.isValid}static init(c,d){if(c instanceof a)return c;const g=c.permissions?d.permissionHandler(c.permissions,l):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},_=new a({...c,permissionResult:g});return _.isValid?_:null}permissionResultHandler(c){const{event:d,isAllowCreate:g,isAllowRead:_,isAllowUpdate:E,isAllowDelete:B}=c;d?typeof this[d]=="function"?this[d]({val:!0}):console.log(`do not have the event ${d}`):g&&_&&E&&B||this.setHidden({val:!0})}setDisabled({val:c}){this.disabled=c}setHidden({val:c}){this.hidden=c}}return a.init(n,e)}function de(t,e){const{layout:n,klass:o}=t,{element:i}=e,s=i.getState()||{},{formData:l={}}=s;class a extends o{constructor(d){super(d),this.permissionResult=d.permissions?e.permissionHandler(d.permissions,l):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},this.permissionResultHandler(this.permissionResult)}permissionResultHandler(d){const{event:g,isAllowCreate:_,isAllowRead:E,isAllowUpdate:B,isAllowDelete:Cn}=d;g?typeof this[g]=="function"?this[g]({val:!0}):console.log(`do not have the event ${g}`):E?B||this.setPreview({val:!0}):this.setHidden({val:!0}),Array.isArray(this.children)&&this.children.forEach(mn=>{mn.permissionResultHandler(d)})}setDecoratorDisabled({val:d}){this.setDisabled({val:d})}setDecoratorHidden({val:d}){this.setHidden({val:d})}setDecoratorPreview({val:d}){this.setPreview({val:d})}}return a.init(n)}function ue(t){return e=>{const{type:n}=e;switch(n){case"button":return ce(e,t);case"node":return de(e,t);default:return null}}}class A extends q{constructor(e={}){super(e),this.configType="ElementQFormConfig",this.buttons=e.buttons,this.css=e.css||{},this.disabledForm=e.disabledForm||!1,this.eventName=e.eventName||{},this.formHandler=ue(e.helpers),this.layout=e.layout,this.previewForm=e.previewForm||!1,this.updateLayoutConfigs=e.updateLayoutConfigs||[]}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function me({helpers:t}){const{element:e}=t,{getClasses:n}=e.getHandlers(),{Cell:o}=t.qGrid;class i extends o{constructor(l){super(l),typeof l.hidden=="function"?this.permissionHidden=l.hidden(this.item.item,this):this.permissionHidden=l.hidden||!1,this.permissionResult=l.permissionResult,this.permissionResultHandler(this.permissionResult,l.customComponentName)}get isValid(){return this.permissionHidden===!1}static init(l){const{permissions:a}=l,u=a?t.permissionHandler(a):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},c=new this({...l,permissionResult:u});return c.isValid?c:null}permissionResultHandler(l,a){const{event:u,isAllowCreate:c,isAllowRead:d,isAllowUpdate:g,isAllowDelete:_}=l;if(u){typeof this[u]=="function"?this[u]({val:!0}):console.log(`do not have the event ${u}`);return}(!(a==="q-grid-body-row-cell-button")&&!d||!(c&&d&&g&&_))&&this.setHidden({val:!0})}setHidden({val:l}){this.permissionHidden=l}}return typeof n!="function"?{Cell:i}:n({helpers:{Cell:i,...t}})}class L extends q{constructor(e={}){super(e),this.configType="ElementQGridConfig",this.classes=me({helpers:e.helpers}),this.converter=he({helpers:e.helpers}),this.eventName=e.eventName,this.layout=e.layout,this.fillLastRow=e.fillLastRow,this.placeholder=e.placeholder,this.urlDelegate=e.urlDelegate}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function he({helpers:t}){const{element:e}=t,{converter:n}=e.getHandlers();if(typeof n!="function")return i=>i;const{QItem:o}=t.qGrid;return n({helpers:{QItem:o,...t}})}function fe({helpers:t}){const{QListBulkButton:e}=t.qList,{getValidation:n}=t.qUtilities;class o extends e{constructor(s){super(s),this.hidden=s.hidden||!1,this.permissionResult=s.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden}static init(s,l){if(s instanceof o)return s;const{restriction:a,permissions:u}=s,c=l.controller.getState();if(!n({rule:a,data:c}))return null;const d=u?l.permissionHandler(u):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},g=new o({...s,permissionResult:d});return g.isValid?g:null}static initFromArray(s,l){return Array.isArray(s)?s.map(a=>this.init(a,l)):[]}static initOnlyValidFromArray(s,l){return this.initFromArray(s,l).filter(a=>a)}permissionResultHandler(s){const{event:l,isAllowCreate:a,isAllowRead:u,isAllowUpdate:c,isAllowDelete:d}=s;l?typeof this[l]=="function"?this[l]({val:!0}):console.log(`do not have the event ${l}`):a&&u&&c&&d||this.setHidden({val:!0})}setHidden({val:s}){this.hidden=s}}return o}function ge({helpers:t}){const{QListButton:e}=t.qList;class n extends e{constructor(i){super(i),this.endpoint=O(i.endpoint,i.qRow),this.httpMethod=i.httpMethod,this.hidden=i.hidden||!1,this.permissionResult=i.permissionResult,this.permissionResultHandler(this.permissionResult),this.url=O(i.url,i.qRow)}get isValid(){return!this.hidden&&super.isValid}static init(i,s){if(i instanceof n)return i;const l=i.permissions?s.permissionHandler(i.permissions,i.qRow.get()):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=new n({...i,permissionResult:l});return a.isValid?a:null}static initFromArray(i,s){return Array.isArray(i)?i.map(l=>this.init(l,s)):[]}static initOnlyValidFromArray(i,s){return this.initFromArray(i,s).filter(l=>l)}permissionResultHandler(i){const{event:s,isAllowCreate:l,isAllowRead:a,isAllowUpdate:u,isAllowDelete:c}=i;s?typeof this[s]=="function"?this[s]({val:!0}):console.log(`do not have the event ${s}`):l&&a&&u&&c||this.setHidden({val:!0})}setHidden({val:i}){this.hidden=i}}return n}function O(t,e){if(!t)return"";const n=/\$\{(.+?)\}/g;return t.replace(n,(o,i)=>e.get(i.trim()))}function pe(){class t{constructor(n){Object.keys(n).forEach(o=>{this[o]=n[o]}),this.hidden=n.hidden||!1,this.permissionResult=n.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!this.hidden}static init(n,o){if(n instanceof t)return n;const{children:i,permissions:s}=n,l=s?o.permissionHandler(s):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=new t({...n,children:Array.isArray(i)?this.initOnlyValidFromArray(i,o):null,permissionResult:l});return a.isValid?a:null}static initFromArray(n,o){return Array.isArray(n)?n.map(i=>this.init(i,o)):[]}static initOnlyValidFromArray(n,o){return this.initFromArray(n,o).filter(i=>i)}permissionResultHandler(n){const{event:o,isAllowCreate:i,isAllowRead:s,isAllowUpdate:l,isAllowDelete:a}=n;o?typeof this[o]=="function"?this[o]({val:!0}):console.log(`do not have the event ${o}`):s||this.setHidden({val:!0})}setHidden({val:n}){this.hidden=n}}return t}class x extends q{constructor(e={}){super(e),this.configType="ElementQListConfig",this.bulkAction=ye({bulkAction:e.bulkAction,helpers:e.helpers}),this.converter=Ce({actions:e.actions,helpers:e.helpers}),this.css=e.css,this.eventName=e.eventName,this.headers=_e({headers:e.headers,helpers:e.helpers}),this.listStyle=e.listStyle||"q-list-table",this.listShowFooter=e.showFooter||!1,this.listSortBys=e.sortBys,this.noDataMessage=e.noDataMessage}get isValid(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}}function ye({bulkAction:t={},helpers:e}){const n=fe({helpers:e});return{...t,actions:n.initOnlyValidFromArray(t.actions,e)}}function _e({headers:t,helpers:e}){return pe().initOnlyValidFromArray(t,e)}function Ce({actions:t,helpers:e}){const{QRow:n}=e.qList,i={QListButton:ge({helpers:e}),QRow:n,...e},{element:s}=i,{converter:l}=s.getHandlers();return typeof l!="function"?a=>a:l({actions:t,helpers:i})}class R{constructor(e){this.permissionHandler=ve,Object.keys(e).forEach(n=>{this[n]=e[n]})}static init(e){const n=new R(e);return n.isValid?n:null}get isValid(){return f(this.eventHandler)&&f(this.getControllerState)&&f(this.getControllerUniqueKey)&&f(this.saveControllerState)&&f(this.startLoading)&&f(this.stopLoading)&&this.qForm&&f(this.qForm.NodeHelper)&&this.qGrid&&f(this.qGrid.QItem)&&f(this.qGrid.Cell)&&this.qList&&f(this.qList.QRow)&&f(this.qList.QListBulkButton)&&f(this.qList.QListButton)&&this.qUtilities&&f(this.qUtilities.convertString)&&f(this.qUtilities.getValidation)&&f(this.qUtilities.lodash)}}function f(t){return typeof t=="function"}function ve(){return{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0}}class ${constructor(e={}){this.id=e.id||N("node"),this.css=e.css||{},this.hidden=e.hidden||!1,this.nodeType="Node",this.permissionResult=e.permissionResult,this.permissionResultHandler(this.permissionResult)}get isValid(){return!!this.id&&!this.hidden}get isCreated(){return!!this}static init(e){const n=new this(e);return n.isValid?n:null}getElementState(){return this}getType(){return this.type}isExist(e){const{name:n}=this;return!!e.find(o=>n&&o.name===n)}permissionResultHandler(e){const{event:n,isAllowCreate:o,isAllowRead:i,isAllowUpdate:s,isAllowDelete:l}=e;n?typeof this[n]=="function"?this[n]({val:!0}):console.log(`do not have the event ${n}`):o&&i&&s&&l||this.setHidden({val:!0})}setHidden({val:e}){this.hidden=e}updateElementState(e){return this}}let v=class extends ${constructor(e={}){super(e),this.children=e.children||[],this.nodeType="Container"}getChildren(){return this.children}getValidChildren(){return this.getChildren().filter(e=>e)}getElementState(){return this.getValidChildren().reduce((e,n)=>({...e,...n.getElementState()}),{})}updateElementState(e){return this.getValidChildren().forEach(n=>n.updateElementState(e)),this}};class ke extends v{constructor(e={}){super(e),this.nodeType="ContainerBox"}}class we extends v{constructor(e={}){super(e),this.nodeType="ContainerColumn"}}class Ee extends v{constructor(e={}){super(e),this.nodeType="ContainerHeaderSticky"}}class be extends v{constructor(e={}){super(e),this.nodeType="ContainerRow"}}const qe={ContainerBox:ke,ContainerColumn:we,ContainerHeaderSticky:Ee,ContainerRow:be};let p=class extends ${constructor(e={}){super(e),this.configPermissions=e.configPermissions,this.name=e.name,this.nodeType=e.nodeType||"Element",this.state={},this.configHandler(e.config)}get isCreated(){return super.isCreated&&!!this.component}get isValid(){return super.isValid&&!!this.name}get hasConfigPermissions(){return!!this.configPermissions}get stateName(){return{...this.defaultStateName,...this.config.stateName}}addComponent(e){this.component=e}configHandler(e={}){this.hasConfigPermissions?this.config=le({config:e,configPermissions:this.configPermissions,type:this.nodeType}):this.config=e}getConfig(){return this.config||{}}getComponent(){return this.component}getElementName(){return this.name}getHandlers(){const e=this.getElementName(),{elementHandlers:n={}}=this.state;return n[e]||{}}getState(){return this.state}getElementState(){return Re(this.state,this.stateName)}onCreated({component:e,payload:n={}}){return this.addComponent(e),this.updateState(n),this}update(e){this.updateElementState(e)}updateState(e){this.state={...this.state,...e}}updateElementState(e){const n=$e(e,this.stateName);return this.updateState(n),this}};function Re(t,e){return Object.keys(e).reduce((n,o)=>{const i=e[o],s=t[o];return{...n,[i]:s}},{})}function $e(t,e){return Object.keys(e).reduce((n,o)=>{const i=e[o],s=t[i];return delete n[i],{...n,[o]:s}},t)}class Be extends p{constructor(e={}){super(e)}}class Se extends p{constructor(e={}){super(e),this.defaultStateName={axios:"axios",formData:"formData",formErrors:"formErrors",formNode:"formNode",pageKey:"pageKey",qForm:"qForm"}}getConfig(e){let n=this.config||{};if(this.state.qForm){const{lodash:o}=e.qUtilities,i=He(this.state.qForm);n=o.mergeWith(i,n||{},Q)}return typeof A=="function"?A.init({...n,helpers:{...e,element:this}}):{}}getFormCustomizer(){const{formCustomizer:e}=this.getHandlers();return typeof e=="function"?e:Q}}function Q(t,e){if(Array.isArray(t))return e||null;if(typeof e=="number"||typeof e=="boolean")return e;if(!e)return null}function He(t){const{buttons:e=[],layout:n={},trees:o=[]}=t||{};return{buttons:e,layout:n,trees:o}}class Ne extends p{constructor(e={}){super(e),this.defaultStateName={gridItems:"gridItems"}}getConfig(e){let n=this.config||{};return this.state.qGrid&&(n={...this.state.qGrid,...n}),typeof L=="function"?L.init({...n,helpers:{...e,element:this}}):{}}}class Ae extends p{constructor(e={}){super(e)}}class Le extends p{constructor(e={}){super(e)}}class Oe extends p{constructor(e={}){super(e)}}class xe extends p{constructor(e={}){super(e),this.defaultStateName={qList:"qList",qSorterKeys:"qSorterKeys",rows:"rows"}}getConfig(e){let n=this.config||{};return this.state.qList&&(n={...Qe(this.state.qList),...n}),typeof x=="function"?x.init({...n,helpers:{...e,element:this}}):{}}}function Qe(t){return{...t}}class De extends p{constructor(e={}){super(e),this.defaultStateName={currentPage:"currentPage",currentPageSize:"currentPageSize",totalRecords:"totalRecords"}}}class Ve extends p{constructor(e={}){super(e),this.defaultStateName={active:"active",tabLayout:"tabLayout"}}}const h={...qe,...{ElementQButton:Be,ElementQForm:Se,ElementQGrid:Ne,ElementQHtml:Ae,ElementQImport:Le,ElementQLabel:Oe,ElementQList:xe,ElementQPaginator:De,ElementQTab:Ve},Container:v,Element:p,Node:$};class Fe{static init({layout:e={},controllerHelpers:n={}}={}){return D({layout:e,nodes:[],controllerHelpers:n})}}function D({layout:t,nodes:e,controllerHelpers:n}){if(t instanceof h.Node)return t;const o={...t};return Array.isArray(o.children)&&(o.children=o.children.map(i=>D({layout:i,nodes:e,controllerHelpers:n}))),Pe(o,e,n)}function Pe(t,e,n){const{nodeType:o,permissions:i}=t||{};if(typeof h[o]=="function"){const{permissionHandler:s}=n,l=i?s(i):{isAllowCreate:!0,isAllowRead:!0,isAllowUpdate:!0,isAllowDelete:!0},a=h[o].init({...t,permissionResult:l});return a?a.isExist(e)?null:(e.push(a),a):null}return null}class Ue{constructor(e={}){this.css=e.css||{},this.controllerHelpers=e.controllerHelpers,this.eventHandlers=e.eventHandlers||{},this.id=e.id||N("controller"),this.initialState=e.initialState,this.name=e.name,this.saveStateKeys=e.saveStateKeys||[],this.setLayout(e.layout,e.controllerHelpers)}get isValid(){return!!this.id&&!!this.layout}static init(e){const n=new this(e);return n.isValid?n:null}getElements(){return this.elements||[]}getElementByElementName(e){return this.elements.find(n=>n.getElementName()===e)}getState(){return{...this.getControllerState(),...this.layout.getElementState()}}getControllerState(){return this.state}setLayout(e,n){this.layout=Fe.init({layout:e,controllerHelpers:n})}setElements(e){this.elements=e}updateState(e){this.state={...this.state,...e},this.layout.updateElementState(this.state)}}const k={beforeCreate(){this.$options.components={...this.$options.components,QWidgetContainersContainer:r.defineAsyncComponent(()=>Promise.resolve().then(()=>gt)),QWidgetElementsElement:r.defineAsyncComponent(()=>Promise.resolve().then(()=>un))}},methods:{currentContainer(t){return t instanceof h.Container?"q-widget-containers-container":t instanceof h.Element?"q-widget-elements-element":""}}},Ke={name:"q-widget-controller",components:{QModal:j},mixins:[k],provide(){return{helpers:{...this.controllerHelpers,controller:this.controller}}},props:{controller:{type:Object,default:()=>({})}},data(){return{isReady:!1,loadingCount:0,modal:null,renderKey:0}},computed:{controllerHelpers(){return this.controller.controllerHelpers},eventHandlers(){return this.controller.eventHandlers||{}},initControllerState(){return this.controller.initialState},node(){return this.controller.layout}},created(){this.init()},methods:{async init(){try{const{getControllerState:t}=this.controllerHelpers;let e=this.initControllerState;typeof t=="function"&&(e=await t({state:e}));const{onCreated:n}=this.eventHandlers;n&&(e=await this.eventHandler({state:e,event:n})),this.updateState(e)}catch(t){C({component:this,message:t.message})}finally{this.isReady=!0,this.reRenderElements()}},async callbackEmit({event:t,payload:e}){console.log("callbackEmit",t,e)},async callbackSubscribe(t,{event:e,payload:n,cb:o}){if(t===this.controllerHelpers.getControllerUniqueKey())try{const{key:i}=e,{controllerSubscribed:s}=this.eventHandlers,l=s[i];let a=this.controller.getState();l&&(a=await this.eventHandler({state:{...a,eventPayload:n},event:l})),typeof o=="function"&&await o({event:e,payload:a})}catch(i){C({component:this,message:i.message})}},async eventHandler({event:t,state:e}){let n=e;const o=je({event:t}),i=this.getLoadingFunctions({scope:o});try{if(V({loadingFunctions:i,action:"start"}),t){const s={body:{...e},controller:this.controller,component:this,controllerHelpers:{...this.controllerHelpers,callbackEmit:this.callbackEmit,callbackSubscribe:this.callbackSubscribe,eventHandler:this.eventHandler,reRenderElements:this.reRenderElements,runEventChains:this.eventHandler,showError:C,updateState:this.updateState}},{eventHandler:l}=this.controllerHelpers,a=await l({event:t,payload:s});n={...n,...a}}return console.log(n),n}catch(s){throw new Error(s.message)}finally{V({loadingFunctions:i,action:"stop"})}},getKey(t,e){return`${this.renderKey}-${t}-${e} `},getLoadingFunctions({scope:t=""}){const{startLoading:e,stopLoading:n}=this.controllerHelpers;switch(t){case"full":return{startLoading:e,stopLoading:n};case"none":return null;case"self":return{startLoading:this.startSelfLoading,stopLoading:this.stopSelfLoading};default:return{startLoading:e,stopLoading:n}}},async onEvent(t){try{const{eventName:e,element:n,payload:o}=t,{elementEvents:i={}}=this.eventHandlers,s=i[e];s?await this.eventHandler({state:{...this.controller.getState(),eventPayload:o,eventElement:n},event:s}):console.log(`can not find the event ${e}`)}catch(e){C({component:this,message:e.message,modalConfig:{title:"提示"}})}},async onElementCreated(t){try{this.controller.setElements(t);const e=this.eventHandlers.onElementCreated;e&&await this.eventHandler({state:this.controller.getState(),event:e})}catch(e){C({component:this,message:e.message})}},reRenderElements(){this.renderKey+=1},startSelfLoading(){this.loadingCount+=1},stopSelfLoading(){this.loadingCount-=1},updateState(t){this.controller.updateState(t);const{saveControllerState:e}=this.controllerHelpers;typeof e=="function"&&I({controller:this.controller,state:t,saveControllerState:e})}}};function je({event:t={}}={}){return t.scope||"full"}function V({loadingFunctions:t,action:e}){if(t){const{startLoading:n,stopLoading:o}=t;switch(e){case"start":{n();break}case"stop":{o();break}}}}const Ie={class:"q-widget-controller __controller"};function ze(t,e,n,o,i,s){const l=r.resolveComponent("q-modal");return r.openBlock(),r.createElementBlock("div",Ie,[(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(s.node)),{key:i.renderKey,controllerReady:i.isReady,node:s.node,loadingCount:i.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"])),i.modal?(r.openBlock(),r.createBlock(l,{key:s.getKey("modal",i.modal),modal:i.modal},null,8,["modal"])):r.createCommentVNode("v-if",!0)])}const Te={name:"q-widget",components:{QWidgetController:m(Ke,[["render",ze],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Controller.vue"]])},props:{content:{type:Object,default:()=>({})},contentHelpers:{type:Object,default:()=>({})},controller:{type:Object,default:()=>null},controllerHelpers:{type:Object,default:()=>null}},data(){return{controllerHelpersInstence:null,controllerInstence:null,error:null}},computed:{hasError(){return this.error}},created(){this.init()},methods:{init(){try{const t=this.controllerHelpers||this.contentHelpers;if(this.controllerHelpersInstence=R.init(t),!this.controllerHelpersInstence)throw new Error("invalid controller helpers");const e=this.controller||this.content;if(this.controllerInstence=Ue.init({...e,controllerHelpers:this.controllerHelpersInstence}),!this.controllerInstence)throw new Error("invalid controller")}catch(t){this.error=t.message||"invalid controller"}}}},We={class:"q-widget"},Me={key:1,class:"__error"};function Ge(t,e,n,o,i,s){const l=r.resolveComponent("q-widget-controller");return r.openBlock(),r.createElementBlock("div",We,[s.hasError?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createBlock(l,{key:0,controller:i.controllerInstence},null,8,["controller"])),s.hasError?(r.openBlock(),r.createElementBlock("div",Me,r.toDisplayString(i.error),1)):r.createCommentVNode("v-if",!0)])}const w=m(Te,[["render",Ge],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/QWidget.vue"]]);function Je(t){t.component(w.name,w)}w.install=Je;const Ye={name:"q-widget-containers-box",mixins:[k],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},Xe={class:"q-widget-containers-box __outer-box"},Ze={class:"__inner-box"};function et(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",Xe,[r.createElementVNode("div",Ze,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("box",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])])}const tt=m(Ye,[["render",et],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Box.vue"]]),nt={name:"q-widget-containers-column",mixins:[k],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},st={class:"q-widget-containers-column __column"};function rt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",st,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("cloumn",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const it=m(nt,[["render",rt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Column.vue"]]),ot={name:"q-widget-containers-header-sticky",mixins:[k],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},lt={class:"q-widget-containers-header-sticky __header __sticky --sticky-top"};function at(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",lt,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("header-sticky",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const ct=m(ot,[["render",at],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/HeaderSticky.vue"]]),dt={name:"q-widget-containers-row",mixins:[k],props:{controllerReady:{type:Boolean,default:!1},getKey:{type:Function,default:()=>null},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{children(){return this.node.children||[]}},methods:{onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){this.$emit("onElementCreated",t)}}},ut={class:"q-widget-containers-row __row"};function mt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",ut,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(s.children,(l,a)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(t.currentContainer(l)),{key:n.getKey("row",a),controllerReady:n.controllerReady,node:l,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["controllerReady","node","loadingCount","onOnEvent","onOnElementCreated"]))),128))])}const ht={name:"q-widget-containers-container",components:{QWidgetBoxContainer:tt,QWidgetColumnContainer:it,QWidgetHeaderStickyContainer:ct,QWidgetRowContainer:m(dt,[["render",mt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Row.vue"]])},props:{controllerReady:{type:Boolean,default:!1},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],data(){return{createdChildren:[]}},computed:{children(){return this.node.getValidChildren()||[]}},methods:{factoryInit(t){return t instanceof h.ContainerBox?"q-widget-box-container":t instanceof h.ContainerColumn?"q-widget-column-container":t instanceof h.ContainerHeaderSticky?"q-widget-header-sticky-container":t instanceof h.ContainerRow?"q-widget-row-container":""},getClass(t){return t.css||""},getKey(t,e){return`${t}-${e}`},onEvent(t){this.$emit("onEvent",t)},onElementCreated(t){if(this.createdChildren.push(t),this.createdChildren.length===this.children.length){const e=this.createdChildren.reduce((n,o)=>[...n,...o],[]);this.$emit("onElementCreated",e)}}}};function ft(t,e,n,o,i,s){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.factoryInit(n.node)),{class:r.normalizeClass(s.getClass(n.node)),controllerReady:n.controllerReady,getKey:s.getKey,node:n.node,loadingCount:n.loadingCount,onOnEvent:s.onEvent,onOnElementCreated:s.onElementCreated},null,40,["class","controllerReady","getKey","node","loadingCount","onOnEvent","onOnElementCreated"])}const gt=Object.freeze(Object.defineProperty({__proto__:null,default:m(ht,[["render",ft],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Containers/Container.vue"]])},Symbol.toStringTag,{value:"Module"})),pt={name:"q-widget-elements-adapters-q-button",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],computed:{$button(){return this.$config.button||{}},$config(){return this.element.getConfig()},$event(){return this.$button.event||"onButtonClick"},$url(){return this.$button.url||""},button(){return{...this.$button,url:this.url}},url(){const t=this.$config.patternMatch||/\$\{(.+?)\}/g,{convertString:e}=this.helpers.qUtilities;return e(this.$url,t,this.state)},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onClick(t){const e={eventName:this.$event,payload:t};this.$emit("onEvent",e)}}},yt={key:1};function _t(t,e,n,o,i,s){const l=r.resolveComponent("q-button",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-button q-widget-adapters-q-button __element __adapter __button __flex",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,class:"q-button",button:s.button,onClick:s.onClick,onOnChange:s.onClick,onUpload:s.onClick},null,8,["button","onClick","onOnChange","onUpload"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",yt,e[0]||(e[0]=[r.createElementVNode("div",{class:"button __loading-box"},[r.createElementVNode("div",{class:"skeleton"},[r.createElementVNode("div",{class:"skeleton__tr"},[r.createElementVNode("div",{class:"skeleton__td"})])])],-1)])))],2)}const Ct=m(pt,[["render",_t],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QButton.vue"]]),vt={name:"q-widget-elements-adapters-q-form",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{formErrors:[],formValue:null,initPageKey:"",isFormReady:!1}},computed:{$buttons(){return this.$config.buttons||[]},$config(){return this.element.getConfig(this.helpers)},$disabledForm(){return this.$config.disabledForm||!1},$eventName(){return this.$config.eventName||{}},$formCss(){return this.$config.css||{}},$formHandler(){return this.$config.formHandler},$layout(){return this.$config.layout},$previewForm(){return this.$config.previewForm||!1},axios(){return this.state.axios},elementHandlers(){return this.element.getHandlers()},customizer(){return this.element.getFormCustomizer()},displayLayout(){return this.getLayout()},formData(){return this.state.formData},isReady(){return this.loadingCount<=0&&this.controllerReady},pageKey(){return this.state.pageKey||this.initPageKey||""}},created(){this.controllerReady&&this.init()},methods:{init(){const{lodash:t}=this.helpers.qUtilities;this.formValue=t.cloneDeep(this.formData),this.isFormReady=!0},getClass(t){return t.css||""},getLayout(){const{NodeHelper:t}=this.helpers.qForm,{convertString:e,getValidation:n}=this.helpers.qUtilities;return wt({config:this.$config,convertString:e,getValidation:n,layout:this.$layout,NodeHelper:t,state:this.state})},onChange(t){const{node:e}=t;this.formErrors=[];const n=e.save({errors:this.formErrors}),{lodash:o}=this.helpers.qUtilities,i=o.mergeWith(this.formValue,n,this.customizer),l={eventName:this.$eventName.onFormChange||"onFormChange",payload:{...t,formData:i,errors:this.formErrors}};this.$emit("onEvent",l)},onClick(t){const{value:e,event:n}=t,{lodash:o}=this.helpers.qUtilities,i=o.mergeWith(this.formValue,e,this.customizer),s={eventName:n,payload:{...t,errors:this.formErrors,formData:i}};this.$emit("onEvent",s)},onCreated(t){const{pageKey:e,node:n}=t;this.initPageKey=e;const{afterSave:o}=this.elementHandlers;typeof o=="function"&&n.subscribe("afterSave",o({node:n,state:this.state})),this.formErrors=[],n.save({errors:this.formErrors}),this.element.onCreated({component:this,payload:{...t,formErrors:this.formErrors,formNode:n,pageKey:e}}),this.$emit("onCreated")}}};function kt(t,e,n,o){const i=/['"]\$\{(.+?)\}['"]/g;return JSON.parse(o(JSON.stringify(t),i,n))}function wt({config:t={},convertString:e,getValidation:n,layout:o,NodeHelper:i,state:s}){const l=Et({config:t,getValidation:n,layout:o,NodeHelper:i,state:s});return kt(l,t,s,e)}function Et({config:t={},getValidation:e,layout:n,NodeHelper:o,state:i}){let s=n;const{updateLayoutConfigs:l=[]}=t;return typeof o.updateNode=="function"&&l.forEach(a=>{const{key:u,value:c,type:d,restriction:g}=a;e({rule:g,data:i})&&(s=o.updateNode({keys:u.split("."),value:c,layout:s,type:d}))}),s}const bt={key:0,class:"__form __flex"},qt={key:1};function Rt(t,e,n,o,i,s){const l=r.resolveComponent("q-form",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-form q-widget-adapters-q-form __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createElementBlock("div",bt,[i.isFormReady?(r.openBlock(),r.createBlock(l,{key:0,axios:s.axios,buttons:s.$buttons,css:s.$formCss,disabledForm:s.$disabledForm,formHandler:s.$formHandler,layout:s.displayLayout,pageKey:s.pageKey,previewForm:s.$previewForm,value:i.formValue,onOnClick:s.onClick,onOnChange:s.onChange,onOnCreated:s.onCreated},null,8,["axios","buttons","css","disabledForm","formHandler","layout","pageKey","previewForm","value","onOnClick","onOnChange","onOnCreated"])):r.createCommentVNode("v-if",!0)])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",qt,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const $t=m(vt,[["render",Rt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QForm.vue"]]),Bt={name:"q-widget-elements-adapters-q-grid",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{itemsData:[]}},computed:{$cellHandler(){return this.$config.cellHandler},$classes(){return this.$config.classes},$config(){return this.element.getConfig(this.helpers)},$converter(){return this.$config.converter},$eventName(){return this.$config.eventName||{}},$fillLastRow(){return this.$config.fillLastRow||!1},$gridCss(){return this.$config.css||""},$placeholder(){return this.$config.placeholder||null},$urlDelegate(){return this.$config.urlDelegate||""},gridItems(){return this.state.gridItems},isReady(){return this.loadingCount<=0&&this.controllerReady},layout(){return this.$config.layout}},created(){this.controllerReady&&this.init()},methods:{init(){this.itemsData=this.gridItems.map(this.$converter),this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onClickGridItem(t){const n={eventName:this.$eventName.onClickGridItem||"onClickGridItem",payload:t};this.$emit("onEvent",n)},onButtonClick(t){const n={eventName:this.$eventName.onClick||"onClick",payload:t};this.$emit("onEvent",n)}}},St={key:1};function Ht(t,e,n,o,i,s){const l=r.resolveComponent("q-grid",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-grid q-widget-adapters-q-grid __element __adapter __grid",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,cellHandler:s.$cellHandler,classes:s.$classes,css:s.$gridCss,fillLastRow:s.$fillLastRow,items:i.itemsData,layout:s.layout,placeholder:s.$placeholder,urlDelegate:s.$urlDelegate,onOnClick:s.onButtonClick,onOnClickGridItem:s.onClickGridItem},null,8,["cellHandler","classes","css","fillLastRow","items","layout","placeholder","urlDelegate","onOnClick","onOnClickGridItem"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",St," Loading "))],2)}const Nt=m(Bt,[["render",Ht],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QGrid.vue"]]),At={name:"q-widget-elements-adapters-q-html",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],computed:{$config(){return this.element.getConfig()},$html(){const t=this.$config.patternMatch||/\$\{(.+?)\}/g,{convertString:e}=this.helpers.qUtilities;return e(this.$config.html,t,this.state)},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""}}},Lt=["innerHTML"],Ot={key:1};function xt(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-html q-widget-adapters-q-html __element __adapter __html",s.getClass(n.element)])},[s.$html&&s.isReady?(r.openBlock(),r.createElementBlock("div",{key:0,class:"__html",innerHTML:s.$html},null,8,Lt)):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Ot,[r.createCommentVNode(" loading ")]))],2)}const Qt=m(At,[["render",xt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QHtml.vue"]]),Dt={name:"q-widget-elements-adapters-q-import",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],data(){return{elementState:{}}},computed:{$additionalListHeaders(){return this.$config.additionalListHeaders||[]},$config(){return this.element.getConfig()},$label(){return this.$config.label},$templateUrl(){return this.$config.templateUrl},elementHandlers(){return this.element.getHandlers()},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},formatRowData(t){return this.elementHandlers.formatRowData(t)},getClass(t){return t.css||""},setElementState(t){this.elementState={...this.elementState,...t}},showError(t={}){const{payload:e}=t;return this.elementHandlers.showError({payload:e,state:{...this.state,...this.elementState}})},showSuccess({payload:t}){return this.elementHandlers.showSuccess({payload:t,state:{...this.state,...this.elementState}})},validationHandler({payload:t}){return this.elementHandlers.validationHandler({payload:t,state:this.state,setElementState:this.setElementState})}}},Vt={key:1};function Ft(t,e,n,o,i,s){const l=r.resolveComponent("q-import",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-import q-widget-adapters-q-import __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createBlock(l,{key:0,additionalListHeaders:s.$additionalListHeaders,formatRowData:s.formatRowData,label:s.$label,showError:s.showError,showSuccess:s.showSuccess,templateUrl:s.$templateUrl,validationHandler:s.validationHandler},null,8,["additionalListHeaders","formatRowData","label","showError","showSuccess","templateUrl","validationHandler"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Vt,e[0]||(e[0]=[r.createElementVNode("div",{class:"import __loading-box"},[r.createElementVNode("div",{class:"skeleton"},[r.createElementVNode("div",{class:"skeleton__tr"},[r.createElementVNode("div",{class:"skeleton__td"})])])],-1)])))],2)}const Pt=m(Dt,[["render",Ft],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QImport.vue"]]),Ut={name:"q-widget-elements-adapters-q-label",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated"],computed:{$config(){return this.element.getConfig()},$label(){return this.$config.label||""},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""}}},Kt={key:0},jt={key:1};function It(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-label q-widget-adapters-q-label __element __label",s.getClass(n.element)])},[s.$label&&s.isReady?(r.openBlock(),r.createElementBlock("h2",Kt,r.toDisplayString(s.$label),1)):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",jt))],2)}const zt=m(Ut,[["render",It],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QLabel.vue"]]),Tt={name:"q-widget-elements-adapters-q-list",inject:["helpers"],props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{listRows:[],paginatorLayout:null,ready:!1}},computed:{$config(){return this.element.getConfig(this.helpers)},$converter(){return this.$config.converter},$css(){return this.$config.css},$eventName(){return this.$config.eventName||{}},$listBulkAction(){return this.$config.bulkAction||{}},$listHeaders(){return this.$config.headers||[]},$listSortBys(){return this.$config.listSortBys||[]},$listShowFooter(){return this.$config.listShowFooter||!1},$listStyle(){return this.$config.listStyle||"q-list-table"},$noDataMessage(){return this.$config.noDataMessage||""},isReady(){return this.loadingCount<=0&&this.controllerReady},listSortKeys(){return this.state.qSorterKeys||[]},rows(){return this.state.rows||[]}},created(){this.controllerReady&&this.init()},methods:{init(){this.listRows=this.rows.map(this.$converter),this.element.onCreated({component:this}),this.$emit("onCreated"),this.ready=!0},converter(t){return t},getClass(t){return t.css||""},onClickList(t){const{action:e,qRow:n,row:o}=t,{qListButtonType:i}=e,s={eventName:i||"onListClick",payload:t};this.$emit("onEvent",s)},onClickListBulk(t){const{action:e,qRows:n,rows:o}=t,{qListButtonType:i}=e,s={eventName:i||"onListClickBulk",payload:t};this.$emit("onEvent",s)},onListHeaderClick(t){const{key:e}=t.header;if(F(e,this.$listSortBys)){const o=Wt(this.listSortKeys,e),i=Mt(this.$listSortBys,o),s={eventName:this.$eventName.onListClickHeader||"onListClickHeader",payload:{qSorterKeys:o,qSorter:i}};this.$emit("onEvent",s)}}}};function F(t,e){return t?e.find(n=>{const{key:o}=n;return t===o}):null}function Wt(t,e){let n=!1;const o=t.map(i=>{const{by:s,direction:l}=i;if(e===s){n=!0;const a=typeof l<"u"?Number(l)===1?-1:Number(l)===-1?0:1:1;return{...i,direction:a}}return i});return n?o.filter(i=>i.direction!==0):[...t,{by:e,direction:1}]}function Mt(t,e){return e.reduce((n,o)=>{const{by:i,direction:s}=o,l=F(i,t),{value:a=[]}=l;if(!l)return n;const u=a.map(c=>({...c,direction:s}));return n.push(...u),n},[])}const Gt={key:1};function Jt(t,e,n,o,i,s){const l=r.resolveComponent("q-list",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-list q-widget-adapters-q-list __element __adapter __list",s.getClass(n.element)])},[s.isReady&&i.ready?(r.openBlock(),r.createBlock(l,{key:0,bulkAction:s.$listBulkAction,css:s.$css,headers:s.$listHeaders,listStyle:s.$listStyle,noDataMessage:s.$noDataMessage,rows:i.listRows,showFooter:s.$listShowFooter,sortBys:s.$listSortBys,sortStatus:s.listSortKeys,onClick:s.onClickList,onOnClickBulk:s.onClickListBulk,onOnListHeaderClick:s.onListHeaderClick},null,8,["bulkAction","css","headers","listStyle","noDataMessage","rows","showFooter","sortBys","sortStatus","onClick","onOnClickBulk","onOnListHeaderClick"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Gt,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__hr"></div><div class="skeleton__section skeleton__section--table"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div></div>',1)])))],2)}const Yt=m(Tt,[["render",Jt],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QList.vue"]]),Xt={name:"q-widget-elements-adapters-q-paginator",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{isPaginator:!1,paginatorLayout:null}},computed:{$config(){return this.element.getConfig()},$controlLabel(){return this.$config.controlLabel},$eventName(){return this.$config.eventName||{}},$paginatorLayout(){return this.$config.layout},$paginatorSizeOptions(){return this.$paginatorLayout.pageSizeOptions||[]},currentPage(){return this.state.currentPage},currentPageSize(){return this.state.currentPageSize},currentPageSizeOptionsIndex(){return this.$paginatorSizeOptions.indexOf(this.currentPageSize)},initPage(){return this.currentPage>=0?this.currentPage:this.$paginatorLayout.initPage},isReady(){return this.loadingCount<=0&&this.controllerReady},pageSizeOptionsIndex(){return this.currentPageSizeOptionsIndex>=0?this.currentPageSizeOptionsIndex:(this.onChangeRecPerPage(this.$paginatorSizeOptions[this.$paginatorLayout.pageSizeOptionsIdx],this.initPage),this.$paginatorLayout.pageSizeOptionsIndex)},totalRecords(){return this.state.totalRecords}},created(){this.controllerReady&&this.init()},mounted(){},methods:{init(){this.paginatorLayout={...this.$paginatorLayout,initPage:this.initPage,pageSizeOptionsIndex:this.pageSizeOptionsIndex},this.isPaginator=!0,this.element.onCreated({component:this}),this.$emit("onCreated")},getClass(t){return t.css||""},onChangePageIdx(t){if(t!==this.currentPage){const n={eventName:this.$eventName.onChangePageIdx||"onChangePageIdx",payload:{currentPage:t}};this.$emit("onEvent",n)}},onChangeRecPerPage(t,e){const o={eventName:this.$eventName.onChangeRecPerPage||"onChangeRecPerPage",payload:{currentPageSize:t,currentPage:e}};this.$emit("onEvent",o)}}},Zt={key:1};function en(t,e,n,o,i,s){const l=r.resolveComponent("q-paginator",!0);return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-paginator q-widget-adapters-q-paginator __element __adapter __paginator",s.getClass(n.element)])},[i.isPaginator&&s.isReady?(r.openBlock(),r.createBlock(l,{key:0,controlLabel:s.$controlLabel,layout:i.paginatorLayout,total:s.totalRecords,onChangeCurrentPage:s.onChangePageIdx,onChangePageSize:s.onChangeRecPerPage},null,8,["controlLabel","layout","total","onChangeCurrentPage","onChangePageSize"])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",Zt,e[0]||(e[0]=[r.createStaticVNode('<div class="paginator __loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const tn=m(Xt,[["render",en],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QPaginator.vue"]]),nn={name:"q-widget-elements-adapters-q-tab",props:{controllerReady:{type:Boolean,default:!1},element:{type:Object,default:()=>({})},elementName:{type:String,default:""},loadingCount:{type:Number,default:0},state:{type:Object,default:()=>({})}},emits:["onCreated","onEvent"],data(){return{active:{},renderKey:0,tabLayout:[]}},computed:{$config(){return this.element.getConfig()},$eventName(){return this.$config.eventName||{}},$tabLayout(){return this.$config.layout||[]},activeKey(){return this.active.key},isReady(){return this.loadingCount<=0&&this.controllerReady}},created(){this.controllerReady&&this.init()},methods:{init(){this.tabLayout=[...this.$tabLayout],this.active=this.state.active||this.tabLayout[0]||{},this.element.onCreated({component:this,payload:{tabLayout:this.tabLayout}}),this.$emit("onCreated")},getClass(t){return t.css||""},onChangeTab(t){const n={eventName:this.$eventName.onChangeTab||"onTabChange",payload:{active:t}};this.$emit("onEvent",n)}}},sn={key:0,class:"__tabs __flex"},rn=["href"],on=["onClick"],ln={key:1};function an(t,e,n,o,i,s){return r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass(["q-widget-elements-adapters-q-tab q-widget-adapters-q-tab __element __adapter",s.getClass(n.element)])},[s.isReady?(r.openBlock(),r.createElementBlock("div",sn,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.tabLayout,(l,a)=>(r.openBlock(),r.createElementBlock("div",{key:a,class:r.normalizeClass(["__pointer __tab",s.activeKey===l.key?"__active":""])},[l.url?(r.openBlock(),r.createElementBlock("a",{key:0,href:l.url},r.toDisplayString(l.label)+r.toDisplayString(Number.isNaN(Number(l.total))?"":`(${Number(l.total)})`),9,rn)):r.createCommentVNode("v-if",!0),l.url?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",{key:1,onClick:u=>s.onChangeTab(l)},r.toDisplayString(l.label)+r.toDisplayString(Number.isNaN(Number(l.total))?"":`(${Number(l.total)})`),9,on))],2))),128))])):r.createCommentVNode("v-if",!0),s.isReady?r.createCommentVNode("v-if",!0):(r.openBlock(),r.createElementBlock("div",ln,e[0]||(e[0]=[r.createStaticVNode('<div class="__loading-box"><div class="skeleton"><div class="skeleton__tr"><div class="skeleton__td"></div><div class="skeleton__td"></div><div class="skeleton__td"></div></div></div></div>',1)])))],2)}const cn={name:"q-widget-elements-element",components:{QWidgetQButtonElement:Ct,QWidgetQFormElement:$t,QWidgetQGridElement:Nt,QWidgetQHtmlElement:Qt,QWidgetQImportElement:Pt,QWidgetQLabelElement:zt,QWidgetQListElement:Yt,QWidgetQPaginatorElement:tn,QWidgetQTabElement:m(nn,[["render",an],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Adapters/QTab.vue"]])},props:{controllerReady:{type:Boolean,default:!1},node:{type:Object,default:()=>({})},loadingCount:{type:Number,default:0}},emits:["onEvent","onElementCreated"],computed:{elementName(){return this.element.getElementName()},element(){return this.node},state(){return this.element.getState()}},methods:{factoryInit(t){return t instanceof h.ElementQButton?"q-widget-q-button-element":t instanceof h.ElementQForm?"q-widget-q-form-element":t instanceof h.ElementQGrid?"q-widget-q-grid-element":t instanceof h.ElementQHtml?"q-widget-q-html-element":t instanceof h.ElementQImport?"q-widget-q-import-element":t instanceof h.ElementQLabel?"q-widget-q-label-element":t instanceof h.ElementQList?"q-widget-q-list-element":t instanceof h.ElementQPaginator?"q-widget-q-paginator-element":t instanceof h.ElementQTab?"q-widget-q-tab-element":""},onEvent(t){this.$emit("onEvent",{...t,element:this.element})},onElementCreated(){this.element.isCreated&&this.$emit("onElementCreated",[this.element])}}};function dn(t,e,n,o,i,s){return r.openBlock(),r.createBlock(r.resolveDynamicComponent(s.factoryInit(n.node)),{controllerReady:n.controllerReady,element:n.node,elementName:s.elementName,loadingCount:n.loadingCount,state:s.state,onOnCreated:s.onElementCreated,onOnEvent:s.onEvent},null,40,["controllerReady","element","elementName","loadingCount","state","onOnCreated","onOnEvent"])}const un=Object.freeze(Object.defineProperty({__proto__:null,default:m(cn,[["render",dn],["__file","/Users/questwork/Developer/qw.vue.q.widget/src/components/Elements/Element.vue"]])},Symbol.toStringTag,{value:"Module"}));y.QWidget=w,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}); return y; });
|
|
@@ -11,12 +11,12 @@ class ControllerHelpers {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
get isValid() {
|
|
14
|
-
return isFunction(this.
|
|
14
|
+
return isFunction(this.eventHandler)
|
|
15
|
+
&& isFunction(this.getControllerState)
|
|
15
16
|
&& isFunction(this.getControllerUniqueKey)
|
|
16
17
|
&& isFunction(this.saveControllerState)
|
|
17
18
|
&& isFunction(this.startLoading)
|
|
18
19
|
&& isFunction(this.stopLoading)
|
|
19
|
-
&& isFunction(this.runChains)
|
|
20
20
|
&& this.qForm && isFunction(this.qForm.NodeHelper)
|
|
21
21
|
&& this.qGrid && isFunction(this.qGrid.QItem) && isFunction(this.qGrid.Cell)
|
|
22
22
|
&& this.qList && isFunction(this.qList.QRow) && isFunction(this.qList.QListBulkButton) && isFunction(this.qList.QListButton)
|
package/package.json
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@questwork/vue-q-widget-vue3",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Questwork vue component Sample",
|
|
5
|
-
"
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"import": "./dist/q-widget.min.js",
|
|
8
|
+
"require": "./dist/q-widget.min.js"
|
|
9
|
+
},
|
|
10
|
+
"./style.css": "./dist/q-widget.min.css"
|
|
11
|
+
},
|
|
6
12
|
"author": {
|
|
7
13
|
"name": "Questwork Consulting Limited",
|
|
8
14
|
"email": "info@questwork.com",
|
|
@@ -13,6 +19,7 @@
|
|
|
13
19
|
"@babel/core": "^7.12.16",
|
|
14
20
|
"@babel/eslint-parser": "^7.12.16",
|
|
15
21
|
"@babel/preset-env": "^7.22.4",
|
|
22
|
+
"@questwork/q-utilities": "^0.1.0",
|
|
16
23
|
"@questwork/vue-q-buttons-vue3": "^3.1.0",
|
|
17
24
|
"@questwork/vue-q-form-vue3": "3.1.0",
|
|
18
25
|
"@questwork/vue-q-grid-vue3": "^3.1.0",
|
|
@@ -26,41 +33,30 @@
|
|
|
26
33
|
"@storybook/vue3": "^8.4.6",
|
|
27
34
|
"@storybook/vue3-vite": "^8.4.6",
|
|
28
35
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
29
|
-
"babel-loader": "^8.2.4",
|
|
30
36
|
"chai": "^4.3.6",
|
|
31
37
|
"chromedriver": "^116.0.0",
|
|
32
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
33
38
|
"cross-env": "^7.0.3",
|
|
34
|
-
"
|
|
39
|
+
"esbuild": "0.24.0",
|
|
35
40
|
"eslint": "^8.47.0",
|
|
36
41
|
"eslint-config-airbnb-base": "11.2.0",
|
|
37
42
|
"eslint-plugin-import": "2.3.0",
|
|
38
43
|
"eslint-plugin-storybook": "^0.11.1",
|
|
39
44
|
"eslint-plugin-vue": "^8.0.3",
|
|
40
|
-
"file-loader": "^6.2.0",
|
|
41
45
|
"gulp": "^4.0.2",
|
|
42
46
|
"lodash": "^4.17.21",
|
|
43
47
|
"rollup-plugin-license": "^3.5.3",
|
|
44
48
|
"rollup-webpack-umd": "^0.1.2",
|
|
45
49
|
"sass": "^1.49.11",
|
|
46
|
-
"sass-loader": "^8.0.2",
|
|
47
50
|
"selenium-webdriver": "^4.11.1",
|
|
48
51
|
"sinon": "^9.2.4",
|
|
49
52
|
"sinon-chai": "^3.7.0",
|
|
50
53
|
"storybook": "^8.4.6",
|
|
51
|
-
"style-loader": "^1.3.0",
|
|
52
54
|
"underscore": "1.4.4",
|
|
53
|
-
"url-loader": "^4.1.1",
|
|
54
55
|
"vite": "^6.0.2",
|
|
55
56
|
"vite-plugin-commonjs": "^0.10.4",
|
|
56
57
|
"vite-plugin-lib-inject-css": "^2.1.1",
|
|
57
58
|
"vue": "^3.5.13",
|
|
58
|
-
"vue-
|
|
59
|
-
"vue-template-compiler": "^2.6.14",
|
|
60
|
-
"webpack": "^5.71.0",
|
|
61
|
-
"webpack-cli": "^4.9.2",
|
|
62
|
-
"webpack-merge": "^4.2.2",
|
|
63
|
-
"webpack-node-externals": "^1.7.2"
|
|
59
|
+
"vue-template-compiler": "^2.6.14"
|
|
64
60
|
},
|
|
65
61
|
"engines": {
|
|
66
62
|
"node": ">=10.0.0"
|
package/vite.config.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { URL, fileURLToPath } from 'node:url'
|
|
2
2
|
import { defineConfig } from 'vite'
|
|
3
|
-
import { libInjectCss } from 'vite-plugin-lib-inject-css'
|
|
4
3
|
import vue from '@vitejs/plugin-vue'
|
|
5
4
|
import license from 'rollup-plugin-license'
|
|
6
5
|
import commonjs from 'vite-plugin-commonjs'
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
|
|
9
7
|
// 与 ./webpack/prod.config.js 的 output.library 名一致
|
|
10
8
|
const libName = 'QWidget'
|
|
11
9
|
// libName 的 kebab-case 格式
|
|
@@ -13,7 +11,6 @@ const fileName = 'q-widget'
|
|
|
13
11
|
|
|
14
12
|
export default defineConfig({
|
|
15
13
|
build: {
|
|
16
|
-
target: ['chrome100', 'safari15', 'firefox91'],
|
|
17
14
|
lib: {
|
|
18
15
|
entry: './src/index.js',
|
|
19
16
|
name: libName,
|
|
@@ -23,6 +20,7 @@ export default defineConfig({
|
|
|
23
20
|
rollupOptions: {
|
|
24
21
|
external: ['vue'],
|
|
25
22
|
output: {
|
|
23
|
+
assetFileNames: `${fileName}.min.[ext]`,
|
|
26
24
|
globals: {
|
|
27
25
|
vue: 'Vue',
|
|
28
26
|
},
|
|
@@ -34,19 +32,78 @@ export default defineConfig({
|
|
|
34
32
|
output: `./dist/${fileName}.min.js.LICENSE.txt`,
|
|
35
33
|
},
|
|
36
34
|
}),
|
|
37
|
-
|
|
35
|
+
rewriteUmdPlugin({
|
|
38
36
|
banner: `/*! For license information please see ${fileName}.min.js.LICENSE.txt */`
|
|
39
37
|
})
|
|
40
38
|
],
|
|
41
39
|
},
|
|
40
|
+
target: ['chrome100', 'safari15', 'firefox91'],
|
|
41
|
+
terserOptions: {
|
|
42
|
+
compress: false,
|
|
43
|
+
mangle: false,
|
|
44
|
+
},
|
|
42
45
|
},
|
|
43
46
|
esbuild: {
|
|
44
47
|
legalComments: 'none',
|
|
45
48
|
},
|
|
46
|
-
plugins: [
|
|
49
|
+
plugins: [
|
|
50
|
+
vue(),
|
|
51
|
+
commonjs()
|
|
52
|
+
],
|
|
47
53
|
resolve: {
|
|
48
54
|
alias: {
|
|
49
55
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
50
56
|
},
|
|
51
57
|
},
|
|
58
|
+
css: {
|
|
59
|
+
preprocessorOptions: {
|
|
60
|
+
scss: {
|
|
61
|
+
api: 'modern-compiler',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
52
65
|
})
|
|
66
|
+
|
|
67
|
+
function rewriteUmdPlugin(options) {
|
|
68
|
+
const {
|
|
69
|
+
banner
|
|
70
|
+
} = options || {}
|
|
71
|
+
return {
|
|
72
|
+
name: 'rewrite-umd',
|
|
73
|
+
generateBundle(_ctx, options2) {
|
|
74
|
+
if (_ctx.format !== 'umd') {
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
const data = Object.values(options2)[0]
|
|
78
|
+
const { code, exports, imports } = data
|
|
79
|
+
const defineReg = /^\(function\((?<root>\w+),(?<factory>\w+)\)\{(?<rest>.*?)\|\|self,(?<scriptTag>.*?)\)\}\)\(this,function/s
|
|
80
|
+
const rewritten = code
|
|
81
|
+
.replace(defineReg, (...args) => {
|
|
82
|
+
const { root, factory, scriptTag } = args.at(-1)
|
|
83
|
+
return `${banner || ''}
|
|
84
|
+
;(function(${root},${factory}){
|
|
85
|
+
if (typeof exports == "object" && typeof module < "u") { // for commonjs
|
|
86
|
+
const returns = {}
|
|
87
|
+
${factory}(returns, ${imports.map((i) => `require("${i}")`).join(', ')});
|
|
88
|
+
module.exports = returns;
|
|
89
|
+
${exports.map((exp) => `exports.${exp} = returns.${exp};`).join('\n')}
|
|
90
|
+
}
|
|
91
|
+
else if (typeof define == "function" && define.amd) { // for amd
|
|
92
|
+
define(["exports", ${imports.map((i) => `"${i}"`).join(', ')}], ${factory});
|
|
93
|
+
}
|
|
94
|
+
else { // for browser script tag
|
|
95
|
+
${root} = (typeof globalThis < "u") ? globalThis : ${root} || self;
|
|
96
|
+
${scriptTag};
|
|
97
|
+
}
|
|
98
|
+
})(this,function`
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// return the exports object at the end
|
|
102
|
+
.replace(new RegExp(/Object.defineProperty\((?<name>\w+),Symbol.toStringTag,{value:"Module"}\)}\);/), (...args) => {
|
|
103
|
+
const { name } = args.at(-1)
|
|
104
|
+
return `Object.defineProperty(${name},Symbol.toStringTag,{value:"Module"}); return ${name}; });`
|
|
105
|
+
})
|
|
106
|
+
data.code = rewritten
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|