@integry/sdk 4.6.17 → 4.6.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.6.17",
3
+ "version": "4.6.18",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -8,6 +8,7 @@ import { isScrolledIntoView } from '@/utils/common';
8
8
  import { searchJSON } from '@/utils/searchJson';
9
9
  import { Input } from '@/components/Input';
10
10
  // import TagsMenuComponent from '@/components/React/TagsMenu';
11
+ import { TagsMenu } from '@/components/TagsMenu';
11
12
  import { TagOptions } from '../TagOptions';
12
13
  import { ThreeDotLoader } from '../../ThreeDotLoader';
13
14
  import styles from './styles.module.scss';
@@ -46,6 +47,7 @@ interface FieldMenuProps {
46
47
  nextPage?: string;
47
48
  tagsComponent?: any;
48
49
  isDynamic?: boolean;
50
+ tagsTree?: any;
49
51
  }
50
52
 
51
53
  const customComponent = (props: { element: any }) => {
@@ -75,6 +77,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
75
77
  nextPage = '',
76
78
  tagsComponent = null,
77
79
  isDynamic = true,
80
+ tagsTree = null,
78
81
  } = props;
79
82
 
80
83
  // Set active tab in state
@@ -127,7 +130,9 @@ const FieldDropdown = (props: FieldMenuProps) => {
127
130
  ? 'none'
128
131
  : 'block',
129
132
  maxWidth: parentContainer
130
- ? `${parentContainer.getBoundingClientRect().width}px`
133
+ ? `${
134
+ parentContainer.getBoundingClientRect().width - (tagsTree ? 25 : 0)
135
+ }px`
131
136
  : '342px',
132
137
  } as any;
133
138
  if (
@@ -215,12 +220,15 @@ const FieldDropdown = (props: FieldMenuProps) => {
215
220
  }
216
221
 
217
222
  return html` <div
218
- class=${`${styles.tagMenu} ${enableSearch ? styles.tagMenuWithSearch : ''}`}
223
+ class=${`${styles.tagMenu} ${tagsTree ? styles.tagMenuV2 : ''} ${
224
+ enableSearch && !tagsTree ? styles.tagMenuWithSearch : ''
225
+ }`}
219
226
  style=${parentContainer && tagMenyStyleRef?.current
220
227
  ? tagMenyStyleRef.current
221
228
  : ''}
222
229
  >
223
230
  ${enableSearch &&
231
+ !tagsTree &&
224
232
  html`
225
233
  <div class=${styles.tagMenuSearch}>
226
234
  <${Input}
@@ -252,7 +260,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
252
260
  </div>`}
253
261
  <div
254
262
  class=${`${styles.tagMenuBody} ${
255
- enableSearch ? styles.tagMenuBodyWithSearch : ''
263
+ enableSearch && !tagsTree ? styles.tagMenuBodyWithSearch : ''
256
264
  }`}
257
265
  >
258
266
  ${activeTab === Tabs.Values
@@ -340,8 +348,11 @@ const FieldDropdown = (props: FieldMenuProps) => {
340
348
  </div>`}
341
349
  </div>`
342
350
  : html` <div className="${styles.mappedFieldMenu}">
343
- ${tagsComponent
344
- ? html``
351
+ ${tagsTree
352
+ ? html`<${TagsMenu}
353
+ tagsTree=${tagsTree}
354
+ onSelect=${onTagClick}
355
+ />`
345
356
  : html`${Object.keys(
346
357
  !isEditable ? searchJSON(tags, searchValue) : tags,
347
358
  ).length > 0
@@ -134,3 +134,10 @@
134
134
  padding-left: 3px !important;
135
135
  }
136
136
  }
137
+
138
+ .tagMenuV2 {
139
+ height: max-content;
140
+ max-height: 400px;
141
+ max-width: fit-content;
142
+ overflow: hidden;
143
+ }
@@ -54,6 +54,7 @@ interface MultipurposeFieldProps {
54
54
  onButtonClickScript?: string;
55
55
  buttonScriptRequiresAuthToken?: boolean;
56
56
  tagsComponent?: any;
57
+ tagsTree?: any;
57
58
  }
58
59
 
59
60
  const MultipurposeField = (props: MultipurposeFieldProps) => {
@@ -87,6 +88,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
87
88
  onButtonClickScript = '',
88
89
  buttonScriptRequiresAuthToken = false,
89
90
  tagsComponent = null,
91
+ tagsTree = null,
90
92
  } = props;
91
93
  const [showTagMenu, setShowTagMenu] = useState(false);
92
94
  const [currentValue, setCurrentValue] = useState(value);
@@ -280,6 +282,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
280
282
  }
281
283
  tags.forEach((tag) => {
282
284
  const tagValue = tag.replace(/{|}/g, '');
285
+ const tagValueParts = tagValue.split('.');
283
286
  const tagData = (activityOutputDataRaw || []).find((element: any) => {
284
287
  return (
285
288
  element.value === tagValue ||
@@ -287,7 +290,10 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
287
290
  );
288
291
  }) || {
289
292
  value: tagValue,
290
- text: tagValue,
293
+ text:
294
+ tagValueParts.length > 0
295
+ ? prettifyString(tagValueParts[tagValueParts.length - 1])
296
+ : tagValue,
291
297
  title: tagValue,
292
298
  };
293
299
  if (tagData) {
@@ -342,18 +348,38 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
342
348
  });
343
349
  return tagValue;
344
350
  }
345
- return activityOutputData[tag];
351
+ return activityOutputData[tag] || '';
346
352
  };
347
353
 
348
- const insertTag = (tag: string) => {
349
- const result = activityOutputDataRaw.find((element: any) => {
354
+ const prettifyString = (str: string) => {
355
+ return str
356
+ .replace(/_/g, ' ') // Replace underscores with spaces
357
+ .replace(/\b\w/g, (c) => c.toUpperCase()); // Capitalize first letter of each word
358
+ };
359
+
360
+ const insertTag = (tag: string | any) => {
361
+ let result = activityOutputDataRaw.find((element: any) => {
350
362
  return element.text === tag;
351
363
  });
364
+ let isStandardTag = true;
365
+ if (
366
+ !result &&
367
+ tag.hasOwnProperty('value') &&
368
+ tag.hasOwnProperty('key') &&
369
+ tag.hasOwnProperty('currentPath')
370
+ ) {
371
+ result = {
372
+ value: tag.currentPath,
373
+ text: tag.key,
374
+ title: tag.value,
375
+ };
376
+ isStandardTag = false; // This tag is coming from TagsMenu component
377
+ }
352
378
  if (tagify) {
353
379
  var tagElm = tagify.createTagElem({
354
380
  value: result.value,
355
- text: result.text,
356
- title: getTagData(tag),
381
+ text: isStandardTag ? result.text : prettifyString(result.text),
382
+ title: isStandardTag ? getTagData(tag) : result.title,
357
383
  editable: false,
358
384
  });
359
385
  tagify.injectAtCaret(tagElm);
@@ -364,8 +390,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
364
390
  }
365
391
  };
366
392
 
367
- const onTagClick = (tag: string) => {
368
- console.log('tag', tag);
393
+ const onTagClick = (tag: string | any) => {
369
394
  if (tagify) {
370
395
  if (!allowTagsInText) {
371
396
  tagify.removeAllTags();
@@ -683,6 +708,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
683
708
  : false}
684
709
  refreshRootStepData=${refreshRootStepData}
685
710
  tagsComponent=${tagsComponent}
711
+ tagsTree=${tagsTree}
686
712
  />
687
713
  </div>`}
688
714
  </div>
@@ -31,7 +31,7 @@
31
31
  }
32
32
  tags {
33
33
  width: 100%;
34
- max-width: 682px;
34
+ // max-width: 682px;
35
35
  font-family: 'Inter';
36
36
  height: 40px;
37
37
  padding-top: 5px;