@integry/sdk 4.5.2 → 4.5.4
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/THIRD_PARTY_LICENSES +0 -37
- package/dist/esm/index.csm.d.ts +12 -2
- package/dist/esm/index.csm.js +7262 -1
- package/dist/umd/index.umd.d.ts +9 -1
- package/dist/umd/index.umd.js +7262 -1
- package/jest.config.cjs +10 -0
- package/package.json +10 -4
- package/src/components/AddTagButton/index.ts +23 -0
- package/src/components/BasicSelect/index.ts +114 -0
- package/src/components/BasicSelect/styles.module.scss +44 -0
- package/src/components/Button/index.ts +94 -0
- package/src/components/Button/styles.module.scss +152 -0
- package/src/components/CheckboxGroup/Checkbox.ts +104 -0
- package/src/components/CheckboxGroup/index.ts +190 -0
- package/src/components/CheckboxGroup/styles.module.scss +63 -0
- package/src/components/CollapsedMenu/index.ts +101 -0
- package/src/components/CollapsedMenu/styles.module.scss +46 -0
- package/src/components/ConfigureFieldWrapper/index.ts +85 -0
- package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
- package/src/components/EditableText/index.ts +121 -0
- package/src/components/EditableText/styles.module.scss +38 -0
- package/src/components/EditableTextArea/index.ts +143 -0
- package/src/components/EditableTextArea/styles.module.scss +91 -0
- package/src/components/ErrorMessage/index.ts +16 -0
- package/src/components/ErrorMessage/styles.module.scss +19 -0
- package/src/components/ErrorPage/index.ts +42 -0
- package/src/components/ErrorPage/styles.module.scss +26 -0
- package/src/components/Footer/index.ts +41 -0
- package/src/components/Footer/styles.module.scss +40 -0
- package/src/components/HTMLContent/index.tsx +275 -0
- package/src/components/HTMLContent/styles.module.scss +3 -0
- package/src/components/InfoBox/index.ts +48 -0
- package/src/components/InfoBox/styles.module.scss +21 -0
- package/src/components/Input/BaseInput/index.ts +170 -0
- package/src/components/Input/BaseInput/styles.module.scss +94 -0
- package/src/components/Input/DateInput/index.ts +103 -0
- package/src/components/Input/DateInput/styles.module.scss +50 -0
- package/src/components/Input/Input/index.ts +206 -0
- package/src/components/Input/Input/styles.module.scss +14 -0
- package/src/components/Input/PasswordInput/index.ts +164 -0
- package/src/components/Input/PasswordInput/styles.module.scss +37 -0
- package/src/components/Input/index.ts +7 -0
- package/src/components/Label/index.ts +61 -0
- package/src/components/Label/styles.module.scss +41 -0
- package/src/components/LargeLoader/index.ts +25 -0
- package/src/components/LargeLoader/styles.module.scss +16 -0
- package/src/components/Listbox/ListBoxItem.ts +57 -0
- package/src/components/Listbox/index.ts +479 -0
- package/src/components/Listbox/styles.module.scss +197 -0
- package/src/components/Loader/index.ts +25 -0
- package/src/components/Loader/styles.module.scss +16 -0
- package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
- package/src/components/MediaGallery/MediaSlider.ts +76 -0
- package/src/components/MediaGallery/index.ts +92 -0
- package/src/components/MediaGallery/styles.module.scss +156 -0
- package/src/components/MediaUpload/index.ts +233 -0
- package/src/components/MediaUpload/styles.module.scss +118 -0
- package/src/components/Modal/index.ts +87 -0
- package/src/components/Modal/styles.module.scss +441 -0
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
- package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
- package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
- package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
- package/src/components/MultipurposeField/index.tsx +687 -0
- package/src/components/MultipurposeField/styles.module.scss +56 -0
- package/src/components/NewModal/index.ts +69 -0
- package/src/components/NewModal/styles.module.scss +70 -0
- package/src/components/OverflowTooltip/index.tsx +59 -0
- package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
- package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
- package/src/components/RadioGroup/Radio.ts +129 -0
- package/src/components/RadioGroup/index.ts +169 -0
- package/src/components/RadioGroup/styles.module.scss +81 -0
- package/src/components/Search/index.ts +69 -0
- package/src/components/Search/styles.module.scss +149 -0
- package/src/components/TabBar/Tab.ts +33 -0
- package/src/components/TabBar/index.ts +64 -0
- package/src/components/TabBar/styles.module.scss +43 -0
- package/src/components/Tag/index.ts +29 -0
- package/src/components/Tag/styles.module.scss +57 -0
- package/src/components/TextArea/index.ts +172 -0
- package/src/components/TextArea/styles.module.scss +70 -0
- package/src/components/TextContent/index.tsx +128 -0
- package/src/components/TextContent/styles.module.scss +6 -0
- package/src/components/ThreeDotLoader/index.ts +39 -0
- package/src/components/ThreeDotLoader/styles.module.scss +41 -0
- package/src/components/TimeInput/index.ts +129 -0
- package/src/components/TimeInput/styles.module.scss +16 -0
- package/src/components/Toggle/index.ts +34 -0
- package/src/components/Toggle/styles.module.scss +56 -0
- package/src/components/Toggle-v2/index.ts +40 -0
- package/src/components/Toggle-v2/styles.module.scss +86 -0
- package/src/components/Tooltip/index.ts +271 -0
- package/src/components/Tooltip/styles.module.scss +105 -0
- package/src/components/form/ObjectField/index.ts +364 -0
- package/src/components/form/ObjectField/styles.module.scss +103 -0
- package/src/components/form/index.ts +3 -0
- package/src/contexts/AppContext.ts +12 -0
- package/src/declaration.d.ts +7 -0
- package/src/extensions/HMAC.ts +25 -0
- package/src/extensions/IntegryAPIError.ts +19 -0
- package/src/features/common/AccountDropdown/index.ts +291 -0
- package/src/features/common/AccountDropdown/styles.module.scss +19 -0
- package/src/features/common/ActionForm/index.ts +1818 -0
- package/src/features/common/ActionForm/styles.module.scss +23 -0
- package/src/features/common/AppCard/index.ts +207 -0
- package/src/features/common/AppCard/styles.module.scss +117 -0
- package/src/features/common/AppCardCompact/index.ts +189 -0
- package/src/features/common/AppCardCompact/styles.module.scss +141 -0
- package/src/features/common/AuthSelector/index.ts +537 -0
- package/src/features/common/AuthSelector/styles.module.scss +161 -0
- package/src/features/common/AuthSelectorCompact/index.ts +706 -0
- package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
- package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
- package/src/features/common/DynamicField/index.ts +229 -0
- package/src/features/common/DynamicField/styles.module.scss +67 -0
- package/src/features/common/DynamicTypedField/index.ts +217 -0
- package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
- package/src/features/common/FunctionForm/index.ts +862 -0
- package/src/features/common/FunctionForm/styles.module.scss +163 -0
- package/src/features/common/MappingUI/index.ts +649 -0
- package/src/features/common/MappingUI/styles.module.scss +121 -0
- package/src/features/common/MarketplaceAppCard/index.ts +279 -0
- package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
- package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
- package/src/features/common/NewMappingUI/index.ts +515 -0
- package/src/features/common/NewMappingUI/styles.module.scss +113 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
- package/src/features/common/RequestAppWidget/index.ts +48 -0
- package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
- package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
- package/src/features/common/SectionField/index.ts +272 -0
- package/src/features/common/SectionField/styles.module.scss +67 -0
- package/src/features/common/Step/index.ts +827 -0
- package/src/features/common/Step/styles.module.scss +12 -0
- package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
- package/src/features/common/StepNavigation/NavItem.ts +111 -0
- package/src/features/common/StepNavigation/index.ts +257 -0
- package/src/features/common/StepNavigation/styles.module.scss +117 -0
- package/src/features/common/Steps/index.ts +1139 -0
- package/src/features/common/Steps/styles.module.scss +314 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
- package/src/features/containers/AppFlowContainer/index.ts +114 -0
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
- package/src/features/containers/AppPageContainer/index.tsx +93 -0
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +161 -0
- package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
- package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
- package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
- package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
- package/src/features/containers/AuthSetupContainer/index.ts +349 -0
- package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
- package/src/features/containers/FlowSetupContainer/index.ts +390 -0
- package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
- package/src/features/containers/MarkeplaceApps/index.ts +574 -0
- package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
- package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
- package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
- package/src/features/containers/MarketplaceContainer/index.ts +242 -0
- package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
- package/src/features/containers/SDKContainer/index.ts +817 -0
- package/src/features/containers/SDKContainer/styles.module.scss +266 -0
- package/src/features/containers/SDKDebugContainer/index.ts +137 -0
- package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
- package/src/features/containers/SDKFailedContainer/index.ts +117 -0
- package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
- package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
- package/src/features/integrations/IntegrationRow/index.ts +129 -0
- package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
- package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
- package/src/features/integrations/IntegrationsList/index.ts +252 -0
- package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
- package/src/features/templates/Template/index.ts +295 -0
- package/src/features/templates/Template/styles.module.scss +226 -0
- package/src/features/templates/TemplatesView/index.ts +368 -0
- package/src/features/templates/TemplatesView/styles.module.scss +71 -0
- package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
- package/src/hooks/useAutosizeTextArea.ts +22 -0
- package/src/hooks/useCustomRef.ts +13 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useElementResize.ts +40 -0
- package/src/hooks/useEventListener.ts +44 -0
- package/src/hooks/useHover.ts +40 -0
- package/src/hooks/useOnClickOutside.ts +32 -0
- package/src/index.ts +2051 -0
- package/src/index.umd.ts +13 -0
- package/src/interfaces/index.ts +924 -0
- package/src/modules/api/index.ts +1315 -0
- package/src/modules/api/responseHandler.ts +38 -0
- package/src/modules/event-emitter/index.ts +72 -0
- package/src/modules/event-emitter/runners/abstract.ts +21 -0
- package/src/modules/event-emitter/runners/default.ts +11 -0
- package/src/modules/event-emitter/runners/ntimes.ts +28 -0
- package/src/modules/event-emitter/types.ts +34 -0
- package/src/store/actionFunctions.ts +1573 -0
- package/src/store/index.ts +17 -0
- package/src/store/initialState.ts +58 -0
- package/src/stories/Button.stories.tsx +83 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
- package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
- package/src/stories/EditableText.stories.tsx +35 -0
- package/src/stories/Input/BaseInput.stories.tsx +48 -0
- package/src/stories/Input/DateInput.stories.tsx +28 -0
- package/src/stories/Input/Input.stories.tsx +24 -0
- package/src/stories/Input/PasswordInput.stories.tsx +26 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/Listbox.stories.tsx +122 -0
- package/src/stories/Radio/Radio.stories.tsx +39 -0
- package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
- package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
- package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
- package/src/stories/TabBar.stories.tsx +31 -0
- package/src/stories/TextArea.stories.tsx +23 -0
- package/src/stories/TimeInput.stories.tsx +37 -0
- package/src/stories/Toggle.stories.tsx +33 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +293 -0
- package/src/types/store.ts +366 -0
- package/src/types/utils.ts +19 -0
- package/src/utils/ActivityOutputUtils.ts +163 -0
- package/src/utils/common.ts +20 -0
- package/src/utils/copyToClipboard.ts +24 -0
- package/src/utils/datetime.ts +101 -0
- package/src/utils/getUrlParam.ts +11 -0
- package/src/utils/isAuthMessage.ts +16 -0
- package/src/utils/isBrowser.ts +1 -0
- package/src/utils/jsonEncodeDecode.ts +15 -0
- package/src/utils/objectUtils.ts +116 -0
- package/src/utils/popup.ts +30 -0
- package/src/utils/searchJson.ts +51 -0
- package/src/utils/stepUtils.ts +45 -0
- package/src/utils/truncate.ts +6 -0
- package/test/setup.ts +1 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
2
|
+
import { html } from 'htm/preact';
|
|
3
|
+
import { useState, useRef, useEffect } from 'preact/hooks';
|
|
4
|
+
import { Input } from '@/components/Input';
|
|
5
|
+
import { TextArea } from '@/components/TextArea';
|
|
6
|
+
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
|
|
7
|
+
import { FieldDropdown } from '@/components/MultipurposeField/TagMenu';
|
|
8
|
+
import { NestedObject } from '@/interfaces';
|
|
9
|
+
import { TagProps } from '@/components/Tag';
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import Tagify from '@yaireo/tagify';
|
|
12
|
+
import '@yaireo/tagify/dist/tagify.css'; // Tagify CSS
|
|
13
|
+
import styles from './styles.module.scss';
|
|
14
|
+
|
|
15
|
+
interface MultipurposeFieldProps {
|
|
16
|
+
activityOutputData: NestedObject;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
placeholder: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
regex: string | null;
|
|
22
|
+
regexErrorMessage: string | null;
|
|
23
|
+
isRequired?: boolean;
|
|
24
|
+
isHidden?: boolean;
|
|
25
|
+
showStepValidation?: boolean;
|
|
26
|
+
onChange?: (val: string, passesRegexTest?: boolean) => void;
|
|
27
|
+
isChanged?: boolean;
|
|
28
|
+
className?: string;
|
|
29
|
+
containerClass: string;
|
|
30
|
+
type: string;
|
|
31
|
+
key: string;
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
apiHandler: any;
|
|
34
|
+
isSearchable: boolean;
|
|
35
|
+
endpointUrl: string;
|
|
36
|
+
isDynamic: boolean;
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
endpointData: any;
|
|
39
|
+
skipOptionFetch: boolean;
|
|
40
|
+
isMappable?: boolean;
|
|
41
|
+
isEditable?: boolean;
|
|
42
|
+
allowTagsInText?: boolean;
|
|
43
|
+
accountConnected?: boolean;
|
|
44
|
+
isConfigMode?: boolean;
|
|
45
|
+
fieldId?: string;
|
|
46
|
+
labelTags: TagProps[];
|
|
47
|
+
activityOutputDataRaw: any;
|
|
48
|
+
enableTagify?: boolean;
|
|
49
|
+
refreshRootStepData?: (callback?: any) => void;
|
|
50
|
+
isArray?: boolean;
|
|
51
|
+
isButtonEnabled?: boolean;
|
|
52
|
+
buttonText?: string;
|
|
53
|
+
onButtonClickScript?: string;
|
|
54
|
+
buttonScriptRequiresAuthToken?: boolean;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const MultipurposeField = (props: MultipurposeFieldProps) => {
|
|
58
|
+
const {
|
|
59
|
+
activityOutputData = {},
|
|
60
|
+
title,
|
|
61
|
+
description,
|
|
62
|
+
placeholder,
|
|
63
|
+
value,
|
|
64
|
+
regex,
|
|
65
|
+
regexErrorMessage,
|
|
66
|
+
isRequired,
|
|
67
|
+
showStepValidation,
|
|
68
|
+
onChange,
|
|
69
|
+
isChanged,
|
|
70
|
+
className,
|
|
71
|
+
type,
|
|
72
|
+
isMappable,
|
|
73
|
+
isEditable,
|
|
74
|
+
allowTagsInText,
|
|
75
|
+
isHidden,
|
|
76
|
+
isConfigMode = false,
|
|
77
|
+
fieldId = 'dropdown-field',
|
|
78
|
+
labelTags = [],
|
|
79
|
+
activityOutputDataRaw = [],
|
|
80
|
+
enableTagify = true,
|
|
81
|
+
refreshRootStepData,
|
|
82
|
+
isArray = false,
|
|
83
|
+
isButtonEnabled = false,
|
|
84
|
+
buttonText = 'Add',
|
|
85
|
+
onButtonClickScript = '',
|
|
86
|
+
buttonScriptRequiresAuthToken = false,
|
|
87
|
+
} = props;
|
|
88
|
+
const [showTagMenu, setShowTagMenu] = useState(false);
|
|
89
|
+
const [currentValue, setCurrentValue] = useState(value);
|
|
90
|
+
const [newValue, setNewValue] = useState(value);
|
|
91
|
+
const [tempPlaceholder, setTempPlaceholder] = useState('');
|
|
92
|
+
const [searchValue, setSearchValue] = useState('');
|
|
93
|
+
const [tagify, setTagify] = useState<Tagify | null>(null);
|
|
94
|
+
const [defaultTagifyValue, setDefaultTagifyValue] = useState('');
|
|
95
|
+
|
|
96
|
+
const menuRef = useRef<HTMLDivElement>();
|
|
97
|
+
const inputRef = useRef<HTMLInputElement>();
|
|
98
|
+
|
|
99
|
+
const handleTabKeyDown = (event: KeyboardEvent) => {
|
|
100
|
+
if (event.key === 'Tab') {
|
|
101
|
+
setShowTagMenu(false);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const getFieldValFromActivityOutputRaw = (array: any, val: any) => {
|
|
106
|
+
const valueToUse = Array.isArray(val) ? val[val.length - 1] : val;
|
|
107
|
+
const results = valueToUse.toString().match(/{([^}]+)}/g);
|
|
108
|
+
let valSubstituded = valueToUse;
|
|
109
|
+
(results || []).forEach((tag: string) => {
|
|
110
|
+
const tagCheck = tag.replace(/{|}/g, '');
|
|
111
|
+
(array || []).forEach((arr: any) => {
|
|
112
|
+
if (arr.value === tagCheck) {
|
|
113
|
+
valSubstituded = valSubstituded.replace(tag, `{${arr.text}}`);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
return valSubstituded;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const clrearTag = (e: KeyboardEvent) => {
|
|
122
|
+
if (e.key === 'Backspace' && searchValue === '' && !isEditable) {
|
|
123
|
+
setCurrentValue('');
|
|
124
|
+
setNewValue('');
|
|
125
|
+
if (onChange) onChange('', true);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
inputRef.current?.addEventListener('keydown', clrearTag);
|
|
129
|
+
// cleanup function
|
|
130
|
+
return () => {
|
|
131
|
+
inputRef.current?.removeEventListener('keydown', clrearTag);
|
|
132
|
+
};
|
|
133
|
+
}, [inputRef.current, searchValue]);
|
|
134
|
+
|
|
135
|
+
// useEffect to update the current value when the value prop changes
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setCurrentValue(value);
|
|
138
|
+
setNewValue(getFieldValFromActivityOutputRaw(activityOutputDataRaw, value));
|
|
139
|
+
|
|
140
|
+
// Attach the event listener when the component mounts
|
|
141
|
+
document.addEventListener('keydown', handleTabKeyDown);
|
|
142
|
+
|
|
143
|
+
// Clean up the event listener when the component unmounts
|
|
144
|
+
return () => {
|
|
145
|
+
document.removeEventListener('keydown', handleTabKeyDown);
|
|
146
|
+
};
|
|
147
|
+
}, [value, title]);
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const textfield = inputRef.current;
|
|
151
|
+
if (textfield && activityOutputDataRaw.length) {
|
|
152
|
+
const el: any = document.getElementById(`tagify_${fieldId}`);
|
|
153
|
+
if (el && el.dataset.tagifyFieldId !== fieldId) {
|
|
154
|
+
el.value = getDefaultTagifyValue(value || '');
|
|
155
|
+
el.dataset.tagifyFieldId = fieldId;
|
|
156
|
+
}
|
|
157
|
+
if (el && !el.__tagify) {
|
|
158
|
+
var tagify = new Tagify(el, {
|
|
159
|
+
mode: 'mix',
|
|
160
|
+
duplicates: true,
|
|
161
|
+
editTags: false,
|
|
162
|
+
trim: false,
|
|
163
|
+
tagTextProp: 'text',
|
|
164
|
+
templates: {
|
|
165
|
+
tag: tagTemplate,
|
|
166
|
+
},
|
|
167
|
+
userInput: allowTagsInText || !isMappable ? true : false,
|
|
168
|
+
});
|
|
169
|
+
tagify
|
|
170
|
+
.on('focus', handleFieldFocus)
|
|
171
|
+
.on('remove', handleOnTagRemove)
|
|
172
|
+
.on('change', handleOnTagRemove);
|
|
173
|
+
setTagify(tagify);
|
|
174
|
+
}
|
|
175
|
+
} else if (
|
|
176
|
+
textfield &&
|
|
177
|
+
!activityOutputDataRaw.length &&
|
|
178
|
+
!value?.startsWith('{') &&
|
|
179
|
+
!value?.endsWith('}')
|
|
180
|
+
) {
|
|
181
|
+
const el: any = document.getElementById(`tagify_${fieldId}`);
|
|
182
|
+
if (el && el.dataset.tagifyFieldId !== fieldId) {
|
|
183
|
+
el.value = getDefaultTagifyValue(value || '');
|
|
184
|
+
el.dataset.tagifyFieldId = fieldId;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}, [activityOutputDataRaw]);
|
|
188
|
+
|
|
189
|
+
const handleTagInputChanged = (e: any) => {
|
|
190
|
+
const textField = inputRef.current;
|
|
191
|
+
if (textField) {
|
|
192
|
+
const oldValue = textField.value;
|
|
193
|
+
let newValue = oldValue;
|
|
194
|
+
if (removeWhitespace(oldValue).length === 0) {
|
|
195
|
+
newValue = '';
|
|
196
|
+
}
|
|
197
|
+
if (e.detail.textContent.length === 0) {
|
|
198
|
+
newValue = '';
|
|
199
|
+
}
|
|
200
|
+
setCurrentValue(newValue);
|
|
201
|
+
setNewValue(newValue);
|
|
202
|
+
if (onChange) onChange(newValue, true);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const handleOnTagRemove = (e: any) => {
|
|
206
|
+
const el: any = document.getElementById(`tagify_${fieldId}`);
|
|
207
|
+
let newValue = el.__tagify.DOM.input.innerText;
|
|
208
|
+
el.__tagify.value.forEach((tag: any) => {
|
|
209
|
+
newValue = newValue.replace(tag.text, `{${tag.value}}`);
|
|
210
|
+
});
|
|
211
|
+
newValue = newValue.trim();
|
|
212
|
+
if (removeWhitespace(newValue).length === 0) {
|
|
213
|
+
el.value = '';
|
|
214
|
+
newValue = '';
|
|
215
|
+
}
|
|
216
|
+
// newValue = newValue.replace(/^\n+|\n+$/g, ''); // remove leading and trailing newlines
|
|
217
|
+
newValue = newValue.replace(/<br>/g, '\n'); // replace <br> with newlines
|
|
218
|
+
newValue = newValue.replace(/\n{/g, '{').replace(/}\n/g, '}'); // remove \n before and after tags
|
|
219
|
+
|
|
220
|
+
setCurrentValue(newValue);
|
|
221
|
+
if (onChange) onChange(newValue, true);
|
|
222
|
+
};
|
|
223
|
+
//write a function that removes all whitespaces including \s, \u200b, \u00A0
|
|
224
|
+
const removeWhitespace = (str: string) => {
|
|
225
|
+
return str
|
|
226
|
+
.replace(/\s/g, '')
|
|
227
|
+
.replace(/\u200b/g, '')
|
|
228
|
+
.replace(/\u00A0/g, '');
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const tagTemplate = (tagData: any) => {
|
|
232
|
+
return `
|
|
233
|
+
<tag
|
|
234
|
+
contenteditable='false'
|
|
235
|
+
spellcheck='false'
|
|
236
|
+
tabIndex="-1"
|
|
237
|
+
class="tagify__tag ${tagData.class ? tagData.class : ''}"
|
|
238
|
+
>
|
|
239
|
+
<x title='' class='tagify__tag__removeBtn' role='button' aria-label='remove tag'></x>
|
|
240
|
+
<div>
|
|
241
|
+
<span data-hint="${
|
|
242
|
+
typeof tagData.title === 'string' ? tagData.title : ''
|
|
243
|
+
}" class='tagify__tag-text'>${tagData.text}</span>
|
|
244
|
+
</div>
|
|
245
|
+
</tag>`;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
useEffect(() => {
|
|
249
|
+
if (value) {
|
|
250
|
+
handleOnChange(value, true);
|
|
251
|
+
}
|
|
252
|
+
}, [fieldId]);
|
|
253
|
+
|
|
254
|
+
// Returns all those strings which are enclosed in curly braces {}
|
|
255
|
+
const getTags = (str: string) => {
|
|
256
|
+
const regex = /\{([^{}]+)}/g;
|
|
257
|
+
const matches = str.match(regex);
|
|
258
|
+
return matches;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const checkIfTagExists = (AOUElement: string, tagValue: string) => {
|
|
262
|
+
if (tagValue.includes('out.')) {
|
|
263
|
+
const tagValuePart = tagValue.split('out.')[1];
|
|
264
|
+
|
|
265
|
+
return AOUElement.endsWith(tagValuePart);
|
|
266
|
+
}
|
|
267
|
+
return false;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
const getDefaultTagifyValue = (value: any) => {
|
|
271
|
+
const tags = getTags(value || '');
|
|
272
|
+
if (tags && tags.length > 0) {
|
|
273
|
+
let newValue = value;
|
|
274
|
+
if (type === 'TEXTAREA') {
|
|
275
|
+
newValue = newValue.replace(/\n/g, '<br>');
|
|
276
|
+
}
|
|
277
|
+
tags.forEach((tag) => {
|
|
278
|
+
const tagValue = tag.replace(/{|}/g, '');
|
|
279
|
+
const tagData = (activityOutputDataRaw || []).find((element: any) => {
|
|
280
|
+
return (
|
|
281
|
+
element.value === tagValue ||
|
|
282
|
+
checkIfTagExists(element.value, tagValue)
|
|
283
|
+
);
|
|
284
|
+
}) || {
|
|
285
|
+
value: tagValue,
|
|
286
|
+
text: tagValue,
|
|
287
|
+
title: tagValue,
|
|
288
|
+
};
|
|
289
|
+
if (tagData) {
|
|
290
|
+
newValue = newValue?.replace(
|
|
291
|
+
tag,
|
|
292
|
+
`[[{"value":"${tagData.value}","text":"${
|
|
293
|
+
tagData.text
|
|
294
|
+
}","title":"${getTagData(tagData.text)}"}]]`,
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
return newValue;
|
|
299
|
+
}
|
|
300
|
+
return value;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
useOnClickOutside(menuRef, (e) => {
|
|
304
|
+
const clickedElement = e.target as HTMLElement;
|
|
305
|
+
|
|
306
|
+
if (
|
|
307
|
+
(clickedElement.tagName === 'INPUT' ||
|
|
308
|
+
clickedElement.tagName === 'TEXTAREA') &&
|
|
309
|
+
inputRef.current &&
|
|
310
|
+
inputRef.current.contains(e.target as Node)
|
|
311
|
+
)
|
|
312
|
+
return;
|
|
313
|
+
setTempPlaceholder('');
|
|
314
|
+
setSearchValue('');
|
|
315
|
+
setShowTagMenu(false);
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const removeSpecificString = (
|
|
319
|
+
str: string,
|
|
320
|
+
specificString: string,
|
|
321
|
+
): string => {
|
|
322
|
+
let tempStr = str;
|
|
323
|
+
if (tempStr.endsWith(specificString)) {
|
|
324
|
+
tempStr = tempStr.slice(0, -specificString.length);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return tempStr;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const getTagData = (tag: string) => {
|
|
331
|
+
if (tag.includes('.')) {
|
|
332
|
+
const tagParts = tag.split('.');
|
|
333
|
+
let tagValue: any = activityOutputData;
|
|
334
|
+
tagParts.forEach((tagPart) => {
|
|
335
|
+
if (tagValue[tagPart]) {
|
|
336
|
+
tagValue = tagValue[tagPart];
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
return tagValue;
|
|
340
|
+
}
|
|
341
|
+
return activityOutputData[tag];
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
const insertTag = (tag: string) => {
|
|
345
|
+
const result = activityOutputDataRaw.find((element: any) => {
|
|
346
|
+
return element.text === tag;
|
|
347
|
+
});
|
|
348
|
+
if (tagify) {
|
|
349
|
+
var tagElm = tagify.createTagElem({
|
|
350
|
+
value: result.value,
|
|
351
|
+
text: result.text,
|
|
352
|
+
title: getTagData(tag),
|
|
353
|
+
editable: false,
|
|
354
|
+
});
|
|
355
|
+
tagify.injectAtCaret(tagElm);
|
|
356
|
+
if (allowTagsInText) {
|
|
357
|
+
var elm = tagify.insertAfterTag(tagElm, ''); // <- adds space after the tag
|
|
358
|
+
tagify.placeCaretAfterNode(elm);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const onTagClick = (tag: string) => {
|
|
364
|
+
if (tagify) {
|
|
365
|
+
if (!allowTagsInText) {
|
|
366
|
+
tagify.removeAllTags();
|
|
367
|
+
}
|
|
368
|
+
insertTag(tag);
|
|
369
|
+
let newValue = tagify.DOM.input.textContent;
|
|
370
|
+
tagify.value.forEach((tag: any) => {
|
|
371
|
+
newValue = (newValue || '').replace(tag.text, `{${tag.value}}`);
|
|
372
|
+
});
|
|
373
|
+
newValue = (newValue || '').trim();
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
setCurrentValue(newValue);
|
|
377
|
+
if (onChange) onChange(newValue || '', true);
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
const onSelect = (option: string) => {
|
|
381
|
+
const textField = inputRef.current;
|
|
382
|
+
let newValue = `{${option}}`;
|
|
383
|
+
setTempPlaceholder('');
|
|
384
|
+
|
|
385
|
+
// if the field is editable only, then EU can only eneter text, no tags and tags menu wont show up, so this function wont be called
|
|
386
|
+
if (textField) {
|
|
387
|
+
if (allowTagsInText) {
|
|
388
|
+
// allowTagsInText will be true only if the field is editable
|
|
389
|
+
// if the fields is editable and allowTagsInText, then EU can enter text or select muliple tags within the text
|
|
390
|
+
const { selectionStart = 0, selectionEnd = 0 } = textField;
|
|
391
|
+
const oldValue =
|
|
392
|
+
searchValue !== ''
|
|
393
|
+
? removeSpecificString(textField.value || '', searchValue)
|
|
394
|
+
: textField.value;
|
|
395
|
+
const textBeforeCursor = oldValue.substring(0, selectionStart || 0);
|
|
396
|
+
const textAfterCursor = oldValue.substring(selectionEnd || 0);
|
|
397
|
+
const insertedText = `{${option}}`;
|
|
398
|
+
newValue = textBeforeCursor + insertedText + textAfterCursor;
|
|
399
|
+
textField.selectionStart = (selectionStart || 0) + insertedText.length;
|
|
400
|
+
textField.selectionEnd = textField.selectionStart;
|
|
401
|
+
textField.focus();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
// if the field is editable and mappable, then EU can enter text or select a tag
|
|
405
|
+
// if the fields in mappable only, then select only one tag
|
|
406
|
+
setCurrentValue(newValue);
|
|
407
|
+
if (showTagMenu && !isEditable) {
|
|
408
|
+
setShowTagMenu(false);
|
|
409
|
+
}
|
|
410
|
+
setSearchValue('');
|
|
411
|
+
if (onChange) onChange(newValue, true);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const handleFieldFocus = (e: any) => {
|
|
415
|
+
// open tag menu
|
|
416
|
+
if (isMappable) {
|
|
417
|
+
setShowTagMenu(true);
|
|
418
|
+
}
|
|
419
|
+
// if allowTagsInText is false, then make current value as temp placeholder to fade it out when user starts typing
|
|
420
|
+
// current valus is tag when it starts with { and ends with }
|
|
421
|
+
const vallueToUse = Array.isArray(currentValue)
|
|
422
|
+
? currentValue[0]
|
|
423
|
+
: currentValue;
|
|
424
|
+
const isTag = vallueToUse?.startsWith('{') && vallueToUse?.endsWith('}');
|
|
425
|
+
if (isEditable && !allowTagsInText && isMappable && isTag) {
|
|
426
|
+
setTempPlaceholder(vallueToUse || '');
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const getStringFromEnd = (str: string): string => {
|
|
431
|
+
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
432
|
+
const regex = /\{([^{}]+)$/;
|
|
433
|
+
const matches = str.match(regex);
|
|
434
|
+
|
|
435
|
+
if (matches && matches.length > 1) {
|
|
436
|
+
const capturedString = matches[0];
|
|
437
|
+
return capturedString;
|
|
438
|
+
}
|
|
439
|
+
return '';
|
|
440
|
+
};
|
|
441
|
+
const handleOnSearch = (val: string) => {
|
|
442
|
+
setTempPlaceholder(``);
|
|
443
|
+
const tempSearchValue =
|
|
444
|
+
showTagMenu && !isEditable ? val.trim() : getStringFromEnd(val);
|
|
445
|
+
if (val !== '') {
|
|
446
|
+
setSearchValue(tempSearchValue);
|
|
447
|
+
} else {
|
|
448
|
+
setSearchValue('');
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
const handleOnChange = (val: string, passedReg: boolean, index?: number) => {
|
|
452
|
+
setTempPlaceholder('');
|
|
453
|
+
setCurrentValue(val);
|
|
454
|
+
if (onChange) onChange(val, passedReg);
|
|
455
|
+
let valueToUse = index !== undefined ? val[index] : val;
|
|
456
|
+
if (index === undefined && Array.isArray(valueToUse)) {
|
|
457
|
+
valueToUse = valueToUse[valueToUse.length - 1];
|
|
458
|
+
}
|
|
459
|
+
const tempSearchValue = getStringFromEnd(valueToUse);
|
|
460
|
+
if (valueToUse !== '') {
|
|
461
|
+
setSearchValue(tempSearchValue);
|
|
462
|
+
} else {
|
|
463
|
+
setSearchValue('');
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
return html`
|
|
468
|
+
<div class="${styles.multipurposeFieldContainer}">
|
|
469
|
+
<div class="${styles.multipurposeField}">
|
|
470
|
+
${type === 'TEXTAREA'
|
|
471
|
+
? html`
|
|
472
|
+
${enableTagify && isMappable
|
|
473
|
+
? html`
|
|
474
|
+
<${TextArea}
|
|
475
|
+
id="tagify_${fieldId}"
|
|
476
|
+
title=${title}
|
|
477
|
+
description=${description}
|
|
478
|
+
placeholder="${showTagMenu && !isEditable
|
|
479
|
+
? currentValue
|
|
480
|
+
: tempPlaceholder || placeholder}"
|
|
481
|
+
regex=${regex}
|
|
482
|
+
regexErrorMessage=${regexErrorMessage}
|
|
483
|
+
showStepValidation="${showStepValidation && !showTagMenu}"
|
|
484
|
+
isRequired=${isRequired}
|
|
485
|
+
onFocus=${handleFieldFocus}
|
|
486
|
+
onChange="${showTagMenu && !isEditable
|
|
487
|
+
? handleOnSearch
|
|
488
|
+
: handleOnChange}"
|
|
489
|
+
isChanged="${isChanged}"
|
|
490
|
+
ref=${inputRef}
|
|
491
|
+
isEditable="${isEditable || showTagMenu}"
|
|
492
|
+
isHidden=${isHidden}
|
|
493
|
+
fieldId=${fieldId}
|
|
494
|
+
labelTags=${labelTags}
|
|
495
|
+
/>
|
|
496
|
+
<div style="display:none">
|
|
497
|
+
<${TextArea}
|
|
498
|
+
id="${fieldId}"
|
|
499
|
+
title=${title}
|
|
500
|
+
description=${description}
|
|
501
|
+
placeholder="${showTagMenu && !isEditable
|
|
502
|
+
? currentValue
|
|
503
|
+
: tempPlaceholder || placeholder}"
|
|
504
|
+
value="${showTagMenu && !isEditable
|
|
505
|
+
? searchValue
|
|
506
|
+
: tempPlaceholder
|
|
507
|
+
? ''
|
|
508
|
+
: currentValue}"
|
|
509
|
+
regex=${regex}
|
|
510
|
+
regexErrorMessage=${regexErrorMessage}
|
|
511
|
+
showStepValidation="${showStepValidation &&
|
|
512
|
+
!showTagMenu}"
|
|
513
|
+
isRequired=${isRequired}
|
|
514
|
+
onFocus=${handleFieldFocus}
|
|
515
|
+
onChange="${showTagMenu && !isEditable
|
|
516
|
+
? handleOnSearch
|
|
517
|
+
: handleOnChange}"
|
|
518
|
+
isChanged="${isChanged}"
|
|
519
|
+
ref=${inputRef}
|
|
520
|
+
isEditable="${isEditable || showTagMenu}"
|
|
521
|
+
isHidden=${isHidden}
|
|
522
|
+
fieldId=${fieldId}
|
|
523
|
+
labelTags=${labelTags}
|
|
524
|
+
/>
|
|
525
|
+
</div>
|
|
526
|
+
`
|
|
527
|
+
: html`
|
|
528
|
+
<${TextArea}
|
|
529
|
+
id="${fieldId}"
|
|
530
|
+
title=${title}
|
|
531
|
+
description=${description}
|
|
532
|
+
placeholder="${showTagMenu && !isEditable
|
|
533
|
+
? currentValue
|
|
534
|
+
: tempPlaceholder || placeholder}"
|
|
535
|
+
value="${showTagMenu && !isEditable
|
|
536
|
+
? searchValue
|
|
537
|
+
: tempPlaceholder
|
|
538
|
+
? ''
|
|
539
|
+
: currentValue}"
|
|
540
|
+
regex=${regex}
|
|
541
|
+
regexErrorMessage=${regexErrorMessage}
|
|
542
|
+
showStepValidation="${showStepValidation && !showTagMenu}"
|
|
543
|
+
isRequired=${isRequired}
|
|
544
|
+
onFocus=${handleFieldFocus}
|
|
545
|
+
onChange="${showTagMenu && !isEditable
|
|
546
|
+
? handleOnSearch
|
|
547
|
+
: handleOnChange}"
|
|
548
|
+
isChanged="${isChanged}"
|
|
549
|
+
ref=${inputRef}
|
|
550
|
+
isEditable="${isEditable || showTagMenu}"
|
|
551
|
+
isHidden=${isHidden}
|
|
552
|
+
fieldId=${fieldId}
|
|
553
|
+
labelTags=${labelTags}
|
|
554
|
+
/>
|
|
555
|
+
`}
|
|
556
|
+
`
|
|
557
|
+
: html`
|
|
558
|
+
${enableTagify && isMappable
|
|
559
|
+
? html`
|
|
560
|
+
<${Input}
|
|
561
|
+
id="tagify_${fieldId}"
|
|
562
|
+
title="${title}"
|
|
563
|
+
description="${description}"
|
|
564
|
+
placeholder="${showTagMenu && !isEditable
|
|
565
|
+
? currentValue
|
|
566
|
+
: tempPlaceholder || placeholder}"
|
|
567
|
+
regex="${regex}"
|
|
568
|
+
regexErrorMessage="${regexErrorMessage}"
|
|
569
|
+
isRequired="${isRequired}"
|
|
570
|
+
showStepValidation="${showStepValidation && !showTagMenu}"
|
|
571
|
+
handleFocus=${handleFieldFocus}
|
|
572
|
+
onChange="${showTagMenu && !isEditable
|
|
573
|
+
? handleOnSearch
|
|
574
|
+
: handleOnChange}"
|
|
575
|
+
isEditable="${isEditable || showTagMenu}"
|
|
576
|
+
isHidden="${isHidden}"
|
|
577
|
+
isChanged=${isChanged}
|
|
578
|
+
className="${className}"
|
|
579
|
+
ref=${inputRef}
|
|
580
|
+
fieldId=${fieldId}
|
|
581
|
+
labelTags=${labelTags}
|
|
582
|
+
hideError=${false}
|
|
583
|
+
isArray=${isArray}
|
|
584
|
+
isButtonEnabled=${isButtonEnabled}
|
|
585
|
+
buttonText=${buttonText}
|
|
586
|
+
onButtonClickScript=${onButtonClickScript}
|
|
587
|
+
buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
|
|
588
|
+
apiHandler=${props.apiHandler}
|
|
589
|
+
/>
|
|
590
|
+
<div style="display:none">
|
|
591
|
+
<${Input}
|
|
592
|
+
id="${fieldId}"
|
|
593
|
+
title="${title}"
|
|
594
|
+
description="${description}"
|
|
595
|
+
placeholder="${showTagMenu && !isEditable
|
|
596
|
+
? currentValue
|
|
597
|
+
: tempPlaceholder || placeholder}"
|
|
598
|
+
value="${showTagMenu && !isEditable
|
|
599
|
+
? searchValue
|
|
600
|
+
: tempPlaceholder
|
|
601
|
+
? ''
|
|
602
|
+
: currentValue}"
|
|
603
|
+
regex="${regex}"
|
|
604
|
+
regexErrorMessage="${regexErrorMessage}"
|
|
605
|
+
isRequired="${isRequired}"
|
|
606
|
+
showStepValidation="${showStepValidation &&
|
|
607
|
+
!showTagMenu}"
|
|
608
|
+
handleFocus=${handleFieldFocus}
|
|
609
|
+
onChange="${showTagMenu && !isEditable
|
|
610
|
+
? handleOnSearch
|
|
611
|
+
: handleOnChange}"
|
|
612
|
+
isEditable="${isEditable || showTagMenu}"
|
|
613
|
+
isHidden="${isHidden}"
|
|
614
|
+
isChanged=${isChanged}
|
|
615
|
+
className="${className}"
|
|
616
|
+
ref=${inputRef}
|
|
617
|
+
fieldId=${fieldId}
|
|
618
|
+
labelTags=${labelTags}
|
|
619
|
+
hideError=${false}
|
|
620
|
+
isArray=${isArray}
|
|
621
|
+
/>
|
|
622
|
+
</div>
|
|
623
|
+
`
|
|
624
|
+
: html`
|
|
625
|
+
<${Input}
|
|
626
|
+
id="${fieldId}"
|
|
627
|
+
title="${title}"
|
|
628
|
+
description="${description}"
|
|
629
|
+
placeholder="${showTagMenu && !isEditable
|
|
630
|
+
? currentValue
|
|
631
|
+
: tempPlaceholder || placeholder}"
|
|
632
|
+
value="${showTagMenu && !isEditable
|
|
633
|
+
? searchValue
|
|
634
|
+
: tempPlaceholder
|
|
635
|
+
? ''
|
|
636
|
+
: currentValue}"
|
|
637
|
+
regex="${regex}"
|
|
638
|
+
regexErrorMessage="${regexErrorMessage}"
|
|
639
|
+
isRequired="${isRequired}"
|
|
640
|
+
showStepValidation="${showStepValidation && !showTagMenu}"
|
|
641
|
+
handleFocus=${handleFieldFocus}
|
|
642
|
+
onChange="${showTagMenu && !isEditable
|
|
643
|
+
? handleOnSearch
|
|
644
|
+
: handleOnChange}"
|
|
645
|
+
isEditable="${isEditable || showTagMenu}"
|
|
646
|
+
isHidden="${isHidden}"
|
|
647
|
+
isChanged=${isChanged}
|
|
648
|
+
className="${className}"
|
|
649
|
+
ref=${inputRef}
|
|
650
|
+
fieldId=${fieldId}
|
|
651
|
+
labelTags=${labelTags}
|
|
652
|
+
hideError=${false}
|
|
653
|
+
isArray=${isArray}
|
|
654
|
+
isButtonEnabled=${isButtonEnabled}
|
|
655
|
+
buttonText=${buttonText}
|
|
656
|
+
onButtonClickScript=${onButtonClickScript}
|
|
657
|
+
buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
|
|
658
|
+
apiHandler=${props.apiHandler}
|
|
659
|
+
/>
|
|
660
|
+
`}
|
|
661
|
+
`}
|
|
662
|
+
</div>
|
|
663
|
+
<div>
|
|
664
|
+
${showTagMenu &&
|
|
665
|
+
(isMappable || allowTagsInText) &&
|
|
666
|
+
html` <div
|
|
667
|
+
ref=${menuRef}
|
|
668
|
+
className=${`${type.toLocaleLowerCase()}_tags_dropdown`}
|
|
669
|
+
>
|
|
670
|
+
<${FieldDropdown}
|
|
671
|
+
tags=${activityOutputData}
|
|
672
|
+
onTagClick=${enableTagify && isMappable ? onTagClick : onSelect}
|
|
673
|
+
hideTabs=${true}
|
|
674
|
+
fieldId=${fieldId}
|
|
675
|
+
value=${currentValue}
|
|
676
|
+
enableSearch=${Object.keys(activityOutputData).length > 0
|
|
677
|
+
? true
|
|
678
|
+
: false}
|
|
679
|
+
refreshRootStepData=${refreshRootStepData}
|
|
680
|
+
/>
|
|
681
|
+
</div>`}
|
|
682
|
+
</div>
|
|
683
|
+
</div>
|
|
684
|
+
`;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
export { MultipurposeField, MultipurposeFieldProps };
|