@superleapai/flow-ui 2.5.12 → 2.5.13
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.
|
@@ -113,6 +113,24 @@
|
|
|
113
113
|
return global.Icon;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Get display name for the object from ObjectType: display_singular_name, display_plural_name, or slug.
|
|
118
|
+
* @param {{ display_singular_name?: string, display_plural_name?: string, slug?: string } | null} objectSchema - optional ObjectType
|
|
119
|
+
* @param {string} slug - objectSlug fallback
|
|
120
|
+
* @param {'singular'|'plural'} kind - which name to return
|
|
121
|
+
* @returns {string}
|
|
122
|
+
*/
|
|
123
|
+
function getObjectDisplayName(objectSchema, slug, kind) {
|
|
124
|
+
var s = objectSchema;
|
|
125
|
+
var str = function (v) {
|
|
126
|
+
return typeof v === "string" && v ? v : "";
|
|
127
|
+
};
|
|
128
|
+
if (kind === "singular") {
|
|
129
|
+
return str(s && s.display_singular_name) || str(s && s.slug) || slug || "";
|
|
130
|
+
}
|
|
131
|
+
return str(s && s.display_plural_name) || str(s && s.display_singular_name) || str(s && s.slug) || slug || "";
|
|
132
|
+
}
|
|
133
|
+
|
|
116
134
|
/**
|
|
117
135
|
* Get iconStr and color for the object: from objectSchema.properties.icon_data first, else OBJECT_SLUG_TO_ICON, else IconDatabase fallback.
|
|
118
136
|
* @param {string} slug - objectSlug
|
|
@@ -155,16 +173,21 @@
|
|
|
155
173
|
* @param {number} [config.initialLimit] - Initial fetch limit (default 50)
|
|
156
174
|
* @param {Array<string>} [config.displayFields] - Fields to display as secondary info (e.g. ["email", "phone"])
|
|
157
175
|
* @param {Object} [config.initialFilter] - Optional filter object to merge with search (e.g. { field: "status", operator: "exact", value: "active" } or { and: [...] })
|
|
158
|
-
* @param {Object} [config.objectSchema] - Optional
|
|
176
|
+
* @param {Object} [config.objectSchema] - Optional ObjectType; display_plural_name/display_singular_name/slug used for placeholder/search/summary label; properties.icon_data { icon?, color? } for static icon (not used for user; user shows Vivid Avatar)
|
|
159
177
|
* @returns {HTMLElement} Record multiselect container element
|
|
160
178
|
*/
|
|
161
179
|
function createRecordMultiSelect(config) {
|
|
162
180
|
var fieldId = config.fieldId;
|
|
163
181
|
var objectSlug = config.objectSlug;
|
|
164
182
|
var objectSchema = config.objectSchema || null;
|
|
165
|
-
var
|
|
166
|
-
var
|
|
167
|
-
|
|
183
|
+
var displayPlural = getObjectDisplayName(objectSchema, objectSlug, "plural");
|
|
184
|
+
var placeholder =
|
|
185
|
+
config.placeholder ||
|
|
186
|
+
(displayPlural ? "Select " + displayPlural : "Select records");
|
|
187
|
+
var searchPlaceholder =
|
|
188
|
+
config.searchPlaceholder ||
|
|
189
|
+
"Search " + (displayPlural || objectSlug || "") + "...";
|
|
190
|
+
var summaryLabel = config.label || (displayPlural || "selected");
|
|
168
191
|
var onValuesChange = config.onValuesChange;
|
|
169
192
|
var variant = config.variant || "default";
|
|
170
193
|
var size = config.size || "default";
|
|
@@ -320,7 +343,7 @@
|
|
|
320
343
|
},
|
|
321
344
|
});
|
|
322
345
|
var inputEl = searchInputWrapper.getInput();
|
|
323
|
-
if (inputEl) inputEl.setAttribute("aria-label", "Search records");
|
|
346
|
+
if (inputEl) inputEl.setAttribute("aria-label", "Search " + (displayPlural || "records"));
|
|
324
347
|
searchInputEl = inputEl;
|
|
325
348
|
searchWrap.appendChild(searchInputWrapper);
|
|
326
349
|
} else {
|
|
@@ -337,7 +360,7 @@
|
|
|
337
360
|
searchInput.className =
|
|
338
361
|
"w-full bg-transparent text-reg-13 text-typography-primary-text placeholder:text-typography-quaternary-text focus:outline-none border-none";
|
|
339
362
|
searchInput.placeholder = searchPlaceholder;
|
|
340
|
-
searchInput.setAttribute("aria-label", "Search records");
|
|
363
|
+
searchInput.setAttribute("aria-label", "Search " + (displayPlural || "records"));
|
|
341
364
|
searchInputEl = searchInput;
|
|
342
365
|
fallbackWrapper.appendChild(searchInput);
|
|
343
366
|
searchWrap.appendChild(fallbackWrapper);
|
|
@@ -121,6 +121,24 @@
|
|
|
121
121
|
return global.Icon;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Get display name for the object from ObjectType: display_singular_name, display_plural_name, or slug.
|
|
126
|
+
* @param {{ display_singular_name?: string, display_plural_name?: string, slug?: string } | null} objectSchema - optional ObjectType
|
|
127
|
+
* @param {string} slug - objectSlug fallback
|
|
128
|
+
* @param {'singular'|'plural'} kind - which name to return
|
|
129
|
+
* @returns {string}
|
|
130
|
+
*/
|
|
131
|
+
function getObjectDisplayName(objectSchema, slug, kind) {
|
|
132
|
+
var s = objectSchema;
|
|
133
|
+
var str = function (v) {
|
|
134
|
+
return typeof v === "string" && v ? v : "";
|
|
135
|
+
};
|
|
136
|
+
if (kind === "singular") {
|
|
137
|
+
return str(s && s.display_singular_name) || str(s && s.slug) || slug || "";
|
|
138
|
+
}
|
|
139
|
+
return str(s && s.display_plural_name) || str(s && s.display_singular_name) || str(s && s.slug) || slug || "";
|
|
140
|
+
}
|
|
141
|
+
|
|
124
142
|
/**
|
|
125
143
|
* Get iconStr and color for the object: from objectSchema.properties.icon_data first, else OBJECT_SLUG_TO_ICON, else IconDatabase fallback.
|
|
126
144
|
* @param {string} slug - objectSlug
|
|
@@ -174,16 +192,21 @@
|
|
|
174
192
|
* @param {boolean} [config.canClear] - Show clear button when value is set
|
|
175
193
|
* @param {number} [config.initialLimit] - Initial fetch limit (default 50)
|
|
176
194
|
* @param {Object} [config.initialFilter] - Optional filter object to merge with search (e.g. { field: "status", operator: "exact", value: "active" } or { and: [...] })
|
|
177
|
-
* @param {Object} [config.objectSchema] - Optional
|
|
195
|
+
* @param {Object} [config.objectSchema] - Optional ObjectType; display_singular_name/display_plural_name/slug used for placeholder/search text; properties.icon_data { icon?, color? } for static icon (not used for user; user shows Vivid Avatar)
|
|
178
196
|
* @returns {HTMLElement} Record select container element
|
|
179
197
|
*/
|
|
180
198
|
function createRecordSelect(config) {
|
|
181
199
|
var fieldId = config.fieldId;
|
|
182
200
|
var objectSlug = config.objectSlug;
|
|
183
201
|
var objectSchema = config.objectSchema || null;
|
|
184
|
-
var
|
|
202
|
+
var displaySingular = getObjectDisplayName(objectSchema, objectSlug, "singular");
|
|
203
|
+
var displayPlural = getObjectDisplayName(objectSchema, objectSlug, "plural");
|
|
204
|
+
var placeholder =
|
|
205
|
+
config.placeholder ||
|
|
206
|
+
(displaySingular ? "Select a " + displaySingular : "Select a record");
|
|
185
207
|
var searchPlaceholder =
|
|
186
|
-
config.searchPlaceholder ||
|
|
208
|
+
config.searchPlaceholder ||
|
|
209
|
+
"Search " + (displayPlural || objectSlug || "") + "...";
|
|
187
210
|
var onChange = config.onChange;
|
|
188
211
|
var variant = config.variant || "default";
|
|
189
212
|
var size = config.size || "default";
|
|
@@ -317,7 +340,7 @@
|
|
|
317
340
|
},
|
|
318
341
|
});
|
|
319
342
|
var inputEl = searchInputWrapper.getInput();
|
|
320
|
-
if (inputEl) inputEl.setAttribute("aria-label", "Search records");
|
|
343
|
+
if (inputEl) inputEl.setAttribute("aria-label", "Search " + (displayPlural || "records"));
|
|
321
344
|
searchInputEl = inputEl;
|
|
322
345
|
searchWrap.appendChild(searchInputWrapper);
|
|
323
346
|
} else {
|
|
@@ -334,7 +357,7 @@
|
|
|
334
357
|
searchInput.className =
|
|
335
358
|
"w-full bg-transparent text-reg-13 text-typography-primary-text placeholder:text-typography-quaternary-text focus:outline-none border-none";
|
|
336
359
|
searchInput.placeholder = searchPlaceholder;
|
|
337
|
-
searchInput.setAttribute("aria-label", "Search records");
|
|
360
|
+
searchInput.setAttribute("aria-label", "Search " + (displayPlural || "records"));
|
|
338
361
|
searchInputEl = searchInput;
|
|
339
362
|
fallbackWrapper.appendChild(searchInput);
|
|
340
363
|
searchWrap.appendChild(fallbackWrapper);
|