@hostlink/nuxt-light 1.15.1 → 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.1",
4
+ "version": "1.15.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.3",
7
7
  "unbuild": "2.0.0"
@@ -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(() => {
@@ -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
 
@@ -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>
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.2",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",