@kissflow/lowcode-client-sdk 1.0.43 → 1.0.49

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.
@@ -40,6 +40,9 @@ const LISTENER_CMDS = {
40
40
  RETURN: "RETURN",
41
41
  GET_FORM_FIELD: "GET_FORM_FIELD",
42
42
  UPDATE_FORM: "UPDATE_FORM",
43
+ GET_FORM_VALIDATION_ERRORS: "GET_FORM_VALIDATION_ERRORS",
44
+ GET_FORM_CONFIGURATION: "GET_FORM_CONFIGURATION",
45
+ GET_FORM_FIELD_STATE: "GET_FORM_FIELD_STATE",
43
46
  GET_TABLE: "GET_TABLE",
44
47
  GET_TABLE_ROW: "GET_TABLE_ROW",
45
48
  ADD_TABLE_ROW: "ADD_TABLE_ROW",
@@ -54,6 +57,13 @@ const LISTENER_CMDS = {
54
57
  REDIRECT: "REDIRECT",
55
58
  OPEN_PAGE: "OPEN_PAGE",
56
59
  GET_IMAGE_URL: "GET_IMAGE_URL",
60
+ FILEPICKER_OPEN: "FILEPICKER_OPEN",
61
+ FILEPREVIEW_OPEN: "FILEPREVIEW_OPEN",
62
+ FILE_UPLOAD: "FILE_UPLOAD",
63
+ SCANNER_OPEN: "SCANNER_OPEN",
64
+ GEOLOCATION_OPEN: "GEOLOCATION_OPEN",
65
+ GET_ROLES: "GET_ROLES",
66
+ SWITCH_ROLE: "SWITCH_ROLE",
57
67
  FORMAT_DATE: "FORMAT_DATE",
58
68
  FORMAT_DATE_TIME: "FORMAT_DATE_TIME",
59
69
  FORMAT_NUMBER: "FORMAT_NUMBER",
@@ -77,6 +87,8 @@ const LISTENER_CMDS = {
77
87
  COMPONENT_ADD_EVENT_LISTENER: "COMPONENT_ADD_EVENT_LISTENER",
78
88
  CC_INITIALIZE: "CC_INITIALIZE",
79
89
  CC_WATCH_PARAMS: "CC_WATCH_PARAMS",
90
+ CC_SET_ROUTE: "CC_SET_ROUTE",
91
+ CC_WATCH_ROUTE: "CC_WATCH_ROUTE",
80
92
  WINDOW_NDEF_READER_NEW: "WINDOW_NDEF_READER_NEW",
81
93
  WINDOW_NDEF_READER_SCAN: "WINDOW_NDEF_READER_SCAN",
82
94
  WINDOW_NDEF_READER_WRITE: "WINDOW_NDEF_READER_WRITE",
@@ -94,6 +106,8 @@ const LISTENER_CMDS = {
94
106
  DATAFORM_DELETE_ITEM: "DATAFORM_DELETE_ITEM",
95
107
  DATAFORM_DISCARD_ITEM: "DATAFORM_DISCARD_ITEM",
96
108
  DATAFORM_SUBMIT_ITEM: "DATAFORM_SUBMIT_ITEM",
109
+ DATAFORM_INIT_FORM: "DATAFORM_INIT_FORM",
110
+ DATAFORM_GET_FIELD_OPTIONS: "DATAFORM_GET_FIELD_OPTIONS",
97
111
  PROCESS_OPEN_FORM: "PROCESS_OPEN_FORM",
98
112
  PROCESS_GET_FIELDS: "PROCESS_GET_FIELDS",
99
113
  PROCESS_GET_MYTASK_FIELDS: "PROCESS_GET_MYTASK_FIELDS",
@@ -107,6 +121,8 @@ const LISTENER_CMDS = {
107
121
  PROCESS_UPDATE_ITEM: "PROCESS_UPDATE_ITEM",
108
122
  PROCESS_GET_ITEM: "PROCESS_GET_ITEM",
109
123
  PROCESS_DELETE_ITEM: "PROCESS_DELETE_ITEM",
124
+ PROCESS_GET_ADMIN_ITEM: "PROCESS_GET_ADMIN_ITEM",
125
+ PROCESS_UPDATE_ADMIN_ITEM: "PROCESS_UPDATE_ADMIN_ITEM",
110
126
  PROCESS_SUBMIT_ITEM: "PROCESS_SUBMIT_ITEM",
111
127
  PROCESS_REJECT_ITEM: "PROCESS_REJECT_ITEM",
112
128
  PROCESS_WITHDRAW_ITEM: "PROCESS_WITHDRAW_ITEM",
@@ -116,6 +132,9 @@ const LISTENER_CMDS = {
116
132
  PROCESS_RESTART_ITEM: "PROCESS_RESTART_ITEM",
117
133
  PROCESS_DISCARD_ITEM: "PROCESS_DISCARD_ITEM",
118
134
  PROCESS_GET_PROGRESS: "PROCESS_GET_PROGRESS",
135
+ PROCESS_INIT_FORM: "PROCESS_INIT_FORM",
136
+ PROCESS_GET_FIELD_OPTIONS: "PROCESS_GET_FIELD_OPTIONS",
137
+ PROCESS_PARSE_ATTACHMENT: "PROCESS_PARSE_ATTACHMENT",
119
138
  BOARD_IMPORT_CSV: "BOARD_IMPORT_CSV",
120
139
  BOARD_OPEN_FORM: "BOARD_OPEN_FORM",
121
140
  BOARD_GET_FIELDS: "BOARD_GET_FIELDS",
@@ -125,11 +144,14 @@ const LISTENER_CMDS = {
125
144
  BOARD_GET_ITEM: "BOARD_GET_ITEM",
126
145
  BOARD_DELETE_ITEM: "BOARD_DELETE_ITEM",
127
146
  BOARD_SUBMIT_ITEM: "BOARD_SUBMIT_ITEM",
128
- BOARD_DISCARD_ITEM: "BOARD_DISCARD_ITEM"
147
+ BOARD_DISCARD_ITEM: "BOARD_DISCARD_ITEM",
148
+ BOARD_INIT_FORM: "BOARD_INIT_FORM",
149
+ BOARD_GET_FIELD_OPTIONS: "BOARD_GET_FIELD_OPTIONS"
129
150
  };
130
151
  const EVENT_TYPES = {
131
152
  COMPONENT_ON_MOUNT: "componentOnMount",
132
- CC_ON_PARAMS_CHANGE: "onCustomComponentParamsChange"
153
+ CC_ON_PARAMS_CHANGE: "onCustomComponentParamsChange",
154
+ CC_ON_ROUTE_CHANGE: "onCustomComponentRouteChange"
133
155
  };
134
156
  const DEFAULTS = {
135
157
  POPUP_ID: "ACTIVE_POP_UP"
@@ -304,107 +326,184 @@ class AtomicsHandler {
304
326
  _textEncoder = new WeakMap();
305
327
  _textDecoder = new WeakMap();
306
328
  class Form extends BaseSDK {
307
- constructor(instanceId) {
329
+ constructor(storeId, flowId, instanceId, activityInstanceId) {
308
330
  super();
309
331
  this.type = "Form";
332
+ this.storeId = storeId;
333
+ this.flowId = flowId;
310
334
  this.instanceId = instanceId;
335
+ this.activityInstanceId = activityInstanceId;
311
336
  }
312
337
  toJSON() {
313
338
  return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
339
+ storeId: this.storeId,
314
340
  instanceId: this.instanceId
315
341
  });
316
342
  }
317
343
  getField(fieldId) {
318
344
  return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD, {
345
+ storeId: this.storeId,
319
346
  instanceId: this.instanceId,
320
347
  fieldId
321
348
  });
322
349
  }
323
350
  updateField(args) {
324
351
  return this._postMessageAsync(LISTENER_CMDS.UPDATE_FORM, {
352
+ storeId: this.storeId,
325
353
  instanceId: this.instanceId,
326
354
  data: args
327
355
  });
328
356
  }
357
+ getValidationErrors() {
358
+ return this._postMessageAsync(
359
+ LISTENER_CMDS.GET_FORM_VALIDATION_ERRORS,
360
+ {
361
+ storeId: this.storeId,
362
+ instanceId: this.instanceId
363
+ }
364
+ );
365
+ }
366
+ getFormConfiguration() {
367
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_CONFIGURATION, {
368
+ storeId: this.storeId,
369
+ instanceId: this.instanceId
370
+ });
371
+ }
372
+ getFieldState() {
373
+ return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD_STATE, {
374
+ storeId: this.storeId,
375
+ instanceId: this.instanceId
376
+ });
377
+ }
329
378
  getTable(tableId) {
330
- return new Table(this.instanceId, tableId);
379
+ return new Table(
380
+ this.storeId,
381
+ this.flowId,
382
+ this.instanceId,
383
+ tableId,
384
+ this.activityInstanceId
385
+ );
331
386
  }
332
387
  }
333
388
  class Table extends BaseSDK {
334
- constructor(instanceId, tableId) {
389
+ constructor(storeId, flowId, instanceId, tableId, activityInstanceId) {
335
390
  super();
336
391
  this.tableId = tableId;
392
+ this.storeId = storeId;
393
+ this.flowId = flowId;
337
394
  this.instanceId = instanceId;
395
+ this.activityInstanceId = activityInstanceId;
338
396
  }
339
397
  toJSON() {
340
398
  return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
399
+ storeId: this.storeId,
400
+ instanceId: this.instanceId,
341
401
  tableId: this.tableId
342
402
  });
343
403
  }
344
404
  getSelectedRows() {
345
405
  return this._postMessageAsync(LISTENER_CMDS.GET_SELECTED_TABLE_ROWS, {
406
+ storeId: this.storeId,
407
+ instanceId: this.instanceId,
346
408
  tableId: this.tableId
347
409
  });
348
410
  }
349
411
  getRows() {
350
412
  return this._postMessageAsync(
351
413
  LISTENER_CMDS.GET_TABLE_ROWS,
352
- { tableId: this.tableId },
414
+ {
415
+ storeId: this.storeId,
416
+ instanceId: this.instanceId,
417
+ tableId: this.tableId
418
+ },
353
419
  true,
354
420
  (data) => {
355
421
  return data.map(
356
- (row) => new TableForm(this.instanceId, this.tableId, row.id)
422
+ (row) => new TableForm(
423
+ this.storeId,
424
+ this.flowId,
425
+ this.instanceId,
426
+ this.tableId,
427
+ row.id,
428
+ this.activityInstanceId
429
+ )
357
430
  );
358
431
  }
359
432
  );
360
433
  }
361
434
  getRow(rowId) {
362
- return new TableForm(this.instanceId, this.tableId, rowId);
435
+ return new TableForm(
436
+ this.storeId,
437
+ this.flowId,
438
+ this.instanceId,
439
+ this.tableId,
440
+ rowId,
441
+ this.activityInstanceId
442
+ );
363
443
  }
364
444
  addRow(rowObject) {
365
445
  return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROW, {
446
+ storeId: this.storeId,
447
+ instanceId: this.instanceId,
366
448
  tableId: this.tableId,
367
449
  rowObject
368
450
  });
369
451
  }
370
452
  addRows(rows) {
371
453
  return this._postMessageAsync(LISTENER_CMDS.ADD_TABLE_ROWS, {
454
+ storeId: this.storeId,
455
+ instanceId: this.instanceId,
372
456
  tableId: this.tableId,
373
457
  rows
374
458
  });
375
459
  }
376
460
  deleteRow(rowId) {
377
461
  return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
462
+ storeId: this.storeId,
463
+ instanceId: this.instanceId,
378
464
  tableId: this.tableId,
379
465
  rows: [rowId]
380
466
  });
381
467
  }
382
468
  deleteRows(rows) {
383
469
  return this._postMessageAsync(LISTENER_CMDS.DELETE_TABLE_ROW, {
470
+ storeId: this.storeId,
471
+ instanceId: this.instanceId,
384
472
  tableId: this.tableId,
385
473
  rows
386
474
  });
387
475
  }
388
476
  }
389
477
  class TableForm extends BaseSDK {
390
- constructor(instanceId, tableId, rowId) {
478
+ constructor(storeId, flowId, instanceId, tableId, rowId, activityInstanceId) {
391
479
  super();
480
+ this.storeId = storeId;
481
+ this.flowId = flowId;
392
482
  this.instanceId = instanceId;
393
483
  this.type = "TabelForm";
394
484
  this.tableId = tableId;
395
485
  this.rowId = rowId;
486
+ this.activityInstanceId = activityInstanceId;
396
487
  }
397
488
  getParent() {
398
- return new Form(this.instanceId);
489
+ return new Form(
490
+ this.storeId,
491
+ this.flowId,
492
+ this.instanceId,
493
+ this.activityInstanceId
494
+ );
399
495
  }
400
496
  toJSON() {
401
497
  return this._postMessageAsync(LISTENER_CMDS.TO_JSON, {
498
+ storeId: this.storeId,
499
+ instanceId: this.instanceId,
402
500
  tableId: this.tableId,
403
501
  rowId: this.rowId
404
502
  });
405
503
  }
406
504
  getField(fieldId) {
407
505
  return this._postMessageAsync(LISTENER_CMDS.GET_FORM_FIELD, {
506
+ storeId: this.storeId,
408
507
  instanceId: this.instanceId,
409
508
  tableId: this.tableId,
410
509
  rowId: this.rowId,
@@ -413,6 +512,7 @@ class TableForm extends BaseSDK {
413
512
  }
414
513
  updateField(args) {
415
514
  return this._postMessageAsync(LISTENER_CMDS.UPDATE_FORM, {
515
+ storeId: this.storeId,
416
516
  instanceId: this.instanceId,
417
517
  tableId: this.tableId,
418
518
  rowId: this.rowId,
@@ -438,7 +538,37 @@ class Client extends BaseSDK {
438
538
  return super._postMessageAsync(LISTENER_CMDS.REDIRECT, { url });
439
539
  }
440
540
  getImageUrl(imageValue) {
441
- return this._postMessageAsync(LISTENER_CMDS.GET_IMAGE_URL, { imageValue });
541
+ return this._postMessageAsync(LISTENER_CMDS.GET_IMAGE_URL, {
542
+ imageValue
543
+ });
544
+ }
545
+ openFilePicker(options) {
546
+ return this._postMessageAsync(LISTENER_CMDS.FILEPICKER_OPEN, {
547
+ options
548
+ });
549
+ }
550
+ openScanner(options = {}) {
551
+ return this._postMessageAsync(LISTENER_CMDS.SCANNER_OPEN, {
552
+ options
553
+ });
554
+ }
555
+ pickLocation(value) {
556
+ return this._postMessageAsync(LISTENER_CMDS.GEOLOCATION_OPEN, {
557
+ value
558
+ });
559
+ }
560
+ uploadFile(file, fileName) {
561
+ return this._postMessageAsync(LISTENER_CMDS.FILE_UPLOAD, {
562
+ file,
563
+ fileName: fileName != null ? fileName : file.name
564
+ });
565
+ }
566
+ openFilePreview(args) {
567
+ var _a;
568
+ return this._postMessageAsync(LISTENER_CMDS.FILEPREVIEW_OPEN, {
569
+ files: args.files,
570
+ indexOfFile: (_a = args.indexOfFile) != null ? _a : 0
571
+ });
442
572
  }
443
573
  }
444
574
  class Formatter extends BaseSDK {
@@ -578,10 +708,12 @@ class Popup extends BaseSDK {
578
708
  }
579
709
  class Page extends BaseSDK {
580
710
  constructor(props, isCustomComponent = false) {
711
+ var _a;
581
712
  super();
582
713
  this.type = "Page";
583
714
  this.popup = new Popup({});
584
715
  this._id = props.pageId;
716
+ this._route = (_a = props.initialRoute) != null ? _a : "";
585
717
  }
586
718
  getParameter(key) {
587
719
  return this._postMessageAsync(LISTENER_CMDS.GET_PAGE_PARAMS, {
@@ -618,6 +750,13 @@ class Page extends BaseSDK {
618
750
  (data) => new Component(data)
619
751
  );
620
752
  }
753
+ setRoute(path) {
754
+ this._route = path;
755
+ return this._postMessage(LISTENER_CMDS.CC_SET_ROUTE, { route: path });
756
+ }
757
+ getRoute() {
758
+ return this._route;
759
+ }
621
760
  }
622
761
  class DecisionTable extends BaseSDK {
623
762
  constructor(flowId) {
@@ -687,7 +826,7 @@ class Dataform extends BaseSDK {
687
826
  return this._postMessageAsync(LISTENER_CMDS.DATAFORM_OPEN_FORM, {
688
827
  flowId: this._id,
689
828
  itemId: item._id,
690
- fullscreen: item.fullscreen || false
829
+ viewId: item._view_id || ""
691
830
  });
692
831
  }
693
832
  deleteItem(options) {
@@ -723,6 +862,32 @@ class Dataform extends BaseSDK {
723
862
  viewId: (options == null ? void 0 : options.viewId) || ""
724
863
  });
725
864
  }
865
+ initForm(instanceId, viewId) {
866
+ return this._postMessageAsync(LISTENER_CMDS.DATAFORM_INIT_FORM, {
867
+ flowId: this._id,
868
+ instanceId: instanceId || "",
869
+ viewId: viewId || ""
870
+ }).then((response) => {
871
+ return new Form(
872
+ response.storeId || instanceId || "",
873
+ this._id,
874
+ response.itemId || instanceId
875
+ );
876
+ });
877
+ }
878
+ getFieldOptions(options) {
879
+ return this._postMessageAsync(
880
+ LISTENER_CMDS.DATAFORM_GET_FIELD_OPTIONS,
881
+ {
882
+ flowId: this._id,
883
+ instanceId: (options == null ? void 0 : options.instanceId) || "",
884
+ fieldId: (options == null ? void 0 : options.fieldId) || "",
885
+ fieldType: options == null ? void 0 : options.fieldType,
886
+ tableId: options == null ? void 0 : options.tableId,
887
+ tableRowId: options == null ? void 0 : options.tableRowId
888
+ }
889
+ );
890
+ }
726
891
  }
727
892
  class Board extends BaseSDK {
728
893
  constructor(flowId) {
@@ -742,8 +907,7 @@ class Board extends BaseSDK {
742
907
  return this._postMessageAsync(LISTENER_CMDS.BOARD_OPEN_FORM, {
743
908
  flowId: this._id,
744
909
  itemId: item._id,
745
- viewId: item._view_id,
746
- fullscreen: item.fullscreen || false
910
+ viewId: item._view_id
747
911
  });
748
912
  }
749
913
  getItems(options) {
@@ -814,6 +978,35 @@ class Board extends BaseSDK {
814
978
  viewId: (options == null ? void 0 : options.viewId) || ""
815
979
  });
816
980
  }
981
+ initForm(instanceId, viewId) {
982
+ return this._postMessageAsync(LISTENER_CMDS.BOARD_INIT_FORM, {
983
+ flowId: this._id,
984
+ instanceId: instanceId || "",
985
+ viewId: viewId || ""
986
+ }).then((response) => {
987
+ return new Form(
988
+ response.storeId || instanceId || "",
989
+ this._id,
990
+ response.itemId || instanceId
991
+ );
992
+ });
993
+ }
994
+ getFieldOptions(options) {
995
+ const error = requireFieldsAsync([
996
+ { value: options.instanceId, name: "instanceId" },
997
+ { value: options.fieldId, name: "fieldId" }
998
+ ]);
999
+ if (error)
1000
+ return error;
1001
+ return this._postMessageAsync(LISTENER_CMDS.BOARD_GET_FIELD_OPTIONS, {
1002
+ flowId: this._id,
1003
+ instanceId: options.instanceId,
1004
+ fieldId: options.fieldId,
1005
+ fieldType: options.fieldType,
1006
+ tableId: options == null ? void 0 : options.tableId,
1007
+ tableRowId: options == null ? void 0 : options.tableRowId
1008
+ });
1009
+ }
817
1010
  }
818
1011
  class Process extends BaseSDK {
819
1012
  constructor(flowId) {
@@ -831,24 +1024,30 @@ class Process extends BaseSDK {
831
1024
  });
832
1025
  }
833
1026
  getMyTasksItems(options) {
834
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_MY_TASKS_ITEMS, {
835
- flowId: this._id,
836
- activityId: (options == null ? void 0 : options.activityId) || "",
837
- searchValue: (options == null ? void 0 : options.searchValue) || "",
838
- pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
839
- pageSize: (options == null ? void 0 : options.pageSize) || 50,
840
- payload: (options == null ? void 0 : options.payload) || {}
841
- });
1027
+ return this._postMessageAsync(
1028
+ LISTENER_CMDS.PROCESS_GET_MY_TASKS_ITEMS,
1029
+ {
1030
+ flowId: this._id,
1031
+ activityId: (options == null ? void 0 : options.activityId) || "",
1032
+ searchValue: (options == null ? void 0 : options.searchValue) || "",
1033
+ pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
1034
+ pageSize: (options == null ? void 0 : options.pageSize) || 50,
1035
+ payload: (options == null ? void 0 : options.payload) || {}
1036
+ }
1037
+ );
842
1038
  }
843
1039
  getParticipatedItems(options) {
844
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_PARTICIPATED_ITEMS, {
845
- flowId: this._id,
846
- activityId: (options == null ? void 0 : options.activityId) || "",
847
- searchValue: (options == null ? void 0 : options.searchValue) || "",
848
- pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
849
- pageSize: (options == null ? void 0 : options.pageSize) || 50,
850
- payload: (options == null ? void 0 : options.payload) || {}
851
- });
1040
+ return this._postMessageAsync(
1041
+ LISTENER_CMDS.PROCESS_GET_PARTICIPATED_ITEMS,
1042
+ {
1043
+ flowId: this._id,
1044
+ activityId: (options == null ? void 0 : options.activityId) || "",
1045
+ searchValue: (options == null ? void 0 : options.searchValue) || "",
1046
+ pageNumber: (options == null ? void 0 : options.pageNumber) || 1,
1047
+ pageSize: (options == null ? void 0 : options.pageSize) || 50,
1048
+ payload: (options == null ? void 0 : options.payload) || {}
1049
+ }
1050
+ );
852
1051
  }
853
1052
  getAdminItems(options) {
854
1053
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ADMIN_ITEMS, {
@@ -860,12 +1059,16 @@ class Process extends BaseSDK {
860
1059
  });
861
1060
  }
862
1061
  getItem(options) {
863
- const error = requireFieldAsync(options.instanceId, "instanceId");
1062
+ const error = requireFieldsAsync([
1063
+ { value: options.instanceId, name: "instanceId" },
1064
+ { value: options.activityInstanceId, name: "activityInstanceId" }
1065
+ ]);
864
1066
  if (error)
865
1067
  return error;
866
1068
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ITEM, {
867
1069
  flowId: this._id,
868
- instanceId: options.instanceId
1070
+ instanceId: options.instanceId,
1071
+ activityInstanceId: options.activityInstanceId
869
1072
  });
870
1073
  }
871
1074
  createItem(options) {
@@ -897,18 +1100,42 @@ class Process extends BaseSDK {
897
1100
  instanceId: options.instanceId
898
1101
  });
899
1102
  }
1103
+ getAdminItem(options) {
1104
+ const error = requireFieldAsync(options.instanceId, "instanceId");
1105
+ if (error)
1106
+ return error;
1107
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_ADMIN_ITEM, {
1108
+ flowId: this._id,
1109
+ instanceId: options.instanceId
1110
+ });
1111
+ }
1112
+ updateAdminItem(options) {
1113
+ const error = requireFieldsAsync([
1114
+ { value: options.instanceId, name: "instanceId" },
1115
+ { value: options.data, name: "data" }
1116
+ ]);
1117
+ if (error)
1118
+ return error;
1119
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_UPDATE_ADMIN_ITEM, {
1120
+ flowId: this._id,
1121
+ instanceId: options.instanceId,
1122
+ data: options.data
1123
+ });
1124
+ }
900
1125
  openForm(item) {
901
1126
  const error = requireFieldsAsync([
902
1127
  { value: item._id, name: "Instance Id (_id)" },
903
- { value: item._activity_instance_id, name: "Activity Instance Id (_activity_instance_id)" }
1128
+ {
1129
+ value: item._activity_instance_id,
1130
+ name: "Activity Instance Id (_activity_instance_id)"
1131
+ }
904
1132
  ]);
905
1133
  if (error)
906
1134
  return error;
907
1135
  return this._postMessageAsync(LISTENER_CMDS.PROCESS_OPEN_FORM, {
908
1136
  flowId: this._id,
909
1137
  instanceId: item._id,
910
- activityInstanceId: item._activity_instance_id,
911
- fullscreen: item.fullscreen || false
1138
+ activityInstanceId: item._activity_instance_id
912
1139
  });
913
1140
  }
914
1141
  submitItem(options) {
@@ -1037,17 +1264,23 @@ class Process extends BaseSDK {
1037
1264
  });
1038
1265
  }
1039
1266
  getParticipatedFields(options) {
1040
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_PARTICIPATED_FIELDS, {
1041
- flowId: this._id,
1042
- activityId: options.activityId,
1043
- isParticipated: true
1044
- });
1267
+ return this._postMessageAsync(
1268
+ LISTENER_CMDS.PROCESS_GET_PARTICIPATED_FIELDS,
1269
+ {
1270
+ flowId: this._id,
1271
+ activityId: options.activityId,
1272
+ isParticipated: true
1273
+ }
1274
+ );
1045
1275
  }
1046
1276
  getMyItemsFields(options) {
1047
- return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_MY_ITEMS_FIELDS, {
1048
- flowId: this._id,
1049
- status: options.status
1050
- });
1277
+ return this._postMessageAsync(
1278
+ LISTENER_CMDS.PROCESS_GET_MY_ITEMS_FIELDS,
1279
+ {
1280
+ flowId: this._id,
1281
+ status: options.status
1282
+ }
1283
+ );
1051
1284
  }
1052
1285
  getProgress(options) {
1053
1286
  const error = requireFieldAsync(options.instanceId, "instanceId");
@@ -1058,6 +1291,48 @@ class Process extends BaseSDK {
1058
1291
  instanceId: options.instanceId
1059
1292
  });
1060
1293
  }
1294
+ initForm(instanceId, activityInstanceId) {
1295
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_INIT_FORM, {
1296
+ flowId: this._id,
1297
+ instanceId: instanceId || "",
1298
+ activityInstanceId: activityInstanceId || ""
1299
+ }).then((response) => {
1300
+ return new Form(
1301
+ response.storeId || instanceId || "",
1302
+ this._id,
1303
+ response.itemId || instanceId,
1304
+ response.activityInstanceId || activityInstanceId
1305
+ );
1306
+ });
1307
+ }
1308
+ getFieldOptions(options) {
1309
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_GET_FIELD_OPTIONS, {
1310
+ flowId: this._id,
1311
+ instanceId: (options == null ? void 0 : options.instanceId) || "",
1312
+ activityInstanceId: (options == null ? void 0 : options.activityInstanceId) || "",
1313
+ fieldId: (options == null ? void 0 : options.fieldId) || "",
1314
+ fieldType: options == null ? void 0 : options.fieldType,
1315
+ tableId: options == null ? void 0 : options.tableId,
1316
+ tableRowId: options == null ? void 0 : options.tableRowId
1317
+ });
1318
+ }
1319
+ parseAttachment(options) {
1320
+ const error = requireFieldsAsync([
1321
+ { value: options.instanceId, name: "instanceId" },
1322
+ { value: options.activityInstanceId, name: "activityInstanceId" },
1323
+ { value: options.fieldId, name: "fieldId" },
1324
+ { value: options.file, name: "file" }
1325
+ ]);
1326
+ if (error)
1327
+ return error;
1328
+ return this._postMessageAsync(LISTENER_CMDS.PROCESS_PARSE_ATTACHMENT, {
1329
+ flowId: this._id,
1330
+ instanceId: options.instanceId,
1331
+ activityInstanceId: options.activityInstanceId,
1332
+ fieldId: options.fieldId,
1333
+ file: options.file
1334
+ });
1335
+ }
1061
1336
  }
1062
1337
  class Application extends BaseSDK {
1063
1338
  constructor(props, isCustomComponent = false) {
@@ -1094,6 +1369,15 @@ class Application extends BaseSDK {
1094
1369
  getProcess(flowId) {
1095
1370
  return new Process(flowId);
1096
1371
  }
1372
+ getRoles() {
1373
+ return this._postMessageAsync(LISTENER_CMDS.GET_ROLES, {});
1374
+ }
1375
+ switchRole(args) {
1376
+ return this._postMessageAsync(LISTENER_CMDS.SWITCH_ROLE, {
1377
+ roleId: args.roleId,
1378
+ roleName: args.roleName
1379
+ });
1380
+ }
1097
1381
  }
1098
1382
  class NDEFReader extends BaseSDK {
1099
1383
  constructor() {
@@ -1174,12 +1458,18 @@ class LowcodeSDK extends BaseSDK {
1174
1458
  __privateAdd(this, _csrfToken, void 0);
1175
1459
  if (props.tableId && props.tableRowId) {
1176
1460
  this.context = new TableForm(
1461
+ props.formInstanceId,
1462
+ props.flowId,
1177
1463
  props.formInstanceId,
1178
1464
  props.tableId,
1179
1465
  props.tableRowId
1180
1466
  );
1181
1467
  } else if (props.formInstanceId) {
1182
- this.context = new Form(props.formInstanceId);
1468
+ this.context = new Form(
1469
+ props.formInstanceId,
1470
+ props.flowId,
1471
+ props.formInstanceId
1472
+ );
1183
1473
  } else if (props.popupId) {
1184
1474
  this.context = new Popup(props);
1185
1475
  } else if (props.pageId && !props.componentId) {