@hostlink/nuxt-light 0.0.18 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +1 -1
  3. package/dist/runtime/components/l-app-main.vue +27 -5
  4. package/dist/runtime/components/l-app.vue +9 -5
  5. package/dist/runtime/components/l-btn.vue +1 -1
  6. package/dist/runtime/components/l-date-picker.vue +12 -15
  7. package/dist/runtime/components/l-file-manager-move.vue +1 -1
  8. package/dist/runtime/components/l-file-manager-preview.vue +1 -1
  9. package/dist/runtime/components/l-file-manager.vue +1 -1
  10. package/dist/runtime/components/l-form.vue +1 -0
  11. package/dist/runtime/components/l-input.vue +17 -4
  12. package/dist/runtime/components/l-login.vue +9 -11
  13. package/dist/runtime/components/l-page.vue +3 -1
  14. package/dist/runtime/components/l-select.vue +2 -2
  15. package/dist/runtime/components/l-table.vue +129 -104
  16. package/dist/runtime/components/l-time-picker.vue +24 -5
  17. package/dist/runtime/{light.d.ts → index.d.ts} +1 -1
  18. package/dist/runtime/{light.mjs → index.mjs} +3 -1
  19. package/dist/runtime/lib/addObject.mjs +9 -4
  20. package/dist/runtime/lib/deleteObject.d.ts +1 -0
  21. package/dist/runtime/lib/deleteObject.mjs +12 -0
  22. package/dist/runtime/lib/getID.d.ts +2 -0
  23. package/dist/runtime/lib/getID.mjs +13 -0
  24. package/dist/runtime/lib/index.d.ts +4 -2
  25. package/dist/runtime/lib/index.mjs +4 -2
  26. package/dist/runtime/lib/listObject.d.ts +1 -0
  27. package/dist/runtime/lib/listObject.mjs +19 -0
  28. package/dist/runtime/lib/login.d.ts +1 -1
  29. package/dist/runtime/lib/login.mjs +3 -2
  30. package/dist/runtime/lib/m.d.ts +1 -1
  31. package/dist/runtime/lib/m.mjs +5 -1
  32. package/dist/runtime/lib/removeObject.mjs +6 -9
  33. package/dist/runtime/lib/updateObject.mjs +8 -7
  34. package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +1 -1
  35. package/dist/runtime/pages/EventLog/index.vue +2 -10
  36. package/dist/runtime/pages/MailLog/index.vue +2 -8
  37. package/dist/runtime/pages/Permission/add.vue +1 -1
  38. package/dist/runtime/pages/Permission/all.vue +1 -1
  39. package/dist/runtime/pages/Permission/index.vue +1 -1
  40. package/dist/runtime/pages/Role/add.vue +1 -1
  41. package/dist/runtime/pages/Role/index.vue +2 -2
  42. package/dist/runtime/pages/System/database/table.vue +1 -1
  43. package/dist/runtime/pages/System/index.vue +1 -1
  44. package/dist/runtime/pages/System/mailtest.vue +1 -1
  45. package/dist/runtime/pages/System/menu/index.vue +2 -2
  46. package/dist/runtime/pages/System/package.vue +1 -1
  47. package/dist/runtime/pages/System/phpinfo.vue +1 -1
  48. package/dist/runtime/pages/System/setting.vue +12 -2
  49. package/dist/runtime/pages/System/view_as.vue +2 -2
  50. package/dist/runtime/pages/User/_user_id/change-password.vue +1 -7
  51. package/dist/runtime/pages/User/_user_id/edit.vue +4 -3
  52. package/dist/runtime/pages/User/_user_id/view.vue +3 -2
  53. package/dist/runtime/pages/User/add.vue +16 -6
  54. package/dist/runtime/pages/User/index.vue +3 -3
  55. package/dist/runtime/pages/User/profile.vue +1 -1
  56. package/dist/runtime/pages/User/setting/bio-auth.vue +1 -2
  57. package/dist/runtime/pages/User/setting/index.vue +1 -1
  58. package/dist/runtime/pages/User/setting/information.vue +1 -1
  59. package/dist/runtime/pages/User/setting/password.vue +1 -1
  60. package/dist/runtime/pages/User/setting/two-factor-auth.vue +1 -1
  61. package/dist/runtime/pages/UserLog/index.vue +1 -12
  62. package/dist/runtime/pages/index.vue +5 -11
  63. package/dist/runtime/pages/logout.vue +1 -1
  64. package/dist/runtime/plugin.mjs +1 -1
  65. package/dist/runtime/routes.mjs +0 -10
  66. package/package.json +1 -1
  67. package/dist/runtime/lib/viewAs.d.ts +0 -1
  68. package/dist/runtime/lib/viewAs.mjs +0 -15
  69. package/dist/runtime/pages/User/setting/2fa.vue +0 -60
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from 'vue'
3
- import { q } from "../../light"
3
+ import { q } from '../../'
4
4
  import { useRouter } from "vue-router"
5
5
  const obj = reactive({
6
6
  roles: []
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from 'vue'
3
- import { q, m } from "../../light"
3
+ import { q, m } from '../../'
4
4
  const app = await q("app", ["permissions"])
5
5
 
6
6
  const roles = await q("listRole", ["name", "permissions"])
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { listData } from "../../light";
2
+ import { listData } from '../../';
3
3
  const onRequest = async (params) => {
4
4
  listData("Permission", params, ["permission_id"]);
5
5
  };
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from 'vue'
3
- import { q } from "../../light"
3
+ import { q } from '../../'
4
4
  const obj = reactive({
5
5
  childs: ["Users"],
6
6
  })
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { useQuasar } from 'quasar'
3
- import { q, m } from "../../light"
3
+ import { q, m } from '../../'
4
4
  import { ref } from "vue"
5
5
 
6
6
  const qua = useQuasar();
@@ -22,7 +22,7 @@ const onDelete = async (role) => {
22
22
  persistent: true,
23
23
  }).onOk(async () => {
24
24
 
25
- m("removeRole", { name: role })
25
+ m("deleteRole", { name: role })
26
26
  //refresh
27
27
  roles.value = await loadData();
28
28
  });
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../../light"
2
+ import { q } from '../../../'
3
3
  const { system: { database } } = await q({ system: { database: ["table"] } })
4
4
  </script>
5
5
  <template>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../light"
2
+ import { q } from '../../'
3
3
  const system = await q("system", ["server"])
4
4
  </script>
5
5
  <template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from 'vue'
3
- import { m } from "../../light"
3
+ import { m } from '../../'
4
4
  const obj = reactive({})
5
5
 
6
6
  const onSave = async () => {
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { reactive, ref, computed, inject } from 'vue';
3
- import { m, q } from "../../../light";
2
+ import { ref, computed, inject } from 'vue';
3
+ import { m, q } from '../../../'
4
4
  import { useQuasar } from 'quasar';
5
5
 
6
6
 
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../light"
2
+ import { q } from '../../'
3
3
  const { system } = await q({ system: ["package"] })
4
4
  </script>
5
5
  <template>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../light"
2
+ import { q } from '../../'
3
3
  const { system } = await q({ system: ["phpInfo"] })
4
4
  </script>
5
5
  <template>
@@ -2,7 +2,7 @@
2
2
  import { useQuasar } from 'quasar'
3
3
  import { useRouter } from 'vue-router'
4
4
  import { reactive } from "vue"
5
- import { q, m } from "../../light"
5
+ import { q, m } from '../../'
6
6
 
7
7
  const router = useRouter()
8
8
  const que = useQuasar()
@@ -17,7 +17,7 @@ const obj = reactive(app.config.reduce((acc, cur) => {
17
17
  }, {}));
18
18
 
19
19
  const fields = ["company", "company_logo", "password_upper_case", "password_lower_case", "password_number", "password_special_character",
20
- "file_manager_show"];
20
+ "file_manager_show", "two_factor_authentication"];
21
21
 
22
22
  //filter out fields that are not in the app.config table
23
23
  Object.keys(obj).forEach((key) => {
@@ -69,6 +69,16 @@ const onSave = async () => {
69
69
  false-value="0"></q-checkbox>
70
70
  </q-field>
71
71
 
72
+
73
+ <q-field label="File manager" stack-label>
74
+ <q-checkbox label="Show" v-model="obj.file_manager_show" true-value="1" false-value="0"></q-checkbox>
75
+ </q-field>
76
+
77
+ <q-field label="Two factor authentication" stack-label>
78
+ <q-checkbox label="Enable" v-model="obj.two_factor_authentication" true-value="1"
79
+ false-value="0"></q-checkbox>
80
+ </q-field>
81
+
72
82
  </l-form>
73
83
  </l-page>
74
84
  </template>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { list } from "../../light"
2
+ import { list, m } from '../../'
3
3
  import { useRouter } from "vue-router"
4
4
 
5
5
  let users = await list("User", {
@@ -36,7 +36,7 @@ let columns = [
36
36
  const router = useRouter();
37
37
  const onCickView = async (id) => {
38
38
 
39
- if (await viewAs(id)) {
39
+ if (await m("viewAs", { user_id: id })) {
40
40
  router.back();
41
41
  }
42
42
 
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../../light"
2
+ import { q } from '../../../'
3
3
  import { useRouter, useRoute } from "vue-router"
4
4
  import { reactive } from "vue"
5
5
  const system = await q("system", ["passwordPolicy"]);
@@ -9,22 +9,16 @@ const rules = system.passwordPolicy.map((rule) => {
9
9
  switch (s[0]) {
10
10
  case "required":
11
11
  return (v) => !!v || "Required";
12
- break;
13
12
  case "containUpper":
14
13
  return (v) => /[A-Z]/.test(v) || "Must contain at least one uppercase letter";
15
- break;
16
14
  case "containLower":
17
15
  return (v) => /[a-z]/.test(v) || "Must contain at least one lowercase letter";
18
- break;
19
16
  case "containNumber":
20
17
  return (v) => /[0-9]/.test(v) || "Must contain at least one number";
21
- break;
22
18
  case "containSpecial":
23
19
  return (v) => /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(v) || "Must contain at least one special character";
24
- break;
25
20
  case "minLength":
26
21
  return (v) => v.length >= parseInt(s[1]) || `Must be at least ${s[1]} characters`;
27
- break;
28
22
  }
29
23
  })
30
24
  const router = useRouter();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
- import { reacttive } from 'vue'
2
+ import { reactive } from 'vue'
3
+ import { getObject } from '../../../'
3
4
  const obj = reactive(await getObject(["first_name", "last_name", "email", "phone",
4
5
  "addr1", "addr2", "addr3", "join_date", "expiry_date", "status", "language", "default_page"
5
6
  ]))
@@ -12,7 +13,7 @@ const obj = reactive(await getObject(["first_name", "last_name", "email", "phone
12
13
  <l-col md="6">
13
14
  <l-input label="First name" v-model="obj.first_name" required />
14
15
  <l-input label="Last name" v-model="obj.last_name" />
15
- <l-input label="Email" v-model="obj.email" required />
16
+ <l-input label="Email" v-model="obj.email" required type="email" />
16
17
  </l-col>
17
18
  <l-col md="6">
18
19
  <l-input label="Phone" v-model="obj.phone" />
@@ -33,7 +34,7 @@ const obj = reactive(await getObject(["first_name", "last_name", "email", "phone
33
34
  }, {
34
35
  label: '中文',
35
36
  value: 'zh-hk'
36
- }]" v-model="obj.language" emit-value map-options required></l-select>
37
+ }]" v-model="obj.language" required></l-select>
37
38
 
38
39
  <l-input label="Default page" v-model="obj.default_page"></l-input>
39
40
 
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import { getObject } from "../../../light";
3
- const obj = await getObject(["username", "first_name", "last_name", "email", "phone"]);
2
+ import { getObject } from '../../../';
3
+ const obj = await getObject(["username", "first_name", "last_name", "email", "phone", "roles"]);
4
4
 
5
5
  </script>
6
6
 
@@ -16,6 +16,7 @@ const obj = await getObject(["username", "first_name", "last_name", "email", "ph
16
16
  <l-item label="Last name">{{ obj.last_name }}</l-item>
17
17
  <l-item label="Email">{{ obj.email }}</l-item>
18
18
  <l-item label="Phone">{{ obj.phone }}</l-item>
19
+ <l-item label="Roles">{{ obj.roles.join(",") }}</l-item>
19
20
  </l-list>
20
21
  </l-card>
21
22
  </l-page>
@@ -1,10 +1,13 @@
1
1
  <script setup>
2
2
  import { reactive } from "vue"
3
- import { q } from "../../light"
3
+ import { q } from '../../'
4
4
  const obj = reactive({
5
5
  roles: ['Users'],
6
- status: 'Active',
7
- language: "en"
6
+ status: 0,
7
+ language: "en",
8
+ //YYYY-MM-DD (today)
9
+ join_date: new Date().toISOString().substring(0, 10),
10
+
8
11
  })
9
12
 
10
13
  let roles = await q("listRole", ["name"]);
@@ -25,7 +28,7 @@ roles = roles.map((role) => {
25
28
  <l-input label="Password" v-model="obj.password" required type="password" />
26
29
  <l-input label="First name" v-model="obj.first_name" required />
27
30
  <l-input label="Last name" v-model="obj.last_name" />
28
- <l-input label="Email" v-model="obj.email" required />
31
+ <l-input label="Email" v-model="obj.email" required type="email" />
29
32
 
30
33
  </l-col>
31
34
  <l-col md="6">
@@ -38,14 +41,21 @@ roles = roles.map((role) => {
38
41
  <l-date-picker label="Join date" v-model="obj.join_date" required />
39
42
  <l-date-picker label="Expiry date" v-model="obj.expiry_date" />
40
43
 
41
- <l-select label="Status" :options="['Active', 'Inactve']" v-model="obj.status"></l-select>
44
+ <l-select label="Status" :options="[{
45
+ label: 'Active',
46
+ value: 0
47
+ }, {
48
+ label: 'Inactive',
49
+ value: 1
50
+ }]" v-model="obj.status" required></l-select>
51
+
42
52
  <l-select label="Language" :options="[{
43
53
  label: 'English',
44
54
  value: 'en'
45
55
  }, {
46
56
  label: '中文',
47
57
  value: 'zh-hk'
48
- }]" v-model="obj.language" emit-value map-options></l-select>
58
+ }]" v-model="obj.language" emit-value map-options required></l-select>
49
59
 
50
60
  <l-input label="Default page" v-model="obj.default_page"></l-input>
51
61
 
@@ -1,9 +1,9 @@
1
1
  <script setup>
2
- import { listData } from "../../light"
3
2
 
3
+ const onRequest = async (request) => {
4
+ //listData("User", params, ["canDelete", "canUpdate", "canRead", "user_id"]);
4
5
 
5
- const onRequest = async (params) => {
6
- listData("User", params, ["canDelete", "canUpdate", "canRead", "user_id"]);
6
+ request.loadData("User", null, ["user_id"]);
7
7
  };
8
8
 
9
9
  const columns = [
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../../light"
2
+ import { q } from '../../'
3
3
  const my = await q("my", ["username", "first_name", "last_name", "email", "phone", "roles", "addr1", "addr2", "addr3", "join_date"])
4
4
 
5
5
  </script>
@@ -1,6 +1,5 @@
1
1
  <script setup>
2
- import { reactive } from "vue"
3
- import { q, m, notify } from "../../../light"
2
+ import { q } from '../../../'
4
3
  const app = q("app"["hasBioAuth"]);
5
4
  </script>
6
5
  <template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from "vue"
3
- import { q, m, notify } from "../../../light"
3
+ import { q, m, notify } from '../../../'
4
4
 
5
5
  const obj = reactive(await q("my", ["username", "email", "first_name", "last_name"]))
6
6
  const save = async () => {
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from "vue"
3
- import { q, m, notify } from "../../../light"
3
+ import { q, m, notify } from '../../../'
4
4
  const obj = reactive(await q("my", ["phone", "addr1", "addr2", "addr3"]))
5
5
  const save = async () => {
6
6
  try {
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { reactive } from "vue"
3
- import { q, m, notify } from "../../../light"
3
+ import { q, m, notify } from '../../../'
4
4
 
5
5
  const obj = reactive({
6
6
  old_password: "",
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { ref, reactive } from "vue"
3
- import { q, m, notify } from "../../../light"
3
+ import { q, m, notify } from '../../../'
4
4
 
5
5
  const my = await q("my", ["twoFactorEnabled"])
6
6
  const my2FA = await m("my2FA", [])
@@ -1,9 +1,4 @@
1
1
  <script setup>
2
- import { listData } from "../../light";
3
- const onRequest = async (params) => {
4
- listData("UserLog", params);
5
- };
6
-
7
2
  const columns = [
8
3
  {
9
4
  label: "ID",
@@ -37,18 +32,12 @@ const columns = [
37
32
  sortable: true,
38
33
  searchable: true,
39
34
  },
40
-
41
-
42
-
43
-
44
-
45
35
  ]
46
36
 
47
37
  </script>
48
-
49
38
  <template>
50
39
  <l-page>
51
- <l-table @request="onRequest" :columns="columns" sort-by="login_dt:desc">
40
+ <l-table @request="$event.loadData('UserLog')" :columns="columns" sort-by="login_dt:desc">
52
41
  </l-table>
53
42
  </l-page>
54
43
  </template>
@@ -1,20 +1,14 @@
1
1
  <script setup>
2
- import { inject } from "vue";
3
-
4
-
5
- const reloadMenu = inject('reloadMenu')
6
-
7
- const onClick = (parent) => {
8
- reloadMenu()
9
-
10
- }
2
+ import { q } from '../'
3
+ const my = await q("my", ["name", "email"]);
11
4
  </script>
12
5
  <template>
13
6
  <q-page padding>
14
7
  <l-card>
15
8
  <q-card-section>
16
- Helloas
17
- <q-btn label="click" @click="onClick($parent)"></q-btn>
9
+ Hello
10
+
11
+ {{ my }}
18
12
  </q-card-section>
19
13
  </l-card>
20
14
  </q-page>
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { m } from "../light";
2
+ import { m } from '../'
3
3
  await m("logout");
4
4
  window.self.location = "/";
5
5
 
@@ -11,7 +11,7 @@ import message_en from "./locales/en.json";
11
11
  import message_zh from "./locales/zh-hk.json";
12
12
  import routes from "./routes.mjs";
13
13
  localStorage.getItem("locale") || localStorage.setItem("locale", "en");
14
- import { useLight } from "./light.mjs";
14
+ import { useLight } from "./index.mjs";
15
15
  export default defineNuxtPlugin((nuxtApp) => {
16
16
  let locale = localStorage.getItem("locale") || "en";
17
17
  nuxtApp.vueApp.config.errorHandler = (error) => {
@@ -101,11 +101,6 @@ function User_setting_index() {
101
101
  /* webpackChunkName: "User-setting-index" */ './pages/User/setting/index.vue'
102
102
  )
103
103
  }
104
- function User_setting_2fa() {
105
- return import(
106
- /* webpackChunkName: "User-setting-2fa" */ './pages/User/setting/2fa.vue'
107
- )
108
- }
109
104
  function User_setting_bio_auth() {
110
105
  return import(
111
106
  /* webpackChunkName: "User-setting-bio-auth" */ './pages/User/setting/bio-auth.vue'
@@ -282,11 +277,6 @@ export default [
282
277
  path: '',
283
278
  component: User_setting_index,
284
279
  },
285
- {
286
- name: 'User-setting-2fa',
287
- path: '2fa',
288
- component: User_setting_2fa,
289
- },
290
280
  {
291
281
  name: 'User-setting-bio-auth',
292
282
  path: 'bio-auth',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- export default function viewAs(id: Number): Promise<boolean>;
@@ -1,15 +0,0 @@
1
- export default async function viewAs(id) {
2
- let { data } = await mutation({
3
- operation: `viewAs`,
4
- variables: {
5
- user_id: {
6
- value: id,
7
- required: true
8
- }
9
- }
10
- });
11
- if (data.viewAs) {
12
- return true;
13
- }
14
- return false;
15
- }
@@ -1,60 +0,0 @@
1
- <script setup>
2
- import { reactive } from "vue"
3
- import { m } from "../../light"
4
- import { useQuasar } from "quasar";
5
- const quasar = useQuasar()
6
- const my2FA = await m("my2FA", [])
7
- const obj = reactive({});
8
- const save = async () => {
9
-
10
- try {
11
- await m("updateMy2FA", {
12
- code: obj.code,
13
- secret: my2FA.secret
14
- });
15
-
16
- } catch (e) {
17
- quasar.notify({
18
- message: e.message,
19
- type: "negative",
20
- position: "top"
21
- })
22
-
23
- return
24
- }
25
- }
26
-
27
- </script>
28
- <template>
29
- <l-page>
30
-
31
- <l-card>
32
- <l-form @save="save">
33
-
34
- <div>
35
-
36
- <p>
37
- Now download the app and scan the qrcode. Input the code to the
38
- following input and submit
39
- </p>
40
- <p>
41
- For Android user, install
42
- <el-link type="primary" target="_blank"
43
- href="https://play.google.com/store/apps/details?id=com.azure.authenticator">Authenticator</el-link>
44
- </p>
45
-
46
- <p>
47
- For iOS user, install
48
- <el-link type="primary" target="_blank"
49
- href="https://apps.apple.com/us/app/microsoft-authenticator/id983156458">Authenticator</el-link>
50
- </p>
51
- </div>
52
- <q-img :src="my2FA.image" width="250px" />
53
- <l-input v-model="obj.code" label="Code"
54
- hint="Please scan the QR code with your authenticator app, and enter the code" required />
55
- </l-form>
56
-
57
- </l-card>
58
-
59
- </l-page>
60
- </template>