@shwfed/config 2.7.7 → 2.7.8
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/mcp.mjs +92 -31
- package/dist/module.json +1 -1
- package/dist/preview/assets/{badge-B0tiCpa_.js → badge-KAEXz3VO.js} +1 -1
- package/dist/preview/assets/{config-CGvnv-5x.js → config-BXx5syNf.js} +1 -1
- package/dist/preview/assets/{config-jDPbLgBr.js → config-Bb9Yeh33.js} +1 -1
- package/dist/preview/assets/{config-Dafqx9xC.js → config-C-QRPeN1.js} +1 -1
- package/dist/preview/assets/{config-DDPihojt.js → config-CkKx7sVR.js} +1 -1
- package/dist/preview/assets/{config-C-XJ-8Rs.js → config-CtbYlZCL.js} +1 -1
- package/dist/preview/assets/{config-GCvXe12z.js → config-DPlbFBRi.js} +1 -1
- package/dist/preview/assets/{config-BG9TRQcv.js → config-DbfJWa8K.js} +1 -1
- package/dist/preview/assets/{config-DqMRy1WL.js → config-DbirfZyy.js} +1 -1
- package/dist/preview/assets/{config-Bfb2sH6S.js → config-ZczGik30.js} +1 -1
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-DBXfCj4Q.js → definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js} +1 -1
- package/dist/preview/assets/{index-D7jDE3kp.js → index-Bv_aA34a.js} +1 -1
- package/dist/preview/assets/{index-B0PL01fm.css → index-C9P-6gZd.css} +1 -1
- package/dist/preview/assets/index-CJFU9znN.js +1 -0
- package/dist/preview/assets/{index-CHzOsSTW.js → index-DUOkekYu.js} +162 -162
- package/dist/preview/assets/{item-DV-Garrg.js → item-SC0WQMVu.js} +1 -1
- package/dist/preview/assets/{runtime-DHTqFEQI.js → runtime-BPOf7Yqz.js} +1 -1
- package/dist/preview/assets/{runtime-BovPWken.js → runtime-CC2caFS9.js} +1 -1
- package/dist/preview/assets/{runtime-DKtlQWwc.js → runtime-CLaRFZzt.js} +1 -1
- package/dist/preview/assets/{runtime-D-LBi56N.js → runtime-Ckuz5Kxm.js} +1 -1
- package/dist/preview/assets/{runtime-CwmJ9MLQ.js → runtime-CnKlH0mi.js} +1 -1
- package/dist/preview/assets/{runtime-Cyjx6haa.js → runtime-DO0anKbw.js} +1 -1
- package/dist/preview/assets/{runtime-DA77AmOP.js → runtime-DcStOiOi.js} +1 -1
- package/dist/preview/assets/{runtime-UmLaEUGf.js → runtime-EVgYW6_7.js} +1 -1
- package/dist/preview/assets/{runtime-BxBBFFHA.js → runtime-i32sR7d3.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/block-layout-editor/index.vue +1 -4
- package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/config.vue +5 -0
- package/dist/runtime/components/form/config.vue +24 -16
- package/dist/runtime/components/form/schema.d.ts +1 -1
- package/dist/runtime/components/form/schema.js +6 -1
- package/dist/runtime/components/form/utils/schema-meta.d.ts +2 -0
- package/dist/runtime/components/form/utils/schema-meta.js +24 -0
- package/dist/runtime/components/table/config.vue +0 -36
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.d.vue.ts +4 -3
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue +135 -111
- package/dist/runtime/components/ui/expression-editor/ExpressionEditor.vue.d.ts +4 -3
- package/dist/runtime/share/expression.d.ts +23 -0
- package/dist/runtime/share/expression.js +37 -17
- package/dist/runtime/vendor/cel-js/CLAUDE.md +2 -2
- package/dist/runtime/vendor/cel-js/PROMPT.md +15 -6
- package/dist/runtime/vendor/cel-js/lib/macros.js +66 -14
- package/package.json +1 -1
- package/dist/preview/assets/index-CSfKAdi7.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as q,u as B,o as O,w as y,a as M,c as E,n as T,b as V,r as x,e as o,g as z,f as A,h as s,i as J,j as L,p as P,l as U,k as W,m as D,q as g,s as G,t as h,v as H}from"./index-
|
|
1
|
+
import{d as q,u as B,o as O,w as y,a as M,c as E,n as T,b as V,r as x,e as o,g as z,f as A,h as s,i as J,j as L,p as P,l as U,k as W,m as D,q as g,s as G,t as h,v as H}from"./index-DUOkekYu.js";import K from"./index-Bv_aA34a.js";const X=q({name:"ShwfedBlockAnimatedNumberItem",__name:"item",props:{item:{}},setup(b){const n=b,j=G(),a=x(void 0),m=x(0);function u(){return D(j)}function S(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){const t=Number(e);return Number.isFinite(t)?t:0}return 0}const d=o(()=>a.value===void 0?g():H(a.value));function v(e){if(!e)return"";try{const t=h(s(e,{...u(),json:d.value}));return t==null?"":String(t)}catch{return""}}const w=o(()=>v(n.item.prefix)),_=o(()=>v(n.item.suffix));function C(e){if(e)try{const t=h(s(e,{...u(),json:d.value}));return t==null?void 0:typeof t=="string"||typeof t=="object"?t:String(t)}catch{return}}const F=o(()=>C(n.item.style));async function r(){const e=n.item.dataSource,t=u(),N=z(function*(){let i=g();e.request&&(i=yield*A(yield*s(e.request,t)));const k=yield*s(e.value,{...t,json:i});return{json:J(i),value:k}});try{const i=await L(P(N,U));a.value=i.json,m.value=S(i.value)}catch(i){console.warn("[shwfed-animated-number] fetch failed",i)}}const l=o(()=>(n.item.pollingInterval??0)>0),I=o(()=>Math.max(1,n.item.pollingInterval??1)*1e3),c=W(),{pause:p,resume:f}=B(()=>{r()},I,{immediate:!1});return O(()=>{r(),l.value&&c.value&&f()}),y(c,e=>{l.value&&(e?(r(),f()):p())}),y(()=>[n.item.dataSource.request??"",n.item.dataSource.value,n.item.pollingInterval??0].join("|"),()=>{r(),l.value&&c.value?f():p()}),(e,t)=>(M(),E(V(K),{value:m.value,prefix:w.value,suffix:_.value,style:T(F.value)},null,8,["value","prefix","suffix","style"]))}});export{X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as n}from"./definition.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import{_ as n}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";import{d as o,c as a,b as c,a as f,aN as i}from"./index-DUOkekYu.js";const _=o({name:"ShwfedPrototypeActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(t){const e=i;return(r,s)=>(f(),a(n,{"action-id":t.buttonId,effect:c(e)},null,8,["action-id","effect"]))}});export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,aK as p,aE as m,aL as a,aM as g,aH as d,c as l,b as x,h as E,m as _,aI as h,s as C,aJ as I,a as b}from"./index-
|
|
1
|
+
import{d as u,aK as p,aE as m,aL as a,aM as g,aH as d,c as l,b as x,h as E,m as _,aI as h,s as C,aJ as I,a as b}from"./index-DUOkekYu.js";import{_ as v}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";const R=u({name:"ShwfedHttpRequestActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(t){const e=t,c=C(),i=(n,s)=>E(n,{..._(c),...s}),r=I(),o=h(),f=p(()=>{const n=o?m(()=>o()):a(!0);return g(n,s=>s?d(e.config.expression,i,{messageExpression:e.config.messageExpression,resultExpression:e.config.resultExpression,channel:r,triggers:{success:e.config.onSuccess,warning:e.config.onWarning,error:e.config.onError,info:e.config.onInfo}}):a(void 0))});return(n,s)=>(b(),l(v,{"action-id":t.buttonId,effect:x(f)},null,8,["action-id","effect"]))}});export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l,G as u,g,aE as m,M as d,aF as p,aG as x,aH as E,c as _,b as h,h as k,m as w,aI as C,s as I,aJ as b,a as v}from"./index-
|
|
1
|
+
import{d as l,G as u,g,aE as m,M as d,aF as p,aG as x,aH as E,c as _,b as h,h as k,m as w,aI as C,s as I,aJ as b,a as v}from"./index-DUOkekYu.js";import{_ as y}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";const R=l({name:"ShwfedHttpRequestConfirmActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(s){const n=s,{locale:i}=u(),a=I(),t=(e,o)=>k(e,{...w(a),...o}),r=b(),c=C(),f=g(function*(){if(c&&!(yield*m(()=>c())))return;const e=d(n.config.markdown,i.value)??"",o=p(e,t);(yield*x({content:o,icon:n.config.icon,color:n.config.color}))||(yield*E(n.config.expression,t,{messageExpression:n.config.messageExpression,resultExpression:n.config.resultExpression,channel:r,triggers:{success:n.config.onSuccess,warning:n.config.onWarning,error:n.config.onError,info:n.config.onInfo}}))});return(e,o)=>(v(),_(y,{"action-id":s.buttonId,effect:h(f)},null,8,["action-id","effect"]))}});export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as i,G as x,aO as M,g as T,M as c,aP as p,t as S,c as b,H as d,b as u,r as N,y as k,aJ as I,aQ as L,a as H,S as w,n as A,I as r,aR as F,aS as R,ax as V,s as $,aT as f,D as m,aU as j}from"./index-
|
|
1
|
+
import{d as i,G as x,aO as M,g as T,M as c,aP as p,t as S,c as b,H as d,b as u,r as N,y as k,aJ as I,aQ as L,a as H,S as w,n as A,I as r,aR as F,aS as R,ax as V,s as $,aT as f,D as m,aU as j}from"./index-DUOkekYu.js";import{_ as z}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";const Y=i({name:"ShwfedModalLayoutActionRuntime",__name:"runtime",props:{buttonId:{},config:{},buttonTitle:{}},setup(n){const a=n,{locale:l}=x(),v=e=>{},g=$(),s=k(f,void 0),h=I(),o=N(null),C=M(a.buttonId,{close:()=>L(()=>{o.value?.()})},h),y=i({name:"ModalBoundaryBridge",setup(e,{slots:t}){return R(g),m(j,C),s&&m(f,s),()=>t.default?.()}}),E=(e,t)=>V()?.(e,t),_=T(function*(){const e=c(a.config.modalTitle,l.value)??c(a.buttonTitle,l.value)??"",{modal:t,close:B}=yield*p({title:e,width:a.config.modalWidth});o.value=()=>S(B()),yield*t,o.value=null});return(e,t)=>(H(),b(z,{"action-id":n.buttonId,effect:u(_)},{default:d(()=>[w("div",{style:A(n.config.modalMinHeight?`min-height: ${n.config.modalMinHeight}`:void 0)},[r(u(y),null,{default:d(()=>[r(F,{"slot-value":n.config.slot,configure:v,"find-entry":E},null,8,["slot-value"])]),_:1})],4)]),_:1},8,["action-id","effect"]))}});export{Y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as c}from"./definition.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import{_ as c}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";import{d as s,aK as o,aV as i,c as r,b as f,aJ as u,a as m}from"./index-DUOkekYu.js";const g=s({name:"ShwfedEventDispatchActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const n=e,t=u(),a=o(()=>i(t,n.config.triggers));return(p,d)=>(m(),r(c,{"action-id":e.buttonId,effect:f(a)},null,8,["action-id","effect"]))}});export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as f,aK as u,aM as l,aE as d,c as m,b as w,h as p,m as h,s as _,a as g}from"./index-
|
|
1
|
+
import{d as f,aK as u,aM as l,aE as d,c as m,b as w,h as p,m as h,s as _,a as g}from"./index-DUOkekYu.js";import{_ as b}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";function v(){return{resolve:e=>({href:new URL(e,window.location.href).href})}}function x(e,t){return window.location.assign(e),Promise.resolve()}const B=f({name:"ShwfedNavigationActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const t=e,i=v(),a=_(),r=(n,o)=>p(n,{...h(a),...o});function c(n){try{return new URL(n,window.location.href).origin!==window.location.origin}catch{return!1}}const s=u(()=>l(r(t.config.url),n=>d(async()=>{const o=c(n);if(t.config.mode==="_blank"){window.open(o?n:i.resolve(n).href,"_blank");return}await x(n)})));return(n,o)=>(g(),m(b,{"action-id":e.buttonId,effect:w(s)},null,8,["action-id","effect"]))}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as _,aK as E,g as S,aQ as r,aV as m,aW as b,aX as j,c as v,b as x,h as B,m as L,aJ as k,s as C,a as R}from"./index-
|
|
1
|
+
import{d as _,aK as E,g as S,aQ as r,aV as m,aW as b,aX as j,c as v,b as x,h as B,m as L,aJ as k,s as C,a as R}from"./index-DUOkekYu.js";import{_ as T}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";const q=_({name:"ShwfedHttpDownloadActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(d){const c=d,g=C(),t=(e,n)=>B(e,{...L(g),...n}),l=k(),p=new Set(["success","error","warning","info"]);function f(e){const n=URL.createObjectURL(e),o=document.createElement("a");o.href=n,o.download=e.name,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(n)}const y=E(()=>S(function*(){const{template:e,messageExpression:n,resultExpression:o}=c.config,u=yield*t(e.request);if(!e.download){const s=yield*u.file();return yield*r(()=>f(s)),yield*m(l,c.config.onSuccess)}const a={json:yield*u.json()},i=o===void 0?"success":yield*b(t(o,a),s=>p.has(s)?s:"success");if(n!==void 0){const s=yield*t(n,a);yield*r(()=>j[i](s))}if(i==="success"||i==="info"){const w=yield*(yield*t(e.download,a)).file();yield*r(()=>f(w))}const h={success:c.config.onSuccess,warning:c.config.onWarning,error:c.config.onError,info:c.config.onInfo};return yield*m(l,h[i])}));return(e,n)=>(R(),v(T,{"action-id":d.buttonId,effect:x(y)},null,8,["action-id","effect"]))}});export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as u,G as i,c as l,b as p,e as m,a as d,J as f,M as _,aF as k,h as w,m as x,s as g}from"./index-
|
|
1
|
+
import{d as u,G as i,c as l,b as p,e as m,a as d,J as f,M as _,aF as k,h as w,m as x,s as g}from"./index-DUOkekYu.js";const B=u({name:"ShwfedMarkdownItemRuntime",__name:"runtime",props:{config:{}},setup(n){const o=n,{locale:t}=i(),a=g(),c=(e,s)=>w(e,{...x(a),...s}),r=m(()=>{const e=_(o.config.content,t.value)??"";return k(e,c)});return(e,s)=>(d(),l(p(f),{"data-slot":"buttons-markdown",source:r.value,class:"prose prose-sm prose-zinc px-1"},null,8,["source"]))}});export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as l,aY as g,aK as A,aM as y,aV as h,c as _,b,h as S,m as j,aJ as k,aZ as C,a as B,s as O}from"./index-
|
|
1
|
+
import{d as l,aY as g,aK as A,aM as y,aV as h,c as _,b,h as S,m as j,aJ as k,aZ as C,a as B,s as O}from"./index-DUOkekYu.js";import{_ as x}from"./definition.vue_vue_type_script_setup_true_lang-CQ6MUPKO.js";const I=l({name:"ShwfedStateWriteActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(r){const s=r,i=O(),f=(e,t)=>S(e,{...j(i),...t}),n=g(),c=n.kind==="form"&&n.parent?n.parent:n,u=k(),m=C((e,t,a)=>{if(Array.isArray(e[t])&&Array.isArray(a))return e[t]=a,!0});function o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function p(e,t){return o(e)&&o(t)?m({...t},e):t}const d=A(()=>y(f(s.config.expression),e=>{for(const t of Object.keys(e)){const a=p(c.getAt(t),e[t]);c.setAt(t,a)}return h(u,s.config.onSuccess)}));return(e,t)=>(B(),_(x,{"action-id":r.buttonId,effect:b(d)},null,8,["action-id","effect"]))}});export{I as default};
|
package/dist/preview/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
`--primary`, the primary button variant renders as transparent. */
|
|
11
11
|
body { --primary: #009689; }
|
|
12
12
|
</style>
|
|
13
|
-
<script type="module" crossorigin src="./assets/index-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
13
|
+
<script type="module" crossorigin src="./assets/index-DUOkekYu.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="./assets/index-C9P-6gZd.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="app"></div>
|
|
@@ -195,9 +195,8 @@ function recenter() {
|
|
|
195
195
|
const frame = activeFrame.value;
|
|
196
196
|
const frameW = frame.cols * stepPx.value;
|
|
197
197
|
const frameH = frame.rows * stepPx.value;
|
|
198
|
-
const rightInset = inlineItem.value ? inlinePaneWidth.value : 0;
|
|
199
198
|
coordinate.value = {
|
|
200
|
-
x: Math.round((rect.width -
|
|
199
|
+
x: Math.round((rect.width - frameW) / 2),
|
|
201
200
|
y: Math.round((rect.height - frameH) / 2)
|
|
202
201
|
};
|
|
203
202
|
}
|
|
@@ -823,7 +822,6 @@ function requestDrill(itemId) {
|
|
|
823
822
|
function closeInline() {
|
|
824
823
|
setSelection([]);
|
|
825
824
|
}
|
|
826
|
-
watch(() => inlineItemId.value !== null, () => recenterSoon());
|
|
827
825
|
let paneResize = null;
|
|
828
826
|
function beginPaneResize(e) {
|
|
829
827
|
if (e.button !== 0) return;
|
|
@@ -841,7 +839,6 @@ useEventListener("mousemove", (e) => {
|
|
|
841
839
|
useEventListener("mouseup", () => {
|
|
842
840
|
if (!paneResize) return;
|
|
843
841
|
paneResize = null;
|
|
844
|
-
recenterSoon();
|
|
845
842
|
});
|
|
846
843
|
</script>
|
|
847
844
|
|
package/dist/runtime/components/config/blocks/2026-05-17/com.shwfed.block.chart.xy/config.vue
CHANGED
|
@@ -384,6 +384,7 @@ function removeY(i) {
|
|
|
384
384
|
:model-value="block.x"
|
|
385
385
|
result-type="list"
|
|
386
386
|
:extra-vars="dataSourceVars"
|
|
387
|
+
unlisted-vars-are-dyn
|
|
387
388
|
placeholder="返回列表,如 range(0, 12)"
|
|
388
389
|
@update:model-value="setX"
|
|
389
390
|
/>
|
|
@@ -440,6 +441,7 @@ function removeY(i) {
|
|
|
440
441
|
:model-value="s.value"
|
|
441
442
|
result-type="list"
|
|
442
443
|
:extra-vars="dataSourceVars"
|
|
444
|
+
unlisted-vars-are-dyn
|
|
443
445
|
:placeholder="`\u7B2C ${i + 1} \u4E2A\u7CFB\u5217\uFF0C\u5982 source1.map(r, r.value)`"
|
|
444
446
|
@update:model-value="(v) => setYValue(i, v)"
|
|
445
447
|
/>
|
|
@@ -576,6 +578,7 @@ function removeY(i) {
|
|
|
576
578
|
:model-value="s.dash ?? ''"
|
|
577
579
|
result-type="list"
|
|
578
580
|
:extra-vars="dataSourceVars"
|
|
581
|
+
unlisted-vars-are-dyn
|
|
579
582
|
placeholder="留空为实线,如 [4, 4]"
|
|
580
583
|
@update:model-value="(v) => setYDash(i, v)"
|
|
581
584
|
/>
|
|
@@ -653,6 +656,7 @@ function removeY(i) {
|
|
|
653
656
|
:model-value="s.width ?? ''"
|
|
654
657
|
result-type="number"
|
|
655
658
|
:extra-vars="dataSourceVars"
|
|
659
|
+
unlisted-vars-are-dyn
|
|
656
660
|
placeholder="留空自动,如 24"
|
|
657
661
|
@update:model-value="(v) => setYWidth(i, v)"
|
|
658
662
|
/>
|
|
@@ -680,6 +684,7 @@ function removeY(i) {
|
|
|
680
684
|
:model-value="s.size ?? ''"
|
|
681
685
|
result-type="list"
|
|
682
686
|
:extra-vars="dataSourceVars"
|
|
687
|
+
unlisted-vars-are-dyn
|
|
683
688
|
placeholder="留空用默认大小,如 source1.map(r, r.weight)"
|
|
684
689
|
@update:model-value="(v) => setYSize(i, v)"
|
|
685
690
|
/>
|
|
@@ -9,6 +9,8 @@ import { Textarea } from "../ui/textarea";
|
|
|
9
9
|
import { provideEventAncestor } from "../../share/event-bus";
|
|
10
10
|
import {
|
|
11
11
|
FormConfig,
|
|
12
|
+
getNestedStructFieldDescription,
|
|
13
|
+
getNestedStructFieldTitle,
|
|
12
14
|
getStructFieldDescription,
|
|
13
15
|
getStructFieldTitle,
|
|
14
16
|
metadata as formMetadata
|
|
@@ -25,6 +27,8 @@ const configure = props.configure ?? (() => {
|
|
|
25
27
|
const formConfigSchema = FormConfig(configure);
|
|
26
28
|
const generalFieldTitle = (f) => getStructFieldTitle(formConfigSchema, f) ?? f;
|
|
27
29
|
const generalFieldDescription = (f) => getStructFieldDescription(formConfigSchema, f);
|
|
30
|
+
const initialFieldTitle = (f) => getNestedStructFieldTitle(formConfigSchema, "initial", f) ?? f;
|
|
31
|
+
const initialFieldDescription = (f) => getNestedStructFieldDescription(formConfigSchema, "initial", f);
|
|
28
32
|
provideCELContext(buildFormCelScope(configure));
|
|
29
33
|
const formEventAncestor = computed(() => {
|
|
30
34
|
const id = config.value.id;
|
|
@@ -124,45 +128,49 @@ function updateStyle(value) {
|
|
|
124
128
|
<Field orientation="vertical">
|
|
125
129
|
<FieldLabel class="text-xs text-zinc-500">
|
|
126
130
|
<template
|
|
127
|
-
v-if="
|
|
131
|
+
v-if="initialFieldDescription('request')"
|
|
128
132
|
#tooltip
|
|
129
133
|
>
|
|
130
134
|
<Markdown
|
|
131
|
-
:source="
|
|
135
|
+
:source="initialFieldDescription('request')"
|
|
132
136
|
block
|
|
133
137
|
class="prose prose-sm prose-zinc"
|
|
134
138
|
/>
|
|
135
139
|
</template>
|
|
136
|
-
{{
|
|
140
|
+
{{ initialFieldTitle("request") }}
|
|
137
141
|
</FieldLabel>
|
|
138
142
|
<ExpressionEditor
|
|
139
|
-
:model-value="config.initial?.
|
|
140
|
-
placeholder="如
|
|
141
|
-
result-type="
|
|
142
|
-
:extra-vars="{ json: { type: 'optional<dyn>', label: 'HTTP \u54CD\u5E94\u4F53', description: '\u300C\u8BF7\u6C42\u300D\u7684\u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E\u8BF7\u6C42\u65F6\u4E3A none' } }"
|
|
143
|
+
:model-value="config.initial?.request ?? ''"
|
|
144
|
+
placeholder="如 http.get('https://api.example.com/record/1')"
|
|
145
|
+
result-type="HttpRequest"
|
|
143
146
|
multiline
|
|
144
147
|
class="min-h-20"
|
|
145
|
-
@update:model-value="(v) => setInitialField('
|
|
148
|
+
@update:model-value="(v) => setInitialField('request', v)"
|
|
146
149
|
/>
|
|
147
150
|
</Field>
|
|
148
151
|
|
|
149
152
|
<Field orientation="vertical">
|
|
150
153
|
<FieldLabel class="text-xs text-zinc-500">
|
|
151
|
-
<template
|
|
154
|
+
<template
|
|
155
|
+
v-if="initialFieldDescription('data')"
|
|
156
|
+
#tooltip
|
|
157
|
+
>
|
|
152
158
|
<Markdown
|
|
153
|
-
source="
|
|
159
|
+
:source="initialFieldDescription('data')"
|
|
154
160
|
block
|
|
155
161
|
class="prose prose-sm prose-zinc"
|
|
156
162
|
/>
|
|
157
163
|
</template>
|
|
158
|
-
{{
|
|
164
|
+
{{ initialFieldTitle("data") }}
|
|
159
165
|
</FieldLabel>
|
|
160
166
|
<ExpressionEditor
|
|
161
|
-
:model-value="config.initial?.
|
|
162
|
-
placeholder="如
|
|
163
|
-
result-type="
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
:model-value="config.initial?.data ?? ''"
|
|
168
|
+
placeholder="如 { 'name': '', 'age': 0 }"
|
|
169
|
+
result-type="dyn"
|
|
170
|
+
:extra-vars="{ json: { type: 'optional<dyn>', label: 'HTTP \u54CD\u5E94\u4F53', description: '\u300C\u8BF7\u6C42\u300D\u7684\u54CD\u5E94\u4F53\uFF08\u5DF2\u89E3\u6790 JSON\uFF09\uFF1B\u672A\u914D\u7F6E\u8BF7\u6C42\u65F6\u4E3A none' } }"
|
|
171
|
+
multiline
|
|
172
|
+
class="min-h-20"
|
|
173
|
+
@update:model-value="(v) => setInitialField('data', v)"
|
|
166
174
|
/>
|
|
167
175
|
</Field>
|
|
168
176
|
|
|
@@ -4,7 +4,7 @@ import type { InitialSource } from './utils/initial.js';
|
|
|
4
4
|
import { registerFormVariablesIfAbsent } from './utils/form-vars.js';
|
|
5
5
|
import { type LayoutSetValue } from '../../share/layout.js';
|
|
6
6
|
export { commonFieldFields } from './utils/common.js';
|
|
7
|
-
export { getStructFieldTitle, getStructFieldDescription } from './utils/schema-meta.js';
|
|
7
|
+
export { getStructFieldTitle, getStructFieldDescription, getNestedStructFieldTitle, getNestedStructFieldDescription, } from './utils/schema-meta.js';
|
|
8
8
|
export { Align, DEFAULT_GAP, LayoutSet, validatePlacements } from '../../share/layout.js';
|
|
9
9
|
declare const KIND = "shwfed.component.form";
|
|
10
10
|
export declare const metadata: {
|
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
validatePlacements
|
|
9
9
|
} from "../../share/layout.js";
|
|
10
10
|
export { commonFieldFields } from "./utils/common.js";
|
|
11
|
-
export {
|
|
11
|
+
export {
|
|
12
|
+
getStructFieldTitle,
|
|
13
|
+
getStructFieldDescription,
|
|
14
|
+
getNestedStructFieldTitle,
|
|
15
|
+
getNestedStructFieldDescription
|
|
16
|
+
} from "./utils/schema-meta.js";
|
|
12
17
|
export { Align, DEFAULT_GAP, LayoutSet, validatePlacements } from "../../share/layout.js";
|
|
13
18
|
const KIND = "shwfed.component.form";
|
|
14
19
|
export const metadata = {
|
|
@@ -2,6 +2,8 @@ import { type Schema } from 'effect';
|
|
|
2
2
|
type AnySchema = Schema.Schema<any, any, any>;
|
|
3
3
|
export declare function getStructFieldTitle(schema: AnySchema, fieldName: string): string | undefined;
|
|
4
4
|
export declare function getStructFieldDescription(schema: AnySchema, fieldName: string): string | undefined;
|
|
5
|
+
export declare function getNestedStructFieldTitle(schema: AnySchema, parentField: string, childField: string): string | undefined;
|
|
6
|
+
export declare function getNestedStructFieldDescription(schema: AnySchema, parentField: string, childField: string): string | undefined;
|
|
5
7
|
export type StructFieldInfo = {
|
|
6
8
|
name: string;
|
|
7
9
|
title?: string;
|
|
@@ -46,6 +46,30 @@ export function getStructFieldTitle(schema, fieldName) {
|
|
|
46
46
|
export function getStructFieldDescription(schema, fieldName) {
|
|
47
47
|
return getFieldAnnotation(schema, fieldName, SchemaAST.getDescriptionAnnotation);
|
|
48
48
|
}
|
|
49
|
+
function getNestedFieldAnnotation(schema, parentField, childField, getter) {
|
|
50
|
+
const parentPs = findPropertySignature(schema, parentField);
|
|
51
|
+
if (!parentPs) return void 0;
|
|
52
|
+
const tl = getTypeLiteral(resolveFieldType(parentPs));
|
|
53
|
+
if (!tl) return void 0;
|
|
54
|
+
const ps = tl.propertySignatures.find((p) => p.name === childField);
|
|
55
|
+
if (!ps) return void 0;
|
|
56
|
+
const fromPS = getter(ps);
|
|
57
|
+
if (Option.isSome(fromPS)) return fromPS.value;
|
|
58
|
+
const resolved = resolveFieldType(ps);
|
|
59
|
+
const fromResolved = getter(resolved);
|
|
60
|
+
if (Option.isSome(fromResolved)) return fromResolved.value;
|
|
61
|
+
if (resolved !== ps.type) {
|
|
62
|
+
const fromType = getter(ps.type);
|
|
63
|
+
if (Option.isSome(fromType)) return fromType.value;
|
|
64
|
+
}
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
export function getNestedStructFieldTitle(schema, parentField, childField) {
|
|
68
|
+
return getNestedFieldAnnotation(schema, parentField, childField, SchemaAST.getTitleAnnotation);
|
|
69
|
+
}
|
|
70
|
+
export function getNestedStructFieldDescription(schema, parentField, childField) {
|
|
71
|
+
return getNestedFieldAnnotation(schema, parentField, childField, SchemaAST.getDescriptionAnnotation);
|
|
72
|
+
}
|
|
49
73
|
export function listStructFields(schema) {
|
|
50
74
|
const tl = getTypeLiteral(schema.ast);
|
|
51
75
|
if (!tl) return [];
|
|
@@ -1249,12 +1249,6 @@ const tableQueryValue = computed({
|
|
|
1249
1249
|
@update:model-value="(v) => updateGeneralOptionalString('rowKey', v)"
|
|
1250
1250
|
/>
|
|
1251
1251
|
</RowKeyCELContext>
|
|
1252
|
-
<p
|
|
1253
|
-
v-if="getError('rowKey')"
|
|
1254
|
-
class="text-xs text-red-500"
|
|
1255
|
-
>
|
|
1256
|
-
{{ getError("rowKey") }}
|
|
1257
|
-
</p>
|
|
1258
1252
|
</Field>
|
|
1259
1253
|
|
|
1260
1254
|
<!-- Host slot inside the general grid: a wrapping editor (e.g. the
|
|
@@ -1297,12 +1291,6 @@ const tableQueryValue = computed({
|
|
|
1297
1291
|
@update:model-value="(v) => updateDataSourceOptional('request', v)"
|
|
1298
1292
|
/>
|
|
1299
1293
|
</RequestCELContext>
|
|
1300
|
-
<p
|
|
1301
|
-
v-if="getError('dataSource.request')"
|
|
1302
|
-
class="text-xs text-red-500"
|
|
1303
|
-
>
|
|
1304
|
-
{{ getError("dataSource.request") }}
|
|
1305
|
-
</p>
|
|
1306
1294
|
</Field>
|
|
1307
1295
|
|
|
1308
1296
|
<div class="grid grid-cols-2 gap-x-6 gap-y-4">
|
|
@@ -1328,12 +1316,6 @@ const tableQueryValue = computed({
|
|
|
1328
1316
|
@update:model-value="(v) => setDataSourceField('data', v)"
|
|
1329
1317
|
/>
|
|
1330
1318
|
</JsonCELContext>
|
|
1331
|
-
<p
|
|
1332
|
-
v-if="getError('dataSource.data')"
|
|
1333
|
-
class="text-xs text-red-500"
|
|
1334
|
-
>
|
|
1335
|
-
{{ getError("dataSource.data") }}
|
|
1336
|
-
</p>
|
|
1337
1319
|
</Field>
|
|
1338
1320
|
<Field orientation="vertical">
|
|
1339
1321
|
<FieldLabel class="text-xs text-zinc-500">
|
|
@@ -1357,12 +1339,6 @@ const tableQueryValue = computed({
|
|
|
1357
1339
|
@update:model-value="(v) => updateDataSourceOptional('total', v)"
|
|
1358
1340
|
/>
|
|
1359
1341
|
</JsonCELContext>
|
|
1360
|
-
<p
|
|
1361
|
-
v-if="getError('dataSource.total')"
|
|
1362
|
-
class="text-xs text-red-500"
|
|
1363
|
-
>
|
|
1364
|
-
{{ getError("dataSource.total") }}
|
|
1365
|
-
</p>
|
|
1366
1342
|
</Field>
|
|
1367
1343
|
</div>
|
|
1368
1344
|
</div>
|
|
@@ -1515,12 +1491,6 @@ const tableQueryValue = computed({
|
|
|
1515
1491
|
@update:model-value="(v) => updateGeneralOptionalString('cellStyle', v)"
|
|
1516
1492
|
/>
|
|
1517
1493
|
</CellStyleCELContext>
|
|
1518
|
-
<p
|
|
1519
|
-
v-if="getError('cellStyle')"
|
|
1520
|
-
class="text-xs text-red-500"
|
|
1521
|
-
>
|
|
1522
|
-
{{ getError("cellStyle") }}
|
|
1523
|
-
</p>
|
|
1524
1494
|
</Field>
|
|
1525
1495
|
|
|
1526
1496
|
<Field orientation="vertical">
|
|
@@ -1543,12 +1513,6 @@ const tableQueryValue = computed({
|
|
|
1543
1513
|
class="min-h-20 font-mono text-xs"
|
|
1544
1514
|
@update:model-value="(v) => updateGeneralOptionalString('style', String(v))"
|
|
1545
1515
|
/>
|
|
1546
|
-
<p
|
|
1547
|
-
v-if="getError('style')"
|
|
1548
|
-
class="text-xs text-red-500"
|
|
1549
|
-
>
|
|
1550
|
-
{{ getError("style") }}
|
|
1551
|
-
</p>
|
|
1552
1516
|
</Field>
|
|
1553
1517
|
</div>
|
|
1554
1518
|
</div>
|
|
@@ -12,12 +12,13 @@ type __VLS_Props = {
|
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
resultType?: string | string[];
|
|
14
14
|
extraVars?: Record<string, VarSpec>;
|
|
15
|
+
unlistedVarsAreDyn?: boolean;
|
|
15
16
|
};
|
|
16
|
-
declare var
|
|
17
|
+
declare var __VLS_13: {}, __VLS_129: {};
|
|
17
18
|
type __VLS_Slots = {} & {
|
|
18
|
-
leading?: (props: typeof
|
|
19
|
+
leading?: (props: typeof __VLS_13) => any;
|
|
19
20
|
} & {
|
|
20
|
-
trailing?: (props: typeof
|
|
21
|
+
trailing?: (props: typeof __VLS_129) => any;
|
|
21
22
|
};
|
|
22
23
|
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
24
|
"update:modelValue": (payload: string) => any;
|