@integry/sdk 4.6.21 → 4.6.23
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/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 +3 -0
- package/src/components/MultipurposeField/TagMenu/index.ts +7 -1
- package/src/components/MultipurposeField/index.tsx +12 -1
- package/src/components/TagsMenu/index.ts +180 -16
- package/src/components/TagsMenu/styles.module.scss +21 -3
- package/src/features/common/ActionForm/index.ts +5 -0
package/package.json
CHANGED
|
@@ -69,6 +69,7 @@ interface ListBoxProps {
|
|
|
69
69
|
dataSourceBody?: any;
|
|
70
70
|
parentFieldChanged?: boolean;
|
|
71
71
|
allowWorkspaceConnectedAccounts: boolean;
|
|
72
|
+
tagsTree?: any;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
const ListBox = (props: ListBoxProps) => {
|
|
@@ -112,6 +113,7 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
112
113
|
dataSourceBody = {},
|
|
113
114
|
parentFieldChanged = false,
|
|
114
115
|
allowWorkspaceConnectedAccounts = false,
|
|
116
|
+
tagsTree = null,
|
|
115
117
|
} = props;
|
|
116
118
|
|
|
117
119
|
const [query, setQuery] = useState<string>('');
|
|
@@ -1000,6 +1002,7 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
1000
1002
|
loadingOptions=${loading}
|
|
1001
1003
|
nextPage=${nextPage}
|
|
1002
1004
|
isDynamic=${isDynamic}
|
|
1005
|
+
tagsTree=${tagsTree}
|
|
1003
1006
|
/>`}
|
|
1004
1007
|
</div>
|
|
1005
1008
|
`}
|
|
@@ -78,6 +78,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
78
78
|
tagsComponent = null,
|
|
79
79
|
isDynamic = true,
|
|
80
80
|
tagsTree = null,
|
|
81
|
+
isMappable = false,
|
|
81
82
|
} = props;
|
|
82
83
|
|
|
83
84
|
// Set active tab in state
|
|
@@ -263,7 +264,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
263
264
|
enableSearch && !tagsTree ? styles.tagMenuBodyWithSearch : ''
|
|
264
265
|
}`}
|
|
265
266
|
>
|
|
266
|
-
${activeTab === Tabs.Values
|
|
267
|
+
${activeTab === Tabs.Values && (tagsTree === null || isDynamic)
|
|
267
268
|
? html`<div className=${styles.tagMenuBodyItem} id="tag-menu-body-item">
|
|
268
269
|
${options.length > 0
|
|
269
270
|
? getFilteredOptions(options, searchValue).length > 0
|
|
@@ -352,6 +353,11 @@ const FieldDropdown = (props: FieldMenuProps) => {
|
|
|
352
353
|
? html`<${TagsMenu}
|
|
353
354
|
tagsTree=${tagsTree}
|
|
354
355
|
onSelect=${onTagClick}
|
|
356
|
+
renderValuesTab=${activeTab === Tabs.Values &&
|
|
357
|
+
!isDynamic &&
|
|
358
|
+
isMappable}
|
|
359
|
+
options=${options}
|
|
360
|
+
onOptionClick=${onOptionClick}
|
|
355
361
|
/>`
|
|
356
362
|
: html`${Object.keys(
|
|
357
363
|
!isEditable ? searchJSON(tags, searchValue) : tags,
|
|
@@ -283,7 +283,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
|
|
|
283
283
|
tags.forEach((tag) => {
|
|
284
284
|
const tagValue = tag.replace(/{|}/g, '');
|
|
285
285
|
const tagValueParts = tagValue.split('.');
|
|
286
|
-
|
|
286
|
+
let tagData = (activityOutputDataRaw || []).find((element: any) => {
|
|
287
287
|
return (
|
|
288
288
|
element.value === tagValue ||
|
|
289
289
|
checkIfTagExists(element.value, tagValue)
|
|
@@ -296,6 +296,17 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
|
|
|
296
296
|
: tagValue,
|
|
297
297
|
title: tagValue,
|
|
298
298
|
};
|
|
299
|
+
if (tagsTree) {
|
|
300
|
+
// this component has been called with explicit tagTree hence we don't need to rely on activity output data any more.
|
|
301
|
+
tagData = {
|
|
302
|
+
value: tagValue,
|
|
303
|
+
text:
|
|
304
|
+
tagValueParts.length > 0
|
|
305
|
+
? prettifyString(tagValueParts[tagValueParts.length - 1])
|
|
306
|
+
: tagValue,
|
|
307
|
+
title: tagValue,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
299
310
|
if (tagData) {
|
|
300
311
|
newValue = newValue?.replace(
|
|
301
312
|
tag,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { html } from 'htm/preact';
|
|
4
|
+
import { render } from 'preact';
|
|
4
5
|
import { useState, useEffect } from 'preact/hooks';
|
|
5
6
|
import styles from './styles.module.scss';
|
|
6
7
|
|
|
@@ -19,10 +20,17 @@ interface TagData {
|
|
|
19
20
|
[key: string]: TagNode;
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
// Add this interface for the Values tab items
|
|
24
|
+
interface ValueItem {
|
|
25
|
+
id: number;
|
|
26
|
+
value: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
// Define the props for the TagMenu component
|
|
23
30
|
interface TagMenuProps {
|
|
24
31
|
data: TagData;
|
|
25
|
-
onSelect: (tag: TagNode) => void;
|
|
32
|
+
onSelect: (tag: TagNode | Record<string, unknown>) => void;
|
|
33
|
+
onOptionClick?: (option: Record<string, unknown>) => void;
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
interface TagListProps {
|
|
@@ -35,6 +43,14 @@ interface TagListProps {
|
|
|
35
43
|
activeTab?: string;
|
|
36
44
|
}
|
|
37
45
|
|
|
46
|
+
interface TagsMenuProps {
|
|
47
|
+
tagsTree: Record<string, unknown>;
|
|
48
|
+
onSelect: (tag: Record<string, unknown>) => void;
|
|
49
|
+
renderValuesTab?: boolean;
|
|
50
|
+
options?: Record<string, unknown>;
|
|
51
|
+
onOptionClick?: (option: Record<string, unknown>) => void;
|
|
52
|
+
}
|
|
53
|
+
|
|
38
54
|
// Helper function to convert nested tags arrays to objects
|
|
39
55
|
function convertNestedTagsToObject(tags: TagNode[]): Record<string, TagNode> {
|
|
40
56
|
const result: Record<string, TagNode> = {};
|
|
@@ -72,6 +88,7 @@ const arrayToObject = (arr: unknown[]): Record<string, unknown> =>
|
|
|
72
88
|
newObj[`[${index}]`] = item;
|
|
73
89
|
return newObj;
|
|
74
90
|
}, {});
|
|
91
|
+
|
|
75
92
|
// Check if output data matches the search term
|
|
76
93
|
const outputMatchesSearch = (output: unknown, term: string): boolean => {
|
|
77
94
|
if (!term || !output) return false;
|
|
@@ -307,6 +324,37 @@ const TypeIcon = ({ value }: { value: unknown }) => {
|
|
|
307
324
|
return html`<span class="${styles.tagIcon}">${getTypeIcon(value)}</span>`;
|
|
308
325
|
};
|
|
309
326
|
|
|
327
|
+
// Add a new component to render the flat list of values
|
|
328
|
+
const ValuesList = ({
|
|
329
|
+
values,
|
|
330
|
+
onSelect,
|
|
331
|
+
onOptionClick,
|
|
332
|
+
}: {
|
|
333
|
+
values: ValueItem[];
|
|
334
|
+
onSelect: (item: Record<string, unknown>) => void;
|
|
335
|
+
onOptionClick: (option: Record<string, unknown>) => void;
|
|
336
|
+
}) =>
|
|
337
|
+
html`
|
|
338
|
+
<div class="${styles.valuesList}">
|
|
339
|
+
<ul>
|
|
340
|
+
${values.map(
|
|
341
|
+
(item) => html`
|
|
342
|
+
<li
|
|
343
|
+
key=${item.id}
|
|
344
|
+
class="${styles.valueItem}"
|
|
345
|
+
onClick=${() =>
|
|
346
|
+
onOptionClick({
|
|
347
|
+
id: item.id,
|
|
348
|
+
value: item.value,
|
|
349
|
+
})}
|
|
350
|
+
>
|
|
351
|
+
<span class="${styles.valueText}">${item.value}</span>
|
|
352
|
+
</li>
|
|
353
|
+
`,
|
|
354
|
+
)}
|
|
355
|
+
</ul>
|
|
356
|
+
</div>
|
|
357
|
+
`;
|
|
310
358
|
const TagList = ({
|
|
311
359
|
tags,
|
|
312
360
|
searchTerm,
|
|
@@ -640,7 +688,7 @@ const TagList = ({
|
|
|
640
688
|
if (isTagNode(value)) {
|
|
641
689
|
if (Array.isArray(value.output)) {
|
|
642
690
|
tagsParam = value.output;
|
|
643
|
-
} else {
|
|
691
|
+
} else if (value.output) {
|
|
644
692
|
tagsParam = value.output as Record<string, unknown>;
|
|
645
693
|
}
|
|
646
694
|
}
|
|
@@ -809,7 +857,7 @@ const TagList = ({
|
|
|
809
857
|
};
|
|
810
858
|
|
|
811
859
|
// Update the TabMenu component to search across all tabs
|
|
812
|
-
const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
860
|
+
const TabMenu = ({ data, onSelect, onOptionClick }: TagMenuProps) => {
|
|
813
861
|
const [activeTab, setActiveTab] = useState<string>(Object.keys(data)[0]);
|
|
814
862
|
const [searchTerm, setSearchTerm] = useState<string>('');
|
|
815
863
|
const [searchResults, setSearchResults] = useState<Record<string, number>>(
|
|
@@ -828,6 +876,18 @@ const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
|
828
876
|
const results: Record<string, number> = {};
|
|
829
877
|
|
|
830
878
|
Object.keys(data).forEach((tabKey) => {
|
|
879
|
+
// Skip counting for Values tab - handle it differently
|
|
880
|
+
if (tabKey === 'Values') {
|
|
881
|
+
const valuesData = (data[tabKey] as unknown) as { values: ValueItem[] };
|
|
882
|
+
if (valuesData.values) {
|
|
883
|
+
const matches = valuesData.values.filter((item) =>
|
|
884
|
+
item.value.toLowerCase().includes(searchTerm.toLowerCase()),
|
|
885
|
+
).length;
|
|
886
|
+
results[tabKey] = matches;
|
|
887
|
+
}
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
|
|
831
891
|
const matches = countSearchMatches(
|
|
832
892
|
data[tabKey].tags || {},
|
|
833
893
|
searchTerm.toLowerCase(),
|
|
@@ -842,6 +902,29 @@ const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
|
842
902
|
const getTabIcon = (tabName: string) => {
|
|
843
903
|
const name = tabName.toLowerCase();
|
|
844
904
|
|
|
905
|
+
if (name === 'values') {
|
|
906
|
+
return html`
|
|
907
|
+
<svg
|
|
908
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
909
|
+
width="16"
|
|
910
|
+
height="16"
|
|
911
|
+
viewBox="0 0 24 24"
|
|
912
|
+
fill="none"
|
|
913
|
+
stroke="currentColor"
|
|
914
|
+
strokeWidth="2"
|
|
915
|
+
strokeLinecap="round"
|
|
916
|
+
strokeLinejoin="round"
|
|
917
|
+
class="mr-1"
|
|
918
|
+
>
|
|
919
|
+
<path d="M8 3H5a2 2 0 0 0-2 2v3"></path>
|
|
920
|
+
<path d="M21 8V5a2 2 0 0 0-2-2h-3"></path>
|
|
921
|
+
<path d="M3 16v3a2 2 0 0 0 2 2h3"></path>
|
|
922
|
+
<path d="M16 21h3a2 2 0 0 0 2-2v-3"></path>
|
|
923
|
+
<rect width="10" height="10" x="7" y="7" rx="2"></rect>
|
|
924
|
+
</svg>
|
|
925
|
+
`;
|
|
926
|
+
}
|
|
927
|
+
|
|
845
928
|
if (name.includes('trigger')) {
|
|
846
929
|
return html`
|
|
847
930
|
<svg
|
|
@@ -883,7 +966,6 @@ const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
|
883
966
|
}
|
|
884
967
|
|
|
885
968
|
if (name.includes('form') || name.includes('setup')) {
|
|
886
|
-
// Keep the existing form icon
|
|
887
969
|
return html`
|
|
888
970
|
<svg
|
|
889
971
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -1015,7 +1097,66 @@ const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
|
1015
1097
|
)}
|
|
1016
1098
|
</div>
|
|
1017
1099
|
`;
|
|
1100
|
+
|
|
1018
1101
|
const renderContent = () => {
|
|
1102
|
+
// Special handling for Values tab
|
|
1103
|
+
if (activeTab === 'Values') {
|
|
1104
|
+
const valuesData = (data[activeTab] as unknown) as {
|
|
1105
|
+
values: ValueItem[];
|
|
1106
|
+
};
|
|
1107
|
+
const filteredValues = searchTerm
|
|
1108
|
+
? valuesData.values.filter((item) =>
|
|
1109
|
+
item.value.toLowerCase().includes(searchTerm.toLowerCase()),
|
|
1110
|
+
)
|
|
1111
|
+
: valuesData.values;
|
|
1112
|
+
|
|
1113
|
+
return html`
|
|
1114
|
+
<div class="${styles.tabContent}">
|
|
1115
|
+
<div class="${styles.searchWrapper}">
|
|
1116
|
+
<input
|
|
1117
|
+
type="text"
|
|
1118
|
+
placeholder="Search values..."
|
|
1119
|
+
value=${searchTerm}
|
|
1120
|
+
onInput=${(e: Event) =>
|
|
1121
|
+
setSearchTerm((e.target as HTMLInputElement).value)}
|
|
1122
|
+
/>
|
|
1123
|
+
${searchTerm
|
|
1124
|
+
? html`
|
|
1125
|
+
<button
|
|
1126
|
+
class="${styles.clearSearch}"
|
|
1127
|
+
onClick=${() => setSearchTerm('')}
|
|
1128
|
+
title="Clear search"
|
|
1129
|
+
>
|
|
1130
|
+
<svg
|
|
1131
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1132
|
+
width="16"
|
|
1133
|
+
height="16"
|
|
1134
|
+
viewBox="0 0 24 24"
|
|
1135
|
+
fill="none"
|
|
1136
|
+
stroke="currentColor"
|
|
1137
|
+
strokeWidth="2"
|
|
1138
|
+
strokeLinecap="round"
|
|
1139
|
+
strokeLinejoin="round"
|
|
1140
|
+
>
|
|
1141
|
+
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
1142
|
+
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
1143
|
+
</svg>
|
|
1144
|
+
</button>
|
|
1145
|
+
`
|
|
1146
|
+
: ''}
|
|
1147
|
+
</div>
|
|
1148
|
+
<div class="${styles.tagsListWrapper}">
|
|
1149
|
+
<${ValuesList}
|
|
1150
|
+
values=${filteredValues}
|
|
1151
|
+
onSelect=${onSelect}
|
|
1152
|
+
onOptionClick=${onOptionClick}
|
|
1153
|
+
/>
|
|
1154
|
+
</div>
|
|
1155
|
+
</div>
|
|
1156
|
+
`;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// Regular tab handling
|
|
1019
1160
|
const activeData = data[activeTab];
|
|
1020
1161
|
return html`
|
|
1021
1162
|
<div class="${styles.tabContent}">
|
|
@@ -1068,10 +1209,8 @@ const TabMenu = ({ data, onSelect }: TagMenuProps) => {
|
|
|
1068
1209
|
return html`<div>${renderTabs()} ${renderContent()}</div>`;
|
|
1069
1210
|
};
|
|
1070
1211
|
|
|
1071
|
-
//
|
|
1072
|
-
|
|
1073
|
-
// Add this function to convert array-based tags back to object-based tags
|
|
1074
|
-
export function convertTagsToObject(tagData: Record<string, unknown>): TagData {
|
|
1212
|
+
// Function to convert TagData to include the Values tab
|
|
1213
|
+
function convertTagsToObject(tagData: Record<string, unknown>): TagData {
|
|
1075
1214
|
const result: TagData = {};
|
|
1076
1215
|
|
|
1077
1216
|
Object.keys(tagData).forEach((key) => {
|
|
@@ -1080,7 +1219,7 @@ export function convertTagsToObject(tagData: Record<string, unknown>): TagData {
|
|
|
1080
1219
|
...section,
|
|
1081
1220
|
};
|
|
1082
1221
|
|
|
1083
|
-
// Convert tags array to object
|
|
1222
|
+
// Convert tags array to object if needed
|
|
1084
1223
|
if (section.tags && Array.isArray(section.tags)) {
|
|
1085
1224
|
const tagsObject: Record<string, TagNode> = {};
|
|
1086
1225
|
|
|
@@ -1108,16 +1247,41 @@ export function convertTagsToObject(tagData: Record<string, unknown>): TagData {
|
|
|
1108
1247
|
return result;
|
|
1109
1248
|
}
|
|
1110
1249
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1250
|
+
// Update the TagsMenu function to add the Values tab
|
|
1251
|
+
export function TagsMenu({
|
|
1252
|
+
tagsTree,
|
|
1253
|
+
onSelect,
|
|
1254
|
+
renderValuesTab,
|
|
1255
|
+
options,
|
|
1256
|
+
onOptionClick,
|
|
1257
|
+
}: TagsMenuProps) {
|
|
1258
|
+
let modifiedData = convertTagsToObject(tagsTree);
|
|
1259
|
+
|
|
1260
|
+
if (
|
|
1261
|
+
renderValuesTab &&
|
|
1262
|
+
options &&
|
|
1263
|
+
Array.isArray(options) &&
|
|
1264
|
+
options.length > 0
|
|
1265
|
+
) {
|
|
1266
|
+
// Add the Values tab with sample data
|
|
1267
|
+
// In a real implementation, this would come from props
|
|
1268
|
+
modifiedData = {
|
|
1269
|
+
Values: {
|
|
1270
|
+
name: 'Values',
|
|
1271
|
+
machineName: 'values',
|
|
1272
|
+
values: options,
|
|
1273
|
+
} as TagNode,
|
|
1274
|
+
...modifiedData, // Spread the remaining tabs after "Values"
|
|
1275
|
+
};
|
|
1276
|
+
}
|
|
1115
1277
|
|
|
1116
|
-
export function TagsMenu({ tagsTree, onSelect }: TagsMenuProps) {
|
|
1117
|
-
const modifiedData = convertTagsToObject(tagsTree);
|
|
1118
1278
|
return html`
|
|
1119
1279
|
<div class="${styles.tagsMenuWrapper}">
|
|
1120
|
-
<${TabMenu}
|
|
1280
|
+
<${TabMenu}
|
|
1281
|
+
data=${modifiedData}
|
|
1282
|
+
onSelect=${onSelect}
|
|
1283
|
+
onOptionClick=${onOptionClick}
|
|
1284
|
+
/>
|
|
1121
1285
|
</div>
|
|
1122
1286
|
`;
|
|
1123
1287
|
}
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
}
|
|
149
149
|
span.key {
|
|
150
150
|
mark {
|
|
151
|
-
|
|
151
|
+
background-color: yellow;
|
|
152
152
|
color: inherit;
|
|
153
153
|
font-weight: 500;
|
|
154
154
|
border-radius: 2px;
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
margin-left: 5px;
|
|
179
179
|
|
|
180
180
|
mark {
|
|
181
|
-
|
|
181
|
+
background-color: yellow;
|
|
182
182
|
color: inherit;
|
|
183
183
|
font-weight: 500;
|
|
184
184
|
border-radius: 2px;
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
margin-left: 5px;
|
|
197
197
|
|
|
198
198
|
mark {
|
|
199
|
-
|
|
199
|
+
background-color: yellow;
|
|
200
200
|
color: inherit;
|
|
201
201
|
font-weight: 500;
|
|
202
202
|
border-radius: 2px;
|
|
@@ -230,6 +230,24 @@
|
|
|
230
230
|
.tagsListWrapper {
|
|
231
231
|
max-height: 170px;
|
|
232
232
|
overflow-y: scroll;
|
|
233
|
+
.valuesList {
|
|
234
|
+
ul {
|
|
235
|
+
margin: 5px 0;
|
|
236
|
+
padding: 0 10px;
|
|
237
|
+
li {
|
|
238
|
+
color: hsl(240deg, 10%, 3.9%);
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
font-weight: 500;
|
|
241
|
+
font-size: 0.8rem;
|
|
242
|
+
line-height: 1rem;
|
|
243
|
+
padding: 5px 10px;
|
|
244
|
+
&:hover {
|
|
245
|
+
background: rgba(66, 80, 240, 0.1);
|
|
246
|
+
border-radius: 100px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
233
251
|
}
|
|
234
252
|
}
|
|
235
253
|
}
|
|
@@ -1476,6 +1476,11 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
allowWorkspaceConnectedAccounts=${!!this.props
|
|
1478
1478
|
.onFieldChangeCallback}
|
|
1479
|
+
tagsTree=${
|
|
1480
|
+
this.props.showMappingMenu
|
|
1481
|
+
? this.props.tagsTree
|
|
1482
|
+
: null
|
|
1483
|
+
}
|
|
1479
1484
|
|
|
1480
1485
|
><//>
|
|
1481
1486
|
</${ConfigureFieldWrapper}>
|