@nyaruka/temba-components 0.160.0 → 0.160.1
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 +6 -0
- package/dist/temba-components.js +2 -2
- package/dist/temba-components.js.map +1 -1
- package/package.json +1 -1
- package/src/utils.ts +12 -2
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -1291,9 +1291,19 @@ export const generateDefaultCategoryName = (
|
|
|
1291
1291
|
|
|
1292
1292
|
// Handle different operator types
|
|
1293
1293
|
switch (operator) {
|
|
1294
|
-
// Word
|
|
1294
|
+
// Word-list operators - the argument is a list of words, so only the
|
|
1295
|
+
// first word seeds the category name (e.g. "red maroon fire" -> "Red").
|
|
1296
|
+
// Trailing punctuation is stripped so comma-separated lists like
|
|
1297
|
+
// "red, blue, green" yield "Red" rather than "Red,".
|
|
1295
1298
|
case 'has_any_word':
|
|
1296
|
-
case 'has_all_words':
|
|
1299
|
+
case 'has_all_words': {
|
|
1300
|
+
const firstWord = cleanValue1
|
|
1301
|
+
.split(/\s+/)[0]
|
|
1302
|
+
.replace(/[^\p{L}\p{N}]+$/u, '');
|
|
1303
|
+
return firstWord ? capitalize(firstWord) : '';
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// Phrase operators - the argument is a single phrase, capitalize as-is
|
|
1297
1307
|
case 'has_phrase':
|
|
1298
1308
|
case 'has_only_phrase':
|
|
1299
1309
|
case 'has_beginning':
|