rayyy-vue-table-components 1.2.21 → 1.2.23

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.
@@ -1,5 +1,6 @@
1
1
  type __VLS_Props = {
2
2
  badgeValue?: number;
3
+ drawerSize?: string;
3
4
  };
4
5
  declare function __VLS_template(): {
5
6
  attrs: Partial<{}>;
@@ -1,8 +1,8 @@
1
1
  type __VLS_Props = {
2
2
  showFilter?: boolean;
3
3
  showSearch?: boolean;
4
- fullInput?: boolean;
5
4
  badgeValue?: number;
5
+ filterDrawerSize?: string;
6
6
  };
7
7
  declare function __VLS_template(): {
8
8
  attrs: Partial<{}>;
@@ -8,6 +8,7 @@ type __VLS_Props = {
8
8
  showFilter?: boolean;
9
9
  showDefaultSearch?: boolean;
10
10
  badgeValue?: number;
11
+ filterDrawerSize?: string;
11
12
  };
12
13
  declare function __VLS_template(): {
13
14
  attrs: Partial<{}>;
@@ -144,6 +144,8 @@ export interface BaseBtnInstance {
144
144
  export interface FilterBtnProps {
145
145
  /** 徽章數值 */
146
146
  badgeValue?: number
147
+ /** 抽屜大小 */
148
+ drawerSize?: string
147
149
  }
148
150
 
149
151
  /** FilterBtn 組件 Emits 類型 */
@@ -348,10 +350,10 @@ export interface SearchBarProps {
348
350
  showFilter?: boolean
349
351
  /** 是否顯示搜尋功能 */
350
352
  showSearch?: boolean
351
- /** 是否為完整輸入框 */
352
- fullInput?: boolean
353
353
  /** 徽章數值 */
354
354
  badgeValue?: number
355
+ /** 篩選抽屜大小 */
356
+ filterDrawerSize?: string
355
357
  }
356
358
 
357
359
  /** SearchBar 組件 Emits 類型 */
@@ -394,6 +396,8 @@ export interface SearchableListPanelProps {
394
396
  dataCy?: string
395
397
  /** 徽章數值 */
396
398
  badgeValue?: number
399
+ /** 篩選抽屜大小 */
400
+ filterDrawerSize?: string
397
401
  }
398
402
 
399
403
  /** SearchableListPanel 組件 Emits 類型 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "1.2.21",
3
+ "version": "1.2.23",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -1,13 +1,11 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed, ref, useAttrs } from 'vue'
3
- import { useWindowSize } from '@vueuse/core'
4
3
  import { BaseBtn } from '@/components'
5
4
  import { Search, Filter } from '@element-plus/icons-vue'
6
5
 
7
- const { width } = useWindowSize()
8
-
9
- defineProps<{
6
+ const props = defineProps<{
10
7
  badgeValue?: number
8
+ drawerSize?: string
11
9
  }>()
12
10
 
13
11
  // 獲取所有非 props 屬性
@@ -28,10 +26,8 @@ const resetValue = () => {
28
26
  emit('update:reset')
29
27
  }
30
28
  const computedDrawerSize = computed(() => {
31
- if (width.value > 1200) {
32
- return '30%'
33
- } else if (width.value < 500) {
34
- return '100%'
29
+ if (props.drawerSize) {
30
+ return props.drawerSize
35
31
  } else {
36
32
  return '50%'
37
33
  }
@@ -6,8 +6,8 @@ import FilterBtn from './FilterBtn.vue'
6
6
  defineProps<{
7
7
  showFilter?: boolean
8
8
  showSearch?: boolean
9
- fullInput?: boolean
10
9
  badgeValue?: number
10
+ filterDrawerSize?: string
11
11
  }>()
12
12
 
13
13
  const emits = defineEmits<{
@@ -39,7 +39,7 @@ const resetFilter = () => {
39
39
  </div>
40
40
 
41
41
  <div class="flex items-center justify-end">
42
- <div v-if="showSearch" :class="{ 'w-full': fullInput, 'search-input': !fullInput }">
42
+ <div v-if="showSearch" class="search-input">
43
43
  <base-input
44
44
  v-model="keyword"
45
45
  placeholder="請輸入關鍵字搜尋列表"
@@ -50,7 +50,11 @@ const resetFilter = () => {
50
50
  </div>
51
51
 
52
52
  <div class="filter-customer" v-if="showFilter">
53
- <filter-btn :badge-value="badgeValue" @update:reset="resetFilter">
53
+ <filter-btn
54
+ :badge-value="badgeValue"
55
+ @update:reset="resetFilter"
56
+ :drawer-size="filterDrawerSize"
57
+ >
54
58
  <slot name="filterBody" />
55
59
  </filter-btn>
56
60
  </div>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { toRefs } from 'vue'
2
+ import { toRefs, computed } from 'vue'
3
3
  import type { Pager } from '@/types'
4
4
  import { MainPanel, SearchBar } from '@/components'
5
5
 
@@ -12,6 +12,7 @@ const props = defineProps<{
12
12
  showFilter?: boolean
13
13
  showDefaultSearch?: boolean
14
14
  badgeValue?: number
15
+ filterDrawerSize?: string
15
16
  }>()
16
17
 
17
18
  const { pagination } = toRefs(props)
@@ -22,6 +23,9 @@ const emits = defineEmits<{
22
23
  (e: 'updatePageSize', limit: number): boolean
23
24
  }>()
24
25
 
26
+ const showAllFeatures = computed(() => {
27
+ return props.showDefaultSearch || (props.showSearch && props.showEdit && props.showFilter)
28
+ })
25
29
  const search = (keyword: string) => {
26
30
  emits('search', keyword)
27
31
  }
@@ -43,15 +47,16 @@ const changePageSize = (limit: number) => {
43
47
  <main-panel :title="props.title" :show-back="showBack">
44
48
  <template #searchBar>
45
49
  <search-bar
46
- :show-filter="showFilter"
47
- :show-search="showSearch"
50
+ :show-filter="showAllFeatures || showFilter"
51
+ :show-search="showAllFeatures || showSearch"
48
52
  :badge-value="badgeValue"
53
+ :filterDrawerSize="filterDrawerSize"
49
54
  @keydown:enter="search"
50
55
  @update:clear="clearable"
51
56
  >
52
57
  <template #button>
53
58
  <slot name="firstButton"></slot>
54
- <slot name="customButton"> </slot>
59
+ <slot name="customButton" v-if="showAllFeatures || showEdit"> </slot>
55
60
  <slot name="lastButton"></slot>
56
61
  </template>
57
62
  <template #filterBody>
@@ -145,6 +145,8 @@ export interface BaseBtnInstance {
145
145
  export interface FilterBtnProps {
146
146
  /** 徽章數值 */
147
147
  badgeValue?: number
148
+ /** 抽屜大小 */
149
+ drawerSize?: string
148
150
  }
149
151
 
150
152
  /** FilterBtn 組件 Emits 類型 */
@@ -349,10 +351,10 @@ export interface SearchBarProps {
349
351
  showFilter?: boolean
350
352
  /** 是否顯示搜尋功能 */
351
353
  showSearch?: boolean
352
- /** 是否為完整輸入框 */
353
- fullInput?: boolean
354
354
  /** 徽章數值 */
355
355
  badgeValue?: number
356
+ /** 篩選抽屜大小 */
357
+ filterDrawerSize?: string
356
358
  }
357
359
 
358
360
  /** SearchBar 組件 Emits 類型 */
@@ -395,6 +397,8 @@ export interface SearchableListPanelProps {
395
397
  dataCy?: string
396
398
  /** 徽章數值 */
397
399
  badgeValue?: number
400
+ /** 篩選抽屜大小 */
401
+ filterDrawerSize?: string
398
402
  }
399
403
 
400
404
  /** SearchableListPanel 組件 Emits 類型 */