shared-ritm 1.3.99 → 1.3.100

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 (96) hide show
  1. package/README.md +103 -103
  2. package/dist/index.css +1 -1
  3. package/dist/shared-ritm.es.js +26 -20
  4. package/dist/shared-ritm.umd.js +3 -3
  5. package/dist/types/api/services/GanttService.d.ts +6 -0
  6. package/package.json +1 -1
  7. package/src/api/services/BrigadesService.ts +32 -32
  8. package/src/api/services/CommentsService.ts +24 -24
  9. package/src/api/services/FileService.ts +17 -17
  10. package/src/api/services/GanttService.ts +58 -47
  11. package/src/api/services/ModulesService.ts +27 -27
  12. package/src/api/services/ProjectsService.ts +83 -83
  13. package/src/api/services/ScheduleService.ts +69 -69
  14. package/src/api/services/SearchService.ts +22 -22
  15. package/src/api/services/TasksService.ts +157 -157
  16. package/src/api/settings/ApiService.ts +184 -184
  17. package/src/api/types/Api_Brigades.ts +36 -36
  18. package/src/api/types/Api_Comment.ts +40 -40
  19. package/src/api/types/Api_Files.ts +7 -7
  20. package/src/api/types/Api_Modules.ts +21 -21
  21. package/src/api/types/Api_Projects.ts +62 -62
  22. package/src/api/types/Api_Schedule.ts +64 -64
  23. package/src/api/types/Api_Service.ts +9 -9
  24. package/src/common/app-button/AppButton.vue +173 -173
  25. package/src/common/app-date-picker/AppDatePicker.vue +81 -81
  26. package/src/common/app-datepicker/AppDatepicker.vue +218 -218
  27. package/src/common/app-dropdown/AppDropdown.vue +37 -37
  28. package/src/common/app-file/AppFile.vue +80 -80
  29. package/src/common/app-input/AppInput.vue +150 -150
  30. package/src/common/app-input-search/AppInputSearch.vue +174 -174
  31. package/src/common/app-layout/AppLayout.vue +84 -84
  32. package/src/common/app-layout/components/AppLayoutPage.vue +16 -16
  33. package/src/common/app-loader/index.vue +43 -43
  34. package/src/common/app-page-layout/AppPageLayout.vue +122 -122
  35. package/src/common/app-sheet/AppSheet.vue +120 -120
  36. package/src/common/app-sheet-new/AppSheetNew.vue +244 -244
  37. package/src/common/app-sidebar/components/SidebarMenu.vue +37 -37
  38. package/src/common/app-sidebar/components/SidebarMenuItem.vue +149 -149
  39. package/src/common/app-table/AppTableLayout.vue +137 -137
  40. package/src/common/app-table/components/TablePagination.vue +152 -152
  41. package/src/common/app-table/components/TableSearch.vue +76 -76
  42. package/src/common/app-table/controllers/useBaseTable.ts +45 -45
  43. package/src/global.d.ts +1 -1
  44. package/src/icons/components/arrow-down-icon.vue +25 -25
  45. package/src/icons/components/arrow-frame-icon.vue +19 -19
  46. package/src/icons/components/arrow-square.vue +22 -22
  47. package/src/icons/components/table-filter-icon.vue +30 -30
  48. package/src/icons/dialogs/RemoveIcon.vue +12 -12
  49. package/src/icons/dialogs/SafetyIcon.vue +12 -12
  50. package/src/icons/header/NotificationIcon.vue +18 -18
  51. package/src/icons/header/PersonIcon.vue +11 -11
  52. package/src/icons/header/SettingIcon.vue +14 -14
  53. package/src/icons/header/flashIcon.vue +24 -24
  54. package/src/icons/header/searchStatusIcon.vue +24 -24
  55. package/src/icons/header/smallCapsIcon.vue +34 -34
  56. package/src/icons/sidebar/assign-module-icon.vue +36 -36
  57. package/src/icons/sidebar/instrument-history-icon.vue +32 -32
  58. package/src/icons/sidebar/instrument-order-icon.vue +38 -38
  59. package/src/icons/sidebar/instrument-work-zone-icon.vue +18 -18
  60. package/src/icons/sidebar/instruments-icon.vue +45 -45
  61. package/src/icons/sidebar/logo-icon.vue +15 -15
  62. package/src/icons/sidebar/logout-icon.vue +13 -13
  63. package/src/icons/sidebar/modules-icon.vue +16 -16
  64. package/src/icons/sidebar/notifications-icon.vue +24 -24
  65. package/src/icons/sidebar/order-icon.vue +44 -44
  66. package/src/icons/sidebar/pass-icon.vue +38 -38
  67. package/src/icons/sidebar/positions-icon.vue +42 -42
  68. package/src/icons/sidebar/preorder-icon.vue +19 -19
  69. package/src/icons/sidebar/projects-icon.vue +31 -31
  70. package/src/icons/sidebar/repair-object-icon.vue +18 -18
  71. package/src/icons/sidebar/repairs-icon.vue +20 -20
  72. package/src/icons/sidebar/roles-icon.vue +26 -26
  73. package/src/icons/sidebar/status-history-icon.vue +24 -24
  74. package/src/icons/sidebar/tasks-icon.vue +28 -28
  75. package/src/icons/sidebar/tasks_tasks-icon.vue +39 -39
  76. package/src/icons/sidebar/tasks_today-icon.vue +27 -27
  77. package/src/icons/sidebar/teams-icon.vue +32 -32
  78. package/src/icons/sidebar/user-icon.vue +18 -18
  79. package/src/icons/sidebar/users-icon.vue +46 -46
  80. package/src/icons/sidebar/videosources-icon.vue +19 -19
  81. package/src/icons/sidebar/videowall-icon.vue +13 -13
  82. package/src/icons/sidebar/videozones-icon.vue +21 -21
  83. package/src/icons/sidebar/warehouses-icon.vue +43 -43
  84. package/src/icons/sidebar/workshop-icon.vue +100 -100
  85. package/src/icons/sidebar/workzones-icon.vue +22 -22
  86. package/src/icons/task/attention-icon.vue +13 -13
  87. package/src/icons/task/clock-icon.vue +10 -10
  88. package/src/icons/task/delete-icon.vue +10 -10
  89. package/src/icons/task/fire-icon.vue +16 -16
  90. package/src/main.ts +28 -28
  91. package/src/quasar-user-options.ts +17 -17
  92. package/src/router/index.ts +10 -10
  93. package/src/shims-vue.d.ts +5 -5
  94. package/src/utils/confirm.ts +12 -12
  95. package/src/utils/faceApiHelper.ts +132 -132
  96. package/src/utils/notification.ts +9 -9
@@ -1,16 +1,16 @@
1
- <template>
2
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="25" viewBox="0 0 16 25" fill="none">
3
- <path
4
- d="M5.98265 0.364887C5.98265 0.386246 6.1589 0.656149 6.39514 0.999838C6.71014 1.45615 6.9239 1.94547 7.0139 2.41343C7.28765 3.85615 6.79452 5.5377 5.30577 8.22896C4.73202 9.26197 3.94077 10.5571 2.3414 13.0775C1.49952 14.4057 1.4714 14.4523 1.3139 14.761C0.950145 15.4833 0.76452 16.1105 0.713895 16.796C0.65202 17.6134 0.85827 18.4853 1.29327 19.2523C2.08265 20.6406 3.56765 21.8853 5.78577 23.0193C6.59765 23.4348 7.34389 23.7591 8.4014 24.1591C8.85139 24.3299 8.85139 24.328 8.85139 24.3222C8.85139 24.3183 8.77264 24.2697 8.67889 24.2134C8.58327 24.1571 8.41264 24.0503 8.29827 23.9746C6.12327 22.5319 5.02264 20.7319 5.24202 18.9765C5.29452 18.5629 5.37702 18.2678 5.66577 17.4639C5.92452 16.7416 6.2339 16.0231 6.72327 15.0095C7.01765 14.3979 7.0589 14.3144 7.7489 12.9804C7.97577 12.5416 8.19702 12.1144 8.24202 12.029C9.05202 10.4561 9.52452 9.2678 9.7439 8.25032C9.79077 8.03673 9.7964 7.97071 9.7964 7.66003C9.7964 7.27751 9.76639 7.05227 9.65952 6.6445C9.33327 5.40566 8.50827 3.78819 7.3139 2.04838C6.71014 1.16683 5.98265 0.248383 5.98265 0.364887Z"
5
- fill="#F65160"
6
- />
7
- <path
8
- d="M11.0699 8.1164C11.1055 8.19602 11.1824 8.36495 11.2424 8.49116C11.368 8.76301 11.4018 8.90864 11.4018 9.18825C11.4018 9.90669 10.9987 11.1416 10.2205 12.8057C10.1249 13.0077 9.99555 13.2873 9.92992 13.4271C9.86617 13.5649 9.54367 14.2251 9.21367 14.8931C7.87492 17.6057 7.59742 18.2834 7.53742 18.9882C7.46805 19.8135 7.75867 20.7397 8.3493 21.5688C8.54055 21.8368 8.81805 22.1378 8.84805 22.1086C8.8518 22.1028 8.78617 22.0077 8.7018 21.8989C8.61555 21.7882 8.52555 21.6543 8.50117 21.598C8.2443 21.0213 8.49555 19.9669 9.2493 18.4465C9.5268 17.8873 9.80055 17.3882 10.3368 16.462C11.1843 14.996 11.4955 14.3824 11.8368 13.5048C12.0262 13.0135 12.2793 12.1921 12.3562 11.8115C12.3993 11.5921 12.418 11.2659 12.3955 11.0717C12.3374 10.5591 12.1987 10.2115 11.5705 9.00961C11.0793 8.06592 10.9274 7.79407 11.0699 8.1164Z"
9
- fill="#F65160"
10
- />
11
- <path
12
- d="M13.7868 11.1261C13.875 11.3028 13.965 11.5105 13.9875 11.5882C14.295 12.6134 14.0925 14.1824 13.455 15.6989C13.2037 16.2969 12.9712 16.6989 12.0581 18.1164C11.1112 19.5863 10.8056 20.1066 10.5262 20.728C10.2712 21.295 10.1681 21.7028 10.1268 22.3105C10.1081 22.5863 10.125 23.0542 10.1625 23.3202C10.1775 23.4193 10.1793 23.4212 10.1812 23.3494C10.1887 23.0736 10.35 22.7435 10.6837 22.3261C10.9031 22.0484 11.6268 21.3105 12.3018 20.6756C13.0481 19.9727 13.515 19.4892 13.8412 19.0775C14.9006 17.7416 15.3468 16.4542 15.2943 14.8892C15.2568 13.763 15.1012 13.2872 14.3625 12.0387C14.1806 11.7338 13.9518 11.3416 13.8487 11.1649C13.7475 10.9882 13.6575 10.8348 13.6481 10.8251C13.6387 10.8134 13.7006 10.9494 13.7868 11.1261Z"
13
- fill="#F65160"
14
- />
15
- </svg>
16
- </template>
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" width="16" height="25" viewBox="0 0 16 25" fill="none">
3
+ <path
4
+ d="M5.98265 0.364887C5.98265 0.386246 6.1589 0.656149 6.39514 0.999838C6.71014 1.45615 6.9239 1.94547 7.0139 2.41343C7.28765 3.85615 6.79452 5.5377 5.30577 8.22896C4.73202 9.26197 3.94077 10.5571 2.3414 13.0775C1.49952 14.4057 1.4714 14.4523 1.3139 14.761C0.950145 15.4833 0.76452 16.1105 0.713895 16.796C0.65202 17.6134 0.85827 18.4853 1.29327 19.2523C2.08265 20.6406 3.56765 21.8853 5.78577 23.0193C6.59765 23.4348 7.34389 23.7591 8.4014 24.1591C8.85139 24.3299 8.85139 24.328 8.85139 24.3222C8.85139 24.3183 8.77264 24.2697 8.67889 24.2134C8.58327 24.1571 8.41264 24.0503 8.29827 23.9746C6.12327 22.5319 5.02264 20.7319 5.24202 18.9765C5.29452 18.5629 5.37702 18.2678 5.66577 17.4639C5.92452 16.7416 6.2339 16.0231 6.72327 15.0095C7.01765 14.3979 7.0589 14.3144 7.7489 12.9804C7.97577 12.5416 8.19702 12.1144 8.24202 12.029C9.05202 10.4561 9.52452 9.2678 9.7439 8.25032C9.79077 8.03673 9.7964 7.97071 9.7964 7.66003C9.7964 7.27751 9.76639 7.05227 9.65952 6.6445C9.33327 5.40566 8.50827 3.78819 7.3139 2.04838C6.71014 1.16683 5.98265 0.248383 5.98265 0.364887Z"
5
+ fill="#F65160"
6
+ />
7
+ <path
8
+ d="M11.0699 8.1164C11.1055 8.19602 11.1824 8.36495 11.2424 8.49116C11.368 8.76301 11.4018 8.90864 11.4018 9.18825C11.4018 9.90669 10.9987 11.1416 10.2205 12.8057C10.1249 13.0077 9.99555 13.2873 9.92992 13.4271C9.86617 13.5649 9.54367 14.2251 9.21367 14.8931C7.87492 17.6057 7.59742 18.2834 7.53742 18.9882C7.46805 19.8135 7.75867 20.7397 8.3493 21.5688C8.54055 21.8368 8.81805 22.1378 8.84805 22.1086C8.8518 22.1028 8.78617 22.0077 8.7018 21.8989C8.61555 21.7882 8.52555 21.6543 8.50117 21.598C8.2443 21.0213 8.49555 19.9669 9.2493 18.4465C9.5268 17.8873 9.80055 17.3882 10.3368 16.462C11.1843 14.996 11.4955 14.3824 11.8368 13.5048C12.0262 13.0135 12.2793 12.1921 12.3562 11.8115C12.3993 11.5921 12.418 11.2659 12.3955 11.0717C12.3374 10.5591 12.1987 10.2115 11.5705 9.00961C11.0793 8.06592 10.9274 7.79407 11.0699 8.1164Z"
9
+ fill="#F65160"
10
+ />
11
+ <path
12
+ d="M13.7868 11.1261C13.875 11.3028 13.965 11.5105 13.9875 11.5882C14.295 12.6134 14.0925 14.1824 13.455 15.6989C13.2037 16.2969 12.9712 16.6989 12.0581 18.1164C11.1112 19.5863 10.8056 20.1066 10.5262 20.728C10.2712 21.295 10.1681 21.7028 10.1268 22.3105C10.1081 22.5863 10.125 23.0542 10.1625 23.3202C10.1775 23.4193 10.1793 23.4212 10.1812 23.3494C10.1887 23.0736 10.35 22.7435 10.6837 22.3261C10.9031 22.0484 11.6268 21.3105 12.3018 20.6756C13.0481 19.9727 13.515 19.4892 13.8412 19.0775C14.9006 17.7416 15.3468 16.4542 15.2943 14.8892C15.2568 13.763 15.1012 13.2872 14.3625 12.0387C14.1806 11.7338 13.9518 11.3416 13.8487 11.1649C13.7475 10.9882 13.6575 10.8348 13.6481 10.8251C13.6387 10.8134 13.7006 10.9494 13.7868 11.1261Z"
13
+ fill="#F65160"
14
+ />
15
+ </svg>
16
+ </template>
package/src/main.ts CHANGED
@@ -1,28 +1,28 @@
1
- import { createApp } from 'vue'
2
- import { Quasar, quasarUserOptions } from './quasar-user-options'
3
- import router from './router/index'
4
-
5
- import '@quasar/extras/material-icons/material-icons.css'
6
- import 'quasar/src/css/index.sass'
7
-
8
- import '@/shared/styles/general.css'
9
-
10
- import App from './App.vue'
11
-
12
- const app = createApp(App)
13
-
14
- //@ts-ignore
15
- app.use(Quasar, quasarUserOptions)
16
-
17
- app.use(router)
18
- app.mount('#app')
19
-
20
- const observerErrRe = /^ResizeObserver loop completed/
21
-
22
- const originalConsoleError = console.error
23
- console.error = (...args) => {
24
- if (typeof args[0] === 'string' && observerErrRe.test(args[0])) {
25
- return
26
- }
27
- originalConsoleError(...args)
28
- }
1
+ import { createApp } from 'vue'
2
+ import { Quasar, quasarUserOptions } from './quasar-user-options'
3
+ import router from './router/index'
4
+
5
+ import '@quasar/extras/material-icons/material-icons.css'
6
+ import 'quasar/src/css/index.sass'
7
+
8
+ import '@/shared/styles/general.css'
9
+
10
+ import App from './App.vue'
11
+
12
+ const app = createApp(App)
13
+
14
+ //@ts-ignore
15
+ app.use(Quasar, quasarUserOptions)
16
+
17
+ app.use(router)
18
+ app.mount('#app')
19
+
20
+ const observerErrRe = /^ResizeObserver loop completed/
21
+
22
+ const originalConsoleError = console.error
23
+ console.error = (...args) => {
24
+ if (typeof args[0] === 'string' && observerErrRe.test(args[0])) {
25
+ return
26
+ }
27
+ originalConsoleError(...args)
28
+ }
@@ -1,17 +1,17 @@
1
- import { Quasar, Notify, Loading, Dialog } from 'quasar'
2
-
3
- import 'quasar/src/css/index.sass'
4
- import '@quasar/extras/roboto-font/roboto-font.css'
5
- import '@quasar/extras/material-icons/material-icons.css'
6
- import '@quasar/extras/material-icons-outlined/material-icons-outlined.css'
7
- import '@quasar/extras/mdi-v7/mdi-v7.css'
8
-
9
- const quasarUserOptions = {
10
- plugins: {
11
- Notify,
12
- Loading,
13
- Dialog,
14
- },
15
- }
16
-
17
- export { Quasar, quasarUserOptions }
1
+ import { Quasar, Notify, Loading, Dialog } from 'quasar'
2
+
3
+ import 'quasar/src/css/index.sass'
4
+ import '@quasar/extras/roboto-font/roboto-font.css'
5
+ import '@quasar/extras/material-icons/material-icons.css'
6
+ import '@quasar/extras/material-icons-outlined/material-icons-outlined.css'
7
+ import '@quasar/extras/mdi-v7/mdi-v7.css'
8
+
9
+ const quasarUserOptions = {
10
+ plugins: {
11
+ Notify,
12
+ Loading,
13
+ Dialog,
14
+ },
15
+ }
16
+
17
+ export { Quasar, quasarUserOptions }
@@ -1,10 +1,10 @@
1
- import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
2
-
3
- const routes: RouteRecordRaw[] = []
4
-
5
- const router = createRouter({
6
- history: createWebHistory(),
7
- routes,
8
- })
9
-
10
- export default router
1
+ import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
2
+
3
+ const routes: RouteRecordRaw[] = []
4
+
5
+ const router = createRouter({
6
+ history: createWebHistory(),
7
+ routes,
8
+ })
9
+
10
+ export default router
@@ -1,5 +1,5 @@
1
- declare module '*.vue' {
2
- import { DefineComponent } from 'vue'
3
- const component: DefineComponent<{}, {}, any>
4
- export default component
5
- }
1
+ declare module '*.vue' {
2
+ import { DefineComponent } from 'vue'
3
+ const component: DefineComponent<{}, {}, any>
4
+ export default component
5
+ }
@@ -1,12 +1,12 @@
1
- import { defineAsyncComponent } from 'vue'
2
- import { useQuasar } from 'quasar'
3
- const $q = useQuasar()
4
-
5
- const AppConfirmDialog = defineAsyncComponent(() => import('@/common/app-dialogs/AppConfirmDialog.vue'))
6
-
7
- export const appConfirm = (content: string, type: 'delete' | 'edit') => {
8
- return $q.dialog({
9
- component: AppConfirmDialog,
10
- componentProps: { content, type },
11
- })
12
- }
1
+ import { defineAsyncComponent } from 'vue'
2
+ import { useQuasar } from 'quasar'
3
+ const $q = useQuasar()
4
+
5
+ const AppConfirmDialog = defineAsyncComponent(() => import('@/common/app-dialogs/AppConfirmDialog.vue'))
6
+
7
+ export const appConfirm = (content: string, type: 'delete' | 'edit') => {
8
+ return $q.dialog({
9
+ component: AppConfirmDialog,
10
+ componentProps: { content, type },
11
+ })
12
+ }
@@ -1,132 +1,132 @@
1
- import * as faceapi from 'face-api.js'
2
-
3
- class FaceApiHelper {
4
- // async getFaceSnapshot(inputImage: any, box: any) {
5
- // const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
6
- // const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
7
- // if (faceImages.length) {
8
- // const dataUrl = faceImages[0].toDataURL('image/jpeg')
9
- // photo.value = dataUrl.replace(/^data:image\/\w+;base64,/, '')
10
- // }
11
- // }
12
-
13
- // Метод настройки конфига для стрима
14
- getVideoStreamConfig(width: number, height: number) {
15
- return {
16
- audio: false,
17
- video: {
18
- width: { min: width, ideal: width },
19
- height: { min: height, ideal: height },
20
- facingMode: 'environment', // или 'user' для фронтальной камеры
21
- },
22
- }
23
- }
24
-
25
- // Метод для настройки рамки, где должно помещаться лицо
26
- getContourCoordinate(width: number, height: number) {
27
- return {
28
- x: width * 0.25,
29
- y: height * 0.05,
30
- width: width * 0.5,
31
- height: height * 0.9,
32
- }
33
- }
34
-
35
- getBoxData(box: any) {
36
- if (!box) return null
37
- return {
38
- x: box.x,
39
- y: box.y,
40
- width: box.width,
41
- height: box.height,
42
- }
43
- }
44
-
45
- setStylesForCanvas(canvasContainer: any) {
46
- canvasContainer.width = '100%'
47
- canvasContainer.height = '100%'
48
- canvasContainer.style.position = 'absolute'
49
- canvasContainer.style.top = '0'
50
- canvasContainer.style.left = '0'
51
- }
52
-
53
- // Метод для рассчёта того, что лицо полностью помещается в рамке
54
- checkFaceInclusion(frame: any, face: any) {
55
- if (!frame || !face) return false
56
-
57
- if (face.width > frame.width || face.height > frame.height) {
58
- return false
59
- }
60
-
61
- const faceXmin = face.x
62
- const faceXmax = face.x + face.width
63
- const faceYmin = face.y
64
- const faceYmax = face.y + face.height
65
-
66
- const frameXmin = frame.x
67
- const frameXmax = frame.x + frame.width
68
- const frameYmin = frame.y
69
- const frameYmax = frame.y + frame.height
70
-
71
- return faceXmin >= frameXmin && faceXmax <= frameXmax && faceYmin >= frameYmin && faceYmax <= frameYmax
72
- }
73
-
74
- async getFaceDetections(videoRef: any, inputSize: number) {
75
- if (!videoRef) return []
76
- const options = new faceapi.TinyFaceDetectorOptions({ inputSize })
77
- return faceapi.detectSingleFace(videoRef, options).withFaceLandmarks(true)
78
- }
79
-
80
- getCanvas(videoRef: any) {
81
- return faceapi.createCanvasFromMedia(videoRef)
82
- }
83
-
84
- getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number) {
85
- faceapi.matchDimensions(canvas, { width: videoWidth, height: videoHeight })
86
-
87
- const resized = faceapi.resizeResults(detections, {
88
- width: videoWidth,
89
- height: videoHeight,
90
- })
91
-
92
- ctx.clearRect(0, 0, videoWidth, videoHeight)
93
-
94
- faceapi.draw.drawDetections(canvas, resized)
95
- faceapi.draw.drawFaceLandmarks(canvas, resized)
96
- //faceapi.draw.drawFaceExpressions(canvas, resized)
97
- }
98
-
99
- async getFaceSnapshot(inputImage: any, box: any) {
100
- const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
101
- const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
102
-
103
- if (faceImages.length) {
104
- const dataUrl = faceImages[0].toDataURL('image/jpeg')
105
- return dataUrl.replace(/^data:image\/\w+;base64,/, '')
106
- }
107
-
108
- return null
109
- }
110
-
111
- async initModels() {
112
- let date = new Date()
113
- console.log(date)
114
- try {
115
- await Promise.all([
116
- faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
117
- faceapi.nets.faceLandmark68TinyNet.loadFromUri('/models'),
118
- ])
119
- } catch (error) {
120
- console.error(error)
121
- }
122
- date = new Date()
123
- console.log(date)
124
- }
125
- }
126
-
127
- let helper: FaceApiHelper
128
-
129
- export default function useFaceApiHelper() {
130
- if (!helper) helper = new FaceApiHelper()
131
- return helper
132
- }
1
+ import * as faceapi from 'face-api.js'
2
+
3
+ class FaceApiHelper {
4
+ // async getFaceSnapshot(inputImage: any, box: any) {
5
+ // const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
6
+ // const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
7
+ // if (faceImages.length) {
8
+ // const dataUrl = faceImages[0].toDataURL('image/jpeg')
9
+ // photo.value = dataUrl.replace(/^data:image\/\w+;base64,/, '')
10
+ // }
11
+ // }
12
+
13
+ // Метод настройки конфига для стрима
14
+ getVideoStreamConfig(width: number, height: number) {
15
+ return {
16
+ audio: false,
17
+ video: {
18
+ width: { min: width, ideal: width },
19
+ height: { min: height, ideal: height },
20
+ facingMode: 'environment', // или 'user' для фронтальной камеры
21
+ },
22
+ }
23
+ }
24
+
25
+ // Метод для настройки рамки, где должно помещаться лицо
26
+ getContourCoordinate(width: number, height: number) {
27
+ return {
28
+ x: width * 0.25,
29
+ y: height * 0.05,
30
+ width: width * 0.5,
31
+ height: height * 0.9,
32
+ }
33
+ }
34
+
35
+ getBoxData(box: any) {
36
+ if (!box) return null
37
+ return {
38
+ x: box.x,
39
+ y: box.y,
40
+ width: box.width,
41
+ height: box.height,
42
+ }
43
+ }
44
+
45
+ setStylesForCanvas(canvasContainer: any) {
46
+ canvasContainer.width = '100%'
47
+ canvasContainer.height = '100%'
48
+ canvasContainer.style.position = 'absolute'
49
+ canvasContainer.style.top = '0'
50
+ canvasContainer.style.left = '0'
51
+ }
52
+
53
+ // Метод для рассчёта того, что лицо полностью помещается в рамке
54
+ checkFaceInclusion(frame: any, face: any) {
55
+ if (!frame || !face) return false
56
+
57
+ if (face.width > frame.width || face.height > frame.height) {
58
+ return false
59
+ }
60
+
61
+ const faceXmin = face.x
62
+ const faceXmax = face.x + face.width
63
+ const faceYmin = face.y
64
+ const faceYmax = face.y + face.height
65
+
66
+ const frameXmin = frame.x
67
+ const frameXmax = frame.x + frame.width
68
+ const frameYmin = frame.y
69
+ const frameYmax = frame.y + frame.height
70
+
71
+ return faceXmin >= frameXmin && faceXmax <= frameXmax && faceYmin >= frameYmin && faceYmax <= frameYmax
72
+ }
73
+
74
+ async getFaceDetections(videoRef: any, inputSize: number) {
75
+ if (!videoRef) return []
76
+ const options = new faceapi.TinyFaceDetectorOptions({ inputSize })
77
+ return faceapi.detectSingleFace(videoRef, options).withFaceLandmarks(true)
78
+ }
79
+
80
+ getCanvas(videoRef: any) {
81
+ return faceapi.createCanvasFromMedia(videoRef)
82
+ }
83
+
84
+ getResizedAndDetection(canvas: any, detections: any, ctx: any, videoWidth: number, videoHeight: number) {
85
+ faceapi.matchDimensions(canvas, { width: videoWidth, height: videoHeight })
86
+
87
+ const resized = faceapi.resizeResults(detections, {
88
+ width: videoWidth,
89
+ height: videoHeight,
90
+ })
91
+
92
+ ctx.clearRect(0, 0, videoWidth, videoHeight)
93
+
94
+ faceapi.draw.drawDetections(canvas, resized)
95
+ faceapi.draw.drawFaceLandmarks(canvas, resized)
96
+ //faceapi.draw.drawFaceExpressions(canvas, resized)
97
+ }
98
+
99
+ async getFaceSnapshot(inputImage: any, box: any) {
100
+ const regionsToExtract = [new faceapi.Rect(box.x, box.y, box.width, box.height)]
101
+ const faceImages = await faceapi.extractFaces(inputImage, regionsToExtract)
102
+
103
+ if (faceImages.length) {
104
+ const dataUrl = faceImages[0].toDataURL('image/jpeg')
105
+ return dataUrl.replace(/^data:image\/\w+;base64,/, '')
106
+ }
107
+
108
+ return null
109
+ }
110
+
111
+ async initModels() {
112
+ let date = new Date()
113
+ console.log(date)
114
+ try {
115
+ await Promise.all([
116
+ faceapi.nets.tinyFaceDetector.loadFromUri('/models'),
117
+ faceapi.nets.faceLandmark68TinyNet.loadFromUri('/models'),
118
+ ])
119
+ } catch (error) {
120
+ console.error(error)
121
+ }
122
+ date = new Date()
123
+ console.log(date)
124
+ }
125
+ }
126
+
127
+ let helper: FaceApiHelper
128
+
129
+ export default function useFaceApiHelper() {
130
+ if (!helper) helper = new FaceApiHelper()
131
+ return helper
132
+ }
@@ -1,9 +1,9 @@
1
- import { QNotifyCreateOptions } from 'quasar'
2
-
3
- export type NotificationType = 'danger' | 'success' | 'warning' | 'info' | 'default'
4
-
5
- export const notificationSettings = (type: NotificationType, message: string): QNotifyCreateOptions => ({
6
- message,
7
- color: type === 'danger' ? 'red' : type === 'success' ? 'green' : type === 'warning' ? 'orange' : 'white',
8
- position: 'top-right',
9
- })
1
+ import { QNotifyCreateOptions } from 'quasar'
2
+
3
+ export type NotificationType = 'danger' | 'success' | 'warning' | 'info' | 'default'
4
+
5
+ export const notificationSettings = (type: NotificationType, message: string): QNotifyCreateOptions => ({
6
+ message,
7
+ color: type === 'danger' ? 'red' : type === 'success' ? 'green' : type === 'warning' ? 'orange' : 'white',
8
+ position: 'top-right',
9
+ })