@processmaker/modeler 1.43.0 → 1.43.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@processmaker/modeler",
3
- "version": "1.43.0",
3
+ "version": "1.43.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve --mode development",
6
6
  "test:unit": "vue-cli-service test:unit",
@@ -0,0 +1,78 @@
1
+
2
+ export default class ColorUtil {
3
+ saturationRange = null;
4
+ lightnessRange = null;
5
+ constructor(saturation, lightness, range) {
6
+ this.saturationRange = this.getRange(saturation, range);
7
+ this.lightnessRange = this.getRange(lightness, range);
8
+ }
9
+
10
+ getRange(value, range) {
11
+ return [Math.max(0, value - range), Math.min(value + range, 100)];
12
+ }
13
+
14
+ /**
15
+ * Calculates a hash value for a given string.
16
+ *
17
+ * @param {string} str - The input string for which the hash needs to be calculated.
18
+ * @returns {number} The calculated hash value for the input string.
19
+ */
20
+ getHashOfString(str) {
21
+ let hash = 0;
22
+ for (let i = 0; i < str.length; i++) {
23
+ hash = str.charCodeAt(i) + ((hash << 5) - hash);
24
+ }
25
+ hash = Math.abs(hash);
26
+ return hash;
27
+ }
28
+ /**
29
+ * Get the hash number to within our range
30
+ *
31
+ * @param {Number} hash
32
+ * @param {Number} min
33
+ * @param {Number} max
34
+ * @returns {Number}
35
+ */
36
+ normalizeHash(hash, min, max) {
37
+ return Math.floor((hash % (max - min)) + min);
38
+ }
39
+ /**
40
+ *Generate Unique Color, create a string using our h,s,l values.
41
+ * @param {String} name
42
+ * @param {Array} saturationRange
43
+ * @param {Array} lightnessRange
44
+ * @returns {Number}
45
+ */
46
+ generateHSL(name) {
47
+ console.log(name);
48
+ const hash = this.getHashOfString(name);
49
+ const h = this.normalizeHash(hash, 0, 360);
50
+ const s = this.normalizeHash(hash, this.saturationRange[0], this.saturationRange[1]);
51
+ const l = this.normalizeHash(hash, this.lightnessRange[0], this.lightnessRange[1]);
52
+ return [h, s, l];
53
+ }
54
+ /**
55
+ * Convert HSL array to string
56
+ * @param {Array} hsl
57
+ * @returns {String}
58
+ */
59
+ HSLtoString(hsl) {
60
+ return `hsl(${hsl[0]}, ${hsl[1]}%, ${hsl[2]}%)`;
61
+ }
62
+ /**
63
+ * Generate the HSL string color
64
+ * @param {String} id
65
+ * @returns {String}
66
+ */
67
+ generateColorHsl(id) {
68
+ return this.HSLtoString(this.generateHSL(id, this.saturationRange, this.lightnessRange));
69
+ }
70
+ /**
71
+ * Create a random color using the user name string
72
+ * @param {String} userName
73
+ * @returns {String || null}
74
+ */
75
+ randomColor(userName) {
76
+ return userName ? this.generateColorHsl(userName) : null;
77
+ }
78
+ }
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="mr-2">
3
+ <button
4
+ id="aiAssetButton"
5
+ :class="['btn px-2 ai-btn', showPopover ? 'ai-btn-open' : 'ai-btn-closed']"
6
+ @click="showPopover = !showPopover"
7
+ >
8
+ <inline-svg :src="proceC2Icon" class="my-auto ai-icon" />
9
+ </button>
10
+ <b-popover
11
+ target="aiAssetButton"
12
+ triggers="click"
13
+ :show.sync="showPopover"
14
+ :title="$t('Create your assets with AI')"
15
+ placement="auto"
16
+ >
17
+ <div class="p-3 d-flex flex-column">
18
+ <div class="m-2">
19
+ {{ $t('Create any missing assets for the process, including screens and scripts.') }}
20
+ </div>
21
+ <div class="m-2">
22
+ <span class="text-primary">
23
+ {{ $t('Optimal results need propper task naming and connections.') }}
24
+ </span>
25
+ </div>
26
+ <button class="m-2 btn btn-primary" @click="onGenerateAssets()">
27
+ {{ $t("Create Assets with AI") }}
28
+ </button>
29
+ </div>
30
+ </b-popover>
31
+ </div>
32
+ </template>
33
+ <script>
34
+ import InlineSvg from 'vue-inline-svg';
35
+
36
+ export default {
37
+ name: 'CreateAssetsButton',
38
+ components: {
39
+ InlineSvg,
40
+ },
41
+ data() {
42
+ return {
43
+ proceC2Icon: require('@/assets/proceC2.svg'),
44
+ showPopover: false,
45
+ };
46
+ },
47
+ methods: {
48
+ onGenerateAssets() {
49
+ this.$emit('onGenerateAssets');
50
+ },
51
+ },
52
+ };
53
+ </script>
54
+ <style scoped>
55
+ .ai-icon {
56
+ width: 22px;
57
+ height: 22px;
58
+ }
59
+
60
+ .ai-btn {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ width: 32px;
65
+ height: 32px;
66
+ }
67
+
68
+ .ai-btn-closed {
69
+ color: #000000;
70
+ background-color: #ebeef2;
71
+ }
72
+
73
+ .ai-btn-open {
74
+ color: #FFFFFF;
75
+ background-color: #6A7888;
76
+ }
77
+ </style>
@@ -0,0 +1,82 @@
1
+ <template>
2
+ <div class="message mt-3">
3
+ <b-card no-body class="h-100 w-100" style="border-radius: 8px;">
4
+ <div class="h-100 d-flex pl-2 justify-content-between align-items-center">
5
+ <div class="col-9">
6
+ <div class="text-left">
7
+ <inline-svg :src="proceC2Icon" class="ml-0 mr-2 my-auto ai-icon" />
8
+ <span style="color: #556271; font-weight: 600;">{{ $t("Assets Generated Successfully") }}</span>
9
+ </div>
10
+ <div style="color: #556271; font-weight: 400;">
11
+ {{ $t("Check them on their corresponding tasks") }}
12
+ </div>
13
+ </div>
14
+ <div class="col-3 h-100 p-0 d-flex flex-column justify-content-center">
15
+ <button
16
+ class="h-100 m-0 cancelBtn btn btn-light btn-block"
17
+ @click="onClose()"
18
+ >
19
+ {{ $t("Close") }}
20
+ </button>
21
+ </div>
22
+ </div>
23
+ </b-card>
24
+ </div>
25
+ </template>
26
+ <script>
27
+ import InlineSvg from 'vue-inline-svg';
28
+
29
+ export default {
30
+ name: 'AssetsCreatedCard',
31
+ components: {
32
+ InlineSvg,
33
+ },
34
+ data() {
35
+ return {
36
+ proceC2Icon: require('@/assets/proceC2.svg'),
37
+ };
38
+ },
39
+ methods: {
40
+ onClose() {
41
+ this.$emit('closeAssetsCreated');
42
+ },
43
+ },
44
+ };
45
+ </script>
46
+ <style scoped>
47
+ .message {
48
+ border-radius: 8px;
49
+ overflow: hidden;
50
+ box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.10);
51
+ line-height: 27px;
52
+ word-wrap: break-word;
53
+ position: absolute;
54
+ display: flex;
55
+ align-items: center;
56
+ right: 10%;
57
+ z-index: 1;
58
+ font-size: 100%;
59
+ height: 90px;
60
+ width: 480px;
61
+ }
62
+
63
+ .ai-icon {
64
+ width: 22px;
65
+ height: 22px;
66
+ }
67
+
68
+ .createBtn {
69
+ border-radius: 0px 8px 0px 0px;
70
+ font-weight: 600;
71
+ text-transform: capitalize;
72
+ }
73
+
74
+ .cancelBtn {
75
+ border-radius: 0px 0px 8px 0px;
76
+ border-left: 1px solid #CDDDEE;
77
+ font-weight: 600;
78
+ text-transform: capitalize;
79
+ }
80
+
81
+
82
+ </style>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div class="message mt-3">
3
+ <b-card no-body class="h-100" style="border-radius: 8px;">
4
+ <div class="h-100 d-flex pl-2 justify-content-between align-items-center">
5
+ <div class="col-9">
6
+ <div class="text-left">
7
+ <inline-svg :src="proceC2Icon" class="ml-0 mr-2 my-auto ai-icon" />
8
+ <span style="color: #556271; font-weight: 600;">{{ $t("Create your missing assets with AI") }}</span>
9
+ </div>
10
+ <div style="color: #556271; font-weight: 400;">
11
+ {{ $t("Use AI to easily produce the necessary screens and scripts to complete the process.") }}
12
+ </div>
13
+ </div>
14
+ <div class="col-3 h-100 p-0 d-flex flex-column justify-content-center">
15
+ <button
16
+ class="h-100 createBtn btn btn-primary btn-block"
17
+ @click="onCreateAssets()"
18
+ >
19
+ {{ $t("Create now") }}
20
+ </button>
21
+ <button
22
+ class="h-100 m-0 cancelBtn btn btn-light btn-block"
23
+ @click="onCancel()"
24
+ >
25
+ {{ $t("Close") }}
26
+ </button>
27
+ </div>
28
+ </div>
29
+ </b-card>
30
+ </div>
31
+ </template>
32
+ <script>
33
+ import InlineSvg from 'vue-inline-svg';
34
+
35
+ export default {
36
+ name: 'CreateAssetsCard',
37
+ components: {
38
+ InlineSvg,
39
+ },
40
+ data() {
41
+ return {
42
+ proceC2Icon: require('@/assets/proceC2.svg'),
43
+ };
44
+ },
45
+ methods: {
46
+ onCreateAssets() {
47
+ this.$emit('onGenerateAssets');
48
+ },
49
+ onCancel() {
50
+ this.$emit('closeCreateAssets');
51
+ },
52
+ },
53
+ };
54
+ </script>
55
+ <style scoped>
56
+ .message {
57
+ border-radius: 8px;
58
+ overflow: hidden;
59
+ box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.10);
60
+ line-height: 27px;
61
+ word-wrap: break-word;
62
+ position: absolute;
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ left: 2%;
67
+ z-index: 1;
68
+ font-size: 100%;
69
+ height: 120px;
70
+ width: 520px;
71
+ }
72
+
73
+ .ai-icon {
74
+ width: 22px;
75
+ height: 22px;
76
+ }
77
+
78
+ .createBtn {
79
+ border-radius: 0px 8px 0px 0px;
80
+ font-weight: 600;
81
+ text-transform: capitalize;
82
+ }
83
+
84
+ .cancelBtn {
85
+ border-radius: 0px 0px 8px 0px;
86
+ border-left: 1px solid #CDDDEE;
87
+ font-weight: 600;
88
+ text-transform: capitalize;
89
+ }
90
+
91
+
92
+ </style>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div class="customAlert mx-auto mt-2">
3
+ <b-alert show dismissible variant="warning">
4
+ {{ $t("Generation of assets was not able to complete. Try again") }}
5
+ </b-alert>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ export default {
10
+ name: 'CreateAssetsFailCard',
11
+ data() {
12
+ return {};
13
+ },
14
+ };
15
+ </script>
16
+ <style scoped>
17
+ .customAlert {
18
+ word-wrap: break-word;
19
+ position: absolute;
20
+ display: flex;
21
+ align-items: center;
22
+ left: 0;
23
+ right: 0;
24
+ z-index: 1;
25
+ width: 600px;
26
+ }
27
+ </style>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="message mt-3">
3
+ <b-card no-body class="h-100 w-100" style="border-radius: 8px;">
4
+ <div class="h-100 d-flex p-3 justify-content-between align-items-center">
5
+ <div>
6
+ <div class="text-left">
7
+ <inline-svg :src="proceC2Icon" class="ml-0 mr-2 my-auto ai-icon" />
8
+ <span class="card-text">{{ $t("Generating...") }}</span>
9
+ </div>
10
+ </div>
11
+ <div class="p-0">
12
+ <button
13
+ class="h-100 px-3 cancel-btn btn btn-secondary"
14
+ @click="onClose()"
15
+ >
16
+ {{ $t("STOP") }}
17
+ </button>
18
+ </div>
19
+ </div>
20
+ </b-card>
21
+ </div>
22
+ </template>
23
+ <script>
24
+ import InlineSvg from 'vue-inline-svg';
25
+
26
+ export default {
27
+ name: 'GeneratingAssetsCard',
28
+ components: {
29
+ InlineSvg,
30
+ },
31
+ data() {
32
+ return {
33
+ proceC2Icon: require('@/assets/proceC2.svg'),
34
+ };
35
+ },
36
+ methods: {
37
+ onClose() {
38
+ this.$emit('stopAssetGeneration');
39
+ },
40
+ },
41
+ };
42
+ </script>
43
+ <style scoped>
44
+ .message {
45
+ border-radius: 8px;
46
+ overflow: hidden;
47
+ box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.10);
48
+ line-height: 27px;
49
+ word-wrap: break-word;
50
+ position: absolute;
51
+ display: flex;
52
+ align-items: center;
53
+ bottom: 35px;
54
+ left: 35%;
55
+ z-index: 1;
56
+ font-size: 100%;
57
+ height: 60px;
58
+ width: 450px;
59
+ }
60
+
61
+ .card-text {
62
+ color: #556271;
63
+ font-weight: 400;
64
+ }
65
+
66
+ .ai-icon {
67
+ width: 22px;
68
+ height: 22px;
69
+ }
70
+
71
+ .cancel-btn {
72
+ font-weight: 600;
73
+ text-transform: capitalize;
74
+ }
75
+
76
+
77
+ </style>