@ramathibodi/nuxt-commons 0.1.13 → 0.1.15

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 (59) hide show
  1. package/README.md +96 -96
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/Alert.vue +53 -53
  4. package/dist/runtime/components/BarcodeReader.vue +98 -98
  5. package/dist/runtime/components/ExportCSV.vue +55 -55
  6. package/dist/runtime/components/FileBtn.vue +62 -62
  7. package/dist/runtime/components/ImportCSV.vue +64 -64
  8. package/dist/runtime/components/SplitterPanel.vue +59 -59
  9. package/dist/runtime/components/TabsGroup.vue +32 -32
  10. package/dist/runtime/components/TextBarcode.vue +52 -52
  11. package/dist/runtime/components/dialog/Confirm.vue +100 -100
  12. package/dist/runtime/components/dialog/Index.vue +72 -72
  13. package/dist/runtime/components/dialog/Loading.vue +39 -39
  14. package/dist/runtime/components/document/TemplateBuilder.vue +203 -216
  15. package/dist/runtime/components/form/Birthdate.vue +216 -199
  16. package/dist/runtime/components/form/CodeEditor.vue +37 -37
  17. package/dist/runtime/components/form/Date.vue +163 -163
  18. package/dist/runtime/components/form/DateTime.vue +107 -107
  19. package/dist/runtime/components/form/Dialog.vue +138 -138
  20. package/dist/runtime/components/form/File.vue +187 -187
  21. package/dist/runtime/components/form/Hidden.vue +32 -32
  22. package/dist/runtime/components/form/Login.vue +131 -131
  23. package/dist/runtime/components/form/Pad.vue +217 -217
  24. package/dist/runtime/components/form/SignPad.vue +186 -186
  25. package/dist/runtime/components/form/Table.vue +266 -266
  26. package/dist/runtime/components/form/Time.vue +158 -158
  27. package/dist/runtime/components/form/images/Capture.vue +231 -0
  28. package/dist/runtime/components/form/images/Edit.vue +117 -143
  29. package/dist/runtime/components/label/Date.vue +29 -29
  30. package/dist/runtime/components/label/Field.vue +42 -29
  31. package/dist/runtime/components/label/FormatMoney.vue +29 -29
  32. package/dist/runtime/components/label/Mask.vue +38 -38
  33. package/dist/runtime/components/master/Autocomplete.vue +159 -159
  34. package/dist/runtime/components/master/Combobox.vue +84 -84
  35. package/dist/runtime/components/master/RadioGroup.vue +78 -78
  36. package/dist/runtime/components/master/Select.vue +82 -82
  37. package/dist/runtime/components/model/Pad.vue +122 -122
  38. package/dist/runtime/components/model/Table.vue +242 -240
  39. package/dist/runtime/components/model/iterator.vue +312 -312
  40. package/dist/runtime/components/pdf/Print.vue +63 -63
  41. package/dist/runtime/components/pdf/View.vue +104 -104
  42. package/dist/runtime/composables/graphqlModel.d.ts +4 -1
  43. package/dist/runtime/composables/graphqlModel.mjs +5 -5
  44. package/dist/runtime/composables/graphqlModelOperation.mjs +7 -4
  45. package/dist/runtime/labs/Calendar.vue +99 -99
  46. package/dist/runtime/labs/form/EditMobile.vue +152 -152
  47. package/dist/runtime/labs/form/TextFieldMask.vue +43 -43
  48. package/dist/runtime/types/alert.d.ts +11 -11
  49. package/dist/runtime/types/formDialog.d.ts +4 -4
  50. package/dist/runtime/types/graphqlOperation.d.ts +23 -23
  51. package/dist/runtime/types/menu.d.ts +25 -25
  52. package/dist/runtime/types/modules.d.ts +7 -7
  53. package/package.json +120 -118
  54. package/scripts/postInstall.cjs +70 -70
  55. package/templates/.codegen/codegen.ts +32 -32
  56. package/templates/.codegen/plugin-schema-object.js +154 -154
  57. package/dist/runtime/components/Camera.vue +0 -129
  58. package/dist/runtime/components/form/images/CameraCrop.vue +0 -58
  59. package/dist/runtime/components/form/images/Preview.vue +0 -48
package/package.json CHANGED
@@ -1,118 +1,120 @@
1
- {
2
- "name": "@ramathibodi/nuxt-commons",
3
- "version": "0.1.13",
4
- "description": "Ramathibodi Nuxt modules for common components",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://gitlab.rama.mahidol.ac.th/ramacare/frontend/rama-modules.git"
8
- },
9
- "license": "MIT",
10
- "type": "module",
11
- "exports": {
12
- ".": {
13
- "types": "./dist/types.d.ts",
14
- "import": "./dist/module.mjs",
15
- "require": "./dist/module.cjs"
16
- },
17
- "./utils/*": {
18
- "types": "./dist/runtime/utils/*.d.ts",
19
- "import": "./dist/runtime/utils/*.mjs",
20
- "require": "./dist/runtime/utils/*.cjs"
21
- },
22
- "./composables/*": {
23
- "types": "./dist/runtime/composables/*.d.ts",
24
- "import": "./dist/runtime/composables/*.mjs",
25
- "require": "./dist/runtime/composables/*.cjs"
26
- },
27
- "./composables/*/*": {
28
- "types": "./dist/runtime/composables/*/*.d.ts",
29
- "import": "./dist/runtime/composables/*/*.mjs",
30
- "require": "./dist/runtime/composables/*/*.cjs"
31
- },
32
- "./components/*": "./dist/runtime/components/*.vue",
33
- "./components/*/*": "./dist/runtime/components/*/*.vue",
34
- "./lab/*": "./dist/runtime/labs/*.vue",
35
- "./lab/*/*": "./dist/runtime/labs/*/*.vue"
36
- },
37
- "main": "./dist/module.cjs",
38
- "types": "./dist/types.d.ts",
39
- "files": [
40
- "dist",
41
- "scripts",
42
- "templates"
43
- ],
44
- "scripts": {
45
- "prepack": "nuxt-module-build build",
46
- "dev": "nuxi dev playground",
47
- "dev:build": "nuxi build playground",
48
- "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
49
- "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
50
- "lint": "eslint .",
51
- "lint:fix": "eslint . --fix",
52
- "test": "vitest run",
53
- "test:watch": "vitest watch",
54
- "postinstall": "node scripts/postInstall.cjs"
55
- },
56
- "dependencies": {
57
- "@codemirror/lang-html": "^6.4.9",
58
- "@codemirror/lang-javascript": "^6.2.2",
59
- "@codemirror/lang-vue": "^0.1.3",
60
- "@codemirror/theme-one-dark": "^6.1.2",
61
- "@fortawesome/fontawesome-free": "^6.5.2",
62
- "@fullcalendar/core": "^6.1.11",
63
- "@fullcalendar/daygrid": "^6.1.11",
64
- "@fullcalendar/interaction": "^6.1.11",
65
- "@fullcalendar/list": "^6.1.11",
66
- "@fullcalendar/multimonth": "^6.1.11",
67
- "@fullcalendar/timegrid": "^6.1.11",
68
- "@fullcalendar/vue3": "^6.1.11",
69
- "@graphql-codegen/cli": "^5.0.2",
70
- "@graphql-codegen/add": "^5.0.2",
71
- "@graphql-codegen/plugin-helpers": "^5.0.4",
72
- "@graphql-codegen/typescript": "^4.0.6",
73
- "@mdi/font": "^7.4.47",
74
- "@nuxt/kit": "^3.11.2",
75
- "@nuxtjs/apollo": "5.0.0-alpha.14",
76
- "@vue/apollo-composable": "^4.0.2",
77
- "@vuepic/vue-datepicker": "^7.4.1",
78
- "@vueuse/integrations": "^10.10.0",
79
- "@zxing/browser": "^0.1.4",
80
- "cropperjs": "^1.6.2",
81
- "currency.js": "^2.0.4",
82
- "fuse.js": "^7.0.0",
83
- "graphql": "^16.9.0",
84
- "gql-query-builder": "^3.8.0",
85
- "lodash": "^4.17.21",
86
- "luxon": "^3.4.4",
87
- "maska": "^2.1.11",
88
- "pdf-vue3": "^1.0.12",
89
- "print-js": "^1.6.0",
90
- "uid": "^2.0.2",
91
- "vue": "^3.4.25",
92
- "vue-codemirror": "^6.1.1",
93
- "vue-signature-pad": "^3.0.2",
94
- "vuetify": "^3.6.8",
95
- "prettier": "3.3.2",
96
- "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
97
- },
98
- "devDependencies": {
99
- "@nuxt/devtools": "^1.2.0",
100
- "@nuxt/eslint-config": "^0.3.9",
101
- "@nuxt/module-builder": "^0.5.5",
102
- "@nuxt/schema": "^3.11.2",
103
- "@nuxt/test-utils": "^3.12.1",
104
- "@types/lodash": "^4.17.0",
105
- "@types/luxon": "^3.4.2",
106
- "@types/node": "^18.17.5",
107
- "@vueuse/core": "^10.9.0",
108
- "@vueuse/nuxt": "^10.9.0",
109
- "changelogen": "^0.5.5",
110
- "eslint": "^9.1.1",
111
- "nuxt": "^3.11.2",
112
- "nuxt-lodash": "^2.5.3",
113
- "sass": "^1.75.0",
114
- "typescript": "^5.4.5",
115
- "vitest": "^1.5.1",
116
- "vue-tsc": "^1.8.27"
117
- }
118
- }
1
+ {
2
+ "name": "@ramathibodi/nuxt-commons",
3
+ "version": "0.1.15",
4
+ "description": "Ramathibodi Nuxt modules for common components",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://gitlab.rama.mahidol.ac.th/ramacare/frontend/rama-modules.git"
8
+ },
9
+ "license": "MIT",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/types.d.ts",
14
+ "import": "./dist/module.mjs",
15
+ "require": "./dist/module.cjs"
16
+ },
17
+ "./utils/*": {
18
+ "types": "./dist/runtime/utils/*.d.ts",
19
+ "import": "./dist/runtime/utils/*.mjs",
20
+ "require": "./dist/runtime/utils/*.cjs"
21
+ },
22
+ "./composables/*": {
23
+ "types": "./dist/runtime/composables/*.d.ts",
24
+ "import": "./dist/runtime/composables/*.mjs",
25
+ "require": "./dist/runtime/composables/*.cjs"
26
+ },
27
+ "./composables/*/*": {
28
+ "types": "./dist/runtime/composables/*/*.d.ts",
29
+ "import": "./dist/runtime/composables/*/*.mjs",
30
+ "require": "./dist/runtime/composables/*/*.cjs"
31
+ },
32
+ "./components/*": "./dist/runtime/components/*.vue",
33
+ "./components/*/*": "./dist/runtime/components/*/*.vue",
34
+ "./lab/*": "./dist/runtime/labs/*.vue",
35
+ "./lab/*/*": "./dist/runtime/labs/*/*.vue"
36
+ },
37
+ "main": "./dist/module.cjs",
38
+ "types": "./dist/types.d.ts",
39
+ "files": [
40
+ "dist",
41
+ "scripts",
42
+ "templates"
43
+ ],
44
+ "scripts": {
45
+ "prepack": "nuxt-module-build build",
46
+ "dev": "nuxi dev playground",
47
+ "dev:build": "nuxi build playground",
48
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
49
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
50
+ "lint": "eslint .",
51
+ "lint:fix": "eslint . --fix",
52
+ "test": "vitest run",
53
+ "test:watch": "vitest watch",
54
+ "postinstall": "node scripts/postInstall.cjs"
55
+ },
56
+ "dependencies": {
57
+ "@codemirror/lang-html": "^6.4.9",
58
+ "@codemirror/lang-javascript": "^6.2.2",
59
+ "@codemirror/lang-vue": "^0.1.3",
60
+ "@codemirror/theme-one-dark": "^6.1.2",
61
+ "@fortawesome/fontawesome-free": "^6.5.2",
62
+ "@fullcalendar/core": "^6.1.11",
63
+ "@fullcalendar/daygrid": "^6.1.11",
64
+ "@fullcalendar/interaction": "^6.1.11",
65
+ "@fullcalendar/list": "^6.1.11",
66
+ "@fullcalendar/multimonth": "^6.1.11",
67
+ "@fullcalendar/timegrid": "^6.1.11",
68
+ "@fullcalendar/vue3": "^6.1.11",
69
+ "@graphql-codegen/add": "^5.0.2",
70
+ "@graphql-codegen/cli": "^5.0.2",
71
+ "@graphql-codegen/plugin-helpers": "^5.0.4",
72
+ "@graphql-codegen/typescript": "^4.0.6",
73
+ "@mdi/font": "^7.4.47",
74
+ "@nuxt/kit": "^3.11.2",
75
+ "@nuxtjs/apollo": "5.0.0-alpha.14",
76
+ "@vue/apollo-composable": "^4.0.2",
77
+ "@vuepic/vue-datepicker": "^7.4.1",
78
+ "@vueuse/integrations": "^10.10.0",
79
+ "@zxing/browser": "^0.1.4",
80
+ "cropperjs": "^1.6.2",
81
+ "currency.js": "^2.0.4",
82
+ "exif-rotate-js": "^1.5.0",
83
+ "fuse.js": "^7.0.0",
84
+ "gql-query-builder": "^3.8.0",
85
+ "graphql": "^16.9.0",
86
+ "lodash": "^4.17.21",
87
+ "luxon": "^3.4.4",
88
+ "maska": "^2.1.11",
89
+ "pdf-vue3": "^1.0.12",
90
+ "prettier": "3.3.2",
91
+ "print-js": "^1.6.0",
92
+ "uid": "^2.0.2",
93
+ "vue": "^3.4.25",
94
+ "vue-codemirror": "^6.1.1",
95
+ "vue-signature-pad": "^3.0.2",
96
+ "vuetify": "^3.6.8",
97
+ "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.0/xlsx-0.20.0.tgz"
98
+ },
99
+ "devDependencies": {
100
+ "@nuxt/devtools": "^1.2.0",
101
+ "@nuxt/eslint-config": "^0.3.9",
102
+ "@nuxt/module-builder": "^0.5.5",
103
+ "@nuxt/schema": "^3.11.2",
104
+ "@nuxt/test-utils": "^3.12.1",
105
+ "@types/lodash": "^4.17.0",
106
+ "@types/luxon": "^3.4.2",
107
+ "@types/node": "^18.17.5",
108
+ "@vueuse/core": "^10.9.0",
109
+ "@vueuse/nuxt": "^10.9.0",
110
+ "changelogen": "^0.5.5",
111
+ "eslint": "^9.1.1",
112
+ "nuxt": "^3.11.2",
113
+ "nuxt-lodash": "^2.5.3",
114
+ "sass": "^1.75.0",
115
+ "typescript": "^5.4.5",
116
+ "vitest": "^1.5.1",
117
+ "vue-tsc": "^1.8.27"
118
+ },
119
+ "packageManager": "pnpm@9.6.0+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e"
120
+ }
@@ -1,70 +1,70 @@
1
- const fs = require('node:fs')
2
- const path = require('node:path')
3
- const { execSync } = require('node:child_process')
4
-
5
- // Function to copy a file from source to destination
6
- function copyFile(src, dest) {
7
- fs.mkdirSync(path.dirname(dest), { recursive: true })
8
- fs.copyFileSync(src, dest)
9
- console.log(`Copied ${src} to ${dest}`)
10
- }
11
-
12
- // Function to copy all files in a directory recursively
13
- function copyDirectory(srcDir, destDir) {
14
- const entries = fs.readdirSync(srcDir, { withFileTypes: true })
15
-
16
- for (let entry of entries) {
17
- const srcPath = path.join(srcDir, entry.name)
18
- const destPath = path.join(destDir, entry.name)
19
-
20
- if (entry.isDirectory()) {
21
- copyDirectory(srcPath, destPath)
22
- }
23
- else {
24
- copyFile(srcPath, destPath)
25
- }
26
- }
27
- }
28
-
29
- // Function to modify package.json to add a new script
30
- function addScriptToPackageJson(scriptName, scriptCommand) {
31
- const packageJsonPath = path.join(process.env.INIT_CWD, 'package.json')
32
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
33
-
34
- packageJson.scripts = packageJson.scripts || {}
35
- packageJson.scripts[scriptName] = scriptCommand
36
-
37
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
38
- console.log(`Added script "${scriptName}": "${scriptCommand}" to package.json`)
39
- }
40
-
41
- // Function to run npm run codegen safely
42
- function runCodegen(projectRoot) {
43
- try {
44
- execSync('npm run codegen', { cwd: projectRoot, stdio: 'inherit' })
45
- console.log('Successfully ran npm run codegen')
46
- }
47
- catch (error) {
48
- console.log('npm run codegen failed or script not found, continuing...')
49
- }
50
- }
51
-
52
- if (process.env.INIT_CWD === process.cwd()) process.exit()
53
-
54
- // Define source and destination directories
55
- const srcDir = path.join(__dirname, '..', 'templates')
56
- const destDir = process.env.INIT_CWD // Project root
57
-
58
- // Copy all files from templates directory to project root
59
- copyDirectory(srcDir, destDir)
60
-
61
- // Add new script to package.json
62
- addScriptToPackageJson('codegen', 'graphql-codegen --require dotenv/config --config ./.codegen/codegen.ts dotenv_config_path=.env')
63
-
64
- // Run npm run codegen safely
65
- if (!fs.existsSync(path.join(destDir, 'types', 'graphql.ts')) || !fs.existsSync(path.join(destDir, 'composables', 'graphqlObject.ts'))) {
66
- if (process.env.NUXT_PUBLIC_WS_GRAPHQL) runCodegen(destDir)
67
- }
68
- else {
69
- console.log('Skipping codegen')
70
- }
1
+ const fs = require('node:fs')
2
+ const path = require('node:path')
3
+ const { execSync } = require('node:child_process')
4
+
5
+ // Function to copy a file from source to destination
6
+ function copyFile(src, dest) {
7
+ fs.mkdirSync(path.dirname(dest), { recursive: true })
8
+ fs.copyFileSync(src, dest)
9
+ console.log(`Copied ${src} to ${dest}`)
10
+ }
11
+
12
+ // Function to copy all files in a directory recursively
13
+ function copyDirectory(srcDir, destDir) {
14
+ const entries = fs.readdirSync(srcDir, { withFileTypes: true })
15
+
16
+ for (let entry of entries) {
17
+ const srcPath = path.join(srcDir, entry.name)
18
+ const destPath = path.join(destDir, entry.name)
19
+
20
+ if (entry.isDirectory()) {
21
+ copyDirectory(srcPath, destPath)
22
+ }
23
+ else {
24
+ copyFile(srcPath, destPath)
25
+ }
26
+ }
27
+ }
28
+
29
+ // Function to modify package.json to add a new script
30
+ function addScriptToPackageJson(scriptName, scriptCommand) {
31
+ const packageJsonPath = path.join(process.env.INIT_CWD, 'package.json')
32
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
33
+
34
+ packageJson.scripts = packageJson.scripts || {}
35
+ packageJson.scripts[scriptName] = scriptCommand
36
+
37
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
38
+ console.log(`Added script "${scriptName}": "${scriptCommand}" to package.json`)
39
+ }
40
+
41
+ // Function to run npm run codegen safely
42
+ function runCodegen(projectRoot) {
43
+ try {
44
+ execSync('npm run codegen', { cwd: projectRoot, stdio: 'inherit' })
45
+ console.log('Successfully ran npm run codegen')
46
+ }
47
+ catch (error) {
48
+ console.log('npm run codegen failed or script not found, continuing...')
49
+ }
50
+ }
51
+
52
+ if (process.env.INIT_CWD === process.cwd()) process.exit()
53
+
54
+ // Define source and destination directories
55
+ const srcDir = path.join(__dirname, '..', 'templates')
56
+ const destDir = process.env.INIT_CWD // Project root
57
+
58
+ // Copy all files from templates directory to project root
59
+ copyDirectory(srcDir, destDir)
60
+
61
+ // Add new script to package.json
62
+ addScriptToPackageJson('codegen', 'graphql-codegen --require dotenv/config --config ./.codegen/codegen.ts dotenv_config_path=.env')
63
+
64
+ // Run npm run codegen safely
65
+ if (!fs.existsSync(path.join(destDir, 'types', 'graphql.ts')) || !fs.existsSync(path.join(destDir, 'composables', 'graphqlObject.ts'))) {
66
+ if (process.env.NUXT_PUBLIC_WS_GRAPHQL) runCodegen(destDir)
67
+ }
68
+ else {
69
+ console.log('Skipping codegen')
70
+ }
@@ -1,32 +1,32 @@
1
- import type {CodegenConfig} from '@graphql-codegen/cli'
2
-
3
- const config: CodegenConfig = {
4
- overwrite: true,
5
- schema: process.env.NUXT_PUBLIC_WS_GRAPHQL,
6
- generates: {
7
- './types/graphql.ts': {
8
- plugins: [{
9
- add: {
10
- content: '//Auto-generated file, do not make any change. Content could be overwritten.',
11
- },
12
- }, 'typescript'],
13
- config: {
14
- maybeValue: 'T | null | undefined',
15
- inputMaybeValue: 'T | null | undefined',
16
- declarationKind: 'class',
17
- enumsAsTypes: true,
18
- skipTypename: true,
19
- },
20
- },
21
- './composables/graphqlObject.ts': {
22
- plugins: [{
23
- add: {
24
- content: '//Auto-generated file, do not make any change. Content could be overwritten.',
25
- },
26
- }, './.codegen/plugin-schema-object.js'],
27
- },
28
- },
29
- hooks: { afterAllFileWrite: ['prettier --parser typescript --tab-width 4 --write'] },
30
- }
31
-
32
- export default config
1
+ import type {CodegenConfig} from '@graphql-codegen/cli'
2
+
3
+ const config: CodegenConfig = {
4
+ overwrite: true,
5
+ schema: process.env.NUXT_PUBLIC_WS_GRAPHQL,
6
+ generates: {
7
+ './types/graphql.ts': {
8
+ plugins: [{
9
+ add: {
10
+ content: '//Auto-generated file, do not make any change. Content could be overwritten.',
11
+ },
12
+ }, 'typescript'],
13
+ config: {
14
+ maybeValue: 'T | null | undefined',
15
+ inputMaybeValue: 'T | null | undefined',
16
+ declarationKind: 'class',
17
+ enumsAsTypes: true,
18
+ skipTypename: true,
19
+ },
20
+ },
21
+ './composables/graphqlObject.ts': {
22
+ plugins: [{
23
+ add: {
24
+ content: '//Auto-generated file, do not make any change. Content could be overwritten.',
25
+ },
26
+ }, './.codegen/plugin-schema-object.js'],
27
+ },
28
+ },
29
+ hooks: { afterAllFileWrite: ['prettier --parser typescript --tab-width 4 --write'] },
30
+ }
31
+
32
+ export default config