@superleapai/flow-ui 1.0.0
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/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +451 -0
- package/components/alert.js +282 -0
- package/components/avatar.js +195 -0
- package/components/badge.js +135 -0
- package/components/button.js +201 -0
- package/components/checkbox.js +254 -0
- package/components/currency.js +227 -0
- package/components/date-time-picker/date-time-picker-utils.js +253 -0
- package/components/date-time-picker/date-time-picker.js +532 -0
- package/components/duration/duration-constants.js +46 -0
- package/components/duration/duration-utils.js +164 -0
- package/components/duration/duration.js +448 -0
- package/components/enum-multiselect.js +869 -0
- package/components/enum-select.js +831 -0
- package/components/enumeration.js +213 -0
- package/components/file-input.js +533 -0
- package/components/icon.js +200 -0
- package/components/input.js +259 -0
- package/components/label.js +111 -0
- package/components/multiselect.js +351 -0
- package/components/phone-input/phone-input.js +392 -0
- package/components/phone-input/phone-utils.js +157 -0
- package/components/popover.js +240 -0
- package/components/radio-group.js +435 -0
- package/components/record-multiselect.js +956 -0
- package/components/record-select.js +930 -0
- package/components/select.js +544 -0
- package/components/spinner.js +136 -0
- package/components/table.js +335 -0
- package/components/textarea.js +114 -0
- package/components/time-picker.js +357 -0
- package/components/toast.js +343 -0
- package/core/flow.js +1729 -0
- package/core/superleapClient.js +146 -0
- package/dist/output.css +2 -0
- package/index.d.ts +458 -0
- package/index.js +253 -0
- package/package.json +70 -0
|
@@ -0,0 +1,869 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EnumMultiSelect Component (vanilla JS, Tailwind)
|
|
3
|
+
* A multiselect component that fetches options from SuperLeap SDK based on object column metadata.
|
|
4
|
+
* Supports dependent fields, URL-based enums, and search functionality.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* var enumMultiSelect = EnumMultiSelect.create({
|
|
8
|
+
* fieldId: 'tags',
|
|
9
|
+
* objectSlug: 'accounts',
|
|
10
|
+
* columnSlug: 'tags',
|
|
11
|
+
* value: ['tag1', 'tag2'],
|
|
12
|
+
* onChange: function(values) { console.log('Selected:', values); },
|
|
13
|
+
* placeholder: 'Select tags',
|
|
14
|
+
* label: 'selected',
|
|
15
|
+
* variant: 'default',
|
|
16
|
+
* size: 'default',
|
|
17
|
+
* disabled: false,
|
|
18
|
+
* currentRecordData: { ... }, // Optional: for dependent fields
|
|
19
|
+
* canClear: true,
|
|
20
|
+
* onClear: function() { console.log('Cleared'); }
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
(function (global) {
|
|
25
|
+
"use strict";
|
|
26
|
+
|
|
27
|
+
var CHEVRON_SVG =
|
|
28
|
+
'<svg width="16" height="16" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/></svg>';
|
|
29
|
+
|
|
30
|
+
var CHECK_SVG =
|
|
31
|
+
'<svg width="14" height="14" viewBox="0 0 15 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.4669 3.72684C11.7558 3.41574 12.2442 3.41574 12.5331 3.72684C12.822 4.03795 12.822 4.53753 12.5331 4.84863L6.81767 10.6736C6.52329 10.9901 6.05308 10.9901 5.7587 10.6736L2.46685 7.3463C2.17795 7.03519 2.17795 6.53561 2.46685 6.2245C2.75575 5.9134 3.24395 5.9134 3.53285 6.2245L6.28822 9.05351L11.4669 3.72684Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"/></svg>';
|
|
32
|
+
|
|
33
|
+
var X_SVG =
|
|
34
|
+
'<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M18 6L6 18M6 6l12 12"/></svg>';
|
|
35
|
+
|
|
36
|
+
var SEARCH_ICON =
|
|
37
|
+
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>';
|
|
38
|
+
|
|
39
|
+
function triggerClasses(variant, size, disabled, isEmpty, hasClear) {
|
|
40
|
+
var v = variant || "default";
|
|
41
|
+
var base =
|
|
42
|
+
"w-full items-center justify-between rounded-4 border-1/2 bg-fill-quarternary-fill-white !text-reg-13 focus:outline-none flex h-full truncate hover:cursor-pointer ";
|
|
43
|
+
var variantClasses = {
|
|
44
|
+
default:
|
|
45
|
+
"border-border-primary hover:border-primary-border focus:border-1/2 focus:border-primary-border",
|
|
46
|
+
error:
|
|
47
|
+
"border-error-border hover:border-error-border-hover focus:border-1/2 focus:border-error-border-hover",
|
|
48
|
+
warning:
|
|
49
|
+
"border-warning-border hover:border-warning-border-hover focus:border-1/2 focus:border-warning-border-hover",
|
|
50
|
+
borderless: "border-none shadow-none rounded-0 bg-fill-quarternary-fill-white",
|
|
51
|
+
inline:
|
|
52
|
+
"focus:border-transparent border border-transparent shadow-none rounded-0 bg-fill-quarternary-fill-white hover:bg-fill-tertiary-fill-light-gray hover:border-transparent",
|
|
53
|
+
};
|
|
54
|
+
var sizeClasses = {
|
|
55
|
+
default: "px-12 py-6",
|
|
56
|
+
large: "px-12 py-8",
|
|
57
|
+
small: "px-8 py-4",
|
|
58
|
+
};
|
|
59
|
+
var textColorClass = isEmpty ? " text-typography-quaternary-text" : " text-typography-primary-text";
|
|
60
|
+
var disabledClass = disabled
|
|
61
|
+
? " pointer-events-none cursor-not-allowed bg-fill-tertiary-fill-light-gray text-typography-quaternary-text hover:border-border-primary"
|
|
62
|
+
: "";
|
|
63
|
+
var clearPadding = hasClear ? " pr-24" : "";
|
|
64
|
+
return (
|
|
65
|
+
base +
|
|
66
|
+
(variantClasses[v] || variantClasses.default) +
|
|
67
|
+
" " +
|
|
68
|
+
(sizeClasses[size] || sizeClasses.default) +
|
|
69
|
+
textColorClass +
|
|
70
|
+
disabledClass +
|
|
71
|
+
clearPadding
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function join() {
|
|
76
|
+
return Array.prototype.filter.call(arguments, Boolean).join(" ");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Resolve client: use FlowUI._getComponent when bundle has captured globals, else global.superleapClient */
|
|
80
|
+
function getClient() {
|
|
81
|
+
if (global.FlowUI && typeof global.FlowUI._getComponent === "function") {
|
|
82
|
+
var c = global.FlowUI._getComponent("superleapClient");
|
|
83
|
+
if (c) return c;
|
|
84
|
+
}
|
|
85
|
+
return global.superleapClient;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Resolve Icon component for badge_config icon_color / start_icon */
|
|
89
|
+
function getIcon() {
|
|
90
|
+
if (global.FlowUI && typeof global.FlowUI._getComponent === "function") {
|
|
91
|
+
var c = global.FlowUI._getComponent("Icon");
|
|
92
|
+
if (c) return c;
|
|
93
|
+
}
|
|
94
|
+
return global.Icon;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Create an enum-based multiselect component
|
|
99
|
+
* @param {Object} config
|
|
100
|
+
* @param {string} config.fieldId - Field ID for state management
|
|
101
|
+
* @param {string} config.objectSlug - Object slug (e.g., 'accounts')
|
|
102
|
+
* @param {string} config.columnSlug - Column slug (e.g., 'tags')
|
|
103
|
+
* @param {string} config.placeholder - Placeholder text
|
|
104
|
+
* @param {Array} config.value - Current selected values (array)
|
|
105
|
+
* @param {string} [config.label] - Label for summary when items selected (e.g. "selected" -> "3 selected")
|
|
106
|
+
* @param {Function} config.onChange - Change handler (values: string[])
|
|
107
|
+
* @param {boolean} config.disabled - Whether multiselect is disabled
|
|
108
|
+
* @param {string} [config.variant] - 'default' | 'error' | 'warning' | 'borderless' | 'inline'
|
|
109
|
+
* @param {string} [config.size] - 'default' | 'large' | 'small'
|
|
110
|
+
* @param {boolean} [config.canClear] - Show clear button when values are set
|
|
111
|
+
* @param {Function} [config.onClear] - Called when clear is clicked
|
|
112
|
+
* @param {Object} [config.currentRecordData] - Current record data for dependent fields
|
|
113
|
+
* @param {boolean} [config.showSearch] - Show search input (default: true if more than 10 options)
|
|
114
|
+
* @param {Function} [config.onLoad] - Called when options are loaded
|
|
115
|
+
* @param {Function} [config.onError] - Called when error occurs
|
|
116
|
+
* @returns {HTMLElement} MultiSelect container element
|
|
117
|
+
*/
|
|
118
|
+
function createEnumMultiSelect(config) {
|
|
119
|
+
var fieldId = config.fieldId;
|
|
120
|
+
var objectSlug = config.objectSlug;
|
|
121
|
+
var columnSlug = config.columnSlug;
|
|
122
|
+
var placeholder = config.placeholder || "Select options";
|
|
123
|
+
var summaryLabel = config.label || "selected";
|
|
124
|
+
var onChange = config.onChange;
|
|
125
|
+
var variant = config.variant || "default";
|
|
126
|
+
var size = config.size || "default";
|
|
127
|
+
var canClear = !!config.canClear;
|
|
128
|
+
var onClear = config.onClear;
|
|
129
|
+
var currentRecordData = config.currentRecordData || {};
|
|
130
|
+
var showSearch = config.showSearch;
|
|
131
|
+
var onLoad = config.onLoad;
|
|
132
|
+
var onError = config.onError;
|
|
133
|
+
|
|
134
|
+
var disabled = config.disabled === true;
|
|
135
|
+
var values = Array.isArray(config.value)
|
|
136
|
+
? config.value.slice()
|
|
137
|
+
: Array.isArray(config.values)
|
|
138
|
+
? config.values.slice()
|
|
139
|
+
: [];
|
|
140
|
+
|
|
141
|
+
// State
|
|
142
|
+
var options = [];
|
|
143
|
+
var columnData = null;
|
|
144
|
+
var isLoading = true;
|
|
145
|
+
var error = null;
|
|
146
|
+
var searchQuery = "";
|
|
147
|
+
var popover = null;
|
|
148
|
+
var usePopover = !!(global.Popover && typeof global.Popover.create === "function");
|
|
149
|
+
var isOpen = false;
|
|
150
|
+
|
|
151
|
+
var container = document.createElement("div");
|
|
152
|
+
container.className = "enum-multiselect relative w-full group";
|
|
153
|
+
container.setAttribute("data-field-id", fieldId);
|
|
154
|
+
|
|
155
|
+
var triggerWrapper = document.createElement("span");
|
|
156
|
+
triggerWrapper.className =
|
|
157
|
+
"multiselect-trigger-wrapper relative flex w-full items-center justify-between gap-8";
|
|
158
|
+
|
|
159
|
+
var trigger = document.createElement("button");
|
|
160
|
+
trigger.type = "button";
|
|
161
|
+
trigger.className = triggerClasses(variant, size, disabled, values.length === 0, canClear && values.length > 0 && !disabled);
|
|
162
|
+
trigger.disabled = disabled;
|
|
163
|
+
trigger.setAttribute("aria-haspopup", "listbox");
|
|
164
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
165
|
+
trigger.setAttribute("aria-multiselectable", "true");
|
|
166
|
+
trigger.setAttribute("aria-label", placeholder);
|
|
167
|
+
|
|
168
|
+
var triggerContent = document.createElement("div");
|
|
169
|
+
triggerContent.className = "flex flex-1 items-center gap-6 truncate text-left text-inherit";
|
|
170
|
+
|
|
171
|
+
function renderTriggerContent() {
|
|
172
|
+
triggerContent.innerHTML = "";
|
|
173
|
+
if (values.length === 0) {
|
|
174
|
+
var placeholderSpan = document.createElement("span");
|
|
175
|
+
placeholderSpan.className = "text-inherit";
|
|
176
|
+
placeholderSpan.textContent = placeholder;
|
|
177
|
+
triggerContent.appendChild(placeholderSpan);
|
|
178
|
+
} else {
|
|
179
|
+
var summary = document.createElement("span");
|
|
180
|
+
summary.className = "text-inherit";
|
|
181
|
+
summary.textContent = values.length + " " + summaryLabel;
|
|
182
|
+
triggerContent.appendChild(summary);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
renderTriggerContent();
|
|
186
|
+
|
|
187
|
+
trigger.appendChild(triggerContent);
|
|
188
|
+
|
|
189
|
+
var chevron = document.createElement("span");
|
|
190
|
+
chevron.className =
|
|
191
|
+
"ml-4 box-content flex size-16 items-center justify-center shrink-0 transition-transform duration-200 group-[.open]:rotate-180";
|
|
192
|
+
chevron.innerHTML = CHEVRON_SVG;
|
|
193
|
+
chevron.setAttribute("aria-hidden", "true");
|
|
194
|
+
|
|
195
|
+
var showChevron = variant !== "inline" || values.length === 0;
|
|
196
|
+
if (showChevron) {
|
|
197
|
+
trigger.appendChild(chevron);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
triggerWrapper.appendChild(trigger);
|
|
201
|
+
|
|
202
|
+
// Create clear button (will be shown/hidden dynamically)
|
|
203
|
+
var clearBtn = document.createElement("button");
|
|
204
|
+
clearBtn.type = "button";
|
|
205
|
+
clearBtn.className =
|
|
206
|
+
"rounded-full absolute right-12 top-1/2 -translate-y-1/2 bg-transparent p-0 text-typography-tertiary-text hover:text-typography-secondary-text focus:outline-none";
|
|
207
|
+
clearBtn.innerHTML = X_SVG;
|
|
208
|
+
clearBtn.setAttribute("aria-label", "Clear selection");
|
|
209
|
+
clearBtn.style.display = canClear && values.length > 0 && !disabled ? "" : "none";
|
|
210
|
+
clearBtn.addEventListener("click", function (e) {
|
|
211
|
+
e.stopPropagation();
|
|
212
|
+
values = [];
|
|
213
|
+
renderTriggerContent();
|
|
214
|
+
trigger.className = triggerClasses(
|
|
215
|
+
variant,
|
|
216
|
+
size,
|
|
217
|
+
disabled,
|
|
218
|
+
true,
|
|
219
|
+
false
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
// Update chevron visibility for inline variant
|
|
223
|
+
var shouldShowChevron = variant !== "inline" || values.length === 0;
|
|
224
|
+
if (shouldShowChevron && !chevron.parentNode) {
|
|
225
|
+
trigger.appendChild(chevron);
|
|
226
|
+
} else if (!shouldShowChevron && chevron.parentNode) {
|
|
227
|
+
chevron.parentNode.removeChild(chevron);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
updateClearButton();
|
|
231
|
+
syncOptionStates();
|
|
232
|
+
|
|
233
|
+
if (onClear) onClear();
|
|
234
|
+
if (onChange) onChange([]);
|
|
235
|
+
});
|
|
236
|
+
triggerWrapper.appendChild(clearBtn);
|
|
237
|
+
|
|
238
|
+
container.appendChild(triggerWrapper);
|
|
239
|
+
|
|
240
|
+
// Helper to update clear button visibility
|
|
241
|
+
function updateClearButton() {
|
|
242
|
+
if (clearBtn) {
|
|
243
|
+
clearBtn.style.display = canClear && values.length > 0 && !disabled ? "" : "none";
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Create dropdown content
|
|
248
|
+
var content = document.createElement("div");
|
|
249
|
+
content.setAttribute("role", "listbox");
|
|
250
|
+
content.setAttribute("aria-multiselectable", "true");
|
|
251
|
+
var contentBase = "w-full min-w-[200px]";
|
|
252
|
+
if (!usePopover) {
|
|
253
|
+
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";
|
|
254
|
+
} else {
|
|
255
|
+
contentBase += " max-h-[30vh] overflow-hidden flex flex-col";
|
|
256
|
+
}
|
|
257
|
+
content.className = contentBase;
|
|
258
|
+
|
|
259
|
+
// Search input (using InputComponent like enum-select)
|
|
260
|
+
var searchContainer = document.createElement("div");
|
|
261
|
+
searchContainer.className = "py-2 border-b-1/2 border-border-primary hidden";
|
|
262
|
+
|
|
263
|
+
var searchInputWrapper = null;
|
|
264
|
+
var searchInput = null;
|
|
265
|
+
if (global.InputComponent && typeof global.InputComponent.create === "function") {
|
|
266
|
+
searchInputWrapper = global.InputComponent.create({
|
|
267
|
+
variant: "borderless",
|
|
268
|
+
inputSize: "small",
|
|
269
|
+
type: "text",
|
|
270
|
+
placeholder: "Search...",
|
|
271
|
+
value: "",
|
|
272
|
+
startIcon: SEARCH_ICON,
|
|
273
|
+
className: "!border-0 !p-0",
|
|
274
|
+
onInput: function () {
|
|
275
|
+
searchQuery = searchInputWrapper.getValue().trim();
|
|
276
|
+
renderOptions();
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
var inputEl = searchInputWrapper.getInput();
|
|
280
|
+
if (inputEl) {
|
|
281
|
+
inputEl.setAttribute("aria-label", "Search options");
|
|
282
|
+
inputEl.addEventListener("click", function (e) {
|
|
283
|
+
e.stopPropagation();
|
|
284
|
+
});
|
|
285
|
+
searchInput = inputEl;
|
|
286
|
+
}
|
|
287
|
+
searchContainer.appendChild(searchInputWrapper);
|
|
288
|
+
} else {
|
|
289
|
+
// Fallback to native input with search icon
|
|
290
|
+
var fallbackWrapper = document.createElement("div");
|
|
291
|
+
fallbackWrapper.className = "flex items-center gap-8";
|
|
292
|
+
|
|
293
|
+
var searchIconSpan = document.createElement("span");
|
|
294
|
+
searchIconSpan.className = "shrink-0 text-typography-tertiary-text";
|
|
295
|
+
searchIconSpan.innerHTML = SEARCH_ICON;
|
|
296
|
+
fallbackWrapper.appendChild(searchIconSpan);
|
|
297
|
+
|
|
298
|
+
var nativeSearchInput = document.createElement("input");
|
|
299
|
+
nativeSearchInput.type = "text";
|
|
300
|
+
nativeSearchInput.placeholder = "Search...";
|
|
301
|
+
nativeSearchInput.className =
|
|
302
|
+
"w-full bg-transparent text-reg-13 text-typography-primary-text placeholder:text-typography-quaternary-text focus:outline-none border-none";
|
|
303
|
+
nativeSearchInput.addEventListener("input", function (e) {
|
|
304
|
+
searchQuery = e.target.value.trim();
|
|
305
|
+
renderOptions();
|
|
306
|
+
});
|
|
307
|
+
nativeSearchInput.addEventListener("click", function (e) {
|
|
308
|
+
e.stopPropagation();
|
|
309
|
+
});
|
|
310
|
+
searchInput = nativeSearchInput;
|
|
311
|
+
fallbackWrapper.appendChild(nativeSearchInput);
|
|
312
|
+
searchContainer.appendChild(fallbackWrapper);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Options list
|
|
316
|
+
var optionsList = document.createElement("div");
|
|
317
|
+
optionsList.className =
|
|
318
|
+
"overflow-y-auto max-h-[30vh] p-2 w-full rounded-4 bg-fill-quarternary-fill-white flex-1 min-h-0";
|
|
319
|
+
|
|
320
|
+
content.appendChild(searchContainer);
|
|
321
|
+
content.appendChild(optionsList);
|
|
322
|
+
|
|
323
|
+
if (!usePopover) {
|
|
324
|
+
container.appendChild(content);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
var highlightedIndex = -1;
|
|
328
|
+
|
|
329
|
+
function showLoading() {
|
|
330
|
+
optionsList.innerHTML = "";
|
|
331
|
+
var loading = document.createElement("div");
|
|
332
|
+
loading.className =
|
|
333
|
+
"flex h-full min-h-[100px] w-full items-center justify-center p-4 !text-reg-13 text-typography-quaternary-text";
|
|
334
|
+
loading.textContent = "Loading options...";
|
|
335
|
+
optionsList.appendChild(loading);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function showError(message) {
|
|
339
|
+
optionsList.innerHTML = "";
|
|
340
|
+
var errorDiv = document.createElement("div");
|
|
341
|
+
errorDiv.className =
|
|
342
|
+
"flex h-full min-h-[100px] w-full items-center justify-center p-4 !text-reg-13 text-error-text";
|
|
343
|
+
errorDiv.textContent = message || "Error loading options";
|
|
344
|
+
optionsList.appendChild(errorDiv);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function getFilteredOptions() {
|
|
348
|
+
if (!searchQuery.trim()) return options;
|
|
349
|
+
|
|
350
|
+
var normalizedQuery = searchQuery.toLowerCase();
|
|
351
|
+
return options.filter(function (option) {
|
|
352
|
+
var matchesDisplayName = option.display_name
|
|
353
|
+
.toLowerCase()
|
|
354
|
+
.includes(normalizedQuery);
|
|
355
|
+
var matchesSlug = String(option.slug || "")
|
|
356
|
+
.toLowerCase()
|
|
357
|
+
.includes(normalizedQuery);
|
|
358
|
+
return matchesDisplayName || matchesSlug;
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function isSelected(optionValue) {
|
|
363
|
+
return values.some(function (v) {
|
|
364
|
+
return v === optionValue || String(v) === String(optionValue);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function toggleValue(optionValue) {
|
|
369
|
+
var idx = values.findIndex(function (v) {
|
|
370
|
+
return v === optionValue || String(v) === String(optionValue);
|
|
371
|
+
});
|
|
372
|
+
if (idx >= 0) {
|
|
373
|
+
values.splice(idx, 1);
|
|
374
|
+
} else {
|
|
375
|
+
values.push(optionValue);
|
|
376
|
+
}
|
|
377
|
+
renderTriggerContent();
|
|
378
|
+
trigger.className = triggerClasses(variant, size, disabled, values.length === 0, canClear && values.length > 0 && !disabled);
|
|
379
|
+
|
|
380
|
+
// Update chevron visibility for inline variant
|
|
381
|
+
var shouldShowChevron = variant !== "inline" || values.length === 0;
|
|
382
|
+
if (shouldShowChevron && !chevron.parentNode) {
|
|
383
|
+
trigger.appendChild(chevron);
|
|
384
|
+
} else if (!shouldShowChevron && chevron.parentNode) {
|
|
385
|
+
chevron.parentNode.removeChild(chevron);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
updateClearButton();
|
|
389
|
+
syncOptionStates();
|
|
390
|
+
if (onChange) onChange(values.slice());
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function syncOptionStates() {
|
|
394
|
+
optionsList.querySelectorAll("[role=option]").forEach(function (optEl) {
|
|
395
|
+
var dv = optEl.getAttribute("data-value");
|
|
396
|
+
var selected = values.some(function (v) {
|
|
397
|
+
return v === dv || String(v) === dv || (dv === "false" && v === false) || (dv === "true" && v === true);
|
|
398
|
+
});
|
|
399
|
+
optEl.setAttribute("aria-selected", selected);
|
|
400
|
+
var checkEl = optEl.querySelector(".multiselect-option-check");
|
|
401
|
+
if (checkEl) checkEl.style.visibility = selected ? "visible" : "hidden";
|
|
402
|
+
optEl.classList.toggle("bg-primary-surface", selected);
|
|
403
|
+
optEl.classList.toggle("hover:!bg-primary-surface-hover", selected);
|
|
404
|
+
optEl.classList.toggle("hover:bg-fill-tertiary-fill-light-gray", !selected);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function renderOptions() {
|
|
409
|
+
optionsList.innerHTML = "";
|
|
410
|
+
var filteredOptions = getFilteredOptions();
|
|
411
|
+
|
|
412
|
+
// Update search visibility
|
|
413
|
+
var shouldShowSearch = showSearch !== undefined ? showSearch : options.length > 10;
|
|
414
|
+
searchContainer.className = shouldShowSearch
|
|
415
|
+
? "p-8 border-b-1/2 border-border-primary "
|
|
416
|
+
: "p-8 hidden";
|
|
417
|
+
|
|
418
|
+
if (filteredOptions.length === 0) {
|
|
419
|
+
var noOpt = document.createElement("div");
|
|
420
|
+
noOpt.className =
|
|
421
|
+
"flex h-full min-h-[100px] w-full items-center justify-center p-4 !text-reg-13 text-typography-quaternary-text";
|
|
422
|
+
noOpt.textContent = searchQuery.trim()
|
|
423
|
+
? "No options found"
|
|
424
|
+
: "No options available";
|
|
425
|
+
optionsList.appendChild(noOpt);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
filteredOptions.forEach(function (opt) {
|
|
430
|
+
var optionValue = opt.slug || opt.display_name;
|
|
431
|
+
var optionLabel = opt.display_name;
|
|
432
|
+
var selected = isSelected(optionValue);
|
|
433
|
+
var isArchived = opt.is_active === 0 || opt.is_active === false;
|
|
434
|
+
|
|
435
|
+
var option = document.createElement("div");
|
|
436
|
+
option.setAttribute("role", "option");
|
|
437
|
+
option.setAttribute("data-value", optionValue);
|
|
438
|
+
option.setAttribute("aria-selected", selected);
|
|
439
|
+
option.className = join(
|
|
440
|
+
"relative flex w-full cursor-pointer select-none items-center gap-8 rounded-2 px-12 py-6 text-reg-13 outline-none first:rounded-t-4 last:rounded-b-4",
|
|
441
|
+
"hover:bg-fill-tertiary-fill-light-gray focus:bg-fill-tertiary-fill-light-gray",
|
|
442
|
+
selected ? "bg-primary-surface hover:!bg-primary-surface-hover" : ""
|
|
443
|
+
);
|
|
444
|
+
|
|
445
|
+
var optionContent = document.createElement("span");
|
|
446
|
+
optionContent.className = "flex items-center gap-8 flex-1 truncate";
|
|
447
|
+
|
|
448
|
+
var badgeConfig = opt.badge_config;
|
|
449
|
+
if (badgeConfig && (badgeConfig.icon_color || badgeConfig.start_icon)) {
|
|
450
|
+
var IconComponent = getIcon();
|
|
451
|
+
if (IconComponent && typeof IconComponent.createIconOrColor === "function") {
|
|
452
|
+
var iconEl = IconComponent.createIconOrColor({
|
|
453
|
+
start_icon: badgeConfig.start_icon,
|
|
454
|
+
icon_color: badgeConfig.icon_color,
|
|
455
|
+
className: (badgeConfig.class_name || "") + " shrink-0",
|
|
456
|
+
});
|
|
457
|
+
if (iconEl) optionContent.appendChild(iconEl);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
var label = document.createElement("span");
|
|
462
|
+
label.textContent = optionLabel;
|
|
463
|
+
optionContent.appendChild(label);
|
|
464
|
+
|
|
465
|
+
option.appendChild(optionContent);
|
|
466
|
+
|
|
467
|
+
// Add archived badge (inline, after label)
|
|
468
|
+
if (isArchived) {
|
|
469
|
+
var archivedBadge = document.createElement("span");
|
|
470
|
+
archivedBadge.className =
|
|
471
|
+
"ml-8 px-6 py-2 text-xs rounded-2 bg-info-surface-hover text-info-text-base border-1/2 border-info-border-base";
|
|
472
|
+
archivedBadge.textContent = "Archived";
|
|
473
|
+
option.appendChild(archivedBadge);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Add checkmark
|
|
477
|
+
var checkSpan = document.createElement("span");
|
|
478
|
+
checkSpan.className = "multiselect-option-check ml-auto flex size-14 shrink-0 items-center justify-center";
|
|
479
|
+
checkSpan.innerHTML = CHECK_SVG;
|
|
480
|
+
checkSpan.style.visibility = selected ? "visible" : "hidden";
|
|
481
|
+
option.appendChild(checkSpan);
|
|
482
|
+
|
|
483
|
+
option.addEventListener("click", function (e) {
|
|
484
|
+
e.stopPropagation();
|
|
485
|
+
if (disabled) return;
|
|
486
|
+
toggleValue(optionValue);
|
|
487
|
+
});
|
|
488
|
+
option.addEventListener("mouseenter", function () {
|
|
489
|
+
if (disabled) return;
|
|
490
|
+
highlightOption(option);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
optionsList.appendChild(option);
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function openDropdown() {
|
|
498
|
+
if (disabled) return;
|
|
499
|
+
if (popover) {
|
|
500
|
+
document
|
|
501
|
+
.querySelectorAll(".enum-select, .enum-multiselect, .custom-select, .record-select, .custom-multiselect")
|
|
502
|
+
.forEach(function (other) {
|
|
503
|
+
if (other !== container && other.popoverInstance) {
|
|
504
|
+
other.popoverInstance.hide();
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
popover.show();
|
|
508
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
509
|
+
if (searchInput) {
|
|
510
|
+
setTimeout(function () {
|
|
511
|
+
searchInput.focus();
|
|
512
|
+
}, 50);
|
|
513
|
+
}
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
document
|
|
517
|
+
.querySelectorAll(".enum-multiselect.open, .enum-select.open")
|
|
518
|
+
.forEach(function (other) {
|
|
519
|
+
if (other !== container) {
|
|
520
|
+
other.classList.remove("open");
|
|
521
|
+
var t = other.querySelector("button");
|
|
522
|
+
if (t) t.setAttribute("aria-expanded", "false");
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
isOpen = true;
|
|
526
|
+
container.classList.add("open");
|
|
527
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
528
|
+
if (searchInput) {
|
|
529
|
+
setTimeout(function () {
|
|
530
|
+
searchInput.focus();
|
|
531
|
+
}, 50);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
function closeDropdown() {
|
|
536
|
+
if (popover) {
|
|
537
|
+
popover.hide();
|
|
538
|
+
} else {
|
|
539
|
+
isOpen = false;
|
|
540
|
+
container.classList.remove("open");
|
|
541
|
+
}
|
|
542
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
543
|
+
highlightedIndex = -1;
|
|
544
|
+
clearSearch();
|
|
545
|
+
renderOptions();
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function toggleDropdown() {
|
|
549
|
+
var isVisible = popover
|
|
550
|
+
? popover.element && popover.element.classList.contains("visible")
|
|
551
|
+
: isOpen;
|
|
552
|
+
if (isVisible) {
|
|
553
|
+
closeDropdown();
|
|
554
|
+
} else {
|
|
555
|
+
openDropdown();
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function clearSearch() {
|
|
560
|
+
searchQuery = "";
|
|
561
|
+
if (searchInputWrapper) searchInputWrapper.setValue("");
|
|
562
|
+
else if (searchInput) searchInput.value = "";
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
function highlightOption(el) {
|
|
566
|
+
optionsList.querySelectorAll("[role=option]").forEach(function (o) {
|
|
567
|
+
if (!isSelected(o.getAttribute("data-value"))) {
|
|
568
|
+
o.classList.remove("bg-fill-tertiary-fill-light-gray");
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
if (!el.classList.contains("bg-primary-surface")) {
|
|
572
|
+
el.classList.add("bg-fill-tertiary-fill-light-gray");
|
|
573
|
+
}
|
|
574
|
+
highlightedIndex = Array.from(optionsList.children).indexOf(el);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function scrollToOption(opt) {
|
|
578
|
+
if (!opt) return;
|
|
579
|
+
var cr = optionsList.getBoundingClientRect();
|
|
580
|
+
var top = opt.offsetTop;
|
|
581
|
+
var bottom = top + opt.offsetHeight;
|
|
582
|
+
var st = optionsList.scrollTop;
|
|
583
|
+
var sb = st + cr.height;
|
|
584
|
+
if (top < st) optionsList.scrollTop = top - 8;
|
|
585
|
+
else if (bottom > sb) optionsList.scrollTop = bottom - cr.height + 8;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
trigger.addEventListener("keydown", function (e) {
|
|
589
|
+
if (disabled) return;
|
|
590
|
+
var isVisible = popover && popover.element && popover.element.classList.contains("visible");
|
|
591
|
+
switch (e.key) {
|
|
592
|
+
case "Enter":
|
|
593
|
+
case " ":
|
|
594
|
+
e.preventDefault();
|
|
595
|
+
toggleDropdown();
|
|
596
|
+
break;
|
|
597
|
+
case "ArrowDown":
|
|
598
|
+
e.preventDefault();
|
|
599
|
+
if (!isVisible) openDropdown();
|
|
600
|
+
else navigateOptions(1);
|
|
601
|
+
break;
|
|
602
|
+
case "ArrowUp":
|
|
603
|
+
e.preventDefault();
|
|
604
|
+
if (!isVisible) openDropdown();
|
|
605
|
+
else navigateOptions(-1);
|
|
606
|
+
break;
|
|
607
|
+
case "Escape":
|
|
608
|
+
if (isVisible) {
|
|
609
|
+
e.preventDefault();
|
|
610
|
+
closeDropdown();
|
|
611
|
+
}
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
function navigateOptions(dir) {
|
|
617
|
+
var list = Array.from(optionsList.children).filter(function (n) {
|
|
618
|
+
return n.getAttribute("role") === "option";
|
|
619
|
+
});
|
|
620
|
+
if (list.length === 0) return;
|
|
621
|
+
highlightedIndex += dir;
|
|
622
|
+
if (highlightedIndex < 0) highlightedIndex = list.length - 1;
|
|
623
|
+
else if (highlightedIndex >= list.length) highlightedIndex = 0;
|
|
624
|
+
var opt = list[highlightedIndex];
|
|
625
|
+
highlightOption(opt);
|
|
626
|
+
scrollToOption(opt);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Initialize Popover
|
|
630
|
+
function initializePopover() {
|
|
631
|
+
if (!usePopover) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
popover = global.Popover.create({
|
|
635
|
+
trigger: trigger,
|
|
636
|
+
content: content,
|
|
637
|
+
placement: "bottom",
|
|
638
|
+
align: "start",
|
|
639
|
+
closeOnClickOutside: true,
|
|
640
|
+
onClose: function () {
|
|
641
|
+
trigger.setAttribute("aria-expanded", "false");
|
|
642
|
+
chevron.style.transform = "";
|
|
643
|
+
highlightedIndex = -1;
|
|
644
|
+
clearSearch();
|
|
645
|
+
renderOptions();
|
|
646
|
+
},
|
|
647
|
+
onOpen: function () {
|
|
648
|
+
trigger.setAttribute("aria-expanded", "true");
|
|
649
|
+
chevron.style.transform = "rotate(180deg)";
|
|
650
|
+
},
|
|
651
|
+
bodyClassName: "p-0 overflow-hidden",
|
|
652
|
+
panelClassName: "min-w-[var(--trigger-width)] overflow-hidden",
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
// Store popover instance for cleanup
|
|
656
|
+
container.popoverInstance = popover;
|
|
657
|
+
|
|
658
|
+
// Set CSS variable for trigger width
|
|
659
|
+
var triggerWidth = trigger.offsetWidth;
|
|
660
|
+
if (popover.panel) {
|
|
661
|
+
popover.panel.style.setProperty("--trigger-width", triggerWidth + "px");
|
|
662
|
+
popover.panel.style.minWidth = triggerWidth + "px";
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Load options from SDK
|
|
667
|
+
function loadOptions() {
|
|
668
|
+
var client = getClient();
|
|
669
|
+
if (!client || (typeof client.isAvailable === "function" && !client.isAvailable())) {
|
|
670
|
+
error = "SuperLeap SDK not initialized";
|
|
671
|
+
showError(error);
|
|
672
|
+
if (onError) onError(error);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
showLoading();
|
|
677
|
+
|
|
678
|
+
var sdk = typeof client.getSdk === "function" ? client.getSdk() : null;
|
|
679
|
+
if (!sdk) {
|
|
680
|
+
error = "Failed to get SDK instance";
|
|
681
|
+
showError(error);
|
|
682
|
+
if (onError) onError(error);
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
var model = sdk.model(objectSlug);
|
|
687
|
+
|
|
688
|
+
model
|
|
689
|
+
.getField(columnSlug)
|
|
690
|
+
.then(function (field) {
|
|
691
|
+
if (!field) {
|
|
692
|
+
throw new Error("Field '" + columnSlug + "' not found in object '" + objectSlug + "'");
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
columnData = field;
|
|
696
|
+
|
|
697
|
+
// Check if it's a select/stage field with enum_group
|
|
698
|
+
if (!field.enumGroup || !field.enumGroup.values) {
|
|
699
|
+
throw new Error("Field '" + columnSlug + "' does not have enum options");
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
var enumGroup = field.enumGroup;
|
|
703
|
+
var allOptions = enumGroup.values || [];
|
|
704
|
+
|
|
705
|
+
// Handle dependent fields
|
|
706
|
+
if (columnData.is_dependent_field && enumGroup.properties && enumGroup.properties.parent_column_slug) {
|
|
707
|
+
var parentSlug = enumGroup.properties.parent_column_slug;
|
|
708
|
+
var parentValue = currentRecordData[parentSlug];
|
|
709
|
+
|
|
710
|
+
if (!parentValue) {
|
|
711
|
+
options = [];
|
|
712
|
+
placeholder = "Select " + parentSlug + " first";
|
|
713
|
+
renderOptions();
|
|
714
|
+
isLoading = false;
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// Filter options based on dependent_enum_slugs
|
|
719
|
+
options = allOptions.filter(function (option) {
|
|
720
|
+
if (!option.dependent_enum_slugs) return false;
|
|
721
|
+
if (Array.isArray(parentValue)) {
|
|
722
|
+
return parentValue.some(function (val) {
|
|
723
|
+
return option.dependent_enum_slugs.includes(val);
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
return option.dependent_enum_slugs.includes(parentValue);
|
|
727
|
+
});
|
|
728
|
+
} else {
|
|
729
|
+
// Filter active options (or include archived if it's in the selected values)
|
|
730
|
+
options = allOptions.filter(function (option) {
|
|
731
|
+
return option.is_active === 1 || option.is_active === true || values.includes(option.slug);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// Sort by rank
|
|
736
|
+
options.sort(function (a, b) {
|
|
737
|
+
var rankA = a.rank !== undefined && a.rank !== null ? a.rank : 999999;
|
|
738
|
+
var rankB = b.rank !== undefined && b.rank !== null ? b.rank : 999999;
|
|
739
|
+
return rankA - rankB;
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
isLoading = false;
|
|
743
|
+
renderOptions();
|
|
744
|
+
|
|
745
|
+
// Update trigger content if values are set
|
|
746
|
+
if (values.length > 0) {
|
|
747
|
+
renderTriggerContent();
|
|
748
|
+
trigger.className = triggerClasses(
|
|
749
|
+
variant,
|
|
750
|
+
size,
|
|
751
|
+
disabled,
|
|
752
|
+
false,
|
|
753
|
+
canClear && values.length > 0 && !disabled
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
// Update chevron visibility for inline variant
|
|
757
|
+
var shouldShowChevron = variant !== "inline" || values.length === 0;
|
|
758
|
+
if (shouldShowChevron && !chevron.parentNode) {
|
|
759
|
+
trigger.appendChild(chevron);
|
|
760
|
+
} else if (!shouldShowChevron && chevron.parentNode) {
|
|
761
|
+
chevron.parentNode.removeChild(chevron);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
updateClearButton();
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (onLoad) onLoad(options);
|
|
768
|
+
})
|
|
769
|
+
.catch(function (err) {
|
|
770
|
+
error = err.message || "Failed to load options";
|
|
771
|
+
console.error("EnumMultiSelect error:", error);
|
|
772
|
+
showError(error);
|
|
773
|
+
isLoading = false;
|
|
774
|
+
if (onError) onError(error);
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// Initialize
|
|
779
|
+
initializePopover();
|
|
780
|
+
loadOptions();
|
|
781
|
+
|
|
782
|
+
if (!usePopover) {
|
|
783
|
+
trigger.addEventListener("click", function (e) {
|
|
784
|
+
e.preventDefault();
|
|
785
|
+
e.stopPropagation();
|
|
786
|
+
if (disabled) return;
|
|
787
|
+
toggleDropdown();
|
|
788
|
+
});
|
|
789
|
+
document.addEventListener("click", function (e) {
|
|
790
|
+
if (isOpen && !container.contains(e.target)) closeDropdown();
|
|
791
|
+
});
|
|
792
|
+
document.addEventListener("keydown", function (e) {
|
|
793
|
+
if (e.key === "Escape" && isOpen) closeDropdown();
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// Public API
|
|
798
|
+
container.updateValues = function (newValues) {
|
|
799
|
+
values = Array.isArray(newValues) ? newValues.slice() : [];
|
|
800
|
+
renderTriggerContent();
|
|
801
|
+
trigger.className = triggerClasses(
|
|
802
|
+
variant,
|
|
803
|
+
size,
|
|
804
|
+
disabled,
|
|
805
|
+
values.length === 0,
|
|
806
|
+
canClear && values.length > 0 && !disabled
|
|
807
|
+
);
|
|
808
|
+
|
|
809
|
+
// Update chevron visibility for inline variant
|
|
810
|
+
var shouldShowChevron = variant !== "inline" || values.length === 0;
|
|
811
|
+
if (shouldShowChevron && !chevron.parentNode) {
|
|
812
|
+
trigger.appendChild(chevron);
|
|
813
|
+
} else if (!shouldShowChevron && chevron.parentNode) {
|
|
814
|
+
chevron.parentNode.removeChild(chevron);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
updateClearButton();
|
|
818
|
+
syncOptionStates();
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
container.updateRecordData = function (newRecordData) {
|
|
822
|
+
currentRecordData = newRecordData || {};
|
|
823
|
+
loadOptions();
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
container.setDisabled = function (isDisabled) {
|
|
827
|
+
disabled = !!isDisabled;
|
|
828
|
+
trigger.disabled = disabled;
|
|
829
|
+
trigger.className = triggerClasses(
|
|
830
|
+
variant,
|
|
831
|
+
size,
|
|
832
|
+
disabled,
|
|
833
|
+
values.length === 0,
|
|
834
|
+
canClear && values.length > 0 && !disabled
|
|
835
|
+
);
|
|
836
|
+
updateClearButton();
|
|
837
|
+
var isVisible = popover && popover.element && popover.element.classList.contains("visible");
|
|
838
|
+
if (disabled && (isVisible || isOpen)) closeDropdown();
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
container.reload = function () {
|
|
842
|
+
loadOptions();
|
|
843
|
+
};
|
|
844
|
+
|
|
845
|
+
container.getValues = function () {
|
|
846
|
+
return values.slice();
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
container.getOptions = function () {
|
|
850
|
+
return options;
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
container.getColumnData = function () {
|
|
854
|
+
return columnData;
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
container.destroy = function () {
|
|
858
|
+
if (popover) {
|
|
859
|
+
popover.destroy();
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
return container;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
global.EnumMultiSelect = {
|
|
867
|
+
create: createEnumMultiSelect,
|
|
868
|
+
};
|
|
869
|
+
})(typeof window !== "undefined" ? window : this);
|