@superleapai/flow-ui 2.4.6 → 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.
@@ -79,7 +79,11 @@
79
79
  const body = document.createElement("div");
80
80
  body.className =
81
81
  bodyClassName ||
82
- "text-reg-14 text-typography-secondary-text leading-5 [&_p]:mb-2 [&_p:last-child]:mb-0";
82
+ "text-reg-14 text-typography-secondary-text leading-5 [&_p]:mb-2 [&_p:last-child]:mb-0 max-h-[90vh] overflow-y-auto overflow-x-hidden min-h-0";
83
+ body.style.maxHeight = "90vh";
84
+ body.style.overflowY = "auto";
85
+ body.style.overflowX = "hidden";
86
+ body.style.minHeight = "0";
83
87
  if (panelClassName) {
84
88
  panel.className = panel.className + " " + panelClassName;
85
89
  }
@@ -104,12 +108,15 @@
104
108
  if (!modal) return;
105
109
  if (!backdropEl) {
106
110
  backdropEl = document.createElement("div");
107
- backdropEl.className = "fixed inset-0 z-[9998] bg-transparent pointer-events-auto";
111
+ backdropEl.className =
112
+ "fixed inset-0 z-40 bg-transparent pointer-events-auto";
108
113
  backdropEl.setAttribute("aria-hidden", "true");
109
114
  backdropEl.addEventListener("click", function () {
110
115
  hide();
111
116
  });
112
- backdropEl.addEventListener("wheel", onBackdropWheel, { passive: false });
117
+ backdropEl.addEventListener("wheel", onBackdropWheel, {
118
+ passive: false,
119
+ });
113
120
  }
114
121
  document.body.appendChild(backdropEl);
115
122
  wrapper.style.zIndex = "999";
@@ -129,8 +136,10 @@
129
136
  const triggerRect = triggerEl.getBoundingClientRect();
130
137
  const panelRect = panel.getBoundingClientRect();
131
138
  const gap = 8;
132
- const viewportHeight = window.innerHeight || document.documentElement.clientHeight;
133
- const viewportWidth = window.innerWidth || document.documentElement.clientWidth;
139
+ const viewportHeight =
140
+ window.innerHeight || document.documentElement.clientHeight;
141
+ const viewportWidth =
142
+ window.innerWidth || document.documentElement.clientWidth;
134
143
  const spaceBelow = viewportHeight - triggerRect.bottom;
135
144
  const spaceAbove = triggerRect.top;
136
145
  const spaceRight = viewportWidth - triggerRect.right;
@@ -138,13 +147,29 @@
138
147
 
139
148
  // Flip placement when there is not enough space (prefer requested side, flip only when needed)
140
149
  let effectivePlacement = placement;
141
- if (placement === "bottom" && spaceBelow < panelRect.height + gap && spaceAbove >= panelRect.height + gap) {
150
+ if (
151
+ placement === "bottom" &&
152
+ spaceBelow < panelRect.height + gap &&
153
+ spaceAbove >= panelRect.height + gap
154
+ ) {
142
155
  effectivePlacement = "top";
143
- } else if (placement === "top" && spaceAbove < panelRect.height + gap && spaceBelow >= panelRect.height + gap) {
156
+ } else if (
157
+ placement === "top" &&
158
+ spaceAbove < panelRect.height + gap &&
159
+ spaceBelow >= panelRect.height + gap
160
+ ) {
144
161
  effectivePlacement = "bottom";
145
- } else if (placement === "right" && spaceRight < panelRect.width + gap && spaceLeft >= panelRect.width + gap) {
162
+ } else if (
163
+ placement === "right" &&
164
+ spaceRight < panelRect.width + gap &&
165
+ spaceLeft >= panelRect.width + gap
166
+ ) {
146
167
  effectivePlacement = "left";
147
- } else if (placement === "left" && spaceLeft < panelRect.width + gap && spaceRight >= panelRect.width + gap) {
168
+ } else if (
169
+ placement === "left" &&
170
+ spaceLeft < panelRect.width + gap &&
171
+ spaceRight >= panelRect.width + gap
172
+ ) {
148
173
  effectivePlacement = "right";
149
174
  }
150
175
 
@@ -152,8 +177,18 @@
152
177
 
153
178
  let top = 0;
154
179
  let left = 0;
155
- const alignLeft = (align === "center" ? (triggerRect.width - panelRect.width) / 2 : align === "end" ? triggerRect.width - panelRect.width : 0);
156
- const alignTop = (align === "center" ? (triggerRect.height - panelRect.height) / 2 : align === "end" ? triggerRect.height - panelRect.height : 0);
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;
157
192
 
158
193
  switch (effectivePlacement) {
159
194
  case "bottom":
@@ -207,7 +242,11 @@
207
242
  applyModalOpen();
208
243
  requestAnimationFrame(function () {
209
244
  position();
210
- wrapper.classList.remove("invisible", "opacity-0", "pointer-events-none");
245
+ wrapper.classList.remove(
246
+ "invisible",
247
+ "opacity-0",
248
+ "pointer-events-none",
249
+ );
211
250
  wrapper.classList.add("visible", "opacity-100", "pointer-events-auto");
212
251
  wrapper.setAttribute("aria-hidden", "false");
213
252
  window.addEventListener("scroll", onScrollOrResize, true);
@@ -288,6 +327,8 @@
288
327
  show,
289
328
  hide,
290
329
  destroy,
330
+ /** Re-run positioning (e.g. after async content load). Call when panel size changes. */
331
+ updatePosition: position,
291
332
  setContent(newContent) {
292
333
  body.innerHTML = "";
293
334
  if (typeof newContent === "string") {
@@ -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
- q = q.filterBy({
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