@unvired/turboforms-embed-sdk 2.0.76 → 2.0.78
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 +120 -19
- 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
|
}
|
|
@@ -37248,8 +37298,9 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37248
37298
|
let selData;
|
|
37249
37299
|
let dataObj = {}
|
|
37250
37300
|
dataObj.limit = this.component.limit;
|
|
37301
|
+
const masterdataList = this.filteredMasterdata;
|
|
37251
37302
|
if (this.data[this.key] && String(this.data[this.key]).length > 0) {
|
|
37252
|
-
selData =
|
|
37303
|
+
selData = masterdataList.filter((value) => {
|
|
37253
37304
|
const propValue = value[this.component.valueProperty];
|
|
37254
37305
|
// Convert to string only if necessary
|
|
37255
37306
|
const valPropData = typeof propValue !== 'string' ? String(propValue) : propValue;
|
|
@@ -37266,7 +37317,7 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37266
37317
|
}
|
|
37267
37318
|
}
|
|
37268
37319
|
dataObj = this.defaultDownloadedResources;
|
|
37269
|
-
dataObj.serverCount =
|
|
37320
|
+
dataObj.serverCount = masterdataList.length;
|
|
37270
37321
|
dataObj.skip = this.defaultDownloadedResources.length + this.component.limit;
|
|
37271
37322
|
this.setItems(this.defaultDownloadedResources);
|
|
37272
37323
|
}
|
|
@@ -37316,7 +37367,7 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37316
37367
|
if ((this.component.dataSrc === 'masterdata') && this.component.masterdata) {
|
|
37317
37368
|
this.component.dropdownOpened = true;
|
|
37318
37369
|
// Force reloading the full list if we currently only have a partial list (e.g. filtered down on hideDropdown)
|
|
37319
|
-
if (!this.defaultDownloadedResources || this.defaultDownloadedResources.length < this.
|
|
37370
|
+
if (!this.defaultDownloadedResources || this.defaultDownloadedResources.length < this.filteredMasterdata.length) {
|
|
37320
37371
|
this.updateItems(null, true);
|
|
37321
37372
|
}
|
|
37322
37373
|
}
|
|
@@ -37335,10 +37386,59 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37335
37386
|
});
|
|
37336
37387
|
|
|
37337
37388
|
this.addEventListener(input, 'search', (event) => {
|
|
37389
|
+
logger.info(`[TF_SDK:SEARCH] 🔍 Choices search event triggered for '${this.key}'. Search input:`, event.detail.value);
|
|
37338
37390
|
if ((this.component.dataSrc === 'masterdata') && this.component.masterdata) {
|
|
37391
|
+
var tmplt = this.component.template || '';
|
|
37392
|
+
var lastDot = tmplt.lastIndexOf('.');
|
|
37393
|
+
var parsedLabel = 'label';
|
|
37394
|
+
if (lastDot !== -1) {
|
|
37395
|
+
var str1 = tmplt.substring(lastDot + 1, tmplt.length);
|
|
37396
|
+
var braceIndex = str1.indexOf('}');
|
|
37397
|
+
if (braceIndex !== -1) {
|
|
37398
|
+
parsedLabel = str1.substring(0, braceIndex).trim();
|
|
37399
|
+
}
|
|
37400
|
+
}
|
|
37401
|
+
const searchFieldClean = this.component.searchField ? this.component.searchField.replace(/__regex$/, '') : '';
|
|
37402
|
+
|
|
37403
|
+
logger.info(`[TF_SDK:SEARCH] Configured searchField: '${this.component.searchField}', clean: '${searchFieldClean}', parsedLabel: '${parsedLabel}', limit: ${this.component.limit}, uniqueOptions: ${this.component.uniqueOptions}`);
|
|
37404
|
+
|
|
37339
37405
|
this.searchDownloadedResources = this.filteredMasterdata.filter(data => {
|
|
37340
|
-
|
|
37341
|
-
|
|
37406
|
+
if (!data) return false;
|
|
37407
|
+
let valToSearch = undefined;
|
|
37408
|
+
|
|
37409
|
+
const candidateFields = [];
|
|
37410
|
+
if (this.component.searchField) candidateFields.push(this.component.searchField);
|
|
37411
|
+
if (searchFieldClean && !candidateFields.includes(searchFieldClean)) candidateFields.push(searchFieldClean);
|
|
37412
|
+
if (this.component.labelProperty && !candidateFields.includes(this.component.labelProperty)) candidateFields.push(this.component.labelProperty);
|
|
37413
|
+
if (parsedLabel && !candidateFields.includes(parsedLabel)) candidateFields.push(parsedLabel);
|
|
37414
|
+
|
|
37415
|
+
// Common fallback fields to check if explicitly configured searchField/labelProperty/template fields are missing
|
|
37416
|
+
const commonFields = ['Name', 'label', 'value', 'text', 'title'];
|
|
37417
|
+
for (const f of commonFields) {
|
|
37418
|
+
if (!candidateFields.includes(f)) {
|
|
37419
|
+
candidateFields.push(f);
|
|
37420
|
+
}
|
|
37421
|
+
}
|
|
37422
|
+
|
|
37423
|
+
for (const field of candidateFields) {
|
|
37424
|
+
if (data[field] !== undefined && data[field] !== null) {
|
|
37425
|
+
valToSearch = data[field];
|
|
37426
|
+
break;
|
|
37427
|
+
}
|
|
37428
|
+
}
|
|
37429
|
+
|
|
37430
|
+
let matches = false;
|
|
37431
|
+
if (valToSearch === undefined || valToSearch === null) {
|
|
37432
|
+
matches = Object.values(data).some(val =>
|
|
37433
|
+
val && String(val).toLowerCase().includes(event.detail.value.toLowerCase())
|
|
37434
|
+
);
|
|
37435
|
+
} else {
|
|
37436
|
+
matches = String(valToSearch).toLowerCase().includes(event.detail.value.toLowerCase());
|
|
37437
|
+
}
|
|
37438
|
+
return matches;
|
|
37439
|
+
});
|
|
37440
|
+
|
|
37441
|
+
logger.info(`[TF_SDK:SEARCH] Found ${this.searchDownloadedResources.length} matching resources out of ${this.filteredMasterdata.length}`);
|
|
37342
37442
|
this.isFromSearch = true;
|
|
37343
37443
|
}
|
|
37344
37444
|
});
|
|
@@ -37487,11 +37587,11 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37487
37587
|
}
|
|
37488
37588
|
|
|
37489
37589
|
onScroll(ev) {
|
|
37490
|
-
if (
|
|
37590
|
+
if (this.isFromSearch) {
|
|
37591
|
+
return; // Do not trigger scroll loading or reset items while a search is active
|
|
37592
|
+
}
|
|
37593
|
+
if ((this.component.dataSrc === 'masterdata') && this.component.masterdata && (this.defaultDownloadedResources.length < this.filteredMasterdata.length)) {
|
|
37491
37594
|
var element = ev.target;
|
|
37492
|
-
if (this.isFromSearch && this.component.totalSearchResults && this.component.totalSearchResults.length == 0) {
|
|
37493
|
-
return;
|
|
37494
|
-
}
|
|
37495
37595
|
if (browserPlatform) {
|
|
37496
37596
|
if (element.scrollHeight - element.scrollTop === element.clientHeight) {
|
|
37497
37597
|
this.isScrollLoading = true;
|
|
@@ -37529,9 +37629,10 @@ class SmartSelectComponent extends SmartSelectField {
|
|
|
37529
37629
|
}
|
|
37530
37630
|
|
|
37531
37631
|
if (this.isFromSearch && this.searchDownloadedResources && this.searchDownloadedResources.length > 0) {
|
|
37532
|
-
|
|
37632
|
+
const totalResults = this.component.totalSearchResults || this.searchDownloadedResources || [];
|
|
37633
|
+
initialData = totalResults.slice(this.searchDownloadedResources.length, this.searchDownloadedResources.length + this.component.limit)
|
|
37533
37634
|
dataObj = initialData;
|
|
37534
|
-
dataObj.serverCount =
|
|
37635
|
+
dataObj.serverCount = totalResults.length;
|
|
37535
37636
|
dataObj.skip = this.searchDownloadedResources.length + this.component.limit;
|
|
37536
37637
|
|
|
37537
37638
|
} else {
|
|
@@ -45329,7 +45430,7 @@ initThemeHook();
|
|
|
45329
45430
|
</div>
|
|
45330
45431
|
|
|
45331
45432
|
<div id="sticky-footer">
|
|
45332
|
-
<div class="build-version">SDK v2.0.
|
|
45433
|
+
<div class="build-version">SDK v2.0.78</div>
|
|
45333
45434
|
|
|
45334
45435
|
<button class="footer-btn footer-btn-secondary" id="prevBtn" style="display:none" onclick="FormOnPrevious()">
|
|
45335
45436
|
<i class="bi bi-chevron-left"></i> Previous
|