@integry/sdk 4.6.27 → 4.6.29
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/.vscode/launch.json +2 -2
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/MultipurposeField/Dropdown/index.tsx +11 -8
- package/src/components/MultipurposeField/TagMenu/index.ts +3 -0
- package/src/components/TagsMenu/index.ts +38 -39
package/package.json
CHANGED
|
@@ -529,7 +529,8 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
529
529
|
setSearchValue('');
|
|
530
530
|
let fieldVal = el.value;
|
|
531
531
|
if (isMultiSelect) {
|
|
532
|
-
|
|
532
|
+
let fieldIds = value ? JSON.parse(value) : [];
|
|
533
|
+
fieldIds = Array.isArray(fieldIds) ? fieldIds : [String(fieldIds)];
|
|
533
534
|
// check if el.id is already selected and then remove it
|
|
534
535
|
if (fieldIds.includes(el.id)) {
|
|
535
536
|
const index = fieldIds.indexOf(el.id);
|
|
@@ -546,8 +547,8 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
546
547
|
if (indexes.length > 0) {
|
|
547
548
|
fieldVal = indexes.map((i) => items[i].value).join(', ');
|
|
548
549
|
}
|
|
549
|
-
onChange(JSON.stringify(fieldIds));
|
|
550
|
-
setEditableTextValue(JSON.stringify(fieldIds));
|
|
550
|
+
onChange(fieldIds.length > 0 ? JSON.stringify(fieldIds) : '');
|
|
551
|
+
setEditableTextValue(fieldIds.length > 0 ? JSON.stringify(fieldIds) : '');
|
|
551
552
|
} else {
|
|
552
553
|
onChange(el.id);
|
|
553
554
|
setEditableTextValue(fieldVal);
|
|
@@ -600,12 +601,14 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
600
601
|
const getSelectedItem = useMemo(() => {
|
|
601
602
|
let index = -1;
|
|
602
603
|
if (isMultiSelect) {
|
|
603
|
-
|
|
604
|
+
let values = value ? JSON.parse(value) : [];
|
|
605
|
+
values = Array.isArray(values) ? values : [String(values)];
|
|
604
606
|
const indexes: any = [];
|
|
605
|
-
const selectedValues =
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
607
|
+
const selectedValues =
|
|
608
|
+
values.map((val: any) => {
|
|
609
|
+
index = items.findIndex((el) => el.id === val);
|
|
610
|
+
indexes.push(index);
|
|
611
|
+
}) || [];
|
|
609
612
|
if (indexes.length > 0 && items.length > 0) {
|
|
610
613
|
return indexes.map((i: number) => items[i].value).join(', ');
|
|
611
614
|
}
|
|
@@ -215,6 +215,9 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
215
215
|
if (value) {
|
|
216
216
|
if (isMultiSelect) {
|
|
217
217
|
selectedValues = JSON.parse(value);
|
|
218
|
+
selectedValues = Array.isArray(selectedValues)
|
|
219
|
+
? selectedValues
|
|
220
|
+
: [String(selectedValues)];
|
|
218
221
|
} else {
|
|
219
222
|
selectedValues = [value];
|
|
220
223
|
}
|
|
@@ -515,10 +515,29 @@ const TagList = ({
|
|
|
515
515
|
}));
|
|
516
516
|
};
|
|
517
517
|
|
|
518
|
+
const escapeHTMLIfNeeded = (input: any) => {
|
|
519
|
+
if (typeof input !== 'string') {
|
|
520
|
+
return input;
|
|
521
|
+
}
|
|
522
|
+
const isHTML = /<\/?[a-z][\s\S]*>/i.test(input);
|
|
523
|
+
|
|
524
|
+
const output = isHTML
|
|
525
|
+
? input
|
|
526
|
+
.replace(/&/g, '&')
|
|
527
|
+
.replace(/</g, '<')
|
|
528
|
+
.replace(/>/g, '>')
|
|
529
|
+
.replace(/"/g, '"')
|
|
530
|
+
.replace(/'/g, ''')
|
|
531
|
+
: input;
|
|
532
|
+
|
|
533
|
+
return output.length > 200 ? `${output.slice(0, 200)}...` : output;
|
|
534
|
+
};
|
|
535
|
+
|
|
518
536
|
const highlightSearchTerm = (text: string, term: string) => {
|
|
519
|
-
|
|
537
|
+
const textModified = escapeHTMLIfNeeded(text);
|
|
538
|
+
if (!term) return textModified;
|
|
520
539
|
const regex = new RegExp(`(${term})`, 'gi');
|
|
521
|
-
return
|
|
540
|
+
return textModified.replace(regex, '<mark>$1</mark>');
|
|
522
541
|
};
|
|
523
542
|
|
|
524
543
|
// Update the filterTags function with proper type checking
|
|
@@ -718,7 +737,11 @@ const TagList = ({
|
|
|
718
737
|
const tagPath = `${activeTab}.${extractStepsFromOutputPath(
|
|
719
738
|
currentPath,
|
|
720
739
|
)}`;
|
|
721
|
-
onSelect({
|
|
740
|
+
onSelect({
|
|
741
|
+
currentPath: tagPath,
|
|
742
|
+
key,
|
|
743
|
+
value: escapeHTMLIfNeeded(value),
|
|
744
|
+
});
|
|
722
745
|
}
|
|
723
746
|
}}
|
|
724
747
|
class="${styles.listItemContent}"
|
|
@@ -1011,45 +1034,21 @@ const TabMenu = ({ data, onSelect, onOptionClick }: TagMenuProps) => {
|
|
|
1011
1034
|
if (name.includes('parameter')) {
|
|
1012
1035
|
return html`
|
|
1013
1036
|
<svg
|
|
1014
|
-
|
|
1015
|
-
|
|
1037
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1038
|
+
width="20"
|
|
1039
|
+
height="20"
|
|
1016
1040
|
viewBox="0 0 24 24"
|
|
1017
1041
|
fill="none"
|
|
1018
|
-
|
|
1042
|
+
stroke="currentColor"
|
|
1043
|
+
stroke-width="2"
|
|
1044
|
+
stroke-linecap="round"
|
|
1045
|
+
stroke-linejoin="round"
|
|
1046
|
+
class="lucide lucide-variable"
|
|
1019
1047
|
>
|
|
1020
|
-
<path
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
stroke-linecap="round"
|
|
1025
|
-
/>
|
|
1026
|
-
<circle cx="18" cy="6" r="2" stroke="currentColor" stroke-width="2" />
|
|
1027
|
-
<path
|
|
1028
|
-
d="M4 12H10"
|
|
1029
|
-
stroke="currentColor"
|
|
1030
|
-
stroke-width="2"
|
|
1031
|
-
stroke-linecap="round"
|
|
1032
|
-
/>
|
|
1033
|
-
<circle
|
|
1034
|
-
cx="14"
|
|
1035
|
-
cy="12"
|
|
1036
|
-
r="2"
|
|
1037
|
-
stroke="currentColor"
|
|
1038
|
-
stroke-width="2"
|
|
1039
|
-
/>
|
|
1040
|
-
<path
|
|
1041
|
-
d="M4 18H12"
|
|
1042
|
-
stroke="currentColor"
|
|
1043
|
-
stroke-width="2"
|
|
1044
|
-
stroke-linecap="round"
|
|
1045
|
-
/>
|
|
1046
|
-
<circle
|
|
1047
|
-
cx="16"
|
|
1048
|
-
cy="18"
|
|
1049
|
-
r="2"
|
|
1050
|
-
stroke="currentColor"
|
|
1051
|
-
stroke-width="2"
|
|
1052
|
-
/>
|
|
1048
|
+
<path d="M8 21s-4-3-4-9 4-9 4-9" />
|
|
1049
|
+
<path d="M16 3s4 3 4 9-4 9-4 9" />
|
|
1050
|
+
<line x1="15" x2="9" y1="9" y2="15" />
|
|
1051
|
+
<line x1="9" x2="15" y1="9" y2="15" />
|
|
1053
1052
|
</svg>
|
|
1054
1053
|
`;
|
|
1055
1054
|
}
|