@integry/sdk 4.6.82 → 4.6.84

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.82",
3
+ "version": "4.6.84",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -77,6 +77,7 @@ interface ListBoxProps {
77
77
  iconKeyPath?: string;
78
78
  optionDescriptionKeyPath?: string;
79
79
  skipInitialLoad?: boolean;
80
+ showMenuOnLeft?: boolean;
80
81
  }
81
82
 
82
83
  const ListBox = (props: ListBoxProps) => {
@@ -122,6 +123,7 @@ const ListBox = (props: ListBoxProps) => {
122
123
  allowWorkspaceConnectedAccounts = false,
123
124
  tagsTree = null,
124
125
  skipInitialLoad = false,
126
+ showMenuOnLeft = false,
125
127
  } = props;
126
128
 
127
129
  const [query, setQuery] = useState<string>('');
@@ -1171,6 +1173,7 @@ const ListBox = (props: ListBoxProps) => {
1171
1173
  nextPage=${nextPage}
1172
1174
  isDynamic=${isDynamic}
1173
1175
  tagsTree=${tagsTree}
1176
+ showMenuOnLeft=${props.showMenuOnLeft || false}
1174
1177
  />`}
1175
1178
  </div>
1176
1179
  `}
@@ -50,6 +50,7 @@ interface FieldMenuProps {
50
50
  tagsComponent?: any;
51
51
  isDynamic?: boolean;
52
52
  tagsTree?: any;
53
+ showMenuOnLeft?: boolean; // used when showing mapping menu in web app.
53
54
  }
54
55
 
55
56
  const customComponent = (props: { element: any }) => {
@@ -77,10 +78,10 @@ const FieldDropdown = (props: FieldMenuProps) => {
77
78
  isMultiSelect = false,
78
79
  loadingOptions = false,
79
80
  nextPage = '',
80
- tagsComponent = null,
81
81
  isDynamic = true,
82
82
  tagsTree = null,
83
83
  isMappable = false,
84
+ showMenuOnLeft = false,
84
85
  } = props;
85
86
 
86
87
  // Set active tab in state
@@ -164,10 +165,72 @@ const FieldDropdown = (props: FieldMenuProps) => {
164
165
  }
165
166
  return tagMenuStyle;
166
167
  };
167
- tagMenyStyleRef.current = getDynamicTagMenuPosition();
168
+
169
+ const getDynamicTagMenuPositionLeftAligned = (): any => {
170
+ let tagMenuStyle = {} as any;
171
+
172
+ if (parentContainer) {
173
+ const parentRect = parentContainer.getBoundingClientRect();
174
+ const estimatedMenuWidth = 210; // Estimated width for the menu
175
+ const estimatedMenuHeight = 400; // Estimated height for the menu (same as the 210 value mentioned in your original code)
176
+
177
+ // Position the menu to the left of the parent container
178
+ tagMenuStyle = {
179
+ top: `${parentRect.top}px`,
180
+ right: `${window.innerWidth - parentRect.left}px`, // This positions it to the left of the container
181
+ display: !isScrolledIntoView(parentContainer, 'steps-body-container')
182
+ ? 'none'
183
+ : 'block',
184
+ };
185
+
186
+ // Check if the tag menu would overflow to the left of the window
187
+ if (parentRect.left - estimatedMenuWidth < 0) {
188
+ // If it would overflow to the left, position it to the right of the parent instead
189
+ tagMenuStyle = {
190
+ ...tagMenuStyle,
191
+ right: 'auto', // Clear the right property
192
+ left: `${parentRect.right}px`,
193
+ };
194
+ }
195
+
196
+ // Check if the menu would overflow vertically
197
+ if (parentRect.top + estimatedMenuHeight > window.innerHeight - 8) {
198
+ // If it would overflow at the bottom, adjust the top position
199
+ const availableHeight = window.innerHeight - 8 - parentRect.top;
200
+ tagMenuStyle.maxHeight = `${availableHeight}px`;
201
+
202
+ // If available height is too small, position above the parent instead
203
+ if (availableHeight < 300) {
204
+ // Minimum usable height
205
+ tagMenuStyle.top = 'auto';
206
+ tagMenuStyle.bottom = `${
207
+ window.innerHeight - parentRect.top - parentRect.height
208
+ }px`;
209
+ tagMenuStyle.maxHeight = `${Math.min(
210
+ estimatedMenuHeight,
211
+ parentRect.top - 8,
212
+ )}px`;
213
+ }
214
+ } else {
215
+ tagMenuStyle.maxHeight = `${estimatedMenuHeight}px`;
216
+ }
217
+ } else {
218
+ tagMenuStyle = {
219
+ display: 'none',
220
+ };
221
+ }
222
+
223
+ return tagMenuStyle;
224
+ };
225
+
226
+ tagMenyStyleRef.current = showMenuOnLeft
227
+ ? getDynamicTagMenuPositionLeftAligned()
228
+ : getDynamicTagMenuPosition();
168
229
 
169
230
  const onScroll = (): void => {
170
- tagMenyStyleRef.current = getDynamicTagMenuPosition();
231
+ tagMenyStyleRef.current = showMenuOnLeft
232
+ ? getDynamicTagMenuPositionLeftAligned()
233
+ : getDynamicTagMenuPosition();
171
234
  setRenderAgain((prev) => !prev);
172
235
  };
173
236
 
@@ -56,6 +56,7 @@ interface MultipurposeFieldProps {
56
56
  tagsComponent?: any;
57
57
  tagsTree?: any;
58
58
  isDisabled?: boolean;
59
+ showMenuOnLeft?: boolean;
59
60
  }
60
61
 
61
62
  const MultipurposeField = (props: MultipurposeFieldProps) => {
@@ -91,6 +92,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
91
92
  tagsComponent = null,
92
93
  tagsTree = null,
93
94
  isDisabled = false,
95
+ showMenuOnLeft = false,
94
96
  } = props;
95
97
  const [showTagMenu, setShowTagMenu] = useState(false);
96
98
  const [currentValue, setCurrentValue] = useState(value);
@@ -764,6 +766,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
764
766
  refreshRootStepData=${refreshRootStepData}
765
767
  tagsComponent=${tagsComponent}
766
768
  tagsTree=${tagsTree}
769
+ showMenuOnLeft=${showMenuOnLeft}
767
770
  />
768
771
  </div>`}
769
772
  </div>
@@ -51,6 +51,7 @@ interface ActionFormPropsType extends StoreType {
51
51
  tagsComponent?: any;
52
52
  tagsTree?: any;
53
53
  showMappingMenu: boolean;
54
+ showMenuOnLeft: boolean;
54
55
  }
55
56
 
56
57
  interface ActionFormStateType {
@@ -1430,7 +1431,8 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1430
1431
  let elParentFields = [];
1431
1432
  if (
1432
1433
  el.activity_field?.parent_fields &&
1433
- el.activity_field?.parent_fields !== ''
1434
+ el.activity_field?.parent_fields !== '' &&
1435
+ el.activity_field?.parent_fields !== 'null'
1434
1436
  ) {
1435
1437
  try {
1436
1438
  elParentFields = JSON.parse(
@@ -1567,6 +1569,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1567
1569
  ? this.props.tagsTree
1568
1570
  : null
1569
1571
  }
1572
+ showMenuOnLeft=${
1573
+ this.props.showMenuOnLeft || false
1574
+ }
1570
1575
  skipInitialLoad=${
1571
1576
  (elParentFields.length ?? 0) > 0 &&
1572
1577
  !elParentFields?.some(
@@ -1762,6 +1767,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1762
1767
  ? this.props.tagsTree
1763
1768
  : null
1764
1769
  }
1770
+ showMenuOnLeft=${
1771
+ this.props.showMenuOnLeft || false
1772
+ }
1765
1773
  ><//>
1766
1774
  </${ConfigureFieldWrapper}>
1767
1775
  </div>
@@ -1971,6 +1979,8 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1971
1979
  tagsTree=${this.props.showMappingMenu
1972
1980
  ? this.props.tagsTree
1973
1981
  : null}
1982
+ showMenuOnLeft=${this.props
1983
+ .showMenuOnLeft || false}
1974
1984
  />
1975
1985
  </div>
1976
1986
  `;
@@ -2066,6 +2076,8 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
2066
2076
  tagsTree=${this.props.showMappingMenu
2067
2077
  ? this.props.tagsTree
2068
2078
  : null}
2079
+ showMenuOnLeft=${this.props
2080
+ .showMenuOnLeft || false}
2069
2081
  dataSourceBody=${this.replacePlaceholders(
2070
2082
  uiField?.data_source.body || {},
2071
2083
  this.state.dynamicFieldsData,
@@ -2321,6 +2333,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
2321
2333
  ? this.props.tagsTree
2322
2334
  : null
2323
2335
  }
2336
+ showMenuOnLeft=${
2337
+ this.props.showMenuOnLeft || false
2338
+ }
2324
2339
  />
2325
2340
 
2326
2341
  </${ConfigureFieldWrapper}>
@@ -30,6 +30,7 @@ export type DynamicFieldsProps = {
30
30
  onChangeCallback?: (val: any) => void;
31
31
  objectValue?: any;
32
32
  tagsTree?: any;
33
+ showMenuOnLeft?: boolean;
33
34
  } & StoreType;
34
35
 
35
36
  interface DynamicDataItem {
@@ -58,6 +59,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
58
59
  onChangeCallback = () => null,
59
60
  objectValue = null,
60
61
  tagsTree = null,
62
+ showMenuOnLeft = false,
61
63
  } = props;
62
64
  const [dynamicItems, setDynamicItems] = useState<DynamicDataItem[]>([]);
63
65
  const [loading, setLoading] = useState<boolean>(true);
@@ -220,6 +222,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
220
222
  refreshRootStepData=${refreshRootStepData}
221
223
  fieldId=${el.id || ''}
222
224
  tagsTree=${tagsTree}
225
+ showMenuOnLeft=${showMenuOnLeft}
223
226
  />
224
227
  </div>
225
228
  `;
package/src/index.ts CHANGED
@@ -2003,6 +2003,7 @@ export class IntegryJS {
2003
2003
  },
2004
2004
  showMappingMenu: false,
2005
2005
  isReadOnly: false,
2006
+ showMenuOnLeft: false,
2006
2007
  },
2007
2008
  ) => {
2008
2009
  const target = document.getElementById(options.containerId);
@@ -2033,6 +2034,7 @@ export class IntegryJS {
2033
2034
  tagsTree=${options.tagsTree}
2034
2035
  showMappingMenu=${options.showMappingMenu}
2035
2036
  isReadOnly=${options.isReadOnly}
2037
+ showMenuOnLeft=${options.showMenuOnLeft}
2036
2038
  />
2037
2039
  <//>
2038
2040
  <//>
@@ -298,6 +298,7 @@ export type RenderFlowStepOptions = {
298
298
  tagsTree: any;
299
299
  showMappingMenu?: boolean;
300
300
  isReadOnly?: boolean;
301
+ showMenuOnLeft?: boolean;
301
302
  };
302
303
  export type RenderMappingMenuOptions = {
303
304
  containerId: string;