@processmaker/screen-builder 3.8.26 → 3.8.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "3.8.26",
3
+ "version": "3.8.28",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -341,6 +341,9 @@ export default {
341
341
  },
342
342
  ],
343
343
  valueTypeReturned: '',
344
+ assetType: null,
345
+ assetTypeResolved: false,
346
+ screenId: null,
344
347
  };
345
348
  },
346
349
  watch: {
@@ -504,9 +507,37 @@ export default {
504
507
  monacoMounted(editor) {
505
508
  editor.getAction('editor.action.formatDocument').run();
506
509
  },
507
- getDataSourceList() {
510
+ resolveAssetType() {
511
+ if (this.assetTypeResolved) {
512
+ return Promise.resolve(this.assetType);
513
+ }
514
+ const match = window.location.pathname.match(/screen-builder\/(\d+)\/edit/);
515
+ if (!match) {
516
+ this.assetTypeResolved = true;
517
+ return Promise.resolve(this.assetType);
518
+ }
519
+ this.screenId = match[1];
520
+ return this.$dataProvider
521
+ .get(`/screens/${this.screenId}`)
522
+ .then(response => {
523
+ this.assetType = response.data.asset_type || null;
524
+ this.assetTypeResolved = true;
525
+ return this.assetType;
526
+ })
527
+ .catch(() => {
528
+ this.assetTypeResolved = true;
529
+ return this.assetType;
530
+ });
531
+ },
532
+ async getDataSourceList() {
533
+ await this.resolveAssetType();
534
+ const params = {};
535
+ if (this.assetType) {
536
+ // For PM Block screens, expose both regular and PM Block connectors.
537
+ params.asset_type = this.assetType === 'PM_BLOCK' ? 'all' : this.assetType;
538
+ }
508
539
  this.$dataProvider
509
- .get('/data_sources')
540
+ .get('/data_sources', { params })
510
541
  .then(response => {
511
542
  let jsonData = response.data.data;
512
543
  // Map the data sources response to value/text items list
@@ -354,8 +354,7 @@ export default {
354
354
  this.loopContext = _.get(this.task, "loop_context", "");
355
355
 
356
356
  if (this.task.draft) {
357
- this.requestData = _.merge(
358
- {},
357
+ this.requestData = this.restoreDraftData(
359
358
  this.requestData,
360
359
  this.task.draft.data
361
360
  );
@@ -373,6 +372,13 @@ export default {
373
372
  this.hasErrors = false;
374
373
  }
375
374
  },
375
+ restoreDraftData(requestData, draftData) {
376
+ const shouldMerge =
377
+ globalThis?.ProcessMaker?.screen?.mergeDraftOnRestore ?? true;
378
+ return shouldMerge
379
+ ? _.merge({}, requestData, draftData)
380
+ : { ...requestData, ...draftData };
381
+ },
376
382
  pageUpdate() {
377
383
  this.$emit("updated-page-core");
378
384
  },