@dative-gpi/foundation-shared-components 1.0.131-kiosk-2 → 1.0.132

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.
Files changed (38) hide show
  1. package/components/FSBreadcrumbs.vue +20 -12
  2. package/components/FSDialogMenu.vue +17 -8
  3. package/components/FSDialogRemove.vue +1 -1
  4. package/components/FSFadeOut.vue +1 -1
  5. package/components/FSSpan.vue +8 -5
  6. package/components/FSText.vue +7 -5
  7. package/components/fields/FSAutocompleteField.vue +36 -52
  8. package/components/fields/FSSelectField.vue +36 -52
  9. package/components/fields/FSTranslateRichTextField.vue +17 -2
  10. package/components/lists/FSDataTableUI.vue +22 -14
  11. package/components/map/FSMap.vue +18 -8
  12. package/components/map/FSMapOverlay.vue +34 -19
  13. package/components/tiles/FSLocationTileUI.vue +1 -1
  14. package/components/views/desktop/FSBaseDefaultDesktopView.vue +8 -7
  15. package/components/views/desktop/FSBaseEntityDesktopView.vue +1 -0
  16. package/components/views/mobile/FSBaseDefaultMobileView.vue +8 -7
  17. package/components/views/mobile/FSBaseEntityMobileView.vue +1 -0
  18. package/composables/useSlots.ts +2 -1
  19. package/models/rules.ts +5 -2
  20. package/package.json +4 -4
  21. package/styles/components/fs_breadcrumbs.scss +19 -31
  22. package/styles/components/fs_button.scss +7 -5
  23. package/styles/components/fs_chip.scss +8 -6
  24. package/styles/components/fs_clickable.scss +14 -12
  25. package/styles/components/fs_data_iterator_item.scss +12 -10
  26. package/styles/components/fs_dialog.scss +1 -1
  27. package/styles/components/fs_dialog_menu.scss +4 -2
  28. package/styles/components/fs_image_card.scss +5 -3
  29. package/styles/components/fs_map.scss +11 -7
  30. package/styles/components/fs_password_field.scss +4 -2
  31. package/styles/components/fs_span.scss +12 -4
  32. package/styles/components/fs_tabs.scss +9 -5
  33. package/styles/components/fs_tag.scss +9 -7
  34. package/styles/globals/overrides.scss +11 -4
  35. package/styles/globals/scrollbars.scss +10 -0
  36. package/utils/index.ts +1 -0
  37. package/utils/operations.ts +69 -0
  38. package/components/buttons/FSButtonPrint.vue +0 -188
@@ -13,17 +13,19 @@
13
13
  background-color: var(--fs-tag-background-color) !important;
14
14
  color: var(--fs-tag-color) !important;
15
15
 
16
- &:hover {
17
- background-color: var(--fs-tag-hover-background-color) !important;
18
- color: var(--fs-tag-hover-color) !important;
19
- }
16
+ min-width: 20px !important;
17
+ width: 20px !important;
18
+ height: 20px !important;
20
19
 
21
20
  &:active {
22
21
  background-color: var(--fs-tag-active-background-color) !important;
23
22
  color: var(--fs-tag-active-color) !important;
24
23
  }
25
24
 
26
- min-width: 20px !important;
27
- width: 20px !important;
28
- height: 20px !important;
25
+ @include clickscreen {
26
+ &:hover {
27
+ background-color: var(--fs-tag-hover-background-color) !important;
28
+ color: var(--fs-tag-hover-color) !important;
29
+ }
30
+ }
29
31
  }
@@ -137,11 +137,16 @@
137
137
  }
138
138
  }
139
139
 
140
- // Ellipsis on input of all fields
141
140
  input {
141
+ // Ellipsis on all fields
142
142
  text-overflow: ellipsis;
143
143
  }
144
144
 
145
+ input, select, textarea {
146
+ // No zoom on focus for user of a certain version of Chrome, and who ask their mobile to zoom if font-size < 16px
147
+ touch-action: none;
148
+ }
149
+
145
150
  // No up / down buttons in input field of type number
146
151
  input[type=number] {
147
152
  -moz-appearance: textfield;
@@ -187,9 +192,11 @@ $nthOverlay: 25;
187
192
  }
188
193
 
189
194
  // Change color on arrows when hovered
190
- .v-slide-group__prev:hover,
191
- .v-slide-group__next:hover {
192
- color: var(--fs-group-hover-color);
195
+ @include clickscreen {
196
+ .v-slide-group__prev:hover,
197
+ .v-slide-group__next:hover {
198
+ color: var(--fs-group-hover-color);
199
+ }
193
200
  }
194
201
 
195
202
  /***************************************************************************/
@@ -47,9 +47,19 @@
47
47
  @include touchscreen {
48
48
  .fs-hide-x-scrollbar {
49
49
  overflow-x: scroll;
50
+
51
+ &::-webkit-scrollbar {
52
+ display: none;
53
+ }
54
+ scrollbar-width: none;
50
55
  }
51
56
 
52
57
  .fs-hide-y-scrollbar {
53
58
  overflow-y: scroll;
59
+
60
+ &::-webkit-scrollbar {
61
+ display: none;
62
+ }
63
+ scrollbar-width: none;
54
64
  }
55
65
  }
package/utils/index.ts CHANGED
@@ -8,6 +8,7 @@ export * from "./icons";
8
8
  export * from "./leafletMarkers"
9
9
  export * from "./levenshtein";
10
10
  export * from "./lexical";
11
+ export * from "./operations";
11
12
  export * from "./sort";
12
13
  export * from "./statuses";
13
14
  export * from "./time";
@@ -0,0 +1,69 @@
1
+ const MinusOperator = "-";
2
+
3
+ // Matches one of the three operators (+, *, /) or the - operator if it is preceded by something that is not another operator
4
+ const operatorsRegex = new RegExp(/[\+\*\/]|(?<=.)(?<![-\+\*\/])[-]/gm);
5
+
6
+ // Matches a nested block of parenthesis
7
+ const parenthesisRegex = new RegExp(/\([^)(]+\)/gm);
8
+
9
+ // Match a positive decimal number
10
+ const decimalRegex = new RegExp(/^\d+(.\d+)?$/gm);
11
+
12
+ const validateBlock = (block: string, operands: string[] = [], variables: string[] = []) => {
13
+ // Remove parenthesis from the block
14
+ block = block.replaceAll("(", "").replaceAll(")", "");
15
+
16
+ // Split block on operators (Leave negative signs)
17
+ const components = block.split(operatorsRegex);
18
+
19
+ // Check if each bit is a valid operand
20
+ for (let i = 0; i < components.length; i++) {
21
+ // Remove negative sign
22
+ if (components[i].startsWith(MinusOperator)) {
23
+ components[i] = components[i].substring(1);
24
+ }
25
+ if (!operands.includes(components[i]) && !variables.includes(components[i]) && !components[i].match(decimalRegex)) {
26
+ return false;
27
+ }
28
+ }
29
+ return true;
30
+ }
31
+
32
+ export const validateOperation = (rawOperation: string, operands: string[] = [], variables: string[] = []) => {
33
+ // Remove spaces
34
+ let operation = rawOperation.replaceAll(" ", "");
35
+
36
+ // Check parenthesis
37
+ const parenthesis: number[] = [];
38
+
39
+ for (let i = 0; i < operation.length; i++) {
40
+ if (operation[i] == '(') {
41
+ parenthesis.push(i);
42
+ }
43
+ else if (operation[i] == ')') {
44
+ if (parenthesis.length > 0) {
45
+ if (i == parenthesis.pop()! + 1) {
46
+ return false;
47
+ }
48
+ }
49
+ else {
50
+ return false;
51
+ }
52
+ }
53
+ }
54
+ if (parenthesis.length > 0) {
55
+ return false;
56
+ }
57
+
58
+ // Check each block between parenthesis
59
+ let match = operation.match(parenthesisRegex);
60
+
61
+ while (match?.[0]) {
62
+ if (!validateBlock(match[0], operands, variables)) {
63
+ return false;
64
+ }
65
+ operation = operation.replace(match[0], "1");
66
+ match = operation.match(parenthesisRegex);
67
+ }
68
+ return validateBlock(operation, operands, variables);
69
+ }
@@ -1,188 +0,0 @@
1
- <template>
2
- <FSButton
3
- prependIcon="mdi-printer-outline"
4
- :label="$tr('ui.common.print', 'Print')"
5
- :color="ColorEnum.Light"
6
- v-bind="$attrs"
7
- @click="buildPreview()"
8
- />
9
- <FSDialog
10
- v-model="dialog"
11
- :title="$tr('ui.common.print', 'Print')"
12
- :width="800"
13
- >
14
- <template
15
- #body
16
- >
17
- <FSLoader
18
- v-if="loading"
19
- width="100%"
20
- height="400px"
21
- />
22
- <FSCol
23
- v-show="!loading"
24
- width="100%"
25
- height="400px"
26
- >
27
- <FSText
28
- :style="{ minHeight: '16px' }"
29
- font="text-overline"
30
- >
31
- {{$tr('ui.print.preview', 'Preview')}}
32
- </FSText>
33
- <div
34
- :style="{ width: '100%', overflow: 'scroll' }"
35
- >
36
- <FSCard
37
- id="canvas-container"
38
- :padding="margin"
39
- >
40
- </FSCard>
41
- </div>
42
- <FSRow
43
- align="center-center"
44
- >
45
- <FSButton
46
- :prependIcon="'mdi-printer-outline'"
47
- :label="$tr('ui.common.print', 'Print')"
48
- :color="ColorEnum.Primary"
49
- @click="printCanvas()"
50
- />
51
- <FSButton
52
- :prependIcon="'mdi-download'"
53
- :label="$tr('ui.print.download-image', 'Download image')"
54
- :color="ColorEnum.Primary"
55
- @click="downloadCanvasImage()"
56
- />
57
- </FSRow>
58
- </FSCol>
59
- </template>
60
- </FSDialog>
61
- </template>
62
-
63
- <script lang="ts">
64
- import { computed, defineComponent, ref } from "vue";
65
-
66
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
67
-
68
- import html2canvas from 'html2canvas';
69
-
70
- import FSButton from "../FSButton.vue";
71
- import FSText from '@dative-gpi/foundation-shared-components/components/FSText.vue';
72
- import FSCard from '@dative-gpi/foundation-shared-components/components/FSCard.vue';
73
- import FSDialog from '@dative-gpi/foundation-shared-components/components/FSDialog.vue';
74
- import FSLoader from '@dative-gpi/foundation-shared-components/components/FSLoader.vue';
75
-
76
- export default defineComponent({
77
- name: "FSButtonPrint",
78
- components: {
79
- FSButton,
80
- FSDialog,
81
- FSLoader,
82
- FSText,
83
- FSCard
84
- },
85
- props: {
86
- elementToPrint: {
87
- type: Object as () => HTMLElement | null,
88
- default: null
89
- },
90
- disableInputs: {
91
- type: Boolean,
92
- default: true
93
- }
94
- },
95
- setup(props) {
96
- const margin = 16;
97
-
98
- const dialog = ref(false);
99
- const loading = ref(false);
100
- // Set A4 size
101
- const windowWidth = computed(() => {
102
- return Math.round((297 / 25.4) * 96);
103
- });
104
-
105
- const ignoreElements = (element: Element) => {
106
- if (props.disableInputs) {
107
- return element.classList.contains("v-input");
108
- }
109
- return false;
110
- }
111
-
112
- const buildPreview = async () => {
113
- loading.value = true;
114
- const elementToPrint = props.elementToPrint || document.body;
115
-
116
- const fullCanvas = await html2canvas(elementToPrint, {
117
- backgroundColor: null,
118
- windowWidth: windowWidth.value,
119
- ignoreElements: ignoreElements
120
- });
121
-
122
- dialog.value = true;
123
-
124
- setTimeout(() => {
125
- setCanvas(fullCanvas);
126
- }, 100);
127
- };
128
-
129
- const setCanvas = async (canvas: HTMLCanvasElement, count = 0) => {
130
- const canvasContainer = document.getElementById("canvas-container");
131
- if (!canvasContainer) {
132
- if(count > 10) {
133
- return;
134
- }
135
- return setCanvas(canvas, count++);
136
- }
137
- canvasContainer.innerHTML = "";
138
- canvasContainer.appendChild(canvas);
139
- loading.value = false;
140
- };
141
-
142
- const printCanvas = () => {
143
- const canvas = document.getElementById("canvas-container")?.querySelector("canvas");
144
-
145
- if (!canvas) {
146
- return;
147
- }
148
-
149
- const dataUrl = canvas.toDataURL("image/png");
150
- const windowContent = `<img width="100%" src="${dataUrl}" />`;
151
- const printWindow = window.open("", "_blank", "width=600,height=600");
152
- printWindow?.document.open();
153
- printWindow?.document.write(windowContent);
154
- printWindow?.document.close();
155
-
156
- printWindow?.addEventListener("load", () => {
157
- printWindow?.focus();
158
- printWindow?.print();
159
- printWindow?.close();
160
- });
161
- }
162
-
163
- const downloadCanvasImage = () => {
164
- const canvas = document.getElementById("canvas-container")?.querySelector("canvas");
165
-
166
- if (!canvas) {
167
- return;
168
- }
169
-
170
- const dataUrl = canvas.toDataURL("image/png");
171
- const a = document.createElement("a");
172
- a.href = dataUrl;
173
- a.download = "image.png";
174
- a.click();
175
- }
176
-
177
- return {
178
- printCanvas,
179
- buildPreview,
180
- downloadCanvasImage,
181
- dialog,
182
- margin,
183
- loading,
184
- ColorEnum
185
- }
186
- }
187
- });
188
- </script>