@a2ui-vue3-elementplus/element-plus 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@a2ui-vue3-elementplus/vue-renderer"),a=require("vue"),i=require("element-plus"),c=e=>Array.isArray(e)?e:e??void 0,h=(e,t)=>a.h("
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@a2ui-vue3-elementplus/vue-renderer"),a=require("vue"),i=require("element-plus"),c=e=>Array.isArray(e)?e:e??void 0,h=(e,t)=>a.h("div",{class:"a2-field"},[e?a.h("span",{class:"a2-field__label"},e):null,t]),I=a.defineComponent({name:"A2Text",props:{text:[String,Number,Boolean],variant:String},setup(e){return()=>{const t=e.variant==="h1"||e.variant==="h2"||e.variant==="h3"||e.variant==="h4"||e.variant==="h5"?e.variant:e.variant==="caption"?"small":"p";return a.h(t,{class:["a2-text",e.variant&&`a2-text--${e.variant}`]},String(e.text??""))}}}),j=a.defineComponent({name:"A2Image",props:{url:String,fit:String,variant:String},setup(e){return()=>a.h(i.ElImage,{src:e.url,fit:e.fit,class:["a2-image",e.variant&&`a2-image--${e.variant}`]})}}),P=a.defineComponent({name:"A2Icon",props:{name:String},setup(e){return()=>a.h("span",{class:"a2-icon","aria-hidden":"true"},e.name??"")}}),k=a.defineComponent({name:"A2Divider",props:{axis:String},setup(e){return()=>a.h(i.ElDivider,{direction:e.axis==="vertical"?"vertical":"horizontal"})}}),B=a.defineComponent({name:"A2Row",props:{justify:String,align:String,children:[Array,Object,String]},setup(e){return()=>a.h("div",{class:"a2-row",style:{justifyContent:e.justify==="spaceBetween"?"space-between":e.justify,alignItems:e.align}},c(e.children))}}),U=a.defineComponent({name:"A2Column",props:{justify:String,align:String,children:[Array,Object,String]},setup(e){return()=>a.h("div",{class:"a2-column",style:{justifyContent:e.justify,alignItems:e.align}},c(e.children))}}),D=a.defineComponent({name:"A2Card",props:{child:[Array,Object,String]},setup(e){return()=>a.h(i.ElCard,{class:"a2-card"},()=>c(e.child))}}),w=a.defineComponent({name:"A2Button",props:{variant:String,child:[Array,Object,String],text:[String,Number]},emits:["click"],setup(e,{emit:t}){return()=>a.h(i.ElButton,{type:e.variant==="primary"?"primary":e.variant==="danger"?"danger":void 0,text:e.variant==="borderless",onClick:()=>t("click")},()=>c(e.child)??String(e.text??""))}}),O=a.defineComponent({name:"A2TextField",props:{label:String,modelValue:[String,Number],textFieldType:String,validationRegexp:String},emits:["update:modelValue"],setup(e,{emit:t}){const n=l=>e.textFieldType==="number"?Number(l):l;return()=>h(e.label,a.h(i.ElInput,{modelValue:e.modelValue,type:e.textFieldType==="longText"?"textarea":e.textFieldType==="obscured"?"password":"text","onUpdate:modelValue":l=>t("update:modelValue",n(l))}))}}),_=a.defineComponent({name:"A2CheckBox",props:{label:String,modelValue:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){return()=>a.h(i.ElCheckbox,{modelValue:e.modelValue,"onUpdate:modelValue":n=>t("update:modelValue",!!n)},()=>e.label)}}),F=a.defineComponent({name:"A2ChoicePicker",props:{label:String,options:{type:Array,default:()=>[]},modelValue:[String,Number,Boolean,Array,Object],multiple:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){return()=>h(e.label,a.h(i.ElSelect,{modelValue:e.modelValue,multiple:e.multiple,class:"a2-choice-picker","onUpdate:modelValue":n=>t("update:modelValue",n)},()=>e.options.map(n=>a.h(i.ElOption,{key:String(n.value),label:n.label,value:n.value}))))}}),N=a.defineComponent({name:"A2DateTimeInput",props:{label:String,modelValue:[String,Date,Array],enableDate:Boolean,enableTime:Boolean},emits:["update:modelValue"],setup(e,{emit:t}){return()=>{const n=e.enableTime&&!e.enableDate?i.ElTimePicker:i.ElDatePicker;return h(e.label,a.h(n,{modelValue:e.modelValue,type:e.enableDate&&e.enableTime?"datetime":"date",valueFormat:"YYYY-MM-DDTHH:mm:ss","onUpdate:modelValue":l=>t("update:modelValue",l)}))}}}),Y=a.defineComponent({name:"A2Slider",props:{modelValue:Number,minValue:Number,maxValue:Number},emits:["update:modelValue"],setup(e,{emit:t}){return()=>a.h(i.ElSlider,{modelValue:e.modelValue??0,min:e.minValue??0,max:e.maxValue??100,"onUpdate:modelValue":n=>t("update:modelValue",Array.isArray(n)?n[0]:n)})}}),q=a.defineComponent({name:"A2Modal",props:{entryPointChild:[Array,Object,String],contentChild:[Array,Object,String]},setup(e){const t=a.ref(!1);return()=>[a.h("span",{class:"a2-modal__entry",onClick:()=>t.value=!0},c(e.entryPointChild)),a.h(i.ElDialog,{modelValue:t.value,"onUpdate:modelValue":n=>t.value=n},()=>c(e.contentChild))]}}),K=a.defineComponent({name:"A2Tabs",props:{tabItems:{type:Array,default:()=>[]}},setup(e){return()=>a.h(i.ElTabs,{class:"a2-tabs"},()=>e.tabItems.map((t,n)=>a.h(i.ElTabPane,{key:n,label:t.title,name:String(n)},()=>c(t.child))))}});function r(e){return e&&typeof e=="object"&&"path"in e?String(e.path):void 0}function y(e){return r(e.selections)??r(e.value)}function $(e){return r(e.selections)!==void 0}function A(e){return e.maxAllowedSelections!==void 0?Number(e.maxAllowedSelections)!==1:e.variant==="multipleSelection"}function v(){return{Text:{component:I,propsMapper:(e,t)=>({text:t.resolveValue(e.text),variant:e.variant})},Image:{component:j,propsMapper:(e,t)=>({url:t.resolveValue(e.url),fit:e.fit,variant:e.variant})},Icon:{component:P,propsMapper:(e,t)=>({name:t.resolveValue(e.name)})},Divider:{component:k,propsMapper:e=>({axis:e.axis})},Row:{component:B,propsMapper:(e,t)=>({justify:e.justify,align:e.align,children:t.renderChildren(e.children)})},Column:{component:U,propsMapper:(e,t)=>({justify:e.justify,align:e.align,children:t.renderChildren(e.children)})},Card:{component:D,propsMapper:(e,t)=>({child:t.renderChild(e.child)})},Button:{component:w,propsMapper:(e,t)=>({variant:e.variant,child:t.renderChild(e.child),text:e.text}),eventsMapper:(e,t)=>({onClick:()=>{const n=e.action,l=n==null?void 0:n.event;l!=null&&l.name&&t.emitAction(String(l.name),l.context)}})},TextField:{component:O,dependencies:e=>[r(e.value)],propsMapper:(e,t)=>{const n=r(e.value);return{label:e.label,modelValue:n?t.getValue(n):t.resolveValue(e.value),textFieldType:e.textFieldType,validationRegexp:e.validationRegexp}},eventsMapper:(e,t)=>({"onUpdate:modelValue":n=>t.setValue(r(e.value),n)})},CheckBox:{component:_,dependencies:e=>[r(e.value)],propsMapper:(e,t)=>{const n=r(e.value);return{label:e.label,modelValue:n?!!t.getValue(n):!!t.resolveValue(e.value)}},eventsMapper:(e,t)=>({"onUpdate:modelValue":n=>t.setValue(r(e.value),n)})},ChoicePicker:{component:F,dependencies:e=>[y(e)],propsMapper:(e,t)=>{const n=y(e),l=A(e),u=n?t.getValue(n):t.resolveValue(e.selections??e.value);return{label:e.label,options:e.options,modelValue:l&&u===void 0?[]:!l&&Array.isArray(u)?u[0]:u,multiple:l}},eventsMapper:(e,t)=>({"onUpdate:modelValue":n=>{const l=A(e),u=$(e);t.setValue(y(e),!l&&u?[n]:n)}})},DateTimeInput:{component:N,dependencies:e=>[r(e.value)],propsMapper:(e,t)=>{const n=r(e.value);return{label:e.label,modelValue:n?t.getValue(n):t.resolveValue(e.value),enableDate:e.enableDate!==!1,enableTime:!!e.enableTime}},eventsMapper:(e,t)=>({"onUpdate:modelValue":n=>t.setValue(r(e.value),n)})},Slider:{component:Y,dependencies:e=>[r(e.value)],propsMapper:(e,t)=>{const n=r(e.value);return{modelValue:n?t.getValue(n):t.resolveValue(e.value),minValue:e.minValue,maxValue:e.maxValue}},eventsMapper:(e,t)=>({"onUpdate:modelValue":n=>t.setValue(r(e.value),n)})},Modal:{component:q,propsMapper:(e,t)=>({entryPointChild:t.renderChild(e.entryPointChild),contentChild:t.renderChild(e.contentChild)})},Tabs:{component:K,propsMapper:(e,t)=>({tabItems:Array.isArray(e.tabItems)?e.tabItems.map(n=>({title:t.resolveValue(n.title),child:t.renderChild(n.child)})):[]})}}}const V=Symbol.for("a2ui.element-plus.registry");function C(e){return typeof e=="object"&&e!==null||typeof e=="function"}function z(e,t){C(e)&&Object.defineProperty(e,V,{configurable:!0,enumerable:!1,value:t,writable:!0})}function G(e){if(C(e))return e[V]}const S="a2uiRuntime",g="a2uiRegistry",b=a.defineComponent({__name:"A2Surface",props:{runtime:{},surfaceId:{default:"main"},registry:{},components:{}},emits:["action","error"],setup(e,{emit:t}){const n=e,l=t,u=a.inject(g,void 0),s=a.inject(S,void 0),o=d.createComponentRegistry(v()),m=a.computed(()=>n.runtime??s),T=a.computed(()=>n.registry??G(m.value)??(u?void 0:o));return(H,p)=>(a.openBlock(),a.createBlock(a.unref(d.A2Surface),{runtime:m.value,"surface-id":e.surfaceId,registry:T.value,components:e.components,onAction:p[0]||(p[0]=f=>l("action",f)),onError:p[1]||(p[1]=f=>l("error",f))},null,8,["runtime","surface-id","registry","components"]))}});function x(e={}){const t=a.hasInjectionContext()?a.inject(g,void 0):void 0,n=e.registry??t??d.createComponentRegistry();n.registerMany(v(),"skip"),e.components&&n.registerMany(e.components);const{components:l,registry:u,...s}=e,o=d.useA2UI({...s,registry:n});return z(o.runtime,o.registry),a.hasInjectionContext()&&(a.provide(S,o.runtime),a.provide(g,o.registry)),o}const M=a.defineComponent({__name:"A2RealtimeRenderer",props:{message:{},surfaceId:{default:"main"},components:{}},emits:["action","error"],setup(e,{emit:t}){const n=e,l=t,{pushMessage:u}=x({components:n.components,onAction:s=>l("action",s),onError:s=>l("error",s)});return a.watch(()=>n.message,s=>{s&&u(s)},{immediate:!0}),(s,o)=>(a.openBlock(),a.createBlock(b,{"surface-id":e.surfaceId,components:e.components,onAction:o[0]||(o[0]=m=>l("action",m)),onError:o[1]||(o[1]=m=>l("error",m))},null,8,["surface-id","components"]))}});function E(e={}){const t=d.createComponentRegistry(v());return e.components&&t.registerMany(e.components,e.conflict??"override"),{install(n){n.provide(g,t),n.component("A2Surface",b),n.component("A2RealtimeRenderer",M)}}}const R=E();Object.defineProperty(exports,"useBaseA2UI",{enumerable:!0,get:()=>d.useA2UI});exports.A2ElementPlusPlugin=R;exports.A2RealtimeRenderer=M;exports.A2Surface=b;exports.createA2ElementPlusPlugin=E;exports.createElementPlusCatalog=v;exports.default=R;exports.useA2UI=x;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { createComponentRegistry as f, A2Surface as k, useA2UI as B } from "@a2u
|
|
|
2
2
|
import { useA2UI as Ce } from "@a2ui-vue3-elementplus/vue-renderer";
|
|
3
3
|
import { defineComponent as r, h as l, ref as P, inject as y, computed as V, openBlock as C, createBlock as M, unref as U, hasInjectionContext as h, provide as S, watch as D } from "vue";
|
|
4
4
|
import { ElTabs as w, ElTabPane as F, ElDialog as N, ElSlider as O, ElTimePicker as _, ElDatePicker as Y, ElSelect as $, ElOption as K, ElCheckbox as z, ElInput as G, ElButton as H, ElCard as L, ElDivider as q, ElImage as J } from "element-plus";
|
|
5
|
-
const c = (e) => Array.isArray(e) ? e : e ?? void 0, b = (e, t) => l("
|
|
5
|
+
const c = (e) => Array.isArray(e) ? e : e ?? void 0, b = (e, t) => l("div", { class: "a2-field" }, [
|
|
6
6
|
e ? l("span", { class: "a2-field__label" }, e) : null,
|
|
7
7
|
t
|
|
8
8
|
]), Q = r({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2ui-vue3-elementplus/element-plus",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"vue": "^3.4.0 || ^3.5.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@a2ui-vue3-elementplus/vue-renderer": "0.
|
|
37
|
+
"@a2ui-vue3-elementplus/vue-renderer": "0.2.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "vite build",
|