@steedos-widgets/amis-lib 1.1.0-beta.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +99 -92
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +99 -92
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +99 -92
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/calendar.d.ts +18 -0
- package/dist/types/lib/objects.d.ts +18 -0
- package/dist/types/workflow/approve.d.ts +34 -45
- package/dist/types/workflow/flow.d.ts +34 -45
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1049,17 +1049,10 @@ async function getSource$1(field, ctx) {
|
|
|
1049
1049
|
data.$value = `$${valueField}`;
|
|
1050
1050
|
// data["&"] = "$$";
|
|
1051
1051
|
|
|
1052
|
-
const fieldValue = ctx.value;
|
|
1053
|
-
|
|
1054
1052
|
const requestAdaptor = `
|
|
1055
1053
|
var filters = [['parent', '=', null]];
|
|
1056
1054
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
1057
1055
|
var defaultValue = api.data.$value;
|
|
1058
|
-
var fieldValue = ${JSON.stringify(fieldValue)};
|
|
1059
|
-
if(!defaultValue && fieldValue){
|
|
1060
|
-
// 如果表单中没有字段值,则认字段上配置的value属性
|
|
1061
|
-
defaultValue = fieldValue;
|
|
1062
|
-
}
|
|
1063
1056
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
1064
1057
|
var optionsFilters = [["user", optionsFiltersOp, []]];
|
|
1065
1058
|
if (defaultValue) {
|
|
@@ -4252,21 +4245,20 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
4252
4245
|
// return await lookupToAmisGroup(field, readonly, ctx);
|
|
4253
4246
|
}
|
|
4254
4247
|
|
|
4255
|
-
if(ctx.ids || ctx.idsTrackOn){
|
|
4256
|
-
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4257
|
-
}
|
|
4258
|
-
|
|
4259
4248
|
let referenceTo = await getReferenceTo(field);
|
|
4260
4249
|
if(!referenceTo){
|
|
4261
4250
|
return await lookupToAmisSelect(field, readonly, ctx);
|
|
4262
4251
|
}
|
|
4263
4252
|
|
|
4264
|
-
const refObject = await getUISchema(referenceTo.objectName);
|
|
4265
|
-
|
|
4266
4253
|
if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
|
|
4254
|
+
if(ctx.idsDependOn || field.amis){
|
|
4255
|
+
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
4256
|
+
}
|
|
4267
4257
|
return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
4268
4258
|
}
|
|
4269
4259
|
|
|
4260
|
+
const refObject = await getUISchema(referenceTo.objectName);
|
|
4261
|
+
|
|
4270
4262
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
4271
4263
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
4272
4264
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
@@ -4301,7 +4293,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4301
4293
|
}
|
|
4302
4294
|
const refObjectConfig = await getUISchema(referenceTo.objectName);
|
|
4303
4295
|
|
|
4304
|
-
const {
|
|
4296
|
+
const { idsDependOn } = ctx;
|
|
4305
4297
|
|
|
4306
4298
|
const fields = {
|
|
4307
4299
|
[referenceTo.labelField.name]: referenceTo.labelField,
|
|
@@ -4315,14 +4307,9 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4315
4307
|
source.data.$term = "$term";
|
|
4316
4308
|
source.data.$self = "$$";
|
|
4317
4309
|
|
|
4318
|
-
if(
|
|
4319
|
-
source.sendOn =
|
|
4320
|
-
|
|
4321
|
-
else {
|
|
4322
|
-
source.sendOn = false;
|
|
4323
|
-
}
|
|
4324
|
-
if(idsTrackOn){
|
|
4325
|
-
source.sendOn = `\${${idsTrackOn} && ${idsTrackOn}.length}`;
|
|
4310
|
+
if(idsDependOn && source.url){
|
|
4311
|
+
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
4312
|
+
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
4326
4313
|
}
|
|
4327
4314
|
|
|
4328
4315
|
source.requestAdaptor = `
|
|
@@ -4339,10 +4326,10 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
4339
4326
|
}
|
|
4340
4327
|
}
|
|
4341
4328
|
|
|
4342
|
-
var ids
|
|
4343
|
-
var
|
|
4344
|
-
if(
|
|
4345
|
-
ids = api.data.$self[
|
|
4329
|
+
var ids;
|
|
4330
|
+
var idsDependOn = "${idsDependOn}";
|
|
4331
|
+
if(idsDependOn){
|
|
4332
|
+
ids = api.data.$self[idsDependOn];
|
|
4346
4333
|
}
|
|
4347
4334
|
if(ids && ids.length){
|
|
4348
4335
|
filters.push(["${referenceTo.valueField.name}", "=", ids]);
|
|
@@ -6878,7 +6865,7 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
6878
6865
|
initialView = "dayGridMonth";
|
|
6879
6866
|
break;
|
|
6880
6867
|
case "agenda":
|
|
6881
|
-
initialView = "
|
|
6868
|
+
initialView = "listWeek";
|
|
6882
6869
|
break;
|
|
6883
6870
|
}
|
|
6884
6871
|
}
|
|
@@ -7100,6 +7087,30 @@ async function getObjectCalendar(objectSchema, calendarOptions, options) {
|
|
|
7100
7087
|
}
|
|
7101
7088
|
]
|
|
7102
7089
|
},
|
|
7090
|
+
"eventDidMount": {
|
|
7091
|
+
"weight": 0,
|
|
7092
|
+
"actions": [
|
|
7093
|
+
{
|
|
7094
|
+
"componentId": "",
|
|
7095
|
+
"args": {
|
|
7096
|
+
},
|
|
7097
|
+
"actionType": "custom",
|
|
7098
|
+
"script": "console.log('eventDidMount'); console.log(event);"
|
|
7099
|
+
}
|
|
7100
|
+
]
|
|
7101
|
+
},
|
|
7102
|
+
"eventWillUnmount": {
|
|
7103
|
+
"weight": 0,
|
|
7104
|
+
"actions": [
|
|
7105
|
+
{
|
|
7106
|
+
"componentId": "",
|
|
7107
|
+
"args": {
|
|
7108
|
+
},
|
|
7109
|
+
"actionType": "custom",
|
|
7110
|
+
"script": "console.log('eventWillUnmount'); console.log(event);"
|
|
7111
|
+
}
|
|
7112
|
+
]
|
|
7113
|
+
},
|
|
7103
7114
|
}
|
|
7104
7115
|
};
|
|
7105
7116
|
return amisSchema;
|
|
@@ -8930,7 +8941,6 @@ const getJudgeInput = async (instance) => {
|
|
|
8930
8941
|
"args": {
|
|
8931
8942
|
"value": {
|
|
8932
8943
|
new_judge: "${event.data.value}",
|
|
8933
|
-
new_next_step: undefined,
|
|
8934
8944
|
next_step: undefined,
|
|
8935
8945
|
}
|
|
8936
8946
|
},
|
|
@@ -8982,7 +8992,11 @@ const getNextStepInput = async (instance) => {
|
|
|
8982
8992
|
id: "u:next_step",
|
|
8983
8993
|
multiple: false,
|
|
8984
8994
|
required: true,
|
|
8985
|
-
selectFirst: true,
|
|
8995
|
+
// selectFirst: true,
|
|
8996
|
+
autoFill: {
|
|
8997
|
+
"new_next_step": "${step}",
|
|
8998
|
+
"next_users": null
|
|
8999
|
+
},
|
|
8986
9000
|
"source": {
|
|
8987
9001
|
"url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
|
|
8988
9002
|
"headers": {
|
|
@@ -8994,10 +9008,12 @@ const getNextStepInput = async (instance) => {
|
|
|
8994
9008
|
"requestAdaptor": "let { context, judge } = api.data; if(!judge){judge='approved'}\nconst formValues = SteedosUI.getRef(api.data.$scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\nflowVersionId: context.flowVersion._id,\n instanceId: context._id,\n flowId: context.flow._id,\n step: context.step,\n judge: judge,\n values: formValues\n}\n\n\n return api;",
|
|
8995
9009
|
"adaptor": `
|
|
8996
9010
|
payload.data = {
|
|
9011
|
+
value: payload.nextSteps.length === 1 ? payload.nextSteps[0]._id : null,
|
|
8997
9012
|
options: _.map(payload.nextSteps, (item)=>{
|
|
8998
9013
|
return {
|
|
8999
9014
|
label: item.name,
|
|
9000
|
-
value: item
|
|
9015
|
+
value: item._id,
|
|
9016
|
+
step: item
|
|
9001
9017
|
}
|
|
9002
9018
|
})
|
|
9003
9019
|
};
|
|
@@ -9010,29 +9026,29 @@ const getNextStepInput = async (instance) => {
|
|
|
9010
9026
|
"judge": "${new_judge}",
|
|
9011
9027
|
}
|
|
9012
9028
|
},
|
|
9013
|
-
"onEvent": {
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9019
|
-
|
|
9020
|
-
|
|
9021
|
-
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
}
|
|
9029
|
+
// "onEvent": {
|
|
9030
|
+
// "change": {
|
|
9031
|
+
// "weight": 0,
|
|
9032
|
+
// "actions": [
|
|
9033
|
+
// {
|
|
9034
|
+
// "componentId": "instance_approval",
|
|
9035
|
+
// "args": {
|
|
9036
|
+
// "value": {
|
|
9037
|
+
// new_next_step: "${event.data.value}",
|
|
9038
|
+
// }
|
|
9039
|
+
// },
|
|
9040
|
+
// "actionType": "setValue"
|
|
9041
|
+
// },
|
|
9042
|
+
// // {
|
|
9043
|
+
// // "args": {
|
|
9044
|
+
// // next_step: "${event.data.value}",
|
|
9045
|
+
// // },
|
|
9046
|
+
// // "actionType": "broadcast",
|
|
9047
|
+
// // eventName: "approve_next_step_change"
|
|
9048
|
+
// // },
|
|
9049
|
+
// ]
|
|
9050
|
+
// }
|
|
9051
|
+
// }
|
|
9036
9052
|
},
|
|
9037
9053
|
],
|
|
9038
9054
|
id: "u:4d3a884b437c",
|
|
@@ -9070,56 +9086,44 @@ const getNextStepUsersInput = async (instance) => {
|
|
|
9070
9086
|
body: [
|
|
9071
9087
|
// TODO 处理下一步处理人默认值
|
|
9072
9088
|
Object.assign({},
|
|
9073
|
-
// await lookupToAmisPicker(
|
|
9074
|
-
// {
|
|
9075
|
-
// name: "next_users",
|
|
9076
|
-
// label: false,
|
|
9077
|
-
// reference_to: "space_users",
|
|
9078
|
-
// reference_to_field: 'user',
|
|
9079
|
-
// multiple: false,
|
|
9080
|
-
// },
|
|
9081
|
-
// false,
|
|
9082
|
-
// {}
|
|
9083
|
-
// ),
|
|
9084
9089
|
{
|
|
9085
9090
|
"type": "steedos-select-user"
|
|
9086
9091
|
},
|
|
9087
|
-
|
|
9088
9092
|
{
|
|
9089
9093
|
name: "next_users",
|
|
9090
|
-
// value: "",
|
|
9091
9094
|
hiddenOn: "this.new_next_step.deal_type != 'pickupAtRuntime'",
|
|
9092
9095
|
required: true
|
|
9093
9096
|
}),
|
|
9094
9097
|
{
|
|
9095
|
-
type: "
|
|
9098
|
+
type: "steedos-select-user",
|
|
9096
9099
|
label: "",
|
|
9097
9100
|
name: "next_users",
|
|
9098
|
-
// options: await getNextStepOptions(instance),
|
|
9099
9101
|
id: "u:next_users",
|
|
9100
9102
|
required: true,
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
"
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
"
|
|
9108
|
-
|
|
9109
|
-
|
|
9103
|
+
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'",
|
|
9104
|
+
amis: {
|
|
9105
|
+
multiple: "this.new_next_step.deal_type === 'counterSign'",
|
|
9106
|
+
"source": {
|
|
9107
|
+
"url": "${context.rootUrl}/api/workflow/v2/nextStepUsers",
|
|
9108
|
+
"method": "post",
|
|
9109
|
+
"sendOn": "!!this.new_next_step && this.new_next_step.step_type != 'end'",
|
|
9110
|
+
"headers": {
|
|
9111
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
9112
|
+
},
|
|
9113
|
+
"messages": {
|
|
9114
|
+
},
|
|
9115
|
+
"requestAdaptor": "\nconst { context, next_step, $scopeId } = api.data;\nconst formValues = SteedosUI.getRef($scopeId).getComponentById(\"instance_form\").getValues();\n\napi.data = {\n instanceId: context._id,\n nextStepId: next_step._id,\n values: formValues\n}\n\n\n return api;",
|
|
9116
|
+
"adaptor": "\npayload.data = {value: payload.nextStepUsers.length === 1 ? payload.nextStepUsers[0].id : null, options: payload.nextStepUsers};\nreturn payload;",
|
|
9117
|
+
"data": {
|
|
9118
|
+
"&": "$$",
|
|
9119
|
+
"$scopeId": "$scopeId",
|
|
9120
|
+
"context": "${context}",
|
|
9121
|
+
"next_step": "${new_next_step}",
|
|
9122
|
+
}
|
|
9110
9123
|
},
|
|
9111
|
-
"
|
|
9112
|
-
"
|
|
9113
|
-
|
|
9114
|
-
"&": "$$",
|
|
9115
|
-
"$scopeId": "$scopeId",
|
|
9116
|
-
"context": "${context}",
|
|
9117
|
-
"next_step": "${new_next_step}",
|
|
9118
|
-
}
|
|
9119
|
-
},
|
|
9120
|
-
"labelField": "name",
|
|
9121
|
-
"valueField": "id",
|
|
9122
|
-
hiddenOn: "this.new_next_step.deal_type === 'pickupAtRuntime'"
|
|
9124
|
+
"labelField": "name",
|
|
9125
|
+
"valueField": "id",
|
|
9126
|
+
}
|
|
9123
9127
|
}
|
|
9124
9128
|
],
|
|
9125
9129
|
id: "u:81a4913c61cc",
|
|
@@ -9321,6 +9325,10 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9321
9325
|
clearPersistDataAfterSubmit: true,
|
|
9322
9326
|
persistData: `workflow_approve_form_${instance.approve._id}`,
|
|
9323
9327
|
body: [
|
|
9328
|
+
{
|
|
9329
|
+
type: 'hidden',
|
|
9330
|
+
name: 'new_next_step'
|
|
9331
|
+
},
|
|
9324
9332
|
await getJudgeInput(instance),
|
|
9325
9333
|
{
|
|
9326
9334
|
type: "textarea",
|
|
@@ -9351,7 +9359,7 @@ const getApprovalDrawerSchema = async (instance) => {
|
|
|
9351
9359
|
// {
|
|
9352
9360
|
// "actionType": "reload",
|
|
9353
9361
|
// "componentId": "u:nex_users",
|
|
9354
|
-
// "args": {
|
|
9362
|
+
// "args": {
|
|
9355
9363
|
// }
|
|
9356
9364
|
// }
|
|
9357
9365
|
// ]
|
|
@@ -9662,7 +9670,7 @@ const getInstanceApprovalHistory = async ()=>{
|
|
|
9662
9670
|
* @Author: baozhoutao@steedos.com
|
|
9663
9671
|
* @Date: 2022-09-07 16:20:45
|
|
9664
9672
|
* @LastEditors: baozhoutao@steedos.com
|
|
9665
|
-
* @LastEditTime: 2023-03-
|
|
9673
|
+
* @LastEditTime: 2023-03-23 16:49:44
|
|
9666
9674
|
* @Description:
|
|
9667
9675
|
*/
|
|
9668
9676
|
|
|
@@ -10226,7 +10234,6 @@ const getFormTableView = async (instance) => {
|
|
|
10226
10234
|
trs: await getFormTrs(instance),
|
|
10227
10235
|
id: "u:047f3669468b",
|
|
10228
10236
|
};
|
|
10229
|
-
console.log(`getFormTableView formSchema=====>`, formSchema);
|
|
10230
10237
|
return formSchema;
|
|
10231
10238
|
};
|
|
10232
10239
|
|