@superleapai/flow-ui 2.5.9 → 2.5.11
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/components/record-multiselect.js +31 -16
- package/components/record-select.js +27 -14
- package/core/flow.js +16 -34
- package/dist/superleap-flow.min.js +2 -2
- package/package.json +1 -1
|
@@ -346,20 +346,20 @@
|
|
|
346
346
|
|
|
347
347
|
var optionsList = document.createElement("div");
|
|
348
348
|
optionsList.className = "overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white record-multiselect-options";
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
349
|
+
|
|
350
|
+
var loadMoreSentinel = null;
|
|
351
|
+
var loadMoreObserver =
|
|
352
|
+
typeof IntersectionObserver !== "undefined"
|
|
353
|
+
? new IntersectionObserver(
|
|
354
|
+
function (entries) {
|
|
355
|
+
if (!entries.length || !entries[0].isIntersecting) return;
|
|
356
|
+
if (isFetchingMore || !hasMoreRecords) return;
|
|
357
|
+
loadMoreRecords();
|
|
358
|
+
},
|
|
359
|
+
{ root: optionsList, rootMargin: "50px", threshold: 0 },
|
|
360
|
+
)
|
|
361
|
+
: null;
|
|
362
|
+
|
|
363
363
|
content.appendChild(optionsList);
|
|
364
364
|
|
|
365
365
|
var Popover = getDep("Popover");
|
|
@@ -619,11 +619,17 @@
|
|
|
619
619
|
opt.remove();
|
|
620
620
|
});
|
|
621
621
|
|
|
622
|
-
|
|
622
|
+
if (loadMoreSentinel && loadMoreObserver) {
|
|
623
|
+
loadMoreObserver.unobserve(loadMoreSentinel);
|
|
624
|
+
loadMoreSentinel = null;
|
|
625
|
+
}
|
|
626
|
+
var oldStates = optionsList.querySelectorAll(
|
|
627
|
+
".record-multiselect-loading, .record-multiselect-empty, .record-multiselect-sentinel",
|
|
628
|
+
);
|
|
623
629
|
oldStates.forEach(function (el) {
|
|
624
630
|
el.remove();
|
|
625
631
|
});
|
|
626
|
-
|
|
632
|
+
|
|
627
633
|
filteredRecords.forEach(function (rec) {
|
|
628
634
|
var recordId = rec.id || rec.value;
|
|
629
635
|
var recordLabel = rec.name || rec.label || rec.value;
|
|
@@ -738,6 +744,15 @@
|
|
|
738
744
|
|
|
739
745
|
if (isFetchingMore) {
|
|
740
746
|
showLoadingMore();
|
|
747
|
+
} else if (hasMoreRecords && filteredRecords.length > 0 && loadMoreObserver) {
|
|
748
|
+
// Sentinel: when visible (short list or user scrolled to bottom), load more automatically
|
|
749
|
+
var sentinel = document.createElement("div");
|
|
750
|
+
sentinel.className = "record-multiselect-sentinel";
|
|
751
|
+
sentinel.setAttribute("aria-hidden", "true");
|
|
752
|
+
sentinel.style.cssText = "height:1px;visibility:hidden;pointer-events:none;";
|
|
753
|
+
optionsList.appendChild(sentinel);
|
|
754
|
+
loadMoreSentinel = sentinel;
|
|
755
|
+
loadMoreObserver.observe(sentinel);
|
|
741
756
|
}
|
|
742
757
|
}
|
|
743
758
|
|
|
@@ -345,18 +345,18 @@
|
|
|
345
345
|
optionsList.className =
|
|
346
346
|
"overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white record-select-options";
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
348
|
+
var loadMoreSentinel = null;
|
|
349
|
+
var loadMoreObserver =
|
|
350
|
+
typeof IntersectionObserver !== "undefined"
|
|
351
|
+
? new IntersectionObserver(
|
|
352
|
+
function (entries) {
|
|
353
|
+
if (!entries.length || !entries[0].isIntersecting) return;
|
|
354
|
+
if (isFetchingMore || !hasMoreRecords) return;
|
|
355
|
+
loadMoreRecords();
|
|
356
|
+
},
|
|
357
|
+
{ root: optionsList, rootMargin: "50px", threshold: 0 },
|
|
358
|
+
)
|
|
359
|
+
: null;
|
|
360
360
|
|
|
361
361
|
content.appendChild(optionsList);
|
|
362
362
|
|
|
@@ -694,9 +694,13 @@
|
|
|
694
694
|
opt.remove();
|
|
695
695
|
});
|
|
696
696
|
|
|
697
|
-
// Remove old loading/empty states
|
|
697
|
+
// Remove old loading/empty states and sentinel (unobserve first)
|
|
698
|
+
if (loadMoreSentinel && loadMoreObserver) {
|
|
699
|
+
loadMoreObserver.unobserve(loadMoreSentinel);
|
|
700
|
+
loadMoreSentinel = null;
|
|
701
|
+
}
|
|
698
702
|
var oldStates = optionsList.querySelectorAll(
|
|
699
|
-
".record-select-loading, .record-select-empty",
|
|
703
|
+
".record-select-loading, .record-select-empty, .record-select-sentinel",
|
|
700
704
|
);
|
|
701
705
|
oldStates.forEach(function (el) {
|
|
702
706
|
el.remove();
|
|
@@ -778,6 +782,15 @@
|
|
|
778
782
|
// Add loading more indicator at the bottom if fetching
|
|
779
783
|
if (isFetchingMore) {
|
|
780
784
|
showLoadingMore();
|
|
785
|
+
} else if (hasMoreRecords && filteredRecords.length > 0 && loadMoreObserver) {
|
|
786
|
+
// Sentinel: when visible (short list or user scrolled to bottom), load more automatically
|
|
787
|
+
var sentinel = document.createElement("div");
|
|
788
|
+
sentinel.className = "record-select-sentinel";
|
|
789
|
+
sentinel.setAttribute("aria-hidden", "true");
|
|
790
|
+
sentinel.style.cssText = "height:1px;visibility:hidden;pointer-events:none;";
|
|
791
|
+
optionsList.appendChild(sentinel);
|
|
792
|
+
loadMoreSentinel = sentinel;
|
|
793
|
+
loadMoreObserver.observe(sentinel);
|
|
781
794
|
}
|
|
782
795
|
}
|
|
783
796
|
|
package/core/flow.js
CHANGED
|
@@ -123,42 +123,24 @@
|
|
|
123
123
|
const field = document.createElement("div");
|
|
124
124
|
field.className = "field";
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
labelEl.className = "field-label";
|
|
141
|
-
const labelContentWrapper = document.createElement("span");
|
|
142
|
-
labelContentWrapper.style.display = "inline-flex";
|
|
143
|
-
labelContentWrapper.style.alignItems = "center";
|
|
144
|
-
labelContentWrapper.style.gap = "0.25rem";
|
|
145
|
-
if (required) {
|
|
146
|
-
labelContentWrapper.appendChild(document.createTextNode(label + " "));
|
|
147
|
-
const asterisk = document.createElement("span");
|
|
148
|
-
asterisk.className = "required-asterisk";
|
|
149
|
-
asterisk.textContent = "*";
|
|
150
|
-
labelContentWrapper.appendChild(asterisk);
|
|
151
|
-
} else {
|
|
152
|
-
labelContentWrapper.appendChild(document.createTextNode(label));
|
|
153
|
-
}
|
|
154
|
-
if (helpText && getComponent("Tooltip")) {
|
|
155
|
-
const tooltip = getComponent("Tooltip").create({ content: helpText, label: "?" });
|
|
156
|
-
if (tooltip) labelContentWrapper.appendChild(tooltip);
|
|
126
|
+
const hasLabel = label != null && String(label).trim() !== "";
|
|
127
|
+
let labelEl = null;
|
|
128
|
+
|
|
129
|
+
if (hasLabel) {
|
|
130
|
+
const LabelComponent = getComponent("Label");
|
|
131
|
+
if (LabelComponent && typeof LabelComponent.create === "function") {
|
|
132
|
+
labelEl = LabelComponent.create({
|
|
133
|
+
label: label,
|
|
134
|
+
required: required,
|
|
135
|
+
requiredPosition: "right",
|
|
136
|
+
optional: false,
|
|
137
|
+
size: "default",
|
|
138
|
+
helpText: helpText || undefined,
|
|
139
|
+
});
|
|
157
140
|
}
|
|
158
|
-
labelEl.appendChild(labelContentWrapper);
|
|
159
141
|
}
|
|
160
142
|
|
|
161
|
-
field.appendChild(labelEl);
|
|
143
|
+
if (labelEl) field.appendChild(labelEl);
|
|
162
144
|
return field;
|
|
163
145
|
}
|
|
164
146
|
|
|
@@ -1256,7 +1238,7 @@
|
|
|
1256
1238
|
onChange,
|
|
1257
1239
|
} = config;
|
|
1258
1240
|
|
|
1259
|
-
const field = createFieldWrapper(label
|
|
1241
|
+
const field = createFieldWrapper(label, required, helpText);
|
|
1260
1242
|
field.setAttribute("data-field-id", fieldId);
|
|
1261
1243
|
|
|
1262
1244
|
if (getComponent("CurrencyComponent") && getComponent("CurrencyComponent").create) {
|