ebta-workflow-prod 1.1.3 → 4.0.2
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/SampleInput.tsx +38 -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 +43 -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,155 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2
|
+
/* eslint-disable prefer-const */
|
|
3
|
+
import type { IActivityHandler } from "@vertigis/workflow";
|
|
4
|
+
import html2canvas from 'html2canvas';
|
|
5
|
+
|
|
6
|
+
/** An interface that defines the inputs of the activity. */
|
|
7
|
+
interface LegendCreatorInputs {
|
|
8
|
+
/**
|
|
9
|
+
* @displayName Class Name
|
|
10
|
+
* @description Legend Class name
|
|
11
|
+
* @required
|
|
12
|
+
*/
|
|
13
|
+
className: string;
|
|
14
|
+
}
|
|
15
|
+
/** An interface that defines the outputs of the activity. */
|
|
16
|
+
interface LegendCreatorOutputs {
|
|
17
|
+
/**
|
|
18
|
+
* @description The result of the activity.
|
|
19
|
+
*/
|
|
20
|
+
imageBase64: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @displayName Create Legend
|
|
25
|
+
* @category EBTA Utilities
|
|
26
|
+
* @description Create Legend Ver1.4
|
|
27
|
+
*/
|
|
28
|
+
function convertSVGTagstoIMG(container) {
|
|
29
|
+
let svgElements: NodeListOf<SVGElement> = container.querySelectorAll('svg[role="img"]');
|
|
30
|
+
let SVGDom = Array.from(svgElements).filter(svg => {
|
|
31
|
+
let svgElement = svg;
|
|
32
|
+
let gTag = svgElement.querySelector('g');
|
|
33
|
+
return gTag && gTag.querySelector('image');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SVGDom.forEach(svg => {
|
|
38
|
+
let svgElement = svg;
|
|
39
|
+
// Create a new <img> element
|
|
40
|
+
let img = document.createElement('img');
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
let imageDOM = svgElement.querySelector('image');
|
|
44
|
+
if (imageDOM) {
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
let imageurl = imageDOM.getAttribute('href');
|
|
48
|
+
|
|
49
|
+
// Transfer the relevant attributes
|
|
50
|
+
img.alt = imageDOM.getAttribute('alt') || '';
|
|
51
|
+
img.src = imageurl || ''; // Use xlink:href for the src
|
|
52
|
+
img.width = parseInt(imageDOM.getAttribute('width') || '0');
|
|
53
|
+
img.height = parseInt(imageDOM.getAttribute('height') || '0');
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
svg.parentNode!.replaceChild(img, svg);
|
|
57
|
+
} else {
|
|
58
|
+
console.log('No image found inside svg.');
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
console.log('IMG conversion finished');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async function captureElementByClassToFile(className: string): Promise<string> {
|
|
66
|
+
// Query the DOM for the first element with the specified class name
|
|
67
|
+
const element :HTMLElement = document.querySelector(`.${className}`)!;
|
|
68
|
+
if (!element) {
|
|
69
|
+
throw new Error(`Element with class ${className} not found`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// Ensure all external images have the crossOrigin attribute set
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
convertSVGTagstoIMG(element)
|
|
78
|
+
const images:NodeListOf<HTMLImageElement> = element.querySelectorAll('img[src]') ;
|
|
79
|
+
images.forEach((img) => {
|
|
80
|
+
if (!img.crossOrigin) {
|
|
81
|
+
img.crossOrigin = 'anonymous';
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
const originalStyles = {
|
|
87
|
+
backgroundColor: element.style.backgroundColor,
|
|
88
|
+
color: element.style.color
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
// Reverse the dark mode styles
|
|
92
|
+
element.style.backgroundColor = 'white';
|
|
93
|
+
element.style.color = 'black';
|
|
94
|
+
|
|
95
|
+
// Apply the same style changes to all children, and backup the original
|
|
96
|
+
const children : NodeListOf<HTMLElement> = element.querySelectorAll('*');
|
|
97
|
+
const originalChildStyles:{element: HTMLElement, backgroundColor: string, color: string}[] = [];
|
|
98
|
+
|
|
99
|
+
children.forEach(child => {
|
|
100
|
+
originalChildStyles.push({
|
|
101
|
+
element: child,
|
|
102
|
+
backgroundColor: child.style.backgroundColor,
|
|
103
|
+
color: child.style.color
|
|
104
|
+
});
|
|
105
|
+
child.style.backgroundColor = 'white';
|
|
106
|
+
child.style.color = 'black';
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// Capture the element using html2canvas with useCORS option
|
|
113
|
+
const canvas = await html2canvas(element, {
|
|
114
|
+
useCORS: true,
|
|
115
|
+
logging: true,
|
|
116
|
+
backgroundColor: '#ffffff',
|
|
117
|
+
allowTaint: true ,
|
|
118
|
+
scale:2.5
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Convert the canvas to Base64 image
|
|
122
|
+
let imageBase64 = canvas.toDataURL("image/jpeg");
|
|
123
|
+
|
|
124
|
+
// Revert to the original styles
|
|
125
|
+
element.style.backgroundColor = originalStyles.backgroundColor;
|
|
126
|
+
element.style.color = originalStyles.color;
|
|
127
|
+
|
|
128
|
+
// Revert the styles of all children
|
|
129
|
+
originalChildStyles.forEach(({ element, backgroundColor, color }) => {
|
|
130
|
+
element.style.backgroundColor = backgroundColor;
|
|
131
|
+
element.style.color = color;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
return imageBase64;
|
|
136
|
+
} catch (error) {
|
|
137
|
+
throw new Error(`Failed to capture legend screenshot: ${(error as Error).message}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @displayName Legend Creator
|
|
143
|
+
* @category VertiGIS Utilities
|
|
144
|
+
* @description Create Legend Ver1.4
|
|
145
|
+
*/
|
|
146
|
+
export default class LegendCreatorActivity implements IActivityHandler {
|
|
147
|
+
/** Perform the execution logic of the activity. */
|
|
148
|
+
async execute(inputs: LegendCreatorInputs): Promise<LegendCreatorOutputs> {
|
|
149
|
+
const imageBase64 = await captureElementByClassToFile(inputs.className);
|
|
150
|
+
console.log('Legend creator version 1.4');
|
|
151
|
+
return {
|
|
152
|
+
imageBase64: imageBase64
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { IActivityHandler } from "@vertigis/workflow";
|
|
2
|
+
|
|
3
|
+
/** An interface that defines the inputs of the activity. */
|
|
4
|
+
interface MergeObjectsInputs {
|
|
5
|
+
/**
|
|
6
|
+
* @description The first array of objects to merge.
|
|
7
|
+
* @required
|
|
8
|
+
*/
|
|
9
|
+
array1: any[];
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description The key in array1 to merge on.
|
|
13
|
+
* @required
|
|
14
|
+
*/
|
|
15
|
+
key1: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description The second array of objects to merge.
|
|
19
|
+
* @required
|
|
20
|
+
*/
|
|
21
|
+
array2: any[];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description The key in array2 to merge on.
|
|
25
|
+
* @required
|
|
26
|
+
*/
|
|
27
|
+
key2: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description The key in array2 to merge on.
|
|
31
|
+
*/
|
|
32
|
+
returnAll?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface MergeObjectsOutputs {
|
|
36
|
+
/**
|
|
37
|
+
* @description The resulting joined array.
|
|
38
|
+
*/
|
|
39
|
+
result: any[];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @displayName Merge Objects
|
|
45
|
+
* @category Geocortex
|
|
46
|
+
* @description Merge Objects 1.3
|
|
47
|
+
*/
|
|
48
|
+
export default class MergeObjects implements IActivityHandler {
|
|
49
|
+
execute(inputs: MergeObjectsInputs): MergeObjectsOutputs {
|
|
50
|
+
const { array1, key1, array2, key2, returnAll = false } = inputs;
|
|
51
|
+
|
|
52
|
+
const result = array1.map((item1) => {
|
|
53
|
+
const item2 = array2.find((item) => item[key2] === item1[key1]);
|
|
54
|
+
return item2 ? { ...item1, ...item2 } : item1;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
result: returnAll ? result : result.filter((item) => item[key2] !== undefined)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|