@hostlink/nuxt-light 1.21.6 → 1.21.8

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 (30) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/L/System/Setting/mail.vue +1 -7
  3. package/dist/runtime/components/{l-user-eventlog.vue → L/User/eventlog.vue} +2 -1
  4. package/dist/runtime/components/{l-user-overview.vue → L/User/overview.vue} +5 -1
  5. package/dist/runtime/components/l-app-main.vue +2 -1
  6. package/dist/runtime/components/l-btn.vue +7 -29
  7. package/dist/runtime/components/l-card.vue +3 -6
  8. package/dist/runtime/components/l-checkbox.vue +2 -18
  9. package/dist/runtime/components/l-date-picker.vue +5 -18
  10. package/dist/runtime/components/l-field.vue +1 -4
  11. package/dist/runtime/components/l-file-upload.vue +14 -35
  12. package/dist/runtime/components/l-file.vue +7 -9
  13. package/dist/runtime/components/l-icon-picker.vue +3253 -3272
  14. package/dist/runtime/components/l-input-xlsx.vue +16 -30
  15. package/dist/runtime/components/l-input.vue +6 -41
  16. package/dist/runtime/components/l-select.vue +3 -26
  17. package/dist/runtime/components/l-table.vue +13 -16
  18. package/dist/runtime/components/l-time-picker.vue +5 -32
  19. package/dist/runtime/formkit/DatePicker.vue +10 -1
  20. package/dist/runtime/formkit/File.vue +6 -12
  21. package/dist/runtime/formkit/Input.vue +11 -5
  22. package/dist/runtime/formkit/Select.vue +2 -10
  23. package/dist/runtime/light.d.ts +6 -10
  24. package/dist/runtime/light.js +61 -22
  25. package/dist/runtime/pages/System/menu/index.vue +61 -55
  26. package/dist/runtime/pages/User/setting/style.vue +88 -113
  27. package/package.json +1 -1
  28. package/dist/runtime/components/l-table-old.vue +0 -718
  29. package/dist/runtime/components/l-table2.vue +0 -754
  30. /package/dist/runtime/components/{l-user-userlog.vue → L/User/userlog.vue} +0 -0
@@ -1,40 +1,26 @@
1
-
2
- <script setup>
1
+ <script setup lang="ts">
3
2
  import * as XLSX from "xlsx";
4
- import { ref, useAttrs, } from "vue";
5
- import { useLight } from "#imports"
6
-
7
- const emit = defineEmits(["update:modelValue"]);
8
-
9
- const light = useLight();
10
- const attrs = {
11
- ...{
12
- filled: light.getStyle("inputFilled"),
13
- outlined: light.getStyle("inputOutlined"),
14
- standout: light.getStyle("inputStandout"),
15
- rounded: light.getStyle("inputRounded"),
16
- dense: light.getStyle("inputDense"),
17
- square: light.getStyle("inputSquare"),
18
- stackLabel: light.getStyle("inputStackLabel")
19
- },
20
- ...useAttrs(),
3
+ import { ref } from "vue";
4
+
5
+ const modelValue = defineModel({
6
+ type: Array,
7
+ default: []
8
+ });
21
9
 
22
- }
23
10
  const loading = ref(false);
24
- const localData = ref([]);
25
11
  const hasFile = ref(false);
26
12
  const file = ref(null);
13
+
27
14
  const onChange = () => {
28
15
  hasFile.value = true;
29
16
  loading.value = true;
30
- file.value.files[0].arrayBuffer().then((data) => {
17
+
18
+ file.value.files[0].arrayBuffer().then((data: any) => {
31
19
  const workbook = XLSX.read(data);
32
20
  const sheet = workbook.Sheets[workbook.SheetNames[0]];
33
21
  const json = XLSX.utils.sheet_to_json(sheet);
34
- localData.value = json;
35
22
  loading.value = false;
36
-
37
- emit("update:modelValue", json);
23
+ modelValue.value = json;
38
24
 
39
25
  });
40
26
 
@@ -42,22 +28,22 @@ const onChange = () => {
42
28
 
43
29
  const onClear = () => {
44
30
  hasFile.value = false;
45
- localData.value = [];
46
- emit("update:modelValue", []);
31
+ modelValue.value = [];
47
32
  }
48
33
 
49
34
  const showView = ref(false);
50
35
  </script>
51
36
 
52
37
  <template>
53
- <q-field v-bind="attrs" :loading="loading" :model-value="localData" @update:model-value="onClear">
38
+ <q-field v-bind="{ ...$light.styles.input, ...$attrs }" :loading="loading" :model-value="localData"
39
+ @update:model-value="onClear">
54
40
  <template v-slot:control>
55
41
  <template v-if="!hasFile">
56
42
  <input type="file" accept=".xlsx" @change="onChange" ref="file" />
57
43
  </template>
58
44
 
59
45
  <template v-else>
60
- {{ localData.length }} records
46
+ {{ modelValue.length }} records
61
47
  </template>
62
48
 
63
49
  </template>
@@ -74,7 +60,7 @@ const showView = ref(false);
74
60
  <q-dialog v-model="showView" full-width>
75
61
  <q-card>
76
62
  <q-card-section>
77
- <q-table :rows="localData" dense separator="cell" flat bordered/>
63
+ <q-table :rows="modelValue" dense separator="cell" flat bordered></q-table>
78
64
  </q-card-section>
79
65
  </q-card>
80
66
  </q-dialog>
@@ -1,9 +1,10 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref } from "vue";
2
+ import { computed, ref, useAttrs } from "vue";
3
3
  import { useI18n } from 'vue-i18n';
4
4
  import tc2sc from "../lib/tc2sc";
5
5
  import { useLight } from '#imports';
6
6
 
7
+
7
8
  import type { QInputProps } from "quasar";
8
9
  export interface LInputProps extends QInputProps {
9
10
  showPassword?: boolean;
@@ -15,22 +16,17 @@ const { t } = useI18n();
15
16
  const light = useLight();
16
17
 
17
18
  const props = withDefaults(defineProps<LInputProps>(), {
18
- showPassword: false,
19
- translate: false,
20
19
  outlined: undefined,
21
20
  filled: undefined,
22
21
  standout: undefined,
23
22
  rounded: undefined,
24
- dense: undefined,
25
23
  square: undefined,
26
24
  stackLabel: undefined,
27
- required: false,
28
25
  hideBottomSpace: true,
29
26
  dark: undefined,
30
27
  });
31
28
 
32
-
33
- const emit = defineEmits(["update:modelValue"]);
29
+ const modelValue = defineModel<string | number | FileList | null | undefined>();
34
30
 
35
31
  //clone rules to new_rules
36
32
  const new_rules = props.rules || [];
@@ -95,10 +91,6 @@ if (minLength) {
95
91
  });
96
92
  }
97
93
 
98
- const localValue = computed({
99
- get: () => props.modelValue,
100
- set: (value) => emit('update:modelValue', value)
101
- });
102
94
 
103
95
  const isShowPassword = ref(false);
104
96
 
@@ -118,46 +110,19 @@ const localShowPassword = computed(() => {
118
110
  return false;
119
111
  }
120
112
 
121
- if (!localValue.value) {
113
+ if (!modelValue.value) {
122
114
  return false;
123
115
  }
124
116
  return true;
125
117
  });
126
118
 
127
119
  const onClickTc2Sc = () => {
128
- localValue.value = tc2sc(localValue.value);
120
+ modelValue.value = tc2sc(modelValue.value);
129
121
  }
130
122
 
131
- const attrs = computed(() => {
132
- const a = { ...props };
133
- if (props.outlined === undefined) a.outlined = light.getStyle("inputOutlined");
134
- if (props.filled === undefined) a.filled = light.getStyle("inputFilled");
135
- if (props.standout === undefined) a.standout = light.getStyle("inputStandout");
136
- if (props.rounded === undefined) a.rounded = light.getStyle("inputRounded");
137
- if (props.dense === undefined) a.dense = light.getStyle("inputDense");
138
- if (props.square === undefined) a.square = light.getStyle("inputSquare");
139
- if (props.stackLabel === undefined) a.stackLabel = light.getStyle("inputStackLabel");
140
-
141
- if (props.label) {
142
- a.label = t(props.label);
143
-
144
- if (props.required) {
145
- a.label = "* " + a.label;
146
- }
147
- }
148
-
149
- if (props.color === undefined) a.color = light.color
150
-
151
- if (props.hint) {
152
- a.hint = t(props.hint);
153
- }
154
-
155
- return a;
156
- })
157
-
158
123
  </script>
159
124
  <template>
160
- <q-input v-bind="attrs" v-model="localValue" :rules="new_rules" :type="localType">
125
+ <q-input v-bind="$light.getInputProps($props)" :rules="new_rules" :type="localType">
161
126
  <template v-if="translate" #prepend>
162
127
  <q-btn icon="sym_o_translate" flat dense rounded>
163
128
  <q-menu dense>
@@ -8,7 +8,7 @@ const emits = defineEmits(["update:modelValue"]);
8
8
 
9
9
  const { t } = useI18n();
10
10
  const light = useLight();
11
- interface LSelectProps extends QSelectProps {
11
+ interface LSelectProps extends QSelectProps {
12
12
  required?: boolean,
13
13
  }
14
14
 
@@ -101,29 +101,6 @@ const clearable = computed(() => {
101
101
  return !props.required;
102
102
  });
103
103
 
104
- const attrs = computed(() => {
105
- const a = {
106
- ...props,
107
- }
108
-
109
- if (props.fillInput === undefined) a.fillInput = light.getStyle("inputFilled")
110
- if (props.outlined === undefined) a.outlined = light.getStyle("inputOutlined")
111
- if (props.standout === undefined) a.standout = light.getStyle("inputStandout")
112
- if (props.rounded === undefined) a.rounded = light.getStyle("inputRounded")
113
- if (props.dense === undefined) a.dense = light.getStyle("inputDense")
114
- if (props.square === undefined) a.square = light.getStyle("inputSquare")
115
- if (props.stackLabel === undefined) a.stackLabel = light.getStyle("inputStackLabel")
116
-
117
- if (props.label) {
118
- a.label = t(props.label);
119
- }
120
-
121
- if (props.color === undefined) a.color = light.color
122
-
123
- return a;
124
-
125
- });
126
-
127
104
  const localValue = computed({
128
105
  get: () => props.modelValue,
129
106
  set: (value) => {
@@ -134,6 +111,6 @@ const localValue = computed({
134
111
 
135
112
  </script>
136
113
  <template>
137
- <q-select v-bind="attrs" v-model="localValue" :options="select_options" @filter="filterFn" :option-label="optionLabel"
138
- hide-bottom-space :rules="rules" :clearable="clearable" />
114
+ <q-select v-bind="$light.getInputProps($props)" v-model="localValue" :options="select_options" @filter="filterFn"
115
+ :option-label="optionLabel" hide-bottom-space :rules="rules" :clearable="clearable" />
139
116
  </template>
@@ -1,12 +1,14 @@
1
1
  <script setup lang="ts">
2
- import { useQuasar, QTable, type QTableColumn, type QTableProps, Dialog, QTab } from 'quasar';
2
+ import { useQuasar, QTable, type QTableColumn, type QTableProps, Dialog } from 'quasar';
3
3
 
4
- import { ref, computed, onMounted, useSlots, useAttrs, watch, defineComponent, h } from "vue";
5
- import { t, q, useLight, GQLFieldBuilder, model } from '../';
4
+ import { ref, computed, onMounted, useSlots, watch, } from "vue";
5
+ import { useLight, GQLFieldBuilder, model } from '../';
6
6
  import { toQuery } from '@hostlink/light';
7
7
  import { collect } from "#imports"
8
+ import { useI18n } from 'vue-i18n';
8
9
 
9
10
  const $q = useQuasar();
11
+ const { t } = useI18n();
10
12
 
11
13
 
12
14
  const minimized = defineModel<boolean>("minimized", { default: false })
@@ -64,6 +66,9 @@ const props = withDefaults(defineProps<LTableProps>(), {
64
66
  loadingLabel: "Loading...",
65
67
  noDataLabel: "No data available",
66
68
  dark: undefined,
69
+ dense: undefined,
70
+ bordered: undefined,
71
+ flat: undefined
67
72
  });
68
73
 
69
74
 
@@ -423,16 +428,12 @@ const onDelete = async (id: any) => {
423
428
  table.value.requestServerInteraction();
424
429
  }
425
430
  }
431
+
426
432
  const attrs = computed(() => {
427
- return {
428
- ...props,
433
+ const a = { ...light.styles.table, ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== undefined)) };
429
434
 
430
- ...{
431
- dense: light.getStyle("tableDense"),
432
- flat: light.getStyle("tableFlat"),
433
- bordered: light.getStyle("tableBorder"),
434
- separator: light.getStyle("tableSeparator"),
435
- },
435
+ return {
436
+ ...a,
436
437
  loadingLabel: t(props.loadingLabel),
437
438
  noDataLabel: t(props.noDataLabel),
438
439
  rowsPerPageOptions: props.rowsPerPageOptions,
@@ -540,7 +541,7 @@ const onAdd = () => {
540
541
 
541
542
 
542
543
  <template>
543
- <l-card flat bordered :maximizable="maximizable" :minimizable="minimizable" :title="title"
544
+ <l-card v-bind="attrs" :maximizable="maximizable" :minimizable="minimizable" :title="title"
544
545
  v-model:minimized="minimized" v-model:maximized="maximized">
545
546
 
546
547
  <q-toolbar v-if="addComponent">
@@ -559,10 +560,6 @@ const onAdd = () => {
559
560
  <q-table v-bind="attrs" :loading="loading" :rows="rows" ref="table" @request="onLocalRequest" :columns="columns"
560
561
  v-model:pagination="pagination" :filter="filter" v-model:selected="localSelected">
561
562
 
562
-
563
-
564
-
565
-
566
563
  <template #header="props">
567
564
  <q-tr :props="props">
568
565
  <q-td v-if="selection != 'none'" auto-width>
@@ -16,7 +16,8 @@ export interface LTimePickerProps {
16
16
  withSeconds?: boolean
17
17
  format24h?: boolean
18
18
  mask?: string
19
- hideBottomSpace?: boolean
19
+ hideBottomSpace?: boolean,
20
+ color?: string
20
21
  }
21
22
 
22
23
  const props = withDefaults(defineProps<LTimePickerProps>(), {
@@ -42,45 +43,17 @@ if (props.required) {
42
43
  rules.push(val => !!val || 'Required.');
43
44
  }
44
45
 
45
-
46
- const input_attrs = computed(() => {
47
-
48
- let attrs: QInputProps = {
49
- modelValue: localValue.value,
50
- filled: light.getStyle("inputFilled"),
51
- outlined: light.getStyle("inputOutlined"),
52
- standout: light.getStyle("inputStandout"),
53
- rounded: light.getStyle("inputRounded"),
54
- dense: light.getStyle("inputDense"),
55
- square: light.getStyle("inputSquare"),
56
- stackLabel: light.getStyle("inputStackLabel"),
57
- }
58
-
59
- if (props.label) {
60
- attrs.label = t(props.label);
61
- }
62
-
63
- if (props.hint) {
64
- attrs.hint = t(props.hint);
65
- }
66
-
67
- if (props.mask) {
68
- attrs.mask = props.mask;
69
- }
70
- return attrs;
71
- })
72
-
73
46
  </script>
74
47
  <template>
75
- <q-input v-bind="input_attrs" v-model="localValue" :rules="rules" :color="$light.color"
48
+ <q-input v-bind="$light.getInputProps(props)" v-model="localValue" :rules="rules" :color="$light.color"
76
49
  :hide-bottom-space="hideBottomSpace">
77
50
  <template v-slot:prepend>
78
51
  <q-btn icon="sym_o_access_time" round dense flat>
79
52
  <q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
80
- <q-time v-model="localValue" :format24h="format24h" :color="$light.color" :now-btn="nowBtn"
53
+ <q-time v-model="localValue" :format24h="format24h" :color="color ?? $light.color" :now-btn="nowBtn"
81
54
  :with-seconds="withSeconds">
82
55
  <div class="row items-center justify-end">
83
- <q-btn v-close-popup label="Close" :color="$light.color" flat />
56
+ <q-btn v-close-popup label="Close" :color="color ?? $light.color" flat />
84
57
  </div>
85
58
  </q-time>
86
59
  </q-popup-proxy>
@@ -13,9 +13,18 @@ const value = computed({
13
13
  set: (val) => props.context.node.input(val)
14
14
  })
15
15
 
16
+ const label = computed(() => {
17
+ let l = props.context.label;
18
+ if (props.context.state.required) {
19
+ l = "* " + l
20
+ }
21
+ return l
22
+ })
23
+
24
+
16
25
  </script>
17
26
  <template>
18
- <l-date-picker v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :type="context.inputType"
27
+ <l-date-picker v-model="value" v-bind="context.attrs" :label="label" :error="error" :type="context.inputType"
19
28
  :error-message="errorMessage" :disable="context.disabled">
20
29
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
21
30
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -25,18 +25,12 @@ const onBlur = () => {
25
25
 
26
26
  const light = useLight();
27
27
 
28
- const attrs = {
29
- ...{
30
- filled: light.getStyle("inputFilled"),
31
- outlined: light.getStyle("inputOutlined"),
32
- standout: light.getStyle("inputStandout"),
33
- rounded: light.getStyle("inputRounded"),
34
- dense: light.getStyle("inputDense"),
35
- square: light.getStyle("inputSquare"),
36
- stackLabel: light.getStyle("inputStackLabel")
37
- },
38
- ...props.context.attrs
39
- }
28
+ const attrs = computed(() => {
29
+ return {
30
+ ...light.styles.input,
31
+ ...JSON.parse(JSON.stringify(props.context.attrs))
32
+ }
33
+ })
40
34
 
41
35
  </script>
42
36
  <template>
@@ -45,14 +45,20 @@ const onBlur = () => {
45
45
  error.value = false
46
46
  }
47
47
  }
48
+
49
+ const label = computed(() => {
50
+ let l = props.context.label;
51
+ if (props.context.state.required) {
52
+ l = "* " + l
53
+ }
54
+ return l
55
+ })
56
+
48
57
  </script>
49
58
  <template>
50
59
 
51
- <l-input v-model="value" :label="context?.label" v-bind="context?.attrs" :error="error" :type="context?.inputType"
52
- :error-message="errorMessage" @blur="onBlur"
53
- :disable="context.disabled"
54
-
55
- >
60
+ <l-input v-model="value" v-bind="context?.attrs" :label="label" :error="error" :type="context?.inputType"
61
+ :error-message="errorMessage" @blur="onBlur" :disable="context.disabled">
56
62
 
57
63
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
58
64
  <slot :name="name" v-bind="props ?? {}"></slot>
@@ -14,17 +14,9 @@ const value = computed({
14
14
  set: (val) => props.context.node.input(val)
15
15
  })
16
16
 
17
- //check required in parsedRules
18
- let required = false;
19
- for (let rule of props.context.node.props.parsedRules ?? []) {
20
- if (rule.name === "required") {
21
- required = true;
22
- break;
23
- }
24
- }
25
17
 
26
18
  let clearable = false;
27
- if (required) { //no clearable
19
+ if (props.context.state.required) { //no clearable
28
20
  clearable = false;
29
21
  } else {
30
22
  clearable = true;
@@ -33,7 +25,7 @@ if (required) { //no clearable
33
25
  </script>
34
26
  <template>
35
27
  <l-select v-model="value" :label="context.label" v-bind="context.attrs" :error="error" :error-message="errorMessage"
36
- :clearable="clearable" :required="required" :disable="context.disabled">
28
+ :clearable="clearable" :required="context.state.required" :disable="context.disabled">
37
29
  <template v-for="(s, name) in $slots" v-slot:[name]="props" :key="name">
38
30
  <slot :name="name" v-bind="props ?? {}"></slot>
39
31
  </template>
@@ -15,6 +15,7 @@ export interface User {
15
15
  language?: string;
16
16
  }
17
17
  declare const light: {
18
+ styles: any;
18
19
  version: string;
19
20
  errors: Array<Error>;
20
21
  $q: {
@@ -604,22 +605,20 @@ declare const light: {
604
605
  isDarkMode: () => boolean;
605
606
  addError: (err: Error) => void;
606
607
  removeError: (error: Error) => void;
607
- getStyle: (name: string) => any;
608
- setStyles: (s: Object) => void;
609
- getStyles: () => {
610
- [key: string]: any;
611
- };
612
608
  setStyle: (name: string, value: any) => Promise<void>;
613
609
  setCurrentRoute: (to: any) => void;
614
610
  getID: () => number | null;
615
611
  init: (styles: any) => void;
616
612
  isGranted: (right?: string) => boolean;
617
613
  setPermissions: (permissions: Array<string>) => void;
614
+ getInputProps: (props: any) => any;
615
+ getButtonProps: (props: any) => any;
618
616
  };
619
617
  export declare const createLight: (opts: any) => {
620
618
  install: (app: App) => void;
621
619
  };
622
620
  export declare const useLight: () => {
621
+ styles: any;
623
622
  version: string;
624
623
  errors: Array<Error>;
625
624
  $q: {
@@ -1209,16 +1208,13 @@ export declare const useLight: () => {
1209
1208
  isDarkMode: () => boolean;
1210
1209
  addError: (err: Error) => void;
1211
1210
  removeError: (error: Error) => void;
1212
- getStyle: (name: string) => any;
1213
- setStyles: (s: Object) => void;
1214
- getStyles: () => {
1215
- [key: string]: any;
1216
- };
1217
1211
  setStyle: (name: string, value: any) => Promise<void>;
1218
1212
  setCurrentRoute: (to: any) => void;
1219
1213
  getID: () => number | null;
1220
1214
  init: (styles: any) => void;
1221
1215
  isGranted: (right?: string) => boolean;
1222
1216
  setPermissions: (permissions: Array<string>) => void;
1217
+ getInputProps: (props: any) => any;
1218
+ getButtonProps: (props: any) => any;
1223
1219
  };
1224
1220
  export {};
@@ -32,14 +32,36 @@ const COLOR_CODE = {
32
32
  dark: "#4b4b4b"
33
33
  };
34
34
  let styles = {};
35
- let defaultStyle = {
36
- inputOutlined: true,
37
- inputStackLabel: true,
38
- tableFlat: true,
39
- tableBorder: true,
40
- tableSeparator: "cell"
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
+ }
41
62
  };
42
63
  const light = reactive({
64
+ styles: {},
43
65
  version: packageJson.version,
44
66
  errors: [],
45
67
  $q: null,
@@ -163,21 +185,6 @@ const light = reactive({
163
185
  light.errors.splice(index, 1);
164
186
  }
165
187
  },
166
- getStyle(name) {
167
- if (styles[name] === void 0) {
168
- if (defaultStyle[name] !== void 0) {
169
- return defaultStyle[name];
170
- }
171
- return false;
172
- }
173
- return styles[name];
174
- },
175
- setStyles(s) {
176
- styles = s;
177
- },
178
- getStyles() {
179
- return styles;
180
- },
181
188
  async setStyle(name, value) {
182
189
  await m("updateMyStyle", {
183
190
  name,
@@ -199,7 +206,11 @@ const light = reactive({
199
206
  init(styles2) {
200
207
  light.color = styles2.color || "primary";
201
208
  light.theme = styles2.theme || "semi-dark";
202
- light.setStyles(styles2);
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 || {} };
213
+ light.styles = styles2;
203
214
  watch(() => light.theme, async () => {
204
215
  await light.setStyle("theme", light.theme);
205
216
  });
@@ -224,6 +235,34 @@ const light = reactive({
224
235
  },
225
236
  setPermissions(permissions) {
226
237
  this.permissions = permissions;
238
+ },
239
+ getInputProps(props) {
240
+ const attr = {
241
+ color: light.color,
242
+ ...light.styles.input,
243
+ ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== void 0))
244
+ };
245
+ if (props.label !== void 0) {
246
+ attr.label = light.$t(props.label);
247
+ if (props.required) {
248
+ attr.label = "* " + attr.label;
249
+ }
250
+ }
251
+ if (props.hint !== void 0) {
252
+ attr.hint = light.$t(props.hint);
253
+ }
254
+ return attr;
255
+ },
256
+ getButtonProps(props) {
257
+ const attr = {
258
+ color: light.color,
259
+ ...light.styles.button,
260
+ ...Object.fromEntries(Object.entries(props).filter(([key, value]) => value !== void 0))
261
+ };
262
+ if (props.label !== void 0) {
263
+ attr.label = light.$t(props.label);
264
+ }
265
+ return attr;
227
266
  }
228
267
  });
229
268
  export const createLight = (opts) => {