create-nexwire 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 +233 -0
- package/express/.dockerignore +14 -0
- package/express/.env +44 -0
- package/express/.env.example +42 -0
- package/express/.vscode/settings.json +26 -0
- package/express/LICENSE +21 -0
- package/express/README.md +211 -0
- package/express/biome.json +66 -0
- package/express/drizzle.config.ts +25 -0
- package/express/gitignore-stub +24 -0
- package/express/package.json +108 -0
- package/express/public/.gitkeep +0 -0
- package/express/src/config/app.ts +41 -0
- package/express/src/config/auth.ts +12 -0
- package/express/src/config/cache.ts +16 -0
- package/express/src/config/cookie.ts +15 -0
- package/express/src/config/cors.ts +12 -0
- package/express/src/config/database.ts +29 -0
- package/express/src/config/index.ts +83 -0
- package/express/src/config/jwt.ts +19 -0
- package/express/src/config/logging.ts +13 -0
- package/express/src/config/mail.ts +24 -0
- package/express/src/config/openapi.ts +54 -0
- package/express/src/config/queue.ts +30 -0
- package/express/src/config/rateLimit.ts +17 -0
- package/express/src/config/realtime.ts +15 -0
- package/express/src/config/redis.ts +18 -0
- package/express/src/config/security.ts +44 -0
- package/express/src/config/session.ts +17 -0
- package/express/src/config/storage.ts +22 -0
- package/express/src/config/validate.ts +40 -0
- package/express/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/express/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/express/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/express/src/database/schema.ts +3 -0
- package/express/src/env.ts +76 -0
- package/express/src/framework/cache/cache.ts +81 -0
- package/express/src/framework/circuit-breaker/cb.ts +60 -0
- package/express/src/framework/database/connection.ts +196 -0
- package/express/src/framework/database/migrate-hooks.ts +87 -0
- package/express/src/framework/database/paginate.ts +227 -0
- package/express/src/framework/database/schema.ts +20 -0
- package/express/src/framework/database/seed.ts +139 -0
- package/express/src/framework/events/dispatcher.ts +49 -0
- package/express/src/framework/facade.ts +48 -0
- package/express/src/framework/http/app.ts +107 -0
- package/express/src/framework/http/cors.ts +7 -0
- package/express/src/framework/http/logger.ts +69 -0
- package/express/src/framework/http/metrics.ts +22 -0
- package/express/src/framework/http/openapi.ts +54 -0
- package/express/src/framework/http/ratelimiter.ts +16 -0
- package/express/src/framework/http/router.ts +178 -0
- package/express/src/framework/http/security.ts +23 -0
- package/express/src/framework/http/static.ts +23 -0
- package/express/src/framework/http/validation.ts +18 -0
- package/express/src/framework/kernel.ts +52 -0
- package/express/src/framework/maker-cli/db/core.mjs +288 -0
- package/express/src/framework/maker-cli/db/index.mjs +204 -0
- package/express/src/framework/maker-cli/deploy/core.mjs +1047 -0
- package/express/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/express/src/framework/maker-cli/index.mjs +53 -0
- package/express/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/express/src/framework/maker-cli/middleware/index.mjs +17 -0
- package/express/src/framework/maker-cli/module/core.mjs +684 -0
- package/express/src/framework/maker-cli/module/index.mjs +140 -0
- package/express/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
- package/express/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/express/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/express/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.ts.stub +47 -0
- package/express/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +48 -0
- package/express/src/framework/maker-cli/stubs/controller/plain.ts.stub +54 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/express/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/express/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/express/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/express/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/express/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/express/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/express/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/express/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/express/src/framework/maker-cli/stubs/example/controller.ts.stub +418 -0
- package/express/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/express/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/express/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/express/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/express/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/express/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/express/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/express/src/framework/maker-cli/stubs/notification/controller.ts.stub +77 -0
- package/express/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/express/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/express/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/express/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/express/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/express/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/express/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/express/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/express/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/express/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/express/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/express/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/express/src/framework/maker-cli/utils/help.mjs +50 -0
- package/express/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/express/src/framework/maker-cli/utils/process.mjs +52 -0
- package/express/src/framework/modules/discover.ts +54 -0
- package/express/src/framework/modules/routes.ts +21 -0
- package/express/src/framework/notification/index.ts +116 -0
- package/express/src/framework/queue/clear.ts +22 -0
- package/express/src/framework/queue/queue.ts +342 -0
- package/express/src/framework/queue/ui.ts +187 -0
- package/express/src/framework/queue/worker.ts +61 -0
- package/express/src/framework/realtime/broadcast.ts +46 -0
- package/express/src/framework/realtime/index.ts +2 -0
- package/express/src/framework/realtime/socket-cookie.ts +71 -0
- package/express/src/framework/realtime/socket.ts +119 -0
- package/express/src/framework/realtime/types.ts +6 -0
- package/express/src/framework/realtime/ui.ts +16 -0
- package/express/src/framework/redis/client.ts +151 -0
- package/express/src/framework/runtime/runtime.ts +23 -0
- package/express/src/framework/runtime/server-adapter.ts +34 -0
- package/express/src/framework/scheduler/lock.ts +116 -0
- package/express/src/framework/scheduler/run.ts +48 -0
- package/express/src/framework/scheduler/scheduler.ts +155 -0
- package/express/src/framework/server.ts +177 -0
- package/express/src/framework/session/session.ts +98 -0
- package/express/src/framework/storage/storage.ts +785 -0
- package/express/src/framework/support/cookie.ts +62 -0
- package/express/src/framework/support/jwt.ts +33 -0
- package/express/src/framework/support/lifecycle.ts +35 -0
- package/express/src/framework/support/logger.ts +148 -0
- package/express/src/framework/support/mail.ts +48 -0
- package/express/src/framework/support/password.ts +23 -0
- package/express/src/framework/support/upload.ts +160 -0
- package/express/src/framework/support/url.ts +41 -0
- package/express/src/middlewares/auth-middleware.ts +98 -0
- package/express/src/middlewares/role-middleware.ts +25 -0
- package/express/src/modules/auth/controllers/auth.controller.ts +358 -0
- package/express/src/modules/auth/controllers/auth.helpers.ts +104 -0
- package/express/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/express/src/modules/auth/controllers/role.controller.ts +15 -0
- package/express/src/modules/auth/database/models/notifications.ts +24 -0
- package/express/src/modules/auth/database/models/role.ts +14 -0
- package/express/src/modules/auth/database/models/user.ts +46 -0
- package/express/src/modules/auth/database/seeders/role.ts +18 -0
- package/express/src/modules/auth/database/seeders/user.ts +35 -0
- package/express/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/express/src/modules/auth/jobs/registeruser.ts +23 -0
- package/express/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/express/src/modules/auth/routes/api.ts +150 -0
- package/express/src/modules/auth/routes/role.ts +33 -0
- package/express/src/resources/index.html +17 -0
- package/express/src/resources/src/App.vue +5 -0
- package/express/src/resources/src/assets/css/styles.css +14761 -0
- package/express/src/resources/src/assets/css/styles.css.map +1 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/express/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/express/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/express/src/resources/src/assets/images/logo.png +0 -0
- package/express/src/resources/src/assets/scss/custom.css +217 -0
- package/express/src/resources/src/assets/scss/custom.css.map +1 -0
- package/express/src/resources/src/assets/scss/custom.scss +1346 -0
- package/express/src/resources/src/components/Button.vue +32 -0
- package/express/src/resources/src/components/Checkbox.vue +29 -0
- package/express/src/resources/src/components/Datepicker.vue +106 -0
- package/express/src/resources/src/components/FeatureButton.vue +53 -0
- package/express/src/resources/src/components/FloatButton.vue +33 -0
- package/express/src/resources/src/components/Href.vue +32 -0
- package/express/src/resources/src/components/Input.vue +223 -0
- package/express/src/resources/src/components/InputGroup.vue +145 -0
- package/express/src/resources/src/components/InputPasswordToggle.vue +213 -0
- package/express/src/resources/src/components/Modal.vue +55 -0
- package/express/src/resources/src/components/Pagebar.vue +26 -0
- package/express/src/resources/src/components/Select.vue +384 -0
- package/express/src/resources/src/components/Spinner.vue +42 -0
- package/express/src/resources/src/components/Switch.vue +65 -0
- package/express/src/resources/src/components/TextArea.vue +117 -0
- package/express/src/resources/src/components/Toast.vue +56 -0
- package/express/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/express/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/express/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/express/src/resources/src/components/datatable/index.vue +199 -0
- package/express/src/resources/src/composables/useAuth.ts +52 -0
- package/express/src/resources/src/helpers/nformatter.ts +10 -0
- package/express/src/resources/src/helpers/utils.ts +75 -0
- package/express/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/express/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/express/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/express/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/express/src/resources/src/layouts/Layout/index.vue +87 -0
- package/express/src/resources/src/main.ts +26 -0
- package/express/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/express/src/resources/src/pages/auth/login.vue +99 -0
- package/express/src/resources/src/pages/auth/register.vue +133 -0
- package/express/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/express/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/express/src/resources/src/pages/dashboard/index.vue +66 -0
- package/express/src/resources/src/plugins/axios.ts +31 -0
- package/express/src/resources/src/plugins/browserDetect.ts +55 -0
- package/express/src/resources/src/plugins/dialog.ts +216 -0
- package/express/src/resources/src/plugins/gum.ts +367 -0
- package/express/src/resources/src/plugins/pulse.ts +147 -0
- package/express/src/resources/src/plugins/routeProgress.ts +87 -0
- package/express/src/resources/src/router/index.ts +85 -0
- package/express/src/resources/src/stores/admin-ui.ts +148 -0
- package/express/src/resources/src/stores/auth.ts +164 -0
- package/express/src/resources/tsconfig.json +19 -0
- package/express/src/resources/vite.config.ts +46 -0
- package/express/src/storage/app/private/.gitkeep +0 -0
- package/express/src/storage/app/public/.gitkeep +0 -0
- package/express/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/express/src/storage/database/nexwire.sqlite +0 -0
- package/express/src/storage/logs/.gitkeep +0 -0
- package/express/src/storage/tmp/.gitkeep +0 -0
- package/express/src/storage/trash/modules/.gitkeep +0 -0
- package/express/src/types/global.d.ts +26 -0
- package/express/tsconfig.json +19 -0
- package/express/vitest.config.ts +23 -0
- package/hono/.dockerignore +14 -0
- package/hono/.env +44 -0
- package/hono/.env.example +42 -0
- package/hono/.vscode/settings.json +26 -0
- package/hono/LICENSE +21 -0
- package/hono/README.md +211 -0
- package/hono/biome.json +76 -0
- package/hono/drizzle.config.ts +25 -0
- package/hono/gitignore-stub +24 -0
- package/hono/package.json +99 -0
- package/hono/public/.gitkeep +0 -0
- package/hono/src/config/app.ts +41 -0
- package/hono/src/config/auth.ts +12 -0
- package/hono/src/config/cache.ts +16 -0
- package/hono/src/config/cookie.ts +15 -0
- package/hono/src/config/cors.ts +12 -0
- package/hono/src/config/database.ts +29 -0
- package/hono/src/config/index.ts +83 -0
- package/hono/src/config/jwt.ts +19 -0
- package/hono/src/config/logging.ts +13 -0
- package/hono/src/config/mail.ts +24 -0
- package/hono/src/config/openapi.ts +54 -0
- package/hono/src/config/queue.ts +30 -0
- package/hono/src/config/rateLimit.ts +17 -0
- package/hono/src/config/realtime.ts +15 -0
- package/hono/src/config/redis.ts +18 -0
- package/hono/src/config/security.ts +44 -0
- package/hono/src/config/session.ts +17 -0
- package/hono/src/config/storage.ts +22 -0
- package/hono/src/config/validate.ts +40 -0
- package/hono/src/database/migrations/sqlite/0000_init.sql +61 -0
- package/hono/src/database/migrations/sqlite/meta/0000_snapshot.json +412 -0
- package/hono/src/database/migrations/sqlite/meta/_journal.json +13 -0
- package/hono/src/database/schema.ts +3 -0
- package/hono/src/env.ts +76 -0
- package/hono/src/framework/cache/cache.ts +81 -0
- package/hono/src/framework/circuit-breaker/cb.ts +60 -0
- package/hono/src/framework/database/connection.ts +196 -0
- package/hono/src/framework/database/migrate-hooks.ts +87 -0
- package/hono/src/framework/database/paginate.ts +253 -0
- package/hono/src/framework/database/schema.ts +20 -0
- package/hono/src/framework/database/seed.ts +139 -0
- package/hono/src/framework/events/dispatcher.ts +49 -0
- package/hono/src/framework/facade.ts +29 -0
- package/hono/src/framework/http/app.ts +109 -0
- package/hono/src/framework/http/cors.ts +19 -0
- package/hono/src/framework/http/logger.ts +81 -0
- package/hono/src/framework/http/metrics.ts +22 -0
- package/hono/src/framework/http/openapi.ts +42 -0
- package/hono/src/framework/http/ratelimiter.ts +172 -0
- package/hono/src/framework/http/router.ts +76 -0
- package/hono/src/framework/http/security.ts +23 -0
- package/hono/src/framework/http/static.ts +70 -0
- package/hono/src/framework/http/validation.ts +21 -0
- package/hono/src/framework/kernel.ts +48 -0
- package/hono/src/framework/maker-cli/db/core.mjs +288 -0
- package/hono/src/framework/maker-cli/db/index.mjs +204 -0
- package/hono/src/framework/maker-cli/deploy/core.mjs +1038 -0
- package/hono/src/framework/maker-cli/deploy/index.mjs +91 -0
- package/hono/src/framework/maker-cli/index.mjs +53 -0
- package/hono/src/framework/maker-cli/middleware/core.mjs +47 -0
- package/hono/src/framework/maker-cli/middleware/index.mjs +12 -0
- package/hono/src/framework/maker-cli/module/core.mjs +684 -0
- package/hono/src/framework/maker-cli/module/index.mjs +140 -0
- package/hono/src/framework/maker-cli/runtime/build-ui.mjs +17 -0
- package/hono/src/framework/maker-cli/runtime/core.mjs +543 -0
- package/hono/src/framework/maker-cli/runtime/index.mjs +104 -0
- package/hono/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.ts.stub +57 -0
- package/hono/src/framework/maker-cli/stubs/controller/openapi.with-model.ts.stub +58 -0
- package/hono/src/framework/maker-cli/stubs/controller/plain.ts.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.plain.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/controller/schema.ts.stub +33 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
- package/hono/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
- package/hono/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
- package/hono/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
- package/hono/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
- package/hono/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
- package/hono/src/framework/maker-cli/stubs/example/console.ts.stub +34 -0
- package/hono/src/framework/maker-cli/stubs/example/controller.ts.stub +505 -0
- package/hono/src/framework/maker-cli/stubs/example/job.ts.stub +75 -0
- package/hono/src/framework/maker-cli/stubs/example/route.api.ts.stub +207 -0
- package/hono/src/framework/maker-cli/stubs/example/route.plain.ts.stub +18 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.plain.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/example/schema.ts.stub +42 -0
- package/hono/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
- package/hono/src/framework/maker-cli/stubs/middleware/name.ts.stub +14 -0
- package/hono/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +9 -0
- package/hono/src/framework/maker-cli/stubs/notification/controller.ts.stub +86 -0
- package/hono/src/framework/maker-cli/stubs/notification/job.ts.stub +13 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.api.ts.stub +50 -0
- package/hono/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +12 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
- package/hono/src/framework/maker-cli/stubs/route/api.ts.stub +80 -0
- package/hono/src/framework/maker-cli/stubs/route/plain.ts.stub +11 -0
- package/hono/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
- package/hono/src/framework/maker-cli/stubs/seeder/name.ts.stub +20 -0
- package/hono/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
- package/hono/src/framework/maker-cli/utils/env-config.mjs +44 -0
- package/hono/src/framework/maker-cli/utils/env-db.mjs +61 -0
- package/hono/src/framework/maker-cli/utils/file-ops.mjs +30 -0
- package/hono/src/framework/maker-cli/utils/flags.mjs +14 -0
- package/hono/src/framework/maker-cli/utils/help.mjs +50 -0
- package/hono/src/framework/maker-cli/utils/naming.mjs +13 -0
- package/hono/src/framework/maker-cli/utils/process.mjs +52 -0
- package/hono/src/framework/modules/discover.ts +54 -0
- package/hono/src/framework/modules/routes.ts +24 -0
- package/hono/src/framework/notification/index.ts +116 -0
- package/hono/src/framework/queue/clear.ts +22 -0
- package/hono/src/framework/queue/queue.ts +342 -0
- package/hono/src/framework/queue/ui.ts +214 -0
- package/hono/src/framework/queue/worker.ts +61 -0
- package/hono/src/framework/realtime/broadcast.ts +46 -0
- package/hono/src/framework/realtime/index.ts +2 -0
- package/hono/src/framework/realtime/socket-cookie.ts +68 -0
- package/hono/src/framework/realtime/socket.ts +196 -0
- package/hono/src/framework/realtime/types.ts +6 -0
- package/hono/src/framework/realtime/ui.ts +16 -0
- package/hono/src/framework/redis/client.ts +151 -0
- package/hono/src/framework/runtime/runtime.ts +23 -0
- package/hono/src/framework/runtime/server-adapter.ts +94 -0
- package/hono/src/framework/scheduler/lock.ts +116 -0
- package/hono/src/framework/scheduler/run.ts +48 -0
- package/hono/src/framework/scheduler/scheduler.ts +155 -0
- package/hono/src/framework/server.ts +183 -0
- package/hono/src/framework/session/session.ts +116 -0
- package/hono/src/framework/storage/storage.ts +785 -0
- package/hono/src/framework/support/cookie.ts +99 -0
- package/hono/src/framework/support/jwt.ts +45 -0
- package/hono/src/framework/support/lifecycle.ts +35 -0
- package/hono/src/framework/support/logger.ts +148 -0
- package/hono/src/framework/support/mail.ts +48 -0
- package/hono/src/framework/support/password.ts +23 -0
- package/hono/src/framework/support/url.ts +41 -0
- package/hono/src/middlewares/auth-middleware.ts +98 -0
- package/hono/src/middlewares/role-middleware.ts +25 -0
- package/hono/src/modules/auth/controllers/auth.controller.ts +413 -0
- package/hono/src/modules/auth/controllers/auth.helpers.ts +128 -0
- package/hono/src/modules/auth/controllers/auth.schema.ts +102 -0
- package/hono/src/modules/auth/controllers/role.controller.ts +25 -0
- package/hono/src/modules/auth/database/models/notifications.ts +24 -0
- package/hono/src/modules/auth/database/models/role.ts +14 -0
- package/hono/src/modules/auth/database/models/user.ts +46 -0
- package/hono/src/modules/auth/database/seeders/role.ts +18 -0
- package/hono/src/modules/auth/database/seeders/user.ts +35 -0
- package/hono/src/modules/auth/jobs/forgetpass.ts +20 -0
- package/hono/src/modules/auth/jobs/registeruser.ts +23 -0
- package/hono/src/modules/auth/jobs/verifyemail.ts +18 -0
- package/hono/src/modules/auth/routes/api.ts +150 -0
- package/hono/src/modules/auth/routes/role.ts +33 -0
- package/hono/src/resources/index.html +17 -0
- package/hono/src/resources/src/App.vue +5 -0
- package/hono/src/resources/src/assets/css/styles.css +14913 -0
- package/hono/src/resources/src/assets/css/styles.css.map +1 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
- package/hono/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
- package/hono/src/resources/src/assets/images/favicon/favicon.ico +0 -0
- package/hono/src/resources/src/assets/images/logo.png +0 -0
- package/hono/src/resources/src/assets/scss/custom.css +217 -0
- package/hono/src/resources/src/assets/scss/custom.css.map +1 -0
- package/hono/src/resources/src/assets/scss/custom.scss +1346 -0
- package/hono/src/resources/src/components/Button.vue +32 -0
- package/hono/src/resources/src/components/Checkbox.vue +29 -0
- package/hono/src/resources/src/components/Datepicker.vue +106 -0
- package/hono/src/resources/src/components/FeatureButton.vue +53 -0
- package/hono/src/resources/src/components/FloatButton.vue +33 -0
- package/hono/src/resources/src/components/Href.vue +32 -0
- package/hono/src/resources/src/components/Input.vue +234 -0
- package/hono/src/resources/src/components/InputGroup.vue +149 -0
- package/hono/src/resources/src/components/InputPasswordToggle.vue +222 -0
- package/hono/src/resources/src/components/Modal.vue +55 -0
- package/hono/src/resources/src/components/Pagebar.vue +26 -0
- package/hono/src/resources/src/components/Select.vue +415 -0
- package/hono/src/resources/src/components/Spinner.vue +42 -0
- package/hono/src/resources/src/components/Switch.vue +65 -0
- package/hono/src/resources/src/components/TextArea.vue +121 -0
- package/hono/src/resources/src/components/Toast.vue +56 -0
- package/hono/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
- package/hono/src/resources/src/components/datatable/Pagination.vue +147 -0
- package/hono/src/resources/src/components/datatable/SelectOpption.vue +64 -0
- package/hono/src/resources/src/components/datatable/index.vue +199 -0
- package/hono/src/resources/src/composables/useAuth.ts +52 -0
- package/hono/src/resources/src/helpers/nformatter.ts +10 -0
- package/hono/src/resources/src/helpers/utils.ts +75 -0
- package/hono/src/resources/src/layouts/AuthLayout.vue +20 -0
- package/hono/src/resources/src/layouts/Layout/Footer.vue +23 -0
- package/hono/src/resources/src/layouts/Layout/Header.vue +105 -0
- package/hono/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
- package/hono/src/resources/src/layouts/Layout/index.vue +87 -0
- package/hono/src/resources/src/main.ts +26 -0
- package/hono/src/resources/src/pages/auth/forgetPassword.vue +82 -0
- package/hono/src/resources/src/pages/auth/login.vue +99 -0
- package/hono/src/resources/src/pages/auth/register.vue +133 -0
- package/hono/src/resources/src/pages/auth/resetPassword.vue +118 -0
- package/hono/src/resources/src/pages/auth/verifyEmail.vue +68 -0
- package/hono/src/resources/src/pages/dashboard/index.vue +66 -0
- package/hono/src/resources/src/plugins/axios.ts +31 -0
- package/hono/src/resources/src/plugins/browserDetect.ts +55 -0
- package/hono/src/resources/src/plugins/dialog.ts +216 -0
- package/hono/src/resources/src/plugins/gum.ts +367 -0
- package/hono/src/resources/src/plugins/pulse.ts +147 -0
- package/hono/src/resources/src/plugins/routeProgress.ts +87 -0
- package/hono/src/resources/src/router/index.ts +85 -0
- package/hono/src/resources/src/stores/admin-ui.ts +148 -0
- package/hono/src/resources/src/stores/auth.ts +164 -0
- package/hono/src/resources/tsconfig.json +19 -0
- package/hono/src/resources/vite.config.ts +46 -0
- package/hono/src/storage/app/private/.gitkeep +0 -0
- package/hono/src/storage/app/public/.gitkeep +0 -0
- package/hono/src/storage/app/tmp/generated/.gitkeep +0 -0
- package/hono/src/storage/database/nexwire.sqlite +0 -0
- package/hono/src/storage/logs/.gitkeep +0 -0
- package/hono/src/storage/tmp/.gitkeep +0 -0
- package/hono/src/storage/trash/modules/.gitkeep +0 -0
- package/hono/src/types/global.d.ts +26 -0
- package/hono/tsconfig.json +20 -0
- package/hono/vitest.config.ts +23 -0
- package/package.json +238 -0
- package/src/index.js +204 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button class="shadow-none" :type="props.type" v-bind="$attrs">
|
|
3
|
+
<slot v-if="hasDefaultSlot"></slot>
|
|
4
|
+
<template v-else>
|
|
5
|
+
<span v-if="props.label" class="text-capitalize" :class="{ 'me-1': props.icon }">
|
|
6
|
+
{{ props.label }}
|
|
7
|
+
</span>
|
|
8
|
+
<span v-if="props.icon"><i :class="props.icon"></i></span>
|
|
9
|
+
</template>
|
|
10
|
+
</button>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { computed, useSlots } from "vue";
|
|
15
|
+
|
|
16
|
+
interface ButtonProps {
|
|
17
|
+
label?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
type?: "button" | "submit" | "reset";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
defineOptions({ name: "Button", inheritAttrs: false });
|
|
23
|
+
|
|
24
|
+
const slots = useSlots();
|
|
25
|
+
const props = withDefaults(defineProps<ButtonProps>(), {
|
|
26
|
+
type: "button"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const hasDefaultSlot = computed(() => Boolean(slots.default?.().length));
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="form-check mb-0" :class="props.topclass">
|
|
3
|
+
<input
|
|
4
|
+
:id="String(props.id)"
|
|
5
|
+
v-model="model"
|
|
6
|
+
class="form-check-input shadow-none border-secondary"
|
|
7
|
+
type="checkbox"
|
|
8
|
+
v-bind="$attrs" />
|
|
9
|
+
<label v-if="props.label" class="form-check-label" :for="String(props.id)">{{ props.label }}</label>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
defineOptions({ name: "Checkbox", inheritAttrs: false });
|
|
15
|
+
|
|
16
|
+
interface CheckboxProps {
|
|
17
|
+
id?: string | number;
|
|
18
|
+
label?: string;
|
|
19
|
+
topclass?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const props = defineProps<CheckboxProps>();
|
|
23
|
+
|
|
24
|
+
type CheckboxModel = boolean | Array<string | number>;
|
|
25
|
+
|
|
26
|
+
const model = defineModel<CheckboxModel>({ default: false });
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="parentClass">
|
|
3
|
+
<label class="text-capitalize d-flex align-items-center mb-1" :class="{ 'd-none': !inputLabel }">
|
|
4
|
+
<div class="position-relative">
|
|
5
|
+
<span class="text-capitalize" v-html="inputLabel"></span>
|
|
6
|
+
<span class="position-absolute text-danger rounded-circle bg-danger must" :class="{ 'd-none': !props.must }"></span>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="text-uppercase w-100 text-end text-primary fw-semibold" :class="{ 'd-none': !props.hood }" style="font-size: 12px; margin-top: 0.15rem" v-html="hoodHtml"></div>
|
|
9
|
+
</label>
|
|
10
|
+
<VueDatePicker
|
|
11
|
+
v-if="usePicker"
|
|
12
|
+
v-model="model"
|
|
13
|
+
:month-picker="props.mode === 'month'"
|
|
14
|
+
:year-picker="props.mode === 'year'"
|
|
15
|
+
:time-picker="props.mode === 'datetime'"
|
|
16
|
+
:time-config="timeConfig"
|
|
17
|
+
:formats="formats"
|
|
18
|
+
text-input
|
|
19
|
+
v-bind="$attrs"></VueDatePicker>
|
|
20
|
+
<input
|
|
21
|
+
v-else
|
|
22
|
+
type="month"
|
|
23
|
+
class="form-control"
|
|
24
|
+
:value="nativeValue"
|
|
25
|
+
:disabled="Boolean($attrs.disabled)"
|
|
26
|
+
:readonly="Boolean($attrs.readonly)"
|
|
27
|
+
@input="onNativeInput" />
|
|
28
|
+
<div class="form-text text-danger" :class="{ 'd-none': !props.err }" style="font-size: 0.8rem">
|
|
29
|
+
{{ props.err }}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { VueDatePicker } from "@vuepic/vue-datepicker";
|
|
36
|
+
import { computed, useAttrs } from "vue";
|
|
37
|
+
import "@vuepic/vue-datepicker/dist/main.css";
|
|
38
|
+
import { browserDetect } from "@/plugins/browserDetect";
|
|
39
|
+
|
|
40
|
+
defineOptions({ name: "Datepicker", inheritAttrs: false });
|
|
41
|
+
|
|
42
|
+
type DateMode = "date" | "datetime" | "month" | "year";
|
|
43
|
+
type DateValue = string | number | Date | null;
|
|
44
|
+
|
|
45
|
+
interface DateProps {
|
|
46
|
+
must?: boolean;
|
|
47
|
+
err?: string | boolean;
|
|
48
|
+
hood?: string | boolean;
|
|
49
|
+
mode?: DateMode;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const $attrs = useAttrs();
|
|
53
|
+
const props = withDefaults(defineProps<DateProps>(), {
|
|
54
|
+
err: false,
|
|
55
|
+
mode: "date"
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const model = defineModel<DateValue>();
|
|
59
|
+
|
|
60
|
+
const usePicker = computed(() => browserDetect.isFirefox.value || props.mode !== "month");
|
|
61
|
+
|
|
62
|
+
const nativeValue = computed(() => {
|
|
63
|
+
const value = model.value;
|
|
64
|
+
if (typeof value === "string") return value;
|
|
65
|
+
if (value instanceof Date && !Number.isNaN(value.getTime())) {
|
|
66
|
+
const year = value.getFullYear();
|
|
67
|
+
const month = String(value.getMonth() + 1).padStart(2, "0");
|
|
68
|
+
return `${year}-${month}`;
|
|
69
|
+
}
|
|
70
|
+
return "";
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const onNativeInput = (e: Event) => {
|
|
74
|
+
model.value = (e.target as HTMLInputElement).value || null;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const parentClass = computed(() => ($attrs.parentclass as string | undefined) || "mb-2");
|
|
78
|
+
const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
|
|
79
|
+
|
|
80
|
+
const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
|
|
81
|
+
|
|
82
|
+
const timeConfig = computed(() => (props.mode === "datetime" ? { is24: false } : undefined));
|
|
83
|
+
|
|
84
|
+
const formats = computed(() => {
|
|
85
|
+
switch (props.mode) {
|
|
86
|
+
case "year":
|
|
87
|
+
return { input: "yyyy" };
|
|
88
|
+
case "month":
|
|
89
|
+
return { input: "MM/yyyy" };
|
|
90
|
+
case "datetime":
|
|
91
|
+
return { input: "dd/MM/yyyy hh:mm a" };
|
|
92
|
+
default:
|
|
93
|
+
return { input: "dd/MM/yyyy" };
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<style lang="scss" scoped>
|
|
99
|
+
.must {
|
|
100
|
+
width: 4px;
|
|
101
|
+
height: 4px;
|
|
102
|
+
top: 0;
|
|
103
|
+
margin-top: 5px;
|
|
104
|
+
margin-left: 2px;
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template></template>
|
|
2
|
+
|
|
3
|
+
<script setup lang="ts">
|
|
4
|
+
import { inject, onBeforeUnmount, onMounted, useAttrs, useSlots } from "vue";
|
|
5
|
+
|
|
6
|
+
defineOptions({ name: "FeatureButton", inheritAttrs: false });
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
icon?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
title?: string;
|
|
12
|
+
buttonClass?: any;
|
|
13
|
+
}>();
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<(e: "click") => void>();
|
|
16
|
+
|
|
17
|
+
interface ButtonEntry {
|
|
18
|
+
id: symbol;
|
|
19
|
+
icon?: string;
|
|
20
|
+
label: string;
|
|
21
|
+
title: string;
|
|
22
|
+
attrs?: Record<string, string>;
|
|
23
|
+
class?: any;
|
|
24
|
+
onClick: () => void;
|
|
25
|
+
render?: () => any[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const featureButtons = inject<ButtonEntry[]>("featureButtons")!;
|
|
29
|
+
const slots = useSlots();
|
|
30
|
+
const fallthroughAttrs = useAttrs();
|
|
31
|
+
|
|
32
|
+
const id = Symbol();
|
|
33
|
+
|
|
34
|
+
onMounted(() => {
|
|
35
|
+
featureButtons.push({
|
|
36
|
+
id,
|
|
37
|
+
icon: props.icon,
|
|
38
|
+
label: props.label ?? "",
|
|
39
|
+
title: props.title ?? props.label ?? "",
|
|
40
|
+
attrs: fallthroughAttrs as any,
|
|
41
|
+
class: props.buttonClass,
|
|
42
|
+
onClick: () => emit("click"),
|
|
43
|
+
render: slots.default || undefined
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
onBeforeUnmount(() => {
|
|
48
|
+
const index = featureButtons.findIndex((b) => b.id === id);
|
|
49
|
+
if (index !== -1) featureButtons.splice(index, 1);
|
|
50
|
+
});
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="float-button position-fixed text-center removeprintarea" :style="floatStyle" v-bind="$attrs">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
import { computed } from "vue";
|
|
9
|
+
|
|
10
|
+
interface FloatButtonProps {
|
|
11
|
+
top?: string;
|
|
12
|
+
right?: string;
|
|
13
|
+
zIndex?: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const props = withDefaults(defineProps<FloatButtonProps>(), {
|
|
17
|
+
top: "200px",
|
|
18
|
+
right: "0",
|
|
19
|
+
zIndex: 100
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const floatStyle = computed(() => ({
|
|
23
|
+
top: props.top,
|
|
24
|
+
right: props.right,
|
|
25
|
+
zIndex: props.zIndex
|
|
26
|
+
}));
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<style lang="scss" scoped>
|
|
30
|
+
.float-button {
|
|
31
|
+
border-radius: 0 5px 5px 5px;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a :href="String(props.to)" class="d-flex align-items-center" v-bind="$attrs">
|
|
3
|
+
<slot v-if="hasDefaultSlot"></slot>
|
|
4
|
+
<template v-else>
|
|
5
|
+
<span v-if="props.label" class="text-capitalize" :class="{ 'me-1': props.icon }">{{
|
|
6
|
+
props.label
|
|
7
|
+
}}</span>
|
|
8
|
+
<span v-if="props.icon"><i :class="props.icon"></i></span>
|
|
9
|
+
</template>
|
|
10
|
+
</a>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { computed, useSlots } from "vue";
|
|
15
|
+
|
|
16
|
+
interface HrefProps {
|
|
17
|
+
label?: string;
|
|
18
|
+
icon?: string;
|
|
19
|
+
to?: string | number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
defineOptions({ name: "Href", inheritAttrs: false });
|
|
23
|
+
|
|
24
|
+
const slots = useSlots();
|
|
25
|
+
const props = withDefaults(defineProps<HrefProps>(), {
|
|
26
|
+
to: "#"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const hasDefaultSlot = computed(() => Boolean(slots.default?.().length));
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="topclass">
|
|
3
|
+
<div class="position-relative">
|
|
4
|
+
<label
|
|
5
|
+
:for="inputId"
|
|
6
|
+
class="d-flex align-items-center mb-1"
|
|
7
|
+
:class="{ 'd-none': !inputLabel }">
|
|
8
|
+
<div class="position-relative">
|
|
9
|
+
<span class="text-capitalize" v-html="inputLabel"></span>
|
|
10
|
+
<span
|
|
11
|
+
class="position-absolute text-danger rounded-circle bg-danger must"
|
|
12
|
+
:class="{ 'd-none': !props.must }"></span>
|
|
13
|
+
</div>
|
|
14
|
+
<div
|
|
15
|
+
class="text-end ms-auto text-primary fw-semibold"
|
|
16
|
+
:class="{ 'd-none': !props.hood }"
|
|
17
|
+
style="font-size: 12px; margin-top: 0.15rem"
|
|
18
|
+
v-html="hoodHtml"></div>
|
|
19
|
+
</label>
|
|
20
|
+
<input
|
|
21
|
+
ref="inputRef"
|
|
22
|
+
class="form-control"
|
|
23
|
+
:value="props.modelValue"
|
|
24
|
+
:maxlength="maxLengthAttr"
|
|
25
|
+
:readonly="props.readonly"
|
|
26
|
+
v-bind="$attrs"
|
|
27
|
+
:autocomplete="inputAutocomplete"
|
|
28
|
+
@input="updateModel" />
|
|
29
|
+
<div
|
|
30
|
+
class="position-absolute bottom-0 end-0 pe-1 text-secondary max"
|
|
31
|
+
:class="{ 'd-none': !max }">
|
|
32
|
+
{{ maxCounter }}
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<div
|
|
36
|
+
:id="`${inputId}Help`"
|
|
37
|
+
class="form-text mt-1 text-danger"
|
|
38
|
+
:class="{ 'd-none': !props.err }">
|
|
39
|
+
{{ props.err }}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
|
|
46
|
+
import { browserDetect } from "@/plugins/browserDetect";
|
|
47
|
+
|
|
48
|
+
const { isFirefox } = browserDetect;
|
|
49
|
+
|
|
50
|
+
const $attrs = useAttrs();
|
|
51
|
+
const inputRef = ref<HTMLInputElement | null>(null);
|
|
52
|
+
type InputCategory = "number" | "decimal" | "+decimal-" | "mobile" | "tax-period" | "bin" | "challan-number" | string;
|
|
53
|
+
|
|
54
|
+
interface InputProps {
|
|
55
|
+
focus?: boolean;
|
|
56
|
+
must?: boolean;
|
|
57
|
+
err?: string | boolean;
|
|
58
|
+
modelValue?: string | number;
|
|
59
|
+
category?: InputCategory;
|
|
60
|
+
hood?: string | boolean | number;
|
|
61
|
+
readonly?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const props = withDefaults(defineProps<InputProps>(), {
|
|
65
|
+
err: false,
|
|
66
|
+
modelValue: ""
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-2");
|
|
70
|
+
const inputId = computed(() => ($attrs.id as string | undefined) || "");
|
|
71
|
+
const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
|
|
72
|
+
const inputType = computed(() => ($attrs.type as string | undefined) || "text");
|
|
73
|
+
|
|
74
|
+
const max = computed<number | null>(() => {
|
|
75
|
+
const raw = $attrs.maxlength as string | number | undefined;
|
|
76
|
+
return raw != null ? Number(raw) : null;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const inputAutocomplete = computed(() => {
|
|
80
|
+
const attrAutocomplete = $attrs.autocomplete as string | undefined;
|
|
81
|
+
if (attrAutocomplete) {
|
|
82
|
+
return attrAutocomplete;
|
|
83
|
+
}
|
|
84
|
+
return ["number", "decimal"].includes(props.category ?? "") ? "off" : "on";
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
|
|
88
|
+
|
|
89
|
+
const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
|
|
90
|
+
|
|
91
|
+
const maxCounter = computed(() => {
|
|
92
|
+
if (max.value == null) {
|
|
93
|
+
return "";
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!isFirefox && inputType.value === "month") {
|
|
97
|
+
return "";
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return max.value - String(props.modelValue).length;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
|
|
104
|
+
const updateModel = (e: Event) => {
|
|
105
|
+
const target = e.target as HTMLInputElement;
|
|
106
|
+
|
|
107
|
+
if (props.category === "number") {
|
|
108
|
+
emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
|
|
109
|
+
} else if (props.category === "decimal") {
|
|
110
|
+
let val = target.value;
|
|
111
|
+
|
|
112
|
+
// Remove everything except digits, decimal point, and minus sign
|
|
113
|
+
val = val.replace(/[^0-9.]/g, "");
|
|
114
|
+
|
|
115
|
+
// Allow only one decimal point
|
|
116
|
+
const parts = val.split(".");
|
|
117
|
+
if (parts.length > 2) {
|
|
118
|
+
val = `${parts[0]}.${parts.slice(1).join("")}`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
emit("update:modelValue", (target.value = val));
|
|
122
|
+
} else if (props.category === "+decimal-") {
|
|
123
|
+
let val = target.value;
|
|
124
|
+
|
|
125
|
+
// Remove everything except digits, decimal point, and minus sign
|
|
126
|
+
val = val.replace(/[^0-9.-]/g, ""); // if need minus sign
|
|
127
|
+
|
|
128
|
+
// Move minus sign to the front if it exists anywhere
|
|
129
|
+
const isNegative = val.includes("-");
|
|
130
|
+
val = val.replace(/-/g, ""); // remove all minus signs
|
|
131
|
+
if (isNegative) {
|
|
132
|
+
val = `-${val}`;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Allow only one decimal point
|
|
136
|
+
const parts = val.split(".");
|
|
137
|
+
if (parts.length > 2) {
|
|
138
|
+
val = `${parts[0]}.${parts.slice(1).join("")}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
emit("update:modelValue", (target.value = val));
|
|
142
|
+
} else if (props.category === "mobile") {
|
|
143
|
+
let digits = target.value.replace(/[^\d]/g, ""); // only digits
|
|
144
|
+
let val = digits;
|
|
145
|
+
if (target.value.includes("+")) {
|
|
146
|
+
val = `+${digits}`;
|
|
147
|
+
}
|
|
148
|
+
emit("update:modelValue", (target.value = val));
|
|
149
|
+
} else if (props.category === "tax-period") {
|
|
150
|
+
let val = target.value.replace(/[^\d-]/g, ""); // Only numbers and hyphen
|
|
151
|
+
val = val.replace(/-/g, ""); // Remove all hyphens
|
|
152
|
+
val = val.slice(0, 6); // Only 6 digits (YYYYMM)
|
|
153
|
+
|
|
154
|
+
if (val.length > 4) {
|
|
155
|
+
let year = val.slice(0, 4);
|
|
156
|
+
let month = val.slice(4, 6);
|
|
157
|
+
|
|
158
|
+
// Only correct if both month digits entered
|
|
159
|
+
if (month.length === 2) {
|
|
160
|
+
let m = parseInt(month, 10);
|
|
161
|
+
// Clamp month between 1 and 12
|
|
162
|
+
if (m < 1) m = 1;
|
|
163
|
+
if (m > 12) m = 12;
|
|
164
|
+
// Always pad to 2 digits
|
|
165
|
+
month = m.toString().padStart(2, "0");
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
val = `${year}-${month}`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
emit("update:modelValue", (target.value = val));
|
|
172
|
+
} else if (props.category === "bin") {
|
|
173
|
+
let digits = target.value.replace(/[^\d]/g, "");
|
|
174
|
+
digits = digits.slice(0, 14);
|
|
175
|
+
let formatted = digits;
|
|
176
|
+
if (digits.length > 9) {
|
|
177
|
+
formatted = `${digits.slice(0, 9)}-${digits.slice(9, 14)}`;
|
|
178
|
+
}
|
|
179
|
+
emit("update:modelValue", (target.value = formatted));
|
|
180
|
+
} else if (props.category === "echallan-number") {
|
|
181
|
+
// Format: V + 9 digits (V000517226)
|
|
182
|
+
let raw = (target.value || "").toUpperCase();
|
|
183
|
+
|
|
184
|
+
// keep only digits, but allow V (we’ll force V at start)
|
|
185
|
+
let digits = raw.replace(/[^\d]/g, "").slice(0, 9);
|
|
186
|
+
|
|
187
|
+
// always prefix V
|
|
188
|
+
let formatted = "V" + digits;
|
|
189
|
+
|
|
190
|
+
emit("update:modelValue", (target.value = formatted));
|
|
191
|
+
} else if (props.category === "challan-number") {
|
|
192
|
+
let digits = target.value.replace(/[^\d]/g, "");
|
|
193
|
+
digits = digits.slice(0, 16);
|
|
194
|
+
let formatted = digits;
|
|
195
|
+
if (digits.length > 4) {
|
|
196
|
+
formatted = `${digits.slice(0, 4)}-${digits.slice(4, 16)}`;
|
|
197
|
+
}
|
|
198
|
+
emit("update:modelValue", (target.value = formatted));
|
|
199
|
+
} else {
|
|
200
|
+
emit("update:modelValue", target.value);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
onMounted(() => {
|
|
205
|
+
const shouldFocus = props.focus !== false && props.focus !== undefined;
|
|
206
|
+
if (!shouldFocus) return;
|
|
207
|
+
|
|
208
|
+
nextTick(() => inputRef.value?.focus());
|
|
209
|
+
});
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<style lang="scss" scoped>
|
|
213
|
+
.must {
|
|
214
|
+
width: 4px;
|
|
215
|
+
height: 4px;
|
|
216
|
+
margin-left: 2px;
|
|
217
|
+
margin-top: 5px;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.max {
|
|
221
|
+
font-size: 0.6rem;
|
|
222
|
+
}
|
|
223
|
+
</style>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="topclass">
|
|
3
|
+
<div class="position-relative">
|
|
4
|
+
<label
|
|
5
|
+
:for="inputId"
|
|
6
|
+
class="text-capitalize d-flex align-items-center mb-1"
|
|
7
|
+
:class="{ 'd-none': !inputLabel }">
|
|
8
|
+
<div class="position-relative">
|
|
9
|
+
<span class="text-capitalize" v-html="inputLabel"></span>
|
|
10
|
+
<span
|
|
11
|
+
class="position-absolute text-danger rounded-circle bg-danger must"
|
|
12
|
+
:class="{ 'd-none': !props.must }"></span>
|
|
13
|
+
</div>
|
|
14
|
+
<div
|
|
15
|
+
:class="hoodClass"
|
|
16
|
+
style="font-size: 12px; margin-top: 0.15rem"
|
|
17
|
+
v-html="hoodHtml"></div>
|
|
18
|
+
</label>
|
|
19
|
+
<div class="input-group">
|
|
20
|
+
<div class="position-relative" :style="props.half ? 'width: 50%;' : 'width: 35%;'">
|
|
21
|
+
<input
|
|
22
|
+
ref="inputRef"
|
|
23
|
+
:id="inputId"
|
|
24
|
+
type="text"
|
|
25
|
+
class="form-control flex-grow-0 px-1 text-center rounded-0 rounded-start"
|
|
26
|
+
:maxlength="maxLengthAttr"
|
|
27
|
+
:value="props.modelValue"
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
@input="updateModel" />
|
|
30
|
+
<div
|
|
31
|
+
class="position-absolute bottom-0 end-0 pe-1 text-secondary max"
|
|
32
|
+
:class="{ 'd-none': !max }">
|
|
33
|
+
{{ maxCounter }}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<input
|
|
37
|
+
type="text"
|
|
38
|
+
class="form-control text-center border-start second-input"
|
|
39
|
+
:style="props.half ? 'width: 50%;' : 'width: 62%;'"
|
|
40
|
+
:placeholder="placeholder1"
|
|
41
|
+
:value="props.calcdata"
|
|
42
|
+
readonly />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div :id="`${inputId}Help`" class="form-text text-danger" :class="{ 'd-none': !props.err }">
|
|
46
|
+
{{ props.err }}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup lang="ts">
|
|
52
|
+
import { computed, nextTick, onMounted, ref, useAttrs } from "vue";
|
|
53
|
+
|
|
54
|
+
defineOptions({ name: "InputGroup", inheritAttrs: false });
|
|
55
|
+
|
|
56
|
+
type InputGroupCategory = "number" | "decimal" | "mobile" | string;
|
|
57
|
+
|
|
58
|
+
interface InputGroupProps {
|
|
59
|
+
focus?: boolean;
|
|
60
|
+
must?: boolean;
|
|
61
|
+
half?: boolean;
|
|
62
|
+
err?: string | boolean;
|
|
63
|
+
modelValue?: string | number;
|
|
64
|
+
category?: InputGroupCategory;
|
|
65
|
+
calcdata?: string | number;
|
|
66
|
+
hood?: string | number | boolean;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const $attrs = useAttrs();
|
|
70
|
+
const inputRef = ref<HTMLInputElement | null>(null);
|
|
71
|
+
const props = withDefaults(defineProps<InputGroupProps>(), {
|
|
72
|
+
err: false,
|
|
73
|
+
modelValue: "",
|
|
74
|
+
calcdata: ""
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const topclass = computed(() => ($attrs.topclass as string | undefined) || "mb-3");
|
|
78
|
+
const inputId = computed(() => ($attrs.id as string | undefined) || "");
|
|
79
|
+
const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
|
|
80
|
+
const placeholder1 = computed(() => ($attrs.placeholder1 as string | undefined) || "");
|
|
81
|
+
|
|
82
|
+
const max = computed<number | null>(() => {
|
|
83
|
+
const raw = $attrs.maxlength as string | number | undefined;
|
|
84
|
+
return raw != null ? Number(raw) : null;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
|
|
88
|
+
const maxCounter = computed(() => (max.value == null ? "" : max.value - String(props.modelValue).length));
|
|
89
|
+
|
|
90
|
+
const hoodHtml = computed(() => (props.hood === false || props.hood == null ? "" : String(props.hood)));
|
|
91
|
+
const hoodClass = computed(() => [
|
|
92
|
+
"text-uppercase w-50 text-end text-primary fw-semibold",
|
|
93
|
+
props.half ? "w-50" : "w-100",
|
|
94
|
+
!props.hood && "d-none"
|
|
95
|
+
]);
|
|
96
|
+
|
|
97
|
+
const emit = defineEmits<(event: "update:modelValue", value: string | number) => void>();
|
|
98
|
+
|
|
99
|
+
const updateModel = (e: Event) => {
|
|
100
|
+
const target = e.target as HTMLInputElement;
|
|
101
|
+
|
|
102
|
+
if (props.category === "number") {
|
|
103
|
+
emit("update:modelValue", (target.value = target.value.replace(/[^\d]/gi, "")));
|
|
104
|
+
} else if (props.category === "decimal") {
|
|
105
|
+
let val = target.value;
|
|
106
|
+
val = val.replace(/[^0-9.]/g, "");
|
|
107
|
+
|
|
108
|
+
const parts = val.split(".");
|
|
109
|
+
if (parts.length > 2) {
|
|
110
|
+
val = `${parts[0]}.${parts.slice(1).join("")}`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
emit("update:modelValue", (target.value = val));
|
|
114
|
+
} else if (props.category === "mobile") {
|
|
115
|
+
const digits = target.value.replace(/[^\d]/g, "");
|
|
116
|
+
let val = digits;
|
|
117
|
+
if (target.value.includes("+")) {
|
|
118
|
+
val = `+${digits}`;
|
|
119
|
+
}
|
|
120
|
+
emit("update:modelValue", (target.value = val));
|
|
121
|
+
} else {
|
|
122
|
+
emit("update:modelValue", target.value);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
onMounted(() => {
|
|
127
|
+
const shouldFocus = props.focus !== false && props.focus !== undefined;
|
|
128
|
+
if (!shouldFocus) return;
|
|
129
|
+
|
|
130
|
+
nextTick(() => inputRef.value?.focus());
|
|
131
|
+
});
|
|
132
|
+
</script>
|
|
133
|
+
|
|
134
|
+
<style lang="scss" scoped>
|
|
135
|
+
.must {
|
|
136
|
+
width: 4px;
|
|
137
|
+
height: 4px;
|
|
138
|
+
margin-left: 2px;
|
|
139
|
+
margin-top: 5px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.max {
|
|
143
|
+
font-size: 0.6rem;
|
|
144
|
+
}
|
|
145
|
+
</style>
|