@stonecrop/desktop 0.3.6 → 0.3.7
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/desktop.d.ts +42 -2
- package/dist/desktop.js +4 -4
- package/dist/desktop.js.map +1 -1
- package/dist/desktop.umd.cjs +1 -1
- package/dist/desktop.umd.cjs.map +1 -1
- package/dist/plugins/index.js +1 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/plugins/index.d.ts +1 -2
- package/dist/src/plugins/index.d.ts.map +1 -1
- package/dist/src/types/index.d.ts +37 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/index.js +0 -0
- package/package.json +5 -5
- package/src/components/ActionSet.vue +5 -18
- package/src/index.ts +1 -0
- package/src/plugins/index.ts +1 -2
- package/src/types/index.ts +41 -0
package/dist/desktop.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(J,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(J=typeof globalThis<"u"?globalThis:J||self,r(J["@stonecrop/desktop"]={},J.Vue))})(this,function(J,r){"use strict";const lr={class:"action-menu-icon"},ur=["onclick"],dr={key:1},pr=["onClick"],fr={class:"dropdown-container"},hr={class:"dropdown"},mr=["onclick"],gr=["href"],yr={class:"dropdown-item"},wr=r.defineComponent({__name:"ActionSet",props:{elements:{}},setup(e){const t=r.ref(e.elements),n=r.ref(!1),o=r.ref(null),s=r.ref(!1),a=r.ref(!1);r.onMounted(()=>{i()});const i=()=>{for(const p of t.value)p.
|
|
1
|
+
(function(J,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],r):(J=typeof globalThis<"u"?globalThis:J||self,r(J["@stonecrop/desktop"]={},J.Vue))})(this,function(J,r){"use strict";const lr={class:"action-menu-icon"},ur=["onclick"],dr={key:1},pr=["onClick"],fr={class:"dropdown-container"},hr={class:"dropdown"},mr=["onclick"],gr=["href"],yr={class:"dropdown-item"},wr=r.defineComponent({__name:"ActionSet",props:{elements:{}},setup(e){const t=r.ref(e.elements),n=r.ref(!1),o=r.ref(null),s=r.ref(!1),a=r.ref(!1);r.onMounted(()=>{i()});const i=()=>{for(const p of t.value)p.type==="dropdown"&&(p.show=!1)},c=()=>{s.value=!0,o.value=setTimeout(()=>{s.value&&(n.value=!0)},500)},u=()=>{s.value=!1,a.value=!1,clearTimeout(o.value),n.value=!1},l=p=>{const d=!t.value[p].show;i(),t.value[p].show=d};return(p,d)=>(r.openBlock(),r.createElementBlock("div",{class:r.normalizeClass([{"open-set":n.value,"hovered-and-closed":a.value},"action-set collapse"]),onMouseover:c,onMouseleave:u},[r.createElementVNode("div",lr,[r.createElementVNode("div",{id:"chevron",onClick:d[0]||(d[0]=f=>a.value=!a.value)},d[1]||(d[1]=[r.createElementVNode("svg",{class:"leftBar",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","xml:space":"preserve",width:"50",height:"50"},[r.createElementVNode("polygon",{points:"54.2,33.4 29.2,58.8 25,54.6 50,29.2 "})],-1),r.createElementVNode("svg",{class:"rightBar",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 100 100","xml:space":"preserve",width:"50",height:"50"},[r.createElementVNode("polygon",{points:"70.8,58.8 45.8,33.4 50,29.2 75,54.6 "})],-1)]))]),d[2]||(d[2]=r.createElementVNode("div",{style:{"margin-right":"30px"}},null,-1)),(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(t.value,(f,h)=>(r.openBlock(),r.createElementBlock("div",{class:"action-element",key:f.label},[f.type=="button"?(r.openBlock(),r.createElementBlock("button",{key:0,onclick:f.action,class:"button-default"},r.toDisplayString(f.label),9,ur)):r.createCommentVNode("",!0),f.type=="dropdown"?(r.openBlock(),r.createElementBlock("div",dr,[r.createElementVNode("button",{class:"button-default",onClick:m=>l(h)},r.toDisplayString(f.label),9,pr),r.withDirectives(r.createElementVNode("div",fr,[r.createElementVNode("div",hr,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(f.actions,m=>(r.openBlock(),r.createElementBlock("div",{key:m.label},[m.action!=null?(r.openBlock(),r.createElementBlock("button",{key:0,onclick:m.action,class:"dropdown-item"},r.toDisplayString(m.label),9,mr)):m.link!=null?(r.openBlock(),r.createElementBlock("a",{key:1,href:m.link},[r.createElementVNode("button",yr,r.toDisplayString(m.label),1)],8,gr)):r.createCommentVNode("",!0)]))),128))])],512),[[r.vShow,f.show]])])):r.createCommentVNode("",!0)]))),128))],34))}}),ut=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},sn=ut(wr,[["__scopeId","data-v-38e7af34"]]),br={};function vr(e,t){return r.openBlock(),r.createElementBlock("dialog")}const an=ut(br,[["render",vr]]),Er=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n};typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const _r={class:"aform"},kr=r.defineComponent({__name:"AForm",props:{modelValue:{},data:{},readonly:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=r.ref(e.data||{}),s=i=>{let c={};for(const[u,l]of Object.entries(i))["component","fieldtype"].includes(u)||(c[u]=l),u==="rows"&&l&&l.length===0&&(c.rows=o.value[i.fieldname]);return c},a=r.computed({get:()=>e.modelValue.map((i,c)=>r.computed({get(){return i.value},set:u=>{e.modelValue[c].value=u,n("update:modelValue",e.modelValue)}})),set:()=>{}});return(i,c)=>(r.openBlock(),r.createElementBlock("form",_r,[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(i.modelValue,(u,l)=>(r.openBlock(),r.createBlock(r.resolveDynamicComponent(u.component),r.mergeProps({key:l,schema:u,modelValue:a.value[l].value,"onUpdate:modelValue":p=>a.value[l].value=p,data:o.value[u.fieldname],readonly:i.readonly,ref_for:!0},s(u)),null,16,["schema","modelValue","onUpdate:modelValue","data","readonly"]))),128))]))}}),Nr=Er(kr,[["__scopeId","data-v-68845234"]]);typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;var $r=Object.defineProperty,Or=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t,n)=>Or(e,typeof t!="symbol"?t+"":t,n);function dt(e){this.message=e||""}dt.prototype=Object.create(Error.prototype,{constructor:{value:dt},name:{value:"NotImplemented"},stack:{get:function(){return new Error().stack}}});const cn=class ct{constructor(t,n,o,s,a){if(Y(this,"name","Stonecrop"),Y(this,"registry"),Y(this,"schema"),Y(this,"workflow"),Y(this,"actions"),Y(this,"store"),ct._root)return ct._root;ct._root=this,this.registry=t,this.store=n,this.schema=o,this.workflow=s,this.actions=a}setup(t){this.getMeta(t),this.getWorkflow(t),this.getActions(t)}getMeta(t){return this.registry.getMeta?this.registry.getMeta(t.doctype):new dt(t.doctype)}getWorkflow(t){const n=this.registry.registry[t.slug];this.workflow=n.workflow}getActions(t){const n=this.registry.registry[t.slug];this.actions=n.actions}async getRecords(t,n){this.store.$patch({records:[]});const o=await(await fetch(`/${t.slug}`,n)).json();this.store.$patch({records:o})}async getRecord(t,n){this.store.$patch({record:{}});const o=await(await fetch(`/${t.slug}/${n}`)).json();this.store.$patch({record:o})}runAction(t,n,o){const s=this.registry.registry[t.slug].actions.get(n),{initialState:a}=this.workflow;this.workflow.transition(a,{type:n}),s.length>0&&s.forEach(i=>{new Function(i)(o)})}};Y(cn,"_root");let Sr=cn;var ln=!1;function qe(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function pt(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function xr(){return un().__VUE_DEVTOOLS_GLOBAL_HOOK__}function un(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cr=typeof Proxy=="function",Pr="devtools-plugin:setup",Ir="plugin:settings:set";let Pe,ft;function Vr(){var e;return Pe!==void 0||(typeof window<"u"&&window.performance?(Pe=!0,ft=window.performance):typeof globalThis<"u"&&!((e=globalThis.perf_hooks)===null||e===void 0)&&e.performance?(Pe=!0,ft=globalThis.perf_hooks.performance):Pe=!1),Pe}function Dr(){return Vr()?ft.now():Date.now()}class Rr{constructor(t,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=t,this.hook=n;const o={};if(t.settings)for(const i in t.settings){const c=t.settings[i];o[i]=c.defaultValue}const s=`__vue-devtools-plugin-settings__${t.id}`;let a=Object.assign({},o);try{const i=localStorage.getItem(s),c=JSON.parse(i);Object.assign(a,c)}catch{}this.fallbacks={getSettings(){return a},setSettings(i){try{localStorage.setItem(s,JSON.stringify(i))}catch{}a=i},now(){return Dr()}},n&&n.on(Ir,(i,c)=>{i===this.plugin.id&&this.fallbacks.setSettings(c)}),this.proxiedOn=new Proxy({},{get:(i,c)=>this.target?this.target.on[c]:(...u)=>{this.onQueue.push({method:c,args:u})}}),this.proxiedTarget=new Proxy({},{get:(i,c)=>this.target?this.target[c]:c==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(c)?(...u)=>(this.targetQueue.push({method:c,args:u,resolve:()=>{}}),this.fallbacks[c](...u)):(...u)=>new Promise(l=>{this.targetQueue.push({method:c,args:u,resolve:l})})})}async setRealTarget(t){this.target=t;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function ht(e,t){const n=e,o=un(),s=xr(),a=Cr&&n.enableEarlyProxy;if(s&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!a))s.emit(Pr,e,t);else{const i=a?new Rr(n,s):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:t,proxy:i}),i&&t(i.proxiedTarget)}}/*!
|
|
2
2
|
* pinia v2.3.0
|
|
3
3
|
* (c) 2024 Eduardo San Martin Morote
|
|
4
4
|
* @license MIT
|