@hostlink/nuxt-light 1.67.7 → 1.68.0

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 (60) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +103 -286
  3. package/dist/runtime/components/L/AppMain.d.vue.ts +4 -4
  4. package/dist/runtime/components/L/AppMain.vue +2 -0
  5. package/dist/runtime/components/L/AppMain.vue.d.ts +4 -4
  6. package/dist/runtime/components/L/NotificationBell.vue +187 -0
  7. package/dist/runtime/components/L/Table.d.vue.ts +12 -6
  8. package/dist/runtime/components/L/Table.vue +7 -1
  9. package/dist/runtime/components/L/Table.vue.d.ts +12 -6
  10. package/dist/runtime/components/L/TimePicker.d.vue.ts +0 -2
  11. package/dist/runtime/components/L/TimePicker.vue +0 -4
  12. package/dist/runtime/components/L/TimePicker.vue.d.ts +0 -2
  13. package/dist/runtime/formkit/Checkbox.vue +4 -2
  14. package/dist/runtime/formkit/DatePicker.vue +15 -4
  15. package/dist/runtime/formkit/Editor.vue +7 -3
  16. package/dist/runtime/formkit/File.vue +7 -3
  17. package/dist/runtime/formkit/FilePicker.vue +3 -1
  18. package/dist/runtime/formkit/FileUpload.vue +3 -1
  19. package/dist/runtime/formkit/GroupSelect.vue +7 -3
  20. package/dist/runtime/formkit/Input.vue +2 -7
  21. package/dist/runtime/formkit/InputSelect.vue +6 -9
  22. package/dist/runtime/formkit/InputXlsx.vue +7 -3
  23. package/dist/runtime/formkit/OptionGroup.vue +7 -3
  24. package/dist/runtime/formkit/Radio.vue +4 -2
  25. package/dist/runtime/formkit/Select.vue +7 -3
  26. package/dist/runtime/formkit/Textarea.vue +6 -9
  27. package/dist/runtime/formkit/TimePicker.vue +15 -4
  28. package/dist/runtime/formkit/Toggle.vue +3 -1
  29. package/dist/runtime/formkit/useRequiredLabel.d.ts +1 -0
  30. package/dist/runtime/formkit/useRequiredLabel.js +10 -0
  31. package/dist/runtime/models/Notification.d.ts +2 -0
  32. package/dist/runtime/models/Notification.js +52 -0
  33. package/dist/runtime/models/SystemValue.js +3 -1
  34. package/dist/runtime/pages/Notification/index.vue +55 -0
  35. package/dist/runtime/pages/User/[user_id]/update-role.d.vue.ts +3 -0
  36. package/dist/runtime/pages/User/[user_id]/update-role.vue.d.ts +3 -0
  37. package/dist/runtime/pages/User/[user_id]/view.d.vue.ts +3 -0
  38. package/dist/runtime/pages/User/[user_id]/view.vue.d.ts +3 -0
  39. package/package.json +1 -1
  40. /package/dist/runtime/{pages/EventLog/_eventlog_id/view.d.vue.ts → components/L/NotificationBell.d.vue.ts} +0 -0
  41. /package/dist/runtime/{pages/EventLog/_eventlog_id/view.vue.d.ts → components/L/NotificationBell.vue.d.ts} +0 -0
  42. /package/dist/runtime/pages/{User/_user_id → EventLog/[eventlog_id]}/view.d.vue.ts +0 -0
  43. /package/dist/runtime/pages/EventLog/{_eventlog_id → [eventlog_id]}/view.vue +0 -0
  44. /package/dist/runtime/pages/{User/_user_id → EventLog/[eventlog_id]}/view.vue.d.ts +0 -0
  45. /package/dist/runtime/pages/{Role/_name/update-child.d.vue.ts → Notification/index.d.vue.ts} +0 -0
  46. /package/dist/runtime/pages/{Role/_name/update-child.vue.d.ts → Notification/index.vue.d.ts} +0 -0
  47. /package/dist/runtime/pages/{SystemValue/_systemvalue_id/edit.d.vue.ts → Role/[name]/update-child.d.vue.ts} +0 -0
  48. /package/dist/runtime/pages/Role/{_name → [name]}/update-child.vue +0 -0
  49. /package/dist/runtime/pages/{SystemValue/_systemvalue_id/edit.vue.d.ts → Role/[name]/update-child.vue.d.ts} +0 -0
  50. /package/dist/runtime/pages/{User/_user_id → SystemValue/[systemvalue_id]}/edit.d.vue.ts +0 -0
  51. /package/dist/runtime/pages/SystemValue/{_systemvalue_id → [systemvalue_id]}/edit.vue +0 -0
  52. /package/dist/runtime/pages/{User/_user_id → SystemValue/[systemvalue_id]}/edit.vue.d.ts +0 -0
  53. /package/dist/runtime/pages/User/{_user_id → [user_id]}/change-password.d.vue.ts +0 -0
  54. /package/dist/runtime/pages/User/{_user_id → [user_id]}/change-password.vue +0 -0
  55. /package/dist/runtime/pages/User/{_user_id → [user_id]}/change-password.vue.d.ts +0 -0
  56. /package/dist/runtime/pages/User/{_user_id/update-role.d.vue.ts → [user_id]/edit.d.vue.ts} +0 -0
  57. /package/dist/runtime/pages/User/{_user_id → [user_id]}/edit.vue +0 -0
  58. /package/dist/runtime/pages/User/{_user_id/update-role.vue.d.ts → [user_id]/edit.vue.d.ts} +0 -0
  59. /package/dist/runtime/pages/User/{_user_id → [user_id]}/update-role.vue +0 -0
  60. /package/dist/runtime/pages/User/{_user_id → [user_id]}/view.vue +0 -0
@@ -79,17 +79,23 @@ export interface LTableRequest {
79
79
  }) => void;
80
80
  }
81
81
  declare function requestServerInteraction(): void;
82
- declare var __VLS_114: any, __VLS_117: string, __VLS_118: any, __VLS_149: any, __VLS_152: any, __VLS_322: string, __VLS_323: any;
82
+ declare var __VLS_24: {
83
+ props: any;
84
+ }, __VLS_55: any, __VLS_119: any, __VLS_122: string, __VLS_123: any, __VLS_154: any, __VLS_157: any, __VLS_327: string, __VLS_328: any;
83
85
  type __VLS_Slots = {} & {
84
- [K in NonNullable<typeof __VLS_117>]?: (props: typeof __VLS_118) => any;
86
+ [K in NonNullable<typeof __VLS_122>]?: (props: typeof __VLS_123) => any;
85
87
  } & {
86
- [K in NonNullable<typeof __VLS_322>]?: (props: typeof __VLS_323) => any;
88
+ [K in NonNullable<typeof __VLS_327>]?: (props: typeof __VLS_328) => any;
87
89
  } & {
88
- actions?: (props: typeof __VLS_114) => any;
90
+ 'header-selection'?: (props: typeof __VLS_24) => any;
89
91
  } & {
90
- 'row-expand'?: (props: typeof __VLS_149) => any;
92
+ 'top-selection'?: (props: typeof __VLS_55) => any;
91
93
  } & {
92
- 'top-right'?: (props: typeof __VLS_152) => any;
94
+ actions?: (props: typeof __VLS_119) => any;
95
+ } & {
96
+ 'row-expand'?: (props: typeof __VLS_154) => any;
97
+ } & {
98
+ 'top-right'?: (props: typeof __VLS_157) => any;
93
99
  };
94
100
  declare const __VLS_base: import("vue").DefineComponent<LTableProps, {
95
101
  requestServerInteraction: typeof requestServerInteraction;
@@ -562,7 +562,9 @@ const hasFilters = computed(() => {
562
562
  <template #header="props">
563
563
  <q-tr :props="props">
564
564
  <q-th v-if="selection != 'none'" auto-width>
565
- <q-checkbox v-model="props.selected" :dense="table?.dense" />
565
+ <slot name="header-selection" :props="props">
566
+ <q-checkbox v-model="props.selected" :dense="table?.dense" />
567
+ </slot>
566
568
  </q-th>
567
569
  <q-th v-if="hasRowExpand" auto-width></q-th>
568
570
  <q-th v-if="hasActions" auto-width></q-th>
@@ -578,6 +580,10 @@ const hasFilters = computed(() => {
578
580
  </div>
579
581
  </template>
580
582
 
583
+ <template #top-selection="props" v-if="ss.indexOf('top-selection') >= 0">
584
+ <slot name="top-selection" v-bind="props"></slot>
585
+ </template>
586
+
581
587
  <template #top-left v-if="addComponent">
582
588
  <q-btn icon="sym_o_add" :label="$t('Add')" color="primary" @click="onAdd" outline />
583
589
  </template>
@@ -79,17 +79,23 @@ export interface LTableRequest {
79
79
  }) => void;
80
80
  }
81
81
  declare function requestServerInteraction(): void;
82
- declare var __VLS_114: any, __VLS_117: string, __VLS_118: any, __VLS_149: any, __VLS_152: any, __VLS_322: string, __VLS_323: any;
82
+ declare var __VLS_24: {
83
+ props: any;
84
+ }, __VLS_55: any, __VLS_119: any, __VLS_122: string, __VLS_123: any, __VLS_154: any, __VLS_157: any, __VLS_327: string, __VLS_328: any;
83
85
  type __VLS_Slots = {} & {
84
- [K in NonNullable<typeof __VLS_117>]?: (props: typeof __VLS_118) => any;
86
+ [K in NonNullable<typeof __VLS_122>]?: (props: typeof __VLS_123) => any;
85
87
  } & {
86
- [K in NonNullable<typeof __VLS_322>]?: (props: typeof __VLS_323) => any;
88
+ [K in NonNullable<typeof __VLS_327>]?: (props: typeof __VLS_328) => any;
87
89
  } & {
88
- actions?: (props: typeof __VLS_114) => any;
90
+ 'header-selection'?: (props: typeof __VLS_24) => any;
89
91
  } & {
90
- 'row-expand'?: (props: typeof __VLS_149) => any;
92
+ 'top-selection'?: (props: typeof __VLS_55) => any;
91
93
  } & {
92
- 'top-right'?: (props: typeof __VLS_152) => any;
94
+ actions?: (props: typeof __VLS_119) => any;
95
+ } & {
96
+ 'row-expand'?: (props: typeof __VLS_154) => any;
97
+ } & {
98
+ 'top-right'?: (props: typeof __VLS_157) => any;
93
99
  };
94
100
  declare const __VLS_base: import("vue").DefineComponent<LTableProps, {
95
101
  requestServerInteraction: typeof requestServerInteraction;
@@ -1,6 +1,5 @@
1
1
  export interface LTimePickerProps {
2
2
  modelValue?: any;
3
- required?: boolean;
4
3
  label?: string;
5
4
  hint?: string;
6
5
  nowBtn?: boolean;
@@ -27,7 +26,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
26
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
28
27
  }>, {
29
28
  format24h: boolean;
30
- required: boolean;
31
29
  hideBottomSpace: boolean;
32
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -7,7 +7,6 @@ const { t } = useI18n();
7
7
  const modelValue = defineModel({ type: null });
8
8
  const props = defineProps({
9
9
  modelValue: { type: null, required: false },
10
- required: { type: Boolean, required: false, default: false },
11
10
  label: { type: String, required: false },
12
11
  hint: { type: String, required: false },
13
12
  nowBtn: { type: Boolean, required: false },
@@ -30,9 +29,6 @@ const inputProps = computed(() => ({
30
29
  }));
31
30
  const rules = computed(() => {
32
31
  const r = [];
33
- if (props.required) {
34
- r.push((v) => !!v || t("This field is required"));
35
- }
36
32
  r.push((v) => {
37
33
  if (!v) return true;
38
34
  const parts = v.split(":");
@@ -1,6 +1,5 @@
1
1
  export interface LTimePickerProps {
2
2
  modelValue?: any;
3
- required?: boolean;
4
3
  label?: string;
5
4
  hint?: string;
6
5
  nowBtn?: boolean;
@@ -27,7 +26,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
26
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
28
27
  }>, {
29
28
  format24h: boolean;
30
- required: boolean;
31
29
  hideBottomSpace: boolean;
32
30
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
31
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { useErrorMessage } from "./useErrorMessage";
3
- import { computed } from "vue";
3
+ import { computed, ref } from "vue";
4
4
  const props = defineProps({
5
5
  context: Object
6
6
  });
@@ -8,7 +8,9 @@ const value = computed({
8
8
  get: () => props.context.value,
9
9
  set: (val) => props.context.node.input(val)
10
10
  });
11
- const { error, errorMessage } = useErrorMessage(props.context.node);
11
+ const error = ref(false);
12
+ const errorMessage = ref("");
13
+ useErrorMessage(props.context.node, error, errorMessage);
12
14
  </script>
13
15
 
14
16
  <template>
@@ -1,19 +1,30 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
11
15
  });
16
+ const onBlur = () => {
17
+ if (errorMessage.value) {
18
+ error.value = true;
19
+ } else {
20
+ error.value = false;
21
+ }
22
+ };
12
23
  </script>
13
24
 
14
25
  <template>
15
- <l-date-picker v-model="value" v-bind="context.attrs" :label="context.label" :error="error"
16
- :type="context.inputType" :error-message="errorMessage" :disable="context.disabled">
26
+ <l-date-picker v-model="value" v-bind="context.attrs" :label="label" :error="error"
27
+ :type="context.inputType" :error-message="errorMessage" :disable="context.disabled" @blur="onBlur">
17
28
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
18
29
  <slot :name="name" v-bind="props ?? {}"></slot>
19
30
  </template>
@@ -1,10 +1,14 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
@@ -12,7 +16,7 @@ const value = computed({
12
16
  </script>
13
17
 
14
18
  <template>
15
- <l-editor v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
19
+ <l-editor v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
16
20
  :error-message="errorMessage">
17
21
  <slot></slot>
18
22
  <!-- <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
@@ -1,11 +1,15 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  import { useLight } from "#imports";
5
6
  const props = defineProps({
6
7
  context: Object
7
8
  });
8
- const { error, errorMessage } = useErrorMessage(props.context.node);
9
+ const error = ref(false);
10
+ const errorMessage = ref("");
11
+ useErrorMessage(props.context.node, error, errorMessage);
12
+ const label = useRequiredLabel(props.context);
9
13
  const value = computed({
10
14
  get: () => props.context.value,
11
15
  set: (val) => props.context.node.input(val)
@@ -27,7 +31,7 @@ const attrs = computed(() => {
27
31
  </script>
28
32
 
29
33
  <template>
30
- <q-file v-model="value" :label="context.label" v-bind="attrs" :error="error" :error-message="errorMessage"
34
+ <q-file v-model="value" :label="label" v-bind="attrs" :error="error" :error-message="errorMessage"
31
35
  @blur="onBlur" hide-bottom-space>
32
36
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
33
37
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -1,12 +1,14 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
8
  const error = ref(false);
8
9
  const errorMessage = ref("");
9
10
  useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
10
12
  const value = computed({
11
13
  get: () => props.context.value,
12
14
  set: (val) => props.context.node.input(val)
@@ -21,7 +23,7 @@ const onBlur = () => {
21
23
  </script>
22
24
 
23
25
  <template>
24
- <l-file v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
26
+ <l-file v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
25
27
  :error-message="errorMessage" @blur="onBlur">
26
28
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
27
29
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -1,12 +1,14 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
8
  const error = ref(false);
8
9
  const errorMessage = ref("");
9
10
  useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
10
12
  const value = computed({
11
13
  get: () => props.context.value,
12
14
  set: (val) => props.context.node.input(val)
@@ -21,7 +23,7 @@ const onBlur = () => {
21
23
  </script>
22
24
 
23
25
  <template>
24
- <l-file-upload v-bind="context.attrs" v-model="value" :label="context.label" :error="error" :type="context.inputType"
26
+ <l-file-upload v-bind="context.attrs" v-model="value" :label="label" :error="error" :type="context.inputType"
25
27
  :error-message="errorMessage" @blur="onBlur">
26
28
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
27
29
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -1,10 +1,14 @@
1
1
  <script setup>
2
2
  import { useErrorMessage } from "./useErrorMessage";
3
- import { computed } from "vue";
3
+ import { useRequiredLabel } from "./useRequiredLabel";
4
+ import { computed, ref } from "vue";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
@@ -18,7 +22,7 @@ if (props.context.state.required) {
18
22
  </script>
19
23
 
20
24
  <template>
21
- <l-group-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error"
25
+ <l-group-select v-model="value" :label="label" v-bind="context.attrs" :error="error"
22
26
  :error-message="errorMessage" :required="context.state.required"
23
27
  :disable="context.disabled">
24
28
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  import { useI18n } from "vue-i18n";
5
6
  const props = defineProps({
6
7
  context: {
@@ -42,13 +43,7 @@ const onBlur = () => {
42
43
  error.value = false;
43
44
  }
44
45
  };
45
- const label = computed(() => {
46
- let l = t(props.context.label);
47
- if (props.context.state.required) {
48
- l = "* " + l;
49
- }
50
- return l;
51
- });
46
+ const label = useRequiredLabel(props.context, t);
52
47
  </script>
53
48
 
54
49
  <template>
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  import { useI18n } from "vue-i18n";
5
6
  const props = defineProps({
6
7
  context: {
@@ -9,7 +10,9 @@ const props = defineProps({
9
10
  }
10
11
  });
11
12
  const { t } = useI18n();
12
- const { error, errorMessage } = useErrorMessage(props.context.node);
13
+ const error = ref(false);
14
+ const errorMessage = ref("");
15
+ useErrorMessage(props.context.node, error, errorMessage);
13
16
  const value = computed({
14
17
  get: () => props.context?.value,
15
18
  set: (val) => props.context.node.input(val)
@@ -21,13 +24,7 @@ const onBlur = () => {
21
24
  error.value = false;
22
25
  }
23
26
  };
24
- const label = computed(() => {
25
- let l = t(props.context.label);
26
- if (props.context.state.required) {
27
- l = "* " + l;
28
- }
29
- return l;
30
- });
27
+ const label = useRequiredLabel(props.context, t);
31
28
  </script>
32
29
 
33
30
  <template>
@@ -1,10 +1,14 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
@@ -12,7 +16,7 @@ const value = computed({
12
16
  </script>
13
17
 
14
18
  <template>
15
- <l-input-xlsx v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
19
+ <l-input-xlsx v-model="value" :label="label" v-bind="context.attrs" :error="error" :type="context.inputType"
16
20
  :error-message="errorMessage">
17
21
  <slot></slot>
18
22
  </l-input-xlsx>
@@ -1,12 +1,16 @@
1
1
  <script setup>
2
2
  import { useLight } from "#imports";
3
- import { computed } from "vue";
3
+ import { computed, ref } from "vue";
4
4
  import { useErrorMessage } from "./useErrorMessage";
5
+ import { useRequiredLabel } from "./useRequiredLabel";
5
6
  const light = useLight();
6
7
  const props = defineProps({
7
8
  context: Object
8
9
  });
9
- const { error, errorMessage } = useErrorMessage(props.context.node);
10
+ const error = ref(false);
11
+ const errorMessage = ref("");
12
+ useErrorMessage(props.context.node, error, errorMessage);
13
+ const label = useRequiredLabel(props.context);
10
14
  const value = computed({
11
15
  get: () => props.context.value,
12
16
  set: (val) => props.context.node.input(val)
@@ -17,7 +21,7 @@ const outlined = computed(() => {
17
21
  </script>
18
22
 
19
23
  <template>
20
- <l-field stack-label :label="context.label" :error="error" :error-message="errorMessage" :outlined="outlined"
24
+ <l-field stack-label :label="label" :error="error" :error-message="errorMessage" :outlined="outlined"
21
25
  hide-bottom-space>
22
26
  <q-option-group type="checkbox" :options="context.options" v-model="value" inline v-bind="context.attrs">
23
27
  </q-option-group>
@@ -1,10 +1,12 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
4
  const props = defineProps({
5
5
  context: Object
6
6
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
7
+ const error = ref(false);
8
+ const errorMessage = ref("");
9
+ useErrorMessage(props.context.node, error, errorMessage);
8
10
  const value = computed({
9
11
  get: () => props.context.value,
10
12
  set: (val) => props.context.node.input(val)
@@ -1,10 +1,14 @@
1
1
  <script setup>
2
2
  import { useErrorMessage } from "./useErrorMessage";
3
- import { computed } from "vue";
3
+ import { useRequiredLabel } from "./useRequiredLabel";
4
+ import { computed, ref } from "vue";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
@@ -18,7 +22,7 @@ if (props.context.state.required) {
18
22
  </script>
19
23
 
20
24
  <template>
21
- <l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
25
+ <l-select v-model="value" :label="label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
22
26
  :clearable="clearable" :disable="context.disabled">
23
27
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
24
28
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  import { useI18n } from "vue-i18n";
5
6
  const props = defineProps({
6
7
  context: {
@@ -9,7 +10,9 @@ const props = defineProps({
9
10
  }
10
11
  });
11
12
  const { t } = useI18n();
12
- const { error, errorMessage } = useErrorMessage(props.context.node);
13
+ const error = ref(false);
14
+ const errorMessage = ref("");
15
+ useErrorMessage(props.context.node, error, errorMessage);
13
16
  const value = computed({
14
17
  get: () => props.context?.value,
15
18
  set: (val) => {
@@ -23,13 +26,7 @@ const onBlur = () => {
23
26
  error.value = false;
24
27
  }
25
28
  };
26
- const label = computed(() => {
27
- let l = t(props.context.label);
28
- if (props.context.state.required) {
29
- l = "* " + l;
30
- }
31
- return l;
32
- });
29
+ const label = useRequiredLabel(props.context, t);
33
30
  </script>
34
31
 
35
32
  <template>
@@ -1,19 +1,30 @@
1
1
  <script setup>
2
- import { computed } from "vue";
2
+ import { computed, ref } from "vue";
3
3
  import { useErrorMessage } from "./useErrorMessage";
4
+ import { useRequiredLabel } from "./useRequiredLabel";
4
5
  const props = defineProps({
5
6
  context: Object
6
7
  });
7
- const { error, errorMessage } = useErrorMessage(props.context.node);
8
+ const error = ref(false);
9
+ const errorMessage = ref("");
10
+ useErrorMessage(props.context.node, error, errorMessage);
11
+ const label = useRequiredLabel(props.context);
8
12
  const value = computed({
9
13
  get: () => props.context.value,
10
14
  set: (val) => props.context.node.input(val)
11
15
  });
16
+ const onBlur = () => {
17
+ if (errorMessage.value) {
18
+ error.value = true;
19
+ } else {
20
+ error.value = false;
21
+ }
22
+ };
12
23
  </script>
13
24
 
14
25
  <template>
15
- <l-time-picker v-model="value" v-bind="context.attrs" :label="context.label" :error="error" :type="context.inputType"
16
- :error-message="errorMessage" :disable="context.disabled" :required="context.state.required">
26
+ <l-time-picker v-model="value" v-bind="context.attrs" :label="label" :error="error" :type="context.inputType"
27
+ :error-message="errorMessage" :disable="context.disabled" @blur="onBlur">
17
28
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
18
29
  <slot :name="name" v-bind="props ?? {}"></slot>
19
30
  </template>
@@ -1,8 +1,10 @@
1
1
  <script setup>
2
2
  import { computed } from "vue";
3
+ import { useRequiredLabel } from "./useRequiredLabel";
3
4
  const props = defineProps({
4
5
  context: Object
5
6
  });
7
+ const label = useRequiredLabel(props.context);
6
8
  const value = computed({
7
9
  get: () => props.context.value,
8
10
  set: (val) => props.context.node.input(val)
@@ -10,7 +12,7 @@ const value = computed({
10
12
  </script>
11
13
 
12
14
  <template>
13
- <q-toggle v-model="value" :label="context.label" :disable="context.disabled" v-bind="context.attrs">
15
+ <q-toggle v-model="value" :label="label" :disable="context.disabled" v-bind="context.attrs">
14
16
  <slot></slot>
15
17
  </q-toggle>
16
18
  </template>
@@ -0,0 +1 @@
1
+ export declare function useRequiredLabel(context: any, t?: (val: string) => string): import("vue").ComputedRef<any>;
@@ -0,0 +1,10 @@
1
+ import { computed } from "vue";
2
+ export function useRequiredLabel(context, t) {
3
+ return computed(() => {
4
+ let l = t ? t(context.label) : context.label;
5
+ if (context.state?.required) {
6
+ l = "* " + l;
7
+ }
8
+ return l;
9
+ });
10
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => void;
2
+ export default _default;
@@ -0,0 +1,52 @@
1
+ import { defineLightModel } from "#imports";
2
+ export default defineLightModel({
3
+ name: "Notification",
4
+ dataPath: "app.listNotification",
5
+ fields: {
6
+ notification_id: {
7
+ label: "ID",
8
+ sortable: true
9
+ },
10
+ type: {
11
+ label: "Type",
12
+ sortable: true,
13
+ searchable: true,
14
+ searchType: "select",
15
+ searchOptions: [
16
+ { label: "Info", value: "info" },
17
+ { label: "Success", value: "success" },
18
+ { label: "Warning", value: "warning" },
19
+ { label: "Error", value: "error" }
20
+ ],
21
+ format: (value) => {
22
+ const map = { info: "Info", success: "Success", warning: "Warning", error: "Error" };
23
+ return map[value] || value;
24
+ }
25
+ },
26
+ title: {
27
+ label: "Title",
28
+ sortable: true,
29
+ searchable: true
30
+ },
31
+ message: {
32
+ label: "Message",
33
+ searchable: true
34
+ },
35
+ link: {
36
+ label: "Link"
37
+ },
38
+ is_read: {
39
+ label: "Read",
40
+ sortable: true,
41
+ searchable: true,
42
+ searchType: "boolean",
43
+ format: (value) => value ? "Yes" : "No"
44
+ },
45
+ created_time: {
46
+ label: "Created Time",
47
+ sortable: true,
48
+ searchable: true,
49
+ searchType: "date"
50
+ }
51
+ }
52
+ });
@@ -5,7 +5,9 @@ export default defineLightModel({
5
5
  fields: {
6
6
  name: {
7
7
  label: "Name",
8
- sortable: true
8
+ sortable: true,
9
+ searchable: true,
10
+ searchPlaceholder: "Search by name..."
9
11
  },
10
12
  value: {
11
13
  label: "Value",