rayyy-vue-table-components 2.0.23 → 2.0.25

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,23 @@
1
+ import { ElOptions } from '../../types/OptionDto.ts';
2
+ export type Selection = string | string[];
3
+ type __VLS_Props = {
4
+ modelValue?: Selection;
5
+ options?: ElOptions[];
6
+ placeholder?: string;
7
+ collapseTags?: boolean;
8
+ collapseTagsTooltip?: boolean;
9
+ multiple?: boolean;
10
+ disabled?: boolean;
11
+ class?: string;
12
+ };
13
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
14
+ "update:modelValue": (data?: Selection | undefined) => any;
15
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
16
+ "onUpdate:modelValue"?: ((data?: Selection | undefined) => any) | undefined;
17
+ }>, {
18
+ class: string;
19
+ placeholder: string;
20
+ modelValue: Selection;
21
+ options: ElOptions[];
22
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
23
+ export default _default;
@@ -1,6 +1,7 @@
1
1
  export { default as BaseTable } from './tables/BaseTable.vue';
2
2
  export { default as BaseBtn } from './items/BaseBtn.vue';
3
3
  export { default as BaseInput } from './form/BaseInput.vue';
4
+ export { default as BaseSelector } from './form/BaseSelector.vue';
4
5
  export { default as BaseDialog } from './items/BaseDialog.vue';
5
6
  export { default as BaseWaringDialog } from './items/BaseWaringDialog.vue';
6
7
  export { default as SortTable } from './tables/SortTable.vue';
@@ -17,6 +18,7 @@ export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, B
17
18
  export type { default as BaseTableType } from './tables/BaseTable.vue';
18
19
  export type { default as BaseBtnType } from './items/BaseBtn.vue';
19
20
  export type { default as BaseInputType } from './form/BaseInput.vue';
21
+ export type { default as BaseSelectorType } from './form/BaseSelector.vue';
20
22
  export type { default as BaseDialogType } from './items/BaseDialog.vue';
21
23
  export type { default as BaseWaringDialogType } from './items/BaseWaringDialog.vue';
22
24
  export type { default as SortTableType } from './tables/SortTable.vue';
@@ -2,6 +2,7 @@ import { App } from 'vue';
2
2
  import { default as BaseTable } from './components/tables/BaseTable.vue';
3
3
  import { default as BaseBtn } from './components/items/BaseBtn.vue';
4
4
  import { default as BaseInput } from './components/form/BaseInput.vue';
5
+ import { default as BaseSelector } from './components/form/BaseSelector.vue';
5
6
  import { default as BaseDialog } from './components/items/BaseDialog.vue';
6
7
  import { default as BaseWaringDialog } from './components/items/BaseWaringDialog.vue';
7
8
  import { default as SortTable } from './components/tables/SortTable.vue';
@@ -18,7 +19,7 @@ export * from './types';
18
19
  export * from './utils/tableHelper';
19
20
  export { useI18n, setLocale, useComponentElementLocale } from './utils/i18n';
20
21
  export * from './locales';
21
- export { BaseTable, BaseBtn, BaseInput, BaseDialog, BaseWaringDialog, SortTable, TitleTable, SearchBar, TransferDialog, TransferItem, FunctionHeader, MainPanel, SearchableListPanel, DetailLayout, FilterLayout };
22
+ export { BaseTable, BaseBtn, BaseInput, BaseSelector, BaseDialog, BaseWaringDialog, SortTable, TitleTable, SearchBar, TransferDialog, TransferItem, FunctionHeader, MainPanel, SearchableListPanel, DetailLayout, FilterLayout };
22
23
  export type { BaseTableProps, BaseTableEmits, BaseTableInstance, BaseBtnProps, BaseBtnEmits, BaseBtnInstance, BaseDialogProps, BaseDialogEmits, BaseDialogInstance, PluginOptions, VueTableComponentsPlugin, } from './types/components';
23
24
  export * from './components';
24
25
  export declare function install(app: App, options?: {
@@ -8,6 +8,7 @@ export declare const ROUTES: {
8
8
  readonly TRANSFER_DIALOG: "/demo/transfer-dialog";
9
9
  readonly BASE_BTN: "/demo/base-btn";
10
10
  readonly BASE_INPUT: "/demo/base-input";
11
+ readonly BASE_SELECTOR: "/demo/base-selector";
11
12
  readonly BASE_DIALOG: "/demo/base-dialog";
12
13
  readonly BASE_WARING_DIALOG: "/demo/base-waring-dialog";
13
14
  readonly BASE_FORM: "/demo/base-form";
@@ -30,6 +31,7 @@ export declare const ROUTE_NAMES: {
30
31
  readonly TRANSFER_DIALOG: "TransferDialog";
31
32
  readonly BASE_BTN: "BaseBtn";
32
33
  readonly BASE_INPUT: "BaseInput";
34
+ readonly BASE_SELECTOR: "BaseSelector";
33
35
  readonly BASE_DIALOG: "BaseDialog";
34
36
  readonly BASE_WARING_DIALOG: "BaseWaringDialog";
35
37
  readonly TABLE: "Table";
@@ -369,6 +369,42 @@ export interface BaseInputInstance {
369
369
  $emit: BaseInputEmits
370
370
  }
371
371
 
372
+ // ==================== BaseSelector 組件類型 ====================
373
+
374
+ /** BaseSelector 組件 Props 類型 */
375
+ export interface BaseSelectorProps {
376
+ /** 模型值 */
377
+ modelValue?: string | string[]
378
+ /** 選項數據 */
379
+ options?: Array<{ value: string; label: string }>
380
+ /** 佔位符 */
381
+ placeholder?: string
382
+ /** 是否折疊標籤 */
383
+ collapseTags?: boolean
384
+ /** 是否顯示折疊標籤提示 */
385
+ collapseTagsTooltip?: boolean
386
+ /** 是否多選 */
387
+ multiple?: boolean
388
+ /** 是否禁用 */
389
+ disabled?: boolean
390
+ /** 自定義 CSS 類名 */
391
+ class?: string
392
+ }
393
+
394
+ /** BaseSelector 組件 Emits 類型 */
395
+ export interface BaseSelectorEmits {
396
+ /** 模型值更新事件 */
397
+ 'update:modelValue': (value?: string | string[]) => void
398
+ }
399
+
400
+ /** BaseSelector 組件實例類型 */
401
+ export interface BaseSelectorInstance {
402
+ /** 組件 Props */
403
+ $props: BaseSelectorProps
404
+ /** 組件 Emits */
405
+ $emit: BaseSelectorEmits
406
+ }
407
+
372
408
 
373
409
  // ==================== 搜尋相關組件類型 ====================
374
410
 
@@ -747,6 +783,23 @@ export declare const BaseInput: DefineComponent<
747
783
  install: (app: App) => void
748
784
  }
749
785
 
786
+ /** BaseSelector 組件定義 */
787
+ export declare const BaseSelector: DefineComponent<
788
+ BaseSelectorProps,
789
+ {},
790
+ {},
791
+ {},
792
+ {},
793
+ {},
794
+ {},
795
+ {},
796
+ {},
797
+ BaseSelectorEmits
798
+ > & {
799
+ /** 安裝方法 */
800
+ install: (app: App) => void
801
+ }
802
+
750
803
 
751
804
  /** SearchBar 組件定義 */
752
805
  export declare const SearchBar: DefineComponent<
@@ -892,6 +945,8 @@ export interface VueTableComponentsPlugin {
892
945
  TransferDialog: typeof TransferDialog
893
946
  /** BaseInput 組件 */
894
947
  BaseInput: typeof BaseInput
948
+ /** BaseSelector 組件 */
949
+ BaseSelector: typeof BaseSelector
895
950
  /** SearchBar 組件 */
896
951
  SearchBar: typeof SearchBar
897
952
  /** SearchableListPanel 組件 */
@@ -920,6 +975,7 @@ declare module '@vue/runtime-core' {
920
975
  BaseWaringDialog: typeof BaseWaringDialog
921
976
  TransferDialog: typeof TransferDialog
922
977
  BaseInput: typeof BaseInput
978
+ BaseSelector: typeof BaseSelector
923
979
  SearchBar: typeof SearchBar
924
980
  SearchableListPanel: typeof SearchableListPanel
925
981
  FunctionHeader: typeof FunctionHeader
@@ -0,0 +1,2 @@
1
+ declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
2
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "2.0.23",
3
+ "version": "2.0.25",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -46,3 +46,9 @@
46
46
  @apply w-fit;
47
47
  @apply text-blue-10;
48
48
  }
49
+
50
+
51
+
52
+ .my-select-popper {
53
+ z-index: 4000 !important; /* 比 dialog 高即可 */
54
+ }
@@ -0,0 +1,58 @@
1
+ <script lang="ts" setup>
2
+ import type { ElOptions } from '@/types/OptionDto.ts'
3
+
4
+ export type Selection = string | string[]
5
+
6
+ const props = withDefaults(
7
+ defineProps<{
8
+ modelValue?: Selection
9
+ options?: ElOptions[]
10
+ placeholder?: string
11
+ collapseTags?: boolean
12
+ collapseTagsTooltip?: boolean
13
+ multiple?: boolean
14
+ disabled?: boolean
15
+ class?: string
16
+ }>(),
17
+ {
18
+ modelValue: () => '',
19
+ options: () => [{ value: '', label: '' }],
20
+ placeholder: '請選擇',
21
+ class: 'w-full',
22
+ },
23
+ )
24
+
25
+ const emits = defineEmits<{
26
+ (e: 'update:modelValue', data?: Selection): void
27
+ }>()
28
+
29
+ function updateValue(val: Selection) {
30
+ let value: Selection | undefined = val
31
+
32
+ if (typeof value === 'string' && !value) {
33
+ // el-select 元件裡包的是 input,所以當清空時預設會給 string,故把空字串轉成 undefined
34
+ value = undefined
35
+ }
36
+
37
+ emits('update:modelValue', value)
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <el-select
43
+ :model-value="modelValue"
44
+ :class="props.class"
45
+ :placeholder="props.placeholder"
46
+ :clearable="true"
47
+ :collapse-tags="props.collapseTags"
48
+ :collapse-tags-tooltip="props.collapseTagsTooltip"
49
+ :multiple="props.multiple"
50
+ :disabled="props.disabled"
51
+ :reserve-keyword="false"
52
+ filterable
53
+ @update:model-value="updateValue"
54
+ popper-class="my-select-popper"
55
+ >
56
+ <el-option v-for="it in options" :key="it.label" :label="it.label" :value="it.value" />
57
+ </el-select>
58
+ </template>
@@ -2,6 +2,7 @@
2
2
  export { default as BaseTable } from './tables/BaseTable.vue'
3
3
  export { default as BaseBtn } from './items/BaseBtn.vue'
4
4
  export { default as BaseInput } from './form/BaseInput.vue'
5
+ export { default as BaseSelector } from './form/BaseSelector.vue'
5
6
  export { default as BaseDialog } from './items/BaseDialog.vue'
6
7
  export { default as BaseWaringDialog } from './items/BaseWaringDialog.vue'
7
8
  export { default as SortTable } from './tables/SortTable.vue'
@@ -88,6 +89,7 @@ export type {
88
89
  export type { default as BaseTableType } from './tables/BaseTable.vue'
89
90
  export type { default as BaseBtnType } from './items/BaseBtn.vue'
90
91
  export type { default as BaseInputType } from './form/BaseInput.vue'
92
+ export type { default as BaseSelectorType } from './form/BaseSelector.vue'
91
93
  export type { default as BaseDialogType } from './items/BaseDialog.vue'
92
94
  export type { default as BaseWaringDialogType } from './items/BaseWaringDialog.vue'
93
95
  export type { default as SortTableType } from './tables/SortTable.vue'
@@ -370,6 +370,42 @@ export interface BaseInputInstance {
370
370
  $emit: BaseInputEmits
371
371
  }
372
372
 
373
+ // ==================== BaseSelector 組件類型 ====================
374
+
375
+ /** BaseSelector 組件 Props 類型 */
376
+ export interface BaseSelectorProps {
377
+ /** 模型值 */
378
+ modelValue?: string | string[]
379
+ /** 選項數據 */
380
+ options?: Array<{ value: string; label: string }>
381
+ /** 佔位符 */
382
+ placeholder?: string
383
+ /** 是否折疊標籤 */
384
+ collapseTags?: boolean
385
+ /** 是否顯示折疊標籤提示 */
386
+ collapseTagsTooltip?: boolean
387
+ /** 是否多選 */
388
+ multiple?: boolean
389
+ /** 是否禁用 */
390
+ disabled?: boolean
391
+ /** 自定義 CSS 類名 */
392
+ class?: string
393
+ }
394
+
395
+ /** BaseSelector 組件 Emits 類型 */
396
+ export interface BaseSelectorEmits {
397
+ /** 模型值更新事件 */
398
+ 'update:modelValue': (value?: string | string[]) => void
399
+ }
400
+
401
+ /** BaseSelector 組件實例類型 */
402
+ export interface BaseSelectorInstance {
403
+ /** 組件 Props */
404
+ $props: BaseSelectorProps
405
+ /** 組件 Emits */
406
+ $emit: BaseSelectorEmits
407
+ }
408
+
373
409
 
374
410
  // ==================== 搜尋相關組件類型 ====================
375
411
 
@@ -748,6 +784,23 @@ export declare const BaseInput: DefineComponent<
748
784
  install: (app: App) => void
749
785
  }
750
786
 
787
+ /** BaseSelector 組件定義 */
788
+ export declare const BaseSelector: DefineComponent<
789
+ BaseSelectorProps,
790
+ {},
791
+ {},
792
+ {},
793
+ {},
794
+ {},
795
+ {},
796
+ {},
797
+ {},
798
+ BaseSelectorEmits
799
+ > & {
800
+ /** 安裝方法 */
801
+ install: (app: App) => void
802
+ }
803
+
751
804
 
752
805
  /** SearchBar 組件定義 */
753
806
  export declare const SearchBar: DefineComponent<
@@ -893,6 +946,8 @@ export interface VueTableComponentsPlugin {
893
946
  TransferDialog: typeof TransferDialog
894
947
  /** BaseInput 組件 */
895
948
  BaseInput: typeof BaseInput
949
+ /** BaseSelector 組件 */
950
+ BaseSelector: typeof BaseSelector
896
951
  /** SearchBar 組件 */
897
952
  SearchBar: typeof SearchBar
898
953
  /** SearchableListPanel 組件 */
@@ -921,6 +976,7 @@ declare module '@vue/runtime-core' {
921
976
  BaseWaringDialog: typeof BaseWaringDialog
922
977
  TransferDialog: typeof TransferDialog
923
978
  BaseInput: typeof BaseInput
979
+ BaseSelector: typeof BaseSelector
924
980
  SearchBar: typeof SearchBar
925
981
  SearchableListPanel: typeof SearchableListPanel
926
982
  FunctionHeader: typeof FunctionHeader