@ramathibodi/nuxt-commons 0.1.73 → 4.0.0
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/README.md +81 -55
- package/dist/module.json +4 -4
- package/dist/module.mjs +5 -4
- package/dist/runtime/bridges/authentication.d.ts +21 -0
- package/dist/runtime/bridges/authentication.js +20 -0
- package/dist/runtime/bridges/graphql.d.ts +17 -0
- package/dist/runtime/bridges/graphql.js +45 -0
- package/dist/runtime/components/Alert.d.vue.ts +3 -0
- package/dist/runtime/components/Alert.vue +17 -22
- package/dist/runtime/components/Alert.vue.d.ts +3 -0
- package/dist/runtime/components/BarcodeReader.d.vue.ts +9 -0
- package/dist/runtime/components/BarcodeReader.vue +56 -73
- package/dist/runtime/components/BarcodeReader.vue.d.ts +9 -0
- package/dist/runtime/components/ExportCSV.d.vue.ts +55 -0
- package/dist/runtime/components/ExportCSV.vue +39 -68
- package/dist/runtime/components/ExportCSV.vue.d.ts +55 -0
- package/dist/runtime/components/FileBtn.d.vue.ts +53 -0
- package/dist/runtime/components/FileBtn.vue +23 -38
- package/dist/runtime/components/FileBtn.vue.d.ts +53 -0
- package/dist/runtime/components/ImportCSV.d.vue.ts +52 -0
- package/dist/runtime/components/ImportCSV.vue +60 -99
- package/dist/runtime/components/ImportCSV.vue.d.ts +52 -0
- package/dist/runtime/components/MrzReader.d.vue.ts +19 -0
- package/dist/runtime/components/MrzReader.vue +128 -0
- package/dist/runtime/components/MrzReader.vue.d.ts +19 -0
- package/dist/runtime/components/SplitterPanel.d.vue.ts +15 -0
- package/dist/runtime/components/SplitterPanel.vue +18 -27
- package/dist/runtime/components/SplitterPanel.vue.d.ts +15 -0
- package/dist/runtime/components/TabsGroup.d.vue.ts +19 -0
- package/dist/runtime/components/TabsGroup.vue +8 -12
- package/dist/runtime/components/TabsGroup.vue.d.ts +19 -0
- package/dist/runtime/components/TextBarcode.d.vue.ts +12 -0
- package/dist/runtime/components/TextBarcode.vue +22 -33
- package/dist/runtime/components/TextBarcode.vue.d.ts +12 -0
- package/dist/runtime/components/device/IdCardButton.d.vue.ts +57 -0
- package/dist/runtime/components/device/IdCardButton.vue +30 -55
- package/dist/runtime/components/device/IdCardButton.vue.d.ts +57 -0
- package/dist/runtime/components/device/IdCardWebSocket.d.vue.ts +55 -0
- package/dist/runtime/components/device/IdCardWebSocket.vue +104 -153
- package/dist/runtime/components/device/IdCardWebSocket.vue.d.ts +55 -0
- package/dist/runtime/components/device/Scanner.d.vue.ts +66 -0
- package/dist/runtime/components/device/Scanner.vue +97 -166
- package/dist/runtime/components/device/Scanner.vue.d.ts +66 -0
- package/dist/runtime/components/dialog/Confirm.d.vue.ts +37 -0
- package/dist/runtime/components/dialog/Confirm.vue +30 -47
- package/dist/runtime/components/dialog/Confirm.vue.d.ts +37 -0
- package/dist/runtime/components/dialog/Host.d.vue.ts +9 -0
- package/dist/runtime/components/dialog/Host.vue +34 -53
- package/dist/runtime/components/dialog/Host.vue.d.ts +9 -0
- package/dist/runtime/components/dialog/Index.d.vue.ts +24 -0
- package/dist/runtime/components/dialog/Index.vue +20 -28
- package/dist/runtime/components/dialog/Index.vue.d.ts +24 -0
- package/dist/runtime/components/dialog/Loading.d.vue.ts +21 -0
- package/dist/runtime/components/dialog/Loading.vue +12 -17
- package/dist/runtime/components/dialog/Loading.vue.d.ts +21 -0
- package/dist/runtime/components/dialog/default/Confirm.d.vue.ts +40 -0
- package/dist/runtime/components/dialog/default/Confirm.vue +29 -50
- package/dist/runtime/components/dialog/default/Confirm.vue.d.ts +40 -0
- package/dist/runtime/components/dialog/default/Loading.d.vue.ts +23 -0
- package/dist/runtime/components/dialog/default/Loading.vue +12 -17
- package/dist/runtime/components/dialog/default/Loading.vue.d.ts +23 -0
- package/dist/runtime/components/dialog/default/Notify.d.vue.ts +23 -0
- package/dist/runtime/components/dialog/default/Notify.vue +19 -36
- package/dist/runtime/components/dialog/default/Notify.vue.d.ts +23 -0
- package/dist/runtime/components/dialog/default/Printing.d.vue.ts +21 -0
- package/dist/runtime/components/dialog/default/Printing.vue +13 -17
- package/dist/runtime/components/dialog/default/Printing.vue.d.ts +21 -0
- package/dist/runtime/components/dialog/default/VerifyUser.d.vue.ts +29 -0
- package/dist/runtime/components/dialog/default/VerifyUser.vue +44 -70
- package/dist/runtime/components/dialog/default/VerifyUser.vue.d.ts +29 -0
- package/dist/runtime/components/document/Form.d.vue.ts +9 -0
- package/dist/runtime/components/document/Form.vue +27 -34
- package/dist/runtime/components/document/Form.vue.d.ts +9 -0
- package/dist/runtime/components/document/TemplateBuilder.d.vue.ts +24 -0
- package/dist/runtime/components/document/TemplateBuilder.vue +154 -182
- package/dist/runtime/components/document/TemplateBuilder.vue.d.ts +24 -0
- package/dist/runtime/components/form/ActionPad.d.vue.ts +114 -0
- package/dist/runtime/components/form/ActionPad.vue +48 -73
- package/dist/runtime/components/form/ActionPad.vue.d.ts +114 -0
- package/dist/runtime/components/form/Birthdate.d.vue.ts +38 -0
- package/dist/runtime/components/form/Birthdate.vue +44 -64
- package/dist/runtime/components/form/Birthdate.vue.d.ts +38 -0
- package/dist/runtime/components/form/CheckboxGroup.d.vue.ts +41 -0
- package/dist/runtime/components/form/CheckboxGroup.vue +34 -52
- package/dist/runtime/components/form/CheckboxGroup.vue.d.ts +41 -0
- package/dist/runtime/components/form/CodeEditor.d.vue.ts +25 -0
- package/dist/runtime/components/form/CodeEditor.vue +18 -28
- package/dist/runtime/components/form/CodeEditor.vue.d.ts +25 -0
- package/dist/runtime/components/form/Date.d.vue.ts +86 -0
- package/dist/runtime/components/form/Date.vue +109 -150
- package/dist/runtime/components/form/Date.vue.d.ts +86 -0
- package/dist/runtime/components/form/DateTime.d.vue.ts +36 -0
- package/dist/runtime/components/form/DateTime.vue +94 -131
- package/dist/runtime/components/form/DateTime.vue.d.ts +36 -0
- package/dist/runtime/components/form/Dialog.d.vue.ts +69 -0
- package/dist/runtime/components/form/Dialog.vue +60 -84
- package/dist/runtime/components/form/Dialog.vue.d.ts +69 -0
- package/dist/runtime/components/form/EditPad.d.vue.ts +113 -0
- package/dist/runtime/components/form/EditPad.vue +49 -73
- package/dist/runtime/components/form/EditPad.vue.d.ts +113 -0
- package/dist/runtime/components/form/File.d.vue.ts +65 -0
- package/dist/runtime/components/form/File.vue +112 -174
- package/dist/runtime/components/form/File.vue.d.ts +65 -0
- package/dist/runtime/components/form/Hidden.d.vue.ts +12 -0
- package/dist/runtime/components/form/Hidden.vue +17 -22
- package/dist/runtime/components/form/Hidden.vue.d.ts +12 -0
- package/dist/runtime/components/form/Iterator.d.vue.ts +279 -0
- package/dist/runtime/components/form/Iterator.vue +162 -240
- package/dist/runtime/components/form/Iterator.vue.d.ts +279 -0
- package/dist/runtime/components/form/Login.d.vue.ts +32 -0
- package/dist/runtime/components/form/Login.vue +23 -43
- package/dist/runtime/components/form/Login.vue.d.ts +32 -0
- package/dist/runtime/components/form/Pad.d.vue.ts +674 -0
- package/dist/runtime/components/form/Pad.vue +166 -253
- package/dist/runtime/components/form/Pad.vue.d.ts +674 -0
- package/dist/runtime/components/form/SignPad.d.vue.ts +62 -0
- package/dist/runtime/components/form/SignPad.vue +80 -118
- package/dist/runtime/components/form/SignPad.vue.d.ts +62 -0
- package/dist/runtime/components/form/System.d.vue.ts +34 -0
- package/dist/runtime/components/form/System.vue +18 -24
- package/dist/runtime/components/form/System.vue.d.ts +34 -0
- package/dist/runtime/components/form/Table.d.vue.ts +221 -0
- package/dist/runtime/components/form/Table.vue +123 -170
- package/dist/runtime/components/form/Table.vue.d.ts +221 -0
- package/dist/runtime/components/form/TableData.d.vue.ts +102 -0
- package/dist/runtime/components/form/TableData.vue +109 -127
- package/dist/runtime/components/form/TableData.vue.d.ts +102 -0
- package/dist/runtime/components/form/Time.d.vue.ts +49 -0
- package/dist/runtime/components/form/Time.vue +64 -87
- package/dist/runtime/components/form/Time.vue.d.ts +49 -0
- package/dist/runtime/components/form/images/Capture.d.vue.ts +96 -0
- package/dist/runtime/components/form/images/Capture.vue +104 -139
- package/dist/runtime/components/form/images/Capture.vue.d.ts +96 -0
- package/dist/runtime/components/form/images/Edit.d.vue.ts +29 -0
- package/dist/runtime/components/form/images/Edit.vue +57 -69
- package/dist/runtime/components/form/images/Edit.vue.d.ts +29 -0
- package/dist/runtime/components/form/images/Field.d.vue.ts +27 -0
- package/dist/runtime/components/form/images/Field.vue +136 -194
- package/dist/runtime/components/form/images/Field.vue.d.ts +27 -0
- package/dist/runtime/components/form/images/Pad.d.vue.ts +13 -0
- package/dist/runtime/components/form/images/Pad.vue +23 -28
- package/dist/runtime/components/form/images/Pad.vue.d.ts +13 -0
- package/dist/runtime/components/label/Date.d.vue.ts +13 -0
- package/dist/runtime/components/label/Date.vue +13 -21
- package/dist/runtime/components/label/Date.vue.d.ts +13 -0
- package/dist/runtime/components/label/DateAgo.d.vue.ts +20 -0
- package/dist/runtime/components/label/DateAgo.vue +43 -67
- package/dist/runtime/components/label/DateAgo.vue.d.ts +20 -0
- package/dist/runtime/components/label/DateCount.d.vue.ts +22 -0
- package/dist/runtime/components/label/DateCount.vue +58 -97
- package/dist/runtime/components/label/DateCount.vue.d.ts +22 -0
- package/dist/runtime/components/label/Field.d.vue.ts +38 -0
- package/dist/runtime/components/label/Field.vue +18 -32
- package/dist/runtime/components/label/Field.vue.d.ts +38 -0
- package/dist/runtime/components/label/FormatMoney.d.vue.ts +12 -0
- package/dist/runtime/components/label/FormatMoney.vue +12 -20
- package/dist/runtime/components/label/FormatMoney.vue.d.ts +12 -0
- package/dist/runtime/components/label/Mask.d.vue.ts +10 -0
- package/dist/runtime/components/label/Mask.vue +21 -30
- package/dist/runtime/components/label/Mask.vue.d.ts +10 -0
- package/dist/runtime/components/label/Object.d.vue.ts +8 -0
- package/dist/runtime/components/label/Object.vue +10 -12
- package/dist/runtime/components/label/Object.vue.d.ts +8 -0
- package/dist/runtime/components/master/Autocomplete.d.vue.ts +70 -0
- package/dist/runtime/components/master/Autocomplete.vue +25 -26
- package/dist/runtime/components/master/Autocomplete.vue.d.ts +70 -0
- package/dist/runtime/components/master/Combobox.d.vue.ts +70 -0
- package/dist/runtime/components/master/Combobox.vue +26 -27
- package/dist/runtime/components/master/Combobox.vue.d.ts +70 -0
- package/dist/runtime/components/master/RadioGroup.d.vue.ts +51 -0
- package/dist/runtime/components/master/RadioGroup.vue +44 -47
- package/dist/runtime/components/master/RadioGroup.vue.d.ts +51 -0
- package/dist/runtime/components/master/Select.d.vue.ts +68 -0
- package/dist/runtime/components/master/Select.vue +25 -26
- package/dist/runtime/components/master/Select.vue.d.ts +68 -0
- package/dist/runtime/components/master/label.d.vue.ts +24 -0
- package/dist/runtime/components/master/label.vue +22 -34
- package/dist/runtime/components/master/label.vue.d.ts +24 -0
- package/dist/runtime/components/model/Autocomplete.d.vue.ts +82 -0
- package/dist/runtime/components/model/Autocomplete.vue +50 -37
- package/dist/runtime/components/model/Autocomplete.vue.d.ts +82 -0
- package/dist/runtime/components/model/Combobox.d.vue.ts +82 -0
- package/dist/runtime/components/model/Combobox.vue +51 -37
- package/dist/runtime/components/model/Combobox.vue.d.ts +82 -0
- package/dist/runtime/components/model/Pad.d.vue.ts +72 -0
- package/dist/runtime/components/model/Pad.vue +50 -53
- package/dist/runtime/components/model/Pad.vue.d.ts +72 -0
- package/dist/runtime/components/model/Select.d.vue.ts +72 -0
- package/dist/runtime/components/model/Select.vue +42 -32
- package/dist/runtime/components/model/Select.vue.d.ts +72 -0
- package/dist/runtime/components/model/Table.d.vue.ts +272 -0
- package/dist/runtime/components/model/Table.vue +121 -133
- package/dist/runtime/components/model/Table.vue.d.ts +272 -0
- package/dist/runtime/components/model/iterator.d.vue.ts +321 -0
- package/dist/runtime/components/model/iterator.vue +148 -175
- package/dist/runtime/components/model/iterator.vue.d.ts +321 -0
- package/dist/runtime/components/model/label.d.vue.ts +26 -0
- package/dist/runtime/components/model/label.vue +25 -35
- package/dist/runtime/components/model/label.vue.d.ts +26 -0
- package/dist/runtime/components/pdf/Print.d.vue.ts +17 -0
- package/dist/runtime/components/pdf/Print.vue +27 -38
- package/dist/runtime/components/pdf/Print.vue.d.ts +17 -0
- package/dist/runtime/components/pdf/View.d.vue.ts +52 -0
- package/dist/runtime/components/pdf/View.vue +58 -83
- package/dist/runtime/components/pdf/View.vue.d.ts +52 -0
- package/dist/runtime/composables/alert.d.ts +4 -0
- package/dist/runtime/composables/api.d.ts +4 -0
- package/dist/runtime/composables/api.js +4 -2
- package/dist/runtime/composables/assetFile.js +4 -2
- package/dist/runtime/composables/dialog.d.ts +1 -1
- package/dist/runtime/composables/document/template.js +3 -3
- package/dist/runtime/composables/document/templateFormHidden.d.ts +4 -0
- package/dist/runtime/composables/document/templateFormTable.js +1 -0
- package/dist/runtime/composables/graphql.d.ts +2 -2
- package/dist/runtime/composables/graphql.js +5 -5
- package/dist/runtime/composables/graphqlModel.d.ts +6 -6
- package/dist/runtime/composables/graphqlModelItem.d.ts +4 -4
- package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
- package/dist/runtime/composables/graphqlModelOperation.js +2 -1
- package/dist/runtime/composables/graphqlOperation.js +5 -1
- package/dist/runtime/composables/hostAgentWs.d.ts +1 -1
- package/dist/runtime/composables/localStorageModel.d.ts +4 -0
- package/dist/runtime/composables/lookupList.d.ts +4 -0
- package/dist/runtime/composables/lookupListMaster.js +3 -3
- package/dist/runtime/composables/menu.d.ts +4 -0
- package/dist/runtime/composables/menu.js +2 -2
- package/dist/runtime/composables/useMrzReader.d.ts +48 -0
- package/dist/runtime/composables/useMrzReader.js +423 -0
- package/dist/runtime/composables/useTesseract.d.ts +16 -0
- package/dist/runtime/composables/useTesseract.js +45 -0
- package/dist/runtime/composables/userPermission.d.ts +1 -1
- package/dist/runtime/composables/utils/fuzzy.d.ts +2 -1
- package/dist/runtime/labs/Calendar.d.vue.ts +35 -0
- package/dist/runtime/labs/Calendar.vue +47 -75
- package/dist/runtime/labs/Calendar.vue.d.ts +35 -0
- package/dist/runtime/labs/form/EditMobile.d.vue.ts +12 -0
- package/dist/runtime/labs/form/EditMobile.vue +19 -36
- package/dist/runtime/labs/form/EditMobile.vue.d.ts +12 -0
- package/dist/runtime/labs/form/TextFieldMask.d.vue.ts +21 -0
- package/dist/runtime/labs/form/TextFieldMask.vue +19 -25
- package/dist/runtime/labs/form/TextFieldMask.vue.d.ts +21 -0
- package/dist/runtime/plugins/dialogManager.js +2 -2
- package/dist/runtime/plugins/permission.js +3 -3
- package/dist/runtime/types/bridge.d.ts +14 -0
- package/dist/runtime/utils/asset.d.ts +2 -0
- package/dist/runtime/utils/asset.js +49 -0
- package/dist/runtime/utils/datetime.js +1 -1
- package/dist/types.d.mts +2 -6
- package/package.json +79 -57
- package/scripts/ci-release.mjs +125 -0
- package/scripts/enrich-vue-docs-from-ai.mjs +197 -0
- package/scripts/generate-ai-summary.mjs +321 -0
- package/scripts/generate-composables-md.mjs +129 -0
- package/scripts/release-version.mjs +68 -0
- package/scripts/release.mjs +49 -0
- package/templates/public/tesseract/mrz.traineddata.gz +0 -0
- package/templates/public/tesseract/ocrb.traineddata.gz +0 -0
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -8
- package/dist/types.d.ts +0 -7
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { VBtn } from 'vuetify/components/VBtn';
|
|
2
|
+
interface ImportButtonProps extends /* @vue-ignore */ InstanceType<typeof VBtn['$props']> {
|
|
3
|
+
stringFields?: Array<string>;
|
|
4
|
+
tooltip?: string | Record<string, any> | undefined;
|
|
5
|
+
}
|
|
6
|
+
declare var __VLS_13: never, __VLS_14: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
[K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ImportButtonProps>, {
|
|
11
|
+
stringFields: () => never[];
|
|
12
|
+
tooltip: () => {
|
|
13
|
+
text: string;
|
|
14
|
+
location: string;
|
|
15
|
+
};
|
|
16
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
17
|
+
import: (value: object[]) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<ImportButtonProps>, {
|
|
19
|
+
stringFields: () => never[];
|
|
20
|
+
tooltip: () => {
|
|
21
|
+
text: string;
|
|
22
|
+
location: string;
|
|
23
|
+
};
|
|
24
|
+
}>>> & Readonly<{
|
|
25
|
+
onImport?: ((value: object[]) => any) | undefined;
|
|
26
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
30
|
+
type __VLS_TypePropsToOption<T> = {
|
|
31
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
32
|
+
type: import('vue').PropType<Required<T>[K]>;
|
|
33
|
+
} : {
|
|
34
|
+
type: import('vue').PropType<T[K]>;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
type __VLS_WithDefaults<P, D> = {
|
|
39
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
40
|
+
default: D[K];
|
|
41
|
+
}> : P[K];
|
|
42
|
+
};
|
|
43
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
44
|
+
new (): {
|
|
45
|
+
$slots: S;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
49
|
+
[K in keyof T]: T[K];
|
|
50
|
+
} : {
|
|
51
|
+
[K in keyof T as K]: T[K];
|
|
52
|
+
}) & {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MrzResult } from '../composables/useMrzReader.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
intervalMs?: number;
|
|
4
|
+
scaleFactor?: number;
|
|
5
|
+
useOpenCv?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
error: (error: unknown) => any;
|
|
9
|
+
decode: (value: MrzResult) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
11
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
12
|
+
onDecode?: ((value: MrzResult) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
intervalMs: number;
|
|
15
|
+
scaleFactor: number;
|
|
16
|
+
useOpenCv: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, ref, watchEffect } from "vue";
|
|
3
|
+
import { useDevicesList, useUserMedia } from "@vueuse/core";
|
|
4
|
+
import { useAlert } from "../composables/alert";
|
|
5
|
+
import { useMrzReader } from "../composables/useMrzReader";
|
|
6
|
+
const mrzReaderControl = ref(null);
|
|
7
|
+
const alert = useAlert();
|
|
8
|
+
const isLoading = ref(false);
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
intervalMs: { type: Number, required: false, default: 900 },
|
|
11
|
+
scaleFactor: { type: Number, required: false, default: 2 },
|
|
12
|
+
useOpenCv: { type: Boolean, required: false, default: true }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["decode", "error"]);
|
|
15
|
+
const videoScreen = ref();
|
|
16
|
+
const currentCameraId = ref();
|
|
17
|
+
const { videoInputs: cameras } = useDevicesList({
|
|
18
|
+
requestPermissions: true,
|
|
19
|
+
constraints: { audio: false, video: true },
|
|
20
|
+
onUpdated() {
|
|
21
|
+
if (!cameras.value.find((camera) => camera.deviceId === currentCameraId.value))
|
|
22
|
+
currentCameraId.value = cameras.value[0]?.deviceId;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const hasCamera = computed(() => !!currentCameraId.value);
|
|
26
|
+
const { stream, start: cameraStart, stop: cameraStop, enabled: cameraEnabled } = useUserMedia({
|
|
27
|
+
constraints: { video: { deviceId: currentCameraId.value } }
|
|
28
|
+
});
|
|
29
|
+
watchEffect(() => {
|
|
30
|
+
if (videoScreen.value)
|
|
31
|
+
videoScreen.value.srcObject = stream.value ?? null;
|
|
32
|
+
});
|
|
33
|
+
const mrzReader = useMrzReader({
|
|
34
|
+
scaleFactor: props.scaleFactor,
|
|
35
|
+
useOpenCv: props.useOpenCv,
|
|
36
|
+
lang: "ocrb",
|
|
37
|
+
langPath: "/tesseract/"
|
|
38
|
+
});
|
|
39
|
+
async function scanOnce() {
|
|
40
|
+
if (!videoScreen.value || !cameraEnabled.value) return;
|
|
41
|
+
try {
|
|
42
|
+
const parsed = await mrzReader.decodeFromVideoElement(videoScreen.value);
|
|
43
|
+
if (parsed) {
|
|
44
|
+
emit("decode", parsed);
|
|
45
|
+
stopCamera();
|
|
46
|
+
}
|
|
47
|
+
} catch (err) {
|
|
48
|
+
emit("error", err);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function startCamera() {
|
|
52
|
+
if (cameraEnabled.value) return;
|
|
53
|
+
isLoading.value = true;
|
|
54
|
+
cameraStart().then(() => {
|
|
55
|
+
if (mrzReaderControl.value) {
|
|
56
|
+
window.clearInterval(mrzReaderControl.value);
|
|
57
|
+
mrzReaderControl.value = null;
|
|
58
|
+
}
|
|
59
|
+
mrzReaderControl.value = window.setInterval(() => {
|
|
60
|
+
void scanOnce();
|
|
61
|
+
}, props.intervalMs);
|
|
62
|
+
}).catch((err) => {
|
|
63
|
+
emit("error", err);
|
|
64
|
+
}).finally(() => {
|
|
65
|
+
isLoading.value = false;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function stopCamera() {
|
|
69
|
+
if (mrzReaderControl.value) {
|
|
70
|
+
window.clearInterval(mrzReaderControl.value);
|
|
71
|
+
mrzReaderControl.value = null;
|
|
72
|
+
}
|
|
73
|
+
if (cameraEnabled.value)
|
|
74
|
+
cameraStop();
|
|
75
|
+
}
|
|
76
|
+
function scanImageFile(selectedFile) {
|
|
77
|
+
if (!selectedFile) {
|
|
78
|
+
alert?.addAlert({ message: "No file selected.", alertType: "error" });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const file = Array.isArray(selectedFile) ? selectedFile[0] : selectedFile;
|
|
82
|
+
void mrzReader.decodeFromImageFile(file).then((parsed) => {
|
|
83
|
+
if (parsed)
|
|
84
|
+
emit("decode", parsed);
|
|
85
|
+
else
|
|
86
|
+
alert?.addAlert({ message: "MRZ not found or checksum invalid.", alertType: "warning" });
|
|
87
|
+
}).catch((err) => {
|
|
88
|
+
emit("error", err);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
onMounted(() => {
|
|
92
|
+
void mrzReader.ensureOpenCvReady();
|
|
93
|
+
startCamera();
|
|
94
|
+
});
|
|
95
|
+
onBeforeUnmount(() => {
|
|
96
|
+
stopCamera();
|
|
97
|
+
});
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<template>
|
|
101
|
+
<v-card flat>
|
|
102
|
+
<v-card-text class="d-flex justify-center" v-if="isLoading">
|
|
103
|
+
<v-progress-circular indeterminate />
|
|
104
|
+
</v-card-text>
|
|
105
|
+
<v-card-text v-else>
|
|
106
|
+
<v-col v-if="hasCamera">
|
|
107
|
+
<div style="position: relative; display: inline-block; width: 100%;" :style="{ maxWidth: '1024px' }">
|
|
108
|
+
<video autoplay ref="videoScreen" width="100%" :style="{ maxWidth: '1024px' }"></video>
|
|
109
|
+
<div style="position: absolute; bottom: 10px; right: 10px; z-index: 2000;">
|
|
110
|
+
<FileBtn
|
|
111
|
+
accept="image/*"
|
|
112
|
+
icon="mdi mdi-image-plus"
|
|
113
|
+
icon-only
|
|
114
|
+
@update:model-value="scanImageFile"
|
|
115
|
+
/>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</v-col>
|
|
119
|
+
<v-col v-else>
|
|
120
|
+
<FileBtn
|
|
121
|
+
accept="image/*"
|
|
122
|
+
text="Upload Image"
|
|
123
|
+
@update:model-value="scanImageFile"
|
|
124
|
+
/>
|
|
125
|
+
</v-col>
|
|
126
|
+
</v-card-text>
|
|
127
|
+
</v-card>
|
|
128
|
+
</template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type MrzResult } from '../composables/useMrzReader.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
intervalMs?: number;
|
|
4
|
+
scaleFactor?: number;
|
|
5
|
+
useOpenCv?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
error: (error: unknown) => any;
|
|
9
|
+
decode: (value: MrzResult) => any;
|
|
10
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
11
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
12
|
+
onDecode?: ((value: MrzResult) => any) | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
intervalMs: number;
|
|
15
|
+
scaleFactor: number;
|
|
16
|
+
useOpenCv: boolean;
|
|
17
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare var __VLS_20: {}, __VLS_35: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
left?: (props: typeof __VLS_20) => any;
|
|
4
|
+
} & {
|
|
5
|
+
right?: (props: typeof __VLS_35) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { ref } from
|
|
3
|
-
import { VCard } from
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
const props = defineProps<Props>()
|
|
12
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { VCard } from "vuetify/components/VCard";
|
|
4
|
+
const isResizing = ref(false);
|
|
5
|
+
const pane1Width = ref("50%");
|
|
6
|
+
const containerRef = ref();
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
height: { type: [Number, String], required: false }
|
|
9
|
+
});
|
|
13
10
|
const startResize = () => {
|
|
14
|
-
isResizing.value = true
|
|
15
|
-
}
|
|
16
|
-
|
|
11
|
+
isResizing.value = true;
|
|
12
|
+
};
|
|
17
13
|
const stopResize = () => {
|
|
18
|
-
isResizing.value = false
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const resize = (event: MouseEvent) => {
|
|
14
|
+
isResizing.value = false;
|
|
15
|
+
};
|
|
16
|
+
const resize = (event) => {
|
|
22
17
|
if (isResizing.value && containerRef.value) {
|
|
23
|
-
const containerRect = containerRef.value.getBoundingClientRect()
|
|
24
|
-
const newWidth = event.clientX - containerRect.left
|
|
25
|
-
pane1Width.value = `${
|
|
18
|
+
const containerRect = containerRef.value.getBoundingClientRect();
|
|
19
|
+
const newWidth = event.clientX - containerRect.left;
|
|
20
|
+
pane1Width.value = `${newWidth / containerRect.width * 100}%`;
|
|
26
21
|
}
|
|
27
|
-
}
|
|
22
|
+
};
|
|
28
23
|
</script>
|
|
29
24
|
|
|
30
25
|
<template>
|
|
@@ -55,7 +50,3 @@ const resize = (event: MouseEvent) => {
|
|
|
55
50
|
</v-sheet>
|
|
56
51
|
</v-card>
|
|
57
52
|
</template>
|
|
58
|
-
|
|
59
|
-
<style scoped>
|
|
60
|
-
|
|
61
|
-
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare var __VLS_20: {}, __VLS_35: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
left?: (props: typeof __VLS_20) => any;
|
|
4
|
+
} & {
|
|
5
|
+
right?: (props: typeof __VLS_35) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare var __VLS_14: {}, __VLS_28: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
tabs?: (props: typeof __VLS_14) => any;
|
|
4
|
+
} & {
|
|
5
|
+
items?: (props: typeof __VLS_28) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {VTabs} from
|
|
3
|
-
|
|
4
|
-
interface Props extends /* @vue-ignore */ InstanceType<typeof VTabs['$props']> {
|
|
5
|
-
flat?: boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { VTabs } from "vuetify/components";
|
|
8
3
|
defineOptions({
|
|
9
|
-
inheritAttrs: false
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
inheritAttrs: false
|
|
5
|
+
});
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
flat: { type: Boolean, required: false }
|
|
8
|
+
});
|
|
9
|
+
const currentTab = defineModel({ type: [String, Number] });
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
<template>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare var __VLS_14: {}, __VLS_28: {};
|
|
2
|
+
type __VLS_Slots = {} & {
|
|
3
|
+
tabs?: (props: typeof __VLS_14) => any;
|
|
4
|
+
} & {
|
|
5
|
+
items?: (props: typeof __VLS_28) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
"update:modelValue": (value: string | number | undefined) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
10
|
+
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
}
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
5
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
6
|
+
decode: (value: string | undefined) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
9
|
+
onDecode?: ((value: string | undefined) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -1,38 +1,27 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import {ref, watch} from
|
|
3
|
-
import {useAlert} from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const handleData = (data: string) => {
|
|
20
|
-
currentValue.value = data
|
|
21
|
-
scanCode.value = false
|
|
22
|
-
emit('decode',data)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const handleError = (error: string | unknown) => {
|
|
26
|
-
alert?.addAlert({ message: error as string, alertType: 'error' })
|
|
27
|
-
}
|
|
28
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, watch } from "vue";
|
|
3
|
+
import { useAlert } from "../composables/alert";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
modelValue: { type: String, required: false }
|
|
6
|
+
});
|
|
7
|
+
const emit = defineEmits(["update:modelValue", "decode"]);
|
|
8
|
+
const alert = useAlert();
|
|
9
|
+
const scanCode = ref(false);
|
|
10
|
+
const currentValue = ref();
|
|
11
|
+
const handleData = (data) => {
|
|
12
|
+
currentValue.value = data;
|
|
13
|
+
scanCode.value = false;
|
|
14
|
+
emit("decode", data);
|
|
15
|
+
};
|
|
16
|
+
const handleError = (error) => {
|
|
17
|
+
alert?.addAlert({ message: error, alertType: "error" });
|
|
18
|
+
};
|
|
29
19
|
watch(() => props.modelValue, () => {
|
|
30
|
-
currentValue.value = props.modelValue
|
|
31
|
-
}, { immediate: true })
|
|
32
|
-
|
|
20
|
+
currentValue.value = props.modelValue;
|
|
21
|
+
}, { immediate: true });
|
|
33
22
|
watch(currentValue, (newValue) => {
|
|
34
|
-
emit(
|
|
35
|
-
})
|
|
23
|
+
emit("update:modelValue", newValue);
|
|
24
|
+
});
|
|
36
25
|
</script>
|
|
37
26
|
|
|
38
27
|
<template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
modelValue?: string;
|
|
3
|
+
}
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
5
|
+
"update:modelValue": (value: string | undefined) => any;
|
|
6
|
+
decode: (value: string | undefined) => any;
|
|
7
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
8
|
+
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
9
|
+
onDecode?: ((value: string | undefined) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { VBtn } from 'vuetify/components/VBtn';
|
|
2
|
+
import { type PatientRegisterPayload } from '../../composables/hostAgent.js';
|
|
3
|
+
interface Props extends /* @vue-ignore */ InstanceType<typeof VBtn['$props']> {
|
|
4
|
+
/** If true -> call /idcard/infoAndPhoto, else /idcard/info */
|
|
5
|
+
withPhoto?: boolean;
|
|
6
|
+
/** Optional reader name/query string */
|
|
7
|
+
reader?: string | null;
|
|
8
|
+
/** Auto-disable button while reading */
|
|
9
|
+
disableWhileLoading?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare var __VLS_12: never, __VLS_13: {};
|
|
12
|
+
type __VLS_Slots = {} & {
|
|
13
|
+
[K in NonNullable<typeof __VLS_12>]?: (props: typeof __VLS_13) => any;
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
16
|
+
withPhoto: boolean;
|
|
17
|
+
reader: null;
|
|
18
|
+
disableWhileLoading: boolean;
|
|
19
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
|
+
error: (err: unknown) => any;
|
|
21
|
+
loading: (loading: boolean) => any;
|
|
22
|
+
read: (payload: PatientRegisterPayload) => any;
|
|
23
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
24
|
+
withPhoto: boolean;
|
|
25
|
+
reader: null;
|
|
26
|
+
disableWhileLoading: boolean;
|
|
27
|
+
}>>> & Readonly<{
|
|
28
|
+
onError?: ((err: unknown) => any) | undefined;
|
|
29
|
+
onLoading?: ((loading: boolean) => any) | undefined;
|
|
30
|
+
onRead?: ((payload: PatientRegisterPayload) => any) | undefined;
|
|
31
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_TypePropsToOption<T> = {
|
|
36
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
37
|
+
type: import('vue').PropType<Required<T>[K]>;
|
|
38
|
+
} : {
|
|
39
|
+
type: import('vue').PropType<T[K]>;
|
|
40
|
+
required: true;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
type __VLS_WithDefaults<P, D> = {
|
|
44
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
45
|
+
default: D[K];
|
|
46
|
+
}> : P[K];
|
|
47
|
+
};
|
|
48
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
49
|
+
new (): {
|
|
50
|
+
$slots: S;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
54
|
+
[K in keyof T]: T[K];
|
|
55
|
+
} : {
|
|
56
|
+
[K in keyof T as K]: T[K];
|
|
57
|
+
}) & {};
|
|
@@ -1,57 +1,32 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { computed, ref, useAttrs } from
|
|
3
|
-
import { VBtn } from
|
|
4
|
-
import { useAlert } from
|
|
5
|
-
import { useHostAgent
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
reader: null,
|
|
19
|
-
disableWhileLoading: true,
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const emit = defineEmits<{
|
|
23
|
-
(e: 'read', payload: PatientRegisterPayload): void
|
|
24
|
-
(e: 'error', err: unknown): void
|
|
25
|
-
(e: 'loading', loading: boolean): void
|
|
26
|
-
}>()
|
|
27
|
-
|
|
28
|
-
const attrs = useAttrs()
|
|
29
|
-
const host = useHostAgent()
|
|
30
|
-
|
|
31
|
-
const loading = ref(false)
|
|
32
|
-
const disabled = computed(() => (props.disableWhileLoading ? loading.value : false))
|
|
33
|
-
|
|
34
|
-
async function onClick(ev: MouseEvent) {
|
|
35
|
-
// allow parent to prevent if they attach their own click handler and call preventDefault
|
|
36
|
-
if (ev.defaultPrevented) return
|
|
37
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref, useAttrs } from "vue";
|
|
3
|
+
import { VBtn } from "vuetify/components/VBtn";
|
|
4
|
+
import { useAlert } from "../../composables/alert";
|
|
5
|
+
import { useHostAgent } from "../../composables/hostAgent";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
withPhoto: { type: Boolean, required: false, default: false },
|
|
8
|
+
reader: { type: [String, null], required: false, default: null },
|
|
9
|
+
disableWhileLoading: { type: Boolean, required: false, default: true }
|
|
10
|
+
});
|
|
11
|
+
const emit = defineEmits(["read", "error", "loading"]);
|
|
12
|
+
const attrs = useAttrs();
|
|
13
|
+
const host = useHostAgent();
|
|
14
|
+
const loading = ref(false);
|
|
15
|
+
const disabled = computed(() => props.disableWhileLoading ? loading.value : false);
|
|
16
|
+
async function onClick(ev) {
|
|
17
|
+
if (ev.defaultPrevented) return;
|
|
38
18
|
try {
|
|
39
|
-
loading.value = true
|
|
40
|
-
emit(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
} catch (e: any) {
|
|
48
|
-
emit('error', e)
|
|
49
|
-
|
|
50
|
-
const msg = e?.data?.detail || e?.data?.title || e?.message || 'ID card read failed'
|
|
51
|
-
useAlert()?.addAlert({ message: msg, alertType: 'error' })
|
|
19
|
+
loading.value = true;
|
|
20
|
+
emit("loading", true);
|
|
21
|
+
const payload = props.withPhoto ? await host.getIdCardInfoAndPhoto(props.reader ?? void 0) : await host.getIdCardInfo(props.reader ?? void 0);
|
|
22
|
+
emit("read", payload);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
emit("error", e);
|
|
25
|
+
const msg = e?.data?.detail || e?.data?.title || e?.message || "ID card read failed";
|
|
26
|
+
useAlert()?.addAlert({ message: msg, alertType: "error" });
|
|
52
27
|
} finally {
|
|
53
|
-
loading.value = false
|
|
54
|
-
emit(
|
|
28
|
+
loading.value = false;
|
|
29
|
+
emit("loading", false);
|
|
55
30
|
}
|
|
56
31
|
}
|
|
57
32
|
</script>
|
|
@@ -66,17 +41,17 @@ async function onClick(ev: MouseEvent) {
|
|
|
66
41
|
v-bind="attrs"
|
|
67
42
|
class="idcard-btn"
|
|
68
43
|
:loading="loading"
|
|
69
|
-
:disabled="disabled ||
|
|
44
|
+
:disabled="disabled || attrs.disabled"
|
|
70
45
|
@click="onClick"
|
|
71
46
|
>
|
|
72
47
|
<template
|
|
73
|
-
v-for="(_, name, index) in
|
|
48
|
+
v-for="(_, name, index) in $slots"
|
|
74
49
|
:key="index"
|
|
75
50
|
#[name]="slotData"
|
|
76
51
|
>
|
|
77
52
|
<slot
|
|
78
53
|
:name="name"
|
|
79
|
-
v-bind="
|
|
54
|
+
v-bind="slotData || {}"
|
|
80
55
|
/>
|
|
81
56
|
</template>
|
|
82
57
|
</v-btn>
|