@chase-shao/vue-component-lib 1.2.8 → 1.2.10
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/components/data-gen/actions/index.vue.d.ts +1 -1
- package/dist/components/data-gen/views/UpdateView.vue.d.ts +200 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.es.js +682 -553
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/services/dataGen.d.ts +32 -40
- package/package.json +4 -2
|
@@ -4,7 +4,7 @@ import { RedirectType } from '../../../types';
|
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
config: ActionConfig;
|
|
6
6
|
};
|
|
7
|
-
declare const RedirectType: import('vue').ComputedRef<
|
|
7
|
+
declare const RedirectType: import('vue').ComputedRef<any>;
|
|
8
8
|
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
9
9
|
click: (type: ActionTypeEnum, url: string, redirectType: RedirectType) => any;
|
|
10
10
|
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
@@ -9,11 +9,209 @@ declare function __VLS_template(): {
|
|
|
9
9
|
content?(_: {}): any;
|
|
10
10
|
action?(_: {}): any;
|
|
11
11
|
};
|
|
12
|
-
refs: {
|
|
12
|
+
refs: {
|
|
13
|
+
dataWidgetsRef: (import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{
|
|
14
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
15
|
+
onChange?: ((value: any) => any) | undefined;
|
|
16
|
+
onError?: ((value: string) => any) | undefined;
|
|
17
|
+
}>, {
|
|
18
|
+
isFileUpload(): boolean;
|
|
19
|
+
submit(workflowId: number): void;
|
|
20
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
21
|
+
"update:modelValue": (value: any) => any;
|
|
22
|
+
change: (value: any) => any;
|
|
23
|
+
error: (value: string) => any;
|
|
24
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
25
|
+
widgetRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{
|
|
26
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
27
|
+
onChange?: ((value: any) => any) | undefined;
|
|
28
|
+
onError?: ((value: string) => any) | undefined;
|
|
29
|
+
onInput?: ((value: any) => any) | undefined;
|
|
30
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
31
|
+
"update:modelValue": (value: any) => any;
|
|
32
|
+
change: (value: any) => any;
|
|
33
|
+
error: (value: string) => any;
|
|
34
|
+
input: (value: any) => any;
|
|
35
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
36
|
+
P: {};
|
|
37
|
+
B: {};
|
|
38
|
+
D: {};
|
|
39
|
+
C: {};
|
|
40
|
+
M: {};
|
|
41
|
+
Defaults: {};
|
|
42
|
+
}, Readonly<{}> & Readonly<{
|
|
43
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
44
|
+
onChange?: ((value: any) => any) | undefined;
|
|
45
|
+
onError?: ((value: string) => any) | undefined;
|
|
46
|
+
onInput?: ((value: any) => any) | undefined;
|
|
47
|
+
}>, {}, {}, {}, {}, {}> | import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
48
|
+
modelValue: string;
|
|
49
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
50
|
+
}> & Readonly<{
|
|
51
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
52
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
53
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
54
|
+
"update:modelValue": (value?: string | number | null | undefined) => any;
|
|
55
|
+
change: (value?: string | number | null | undefined) => any;
|
|
56
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
57
|
+
P: {};
|
|
58
|
+
B: {};
|
|
59
|
+
D: {};
|
|
60
|
+
C: {};
|
|
61
|
+
M: {};
|
|
62
|
+
Defaults: {};
|
|
63
|
+
}, Readonly<{
|
|
64
|
+
modelValue: string;
|
|
65
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
66
|
+
}> & Readonly<{
|
|
67
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
68
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
69
|
+
}>, {}, {}, {}, {}, {}> | import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
70
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
71
|
+
}> & Readonly<{
|
|
72
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
73
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
74
|
+
}>, {
|
|
75
|
+
submit(workflowId: number): void;
|
|
76
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
77
|
+
"update:modelValue": (value?: string | number | null | undefined) => any;
|
|
78
|
+
change: (value?: string | number | null | undefined) => any;
|
|
79
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
80
|
+
uploadRef: any;
|
|
81
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
82
|
+
P: {};
|
|
83
|
+
B: {};
|
|
84
|
+
D: {};
|
|
85
|
+
C: {};
|
|
86
|
+
M: {};
|
|
87
|
+
Defaults: {};
|
|
88
|
+
}, Readonly<{
|
|
89
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
90
|
+
}> & Readonly<{
|
|
91
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
92
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
93
|
+
}>, {
|
|
94
|
+
submit(workflowId: number): void;
|
|
95
|
+
}, {}, {}, {}, {}> | null;
|
|
96
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
97
|
+
P: {};
|
|
98
|
+
B: {};
|
|
99
|
+
D: {};
|
|
100
|
+
C: {};
|
|
101
|
+
M: {};
|
|
102
|
+
Defaults: {};
|
|
103
|
+
}, Readonly<{}> & Readonly<{
|
|
104
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
105
|
+
onChange?: ((value: any) => any) | undefined;
|
|
106
|
+
onError?: ((value: string) => any) | undefined;
|
|
107
|
+
}>, {
|
|
108
|
+
isFileUpload(): boolean;
|
|
109
|
+
submit(workflowId: number): void;
|
|
110
|
+
}, {}, {}, {}, {}> | null)[];
|
|
111
|
+
};
|
|
13
112
|
rootEl: HTMLDivElement;
|
|
14
113
|
};
|
|
15
114
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
-
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
115
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
116
|
+
dataWidgetsRef: (import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{
|
|
117
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
118
|
+
onChange?: ((value: any) => any) | undefined;
|
|
119
|
+
onError?: ((value: string) => any) | undefined;
|
|
120
|
+
}>, {
|
|
121
|
+
isFileUpload(): boolean;
|
|
122
|
+
submit(workflowId: number): void;
|
|
123
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
124
|
+
"update:modelValue": (value: any) => any;
|
|
125
|
+
change: (value: any) => any;
|
|
126
|
+
error: (value: string) => any;
|
|
127
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
128
|
+
widgetRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{
|
|
129
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
130
|
+
onChange?: ((value: any) => any) | undefined;
|
|
131
|
+
onError?: ((value: string) => any) | undefined;
|
|
132
|
+
onInput?: ((value: any) => any) | undefined;
|
|
133
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
134
|
+
"update:modelValue": (value: any) => any;
|
|
135
|
+
change: (value: any) => any;
|
|
136
|
+
error: (value: string) => any;
|
|
137
|
+
input: (value: any) => any;
|
|
138
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
139
|
+
P: {};
|
|
140
|
+
B: {};
|
|
141
|
+
D: {};
|
|
142
|
+
C: {};
|
|
143
|
+
M: {};
|
|
144
|
+
Defaults: {};
|
|
145
|
+
}, Readonly<{}> & Readonly<{
|
|
146
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
147
|
+
onChange?: ((value: any) => any) | undefined;
|
|
148
|
+
onError?: ((value: string) => any) | undefined;
|
|
149
|
+
onInput?: ((value: any) => any) | undefined;
|
|
150
|
+
}>, {}, {}, {}, {}, {}> | import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
151
|
+
modelValue: string;
|
|
152
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
153
|
+
}> & Readonly<{
|
|
154
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
155
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
156
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
157
|
+
"update:modelValue": (value?: string | number | null | undefined) => any;
|
|
158
|
+
change: (value?: string | number | null | undefined) => any;
|
|
159
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
|
|
160
|
+
P: {};
|
|
161
|
+
B: {};
|
|
162
|
+
D: {};
|
|
163
|
+
C: {};
|
|
164
|
+
M: {};
|
|
165
|
+
Defaults: {};
|
|
166
|
+
}, Readonly<{
|
|
167
|
+
modelValue: string;
|
|
168
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
169
|
+
}> & Readonly<{
|
|
170
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
171
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
172
|
+
}>, {}, {}, {}, {}, {}> | import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
|
|
173
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
174
|
+
}> & Readonly<{
|
|
175
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
176
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
177
|
+
}>, {
|
|
178
|
+
submit(workflowId: number): void;
|
|
179
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
180
|
+
"update:modelValue": (value?: string | number | null | undefined) => any;
|
|
181
|
+
change: (value?: string | number | null | undefined) => any;
|
|
182
|
+
}, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
|
|
183
|
+
uploadRef: any;
|
|
184
|
+
}, any, import('vue').ComponentProvideOptions, {
|
|
185
|
+
P: {};
|
|
186
|
+
B: {};
|
|
187
|
+
D: {};
|
|
188
|
+
C: {};
|
|
189
|
+
M: {};
|
|
190
|
+
Defaults: {};
|
|
191
|
+
}, Readonly<{
|
|
192
|
+
config: import('../../../services/dataGen').WidgetConfig;
|
|
193
|
+
}> & Readonly<{
|
|
194
|
+
"onUpdate:modelValue"?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
195
|
+
onChange?: ((value?: string | number | null | undefined) => any) | undefined;
|
|
196
|
+
}>, {
|
|
197
|
+
submit(workflowId: number): void;
|
|
198
|
+
}, {}, {}, {}, {}> | null;
|
|
199
|
+
}, HTMLDivElement, import('vue').ComponentProvideOptions, {
|
|
200
|
+
P: {};
|
|
201
|
+
B: {};
|
|
202
|
+
D: {};
|
|
203
|
+
C: {};
|
|
204
|
+
M: {};
|
|
205
|
+
Defaults: {};
|
|
206
|
+
}, Readonly<{}> & Readonly<{
|
|
207
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
208
|
+
onChange?: ((value: any) => any) | undefined;
|
|
209
|
+
onError?: ((value: string) => any) | undefined;
|
|
210
|
+
}>, {
|
|
211
|
+
isFileUpload(): boolean;
|
|
212
|
+
submit(workflowId: number): void;
|
|
213
|
+
}, {}, {}, {}, {}> | null)[];
|
|
214
|
+
}, HTMLDivElement>;
|
|
17
215
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
18
216
|
export default _default;
|
|
19
217
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),q=require("axios"),G=require("pinia"),J=require("vue-router"),Q=G.defineStore("main",()=>({token:e.ref(void 0)})),X=async t=>new Promise(a=>setTimeout(a,t)),Y=async(t,a,o,n=void 0)=>{if(t[a]===void 0)try{t[a]=null,t[a]=await o()||n}catch(l){console.error(l),t[a]=void 0}for(;t[a]===null;)await X(100);return t[a]};function D(){const t=M();return{apiBase:t.apiBase||void 0||"",appSecret:t.appSecret||void 0||""}}function I(){const{apiBase:t}=D();return q.create({baseURL:t,timeout:1e4,headers:{"Content-Type":"application/json"}})}const Z=async()=>{const{apiBase:t,appSecret:a}=D(),o=I(),n=Q();return await Y(n,"token",async()=>(await o.get(`${t}/GenerateToken`,{params:{appid:"bpm",appsecret:a}}))?.data?.token)},h=async()=>{const t=await Z(),a=I();return a.defaults.headers.common.Authorization=`Bearer ${t}`,a},x={CurrentUserEmail:()=>"test.email@dataGetter.ts",CurrentUserPositionCode:()=>888,CurrentDatetime:()=>new Date().toISOString(),ApproverEmail:()=>"test.approver@sanofi.com",ApproverPositionCode:()=>999,RejectReason:()=>"Test Reject Reason"};var B=(t=>(t[t.Create=0]="Create",t[t.Update=1]="Update",t[t.Details=2]="Details",t[t.list=3]="list",t))(B||{});function ee(t){const a={pageType:"",fields:{},globalValidations:[]};return t.__ClassAttributes?.forEach(o=>{o.AttributeType==="UIPageType"?a.pageType=o.Type:o.AttributeType==="UIValidationControl"?a.globalValidations.push({rule:o.RuleName,param:o.RuleParameter,appliesTo:o.PropertyNames||["*"]}):o.AttributeType==="UIControl"&&(a.actions||(a.actions=[]),a.actions.push({isSubmit:o.IsSubmit,requestUrl:o.RequestUrl,redirectUrl:o.RedirectUrl,redirectType:o.RedirectType,title:o.Title,widget:o.Widget}))}),Object.entries(t).forEach(([o,n])=>{if(o==="__ClassAttributes"||o==="ClassName")return;const l={validations:[]},{attributes:d,propertyValue:s}=n;switch(s){case null:l.value="";break;case void 0:l.value="";break;default:l.value=s;break}d?.forEach(r=>{r.order||r.Order?l.order=r.order??r.Order:r.AttributeType==="UIControl"?l.widget={...r,column:!0}:r.AttributeType==="UIValidationControl"?l.validations.push(r):r.AttributeType==="UIListed"?l.widget={...r,column:!0}:r.DependentType&&(l.value=x[r.DependentType]?x[r.DependentType]():"")}),a.fields[o]=l}),a}const S=async(t,a)=>{const n=await(await h()).get(`/General/${t}/page`,{params:a});return ee(n?.data)};async function te(t,a){const n=await(await h()).get(`/General/${t}/list`,{params:a});return{data:n.data.Data.propertyValue.data,totalCount:n.data.Data.propertyValue.totalCount,actions:n.data.__ClassAttributes.filter(l=>l.AttributeType==="UIControl").map(l=>({redirectUrl:l.RedirectUrl,location:l.Location,attributeType:l.AttributeType,redirectType:l.RedirectType,readonly:l.Readonly,widget:l.Widget,title:l.Title,isSubmit:l.IsSubmit}))}}async function oe(t,a,o){const l=await(await h()).post(o,a,{params:{className:t}});return l.data.length>0?l.data[0]:0}function ne(t,a){return t.replace(/{workflowId}/g,a)}async function ae(t,a,o,n){const l=await h(),d=ne(n,a);return(await l.put(d,o,{params:{className:t}}))?.data}function le(t,a){return t.replace(/{WorkflowId}/g,a)}function re(t,a){return t.replace(/{ApproverEmail}/g,a)}function ie(t,a){return t.replace(/{WorkFlowReason}/g,a)}async function se(t,a,o,n,l,d){const s=await h();let r=le(d,a);return r=re(r,o),r=ie(r,n),(await s.put(r,l,{params:{className:t}}))?.data}async function ce(t,a){return((await(await h()).get(t,{params:{value:a}}))?.data).map(d=>({value:d.key,label:d.value}))}const ue=(t,a)=>t.reduce((o,n)=>o&&de(n,a),!0),de=(t,a)=>{const{RuleName:o,RuleParameter:n}=t;return pe[o](n,a)},pe={Regex:(t,a)=>new RegExp(t).test(a)},T=e.defineComponent({__name:"InputText",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:a}){const o=t,n=a,l=r=>ue(o.validations,r),d=r=>{n("update:modelValue",r),n("input",r)},s=r=>{const i=l(r);n("update:modelValue",r),n("change",r),n("error",i?"":"Validation Error")};return(r,i)=>{const u=e.resolveComponent("AInput");return e.openBlock(),e.createBlock(u,{"model-value":o.modelValue,clearable:"",disabled:o.readonly||o.config.Readonly,onInput:d,onChange:s},null,8,["model-value","disabled"])}}}),me=e.defineComponent({__name:"InputNumber",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:a}){const o=t,n=a,l=e.ref(100),d=e.ref(0);e.onMounted(()=>{o.validations&&o.validations.forEach(i=>{i.RuleName==="Max"&&(l.value=i.RuleParameter),i.RuleName==="Min"&&(d.value=i.RuleParameter)})});const s=i=>{n("update:modelValue",i),n("input",i)},r=i=>{n("update:modelValue",i),n("change",i)};return(i,u)=>{const c=e.resolveComponent("AInputNumber");return e.openBlock(),e.createBlock(c,{"model-value":o.modelValue,clearable:"",disabled:o.readonly,min:d.value,max:l.value,onInput:s,onChange:r},null,8,["model-value","disabled","min","max"])}}}),E=e.defineComponent({__name:"SelectList",props:{modelValue:{},config:{}},emits:["update:modelValue","change"],setup(t,{emit:a}){const o=t,n=a,l=e.ref(!1),d=e.ref(o.config.options??[]),s=async()=>{d.value=await ce(o.config.DataSourceProvider)};e.onMounted(s);const r=i=>{n("update:modelValue",i),n("change",i)};return(i,u)=>{const c=e.resolveComponent("AOption"),f=e.resolveComponent("ASelect");return e.openBlock(),e.createBlock(f,{"model-value":i.modelValue,loading:l.value,"filter-option":!0,"allow-search":!0,onChange:r},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,p=>(e.openBlock(),e.createBlock(c,{key:p.value,value:p.value,label:p.label},null,8,["value","label"]))),128))]),_:1},8,["model-value","loading"])}}}),fe=e.defineComponent({__name:"Cascader",props:{modelValue:{},config:{}},emits:["update:modelValue","change"],setup(t,{emit:a}){const o=t,n=a,l=e.ref(o.config.options??[]),d=r=>{n("update:modelValue",r),n("change",r)};e.onMounted(async()=>{if(o.config){const r=o.config.DataSourceProvider;if(r){const u=await(await h()).get(r);l.value=u.data}}});const s={value:"key",label:"value"};return(r,i)=>{const u=e.resolveComponent("ACascader"),c=e.resolveComponent("ASpace");return e.openBlock(),e.createBlock(c,{direction:"vertical",size:"large"},{default:e.withCtx(()=>[e.createVNode(u,{"field-names":s,"model-value":r.modelValue,options:l.value,style:{width:"320px"},placeholder:"Please select ...",onChange:d},null,8,["model-value","options"])]),_:1})}}}),ge=e.defineComponent({__name:"FileUpload",props:{config:{}},emits:["update:modelValue","change"],setup(t,{expose:a,emit:o}){const n=t,l=o,d="",s=e.ref(null),r=e.ref(0),i=e.ref([]);function u(p,m){return p.replace(/{WorkflowId}/g,m)}const c=e.computed(()=>{if(n.config.UploadURL){const p=d+n.config.UploadURL;return u(p,r.value.toString())}return""}),f=p=>{l("change",p)};return a({submit(p){console.log("🚀 ~ submit ~ workflowId:",p),s.value&&(n.config.UploadURL&&(r.value=p),e.nextTick(()=>{s.value.submit()}))}}),(p,m)=>{const v=e.resolveComponent("a-upload");return e.openBlock(),e.createBlock(v,{ref_key:"uploadRef",ref:s,modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=b=>i.value=b),"auto-upload":!1,action:c.value,onChange:f},{"start-icon":e.withCtx(()=>m[1]||(m[1]=[])),_:1},8,["modelValue","action"])}}}),ve=e.defineComponent({__name:"TextArea",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:a}){const o=t,n=a,l=s=>{n("update:modelValue",s),n("input",s)},d=s=>{n("update:modelValue",s),n("change",s)};return(s,r)=>{const i=e.resolveComponent("ATextarea");return e.openBlock(),e.createBlock(i,{"model-value":o.modelValue,placeholder:"Please enter something","allow-clear":"",disabled:o.readonly,onInput:l,onChange:d},null,8,["model-value","disabled"])}}}),_e={class:"widget-wrapper"},ke={class:"title mb-1.5"},we={class:"form-widget"},he={class:"widget"},be={key:0,class:"err-msg"},ye=e.defineComponent({__name:"index",props:{config:{},modelValue:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error"],setup(t,{expose:a,emit:o}){const n=t,l=o,d=e.useTemplateRef("widgetRef"),s=e.ref(n.modelValue||n.config?.value);e.watch(s,m=>{l("update:modelValue",m)});const r=e.computed(()=>{switch(n.config?.widget?.Widget){case"TextBox":return T;case"Number":return me;case"SelectList":return E;case"Cascade":return fe;case"File":return ge;case"TextArea":return ve;case"DropDown":return E;default:return T}}),i=e.ref(""),u=m=>{i.value=m},c=m=>l("change",m),f=m=>l("update:modelValue",m);function p(){return n.config?.widget?.Widget==="File"}return a({isFileUpload(){return n.config?.widget?.Widget==="File"},submit(m){p()&&d.value.submit(m)}}),(m,v)=>(e.openBlock(),e.createElementBlock("div",_e,[e.createElementVNode("div",ke,e.toDisplayString(n?.config?.widget?.Title),1),e.createElementVNode("div",we,[e.createElementVNode("div",he,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ref_key:"widgetRef",ref:d,"model-value":n.modelValue,config:n.config.widget,validations:n.config.validations,onError:u,onChange:c,"onUpdate:modelValue":f},null,40,["model-value","config","validations"]))]),i.value.length>0?(e.openBlock(),e.createElementBlock("div",be,e.toDisplayString(i.value),1)):e.createCommentVNode("",!0)])]))}}),N=(t,a)=>{const o=t.__vccOpts||t;for(const[n,l]of a)o[n]=l;return o},A=N(ye,[["__scopeId","data-v-bc0a480b"]]);var k=(t=>(t[t.Submit=0]="Submit",t[t.Link=1]="Link",t))(k||{});const Ce=e.defineComponent({__name:"SubmitButton",props:{url:{},redirectType:{}},emits:["click"],setup(t,{emit:a}){const o=t,n=a;function l(){n("click",k.Submit,o.url,o.redirectType)}return(d,s)=>{const r=e.resolveComponent("AButton");return e.openBlock(),e.createBlock(r,{onClick:l},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})}}}),Ve=e.defineComponent({__name:"DetailLink",props:{url:{},redirectType:{}},emits:["click"],setup(t,{emit:a}){const o=t,n=a;function l(){n("click",k.Link,o.url,o.redirectType)}return(d,s)=>{const r=e.resolveComponent("ALink");return e.openBlock(),e.createBlock(r,{onClick:l},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})}}}),V=e.defineComponent({__name:"index",props:{config:{}},emits:["click"],setup(t,{emit:a}){const o=t,n=a;function l(i,u,c){n("click",i,u,c)}const d=e.computed(()=>{switch(o.config.widget){case"Submit":return Ce;case"Link":default:return Ve}}),s=e.computed(()=>o.config.widget==="Submit"?o.config.requestUrl??"":o.config.widget==="Link"?o.config.redirectUrl??"":""),r=e.computed(()=>o.config.redirectType??"Details");return(i,u)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),{url:s.value,"redirect-type":r.value,onClick:l},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.config.title),1)]),_:1},8,["url","redirect-type"]))}}),R=Symbol("library-router");function L(){const t=e.inject(R,null);return t||J.useRouter()}const Be={class:"page-container relative h-full"},Se={class:"page-title p-4 bg-white"},Ne={class:"title"},Le={class:"fields grid grid-cols-3 gap-8 bg-white p-4"},Ue={class:"action-row absolute bottom-0 left-0 w-full bg-white p-4 flex justify-end"},xe=e.defineComponent({__name:"CreateView",props:{className:{}},setup(t){const a=L(),o=t,n=e.ref(),l=e.computed(()=>n.value?.fields?Object.entries(n.value.fields).map(([f,p])=>({fieldKey:f,...p})).filter(f=>f.widget&&f.widget.Widget!=="Hidden").sort((f,p)=>(f.order??0)-(p.order??0)):[]),d=e.computed(()=>n.value?.actions?[...n.value.actions].reverse():[]),s=e.reactive({}),r=e.ref(!1),i=e.useTemplateRef("dataWidgetsRef");e.onMounted(async()=>{r.value=!0,n.value=await S(B.Create,{className:o.className});for(const c in n.value.fields)s[c]=n.value.fields[c].value;r.value=!1});async function u(c,f,p){switch(c){case k.Submit:const m=await oe(o.className,s,f);i.value?.filter(v=>{v?.submit&&v.submit(m)}),a.push({name:"List"});break;case k.Link:p==="List"&&a.push({name:"List"});break;default:console.warn("Unknown action type:",c)}}return(c,f)=>{const p=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Se,[e.renderSlot(c.$slots,"title",{},()=>[e.createElementVNode("div",Ne,e.toDisplayString(c.className)+" : Create",1)],!0)]),e.createVNode(p,{loading:r.value,class:"page-content p-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(m,v)=>(e.openBlock(),e.createElementBlock("div",{key:m.fieldKey,class:"field"},[e.createVNode(A,{ref_for:!0,ref_key:"dataWidgetsRef",ref:i,name:v,config:m,modelValue:s[m.fieldKey],"onUpdate:modelValue":b=>s[m.fieldKey]=b},null,8,["name","config","modelValue","onUpdate:modelValue"])]))),128))]),e.renderSlot(c.$slots,"content",{},void 0,!0)]),_:3},8,["loading"]),e.createElementVNode("div",Ue,[e.renderSlot(c.$slots,"action",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,m=>(e.openBlock(),e.createBlock(V,{key:m.Title,config:m,class:"action",onClick:u},null,8,["config"]))),128))])])}}}),H=N(xe,[["__scopeId","data-v-fcbe0290"]]),$e={class:"page-container relative h-full"},Re={class:"page-title p-4 bg-white"},Te={class:"title"},Ee={class:"fields grid grid-cols-3 gap-8 bg-white p-4"},De={class:"action-row absolute bottom-0 left-0 w-full bg-white p-4 flex justify-end"},Ie=e.defineComponent({__name:"UpdateView",props:{className:{},workflowId:{}},setup(t){const a=L(),o=t,n=e.ref(),l=e.computed(()=>n.value?.fields?Object.entries(n.value.fields).map(([c,f])=>({fieldKey:c,...f})).filter(c=>c.widget&&c.widget.Widget!=="Hidden").sort((c,f)=>(c.order??0)-(f.order??0)):[]),d=e.computed(()=>n.value?.actions?[...n.value.actions].reverse():[]),s=e.reactive({}),r=e.ref(!0);e.onMounted(async()=>{r.value=!0,n.value=await S(B.Update,{workflowId:o.workflowId,className:o.className});for(const u in n.value.fields)s[u]=n.value.fields[u].value;r.value=!1});async function i(u,c,f){switch(u){case k.Submit:await ae(o.className,o.workflowId,s,c),a.push({name:"List"});break;case k.Link:f==="List"&&a.push({name:"List"});break;default:console.warn("Unknown action type:",u)}}return(u,c)=>{const f=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Re,[e.renderSlot(u.$slots,"title",{},()=>[e.createElementVNode("div",Te,e.toDisplayString(u.className)+" : Update",1)],!0)]),e.createVNode(f,{loading:r.value,class:"page-content p-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(p,m)=>(e.openBlock(),e.createElementBlock("div",{key:p.fieldKey,class:"field"},[e.createVNode(A,{name:m,config:p,modelValue:s[p.fieldKey],"onUpdate:modelValue":v=>s[p.fieldKey]=v},null,8,["name","config","modelValue","onUpdate:modelValue"])]))),128))]),e.renderSlot(u.$slots,"content",{},void 0,!0)]),_:3},8,["loading"]),e.createElementVNode("div",De,[e.renderSlot(u.$slots,"action",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,p=>(e.openBlock(),e.createBlock(V,{key:p.Title,config:p,data:s,class:"action",onClick:i},null,8,["config","data"]))),128))])])}}}),F=N(Ie,[["__scopeId","data-v-73c3a6e5"]]),Ae={class:"page-container relative h-full"},He={class:"page-title p-4 bg-white"},Fe={class:"title"},Pe={class:"bg-white"},Oe={class:"action-row absolute bottom-0 left-0 w-full bg-white p-4 flex justify-end"},We=e.defineComponent({__name:"DetailView",props:{className:{},workflowId:{}},setup(t){const a=L(),o=t,n=e.ref();e.computed(()=>n.value?.fields?Object.entries(n.value.fields).map(([u,c])=>({fieldKey:u,...c})).filter(u=>u.widget&&u.widget.Widget!=="Hidden").sort((u,c)=>(u.order??0)-(c.order??0)):[]);const l=e.computed(()=>n.value?.actions?[...n.value.actions].reverse():[]),d=e.reactive([]),s=e.ref(!0);e.onMounted(async()=>{s.value=!0,n.value=await S(B.Details,{workflowId:o.workflowId,className:o.className});for(const[i,u]of Object.entries(n.value.fields))d.push({label:i,value:u.value});s.value=!1});function r(i,u,c){switch(i){case k.Submit:se(o.className,o.workflowId,x.ApproverEmail(),"",d,u),a.push({name:"List"});break;case k.Link:c==="List"&&a.push({name:"List"});break;default:console.warn("Unknown action type:",i)}}return(i,u)=>{const c=e.resolveComponent("a-descriptions"),f=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",He,[e.renderSlot(i.$slots,"title",{},()=>[e.createElementVNode("div",Fe,e.toDisplayString(i.className)+" : Approve",1)],!0)]),e.createVNode(f,{loading:s.value,class:"page-content p-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Pe,[e.createVNode(c,{data:d,layout:"inline-vertical"},null,8,["data"])]),e.renderSlot(i.$slots,"content",{},void 0,!0)]),_:3},8,["loading"]),e.createElementVNode("div",Oe,[e.renderSlot(i.$slots,"action",{},void 0,!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,p=>(e.openBlock(),e.createBlock(V,{key:p.Title,config:p,data:d,class:"action",onClick:r},null,8,["config","data"]))),128))])])}}}),P=N(We,[["__scopeId","data-v-e77c8eef"]]),je={class:"page-container relative h-full"},Me={class:"page-title p-4 bg-white"},Ke={class:"title"},O=e.defineComponent({__name:"ListView",props:{className:{}},setup(t){const a=L(),o=t,n=e.ref(),l=e.reactive({current:1,total:0,pageSize:20,defaultPageSize:20,showTotal:!0,showPageSize:!0}),d=e.computed(()=>({PageNumber:l.current-1,PageSize:l.pageSize,Filters:[],Sorts:[]})),s=e.ref([]),r=e.ref([]),i=e.ref(!0),u=e.ref(!0),c=e.ref(),f=g=>{console.log(g),s.value=Object.entries(g).filter(([,_])=>_.widget?.column).map(([_,w])=>({title:w.widget.Title,dataIndex:_.charAt(0).toLowerCase()+_.slice(1),order:w.order})).sort((_,w)=>_.order-w.order),s.value.push({title:"Actions",slotName:"optional"})},p=async()=>{u.value=!0;const g=await te(o.className,d.value);r.value=g.data,l.total=g.totalCount,c.value=g.actions,u.value=!1};e.onMounted(async()=>{i.value=!0,n.value=await S(3,{className:o.className}),f(n.value.fields),i.value=!1,p()});const m=g=>{l.current=g,p()},v=g=>{l.pageSize=g,p()};function b(g,_,w,U){switch(g){case k.Link:a.push({name:w,params:{workflowId:U}});break;default:console.warn("Unknown action type:",g)}}function K(g,_,w){switch(g){case k.Link:a.push({name:w});break;default:console.warn("Unknown action type:",g)}}return(g,_)=>{const w=e.resolveComponent("ATable"),U=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",je,[e.createElementVNode("div",Me,[e.renderSlot(g.$slots,"title",{},()=>[e.createElementVNode("div",Ke,e.toDisplayString(g.className)+" : List",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,y=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y.title},[y.location==="InOperation"?(e.openBlock(),e.createBlock(V,{key:0,config:y,class:"action",onClick:_[0]||(_[0]=(...C)=>K(...C))},null,8,["config"])):e.createCommentVNode("",!0)],64))),128))])]),e.createVNode(U,{loading:i.value,class:"page-conteont p-2"},{default:e.withCtx(()=>[e.renderSlot(g.$slots,"content",{},()=>[e.createVNode(w,{columns:s.value,data:r.value,stripe:"",border:"","page-position":"bl",pagination:l,loading:u.value,onPageChange:m,onPageSizeChange:v},{optional:e.withCtx(({record:y})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,C=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:C.title},[C.location==="InTable"?(e.openBlock(),e.createBlock(V,{key:0,config:C,class:"action",onClick:(...z)=>b(...z,y.workflowId)},null,8,["config","onClick"])):e.createCommentVNode("",!0)],64))),128))]),_:1},8,["columns","data","pagination","loading"])])]),_:3},8,["loading"])])}}}),W=Symbol("library-pinia");let $={};function j(t){$={...$,...t}}function M(){return $}const ze={install(t,a={}){a.config&&j(a.config),a.router&&t.provide(R,a.router),a.pinia&&t.provide(W,a.pinia),t.component("CreateView",H),t.component("UpdateView",F),t.component("DetailView",P),t.component("ListView",O)}};exports.CreateView=H;exports.DetailView=P;exports.ListView=O;exports.PiniaKey=W;exports.RouterKey=R;exports.UpdateView=F;exports.default=ze;exports.getLibraryConfig=M;exports.setLibraryConfig=j;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),ee=require("axios"),te=require("pinia"),oe=require("vue-router"),ne=te.defineStore("main",()=>({token:e.ref(void 0)})),ae=async t=>new Promise(o=>setTimeout(o,t)),le=async(t,o,n,a=void 0)=>{if(t[o]===void 0)try{t[o]=null,t[o]=await n()||a}catch(s){console.error(s),t[o]=void 0}for(;t[o]===null;)await ae(100);return t[o]};function F(){const t=G();return{apiBase:t.apiBase||void 0||"",appSecret:t.appSecret||void 0||""}}function W(){const{apiBase:t}=F();return ee.create({baseURL:t,timeout:1e4,headers:{"Content-Type":"application/json"}})}const se=async()=>{const{apiBase:t,appSecret:o}=F(),n=W(),a=ne();return await le(a,"token",async()=>(await n.get(`${t}/GenerateToken`,{params:{appid:"bpm",appsecret:o}}))?.data?.token)},b=async()=>{const t=await se(),o=W();return o.defaults.headers.common.Authorization=`Bearer ${t}`,o},R={CurrentUserEmail:()=>"test.email@dataGetter.ts",CurrentUserPositionCode:()=>888,CurrentDatetime:()=>new Date().toISOString(),ApproverEmail:()=>"test.approver@sanofi.com",ApproverPositionCode:()=>999,RejectReason:()=>"Test Reject Reason"},_=[];for(let t=0;t<256;++t)_.push((t+256).toString(16).slice(1));function re(t,o=0){return(_[t[o+0]]+_[t[o+1]]+_[t[o+2]]+_[t[o+3]]+"-"+_[t[o+4]]+_[t[o+5]]+"-"+_[t[o+6]]+_[t[o+7]]+"-"+_[t[o+8]]+_[t[o+9]]+"-"+_[t[o+10]]+_[t[o+11]]+_[t[o+12]]+_[t[o+13]]+_[t[o+14]]+_[t[o+15]]).toLowerCase()}let L;const ie=new Uint8Array(16);function ce(){if(!L){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");L=crypto.getRandomValues.bind(crypto)}return L(ie)}const de=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),T={randomUUID:de};function ue(t,o,n){if(T.randomUUID&&!t)return T.randomUUID();t=t||{};const a=t.random??t.rng?.()??ce();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,re(a)}var B=(t=>(t[t.Create=0]="Create",t[t.Update=1]="Update",t[t.Details=2]="Details",t[t.list=3]="list",t))(B||{});function pe(t){const o={pageType:"",fields:{},globalValidations:[]};return t.__ClassAttributes?.forEach(n=>{if(n.AttributeType==="UIPageType")o.pageType=n.Type;else if(n.AttributeType==="UIValidationControl")o.globalValidations.push({rule:n.RuleName,param:n.RuleParameter,appliesTo:n.PropertyNames||["*"]});else if(n.AttributeType==="UIControl"){if(n.Widget==="Tab"){o.tabs||(o.tabs=[]),o.tabs.unshift({key:ue(),title:n.Title,filters:n.Filters?JSON.parse(n.Filters):[]});return}o.actions||(o.actions=[]),o.actions.push({isSubmit:n.IsSubmit,requestUrl:n.RequestUrl,redirectUrl:n.RedirectUrl,redirectType:n.RedirectType,title:n.Title,widget:n.Widget,location:n.Location,attributeType:n.AttributeType,readonly:n.Readonly})}}),Object.entries(t).forEach(([n,a])=>{if(n==="__ClassAttributes"||n==="ClassName"||n==="Id"||n==="DeleteFlag"||n==="Status"||n==="WorkflowId"||n==="WorkFlowReason")return;const s={validations:[]},{attributes:d,propertyValue:c}=a;switch(c){case null:s.value="";break;case void 0:s.value="";break;default:s.value=c;break}d?.forEach(l=>{l.order||l.Order?s.order=l.order??l.Order:l.AttributeType==="UIControl"?s.widget={...l,column:!0}:l.AttributeType==="UIValidationControl"?s.validations.push(l):l.AttributeType==="UIListed"?s.widget={...l,column:!0}:l.DependentType&&(s.value=R[l.DependentType]?R[l.DependentType]():"")}),o.fields[n]=s}),o}const N=async(t,o,n)=>{const s=await(await b()).get(`/General/${o}/${t}/page`,{params:n});return pe(s?.data)};async function me(t,o){const a=await(await b()).post(`/General/${t}/list`,{params:o});return{data:a.data.data,totalCount:a.data.totalCount}}async function fe(t,o,n){const s=await(await b()).post(n,o,{params:{className:t}});return s.data.length>0?s.data[0]:0}function ge(t,o){return t.replace(/{workflowId}/g,o)}async function _e(t,o,n,a){const s=await b(),d=ge(a,o);return(await s.put(d,n,{params:{className:t}}))?.data}function ve(t,o){return t.replace(/{WorkflowId}/g,o)}function ke(t,o){return t.replace(/{ApproverEmail}/g,o)}function he(t,o){return t.replace(/{WorkFlowReason}/g,o)}async function we(t,o,n,a,s,d){const c=await b();let l=ve(d,o);return l=ke(l,n),l=he(l,a),(await c.put(l,s,{params:{className:t}}))?.data}async function ye(t,o){return((await(await b()).get(t,{params:{value:o}}))?.data).map(d=>({value:d.key,label:d.value}))}const be=(t,o)=>t.reduce((n,a)=>n&&Ve(a,o),!0),Ve=(t,o)=>{const{RuleName:n,RuleParameter:a}=t;return Ce[n](a,o)},Ce={Regex:(t,o)=>new RegExp(t).test(o)},A=e.defineComponent({__name:"InputText",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:o}){const n=t,a=o,s=l=>be(n.validations,l),d=l=>{a("update:modelValue",l),a("input",l)},c=l=>{const r=s(l);a("update:modelValue",l),a("change",l),a("error",r?"":"Validation Error")};return(l,r)=>{const m=e.resolveComponent("AInput");return e.openBlock(),e.createBlock(m,{"model-value":n.modelValue,clearable:"",disabled:n.readonly||n.config.Readonly,onInput:d,onChange:c},null,8,["model-value","disabled"])}}}),Be=e.defineComponent({__name:"InputNumber",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:o}){const n=t,a=o,s=e.ref(100),d=e.ref(0);e.onMounted(()=>{n.validations&&n.validations.forEach(r=>{r.RuleName==="Max"&&(s.value=r.RuleParameter),r.RuleName==="Min"&&(d.value=r.RuleParameter)})});const c=r=>{a("update:modelValue",r),a("input",r)},l=r=>{a("update:modelValue",r),a("change",r)};return(r,m)=>{const i=e.resolveComponent("AInputNumber");return e.openBlock(),e.createBlock(i,{"model-value":n.modelValue,clearable:"",disabled:n.readonly,min:d.value,max:s.value,onInput:c,onChange:l},null,8,["model-value","disabled","min","max"])}}}),H=e.defineComponent({__name:"SelectList",props:{modelValue:{},config:{}},emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,a=o,s=e.ref(!1),d=e.ref(n.config.options??[]),c=async()=>{d.value=await ye(n.config.DataSourceProvider)};e.onMounted(c);const l=r=>{a("update:modelValue",r),a("change",r)};return(r,m)=>{const i=e.resolveComponent("AOption"),f=e.resolveComponent("ASelect");return e.openBlock(),e.createBlock(f,{"model-value":r.modelValue,loading:s.value,"filter-option":!0,"allow-search":!0,onChange:l},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,u=>(e.openBlock(),e.createBlock(i,{key:u.value,value:u.value,label:u.label},null,8,["value","label"]))),128))]),_:1},8,["model-value","loading"])}}}),Ne=e.defineComponent({__name:"Cascader",props:{modelValue:{},config:{}},emits:["update:modelValue","change"],setup(t,{emit:o}){const n=t,a=o,s=e.ref(n.config.options??[]),d=l=>{a("update:modelValue",l),a("change",l)};e.onMounted(async()=>{if(n.config){const l=n.config.DataSourceProvider;if(l){const m=await(await b()).get(l);s.value=m.data}}});const c={value:"key",label:"value"};return(l,r)=>{const m=e.resolveComponent("ACascader"),i=e.resolveComponent("ASpace");return e.openBlock(),e.createBlock(i,{direction:"vertical",size:"large"},{default:e.withCtx(()=>[e.createVNode(m,{"field-names":c,"model-value":l.modelValue,options:s.value,style:{width:"320px"},placeholder:"Please select ...",onChange:d},null,8,["model-value","options"])]),_:1})}}}),Se=e.defineComponent({__name:"FileUpload",props:{config:{}},emits:["update:modelValue","change"],setup(t,{expose:o,emit:n}){const a=t,s=n,d="",c=e.ref(null),l=e.ref(0),r=e.ref([]);function m(u,p){return u.replace(/{WorkflowId}/g,p)}const i=e.computed(()=>{if(a.config.UploadURL){const u=d+a.config.UploadURL;return m(u,l.value.toString())}return""}),f=u=>{s("change",u)};return o({submit(u){console.log("🚀 ~ submit ~ workflowId:",u),c.value&&(a.config.UploadURL&&(l.value=u),e.nextTick(()=>{c.value.submit()}))}}),(u,p)=>{const v=e.resolveComponent("a-upload");return e.openBlock(),e.createBlock(v,{ref_key:"uploadRef",ref:c,modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=y=>r.value=y),"auto-upload":!1,action:i.value,onChange:f},{"start-icon":e.withCtx(()=>p[1]||(p[1]=[])),_:1},8,["modelValue","action"])}}}),Ee=e.defineComponent({__name:"TextArea",props:{modelValue:{},config:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error","input"],setup(t,{emit:o}){const n=t,a=o,s=c=>{a("update:modelValue",c),a("input",c)},d=c=>{a("update:modelValue",c),a("change",c)};return(c,l)=>{const r=e.resolveComponent("ATextarea");return e.openBlock(),e.createBlock(r,{"model-value":n.modelValue,placeholder:"Please enter something","allow-clear":"",disabled:n.readonly,onInput:s,onChange:d},null,8,["model-value","disabled"])}}}),$e={class:"widget-wrapper"},Ue={class:"title mb-1.5"},De={class:"form-widget"},Le={class:"widget"},Re={key:0,class:"err-msg"},xe=e.defineComponent({__name:"index",props:{config:{},modelValue:{},readonly:{type:Boolean},validations:{}},emits:["update:modelValue","change","error"],setup(t,{expose:o,emit:n}){const a=t,s=n,d=e.useTemplateRef("widgetRef"),c=e.ref(a.modelValue||a.config?.value);e.watch(c,p=>{s("update:modelValue",p)});const l=e.computed(()=>{switch(a.config?.widget?.Widget){case"TextBox":return A;case"Number":return Be;case"SelectList":return H;case"Cascade":return Ne;case"File":return Se;case"TextArea":return Ee;case"DropDown":return H;default:return A}}),r=e.ref(""),m=p=>{r.value=p},i=p=>s("change",p),f=p=>s("update:modelValue",p);function u(){return a.config?.widget?.Widget==="File"}return o({isFileUpload(){return a.config?.widget?.Widget==="File"},submit(p){u()&&d.value.submit(p)}}),(p,v)=>(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Ue,e.toDisplayString(a?.config?.widget?.Title),1),e.createElementVNode("div",De,[e.createElementVNode("div",Le,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),{ref_key:"widgetRef",ref:d,"model-value":a.modelValue,config:a.config.widget,validations:a.config.validations,onError:m,onChange:i,"onUpdate:modelValue":f},null,40,["model-value","config","validations"]))]),r.value.length>0?(e.openBlock(),e.createElementBlock("div",Re,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)])]))}}),S=(t,o)=>{const n=t.__vccOpts||t;for(const[a,s]of o)n[a]=s;return n},P=S(xe,[["__scopeId","data-v-bc0a480b"]]);var w=(t=>(t[t.Submit=0]="Submit",t[t.Link=1]="Link",t))(w||{});const Ie=e.defineComponent({__name:"SubmitButton",props:{url:{},redirectType:{}},emits:["click"],setup(t,{emit:o}){const n=t,a=o;function s(){a("click",w.Submit,n.url,n.redirectType)}return(d,c)=>{const l=e.resolveComponent("AButton");return e.openBlock(),e.createBlock(l,{onClick:s},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})}}}),Te=e.defineComponent({__name:"DetailLink",props:{url:{},redirectType:{}},emits:["click"],setup(t,{emit:o}){const n=t,a=o;function s(){a("click",w.Link,n.url,n.redirectType)}return(d,c)=>{const l=e.resolveComponent("ALink");return e.openBlock(),e.createBlock(l,{onClick:s},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default")]),_:3})}}}),C=e.defineComponent({__name:"index",props:{config:{}},emits:["click"],setup(t,{emit:o}){const n=t,a=o;function s(r,m,i){a("click",r,m,i)}const d=e.computed(()=>{switch(n.config.widget){case"Submit":return Ie;case"Link":default:return Te}}),c=e.computed(()=>n.config.widget==="Submit"?n.config.requestUrl??"":n.config.widget==="Link"?n.config.redirectUrl??"":""),l=e.computed(()=>n.config.redirectType??"Details");return(r,m)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),{url:c.value,"redirect-type":l.value,onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(n.config.title),1)]),_:1},8,["url","redirect-type"]))}}),I=Symbol("library-router");function E(){const t=e.inject(I,null);return t||oe.useRouter()}const Ae={class:"page-container"},He={class:"page-header"},Fe={class:"page-title"},We={class:"page-subtitle"},Pe={class:"page-body"},Oe={class:"form-card"},Me={class:"form-fields"},je={key:0,class:"form-content"},Ke={class:"page-footer"},ze={class:"action-container"},qe={class:"action-buttons"},Ge=e.defineComponent({__name:"CreateView",props:{className:{}},setup(t){const o=E(),n=t,a=e.ref(),s=e.computed(()=>a.value?.fields?Object.entries(a.value.fields).map(([f,u])=>({fieldKey:f,...u})).filter(f=>f.widget&&f.widget.Widget!=="Hidden").sort((f,u)=>(f.order??0)-(u.order??0)):[]),d=e.computed(()=>a.value?.actions?[...a.value.actions].reverse():[]),c=e.reactive({}),l=e.ref(!1),r=e.useTemplateRef("dataWidgetsRef");e.onMounted(async()=>{l.value=!0,a.value=await N(B.Create,n.className);for(const i in a.value.fields)c[i]=a.value.fields[i].value;l.value=!1});async function m(i,f,u){switch(i){case w.Submit:const p=await fe(n.className,c,f);r.value?.filter(v=>{v?.submit&&v.submit(p)}),o.push({name:"List"});break;case w.Link:u==="List"&&o.push({name:"List"});break;default:console.warn("Unknown action type:",i)}}return(i,f)=>{const u=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",Ae,[e.createElementVNode("div",He,[e.renderSlot(i.$slots,"title",{},()=>[e.createElementVNode("h1",Fe,"创建 "+e.toDisplayString(i.className),1),e.createElementVNode("p",We,"请填写以下信息创建新的 "+e.toDisplayString(i.className)+" 记录",1)],!0)]),e.createElementVNode("div",Pe,[e.createVNode(u,{loading:l.value,class:"form-container"},{default:e.withCtx(()=>[e.createElementVNode("div",Oe,[e.createElementVNode("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(p,v)=>(e.openBlock(),e.createElementBlock("div",{key:p.fieldKey,class:"form-field-wrapper"},[e.createVNode(P,{ref_for:!0,ref_key:"dataWidgetsRef",ref:r,name:v,config:p,modelValue:c[p.fieldKey],"onUpdate:modelValue":y=>c[p.fieldKey]=y,class:"form-field"},null,8,["name","config","modelValue","onUpdate:modelValue"])]))),128))]),i.$slots.content?(e.openBlock(),e.createElementBlock("div",je,[e.renderSlot(i.$slots,"content",{},void 0,!0)])):e.createCommentVNode("",!0)])]),_:3},8,["loading"])]),e.createElementVNode("div",Ke,[e.createElementVNode("div",ze,[e.renderSlot(i.$slots,"action",{},void 0,!0),e.createElementVNode("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,p=>(e.openBlock(),e.createBlock(C,{key:p.Title,config:p,class:"action-button",onClick:m},null,8,["config"]))),128))])])])])}}}),O=S(Ge,[["__scopeId","data-v-da0010da"]]),Je={class:"page-container"},Qe={class:"page-header"},Xe={class:"page-title"},Ye={class:"page-subtitle"},Ze={class:"page-body"},et={class:"form-card"},tt={class:"form-fields"},ot={key:0,class:"form-content"},nt={class:"page-footer"},at={class:"action-container"},lt={class:"action-buttons"},st=e.defineComponent({__name:"UpdateView",props:{className:{},workflowId:{}},setup(t){const o=E(),n=t,a=e.ref(),s=e.computed(()=>a.value?.fields?Object.entries(a.value.fields).map(([f,u])=>({fieldKey:f,...u})).filter(f=>f.widget&&f.widget.Widget!=="Hidden").sort((f,u)=>(f.order??0)-(u.order??0)):[]),d=e.computed(()=>a.value?.actions?[...a.value.actions].reverse():[]),c=e.reactive({}),l=e.ref(!1),r=e.useTemplateRef("dataWidgetsRef");e.onMounted(async()=>{l.value=!0,a.value=await N(B.Update,n.className,{workflowId:n.workflowId});for(const i in a.value.fields)c[i]=a.value.fields[i].value;l.value=!1});async function m(i,f,u){switch(i){case w.Submit:const p=await _e(n.className,n.workflowId,c,f);r.value?.filter(v=>{v?.submit&&v.submit(p)}),o.push({name:"List"});break;case w.Link:u==="List"&&o.push({name:"List"});break;default:console.warn("Unknown action type:",i)}}return(i,f)=>{const u=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",Je,[e.createElementVNode("div",Qe,[e.renderSlot(i.$slots,"title",{},()=>[e.createElementVNode("h1",Xe,"编辑 "+e.toDisplayString(i.className),1),e.createElementVNode("p",Ye,"修改以下信息来更新 "+e.toDisplayString(i.className)+" 记录 (ID: "+e.toDisplayString(i.workflowId)+")",1)],!0)]),e.createElementVNode("div",Ze,[e.createVNode(u,{loading:l.value,class:"form-container"},{default:e.withCtx(()=>[e.createElementVNode("div",et,[e.createElementVNode("div",tt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(p,v)=>(e.openBlock(),e.createElementBlock("div",{key:p.fieldKey,class:"form-field-wrapper"},[e.createVNode(P,{ref_for:!0,ref_key:"dataWidgetsRef",ref:r,name:v,config:p,modelValue:c[p.fieldKey],"onUpdate:modelValue":y=>c[p.fieldKey]=y,class:"form-field"},null,8,["name","config","modelValue","onUpdate:modelValue"])]))),128))]),i.$slots.content?(e.openBlock(),e.createElementBlock("div",ot,[e.renderSlot(i.$slots,"content",{},void 0,!0)])):e.createCommentVNode("",!0)])]),_:3},8,["loading"])]),e.createElementVNode("div",nt,[e.createElementVNode("div",at,[e.renderSlot(i.$slots,"action",{},void 0,!0),e.createElementVNode("div",lt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,p=>(e.openBlock(),e.createBlock(C,{key:p.Title,config:p,data:c,class:"action-button",onClick:m},null,8,["config","data"]))),128))])])])])}}}),M=S(st,[["__scopeId","data-v-2d4c0c23"]]),rt={class:"page-container"},it={class:"page-header"},ct={class:"header-content"},dt={class:"page-title"},ut={class:"page-subtitle"},pt={class:"page-body"},mt={class:"detail-card"},ft={class:"detail-content"},gt={key:0,class:"detail-extra"},_t={class:"page-footer"},vt={class:"action-container"},kt={class:"action-buttons"},ht=e.defineComponent({__name:"DetailView",props:{className:{},workflowId:{}},setup(t){const o=E(),n=t,a=e.ref();e.computed(()=>a.value?.fields?Object.entries(a.value.fields).map(([m,i])=>({fieldKey:m,...i})).filter(m=>m.widget&&m.widget.Widget!=="Hidden").sort((m,i)=>(m.order??0)-(i.order??0)):[]);const s=e.computed(()=>a.value?.actions?[...a.value.actions].reverse():[]),d=e.reactive([]),c=e.ref(!0);e.onMounted(async()=>{c.value=!0,a.value=await N(B.Details,n.className,{workflowId:n.workflowId});for(const[r,m]of Object.entries(a.value.fields))d.push({label:r,value:m.value});c.value=!1});function l(r,m,i){switch(r){case w.Submit:we(n.className,n.workflowId,R.ApproverEmail(),"",d,m),o.push({name:"List"});break;case w.Link:i==="List"&&o.push({name:"List"});break;default:console.warn("Unknown action type:",r)}}return(r,m)=>{const i=e.resolveComponent("a-descriptions"),f=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("div",it,[e.createElementVNode("div",ct,[e.renderSlot(r.$slots,"title",{},()=>[e.createElementVNode("h1",dt,e.toDisplayString(r.className)+" 详情",1),e.createElementVNode("p",ut,"查看 "+e.toDisplayString(r.className)+" 记录详细信息 (ID: "+e.toDisplayString(r.workflowId)+")",1)],!0)])]),e.createElementVNode("div",pt,[e.createVNode(f,{loading:c.value,class:"detail-container"},{default:e.withCtx(()=>[e.createElementVNode("div",mt,[e.createElementVNode("div",ft,[e.createVNode(i,{data:d,layout:"inline-vertical",column:{xs:1,sm:2,md:3,lg:3,xl:3,xxl:4},class:"detail-descriptions"},null,8,["data"])]),r.$slots.content?(e.openBlock(),e.createElementBlock("div",gt,[e.renderSlot(r.$slots,"content",{},void 0,!0)])):e.createCommentVNode("",!0)])]),_:3},8,["loading"])]),e.createElementVNode("div",_t,[e.createElementVNode("div",vt,[e.renderSlot(r.$slots,"action",{},void 0,!0),e.createElementVNode("div",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,u=>(e.openBlock(),e.createBlock(C,{key:u.Title,config:u,data:d,class:"action-button",onClick:l},null,8,["config","data"]))),128))])])])])}}}),j=S(ht,[["__scopeId","data-v-831a989f"]]),wt={class:"page-container relative h-full"},yt={class:"page-title p-4 bg-white"},bt={class:"title"},K=e.defineComponent({__name:"ListView",props:{className:{}},setup(t){const o=E(),n=t,a=e.ref(),s=e.reactive({current:1,total:0,pageSize:20,defaultPageSize:20,showTotal:!0,showPageSize:!0,filters:[]});function d(){return{pageNumber:s.current-1,pageSize:s.pageSize,filters:s.filters,sorts:[{key:"status",type:0}]}}const c=e.ref([]),l=e.ref([]),r=e.ref(!0),m=e.ref(!0),i=e.ref(),f=g=>{console.log(g),c.value=Object.entries(g).filter(([,k])=>k.widget?.column).map(([k,h])=>({title:h.widget.Title,dataIndex:k.charAt(0).toLowerCase()+k.slice(1),order:h.order,ellipsis:!0,tooltip:!0})).sort((k,h)=>k.order-h.order),c.value.push({title:"Actions",slotName:"optional"})},u=async()=>{m.value=!0;const g=await me(n.className,d());l.value=g.data,s.total=g.totalCount,m.value=!1};e.onMounted(async()=>{r.value=!0,a.value=await N(3,n.className),console.log("🚀 ~ pageData.value:",a.value.actions,a.value.fields),f(a.value.fields),u(),i.value=a.value.actions,r.value=!1});const p=g=>{s.current=g,u()},v=g=>{console.log("🚀 ~ pageSizeChangeHandler ~ pageSize:",g),s.pageSize=g,u()};function y(g,k,h,$){switch(g){case w.Link:o.push({name:h,params:{workflowId:$}});break;default:console.warn("Unknown action type:",g)}}function J(g,k,h){switch(g){case w.Link:o.push({name:h});break;default:console.warn("Unknown action type:",g)}}function Q(g){const k=a.value?.tabs?.find(h=>h.key===g)?.filters;s.filters=k||[],u()}return(g,k)=>{const h=e.resolveComponent("a-table"),$=e.resolveComponent("a-tab-pane"),X=e.resolveComponent("a-tabs"),Y=e.resolveComponent("a-spin");return e.openBlock(),e.createElementBlock("div",wt,[e.createElementVNode("div",yt,[e.renderSlot(g.$slots,"title",{},()=>[e.createElementVNode("div",bt,e.toDisplayString(g.className)+" : List",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,V=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:V.title},[V.location==="InOperation"?(e.openBlock(),e.createBlock(C,{key:0,config:V,class:"action",onClick:k[0]||(k[0]=(...U)=>J(...U))},null,8,["config"])):e.createCommentVNode("",!0)],64))),128))])]),e.createVNode(Y,{loading:r.value,class:"page-conteont p-2"},{default:e.withCtx(()=>[e.renderSlot(g.$slots,"content",{},()=>[e.createVNode(X,{class:"mb-4",onTabClick:Q},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value?.tabs,V=>(e.openBlock(),e.createBlock($,{key:V.key,title:V.title},{default:e.withCtx(()=>[e.createVNode(h,{columns:c.value,data:l.value,stripe:"",border:"","page-position":"bl",pagination:s,loading:m.value,scroll:{x:"100%"},"table-layout-fixed":"","row-selection":{type:"checkbox",showCheckedAll:!0,onlyCurrent:!1},onPageChange:p,onPageSizeChange:v},{optional:e.withCtx(({record:U})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,D=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:D.title},[D.location==="InTable"?(e.openBlock(),e.createBlock(C,{key:0,config:D,class:"action",onClick:(...Z)=>y(...Z,U.workflowId)},null,8,["config","onClick"])):e.createCommentVNode("",!0)],64))),128))]),_:1},8,["columns","data","pagination","loading"])]),_:2},1032,["title"]))),128))]),_:1})])]),_:3},8,["loading"])])}}}),z=Symbol("library-pinia");let x={};function q(t){x={...x,...t}}function G(){return x}const Vt={install(t,o={}){o.config&&q(o.config),o.router&&t.provide(I,o.router),o.pinia&&t.provide(z,o.pinia),t.component("CreateView",O),t.component("UpdateView",M),t.component("DetailView",j),t.component("ListView",K)}};exports.CreateView=O;exports.DetailView=j;exports.ListView=K;exports.PiniaKey=z;exports.RouterKey=I;exports.UpdateView=M;exports.default=Vt;exports.getLibraryConfig=G;exports.setLibraryConfig=q;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|