@hostlink/nuxt-light 1.21.8 → 1.21.9

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.21.8",
4
+ "version": "1.21.9",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -1,28 +1,15 @@
1
1
  <script setup>
2
- import { useRoute } from "vue-router"
3
- const route = useRoute();
4
-
5
- //get relative path
6
- const relativePath = route.path.split("/").slice(1).join("/");
7
-
8
2
  const props = defineProps({
9
3
  label: {
10
4
  type: String,
11
5
  default: "Add"
12
6
  },
13
- to: {
14
- type: String,
15
- default: null
16
- }
7
+ to: String,
8
+ color: String
17
9
  });
18
-
19
- const to = props.to ?? relativePath + "/add";
20
-
21
10
  </script>
22
11
  <template>
23
- <l-btn :color="$light.color" icon="sym_o_add" :to="to" :label="label">
24
- <q-tooltip>
25
- {{ $t(label) }}
26
- </q-tooltip>
12
+ <l-btn icon="sym_o_add" v-bind="$props" :to="to ?? $route.path + '/add'">
13
+ <q-tooltip>{{ $t(label) }}</q-tooltip>
27
14
  </l-btn>
28
15
  </template>
@@ -1,32 +1,20 @@
1
1
  <script setup lang="ts">
2
- import { useLight } from '#imports';
3
- import { computed } from 'vue';
4
- import { useI18n } from 'vue-i18n';
5
-
6
2
  import type { QFieldProps } from 'quasar';
7
- const props = defineProps<QFieldProps>()
8
- const light = useLight();
9
-
10
- const { t } = useI18n();
11
-
12
- const attrs = computed(() => {
13
-
14
- const a = { ...light.styles.input, ...JSON.parse(JSON.stringify(props)) };
15
-
16
- if (props.label) {
17
- a.label = t(props.label);
18
- }
19
-
20
- if (props.color === undefined) {
21
- a.color = light.color
22
- }
23
-
24
- return a;
3
+ const props = withDefaults(defineProps<QFieldProps>(), {
4
+ outlined: undefined,
5
+ filled: undefined,
6
+ standout: undefined,
7
+ rounded: undefined,
8
+ square: undefined,
9
+ stackLabel: undefined,
10
+ dark: undefined,
11
+ dense: undefined,
25
12
  });
26
13
 
27
14
  </script>
28
15
  <template>
29
- <q-field v-bind="attrs">
16
+
17
+ <q-field v-bind="$light.getInputProps($props)">
30
18
  <slot></slot>
31
19
  </q-field>
32
20
  </template>
@@ -24,6 +24,7 @@ const props = withDefaults(defineProps<LInputProps>(), {
24
24
  stackLabel: undefined,
25
25
  hideBottomSpace: true,
26
26
  dark: undefined,
27
+ dense: undefined,
27
28
  });
28
29
 
29
30
  const modelValue = defineModel<string | number | FileList | null | undefined>();
@@ -1,9 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { QTabPanelProps, QTabProps } from 'quasar';
3
3
  import { getCurrentInstance } from 'vue';
4
- import { useI18n } from 'vue-i18n';
5
-
6
- const { t } = useI18n();
7
4
 
8
5
  const instance = getCurrentInstance();
9
6
  defineProps<QTabPanelProps | QTabProps>()
@@ -1,11 +1,14 @@
1
1
  <script setup>
2
2
  import { computed } from 'vue'
3
3
  import { getErrorMessage } from 'formkit-quasar';
4
+ import { useI18n } from 'vue-i18n';
4
5
 
5
6
  const props = defineProps({
6
7
  context: Object
7
8
  });
8
9
 
10
+ const { t } = useI18n()
11
+
9
12
  const { error, errorMessage } = getErrorMessage(props.context.node);
10
13
 
11
14
  const value = computed({
@@ -14,7 +17,7 @@ const value = computed({
14
17
  })
15
18
 
16
19
  const label = computed(() => {
17
- let l = props.context.label;
20
+ let l = t(props.context.label);
18
21
  if (props.context.state.required) {
19
22
  l = "* " + l
20
23
  }
@@ -1,6 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
  import { getErrorMessage } from 'formkit-quasar';
4
+ import { useI18n } from 'vue-i18n';
4
5
 
5
6
  const props = defineProps({
6
7
  context: {
@@ -9,8 +10,9 @@ const props = defineProps({
9
10
  }
10
11
  });
11
12
 
12
- const { error, errorMessage } = getErrorMessage(props.context?.node);
13
+ const { t } = useI18n()
13
14
 
15
+ const { error, errorMessage } = getErrorMessage(props.context.node);
14
16
  const value = computed({
15
17
  get: () => props.context?.value,
16
18
  set: (val) => {
@@ -47,7 +49,7 @@ const onBlur = () => {
47
49
  }
48
50
 
49
51
  const label = computed(() => {
50
- let l = props.context.label;
52
+ let l = t(props.context.label);
51
53
  if (props.context.state.required) {
52
54
  l = "* " + l
53
55
  }
@@ -56,7 +58,6 @@ const label = computed(() => {
56
58
 
57
59
  </script>
58
60
  <template>
59
-
60
61
  <l-input v-model="value" v-bind="context?.attrs" :label="label" :error="error" :type="context?.inputType"
61
62
  :error-message="errorMessage" @blur="onBlur" :disable="context.disabled">
62
63
 
@@ -1,7 +1,9 @@
1
1
  <script setup>
2
+ import { useLight } from '#imports';
2
3
  import { computed } from 'vue'
3
4
  import { getErrorMessage } from 'formkit-quasar';
4
5
 
6
+ const light = useLight();
5
7
  const props = defineProps({
6
8
  context: Object
7
9
  });
@@ -13,10 +15,18 @@ const value = computed({
13
15
  set: (val) => props.context.node.input(val)
14
16
  })
15
17
 
18
+ const outlined = computed(() => {
19
+ return props.context.attrs.outlined != undefined ? props.context.attrs.outlined : light.styles.input.outlined;
20
+
21
+ })
22
+
23
+
16
24
  </script>
17
25
  <template>
18
- <l-field stack-label :label="context.label" :error="error" :error-message="errorMessage">
19
- <q-option-group type="checkbox" :options="context.options" v-model="value" inline v-bind="context.attrs" :color="$light.color">
26
+ <l-field stack-label :label="context.label" :error="error" :error-message="errorMessage" :outlined="outlined"
27
+ hide-bottom-space>
28
+ <q-option-group type="checkbox" :options="context.options" v-model="value" inline v-bind="context.attrs"
29
+ :color="$light.color">
20
30
  </q-option-group>
21
31
  </l-field>
22
32
  </template>
@@ -1,20 +1,30 @@
1
1
  <script setup>
2
2
  import { computed } from 'vue'
3
3
  import { getErrorMessage } from 'formkit-quasar';
4
-
4
+ import { useI18n } from 'vue-i18n';
5
5
  const props = defineProps({
6
6
  context: Object
7
7
  });
8
8
 
9
+ const { t } = useI18n()
10
+
9
11
  const { error, errorMessage } = getErrorMessage(props.context.node);
10
12
 
11
13
  const value = computed({
12
14
  get: () => props.context.value,
13
15
  set: (val) => props.context.node.input(val)
14
16
  })
17
+
18
+ const label = computed(() => {
19
+ let l = t(props.context.label);
20
+ if (props.context.state.required) {
21
+ l = "* " + l
22
+ }
23
+ return l
24
+ })
15
25
  </script>
16
26
  <template>
17
- <l-time-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
27
+ <l-time-picker v-model="value" v-bind="context.attrs" :label="label" :error="error" :type="context.inputType"
18
28
  :error-message="errorMessage">
19
29
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
20
30
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -32,36 +32,35 @@ const COLOR_CODE = {
32
32
  dark: "#4b4b4b"
33
33
  };
34
34
  let styles = {};
35
- const defaultStyle = {
36
- table: {
37
- dense: true,
38
- flat: true,
39
- bordered: true,
40
- separator: "cell"
41
- },
42
- card: {
43
- flat: true,
44
- bordered: true,
45
- square: false
46
- },
47
- button: {
48
- outline: true,
49
- rounded: true,
50
- unelevated: false,
51
- dense: false
52
- },
53
- input: {
54
- filled: false,
55
- outlined: true,
56
- standout: false,
57
- rounded: false,
58
- dense: true,
59
- square: false,
60
- stackLabel: false
61
- }
62
- };
63
35
  const light = reactive({
64
- styles: {},
36
+ styles: {
37
+ table: {
38
+ dense: true,
39
+ flat: true,
40
+ bordered: true,
41
+ separator: "cell"
42
+ },
43
+ card: {
44
+ flat: true,
45
+ bordered: true,
46
+ square: false
47
+ },
48
+ button: {
49
+ outline: true,
50
+ rounded: true,
51
+ unelevated: false,
52
+ dense: false
53
+ },
54
+ input: {
55
+ filled: false,
56
+ outlined: true,
57
+ standout: false,
58
+ rounded: false,
59
+ dense: true,
60
+ square: false,
61
+ stackLabel: true
62
+ }
63
+ },
65
64
  version: packageJson.version,
66
65
  errors: [],
67
66
  $q: null,
@@ -206,10 +205,10 @@ const light = reactive({
206
205
  init(styles2) {
207
206
  light.color = styles2.color || "primary";
208
207
  light.theme = styles2.theme || "semi-dark";
209
- styles2.input = { ...defaultStyle.input, ...styles2.input || {} };
210
- styles2.card = { ...defaultStyle.card, ...styles2.card || {} };
211
- styles2.button = { ...defaultStyle.button, ...styles2.button || {} };
212
- styles2.table = { ...defaultStyle.table, ...styles2.table || {} };
208
+ styles2.input = { ...light.styles.input, ...styles2.input || {} };
209
+ styles2.card = { ...light.styles.card, ...styles2.card || {} };
210
+ styles2.button = { ...light.styles.button, ...styles2.button || {} };
211
+ styles2.table = { ...light.styles.table, ...styles2.table || {} };
213
212
  light.styles = styles2;
214
213
  watch(() => light.theme, async () => {
215
214
  await light.setStyle("theme", light.theme);
@@ -80,7 +80,8 @@ const languages = tt.app.languages.map((lang) => {
80
80
  <FormKit type="l-date-picker" label="Join date" name="join_date" validation="required" />
81
81
  <FormKit type="l-date-picker" label="Expiry date" name="expiry_date" />
82
82
  <FormKit type="l-select" label="Status" name="status" :options="options" validation="required" />
83
- <FormKit type="l-select" label="Language" name="language" :options="languages" validation="required" />
83
+ <FormKit type="l-select" label="Language" name="language" :options="languages"
84
+ validation="required" />
84
85
  <FormKit type="l-input" label="Default page" name="default_page" />
85
86
 
86
87
  <FormKit type="l-option-group" label="Roles" name="roles" :options="roles ?? []" />
@@ -148,7 +148,7 @@ const preview = ref({})
148
148
  { name: 'A', phone: '123' },
149
149
  { name: 'B', phone: '456' },
150
150
  { name: 'C', phone: '789' },
151
- ]" v-bind="styles.table">
151
+ ]" v-bind="styles.table" selection="multiple">
152
152
 
153
153
  <template #body-cell-action="props">
154
154
  <q-td auto-width>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.21.8",
3
+ "version": "1.21.9",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",