rayyy-vue-table-components 1.2.24 → 1.2.26

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/README.md CHANGED
@@ -350,6 +350,116 @@ const handleCancel = () => {
350
350
  ```
351
351
  </details>
352
352
 
353
+ ### MainPanel - 主面板組件
354
+
355
+ 靈活的主面板組件,提供標題、返回按鈕和可自定義高度的滾動區域。
356
+
357
+ <details>
358
+ <summary>基本用法</summary>
359
+
360
+ ```vue
361
+ <template>
362
+ <MainPanel
363
+ title="用戶管理"
364
+ :show-back="true"
365
+ max-height="calc(100vh-200px)"
366
+ >
367
+ <template #searchBar>
368
+ <SearchBar @search="handleSearch" />
369
+ </template>
370
+
371
+ <template #main>
372
+ <BaseTable
373
+ :data="tableData"
374
+ :columns="columns"
375
+ :loading="loading"
376
+ />
377
+ </template>
378
+
379
+ <template #footer>
380
+ <el-pagination
381
+ v-model:current-page="currentPage"
382
+ v-model:page-size="pageSize"
383
+ :total="total"
384
+ layout="total, sizes, prev, pager, next, jumper"
385
+ />
386
+ </template>
387
+ </MainPanel>
388
+ </template>
389
+
390
+ <script setup lang="ts">
391
+ import { ref } from 'vue'
392
+ import { MainPanel, SearchBar, BaseTable } from 'rayyy-vue-table-components'
393
+ import type { TableColumn } from 'rayyy-vue-table-components'
394
+
395
+ interface User {
396
+ id: number
397
+ name: string
398
+ email: string
399
+ }
400
+
401
+ const loading = ref(false)
402
+ const currentPage = ref(1)
403
+ const pageSize = ref(10)
404
+ const total = ref(100)
405
+
406
+ const tableData = ref<User[]>([
407
+ { id: 1, name: '張三', email: 'zhangsan@example.com' },
408
+ { id: 2, name: '李四', email: 'lisi@example.com' }
409
+ ])
410
+
411
+ const columns: TableColumn<User>[] = [
412
+ { prop: 'id', label: 'ID', width: 80 },
413
+ { prop: 'name', label: '姓名' },
414
+ { prop: 'email', label: '郵箱' }
415
+ ]
416
+
417
+ const handleSearch = (keyword: string) => {
418
+ console.log('搜尋關鍵字:', keyword)
419
+ }
420
+ </script>
421
+ ```
422
+ </details>
423
+
424
+ <details>
425
+ <summary>自定義高度</summary>
426
+
427
+ ```vue
428
+ <template>
429
+ <!-- 使用預設高度 -->
430
+ <MainPanel title="預設高度">
431
+ <template #main>
432
+ <div>內容區域</div>
433
+ </template>
434
+ </MainPanel>
435
+
436
+ <!-- 自定義高度 -->
437
+ <MainPanel
438
+ title="自定義高度"
439
+ max-height="500px"
440
+ >
441
+ <template #main>
442
+ <div>固定高度 500px 的內容區域</div>
443
+ </template>
444
+ </MainPanel>
445
+
446
+ <!-- 響應式高度 -->
447
+ <MainPanel
448
+ title="響應式高度"
449
+ max-height="calc(100vh-300px)"
450
+ >
451
+ <template #main>
452
+ <div>根據視窗高度動態調整的內容區域</div>
453
+ </template>
454
+ </MainPanel>
455
+ </template>
456
+
457
+ <script setup lang="ts">
458
+ import { MainPanel } from 'rayyy-vue-table-components'
459
+ </script>
460
+ ```
461
+ </details>
462
+
353
463
  ### TransferDialog - 穿梭框對話框
354
464
 
355
465
  用於表格列配置的穿梭框組件,支援拖拽排序。
@@ -584,6 +694,35 @@ interface ListContainerSlotProps<T = any> {
584
694
 
585
695
  ---
586
696
 
697
+ ### MainPanel
698
+
699
+ 主面板組件,提供標題、返回按鈕和可自定義高度的滾動區域。
700
+
701
+ #### Props
702
+
703
+ | 屬性 | 類型 | 默認值 | 說明 |
704
+ |------|------|--------|------|
705
+ | `title` | `string` | `''` | 面板標題 |
706
+ | `showBack` | `boolean \| string \| object` | `false` | 是否顯示返回按鈕 |
707
+ | `depth` | `number` | `1` | 返回深度 |
708
+ | `maxHeight` | `string` | `'calc(100vh-120px)'` | 滾動區域最大高度 |
709
+
710
+ #### Events
711
+
712
+ | 事件名 | 參數 | 說明 |
713
+ |--------|------|------|
714
+ | `back` | `payload: { path?: string; [key: string]: unknown }` | 返回按鈕點擊時觸發 |
715
+
716
+ #### Slots
717
+
718
+ | 插槽名 | 參數 | 說明 |
719
+ |--------|------|------|
720
+ | `searchBar` | - | 搜尋欄區域 |
721
+ | `main` | - | 主要內容區域 |
722
+ | `footer` | - | 底部區域(如分頁器) |
723
+
724
+ ---
725
+
587
726
  ### 通用類型定義
588
727
 
589
728
  #### TableColumn