@gameap/ui 1.1.1 → 1.2.0

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.
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <n-card
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
7
+ <slot :name="slotName" v-bind="slotProps || {}" />
8
+ </template>
9
+ </n-card>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue'
14
+ import { NCard } from 'naive-ui'
15
+
16
+ const props = defineProps({
17
+ title: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+ size: {
22
+ type: String,
23
+ default: 'small'
24
+ },
25
+ bordered: {
26
+ type: Boolean,
27
+ default: true
28
+ },
29
+ segmented: {
30
+ type: [Boolean, Object],
31
+ default: () => ({ content: true, footer: 'soft' })
32
+ },
33
+ headerClass: {
34
+ type: String,
35
+ default: 'g-card-header'
36
+ }
37
+ })
38
+
39
+ defineOptions({
40
+ inheritAttrs: false
41
+ })
42
+
43
+ const attrs = useAttrs()
44
+
45
+ const mergedProps = computed(() => ({
46
+ title: props.title,
47
+ size: props.size,
48
+ bordered: props.bordered,
49
+ segmented: props.segmented,
50
+ headerClass: props.headerClass,
51
+ ...attrs
52
+ }))
53
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <n-data-table
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
7
+ <slot :name="slotName" v-bind="slotProps || {}" />
8
+ </template>
9
+ </n-data-table>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue'
14
+ import { NDataTable } from 'naive-ui'
15
+
16
+ const props = defineProps({
17
+ bordered: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ singleLine: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ columns: {
26
+ type: Array,
27
+ default: () => []
28
+ },
29
+ data: {
30
+ type: Array,
31
+ default: () => []
32
+ },
33
+ loading: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ pagination: {
38
+ type: [Object, Boolean],
39
+ default: false
40
+ },
41
+ remote: {
42
+ type: Boolean,
43
+ default: false
44
+ }
45
+ })
46
+
47
+ defineOptions({
48
+ inheritAttrs: false
49
+ })
50
+
51
+ const attrs = useAttrs()
52
+
53
+ const mergedProps = computed(() => ({
54
+ bordered: props.bordered,
55
+ singleLine: props.singleLine,
56
+ columns: props.columns,
57
+ data: props.data,
58
+ loading: props.loading,
59
+ pagination: props.pagination,
60
+ remote: props.remote,
61
+ ...attrs
62
+ }))
63
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <n-divider v-bind="$attrs">
3
+ <slot />
4
+ </n-divider>
5
+ </template>
6
+
7
+ <script setup>
8
+ import { NDivider } from 'naive-ui'
9
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <n-empty
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
7
+ <slot :name="slotName" v-bind="slotProps || {}" />
8
+ </template>
9
+ </n-empty>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue'
14
+ import { NEmpty } from 'naive-ui'
15
+
16
+ const props = defineProps({
17
+ description: {
18
+ type: String,
19
+ default: undefined
20
+ },
21
+ size: {
22
+ type: String,
23
+ default: undefined
24
+ }
25
+ })
26
+
27
+ defineOptions({
28
+ inheritAttrs: false
29
+ })
30
+
31
+ const attrs = useAttrs()
32
+
33
+ const mergedProps = computed(() => ({
34
+ ...(props.description && { description: props.description }),
35
+ ...(props.size && { size: props.size }),
36
+ ...attrs
37
+ }))
38
+ </script>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <n-input
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
7
+ <slot :name="slotName" v-bind="slotProps || {}" />
8
+ </template>
9
+ </n-input>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue'
14
+ import { NInput } from 'naive-ui'
15
+
16
+ const props = defineProps({
17
+ value: {
18
+ type: [String, Array],
19
+ default: undefined
20
+ },
21
+ type: {
22
+ type: String,
23
+ default: 'text'
24
+ },
25
+ placeholder: {
26
+ type: String,
27
+ default: ''
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ readonly: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ clearable: {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ size: {
42
+ type: String,
43
+ default: undefined
44
+ }
45
+ })
46
+
47
+ defineOptions({
48
+ inheritAttrs: false
49
+ })
50
+
51
+ const emit = defineEmits(['update:value'])
52
+
53
+ const attrs = useAttrs()
54
+
55
+ const mergedProps = computed(() => ({
56
+ value: props.value,
57
+ 'onUpdate:value': (val) => emit('update:value', val),
58
+ type: props.type,
59
+ placeholder: props.placeholder,
60
+ disabled: props.disabled,
61
+ readonly: props.readonly,
62
+ clearable: props.clearable,
63
+ ...(props.size && { size: props.size }),
64
+ ...attrs
65
+ }))
66
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <n-modal
3
+ v-bind="mergedProps"
4
+ >
5
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
6
+ <slot :name="slotName" v-bind="slotProps || {}" />
7
+ </template>
8
+ </n-modal>
9
+ </template>
10
+
11
+ <script setup>
12
+ import { computed, useAttrs } from 'vue'
13
+ import { NModal } from 'naive-ui'
14
+
15
+ const props = defineProps({
16
+ show: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ preset: {
21
+ type: String,
22
+ default: 'card'
23
+ },
24
+ bordered: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ title: {
29
+ type: String,
30
+ default: ''
31
+ },
32
+ segmented: {
33
+ type: Object,
34
+ default: () => ({ content: 'soft', footer: 'soft' })
35
+ }
36
+ })
37
+
38
+ defineOptions({
39
+ inheritAttrs: false
40
+ })
41
+
42
+ const emit = defineEmits(['update:show'])
43
+
44
+ const attrs = useAttrs()
45
+
46
+ const mergedProps = computed(() => ({
47
+ show: props.show,
48
+ 'onUpdate:show': (value) => emit('update:show', value),
49
+ preset: props.preset,
50
+ bordered: props.bordered,
51
+ title: props.title,
52
+ segmented: props.segmented,
53
+ class: 'custom-card',
54
+ ...attrs
55
+ }))
56
+ </script>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <n-switch
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <template v-for="(_, slotName) in $slots" :key="slotName" #[slotName]="slotProps">
7
+ <slot :name="slotName" v-bind="slotProps || {}" />
8
+ </template>
9
+ </n-switch>
10
+ </template>
11
+
12
+ <script setup>
13
+ import { computed, useAttrs } from 'vue'
14
+ import { NSwitch } from 'naive-ui'
15
+
16
+ const props = defineProps({
17
+ value: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ size: {
26
+ type: String,
27
+ default: undefined
28
+ }
29
+ })
30
+
31
+ defineOptions({
32
+ inheritAttrs: false
33
+ })
34
+
35
+ const emit = defineEmits(['update:value'])
36
+
37
+ const attrs = useAttrs()
38
+
39
+ const mergedProps = computed(() => ({
40
+ value: props.value,
41
+ 'onUpdate:value': (val) => emit('update:value', val),
42
+ disabled: props.disabled,
43
+ ...(props.size && { size: props.size }),
44
+ ...attrs
45
+ }))
46
+ </script>
@@ -0,0 +1,41 @@
1
+ <template>
2
+ <n-table
3
+ v-bind="mergedProps"
4
+ v-on="$attrs"
5
+ >
6
+ <slot />
7
+ </n-table>
8
+ </template>
9
+
10
+ <script setup>
11
+ import { computed, useAttrs } from 'vue'
12
+ import { NTable } from 'naive-ui'
13
+
14
+ const props = defineProps({
15
+ bordered: {
16
+ type: Boolean,
17
+ default: false
18
+ },
19
+ singleLine: {
20
+ type: Boolean,
21
+ default: true
22
+ },
23
+ size: {
24
+ type: String,
25
+ default: undefined
26
+ }
27
+ })
28
+
29
+ defineOptions({
30
+ inheritAttrs: false
31
+ })
32
+
33
+ const attrs = useAttrs()
34
+
35
+ const mergedProps = computed(() => ({
36
+ bordered: props.bordered,
37
+ singleLine: props.singleLine,
38
+ ...(props.size && { size: props.size }),
39
+ ...attrs
40
+ }))
41
+ </script>
package/index.js CHANGED
@@ -8,6 +8,14 @@ export { default as GMenuButton } from './components/GMenuButton.vue'
8
8
  export { default as GMenuItems } from './components/GMenuItems.vue'
9
9
  export { default as GMenuItem } from './components/GMenuItem.vue'
10
10
  export { default as GIcon } from './components/GIcon.vue'
11
+ export { default as GDataTable } from './components/GDataTable.vue'
12
+ export { default as GModal } from './components/GModal.vue'
13
+ export { default as GInput } from './components/GInput.vue'
14
+ export { default as GCard } from './components/GCard.vue'
15
+ export { default as GTable } from './components/GTable.vue'
16
+ export { default as GEmpty } from './components/GEmpty.vue'
17
+ export { default as GSwitch } from './components/GSwitch.vue'
18
+ export { default as GDivider } from './components/GDivider.vue'
11
19
 
12
20
  export { registerIcons, iconRegistry, getIcon, hasIcon } from './icons/registry.js'
13
21
  export { defaultIconMap } from './icons/iconMap.js'
@@ -22,6 +30,14 @@ import GMenuButton from './components/GMenuButton.vue'
22
30
  import GMenuItems from './components/GMenuItems.vue'
23
31
  import GMenuItem from './components/GMenuItem.vue'
24
32
  import GIcon from './components/GIcon.vue'
33
+ import GDataTable from './components/GDataTable.vue'
34
+ import GModal from './components/GModal.vue'
35
+ import GInput from './components/GInput.vue'
36
+ import GCard from './components/GCard.vue'
37
+ import GTable from './components/GTable.vue'
38
+ import GEmpty from './components/GEmpty.vue'
39
+ import GSwitch from './components/GSwitch.vue'
40
+ import GDivider from './components/GDivider.vue'
25
41
 
26
42
  export function install(app) {
27
43
  app.component('GBreadcrumbs', GBreadcrumbs)
@@ -34,6 +50,14 @@ export function install(app) {
34
50
  app.component('GMenuItems', GMenuItems)
35
51
  app.component('GMenuItem', GMenuItem)
36
52
  app.component('GIcon', GIcon)
53
+ app.component('GDataTable', GDataTable)
54
+ app.component('GModal', GModal)
55
+ app.component('GInput', GInput)
56
+ app.component('GCard', GCard)
57
+ app.component('GTable', GTable)
58
+ app.component('GEmpty', GEmpty)
59
+ app.component('GSwitch', GSwitch)
60
+ app.component('GDivider', GDivider)
37
61
  }
38
62
 
39
63
  export default { install }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gameap/ui",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",