@hostlink/nuxt-light 0.0.23 → 0.0.25

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "0.0.23"
4
+ "version": "0.0.25"
5
5
  }
@@ -11,12 +11,12 @@ const props = defineProps({
11
11
  }
12
12
  });
13
13
 
14
- let app = await q("app", ["menus", "viewAsMode"]);
15
- let my = await q("my", ["styles"]);
14
+ let app = await q("app", ["menus", "viewAsMode", "languages"]);
15
+ let my = await q("my", ["styles", "language"]);
16
16
  const menus = ref(app.menus)
17
17
 
18
18
  const i18n = useI18n();
19
- i18n.locale = 'zh-hk';
19
+ i18n.locale = my.language || 'en';
20
20
 
21
21
  const user = ref(await getCurrentUser());
22
22
 
@@ -79,20 +79,11 @@ const menuDark = computed(() => {
79
79
  return false
80
80
  })
81
81
 
82
- const languages = [
83
- {
84
- name: 'English',
85
- value: 'en'
86
- },
87
- {
88
- name: '中文',
89
- value: 'zh-hk'
90
- }
91
- ]
82
+ const languages = app.languages;
92
83
 
93
- const onChangeLocale = (locale) => {
84
+ const onChangeLocale = async (locale) => {
94
85
 
95
- localStorage.setItem('locale', locale);
86
+ await m("updateMyLanguage", { name: locale })
96
87
  window.location.reload();
97
88
  }
98
89
 
@@ -142,7 +133,7 @@ const exitViewAs = async () => {
142
133
 
143
134
  <q-space />
144
135
 
145
- <q-btn v-if="languages.length > 1" round flat icon="language">
136
+ <q-btn v-if="languages.length > 1" rounded flat icon="language" :label="my.language">
146
137
  <q-menu>
147
138
  <q-list>
148
139
  <q-item v-for="language in languages" :key="language.value" v-close-popup clickable
@@ -1,7 +1,12 @@
1
1
  <script setup>
2
2
  import { ref } from "vue";
3
3
  import { q, f } from '../';
4
- const props = defineProps(["permission"]);
4
+ import { useI18n } from "vue-i18n"
5
+ const i18n = useI18n()
6
+
7
+ const props = defineProps(["permission", "label"]);
8
+
9
+ const label = i18n.t(props.label);
5
10
 
6
11
  const granted = ref(false);
7
12
  if (props.permission) {
@@ -14,9 +19,11 @@ if (props.permission) {
14
19
  granted.value = true;
15
20
  }
16
21
 
22
+
23
+
17
24
  </script>
18
25
  <template>
19
- <q-btn rounded outline color="primary" v-if="granted">
26
+ <q-btn rounded outline color="primary" v-if="granted" :label="label">
20
27
 
21
28
  <slot></slot>
22
29
  </q-btn>
@@ -5,6 +5,7 @@ import { ref, watch, computed } from 'vue';
5
5
  import { useQuasar } from 'quasar';
6
6
  import { q } from '../';
7
7
 
8
+ const i18n = useI18n();
8
9
  const quasar = useQuasar();
9
10
  const emit = defineEmits(["input", "close"]);
10
11
 
@@ -27,7 +28,6 @@ defineProps({
27
28
  const loading = ref(false);
28
29
  const folderTree = ref(null);
29
30
 
30
- let i18n = useI18n();
31
31
  const pagination = {
32
32
  rowsPerPage: 0,
33
33
  "rows-per-page-options": [0],
@@ -410,7 +410,7 @@ const reloadStorage = async () => {
410
410
  <q-btn flat round @click="toggleLeftDrawer" aria-label="Menu" icon="menu" class="q-mr-sm" />
411
411
 
412
412
  <q-toolbar-title v-if="$q.screen.gt.xs" shrink class="row items-center no-wrap">
413
- <span class="q-ml-sm">{{ $t('File manager') }}</span>
413
+ <span class="q-ml-sm">{{ $t('File Manager') }}</span>
414
414
  </q-toolbar-title>
415
415
 
416
416
  <div>
@@ -33,6 +33,7 @@ const save = async () => {
33
33
 
34
34
  if (props.modelValue) {
35
35
  const [module, id_name] = route.name.split("-");
36
+
36
37
 
37
38
  if (route.params[id_name]) {//edit
38
39
 
@@ -1,4 +1,6 @@
1
1
  <script setup>
2
+ import { useI18n } from 'vue-i18n';
3
+ const i18n = useI18n();
2
4
 
3
5
  defineProps(["value", "dense"])
4
6
 
@@ -19,7 +21,7 @@ defineProps(["value", "dense"])
19
21
  </style>
20
22
 
21
23
  <template>
22
- <q-expansion-item v-if="value.children?.length > 0" :label="value.label" :icon="value.icon" :dense="dense">
24
+ <q-expansion-item v-if="value.children?.length > 0" :label="i18n.t(value.label)" :icon="value.icon" :dense="dense">
23
25
  <q-list class="q-pl-md">
24
26
  <l-menu :value="menu" v-for="menu in value.children" :dense="dense"></l-menu>
25
27
  </q-list>
@@ -30,7 +32,7 @@ defineProps(["value", "dense"])
30
32
  <q-icon :name="value.icon" />
31
33
  </q-item-section>
32
34
  <q-item-section>
33
- <q-item-label v-text="value.label"></q-item-label>
35
+ <q-item-label v-text="i18n.t(value.label)"></q-item-label>
34
36
  </q-item-section>
35
37
  </q-item>
36
38
  </q-list>
@@ -1,6 +1,9 @@
1
1
  <script setup>
2
2
  import { useRouter, useRoute } from "vue-router"
3
3
  import { removeObject, getID } from '../'
4
+ import { useI18n } from 'vue-i18n';
5
+
6
+ const i18n = useI18n();
4
7
  const router = useRouter();
5
8
  const route = useRoute();
6
9
 
@@ -68,7 +71,11 @@ if (props.addBtn) {
68
71
  showAddBtn = true
69
72
  }
70
73
 
71
- const title = props.title || route.path.split("/")[1];
74
+ //const title = props.title || route.path.split("/")[1];
75
+
76
+ //title split by Capital letter
77
+ const title = props.title || route.path.split("/")[1].split(/(?=[A-Z])/).join(" ");
78
+
72
79
 
73
80
 
74
81
  const module = route.path.split("/")[1];
@@ -89,7 +96,7 @@ const onDelete = async () => {
89
96
  <l-delete-btn v-if="showDeleteBtn" @submit="onDelete" />
90
97
 
91
98
  <slot name="header"></slot>
92
- <q-toolbar-title>{{ title }}</q-toolbar-title>
99
+ <q-toolbar-title>{{ i18n.t(title) }}</q-toolbar-title>
93
100
  </q-toolbar>
94
101
 
95
102
  <slot></slot>
@@ -1,8 +1,19 @@
1
1
  import { Dialog } from "quasar";
2
2
  import m from "./m.mjs";
3
+ import { VariableType } from "json-to-graphql-query";
3
4
  export default async (name, data) => {
4
5
  try {
5
- return await m(`add${name}`, { data });
6
+ const variables = {};
7
+ Object.entries(data).forEach(([key, value]) => {
8
+ if (value instanceof File) {
9
+ variables[key] = {
10
+ type: "Upload!",
11
+ value
12
+ };
13
+ data[key] = new VariableType(key);
14
+ }
15
+ });
16
+ return await m(`add${name}`, { data }, [{ __variables: variables }]);
6
17
  } catch (e) {
7
18
  Dialog.create({
8
19
  title: "Error",
@@ -1 +1 @@
1
- export default function (operation: string, args: any, fields?: never[]): Promise<any>;
1
+ export default function (operation: string, args: any, fields?: any): Promise<any>;
@@ -40,7 +40,7 @@ export default async function(operation, args, fields = []) {
40
40
  }));
41
41
  fd.append("map", JSON.stringify(map));
42
42
  for (let i = 0; i < map_values.length; i++) {
43
- fd.append(i, map_values[i]);
43
+ fd.append(i.toString(), map_values[i]);
44
44
  }
45
45
  data = (await service.post("/api/", fd)).data;
46
46
  } else {
@@ -1,8 +1,19 @@
1
+ import { VariableType } from "json-to-graphql-query";
1
2
  import m from "./m.mjs";
2
3
  import { Dialog } from "quasar";
3
4
  export default async (name, id, data) => {
4
5
  try {
5
- return await m(`update${name}`, { id, data });
6
+ const variables = {};
7
+ Object.entries(data).forEach(([key, value]) => {
8
+ if (value instanceof File) {
9
+ variables[key] = {
10
+ type: "Upload!",
11
+ value
12
+ };
13
+ data[key] = new VariableType(key);
14
+ }
15
+ });
16
+ return await m(`update${name}`, { id, data }, [{ __variables: variables }]);
6
17
  } catch (e) {
7
18
  Dialog.create({
8
19
  title: "Error",
@@ -136,5 +136,14 @@
136
136
  "Restore": "還原",
137
137
  "restore": "還原",
138
138
  "Content": "內容",
139
- "Download": "下載"
139
+ "Download": "下載",
140
+ "File Manager": "文件管理器",
141
+ "User log": "使用者紀錄",
142
+ "Event log": "事件紀錄",
143
+ "Mail log": "郵件紀錄",
144
+ "PHPInfo": "PHP資訊",
145
+ "Menu": "選單",
146
+ "New": "新增",
147
+ "Server": "伺服器",
148
+ "Remove": "移除"
140
149
  }
@@ -156,18 +156,22 @@ const onMoveToRoot = () => {
156
156
  }
157
157
 
158
158
  const getParentNode = (node) => {
159
- if (!node.parent) return menus.value;
159
+ if (!node.parent) return {
160
+ children: menus.value
161
+ };
160
162
  return tree1.value.getNodeByKey(node.parent);
161
163
  }
162
164
 
163
165
  const onMoveUp = (node) => {
164
166
  const parent = getParentNode(node);
167
+
165
168
  const index = parent.children.findIndex((item) => item.uuid === node.uuid);
166
169
  if (index > 0) {
167
170
  const temp = parent.children[index - 1];
168
171
  parent.children[index - 1] = node;
169
172
  parent.children[index] = temp;
170
173
  }
174
+
171
175
  }
172
176
 
173
177
  const onMoveDown = (node) => {
@@ -216,10 +220,10 @@ const onAddChildMenu = (node, type) => {
216
220
  <q-splitter v-model="splitterModel" style="height:680px">
217
221
  <template #before>
218
222
  <q-card-section>
219
- <q-btn outline rounded color="primary" @click="onAdd" label="Add" icon="sym_o_add" />
220
- <q-btn outline rounded color="primary" @click="onReload" label="Reload" icon="sym_o_refresh" />
223
+ <l-btn @click="onAdd" label="Add" icon="sym_o_add" />
224
+ <l-btn @click="onReload" label="Reload" icon="sym_o_refresh" />
221
225
 
222
- <q-btn outline rounded color="primary" @click="onSave" label="Save" icon="sym_o_save" />
226
+ <l-btn @click="onSave" label="Save" icon="sym_o_save" />
223
227
  </q-card-section>
224
228
 
225
229
  <q-tree :nodes="menus" selected-color="primary" default-expand-all v-model:selected="selected"
@@ -229,18 +233,18 @@ const onAddChildMenu = (node, type) => {
229
233
  <template #after v-if="selected">
230
234
 
231
235
  <q-card-section>
232
- <q-btn outline rounded color="primary" @click="onRemove(selectedNode)" label="Remove"
236
+ <l-btn outline rounded color="primary" @click="onRemove(selectedNode)" label="Remove"
233
237
  icon="sym_o_remove" />
234
- <q-btn outline rounded color="primary" @click="onAddChild(selectedNode)" label="Add Child"
238
+ <l-btn outline rounded color="primary" @click="onAddChild(selectedNode)" label="Add Child"
235
239
  icon="sym_o_add" />
236
240
 
237
- <q-btn outline rounded color="primary" @click="onMove(selectedNode)" label="Move"
241
+ <l-btn outline rounded color="primary" @click="onMove(selectedNode)" label="Move"
238
242
  icon="sym_o_move" />
239
243
 
240
- <q-btn outline rounded color="primary" @click="onMoveUp(selectedNode)" label="Up"
244
+ <l-btn outline rounded color="primary" @click="onMoveUp(selectedNode)" label="Up"
241
245
  icon="sym_o_arrow_upward" />
242
246
 
243
- <q-btn outline rounded color="primary" @click="onMoveDown(selectedNode)" label="Down"
247
+ <l-btn outline rounded color="primary" @click="onMoveDown(selectedNode)" label="Down"
244
248
  icon="sym_o_arrow_downward" />
245
249
 
246
250
 
@@ -0,0 +1,23 @@
1
+ <script setup>
2
+ import { reactive } from 'vue'
3
+ import { m } from "../../"
4
+ const obj = reactive({
5
+ input1: 'test'
6
+ })
7
+ const onSave = async () => {
8
+ console.log(obj)
9
+
10
+ await m("testSystem", {
11
+ data: obj
12
+ })
13
+
14
+ }
15
+ </script>
16
+ <template>
17
+ <l-page>
18
+ <l-form v-model="obj">
19
+ <l-input v-model="obj.input1" label="Input1" />
20
+ <q-file v-model="obj.file" label="File" accept=".txt" />
21
+ </l-form>
22
+ </l-page>
23
+ </template>
@@ -0,0 +1,31 @@
1
+ <script setup>
2
+ import { ref, computed, inject, reactive } from 'vue';
3
+ import { m, q } from '../../'
4
+ const app = await q("app", ["languages"])
5
+
6
+ const splitterModel = ref(38)
7
+
8
+ const obj = reactive({
9
+ name: ""
10
+ })
11
+ </script>
12
+ <template>
13
+ <l-page>
14
+ <l-card>
15
+ <q-splitter v-model="splitterModel" style="height:680px">
16
+ <template #before>
17
+ <q-card-section>
18
+ comming soon
19
+ </q-card-section>
20
+ </template>
21
+ <template #after>
22
+ <l-form :bordered="false">
23
+ <l-input label="Name" required v-model="obj.name"></l-input>
24
+ <l-input v-for="language in app.languages" :label="language.name"
25
+ v-model="obj[language.value]"></l-input>
26
+ </l-form>
27
+ </template>
28
+ </q-splitter>
29
+ </l-card>
30
+ </l-page>
31
+ </template>
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { useQuasar } from 'quasar';
3
- import { useRouter } from 'vue-router';
4
- import { router } from "vue-router"
3
+ //import { useRouter, router } from 'vue-router';
4
+
5
5
 
6
6
  const obj = reactive({
7
7
  old_password: "",
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { q } from '../'
3
- const my = await q("my", ["name", "email"]);
3
+ const my = await q("my", ["name", "first_name", "last_name", "email"]);
4
4
  </script>
5
5
  <template>
6
6
  <q-page padding>
@@ -32,6 +32,11 @@ function System_index() {
32
32
  /* webpackChunkName: "System-index" */ './pages/System/index.vue'
33
33
  )
34
34
  }
35
+ function Translate_index() {
36
+ return import(
37
+ /* webpackChunkName: "Translate-index" */ './pages/Translate/index.vue'
38
+ )
39
+ }
35
40
  function User_index() {
36
41
  return import(/* webpackChunkName: "User-index" */ './pages/User/index.vue')
37
42
  }
@@ -73,6 +78,9 @@ function System_setting() {
73
78
  /* webpackChunkName: "System-setting" */ './pages/System/setting.vue'
74
79
  )
75
80
  }
81
+ function System_test() {
82
+ return import(/* webpackChunkName: "System-test" */ './pages/System/test.vue')
83
+ }
76
84
  function System_view_as() {
77
85
  return import(
78
86
  /* webpackChunkName: "System-view_as" */ './pages/System/view_as.vue'
@@ -203,6 +211,11 @@ export default [
203
211
  path: '/System',
204
212
  component: System_index,
205
213
  },
214
+ {
215
+ name: 'Translate',
216
+ path: '/Translate',
217
+ component: Translate_index,
218
+ },
206
219
  {
207
220
  name: 'User',
208
221
  path: '/User',
@@ -248,6 +261,11 @@ export default [
248
261
  path: '/System/setting',
249
262
  component: System_setting,
250
263
  },
264
+ {
265
+ name: 'System-test',
266
+ path: '/System/test',
267
+ component: System_test,
268
+ },
251
269
  {
252
270
  name: 'System-view_as',
253
271
  path: '/System/view_as',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -30,6 +30,7 @@
30
30
  "route-gen": "node route-generate.mjs"
31
31
  },
32
32
  "dependencies": {
33
+ "@formkit/inputs": "^1.1.0",
33
34
  "@nuxt/kit": "^3.7.0",
34
35
  "@quasar/extras": "^1.16.6",
35
36
  "axios": "^1.5.0",