@processmaker/screen-builder 3.8.8 → 3.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/screen-builder",
3
- "version": "3.8.8",
3
+ "version": "3.8.10",
4
4
  "scripts": {
5
5
  "dev": "VITE_COVERAGE=true vite",
6
6
  "build": "vite build",
@@ -22,22 +22,34 @@
22
22
  data-test="i1177-inspector-index-name"
23
23
  />
24
24
  </div>
25
+
26
+ <div class="form-group border-bottom">
27
+ <FormTextArea
28
+ v-model="settings.emptyStateMessage"
29
+ :label="$t('Empty State Message')"
30
+ :name="$t('Empty State Message')"
31
+ :helper="$t('Custom message to display when the panel has no data. Supports HTML and Mustache placeholders')"
32
+ :rows="3"
33
+ data-test="i1177-inspector-empty-state-message"
34
+ />
35
+ </div>
25
36
  </div>
26
37
  </template>
27
38
 
28
39
  <script>
29
- import { FormInput } from '@processmaker/vue-form-elements';
40
+ import { FormInput, FormTextArea } from '@processmaker/vue-form-elements';
30
41
 
31
42
  export default {
32
43
  props: ['value', 'screenType'],
33
44
  inheritAttrs: false,
34
- components: { FormInput },
45
+ components: { FormInput, FormTextArea },
35
46
  data() {
36
47
  return {
37
48
  settings: {
38
49
  type: 'new',
39
50
  varname: '',
40
51
  indexName: '',
52
+ emptyStateMessage: this.$t('No data available for this dynamic panel'),
41
53
  },
42
54
  };
43
55
  },
@@ -4,12 +4,13 @@
4
4
  <slot></slot>
5
5
  </div>
6
6
  <div v-else class="dynamic-panel-empty">
7
- <p class="text-muted">No data available for this dynamic panel</p>
7
+ <div v-html="renderedEmptyMessage" class="text-muted"></div>
8
8
  </div>
9
9
  </div>
10
10
  </template>
11
11
 
12
12
  <script>
13
+ import Mustache from 'mustache';
13
14
 
14
15
  export default {
15
16
  name: "FormDynamicPanel",
@@ -19,10 +20,34 @@ export default {
19
20
  required: false,
20
21
  default: null
21
22
  },
23
+ emptyStateMessage: {
24
+ type: String,
25
+ required: false,
26
+ default: 'No data available for this dynamic panel'
27
+ },
28
+ validationData: {
29
+ type: Object,
30
+ required: false,
31
+ default: () => ({})
32
+ }
22
33
  },
23
34
  computed: {
24
35
  hasData() {
25
36
  return this.itemData !== null && this.itemData !== undefined;
37
+ },
38
+ renderedEmptyMessage() {
39
+ if (!this.emptyStateMessage) {
40
+ return this.$t('No data available for this dynamic panel');
41
+ }
42
+
43
+ try {
44
+ // Process Mustache placeholders
45
+ const processedMessage = Mustache.render(this.emptyStateMessage, this.validationData);
46
+ return processedMessage;
47
+ } catch (error) {
48
+ // If Mustache processing fails, return the original message
49
+ return this.emptyStateMessage;
50
+ }
26
51
  }
27
52
  }
28
53
  };
@@ -22,10 +22,10 @@ export default {
22
22
  ],
23
23
  computed: {
24
24
  classColor() {
25
- if (this.variantStyle === "link") {
26
- return `text-${this.variant}`;
25
+ if (this.variantStyle === "button") {
26
+ return `btn btn-${this.variant}`;
27
27
  }
28
- return `btn btn-${this.variant}`;
28
+ return `text-${this.variant}`;
29
29
  }
30
30
  }
31
31
  };
@@ -489,6 +489,7 @@ export default [
489
489
  varname: 'dynamic_panel',
490
490
  indexName: '',
491
491
  add: false,
492
+ emptyStateMessage: 'No data available for this dynamic panel',
492
493
  },
493
494
  },
494
495
  inspector: [
@@ -14,6 +14,15 @@ export default {
14
14
 
15
15
  // Add itemData to the properties of FormDynamicPanel
16
16
  properties[':itemData'] = `${variableName} && ${variableName}[${index}]`;
17
+
18
+ // Add emptyStateMessage property if configured
19
+ if (element.config.settings.emptyStateMessage) {
20
+ properties[':emptyStateMessage'] = this.byRef(element.config.settings.emptyStateMessage);
21
+ }
22
+
23
+ // Add validationData for Mustache processing
24
+ properties[':validationData'] = 'getValidationData()';
25
+
17
26
  this.registerVariable(element.config.settings.varname, element);
18
27
  },
19
28
  loadFormDynamicPanelItems({ element, node, definition }) {