lisichatbot 1.8.6 → 1.8.8
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/package.json +1 -1
- package/src/index.js +62 -28
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -587,6 +587,7 @@ function renderOptions(options, field, isSingleSelect = true) {
|
|
|
587
587
|
const optionsWrapper = document.createElement('div');
|
|
588
588
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
589
589
|
optionsWrapper.style.display = 'flex';
|
|
590
|
+
optionsWrapper.style.flexDirection = 'row';
|
|
590
591
|
optionsWrapper.style.flexWrap = 'wrap';
|
|
591
592
|
optionsWrapper.style.alignItems = 'flex-start';
|
|
592
593
|
optionsWrapper.style.gap = '8px';
|
|
@@ -726,6 +727,7 @@ function renderColorOptions(options, field) {
|
|
|
726
727
|
const optionsWrapper = document.createElement('div');
|
|
727
728
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
728
729
|
optionsWrapper.style.display = 'flex';
|
|
730
|
+
optionsWrapper.style.flexDirection = 'row';
|
|
729
731
|
optionsWrapper.style.flexWrap = 'wrap';
|
|
730
732
|
optionsWrapper.style.alignItems = 'flex-start';
|
|
731
733
|
optionsWrapper.style.gap = '8px';
|
|
@@ -862,6 +864,7 @@ function renderCustomSelectOptions(options, field, customConfig) {
|
|
|
862
864
|
const optionsWrapper = document.createElement('div');
|
|
863
865
|
optionsWrapper.setAttribute('data-chat-element', 'options-wrapper');
|
|
864
866
|
optionsWrapper.style.display = 'flex';
|
|
867
|
+
optionsWrapper.style.flexDirection = 'row';
|
|
865
868
|
optionsWrapper.style.flexWrap = 'wrap';
|
|
866
869
|
optionsWrapper.style.alignItems = 'flex-start';
|
|
867
870
|
optionsWrapper.style.gap = '8px';
|
|
@@ -1072,13 +1075,16 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1072
1075
|
if (minInput) {
|
|
1073
1076
|
minInput.setAttribute('data-field', field);
|
|
1074
1077
|
minInput.setAttribute('data-input-type', 'min');
|
|
1075
|
-
minInput.type = 'number'
|
|
1076
|
-
minInput.
|
|
1077
|
-
minInput.
|
|
1078
|
-
minInput.
|
|
1078
|
+
minInput.type = 'text'; // Changed from 'number' to 'text' for locale formatting
|
|
1079
|
+
minInput.setAttribute('inputmode', 'numeric'); // Show numeric keyboard on mobile
|
|
1080
|
+
minInput.setAttribute('data-min', customConfig.min !== undefined ? customConfig.min : 0);
|
|
1081
|
+
minInput.setAttribute('data-max', customConfig.max !== undefined ? customConfig.max : 100);
|
|
1079
1082
|
|
|
1080
|
-
if (showMinMax) {
|
|
1081
|
-
|
|
1083
|
+
if (showMinMax && existingData[0] !== undefined) {
|
|
1084
|
+
const numValue = Number(existingData[0]);
|
|
1085
|
+
minInput.value = numValue.toLocaleString();
|
|
1086
|
+
minInput.setAttribute('data-raw-value', existingData[0]);
|
|
1087
|
+
console.log(` ✅ Pre-filled min: ${existingData[0]} (display: ${numValue.toLocaleString()})`);
|
|
1082
1088
|
}
|
|
1083
1089
|
}
|
|
1084
1090
|
|
|
@@ -1093,13 +1099,16 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1093
1099
|
if (maxInput) {
|
|
1094
1100
|
maxInput.setAttribute('data-field', field);
|
|
1095
1101
|
maxInput.setAttribute('data-input-type', 'max');
|
|
1096
|
-
maxInput.type = 'number'
|
|
1097
|
-
maxInput.
|
|
1098
|
-
maxInput.
|
|
1099
|
-
maxInput.
|
|
1102
|
+
maxInput.type = 'text'; // Changed from 'number' to 'text' for locale formatting
|
|
1103
|
+
maxInput.setAttribute('inputmode', 'numeric'); // Show numeric keyboard on mobile
|
|
1104
|
+
maxInput.setAttribute('data-min', customConfig.min !== undefined ? customConfig.min : 0);
|
|
1105
|
+
maxInput.setAttribute('data-max', customConfig.max !== undefined ? customConfig.max : 100);
|
|
1100
1106
|
|
|
1101
|
-
if (showMinMax) {
|
|
1102
|
-
|
|
1107
|
+
if (showMinMax && existingData[1] !== undefined) {
|
|
1108
|
+
const numValue = Number(existingData[1]);
|
|
1109
|
+
maxInput.value = numValue.toLocaleString();
|
|
1110
|
+
maxInput.setAttribute('data-raw-value', existingData[1]);
|
|
1111
|
+
console.log(` ✅ Pre-filled max: ${existingData[1]} (display: ${numValue.toLocaleString()})`);
|
|
1103
1112
|
}
|
|
1104
1113
|
}
|
|
1105
1114
|
|
|
@@ -1134,8 +1143,8 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1134
1143
|
|
|
1135
1144
|
if (minInput && maxInput) {
|
|
1136
1145
|
const updateVisualFeedback = () => {
|
|
1137
|
-
const minFilled = minInput.value.trim() !== '';
|
|
1138
|
-
const maxFilled = maxInput.value.trim() !== '';
|
|
1146
|
+
const minFilled = (minInput.getAttribute('data-raw-value') || minInput.value.trim()) !== '';
|
|
1147
|
+
const maxFilled = (maxInput.getAttribute('data-raw-value') || maxInput.value.trim()) !== '';
|
|
1139
1148
|
const anyFilled = minFilled || maxFilled;
|
|
1140
1149
|
|
|
1141
1150
|
const minTick = minClone.querySelector('[data-chat-input-element="tick-icon"]');
|
|
@@ -1160,20 +1169,40 @@ function renderMinMaxInputs(field, customConfig, existingData) {
|
|
|
1160
1169
|
console.log(' ✅ Applied visual feedback for pre-filled values');
|
|
1161
1170
|
}
|
|
1162
1171
|
|
|
1163
|
-
minInput.
|
|
1172
|
+
minInput.onchange = () => {
|
|
1164
1173
|
selectCustomOption(field);
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1174
|
+
// Remove non-numeric characters except minus sign at start
|
|
1175
|
+
let value = minInput.value.replace(/[^\d-]/g, '');
|
|
1176
|
+
if (value.indexOf('-') > 0) {
|
|
1177
|
+
value = value.replace(/-/g, '');
|
|
1178
|
+
}
|
|
1179
|
+
minInput.setAttribute('data-raw-value', value);
|
|
1180
|
+
|
|
1181
|
+
// Format with locale string if valid number
|
|
1182
|
+
if (value && value !== '' && !isNaN(value)) {
|
|
1183
|
+
const numValue = Number(value);
|
|
1184
|
+
minInput.value = numValue.toLocaleString();
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1168
1187
|
updateVisualFeedback();
|
|
1169
1188
|
validateMinMax(field, customConfig);
|
|
1170
1189
|
};
|
|
1171
1190
|
|
|
1172
|
-
maxInput.
|
|
1191
|
+
maxInput.onchange = () => {
|
|
1173
1192
|
selectCustomOption(field);
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1193
|
+
// Remove non-numeric characters except minus sign at start
|
|
1194
|
+
let value = maxInput.value.replace(/[^\d-]/g, '');
|
|
1195
|
+
if (value.indexOf('-') > 0) {
|
|
1196
|
+
value = value.replace(/-/g, '');
|
|
1197
|
+
}
|
|
1198
|
+
maxInput.setAttribute('data-raw-value', value);
|
|
1199
|
+
|
|
1200
|
+
// Format with locale string if valid number
|
|
1201
|
+
if (value && value !== '' && !isNaN(value)) {
|
|
1202
|
+
const numValue = Number(value);
|
|
1203
|
+
maxInput.value = numValue.toLocaleString();
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1177
1206
|
updateVisualFeedback();
|
|
1178
1207
|
validateMinMax(field, customConfig);
|
|
1179
1208
|
};
|
|
@@ -1325,10 +1354,12 @@ function handleCustomSelectClick(element, field, customConfig) {
|
|
|
1325
1354
|
|
|
1326
1355
|
if (minInput) {
|
|
1327
1356
|
minInput.value = '';
|
|
1357
|
+
minInput.removeAttribute('data-raw-value');
|
|
1328
1358
|
console.log(' 🧹 Cleared min input');
|
|
1329
1359
|
}
|
|
1330
1360
|
if (maxInput) {
|
|
1331
1361
|
maxInput.value = '';
|
|
1362
|
+
maxInput.removeAttribute('data-raw-value');
|
|
1332
1363
|
console.log(' 🧹 Cleared max input');
|
|
1333
1364
|
}
|
|
1334
1365
|
|
|
@@ -1398,17 +1429,20 @@ function validateMinMax(field, customConfig) {
|
|
|
1398
1429
|
return { valid: false, error: null };
|
|
1399
1430
|
}
|
|
1400
1431
|
|
|
1401
|
-
|
|
1402
|
-
const
|
|
1403
|
-
const
|
|
1404
|
-
const
|
|
1432
|
+
// Use data-raw-value for validation instead of formatted display value
|
|
1433
|
+
const minRawValue = minInput.getAttribute('data-raw-value') || '';
|
|
1434
|
+
const maxRawValue = maxInput.getAttribute('data-raw-value') || '';
|
|
1435
|
+
const minValue = parseFloat(minRawValue);
|
|
1436
|
+
const maxValue = parseFloat(maxRawValue);
|
|
1437
|
+
const minFilled = minRawValue.trim() !== '';
|
|
1438
|
+
const maxFilled = maxRawValue.trim() !== '';
|
|
1405
1439
|
|
|
1406
1440
|
const minConstraint = customConfig.min !== undefined ? customConfig.min : 0;
|
|
1407
1441
|
const maxConstraint = customConfig.max !== undefined ? customConfig.max : 100;
|
|
1408
1442
|
|
|
1409
1443
|
console.log(`📊 Input values:
|
|
1410
|
-
Min
|
|
1411
|
-
Max
|
|
1444
|
+
Min raw value: "${minRawValue}" (filled: ${minFilled}, parsed: ${minValue})
|
|
1445
|
+
Max raw value: "${maxRawValue}" (filled: ${maxFilled}, parsed: ${maxValue})`);
|
|
1412
1446
|
|
|
1413
1447
|
console.log(`📏 Constraints:
|
|
1414
1448
|
Min constraint: >= ${minConstraint}
|