@hostlink/nuxt-light 0.0.53 → 0.0.55
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 +25 -25
- package/dist/module.json +1 -1
- package/dist/runtime/components/l-app-main.vue +12 -7
- package/dist/runtime/components/l-statistic.vue +1 -1
- package/dist/runtime/lib/m.mjs +0 -2
- package/dist/runtime/lib/q.mjs +7 -3
- package/dist/runtime/pages/Translate/index.vue +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,57 +2,57 @@
|
|
|
2
2
|
Get your module up and running quickly.
|
|
3
3
|
|
|
4
4
|
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
-
- Name:
|
|
6
|
-
- Package name:
|
|
5
|
+
- Name: nuxt-light
|
|
6
|
+
- Package name: nuxt-light
|
|
7
7
|
- Description: My new Nuxt module
|
|
8
8
|
-->
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# nuxt-light
|
|
11
11
|
|
|
12
12
|
[![npm version][npm-version-src]][npm-version-href]
|
|
13
13
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
14
|
[![License][license-src]][license-href]
|
|
15
15
|
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
This is a Hostlink nuxt-light framework for Nuxt.
|
|
18
18
|
|
|
19
19
|
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
-
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/
|
|
20
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-light?file=playground%2Fapp.vue) -->
|
|
21
21
|
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
22
|
|
|
23
23
|
## Features
|
|
24
24
|
|
|
25
25
|
<!-- Highlight some of the features your module provide here -->
|
|
26
|
-
-
|
|
27
|
-
- 🚠 Bar
|
|
28
|
-
- 🌲 Baz
|
|
26
|
+
- HostLink nuxt-light framework
|
|
29
27
|
|
|
30
28
|
## Quick Setup
|
|
31
29
|
|
|
32
|
-
1. Add `
|
|
30
|
+
1. Add `nuxt-light` dependency to your project
|
|
33
31
|
|
|
34
32
|
```bash
|
|
35
|
-
# Using pnpm
|
|
36
|
-
pnpm add -D my-module
|
|
37
|
-
|
|
38
|
-
# Using yarn
|
|
39
|
-
yarn add --dev my-module
|
|
40
|
-
|
|
41
33
|
# Using npm
|
|
42
|
-
npm install --save-dev
|
|
34
|
+
npm install --save-dev nuxt-light
|
|
43
35
|
```
|
|
44
36
|
|
|
45
|
-
2. Add
|
|
37
|
+
2. Add `@hostlink/nuxt-light` to the `modules` section of `nuxt.config.ts`
|
|
46
38
|
|
|
47
39
|
```js
|
|
40
|
+
import pkg from './package.json'
|
|
48
41
|
export default defineNuxtConfig({
|
|
42
|
+
runtimeConfig: {
|
|
43
|
+
public: {
|
|
44
|
+
//apiBase: 'your-api-base-url'
|
|
45
|
+
appVersion: pkg.version
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
ssr:false,
|
|
49
49
|
modules: [
|
|
50
|
-
'
|
|
50
|
+
'@hostlink/nuxt-light'
|
|
51
51
|
]
|
|
52
52
|
})
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
That's it! You can now use
|
|
55
|
+
That's it! You can now use nuxt-light in your Nuxt app ✨
|
|
56
56
|
|
|
57
57
|
## Development
|
|
58
58
|
|
|
@@ -81,14 +81,14 @@ npm run release
|
|
|
81
81
|
```
|
|
82
82
|
|
|
83
83
|
<!-- Badges -->
|
|
84
|
-
[npm-version-src]: https://img.shields.io/npm/v/
|
|
85
|
-
[npm-version-href]: https://npmjs.com/package/
|
|
84
|
+
[npm-version-src]: https://img.shields.io/npm/v/@hostlink/nuxt-light/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
85
|
+
[npm-version-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
86
86
|
|
|
87
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/
|
|
88
|
-
[npm-downloads-href]: https://npmjs.com/package/
|
|
87
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@hostlink/nuxt-light.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
88
|
+
[npm-downloads-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
89
89
|
|
|
90
|
-
[license-src]: https://img.shields.io/npm/l/
|
|
91
|
-
[license-href]: https://npmjs.com/package/
|
|
90
|
+
[license-src]: https://img.shields.io/npm/l/@hostlink/nuxt-light.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
91
|
+
[license-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
92
92
|
|
|
93
93
|
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
94
94
|
[nuxt-href]: https://nuxt.com
|
package/dist/module.json
CHANGED
|
@@ -3,6 +3,13 @@ import { useQuasar } from 'quasar';
|
|
|
3
3
|
import { useI18n } from 'vue-i18n';
|
|
4
4
|
import { useLight, q, getCurrentUser, m, f } from '../';
|
|
5
5
|
import { ref, computed, reactive, provide, watch } from 'vue';
|
|
6
|
+
import { useRuntimeConfig } from 'nuxt/app';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const config = useRuntimeConfig();
|
|
10
|
+
|
|
11
|
+
const appVersion = config.public.appVersion ?? '0.0.1';
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
const quasar = useQuasar();
|
|
8
15
|
quasar.dark.set(false);
|
|
@@ -15,11 +22,10 @@ const props = defineProps({
|
|
|
15
22
|
});
|
|
16
23
|
|
|
17
24
|
const tt = await q({
|
|
18
|
-
app: ["menus", "viewAsMode", "languages"],
|
|
25
|
+
app: ["menus", "viewAsMode", "languages", { i18nMessages: ["name", "value"] }],
|
|
19
26
|
my: ["styles", "language", f('granted_storage:granted', { right: "system.storage" }, [])],
|
|
20
27
|
})
|
|
21
28
|
|
|
22
|
-
const allTranslate = ref(await q("allTranslate", []))
|
|
23
29
|
|
|
24
30
|
let app = tt.app
|
|
25
31
|
let my = tt.my
|
|
@@ -35,15 +41,14 @@ const menus = ref(app.menus)
|
|
|
35
41
|
const i18n = useI18n();
|
|
36
42
|
i18n.locale = my.language || 'en';
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
let messages = i18n.messages.value[i18n.locale];
|
|
39
45
|
|
|
40
|
-
for (
|
|
41
|
-
messages[
|
|
46
|
+
for (let t of app.i18nMessages) {
|
|
47
|
+
messages[t.name] = t.value;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
i18n.setLocaleMessage(i18n.locale, messages);
|
|
45
51
|
|
|
46
|
-
|
|
47
52
|
const user = ref(await getCurrentUser());
|
|
48
53
|
|
|
49
54
|
const leftDrawerOpen = ref(false)
|
|
@@ -338,7 +343,7 @@ const storageUsagePercent = computed(() => {
|
|
|
338
343
|
<q-footer class="bg-white text-grey" bordered>
|
|
339
344
|
<q-item>
|
|
340
345
|
<q-item-section>
|
|
341
|
-
{{ company }} {{
|
|
346
|
+
{{ company }} {{ appVersion }} - Copyright 2023 HostLink(HK). Build {{ light.getVersion() }}
|
|
342
347
|
</q-item-section>
|
|
343
348
|
</q-item>
|
|
344
349
|
</q-footer>
|
package/dist/runtime/lib/m.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
3
|
-
import { useRuntimeConfig } from "nuxt/app";
|
|
4
3
|
import { getApiBase } from "./index.mjs";
|
|
5
4
|
export default async function(operation, args, fields = []) {
|
|
6
|
-
const config = useRuntimeConfig();
|
|
7
5
|
const mutation = {
|
|
8
6
|
mutation: {}
|
|
9
7
|
};
|
package/dist/runtime/lib/q.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import f from "./f.mjs";
|
|
3
3
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
4
|
-
import { useRuntimeConfig } from "nuxt/app";
|
|
5
4
|
import { getApiBase } from "./index.mjs";
|
|
6
5
|
const mapping = function(obj) {
|
|
7
6
|
let q = {};
|
|
@@ -9,7 +8,13 @@ const mapping = function(obj) {
|
|
|
9
8
|
if (value instanceof Array) {
|
|
10
9
|
q[key] = {};
|
|
11
10
|
value.forEach((subField) => {
|
|
12
|
-
|
|
11
|
+
if (subField instanceof Object) {
|
|
12
|
+
Object.entries(mapping(subField)).forEach(([subKey, subValue]) => {
|
|
13
|
+
q[key][subKey] = subValue;
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
q[key][subField] = true;
|
|
17
|
+
}
|
|
13
18
|
});
|
|
14
19
|
} else {
|
|
15
20
|
q[key] = mapping(value);
|
|
@@ -18,7 +23,6 @@ const mapping = function(obj) {
|
|
|
18
23
|
return q;
|
|
19
24
|
};
|
|
20
25
|
export default async function(operation, args, fields = []) {
|
|
21
|
-
const config = useRuntimeConfig();
|
|
22
26
|
const service = axios.create({
|
|
23
27
|
withCredentials: true
|
|
24
28
|
});
|
|
@@ -26,6 +26,13 @@ const onSave = async () => {
|
|
|
26
26
|
|
|
27
27
|
}
|
|
28
28
|
})
|
|
29
|
+
|
|
30
|
+
Notify.create({
|
|
31
|
+
message: "Save success",
|
|
32
|
+
color: "positive",
|
|
33
|
+
icon: "check"
|
|
34
|
+
})
|
|
35
|
+
|
|
29
36
|
//reload
|
|
30
37
|
all.value = await q("allTranslate", [])
|
|
31
38
|
}
|
|
@@ -40,7 +47,8 @@ const columns = [
|
|
|
40
47
|
label: "Name",
|
|
41
48
|
name: "name",
|
|
42
49
|
field: "name",
|
|
43
|
-
align: "left"
|
|
50
|
+
align: "left",
|
|
51
|
+
sortable: true,
|
|
44
52
|
}];
|
|
45
53
|
|
|
46
54
|
for (const language of app.languages) {
|