@unvired/turboforms-embed-sdk 2.0.76 → 2.0.77
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/dist/turboforms.esm.js +3 -3
- package/dist/turboforms.html +112 -12
- package/dist/turboforms.js +3 -3
- package/package.json +1 -1
package/dist/turboforms.html
CHANGED
|
@@ -35775,7 +35775,7 @@ const _FormioUtils = (typeof FormioUtils !== 'undefined') ? FormioUtils : (_Form
|
|
|
35775
35775
|
const SmartSelectField = (_Formio && _Formio.Components && _Formio.Components.components) ? _Formio.Components.components.list : class { static schema() { return {}; } };
|
|
35776
35776
|
const getRandomComponentId = (_FormioUtils && _FormioUtils.getRandomComponentId) ? _FormioUtils.getRandomComponentId : () => Math.random().toString(36).substring(7);
|
|
35777
35777
|
const boolValue = (_FormioUtils && _FormioUtils.boolValue) ? _FormioUtils.boolValue : (val) => !!val;
|
|
35778
|
-
|
|
35778
|
+
var browserPlatform = window.platform === "web"
|
|
35779
35779
|
class SmartSelectComponent extends SmartSelectField {
|
|
35780
35780
|
static schema(...extend) {
|
|
35781
35781
|
return SmartSelectField.schema({
|
|
@@ -36694,9 +36694,16 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
36694
36694
|
// for the author automatically -- no type ambiguity here, unlike '=='.
|
|
36695
36695
|
const template = this.component.filter.replace(/(~=\s*)(\{\{.*?\}\})/g, '$1"$2"');
|
|
36696
36696
|
const filterStr = this.interpolate(template, { data: this.data });
|
|
36697
|
+
|
|
36697
36698
|
const filterFn = filtrex.compileExpression(filterStr, {
|
|
36698
36699
|
customProp: filtrex.useDotAccessOperatorAndOptionalChaining,
|
|
36700
|
+
extraFunctions: {
|
|
36701
|
+
equalsIgnoreCase: (a, b) => String(a).toLowerCase() === String(b).toLowerCase(),
|
|
36702
|
+
matchIgnoreCase: (value, pattern) => new RegExp(pattern, 'i').test(String(value)),
|
|
36703
|
+
},
|
|
36699
36704
|
});
|
|
36705
|
+
|
|
36706
|
+
|
|
36700
36707
|
items = items.filter((row) => filterFn({ data: row }));
|
|
36701
36708
|
} catch (e) {
|
|
36702
36709
|
console.warn('[TF_SDK:153] ⚠️ Filter error:', e);
|
|
@@ -37016,6 +37023,7 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37016
37023
|
searchEnabled: useSearch,
|
|
37017
37024
|
searchChoices: !this.component.searchField,
|
|
37018
37025
|
searchFields: _.get(this, 'component.searchFields', ['label']),
|
|
37026
|
+
searchResultLimit: _.get(this, 'component.searchResultLimit', this.component.limit || 100),
|
|
37019
37027
|
fuseOptions: this.component.useExactSearch ? Object.assign(fuseObj, commonFuseOptions) : Object.assign({},
|
|
37020
37028
|
_.get(this, 'component.fuseOptions', {}),
|
|
37021
37029
|
Object.assign(fuseObj1, commonFuseOptions)
|
|
@@ -37181,9 +37189,11 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37181
37189
|
}
|
|
37182
37190
|
let that = this;
|
|
37183
37191
|
this.addEventListener(this.choices.input.element, 'input', debounce(function (event) {
|
|
37192
|
+
logger.info(`[TF_SDK:INPUT] ⌨️ Choices input event triggered for '${that.key}'. Search input:`, event.target.value);
|
|
37184
37193
|
that.isFromSearch = !!event.target.value;
|
|
37185
37194
|
if ((that.component.dataSrc === 'masterdata') && that.component.masterdata) {
|
|
37186
37195
|
if (event.target.value.length == 0) {
|
|
37196
|
+
logger.info(`[TF_SDK:INPUT] Search cleared for '${that.key}'`);
|
|
37187
37197
|
that.triggerUpdate();
|
|
37188
37198
|
that.searchDownloadedResources = [];
|
|
37189
37199
|
that.component.totalSearchResults = [];
|
|
@@ -37192,20 +37202,60 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37192
37202
|
|
|
37193
37203
|
} else {
|
|
37194
37204
|
let tempArray = [];
|
|
37195
|
-
var tmplt = that.component.template;
|
|
37196
|
-
var
|
|
37197
|
-
var label =
|
|
37198
|
-
|
|
37205
|
+
var tmplt = that.component.template || '';
|
|
37206
|
+
var lastDot = tmplt.lastIndexOf('.');
|
|
37207
|
+
var label = 'label';
|
|
37208
|
+
if (lastDot !== -1) {
|
|
37209
|
+
var str1 = tmplt.substring(lastDot + 1, tmplt.length);
|
|
37210
|
+
var braceIndex = str1.indexOf('}');
|
|
37211
|
+
if (braceIndex !== -1) {
|
|
37212
|
+
label = str1.substring(0, braceIndex).trim();
|
|
37213
|
+
}
|
|
37214
|
+
}
|
|
37215
|
+
|
|
37216
|
+
logger.info(`[TF_SDK:INPUT] Parsed label key: '${label}', labelProperty: '${that.component.labelProperty}', limit: ${that.component.limit}, uniqueOptions: ${that.component.uniqueOptions}`);
|
|
37217
|
+
|
|
37199
37218
|
tempArray = that.component.masterdata.filter((value) => {
|
|
37200
|
-
|
|
37201
|
-
|
|
37219
|
+
if (!value) return false;
|
|
37220
|
+
let valToSearch = undefined;
|
|
37221
|
+
|
|
37222
|
+
const candidateFields = [];
|
|
37223
|
+
if (that.component.labelProperty) candidateFields.push(that.component.labelProperty);
|
|
37224
|
+
if (label && !candidateFields.includes(label)) candidateFields.push(label);
|
|
37225
|
+
|
|
37226
|
+
// Common fallback fields to check if explicitly configured labelProperty/template fields are missing
|
|
37227
|
+
const commonFields = ['Name', 'label', 'value', 'text', 'title'];
|
|
37228
|
+
for (const f of commonFields) {
|
|
37229
|
+
if (!candidateFields.includes(f)) {
|
|
37230
|
+
candidateFields.push(f);
|
|
37231
|
+
}
|
|
37232
|
+
}
|
|
37233
|
+
|
|
37234
|
+
for (const field of candidateFields) {
|
|
37235
|
+
if (value[field] !== undefined && value[field] !== null) {
|
|
37236
|
+
valToSearch = value[field];
|
|
37237
|
+
break;
|
|
37238
|
+
}
|
|
37239
|
+
}
|
|
37240
|
+
|
|
37241
|
+
if (valToSearch === undefined || valToSearch === null) {
|
|
37242
|
+
return Object.values(value).some(val =>
|
|
37243
|
+
val && String(val).toLowerCase().includes(event.target.value.toLowerCase())
|
|
37244
|
+
);
|
|
37245
|
+
}
|
|
37246
|
+
return String(valToSearch).toLowerCase().includes(event.target.value.toLowerCase());
|
|
37247
|
+
});
|
|
37248
|
+
|
|
37249
|
+
logger.info(`[TF_SDK:INPUT] Found ${tempArray.length} items matching '${event.target.value}' out of ${that.component.masterdata.length}`);
|
|
37202
37250
|
|
|
37203
37251
|
if (tempArray.length > that.component.limit) {
|
|
37252
|
+
logger.info(`[TF_SDK:INPUT] Found items count ${tempArray.length} exceeds limit ${that.component.limit}. Slicing.`);
|
|
37204
37253
|
that.component.totalSearchResults = [];
|
|
37205
37254
|
that.component.totalSearchResults = tempArray;
|
|
37206
37255
|
let searchedData = that.component.totalSearchResults.slice(0, that.component.limit);
|
|
37207
37256
|
that.setItems(searchedData);
|
|
37208
37257
|
} else {
|
|
37258
|
+
logger.info(`[TF_SDK:INPUT] Setting items directly. Count: ${tempArray.length}`);
|
|
37209
37259
|
that.setItems(tempArray);
|
|
37210
37260
|
}
|
|
37211
37261
|
}
|
|
@@ -37335,10 +37385,59 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37335
37385
|
});
|
|
37336
37386
|
|
|
37337
37387
|
this.addEventListener(input, 'search', (event) => {
|
|
37388
|
+
logger.info(`[TF_SDK:SEARCH] 🔍 Choices search event triggered for '${this.key}'. Search input:`, event.detail.value);
|
|
37338
37389
|
if ((this.component.dataSrc === 'masterdata') && this.component.masterdata) {
|
|
37390
|
+
var tmplt = this.component.template || '';
|
|
37391
|
+
var lastDot = tmplt.lastIndexOf('.');
|
|
37392
|
+
var parsedLabel = 'label';
|
|
37393
|
+
if (lastDot !== -1) {
|
|
37394
|
+
var str1 = tmplt.substring(lastDot + 1, tmplt.length);
|
|
37395
|
+
var braceIndex = str1.indexOf('}');
|
|
37396
|
+
if (braceIndex !== -1) {
|
|
37397
|
+
parsedLabel = str1.substring(0, braceIndex).trim();
|
|
37398
|
+
}
|
|
37399
|
+
}
|
|
37400
|
+
const searchFieldClean = this.component.searchField ? this.component.searchField.replace(/__regex$/, '') : '';
|
|
37401
|
+
|
|
37402
|
+
logger.info(`[TF_SDK:SEARCH] Configured searchField: '${this.component.searchField}', clean: '${searchFieldClean}', parsedLabel: '${parsedLabel}', limit: ${this.component.limit}, uniqueOptions: ${this.component.uniqueOptions}`);
|
|
37403
|
+
|
|
37339
37404
|
this.searchDownloadedResources = this.filteredMasterdata.filter(data => {
|
|
37340
|
-
|
|
37341
|
-
|
|
37405
|
+
if (!data) return false;
|
|
37406
|
+
let valToSearch = undefined;
|
|
37407
|
+
|
|
37408
|
+
const candidateFields = [];
|
|
37409
|
+
if (this.component.searchField) candidateFields.push(this.component.searchField);
|
|
37410
|
+
if (searchFieldClean && !candidateFields.includes(searchFieldClean)) candidateFields.push(searchFieldClean);
|
|
37411
|
+
if (this.component.labelProperty && !candidateFields.includes(this.component.labelProperty)) candidateFields.push(this.component.labelProperty);
|
|
37412
|
+
if (parsedLabel && !candidateFields.includes(parsedLabel)) candidateFields.push(parsedLabel);
|
|
37413
|
+
|
|
37414
|
+
// Common fallback fields to check if explicitly configured searchField/labelProperty/template fields are missing
|
|
37415
|
+
const commonFields = ['Name', 'label', 'value', 'text', 'title'];
|
|
37416
|
+
for (const f of commonFields) {
|
|
37417
|
+
if (!candidateFields.includes(f)) {
|
|
37418
|
+
candidateFields.push(f);
|
|
37419
|
+
}
|
|
37420
|
+
}
|
|
37421
|
+
|
|
37422
|
+
for (const field of candidateFields) {
|
|
37423
|
+
if (data[field] !== undefined && data[field] !== null) {
|
|
37424
|
+
valToSearch = data[field];
|
|
37425
|
+
break;
|
|
37426
|
+
}
|
|
37427
|
+
}
|
|
37428
|
+
|
|
37429
|
+
let matches = false;
|
|
37430
|
+
if (valToSearch === undefined || valToSearch === null) {
|
|
37431
|
+
matches = Object.values(data).some(val =>
|
|
37432
|
+
val && String(val).toLowerCase().includes(event.detail.value.toLowerCase())
|
|
37433
|
+
);
|
|
37434
|
+
} else {
|
|
37435
|
+
matches = String(valToSearch).toLowerCase().includes(event.detail.value.toLowerCase());
|
|
37436
|
+
}
|
|
37437
|
+
return matches;
|
|
37438
|
+
});
|
|
37439
|
+
|
|
37440
|
+
logger.info(`[TF_SDK:SEARCH] Found ${this.searchDownloadedResources.length} matching resources out of ${this.filteredMasterdata.length}`);
|
|
37342
37441
|
this.isFromSearch = true;
|
|
37343
37442
|
}
|
|
37344
37443
|
});
|
|
@@ -37529,9 +37628,10 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37529
37628
|
}
|
|
37530
37629
|
|
|
37531
37630
|
if (this.isFromSearch && this.searchDownloadedResources && this.searchDownloadedResources.length > 0) {
|
|
37532
|
-
|
|
37631
|
+
const totalResults = this.component.totalSearchResults || this.searchDownloadedResources || [];
|
|
37632
|
+
initialData = totalResults.slice(this.searchDownloadedResources.length, this.searchDownloadedResources.length + this.component.limit)
|
|
37533
37633
|
dataObj = initialData;
|
|
37534
|
-
dataObj.serverCount =
|
|
37634
|
+
dataObj.serverCount = totalResults.length;
|
|
37535
37635
|
dataObj.skip = this.searchDownloadedResources.length + this.component.limit;
|
|
37536
37636
|
|
|
37537
37637
|
} else {
|
|
@@ -45329,7 +45429,7 @@ initThemeHook();
|
|
|
45329
45429
|
</div>
|
|
45330
45430
|
|
|
45331
45431
|
<div id="sticky-footer">
|
|
45332
|
-
<div class="build-version">SDK v2.0.
|
|
45432
|
+
<div class="build-version">SDK v2.0.77</div>
|
|
45333
45433
|
|
|
45334
45434
|
<button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
|
|
45335
45435
|
<i class="bi bi-chevron-left"></i> Previous
|