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,415 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { debounce } from "lodash-es";
|
|
4
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, reactive, ref, useAttrs, watch } from "vue";
|
|
5
|
+
import "vue-select/dist/vue-select.css";
|
|
6
|
+
import vSelect from "vue-select";
|
|
7
|
+
import { empty } from "../helpers/utils";
|
|
8
|
+
|
|
9
|
+
defineOptions({ name: "Select", inheritAttrs: false });
|
|
10
|
+
|
|
11
|
+
type AnyRecord = Record<string, unknown>;
|
|
12
|
+
type SelectValue = string | number | boolean | AnyRecord | null;
|
|
13
|
+
type OptionHook = ((value: unknown) => void | Promise<void>) | null;
|
|
14
|
+
|
|
15
|
+
interface FetchPack {
|
|
16
|
+
url?: string | null;
|
|
17
|
+
data?: string | null;
|
|
18
|
+
params?: AnyRecord;
|
|
19
|
+
mapFn?: (x: AnyRecord) => AnyRecord;
|
|
20
|
+
option?:
|
|
21
|
+
| ((value: unknown) => void | Promise<void>)
|
|
22
|
+
| Array<(value: unknown) => void | Promise<void>>;
|
|
23
|
+
reset?: boolean;
|
|
24
|
+
reload?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface SelectProps {
|
|
28
|
+
fetched?: (payload: Record<string, any>) => any;
|
|
29
|
+
must?: boolean;
|
|
30
|
+
err?: string | boolean;
|
|
31
|
+
hood?: string | boolean;
|
|
32
|
+
defaultValue?: SelectValue;
|
|
33
|
+
resetKey?: string | number | boolean | AnyRecord | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const $attrs = useAttrs();
|
|
37
|
+
const props = withDefaults(defineProps<SelectProps>(), {
|
|
38
|
+
defaultValue: null,
|
|
39
|
+
resetKey: null
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// vue3.4 way
|
|
43
|
+
const emit = defineEmits<{
|
|
44
|
+
(event: "fetched"): void;
|
|
45
|
+
(event: "clear"): void;
|
|
46
|
+
}>();
|
|
47
|
+
const model = defineModel<SelectValue | SelectValue[]>();
|
|
48
|
+
|
|
49
|
+
const skipNextSearch = ref(false); // suppress search right after clear
|
|
50
|
+
|
|
51
|
+
let observer = ref<IntersectionObserver | null>(null);
|
|
52
|
+
let load = ref<HTMLElement | null>(null);
|
|
53
|
+
|
|
54
|
+
// store callbacks coming from fetchedDropdown(pack)
|
|
55
|
+
const hooks = ref<{ option: OptionHook | OptionHook[]; }>({ option: null }); // function | function[] | null
|
|
56
|
+
|
|
57
|
+
// remember last fetch config and search so the child can refetch/append by itself
|
|
58
|
+
const lastPack = ref<FetchPack | null>(null); // { url, data, params, mapFn }
|
|
59
|
+
const lastSearch = ref(""); // current search term
|
|
60
|
+
const lastSearchRows = ref<AnyRecord[]>([]); // results of the last search, to pin on top after clearing
|
|
61
|
+
|
|
62
|
+
const hasNextPage = computed(() => {
|
|
63
|
+
const total = Number((fieldData.value as { total?: number; }).total ?? 0);
|
|
64
|
+
return field.all.length < total;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
// ask parent for a pack and run our internal fetcher
|
|
68
|
+
const callParentFetched = async (search: string, opts: Partial<FetchPack> = {}) => {
|
|
69
|
+
const maybePack = await props.fetched?.({ search, ...opts });
|
|
70
|
+
if (maybePack && typeof maybePack === "object") {
|
|
71
|
+
await fetchedDropdown(search, { ...maybePack, ...opts });
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const onClear = () => {
|
|
76
|
+
resetMe(); // clear options + selected value
|
|
77
|
+
skipNextSearch.value = true; // suppress the immediate empty search
|
|
78
|
+
emit("clear"); // notify parent that clear button was clicked
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const onOpen = async () => {
|
|
82
|
+
// if empty, load page 1 via parent fetcher (no boolean flags)
|
|
83
|
+
if (!field.all.length) {
|
|
84
|
+
if (lastPack.value) {
|
|
85
|
+
await fetchedDropdown("", { ...lastPack.value, reset: true });
|
|
86
|
+
} else {
|
|
87
|
+
// await props.fetched?.('');
|
|
88
|
+
await callParentFetched("", { reset: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
await nextTick();
|
|
93
|
+
if (load.value && hasNextPage.value) {
|
|
94
|
+
observer.value?.observe(load.value);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const onClose = async () => {
|
|
99
|
+
observer.value?.disconnect();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const onModelUpdate = async (val: unknown) => {
|
|
103
|
+
const optHooks = Array.isArray(hooks.value.option)
|
|
104
|
+
? hooks.value.option
|
|
105
|
+
: hooks.value.option
|
|
106
|
+
? [hooks.value.option]
|
|
107
|
+
: [];
|
|
108
|
+
|
|
109
|
+
// When user clicks × or backspaces everything, v-select sets model to null.
|
|
110
|
+
if (val == null || val === "") {
|
|
111
|
+
for (const f of optHooks) {
|
|
112
|
+
if (typeof f === "function") {
|
|
113
|
+
await Promise.resolve(f(null));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
emit("clear");
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
field.val = val as SelectValue;
|
|
121
|
+
|
|
122
|
+
for (const f of optHooks) {
|
|
123
|
+
if (typeof f === "function") {
|
|
124
|
+
await Promise.resolve(f(val));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const inputSearch = debounce(async (search: string, loading: (value: boolean) => void) => {
|
|
130
|
+
if (skipNextSearch.value && !search?.trim().length) {
|
|
131
|
+
skipNextSearch.value = false; // consume the flag
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (search?.trim().length) {
|
|
136
|
+
loading(true);
|
|
137
|
+
if (lastPack.value) {
|
|
138
|
+
await fetchedDropdown(search, { ...lastPack.value, reset: true }).finally(() =>
|
|
139
|
+
loading(false)
|
|
140
|
+
);
|
|
141
|
+
} else {
|
|
142
|
+
await callParentFetched(search, { reset: true }).finally(() => loading(false));
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
// user erased the query manually: refetch the full list, then pin the last search results on top
|
|
146
|
+
field.page = 0;
|
|
147
|
+
if (lastPack.value) {
|
|
148
|
+
await fetchedDropdown("", { ...lastPack.value, reset: true });
|
|
149
|
+
} else {
|
|
150
|
+
await callParentFetched("");
|
|
151
|
+
}
|
|
152
|
+
pinLastSearchRows();
|
|
153
|
+
await nextTick();
|
|
154
|
+
if (load.value && hasNextPage.value) observer.value?.observe(load.value);
|
|
155
|
+
}
|
|
156
|
+
}, 400);
|
|
157
|
+
|
|
158
|
+
const infiniteScroll = async ([{ isIntersecting, target }]: IntersectionObserverEntry[]) => {
|
|
159
|
+
if (!isIntersecting) return;
|
|
160
|
+
|
|
161
|
+
const ul =
|
|
162
|
+
target instanceof HTMLElement && target.offsetParent instanceof HTMLElement
|
|
163
|
+
? target.offsetParent
|
|
164
|
+
: null;
|
|
165
|
+
const scrollTop = ul?.scrollTop ?? 0;
|
|
166
|
+
|
|
167
|
+
if (lastPack.value) {
|
|
168
|
+
await fetchedDropdown(lastSearch.value, { ...lastPack.value }); // next page of current mode
|
|
169
|
+
} else {
|
|
170
|
+
await callParentFetched(lastSearch.value || "");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
await nextTick();
|
|
174
|
+
|
|
175
|
+
if (ul) ul.scrollTop = scrollTop;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
onMounted(async () => {
|
|
179
|
+
observer.value = new IntersectionObserver(infiniteScroll);
|
|
180
|
+
|
|
181
|
+
// set default value if provided
|
|
182
|
+
if (props.defaultValue) {
|
|
183
|
+
await nextTick();
|
|
184
|
+
field.val = props.defaultValue;
|
|
185
|
+
model.value = props.defaultValue;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
onBeforeUnmount(() => {
|
|
190
|
+
observer.value?.disconnect();
|
|
191
|
+
observer.value = null;
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
// prototype and it will call from parent
|
|
195
|
+
const field = reactive<{ all: AnyRecord[]; val: SelectValue; page: number; size: number; }>({
|
|
196
|
+
all: [],
|
|
197
|
+
val: "",
|
|
198
|
+
page: 0,
|
|
199
|
+
size: 10
|
|
200
|
+
});
|
|
201
|
+
const fieldData = ref<AnyRecord>({});
|
|
202
|
+
|
|
203
|
+
const resetMe = () => {
|
|
204
|
+
field.all = [];
|
|
205
|
+
field.page = 0;
|
|
206
|
+
field.val = "";
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const reloadMe = () => {
|
|
210
|
+
field.all = [];
|
|
211
|
+
field.page = 0;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const fetchedDropdown = async (search: string, pack: FetchPack | null = null) => {
|
|
215
|
+
const url = pack?.url ?? null;
|
|
216
|
+
const data = pack?.data ?? null;
|
|
217
|
+
const params = pack?.params ?? {};
|
|
218
|
+
const mapFn = pack?.mapFn ?? ((x: AnyRecord) => x);
|
|
219
|
+
const reset = !!pack?.reset;
|
|
220
|
+
const reload = !!pack?.reload;
|
|
221
|
+
|
|
222
|
+
// make option sticky: only overwrite if caller provided it
|
|
223
|
+
if ("option" in (pack ?? {})) {
|
|
224
|
+
const pOpt = pack?.option;
|
|
225
|
+
hooks.value.option = Array.isArray(pOpt)
|
|
226
|
+
? pOpt.filter((fn) => typeof fn === "function")
|
|
227
|
+
: typeof pOpt === "function"
|
|
228
|
+
? [pOpt]
|
|
229
|
+
: [];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// remember essentials so the child can refetch/append on its own
|
|
233
|
+
lastPack.value = { url, data, params, mapFn };
|
|
234
|
+
lastSearch.value = search ?? "";
|
|
235
|
+
|
|
236
|
+
// if pass and true -> reset, reload , search
|
|
237
|
+
(reset && resetMe()) ||
|
|
238
|
+
(reload && reloadMe()) ||
|
|
239
|
+
(!empty(search) && !reset && !reload && reloadMe());
|
|
240
|
+
|
|
241
|
+
// after reset/reload/search
|
|
242
|
+
field.page++;
|
|
243
|
+
const param = { page: field.page, size: field.size, search: search };
|
|
244
|
+
|
|
245
|
+
// log once (don't call axios twice)
|
|
246
|
+
// console.log('GET', pack.url, { params: pack.params ? { ...pack.params, ...param } : param });
|
|
247
|
+
|
|
248
|
+
if (!url || !data) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
let key: any;
|
|
253
|
+
try {
|
|
254
|
+
key = await axios.get(url, { params: params ? { ...params, ...param } : param });
|
|
255
|
+
} catch {
|
|
256
|
+
return; // failed to fetch (e.g. cascade with missing parent)
|
|
257
|
+
}
|
|
258
|
+
const payload = key.data[data as string] as AnyRecord;
|
|
259
|
+
|
|
260
|
+
fieldData.value = payload;
|
|
261
|
+
const rows = Array.isArray((payload as { data?: unknown; }).data)
|
|
262
|
+
? (payload as { data: AnyRecord[]; }).data
|
|
263
|
+
: [];
|
|
264
|
+
|
|
265
|
+
const options = rows
|
|
266
|
+
.map((dt) => (dt == null ? null : mapFn(dt)))
|
|
267
|
+
.filter((opt): opt is AnyRecord => opt != null);
|
|
268
|
+
|
|
269
|
+
// remember the last fresh search results so they can be pinned on top after clearing the search
|
|
270
|
+
if (search?.trim().length && reset) {
|
|
271
|
+
lastSearchRows.value = options.map((opt) => ({ ...opt }));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// console.log('Fetched', payload?.data);
|
|
275
|
+
options.forEach((opt) => {
|
|
276
|
+
const key = opt?.id ?? opt?.title ?? JSON.stringify(opt); // build a comparison key: prefer id, then title, then full object
|
|
277
|
+
|
|
278
|
+
if (
|
|
279
|
+
!field.all.some(
|
|
280
|
+
(o) =>
|
|
281
|
+
o != null &&
|
|
282
|
+
((o as { id?: unknown; title?: unknown; }).id ??
|
|
283
|
+
(o as { id?: unknown; title?: unknown; }).title ??
|
|
284
|
+
JSON.stringify(o)) === key
|
|
285
|
+
)
|
|
286
|
+
) {
|
|
287
|
+
field.all = [...field.all, opt];
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const optionKey = (o: AnyRecord) =>
|
|
293
|
+
(o as { id?: unknown; title?: unknown; }).id ??
|
|
294
|
+
(o as { id?: unknown; title?: unknown; }).title ??
|
|
295
|
+
JSON.stringify(o);
|
|
296
|
+
|
|
297
|
+
// after a refetch, move the last search results to the top of the list
|
|
298
|
+
const pinLastSearchRows = () => {
|
|
299
|
+
if (!lastSearchRows.value.length) return;
|
|
300
|
+
const pinKeys = new Set(lastSearchRows.value.map(optionKey));
|
|
301
|
+
const rest = field.all.filter((o) => !pinKeys.has(optionKey(o)));
|
|
302
|
+
field.all = [...lastSearchRows.value, ...rest];
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* This function created for
|
|
307
|
+
* functionally reset or reload
|
|
308
|
+
* from without component
|
|
309
|
+
* like fn.value.reload({reset:true/reload:true/both});
|
|
310
|
+
* it is exposed, so we can call from with
|
|
311
|
+
* template ref
|
|
312
|
+
*/
|
|
313
|
+
const reload = async () => {
|
|
314
|
+
resetMe(); // clear field.all, page, val
|
|
315
|
+
await callParentFetched("", { reset: true }); // ask parent to fetch first page again
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* if backend send proper object or null
|
|
320
|
+
* then watch function not get any axios
|
|
321
|
+
* error else axios can send error
|
|
322
|
+
*/
|
|
323
|
+
watch(
|
|
324
|
+
() => props.resetKey,
|
|
325
|
+
async (newVal, oldVal) => {
|
|
326
|
+
if (oldVal === undefined) return;
|
|
327
|
+
|
|
328
|
+
const optHooks = Array.isArray(hooks.value.option)
|
|
329
|
+
? hooks.value.option
|
|
330
|
+
: hooks.value.option
|
|
331
|
+
? [hooks.value.option]
|
|
332
|
+
: [];
|
|
333
|
+
|
|
334
|
+
model.value = "";
|
|
335
|
+
|
|
336
|
+
// Notify hooks that selection is gone
|
|
337
|
+
for (const fn of optHooks) {
|
|
338
|
+
if (typeof fn === "function") {
|
|
339
|
+
await Promise.resolve(fn(null));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
skipNextSearch.value = true; // avoid instant empty-search call
|
|
344
|
+
if (newVal == null) {
|
|
345
|
+
lastPack.value = null;
|
|
346
|
+
return;
|
|
347
|
+
} // parent cleared, don't fetch with null key
|
|
348
|
+
await callParentFetched("", { reload: true });
|
|
349
|
+
pinLastSearchRows();
|
|
350
|
+
skipNextSearch.value = false; // allow subsequent empty-searches (backspace-to-empty)
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
defineExpose({ field, fieldData, fetchedDropdown, reload });
|
|
355
|
+
|
|
356
|
+
const parentClass = computed(() => ($attrs.parentclass as string | undefined) || "mb-2");
|
|
357
|
+
|
|
358
|
+
const inputTitle = computed(() => ($attrs.title as string | undefined) || "");
|
|
359
|
+
const hoodHtml = computed(() =>
|
|
360
|
+
props.hood === false || props.hood == null ? "" : String(props.hood)
|
|
361
|
+
);
|
|
362
|
+
</script>
|
|
363
|
+
|
|
364
|
+
<template>
|
|
365
|
+
<div :class="parentClass">
|
|
366
|
+
<label
|
|
367
|
+
class="text-capitalize d-flex align-items-center mb-1"
|
|
368
|
+
:class="{ 'd-none': !inputTitle }">
|
|
369
|
+
<div class="position-relative">
|
|
370
|
+
<span class="text-capitalize" v-html="inputTitle"></span>
|
|
371
|
+
<span
|
|
372
|
+
class="position-absolute text-danger rounded-circle bg-danger must"
|
|
373
|
+
:class="{ 'd-none': !props.must }"></span>
|
|
374
|
+
</div>
|
|
375
|
+
<div
|
|
376
|
+
class="text-uppercase w-100 text-end text-primary fw-semibold"
|
|
377
|
+
:class="{ 'd-none': !props.hood }"
|
|
378
|
+
style="font-size: 12px; margin-top: 0.15rem"
|
|
379
|
+
v-html="hoodHtml"></div>
|
|
380
|
+
</label>
|
|
381
|
+
<v-select
|
|
382
|
+
v-model="model"
|
|
383
|
+
label="title"
|
|
384
|
+
:filterable="false"
|
|
385
|
+
:options="field.all"
|
|
386
|
+
v-bind="$attrs"
|
|
387
|
+
@open="onOpen"
|
|
388
|
+
@update:model-value="onModelUpdate"
|
|
389
|
+
@close="onClose"
|
|
390
|
+
@search="inputSearch"
|
|
391
|
+
@clear="onClear">
|
|
392
|
+
<template #list-footer>
|
|
393
|
+
<li v-show="hasNextPage" ref="load" class="loader">More...</li>
|
|
394
|
+
</template>
|
|
395
|
+
</v-select>
|
|
396
|
+
<div class="form-text text-danger" :class="{ 'd-none': !props.err }" style="font-size: 0.8rem">
|
|
397
|
+
{{ props.err }}
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</template>
|
|
401
|
+
|
|
402
|
+
<style lang="scss" scoped>
|
|
403
|
+
.loader {
|
|
404
|
+
text-align: center;
|
|
405
|
+
color: #bbbbbb;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.must {
|
|
409
|
+
width: 4px;
|
|
410
|
+
height: 4px;
|
|
411
|
+
top: 0;
|
|
412
|
+
margin-top: 5px;
|
|
413
|
+
margin-left: 2px;
|
|
414
|
+
}
|
|
415
|
+
</style>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="h-100" v-bind="$attrs">
|
|
3
|
+
<div class="h-100 d-flex align-items-center justify-content-center">
|
|
4
|
+
<div class="spinner-grow" :style="spinnerStyle" role="status">
|
|
5
|
+
<span class="visually-hidden">Loading...</span>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="fw-bold ms-2">
|
|
8
|
+
<span v-if="props.text" :class="props.textsize" :style="textStyle">
|
|
9
|
+
{{ props.text }}
|
|
10
|
+
</span>
|
|
11
|
+
<span v-else>Loading...</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { computed } from "vue";
|
|
19
|
+
|
|
20
|
+
defineOptions({ name: "Spinner", inheritAttrs: false });
|
|
21
|
+
|
|
22
|
+
interface SpinnerProps {
|
|
23
|
+
size?: string;
|
|
24
|
+
text?: string;
|
|
25
|
+
textsize?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<SpinnerProps>(), {
|
|
29
|
+
size: "3rem",
|
|
30
|
+
text: "",
|
|
31
|
+
textsize: ""
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const spinnerStyle = computed(() => ({
|
|
35
|
+
width: props.size,
|
|
36
|
+
height: props.size
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
const textStyle = computed(() => ({
|
|
40
|
+
fontSize: props.textsize || undefined
|
|
41
|
+
}));
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="wrapperClass">
|
|
3
|
+
<label :class="props.vertical ? 'form-check-label d-block' : 'd-none'">
|
|
4
|
+
<span v-html="statusHtml"></span>
|
|
5
|
+
</label>
|
|
6
|
+
<div class="form-check form-switch d-inline-block">
|
|
7
|
+
<input
|
|
8
|
+
class="form-check-input shadow-none border-primary"
|
|
9
|
+
type="checkbox"
|
|
10
|
+
role="switch"
|
|
11
|
+
:checked="isChecked"
|
|
12
|
+
v-bind="$attrs" />
|
|
13
|
+
<label :class="props.vertical ? 'd-none' : 'form-check-label'">
|
|
14
|
+
<span v-html="statusHtml"></span>
|
|
15
|
+
</label>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { computed, useAttrs } from "vue";
|
|
22
|
+
|
|
23
|
+
defineOptions({ name: "Switch", inheritAttrs: false });
|
|
24
|
+
|
|
25
|
+
interface SwitchProps {
|
|
26
|
+
modelValue?: string | number | boolean;
|
|
27
|
+
value?: unknown[] | Record<string, unknown> | string | number | boolean;
|
|
28
|
+
vertical?: boolean;
|
|
29
|
+
checked?: boolean | number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const $attrs = useAttrs();
|
|
33
|
+
const props = defineProps<SwitchProps>();
|
|
34
|
+
|
|
35
|
+
const textLabel = computed(() => ($attrs.text as string | undefined) || "");
|
|
36
|
+
const blankLabel = computed(() => ($attrs.blank as string | undefined) || "");
|
|
37
|
+
const topclass = computed(() => ($attrs.topclass as string | undefined) || "");
|
|
38
|
+
|
|
39
|
+
const isChecked = computed(() => Boolean(props.checked));
|
|
40
|
+
|
|
41
|
+
const wrapperClass = computed(() => props.vertical ? `text-center ${topclass.value}`.trim() : "");
|
|
42
|
+
|
|
43
|
+
const statusHtml = computed(() => {
|
|
44
|
+
if (isChecked.value) {
|
|
45
|
+
return `<div class='d-flex justify-content-center'><span>${textLabel.value}</span><div class='rounded-circle bg-success indicator'></div></div>`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return `<div class='d-flex justify-content-center'><span>${blankLabel.value}</span><div class='rounded-circle bg-danger indicator'></div></div>`;
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<style lang="scss">
|
|
53
|
+
.indicator {
|
|
54
|
+
width: 4px;
|
|
55
|
+
height: 4px;
|
|
56
|
+
margin-left: 2px;
|
|
57
|
+
margin-top: 5px;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
<style lang="scss" scoped>
|
|
61
|
+
label,
|
|
62
|
+
input {
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="wrapperClass">
|
|
3
|
+
<div class="position-relative">
|
|
4
|
+
<div class="position-relative mb-1">
|
|
5
|
+
<span class="text-capitalize" v-html="inputLabel"></span>
|
|
6
|
+
<span
|
|
7
|
+
class="position-absolute text-danger rounded-circle bg-danger must"
|
|
8
|
+
:class="{ 'd-none': !props.must }"></span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="form-floating h-100">
|
|
11
|
+
<textarea
|
|
12
|
+
:value="props.modelValue"
|
|
13
|
+
class="form-control mb-0 h-100"
|
|
14
|
+
:maxlength="maxLengthAttr"
|
|
15
|
+
:aria-describedby="`${inputId}Help`"
|
|
16
|
+
v-bind="$attrs"
|
|
17
|
+
rows="3"
|
|
18
|
+
@input="updateModel">
|
|
19
|
+
</textarea>
|
|
20
|
+
<label
|
|
21
|
+
:for="inputId"
|
|
22
|
+
class="d-block placeholder-label border-0"
|
|
23
|
+
:class="{ 'd-none': !placeholderText }">
|
|
24
|
+
{{ placeholderText }}
|
|
25
|
+
</label>
|
|
26
|
+
</div>
|
|
27
|
+
<label
|
|
28
|
+
class="position-absolute end-0 pe-1 text-secondary max"
|
|
29
|
+
:class="{ 'd-none': !max }"
|
|
30
|
+
style="top: 28px">
|
|
31
|
+
{{ maxCounter }}
|
|
32
|
+
</label>
|
|
33
|
+
</div>
|
|
34
|
+
<div :id="`${inputId}Help`" class="form-text text-danger" :class="{ 'd-none': !props.err }">
|
|
35
|
+
{{ props.err }}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { computed, nextTick, onMounted, useAttrs } from "vue";
|
|
42
|
+
|
|
43
|
+
defineOptions({ name: "TextArea", inheritAttrs: false });
|
|
44
|
+
|
|
45
|
+
const $attrs = useAttrs();
|
|
46
|
+
interface TextAreaProps {
|
|
47
|
+
focus?: boolean;
|
|
48
|
+
must?: boolean;
|
|
49
|
+
err?: string | boolean;
|
|
50
|
+
modelValue?: string | number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(defineProps<TextAreaProps>(), {
|
|
54
|
+
modelValue: ""
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const inputId = computed(() => ($attrs.id as string | undefined) || "");
|
|
58
|
+
const inputLabel = computed(() => ($attrs.label as string | undefined) || "");
|
|
59
|
+
const placeholderText = computed(() => ($attrs.placeholder as string | undefined) || "");
|
|
60
|
+
const topclass = computed(() => ($attrs.topclass as string | undefined) || "");
|
|
61
|
+
|
|
62
|
+
const wrapperClass = computed(() =>
|
|
63
|
+
topclass.value ? `${topclass.value} position-relative` : "mb-2"
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const max = computed<number | null>(() => {
|
|
67
|
+
const raw = $attrs.maxlength as string | number | undefined;
|
|
68
|
+
return raw != null ? Number(raw) : null;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const maxLengthAttr = computed<number | undefined>(() => max.value ?? undefined);
|
|
72
|
+
const maxCounter = computed(() =>
|
|
73
|
+
max.value == null ? "" : max.value - String(props.modelValue).length
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const emit = defineEmits<(event: "update:modelValue", value: string) => void>();
|
|
77
|
+
const updateModel = (e: Event) => {
|
|
78
|
+
const target = e.target as HTMLTextAreaElement;
|
|
79
|
+
emit("update:modelValue", target.value);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
onMounted(() => {
|
|
83
|
+
if (!props.focus || !inputId.value) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
nextTick(() => {
|
|
88
|
+
const textarea = document.querySelector(`#${inputId.value}`) as HTMLTextAreaElement | null;
|
|
89
|
+
textarea?.focus();
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
</script>
|
|
93
|
+
|
|
94
|
+
<style lang="scss" scoped>
|
|
95
|
+
.form-floating {
|
|
96
|
+
label {
|
|
97
|
+
top: -1px;
|
|
98
|
+
left: 1px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
textarea:focus+label,
|
|
102
|
+
textarea:not(:placeholder-shown)+label {
|
|
103
|
+
top: -6px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.placeholder-label {
|
|
108
|
+
color: #cccccc !important;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.must {
|
|
112
|
+
width: 4px;
|
|
113
|
+
height: 4px;
|
|
114
|
+
margin-left: 2px;
|
|
115
|
+
margin-top: 5px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.max {
|
|
119
|
+
font-size: 0.6rem;
|
|
120
|
+
}
|
|
121
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="#toast-show">
|
|
3
|
+
<div
|
|
4
|
+
ref="notify"
|
|
5
|
+
class="toast position-fixed"
|
|
6
|
+
role="alert"
|
|
7
|
+
aria-live="assertive"
|
|
8
|
+
aria-atomic="true"
|
|
9
|
+
style="z-index: 1000000; top: 10px; right: 23px"
|
|
10
|
+
data-bs-delay="2000">
|
|
11
|
+
<div :class="`text-bg-${bgcolor} align-items-center rounded-1 shadow-sm`">
|
|
12
|
+
<div class="d-flex">
|
|
13
|
+
<div class="toast-body">
|
|
14
|
+
{{ message }}
|
|
15
|
+
</div>
|
|
16
|
+
<button
|
|
17
|
+
type="button"
|
|
18
|
+
class="btn-close btn-close-white me-2 m-auto"
|
|
19
|
+
data-bs-dismiss="toast"
|
|
20
|
+
aria-label="Close"></button>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</Teleport>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import Toast from "bootstrap/js/dist/toast.js";
|
|
29
|
+
import { ref } from "vue";
|
|
30
|
+
|
|
31
|
+
defineOptions({ name: "Toast", inheritAttrs: false });
|
|
32
|
+
|
|
33
|
+
interface ToastProps {
|
|
34
|
+
icon?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
defineProps<ToastProps>();
|
|
38
|
+
|
|
39
|
+
const notify = ref<HTMLElement | null>(null);
|
|
40
|
+
const message = ref("");
|
|
41
|
+
const bgcolor = ref("primary");
|
|
42
|
+
|
|
43
|
+
const toastme = (msg: string, bg: string) => {
|
|
44
|
+
message.value = msg;
|
|
45
|
+
bgcolor.value = bg;
|
|
46
|
+
if (!notify.value) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const toast = Toast.getOrCreateInstance(notify.value);
|
|
50
|
+
toast.show();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
defineExpose({ toastme });
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<style lang="scss" scoped></style>
|