@processmaker/screen-builder 3.8.9 → 3.8.11

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.
@@ -14049,12 +14049,13 @@ const Fb = /* @__PURE__ */ Pr(YO), kr = typeof window > "u" ? global : window, J
14049
14049
  return {};
14050
14050
  },
14051
14051
  methods: {
14052
- loadFormDynamicPanelProperties({ properties: t, element: e }) {
14053
- const r = e.config.settings.varname, i = e.config.settings.indexName;
14054
- t[":itemData"] = `${r} && ${r}[${i}]`, e.config.settings.emptyStateMessage && (t[":emptyStateMessage"] = this.byRef(e.config.settings.emptyStateMessage)), t[":validationData"] = "getValidationData()", this.registerVariable(e.config.settings.varname, e);
14055
- },
14056
- loadFormDynamicPanelItems({ element: t, node: e, definition: r }) {
14057
- const i = {
14052
+ /**
14053
+ * Builds the nested configuration for dynamic panel items
14054
+ * @param {Object} element - The dynamic panel element
14055
+ * @returns {Object} The nested configuration
14056
+ */
14057
+ buildNestedConfig(t) {
14058
+ return {
14058
14059
  config: [
14059
14060
  {
14060
14061
  items: t.items
@@ -14062,16 +14063,102 @@ const Fb = /* @__PURE__ */ Pr(YO), kr = typeof window > "u" ? global : window, J
14062
14063
  ],
14063
14064
  watchers: [],
14064
14065
  isMobile: !1
14065
- }, a = t.config.settings.varname, n = t.config.settings.indexName, s = this.createComponent("ScreenRenderer", {
14066
- ":definition": this.byRef(i),
14067
- ":value": `${a} && ${a}[${n}]`,
14068
- ":loop-context": `'${a} && ${a}[${n}]'`,
14066
+ };
14067
+ },
14068
+ /**
14069
+ * Creates expressions for value and loop context based on index availability
14070
+ * @param {string} variableName - The variable name
14071
+ * @param {string} index - The index name
14072
+ * @returns {Object} Object containing valueExpression and loopContextExpression
14073
+ */
14074
+ buildExpressions(t, e) {
14075
+ return e && e.trim() ? {
14076
+ valueExpression: `${t} && ${t}[${e}]`,
14077
+ loopContextExpression: `'${t} && ${t}[${e}]'`
14078
+ } : {
14079
+ valueExpression: t,
14080
+ loopContextExpression: `'${t}'`
14081
+ };
14082
+ },
14083
+ /**
14084
+ * Creates a ScreenRenderer component for the dynamic panel
14085
+ * @param {Object} nested - The nested configuration
14086
+ * @param {string} valueExpression - The value expression
14087
+ * @param {string} loopContextExpression - The loop context expression
14088
+ * @param {Object} definition - The definition object
14089
+ * @returns {Object} The created component
14090
+ */
14091
+ createScreenRenderer(t, e, r, i) {
14092
+ return this.createComponent("ScreenRenderer", {
14093
+ ":definition": this.byRef(t),
14094
+ ":value": e,
14095
+ ":loop-context": r,
14069
14096
  ":_parent": "getValidationData()",
14070
14097
  ":components": this.byRef(this.components),
14071
- ":config-ref": this.byRef(this.configRef || r.config),
14098
+ ":config-ref": this.byRef(this.configRef || i.config),
14072
14099
  "@submit": "submitForm"
14073
14100
  });
14074
- e.appendChild(s);
14101
+ },
14102
+ /**
14103
+ * Builds the itemData property based on variable name and index
14104
+ * @param {string} variableName - The variable name
14105
+ * @param {string} index - The index name
14106
+ * @returns {string} The itemData expression
14107
+ */
14108
+ buildItemDataExpression(t, e) {
14109
+ return e && e.trim() ? `${t} && ${t}[${e}]` : t;
14110
+ },
14111
+ /**
14112
+ * Gets a helpful empty state message based on whether index is configured
14113
+ * @param {string} index - The index name
14114
+ * @param {string} customMessage - Custom message from settings
14115
+ * @returns {string} The appropriate empty state message
14116
+ */
14117
+ getEmptyStateMessage(t, e) {
14118
+ return e || (!t || !t.trim() ? (console.warn("FormDynamicPanel: No Index Name configured. The dynamic panel will not function properly without an index."), "No data available. Please configure an Index Name for this dynamic panel.") : "No data available for this dynamic panel.");
14119
+ },
14120
+ /**
14121
+ * Validates that required settings are present
14122
+ * @param {Object} element - The dynamic panel element
14123
+ * @returns {boolean} True if valid, false otherwise
14124
+ */
14125
+ validateElementSettings(t) {
14126
+ return !t.config || !t.config.settings ? (console.warn("FormDynamicPanel: Missing config or settings"), !1) : t.config.settings.varname ? !0 : (console.warn("FormDynamicPanel: Missing varname setting"), !1);
14127
+ },
14128
+ /**
14129
+ * Safely extracts settings from element with validation
14130
+ * @param {Object} element - The dynamic panel element
14131
+ * @returns {Object|null} Settings object or null if invalid
14132
+ */
14133
+ extractValidatedSettings(t) {
14134
+ return this.validateElementSettings(t) ? {
14135
+ variableName: t.config.settings.varname,
14136
+ index: t.config.settings.indexName || "",
14137
+ emptyStateMessage: t.config.settings.emptyStateMessage
14138
+ } : null;
14139
+ },
14140
+ /**
14141
+ * Loads the properties for the FormDynamicPanel
14142
+ * @param {Object} params - The parameters object
14143
+ */
14144
+ loadFormDynamicPanelProperties({ properties: t, element: e }) {
14145
+ const r = this.extractValidatedSettings(e);
14146
+ if (!r)
14147
+ return;
14148
+ t[":itemData"] = this.buildItemDataExpression(r.variableName, r.index);
14149
+ const i = this.getEmptyStateMessage(r.index, r.emptyStateMessage);
14150
+ t[":emptyStateMessage"] = this.byRef(i), t[":validationData"] = "getValidationData()", this.registerVariable(r.variableName, e);
14151
+ },
14152
+ /**
14153
+ * Loads the items for the FormDynamicPanel
14154
+ * @param {Object} params - The parameters object
14155
+ */
14156
+ loadFormDynamicPanelItems({ element: t, node: e, definition: r }) {
14157
+ const i = this.extractValidatedSettings(t);
14158
+ if (!i)
14159
+ return;
14160
+ const a = this.buildNestedConfig(t), { valueExpression: n, loopContextExpression: s } = this.buildExpressions(i.variableName, i.index), o = this.createScreenRenderer(a, n, s, r);
14161
+ e.appendChild(o);
14075
14162
  }
14076
14163
  },
14077
14164
  mounted() {
@@ -47000,7 +47087,7 @@ const G_ = {
47000
47087
  ],
47001
47088
  computed: {
47002
47089
  classColor() {
47003
- return this.variantStyle === "link" ? `text-${this.variant}` : `btn btn-${this.variant}`;
47090
+ return this.variantStyle === "button" ? `btn btn-${this.variant}` : `text-${this.variant}`;
47004
47091
  }
47005
47092
  }
47006
47093
  };
@@ -47013,7 +47100,7 @@ var Y_ = function() {
47013
47100
  Q_,
47014
47101
  !1,
47015
47102
  null,
47016
- "8414cd47",
47103
+ "c0b7067a",
47017
47104
  null,
47018
47105
  null
47019
47106
  );
@@ -53132,7 +53219,7 @@ const gie = Ru(hie), rne = Ru(mie), ine = Ru([pie]), bie = Ru([gS, vS]), yie = v
53132
53219
  varname: "dynamic_panel",
53133
53220
  indexName: "",
53134
53221
  add: !1,
53135
- emptyStateMessage: "No data available for this dynamic panel"
53222
+ emptyStateMessage: "No data available. Please configure an Index Name for this dynamic panel."
53136
53223
  }
53137
53224
  },
53138
53225
  inspector: [