@superleapai/flow-ui 2.4.3 → 2.4.5
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 +33 -17
- package/components/record-multiselect.js +21 -24
- package/components/record-select.js +24 -23
- package/components/select.js +3 -3
- 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
package/dist/superleap-flow.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @superleapai/flow-ui v2.
|
|
2
|
+
* @superleapai/flow-ui v2.2.9
|
|
3
3
|
* A reusable design system for building multi-step forms
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-present SuperLeap
|
|
6
6
|
* Licensed under MIT
|
|
7
7
|
*
|
|
8
8
|
* Build: development
|
|
9
|
-
* Date: 2026-02-
|
|
9
|
+
* Date: 2026-02-16T06:02:03.445Z
|
|
10
10
|
*
|
|
11
11
|
* For documentation and examples, visit:
|
|
12
12
|
* https://github.com/superleap/superleap-flow
|
|
@@ -3567,13 +3567,12 @@
|
|
|
3567
3567
|
|
|
3568
3568
|
/**
|
|
3569
3569
|
* Tell the CRM to navigate to a path.
|
|
3570
|
-
* @param {string}
|
|
3571
|
-
* @param {boolean} [newTab=false]
|
|
3570
|
+
* @param {string} path
|
|
3572
3571
|
*/
|
|
3573
|
-
function navigate(
|
|
3572
|
+
function navigate(path) {
|
|
3574
3573
|
var bridge = getBridge();
|
|
3575
3574
|
if (bridge && bridge.isConnected()) {
|
|
3576
|
-
bridge.send("crm:navigate", {
|
|
3575
|
+
bridge.send("crm:navigate", { path: path });
|
|
3577
3576
|
}
|
|
3578
3577
|
}
|
|
3579
3578
|
|
|
@@ -5122,6 +5121,42 @@
|
|
|
5122
5121
|
});
|
|
5123
5122
|
}
|
|
5124
5123
|
|
|
5124
|
+
// ============================================================================
|
|
5125
|
+
// ALERT COMPONENT
|
|
5126
|
+
// ============================================================================
|
|
5127
|
+
|
|
5128
|
+
/**
|
|
5129
|
+
* Render alerts/errors
|
|
5130
|
+
* Uses Alert component when available for design-system styling.
|
|
5131
|
+
* @param {HTMLElement} container - Container element for alerts
|
|
5132
|
+
* @param {Array} messages - Array of error/info messages (strings) or { title?, description } objects
|
|
5133
|
+
* @param {string} type - Alert type: "error" | "info" | "success" | "warning" | "destructive" | "default"
|
|
5134
|
+
*/
|
|
5135
|
+
function renderAlerts(container, messages = [], type = "error") {
|
|
5136
|
+
if (!container) {return;}
|
|
5137
|
+
container.innerHTML = "";
|
|
5138
|
+
|
|
5139
|
+
const Alert = getComponent("Alert");
|
|
5140
|
+
const useAlertComponent = Alert && typeof Alert.create === "function";
|
|
5141
|
+
|
|
5142
|
+
messages.forEach((msg) => {
|
|
5143
|
+
const description = typeof msg === "string" ? msg : (msg.description || msg.title || "");
|
|
5144
|
+
const title = typeof msg === "object" && msg.title ? msg.title : "";
|
|
5145
|
+
|
|
5146
|
+
if (useAlertComponent && (description || title)) {
|
|
5147
|
+
const variantMap = { error: "error", info: "info", success: "success" };
|
|
5148
|
+
const variant = variantMap[type] || type;
|
|
5149
|
+
const alertEl = Alert.create({ title, description, variant });
|
|
5150
|
+
if (alertEl) container.appendChild(alertEl);
|
|
5151
|
+
} else {
|
|
5152
|
+
const div = document.createElement("div");
|
|
5153
|
+
div.className = `alert alert--${type}`;
|
|
5154
|
+
div.textContent = description || title;
|
|
5155
|
+
container.appendChild(div);
|
|
5156
|
+
}
|
|
5157
|
+
});
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5125
5160
|
// ============================================================================
|
|
5126
5161
|
// TABLE COMPONENT
|
|
5127
5162
|
// ============================================================================
|
|
@@ -5456,8 +5491,9 @@
|
|
|
5456
5491
|
// Stepper
|
|
5457
5492
|
renderStepper,
|
|
5458
5493
|
|
|
5459
|
-
// Alerts
|
|
5494
|
+
// Alerts (now shows toast notifications)
|
|
5460
5495
|
showToast,
|
|
5496
|
+
renderAlerts, // Legacy support for static alerts
|
|
5461
5497
|
|
|
5462
5498
|
// Table
|
|
5463
5499
|
createDataTable,
|
|
@@ -6860,12 +6896,12 @@
|
|
|
6860
6896
|
' stroke-width="1.5">' +
|
|
6861
6897
|
TI_PATH_NONE +
|
|
6862
6898
|
'<path d="M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0"/><path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"/></svg>',
|
|
6863
|
-
|
|
6899
|
+
IconCurrencyDollar:
|
|
6864
6900
|
"<svg" +
|
|
6865
6901
|
TI +
|
|
6866
6902
|
' stroke-width="1.5">' +
|
|
6867
6903
|
TI_PATH_NONE +
|
|
6868
|
-
'<path d="
|
|
6904
|
+
'<path d="M16.7 8a3 3 0 0 0 -2.7 -2h-4a3 3 0 0 0 0 6h4a3 3 0 0 1 0 6h-4a3 3 0 0 1 -2.7 -2"/><path d="M12 3v3m0 12v3"/></svg>',
|
|
6869
6905
|
IconPhone:
|
|
6870
6906
|
"<svg" +
|
|
6871
6907
|
TI +
|
|
@@ -7064,18 +7100,9 @@
|
|
|
7064
7100
|
return { show: noop, hide: noop, destroy: noop, element: null };
|
|
7065
7101
|
}
|
|
7066
7102
|
|
|
7067
|
-
// Wrap trigger in a relative container so popover can be absolute relative to it (full width so parent controls it)
|
|
7068
|
-
const container = document.createElement("div");
|
|
7069
|
-
container.className = "relative w-full";
|
|
7070
|
-
const triggerParent = triggerEl.parentNode;
|
|
7071
|
-
if (triggerParent) {
|
|
7072
|
-
triggerParent.insertBefore(container, triggerEl);
|
|
7073
|
-
container.appendChild(triggerEl);
|
|
7074
|
-
}
|
|
7075
|
-
|
|
7076
7103
|
const wrapper = document.createElement("div");
|
|
7077
7104
|
wrapper.className =
|
|
7078
|
-
"
|
|
7105
|
+
"fixed z-50 pointer-events-none opacity-0 invisible transition-opacity duration-150 ease-out";
|
|
7079
7106
|
wrapper.setAttribute("aria-hidden", "true");
|
|
7080
7107
|
|
|
7081
7108
|
const panel = document.createElement("div");
|
|
@@ -7111,46 +7138,57 @@
|
|
|
7111
7138
|
panel.appendChild(body);
|
|
7112
7139
|
|
|
7113
7140
|
wrapper.appendChild(panel);
|
|
7114
|
-
container.appendChild(wrapper);
|
|
7115
7141
|
|
|
7116
7142
|
function noop() {}
|
|
7117
7143
|
|
|
7118
7144
|
function position() {
|
|
7119
|
-
const
|
|
7145
|
+
const rect = triggerEl.getBoundingClientRect();
|
|
7120
7146
|
const panelRect = panel.getBoundingClientRect();
|
|
7121
7147
|
const gap = 8;
|
|
7122
7148
|
let top = 0;
|
|
7123
7149
|
let left = 0;
|
|
7124
7150
|
|
|
7125
7151
|
// Alignment offset: start = 0, center = half diff, end = full diff
|
|
7126
|
-
const alignLeft = (align === "center" ? (
|
|
7127
|
-
const alignTop = (align === "center" ? (
|
|
7152
|
+
const alignLeft = (align === "center" ? (rect.width - panelRect.width) / 2 : align === "end" ? rect.width - panelRect.width : 0);
|
|
7153
|
+
const alignTop = (align === "center" ? (rect.height - panelRect.height) / 2 : align === "end" ? rect.height - panelRect.height : 0);
|
|
7128
7154
|
|
|
7129
7155
|
switch (placement) {
|
|
7130
7156
|
case "bottom":
|
|
7131
|
-
top =
|
|
7132
|
-
left = alignLeft;
|
|
7157
|
+
top = rect.bottom + gap;
|
|
7158
|
+
left = rect.left + alignLeft;
|
|
7133
7159
|
break;
|
|
7134
7160
|
case "top":
|
|
7135
|
-
top = -panelRect.height - gap;
|
|
7136
|
-
left = alignLeft;
|
|
7161
|
+
top = rect.top - panelRect.height - gap;
|
|
7162
|
+
left = rect.left + alignLeft;
|
|
7137
7163
|
break;
|
|
7138
7164
|
case "right":
|
|
7139
|
-
top = alignTop;
|
|
7140
|
-
left =
|
|
7165
|
+
top = rect.top + alignTop;
|
|
7166
|
+
left = rect.right + gap;
|
|
7141
7167
|
break;
|
|
7142
7168
|
case "left":
|
|
7143
|
-
top = alignTop;
|
|
7144
|
-
left = -panelRect.width - gap;
|
|
7169
|
+
top = rect.top + alignTop;
|
|
7170
|
+
left = rect.left - panelRect.width - gap;
|
|
7145
7171
|
break;
|
|
7146
7172
|
default:
|
|
7147
|
-
top =
|
|
7148
|
-
left = alignLeft;
|
|
7173
|
+
top = rect.bottom + gap;
|
|
7174
|
+
left = rect.left + alignLeft;
|
|
7175
|
+
}
|
|
7176
|
+
|
|
7177
|
+
// Keep within viewport
|
|
7178
|
+
const padding = 8;
|
|
7179
|
+
if (left < padding) left = padding;
|
|
7180
|
+
if (left + panelRect.width > window.innerWidth - padding) {
|
|
7181
|
+
left = window.innerWidth - panelRect.width - padding;
|
|
7182
|
+
}
|
|
7183
|
+
if (top < padding) top = padding;
|
|
7184
|
+
if (top + panelRect.height > window.innerHeight - padding) {
|
|
7185
|
+
top = window.innerHeight - panelRect.height - padding;
|
|
7149
7186
|
}
|
|
7150
7187
|
|
|
7151
|
-
wrapper.style.
|
|
7152
|
-
wrapper.style.top =
|
|
7153
|
-
wrapper.style.
|
|
7188
|
+
wrapper.style.left = "0";
|
|
7189
|
+
wrapper.style.top = "0";
|
|
7190
|
+
wrapper.style.transform = "translate(" + left + "px, " + top + "px)";
|
|
7191
|
+
// Force reflow so transform is applied before we show (avoids flash from left/top-left)
|
|
7154
7192
|
wrapper.offsetHeight;
|
|
7155
7193
|
}
|
|
7156
7194
|
|
|
@@ -7164,7 +7202,24 @@
|
|
|
7164
7202
|
|
|
7165
7203
|
function show() {
|
|
7166
7204
|
if (onOpen) onOpen();
|
|
7167
|
-
|
|
7205
|
+
var justAppended = !wrapper.parentNode;
|
|
7206
|
+
if (justAppended) {
|
|
7207
|
+
document.body.appendChild(wrapper);
|
|
7208
|
+
}
|
|
7209
|
+
// On first open, wait for layout so getBoundingClientRect() is correct (avoids wrong position / "from left" look)
|
|
7210
|
+
if (justAppended) {
|
|
7211
|
+
requestAnimationFrame(function () {
|
|
7212
|
+
position();
|
|
7213
|
+
wrapper.classList.remove("invisible", "opacity-0", "pointer-events-none");
|
|
7214
|
+
wrapper.classList.add("visible", "opacity-100", "pointer-events-auto");
|
|
7215
|
+
wrapper.setAttribute("aria-hidden", "false");
|
|
7216
|
+
requestAnimationFrame(function () {
|
|
7217
|
+
requestAnimationFrame(function () {
|
|
7218
|
+
panel.setAttribute("data-state", "open");
|
|
7219
|
+
});
|
|
7220
|
+
});
|
|
7221
|
+
});
|
|
7222
|
+
} else {
|
|
7168
7223
|
position();
|
|
7169
7224
|
wrapper.classList.remove("invisible", "opacity-0", "pointer-events-none");
|
|
7170
7225
|
wrapper.classList.add("visible", "opacity-100", "pointer-events-auto");
|
|
@@ -7174,7 +7229,7 @@
|
|
|
7174
7229
|
panel.setAttribute("data-state", "open");
|
|
7175
7230
|
});
|
|
7176
7231
|
});
|
|
7177
|
-
}
|
|
7232
|
+
}
|
|
7178
7233
|
}
|
|
7179
7234
|
|
|
7180
7235
|
function destroy() {
|
|
@@ -7182,10 +7237,6 @@
|
|
|
7182
7237
|
if (wrapper.parentNode) {
|
|
7183
7238
|
wrapper.parentNode.removeChild(wrapper);
|
|
7184
7239
|
}
|
|
7185
|
-
if (container.parentNode && triggerEl.parentNode === container) {
|
|
7186
|
-
container.parentNode.insertBefore(triggerEl, container);
|
|
7187
|
-
container.parentNode.removeChild(container);
|
|
7188
|
-
}
|
|
7189
7240
|
if (closeOnClickOutside) {
|
|
7190
7241
|
document.removeEventListener("click", outsideClick);
|
|
7191
7242
|
}
|
|
@@ -7305,14 +7356,6 @@
|
|
|
7305
7356
|
return Array.prototype.filter.call(arguments, Boolean).join(" ");
|
|
7306
7357
|
}
|
|
7307
7358
|
|
|
7308
|
-
function getDep(name) {
|
|
7309
|
-
if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
|
|
7310
|
-
var c = global.FlowUI._getComponent(name);
|
|
7311
|
-
if (c) return c;
|
|
7312
|
-
}
|
|
7313
|
-
return global[name];
|
|
7314
|
-
}
|
|
7315
|
-
|
|
7316
7359
|
/**
|
|
7317
7360
|
* Create a custom select component
|
|
7318
7361
|
* @param {Object} config
|
|
@@ -7342,11 +7385,6 @@
|
|
|
7342
7385
|
var value =
|
|
7343
7386
|
config.value !== undefined && config.value !== null ? config.value : "";
|
|
7344
7387
|
|
|
7345
|
-
var Popover = getDep("Popover");
|
|
7346
|
-
if (!Popover || typeof Popover.create !== "function") {
|
|
7347
|
-
throw new Error("Select requires Popover");
|
|
7348
|
-
}
|
|
7349
|
-
|
|
7350
7388
|
var selectedOption = options.find(function (opt) {
|
|
7351
7389
|
var optValue =
|
|
7352
7390
|
opt.value !== undefined && opt.value !== null
|
|
@@ -7446,7 +7484,11 @@
|
|
|
7446
7484
|
|
|
7447
7485
|
var content = document.createElement("div");
|
|
7448
7486
|
content.setAttribute("role", "listbox");
|
|
7449
|
-
|
|
7487
|
+
var contentBase =
|
|
7488
|
+
"custom-select-content absolute left-0 right-0 z-50 max-h-[200px] min-w-[8rem] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium opacity-0 invisible transition-all duration-150 ease-out " +
|
|
7489
|
+
"group-[.open]:opacity-100 group-[.open]:visible ";
|
|
7490
|
+
content.className =
|
|
7491
|
+
contentBase + "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0";
|
|
7450
7492
|
|
|
7451
7493
|
var optionsList = document.createElement("div");
|
|
7452
7494
|
optionsList.className =
|
|
@@ -7500,66 +7542,47 @@
|
|
|
7500
7542
|
}
|
|
7501
7543
|
|
|
7502
7544
|
content.appendChild(optionsList);
|
|
7545
|
+
container.appendChild(content);
|
|
7503
7546
|
|
|
7547
|
+
var isOpen = false;
|
|
7504
7548
|
var highlightedIndex = -1;
|
|
7505
|
-
var popover = Popover.create({
|
|
7506
|
-
trigger: trigger,
|
|
7507
|
-
content: content,
|
|
7508
|
-
placement: "bottom",
|
|
7509
|
-
align: "start",
|
|
7510
|
-
closeOnClickOutside: true,
|
|
7511
|
-
bodyClassName: "p-0 overflow-hidden",
|
|
7512
|
-
panelClassName: "min-w-[var(--trigger-width)] max-h-[200px] overflow-hidden",
|
|
7513
|
-
onOpen: function () {
|
|
7514
|
-
if (disabled) {
|
|
7515
|
-
popover.hide();
|
|
7516
|
-
return;
|
|
7517
|
-
}
|
|
7518
|
-
document
|
|
7519
|
-
.querySelectorAll(".custom-select, .record-select, .enum-select, .enum-multiselect, .custom-multiselect, .record-multiselect")
|
|
7520
|
-
.forEach(function (other) {
|
|
7521
|
-
if (other !== container && other.popoverInstance) {
|
|
7522
|
-
other.popoverInstance.hide();
|
|
7523
|
-
}
|
|
7524
|
-
});
|
|
7525
|
-
trigger.setAttribute("aria-expanded", "true");
|
|
7526
|
-
chevron.style.transform = "rotate(180deg)";
|
|
7527
|
-
highlightOptionByValue(value);
|
|
7528
|
-
if (popover.panel) {
|
|
7529
|
-
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
7530
|
-
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
7531
|
-
popover.panel.style.minWidth = triggerWidthPx;
|
|
7532
|
-
popover.panel.style.width = triggerWidthPx;
|
|
7533
|
-
}
|
|
7534
|
-
},
|
|
7535
|
-
onClose: function () {
|
|
7536
|
-
trigger.setAttribute("aria-expanded", "false");
|
|
7537
|
-
chevron.style.transform = "";
|
|
7538
|
-
highlightedIndex = -1;
|
|
7539
|
-
},
|
|
7540
|
-
});
|
|
7541
|
-
container.popoverInstance = popover;
|
|
7542
7549
|
|
|
7543
7550
|
function openDropdown() {
|
|
7544
7551
|
if (disabled) return;
|
|
7545
|
-
|
|
7552
|
+
document
|
|
7553
|
+
.querySelectorAll(".custom-select.open, .record-select.open")
|
|
7554
|
+
.forEach(function (other) {
|
|
7555
|
+
if (other !== container) {
|
|
7556
|
+
other.classList.remove("open");
|
|
7557
|
+
var t = other.querySelector(
|
|
7558
|
+
"button, .custom-select-trigger, .record-select-trigger"
|
|
7559
|
+
);
|
|
7560
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
7561
|
+
}
|
|
7562
|
+
});
|
|
7563
|
+
isOpen = true;
|
|
7564
|
+
container.classList.add("open");
|
|
7565
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
7566
|
+
highlightOptionByValue(value);
|
|
7567
|
+
updatePosition();
|
|
7546
7568
|
}
|
|
7547
7569
|
|
|
7548
7570
|
function closeDropdown() {
|
|
7549
|
-
|
|
7571
|
+
isOpen = false;
|
|
7572
|
+
container.classList.remove("open");
|
|
7573
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
7550
7574
|
highlightedIndex = -1;
|
|
7551
7575
|
}
|
|
7552
7576
|
|
|
7553
7577
|
function toggleDropdown() {
|
|
7554
|
-
var isVisible = popover.element && popover.element.classList.contains("visible");
|
|
7555
7578
|
var others = document.querySelectorAll(
|
|
7556
|
-
".custom-select, .record-select
|
|
7579
|
+
".custom-select.open, .record-select.open"
|
|
7557
7580
|
);
|
|
7558
7581
|
var hasOther = Array.from(others).some(function (s) {
|
|
7559
|
-
return s !== container
|
|
7582
|
+
return s !== container;
|
|
7560
7583
|
});
|
|
7561
7584
|
if (hasOther) openDropdown();
|
|
7562
|
-
else if (
|
|
7585
|
+
else if (isOpen) closeDropdown();
|
|
7563
7586
|
else openDropdown();
|
|
7564
7587
|
}
|
|
7565
7588
|
|
|
@@ -7638,26 +7661,40 @@
|
|
|
7638
7661
|
|
|
7639
7662
|
function scrollToOption(opt) {
|
|
7640
7663
|
if (!opt) return;
|
|
7641
|
-
var cr =
|
|
7664
|
+
var cr = content.getBoundingClientRect();
|
|
7642
7665
|
var top = opt.offsetTop;
|
|
7643
7666
|
var bottom = top + opt.offsetHeight;
|
|
7644
|
-
var st =
|
|
7667
|
+
var st = content.scrollTop;
|
|
7645
7668
|
var sb = st + cr.height;
|
|
7646
|
-
if (top < st)
|
|
7669
|
+
if (top < st) content.scrollTop = top - 8;
|
|
7647
7670
|
else if (bottom > sb)
|
|
7648
|
-
|
|
7671
|
+
content.scrollTop = bottom - cr.height + 8;
|
|
7672
|
+
}
|
|
7673
|
+
|
|
7674
|
+
function updatePosition() {
|
|
7675
|
+
var rect = trigger.getBoundingClientRect();
|
|
7676
|
+
var vh = window.innerHeight;
|
|
7677
|
+
var below = vh - rect.bottom;
|
|
7678
|
+
var above = rect.top;
|
|
7679
|
+
if (below < 200 && above > below) {
|
|
7680
|
+
content.className =
|
|
7681
|
+
contentBase +
|
|
7682
|
+
"bottom-full mb-1 translate-y-1 group-[.open]:translate-y-0";
|
|
7683
|
+
} else {
|
|
7684
|
+
content.className =
|
|
7685
|
+
contentBase +
|
|
7686
|
+
"top-full mt-1 -translate-y-1 group-[.open]:translate-y-0";
|
|
7687
|
+
}
|
|
7649
7688
|
}
|
|
7650
7689
|
|
|
7651
7690
|
trigger.addEventListener("click", function (e) {
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
}, true);
|
|
7691
|
+
e.preventDefault();
|
|
7692
|
+
e.stopPropagation();
|
|
7693
|
+
toggleDropdown();
|
|
7694
|
+
});
|
|
7657
7695
|
|
|
7658
7696
|
trigger.addEventListener("keydown", function (e) {
|
|
7659
7697
|
if (disabled) return;
|
|
7660
|
-
var isVisible = popover.element && popover.element.classList.contains("visible");
|
|
7661
7698
|
switch (e.key) {
|
|
7662
7699
|
case "Enter":
|
|
7663
7700
|
case " ":
|
|
@@ -7666,16 +7703,16 @@
|
|
|
7666
7703
|
break;
|
|
7667
7704
|
case "ArrowDown":
|
|
7668
7705
|
e.preventDefault();
|
|
7669
|
-
if (!
|
|
7706
|
+
if (!isOpen) openDropdown();
|
|
7670
7707
|
else navigateOptions(1);
|
|
7671
7708
|
break;
|
|
7672
7709
|
case "ArrowUp":
|
|
7673
7710
|
e.preventDefault();
|
|
7674
|
-
if (!
|
|
7711
|
+
if (!isOpen) openDropdown();
|
|
7675
7712
|
else navigateOptions(-1);
|
|
7676
7713
|
break;
|
|
7677
7714
|
case "Escape":
|
|
7678
|
-
if (
|
|
7715
|
+
if (isOpen) {
|
|
7679
7716
|
e.preventDefault();
|
|
7680
7717
|
closeDropdown();
|
|
7681
7718
|
}
|
|
@@ -7696,6 +7733,13 @@
|
|
|
7696
7733
|
scrollToOption(opt);
|
|
7697
7734
|
}
|
|
7698
7735
|
|
|
7736
|
+
document.addEventListener("click", function (e) {
|
|
7737
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
7738
|
+
});
|
|
7739
|
+
document.addEventListener("keydown", function (e) {
|
|
7740
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
7741
|
+
});
|
|
7742
|
+
|
|
7699
7743
|
container.updateValue = function (newValue) {
|
|
7700
7744
|
value =
|
|
7701
7745
|
newValue !== undefined && newValue !== null ? newValue : "";
|
|
@@ -7792,8 +7836,7 @@
|
|
|
7792
7836
|
canClear && !!value && !disabled
|
|
7793
7837
|
);
|
|
7794
7838
|
updateClearButton();
|
|
7795
|
-
|
|
7796
|
-
if (disabled && isVisible) closeDropdown();
|
|
7839
|
+
if (disabled && isOpen) closeDropdown();
|
|
7797
7840
|
};
|
|
7798
7841
|
|
|
7799
7842
|
return container;
|
|
@@ -7883,14 +7926,6 @@
|
|
|
7883
7926
|
return Array.prototype.filter.call(arguments, Boolean).join(" ");
|
|
7884
7927
|
}
|
|
7885
7928
|
|
|
7886
|
-
function getDep(name) {
|
|
7887
|
-
if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
|
|
7888
|
-
var c = global.FlowUI._getComponent(name);
|
|
7889
|
-
if (c) return c;
|
|
7890
|
-
}
|
|
7891
|
-
return global[name];
|
|
7892
|
-
}
|
|
7893
|
-
|
|
7894
7929
|
/** Resolve client: use FlowUI._getComponent when bundle has captured globals, else global.superleapClient */
|
|
7895
7930
|
function getClient() {
|
|
7896
7931
|
if (global.FlowUI && typeof global.FlowUI._getComponent === "function") {
|
|
@@ -7954,10 +7989,8 @@
|
|
|
7954
7989
|
var error = null;
|
|
7955
7990
|
var searchQuery = "";
|
|
7956
7991
|
var popover = null;
|
|
7957
|
-
var
|
|
7958
|
-
|
|
7959
|
-
throw new Error("EnumSelect requires Popover");
|
|
7960
|
-
}
|
|
7992
|
+
var usePopover = !!(global.Popover && typeof global.Popover.create === "function");
|
|
7993
|
+
var isOpen = false;
|
|
7961
7994
|
|
|
7962
7995
|
var container = document.createElement("div");
|
|
7963
7996
|
container.className = "enum-select relative w-full group";
|
|
@@ -8041,7 +8074,13 @@
|
|
|
8041
8074
|
// Create dropdown content
|
|
8042
8075
|
var content = document.createElement("div");
|
|
8043
8076
|
content.setAttribute("role", "listbox");
|
|
8044
|
-
|
|
8077
|
+
var contentBase = "w-full min-w-[200px]";
|
|
8078
|
+
if (!usePopover) {
|
|
8079
|
+
contentBase += " absolute left-0 right-0 z-50 max-h-[30vh] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium border-1/2 border-border-primary opacity-0 invisible transition-all duration-150 ease-out group-[.open]:opacity-100 group-[.open]:visible top-full mt-1 -translate-y-1 group-[.open]:translate-y-0 flex flex-col";
|
|
8080
|
+
} else {
|
|
8081
|
+
contentBase += " max-h-[30vh] overflow-hidden flex flex-col";
|
|
8082
|
+
}
|
|
8083
|
+
content.className = contentBase;
|
|
8045
8084
|
|
|
8046
8085
|
// Search input (using InputComponent like phone-input)
|
|
8047
8086
|
var searchContainer = document.createElement("div");
|
|
@@ -8107,6 +8146,10 @@
|
|
|
8107
8146
|
content.appendChild(searchContainer);
|
|
8108
8147
|
content.appendChild(optionsList);
|
|
8109
8148
|
|
|
8149
|
+
if (!usePopover) {
|
|
8150
|
+
container.appendChild(content);
|
|
8151
|
+
}
|
|
8152
|
+
|
|
8110
8153
|
var highlightedIndex = -1;
|
|
8111
8154
|
|
|
8112
8155
|
function showLoading() {
|
|
@@ -8229,14 +8272,37 @@
|
|
|
8229
8272
|
|
|
8230
8273
|
function openDropdown() {
|
|
8231
8274
|
if (disabled) return;
|
|
8275
|
+
if (popover) {
|
|
8276
|
+
// Close other open selects
|
|
8277
|
+
document
|
|
8278
|
+
.querySelectorAll(".enum-select, .custom-select, .record-select")
|
|
8279
|
+
.forEach(function (other) {
|
|
8280
|
+
if (other !== container && other.popoverInstance) {
|
|
8281
|
+
other.popoverInstance.hide();
|
|
8282
|
+
}
|
|
8283
|
+
});
|
|
8284
|
+
popover.show();
|
|
8285
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
8286
|
+
highlightOptionByValue(value);
|
|
8287
|
+
if (searchInput) {
|
|
8288
|
+
setTimeout(function () {
|
|
8289
|
+
searchInput.focus();
|
|
8290
|
+
}, 50);
|
|
8291
|
+
}
|
|
8292
|
+
return;
|
|
8293
|
+
}
|
|
8294
|
+
// Fallback when Popover not available
|
|
8232
8295
|
document
|
|
8233
|
-
.querySelectorAll(".enum-select
|
|
8296
|
+
.querySelectorAll(".enum-select.open")
|
|
8234
8297
|
.forEach(function (other) {
|
|
8235
|
-
if (other !== container
|
|
8236
|
-
other.
|
|
8298
|
+
if (other !== container) {
|
|
8299
|
+
other.classList.remove("open");
|
|
8300
|
+
var t = other.querySelector("button");
|
|
8301
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
8237
8302
|
}
|
|
8238
8303
|
});
|
|
8239
|
-
|
|
8304
|
+
isOpen = true;
|
|
8305
|
+
container.classList.add("open");
|
|
8240
8306
|
trigger.setAttribute("aria-expanded", "true");
|
|
8241
8307
|
highlightOptionByValue(value);
|
|
8242
8308
|
if (searchInput) {
|
|
@@ -8247,7 +8313,12 @@
|
|
|
8247
8313
|
}
|
|
8248
8314
|
|
|
8249
8315
|
function closeDropdown() {
|
|
8250
|
-
popover
|
|
8316
|
+
if (popover) {
|
|
8317
|
+
popover.hide();
|
|
8318
|
+
} else {
|
|
8319
|
+
isOpen = false;
|
|
8320
|
+
container.classList.remove("open");
|
|
8321
|
+
}
|
|
8251
8322
|
trigger.setAttribute("aria-expanded", "false");
|
|
8252
8323
|
highlightedIndex = -1;
|
|
8253
8324
|
clearSearch();
|
|
@@ -8255,7 +8326,9 @@
|
|
|
8255
8326
|
}
|
|
8256
8327
|
|
|
8257
8328
|
function toggleDropdown() {
|
|
8258
|
-
var isVisible = popover
|
|
8329
|
+
var isVisible = popover
|
|
8330
|
+
? popover.element && popover.element.classList.contains("visible")
|
|
8331
|
+
: isOpen;
|
|
8259
8332
|
if (isVisible) {
|
|
8260
8333
|
closeDropdown();
|
|
8261
8334
|
} else {
|
|
@@ -8366,7 +8439,10 @@
|
|
|
8366
8439
|
|
|
8367
8440
|
// Initialize Popover
|
|
8368
8441
|
function initializePopover() {
|
|
8369
|
-
|
|
8442
|
+
if (!usePopover) {
|
|
8443
|
+
return;
|
|
8444
|
+
}
|
|
8445
|
+
popover = global.Popover.create({
|
|
8370
8446
|
trigger: trigger,
|
|
8371
8447
|
content: content,
|
|
8372
8448
|
placement: "bottom",
|
|
@@ -8382,12 +8458,6 @@
|
|
|
8382
8458
|
onOpen: function () {
|
|
8383
8459
|
trigger.setAttribute("aria-expanded", "true");
|
|
8384
8460
|
chevron.style.transform = "rotate(180deg)";
|
|
8385
|
-
if (popover.panel) {
|
|
8386
|
-
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
8387
|
-
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
8388
|
-
popover.panel.style.minWidth = triggerWidthPx;
|
|
8389
|
-
popover.panel.style.width = triggerWidthPx;
|
|
8390
|
-
}
|
|
8391
8461
|
},
|
|
8392
8462
|
bodyClassName: "p-0 overflow-hidden",
|
|
8393
8463
|
panelClassName: "min-w-[var(--trigger-width)] overflow-hidden",
|
|
@@ -8395,6 +8465,13 @@
|
|
|
8395
8465
|
|
|
8396
8466
|
// Store popover instance for cleanup
|
|
8397
8467
|
container.popoverInstance = popover;
|
|
8468
|
+
|
|
8469
|
+
// Set CSS variable for trigger width
|
|
8470
|
+
var triggerWidth = trigger.offsetWidth;
|
|
8471
|
+
if (popover.panel) {
|
|
8472
|
+
popover.panel.style.setProperty("--trigger-width", triggerWidth + "px");
|
|
8473
|
+
popover.panel.style.minWidth = triggerWidth + "px";
|
|
8474
|
+
}
|
|
8398
8475
|
}
|
|
8399
8476
|
|
|
8400
8477
|
// Load options from SDK
|
|
@@ -8514,6 +8591,21 @@
|
|
|
8514
8591
|
initializePopover();
|
|
8515
8592
|
loadOptions();
|
|
8516
8593
|
|
|
8594
|
+
if (!usePopover) {
|
|
8595
|
+
trigger.addEventListener("click", function (e) {
|
|
8596
|
+
e.preventDefault();
|
|
8597
|
+
e.stopPropagation();
|
|
8598
|
+
if (disabled) return;
|
|
8599
|
+
toggleDropdown();
|
|
8600
|
+
});
|
|
8601
|
+
document.addEventListener("click", function (e) {
|
|
8602
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
8603
|
+
});
|
|
8604
|
+
document.addEventListener("keydown", function (e) {
|
|
8605
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
8606
|
+
});
|
|
8607
|
+
}
|
|
8608
|
+
|
|
8517
8609
|
// Public API
|
|
8518
8610
|
container.updateValue = function (newValue) {
|
|
8519
8611
|
value = newValue !== undefined && newValue !== null ? newValue : "";
|
|
@@ -8558,7 +8650,7 @@
|
|
|
8558
8650
|
);
|
|
8559
8651
|
updateClearButton();
|
|
8560
8652
|
var isVisible = popover && popover.element && popover.element.classList.contains("visible");
|
|
8561
|
-
if (disabled && isVisible) closeDropdown();
|
|
8653
|
+
if (disabled && (isVisible || isOpen)) closeDropdown();
|
|
8562
8654
|
};
|
|
8563
8655
|
|
|
8564
8656
|
container.reload = function () {
|
|
@@ -8596,7 +8688,7 @@
|
|
|
8596
8688
|
/**
|
|
8597
8689
|
* Record Select Component (superleap-flow)
|
|
8598
8690
|
* Single-record select with search; same trigger/content styling as Select.
|
|
8599
|
-
* Uses Popover
|
|
8691
|
+
* Uses: Popover (dropdown), InputComponent (search), Spinner (loading), Avatar (vivid for user).
|
|
8600
8692
|
* Fetches records via superleapClient.getSdk().model(objectSlug).
|
|
8601
8693
|
* For objectSlug === 'user' shows Vivid Avatar; otherwise static icon from schema or object map (database fallback).
|
|
8602
8694
|
* Does not use icon from backend payload.
|
|
@@ -8617,7 +8709,7 @@
|
|
|
8617
8709
|
role: { iconStr: "IconShield", color: "info" },
|
|
8618
8710
|
iframe: { iconStr: "IconLayout", color: "neutral" },
|
|
8619
8711
|
lead: { iconStr: "IconUser", color: "primary" },
|
|
8620
|
-
opportunity: { iconStr: "
|
|
8712
|
+
opportunity: { iconStr: "IconCurrencyDollar", color: "success" },
|
|
8621
8713
|
call_log: { iconStr: "IconPhone", color: "info" },
|
|
8622
8714
|
communication: { iconStr: "IconMessage", color: "primary" },
|
|
8623
8715
|
history_field: { iconStr: "IconClock", color: "neutral" },
|
|
@@ -8764,12 +8856,6 @@
|
|
|
8764
8856
|
errEl.textContent = "Record select: objectSlug is required.";
|
|
8765
8857
|
return errEl;
|
|
8766
8858
|
}
|
|
8767
|
-
if (!Popover || typeof Popover.create !== "function") {
|
|
8768
|
-
var popoverErr = document.createElement("div");
|
|
8769
|
-
popoverErr.className = "text-reg-13 text-typography-quaternary-text";
|
|
8770
|
-
popoverErr.textContent = "Record select: Popover is required.";
|
|
8771
|
-
return popoverErr;
|
|
8772
|
-
}
|
|
8773
8859
|
|
|
8774
8860
|
var container = document.createElement("div");
|
|
8775
8861
|
container.className = "record-select relative w-full group";
|
|
@@ -8782,11 +8868,16 @@
|
|
|
8782
8868
|
var isOpen = false;
|
|
8783
8869
|
var searchTerm = "";
|
|
8784
8870
|
var searchDebounceTimer = null;
|
|
8871
|
+
var usePopover = Popover && typeof Popover.create === "function";
|
|
8785
8872
|
var popover = null;
|
|
8786
8873
|
var hasMoreRecords = true;
|
|
8787
8874
|
var currentPage = 1;
|
|
8788
8875
|
var isFetchingMore = false;
|
|
8789
8876
|
var totalFetched = 0;
|
|
8877
|
+
var contentBase = "record-select-content min-w-[8rem] ";
|
|
8878
|
+
if (!usePopover) {
|
|
8879
|
+
contentBase += "absolute left-0 right-0 z-50 max-h-[30vh] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium opacity-0 invisible transition-all duration-150 ease-out group-[.open]:opacity-100 group-[.open]:visible ";
|
|
8880
|
+
}
|
|
8790
8881
|
|
|
8791
8882
|
// Trigger wrapper + button (same structure as Select)
|
|
8792
8883
|
var triggerWrapper = document.createElement("span");
|
|
@@ -8852,7 +8943,7 @@
|
|
|
8852
8943
|
// Dropdown content: search + list (same content pattern as Select)
|
|
8853
8944
|
var content = document.createElement("div");
|
|
8854
8945
|
content.setAttribute("role", "listbox");
|
|
8855
|
-
content.className = "
|
|
8946
|
+
content.className = contentBase + (usePopover ? "max-h-[30vh] overflow-hidden flex flex-col" : "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0");
|
|
8856
8947
|
|
|
8857
8948
|
var searchWrap = document.createElement("div");
|
|
8858
8949
|
searchWrap.className = "py-8 border-b-1/2 border-border-primary";
|
|
@@ -8919,51 +9010,57 @@
|
|
|
8919
9010
|
|
|
8920
9011
|
content.appendChild(optionsList);
|
|
8921
9012
|
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
if (
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
if (t) t.setAttribute("aria-expanded", "false");
|
|
9013
|
+
if (!usePopover) {
|
|
9014
|
+
container.appendChild(content);
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9017
|
+
if (usePopover) {
|
|
9018
|
+
popover = Popover.create({
|
|
9019
|
+
trigger: trigger,
|
|
9020
|
+
content: content,
|
|
9021
|
+
placement: "bottom",
|
|
9022
|
+
align: "start",
|
|
9023
|
+
closeOnClickOutside: true,
|
|
9024
|
+
bodyClassName: "p-0 overflow-hidden",
|
|
9025
|
+
panelClassName: "max-h-[30vh] overflow-hidden",
|
|
9026
|
+
onOpen: function () {
|
|
9027
|
+
if (disabled) {
|
|
9028
|
+
popover.hide();
|
|
9029
|
+
return;
|
|
8940
9030
|
}
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8962
|
-
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
9031
|
+
document.querySelectorAll(".custom-select.open, .record-select.open").forEach(function (other) {
|
|
9032
|
+
if (other !== container) {
|
|
9033
|
+
other.classList.remove("open");
|
|
9034
|
+
var t = other.querySelector("button, .custom-select-trigger, .record-select-trigger");
|
|
9035
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
9036
|
+
}
|
|
9037
|
+
});
|
|
9038
|
+
isOpen = true;
|
|
9039
|
+
container.classList.add("open");
|
|
9040
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
9041
|
+
searchTerm = "";
|
|
9042
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
9043
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
9044
|
+
content.style.minWidth = trigger.offsetWidth + "px";
|
|
9045
|
+
loadInitialAndRender();
|
|
9046
|
+
setTimeout(function () {
|
|
9047
|
+
if (searchInputEl) searchInputEl.focus();
|
|
9048
|
+
}, 0);
|
|
9049
|
+
},
|
|
9050
|
+
onClose: function () {
|
|
9051
|
+
isOpen = false;
|
|
9052
|
+
container.classList.remove("open");
|
|
9053
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
9054
|
+
searchTerm = "";
|
|
9055
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
9056
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
9057
|
+
if (searchDebounceTimer) {
|
|
9058
|
+
clearTimeout(searchDebounceTimer);
|
|
9059
|
+
searchDebounceTimer = null;
|
|
9060
|
+
}
|
|
9061
|
+
},
|
|
9062
|
+
});
|
|
9063
|
+
}
|
|
8967
9064
|
|
|
8968
9065
|
if (clearBtn) clearBtn.style.display = canClear && value && !disabled ? "" : "none";
|
|
8969
9066
|
|
|
@@ -9359,8 +9456,64 @@
|
|
|
9359
9456
|
}, 500);
|
|
9360
9457
|
}
|
|
9361
9458
|
|
|
9459
|
+
function openDropdown() {
|
|
9460
|
+
if (disabled) return;
|
|
9461
|
+
if (usePopover && popover) {
|
|
9462
|
+
popover.show();
|
|
9463
|
+
return;
|
|
9464
|
+
}
|
|
9465
|
+
document
|
|
9466
|
+
.querySelectorAll(".custom-select.open, .record-select.open")
|
|
9467
|
+
.forEach(function (other) {
|
|
9468
|
+
if (other !== container) {
|
|
9469
|
+
other.classList.remove("open");
|
|
9470
|
+
var t = other.querySelector(
|
|
9471
|
+
"button, .custom-select-trigger, .record-select-trigger"
|
|
9472
|
+
);
|
|
9473
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
9474
|
+
}
|
|
9475
|
+
});
|
|
9476
|
+
isOpen = true;
|
|
9477
|
+
container.classList.add("open");
|
|
9478
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
9479
|
+
searchTerm = "";
|
|
9480
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
9481
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
9482
|
+
loadInitialAndRender();
|
|
9483
|
+
setTimeout(function () {
|
|
9484
|
+
if (searchInputEl) searchInputEl.focus();
|
|
9485
|
+
}, 0);
|
|
9486
|
+
updatePosition();
|
|
9487
|
+
}
|
|
9488
|
+
|
|
9362
9489
|
function closeDropdown() {
|
|
9363
|
-
popover
|
|
9490
|
+
if (usePopover && popover) {
|
|
9491
|
+
popover.hide();
|
|
9492
|
+
return;
|
|
9493
|
+
}
|
|
9494
|
+
isOpen = false;
|
|
9495
|
+
container.classList.remove("open");
|
|
9496
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
9497
|
+
searchTerm = "";
|
|
9498
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
9499
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
9500
|
+
if (searchDebounceTimer) {
|
|
9501
|
+
clearTimeout(searchDebounceTimer);
|
|
9502
|
+
searchDebounceTimer = null;
|
|
9503
|
+
}
|
|
9504
|
+
}
|
|
9505
|
+
|
|
9506
|
+
function updatePosition() {
|
|
9507
|
+
if (usePopover) return;
|
|
9508
|
+
var rect = trigger.getBoundingClientRect();
|
|
9509
|
+
var vh = window.innerHeight;
|
|
9510
|
+
var below = vh - rect.bottom;
|
|
9511
|
+
var above = rect.top;
|
|
9512
|
+
if (below < 200 && above > below) {
|
|
9513
|
+
content.className = contentBase + "bottom-full mb-1 translate-y-1 group-[.open]:translate-y-0";
|
|
9514
|
+
} else {
|
|
9515
|
+
content.className = contentBase + "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0";
|
|
9516
|
+
}
|
|
9364
9517
|
}
|
|
9365
9518
|
|
|
9366
9519
|
if (!searchInputWrapper && searchInputEl) {
|
|
@@ -9379,14 +9532,41 @@
|
|
|
9379
9532
|
});
|
|
9380
9533
|
}
|
|
9381
9534
|
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9535
|
+
if (usePopover && popover) {
|
|
9536
|
+
trigger.addEventListener("keydown", function (e) {
|
|
9537
|
+
if (disabled) return;
|
|
9538
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9539
|
+
e.preventDefault();
|
|
9540
|
+
if (isOpen) popover.hide();
|
|
9541
|
+
else popover.show();
|
|
9542
|
+
}
|
|
9543
|
+
});
|
|
9544
|
+
} else {
|
|
9545
|
+
trigger.addEventListener("click", function (e) {
|
|
9385
9546
|
e.preventDefault();
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9547
|
+
e.stopPropagation();
|
|
9548
|
+
if (isOpen) closeDropdown();
|
|
9549
|
+
else openDropdown();
|
|
9550
|
+
});
|
|
9551
|
+
trigger.addEventListener("keydown", function (e) {
|
|
9552
|
+
if (disabled) return;
|
|
9553
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9554
|
+
e.preventDefault();
|
|
9555
|
+
if (isOpen) closeDropdown();
|
|
9556
|
+
else openDropdown();
|
|
9557
|
+
}
|
|
9558
|
+
if (e.key === "Escape" && isOpen) {
|
|
9559
|
+
e.preventDefault();
|
|
9560
|
+
closeDropdown();
|
|
9561
|
+
}
|
|
9562
|
+
});
|
|
9563
|
+
document.addEventListener("click", function (e) {
|
|
9564
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
9565
|
+
});
|
|
9566
|
+
document.addEventListener("keydown", function (e) {
|
|
9567
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
9568
|
+
});
|
|
9569
|
+
}
|
|
9390
9570
|
|
|
9391
9571
|
container.updateValue = function (newVal) {
|
|
9392
9572
|
setValue(newVal);
|
|
@@ -9483,14 +9663,6 @@
|
|
|
9483
9663
|
return opt.label || opt.name || opt.display_name || opt.value;
|
|
9484
9664
|
}
|
|
9485
9665
|
|
|
9486
|
-
function getDep(name) {
|
|
9487
|
-
if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
|
|
9488
|
-
var c = global.FlowUI._getComponent(name);
|
|
9489
|
-
if (c) return c;
|
|
9490
|
-
}
|
|
9491
|
-
return global[name];
|
|
9492
|
-
}
|
|
9493
|
-
|
|
9494
9666
|
/**
|
|
9495
9667
|
* Create a multiselect dropdown component
|
|
9496
9668
|
* @param {Object} config
|
|
@@ -9521,11 +9693,6 @@
|
|
|
9521
9693
|
? config.values.slice()
|
|
9522
9694
|
: [];
|
|
9523
9695
|
|
|
9524
|
-
var Popover = getDep("Popover");
|
|
9525
|
-
if (!Popover || typeof Popover.create !== "function") {
|
|
9526
|
-
throw new Error("MultiSelect requires Popover");
|
|
9527
|
-
}
|
|
9528
|
-
|
|
9529
9696
|
var container = document.createElement("div");
|
|
9530
9697
|
container.className = "custom-multiselect relative w-full group";
|
|
9531
9698
|
if (fieldId) container.setAttribute("data-field-id", fieldId);
|
|
@@ -9574,10 +9741,14 @@
|
|
|
9574
9741
|
triggerWrapper.appendChild(trigger);
|
|
9575
9742
|
container.appendChild(triggerWrapper);
|
|
9576
9743
|
|
|
9744
|
+
var contentBase =
|
|
9745
|
+
"custom-multiselect-content absolute left-0 right-0 z-50 max-h-[200px] min-w-[8rem] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium opacity-0 invisible transition-all duration-150 ease-out " +
|
|
9746
|
+
"group-[.open]:opacity-100 group-[.open]:visible ";
|
|
9747
|
+
|
|
9577
9748
|
var content = document.createElement("div");
|
|
9578
9749
|
content.setAttribute("role", "listbox");
|
|
9579
9750
|
content.setAttribute("aria-multiselectable", "true");
|
|
9580
|
-
content.className = "
|
|
9751
|
+
content.className = contentBase + "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0";
|
|
9581
9752
|
|
|
9582
9753
|
var optionsList = document.createElement("div");
|
|
9583
9754
|
optionsList.className =
|
|
@@ -9678,68 +9849,47 @@
|
|
|
9678
9849
|
buildOptionsList();
|
|
9679
9850
|
|
|
9680
9851
|
content.appendChild(optionsList);
|
|
9852
|
+
container.appendChild(content);
|
|
9681
9853
|
|
|
9682
|
-
var
|
|
9683
|
-
trigger: trigger,
|
|
9684
|
-
content: content,
|
|
9685
|
-
placement: "bottom",
|
|
9686
|
-
align: "start",
|
|
9687
|
-
closeOnClickOutside: true,
|
|
9688
|
-
bodyClassName: "p-0 overflow-hidden",
|
|
9689
|
-
panelClassName: "min-w-[var(--trigger-width)] max-h-[200px] overflow-hidden",
|
|
9690
|
-
onOpen: function () {
|
|
9691
|
-
if (disabled) {
|
|
9692
|
-
popover.hide();
|
|
9693
|
-
return;
|
|
9694
|
-
}
|
|
9695
|
-
document
|
|
9696
|
-
.querySelectorAll(".custom-select, .record-select, .custom-multiselect, .enum-select, .enum-multiselect, .record-multiselect")
|
|
9697
|
-
.forEach(function (other) {
|
|
9698
|
-
if (other !== container && other.popoverInstance) {
|
|
9699
|
-
other.popoverInstance.hide();
|
|
9700
|
-
}
|
|
9701
|
-
});
|
|
9702
|
-
trigger.setAttribute("aria-expanded", "true");
|
|
9703
|
-
chevron.style.transform = "rotate(180deg)";
|
|
9704
|
-
if (popover.panel) {
|
|
9705
|
-
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
9706
|
-
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
9707
|
-
popover.panel.style.minWidth = triggerWidthPx;
|
|
9708
|
-
popover.panel.style.width = triggerWidthPx;
|
|
9709
|
-
}
|
|
9710
|
-
},
|
|
9711
|
-
onClose: function () {
|
|
9712
|
-
trigger.setAttribute("aria-expanded", "false");
|
|
9713
|
-
chevron.style.transform = "";
|
|
9714
|
-
},
|
|
9715
|
-
});
|
|
9716
|
-
container.popoverInstance = popover;
|
|
9854
|
+
var isOpen = false;
|
|
9717
9855
|
|
|
9718
9856
|
function openDropdown() {
|
|
9719
9857
|
if (disabled) return;
|
|
9720
|
-
|
|
9858
|
+
document
|
|
9859
|
+
.querySelectorAll(".custom-select.open, .record-select.open, .custom-multiselect.open")
|
|
9860
|
+
.forEach(function (other) {
|
|
9861
|
+
if (other !== container) {
|
|
9862
|
+
other.classList.remove("open");
|
|
9863
|
+
var t = other.querySelector(
|
|
9864
|
+
"button, .custom-select-trigger, .record-select-trigger, .multiselect-trigger-wrapper button"
|
|
9865
|
+
);
|
|
9866
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
9867
|
+
}
|
|
9868
|
+
});
|
|
9869
|
+
isOpen = true;
|
|
9870
|
+
container.classList.add("open");
|
|
9871
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
9721
9872
|
}
|
|
9722
9873
|
|
|
9723
9874
|
function closeDropdown() {
|
|
9724
|
-
|
|
9875
|
+
isOpen = false;
|
|
9876
|
+
container.classList.remove("open");
|
|
9877
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
9725
9878
|
}
|
|
9726
9879
|
|
|
9727
9880
|
function toggleDropdown() {
|
|
9728
|
-
|
|
9729
|
-
if (isVisible) closeDropdown();
|
|
9881
|
+
if (isOpen) closeDropdown();
|
|
9730
9882
|
else openDropdown();
|
|
9731
9883
|
}
|
|
9732
9884
|
|
|
9733
9885
|
trigger.addEventListener("click", function (e) {
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
}, true);
|
|
9886
|
+
e.preventDefault();
|
|
9887
|
+
e.stopPropagation();
|
|
9888
|
+
toggleDropdown();
|
|
9889
|
+
});
|
|
9739
9890
|
|
|
9740
9891
|
trigger.addEventListener("keydown", function (e) {
|
|
9741
9892
|
if (disabled) return;
|
|
9742
|
-
var isVisible = popover.element && popover.element.classList.contains("visible");
|
|
9743
9893
|
switch (e.key) {
|
|
9744
9894
|
case "Enter":
|
|
9745
9895
|
case " ":
|
|
@@ -9748,14 +9898,14 @@
|
|
|
9748
9898
|
break;
|
|
9749
9899
|
case "ArrowDown":
|
|
9750
9900
|
e.preventDefault();
|
|
9751
|
-
if (!
|
|
9901
|
+
if (!isOpen) openDropdown();
|
|
9752
9902
|
break;
|
|
9753
9903
|
case "ArrowUp":
|
|
9754
9904
|
e.preventDefault();
|
|
9755
|
-
if (!
|
|
9905
|
+
if (!isOpen) openDropdown();
|
|
9756
9906
|
break;
|
|
9757
9907
|
case "Escape":
|
|
9758
|
-
if (
|
|
9908
|
+
if (isOpen) {
|
|
9759
9909
|
e.preventDefault();
|
|
9760
9910
|
closeDropdown();
|
|
9761
9911
|
}
|
|
@@ -9763,6 +9913,13 @@
|
|
|
9763
9913
|
}
|
|
9764
9914
|
});
|
|
9765
9915
|
|
|
9916
|
+
document.addEventListener("click", function (e) {
|
|
9917
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
9918
|
+
});
|
|
9919
|
+
document.addEventListener("keydown", function (e) {
|
|
9920
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
9921
|
+
});
|
|
9922
|
+
|
|
9766
9923
|
container.updateValues = function (newValues) {
|
|
9767
9924
|
values = Array.isArray(newValues) ? newValues.slice() : [];
|
|
9768
9925
|
renderTriggerContent();
|
|
@@ -9781,8 +9938,7 @@
|
|
|
9781
9938
|
disabled = !!isDisabled;
|
|
9782
9939
|
trigger.disabled = disabled;
|
|
9783
9940
|
trigger.className = triggerClasses(variant, size, disabled, values.length === 0);
|
|
9784
|
-
|
|
9785
|
-
if (disabled && isVisible) closeDropdown();
|
|
9941
|
+
if (disabled && isOpen) closeDropdown();
|
|
9786
9942
|
};
|
|
9787
9943
|
|
|
9788
9944
|
container.getValues = function () {
|
|
@@ -9880,14 +10036,6 @@
|
|
|
9880
10036
|
return Array.prototype.filter.call(arguments, Boolean).join(" ");
|
|
9881
10037
|
}
|
|
9882
10038
|
|
|
9883
|
-
function getDep(name) {
|
|
9884
|
-
if (typeof global.FlowUI !== "undefined" && typeof global.FlowUI._getComponent === "function") {
|
|
9885
|
-
var c = global.FlowUI._getComponent(name);
|
|
9886
|
-
if (c) return c;
|
|
9887
|
-
}
|
|
9888
|
-
return global[name];
|
|
9889
|
-
}
|
|
9890
|
-
|
|
9891
10039
|
/** Resolve client: use FlowUI._getComponent when bundle has captured globals, else global.superleapClient */
|
|
9892
10040
|
function getClient() {
|
|
9893
10041
|
if (global.FlowUI && typeof global.FlowUI._getComponent === "function") {
|
|
@@ -9956,10 +10104,8 @@
|
|
|
9956
10104
|
var error = null;
|
|
9957
10105
|
var searchQuery = "";
|
|
9958
10106
|
var popover = null;
|
|
9959
|
-
var
|
|
9960
|
-
|
|
9961
|
-
throw new Error("EnumMultiSelect requires Popover");
|
|
9962
|
-
}
|
|
10107
|
+
var usePopover = !!(global.Popover && typeof global.Popover.create === "function");
|
|
10108
|
+
var isOpen = false;
|
|
9963
10109
|
|
|
9964
10110
|
var container = document.createElement("div");
|
|
9965
10111
|
container.className = "enum-multiselect relative w-full group";
|
|
@@ -10061,7 +10207,13 @@
|
|
|
10061
10207
|
var content = document.createElement("div");
|
|
10062
10208
|
content.setAttribute("role", "listbox");
|
|
10063
10209
|
content.setAttribute("aria-multiselectable", "true");
|
|
10064
|
-
|
|
10210
|
+
var contentBase = "w-full min-w-[200px]";
|
|
10211
|
+
if (!usePopover) {
|
|
10212
|
+
contentBase += " absolute left-0 right-0 z-50 max-h-[30vh] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium border-1/2 border-border-primary opacity-0 invisible transition-all duration-150 ease-out group-[.open]:opacity-100 group-[.open]:visible top-full mt-1 -translate-y-1 group-[.open]:translate-y-0 flex flex-col";
|
|
10213
|
+
} else {
|
|
10214
|
+
contentBase += " max-h-[30vh] overflow-hidden flex flex-col";
|
|
10215
|
+
}
|
|
10216
|
+
content.className = contentBase;
|
|
10065
10217
|
|
|
10066
10218
|
// Search input (using InputComponent like enum-select)
|
|
10067
10219
|
var searchContainer = document.createElement("div");
|
|
@@ -10127,6 +10279,10 @@
|
|
|
10127
10279
|
content.appendChild(searchContainer);
|
|
10128
10280
|
content.appendChild(optionsList);
|
|
10129
10281
|
|
|
10282
|
+
if (!usePopover) {
|
|
10283
|
+
container.appendChild(content);
|
|
10284
|
+
}
|
|
10285
|
+
|
|
10130
10286
|
var highlightedIndex = -1;
|
|
10131
10287
|
|
|
10132
10288
|
function showLoading() {
|
|
@@ -10299,14 +10455,34 @@
|
|
|
10299
10455
|
|
|
10300
10456
|
function openDropdown() {
|
|
10301
10457
|
if (disabled) return;
|
|
10458
|
+
if (popover) {
|
|
10459
|
+
document
|
|
10460
|
+
.querySelectorAll(".enum-select, .enum-multiselect, .custom-select, .record-select, .custom-multiselect")
|
|
10461
|
+
.forEach(function (other) {
|
|
10462
|
+
if (other !== container && other.popoverInstance) {
|
|
10463
|
+
other.popoverInstance.hide();
|
|
10464
|
+
}
|
|
10465
|
+
});
|
|
10466
|
+
popover.show();
|
|
10467
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
10468
|
+
if (searchInput) {
|
|
10469
|
+
setTimeout(function () {
|
|
10470
|
+
searchInput.focus();
|
|
10471
|
+
}, 50);
|
|
10472
|
+
}
|
|
10473
|
+
return;
|
|
10474
|
+
}
|
|
10302
10475
|
document
|
|
10303
|
-
.querySelectorAll(".enum-
|
|
10476
|
+
.querySelectorAll(".enum-multiselect.open, .enum-select.open")
|
|
10304
10477
|
.forEach(function (other) {
|
|
10305
|
-
if (other !== container
|
|
10306
|
-
other.
|
|
10478
|
+
if (other !== container) {
|
|
10479
|
+
other.classList.remove("open");
|
|
10480
|
+
var t = other.querySelector("button");
|
|
10481
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
10307
10482
|
}
|
|
10308
10483
|
});
|
|
10309
|
-
|
|
10484
|
+
isOpen = true;
|
|
10485
|
+
container.classList.add("open");
|
|
10310
10486
|
trigger.setAttribute("aria-expanded", "true");
|
|
10311
10487
|
if (searchInput) {
|
|
10312
10488
|
setTimeout(function () {
|
|
@@ -10316,7 +10492,12 @@
|
|
|
10316
10492
|
}
|
|
10317
10493
|
|
|
10318
10494
|
function closeDropdown() {
|
|
10319
|
-
popover
|
|
10495
|
+
if (popover) {
|
|
10496
|
+
popover.hide();
|
|
10497
|
+
} else {
|
|
10498
|
+
isOpen = false;
|
|
10499
|
+
container.classList.remove("open");
|
|
10500
|
+
}
|
|
10320
10501
|
trigger.setAttribute("aria-expanded", "false");
|
|
10321
10502
|
highlightedIndex = -1;
|
|
10322
10503
|
clearSearch();
|
|
@@ -10324,7 +10505,9 @@
|
|
|
10324
10505
|
}
|
|
10325
10506
|
|
|
10326
10507
|
function toggleDropdown() {
|
|
10327
|
-
var isVisible = popover
|
|
10508
|
+
var isVisible = popover
|
|
10509
|
+
? popover.element && popover.element.classList.contains("visible")
|
|
10510
|
+
: isOpen;
|
|
10328
10511
|
if (isVisible) {
|
|
10329
10512
|
closeDropdown();
|
|
10330
10513
|
} else {
|
|
@@ -10404,7 +10587,10 @@
|
|
|
10404
10587
|
|
|
10405
10588
|
// Initialize Popover
|
|
10406
10589
|
function initializePopover() {
|
|
10407
|
-
|
|
10590
|
+
if (!usePopover) {
|
|
10591
|
+
return;
|
|
10592
|
+
}
|
|
10593
|
+
popover = global.Popover.create({
|
|
10408
10594
|
trigger: trigger,
|
|
10409
10595
|
content: content,
|
|
10410
10596
|
placement: "bottom",
|
|
@@ -10420,12 +10606,6 @@
|
|
|
10420
10606
|
onOpen: function () {
|
|
10421
10607
|
trigger.setAttribute("aria-expanded", "true");
|
|
10422
10608
|
chevron.style.transform = "rotate(180deg)";
|
|
10423
|
-
if (popover.panel) {
|
|
10424
|
-
var triggerWidthPx = trigger.offsetWidth + "px";
|
|
10425
|
-
popover.panel.style.setProperty("--trigger-width", triggerWidthPx);
|
|
10426
|
-
popover.panel.style.minWidth = triggerWidthPx;
|
|
10427
|
-
popover.panel.style.width = triggerWidthPx;
|
|
10428
|
-
}
|
|
10429
10609
|
},
|
|
10430
10610
|
bodyClassName: "p-0 overflow-hidden",
|
|
10431
10611
|
panelClassName: "min-w-[var(--trigger-width)] overflow-hidden",
|
|
@@ -10433,6 +10613,13 @@
|
|
|
10433
10613
|
|
|
10434
10614
|
// Store popover instance for cleanup
|
|
10435
10615
|
container.popoverInstance = popover;
|
|
10616
|
+
|
|
10617
|
+
// Set CSS variable for trigger width
|
|
10618
|
+
var triggerWidth = trigger.offsetWidth;
|
|
10619
|
+
if (popover.panel) {
|
|
10620
|
+
popover.panel.style.setProperty("--trigger-width", triggerWidth + "px");
|
|
10621
|
+
popover.panel.style.minWidth = triggerWidth + "px";
|
|
10622
|
+
}
|
|
10436
10623
|
}
|
|
10437
10624
|
|
|
10438
10625
|
// Load options from SDK
|
|
@@ -10547,6 +10734,21 @@
|
|
|
10547
10734
|
initializePopover();
|
|
10548
10735
|
loadOptions();
|
|
10549
10736
|
|
|
10737
|
+
if (!usePopover) {
|
|
10738
|
+
trigger.addEventListener("click", function (e) {
|
|
10739
|
+
e.preventDefault();
|
|
10740
|
+
e.stopPropagation();
|
|
10741
|
+
if (disabled) return;
|
|
10742
|
+
toggleDropdown();
|
|
10743
|
+
});
|
|
10744
|
+
document.addEventListener("click", function (e) {
|
|
10745
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
10746
|
+
});
|
|
10747
|
+
document.addEventListener("keydown", function (e) {
|
|
10748
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
10749
|
+
});
|
|
10750
|
+
}
|
|
10751
|
+
|
|
10550
10752
|
// Public API
|
|
10551
10753
|
container.updateValues = function (newValues) {
|
|
10552
10754
|
values = Array.isArray(newValues) ? newValues.slice() : [];
|
|
@@ -10588,7 +10790,7 @@
|
|
|
10588
10790
|
);
|
|
10589
10791
|
updateClearButton();
|
|
10590
10792
|
var isVisible = popover && popover.element && popover.element.classList.contains("visible");
|
|
10591
|
-
if (disabled && isVisible) closeDropdown();
|
|
10793
|
+
if (disabled && (isVisible || isOpen)) closeDropdown();
|
|
10592
10794
|
};
|
|
10593
10795
|
|
|
10594
10796
|
container.reload = function () {
|
|
@@ -10638,14 +10840,7 @@
|
|
|
10638
10840
|
|
|
10639
10841
|
(function (global) {
|
|
10640
10842
|
|
|
10641
|
-
|
|
10642
|
-
if (global.FlowUI && typeof global.FlowUI._getComponent === "function") {
|
|
10643
|
-
var c = global.FlowUI._getComponent(name);
|
|
10644
|
-
if (c) return c;
|
|
10645
|
-
}
|
|
10646
|
-
return global[name];
|
|
10647
|
-
}
|
|
10648
|
-
|
|
10843
|
+
var Popover = global.Popover;
|
|
10649
10844
|
var InputComponent = global.InputComponent;
|
|
10650
10845
|
var Spinner = global.Spinner;
|
|
10651
10846
|
|
|
@@ -10658,7 +10853,7 @@
|
|
|
10658
10853
|
role: { iconStr: "IconShield", color: "info" },
|
|
10659
10854
|
iframe: { iconStr: "IconLayout", color: "neutral" },
|
|
10660
10855
|
lead: { iconStr: "IconUser", color: "primary" },
|
|
10661
|
-
opportunity: { iconStr: "
|
|
10856
|
+
opportunity: { iconStr: "IconCurrencyDollar", color: "success" },
|
|
10662
10857
|
call_log: { iconStr: "IconPhone", color: "info" },
|
|
10663
10858
|
communication: { iconStr: "IconMessage", color: "primary" },
|
|
10664
10859
|
history_field: { iconStr: "IconClock", color: "neutral" },
|
|
@@ -10818,13 +11013,19 @@
|
|
|
10818
11013
|
var selectedRecords = [];
|
|
10819
11014
|
var allRecords = [];
|
|
10820
11015
|
var filteredRecords = [];
|
|
11016
|
+
var isOpen = false;
|
|
10821
11017
|
var searchTerm = "";
|
|
10822
11018
|
var searchDebounceTimer = null;
|
|
11019
|
+
var usePopover = Popover && typeof Popover.create === "function";
|
|
10823
11020
|
var popover = null;
|
|
10824
11021
|
var hasMoreRecords = true;
|
|
10825
11022
|
var currentPage = 1;
|
|
10826
11023
|
var isFetchingMore = false;
|
|
10827
11024
|
var totalFetched = 0;
|
|
11025
|
+
var contentBase = "record-multiselect-content min-w-[8rem] ";
|
|
11026
|
+
if (!usePopover) {
|
|
11027
|
+
contentBase += "absolute left-0 right-0 z-50 max-h-[30vh] overflow-hidden rounded-4 bg-fill-quarternary-fill-white shadow-default-medium opacity-0 invisible transition-all duration-150 ease-out group-[.open]:opacity-100 group-[.open]:visible ";
|
|
11028
|
+
}
|
|
10828
11029
|
|
|
10829
11030
|
// Trigger wrapper + button
|
|
10830
11031
|
var triggerWrapper = document.createElement("span");
|
|
@@ -10919,7 +11120,7 @@
|
|
|
10919
11120
|
var content = document.createElement("div");
|
|
10920
11121
|
content.setAttribute("role", "listbox");
|
|
10921
11122
|
content.setAttribute("aria-multiselectable", "true");
|
|
10922
|
-
content.className = "
|
|
11123
|
+
content.className = contentBase + (usePopover ? "max-h-[30vh] overflow-hidden flex flex-col" : "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0");
|
|
10923
11124
|
|
|
10924
11125
|
var searchWrap = document.createElement("div");
|
|
10925
11126
|
searchWrap.className = "p-8 pb-4 border-b-1/2 border-border-primary ";
|
|
@@ -10986,58 +11187,57 @@
|
|
|
10986
11187
|
|
|
10987
11188
|
content.appendChild(optionsList);
|
|
10988
11189
|
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
throw new Error("RecordMultiSelect requires Popover");
|
|
11190
|
+
if (!usePopover) {
|
|
11191
|
+
container.appendChild(content);
|
|
10992
11192
|
}
|
|
10993
|
-
|
|
10994
|
-
|
|
10995
|
-
|
|
10996
|
-
|
|
10997
|
-
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
if (other !== container && other.popoverInstance) {
|
|
11008
|
-
other.popoverInstance.hide();
|
|
11193
|
+
|
|
11194
|
+
if (usePopover) {
|
|
11195
|
+
popover = Popover.create({
|
|
11196
|
+
trigger: trigger,
|
|
11197
|
+
content: content,
|
|
11198
|
+
placement: "bottom",
|
|
11199
|
+
align: "start",
|
|
11200
|
+
closeOnClickOutside: true,
|
|
11201
|
+
bodyClassName: "p-0 overflow-hidden",
|
|
11202
|
+
panelClassName: "max-h-[30vh] overflow-hidden",
|
|
11203
|
+
onOpen: function () {
|
|
11204
|
+
if (disabled) {
|
|
11205
|
+
popover.hide();
|
|
11206
|
+
return;
|
|
11009
11207
|
}
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
searchDebounceTimer
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11208
|
+
document.querySelectorAll(".custom-select.open, .record-select.open, .custom-multiselect.open, .record-multiselect.open").forEach(function (other) {
|
|
11209
|
+
if (other !== container) {
|
|
11210
|
+
other.classList.remove("open");
|
|
11211
|
+
var t = other.querySelector("button, .custom-select-trigger, .record-select-trigger, .multiselect-trigger-wrapper button, .record-multiselect-trigger");
|
|
11212
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
11213
|
+
}
|
|
11214
|
+
});
|
|
11215
|
+
isOpen = true;
|
|
11216
|
+
container.classList.add("open");
|
|
11217
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
11218
|
+
searchTerm = "";
|
|
11219
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
11220
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
11221
|
+
content.style.minWidth = trigger.offsetWidth + "px";
|
|
11222
|
+
loadInitialAndRender();
|
|
11223
|
+
setTimeout(function () {
|
|
11224
|
+
if (searchInputEl) searchInputEl.focus();
|
|
11225
|
+
}, 0);
|
|
11226
|
+
},
|
|
11227
|
+
onClose: function () {
|
|
11228
|
+
isOpen = false;
|
|
11229
|
+
container.classList.remove("open");
|
|
11230
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
11231
|
+
searchTerm = "";
|
|
11232
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
11233
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
11234
|
+
if (searchDebounceTimer) {
|
|
11235
|
+
clearTimeout(searchDebounceTimer);
|
|
11236
|
+
searchDebounceTimer = null;
|
|
11237
|
+
}
|
|
11238
|
+
},
|
|
11239
|
+
});
|
|
11240
|
+
}
|
|
11041
11241
|
|
|
11042
11242
|
function isSelected(recordId) {
|
|
11043
11243
|
return values.some(function (v) {
|
|
@@ -11442,6 +11642,66 @@
|
|
|
11442
11642
|
}, 500);
|
|
11443
11643
|
}
|
|
11444
11644
|
|
|
11645
|
+
function openDropdown() {
|
|
11646
|
+
if (disabled) return;
|
|
11647
|
+
if (usePopover && popover) {
|
|
11648
|
+
popover.show();
|
|
11649
|
+
return;
|
|
11650
|
+
}
|
|
11651
|
+
document
|
|
11652
|
+
.querySelectorAll(".custom-select.open, .record-select.open, .custom-multiselect.open, .record-multiselect.open")
|
|
11653
|
+
.forEach(function (other) {
|
|
11654
|
+
if (other !== container) {
|
|
11655
|
+
other.classList.remove("open");
|
|
11656
|
+
var t = other.querySelector(
|
|
11657
|
+
"button, .custom-select-trigger, .record-select-trigger, .multiselect-trigger-wrapper button, .record-multiselect-trigger"
|
|
11658
|
+
);
|
|
11659
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
11660
|
+
}
|
|
11661
|
+
});
|
|
11662
|
+
isOpen = true;
|
|
11663
|
+
container.classList.add("open");
|
|
11664
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
11665
|
+
searchTerm = "";
|
|
11666
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
11667
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
11668
|
+
loadInitialAndRender();
|
|
11669
|
+
setTimeout(function () {
|
|
11670
|
+
if (searchInputEl) searchInputEl.focus();
|
|
11671
|
+
}, 0);
|
|
11672
|
+
updatePosition();
|
|
11673
|
+
}
|
|
11674
|
+
|
|
11675
|
+
function closeDropdown() {
|
|
11676
|
+
if (usePopover && popover) {
|
|
11677
|
+
popover.hide();
|
|
11678
|
+
return;
|
|
11679
|
+
}
|
|
11680
|
+
isOpen = false;
|
|
11681
|
+
container.classList.remove("open");
|
|
11682
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
11683
|
+
searchTerm = "";
|
|
11684
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
11685
|
+
else if (searchInputEl) searchInputEl.value = "";
|
|
11686
|
+
if (searchDebounceTimer) {
|
|
11687
|
+
clearTimeout(searchDebounceTimer);
|
|
11688
|
+
searchDebounceTimer = null;
|
|
11689
|
+
}
|
|
11690
|
+
}
|
|
11691
|
+
|
|
11692
|
+
function updatePosition() {
|
|
11693
|
+
if (usePopover) return;
|
|
11694
|
+
var rect = trigger.getBoundingClientRect();
|
|
11695
|
+
var vh = window.innerHeight;
|
|
11696
|
+
var below = vh - rect.bottom;
|
|
11697
|
+
var above = rect.top;
|
|
11698
|
+
if (below < 200 && above > below) {
|
|
11699
|
+
content.className = contentBase + "bottom-full mb-1 translate-y-1 group-[.open]:translate-y-0";
|
|
11700
|
+
} else {
|
|
11701
|
+
content.className = contentBase + "top-full mt-1 -translate-y-1 group-[.open]:translate-y-0";
|
|
11702
|
+
}
|
|
11703
|
+
}
|
|
11704
|
+
|
|
11445
11705
|
if (!searchInputWrapper && searchInputEl) {
|
|
11446
11706
|
searchInputEl.addEventListener("input", function () {
|
|
11447
11707
|
searchTerm = this.value.trim();
|
|
@@ -11458,19 +11718,41 @@
|
|
|
11458
11718
|
});
|
|
11459
11719
|
}
|
|
11460
11720
|
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
|
|
11469
|
-
|
|
11721
|
+
if (usePopover && popover) {
|
|
11722
|
+
trigger.addEventListener("keydown", function (e) {
|
|
11723
|
+
if (disabled) return;
|
|
11724
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
11725
|
+
e.preventDefault();
|
|
11726
|
+
if (isOpen) popover.hide();
|
|
11727
|
+
else popover.show();
|
|
11728
|
+
}
|
|
11729
|
+
});
|
|
11730
|
+
} else {
|
|
11731
|
+
trigger.addEventListener("click", function (e) {
|
|
11470
11732
|
e.preventDefault();
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11733
|
+
e.stopPropagation();
|
|
11734
|
+
if (isOpen) closeDropdown();
|
|
11735
|
+
else openDropdown();
|
|
11736
|
+
});
|
|
11737
|
+
trigger.addEventListener("keydown", function (e) {
|
|
11738
|
+
if (disabled) return;
|
|
11739
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
11740
|
+
e.preventDefault();
|
|
11741
|
+
if (isOpen) closeDropdown();
|
|
11742
|
+
else openDropdown();
|
|
11743
|
+
}
|
|
11744
|
+
if (e.key === "Escape" && isOpen) {
|
|
11745
|
+
e.preventDefault();
|
|
11746
|
+
closeDropdown();
|
|
11747
|
+
}
|
|
11748
|
+
});
|
|
11749
|
+
document.addEventListener("click", function (e) {
|
|
11750
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
11751
|
+
});
|
|
11752
|
+
document.addEventListener("keydown", function (e) {
|
|
11753
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
11754
|
+
});
|
|
11755
|
+
}
|
|
11474
11756
|
|
|
11475
11757
|
container.updateValues = function (newValues) {
|
|
11476
11758
|
values = Array.isArray(newValues) ? newValues.slice() : [];
|
|
@@ -11481,8 +11763,7 @@
|
|
|
11481
11763
|
disabled = !!isDisabled;
|
|
11482
11764
|
trigger.disabled = disabled;
|
|
11483
11765
|
trigger.className = triggerClasses(variant, size, disabled, values.length === 0);
|
|
11484
|
-
|
|
11485
|
-
if (disabled && isVisible) popover.hide();
|
|
11766
|
+
if (disabled && isOpen) closeDropdown();
|
|
11486
11767
|
};
|
|
11487
11768
|
|
|
11488
11769
|
container.getValues = function () {
|
|
@@ -13315,12 +13596,12 @@
|
|
|
13315
13596
|
if (periodColumn) periodColumn.scrollToSelected();
|
|
13316
13597
|
}
|
|
13317
13598
|
|
|
13318
|
-
// Trigger must be in DOM before Popover.create() so Popover can wrap it and insert its panel into the document.
|
|
13319
|
-
container.appendChild(trigger);
|
|
13320
|
-
|
|
13321
13599
|
var Popover = getDep("Popover");
|
|
13322
13600
|
if (!Popover || typeof Popover.create !== "function") {
|
|
13323
|
-
|
|
13601
|
+
container.appendChild(trigger);
|
|
13602
|
+
container.updateValue = function (newVal) { value = typeof newVal === "string" ? newVal : ""; };
|
|
13603
|
+
container.setDisabled = function (isDisabled) { trigger.disabled = !!isDisabled; };
|
|
13604
|
+
return container;
|
|
13324
13605
|
}
|
|
13325
13606
|
var popover = Popover.create({
|
|
13326
13607
|
trigger: trigger,
|
|
@@ -13341,6 +13622,8 @@
|
|
|
13341
13622
|
});
|
|
13342
13623
|
hidePopover = popover.hide;
|
|
13343
13624
|
|
|
13625
|
+
container.appendChild(trigger);
|
|
13626
|
+
|
|
13344
13627
|
container.updateValue = function (newVal) {
|
|
13345
13628
|
value = typeof newVal === "string" ? newVal : "";
|
|
13346
13629
|
var p = parseValue(value);
|
|
@@ -14488,7 +14771,7 @@
|
|
|
14488
14771
|
variant = "outline";
|
|
14489
14772
|
}
|
|
14490
14773
|
var btnClassName = join(
|
|
14491
|
-
"!text-reg-12 my-2 flex-1",
|
|
14774
|
+
"!text-reg-12 my-2 flex-1 !px-0 !py-0",
|
|
14492
14775
|
cell.currentMonth ? "" : "text-typography-quaternary-text"
|
|
14493
14776
|
);
|
|
14494
14777
|
var btn = Button.create({
|
|
@@ -15633,13 +15916,15 @@
|
|
|
15633
15916
|
e.stopPropagation();
|
|
15634
15917
|
navigator.clipboard.writeText(fileUrl).then(
|
|
15635
15918
|
function () {
|
|
15636
|
-
if (global.FlowUI && global.FlowUI.
|
|
15637
|
-
|
|
15919
|
+
if (global.FlowUI && global.FlowUI.renderAlerts) {
|
|
15920
|
+
const ac = document.getElementById("alerts");
|
|
15921
|
+
if (ac) global.FlowUI.renderAlerts(ac, ["Link copied"], "success");
|
|
15638
15922
|
}
|
|
15639
15923
|
},
|
|
15640
15924
|
function () {
|
|
15641
|
-
if (global.FlowUI && global.FlowUI.
|
|
15642
|
-
|
|
15925
|
+
if (global.FlowUI && global.FlowUI.renderAlerts) {
|
|
15926
|
+
const ac = document.getElementById("alerts");
|
|
15927
|
+
if (ac) global.FlowUI.renderAlerts(ac, ["Copy failed"], "error");
|
|
15643
15928
|
}
|
|
15644
15929
|
}
|
|
15645
15930
|
);
|
|
@@ -15835,8 +16120,11 @@
|
|
|
15835
16120
|
async function uploadFile(file) {
|
|
15836
16121
|
const error = validateFile(file);
|
|
15837
16122
|
if (error) {
|
|
15838
|
-
if (global.FlowUI && global.FlowUI.
|
|
15839
|
-
|
|
16123
|
+
if (global.FlowUI && global.FlowUI.renderAlerts) {
|
|
16124
|
+
const alertsContainer = document.getElementById("alerts");
|
|
16125
|
+
if (alertsContainer) {
|
|
16126
|
+
global.FlowUI.renderAlerts(alertsContainer, [error], "error");
|
|
16127
|
+
}
|
|
15840
16128
|
}
|
|
15841
16129
|
return;
|
|
15842
16130
|
}
|
|
@@ -15864,8 +16152,15 @@
|
|
|
15864
16152
|
uploadingFiles = uploadingFiles.filter((f) => f.file !== file);
|
|
15865
16153
|
renderUploadingList();
|
|
15866
16154
|
updateStatus();
|
|
15867
|
-
if (global.FlowUI && global.FlowUI.
|
|
15868
|
-
|
|
16155
|
+
if (global.FlowUI && global.FlowUI.renderAlerts) {
|
|
16156
|
+
const alertsContainer = document.getElementById("alerts");
|
|
16157
|
+
if (alertsContainer) {
|
|
16158
|
+
global.FlowUI.renderAlerts(
|
|
16159
|
+
alertsContainer,
|
|
16160
|
+
[`Failed to upload "${file.name}": ${error.message}`],
|
|
16161
|
+
"error"
|
|
16162
|
+
);
|
|
16163
|
+
}
|
|
15869
16164
|
}
|
|
15870
16165
|
}
|
|
15871
16166
|
}
|
|
@@ -15878,8 +16173,11 @@
|
|
|
15878
16173
|
// Check max files limit
|
|
15879
16174
|
if (multiple && maxFiles && uploadedFiles.length + files.length > maxFiles) {
|
|
15880
16175
|
const message = `You can only upload ${maxFiles} file${maxFiles !== 1 ? "s" : ""}`;
|
|
15881
|
-
if (global.FlowUI && global.FlowUI.
|
|
15882
|
-
|
|
16176
|
+
if (global.FlowUI && global.FlowUI.renderAlerts) {
|
|
16177
|
+
const alertsContainer = document.getElementById("alerts");
|
|
16178
|
+
if (alertsContainer) {
|
|
16179
|
+
global.FlowUI.renderAlerts(alertsContainer, [message], "error");
|
|
16180
|
+
}
|
|
15883
16181
|
}
|
|
15884
16182
|
input.value = "";
|
|
15885
16183
|
return;
|
|
@@ -16526,7 +16824,7 @@
|
|
|
16526
16824
|
},
|
|
16527
16825
|
});
|
|
16528
16826
|
document.dispatchEvent(event);
|
|
16529
|
-
console.log("[Superleap-Flow] Library ready - v2.
|
|
16827
|
+
console.log("[Superleap-Flow] Library ready - v2.2.9");
|
|
16530
16828
|
}
|
|
16531
16829
|
|
|
16532
16830
|
// Wait for DOM to be ready before dispatching event
|