@unvired/turboforms-embed-sdk 2.0.35 → 2.0.36

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.
@@ -35962,14 +35962,60 @@ class SmartSelectComponent extends SmartSelectList {
35962
35962
 
35963
35963
  if (this.component.filter) {
35964
35964
  try {
35965
- const filterStr = this.interpolate(this.component.filter);
35966
- let [key, val] = filterStr.split('=').map(s => decodeURIComponent(s.trim()));
35965
+ let val;
35966
+ let isTemplate = false;
35967
+ if (this.component.filter.includes('={{')) {
35968
+ const match = this.component.filter.match(/\{\{([^}]+)\}\}/);
35969
+ if (match) {
35970
+ isTemplate = true;
35971
+ const path = match[1].trim();
35972
+ let contextVal = _.get(this.evalContext ? this.evalContext() : { data: this.data }, path);
35973
+ if (contextVal === undefined) {
35974
+ const cleanPath = path.startsWith('data.') ? path.replace('data.', '') : path;
35975
+ contextVal = _.get(this.data, cleanPath);
35976
+ }
35977
+ if (contextVal && typeof contextVal === 'object') {
35978
+ if (contextVal.value !== undefined) {
35979
+ val = contextVal.value;
35980
+ } else if (contextVal.id !== undefined) {
35981
+ val = contextVal.id;
35982
+ } else if (contextVal.data && contextVal.data.value !== undefined) {
35983
+ val = contextVal.data.value;
35984
+ } else {
35985
+ val = contextVal;
35986
+ }
35987
+ } else {
35988
+ val = contextVal;
35989
+ }
35990
+ }
35991
+ }
35992
+
35993
+ if (!isTemplate || val === undefined) {
35994
+ const filterStr = this.interpolate(this.component.filter, this.evalContext ? this.evalContext() : { data: this.data });
35995
+ let [k, v] = filterStr.split('=').map(s => decodeURIComponent(s.trim()));
35996
+ val = v;
35997
+ }
35998
+
35999
+ let key = this.component.filter.split('=')[0].trim();
36000
+ let originalKey = key;
35967
36001
  if (key && key.startsWith('data.')) {
35968
36002
  key = key.replace('data.', '');
35969
-
35970
36003
  }
36004
+
35971
36005
  items = items.filter((row) => {
35972
- return String(row[key]).toLowerCase() === String(val).toLowerCase();
36006
+ let rowVal;
36007
+ if (row) {
36008
+ if (row.hasOwnProperty(originalKey)) {
36009
+ rowVal = row[originalKey];
36010
+ } else if (row.data && row.data.hasOwnProperty(key)) {
36011
+ rowVal = row.data[key];
36012
+ } else if (row.hasOwnProperty(key)) {
36013
+ rowVal = row[key];
36014
+ } else {
36015
+ rowVal = _.get(row, originalKey) !== undefined ? _.get(row, originalKey) : _.get(row, key);
36016
+ }
36017
+ }
36018
+ return rowVal !== undefined && val !== undefined && String(rowVal).toLowerCase() === String(val).toLowerCase();
35973
36019
  });
35974
36020
  } catch (e) {
35975
36021
  console.warn('[TF_SDK:153] ⚠️ Filter error:', e);
@@ -36048,16 +36094,19 @@ class SmartSelectComponent extends SmartSelectList {
36048
36094
  // }
36049
36095
  console.log("[TF_SDK:159] ✅ this.data =" + this.data[this.key]);
36050
36096
  if (!this.isFromSearch && !this.isScrollLoading && !this.component.dropdownOpened) {
36051
- if (this.component.masterdata && this.defaultDownloadedResources && this.defaultDownloadedResources.length > 0 && (this.defaultDownloadedResources.length < this.component.masterdata.length)) {
36097
+ const masterdataList = this.filteredMasterdata;
36098
+ if (masterdataList && this.defaultDownloadedResources && this.defaultDownloadedResources.length > 0 && (this.defaultDownloadedResources.length < masterdataList.length)) {
36052
36099
  this.setItems(this.defaultDownloadedResources);
36053
36100
  } else {
36054
- // if (!this.component.dropdownOpened && this.data[this.key] && String(this.data[this.key]).length > 0 && this.component.masterdata) {
36055
- if (!this.component.dropdownOpened && this.component.masterdata) {
36056
- console.log("[TF_SDK:160] ✅ Masterdata found for component:", this.component.key, "Length:", this.component.masterdata.length);
36057
- console.log("[TF_SDK:161] Masterdata first item:", this.component.masterdata[0]);
36101
+ // if (!this.component.dropdownOpened && this.data[this.key] && String(this.data[this.key]).length > 0 && masterdataList) {
36102
+ if (!this.component.dropdownOpened && masterdataList) {
36103
+ console.log("[TF_SDK:160] ✅ Masterdata found for component:", this.component.key, "Length:", masterdataList.length);
36104
+ if (masterdataList.length > 0) {
36105
+ console.log("[TF_SDK:161] ✅ Masterdata first item:", masterdataList[0]);
36106
+ }
36058
36107
  if (this.data && this.data[this.key]) {
36059
36108
  console.log("[TF_SDK:162] ✅ Filtering masterdata with search term:", this.data[this.key]);
36060
- let result = this.component.masterdata.filter((value) => {
36109
+ let result = masterdataList.filter((value) => {
36061
36110
  if (value) {
36062
36111
  let propVal = _.get(value, this.component.valueProperty);
36063
36112
  let data = propVal ? propVal.toString().toLowerCase() : '';
@@ -36069,10 +36118,10 @@ class SmartSelectComponent extends SmartSelectList {
36069
36118
  this.setItems(result);
36070
36119
  } else {
36071
36120
  console.log("[TF_SDK:164] ✅ No search term, passing all masterdata to setItems.");
36072
- this.setItems(this.component.masterdata);
36121
+ this.setItems(masterdataList);
36073
36122
  }
36074
36123
  } else {
36075
- console.log("[TF_SDK:165] ✅ Condition failed. dropdownOpened:", this.component.dropdownOpened, "masterdata:", !!this.component.masterdata);
36124
+ console.log("[TF_SDK:165] ✅ Condition failed. dropdownOpened:", this.component.dropdownOpened, "masterdata:", !!masterdataList);
36076
36125
  }
36077
36126
  }
36078
36127
  }
@@ -42821,7 +42870,7 @@ window.CommentOnBack = CommentOnBack;
42821
42870
 
42822
42871
 
42823
42872
  <div id="sticky-footer">
42824
- <div class="build-version">SDK v2.0.35</div>
42873
+ <div class="build-version">SDK v2.0.36</div>
42825
42874
  <div class="relative-position">
42826
42875
  <button id="unvired-more-btn" class="ui button primary dataGrid-addRow" onclick="toggleTooltip()">
42827
42876
  <i class="icon options"></i>