@superleapai/flow-ui 2.4.5 → 2.4.7
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/popover.js +63 -12
- package/components/record-multiselect.js +12 -1
- package/components/record-select.js +204 -107
- package/core/flow.js +4 -0
- package/dist/output.css +1 -1
- package/dist/superleap-flow.js +383 -681
- package/dist/superleap-flow.js.map +1 -1
- package/dist/superleap-flow.min.js +2 -2
- package/package.json +1 -1
package/components/popover.js
CHANGED
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
document.body.appendChild(wrapper);
|
|
99
99
|
|
|
100
100
|
var backdropEl = null;
|
|
101
|
+
var resizeObserver = null;
|
|
101
102
|
|
|
102
103
|
function onBackdropWheel(e) {
|
|
103
104
|
e.preventDefault();
|
|
@@ -107,15 +108,18 @@
|
|
|
107
108
|
if (!modal) return;
|
|
108
109
|
if (!backdropEl) {
|
|
109
110
|
backdropEl = document.createElement("div");
|
|
110
|
-
backdropEl.className =
|
|
111
|
+
backdropEl.className =
|
|
112
|
+
"fixed inset-0 z-40 bg-transparent pointer-events-auto";
|
|
111
113
|
backdropEl.setAttribute("aria-hidden", "true");
|
|
112
114
|
backdropEl.addEventListener("click", function () {
|
|
113
115
|
hide();
|
|
114
116
|
});
|
|
115
|
-
backdropEl.addEventListener("wheel", onBackdropWheel, {
|
|
117
|
+
backdropEl.addEventListener("wheel", onBackdropWheel, {
|
|
118
|
+
passive: false,
|
|
119
|
+
});
|
|
116
120
|
}
|
|
117
121
|
document.body.appendChild(backdropEl);
|
|
118
|
-
wrapper.style.zIndex = "";
|
|
122
|
+
wrapper.style.zIndex = "999";
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
function applyModalClose() {
|
|
@@ -132,8 +136,10 @@
|
|
|
132
136
|
const triggerRect = triggerEl.getBoundingClientRect();
|
|
133
137
|
const panelRect = panel.getBoundingClientRect();
|
|
134
138
|
const gap = 8;
|
|
135
|
-
const viewportHeight =
|
|
136
|
-
|
|
139
|
+
const viewportHeight =
|
|
140
|
+
window.innerHeight || document.documentElement.clientHeight;
|
|
141
|
+
const viewportWidth =
|
|
142
|
+
window.innerWidth || document.documentElement.clientWidth;
|
|
137
143
|
const spaceBelow = viewportHeight - triggerRect.bottom;
|
|
138
144
|
const spaceAbove = triggerRect.top;
|
|
139
145
|
const spaceRight = viewportWidth - triggerRect.right;
|
|
@@ -141,13 +147,29 @@
|
|
|
141
147
|
|
|
142
148
|
// Flip placement when there is not enough space (prefer requested side, flip only when needed)
|
|
143
149
|
let effectivePlacement = placement;
|
|
144
|
-
if (
|
|
150
|
+
if (
|
|
151
|
+
placement === "bottom" &&
|
|
152
|
+
spaceBelow < panelRect.height + gap &&
|
|
153
|
+
spaceAbove >= panelRect.height + gap
|
|
154
|
+
) {
|
|
145
155
|
effectivePlacement = "top";
|
|
146
|
-
} else if (
|
|
156
|
+
} else if (
|
|
157
|
+
placement === "top" &&
|
|
158
|
+
spaceAbove < panelRect.height + gap &&
|
|
159
|
+
spaceBelow >= panelRect.height + gap
|
|
160
|
+
) {
|
|
147
161
|
effectivePlacement = "bottom";
|
|
148
|
-
} else if (
|
|
162
|
+
} else if (
|
|
163
|
+
placement === "right" &&
|
|
164
|
+
spaceRight < panelRect.width + gap &&
|
|
165
|
+
spaceLeft >= panelRect.width + gap
|
|
166
|
+
) {
|
|
149
167
|
effectivePlacement = "left";
|
|
150
|
-
} else if (
|
|
168
|
+
} else if (
|
|
169
|
+
placement === "left" &&
|
|
170
|
+
spaceLeft < panelRect.width + gap &&
|
|
171
|
+
spaceRight >= panelRect.width + gap
|
|
172
|
+
) {
|
|
151
173
|
effectivePlacement = "right";
|
|
152
174
|
}
|
|
153
175
|
|
|
@@ -155,8 +177,18 @@
|
|
|
155
177
|
|
|
156
178
|
let top = 0;
|
|
157
179
|
let left = 0;
|
|
158
|
-
const alignLeft =
|
|
159
|
-
|
|
180
|
+
const alignLeft =
|
|
181
|
+
align === "center"
|
|
182
|
+
? (triggerRect.width - panelRect.width) / 2
|
|
183
|
+
: align === "end"
|
|
184
|
+
? triggerRect.width - panelRect.width
|
|
185
|
+
: 0;
|
|
186
|
+
const alignTop =
|
|
187
|
+
align === "center"
|
|
188
|
+
? (triggerRect.height - panelRect.height) / 2
|
|
189
|
+
: align === "end"
|
|
190
|
+
? triggerRect.height - panelRect.height
|
|
191
|
+
: 0;
|
|
160
192
|
|
|
161
193
|
switch (effectivePlacement) {
|
|
162
194
|
case "bottom":
|
|
@@ -193,6 +225,10 @@
|
|
|
193
225
|
wrapper.setAttribute("aria-hidden", "true");
|
|
194
226
|
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
195
227
|
window.removeEventListener("resize", onScrollOrResize);
|
|
228
|
+
if (resizeObserver && panel) {
|
|
229
|
+
resizeObserver.disconnect();
|
|
230
|
+
resizeObserver = null;
|
|
231
|
+
}
|
|
196
232
|
applyModalClose();
|
|
197
233
|
if (onClose) onClose();
|
|
198
234
|
}
|
|
@@ -206,11 +242,22 @@
|
|
|
206
242
|
applyModalOpen();
|
|
207
243
|
requestAnimationFrame(function () {
|
|
208
244
|
position();
|
|
209
|
-
wrapper.classList.remove(
|
|
245
|
+
wrapper.classList.remove(
|
|
246
|
+
"invisible",
|
|
247
|
+
"opacity-0",
|
|
248
|
+
"pointer-events-none",
|
|
249
|
+
);
|
|
210
250
|
wrapper.classList.add("visible", "opacity-100", "pointer-events-auto");
|
|
211
251
|
wrapper.setAttribute("aria-hidden", "false");
|
|
212
252
|
window.addEventListener("scroll", onScrollOrResize, true);
|
|
213
253
|
window.addEventListener("resize", onScrollOrResize);
|
|
254
|
+
// Re-position when panel content size changes (e.g. async record list load in record-select)
|
|
255
|
+
if (typeof ResizeObserver !== "undefined" && !resizeObserver) {
|
|
256
|
+
resizeObserver = new ResizeObserver(function () {
|
|
257
|
+
if (wrapper.classList.contains("visible")) position();
|
|
258
|
+
});
|
|
259
|
+
resizeObserver.observe(panel);
|
|
260
|
+
}
|
|
214
261
|
requestAnimationFrame(function () {
|
|
215
262
|
requestAnimationFrame(function () {
|
|
216
263
|
panel.setAttribute("data-state", "open");
|
|
@@ -222,6 +269,10 @@
|
|
|
222
269
|
function destroy() {
|
|
223
270
|
hide();
|
|
224
271
|
applyModalClose();
|
|
272
|
+
if (resizeObserver && panel) {
|
|
273
|
+
resizeObserver.disconnect();
|
|
274
|
+
resizeObserver = null;
|
|
275
|
+
}
|
|
225
276
|
if (backdropEl && backdropEl.parentNode) {
|
|
226
277
|
backdropEl.parentNode.removeChild(backdropEl);
|
|
227
278
|
}
|
|
@@ -152,6 +152,7 @@
|
|
|
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: [...] })
|
|
155
156
|
* @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)
|
|
156
157
|
* @returns {HTMLElement} Record multiselect container element
|
|
157
158
|
*/
|
|
@@ -166,6 +167,7 @@
|
|
|
166
167
|
var variant = config.variant || "default";
|
|
167
168
|
var size = config.size || "default";
|
|
168
169
|
var initialLimit = config.initialLimit != null ? config.initialLimit : 50;
|
|
170
|
+
var initialFilter = config.initialFilter || null; // Can be array, object, or function returning either
|
|
169
171
|
var displayFields = config.displayFields || [];
|
|
170
172
|
|
|
171
173
|
var disabled = config.disabled === true;
|
|
@@ -463,14 +465,23 @@
|
|
|
463
465
|
try {
|
|
464
466
|
if (model && typeof model.select === "function") {
|
|
465
467
|
var q = model.select.apply(model, fields);
|
|
468
|
+
var filters = [];
|
|
469
|
+
var resolvedFilter = typeof initialFilter === 'function' ? initialFilter() : initialFilter;
|
|
470
|
+
console.log('[RecordMultiselect] initialFilter:', resolvedFilter, '| search:', search);
|
|
471
|
+
if (resolvedFilter) {
|
|
472
|
+
filters = filters.concat(Array.isArray(resolvedFilter) ? resolvedFilter : [resolvedFilter]);
|
|
473
|
+
}
|
|
466
474
|
if (search && search.trim()) {
|
|
467
|
-
|
|
475
|
+
filters.push({
|
|
468
476
|
or: [
|
|
469
477
|
{ field: "name", operator: "contains", value: search.trim() },
|
|
470
478
|
{ field: "id", operator: "eq", value: search.trim() },
|
|
471
479
|
],
|
|
472
480
|
});
|
|
473
481
|
}
|
|
482
|
+
if (filters.length > 0) {
|
|
483
|
+
q = q.filterBy(filters.length === 1 ? filters[0] : { and: filters });
|
|
484
|
+
}
|
|
474
485
|
var orderBy = ["name"];
|
|
475
486
|
if (objectSlug === "account") orderBy.push("-ParentId");
|
|
476
487
|
return q
|