@hostlink/nuxt-light 0.0.3

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 (111) hide show
  1. package/README.md +106 -0
  2. package/dist/module.cjs +5 -0
  3. package/dist/module.d.ts +7 -0
  4. package/dist/module.json +5 -0
  5. package/dist/module.mjs +51 -0
  6. package/dist/runtime/assets/element.css +15925 -0
  7. package/dist/runtime/assets/element.css.map +1 -0
  8. package/dist/runtime/assets/main.css +13 -0
  9. package/dist/runtime/components/l-add-btn.vue +22 -0
  10. package/dist/runtime/components/l-app-main.vue +214 -0
  11. package/dist/runtime/components/l-app.vue +17 -0
  12. package/dist/runtime/components/l-back-btn.vue +7 -0
  13. package/dist/runtime/components/l-btn.vue +19 -0
  14. package/dist/runtime/components/l-card.vue +19 -0
  15. package/dist/runtime/components/l-checkbox.vue +6 -0
  16. package/dist/runtime/components/l-col.vue +14 -0
  17. package/dist/runtime/components/l-customizer.vue +102 -0
  18. package/dist/runtime/components/l-date-picker.vue +78 -0
  19. package/dist/runtime/components/l-delete-btn.vue +23 -0
  20. package/dist/runtime/components/l-edit-btn.vue +3 -0
  21. package/dist/runtime/components/l-file-manager-labels.vue +55 -0
  22. package/dist/runtime/components/l-file-manager-move.vue +185 -0
  23. package/dist/runtime/components/l-file-manager-preview.vue +59 -0
  24. package/dist/runtime/components/l-file-manager.vue +618 -0
  25. package/dist/runtime/components/l-file.vue +33 -0
  26. package/dist/runtime/components/l-form.vue +73 -0
  27. package/dist/runtime/components/l-input.vue +48 -0
  28. package/dist/runtime/components/l-item.vue +14 -0
  29. package/dist/runtime/components/l-link.vue +24 -0
  30. package/dist/runtime/components/l-list.vue +5 -0
  31. package/dist/runtime/components/l-login.vue +128 -0
  32. package/dist/runtime/components/l-menu.vue +37 -0
  33. package/dist/runtime/components/l-page.vue +94 -0
  34. package/dist/runtime/components/l-row.vue +5 -0
  35. package/dist/runtime/components/l-save-btn.vue +3 -0
  36. package/dist/runtime/components/l-select.vue +77 -0
  37. package/dist/runtime/components/l-table.vue +333 -0
  38. package/dist/runtime/components/l-tabs.vue +5 -0
  39. package/dist/runtime/components/l-time-picker.vue +28 -0
  40. package/dist/runtime/components/l-view-btn.vue +3 -0
  41. package/dist/runtime/composables/addObject.d.ts +2 -0
  42. package/dist/runtime/composables/addObject.mjs +6 -0
  43. package/dist/runtime/composables/f.d.ts +1 -0
  44. package/dist/runtime/composables/f.mjs +27 -0
  45. package/dist/runtime/composables/getApiUrl.d.ts +1 -0
  46. package/dist/runtime/composables/getApiUrl.mjs +4 -0
  47. package/dist/runtime/composables/getCurrentUser.d.ts +2 -0
  48. package/dist/runtime/composables/getCurrentUser.mjs +8 -0
  49. package/dist/runtime/composables/getObject.d.ts +1 -0
  50. package/dist/runtime/composables/getObject.mjs +20 -0
  51. package/dist/runtime/composables/id.d.ts +2 -0
  52. package/dist/runtime/composables/id.mjs +12 -0
  53. package/dist/runtime/composables/list.d.ts +1 -0
  54. package/dist/runtime/composables/list.mjs +33 -0
  55. package/dist/runtime/composables/listData.d.ts +1 -0
  56. package/dist/runtime/composables/listData.mjs +30 -0
  57. package/dist/runtime/composables/login.d.ts +2 -0
  58. package/dist/runtime/composables/login.mjs +17 -0
  59. package/dist/runtime/composables/m.d.ts +1 -0
  60. package/dist/runtime/composables/m.mjs +73 -0
  61. package/dist/runtime/composables/mutation.d.ts +1 -0
  62. package/dist/runtime/composables/mutation.mjs +23 -0
  63. package/dist/runtime/composables/q.d.ts +1 -0
  64. package/dist/runtime/composables/q.mjs +18 -0
  65. package/dist/runtime/composables/removeObject.d.ts +1 -0
  66. package/dist/runtime/composables/removeObject.mjs +15 -0
  67. package/dist/runtime/composables/t.d.ts +1 -0
  68. package/dist/runtime/composables/t.mjs +8 -0
  69. package/dist/runtime/composables/updateObject.d.ts +2 -0
  70. package/dist/runtime/composables/updateObject.mjs +10 -0
  71. package/dist/runtime/composables/useLight.d.ts +7 -0
  72. package/dist/runtime/composables/useLight.mjs +17 -0
  73. package/dist/runtime/composables/viewAs.d.ts +1 -0
  74. package/dist/runtime/composables/viewAs.mjs +15 -0
  75. package/dist/runtime/locales/en.json +14 -0
  76. package/dist/runtime/locales/zh-hk.json +140 -0
  77. package/dist/runtime/pages/EventLog/_eventlog_id/view.vue +21 -0
  78. package/dist/runtime/pages/EventLog/index.vue +56 -0
  79. package/dist/runtime/pages/FileManager/index.vue +5 -0
  80. package/dist/runtime/pages/MailLog/index.vue +48 -0
  81. package/dist/runtime/pages/Permission/add.vue +47 -0
  82. package/dist/runtime/pages/Permission/all.vue +85 -0
  83. package/dist/runtime/pages/Permission/index.vue +26 -0
  84. package/dist/runtime/pages/Role/add.vue +28 -0
  85. package/dist/runtime/pages/Role/index.vue +51 -0
  86. package/dist/runtime/pages/System/database/backup.vue +5 -0
  87. package/dist/runtime/pages/System/database/table.vue +19 -0
  88. package/dist/runtime/pages/System/index.vue +8 -0
  89. package/dist/runtime/pages/System/mailtest.vue +22 -0
  90. package/dist/runtime/pages/System/package.vue +8 -0
  91. package/dist/runtime/pages/System/phpinfo.vue +8 -0
  92. package/dist/runtime/pages/System/setting.vue +68 -0
  93. package/dist/runtime/pages/System/view_as.vue +56 -0
  94. package/dist/runtime/pages/User/_user_id/change-password.vue +49 -0
  95. package/dist/runtime/pages/User/_user_id/edit.vue +49 -0
  96. package/dist/runtime/pages/User/_user_id/view.vue +21 -0
  97. package/dist/runtime/pages/User/add.vue +64 -0
  98. package/dist/runtime/pages/User/index.vue +47 -0
  99. package/dist/runtime/pages/User/profile.vue +25 -0
  100. package/dist/runtime/pages/User/update-password.vue +45 -0
  101. package/dist/runtime/pages/UserLog/index.vue +53 -0
  102. package/dist/runtime/pages/index.vue +9 -0
  103. package/dist/runtime/pages/logout.vue +10 -0
  104. package/dist/runtime/plugin.d.ts +4 -0
  105. package/dist/runtime/plugin.mjs +58 -0
  106. package/dist/runtime/routes.d.ts +7 -0
  107. package/dist/runtime/routes.mjs +261 -0
  108. package/dist/runtime/system_menus.d.ts +10 -0
  109. package/dist/runtime/system_menus.mjs +37 -0
  110. package/dist/types.d.ts +15 -0
  111. package/package.json +57 -0
@@ -0,0 +1,73 @@
1
+ <script setup>
2
+ const route = useRoute();
3
+ const router = useRouter();
4
+ const module = route.path.split("/")[1];
5
+
6
+ const form = ref(null);
7
+ const props = defineProps({
8
+ modelValue: {
9
+ type: Object
10
+ }
11
+ });
12
+
13
+ const que = useQuasar();
14
+ const emit = defineEmits(["save"]);
15
+ const save = async () => {
16
+ console.log(form.value)
17
+
18
+ let valid = await form.value.validate();
19
+ if (!valid) return;
20
+ if (valid) {
21
+ emit("save");
22
+ }
23
+
24
+
25
+
26
+ if (props.modelValue) {
27
+ const [module, id_name] = route.name.split("-");
28
+
29
+ if (route.params[id_name]) {//edit
30
+
31
+
32
+
33
+ try {
34
+ if (await updateObject(module, parseInt(route.params[id_name]), props.modelValue)) {
35
+ router.push(`/${module}`);
36
+ return;
37
+ }
38
+ } catch (e) {
39
+ //show error
40
+ que.dialog({
41
+ title: "Error",
42
+ message: e.message,
43
+ ok: "OK"
44
+ });
45
+
46
+ }
47
+ } else { // add
48
+ if (await addObject(module, props.modelValue)) {
49
+ router.push(`/${module}`);
50
+ return;
51
+ }
52
+ }
53
+ }
54
+ }
55
+ const onSubmit = (e) => {
56
+ e.preventDefault();
57
+ save();
58
+ }
59
+
60
+ </script>
61
+ <template>
62
+ <q-form ref="form" @submit="onSubmit">
63
+ <l-card>
64
+ <q-card-section>
65
+ <slot></slot>
66
+ </q-card-section>
67
+
68
+ <q-card-actions align="right">
69
+ <l-save-btn @click="save" />
70
+ </q-card-actions>
71
+ </l-card>
72
+ </q-form>
73
+ </template>
@@ -0,0 +1,48 @@
1
+ <script setup>
2
+
3
+ const props = defineProps({
4
+ modelValue: {
5
+ },
6
+ rules: {
7
+ type: Array,
8
+ default: () => []
9
+ },
10
+ required: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ label: {
15
+ type: String,
16
+ default: ""
17
+ },
18
+ });
19
+ const emit = defineEmits(["update:modelValue"]);
20
+
21
+ const new_rules = props.rules || [];
22
+
23
+ //has required prop (in properties)
24
+ if (props.required) {
25
+ new_rules.push(val => !!val || 'Required.');
26
+ }
27
+
28
+
29
+ const localValue = computed({
30
+ get: () => props.modelValue,
31
+ set: (value) => emit('update:modelValue', value)
32
+ });
33
+
34
+ const localLabel = computed(() => {
35
+ if (props.required && !localValue.value) {
36
+ return t(props.label);
37
+ }
38
+ return t(props.label);
39
+
40
+ });
41
+
42
+
43
+
44
+
45
+ </script>
46
+ <template>
47
+ <q-input :label="localLabel" v-model="localValue" hide-bottom-space :rules="new_rules"></q-input>
48
+ </template>
@@ -0,0 +1,14 @@
1
+ <script setup>
2
+ const props = defineProps(["label"]);
3
+
4
+ </script>
5
+ <template>
6
+ <q-item>
7
+ <q-item-section>
8
+ <q-item-label>{{ props.label }}</q-item-label>
9
+ </q-item-section>
10
+ <q-item-section side>
11
+ <q-item-label><slot></slot></q-item-label>
12
+ </q-item-section>
13
+ </q-item>
14
+ </template>
@@ -0,0 +1,24 @@
1
+ <script setup>
2
+ const props = defineProps({
3
+ to: {
4
+ type: String,
5
+ required: false
6
+ },
7
+ type: {
8
+ type: String,
9
+ required: false,
10
+ default: "primary"
11
+ },
12
+ })
13
+ const router = useRouter();
14
+ const navigate = () => {
15
+ if (props.to) {
16
+ router.push(props.to);
17
+ }
18
+ }
19
+ </script>
20
+ <template>
21
+ <el-link :type="props.type" @click="navigate">
22
+ <slot />
23
+ </el-link>
24
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <q-list bordered separator>
3
+ <slot></slot>
4
+ </q-list>
5
+ </template>
@@ -0,0 +1,128 @@
1
+ <script setup>
2
+
3
+ defineProps({
4
+ company: String,
5
+ companyLogo: String
6
+
7
+ })
8
+
9
+ const form1 = ref(null);
10
+ const data = reactive({
11
+ username: "", password: ""
12
+ });
13
+
14
+ const qua = useQuasar()
15
+ const submit = async () => {
16
+ if (await form1.value.validate()) {
17
+
18
+ try {
19
+ await login(data.username, data.password)
20
+ window.self.location = "/";
21
+ } catch (e) {
22
+ qua.notify({
23
+ message: e.message,
24
+ color: "negative",
25
+ icon: "sym_o_error",
26
+ position: "top",
27
+ timeout: 2000
28
+ });
29
+ }
30
+ }
31
+ }
32
+
33
+ const forgetPassword = async () => {
34
+
35
+ //show dialog
36
+ qua.dialog({
37
+ title: "Forget password",
38
+ message: "Please enter your email address, we will send you a code to reset your password",
39
+ prompt: {
40
+ model: "",
41
+ type: "email",
42
+ },
43
+ cancel: true
44
+ }).onOk(async email => {
45
+ if (email.length == 0) {
46
+ return;
47
+ }
48
+
49
+
50
+ if (await m("forgetPassword", { email: email })) {
51
+ qua.dialog({
52
+ title: "Enter your code",
53
+ message: "Please enter the code sent to your email, your code will expire in 10 minutes",
54
+ prompt: {
55
+ model: "",
56
+ type: "text"
57
+ },
58
+ cancel: true,
59
+ persistent: true
60
+ }).onOk(async code => {
61
+ if (code.length == 0) {
62
+ return;
63
+ }
64
+
65
+ if (await m("verifyCode", { code: code, email: email })) {
66
+ qua.dialog({
67
+ title: "Reset password",
68
+ message: "Please enter your new password",
69
+ prompt: {
70
+ model: "",
71
+ type: "password"
72
+ },
73
+ }).onOk(async password => {
74
+ if (password.length == 0) {
75
+ return;
76
+ }
77
+
78
+ if (await m("resetPassword", { password: password, email: email, code: code })) {
79
+ qua.notify({
80
+ message: "Your password has been reset successfully",
81
+ color: "positive",
82
+ icon: "sym_o_check",
83
+ position: "top",
84
+ timeout: 2000
85
+ });
86
+ }
87
+ });
88
+ } else {
89
+ qua.notify({
90
+ message: "Your code is invalid",
91
+ color: "negative",
92
+ icon: "sym_o_error",
93
+ position: "top",
94
+ timeout: 2000
95
+ });
96
+
97
+ }
98
+
99
+
100
+ });
101
+ }
102
+ });
103
+ };
104
+
105
+
106
+
107
+ </script>
108
+
109
+ <template>
110
+ <q-card bordered flat style="min-width:400px;max-width: 400px;" class="fixed-center">
111
+ <q-card-section>
112
+ <q-img :src="companyLogo" class="full-width" />
113
+ <div class="text-h6">
114
+ {{ company }}
115
+ </div>
116
+ <q-form ref="form1">
117
+ <q-input v-model="data.username" label="Username" required :rules="[v => !!v || 'Username is required']"
118
+ clearable />
119
+ <q-input v-model="data.password" label="Password" required type="password" clearable
120
+ :rules="[v => !!v || 'Password is required']" />
121
+ </q-form>
122
+ </q-card-section>
123
+ <q-card-actions>
124
+ <q-btn label="Login" outline rounded="" color="primary" icon="sym_o_login" @click="submit" />
125
+ <q-btn label="Forget password" outline rounded="" color="primary" icon="sym_o_lock_reset" @click="forgetPassword" />
126
+ </q-card-actions>
127
+ </q-card>
128
+ </template>
@@ -0,0 +1,37 @@
1
+ <script setup>
2
+
3
+ defineProps(["value","dense"])
4
+
5
+ </script>
6
+
7
+
8
+ <style scoped>
9
+ .menu-list .q-item {
10
+ border-radius: 24px 24px 24px 24px;
11
+ }
12
+
13
+ .menu-list .q-router-link--exact-active {
14
+ background: linear-gradient(118deg,
15
+ var(--q-primary),
16
+ rgba(115, 103, 240, 0.7));
17
+ color: #fff;
18
+ }
19
+ </style>
20
+
21
+ <template>
22
+ <q-expansion-item v-if="value.menus" :label="value.label" :icon="value.icon" :dense="dense">
23
+ <q-list class="q-pl-md">
24
+ <l-menu :value="menu" v-for="menu in value.menus" :dense="dense"></l-menu>
25
+ </q-list>
26
+ </q-expansion-item>
27
+ <q-list v-else class="menu-list" :dense="dense">
28
+ <q-item v-ripple :to="value.to">
29
+ <q-item-section avatar>
30
+ <q-icon :name="value.icon" />
31
+ </q-item-section>
32
+ <q-item-section>
33
+ <q-item-label v-text="value.label"></q-item-label>
34
+ </q-item-section>
35
+ </q-item>
36
+ </q-list>
37
+ </template>
@@ -0,0 +1,94 @@
1
+ <script setup>
2
+ const router = useRouter();
3
+ const route = useRoute();
4
+
5
+ const props = defineProps({
6
+ type: {
7
+ type: String,
8
+ default: "view"
9
+ },
10
+ title: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ backBtn: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ editBtn: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ deleteBtn: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ addBtn: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ });
31
+
32
+ let showToolbar = false;
33
+ let showBackBtn = false;
34
+ let showEditBtn = false;
35
+ let showAddBtn = false;
36
+ let showDeleteBtn = false;
37
+
38
+
39
+ if (props.type == "edit") {
40
+ showToolbar = true
41
+ showBackBtn = true
42
+ }
43
+
44
+ if (props.type == "add") {
45
+ showToolbar = true
46
+ showBackBtn = true
47
+ }
48
+
49
+ if (props.type == "view") {
50
+ showToolbar = true
51
+ showBackBtn = true
52
+ }
53
+
54
+ if (props.editBtn) {
55
+ showToolbar = true
56
+ showEditBtn = true
57
+ }
58
+
59
+ if (props.deleteBtn) {
60
+ showToolbar = true
61
+ showDeleteBtn = true
62
+ }
63
+
64
+ if(props.addBtn){
65
+ showToolbar = true
66
+ showAddBtn = true
67
+ }
68
+
69
+ const title = props.title || route.path.split("/")[1];
70
+
71
+
72
+ const module = route.path.split("/")[1];
73
+ const onDelete = async () => {
74
+ if (await removeObject(module, route.params.id)) {
75
+ router.push(`/${module}`);
76
+ }
77
+ }
78
+ </script>
79
+
80
+ <template>
81
+ <q-page padding>
82
+ <q-toolbar v-if="showToolbar">
83
+ <l-back-btn v-if="showBackBtn" />
84
+ <l-add-btn v-if="showAddBtn" />
85
+ <l-edit-btn v-if="showEditBtn" />
86
+ <l-delete-btn v-if="showDeleteBtn" @submit="onDelete" />
87
+
88
+ <slot name="header"></slot>
89
+ <q-toolbar-title>{{ title }}</q-toolbar-title>
90
+ </q-toolbar>
91
+
92
+ <slot></slot>
93
+ </q-page>
94
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="row q-col-gutter-md">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <q-btn color="primary" flat rounded icon="sym_o_save" label="Save" />
3
+ </template>
@@ -0,0 +1,77 @@
1
+ <script setup>
2
+ import { isNumber } from 'element-plus/es/utils';
3
+
4
+
5
+ const props = defineProps({
6
+
7
+ rules: {
8
+ type: Array,
9
+ default: () => []
10
+ },
11
+ required: {
12
+ type: Boolean,
13
+ default: false
14
+ },
15
+ options: {
16
+ type: Array,
17
+ default: () => []
18
+ },
19
+ optionLabel: {
20
+ type: String,
21
+ default: "label"
22
+ },
23
+ label: {
24
+ type: String,
25
+ default: ""
26
+ },
27
+ })
28
+
29
+
30
+
31
+ if (props.required) {
32
+ props.rules.push((val) => {
33
+ if(isNumber(val)){
34
+ return;
35
+ }
36
+
37
+ return !!val || 'Required.'
38
+ });
39
+ }
40
+
41
+ let select_options = ref(props.options);
42
+
43
+ const filterFn = (val, update, abort) => {
44
+
45
+ if (val === "") {
46
+ update(() => {
47
+ select_options.value = props.options
48
+ });
49
+ return;
50
+ }
51
+
52
+ update(() => {
53
+
54
+ const needle = val.toLowerCase();
55
+
56
+ select_options.value = props.options.filter(v => v[props.optionLabel].toLowerCase().indexOf(needle) > -1);
57
+
58
+
59
+
60
+
61
+ })
62
+ }
63
+
64
+
65
+ const localLabel = computed(() => {
66
+ return t(props.label);
67
+ });
68
+
69
+ const clearable = computed(() => {
70
+ return !props.required;
71
+ });
72
+
73
+ </script>
74
+ <template>
75
+ <q-select :label="localLabel" emit-value map-options :options="select_options" @filter="filterFn"
76
+ :option-label="optionLabel" hide-bottom-space :rules="rules" :clearable="clearable" />
77
+ </template>