@ramathibodi/nuxt-commons 0.0.6 → 0.0.7

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 CHANGED
@@ -6,7 +6,7 @@ Find and replace all on all files (CMD+SHIFT+F):
6
6
  - Package name: @ramahis/common-components
7
7
  -->
8
8
 
9
- # Ramahis Common Component
9
+ # @ramathibodi/nuxt-commons
10
10
 
11
11
  [![npm version][npm-version-src]][npm-version-href]
12
12
  [![npm downloads][npm-downloads-src]][npm-downloads-href]
@@ -16,17 +16,17 @@ Find and replace all on all files (CMD+SHIFT+F):
16
16
 
17
17
  ## Quick Setup
18
18
 
19
- 1. Add `@deverloprama/common-components` dependency to your project
19
+ 1. Add `'@ramathibodi/nuxt-commons'` dependency to your project
20
20
 
21
21
  ```bash
22
22
  # Using pnpm
23
- pnpm add -D @deverloprama/common-components
23
+ pnpm add -D @ramathibodi/nuxt-commons
24
24
 
25
25
  # Using yarn
26
- yarn add --dev @deverloprama/common-components
26
+ yarn add --dev @ramathibodi/nuxt-commons
27
27
 
28
28
  # Using npm
29
- npm install --save-dev @deverloprama/common-components
29
+ npm install --save-dev @ramathibodi/nuxt-commons
30
30
  ```
31
31
 
32
32
  2. Add `my-module` to the `modules` section of `nuxt.config.ts`
@@ -34,7 +34,7 @@ npm install --save-dev @deverloprama/common-components
34
34
  ```js
35
35
  export default defineNuxtConfig({
36
36
  modules: [
37
- '@deverloprama/common-components'
37
+ '@ramathibodi/nuxt-commons'
38
38
  ]
39
39
  })
40
40
  ```
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0"
6
6
  },
7
- "version": "0.0.6"
7
+ "version": "0.0.7"
8
8
  }
@@ -32,7 +32,7 @@ watch(() => alert?.hasAlert(), (hasAlert) => {
32
32
  v-if="currentItem"
33
33
  v-model="isAlertOpen"
34
34
  :timeout="timeout"
35
- location="top"
35
+ location="center"
36
36
  multi-line
37
37
  variant="text"
38
38
  @update:model-value="renewAlert()"
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ import {computed} from "vue";
3
+ interface Props {
4
+ modelValue: string
5
+ variant?: 'mobilePhone' | 'homePhone' | 'citizenId' | 'creditCard'
6
+ hideContent?: boolean
7
+ }
8
+
9
+ const props = withDefaults(defineProps<Props>(), {
10
+ hideContent: false,
11
+ })
12
+
13
+ const labelMask = computed(() => {
14
+ if (!props.hideContent) {
15
+ if(props.variant == 'mobilePhone') return props.modelValue.length == 10 ? `${props.modelValue.substring(0,3)}-${props.modelValue.substring(3,6)}-${props.modelValue.substring(6,10)}` : "invalid format"
16
+ if(props.variant == 'homePhone') return props.modelValue.length == 9 ? `${props.modelValue.substring(0,2)}-${props.modelValue.substring(2,5)}-${props.modelValue.substring(5,9)}` : "invalid format"
17
+ if(props.variant == 'citizenId') return props.modelValue.length == 13 ? `${props.modelValue.substring(0,1)}-${props.modelValue.substring(1,5)}-${props.modelValue.substring(5,10)}-${props.modelValue.substring(10,12)}-${props.modelValue.substring(12,13)}` : "invalid format"
18
+ if(props.variant == 'creditCard') return props.modelValue.length == 16 ? `${props.modelValue.substring(0,4)}-${props.modelValue.substring(4,8)}-${props.modelValue.substring(8,12)}-${props.modelValue.substring(12,16)}` : "invalid format"
19
+
20
+ const middlePart = 'x'.repeat(props.modelValue.length - 6);
21
+ return `${props.modelValue.substring(0,3)}${middlePart}${props.modelValue.slice(-3)}`
22
+ } else {
23
+ if(props.variant == 'mobilePhone') return props.modelValue.length == 10 ? `${props.modelValue.substring(0,2)}x-xxx-${props.modelValue.substring(6,10)}` : "invalid format"
24
+ if(props.variant == 'homePhone') return props.modelValue.length == 9 ? `${props.modelValue.substring(0,2)}-xxx-${props.modelValue.substring(5,9)}` : "invalid format"
25
+ if(props.variant == 'citizenId') return props.modelValue.length == 13 ? `${props.modelValue.substring(0,1)}-xxxx-xxxxx-${props.modelValue.substring(10,12)}-${props.modelValue.substring(12,13)}` : "invalid format"
26
+ if(props.variant == 'creditCard') return props.modelValue.length == 16 ? `xxxx-xxxx-xxxx-${props.modelValue.substring(12,16)}` : "invalid format"
27
+
28
+ const middlePart = 'x'.repeat(props.modelValue.length - 6);
29
+ return `${props.modelValue.substring(0,3)}${middlePart}${props.modelValue.slice(-3)}`
30
+ }
31
+ })
32
+ </script>
33
+
34
+ <template>
35
+ {{labelMask}}
36
+ </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramathibodi/nuxt-commons",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Ramathibodi Nuxt modules for common components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@
64
64
  "uid": "^2.0.2",
65
65
  "vue": "^3.4.25",
66
66
  "vue-signature-pad": "^3.0.2",
67
- "vuetify": "^3.6.6",
67
+ "vuetify": "^3.6.8",
68
68
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
69
69
  },
70
70
  "devDependencies": {