@hostlink/nuxt-light 1.15.1 → 1.15.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.15.1",
4
+ "version": "1.15.3",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.3",
7
7
  "unbuild": "2.0.0"
@@ -344,7 +344,7 @@ if (route.fullPath == "/" && my.default_page) {
344
344
 
345
345
  <q-btn flat round dense icon="sym_o_person" class="q-mr-sm">
346
346
  <q-menu max-width="250px">
347
- <q-list>
347
+ <q-list >
348
348
  <q-item v-close-popup to="/User/profile">
349
349
  <q-item-section avatar>
350
350
  <q-icon name="sym_o_person" />
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from "vue"
3
- import { type QCheckboxProps } from "quasar"
3
+ import type { QCheckboxProps } from "quasar"
4
4
 
5
- export interface LCheckboxProps extends QCheckboxProps {
5
+ export interface LCheckboxProps extends QCheckboxProps {
6
6
  }
7
7
 
8
8
  const emit = defineEmits(["update:modelValue"]);
@@ -1,22 +1,18 @@
1
- <script setup>
1
+ <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- const props = defineProps({
4
- md: {
5
- type: [Number, String],
6
- default: 12
7
- },
8
- sm: {
9
- type: [Number, String],
10
- default: 12
11
- },
12
- xs: {
13
- type: [Number, String],
14
- default: 12
15
- },
16
- gutter: {
17
- type: String,
18
- default: "md"
19
- }
3
+
4
+ export interface LColProps {
5
+ md?: number | string;
6
+ sm?: number | string;
7
+ xs?: number | string;
8
+ gutter?: "xs" | "sm" | "md" | "lg" | "xl" | "none";
9
+ }
10
+
11
+ const props = withDefaults(defineProps<LColProps>(), {
12
+ md: 12,
13
+ sm: 12,
14
+ xs: 12,
15
+ gutter: "md"
20
16
  })
21
17
 
22
18
  const classes = computed(() => {
@@ -2,11 +2,13 @@
2
2
  import { ref, computed } from "vue";
3
3
  import { useLight } from '#imports';
4
4
 
5
- import { type QDateProps } from "quasar";
5
+ import { date, type QDateProps, type QInputProps } from "quasar";
6
6
  import { useI18n } from 'vue-i18n';
7
7
 
8
8
  const { t } = useI18n();
9
9
 
10
+ const modelValue = defineModel<string | DateRange | null | undefined>();
11
+
10
12
  interface DateRange {
11
13
  from: string,
12
14
  to: string
@@ -14,7 +16,6 @@ interface DateRange {
14
16
 
15
17
 
16
18
  export interface LDatePickerProps {
17
- modelValue?: string | DateRange
18
19
  label?: string
19
20
  required?: boolean
20
21
  hideBottomSpace?: boolean
@@ -40,67 +41,59 @@ const props = withDefaults(defineProps<LDatePickerProps>(), {
40
41
  square: undefined,
41
42
  stackLabel: undefined,
42
43
  mask: "YYYY-MM-DD",
44
+ range: false
43
45
  })
44
46
 
45
47
 
46
48
  const light = useLight();
47
49
 
48
- const emit = defineEmits<{
49
- (e: 'update:modelValue', value?: string | object): void
50
- }>();
51
-
52
50
  const popup = ref<any>(null);
53
51
  const localValue = computed({
54
52
  get: () => {
55
- //if is object
56
- if (props.modelValue) {
57
- if (typeof props.modelValue == "object") {
58
- return props.modelValue.from + " - " + props.modelValue.to
53
+ if (modelValue.value) {
54
+ if (typeof modelValue.value == "object") {
55
+ return modelValue.value.from + " - " + modelValue.value.to
59
56
  }
60
57
  }
61
58
 
62
- return props.modelValue
59
+ return modelValue.value
63
60
  },
64
- set: (value) => {
65
- if (value == null) {
66
- emit('update:modelValue', value)
67
- return;
68
- }
69
-
70
- //is object
71
- if (typeof value == "object") {
72
- emit('update:modelValue', value)
73
- return;
74
- }
61
+ set: (value: string) => {
62
+
75
63
 
76
64
  if (props.range) {
77
-
78
65
  //try to split
79
66
  const parts = value.split(" - ");
80
67
  if (parts.length == 2) {
81
68
  const from = parts[0];
82
69
  const to = parts[1];
83
70
  if (from.match(/^\d{4}-\d{2}-\d{2}$/) && to.match(/^\d{4}-\d{2}-\d{2}$/)) {
84
- emit('update:modelValue', { from, to })
71
+ modelValue.value = { from, to }
85
72
  return;
86
73
  }
87
74
  }
88
75
  }
89
76
 
90
- emit('update:modelValue', value)
77
+ if (value.match(/^\d{4}-\d{2}-\d{2}$/)) {
78
+ modelValue.value = value;
79
+ return;
80
+ }
81
+
82
+
83
+ modelValue.value = null;
91
84
  }
92
85
  });
93
86
 
94
87
  const dateValue = computed({
95
88
  get: () => {
96
- return props.modelValue
89
+ return modelValue
97
90
  },
98
- set: (value) => {
91
+ set: (value: string) => {
99
92
  if (popup.value) {
100
93
  popup.value.hide();
101
94
  }
102
- (localValue as any).value = value;
103
- emit('update:modelValue', value)
95
+ localValue.value = value;
96
+ modelValue.value = value;
104
97
  }
105
98
  });
106
99
 
@@ -126,7 +119,11 @@ if (!props.range) {
126
119
  }
127
120
 
128
121
  const input_attrs = computed(() => {
129
- let a = { ...props }
122
+ let a: QInputProps = {
123
+ modelValue: localValue.value,
124
+ ...props
125
+ }
126
+
130
127
  a.rules = rules;
131
128
  a.mask = props.range ? "####-##-## - ####-##-##" : "####-##-##"
132
129
 
@@ -24,6 +24,10 @@ const props = defineProps({
24
24
  default: () => {
25
25
  return {}
26
26
  }
27
+ },
28
+ showNotification: {
29
+ type: Boolean,
30
+ default: true
27
31
  }
28
32
 
29
33
  })
@@ -44,10 +48,12 @@ const onSubmit = async (data, node) => {
44
48
  loading.value = true
45
49
  try {
46
50
  await props.save(data)
47
- $q.notify({
48
- type: 'positive',
49
- message: 'Data saved successfully'
50
- })
51
+ if (props.showNotification) {
52
+ $q.notify({
53
+ type: 'positive',
54
+ message: 'Data saved successfully'
55
+ })
56
+ }
51
57
  onDialogOK(data)
52
58
  } catch (error) {
53
59
 
@@ -86,14 +92,16 @@ const onCancel = async () => {
86
92
  <q-btn icon="sym_o_close" flat round dense v-close-popup />
87
93
  </q-toolbar>
88
94
 
89
- <form-kit type="form" :bordered="false" :actions="false" :value="value" #default="context" @submit="onSubmit">
95
+ <form-kit type="form" :bordered="false" :actions="false" :value="value" #default="context"
96
+ @submit="onSubmit">
90
97
 
91
98
  <q-card-section>
92
99
  <slot name="default" v-bind="context"></slot>
93
100
  </q-card-section>
94
101
  <q-card-actions align="right">
95
- <q-btn icon="sym_o_close" :label="$t('Cancel')" @click="onCancel" unelevated color="grey-4" text-color="grey-8" />
96
- <q-btn icon="sym_o_check" :label="$t('Save')" type="submit" color="primary" unelevated :disabled="!context.state.valid" />
102
+ <q-btn icon="sym_o_close" :label="$t('Cancel')" @click="onCancel" unelevated />
103
+ <q-btn icon="sym_o_check" :label="$t('Save')" type="submit" :color="$light.color" unelevated
104
+ :disabled="!context.state.valid" />
97
105
  </q-card-actions>
98
106
  </form-kit>
99
107
 
@@ -1,6 +1,17 @@
1
+ <script setup lang="ts">
2
+
3
+ export interface LRowProps {
4
+ gutter?: "xs" | "sm" | "md" | "lg" | "xl" | "none";
5
+ }
6
+
7
+ withDefaults(defineProps<LRowProps>(), {
8
+ gutter: "md"
9
+ })
10
+
11
+ </script>
1
12
  <template>
2
13
  <div>
3
- <div class="row q-col-gutter-md">
14
+ <div class="row" :class="`q-col-gutter-${gutter}`">
4
15
  <slot></slot>
5
16
  </div>
6
17
  </div>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { useQuasar, QTable, type QTableColumn, type QTableProps, Dialog } from 'quasar';
2
+ import { useQuasar, QTable, type QTableColumn, type QTableProps, Dialog, QTab } from 'quasar';
3
3
 
4
4
  import { ref, computed, onMounted, useSlots, useAttrs, watch, defineComponent, h } from "vue";
5
5
  import { t, q, useLight, GQLFieldBuilder, model } from '../';
@@ -19,9 +19,9 @@ export type LTableColumn = QTableColumn & {
19
19
  searchMultiple?: boolean,
20
20
  gqlField?: string | Array<string> | Object,
21
21
  backgroundColor?: string | Function
22
-
23
22
  }
24
23
 
24
+
25
25
  const errors = ref<InstanceType<any>>([
26
26
  ]);
27
27
 
@@ -38,6 +38,7 @@ export type LTableProps = QTableProps & {
38
38
  rows?: Array<any>,
39
39
  onRequestData?: (request: LTableRequest) => void
40
40
  addComponent?: Dialog
41
+ addComponentProps?: any
41
42
  }
42
43
 
43
44
 
@@ -64,6 +65,7 @@ const props = withDefaults(defineProps<LTableProps>(), {
64
65
  dark: undefined,
65
66
  });
66
67
 
68
+
67
69
  const isServerSide = (props.rows == undefined);
68
70
 
69
71
 
@@ -370,7 +372,7 @@ const onLocalRequest = async (p: any) => {
370
372
 
371
373
  loading.value = true;
372
374
  //emits("request", p);
373
- emits("requestData", callback);
375
+ emits("request-data", callback);
374
376
 
375
377
  }
376
378
 
@@ -547,8 +549,9 @@ const onAdd = () => {
547
549
  if (!props.addComponent) return;
548
550
 
549
551
  $q.dialog({
552
+ component: props.addComponent,
553
+ componentProps: props.addComponentProps,
550
554
 
551
- component: props.addComponent
552
555
  }).onOk(() => {
553
556
  requestServerInteraction();
554
557
  })
@@ -561,7 +564,7 @@ const onAdd = () => {
561
564
  v-model:minimized="minimized" v-model:maximized="maximized">
562
565
 
563
566
  <q-toolbar v-if="addComponent">
564
- <q-btn icon="sym_o_add" label="Add" color="primary" @click="onAdd" v-if="addComponent" />
567
+ <q-btn icon="sym_o_add" :label="$t('Add')" :color="$light.color" @click="onAdd" v-if="addComponent" />
565
568
  </q-toolbar>
566
569
 
567
570
 
@@ -678,7 +681,7 @@ const onAdd = () => {
678
681
  <template v-if="col.searchType == 'number'">
679
682
  <q-input style="min-width: 80px;" dense clearable filled square
680
683
  v-model.number="filters[col.name]" @keydown.enter.prevent="onFilters"
681
- @clear="onFilters" mask="##########" enterkeyhint="search"></q-input>
684
+ @clear="onFilters" mask="##########" :enterkeyhint="$t('search')"></q-input>
682
685
  </template>
683
686
 
684
687
  <template v-if="col.searchType == 'select'">
@@ -695,10 +698,10 @@ const onAdd = () => {
695
698
  @clear="onFilters" />
696
699
  </template>
697
700
 
698
- <template v-if="!col.searchType">
701
+ <template v-if="!col.searchType || col.searchType == 'text'">
699
702
  <q-input style="min-width: 80px;" dense clearable filled square
700
703
  v-model="filters[col.name]" @keydown.enter.prevent="onFilters" @clear="onFilters"
701
- enterkeyhint="search" :color="$light.color"></q-input>
704
+ :enterkeyhint="$t('search')" :color="$light.color"></q-input>
702
705
 
703
706
  </template>
704
707
 
@@ -1,64 +1,84 @@
1
- <script setup>
1
+ <script setup lang="ts">
2
2
  import { computed, ref, useAttrs } from "vue";
3
- import { useLight } from '../';
3
+ import { useLight } from '#imports';
4
+ import type { ValidationRule, QInputProps } from "quasar";
5
+ import { useI18n } from "vue-i18n";
4
6
  const light = useLight();
7
+ const { t } = useI18n();
8
+ const modelValue = defineModel<string | null | undefined>();
5
9
 
6
- const props = defineProps({
7
- modelValue: {
8
- type: [String, Object],
9
- required: false,
10
- default: null
11
- }, required: {
12
- type: Boolean,
13
- default: false
14
- },
15
- label: {
16
- type: String,
17
- },
18
- hint: {
19
- type: String,
20
- default: ""
21
- }
22
- });
10
+ export interface LTimePickerProps {
11
+ modelValue?: string | null | undefined
12
+ required?: boolean
13
+ label?: string
14
+ hint?: string
15
+ nowBtn?: boolean
16
+ withSeconds?: boolean
17
+ format24h?: boolean
18
+ mask?: string
19
+ hideBottomSpace?: boolean
20
+ }
21
+
22
+ const props = withDefaults(defineProps<LTimePickerProps>(), {
23
+ required: false,
24
+ format24h: true,
25
+ mask: "time",
26
+ hideBottomSpace: true
27
+ })
23
28
 
24
- const emit = defineEmits(["update:modelValue"]);
25
29
  const popup = ref(null);
26
- const localValue = computed({
27
- get: () => props.modelValue,
28
- set: (value) => {
29
- // popup.value.hide();
30
- emit('update:modelValue', value)
30
+ const localValue = computed<string | null | undefined>({
31
+ get: (): string | null | undefined => {
32
+ return modelValue.value;
33
+ },
34
+ set: (value: string | null | undefined) => {
35
+ modelValue.value = value;
31
36
  }
32
37
  });
33
38
 
34
- const rules = ["timeOrFulltime"];
39
+ const rules: ValidationRule[] = ["timeOrFulltime"];
35
40
  //const rules = [];
36
41
  if (props.required) {
37
42
  rules.push(val => !!val || 'Required.');
38
43
  }
39
44
 
40
45
 
41
- const attrs = {
42
- ...{
46
+ const input_attrs = computed(() => {
47
+
48
+ let attrs: QInputProps = {
49
+ modelValue: localValue.value,
43
50
  filled: light.getStyle("inputFilled"),
44
51
  outlined: light.getStyle("inputOutlined"),
45
52
  standout: light.getStyle("inputStandout"),
46
53
  rounded: light.getStyle("inputRounded"),
47
54
  dense: light.getStyle("inputDense"),
48
55
  square: light.getStyle("inputSquare"),
49
- stackLabel: light.getStyle("inputStackLabel")
50
- },
51
- ...useAttrs(),
52
- }
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
+ }
53
66
 
67
+ if (props.mask) {
68
+ attrs.mask = props.mask;
69
+ }
70
+ return attrs;
71
+ })
54
72
 
55
73
  </script>
56
74
  <template>
57
- <q-input v-bind="attrs" v-model="localValue" mask="time" :rules="rules" :label="$t(label)" :hint="$t(hint)">
75
+ <q-input v-bind="input_attrs" v-model="localValue" :rules="rules" :color="$light.color"
76
+ :hide-bottom-space="hideBottomSpace">
58
77
  <template v-slot:prepend>
59
78
  <q-btn icon="sym_o_access_time" round dense flat>
60
79
  <q-popup-proxy cover transition-show="scale" transition-hide="scale" ref="popup">
61
- <q-time v-model="localValue" format24h>
80
+ <q-time v-model="localValue" :format24h="format24h" :color="$light.color" :now-btn="nowBtn"
81
+ :with-seconds="withSeconds">
62
82
  <div class="row items-center justify-end">
63
83
  <q-btn v-close-popup label="Close" :color="$light.color" flat />
64
84
  </div>
@@ -12,7 +12,7 @@ declare module '@formkit/inputs' {
12
12
  interface FormKitInputProps<Props extends FormKitInputs<Props>> {
13
13
  lForm: {
14
14
  type: 'l-form';
15
- gutter?: string;
15
+ gutter?: 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
16
16
  bordered?: boolean;
17
17
  };
18
18
  }
@@ -20,7 +20,10 @@ declare module '@formkit/inputs' {
20
20
 
21
21
 
22
22
  let props = defineProps({
23
- context: Object
23
+ context: {
24
+ type: Object,
25
+ required: true
26
+ }
24
27
  });
25
28
 
26
29
  let onSubmit = async () => {
@@ -31,12 +34,12 @@ const gutter = props.context?.gutter ?? "md";
31
34
 
32
35
  //check bordered is undefined
33
36
  let bordered = true;
34
- if (props.context?.bordered !== undefined) {
37
+ if (props.context.bordered !== undefined) {
35
38
  bordered = props.context.bordered;
36
39
  }
37
40
 
38
41
  let redirect = true;
39
- if (props.context?.attrs.onSubmitted) {
42
+ if (props.context.attrs.onSubmitted) {
40
43
 
41
44
  redirect = false;
42
45
  }
@@ -101,6 +104,8 @@ if (!props.context.onSubmit) {
101
104
  </script>
102
105
  <template>
103
106
  <form v-bind="context.attrs">
107
+
108
+
104
109
  <l-card :bordered="bordered">
105
110
  <q-card-section>
106
111
  <div :class="`q-gutter-${gutter}`">
@@ -5,7 +5,10 @@ import { getErrorMessage } from 'formkit-quasar';
5
5
 
6
6
 
7
7
  const props = defineProps({
8
- context: Object
8
+ context: {
9
+ type: Object,
10
+ required: true
11
+ }
9
12
  });
10
13
 
11
14
  const { error, errorMessage } = getErrorMessage(props.context?.node);
@@ -13,7 +16,7 @@ const { error, errorMessage } = getErrorMessage(props.context?.node);
13
16
  const value = computed({
14
17
  get: () => props.context?.value,
15
18
  set: (val) => {
16
- if (props.context?.number !== undefined) {
19
+ if (props.context.number !== undefined) {
17
20
  if (val === "") {
18
21
  props.context?.node.input(0)
19
22
  return
@@ -21,18 +24,18 @@ const value = computed({
21
24
 
22
25
  let tryprase = parseInt(val)
23
26
  if (isNaN(tryprase)) {
24
- props.context?.node.input(val)
27
+ props.context.node.input(val)
25
28
  return
26
29
  }
27
30
 
28
- if (props.context?.number === "integer") {
29
- props.context?.node.input(parseInt(val))
31
+ if (props.context.number === "integer") {
32
+ props.context.node.input(parseInt(val))
30
33
  return
31
34
  }
32
35
 
33
36
  props.context.node.input(parseFloat(val))
34
37
  } else {
35
- props.context?.node.input(val)
38
+ props.context.node.input(val)
36
39
  }
37
40
  }
38
41
  })
@@ -6,7 +6,7 @@ export interface LightModelField {
6
6
  sortable?: boolean;
7
7
  searchable?: boolean;
8
8
  autoWidth?: boolean;
9
- searchType?: string;
9
+ searchType?: "date" | "text" | "number" | "select";
10
10
  name?: string;
11
11
  gqlField?: LightModelGqlField;
12
12
  to?: (row: any) => string;
@@ -63,15 +63,21 @@ const columns = [
63
63
  <l-btn label="Add" icon="sym_o_add" @click="dialog = true"></l-btn>
64
64
  </template>
65
65
  <q-dialog v-model="dialog" persistent>
66
- <l-card style="width: 500px; max-width: 90vw;" :bordered="false" closeable>
66
+ <q-card style="width: 500px;">
67
67
 
68
+ <q-toolbar>
69
+ <q-toolbar-title>{{ $t('Add File System') }}</q-toolbar-title>
70
+ <q-space></q-space>
71
+ <q-btn flat round dense icon="sym_o_close" v-close-popup></q-btn>
72
+ </q-toolbar>
68
73
 
69
74
  <FormKit type="l-form" :value="value" @submit="onSubmit" #default="{ value }">
70
75
  <FormKit type="l-input" label="Name" name="name" validation="required"></FormKit>
71
76
  <FormKit type="l-select" label="Type" name="type" validation="required" :options="[
72
77
  { label: 'Local', value: 'local' },
73
78
  { label: 'S3', value: 'S3' },
74
- { label: 'HostLink storage', value: 'hostlink' }
79
+ { label: 'HostLink storage', value: 'hostlink' },
80
+ { label: 'Aliyun OSS', value: 'aliyun-oss' }
75
81
  ]"></FormKit>
76
82
 
77
83
  <FormKit type="group" name="data">
@@ -97,11 +103,21 @@ const columns = [
97
103
  <FormKit type="l-input" label="Endpoint" name="endpoint" validation="required"></FormKit>
98
104
  <FormKit type="l-input" label="Token" name="token" validation="required"></FormKit>
99
105
  </template>
106
+
107
+ <template v-if="value.type == 'aliyun-oss'">
108
+ <FormKit type="l-input" label="Access Key" name="access_key_id" validation="required">
109
+ </FormKit>
110
+ <FormKit type="l-input" label="Secret Key" name="access_key_secret" validation="required">
111
+ </FormKit>
112
+ <FormKit type="l-input" label="Endpoint" name="endpoint" validation="required"></FormKit>
113
+ <FormKit type="l-input" label="Bucket" name="bucket" validation="required"></FormKit>
114
+ <FormKit type="l-input" label="Prefix" name="prefix"></FormKit>
115
+ </template>
100
116
  </FormKit>
101
117
 
102
118
  </FormKit>
103
- </l-card>
104
119
 
120
+ </q-card>
105
121
  </q-dialog>
106
122
 
107
123
  <l-table :rows="items" :columns="columns">
@@ -24,7 +24,7 @@ const languages = tt.app.languages.map((lang) => {
24
24
 
25
25
  <template>
26
26
  <l-page>
27
- <FormKit type="l-form" :value="obj">
27
+ <FormKit type="l-form" :value="obj" gutter="none">
28
28
  <l-row>
29
29
  <l-col md="6">
30
30
  <FormKit type="l-input" label="Username" name="username" validation="required" />
@@ -21,8 +21,8 @@ const status = ref("0");
21
21
 
22
22
  //const testDialog = resolveComponent("l-test-dialog")
23
23
 
24
- //const testDialog = null
25
- const testDialog = resolveComponent("l-test2")
24
+ const testDialog = null
25
+ //const testDialog = resolveComponent("l-test2")
26
26
 
27
27
 
28
28
  </script>
@@ -46,7 +46,8 @@ eventLogCols.forEach(col => {
46
46
 
47
47
  </script>
48
48
  <template>
49
- <l-page title="User profile">
49
+ <l-page title="User profile" gutter="sm">
50
+
50
51
  <template #header>
51
52
  <l-btn icon="sym_o_password" to="setting/password" label="Update password" />
52
53
  <l-btn icon="sym_o_key" to="setting/two-factor-auth" label="Two factor auth" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",