ebta-workflow-prod 1.1.2 → 4.0.1
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/.eslintrc.js +7 -0
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +3 -0
- package/README.md +26 -0
- package/build/2983859c0d77824ec8db.svg +1 -0
- package/build/4168d659d55fd94368bc.svg +1 -0
- package/build/641b2c17e92b0e885b9f.svg +1 -0
- package/build/882445a26a4f3964786f.svg +1 -0
- package/build/activitypack.json +1 -1
- package/build/b280e967312a55101032.svg +1 -0
- package/build/main.js +2 -2
- package/build/main.js.LICENSE.txt +99 -0
- package/certs/localhost+2-key.pem +28 -0
- package/certs/localhost+2.pem +26 -0
- package/index.html +58 -0
- package/package.json +43 -7
- package/public/img/background.svg +3 -3
- package/public/img/compass.svg +3 -3
- package/public/img/grab.svg +3 -3
- package/public/img/grabbing.svg +3 -3
- package/public/img/sprites.svg +14 -14
- package/src/activities/AppendObjects.ts +40 -0
- package/src/activities/Base64ToFile.ts +56 -0
- package/src/activities/CreateGraphicLayer.ts +85 -0
- package/src/activities/DrapGeometry.ts +99 -0
- package/src/activities/GetElementByDataLayoutID.ts +58 -0
- package/src/activities/GetSesionStorage.ts +36 -0
- package/src/activities/GetTaskStatus.ts +56 -0
- package/src/activities/GetUserToken.ts +102 -0
- package/src/activities/GetvGISDetails copy.ts +110 -0
- package/src/activities/GetvGISDetails.ts +110 -0
- package/src/activities/HTMLextractor.ts +188 -0
- package/src/activities/LegendCreator.ts +155 -0
- package/src/activities/MergeObjects.ts +61 -0
- package/src/activities/PDFMapGenerator.ts +729 -0
- package/src/activities/RequestChecker.ts +94 -0
- package/src/activities/Sample.ts +41 -0
- package/src/activities/SetSessionStorage.ts +57 -0
- package/src/activities/SliceLine.ts +61 -0
- package/src/elements/AttributeFilter.tsx +1867 -0
- package/src/elements/CircularSlider.tsx +67 -0
- package/src/elements/CsColorPicker.tsx +140 -0
- package/src/elements/DropDownMenu.tsx +282 -0
- package/src/elements/HeaderwithHelp.tsx +178 -0
- package/src/elements/ItemSearcher.tsx +1035 -0
- package/src/elements/ItemSearcher_v2.tsx +1071 -0
- package/src/elements/LineChartMui.tsx +50 -0
- package/src/elements/MenueBar.tsx +118 -0
- package/src/elements/MultipleAutoCompleteCS.tsx +145 -0
- package/src/elements/SingleAutoCompleteCS.tsx +133 -0
- package/src/elements/TableRadioGoup.tsx +163 -0
- package/src/elements/Timeline.tsx +104 -0
- package/src/elements/ToggleButtonGroup.tsx +129 -0
- package/src/elements/Viewer360.tsx +71 -0
- package/src/elements/modules/AttributeFilterEasyComp.tsx +253 -0
- package/src/index.ts +41 -0
- package/src/main.ts +15 -0
- package/src/styles/imageSlider.css +34 -0
- package/tsconfig.json +12 -0
- package/uuid.js +7 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FormElementProps, FormElementRegistration } from "@vertigis/workflow";
|
|
3
|
+
import CircularSlider from '@fseehawer/react-circular-slider';
|
|
4
|
+
|
|
5
|
+
// Cast to React Component to satisfy TypeScript
|
|
6
|
+
|
|
7
|
+
interface Continuous {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
clicks: number;
|
|
10
|
+
interval: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type KnobPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
14
|
+
|
|
15
|
+
interface CircularSliderProps extends FormElementProps<number> {
|
|
16
|
+
width?: number;
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
label?: string;
|
|
20
|
+
knobPosition?: KnobPosition; // Fixed casing
|
|
21
|
+
continuous?: Continuous; // Fixed spelling
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function CircularSliderElement(props: CircularSliderProps): React.ReactElement {
|
|
25
|
+
const {
|
|
26
|
+
value,
|
|
27
|
+
setValue,
|
|
28
|
+
width = 280,
|
|
29
|
+
min = 0,
|
|
30
|
+
max = 360,
|
|
31
|
+
label = "Value",
|
|
32
|
+
knobPosition = 'top', // Fixed casing
|
|
33
|
+
...rest
|
|
34
|
+
} = props;
|
|
35
|
+
|
|
36
|
+
const handleChange = React.useCallback((newValue: string | number) => {
|
|
37
|
+
setValue(typeof newValue === 'string' ? parseFloat(newValue) : newValue);
|
|
38
|
+
}, [setValue]);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<CircularSlider
|
|
42
|
+
width={width}
|
|
43
|
+
min={min}
|
|
44
|
+
max={max}
|
|
45
|
+
label={label}
|
|
46
|
+
knobPosition={knobPosition} // Fixed casing
|
|
47
|
+
onChange={handleChange}
|
|
48
|
+
initialValue={value || 0}
|
|
49
|
+
{...rest}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const CircularSliderElementRegistration: FormElementRegistration<CircularSliderProps> = {
|
|
55
|
+
component: CircularSliderElement,
|
|
56
|
+
id: "CircularSlider",
|
|
57
|
+
getInitialProperties: () => ({
|
|
58
|
+
value: 0,
|
|
59
|
+
min: 0,
|
|
60
|
+
max: 360,
|
|
61
|
+
label: "Value",
|
|
62
|
+
knobPosition: 'top', // Fixed casing
|
|
63
|
+
width: 280
|
|
64
|
+
})
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export default CircularSliderElementRegistration;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { MantineProvider } from '@mantine/core';
|
|
3
|
+
import { FormElementProps, FormElementRegistration } from "@vertigis/workflow";
|
|
4
|
+
import { ColorInput, ColorPicker } from '@mantine/core';
|
|
5
|
+
import type { ColorFormat } from "@mantine/core/lib/components/ColorPicker/ColorPicker.types";
|
|
6
|
+
|
|
7
|
+
import "@mantine/core/styles.css";
|
|
8
|
+
|
|
9
|
+
import Color from "esri/Color";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
declare module "@vertigis/workflow" {
|
|
13
|
+
interface FormElementSettableProps<> {
|
|
14
|
+
esriColor?: Color
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Define a type that includes both the base props and your custom props
|
|
19
|
+
interface CsColorPickerV2Props extends FormElementProps<string> {
|
|
20
|
+
description?: string;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
swatches?: string[];
|
|
24
|
+
swatchesPerRow: number;
|
|
25
|
+
componentType: string;
|
|
26
|
+
colorType: ColorFormat;
|
|
27
|
+
colorPickerSize?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A Workflow element built using React.
|
|
32
|
+
* @displayName New Color Picker
|
|
33
|
+
* @description New Color Picker V1
|
|
34
|
+
* @param props The props that will be provided by the Workflow runtime.
|
|
35
|
+
*/
|
|
36
|
+
function CsColorPickerV2(props: CsColorPickerV2Props): React.ReactElement {
|
|
37
|
+
const {
|
|
38
|
+
setProperty,
|
|
39
|
+
placeholder,
|
|
40
|
+
colorPickerSize,
|
|
41
|
+
description,
|
|
42
|
+
defaultValue,
|
|
43
|
+
colorType,
|
|
44
|
+
setValue,
|
|
45
|
+
raiseEvent,
|
|
46
|
+
value,
|
|
47
|
+
swatches,
|
|
48
|
+
swatchesPerRow,
|
|
49
|
+
componentType
|
|
50
|
+
} = props;
|
|
51
|
+
|
|
52
|
+
const handleChange = (color: string) => {
|
|
53
|
+
let esriColor: Color;
|
|
54
|
+
|
|
55
|
+
if (color.startsWith("rgb")) {
|
|
56
|
+
const values = color
|
|
57
|
+
.replace(/^rgba?\(|\s+|\)$/g, '')
|
|
58
|
+
.split(",")
|
|
59
|
+
.map(val => parseFloat(val.trim()));
|
|
60
|
+
|
|
61
|
+
esriColor = new Color([
|
|
62
|
+
values[0] || 0, // r
|
|
63
|
+
values[1] || 0, // g
|
|
64
|
+
values[2] || 0, // b
|
|
65
|
+
values[3] !== undefined ? values[3] : 1 // a
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
} else if (color.startsWith("#")) {
|
|
69
|
+
// Handle Hex format
|
|
70
|
+
esriColor = new Color(color);
|
|
71
|
+
} else {
|
|
72
|
+
// Handle named colors or other formats
|
|
73
|
+
esriColor = new Color(color);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
setProperty("esriColor", esriColor);
|
|
77
|
+
setValue(color);
|
|
78
|
+
raiseEvent("changed", color);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<MantineProvider withStaticClasses withGlobalClasses classNamesPrefix="ebta-mantime">
|
|
83
|
+
{componentType === "ColorInput" ? (
|
|
84
|
+
<ColorInput
|
|
85
|
+
swatches={swatches? swatches : undefined}
|
|
86
|
+
swatchesPerRow={swatches ? swatchesPerRow : undefined}
|
|
87
|
+
value={value}
|
|
88
|
+
size={colorPickerSize}
|
|
89
|
+
onChange={handleChange}
|
|
90
|
+
description={description ? description : undefined}
|
|
91
|
+
placeholder={placeholder ? placeholder : undefined}
|
|
92
|
+
format={colorType}
|
|
93
|
+
defaultValue={defaultValue}
|
|
94
|
+
/>
|
|
95
|
+
) : (
|
|
96
|
+
<ColorPicker
|
|
97
|
+
fullWidth
|
|
98
|
+
size={colorPickerSize}
|
|
99
|
+
swatches={swatches? swatches : undefined}
|
|
100
|
+
swatchesPerRow={swatches ? swatchesPerRow : undefined}
|
|
101
|
+
value={value}
|
|
102
|
+
onChange={handleChange}
|
|
103
|
+
format={colorType}
|
|
104
|
+
defaultValue={defaultValue}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
</MantineProvider>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
const CsColorPickerV2ElementRegistration: FormElementRegistration<CsColorPickerV2Props> = {
|
|
113
|
+
component: CsColorPickerV2,
|
|
114
|
+
getInitialProperties: () => ({
|
|
115
|
+
componentType: "ColorInput",
|
|
116
|
+
defaultValue: "rgb(168, 160, 152, 1)",
|
|
117
|
+
swatchesPerRow: 7,
|
|
118
|
+
colorPickerSize: "md",
|
|
119
|
+
colorType: "rgba" as ColorFormat,
|
|
120
|
+
swatches: [
|
|
121
|
+
"rgb(37, 38, 43)",
|
|
122
|
+
"rgb(134, 142, 150)",
|
|
123
|
+
"rgb(250, 82, 82)",
|
|
124
|
+
"rgb(230, 73, 128)",
|
|
125
|
+
"rgb(190, 75, 219)",
|
|
126
|
+
"rgb(121, 80, 242)",
|
|
127
|
+
"rgb(76, 110, 245)",
|
|
128
|
+
"rgb(34, 139, 230)",
|
|
129
|
+
"rgb(21, 170, 191)",
|
|
130
|
+
"rgb(18, 184, 134)",
|
|
131
|
+
"rgb(64, 192, 87)",
|
|
132
|
+
"rgb(130, 201, 30)",
|
|
133
|
+
"rgb(250, 176, 5)",
|
|
134
|
+
"rgb(253, 126, 20)"
|
|
135
|
+
]
|
|
136
|
+
}),
|
|
137
|
+
id: "CsColorPickerV2",
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export default CsColorPickerV2ElementRegistration;
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormElementProps, FormElementRegistration } from "@vertigis/workflow";
|
|
3
|
+
import { createTheme, ThemeProvider } from "@mui/material/styles";
|
|
4
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
6
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
7
|
+
import FormControl from "@mui/material/FormControl";
|
|
8
|
+
import InputLabel from "@mui/material/InputLabel";
|
|
9
|
+
import Select from "@mui/material/Select";
|
|
10
|
+
import OutlinedInput from "@mui/material/OutlinedInput";
|
|
11
|
+
import {useEffect} from "react"
|
|
12
|
+
|
|
13
|
+
interface Option {
|
|
14
|
+
label: string;
|
|
15
|
+
value?: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DropDownMenuProps extends FormElementProps<any> {
|
|
19
|
+
options: Option[];
|
|
20
|
+
variant: "standard" | "outlined" | "filled";
|
|
21
|
+
defaultLabel: string;
|
|
22
|
+
multiple: boolean;
|
|
23
|
+
nullable: boolean;
|
|
24
|
+
initialValue: any[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const theme = createTheme({
|
|
29
|
+
components: {
|
|
30
|
+
MuiInputLabel: {
|
|
31
|
+
styleOverrides: {
|
|
32
|
+
root: {
|
|
33
|
+
color: 'var(--primaryForeground)',
|
|
34
|
+
fontSize: '1.2rem',
|
|
35
|
+
'&.Mui-focused': {
|
|
36
|
+
color: 'var(--primaryForeground)',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
MuiSelect: {
|
|
42
|
+
styleOverrides: {
|
|
43
|
+
root: {
|
|
44
|
+
color: 'var(--primaryForeground)',
|
|
45
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
46
|
+
},
|
|
47
|
+
icon: {
|
|
48
|
+
color: 'var(--primaryForeground)',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
MuiMenuItem: {
|
|
53
|
+
styleOverrides: {
|
|
54
|
+
root: {
|
|
55
|
+
color: 'var(--primaryForeground)',
|
|
56
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
57
|
+
fontSize: '1.2rem',
|
|
58
|
+
'&:hover': {
|
|
59
|
+
backgroundColor: 'var(--buttonBackground)',
|
|
60
|
+
},
|
|
61
|
+
'&.Mui-selected': {
|
|
62
|
+
backgroundColor: 'var(--buttonBackground)',
|
|
63
|
+
'&:hover': {
|
|
64
|
+
backgroundColor: 'var(--buttonBackground)',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
MuiCheckbox: {
|
|
71
|
+
styleOverrides: {
|
|
72
|
+
root: {
|
|
73
|
+
color: 'var(--primaryForeground)',
|
|
74
|
+
'&.Mui-checked': {
|
|
75
|
+
color: 'var(--primaryForeground)',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
MuiPaper: {
|
|
81
|
+
styleOverrides: {
|
|
82
|
+
root: {
|
|
83
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
84
|
+
color: 'var(--primaryForeground)',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
MuiListItemText: {
|
|
89
|
+
styleOverrides: {
|
|
90
|
+
primary: {
|
|
91
|
+
color: 'var(--primaryForeground)',
|
|
92
|
+
fontSize: '1.2rem',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
MuiOutlinedInput: {
|
|
97
|
+
styleOverrides: {
|
|
98
|
+
root: {
|
|
99
|
+
color: 'var(--primaryForeground)',
|
|
100
|
+
},
|
|
101
|
+
input: {
|
|
102
|
+
color: 'var(--primaryForeground)',
|
|
103
|
+
fontSize: '1.2rem',
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
MuiAutocomplete: {
|
|
108
|
+
styleOverrides: {
|
|
109
|
+
root: {
|
|
110
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
111
|
+
},
|
|
112
|
+
listbox: {
|
|
113
|
+
fontSize: '1.2rem',
|
|
114
|
+
color: 'var(--secondaryForeground)',
|
|
115
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
116
|
+
},
|
|
117
|
+
endAdornment: {
|
|
118
|
+
color: 'var(--primaryForeground)',
|
|
119
|
+
},
|
|
120
|
+
popupIndicator: {
|
|
121
|
+
color: 'var(--primaryForeground)',
|
|
122
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
123
|
+
},
|
|
124
|
+
clearIndicator: {
|
|
125
|
+
color: 'var(--primaryForeground)',
|
|
126
|
+
'&:hover': {
|
|
127
|
+
color: 'var(--secondaryForeground)',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
paper: {
|
|
131
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
132
|
+
color: 'var(--primaryForeground)',
|
|
133
|
+
},
|
|
134
|
+
inputRoot: {
|
|
135
|
+
color: 'var(--primaryForeground)',
|
|
136
|
+
'& .MuiOutlinedInput-root': {
|
|
137
|
+
border: '1px solid var(--primaryForeground)',
|
|
138
|
+
},
|
|
139
|
+
'& .MuiChip-root': {
|
|
140
|
+
fontSize: '1.2rem',
|
|
141
|
+
backgroundColor: 'var(--buttonBackground)',
|
|
142
|
+
color: 'var(--buttonForeground)',
|
|
143
|
+
border: '1px solid var(--buttonBorder)',
|
|
144
|
+
'& .MuiChip-deleteIcon': {
|
|
145
|
+
color: 'var(--buttonForeground)',
|
|
146
|
+
'&:hover': {
|
|
147
|
+
color: 'var(--buttonForeground)',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
MuiFormControl: {
|
|
155
|
+
styleOverrides: {
|
|
156
|
+
root: {
|
|
157
|
+
'& .MuiInputBase-root': {
|
|
158
|
+
backgroundColor: 'var(--primaryBackground)',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
typography: {
|
|
165
|
+
fontFamily: 'inherit',
|
|
166
|
+
},
|
|
167
|
+
palette: {
|
|
168
|
+
mode: 'light',
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A Workflow element built using React.
|
|
174
|
+
* @displayName Drop Down Menu
|
|
175
|
+
* @description Drop Down Menu v1.9
|
|
176
|
+
* @param props The props that will be provided by the Workflow runtime.
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
function DropDownMenu(props: DropDownMenuProps): React.ReactElement {
|
|
180
|
+
const { variant, defaultLabel, options, multiple,initialValue,setValue } = props;
|
|
181
|
+
useEffect(() => {
|
|
182
|
+
if (initialValue !== undefined) {
|
|
183
|
+
setValue(initialValue);
|
|
184
|
+
}
|
|
185
|
+
}, []);
|
|
186
|
+
|
|
187
|
+
const [selectedValues, setSelectedValues] = React.useState<any>(initialValue);
|
|
188
|
+
const [isDataSelected, setIsDataSelected] = React.useState<boolean>(!!initialValue);
|
|
189
|
+
|
|
190
|
+
// Update the internal state and call setValue when selection changes
|
|
191
|
+
const handleChange = (event: any) => {
|
|
192
|
+
const newValue = event.target.value;
|
|
193
|
+
|
|
194
|
+
if (newValue.length === 0 && !props.nullable) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
setIsDataSelected(newValue.length > 0);
|
|
198
|
+
setSelectedValues(newValue);
|
|
199
|
+
if (setValue) {
|
|
200
|
+
console.log(newValue);
|
|
201
|
+
setValue(newValue);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// Render the selected values
|
|
206
|
+
const renderValue = (selected: any) => {
|
|
207
|
+
if (!selected) return '';
|
|
208
|
+
if (multiple) {
|
|
209
|
+
if (Array.isArray(selected)) {
|
|
210
|
+
return selected
|
|
211
|
+
.map(val => options.find(opt => opt.value === val)?.label)
|
|
212
|
+
.filter(Boolean)
|
|
213
|
+
.join(', ');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const selectedOption = options.find(opt => opt.value === selected);
|
|
217
|
+
return selectedOption ? selectedOption.label : '';
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
<ThemeProvider theme={theme}>
|
|
222
|
+
<FormControl sx={{
|
|
223
|
+
width: '100%', mt: 1, mb: 1}} size="small">
|
|
224
|
+
{!isDataSelected && <InputLabel id="dropdown-menu-label">{defaultLabel}</InputLabel>}
|
|
225
|
+
<Select
|
|
226
|
+
variant={variant}
|
|
227
|
+
notched={false}
|
|
228
|
+
labelId="dropdown-menu-label"
|
|
229
|
+
id="dropdown-menu"
|
|
230
|
+
multiple={multiple}
|
|
231
|
+
value={selectedValues}
|
|
232
|
+
onChange={handleChange}
|
|
233
|
+
input={<OutlinedInput label={defaultLabel} />}
|
|
234
|
+
renderValue={renderValue}
|
|
235
|
+
sx={{ border: '0.1rem solid var(--primaryForeground)'}}
|
|
236
|
+
MenuProps={{
|
|
237
|
+
PaperProps: {
|
|
238
|
+
style: {
|
|
239
|
+
maxHeight: 300,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
}}
|
|
243
|
+
>
|
|
244
|
+
{options.map((option) => (
|
|
245
|
+
<MenuItem key={option.value} value={option.value}>
|
|
246
|
+
{multiple && (
|
|
247
|
+
<Checkbox
|
|
248
|
+
checked={Array.isArray(selectedValues)
|
|
249
|
+
? selectedValues.includes(option.value)
|
|
250
|
+
: selectedValues === option.value
|
|
251
|
+
}
|
|
252
|
+
/>
|
|
253
|
+
)}
|
|
254
|
+
<ListItemText primary={option.label} />
|
|
255
|
+
</MenuItem>
|
|
256
|
+
))}
|
|
257
|
+
</Select>
|
|
258
|
+
</FormControl>
|
|
259
|
+
</ThemeProvider>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const DropDownMenuElementRegistration: FormElementRegistration<DropDownMenuProps> = {
|
|
264
|
+
component: DropDownMenu,
|
|
265
|
+
getInitialProperties: () => ({
|
|
266
|
+
defaultLabel: "Default Label", // Provide a default label here
|
|
267
|
+
variant: "outlined", // Provide a default variant here
|
|
268
|
+
autocompleteType: "autoComplete", // Provide a default autocomplete type here
|
|
269
|
+
options: [
|
|
270
|
+
{ label: "Option 1", value: 1},
|
|
271
|
+
{ label: "Option 2", value: 2 },
|
|
272
|
+
{ label: "Option 3", value: 3 },
|
|
273
|
+
{ label: "Option 4", value: 4 },
|
|
274
|
+
], // Sample options
|
|
275
|
+
multiple: true,
|
|
276
|
+
nullable: false,
|
|
277
|
+
initialValue: [1, 2],
|
|
278
|
+
}),
|
|
279
|
+
id: "DropDownMenu",
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export default DropDownMenuElementRegistration;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FormElementProps, FormElementRegistration } from "@vertigis/workflow";
|
|
3
|
+
import Button from '@mui/material/Button';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The generic type argument provided to `FormElementProps<T>` controls the type
|
|
8
|
+
* of `props.value` and `props.setValue(value)`. If your element doesn't need a
|
|
9
|
+
* `value`, you can omit the type argument.
|
|
10
|
+
*
|
|
11
|
+
* You can also declare additional public properties of your element by adding
|
|
12
|
+
* properties to this interface. The properties will be managed by the Workflow
|
|
13
|
+
* runtime, and passed in as `props`. You can update the properties by using
|
|
14
|
+
* `props.setProperty(key, value)`.
|
|
15
|
+
*/
|
|
16
|
+
interface HeaderwithHelpProps extends FormElementProps<string> {
|
|
17
|
+
setting?: settingConfig
|
|
18
|
+
//Following NOT necessary, to be Compatible with old header only
|
|
19
|
+
backgroundColor?: string
|
|
20
|
+
imgSrc?: string
|
|
21
|
+
text?: string;
|
|
22
|
+
imgPosition?: string;
|
|
23
|
+
divHeight?: string;
|
|
24
|
+
margin?: string;
|
|
25
|
+
padding?: string;
|
|
26
|
+
fontSize?: string;
|
|
27
|
+
fontWeight?: string;
|
|
28
|
+
fontFamily?: string;
|
|
29
|
+
fontColor?: string;
|
|
30
|
+
borderRaius?: string;
|
|
31
|
+
align?: string;
|
|
32
|
+
innermargin?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A Workflow element built using React.
|
|
37
|
+
* @displayName HeaderwithHelp
|
|
38
|
+
* @description Header to display icon and title, optional to provide help video if available.
|
|
39
|
+
* @param props The props that will be provided by the Workflow runtime. For new header, give value to property "setting"; for existing header, copy the old load activities and add new setting for help button, then assign click events.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
interface settingConfig {
|
|
43
|
+
headerText?: string,
|
|
44
|
+
headerIcon?: string,
|
|
45
|
+
smallSize?: boolean,
|
|
46
|
+
helpIcon?: string,
|
|
47
|
+
backgroundColor?: string,
|
|
48
|
+
helpTitle?: string,
|
|
49
|
+
helpUrl?: string,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
function HeaderwithHelp(props: HeaderwithHelpProps): React.ReactElement {
|
|
54
|
+
const { raiseEvent } = props;
|
|
55
|
+
const helpInfo = { title: props.setting?.helpTitle || '!!please contact GIS Admin to provide setting.helpTitle', url: props.setting?.helpUrl || "https://descriptusercontent.com/published/e09ca015-acd7-4980-b4b4-7ca72ebb7208/original.mp4" }
|
|
56
|
+
const handleHelpClick = () => {
|
|
57
|
+
raiseEvent("clicked", JSON.stringify(helpInfo)); // Pass the entire item data structure
|
|
58
|
+
};
|
|
59
|
+
function addLengths(...lengths) {
|
|
60
|
+
if (lengths.length === 0) return '0px'; // Handle no input case
|
|
61
|
+
|
|
62
|
+
let total = 0;
|
|
63
|
+
let baseUnit = '';
|
|
64
|
+
|
|
65
|
+
lengths.forEach(length => {
|
|
66
|
+
const match: string = length.match(/(\d+)([a-zA-Z%]+)/);
|
|
67
|
+
if (match) {
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
69
|
+
const value = parseFloat(length.toString());
|
|
70
|
+
const unit = match[2];
|
|
71
|
+
|
|
72
|
+
if (baseUnit === '') {
|
|
73
|
+
baseUnit = unit; // Set the base unit from the first input
|
|
74
|
+
}
|
|
75
|
+
if (baseUnit === 'rem') {
|
|
76
|
+
baseUnit = 'px'; // Set the base unit to px if first rem
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (unit === baseUnit) {
|
|
80
|
+
total += value; // Add directly if units are the same
|
|
81
|
+
} else if (unit === 'rem' && baseUnit === 'px') {
|
|
82
|
+
total += value * 10; // Convert rem to px
|
|
83
|
+
} else {
|
|
84
|
+
throw new Error(`Unsupported unit: ${unit}`);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
throw new Error(`Invalid length format: ${length}`);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return total + baseUnit; // Return total with the original base unit
|
|
92
|
+
}
|
|
93
|
+
// Example usage:
|
|
94
|
+
let helpButtonHeight:string = ''
|
|
95
|
+
if (props.divHeight && props.padding) {
|
|
96
|
+
helpButtonHeight = addLengths(props.divHeight, props.padding, props.padding)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
const helpExist: boolean = Boolean(props.setting?.helpTitle) || Boolean(props.setting?.helpUrl)
|
|
101
|
+
|
|
102
|
+
const smallStyle = Boolean(props.setting && props.setting.smallSize)
|
|
103
|
+
|
|
104
|
+
const helpIconHeight =helpButtonHeight !== '' ? parseFloat(helpButtonHeight)/2 + 'px' : (smallStyle ? '24px' : '30px')
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<>
|
|
108
|
+
<div style={{
|
|
109
|
+
display: 'flex',
|
|
110
|
+
gap: '0.5em',
|
|
111
|
+
margin: 0,
|
|
112
|
+
padding: 0,
|
|
113
|
+
fontFamily: props.fontFamily!==undefined? `${("'"+props.fontFamily+"'")} , Arial, sans-serif !important`: `'NetworkNeo', Arial, sans-serif !important`,
|
|
114
|
+
|
|
115
|
+
}}>
|
|
116
|
+
<div
|
|
117
|
+
style={{
|
|
118
|
+
backgroundColor: props.backgroundColor !== undefined ? props.backgroundColor : (props.setting && props.setting.backgroundColor ? props.setting.backgroundColor : 'rgb(255, 199, 9)'),
|
|
119
|
+
padding: props.padding !== undefined ? props.padding : (smallStyle ? '12px' : '15px'),
|
|
120
|
+
borderRadius: props.borderRaius || '5px',
|
|
121
|
+
cursor: 'default',
|
|
122
|
+
textAlign: 'center',
|
|
123
|
+
flex: '1 ',
|
|
124
|
+
flexGrow: '4 ',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<div style={{
|
|
128
|
+
display: 'flex',
|
|
129
|
+
height: props.divHeight !== undefined ? props.divHeight : (smallStyle ? '24px' : '30px'),
|
|
130
|
+
justifyContent: 'start',
|
|
131
|
+
alignItems: 'center'
|
|
132
|
+
}}>
|
|
133
|
+
<img
|
|
134
|
+
src={props.imgSrc !== undefined ? props.imgSrc : (props.setting && props.setting.headerIcon ? props.setting.headerIcon : 'https://cdn-icons-png.flaticon.com/24/6679/6679617.png')}
|
|
135
|
+
alt=""
|
|
136
|
+
style={{
|
|
137
|
+
marginRight: '2px',
|
|
138
|
+
marginLeft: '2px',
|
|
139
|
+
height: '24px',
|
|
140
|
+
width: "auto"
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
<span style={{
|
|
144
|
+
fontFamily: 'Arial',
|
|
145
|
+
fontSize: props.fontSize !== undefined ? props.fontSize : (smallStyle ? '16px' : '22px'),
|
|
146
|
+
fontWeight: props.fontWeight || 700,
|
|
147
|
+
color: props.fontColor || 'rgb(0, 0, 0)',
|
|
148
|
+
margin: '10px'
|
|
149
|
+
}}>
|
|
150
|
+
{props.text !== undefined ? props.text : (props.setting && props.setting.headerText ? props.setting.headerText : 'edit setting.headerText ')}
|
|
151
|
+
</span>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
{
|
|
156
|
+
helpExist ? <Button startIcon={<img className="material-icons notranslate MuiIcon-root MuiIcon-fontSizeMedium" aria-hidden="true" src={props.setting && props.setting.helpIcon || "https://cdn-icons-png.flaticon.com/24/189/189665.png"} style={{ height: helpIconHeight, width: helpIconHeight ,transform: 'translateX(6px)'}} />} style={{
|
|
157
|
+
flex: '1 !important',
|
|
158
|
+
justifyContent: 'center',
|
|
159
|
+
height: helpButtonHeight !== '' ? helpButtonHeight : (smallStyle ? '48px' : '60px'),
|
|
160
|
+
minWidth: 'auto',
|
|
161
|
+
padding: '0px',
|
|
162
|
+
lineHeight: 0,
|
|
163
|
+
backgroundColor: props.backgroundColor !== undefined ? props.backgroundColor : (props.setting && props.setting.backgroundColor ? props.setting.backgroundColor : 'rgb(255, 199, 9)'),
|
|
164
|
+
width: helpButtonHeight !== '' ? helpButtonHeight :(smallStyle ? '48px' : '60px'),
|
|
165
|
+
}}
|
|
166
|
+
onClick={() => handleHelpClick()}>
|
|
167
|
+
</Button> : <></>
|
|
168
|
+
}
|
|
169
|
+
</div>
|
|
170
|
+
</>
|
|
171
|
+
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
const HeaderwithHelpElementRegistration: FormElementRegistration<HeaderwithHelpProps> = {
|
|
175
|
+
component: HeaderwithHelp,
|
|
176
|
+
id: "HeaderwithHelp",
|
|
177
|
+
};
|
|
178
|
+
export default HeaderwithHelpElementRegistration;
|