@shwfed/config 2.3.17 → 2.3.18

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.
Files changed (41) hide show
  1. package/dist/mcp.mjs +727 -534
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/{config-lCt8xg5R.js → config-C8Y4mJbo.js} +1 -1
  4. package/dist/preview/assets/{config-DkE2KJox.js → config-CGjY6-4G.js} +1 -1
  5. package/dist/preview/assets/{config-CDcbWHz1.js → config-CR-ypZys.js} +1 -1
  6. package/dist/preview/assets/{config-D9wKVRfv.js → config-Cs3k3BuR.js} +1 -1
  7. package/dist/preview/assets/{config-DReApS3g.js → config-D9mrL0UY.js} +1 -1
  8. package/dist/preview/assets/{config-CAzy2oY1.js → config-DRy0SpMq.js} +1 -1
  9. package/dist/preview/assets/{config-CAUy5OIr.js → config-eopfzGON.js} +1 -1
  10. package/dist/preview/assets/{config-B_D_DLrg.js → config-qmkDiyXK.js} +1 -1
  11. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js → definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js} +1 -1
  12. package/dist/preview/assets/index-Bsbk3Okp.js +1 -0
  13. package/dist/preview/assets/index-Dz_SnGc9.js +639 -0
  14. package/dist/preview/assets/{runtime-eRS_ur88.js → runtime-B1Lqn7iS.js} +1 -1
  15. package/dist/preview/assets/{runtime-C7iG_6_s.js → runtime-BvJjQaAU.js} +1 -1
  16. package/dist/preview/assets/{runtime-CWwZuZQ7.js → runtime-C-3DIGFz.js} +1 -1
  17. package/dist/preview/assets/{runtime-CNI--nfZ.js → runtime-C2q2Mp8_.js} +1 -1
  18. package/dist/preview/assets/{runtime-Dj39BqNd.js → runtime-CdELhC3y.js} +1 -1
  19. package/dist/preview/assets/{runtime-TUjKxXEj.js → runtime-D8OAMic8.js} +1 -1
  20. package/dist/preview/assets/{runtime-Dg8BS7Rt.js → runtime-DQcKN5I_.js} +1 -1
  21. package/dist/preview/assets/{runtime-CEymLc8o.js → runtime-DQvlwOZl.js} +1 -1
  22. package/dist/preview/index.html +1 -1
  23. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +107 -0
  24. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue +493 -0
  25. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +107 -0
  26. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.d.vue.ts +8 -0
  27. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue +123 -0
  28. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/runtime.vue.d.ts +8 -0
  29. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.d.ts +79 -0
  30. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/schema.js +78 -0
  31. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +125 -0
  32. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue +645 -0
  33. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +125 -0
  34. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.d.vue.ts +8 -0
  35. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue +155 -0
  36. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/runtime.vue.d.ts +8 -0
  37. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.d.ts +90 -0
  38. package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/schema.js +100 -0
  39. package/package.json +1 -1
  40. package/dist/preview/assets/index-DOUzPsqV.js +0 -639
  41. package/dist/preview/assets/index-DUZhCCDY.js +0 -1
@@ -1 +1 @@
1
- import{d as r,an as f,ai as u,e as p,u as g,aj as m,ak as l,al as d,am as x,o as E}from"./index-DOUzPsqV.js";import{_}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";const k=r({name:"ShwfedHttpRequestActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(n){const e=n,t=d(),c=(s,o)=>m(s,{...l(t),...o}),i=x(),a=f(()=>u(e.config.expression,c,{messageExpression:e.config.messageExpression,resultExpression:e.config.resultExpression,channel:i,triggers:{success:e.config.onSuccess,warning:e.config.onWarning,error:e.config.onError,info:e.config.onInfo}}));return(s,o)=>(E(),p(_,{"action-id":n.buttonId,effect:g(a)},null,8,["action-id","effect"]))}});export{k as default};
1
+ import{d as r,an as f,ai as u,e as p,u as g,aj as m,ak as l,al as d,am as x,o as E}from"./index-Dz_SnGc9.js";import{_}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";const k=r({name:"ShwfedHttpRequestActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(n){const e=n,t=d(),c=(s,o)=>m(s,{...l(t),...o}),i=x(),a=f(()=>u(e.config.expression,c,{messageExpression:e.config.messageExpression,resultExpression:e.config.resultExpression,channel:i,triggers:{success:e.config.onSuccess,warning:e.config.onWarning,error:e.config.onError,info:e.config.onInfo}}));return(s,o)=>(E(),p(_,{"action-id":n.buttonId,effect:g(a)},null,8,["action-id","effect"]))}});export{k as default};
@@ -1 +1 @@
1
- import{d as _,an as j,ae as B,aq as r,az as m,aA as E,aB as S,e as k,u as v,aj as x,ak as L,am as b,o as C,al as R}from"./index-DOUzPsqV.js";import{_ as T}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";const I=_({name:"ShwfedHttpDownloadActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(d){const c=d,g=R(),t=(e,n)=>x(e,{...L(g),...n}),l=b(),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=j(()=>B(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*E(t(o,a),s=>p.has(s)?s:"success");if(n!==void 0){const s=yield*t(n,a);yield*r(()=>S[i](s))}if(i==="success"||i==="info"){const h=yield*(yield*t(e.download,a)).file();yield*r(()=>f(h))}const w={success:c.config.onSuccess,warning:c.config.onWarning,error:c.config.onError,info:c.config.onInfo};return yield*m(l,w[i])}));return(e,n)=>(C(),k(T,{"action-id":d.buttonId,effect:v(y)},null,8,["action-id","effect"]))}});export{I as default};
1
+ import{d as _,an as j,ae as B,aq as r,az as m,aA as E,aB as S,e as k,u as v,aj as x,ak as L,am as b,o as C,al as R}from"./index-Dz_SnGc9.js";import{_ as T}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";const I=_({name:"ShwfedHttpDownloadActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(d){const c=d,g=R(),t=(e,n)=>x(e,{...L(g),...n}),l=b(),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=j(()=>B(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*E(t(o,a),s=>p.has(s)?s:"success");if(n!==void 0){const s=yield*t(n,a);yield*r(()=>S[i](s))}if(i==="success"||i==="info"){const h=yield*(yield*t(e.download,a)).file();yield*r(()=>f(h))}const w={success:c.config.onSuccess,warning:c.config.onWarning,error:c.config.onError,info:c.config.onInfo};return yield*m(l,w[i])}));return(e,n)=>(C(),k(T,{"action-id":d.buttonId,effect:v(y)},null,8,["action-id","effect"]))}});export{I as default};
@@ -1 +1 @@
1
- import{_ as s}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";import{d as c,an as o,az as i,e as r,u as f,am as u,o as m}from"./index-DOUzPsqV.js";const g=c({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(s,{"action-id":e.buttonId,effect:f(a)},null,8,["action-id","effect"]))}});export{g as default};
1
+ import{_ as s}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";import{d as c,an as o,az as i,e as r,u as f,am as u,o as m}from"./index-Dz_SnGc9.js";const g=c({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(s,{"action-id":e.buttonId,effect:f(a)},null,8,["action-id","effect"]))}});export{g as default};
@@ -1 +1 @@
1
- import{d as f,ad as u,ae as l,af as g,ag as d,ah as m,ai as p,e as x,u as E,aj as _,ak as h,al as k,am as w,o as C}from"./index-DOUzPsqV.js";import{_ as I}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";const R=f({name:"ShwfedHttpRequestConfirmActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(s){const n=s,{locale:c}=u(),a=k(),t=(e,o)=>_(e,{...h(a),...o}),i=w(),r=l(function*(){const e=g(n.config.markdown,c.value)??"",o=d(e,t);(yield*m({content:o,icon:n.config.icon,color:n.config.color}))||(yield*p(n.config.expression,t,{messageExpression:n.config.messageExpression,resultExpression:n.config.resultExpression,channel:i,triggers:{success:n.config.onSuccess,warning:n.config.onWarning,error:n.config.onError,info:n.config.onInfo}}))});return(e,o)=>(C(),x(I,{"action-id":s.buttonId,effect:E(r)},null,8,["action-id","effect"]))}});export{R as default};
1
+ import{d as f,ad as u,ae as l,af as g,ag as d,ah as m,ai as p,e as x,u as E,aj as _,ak as h,al as k,am as w,o as C}from"./index-Dz_SnGc9.js";import{_ as I}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";const R=f({name:"ShwfedHttpRequestConfirmActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(s){const n=s,{locale:c}=u(),a=k(),t=(e,o)=>_(e,{...h(a),...o}),i=w(),r=l(function*(){const e=g(n.config.markdown,c.value)??"",o=d(e,t);(yield*m({content:o,icon:n.config.icon,color:n.config.color}))||(yield*p(n.config.expression,t,{messageExpression:n.config.messageExpression,resultExpression:n.config.resultExpression,channel:i,triggers:{success:n.config.onSuccess,warning:n.config.onWarning,error:n.config.onError,info:n.config.onInfo}}))});return(e,o)=>(C(),x(I,{"action-id":s.buttonId,effect:E(r)},null,8,["action-id","effect"]))}});export{R as default};
@@ -1 +1 @@
1
- import{d as u,ad as l,e as i,u as p,$ as d,o as m,k as f,af as _,ag as k,aj as g,ak as w,al as x}from"./index-DOUzPsqV.js";const B=u({name:"ShwfedMarkdownItemRuntime",__name:"runtime",props:{config:{}},setup(n){const s=n,{locale:o}=l(),t=x(),c=(e,a)=>g(e,{...w(t),...a}),r=d(()=>{const e=_(s.config.content,o.value)??"";return k(e,c)});return(e,a)=>(m(),i(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
+ import{d as u,ad as l,e as i,u as p,$ as d,o as m,k as f,af as _,ag as k,aj as g,ak as w,al as x}from"./index-Dz_SnGc9.js";const B=u({name:"ShwfedMarkdownItemRuntime",__name:"runtime",props:{config:{}},setup(n){const s=n,{locale:o}=l(),t=x(),c=(e,a)=>g(e,{...w(t),...a}),r=d(()=>{const e=_(s.config.content,o.value)??"";return k(e,c)});return(e,a)=>(m(),i(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 i,an as f,ap as r,aq as d,e as u,u as m,aj as p,ak as l,al as _,o as g}from"./index-DOUzPsqV.js";import{_ as h}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";const x=i({name:"ShwfedNavigationActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const t=e,o=_(),c=(n,a)=>p(n,{...l(o),...a}),s=f(()=>r(c(t.config.url),n=>d(()=>{window.open(n,t.config.mode)})));return(n,a)=>(g(),u(h,{"action-id":e.buttonId,effect:m(s)},null,8,["action-id","effect"]))}});export{x as default};
1
+ import{d as i,an as f,ap as r,aq as d,e as u,u as m,aj as p,ak as l,al as _,o as g}from"./index-Dz_SnGc9.js";import{_ as h}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";const x=i({name:"ShwfedNavigationActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const t=e,o=_(),c=(n,a)=>p(n,{...l(o),...a}),s=f(()=>r(c(t.config.url),n=>d(()=>{window.open(n,t.config.mode)})));return(n,a)=>(g(),u(h,{"action-id":e.buttonId,effect:m(s)},null,8,["action-id","effect"]))}});export{x as default};
@@ -1 +1 @@
1
- import{_ as o}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";import{d as n,e as a,u as c,o as f,ao as i}from"./index-DOUzPsqV.js";const _=n({name:"ShwfedPrototypeActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const t=i;return(r,s)=>(f(),a(o,{"action-id":e.buttonId,effect:c(t)},null,8,["action-id","effect"]))}});export{_ as default};
1
+ import{_ as o}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";import{d as n,e as a,u as c,o as f,ao as i}from"./index-Dz_SnGc9.js";const _=n({name:"ShwfedPrototypeActionRuntime",__name:"runtime",props:{buttonId:{},config:{}},setup(e){const t=i;return(r,s)=>(f(),a(o,{"action-id":e.buttonId,effect:c(t)},null,8,["action-id","effect"]))}});export{_ as default};
@@ -1 +1 @@
1
- import{d as s,ad as B,ar as E,ae as _,af as i,as as x,at as p,e as M,w as c,u as d,a0 as N,am as b,aq as k,o as w,f as L,au as T,g as u,av as I,aw as H,a7 as S,al as V,ax as $,ay as z}from"./index-DOUzPsqV.js";import{_ as A}from"./definition.vue_vue_type_script_setup_true_lang-CvzBdDHI.js";const F=s({name:"ShwfedModalLayoutActionRuntime",__name:"runtime",props:{buttonId:{},config:{},buttonTitle:{}},setup(a){const n=a,{locale:l}=B(),f=e=>{},r=V(),m=b(),o=N(null),v=E(n.buttonId,{close:()=>k(()=>{o.value?.()})},m),g=s({name:"ModalBoundaryBridge",setup(e,{slots:t}){return H(r),$(z,v),()=>t.default?.()}}),h=(e,t)=>S()?.(e,t),C=_(function*(){const e=i(n.config.modalTitle,l.value)??i(n.buttonTitle,l.value)??"",{modal:t,close:y}=yield*x({title:e,width:n.config.modalWidth});o.value=()=>p(y()),yield*t,o.value=null});return(e,t)=>(w(),M(A,{"action-id":a.buttonId,effect:d(C)},{default:c(()=>[L("div",{style:T(a.config.modalMinHeight?`min-height: ${a.config.modalMinHeight}`:void 0)},[u(d(g),null,{default:c(()=>[u(I,{"slot-value":a.config.slot,configure:f,"find-entry":h},null,8,["slot-value"])]),_:1})],4)]),_:1},8,["action-id","effect"]))}});export{F as default};
1
+ import{d as s,ad as B,ar as E,ae as _,af as i,as as x,at as p,e as M,w as c,u as d,a0 as N,am as b,aq as k,o as w,f as L,au as T,g as u,av as I,aw as H,a7 as S,al as V,ax as $,ay as z}from"./index-Dz_SnGc9.js";import{_ as A}from"./definition.vue_vue_type_script_setup_true_lang-BakGkJ_w.js";const F=s({name:"ShwfedModalLayoutActionRuntime",__name:"runtime",props:{buttonId:{},config:{},buttonTitle:{}},setup(a){const n=a,{locale:l}=B(),f=e=>{},r=V(),m=b(),o=N(null),v=E(n.buttonId,{close:()=>k(()=>{o.value?.()})},m),g=s({name:"ModalBoundaryBridge",setup(e,{slots:t}){return H(r),$(z,v),()=>t.default?.()}}),h=(e,t)=>S()?.(e,t),C=_(function*(){const e=i(n.config.modalTitle,l.value)??i(n.buttonTitle,l.value)??"",{modal:t,close:y}=yield*x({title:e,width:n.config.modalWidth});o.value=()=>p(y()),yield*t,o.value=null});return(e,t)=>(w(),M(A,{"action-id":a.buttonId,effect:d(C)},{default:c(()=>[L("div",{style:T(a.config.modalMinHeight?`min-height: ${a.config.modalMinHeight}`:void 0)},[u(d(g),null,{default:c(()=>[u(I,{"slot-value":a.config.slot,configure:f,"find-entry":h},null,8,["slot-value"])]),_:1})],4)]),_:1},8,["action-id","effect"]))}});export{F as default};
@@ -10,7 +10,7 @@
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-DOUzPsqV.js"></script>
13
+ <script type="module" crossorigin src="./assets/index-Dz_SnGc9.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="./assets/index-BUyz4nJb.css">
15
15
  </head>
16
16
  <body>
@@ -0,0 +1,107 @@
1
+ import { type Value } from './schema.js';
2
+ type __VLS_ModelProps = {
3
+ modelValue: Value;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:modelValue": (value: {
7
+ readonly label?: readonly [{
8
+ readonly locale: "zh";
9
+ readonly message: string;
10
+ }, ...{
11
+ readonly locale: "en" | "ja" | "ko";
12
+ readonly message: string;
13
+ }[]] | undefined;
14
+ readonly disabled?: string | undefined;
15
+ readonly type: "com.shwfed.form.field.month";
16
+ readonly id: string;
17
+ readonly hidden?: string | undefined;
18
+ readonly tooltip?: readonly [{
19
+ readonly locale: "zh";
20
+ readonly message: string;
21
+ }, ...{
22
+ readonly locale: "en" | "ja" | "ko";
23
+ readonly message: string;
24
+ }[]] | undefined;
25
+ readonly displayName?: string | undefined;
26
+ readonly compatibilityDate: "2026-05-24";
27
+ readonly orientation?: "vertical" | "floating" | undefined;
28
+ readonly placeholder?: readonly [{
29
+ readonly locale: "zh";
30
+ readonly message: string;
31
+ }, ...{
32
+ readonly locale: "en" | "ja" | "ko";
33
+ readonly message: string;
34
+ }[]] | undefined;
35
+ readonly readonly?: string | undefined;
36
+ readonly binding?: string | undefined;
37
+ readonly derived?: {
38
+ readonly mode: "formula" | "prefill";
39
+ readonly expression: string;
40
+ } | undefined;
41
+ readonly format?: string | undefined;
42
+ readonly valueFormat?: string | undefined;
43
+ readonly presets?: readonly {
44
+ readonly label: readonly [{
45
+ readonly locale: "zh";
46
+ readonly message: string;
47
+ }, ...{
48
+ readonly locale: "en" | "ja" | "ko";
49
+ readonly message: string;
50
+ }[]];
51
+ readonly id: string;
52
+ readonly value: string;
53
+ }[] | undefined;
54
+ }) => any;
55
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
56
+ "onUpdate:modelValue"?: ((value: {
57
+ readonly label?: readonly [{
58
+ readonly locale: "zh";
59
+ readonly message: string;
60
+ }, ...{
61
+ readonly locale: "en" | "ja" | "ko";
62
+ readonly message: string;
63
+ }[]] | undefined;
64
+ readonly disabled?: string | undefined;
65
+ readonly type: "com.shwfed.form.field.month";
66
+ readonly id: string;
67
+ readonly hidden?: string | undefined;
68
+ readonly tooltip?: readonly [{
69
+ readonly locale: "zh";
70
+ readonly message: string;
71
+ }, ...{
72
+ readonly locale: "en" | "ja" | "ko";
73
+ readonly message: string;
74
+ }[]] | undefined;
75
+ readonly displayName?: string | undefined;
76
+ readonly compatibilityDate: "2026-05-24";
77
+ readonly orientation?: "vertical" | "floating" | undefined;
78
+ readonly placeholder?: readonly [{
79
+ readonly locale: "zh";
80
+ readonly message: string;
81
+ }, ...{
82
+ readonly locale: "en" | "ja" | "ko";
83
+ readonly message: string;
84
+ }[]] | undefined;
85
+ readonly readonly?: string | undefined;
86
+ readonly binding?: string | undefined;
87
+ readonly derived?: {
88
+ readonly mode: "formula" | "prefill";
89
+ readonly expression: string;
90
+ } | undefined;
91
+ readonly format?: string | undefined;
92
+ readonly valueFormat?: string | undefined;
93
+ readonly presets?: readonly {
94
+ readonly label: readonly [{
95
+ readonly locale: "zh";
96
+ readonly message: string;
97
+ }, ...{
98
+ readonly locale: "en" | "ja" | "ko";
99
+ readonly message: string;
100
+ }[]];
101
+ readonly id: string;
102
+ readonly value: string;
103
+ }[] | undefined;
104
+ }) => any) | undefined;
105
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
106
+ declare const _default: typeof __VLS_export;
107
+ export default _default;
@@ -0,0 +1,493 @@
1
+ <script setup>
2
+ import { Icon } from "@iconify/vue";
3
+ import { computed } from "vue";
4
+ import { format as formatDate } from "date-fns";
5
+ import { Button } from "../../../../ui/button";
6
+ import { ExpressionEditor } from "../../../../ui/expression-editor";
7
+ import DerivedValueEditor from "../../../DerivedValueEditor.vue";
8
+ import { Field, FieldLabel } from "../../../../ui/field";
9
+ import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText } from "../../../../ui/input-group";
10
+ import { Locale as LocaleField } from "../../../../ui/locale";
11
+ import { Markdown } from "../../../../ui/markdown";
12
+ import {
13
+ Select,
14
+ SelectContent,
15
+ SelectItem,
16
+ SelectTrigger,
17
+ SelectValue
18
+ } from "../../../../ui/select";
19
+ import { getStructFieldDescription, getStructFieldTitle } from "../../../schema";
20
+ import { DEFAULT_FIELD_ORIENTATION, FIELD_ORIENTATION_OPTIONS } from "../../../utils/common";
21
+ import { presetSchema, schema } from "./schema";
22
+ defineOptions({ name: "ShwfedMonthFieldConfig" });
23
+ const value = defineModel({ type: null, ...{ required: true } });
24
+ const fieldSchema = schema(() => {
25
+ });
26
+ const fieldTitle = (f) => getStructFieldTitle(fieldSchema, f) ?? f;
27
+ const fieldDescription = (f) => getStructFieldDescription(fieldSchema, f);
28
+ const presetFieldSchema = presetSchema(() => {
29
+ });
30
+ const presetFieldTitle = (f) => getStructFieldTitle(presetFieldSchema, f) ?? f;
31
+ const presetFieldDescription = (f) => getStructFieldDescription(presetFieldSchema, f);
32
+ const presets = computed(() => value.value.presets ?? []);
33
+ function newId() {
34
+ return typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
35
+ const r = Math.random() * 16 | 0;
36
+ const v = c === "x" ? r : r & 3 | 8;
37
+ return v.toString(16);
38
+ });
39
+ }
40
+ function newPreset() {
41
+ return {
42
+ id: newId(),
43
+ label: [{ locale: "zh", message: "" }],
44
+ value: ""
45
+ };
46
+ }
47
+ function patchPreset(index, patch) {
48
+ const next = [...value.value.presets ?? []];
49
+ const cur = next[index];
50
+ if (!cur) return;
51
+ next[index] = { ...cur, ...patch };
52
+ value.value = { ...value.value, presets: next };
53
+ }
54
+ function addPreset() {
55
+ value.value = { ...value.value, presets: [...value.value.presets ?? [], newPreset()] };
56
+ }
57
+ function removePreset(index) {
58
+ const next = [...value.value.presets ?? []];
59
+ next.splice(index, 1);
60
+ value.value = { ...value.value, presets: next };
61
+ }
62
+ function setPresetLabel(index, label) {
63
+ patchPreset(index, { label });
64
+ }
65
+ function setPresetValue(index, expr) {
66
+ patchPreset(index, { value: expr });
67
+ }
68
+ const pathText = computed({
69
+ get: () => value.value.binding ?? "",
70
+ set: (next) => {
71
+ const trimmed = next.trim();
72
+ if (trimmed.length === 0) {
73
+ const { binding: _omit, ...rest } = value.value;
74
+ value.value = rest;
75
+ } else {
76
+ value.value = { ...value.value, binding: trimmed };
77
+ }
78
+ }
79
+ });
80
+ const formatText = computed({
81
+ get: () => value.value.format ?? "",
82
+ set: (next) => {
83
+ const trimmed = next.trim();
84
+ if (trimmed.length === 0) {
85
+ const { format: _omit, ...rest } = value.value;
86
+ value.value = rest;
87
+ } else {
88
+ value.value = { ...value.value, format: trimmed };
89
+ }
90
+ }
91
+ });
92
+ const valueFormatText = computed({
93
+ get: () => value.value.valueFormat ?? "",
94
+ set: (next) => {
95
+ const trimmed = next.trim();
96
+ if (trimmed.length === 0) {
97
+ const { valueFormat: _omit, ...rest } = value.value;
98
+ value.value = rest;
99
+ } else {
100
+ value.value = { ...value.value, valueFormat: trimmed };
101
+ }
102
+ }
103
+ });
104
+ function previewFormat(fmt) {
105
+ if (!fmt) return "";
106
+ try {
107
+ return formatDate(/* @__PURE__ */ new Date(), fmt);
108
+ } catch {
109
+ return "(\u65E0\u6548\u683C\u5F0F)";
110
+ }
111
+ }
112
+ const formatExample = computed(() => previewFormat(value.value.format ?? ""));
113
+ const valueFormatExample = computed(() => previewFormat(value.value.valueFormat ?? ""));
114
+ </script>
115
+
116
+ <template>
117
+ <div class="flex flex-col gap-3">
118
+ <div class="grid grid-cols-2 gap-3">
119
+ <Field orientation="vertical">
120
+ <FieldLabel class="text-xs text-zinc-500">
121
+ <template
122
+ v-if="fieldDescription('displayName')"
123
+ #tooltip
124
+ >
125
+ <Markdown
126
+ :source="fieldDescription('displayName')"
127
+ block
128
+ class="prose prose-sm prose-zinc"
129
+ />
130
+ </template>
131
+ {{ fieldTitle("displayName") }}
132
+ </FieldLabel>
133
+ <InputGroup>
134
+ <InputGroupInput
135
+ :model-value="value.displayName ?? ''"
136
+ placeholder="例:入职月份"
137
+ @update:model-value="(v) => {
138
+ const s = String(v ?? '');
139
+ value = { ...value, displayName: s.length > 0 ? s : void 0 };
140
+ }"
141
+ />
142
+ </InputGroup>
143
+ </Field>
144
+
145
+ <Field orientation="vertical">
146
+ <FieldLabel class="text-xs text-zinc-500">
147
+ <template #tooltip>
148
+ <Markdown
149
+ source="写入表单状态的嵌套键路径,使用 `.` 分隔,例如 `user.joinMonth`"
150
+ block
151
+ class="prose prose-sm prose-zinc"
152
+ />
153
+ </template>
154
+ {{ fieldTitle("binding") }}
155
+ </FieldLabel>
156
+ <InputGroup>
157
+ <InputGroupInput
158
+ v-model="pathText"
159
+ placeholder="例:user.joinMonth"
160
+ class="font-mono"
161
+ />
162
+ </InputGroup>
163
+ </Field>
164
+ </div>
165
+
166
+ <div class="grid grid-cols-3 gap-3">
167
+ <Field orientation="vertical">
168
+ <FieldLabel class="text-xs text-zinc-500">
169
+ <template
170
+ v-if="fieldDescription('label')"
171
+ #tooltip
172
+ >
173
+ <Markdown
174
+ :source="fieldDescription('label')"
175
+ block
176
+ class="prose prose-sm prose-zinc"
177
+ />
178
+ </template>
179
+ {{ fieldTitle("label") }}
180
+ </FieldLabel>
181
+ <LocaleField
182
+ :model-value="value.label"
183
+ @update:model-value="(v) => value = { ...value, label: v }"
184
+ />
185
+ </Field>
186
+
187
+ <Field orientation="vertical">
188
+ <FieldLabel class="text-xs text-zinc-500">
189
+ <template
190
+ v-if="fieldDescription('placeholder')"
191
+ #tooltip
192
+ >
193
+ <Markdown
194
+ :source="fieldDescription('placeholder')"
195
+ block
196
+ class="prose prose-sm prose-zinc"
197
+ />
198
+ </template>
199
+ {{ fieldTitle("placeholder") }}
200
+ </FieldLabel>
201
+ <LocaleField
202
+ :model-value="value.placeholder"
203
+ @update:model-value="(v) => value = { ...value, placeholder: v }"
204
+ />
205
+ </Field>
206
+
207
+ <Field orientation="vertical">
208
+ <FieldLabel class="text-xs text-zinc-500">
209
+ <template
210
+ v-if="fieldDescription('tooltip')"
211
+ #tooltip
212
+ >
213
+ <Markdown
214
+ :source="fieldDescription('tooltip')"
215
+ block
216
+ class="prose prose-sm prose-zinc"
217
+ />
218
+ </template>
219
+ {{ fieldTitle("tooltip") }}
220
+ </FieldLabel>
221
+ <LocaleField
222
+ markdown
223
+ :model-value="value.tooltip"
224
+ @update:model-value="(v) => value = { ...value, tooltip: v }"
225
+ />
226
+ </Field>
227
+ </div>
228
+
229
+ <div class="grid grid-cols-3 gap-3">
230
+ <Field orientation="vertical">
231
+ <FieldLabel class="text-xs text-zinc-500">
232
+ <template #tooltip>
233
+ <Markdown
234
+ :source="fieldDescription('format') ?? '\u8F93\u5165\u6846\u4E2D\u5C55\u793A\u6708\u4EFD\u7684 `date-fns` \u683C\u5F0F\u4E32'"
235
+ block
236
+ class="prose prose-sm prose-zinc"
237
+ />
238
+ </template>
239
+ {{ fieldTitle("format") }}
240
+ </FieldLabel>
241
+ <InputGroup>
242
+ <InputGroupInput
243
+ v-model="formatText"
244
+ placeholder="例:yyyy-MM"
245
+ class="font-mono"
246
+ />
247
+ <InputGroupAddon
248
+ v-if="formatExample"
249
+ align="inline-end"
250
+ >
251
+ <InputGroupText class="text-xs text-zinc-400">
252
+ {{ formatExample }}
253
+ </InputGroupText>
254
+ </InputGroupAddon>
255
+ </InputGroup>
256
+ </Field>
257
+
258
+ <Field orientation="vertical">
259
+ <FieldLabel class="text-xs text-zinc-500">
260
+ <template #tooltip>
261
+ <Markdown
262
+ :source="fieldDescription('valueFormat') ?? '\u5199\u5165\u8868\u5355\u72B6\u6001\u7684 `date-fns` \u683C\u5F0F\u4E32'"
263
+ block
264
+ class="prose prose-sm prose-zinc"
265
+ />
266
+ </template>
267
+ {{ fieldTitle("valueFormat") }}
268
+ </FieldLabel>
269
+ <InputGroup>
270
+ <InputGroupInput
271
+ v-model="valueFormatText"
272
+ placeholder="例:yyyy-MM"
273
+ class="font-mono"
274
+ />
275
+ <InputGroupAddon
276
+ v-if="valueFormatExample"
277
+ align="inline-end"
278
+ >
279
+ <InputGroupText class="text-xs text-zinc-400">
280
+ {{ valueFormatExample }}
281
+ </InputGroupText>
282
+ </InputGroupAddon>
283
+ </InputGroup>
284
+ </Field>
285
+ </div>
286
+
287
+ <div class="grid grid-cols-3 gap-3">
288
+ <Field orientation="vertical">
289
+ <FieldLabel class="text-xs text-zinc-500">
290
+ <template
291
+ v-if="fieldDescription('orientation')"
292
+ #tooltip
293
+ >
294
+ <Markdown
295
+ :source="fieldDescription('orientation')"
296
+ block
297
+ class="prose prose-sm prose-zinc"
298
+ />
299
+ </template>
300
+ {{ fieldTitle("orientation") }}
301
+ </FieldLabel>
302
+ <Select
303
+ :model-value="value.orientation ?? DEFAULT_FIELD_ORIENTATION"
304
+ @update:model-value="(v) => value = { ...value, orientation: v }"
305
+ >
306
+ <SelectTrigger class="w-full">
307
+ <SelectValue />
308
+ </SelectTrigger>
309
+ <SelectContent>
310
+ <SelectItem
311
+ v-for="opt in FIELD_ORIENTATION_OPTIONS"
312
+ :key="opt.value"
313
+ :value="opt.value"
314
+ >
315
+ {{ opt.label }}
316
+ </SelectItem>
317
+ </SelectContent>
318
+ </Select>
319
+ </Field>
320
+ </div>
321
+
322
+ <Field orientation="vertical">
323
+ <FieldLabel class="text-xs text-zinc-500">
324
+ <template
325
+ v-if="fieldDescription('presets')"
326
+ #tooltip
327
+ >
328
+ <Markdown
329
+ :source="fieldDescription('presets')"
330
+ block
331
+ class="prose prose-sm prose-zinc"
332
+ />
333
+ </template>
334
+ {{ fieldTitle("presets") }}
335
+ </FieldLabel>
336
+
337
+ <div class="flex flex-col gap-3">
338
+ <div
339
+ v-for="(preset, index) in presets"
340
+ :key="preset.id"
341
+ data-slot="month-field-preset"
342
+ class="relative pt-8 grid grid-cols-2 gap-3 rounded border border-zinc-200 bg-zinc-50/40 p-3"
343
+ >
344
+ <InputGroupButton
345
+ variant="destructive"
346
+ size="icon-xs"
347
+ data-slot="month-field-preset-delete"
348
+ aria-label="删除预设"
349
+ class="absolute right-2 top-2 z-10"
350
+ @click="removePreset(index)"
351
+ >
352
+ <Icon icon="fluent:delete-20-regular" />
353
+ </InputGroupButton>
354
+
355
+ <Field orientation="vertical">
356
+ <FieldLabel class="text-xs text-zinc-500">
357
+ <template
358
+ v-if="presetFieldDescription('label')"
359
+ #tooltip
360
+ >
361
+ <Markdown
362
+ :source="presetFieldDescription('label')"
363
+ block
364
+ class="prose prose-sm prose-zinc"
365
+ />
366
+ </template>
367
+ {{ presetFieldTitle("label") }}
368
+ </FieldLabel>
369
+ <LocaleField
370
+ translate-hint="month field preset label"
371
+ :model-value="preset.label"
372
+ @update:model-value="(v) => setPresetLabel(index, v)"
373
+ />
374
+ </Field>
375
+
376
+ <Field orientation="vertical">
377
+ <FieldLabel class="text-xs text-zinc-500">
378
+ <template
379
+ v-if="presetFieldDescription('value')"
380
+ #tooltip
381
+ >
382
+ <Markdown
383
+ :source="presetFieldDescription('value')"
384
+ block
385
+ class="prose prose-sm prose-zinc"
386
+ />
387
+ </template>
388
+ {{ presetFieldTitle("value") }}
389
+ </FieldLabel>
390
+ <ExpressionEditor
391
+ :model-value="preset.value"
392
+ placeholder="例:now.offset(-1, &quot;months&quot;)"
393
+ result-type="Date"
394
+ class="min-h-10"
395
+ @update:model-value="(v) => setPresetValue(index, v)"
396
+ />
397
+ </Field>
398
+ </div>
399
+
400
+ <Button
401
+ type="button"
402
+ data-slot="month-field-add-preset"
403
+ class="w-full justify-center"
404
+ @click="addPreset"
405
+ >
406
+ <Icon icon="fluent:add-20-regular" />
407
+ <span>增加快捷选项</span>
408
+ </Button>
409
+ </div>
410
+ </Field>
411
+
412
+ <div class="grid grid-cols-3 gap-3">
413
+ <Field orientation="vertical">
414
+ <FieldLabel class="text-xs text-zinc-500">
415
+ <template #tooltip>
416
+ <Markdown
417
+ :source="fieldDescription('hidden') ?? '\u8FD4\u56DE `true` \u65F6\u5B57\u6BB5\u5728\u6240\u6709\u5E03\u5C40\u4E2D\u90FD\u4E0D\u6E32\u67D3'"
418
+ block
419
+ class="prose prose-sm prose-zinc"
420
+ />
421
+ </template>
422
+ {{ fieldTitle("hidden") }}
423
+ </FieldLabel>
424
+ <ExpressionEditor
425
+ :model-value="value.hidden ?? ''"
426
+ placeholder="例:form.role == 'guest'"
427
+ result-type="bool"
428
+ class="min-h-10"
429
+ @update:model-value="(v) => value = { ...value, hidden: v.length > 0 ? v : void 0 }"
430
+ />
431
+ </Field>
432
+
433
+ <Field orientation="vertical">
434
+ <FieldLabel class="text-xs text-zinc-500">
435
+ <template #tooltip>
436
+ <Markdown
437
+ :source="fieldDescription('disabled') ?? '\u8FD4\u56DE `true` \u65F6\u8F93\u5165\u6846\u4ECD\u7136\u6E32\u67D3\u4F46\u4E0D\u53EF\u7F16\u8F91'"
438
+ block
439
+ class="prose prose-sm prose-zinc"
440
+ />
441
+ </template>
442
+ {{ fieldTitle("disabled") }}
443
+ </FieldLabel>
444
+ <ExpressionEditor
445
+ :model-value="value.disabled ?? ''"
446
+ placeholder="例:form.status == 'locked'"
447
+ result-type="bool"
448
+ class="min-h-10"
449
+ @update:model-value="(v) => value = { ...value, disabled: v.length > 0 ? v : void 0 }"
450
+ />
451
+ </Field>
452
+
453
+ <Field orientation="vertical">
454
+ <FieldLabel class="text-xs text-zinc-500">
455
+ <template #tooltip>
456
+ <Markdown
457
+ :source="fieldDescription('readonly') ?? '\u8FD4\u56DE `true` \u65F6\u4EC5\u4EE5\u7EAF\u6587\u672C\u5C55\u793A\u5F53\u524D\u503C'"
458
+ block
459
+ class="prose prose-sm prose-zinc"
460
+ />
461
+ </template>
462
+ {{ fieldTitle("readonly") }}
463
+ </FieldLabel>
464
+ <ExpressionEditor
465
+ :model-value="value.readonly ?? ''"
466
+ placeholder="例:form.id != null"
467
+ result-type="bool"
468
+ class="min-h-10"
469
+ @update:model-value="(v) => value = { ...value, readonly: v.length > 0 ? v : void 0 }"
470
+ />
471
+ </Field>
472
+ </div>
473
+
474
+ <Field orientation="vertical">
475
+ <FieldLabel class="text-xs text-zinc-500">
476
+ <template #tooltip>
477
+ <Markdown
478
+ :source="fieldDescription('derived')"
479
+ block
480
+ class="prose prose-sm prose-zinc"
481
+ />
482
+ </template>
483
+ {{ fieldTitle("derived") }}
484
+ </FieldLabel>
485
+ <DerivedValueEditor
486
+ :model-value="value.derived"
487
+ result-type="string"
488
+ placeholder="例:form.startMonth"
489
+ @update:model-value="(v) => value = { ...value, derived: v }"
490
+ />
491
+ </Field>
492
+ </div>
493
+ </template>