lisichatbot 2.0.0 → 2.0.2
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 +36 -4
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -213,16 +213,21 @@ function updateEditIcons() {
|
|
|
213
213
|
return;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
// ✅ FIX: In edit mode, keep edit icons visible even after completion
|
|
217
|
+
if (chatState.completed && chatState.chatMode !== 'edit') {
|
|
217
218
|
editIcon.style.setProperty('display', 'none', 'important');
|
|
218
|
-
console.log(` 🏁 Step ${stepNumber}: Icon HIDDEN (flow completed)`);
|
|
219
|
+
console.log(` 🏁 Step ${stepNumber}: Icon HIDDEN (flow completed in create mode)`);
|
|
219
220
|
return;
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
// ✅ NEW: Check if edit icon should be forced to show (even without input)
|
|
223
224
|
const forceShowEdit = stepData && stepData.showEditIcon === true;
|
|
224
225
|
|
|
225
|
-
|
|
226
|
+
// ✅ FIX: In edit mode, show edit icons for all completed steps (not just previous)
|
|
227
|
+
const shouldShowInEditMode = chatState.chatMode === 'edit' && chatState.completed && isLatest;
|
|
228
|
+
const shouldShowNormally = stepNumber < chatState.step && isLatest;
|
|
229
|
+
|
|
230
|
+
if ((hasInput || forceShowEdit) && (shouldShowInEditMode || shouldShowNormally)) {
|
|
226
231
|
editIcon.onclick = (e) => {
|
|
227
232
|
e.stopPropagation();
|
|
228
233
|
e.preventDefault();
|
|
@@ -284,6 +289,7 @@ function renderMultiSelectDropdown(options, field) {
|
|
|
284
289
|
const optionTemplate = clone.querySelector('[data-chat-input-element="dropdown-option-wrapper"]');
|
|
285
290
|
const tagsContainer = clone.querySelector('[data-chat-input-element="tags-container"]');
|
|
286
291
|
const tagTemplate = clone.querySelector('[data-chat-input-element="tag-wrapper"]');
|
|
292
|
+
const dropdownInput = clone.querySelector('[data-chat-input-element="dropdown-input"]'); // ✅ NEW
|
|
287
293
|
|
|
288
294
|
if (!dropdown || !optionsWrapper || !searchBar || !optionsContainer || !optionTemplate || !tagsContainer || !tagTemplate) {
|
|
289
295
|
console.error('Multi-select dropdown: Missing required elements');
|
|
@@ -294,7 +300,8 @@ function renderMultiSelectDropdown(options, field) {
|
|
|
294
300
|
optionsContainer: !!optionsContainer,
|
|
295
301
|
optionTemplate: !!optionTemplate,
|
|
296
302
|
tagsContainer: !!tagsContainer,
|
|
297
|
-
tagTemplate: !!tagTemplate
|
|
303
|
+
tagTemplate: !!tagTemplate,
|
|
304
|
+
dropdownInput: !!dropdownInput // ✅ NEW
|
|
298
305
|
});
|
|
299
306
|
return;
|
|
300
307
|
}
|
|
@@ -317,6 +324,17 @@ function renderMultiSelectDropdown(options, field) {
|
|
|
317
324
|
const existingData = disablePrefill ? [] : (chatState.data[field] || []);
|
|
318
325
|
const selectedValues = new Set(existingData);
|
|
319
326
|
|
|
327
|
+
// ✅ NEW: Set initial dropdown-input visibility based on pre-filled data
|
|
328
|
+
if (dropdownInput) {
|
|
329
|
+
if (existingData.length > 0) {
|
|
330
|
+
dropdownInput.style.display = 'none';
|
|
331
|
+
console.log(` 🙈 Dropdown input hidden initially (${existingData.length} pre-filled selection${existingData.length === 1 ? '' : 's'})`);
|
|
332
|
+
} else {
|
|
333
|
+
dropdownInput.style.display = '';
|
|
334
|
+
console.log(` 👁️ Dropdown input visible initially (no pre-filled selections)`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
320
338
|
if (disablePrefill) {
|
|
321
339
|
console.log(`⏭️ Pre-fill disabled for ${field} - starting fresh`);
|
|
322
340
|
} else {
|
|
@@ -538,11 +556,25 @@ function renderMultiSelectDropdown(options, field) {
|
|
|
538
556
|
enableNextButton();
|
|
539
557
|
}
|
|
540
558
|
}
|
|
559
|
+
|
|
560
|
+
// ✅ NEW: Re-render tags to update dropdown-input visibility
|
|
561
|
+
renderTags(field, options, tagsContainer, tagTemplate, optionsContainer);
|
|
541
562
|
};
|
|
542
563
|
}
|
|
543
564
|
|
|
544
565
|
tagsContainer.appendChild(tagEl);
|
|
545
566
|
});
|
|
567
|
+
|
|
568
|
+
// ✅ NEW: Show/hide dropdown-input based on tag count
|
|
569
|
+
if (dropdownInput) {
|
|
570
|
+
if (selections.length > 0) {
|
|
571
|
+
dropdownInput.style.display = 'none';
|
|
572
|
+
console.log(` 🙈 Dropdown input hidden (${selections.length} tag${selections.length === 1 ? '' : 's'} displayed)`);
|
|
573
|
+
} else {
|
|
574
|
+
dropdownInput.style.display = '';
|
|
575
|
+
console.log(` 👁️ Dropdown input visible (no tags)`);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
546
578
|
}
|
|
547
579
|
|
|
548
580
|
// ✅ Initial tag render if pre-filled (edit mode)
|