@hostlink/nuxt-light 0.0.115 → 0.0.117

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.115"
4
+ "version": "0.0.117"
5
5
  }
@@ -28,14 +28,23 @@ if (!props.context.onSubmit) {
28
28
  loading.value = true;
29
29
  const [module, id_name] = route.name.split("-");
30
30
 
31
+
32
+ const v = {};
33
+ //filter out undefined value from context.value
34
+ for (const [key, value] of Object.entries(props.context.value)) {
35
+ if (value !== undefined) {
36
+ v[key] = value;
37
+ }
38
+ }
39
+
31
40
  try {
32
41
  if (route.params[id_name]) {//edit
33
- if (await model(module).update(parseInt(route.params[id_name]), props.context.value)) {
42
+ if (await model(module).update(parseInt(route.params[id_name]), v)) {
34
43
  router.go(-1);
35
44
  return;
36
45
  }
37
46
  } else {
38
- if (await model(module).add(props.context.value)) {
47
+ if (await model(module).add(v)) {
39
48
  router.go(-1);
40
49
  return;
41
50
  }
@@ -65,6 +65,7 @@ export const createLightPlugin = () => {
65
65
  type: "group",
66
66
  component: FormVue,
67
67
  props: [
68
+ "actions",
68
69
  "submitLabel",
69
70
  "submit",
70
71
  "actions",
@@ -1,15 +1,13 @@
1
1
  <script setup>
2
- import { reactive } from 'vue'
3
- import { getObject } from '../../../'
4
- const obj = reactive(await getObject(["name", "value"]))
2
+ import { getObject } from '#imports'
3
+ const obj = await getObject(["name", "value"])
5
4
  </script>
6
5
 
7
6
  <template>
8
7
  <l-page>
9
- <l-form v-model="obj">
10
- <l-input label="Name" v-model="obj.name" required />
11
- <l-input label="Value" v-model="obj.value" required type="textarea" />
12
- </l-form>
13
-
8
+ <FormKit type="l-form" :value="obj">
9
+ <FormKit type="l-input" label="Name" name="name" validation="required" />
10
+ <FormKit type="l-input" label="Value" name="value" validation="required" input-type="textarea" />
11
+ </FormKit>
14
12
  </l-page>
15
13
  </template>
@@ -1,15 +1,8 @@
1
- <script setup>
2
- import { reactive } from 'vue'
3
-
4
- const obj = reactive({})
5
- </script>
6
-
7
1
  <template>
8
2
  <l-page>
9
- <l-form v-model="obj">
10
- <l-input label="Name" v-model="obj.name" required />
11
- <l-input label="Value" v-model="obj.value" required type="textarea" />
12
- </l-form>
13
-
3
+ <FormKit type="l-form">
4
+ <FormKit type="l-input" label="Name" name="name" validation="required" />
5
+ <FormKit type="l-input" label="Value" name="value" validation="required" input-type="textarea" />
6
+ </FormKit>
14
7
  </l-page>
15
8
  </template>
@@ -48,8 +48,8 @@ eventLogCols.forEach(col => {
48
48
  <template>
49
49
  <l-page title="User profile">
50
50
  <template #header>
51
- <l-btn icon="sym_o_key" to="update-password" label="Update password" />
52
- <l-btn icon="sym_o_key" to="two-factor-auth" label="Two factor auth" />
51
+ <l-btn icon="sym_o_password" to="setting/password" label="Update password" />
52
+ <l-btn icon="sym_o_key" to="setting/two-factor-auth" label="Two factor auth" />
53
53
  </template>
54
54
  <div class="q-gutter-md q-mt-md">
55
55
  <l-card>
@@ -151,11 +151,6 @@ function User_setting_two_factor_auth() {
151
151
  /* webpackChunkName: "User-setting-two-factor-auth" */ './pages/User/setting/two-factor-auth.vue'
152
152
  )
153
153
  }
154
- function User_update_password() {
155
- return import(
156
- /* webpackChunkName: "User-update-password" */ './pages/User/update-password.vue'
157
- )
158
- }
159
154
  function System_database_backup() {
160
155
  return import(
161
156
  /* webpackChunkName: "System-database-backup" */ './pages/System/database/backup.vue'
@@ -369,11 +364,6 @@ export default [
369
364
  },
370
365
  ],
371
366
  },
372
- {
373
- name: 'User-update-password',
374
- path: '/User/update-password',
375
- component: User_update_password,
376
- },
377
367
  {
378
368
  name: 'System-database-backup',
379
369
  path: '/System/database/backup',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "0.0.115",
3
+ "version": "0.0.117",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": "@hostlink/nuxt-light",
6
6
  "license": "MIT",
@@ -1,44 +0,0 @@
1
- <script setup>
2
- import { useQuasar } from 'quasar';
3
- import { updatePassword } from '@hostlink/light';
4
-
5
- const obj = reactive({
6
- old_password: "",
7
- new_password: "",
8
- confirm_password: ""
9
- })
10
-
11
- const qua = useQuasar();
12
- const router = useRouter();
13
-
14
- const onSave = async () => {
15
- if (await updatePassword(obj.old_password, obj.new_password)) {
16
- //back
17
- router.back();
18
- } else {
19
- //show error
20
- qua.notify({
21
- message: "Invalid old password",
22
- color: "negative",
23
- icon: "sym_o_error",
24
- position: "top",
25
- timeout: 2000
26
- });
27
- }
28
- }
29
-
30
- </script>
31
- <template>
32
- <l-page>
33
- <l-form @save="onSave">
34
- <l-input label="Old password" v-model="obj.old_password" type="password"
35
- :rules="[v => !!v || 'Old password is required']" />
36
- <l-input label="New password" v-model="obj.new_password" type="password"
37
- :rules="[v => !!v || 'New password is required']" />
38
- <l-input label="Confirm password" v-model="obj.confirm_password" type="password" :rules="[
39
- v => !!v || 'Confirm password is required',
40
- v => v == obj.new_password || 'Confirm password does not match'
41
- ]" />
42
- </l-form>
43
- </l-page>
44
- </template>