@hostlink/nuxt-light 1.19.1 → 1.19.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "light",
3
3
  "configKey": "light",
4
- "version": "1.19.1",
4
+ "version": "1.19.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -3,7 +3,16 @@ import { q, m } from '#imports'
3
3
  import { useQuasar } from 'quasar'
4
4
  const $q = useQuasar()
5
5
 
6
- const modelValue = defineModel<{
6
+
7
+ const emits = defineEmits(["submit"])
8
+
9
+ const { authorizationUrl } = await q({
10
+ authorizationUrl: true
11
+ })
12
+
13
+ console.log(authorizationUrl);
14
+
15
+ withDefaults(defineProps<{
7
16
  mail_driver: string,
8
17
  mail_host: string
9
18
  mail_port: string
@@ -14,70 +23,57 @@ const modelValue = defineModel<{
14
23
  mail_from_name: string
15
24
  mail_reply_to: string
16
25
  mail_reply_to_name: string
17
- }>()
26
+ }>(), {
27
+ mail_driver: "mail",
28
+ })
18
29
 
19
- if (!modelValue.value.mail_driver) {
20
- modelValue.value.mail_driver = "mail"
21
- }
22
-
23
- const onSubmit = async (d) => {
24
- let data = [];
25
- Object.keys(d).forEach((key) => {
26
- if (d[key] === undefined) {
27
- d[key] = ""
28
- }
29
-
30
- data.push({
31
- name: key,
32
- value: d[key]
33
- })
34
- })
35
- await m("updateAppConfigs", { data })
36
- //update the props.data
37
- Object.keys(d).forEach((key) => {
38
- modelValue.value[key] = d[key]
39
- })
40
- $q.notify({ message: "Settings saved", color: "positive" })
30
+ const onLoginGmail = () => {
31
+ let state = encodeURIComponent(window.self.location.origin + window.self.location.pathname + "?mail_driver=gmail");
32
+ let url = "https://accounts.google.com/o/oauth2/v2/auth?scope=openid%20email%20profile%20https%3A%2F%2Fmail.google.com%2F&access_type=offline&state=" + state + "&response_type=code&redirect_uri=https%3A%2F%2Fraymond4.hostlink.com.hk%2Flight%2Fgmail_notification%2Fredirect.php&client_id=790028313082-8qqnoqvkqtqssufto11k6qe6pnievcpv.apps.googleusercontent.com&prompt=consent";
33
+ window.open(url, "_blank");
41
34
  }
42
35
 
43
36
  </script>
44
37
  <template>
45
- <FormKit type="l-form" :bordered="false" :value="{
46
- mail_driver: modelValue.mail_driver,
47
- mail_host: modelValue.mail_host,
48
- mail_port: modelValue.mail_port,
49
- mail_username: modelValue.mail_username,
50
- mail_password: modelValue.mail_password,
51
- mail_encryption: modelValue.mail_encryption,
52
- mail_from: modelValue.mail_from,
53
- mail_from_name: modelValue.mail_from_name,
54
- mail_reply_to: modelValue.mail_reply_to,
55
- mail_reply_to_name: modelValue.mail_reply_to_name,
56
- }" @submit="onSubmit" #default="{ value }">
38
+ <FormKit type="l-form" :bordered="false" :value="$props" @submit="$emit('submit', $event)" #default="{ value }">
39
+ {{ authorizationUrl }}
57
40
 
58
41
  <FormKit type="l-select" label="Mail Driver" name="mail_driver" :options="[{
59
42
  label: 'Mail', value: 'mail'
60
43
  }, {
61
44
  label: 'SMTP', value: 'smtp'
62
- }]" validation="required"></FormKit>
63
-
64
- <FormKit type="l-input" label="From Address" name="mail_from" validation="email"></FormKit>
65
- <FormKit type="l-input" label="From Name" name="mail_from_name"></FormKit>
66
- <FormKit type="l-input" label="Reply To Address" name="mail_reply_to" validation="email">
67
- </FormKit>
68
- <FormKit type="l-input" label="Reply To Name" name="mail_reply_to_name"></FormKit>
69
-
70
- <template v-if="value.mail_driver === 'smtp'">
71
- <FormKit type="l-input" label="SMTP Host" name="mail_host"></FormKit>
72
- <FormKit type="l-input" label="SMTP Port" name="mail_port"></FormKit>
73
- <FormKit type="l-input" label="SMTP Username" name="mail_username"></FormKit>
74
- <FormKit type="l-input" label="SMTP Password" name="mail_password"></FormKit>
75
-
76
- <FormKit type="l-select" label="SMTP Encryption" name="mail_encryption" :options="[
77
- { label: 'None', value: '' },
78
- { label: 'SSL', value: 'ssl' },
79
- { label: 'TLS', value: 'tls' },
80
- ]"></FormKit>
45
+ },
46
+ {
47
+ label: 'Gmail', value: 'gmail'
48
+ }
49
+ ]" validation="required"></FormKit>
50
+
51
+ <template v-if="value.mail_driver === 'gmail'">
52
+ <l-btn label="Login" @click="onLoginGmail"></l-btn>
53
+ </template>
54
+
55
+ <template v-else>
56
+
57
+
58
+ <FormKit type="l-input" label="From Address" name="mail_from" validation="email"></FormKit>
59
+ <FormKit type="l-input" label="From Name" name="mail_from_name"></FormKit>
60
+ <FormKit type="l-input" label="Reply To Address" name="mail_reply_to" validation="email">
61
+ </FormKit>
62
+ <FormKit type="l-input" label="Reply To Name" name="mail_reply_to_name"></FormKit>
63
+
64
+ <template v-if="value.mail_driver === 'smtp'">
65
+ <FormKit type="l-input" label="SMTP Host" name="mail_host"></FormKit>
66
+ <FormKit type="l-input" label="SMTP Port" name="mail_port"></FormKit>
67
+ <FormKit type="l-input" label="SMTP Username" name="mail_username"></FormKit>
68
+ <FormKit type="l-input" label="SMTP Password" name="mail_password"></FormKit>
69
+
70
+ <FormKit type="l-select" label="SMTP Encryption" name="mail_encryption" :options="[
71
+ { label: 'None', value: '' },
72
+ { label: 'SSL', value: 'ssl' },
73
+ { label: 'TLS', value: 'tls' },
74
+ ]"></FormKit>
75
+ </template>
76
+
81
77
  </template>
82
78
 
83
79
 
@@ -28,7 +28,8 @@ export interface LDatePickerProps {
28
28
  stackLabel?: boolean
29
29
  rules?: any[],
30
30
  range?: boolean,
31
- mask?: string
31
+ mask?: string,
32
+ disable?: boolean
32
33
  }
33
34
 
34
35
  const props = withDefaults(defineProps<LDatePickerProps>(), {
@@ -41,7 +42,8 @@ const props = withDefaults(defineProps<LDatePickerProps>(), {
41
42
  square: undefined,
42
43
  stackLabel: undefined,
43
44
  mask: "YYYY-MM-DD",
44
- range: false
45
+ range: false,
46
+ disable: false
45
47
  })
46
48
 
47
49
 
@@ -59,7 +61,7 @@ const localValue = computed({
59
61
  return modelValue.value
60
62
  },
61
63
  set: (value: string) => {
62
-
64
+
63
65
 
64
66
  if (props.range) {
65
67
  //try to split
@@ -1,6 +1,10 @@
1
1
  <script setup>
2
2
 
3
3
  import { useQuasar } from 'quasar';
4
+ import { useI18n } from 'vue-i18n';
5
+
6
+
7
+ const { t } = useI18n();
4
8
 
5
9
  const props = defineProps(["to"]);
6
10
 
@@ -9,10 +13,11 @@ const emit = defineEmits(["submit"]);
9
13
  const qua = useQuasar();
10
14
  const onDelete = () => {
11
15
  qua.dialog({
12
- title: "Delete",
13
- message: "Are you sure you want to delete this record?",
16
+ title: t("Delete"),
17
+ message: t("Are you sure you want to delete this record?"),
14
18
  cancel: true,
15
- persistent: true
19
+ persistent: true,
20
+ color: "negative",
16
21
  }).onOk(async () => {
17
22
  emit("submit");
18
23
  })
@@ -1,3 +1,3 @@
1
1
  <template>
2
- <q-btn flat round dense icon="sym_o_edit" to="edit" />
2
+ <q-btn flat round icon="sym_o_edit" to="edit" />
3
3
  </template>
@@ -1,13 +1,29 @@
1
1
  <script setup lang="ts">
2
2
  import { model, q } from "#imports";
3
- const props = defineProps(['id']);
3
+ const props = defineProps({
4
+ id: String
5
+ });
6
+
7
+ const columns = model('UserLog').columns({
8
+ userlog_id: true,
9
+ login_dt: true,
10
+ last_access_time: true,
11
+ logout_dt: true,
12
+ result: true,
13
+ user_agent: true
14
+ }
15
+ );
16
+
17
+
18
+
19
+ const onRequestData = async (req) => {
20
+ req.loadObjects('UserLog', { user_id: props.id })
21
+ }
22
+
4
23
 
5
- const columns = model('UserLog').columns(["userlog_id", "login_dt", "last_access_time", "logout_dt", "result", "user_agent"]);
6
24
  </script>
7
25
  <template>
8
- <div>
9
- <l-table row-key="userlog_id" sort-by="userlog_id:desc" :columns="columns" @request-data="async (req) => {
10
- req.loadObjects('UserLog', { filters: { user_id: props.id } })
11
- }" />
12
- </div>
26
+
27
+ <l-table row-key="userlog_id" sort-by="userlog_id:desc" :columns="columns" @request-data="onRequestData" />
28
+
13
29
  </template>
@@ -15,8 +15,8 @@ const { error, errorMessage } = getErrorMessage(props.context.node);
15
15
  </script>
16
16
  <template>
17
17
 
18
- <l-checkbox v-model="value" :label="context.label" v-bind="context.attrs" :error="error"
19
- :error-message="errorMessage">
18
+ <l-checkbox v-model="value" :error="error" :error-message="errorMessage" :disable="context.disabled"
19
+ v-bind="context.attrs" :label="context.label">
20
20
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
21
21
  <slot :name="name" v-bind="props ?? {}"></slot>
22
22
  </template>
@@ -16,7 +16,7 @@ const value = computed({
16
16
  </script>
17
17
  <template>
18
18
  <l-date-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
19
- :error-message="errorMessage">
19
+ :error-message="errorMessage" :disable="context.disabled">
20
20
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
21
21
  <slot :name="name" v-bind="props ?? {}"></slot>
22
22
  </template>
@@ -2,8 +2,6 @@
2
2
  import { computed } from 'vue'
3
3
  import { getErrorMessage } from 'formkit-quasar';
4
4
 
5
-
6
-
7
5
  const props = defineProps({
8
6
  context: {
9
7
  type: Object,
@@ -49,8 +47,12 @@ const onBlur = () => {
49
47
  }
50
48
  </script>
51
49
  <template>
50
+
52
51
  <l-input v-model="value" :label="context?.label" v-bind="context?.attrs" :error="error" :type="context?.inputType"
53
- :error-message="errorMessage" @blur="onBlur">
52
+ :error-message="errorMessage" @blur="onBlur"
53
+ :disable="context.disabled"
54
+
55
+ >
54
56
 
55
57
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
56
58
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -33,7 +33,7 @@ if (required) { //no clearable
33
33
  </script>
34
34
  <template>
35
35
  <l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
36
- :clearable="clearable" :required="required">
36
+ :clearable="clearable" :required="required" :disable="context.disabled">
37
37
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
38
38
  <slot :name="name" v-bind="props ?? {}"></slot>
39
39
  </template>
@@ -1,4 +1,4 @@
1
- <script setup>
1
+ <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
 
4
4
  const props = defineProps({
@@ -10,9 +10,11 @@ const value = computed({
10
10
  set: (val) => props.context.node.input(val)
11
11
  })
12
12
 
13
-
14
13
  </script>
15
14
  <template>
16
- <q-toggle v-model="value" :label="context.label" v-bind="context.attrs">
15
+
16
+ <q-toggle v-model="value" :label="context.label" :disable="context.disabled" :color="$light.color"
17
+ v-bind="context.attrs">
18
+ <slot></slot>
17
19
  </q-toggle>
18
20
  </template>
@@ -13,6 +13,7 @@ import FileVue from "./File.vue";
13
13
  import InputXlsxVue from "./InputXlsx.vue";
14
14
  import FileUploadVue from "./FileUpload.vue";
15
15
  import EditorVue from "./Editor.vue";
16
+ import ToggleVue from "./Toggle.vue";
16
17
  export const createLightPlugin = () => {
17
18
  return (node) => {
18
19
  let type = node.props.type + "";
@@ -98,6 +99,11 @@ export const createLightPlugin = () => {
98
99
  ],
99
100
  features: [forms, disablesChildren]
100
101
  });
102
+ case "l-toggle":
103
+ return node.define({
104
+ type: "input",
105
+ component: ToggleVue
106
+ });
101
107
  }
102
108
  };
103
109
  };
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { getObject } from "#imports"
3
- const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username", "source", "target"]);
3
+ const obj = await getObject(["eventlog_id", "class", "id", "action", "created_time", "username", "source", "target", "different"]);
4
4
 
5
5
  const splitterModel = 50;
6
6
  </script>
@@ -17,7 +17,7 @@ const splitterModel = 50;
17
17
 
18
18
  </l-list>
19
19
 
20
- <q-splitter v-model="splitterModel" >
20
+ <q-splitter v-model="splitterModel">
21
21
  <template v-slot:before>
22
22
  <div class="q-pa-md">
23
23
  <div class="text-h6 q-mb-md">{{ $t('Source') }}</div>
@@ -28,12 +28,16 @@ const splitterModel = 50;
28
28
  <template v-slot:after>
29
29
  <div class="q-pa-md">
30
30
  <div class="text-h6 q-mb-md">{{ $t('Target') }}</div>
31
- <pre>{{ obj.target }}
32
- </pre>
33
-
31
+ <pre>{{ obj.target }}</pre>
34
32
  </div>
35
33
  </template>
36
34
  </q-splitter>
35
+
36
+ <q-separator />
37
+ <div class="q-pa-md">
38
+ <div class="text-h6 q-mb-md">{{ $t('Different') }}</div>
39
+ <pre>{{ obj.different }}</pre>
40
+ </div>
37
41
  </l-card>
38
42
 
39
43
  </l-page>
@@ -1,6 +1,28 @@
1
1
  <script setup>
2
2
  import { ref } from 'vue'
3
- import { q, m, useLight } from '#imports';
3
+ import { q, m, useLight, useRoute } from '#imports';
4
+ import { useQuasar } from 'quasar';
5
+ const route = useRoute()
6
+ const tab = ref('general')
7
+ const $q = useQuasar()
8
+
9
+
10
+ if (route.query.mail_driver == 'gmail' && route.query.refresh_token) {
11
+
12
+ //save the mail_driver
13
+ await m("updateAppConfigs", {
14
+ data: [
15
+ { name: 'mail_driver', value: 'gmail' },
16
+ { name: 'mail_google_refresh_token', value: route.query.refresh_token }
17
+ ]
18
+ })
19
+ tab.value = 'mail'
20
+
21
+ //remove the query string
22
+ window.history.replaceState({}, document.title, window.location.pathname);
23
+
24
+ $q.notify({ message: "Gmail account added", color: "positive" })
25
+ }
4
26
 
5
27
  const light = useLight()
6
28
 
@@ -12,7 +34,6 @@ const obj = app.config.reduce((acc, cur) => {
12
34
 
13
35
  obj.revision = obj.revision ? obj.revision.split(',') : []
14
36
 
15
- const tab = ref('general')
16
37
 
17
38
  const onSubmit = async (d) => {
18
39
  let data = [];
@@ -31,6 +52,9 @@ const onSubmit = async (d) => {
31
52
  obj[key] = d[key]
32
53
  })
33
54
  }
55
+
56
+
57
+
34
58
  </script>
35
59
  <template>
36
60
  <l-page>
@@ -50,7 +74,7 @@ const onSubmit = async (d) => {
50
74
  </template>
51
75
  <template #after>
52
76
  <l-system-setting-general v-if="tab == 'general'" v-model="obj" />
53
- <l-system-setting-mail v-if="tab == 'mail'" v-model="obj" />
77
+ <l-system-setting-mail v-if="tab == 'mail'" v-bind="obj" @submit="onSubmit" />
54
78
  <l-system-setting-security v-if="tab == 'security'" v-model="obj" />
55
79
  <l-system-setting-modules v-if="tab == 'Modules'" v-model="obj" />
56
80
  <l-system-setting-developer v-if="tab == 'developer'" v-model="obj" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.19.1",
3
+ "version": "1.19.3",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",