rayyy-vue-table-components 1.2.20 → 1.2.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts" generic="T extends Record<string, unknown>">
2
- import { computed, ref } from 'vue'
2
+ import { computed, ref, useAttrs } from 'vue'
3
3
  import type { FormInstance, FormRules } from 'element-plus'
4
4
 
5
5
  type Props<T extends object = object> = {
@@ -10,6 +10,9 @@ type Props<T extends object = object> = {
10
10
  }
11
11
  const props = withDefaults(defineProps<Props>(), {})
12
12
 
13
+ // 獲取所有非 props 屬性
14
+ const attrs = useAttrs()
15
+
13
16
  const computedLabelWidth = computed(() => {
14
17
  if (props.labelWidth) return props.labelWidth
15
18
  else return '100px'
@@ -47,6 +50,7 @@ defineExpose({
47
50
 
48
51
  <template>
49
52
  <el-form
53
+ v-bind="attrs"
50
54
  ref="formRef"
51
55
  :model="formData"
52
56
  :label-width="computedLabelWidth"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed } from 'vue'
2
+ import { computed, useAttrs } from 'vue'
3
3
  import { Search } from '@element-plus/icons-vue'
4
4
 
5
5
  const props = defineProps<{
@@ -20,6 +20,9 @@ const emits = defineEmits<{
20
20
  (e: 'update:clearValue'): void
21
21
  }>()
22
22
 
23
+ // 獲取所有非 props 屬性
24
+ const attrs = useAttrs()
25
+
23
26
  const v = computed({
24
27
  get: () => props.modelValue,
25
28
  set: (val: string | number | null | undefined) => emits('update:modelValue', val),
@@ -31,6 +34,7 @@ const handlerClear = () => {
31
34
 
32
35
  <template>
33
36
  <el-input
37
+ v-bind="attrs"
34
38
  v-model="v"
35
39
  :placeholder="props.placeholder"
36
40
  :type="props.type"
@@ -1,6 +1,6 @@
1
1
 
2
2
  <script setup lang="ts">
3
- import { ref } from 'vue'
3
+ import { ref, useAttrs } from 'vue'
4
4
  import type { ElInput } from 'element-plus'
5
5
 
6
6
  const inputValue = ref<string>('')
@@ -18,6 +18,9 @@ const props = withDefaults(
18
18
  }
19
19
  )
20
20
 
21
+ // 獲取所有非 props 屬性
22
+ const attrs = useAttrs()
23
+
21
24
  const emits = defineEmits<{
22
25
  (e: 'update:modelValue', val: string[]): void
23
26
  (e: 'inputError'): void
@@ -60,7 +63,7 @@ const deleteLastTag = () => {
60
63
  </script>
61
64
 
62
65
  <template>
63
- <div class="w-full border border-t rounded" @click="focusInput" >
66
+ <div v-bind="attrs" class="w-full border border-t rounded" @click="focusInput" >
64
67
  <el-tag
65
68
  v-for="(tag, position) in props.modelValue"
66
69
  :key="tag"
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <el-select
3
+ v-bind="attrs"
3
4
  :model-value="modelValue"
4
5
  :class="props.class"
5
6
  :placeholder="props.placeholder"
@@ -17,6 +18,7 @@
17
18
  </template>
18
19
 
19
20
  <script lang="ts" setup>
21
+ import { useAttrs } from 'vue'
20
22
  import type { ElOptions } from '@/types/OptionDto.ts'
21
23
 
22
24
  export type Selection = string | string[]
@@ -42,6 +44,9 @@ const props = withDefaults(
42
44
  },
43
45
  )
44
46
 
47
+ // 獲取所有非 props 屬性
48
+ const attrs = useAttrs()
49
+
45
50
  const emits = defineEmits<{
46
51
  (e: 'update:modelValue', data?: Selection): void
47
52
  }>()
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed } from 'vue'
2
+ import { computed, useAttrs } from 'vue'
3
3
 
4
4
  const props = defineProps<{
5
5
  text?: string
@@ -19,6 +19,9 @@ const emits = defineEmits<{
19
19
  (e: 'click', evt: MouseEvent): void
20
20
  }>()
21
21
 
22
+ // 獲取所有非 props 屬性
23
+ const attrs = useAttrs()
24
+
22
25
  const click = (evt: MouseEvent) => {
23
26
  emits('click', evt)
24
27
  }
@@ -33,6 +36,7 @@ const buttonClass = computed(() => {
33
36
 
34
37
  <template>
35
38
  <el-button
39
+ v-bind="attrs"
36
40
  :type="props.type"
37
41
  :size="props.size"
38
42
  :plain="props.plain"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed, ref } from 'vue'
2
+ import { computed, ref, useAttrs } from 'vue'
3
3
  import { useWindowSize } from '@vueuse/core'
4
4
  import { BaseBtn } from '@/components'
5
5
  import { Search, Filter } from '@element-plus/icons-vue'
@@ -10,6 +10,9 @@ defineProps<{
10
10
  badgeValue?: number
11
11
  }>()
12
12
 
13
+ // 獲取所有非 props 屬性
14
+ const attrs = useAttrs()
15
+
13
16
  const showDrawer = ref(false)
14
17
 
15
18
  function onClickBtn() {
@@ -40,7 +43,7 @@ const submitFilter = () => {
40
43
  </script>
41
44
 
42
45
  <template>
43
- <base-btn type="primary" class="filter-btn" @click="onClickBtn">
46
+ <base-btn v-bind="attrs" type="primary" class="filter-btn" @click="onClickBtn">
44
47
  <el-badge
45
48
  :value="badgeValue"
46
49
  class="!flex justify-center items-center"
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { ref } from 'vue'
2
+ import { ref, useAttrs } from 'vue'
3
3
  import BaseInput from '../form/BaseInput.vue'
4
4
  import FilterBtn from './FilterBtn.vue'
5
5
 
@@ -16,6 +16,9 @@ const emits = defineEmits<{
16
16
  (e: 'update:resetFilter'): void
17
17
  }>()
18
18
 
19
+ // 獲取所有非 props 屬性
20
+ const attrs = useAttrs()
21
+
19
22
  const keyword = ref('')
20
23
 
21
24
  const doSearch = () => {
@@ -30,7 +33,7 @@ const resetFilter = () => {
30
33
  </script>
31
34
 
32
35
  <template>
33
- <div class="search-bar">
36
+ <div v-bind="attrs" class="search-bar">
34
37
  <div class="search-bar-left">
35
38
  <slot name="button" />
36
39
  </div>