diff --git a/README.md b/README.md index 054f28c5..9dc0e298 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ RSSA - Front End - > [!IMPORTANT] > Read this following instructions before doing your job @@ -65,22 +64,22 @@ The basic development workflow follows these steps: ## Code Conventions - Under the script setup block, putting things in group with the following order: - - Imports → all dependencies, sorted by external, alias (~), and relative imports. - - Props & Emits → clearly define component inputs & outputs. - - State & Computed → all ref, reactive, and computed variables grouped together. - - Lifecycle Hooks → grouped by mounting → updating → unmounting order. - - Functions → async first (fetching, API calls), then utility & event handlers. - - Watchers → if needed, put them at the bottom. - - Template → keep clean and minimal logic, use methods/computed instead of inline JS. + - Imports → all dependencies, sorted by external, alias (~), and relative imports. + - Props & Emits → clearly define component inputs & outputs. + - State & Computed → all ref, reactive, and computed variables grouped together. + - Lifecycle Hooks → grouped by mounting → updating → unmounting order. + - Functions → async first (fetching, API calls), then utility & event handlers. + - Watchers → if needed, put them at the bottom. + - Template → keep clean and minimal logic, use methods/computed instead of inline JS. - Declaration Naming - - Uses PascalCase for `type` naming - - Uses camelCase for `variable` and `const` naming - - Underscore can be used to indicates that a variable has derived from an attribute of an object
- for example: `person_name` indicates it is an attribute `name` from object `person` + - Uses PascalCase for `type` naming + - Uses camelCase for `variable` and `const` naming + - Underscore can be used to indicates that a variable has derived from an attribute of an object
+ for example: `person_name` indicates it is an attribute `name` from object `person` - Looping - - Uses `i`, `j`, `k` as variable for `for` looping index - - Uses `item` as object instantition for `forEach` loop callback - - Uses `item` as object instantition for `v-for` loop callback in the template + - Uses `i`, `j`, `k` as variable for `for` looping index + - Uses `item` as object instantition for `forEach` loop callback + - Uses `item` as object instantition for `v-for` loop callback in the template ## Git Workflows diff --git a/app/components/app/patient/entry-form.vue b/app/components/app/patient/entry-form.vue index 0b636bcf..5768c6a0 100644 --- a/app/components/app/patient/entry-form.vue +++ b/app/components/app/patient/entry-form.vue @@ -13,22 +13,32 @@ import Label from '~/components/pub/form/label.vue'
-
- - - - - - - - - - - - - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/app/components/app/patient/list-cfg.ts b/app/components/app/patient/list-cfg.ts index c1131bec..0e1fe7f4 100644 --- a/app/components/app/patient/list-cfg.ts +++ b/app/components/app/patient/list-cfg.ts @@ -1,11 +1,5 @@ -import type { - Col, - KeyLabel, - RecComponent, - RecStrFuncComponent, - RecStrFuncUnknown, - Th, -} from '~/components/pub/nav/types' +import type { Col, KeyLabel, RecComponent, RecStrFuncComponent, RecStrFuncUnknown, Th } from '../../pub/nav/types' +import { defineAsyncComponent } from 'vue' type SmallDetailDto = any diff --git a/app/components/app/patient/list.vue b/app/components/app/patient/list.vue index beba372c..5b8778d9 100644 --- a/app/components/app/patient/list.vue +++ b/app/components/app/patient/list.vue @@ -1,5 +1,5 @@ - + diff --git a/app/components/pub/form/label.vue b/app/components/pub/form/label.vue index b1ad2d55..179cee89 100644 --- a/app/components/pub/form/label.vue +++ b/app/components/pub/form/label.vue @@ -4,69 +4,49 @@ const props = withDefaults( size?: 'default' | 'narrow' | 'wide' height?: 'default' | 'compact' position?: 'default' | 'dynamic' - class?: string }>(), { size: 'default', height: 'default', position: 'default', - class: '', }, ) -const classVal = computed(() => { - let val = '' +const sizeMap = { + default: 'w-28 2xl:w-36', + narrow: 'w-24 2xl:w-28', + wide: 'w-44 2xl:w-48', +} as const - if (props.size === 'narrow') val += 'size-narrow ' - else if (props.size === 'wide') val += 'size-wide ' - else val += 'size-default ' +const heightMap = { + default: 'pt-2 2xl:pt-2.5', + compact: 'leading-[14pt]', +} as const - if (props.height === 'compact') val += 'height-compact ' - else val += 'height-default ' +const positionWrapMap = { + default: 'pe-2 text-start', + dynamic: 'md:text-end', +} as const - if (props.position === 'dynamic') val += 'position-dynamic ' - else val += 'position-default ' +const positionChildMap = { + default: '', + dynamic: 'block pe-2.5', +} as const - return (val + (props.class || '')).trim() -}) +const wrapperClass = computed(() => [ + 'block shrink-0', + sizeMap[props.size], + heightMap[props.height], + positionWrapMap[props.position], +]) + +const labelClass = computed(() => positionChildMap[props.position]) - - diff --git a/app/components/pub/nav/types.ts b/app/components/pub/nav/types.ts index aa4d130b..c1dbe8d3 100644 --- a/app/components/pub/nav/types.ts +++ b/app/components/pub/nav/types.ts @@ -1,4 +1,5 @@ -import type { ComponentType } from '@unovis/ts' +// import type { ComponentType } from '@unovis/ts' +import type { Component } from 'vue' export interface ListItemDto { id: number @@ -6,6 +7,8 @@ export interface ListItemDto { code: string } +export type ComponentType = Component + export interface RecComponent { idx?: number rec: object diff --git a/app/components/pub/ui/accordion/AccordionContent.vue b/app/components/pub/ui/accordion/AccordionContent.vue index 585ad9bb..c3b9e2fa 100644 --- a/app/components/pub/ui/accordion/AccordionContent.vue +++ b/app/components/pub/ui/accordion/AccordionContent.vue @@ -1,9 +1,9 @@ diff --git a/app/components/pub/ui/form/useFormField.ts b/app/components/pub/ui/form/useFormField.ts index 2da133b8..b94b79ae 100644 --- a/app/components/pub/ui/form/useFormField.ts +++ b/app/components/pub/ui/form/useFormField.ts @@ -13,7 +13,7 @@ export function useFormField() { } if (!fieldContext) - throw new Error('useFormField should be used within ') + { throw new Error('useFormField should be used within ') } const { name } = fieldContext const id = fieldItemContext diff --git a/app/components/pub/ui/hover-card/HoverCardContent.vue b/app/components/pub/ui/hover-card/HoverCardContent.vue index f35e3809..47b1517a 100644 --- a/app/components/pub/ui/hover-card/HoverCardContent.vue +++ b/app/components/pub/ui/hover-card/HoverCardContent.vue @@ -1,7 +1,6 @@ diff --git a/app/components/pub/ui/menubar/MenubarRadioItem.vue b/app/components/pub/ui/menubar/MenubarRadioItem.vue index a4d72455..688034dc 100644 --- a/app/components/pub/ui/menubar/MenubarRadioItem.vue +++ b/app/components/pub/ui/menubar/MenubarRadioItem.vue @@ -1,7 +1,6 @@