lisichatbot 2.2.7 → 2.2.9

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +29 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisichatbot",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "exports": {
package/src/index.js CHANGED
@@ -1213,11 +1213,14 @@ function renderMinMaxInputs(field, customConfig, existingData, hasMatchingNormal
1213
1213
  minInput.setAttribute('inputmode', 'numeric'); // Show numeric keyboard on mobile
1214
1214
  minInput.setAttribute('data-min', customConfig.min !== undefined ? customConfig.min : 0);
1215
1215
  minInput.setAttribute('data-max', customConfig.max !== undefined ? customConfig.max : 100);
1216
- if (customConfig.minPlaceholder !== undefined) minInput.setAttribute('placeholder', customConfig.minPlaceholder);
1217
-
1216
+ if (customConfig.minPlaceholder !== undefined) {
1217
+ const phVal = Number(customConfig.minPlaceholder);
1218
+ minInput.setAttribute('placeholder', !isNaN(phVal) && config.localeString ? phVal.toLocaleString(config.localeString) : customConfig.minPlaceholder);
1219
+ }
1220
+
1218
1221
  if (showMinMax && existingData[0] !== undefined) {
1219
1222
  const numValue = Number(existingData[0]);
1220
- minInput.value = numValue.toLocaleString();
1223
+ minInput.value = config.localeString ? numValue.toLocaleString(config.localeString) : numValue.toLocaleString();
1221
1224
  minInput.setAttribute('data-raw-value', existingData[0]);
1222
1225
  // console.log(` ✅ Pre-filled min: ${existingData[0]} (display: ${numValue.toLocaleString()})`);
1223
1226
  }
@@ -1238,11 +1241,14 @@ function renderMinMaxInputs(field, customConfig, existingData, hasMatchingNormal
1238
1241
  maxInput.setAttribute('inputmode', 'numeric'); // Show numeric keyboard on mobile
1239
1242
  maxInput.setAttribute('data-min', customConfig.min !== undefined ? customConfig.min : 0);
1240
1243
  maxInput.setAttribute('data-max', customConfig.max !== undefined ? customConfig.max : 100);
1241
- if (customConfig.maxPlaceholder !== undefined) maxInput.setAttribute('placeholder', customConfig.maxPlaceholder);
1242
-
1244
+ if (customConfig.maxPlaceholder !== undefined) {
1245
+ const phVal = Number(customConfig.maxPlaceholder);
1246
+ maxInput.setAttribute('placeholder', !isNaN(phVal) && config.localeString ? phVal.toLocaleString(config.localeString) : customConfig.maxPlaceholder);
1247
+ }
1248
+
1243
1249
  if (showMinMax && existingData[1] !== undefined) {
1244
1250
  const numValue = Number(existingData[1]);
1245
- maxInput.value = numValue.toLocaleString();
1251
+ maxInput.value = config.localeString ? numValue.toLocaleString(config.localeString) : numValue.toLocaleString();
1246
1252
  maxInput.setAttribute('data-raw-value', existingData[1]);
1247
1253
  // console.log(` ✅ Pre-filled max: ${existingData[1]} (display: ${numValue.toLocaleString()})`);
1248
1254
  }
@@ -1306,41 +1312,43 @@ function renderMinMaxInputs(field, customConfig, existingData, hasMatchingNormal
1306
1312
  }
1307
1313
 
1308
1314
  minInput.onchange = () => {
1309
- // ✅ Don't auto-select custom option - only select when explicitly clicked
1310
- // Remove non-numeric characters except minus sign at start
1311
1315
  let value = minInput.value.replace(/[^\d-]/g, '');
1312
1316
  if (value.indexOf('-') > 0) {
1313
1317
  value = value.replace(/-/g, '');
1314
1318
  }
1315
1319
  minInput.setAttribute('data-raw-value', value);
1316
-
1317
- // Format with locale string if valid number
1320
+
1318
1321
  if (value && value !== '' && !isNaN(value)) {
1319
1322
  const numValue = Number(value);
1320
- minInput.value = numValue.toLocaleString();
1323
+ minInput.value = config.localeString ? numValue.toLocaleString(config.localeString) : numValue.toLocaleString();
1321
1324
  }
1322
-
1325
+
1323
1326
  updateVisualFeedback();
1324
- // Removed validateMinMax - errors only show on Next button click
1327
+ // Re-validate if error is already shown to clear it when values are corrected
1328
+ const errorDiv = document.querySelector(`[data-chat-element="range-error"][data-field="${field}"]`);
1329
+ if (errorDiv && errorDiv.style.display === 'block') {
1330
+ validateMinMax(field, customConfig, true);
1331
+ }
1325
1332
  };
1326
-
1333
+
1327
1334
  maxInput.onchange = () => {
1328
- // ✅ Don't auto-select custom option - only select when explicitly clicked
1329
- // Remove non-numeric characters except minus sign at start
1330
1335
  let value = maxInput.value.replace(/[^\d-]/g, '');
1331
1336
  if (value.indexOf('-') > 0) {
1332
1337
  value = value.replace(/-/g, '');
1333
1338
  }
1334
1339
  maxInput.setAttribute('data-raw-value', value);
1335
-
1336
- // Format with locale string if valid number
1340
+
1337
1341
  if (value && value !== '' && !isNaN(value)) {
1338
1342
  const numValue = Number(value);
1339
- maxInput.value = numValue.toLocaleString();
1343
+ maxInput.value = config.localeString ? numValue.toLocaleString(config.localeString) : numValue.toLocaleString();
1340
1344
  }
1341
-
1345
+
1342
1346
  updateVisualFeedback();
1343
- // Removed validateMinMax - errors only show on Next button click
1347
+ // Re-validate if error is already shown to clear it when values are corrected
1348
+ const errorDiv = document.querySelector(`[data-chat-element="range-error"][data-field="${field}"]`);
1349
+ if (errorDiv && errorDiv.style.display === 'block') {
1350
+ validateMinMax(field, customConfig, true);
1351
+ }
1344
1352
  };
1345
1353
  }
1346
1354
  }