@hostlink/nuxt-light 1.15.0 → 1.15.2

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.0",
4
+ "version": "1.15.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.3",
7
7
  "unbuild": "2.0.0"
@@ -19,14 +19,18 @@ const props = defineProps({
19
19
  </script>
20
20
 
21
21
  <style scoped>
22
- body.body--dark fieldset{border-color:hsla(0,0%,100%,.6)}fieldset{border:1px solid rgba(0,0,0,.24);border-radius:4px;margin:0}legend{padding-left:.5rem;padding-right:.5rem}
22
+ body.body--dark fieldset{border-color:hsla(0,0%,100%,.6)}fieldset{border:1px solid rgba(0,0,0,.24);border-radius:4px}legend{padding-left:.5rem;padding-right:.5rem}
23
23
  </style>
24
24
  <template>
25
- <fieldset :class="`q-gutter-${props.gutter}`">
25
+ <fieldset>
26
26
  <legend v-if="props.label">{{ i18n.t(props.label) }}</legend>
27
- <slot></slot>
28
27
 
29
- {{ props }}
28
+ <div :class="`q-gutter-${props.gutter}`">
29
+ <slot></slot>
30
+ </div>
31
+
32
+
33
+
30
34
 
31
35
  </fieldset>
32
36
  </template>
@@ -416,17 +416,21 @@ if (route.fullPath == "/" && my.default_page) {
416
416
 
417
417
  <q-page-container :class="containerClass" :style="containerStyle"> <!-- Error message -->
418
418
  <slot name="header"></slot>
419
- <q-banner dense inline-actions class="bg-grey-4 q-ma-md" v-for=" error in errors " rounded>
420
- {{ error }}
421
- <template v-slot:action>
422
- <q-btn flat label="Detail" @click="$q.dialog({
423
- title: 'Error Detail',
424
- message: error.stack,
425
- fullWidth: true,
426
- })"></q-btn>
427
- <q-btn flat icon="sym_o_close" round dense @click="light.removeError(error)" />
428
- </template>
429
- </q-banner>
419
+ <div class="q-gutter-sm q-pa-sm" v-if="errors.length > 0">
420
+ <q-banner dense inline-actions class="bg-grey-4" v-for=" error in errors " rounded>
421
+ {{ error }}
422
+ <template v-slot:action>
423
+ <q-btn flat label="Detail" @click="$q.dialog({
424
+ title: 'Error Detail',
425
+ message: error.stack,
426
+ fullWidth: true,
427
+ })"></q-btn>
428
+ <q-btn flat icon="sym_o_close" round dense @click="light.removeError(error)" />
429
+ </template>
430
+ </q-banner>
431
+
432
+ </div>
433
+
430
434
 
431
435
  <!-- router-view v-slot="{ Component }">
432
436
 
@@ -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(() => {
@@ -11,7 +11,7 @@ const props = defineProps({
11
11
  type: String,
12
12
  default: '500px'
13
13
  },
14
- ok: {
14
+ save: {
15
15
  type: Function,
16
16
  default: null
17
17
  },
@@ -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
  })
@@ -37,14 +41,19 @@ const loading = ref(false)
37
41
 
38
42
  const emits = defineEmits(['submit'])
39
43
 
40
-
41
- const onOk = async (data, node) => {
44
+ const onSubmit = async (data, node) => {
42
45
  emits('submit', data)
43
46
 
44
- if (props.ok) {
47
+ if (props.save) {
45
48
  loading.value = true
46
49
  try {
47
- await props.ok(data)
50
+ await props.save(data)
51
+ if (props.showNotification) {
52
+ $q.notify({
53
+ type: 'positive',
54
+ message: 'Data saved successfully'
55
+ })
56
+ }
48
57
  onDialogOK(data)
49
58
  } catch (error) {
50
59
 
@@ -52,6 +61,7 @@ const onOk = async (data, node) => {
52
61
  title: 'Error',
53
62
  message: error.message
54
63
  })
64
+
55
65
  } finally {
56
66
  loading.value = false
57
67
  }
@@ -82,14 +92,16 @@ const onCancel = async () => {
82
92
  <q-btn icon="sym_o_close" flat round dense v-close-popup />
83
93
  </q-toolbar>
84
94
 
85
- <form-kit type="form" :bordered="false" :actions="false" :value="value" #default="context" @submit="onOk">
95
+ <form-kit type="form" :bordered="false" :actions="false" :value="value" #default="context"
96
+ @submit="onSubmit">
86
97
 
87
98
  <q-card-section>
88
99
  <slot name="default" v-bind="context"></slot>
89
100
  </q-card-section>
90
101
  <q-card-actions align="right">
91
- <q-btn label="Cancel" @click="onCancel" unelevated color="grey-4" text-color="grey-8" />
92
- <q-btn label="OK" 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" />
93
105
  </q-card-actions>
94
106
  </form-kit>
95
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" dense />
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
 
@@ -608,10 +611,10 @@ const onAdd = () => {
608
611
  <div :class="{ 'text-grey-8': !isDark }" v-if="primaryKey">
609
612
 
610
613
  <l-view-btn v-if="actionView && props.row.canView"
611
- :to="`/${modelName}/${props.row[primaryKey]}/view`" size="sm"/>
614
+ :to="`/${modelName}/${props.row[primaryKey]}/view`" size="sm" />
612
615
 
613
616
  <l-edit-btn v-if="activeEdit && props.row.canUpdate"
614
- :to="`/${modelName}/${props.row[primaryKey]}/edit`" size="sm"/>
617
+ :to="`/${modelName}/${props.row[primaryKey]}/edit`" size="sm" />
615
618
 
616
619
  <l-delete-btn v-if="actionDelete && props.row.canDelete"
617
620
  @submit="onDelete(props.row[primaryKey])" size="sm"></l-delete-btn>
@@ -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,12 +1,12 @@
1
1
  <script setup>
2
2
  import { ref } from 'vue'
3
3
  const form = ref(null)
4
- const ok = async (data, node) => {
4
+ const save = async (data, node) => {
5
5
  await new Promise(resolve => setTimeout(resolve, 1000))
6
6
  }
7
7
  </script>
8
8
  <template>
9
- <l-form-dialog title="Add User" :ok="ok">
9
+ <l-form-dialog title="Add User" :save="save">
10
10
  <form-kit type="l-input" name="name" label="Name" dense validation="required" />
11
11
  </l-form-dialog>
12
12
  </template>
@@ -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}`">
@@ -1,22 +1,14 @@
1
1
  <script setup lang="ts">
2
- import { type FormKitInputs } from '@formkit/inputs';
3
2
  import { computed } from 'vue'
4
3
  import { getErrorMessage } from 'formkit-quasar';
5
4
 
6
- declare module '@formkit/inputs' {
7
- interface FormKitInputProps<Props extends FormKitInputs<Props>> {
8
- lInput: {
9
- type: 'l-input';
10
- name: string;
11
- label: string;
12
- number?: string;
13
- };
14
- }
15
- }
16
5
 
17
6
 
18
7
  const props = defineProps({
19
- context: Object
8
+ context: {
9
+ type: Object,
10
+ required: true
11
+ }
20
12
  });
21
13
 
22
14
  const { error, errorMessage } = getErrorMessage(props.context?.node);
@@ -24,7 +16,7 @@ const { error, errorMessage } = getErrorMessage(props.context?.node);
24
16
  const value = computed({
25
17
  get: () => props.context?.value,
26
18
  set: (val) => {
27
- if (props.context?.number !== undefined) {
19
+ if (props.context.number !== undefined) {
28
20
  if (val === "") {
29
21
  props.context?.node.input(0)
30
22
  return
@@ -32,18 +24,18 @@ const value = computed({
32
24
 
33
25
  let tryprase = parseInt(val)
34
26
  if (isNaN(tryprase)) {
35
- props.context?.node.input(val)
27
+ props.context.node.input(val)
36
28
  return
37
29
  }
38
30
 
39
- if (props.context?.number === "integer") {
40
- props.context?.node.input(parseInt(val))
31
+ if (props.context.number === "integer") {
32
+ props.context.node.input(parseInt(val))
41
33
  return
42
34
  }
43
35
 
44
36
  props.context.node.input(parseFloat(val))
45
37
  } else {
46
- props.context?.node.input(val)
38
+ props.context.node.input(val)
47
39
  }
48
40
  }
49
41
  })
@@ -1,3 +1,4 @@
1
+ import { type FormKitInputs } from '@formkit/inputs';
1
2
  export interface User {
2
3
  user_id?: number;
3
4
  username: string;
@@ -54,6 +55,25 @@ declare module 'vue' {
54
55
  $light: typeof app;
55
56
  }
56
57
  }
58
+ declare module '@formkit/inputs' {
59
+ interface FormKitInputProps<Props extends FormKitInputs<Props>> {
60
+ lInput: {
61
+ type: 'l-input';
62
+ name: string;
63
+ label: string;
64
+ number?: string;
65
+ dense?: boolean;
66
+ };
67
+ }
68
+ interface FormKitInputProps<Props extends FormKitInputs<Props>> {
69
+ lDatePicker: {
70
+ type: 'l-date-picker';
71
+ name: string;
72
+ label: string;
73
+ dense?: boolean;
74
+ };
75
+ }
76
+ }
57
77
  export declare const useLight: (options?: {
58
78
  color?: string;
59
79
  }) => {
@@ -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" />
@@ -20,8 +20,9 @@ const columns = model("User").columns({
20
20
  const status = ref("0");
21
21
 
22
22
  //const testDialog = resolveComponent("l-test-dialog")
23
- //const testDialog = resolveComponent("l-test2")
23
+
24
24
  const testDialog = null
25
+ //const testDialog = resolveComponent("l-test2")
25
26
 
26
27
 
27
28
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",