@steedos-labs/plugin-workflow 3.0.0-beta.5 → 3.0.0-beta.7

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.
@@ -559,7 +559,7 @@
559
559
  "cache": 100,
560
560
  "adaptor": "\n if(payload.data.data){\n var data = payload.data.data[0];\n if(data){\n \n \n //初始化接口返回的字段移除字段值为null的字段\n for (key in data){\n if(data[key] === null){\n delete data[key];\n }\n }\n };\n payload.data = data;\n delete payload.extensions;\n }\n return payload;\n ",
561
561
  "data": {
562
- "query": "{data:flows(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,company_id,name,api_name,form,category,state,is_valid,current_no,description,help_text,created_by,modified_by,current,perms,object_name,instance_fields,instance_table_fields,instance_template,print_template,field_map,events,auto_remind,sort_no,timeout_auto_submit,allow_select_step,created,modified,instance_state,_display:_ui{company_id,form,category,state,is_valid,current_no,created_by,modified_by,object_name,auto_remind,sort_no,timeout_auto_submit,allow_select_step,created,modified,instance_state}, \n recordPermissions: _permissions{\n allowCreate,\n allowCreateFiles,\n allowDelete,\n allowDeleteFiles,\n allowEdit,\n allowEditFiles,\n allowRead,\n allowReadFiles,\n disabled_actions,\n disabled_list_views,\n field_permissions,\n modifyAllFiles,\n modifyAllRecords,\n modifyAssignCompanysRecords,\n modifyCompanyRecords,\n uneditable_fields,\n unreadable_fields,\n unrelated_objects,\n viewAllFiles,\n viewAllRecords,\n viewAssignCompanysRecords,\n viewCompanyRecords,\n }\n }}"
562
+ "query": "{data:flows(filters:[\"_id\", \"=\", \"${recordId}\"]){_id,company_id,name,api_name,form,category,state,is_valid,current_no,description,help_text,created_by,modified_by,current,perms,object_name,instance_fields,instance_table_fields,field_map,auto_remind,sort_no,timeout_auto_submit,allow_select_step,created,modified,instance_state,_display:_ui{company_id,form,category,state,is_valid,current_no,created_by,modified_by,object_name,auto_remind,sort_no,timeout_auto_submit,allow_select_step,created,modified,instance_state}, \n recordPermissions: _permissions{\n allowCreate,\n allowCreateFiles,\n allowDelete,\n allowDeleteFiles,\n allowEdit,\n allowEditFiles,\n allowRead,\n allowReadFiles,\n disabled_actions,\n disabled_list_views,\n field_permissions,\n modifyAllFiles,\n modifyAllRecords,\n modifyAssignCompanysRecords,\n modifyCompanyRecords,\n uneditable_fields,\n unreadable_fields,\n unrelated_objects,\n viewAllFiles,\n viewAllRecords,\n viewAssignCompanysRecords,\n viewCompanyRecords,\n }\n }}"
563
563
  },
564
564
  "headers": {
565
565
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
@@ -102,7 +102,7 @@ router.post('/am/forms', async function (req, res) {
102
102
  if (objectName) {
103
103
  instanceFields = await designerManager.getBusinessFields(objectName)
104
104
  const objFields = await objectql.getObject(objectName).getFields();
105
- const transformObjectFields = await designerManager.transformObjectFields(instanceFields, _.sortBy(objFields, 'sort_no'));
105
+ const transformObjectFields = await designerManager.transformObjectFields(_.sortBy(instanceFields, 'sort_no'), objFields);
106
106
  formFields = await designerManager.transformObjectFieldsToFormFields(transformObjectFields);
107
107
  }
108
108
  const tables = await designerManager.transformObjectDetailFieldsToFormTableFields(instance_table_fields)
@@ -1,112 +1,119 @@
1
1
  <html>
2
- <head>
3
- <script src="/unpkg.com/@steedos-builder/fiddle@0.0.5/dist/builder-fiddle.umd.js"></script>
4
- <script src="/unpkg.com/axios@0.26.1/dist/axios.min.js"></script>
5
- <script src="https://unpkg.steedos.cn/flowbite@2.3.0/dist/flowbite.min.js"></script>
6
- <script src="https://cdn.tailwindcss.com"></script>
7
- <link href="/toast/toastr.min.css" rel="stylesheet" />
8
- <script src="/jquery.min.js" ></script>
9
- <script src="/toast/toastr.min.js"></script>
10
- <style>
11
- #toast-container.toast-bottom-center>div, #toast-container.toast-top-center>div {
12
- width: 450px;
13
- opacity: 1;
14
- }
15
- </style>
16
- </head>
17
-
18
- <body>
19
- <!-- Main modal -->
20
- <div id="fieldLayoutModal" tabindex="-1" aria-hidden="true" class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
21
- <div class="relative p-4 w-full max-w-2xl max-h-full">
22
- <!-- Modal content -->
23
- <div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
24
- <!-- Modal header -->
25
- <div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
26
- <h3 class="text-xl font-semibold text-gray-900 dark:text-white">
27
- 字段保存结果
28
- </h3>
29
- <button type="button" class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white" data-modal-hide="fieldLayoutModal">
30
- <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
31
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
32
- </svg>
33
- <span class="sr-only">Close modal</span>
34
- </button>
35
- </div>
36
- <!-- Modal body -->
37
- <div class="p-4 md:p-5 space-y-4">
38
- <ul class="space-y-4 text-gray-500 list-disc list-inside dark:text-gray-400" id="fieldLayoutList">
39
- </ul>
40
- </div>
41
- </div>
2
+
3
+ <head>
4
+ <script src="/unpkg.com/@steedos-builder/fiddle@0.0.5/dist/builder-fiddle.umd.js"></script>
5
+ <script src="/unpkg.com/axios@0.26.1/dist/axios.min.js"></script>
6
+ <script src="/unpkg.com/flowbite@2.3.0/dist/flowbite.min.js"></script>
7
+ <script src="/unpkg.com/lodash@4.17.21/lodash.min.js"></script>
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <link href="/toast/toastr.min.css" rel="stylesheet" />
10
+ <script src="/jquery.min.js"></script>
11
+ <script src="/toast/toastr.min.js"></script>
12
+ <style>
13
+ #toast-container.toast-bottom-center>div,
14
+ #toast-container.toast-top-center>div {
15
+ width: 450px;
16
+ opacity: 1;
17
+ }
18
+ </style>
19
+ </head>
20
+
21
+ <body>
22
+ <!-- Main modal -->
23
+ <div id="fieldLayoutModal" tabindex="-1" aria-hidden="true"
24
+ class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
25
+ <div class="relative p-4 w-full max-w-2xl max-h-full">
26
+ <!-- Modal content -->
27
+ <div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
28
+ <!-- Modal header -->
29
+ <div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
30
+ <h3 class="text-xl font-semibold text-gray-900 dark:text-white">
31
+ 字段保存结果
32
+ </h3>
33
+ <button type="button"
34
+ class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 ms-auto inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white"
35
+ data-modal-hide="fieldLayoutModal">
36
+ <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
37
+ <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
38
+ d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" />
39
+ </svg>
40
+ <span class="sr-only">Close modal</span>
41
+ </button>
42
+ </div>
43
+ <!-- Modal body -->
44
+ <div class="p-4 md:p-5 space-y-4">
45
+ <ul class="space-y-4 text-gray-500 list-disc list-inside dark:text-gray-400" id="fieldLayoutList">
46
+ </ul>
47
+ </div>
42
48
  </div>
43
49
  </div>
44
- <builder-fiddle host="<%=builderHost%>"></builder-fiddle>
45
- <script>
46
- const useOpenAPI= <%=(useOpenAPI === "true" || useOpenAPI === true)%>;
47
- const settings = {
48
- assetUrls: "<%=assetUrls%>",
49
- rootUrl: "<%=rootUrl%>",
50
- userId: "<%=userId%>",
51
- tenantId: "<%=tenantId%>",
52
- authToken: "<%=authToken%>",
53
- messageOnly: true,
54
- useOpenAPI: useOpenAPI,
55
- id: "<%=id%>",
56
- pageId: "<%=id%>",
57
- hiddenDeploy: true
58
- };
50
+ </div>
51
+ <builder-fiddle host="<%=builderHost%>"></builder-fiddle>
52
+ <script>
53
+ const useOpenAPI = <%=(useOpenAPI === "true" || useOpenAPI === true) %>;
54
+ const settings = {
55
+ assetUrls: "<%=assetUrls%>",
56
+ rootUrl: "<%=rootUrl%>",
57
+ userId: "<%=userId%>",
58
+ tenantId: "<%=tenantId%>",
59
+ authToken: "<%=authToken%>",
60
+ messageOnly: true,
61
+ useOpenAPI: useOpenAPI,
62
+ id: "<%=id%>",
63
+ pageId: "<%=id%>",
64
+ hiddenDeploy: true
65
+ };
59
66
 
60
- let comp = document.querySelector("builder-fiddle");
61
-
62
- // set the modal menu element
63
- const $targetEl = document.getElementById('fieldLayoutModal');
64
- // options with default values
65
- const options = {
66
- placement: 'top-center',
67
- backdrop: 'dynamic',
68
- backdropClasses:
69
- 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40',
70
- closable: true,
71
- onHide: () => {
72
- console.log('modal is hidden');
73
- },
74
- onShow: () => {
75
- console.log('modal is shown');
76
- },
77
- onToggle: () => {
78
- console.log('modal has been toggled');
67
+ let comp = document.querySelector("builder-fiddle");
68
+
69
+ // set the modal menu element
70
+ const $targetEl = document.getElementById('fieldLayoutModal');
71
+ // options with default values
72
+ const options = {
73
+ placement: 'top-center',
74
+ backdrop: 'dynamic',
75
+ backdropClasses:
76
+ 'bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-40',
77
+ closable: true,
78
+ onHide: () => {
79
+ console.log('modal is hidden');
80
+ },
81
+ onShow: () => {
82
+ console.log('modal is shown');
83
+ },
84
+ onToggle: () => {
85
+ console.log('modal has been toggled');
86
+ },
87
+ };
88
+ // instance options object
89
+ const instanceOptions = {
90
+ id: 'fieldLayoutModal',
91
+ override: true
92
+ };
93
+ const modal = new Flowbite.default.Modal($targetEl, options, instanceOptions);
94
+
95
+ const loadPage = async () => {
96
+ const { assetUrls, rootUrl, userId, tenantId, authToken, id } = settings;
97
+
98
+ // 如果传入 steedos rooturl
99
+ if (rootUrl && !authToken) return;
100
+
101
+ const initialContent = {
102
+ type: "page",
103
+ title: "Welcome to Steedos",
104
+ body: [],
105
+ regions: ["body"],
106
+ data: {
107
+ context: {
108
+ rootUrl,
109
+ userId,
110
+ tenantId,
111
+ authToken,
79
112
  },
113
+ },
80
114
  };
81
- // instance options object
82
- const instanceOptions = {
83
- id: 'fieldLayoutModal',
84
- override: true
85
- };
86
- const modal = new Flowbite.default.Modal($targetEl, options, instanceOptions);
87
-
88
- const loadPage = async () => {
89
- const { assetUrls, rootUrl, userId, tenantId, authToken, id } = settings;
90
-
91
- // 如果传入 steedos rooturl
92
- if (rootUrl && !authToken) return;
93
-
94
- const initialContent = {
95
- type: "page",
96
- title: "Welcome to Steedos",
97
- body: [],
98
- regions: ["body"],
99
- data: {
100
- context: {
101
- rootUrl,
102
- userId,
103
- tenantId,
104
- authToken,
105
- },
106
- },
107
- };
108
115
 
109
- if (id) {
116
+ if (id) {
110
117
  const result = await axios.post(
111
118
  `${rootUrl}/graphql`,
112
119
  {
@@ -141,7 +148,7 @@
141
148
  "actions": [],
142
149
  "wrapWithPanel": false
143
150
  }
144
- if(result.data.data.record.current.fields){
151
+ if (result.data.data.record.current.fields) {
145
152
  for (let i = 0; i < result.data.data.record.current.fields.length; i++) {
146
153
  const temp = await getFieldEditTpl(result.data.data.record.current.fields[i]);
147
154
  if (temp) {
@@ -183,66 +190,319 @@
183
190
  } else {
184
191
  return initialContent
185
192
  }
186
- };
193
+ };
194
+
187
195
 
188
- const savePage = async (data) => {
189
- const { rootUrl, userId, tenantId, authToken, id } = settings;
190
196
 
191
- if (!id) {
192
- return;
197
+ const getSelectOptions = (field) => {
198
+ const options = [];
199
+ // each(field.options.split("\n"), (item) => {
200
+ // var foo = item.split(":");
201
+ // if (foo.length == 2) {
202
+ // options.push({ label: foo[0], value: foo[1] });
203
+ // } else {
204
+ // options.push({ label: item, value: item });
205
+ // }
206
+ // });
207
+
208
+ const splitItem = field.options.split("\n");
209
+ splitItem.forEach(item => {
210
+ var foo = item.split(":");
211
+ if (foo.length == 2) {
212
+ options.push({ label: foo[0], value: foo[1] });
213
+ } else {
214
+ options.push({ label: item, value: item });
193
215
  }
216
+ });
194
217
 
195
- // 保存schema时,清理context下的认证信息
196
- const schema = JSON.parse(
197
- JSON.stringify(data.data.AmisSchema, null, 4)
198
- );
199
- if (schema.data && typeof schema.data.context === 'object' ) {
200
- delete schema.data.context
218
+ return options;
219
+ };
220
+
221
+ const startsWith = (url, str) => {
222
+
223
+ let flag = false
224
+ if (url.substr(0, 4) === str) {
225
+ flag = true
226
+ } else {
227
+ flag = false
228
+ }
229
+ return flag
230
+
231
+ }
232
+
233
+ //将原数据字段转换为amis字段
234
+ const getFieldEditTpl = async (field) => {
235
+
236
+ if(field.steedos_field){
237
+ return {
238
+ type: `sfield-${_.toLower(_.camelCase(field.steedos_field.type))}`,
239
+ config: field.steedos_field
201
240
  }
202
-
203
- return await axios.post(
204
- `${rootUrl}/graphql`,
205
- {
206
- query: `
241
+ }
242
+
243
+ const tpl = {
244
+ label: field.name,
245
+ name: field.code,
246
+ required: field.is_required,
247
+ multiple: field.is_multiselect,
248
+ className: (field.is_wide ? 'is_wide' : '') +
249
+ (field.is_list_display ? ' is_list_display' : '') +
250
+ (field.is_searchable ? ' is_searchable' : '')
251
+ };
252
+ switch (field.type) {
253
+ case "input":
254
+ if (field.is_textarea) {
255
+ tpl.type = "textarea";
256
+ } else {
257
+ tpl.type = "input-text";
258
+ }
259
+ break;
260
+ case "number":
261
+ tpl.type = "input-number";
262
+ break;
263
+ case "date":
264
+ tpl.type = "input-date";
265
+ tpl.inputFormat = "YYYY-MM-DD";
266
+ tpl.format = 'YYYY-MM-DDT00:00:00.000[Z]';
267
+ break;
268
+ case "dateTime":
269
+ tpl.type = "input-datetime";
270
+ tpl.inputFormat = "YYYY-MM-DD HH:mm";
271
+ tpl.format = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
272
+ break;
273
+ case "checkbox":
274
+ tpl.type = "checkbox";
275
+ break;
276
+
277
+ case "email":
278
+ tpl.type = "input-email";
279
+ tpl.validations = {
280
+ isEmail: true,
281
+ };
282
+ break;
283
+ case "url":
284
+ tpl.type = "input-url";
285
+ tpl.validations = {
286
+ isUrl: true,
287
+ };
288
+ break;
289
+ case "password":
290
+ tpl.type = "input-password";
291
+ tpl.showCounter = true;
292
+ break;
293
+ case "select":
294
+ tpl.type = "select";
295
+ tpl.options = getSelectOptions(field);
296
+ break;
297
+
298
+ case "user":
299
+ const useTpl = {
300
+ "type": "steedos-field",
301
+ "id": "u:9f4486c22f52",
302
+ "field": JSON.stringify({
303
+ name: field.code,
304
+ label: field.name,
305
+ reference_to: "space_users",
306
+ reference_to_field: 'user',
307
+ multiple: field.is_multiselect,
308
+ type: "lookup"
309
+ }),
310
+ }
311
+ // const useTpl = await lookupToAmis(
312
+ // {
313
+ // name: field.code,
314
+ // label: field.name,
315
+ // reference_to: "space_users",
316
+ // reference_to_field: 'user',
317
+ // multiple: field.is_multiselect,
318
+ // },
319
+ // false,
320
+ // {}
321
+ // );
322
+ Object.assign(tpl, useTpl);
323
+ break;
324
+
325
+ case "group":
326
+ const orgTpl = {
327
+ "type": "steedos-field",
328
+ "id": "u:9f4486c22f52",
329
+ "field": JSON.stringify({
330
+ name: field.code,
331
+ label: field.name,
332
+ reference_to: "organizations",
333
+ multiple: field.is_multiselect,
334
+ type: "lookup"
335
+ })
336
+ }
337
+
338
+ // const orgTpl = await lookupToAmis(
339
+ // {
340
+ // name: field.code,
341
+ // label: field.name,
342
+ // reference_to: "organizations",
343
+ // multiple: field.is_multiselect,
344
+ // },
345
+ // false,
346
+ // {}
347
+ // );
348
+ Object.assign(tpl, orgTpl);
349
+ break;
350
+ case "radio":
351
+ tpl.type = "radios";
352
+ tpl.options = getSelectOptions(field);
353
+ break;
354
+ case "multiSelect":
355
+ tpl.type = "checkboxes";
356
+ tpl.options = getSelectOptions(field);
357
+ break;
358
+ case "odata":
359
+ console.log('field', field);
360
+ var labelField = field.formula.substr(1, field.formula.length - 2);
361
+ labelField = labelField.substr(labelField.indexOf(".") + 1);
362
+ // 加入odata标签以示区别 把field-老表单设计器的元素加入
363
+ tpl.type = "select";
364
+ tpl.description = field.description
365
+ tpl.detail_url = field.detail_url
366
+ tpl.filters = field.filters
367
+ tpl.formula = field.formula
368
+ tpl.is_list_display = field.is_list_display
369
+ tpl.is_multiselect = field.is_multiselect
370
+ tpl.is_required = field.is_required
371
+ tpl.is_searchable = field.is_searchable
372
+ tpl.is_wide = field.is_wide
373
+ tpl.search_field = field.search_field
374
+ tpl._id = field._id
375
+ // tpl.labelField = labelField;
376
+ // tpl.valueField = "_value";
377
+ tpl.source = {
378
+ //判断该field.url是否为http开头
379
+ url: startsWith(field.url, "http")
380
+ ? field.url
381
+ : `\${context.rootUrl}${field.url}`,
382
+ method: "get",
383
+ dataType: "json",
384
+ headers: {
385
+ Authorization: "Bearer ${context.tenantId},${context.authToken}",
386
+ },
387
+ adaptor: `
388
+ payload.data = {
389
+ options: _.map(payload.value, (item)=>{
390
+ const value = item;
391
+ item["@label"] = item["${labelField}"]
392
+ delete item['@odata.editLink'];
393
+ delete item['@odata.etag'];
394
+ delete item['@odata.id'];
395
+ return {
396
+ label: item["@label"],
397
+ value: value
398
+ }
399
+ })
400
+ }
401
+ return payload;
402
+ `
403
+ };
404
+ break;
405
+ case "html":
406
+ if (tpl.disabled) {
407
+ tpl.type = 'html';
408
+ } else {
409
+ tpl.type = "input-rich-text";
410
+ }
411
+ break;
412
+ case "table":
413
+ tpl.type = "input-table";
414
+ tpl.addable = field.permission === "editable";
415
+ tpl.editable = tpl.addable;
416
+ tpl.copyable = tpl.addable;
417
+ tpl.columns = [];
418
+ for (const sField of field.fields) {
419
+ if (sField.type != "hidden") {
420
+ sField.permission = field.permission
421
+ const column = await getFieldEditTpl(sField, true);
422
+ tpl.columns.push(column);
423
+ }
424
+ }
425
+ break;
426
+ case "section":
427
+ tpl.type = "fieldset";
428
+ tpl.title = field.name;
429
+ tpl.collapsable = true;
430
+ tpl.body = []
431
+ if (field.fields) {
432
+ for (let i = 0; i < field.fields.length; i++) {
433
+ let fieldsItem = await getFieldEditTpl(field.fields[i], true)
434
+ tpl.body.push(fieldsItem)
435
+ }
436
+ }
437
+ break;
438
+ default:
439
+ break;
440
+ }
441
+ return tpl
442
+
443
+ }
444
+
445
+
446
+
447
+ const savePage = async (data) => {
448
+ const { rootUrl, userId, tenantId, authToken, id } = settings;
449
+
450
+ if (!id) {
451
+ return;
452
+ }
453
+
454
+ // 保存schema时,清理context下的认证信息
455
+ const schema = JSON.parse(
456
+ JSON.stringify(data.data.AmisSchema, null, 4)
457
+ );
458
+ if (schema.data && typeof schema.data.context === 'object') {
459
+ delete schema.data.context
460
+ }
461
+
462
+ return await axios.post(
463
+ `${rootUrl}/graphql`,
464
+ {
465
+ query: `
207
466
  mutation{
208
467
  forms__update(id: "${id}", doc: {amis_schema: ${JSON.stringify(JSON.stringify(schema, null, 4))}}){_id}
209
468
  }
210
469
  `,
211
- },
212
- {
213
- withCredentials: true,
214
- headers: { Authorization: `Bearer ${tenantId},${authToken}` },
215
- }
216
- )
217
- .catch(function (error) {
218
- // handle error
219
- console.log(error);
220
- });
470
+ },
471
+ {
472
+ withCredentials: true,
473
+ headers: { Authorization: `Bearer ${tenantId},${authToken}` },
474
+ }
475
+ )
476
+ .catch(function (error) {
477
+ // handle error
478
+ console.log(error);
479
+ });
221
480
 
222
481
 
223
- return result;
224
- };
225
- window.addEventListener('message', function (event) {
226
- const { data } = event;
227
- if (data) {
228
- if(data.type === 'builder.loaded'){
229
- comp.messageFrame('builder.EditorPropsChanged', { editorProps : JSON.stringify({
230
- onChange: function(value){
231
-
232
- },
233
- onDndAccept: function(event){
234
- return true;
235
- },
236
- beforeDelete: function(event){
237
-
238
- },
239
- onInit: function(){
240
- // 创建一个新的 style 元素
241
- var style = document.createElement('style');
242
- style.type="text/css";
243
- style.media="screen";
244
- // CSS 样式写入 style 元素
245
- style.innerHTML = `
482
+ return result;
483
+ };
484
+ window.addEventListener('message', function (event) {
485
+ const { data } = event;
486
+ if (data) {
487
+ if (data.type === 'builder.loaded') {
488
+ comp.messageFrame('builder.EditorPropsChanged', {
489
+ editorProps: JSON.stringify({
490
+ onChange: function (value) {
491
+
492
+ },
493
+ onDndAccept: function (event) {
494
+ return true;
495
+ },
496
+ beforeDelete: function (event) {
497
+
498
+ },
499
+ onInit: function () {
500
+ // 创建一个新的 style 元素
501
+ var style = document.createElement('style');
502
+ style.type = "text/css";
503
+ style.media = "screen";
504
+ // 将 CSS 样式写入 style 元素
505
+ style.innerHTML = `
246
506
  .ae-RendererList-groupWrap .ae-RendererList-group:nth-child(n+3) {
247
507
  display: none;
248
508
  }
@@ -257,185 +517,187 @@
257
517
  }
258
518
  `;
259
519
 
260
- // 将 style 元素插入到 head 中
261
- document.head.appendChild(style);
262
- },
263
- disableBultinPlugin: false,
264
- disablePluginList2: function(id, plugin){
265
- if(lodash.includes([
266
- "FlexPlugin",
267
- "GridPlugin",
268
- "ContainerPlugin",
269
- "Layout_free_container",
270
- "Layout_fixed_top",
271
- "Layout_fixed",
272
- "CollapseGroupPlugin",
273
- "PanelPlugin",
274
- "TabsPlugin",
275
- "SwitchContainerPlugin",
276
- "CRUDPlugin",
277
- "Table2Plugin",
278
- "TableCRUDPlugin",
279
- "FormPlugin",
280
- "ServicePlugin",
281
- // "TextControlPlugin",
282
- // "TextareaControlPlugin",
283
- // "NumberControlPlugin",
284
- // "SelectControlPlugin",
285
- // "NestedSelectControlPlugin",
286
- // "ChainedSelectControlPlugin",
287
- // "DropDownButtonPlugin",
288
- // "CheckboxesControlPlugin",
289
- // "RadiosControlPlugin",
290
- // "CheckboxControlPlugin",
291
- // "DateControlPlugin",
292
- // "DateRangeControlPlugin",
293
- // "FileControlPlugin",
294
- // "ImageControlPlugin",
295
- // "ExcelControlPlugin",
296
- // "TreeControlPlugin",
297
- // "TagControlPlugin",
298
- // "ListControlPlugin",
299
- // "ButtonGroupControlPlugin",
300
- // "ButtonToolbarControlPlugin",
301
- // "PickerControlPlugin",
302
- // "SwitchControlPlugin",
303
- // "RangeControlPlugin",
304
- // "RateControlPlugin",
305
- // "CityControlPlugin",
306
- // "TransferPlugin",
307
- // "TabsTransferPlugin",
308
- // "ColorControlPlugin",
309
- // "ConditionBilderPlugin",
310
- // "FieldSetControlPlugin",
311
- // "ComboControlPlugin",
312
- // "InputGroupControlPlugin",
313
- // "TableControlPlugin",
314
- // "MatrixControlPlugin",
315
- // "RichTextControlPlugin",
316
- // "DiffEditorControlPlugin",
317
- // "CodeEditorControlPlugin",
318
- // "SearchBoxPlugin",
319
- // "KVControlPlugin",
320
- // "RepeatControlPlugin",
321
- // "UUIDControlPlugin",
322
- // "LocationControlPlugin",
323
- // "SubFormControlPlugin",
324
- // "HiddenControlPlugin",
325
- // "SignaturePlugin",
326
- // "StaticControlPlugin",
327
- "ButtonPlugin",
328
- "ButtonGroupPlugin",
329
- "NavPlugin",
330
- "AnchorNavPlugin",
331
- "TooltipWrapperPlugin",
332
- "AlertPlugin",
333
- "WizardPlugin",
334
- "TableViewPlugin",
335
- "WebComponentPlugin",
336
- "AudioPlugin",
337
- "VideoPlugin",
338
- "CustomPlugin",
339
- "TasksPlugin",
340
- "EachPlugin",
341
- "PropertyPlugin",
342
- "IFramePlugin",
343
- "QRCodePlugin",
344
- "TplPlugin",
345
- "IconPlugin",
346
- "LinkPlugin",
347
- "ListPlugin",
348
- "List2Plugin",
349
- "MappingPlugin",
350
- "AvatarPlugin",
351
- "CardPlugin",
352
- "Card2Plugin",
353
- "CardsPlugin",
354
- "TablePlugin",
355
- "TableCell2Plugin",
356
- "ChartPlugin",
357
- "SparklinePlugin",
358
- "CarouselPlugin",
359
- "ImagePlugin",
360
- "ImagesPlugin",
361
- "DatePlugin",
362
- "TimePlugin",
363
- "DatetimePlugin",
364
- "CalendarPlugin",
365
- "TagPlugin",
366
- "JsonPlugin",
367
- "ProgressPlugin",
368
- "StatusPlugin",
369
- "StepsPlugin",
370
- "TimelinePlugin",
371
- // "DividerPlugin",
372
- // "CodeViewPlugin",
373
- // "MarkdownPlugin",
374
- // "CollapsePlugin",
375
- "OfficeViewerPlugin",
376
- "PdfViewerPlugin",
377
- "LogPlugin",
378
- "ActionPlugin",
379
- "TableCellPlugin",
380
- "ArrayControlPlugin",
381
- "ControlPlugin",
382
- "DateTimeControlPlugin",
383
- "DateTimeRangeControlPlugin",
384
- "EmailControlPlugin",
385
- "FormulaControlPlugin",
386
- "GroupControlPlugin",
387
- "ItemPlugin",
388
- "MonthControlPlugin",
389
- "MonthRangeControlPlugin",
390
- "PasswordControlPlugin",
391
- "InputQuarterPlugin",
392
- "QuarterRangePlugin",
393
- "TimeControlPlugin",
394
- "TimeRangeControlPlugin",
395
- "TreeSelectControlPlugin",
396
- "URLControlPlugin",
397
- "YearControlPlugin",
398
- "YearRangeControlPlugin",
399
- "BreadcrumbPlugin",
400
- "CustomRegionPlugin",
401
- "DialogPlugin",
402
- "DrawerPlugin",
403
- "HBoxPlugin",
404
- "ListItemPlugin",
405
- "OperationPlugin",
406
- // "PagePlugin",
407
- "PaginationPlugin",
408
- "PlainPlugin",
409
- "ResetPlugin",
410
- "SubmitPlugin",
411
- "WrapperPlugin",
412
- "ColumnToggler"
413
- ]
414
- ,id)){
415
- return true;
416
- }
417
- return false
418
- }
419
- }, (key, value) => {
420
- if (typeof value === 'function') {
421
- return value.toString();
520
+ // 将 style 元素插入到 head 中
521
+ document.head.appendChild(style);
522
+ },
523
+ disableBultinPlugin: false,
524
+ disablePluginList2: function (id, plugin) {
525
+ if (lodash.includes([
526
+ "FlexPlugin",
527
+ "GridPlugin",
528
+ "ContainerPlugin",
529
+ "Layout_free_container",
530
+ "Layout_fixed_top",
531
+ "Layout_fixed",
532
+ "CollapseGroupPlugin",
533
+ "PanelPlugin",
534
+ "TabsPlugin",
535
+ "SwitchContainerPlugin",
536
+ "CRUDPlugin",
537
+ "Table2Plugin",
538
+ "TableCRUDPlugin",
539
+ "FormPlugin",
540
+ "ServicePlugin",
541
+ // "TextControlPlugin",
542
+ // "TextareaControlPlugin",
543
+ // "NumberControlPlugin",
544
+ // "SelectControlPlugin",
545
+ // "NestedSelectControlPlugin",
546
+ // "ChainedSelectControlPlugin",
547
+ // "DropDownButtonPlugin",
548
+ // "CheckboxesControlPlugin",
549
+ // "RadiosControlPlugin",
550
+ // "CheckboxControlPlugin",
551
+ // "DateControlPlugin",
552
+ // "DateRangeControlPlugin",
553
+ // "FileControlPlugin",
554
+ // "ImageControlPlugin",
555
+ // "ExcelControlPlugin",
556
+ // "TreeControlPlugin",
557
+ // "TagControlPlugin",
558
+ // "ListControlPlugin",
559
+ // "ButtonGroupControlPlugin",
560
+ // "ButtonToolbarControlPlugin",
561
+ // "PickerControlPlugin",
562
+ // "SwitchControlPlugin",
563
+ // "RangeControlPlugin",
564
+ // "RateControlPlugin",
565
+ // "CityControlPlugin",
566
+ // "TransferPlugin",
567
+ // "TabsTransferPlugin",
568
+ // "ColorControlPlugin",
569
+ // "ConditionBilderPlugin",
570
+ // "FieldSetControlPlugin",
571
+ // "ComboControlPlugin",
572
+ // "InputGroupControlPlugin",
573
+ // "TableControlPlugin",
574
+ // "MatrixControlPlugin",
575
+ // "RichTextControlPlugin",
576
+ // "DiffEditorControlPlugin",
577
+ // "CodeEditorControlPlugin",
578
+ // "SearchBoxPlugin",
579
+ // "KVControlPlugin",
580
+ // "RepeatControlPlugin",
581
+ // "UUIDControlPlugin",
582
+ // "LocationControlPlugin",
583
+ // "SubFormControlPlugin",
584
+ // "HiddenControlPlugin",
585
+ // "SignaturePlugin",
586
+ // "StaticControlPlugin",
587
+ "ButtonPlugin",
588
+ "ButtonGroupPlugin",
589
+ "NavPlugin",
590
+ "AnchorNavPlugin",
591
+ "TooltipWrapperPlugin",
592
+ "AlertPlugin",
593
+ "WizardPlugin",
594
+ "TableViewPlugin",
595
+ "WebComponentPlugin",
596
+ "AudioPlugin",
597
+ "VideoPlugin",
598
+ "CustomPlugin",
599
+ "TasksPlugin",
600
+ "EachPlugin",
601
+ "PropertyPlugin",
602
+ "IFramePlugin",
603
+ "QRCodePlugin",
604
+ "TplPlugin",
605
+ "IconPlugin",
606
+ "LinkPlugin",
607
+ "ListPlugin",
608
+ "List2Plugin",
609
+ "MappingPlugin",
610
+ "AvatarPlugin",
611
+ "CardPlugin",
612
+ "Card2Plugin",
613
+ "CardsPlugin",
614
+ "TablePlugin",
615
+ "TableCell2Plugin",
616
+ "ChartPlugin",
617
+ "SparklinePlugin",
618
+ "CarouselPlugin",
619
+ "ImagePlugin",
620
+ "ImagesPlugin",
621
+ "DatePlugin",
622
+ "TimePlugin",
623
+ "DatetimePlugin",
624
+ "CalendarPlugin",
625
+ "TagPlugin",
626
+ "JsonPlugin",
627
+ "ProgressPlugin",
628
+ "StatusPlugin",
629
+ "StepsPlugin",
630
+ "TimelinePlugin",
631
+ // "DividerPlugin",
632
+ // "CodeViewPlugin",
633
+ // "MarkdownPlugin",
634
+ // "CollapsePlugin",
635
+ "OfficeViewerPlugin",
636
+ "PdfViewerPlugin",
637
+ "LogPlugin",
638
+ "ActionPlugin",
639
+ "TableCellPlugin",
640
+ "ArrayControlPlugin",
641
+ "ControlPlugin",
642
+ "DateTimeControlPlugin",
643
+ "DateTimeRangeControlPlugin",
644
+ "EmailControlPlugin",
645
+ "FormulaControlPlugin",
646
+ "GroupControlPlugin",
647
+ "ItemPlugin",
648
+ "MonthControlPlugin",
649
+ "MonthRangeControlPlugin",
650
+ "PasswordControlPlugin",
651
+ "InputQuarterPlugin",
652
+ "QuarterRangePlugin",
653
+ "TimeControlPlugin",
654
+ "TimeRangeControlPlugin",
655
+ "TreeSelectControlPlugin",
656
+ "URLControlPlugin",
657
+ "YearControlPlugin",
658
+ "YearRangeControlPlugin",
659
+ "BreadcrumbPlugin",
660
+ "CustomRegionPlugin",
661
+ "DialogPlugin",
662
+ "DrawerPlugin",
663
+ "HBoxPlugin",
664
+ "ListItemPlugin",
665
+ "OperationPlugin",
666
+ // "PagePlugin",
667
+ "PaginationPlugin",
668
+ "PlainPlugin",
669
+ "ResetPlugin",
670
+ "SubmitPlugin",
671
+ "WrapperPlugin",
672
+ "ColumnToggler"
673
+ ]
674
+ , id)) {
675
+ return true;
422
676
  }
423
- return value;
424
- })} )
425
- }
426
- if (data.type === 'builder.loadContent') {
427
- loadPage().then((content)=>{
428
- comp.messageFrame('builder.contentChanged', { AmisSchema : content } )
429
- })
430
- }
431
- if (data.type === 'builder.saveContent') {
432
- savePage(data.data).then(()=>{
433
- comp.messageFrame('builder.contentSaved')
677
+ return false
678
+ }
679
+ }, (key, value) => {
680
+ if (typeof value === 'function') {
681
+ return value.toString();
682
+ }
683
+ return value;
434
684
  })
435
- }
685
+ })
436
686
  }
437
- })
438
- comp.settings = settings;
439
- </script>
440
- </body>
441
- </html>
687
+ if (data.type === 'builder.loadContent') {
688
+ loadPage().then((content) => {
689
+ comp.messageFrame('builder.contentChanged', { AmisSchema: content })
690
+ })
691
+ }
692
+ if (data.type === 'builder.saveContent') {
693
+ savePage(data.data).then(() => {
694
+ comp.messageFrame('builder.contentSaved')
695
+ })
696
+ }
697
+ }
698
+ })
699
+ comp.settings = settings;
700
+ </script>
701
+ </body>
702
+
703
+ </html>
@@ -549,6 +549,7 @@ function getNeededFields(fields) {
549
549
  return {
550
550
  name: fields.name,
551
551
  label: fields.label,
552
+ sort_no: fields.sort_no,
552
553
  required: fields.required
553
554
  }
554
555
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-labs/plugin-workflow",
3
- "version": "3.0.0-beta.5",
3
+ "version": "3.0.0-beta.7",
4
4
  "main": "package.service.js",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -20,7 +20,7 @@ module.exports = {
20
20
  $package: {
21
21
  name: serviceName,
22
22
  path: __dirname,
23
- isPackage: false
23
+ isPackage: true
24
24
  }
25
25
  },
26
26
  /**