@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
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.18"
4
+ "version": "0.0.21"
5
5
  }
package/dist/module.mjs CHANGED
@@ -53,7 +53,7 @@ const module = defineNuxtModule({
53
53
  { name: "removeObject", from },
54
54
  { name: "t", from },
55
55
  { name: "updateObject", from },
56
- { name: "viewAs", from }
56
+ { name: "listObject", from }
57
57
  ]);
58
58
  addPlugin({
59
59
  src: resolver.resolve("./runtime/plugin"),
@@ -1,8 +1,8 @@
1
1
  <script setup>
2
2
  import { useI18n } from 'vue-i18n';
3
- import { useLight, q, getCurrentUser, m } from '../light';
3
+ import { useLight, q, getCurrentUser, m } from '../';
4
4
  import { ref, computed, reactive, provide, watch } from 'vue';
5
- import packageJson from '../../package.json'
5
+ //import packageJson from '../../package.json'
6
6
 
7
7
  const light = useLight();
8
8
  const props = defineProps({
@@ -11,7 +11,7 @@ const props = defineProps({
11
11
  }
12
12
  });
13
13
 
14
- let app = await q("app", ["menus"]);
14
+ let app = await q("app", ["menus", "viewAsMode"]);
15
15
  let my = await q("my", ["styles"]);
16
16
  const menus = ref(app.menus)
17
17
 
@@ -122,6 +122,11 @@ watch(() => style.color, async (value) => {
122
122
  });
123
123
  })
124
124
 
125
+ const exitViewAs = async () => {
126
+ await m("cancelViewAs");
127
+ window.location.reload();
128
+ }
129
+
125
130
  </script>
126
131
 
127
132
 
@@ -185,6 +190,13 @@ watch(() => style.color, async (value) => {
185
190
  <q-item-section>{{ $t('View as') }}</q-item-section>
186
191
  </q-item>
187
192
 
193
+ <q-item v-close-popup v-if="app.viewAsMode" @click="exitViewAs" clickable>
194
+ <q-item-section avatar>
195
+ <q-icon name="sym_o_visibility_off" />
196
+ </q-item-section>
197
+ <q-item-section>{{ $t('Exit view as') }}</q-item-section>
198
+ </q-item>
199
+
188
200
  <q-separator />
189
201
 
190
202
  <q-item v-close-popup to="/logout">
@@ -206,7 +218,7 @@ watch(() => style.color, async (value) => {
206
218
  @mouseover="isMouseOnDrawer = true">
207
219
  <!-- drawer content -->
208
220
  <q-scroll-area class="fit">
209
- <l-menu v-for="menu in menus" :value="menu" v-if="isAdmin" :dense="style.dense" />
221
+ <l-menu v-for="menu in menus" :value="menu" :dense="style.dense" />
210
222
  </q-scroll-area>
211
223
  </q-drawer>
212
224
 
@@ -227,7 +239,17 @@ watch(() => style.color, async (value) => {
227
239
  error }}
228
240
  </q-card-section>
229
241
  </q-card>
230
- <slot :reload="reloadMenu" />
242
+
243
+
244
+ <router-view v-slot="{ Component }">
245
+ <template v-if="Component">
246
+ <suspense>
247
+ <component :is="Component" :reloadMenu="reloadMenu"></component>
248
+ </suspense>
249
+ </template>
250
+ </router-view>
251
+
252
+
231
253
  </q-page-container>
232
254
 
233
255
 
@@ -1,17 +1,21 @@
1
1
  <script setup>
2
- import { q } from '../light';
3
- const { system } = await q({ system: ['company', 'companyLogo', 'logged'] });
2
+ import { q } from '../';
3
+ const { app } = await q({ app: ['company', 'companyLogo', 'logged', 'twoFactorAuthentication'] });
4
4
  </script>
5
5
  <template>
6
- <q-layout v-if="!system.logged">
6
+ <q-layout v-if="!app.logged">
7
7
  <q-page-container class="bg-grey-2" style="color:#1f1f1f">
8
8
  <q-page padding>
9
- <l-login :company="system.company" :company-logo="system.companyLogo"></l-login>
9
+ <l-login
10
+ :company="app.company"
11
+ :company-logo="app.companyLogo"
12
+ :twoFactorAuthentication="app.twoFactorAuthentication"
13
+ ></l-login>
10
14
  </q-page>
11
15
  </q-page-container>
12
16
  </q-layout>
13
17
 
14
- <l-app-main v-else :company="system.company">
18
+ <l-app-main v-else :company="app.company">
15
19
  <slot></slot>
16
20
  </l-app-main>
17
21
  </template>
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { ref } from "vue";
3
- import { q, f } from "../light";
3
+ import { q, f } from '../';
4
4
  const props = defineProps(["permission"]);
5
5
 
6
6
  const granted = ref(false);
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { ref, computed } from "vue";
3
- import { t } from "../light";
3
+ import { t } from '../';
4
4
  const props = defineProps({
5
5
  modelValue: {
6
6
  type: [String, Object],
@@ -15,6 +15,10 @@ const props = defineProps({
15
15
  type: String,
16
16
  default: ""
17
17
  },
18
+ required: {
19
+ type: Boolean,
20
+ default: false
21
+ },
18
22
  });
19
23
 
20
24
  const emit = defineEmits(["update:modelValue"]);
@@ -29,7 +33,6 @@ const localValue = computed({
29
33
  return props.modelValue
30
34
  },
31
35
  set: (value) => {
32
- console.log(value);
33
36
  popup.value.hide();
34
37
  emit('update:modelValue', value)
35
38
  }
@@ -38,23 +41,17 @@ const localValue = computed({
38
41
 
39
42
  const rules = [];
40
43
 
41
-
42
-
43
- rules.push((val) => {
44
-
45
- if (props.range) {
46
- return;
47
- }
48
-
49
- if (props.required) {
44
+ if (props.required && !props.range) {
45
+ rules.push((val) => {
46
+ if (!val) {
47
+ return "Required";
48
+ }
50
49
  //check val is YYYY-MM-DD
51
50
  if (!val.match(/^\d{4}-\d{2}-\d{2}$/)) {
52
51
  return "Invalid date format";
53
52
  }
54
-
55
- }
56
- return;
57
- });
53
+ });
54
+ }
58
55
 
59
56
  const localLabel = computed(() => {
60
57
 
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { ref, computed, watch } from "vue";
3
- import { q, m } from "../light";
3
+ import { q, m } from '../';
4
4
  const emit = defineEmits(["selected"]);
5
5
  const data = await q("fsListFolders", { path: "/" }, ["name", "path"]);
6
6
  const folders = ref(data);
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import { q } from "../light";
2
+ import { q } from '../';
3
3
  const props = defineProps(["modelValue"]);
4
4
 
5
5
  const file = await q("fsFile", {
@@ -3,7 +3,7 @@ import { VariableType } from "json-to-graphql-query";
3
3
  import { useI18n } from "vue-i18n";
4
4
  import { ref, watch, computed } from 'vue';
5
5
  import { useQuasar } from 'quasar';
6
- import { q } from "../light";
6
+ import { q } from '../';
7
7
 
8
8
  const quasar = useQuasar();
9
9
  const emit = defineEmits(["input", "close"]);
@@ -2,6 +2,7 @@
2
2
  import { ref } from "vue";
3
3
  import { useRouter, useRoute } from "vue-router";
4
4
  import { useQuasar } from "quasar";
5
+ import { addObject, updateObject } from '../';
5
6
 
6
7
  const route = useRoute();
7
8
  const router = useRouter();
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed } from "vue";
3
- import { t } from "../light";
3
+ import { useI18n } from 'vue-i18n';
4
+ const i18n = useI18n();
4
5
 
5
6
  const props = defineProps({
6
7
  modelValue: {
@@ -17,6 +18,10 @@ const props = defineProps({
17
18
  type: String,
18
19
  default: ""
19
20
  },
21
+ type: {
22
+ type: String,
23
+ default: "text"
24
+ },
20
25
  });
21
26
  const emit = defineEmits(["update:modelValue"]);
22
27
 
@@ -27,6 +32,14 @@ if (props.required) {
27
32
  new_rules.push(val => !!val || 'Required.');
28
33
  }
29
34
 
35
+ if (props.type == "email") {
36
+ new_rules.push(val => {
37
+ if (val && !val.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
38
+ return i18n.t("Invalid email format");
39
+ }
40
+ });
41
+ }
42
+
30
43
 
31
44
  const localValue = computed({
32
45
  get: () => props.modelValue,
@@ -35,9 +48,9 @@ const localValue = computed({
35
48
 
36
49
  const localLabel = computed(() => {
37
50
  if (props.required && !localValue.value) {
38
- return t(props.label);
51
+ return i18n.t(props.label);
39
52
  }
40
- return t(props.label);
53
+ return i18n.t(props.label);
41
54
 
42
55
  });
43
56
 
@@ -46,5 +59,5 @@ const localLabel = computed(() => {
46
59
 
47
60
  </script>
48
61
  <template>
49
- <q-input :label="localLabel" v-model="localValue" hide-bottom-space :rules="new_rules"></q-input>
62
+ <q-input :label="localLabel" v-model="localValue" hide-bottom-space :rules="new_rules" :type="type"></q-input>
50
63
  </template>
@@ -1,16 +1,17 @@
1
1
  <script setup>
2
2
  import { ref, reactive } from 'vue'
3
3
  import { useQuasar } from 'quasar';
4
- import { login, m } from '../light';
4
+ import { login, m, notify } from '../';
5
5
  defineProps({
6
6
  company: String,
7
- companyLogo: String
7
+ companyLogo: String,
8
+ twoFactorAuthentication: Boolean
8
9
 
9
10
  })
10
11
 
11
12
  const form1 = ref(null);
12
13
  const data = reactive({
13
- username: "", password: ""
14
+ username: "", password: "", code: ""
14
15
  });
15
16
 
16
17
  const qua = useQuasar()
@@ -18,16 +19,11 @@ const submit = async () => {
18
19
  if (await form1.value.validate()) {
19
20
 
20
21
  try {
21
- await login(data.username, data.password)
22
+ await login(data.username, data.password, data.code)
22
23
  window.self.location = "/";
23
24
  } catch (e) {
24
- qua.notify({
25
- message: e.message,
26
- color: "negative",
27
- icon: "sym_o_error",
28
- position: "top",
29
- timeout: 2000
30
- });
25
+ notify(e.message, "negative");
26
+
31
27
  }
32
28
  }
33
29
  }
@@ -120,6 +116,8 @@ const forgetPassword = async () => {
120
116
  clearable />
121
117
  <q-input v-model="data.password" label="Password" required type="password" clearable
122
118
  :rules="[v => !!v || 'Password is required']" />
119
+ <q-input v-if="twoFactorAuthentication" v-model="data.code" label="2FA code" required type="text" clearable>
120
+ </q-input>
123
121
  </q-form>
124
122
  </q-card-section>
125
123
  <q-card-actions>
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { useRouter, useRoute } from "vue-router"
3
+ import { removeObject, getID } from '../'
3
4
  const router = useRouter();
4
5
  const route = useRoute();
5
6
 
@@ -72,7 +73,8 @@ const title = props.title || route.path.split("/")[1];
72
73
 
73
74
  const module = route.path.split("/")[1];
74
75
  const onDelete = async () => {
75
- if (await removeObject(module, route.params.id)) {
76
+
77
+ if (await removeObject(module, getID())) {
76
78
  router.push(`/${module}`);
77
79
  }
78
80
  }
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
- import { t } from "../light"
3
+ import { t } from '../'
4
4
  const props = defineProps({
5
5
 
6
6
  rules: {
@@ -29,7 +29,7 @@ const props = defineProps({
29
29
 
30
30
  if (props.required) {
31
31
  props.rules.push((val) => {
32
- if (isNumber(val)) {
32
+ if (Number.isInteger(val)) {
33
33
  return;
34
34
  }
35
35