@superleapai/flow-ui 2.4.4 → 2.4.6
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/enum-multiselect.js +2 -2
- package/components/enum-select.js +2 -2
- package/components/multiselect.js +3 -3
- package/components/popover.js +41 -15
- package/components/record-multiselect.js +21 -24
- package/components/record-select.js +45 -26
- package/components/select.js +3 -3
- package/core/flow.js +0 -4
- package/dist/output.css +1 -1
- package/dist/superleap-flow.js +681 -383
- package/dist/superleap-flow.js.map +1 -1
- package/dist/superleap-flow.min.js +2 -2
- package/package.json +1 -1
|
@@ -258,7 +258,7 @@
|
|
|
258
258
|
var content = document.createElement("div");
|
|
259
259
|
content.setAttribute("role", "listbox");
|
|
260
260
|
content.setAttribute("aria-multiselectable", "true");
|
|
261
|
-
content.className = "w-full min-w-[200px] max-h-[
|
|
261
|
+
content.className = "w-full min-w-[200px] max-h-[45vh] overflow-hidden flex flex-col";
|
|
262
262
|
|
|
263
263
|
// Search input (using InputComponent like enum-select)
|
|
264
264
|
var searchContainer = document.createElement("div");
|
|
@@ -319,7 +319,7 @@
|
|
|
319
319
|
// Options list
|
|
320
320
|
var optionsList = document.createElement("div");
|
|
321
321
|
optionsList.className =
|
|
322
|
-
"overflow-y-auto max-h-[
|
|
322
|
+
"overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white flex-1 min-h-0";
|
|
323
323
|
|
|
324
324
|
content.appendChild(searchContainer);
|
|
325
325
|
content.appendChild(optionsList);
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
// Create dropdown content
|
|
232
232
|
var content = document.createElement("div");
|
|
233
233
|
content.setAttribute("role", "listbox");
|
|
234
|
-
content.className = "w-full min-w-[200px] max-h-[
|
|
234
|
+
content.className = "w-full min-w-[200px] max-h-[45vh] overflow-hidden flex flex-col";
|
|
235
235
|
|
|
236
236
|
// Search input (using InputComponent like phone-input)
|
|
237
237
|
var searchContainer = document.createElement("div");
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
// Options list
|
|
293
293
|
var optionsList = document.createElement("div");
|
|
294
294
|
optionsList.className =
|
|
295
|
-
"overflow-y-auto max-h-[
|
|
295
|
+
"overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white flex-1 min-h-0";
|
|
296
296
|
|
|
297
297
|
content.appendChild(searchContainer);
|
|
298
298
|
content.appendChild(optionsList);
|
|
@@ -154,11 +154,11 @@
|
|
|
154
154
|
var content = document.createElement("div");
|
|
155
155
|
content.setAttribute("role", "listbox");
|
|
156
156
|
content.setAttribute("aria-multiselectable", "true");
|
|
157
|
-
content.className = "custom-multiselect-content w-full max-h-[
|
|
157
|
+
content.className = "custom-multiselect-content w-full max-h-[45vh] overflow-hidden flex flex-col";
|
|
158
158
|
|
|
159
159
|
var optionsList = document.createElement("div");
|
|
160
160
|
optionsList.className =
|
|
161
|
-
"overflow-y-auto max-h-[
|
|
161
|
+
"overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white";
|
|
162
162
|
|
|
163
163
|
function isSelected(optionValue) {
|
|
164
164
|
return values.some(function (v) {
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
align: "start",
|
|
264
264
|
closeOnClickOutside: true,
|
|
265
265
|
bodyClassName: "p-0 overflow-hidden",
|
|
266
|
-
panelClassName: "min-w-[var(--trigger-width)] max-h-[
|
|
266
|
+
panelClassName: "min-w-[var(--trigger-width)] max-h-[45vh] overflow-hidden",
|
|
267
267
|
onOpen: function () {
|
|
268
268
|
if (disabled) {
|
|
269
269
|
popover.hide();
|
package/components/popover.js
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
return { show: noop, hide: noop, destroy: noop, element: null };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// Wrap trigger in a relative container
|
|
47
|
+
// Wrap trigger in a relative container for layout (full width); popover is portaled to body
|
|
48
48
|
const container = document.createElement("div");
|
|
49
49
|
container.className = "relative w-full";
|
|
50
50
|
const triggerParent = triggerEl.parentNode;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
|
|
56
56
|
const wrapper = document.createElement("div");
|
|
57
57
|
wrapper.className =
|
|
58
|
-
"
|
|
58
|
+
"fixed z-50 pointer-events-none opacity-0 invisible transition-opacity duration-150 ease-out";
|
|
59
59
|
wrapper.setAttribute("aria-hidden", "true");
|
|
60
60
|
|
|
61
61
|
const panel = document.createElement("div");
|
|
@@ -91,9 +91,10 @@
|
|
|
91
91
|
panel.appendChild(body);
|
|
92
92
|
|
|
93
93
|
wrapper.appendChild(panel);
|
|
94
|
-
|
|
94
|
+
document.body.appendChild(wrapper);
|
|
95
95
|
|
|
96
96
|
var backdropEl = null;
|
|
97
|
+
var resizeObserver = null;
|
|
97
98
|
|
|
98
99
|
function onBackdropWheel(e) {
|
|
99
100
|
e.preventDefault();
|
|
@@ -111,7 +112,7 @@
|
|
|
111
112
|
backdropEl.addEventListener("wheel", onBackdropWheel, { passive: false });
|
|
112
113
|
}
|
|
113
114
|
document.body.appendChild(backdropEl);
|
|
114
|
-
|
|
115
|
+
wrapper.style.zIndex = "999";
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
function applyModalClose() {
|
|
@@ -119,7 +120,7 @@
|
|
|
119
120
|
if (backdropEl && backdropEl.parentNode) {
|
|
120
121
|
backdropEl.parentNode.removeChild(backdropEl);
|
|
121
122
|
}
|
|
122
|
-
|
|
123
|
+
wrapper.style.zIndex = "";
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
function noop() {}
|
|
@@ -156,24 +157,24 @@
|
|
|
156
157
|
|
|
157
158
|
switch (effectivePlacement) {
|
|
158
159
|
case "bottom":
|
|
159
|
-
top = triggerRect.
|
|
160
|
-
left = alignLeft;
|
|
160
|
+
top = triggerRect.bottom + gap;
|
|
161
|
+
left = triggerRect.left + alignLeft;
|
|
161
162
|
break;
|
|
162
163
|
case "top":
|
|
163
|
-
top = -panelRect.height - gap;
|
|
164
|
-
left = alignLeft;
|
|
164
|
+
top = triggerRect.top - panelRect.height - gap;
|
|
165
|
+
left = triggerRect.left + alignLeft;
|
|
165
166
|
break;
|
|
166
167
|
case "right":
|
|
167
|
-
top = alignTop;
|
|
168
|
-
left = triggerRect.
|
|
168
|
+
top = triggerRect.top + alignTop;
|
|
169
|
+
left = triggerRect.right + gap;
|
|
169
170
|
break;
|
|
170
171
|
case "left":
|
|
171
|
-
top = alignTop;
|
|
172
|
-
left = -panelRect.width - gap;
|
|
172
|
+
top = triggerRect.top + alignTop;
|
|
173
|
+
left = triggerRect.left - panelRect.width - gap;
|
|
173
174
|
break;
|
|
174
175
|
default:
|
|
175
|
-
top = triggerRect.
|
|
176
|
-
left = alignLeft;
|
|
176
|
+
top = triggerRect.bottom + gap;
|
|
177
|
+
left = triggerRect.left + alignLeft;
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
wrapper.style.transform = "";
|
|
@@ -187,10 +188,20 @@
|
|
|
187
188
|
wrapper.classList.add("invisible", "opacity-0", "pointer-events-none");
|
|
188
189
|
wrapper.classList.remove("visible", "opacity-100", "pointer-events-auto");
|
|
189
190
|
wrapper.setAttribute("aria-hidden", "true");
|
|
191
|
+
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
192
|
+
window.removeEventListener("resize", onScrollOrResize);
|
|
193
|
+
if (resizeObserver && panel) {
|
|
194
|
+
resizeObserver.disconnect();
|
|
195
|
+
resizeObserver = null;
|
|
196
|
+
}
|
|
190
197
|
applyModalClose();
|
|
191
198
|
if (onClose) onClose();
|
|
192
199
|
}
|
|
193
200
|
|
|
201
|
+
function onScrollOrResize() {
|
|
202
|
+
if (wrapper.classList.contains("visible")) position();
|
|
203
|
+
}
|
|
204
|
+
|
|
194
205
|
function show() {
|
|
195
206
|
if (onOpen) onOpen();
|
|
196
207
|
applyModalOpen();
|
|
@@ -199,6 +210,15 @@
|
|
|
199
210
|
wrapper.classList.remove("invisible", "opacity-0", "pointer-events-none");
|
|
200
211
|
wrapper.classList.add("visible", "opacity-100", "pointer-events-auto");
|
|
201
212
|
wrapper.setAttribute("aria-hidden", "false");
|
|
213
|
+
window.addEventListener("scroll", onScrollOrResize, true);
|
|
214
|
+
window.addEventListener("resize", onScrollOrResize);
|
|
215
|
+
// Re-position when panel content size changes (e.g. async record list load in record-select)
|
|
216
|
+
if (typeof ResizeObserver !== "undefined" && !resizeObserver) {
|
|
217
|
+
resizeObserver = new ResizeObserver(function () {
|
|
218
|
+
if (wrapper.classList.contains("visible")) position();
|
|
219
|
+
});
|
|
220
|
+
resizeObserver.observe(panel);
|
|
221
|
+
}
|
|
202
222
|
requestAnimationFrame(function () {
|
|
203
223
|
requestAnimationFrame(function () {
|
|
204
224
|
panel.setAttribute("data-state", "open");
|
|
@@ -210,9 +230,15 @@
|
|
|
210
230
|
function destroy() {
|
|
211
231
|
hide();
|
|
212
232
|
applyModalClose();
|
|
233
|
+
if (resizeObserver && panel) {
|
|
234
|
+
resizeObserver.disconnect();
|
|
235
|
+
resizeObserver = null;
|
|
236
|
+
}
|
|
213
237
|
if (backdropEl && backdropEl.parentNode) {
|
|
214
238
|
backdropEl.parentNode.removeChild(backdropEl);
|
|
215
239
|
}
|
|
240
|
+
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
241
|
+
window.removeEventListener("resize", onScrollOrResize);
|
|
216
242
|
if (wrapper.parentNode) {
|
|
217
243
|
wrapper.parentNode.removeChild(wrapper);
|
|
218
244
|
}
|
|
@@ -152,7 +152,6 @@
|
|
|
152
152
|
* @param {string} [config.size] - 'default' | 'large' | 'small'
|
|
153
153
|
* @param {number} [config.initialLimit] - Initial fetch limit (default 50)
|
|
154
154
|
* @param {Array<string>} [config.displayFields] - Fields to display as secondary info (e.g. ["email", "phone"])
|
|
155
|
-
* @param {Object} [config.initialFilter] - Optional filter object to merge with search (e.g. { field: "status", operator: "exact", value: "active" } or { and: [...] })
|
|
156
155
|
* @param {Object} [config.objectSchema] - Optional object type/schema; properties.icon_data { icon?, color? } used for static icon (not used for user; user shows Vivid Avatar)
|
|
157
156
|
* @returns {HTMLElement} Record multiselect container element
|
|
158
157
|
*/
|
|
@@ -167,7 +166,6 @@
|
|
|
167
166
|
var variant = config.variant || "default";
|
|
168
167
|
var size = config.size || "default";
|
|
169
168
|
var initialLimit = config.initialLimit != null ? config.initialLimit : 50;
|
|
170
|
-
var initialFilter = config.initialFilter || null; // Can be array, object, or function returning either
|
|
171
169
|
var displayFields = config.displayFields || [];
|
|
172
170
|
|
|
173
171
|
var disabled = config.disabled === true;
|
|
@@ -293,7 +291,7 @@
|
|
|
293
291
|
var content = document.createElement("div");
|
|
294
292
|
content.setAttribute("role", "listbox");
|
|
295
293
|
content.setAttribute("aria-multiselectable", "true");
|
|
296
|
-
content.className = "record-multiselect-content max-h-[
|
|
294
|
+
content.className = "record-multiselect-content max-h-[45vh] overflow-hidden flex flex-col";
|
|
297
295
|
|
|
298
296
|
var searchWrap = document.createElement("div");
|
|
299
297
|
searchWrap.className = "p-8 pb-4 border-b-1/2 border-border-primary ";
|
|
@@ -343,7 +341,7 @@
|
|
|
343
341
|
content.appendChild(searchWrap);
|
|
344
342
|
|
|
345
343
|
var optionsList = document.createElement("div");
|
|
346
|
-
optionsList.className = "overflow-y-auto max-h-[
|
|
344
|
+
optionsList.className = "overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white record-multiselect-options";
|
|
347
345
|
|
|
348
346
|
// Add scroll listener for infinite scroll
|
|
349
347
|
optionsList.addEventListener("scroll", function () {
|
|
@@ -371,28 +369,22 @@
|
|
|
371
369
|
align: "start",
|
|
372
370
|
closeOnClickOutside: true,
|
|
373
371
|
bodyClassName: "p-0 overflow-hidden",
|
|
374
|
-
panelClassName: "
|
|
372
|
+
panelClassName: "min-w-[var(--trigger-width)] overflow-hidden",
|
|
375
373
|
onOpen: function () {
|
|
376
374
|
if (disabled) {
|
|
377
375
|
popover.hide();
|
|
378
376
|
return;
|
|
379
377
|
}
|
|
380
|
-
document.querySelectorAll(".custom-select.open, .record-select.open, .custom-multiselect.open, .record-multiselect.open, .enum-select, .enum-multiselect").forEach(function (other) {
|
|
381
|
-
if (other !== container && other.popoverInstance) {
|
|
382
|
-
other.popoverInstance.hide();
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
378
|
container.classList.add("open");
|
|
386
379
|
trigger.setAttribute("aria-expanded", "true");
|
|
387
380
|
searchTerm = "";
|
|
388
381
|
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
389
382
|
else if (searchInputEl) searchInputEl.value = "";
|
|
390
|
-
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
391
|
-
content.style.minWidth = triggerWidthPx;
|
|
392
|
-
content.style.width = triggerWidthPx;
|
|
393
383
|
if (popover.panel) {
|
|
394
|
-
|
|
384
|
+
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
385
|
+
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
395
386
|
popover.panel.style.minWidth = triggerWidthPx;
|
|
387
|
+
popover.panel.style.width = triggerWidthPx;
|
|
396
388
|
}
|
|
397
389
|
loadInitialAndRender();
|
|
398
390
|
setTimeout(function () {
|
|
@@ -471,23 +463,14 @@
|
|
|
471
463
|
try {
|
|
472
464
|
if (model && typeof model.select === "function") {
|
|
473
465
|
var q = model.select.apply(model, fields);
|
|
474
|
-
var filters = [];
|
|
475
|
-
var resolvedFilter = typeof initialFilter === 'function' ? initialFilter() : initialFilter;
|
|
476
|
-
console.log('[RecordMultiselect] initialFilter:', resolvedFilter, '| search:', search);
|
|
477
|
-
if (resolvedFilter) {
|
|
478
|
-
filters = filters.concat(Array.isArray(resolvedFilter) ? resolvedFilter : [resolvedFilter]);
|
|
479
|
-
}
|
|
480
466
|
if (search && search.trim()) {
|
|
481
|
-
|
|
467
|
+
q = q.filterBy({
|
|
482
468
|
or: [
|
|
483
469
|
{ field: "name", operator: "contains", value: search.trim() },
|
|
484
470
|
{ field: "id", operator: "eq", value: search.trim() },
|
|
485
471
|
],
|
|
486
472
|
});
|
|
487
473
|
}
|
|
488
|
-
if (filters.length > 0) {
|
|
489
|
-
q = q.filterBy(filters.length === 1 ? filters[0] : { and: filters });
|
|
490
|
-
}
|
|
491
474
|
var orderBy = ["name"];
|
|
492
475
|
if (objectSlug === "account") orderBy.push("-ParentId");
|
|
493
476
|
return q
|
|
@@ -746,6 +729,16 @@
|
|
|
746
729
|
}
|
|
747
730
|
}
|
|
748
731
|
|
|
732
|
+
function scheduleUpdatePosition() {
|
|
733
|
+
if (popover && typeof popover.updatePosition === "function") {
|
|
734
|
+
requestAnimationFrame(function () {
|
|
735
|
+
requestAnimationFrame(function () {
|
|
736
|
+
popover.updatePosition();
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
749
742
|
function loadInitialAndRender() {
|
|
750
743
|
showLoading();
|
|
751
744
|
currentPage = 1;
|
|
@@ -764,9 +757,11 @@
|
|
|
764
757
|
} else {
|
|
765
758
|
renderOptions();
|
|
766
759
|
}
|
|
760
|
+
scheduleUpdatePosition();
|
|
767
761
|
}).catch(function () {
|
|
768
762
|
showEmpty("Failed to load records");
|
|
769
763
|
hasMoreRecords = false;
|
|
764
|
+
scheduleUpdatePosition();
|
|
770
765
|
});
|
|
771
766
|
}
|
|
772
767
|
|
|
@@ -818,9 +813,11 @@
|
|
|
818
813
|
} else {
|
|
819
814
|
renderOptions();
|
|
820
815
|
}
|
|
816
|
+
scheduleUpdatePosition();
|
|
821
817
|
}).catch(function () {
|
|
822
818
|
showEmpty("Search failed");
|
|
823
819
|
hasMoreRecords = false;
|
|
820
|
+
scheduleUpdatePosition();
|
|
824
821
|
});
|
|
825
822
|
}, 500);
|
|
826
823
|
}
|
|
@@ -10,9 +10,17 @@
|
|
|
10
10
|
(function (global) {
|
|
11
11
|
"use strict";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
function getDep(name) {
|
|
14
|
+
if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
|
|
15
|
+
var c = global.FlowUI._getComponent(name);
|
|
16
|
+
if (c) return c;
|
|
17
|
+
}
|
|
18
|
+
return global[name];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var Popover = getDep("Popover");
|
|
22
|
+
var InputComponent = getDep("InputComponent");
|
|
23
|
+
var Spinner = getDep("Spinner");
|
|
16
24
|
|
|
17
25
|
/** When objectSlug === USERS, show Vivid Avatar (name-based color) instead of static icon */
|
|
18
26
|
var STANDARD_OBJECT_SLUGS_USERS = "user";
|
|
@@ -145,7 +153,6 @@
|
|
|
145
153
|
* @param {string} [config.size] - 'default' | 'large' | 'small'
|
|
146
154
|
* @param {boolean} [config.canClear] - Show clear button when value is set
|
|
147
155
|
* @param {number} [config.initialLimit] - Initial fetch limit (default 50)
|
|
148
|
-
* @param {Object} [config.initialFilter] - Optional filter object to merge with search (e.g. { field: "status", operator: "exact", value: "active" } or { and: [...] })
|
|
149
156
|
* @param {Object} [config.objectSchema] - Optional object type/schema; properties.icon_data { svg?, color? } used for static icon (not used for user; user shows Vivid Avatar)
|
|
150
157
|
* @returns {HTMLElement} Record select container element
|
|
151
158
|
*/
|
|
@@ -160,7 +167,6 @@
|
|
|
160
167
|
var size = config.size || "default";
|
|
161
168
|
var canClear = !!config.canClear;
|
|
162
169
|
var initialLimit = config.initialLimit != null ? config.initialLimit : 50;
|
|
163
|
-
var initialFilter = config.initialFilter || null; // Can be array, object, or function returning either
|
|
164
170
|
|
|
165
171
|
var disabled = config.disabled === true;
|
|
166
172
|
var value =
|
|
@@ -260,7 +266,8 @@
|
|
|
260
266
|
// Dropdown content: search + list (same content pattern as Select)
|
|
261
267
|
var content = document.createElement("div");
|
|
262
268
|
content.setAttribute("role", "listbox");
|
|
263
|
-
content.
|
|
269
|
+
content.setAttribute("data-field-id", fieldId);
|
|
270
|
+
content.className = "record-select-content max-h-[45vh] overflow-hidden flex flex-col";
|
|
264
271
|
|
|
265
272
|
var searchWrap = document.createElement("div");
|
|
266
273
|
searchWrap.className = "py-8 border-b-1/2 border-border-primary";
|
|
@@ -310,7 +317,7 @@
|
|
|
310
317
|
content.appendChild(searchWrap);
|
|
311
318
|
|
|
312
319
|
var optionsList = document.createElement("div");
|
|
313
|
-
optionsList.className = "overflow-y-auto max-h-[
|
|
320
|
+
optionsList.className = "overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white record-select-options";
|
|
314
321
|
|
|
315
322
|
// Add scroll listener for infinite scroll
|
|
316
323
|
optionsList.addEventListener("scroll", function () {
|
|
@@ -334,30 +341,37 @@
|
|
|
334
341
|
align: "start",
|
|
335
342
|
closeOnClickOutside: true,
|
|
336
343
|
bodyClassName: "p-0 overflow-hidden",
|
|
337
|
-
panelClassName: "
|
|
344
|
+
panelClassName: "min-w-[var(--trigger-width)] overflow-hidden",
|
|
338
345
|
onOpen: function () {
|
|
339
346
|
if (disabled) {
|
|
340
347
|
popover.hide();
|
|
341
348
|
return;
|
|
342
349
|
}
|
|
343
|
-
document.querySelectorAll(".custom-select.open, .record-select.open").forEach(function (other) {
|
|
344
|
-
if (other !== container) {
|
|
345
|
-
other.classList.remove("open");
|
|
346
|
-
var t = other.querySelector("button, .custom-select-trigger, .record-select-trigger");
|
|
347
|
-
if (t) t.setAttribute("aria-expanded", "false");
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
350
|
isOpen = true;
|
|
351
351
|
container.classList.add("open");
|
|
352
352
|
trigger.setAttribute("aria-expanded", "true");
|
|
353
353
|
searchTerm = "";
|
|
354
354
|
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
355
355
|
else if (searchInputEl) searchInputEl.value = "";
|
|
356
|
-
|
|
356
|
+
if (popover.panel) {
|
|
357
|
+
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
358
|
+
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
359
|
+
popover.panel.style.minWidth = triggerWidthPx;
|
|
360
|
+
popover.panel.style.width = triggerWidthPx;
|
|
361
|
+
}
|
|
357
362
|
loadInitialAndRender();
|
|
358
363
|
setTimeout(function () {
|
|
359
364
|
if (searchInputEl) searchInputEl.focus();
|
|
360
365
|
}, 0);
|
|
366
|
+
// Let consumers (e.g. BANT Questions "Add Contact") inject content into the dropdown
|
|
367
|
+
try {
|
|
368
|
+
var doc = global.document || (typeof document !== "undefined" ? document : null);
|
|
369
|
+
if (doc && typeof global.CustomEvent !== "undefined") {
|
|
370
|
+
doc.dispatchEvent(new global.CustomEvent("record-select:opened", {
|
|
371
|
+
detail: { fieldId: fieldId, content: content },
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
374
|
+
} catch (e) {}
|
|
361
375
|
},
|
|
362
376
|
onClose: function () {
|
|
363
377
|
isOpen = false;
|
|
@@ -486,23 +500,14 @@
|
|
|
486
500
|
try {
|
|
487
501
|
if (model && typeof model.select === "function") {
|
|
488
502
|
var q = model.select.apply(model, fields);
|
|
489
|
-
var filters = [];
|
|
490
|
-
var resolvedFilter = typeof initialFilter === 'function' ? initialFilter() : initialFilter;
|
|
491
|
-
console.log('[RecordSelect] initialFilter:', resolvedFilter, '| search:', search);
|
|
492
|
-
if (resolvedFilter) {
|
|
493
|
-
filters = filters.concat(Array.isArray(resolvedFilter) ? resolvedFilter : [resolvedFilter]);
|
|
494
|
-
}
|
|
495
503
|
if (search && search.trim()) {
|
|
496
|
-
|
|
504
|
+
q = q.filterBy({
|
|
497
505
|
or: [
|
|
498
506
|
{ field: "name", operator: "contains", value: search.trim() },
|
|
499
507
|
{ field: "id", operator: "eq", value: search.trim() },
|
|
500
508
|
],
|
|
501
509
|
});
|
|
502
510
|
}
|
|
503
|
-
if (filters.length > 0) {
|
|
504
|
-
q = q.filterBy(filters.length === 1 ? filters[0] : { and: filters });
|
|
505
|
-
}
|
|
506
511
|
var orderBy = ["name"];
|
|
507
512
|
if (objectSlug === "account") orderBy.push("-ParentId");
|
|
508
513
|
return q
|
|
@@ -709,6 +714,16 @@
|
|
|
709
714
|
}
|
|
710
715
|
}
|
|
711
716
|
|
|
717
|
+
function scheduleUpdatePosition() {
|
|
718
|
+
if (popover && typeof popover.updatePosition === "function") {
|
|
719
|
+
requestAnimationFrame(function () {
|
|
720
|
+
requestAnimationFrame(function () {
|
|
721
|
+
popover.updatePosition();
|
|
722
|
+
});
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
712
727
|
function loadInitialAndRender() {
|
|
713
728
|
showLoading();
|
|
714
729
|
currentPage = 1;
|
|
@@ -734,9 +749,11 @@
|
|
|
734
749
|
} else {
|
|
735
750
|
renderOptions();
|
|
736
751
|
}
|
|
752
|
+
scheduleUpdatePosition();
|
|
737
753
|
}).catch(function () {
|
|
738
754
|
showEmpty("Failed to load records");
|
|
739
755
|
hasMoreRecords = false;
|
|
756
|
+
scheduleUpdatePosition();
|
|
740
757
|
});
|
|
741
758
|
}
|
|
742
759
|
|
|
@@ -788,9 +805,11 @@
|
|
|
788
805
|
} else {
|
|
789
806
|
renderOptions();
|
|
790
807
|
}
|
|
808
|
+
scheduleUpdatePosition();
|
|
791
809
|
}).catch(function () {
|
|
792
810
|
showEmpty("Search failed");
|
|
793
811
|
hasMoreRecords = false;
|
|
812
|
+
scheduleUpdatePosition();
|
|
794
813
|
});
|
|
795
814
|
}, 500);
|
|
796
815
|
}
|
package/components/select.js
CHANGED
|
@@ -193,11 +193,11 @@
|
|
|
193
193
|
|
|
194
194
|
var content = document.createElement("div");
|
|
195
195
|
content.setAttribute("role", "listbox");
|
|
196
|
-
content.className = "custom-select-content w-full max-h-[
|
|
196
|
+
content.className = "custom-select-content w-full max-h-[45vh] overflow-hidden flex flex-col";
|
|
197
197
|
|
|
198
198
|
var optionsList = document.createElement("div");
|
|
199
199
|
optionsList.className =
|
|
200
|
-
"overflow-y-auto max-h-[
|
|
200
|
+
"overflow-y-auto max-h-[45vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white";
|
|
201
201
|
|
|
202
202
|
if (options.length === 0) {
|
|
203
203
|
var noOpt = document.createElement("div");
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
align: "start",
|
|
257
257
|
closeOnClickOutside: true,
|
|
258
258
|
bodyClassName: "p-0 overflow-hidden",
|
|
259
|
-
panelClassName: "min-w-[var(--trigger-width)] max-h-[
|
|
259
|
+
panelClassName: "min-w-[var(--trigger-width)] max-h-[45vh] overflow-hidden",
|
|
260
260
|
onOpen: function () {
|
|
261
261
|
if (disabled) {
|
|
262
262
|
popover.hide();
|
package/core/flow.js
CHANGED
|
@@ -700,7 +700,6 @@
|
|
|
700
700
|
size,
|
|
701
701
|
canClear,
|
|
702
702
|
initialLimit,
|
|
703
|
-
initialFilter,
|
|
704
703
|
helpText = null,
|
|
705
704
|
} = config;
|
|
706
705
|
|
|
@@ -720,7 +719,6 @@
|
|
|
720
719
|
size: size || "default",
|
|
721
720
|
canClear: !!canClear,
|
|
722
721
|
initialLimit,
|
|
723
|
-
initialFilter,
|
|
724
722
|
onChange: (value, record) => {
|
|
725
723
|
set(fieldId, value);
|
|
726
724
|
if (onChange) onChange(value, record);
|
|
@@ -770,7 +768,6 @@
|
|
|
770
768
|
variant,
|
|
771
769
|
size,
|
|
772
770
|
initialLimit,
|
|
773
|
-
initialFilter,
|
|
774
771
|
displayFields,
|
|
775
772
|
helpText = null,
|
|
776
773
|
} = config;
|
|
@@ -789,7 +786,6 @@
|
|
|
789
786
|
variant: variant || "default",
|
|
790
787
|
size: size || "default",
|
|
791
788
|
initialLimit,
|
|
792
|
-
initialFilter,
|
|
793
789
|
displayFields: displayFields || [],
|
|
794
790
|
onValuesChange: (values, records) => {
|
|
795
791
|
set(fieldId, values);
|