gi-component 0.0.7 → 0.0.9

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.
Files changed (59) hide show
  1. package/dist/gi.css +1 -1
  2. package/dist/index.d.ts +4 -50
  3. package/dist/index.es.js +39 -39
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +1 -1
  6. package/dist/index.umd.js.map +1 -1
  7. package/package.json +60 -56
  8. package/packages/components/button/index.ts +4 -4
  9. package/packages/components/button/src/button.vue +32 -32
  10. package/packages/components/button/src/type.ts +2 -2
  11. package/packages/components/card/index.ts +4 -4
  12. package/packages/components/card/src/card.vue +21 -21
  13. package/packages/components/card/src/type.ts +9 -9
  14. package/packages/components/dialog/index.ts +5 -5
  15. package/packages/components/dialog/src/dialog.ts +33 -33
  16. package/packages/components/dialog/src/dialog.vue +34 -32
  17. package/packages/components/dialog/src/type.ts +13 -13
  18. package/packages/components/edit-table/index.ts +4 -4
  19. package/packages/components/edit-table/src/edit-table.vue +47 -47
  20. package/packages/components/edit-table/src/type.ts +42 -63
  21. package/packages/components/form/index.ts +4 -4
  22. package/packages/components/form/src/form.vue +102 -98
  23. package/packages/components/form/src/type.ts +67 -88
  24. package/packages/components/grid/index.ts +6 -6
  25. package/packages/components/grid/src/context.ts +17 -17
  26. package/packages/components/grid/src/grid-item.vue +40 -40
  27. package/packages/components/grid/src/grid.vue +38 -38
  28. package/packages/components/grid/src/hook/use-index.ts +24 -24
  29. package/packages/components/grid/src/hook/use-responsive-state.ts +26 -26
  30. package/packages/components/grid/src/hook/use-responsive-value.ts +24 -24
  31. package/packages/components/grid/src/interface.ts +32 -32
  32. package/packages/components/grid/src/utils/global-config.ts +3 -3
  33. package/packages/components/grid/src/utils/index.ts +25 -25
  34. package/packages/components/grid/src/utils/is.ts +2 -2
  35. package/packages/components/grid/src/utils/responsive-observe.ts +53 -53
  36. package/packages/components/input-group/index.ts +4 -4
  37. package/packages/components/input-group/src/input-group.vue +2 -2
  38. package/packages/components/input-search/index.ts +4 -4
  39. package/packages/components/input-search/src/input-search.vue +15 -15
  40. package/packages/components/input-search/src/type.ts +4 -4
  41. package/packages/components/page-layout/index.ts +4 -4
  42. package/packages/components/page-layout/src/page-layout.vue +25 -25
  43. package/packages/components/page-layout/src/split-button.vue +22 -22
  44. package/packages/components/page-layout/src/type.ts +9 -9
  45. package/packages/components/table/index.ts +4 -4
  46. package/packages/components/table/src/TableColumn.vue +10 -10
  47. package/packages/components/table/src/table.vue +14 -14
  48. package/packages/components/table/src/type.ts +7 -7
  49. package/packages/components/tabs/index.ts +4 -4
  50. package/packages/components/tabs/src/tabs.vue +20 -20
  51. package/packages/components/tabs/src/type.ts +9 -9
  52. package/packages/hooks/index.ts +2 -2
  53. package/packages/hooks/useBemClass.ts +7 -7
  54. package/packages/hooks/useTable.ts +6 -7
  55. package/packages/index.ts +44 -44
  56. package/packages/styles/index.scss +6 -0
  57. package/packages/types/tool.ts +4 -4
  58. package/packages/utils/createSelectDialog.ts +28 -27
  59. package/packages/utils/index.ts +1 -1
@@ -36,10 +36,10 @@
36
36
  </template>
37
37
 
38
38
  <script lang="ts" setup>
39
- import type { PageLayoutProps } from './type';
40
- import { computed, ref, useSlots } from 'vue';
41
- import { useBemClass } from '../../../hooks';
42
- import SplitButton from './split-button.vue';
39
+ import type { PageLayoutProps } from './type'
40
+ import { computed, ref, useSlots } from 'vue'
41
+ import { useBemClass } from '../../../hooks'
42
+ import SplitButton from './split-button.vue'
43
43
 
44
44
  const props = withDefaults(defineProps<PageLayoutProps>(), {
45
45
  size: 270,
@@ -49,43 +49,43 @@ const props = withDefaults(defineProps<PageLayoutProps>(), {
49
49
  headerStyle: () => ({}),
50
50
  toolStyle: () => ({}),
51
51
  bodyStyle: () => ({})
52
- });
52
+ })
53
53
 
54
54
  defineSlots<{
55
- header: () => void;
56
- left: () => void;
57
- tool: () => void;
58
- default: () => void;
59
- }>();
55
+ header: () => void
56
+ left: () => void
57
+ tool: () => void
58
+ default: () => void
59
+ }>()
60
60
 
61
- const slots = useSlots();
62
- const { b } = useBemClass();
63
- const size = ref(props.size);
64
- const collapsing = ref(false);
61
+ const slots = useSlots()
62
+ const { b } = useBemClass()
63
+ const size = ref(props.size)
64
+ const collapsing = ref(false)
65
65
 
66
66
  const getClass = computed(() => {
67
- const arr: string[] = [b('page-layout')];
67
+ const arr: string[] = [b('page-layout')]
68
68
  if (props.bordered) {
69
- arr.push(b('page-layout--bordered'));
69
+ arr.push(b('page-layout--bordered'))
70
70
  }
71
71
  if (slots.header) {
72
- arr.push(b('page-layout--has-header'));
72
+ arr.push(b('page-layout--has-header'))
73
73
  }
74
74
  if (slots.tool) {
75
- arr.push(b('page-layout--has-tool'));
75
+ arr.push(b('page-layout--has-tool'))
76
76
  }
77
77
  if (collapsing.value) {
78
- arr.push(b('page-layout--collapsing'));
78
+ arr.push(b('page-layout--collapsing'))
79
79
  }
80
- return arr.join(' ');
81
- });
80
+ return arr.join(' ')
81
+ })
82
82
 
83
83
  function handleClick() {
84
- collapsing.value = true;
84
+ collapsing.value = true
85
85
  setTimeout(() => {
86
- collapsing.value = false;
87
- }, 300);
88
- size.value = Number(size.value) > 30 ? 0 : props.size;
86
+ collapsing.value = false
87
+ }, 300)
88
+ size.value = Number(size.value) > 30 ? 0 : props.size
89
89
  }
90
90
  </script>
91
91
 
@@ -8,29 +8,29 @@
8
8
  </template>
9
9
 
10
10
  <script setup lang="ts">
11
- import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';
12
- import { computed } from 'vue';
13
- import { useBemClass } from '../../../hooks';
11
+ import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue'
12
+ import { computed } from 'vue'
13
+ import { useBemClass } from '../../../hooks'
14
14
 
15
15
  /** 按钮类型 */
16
- type ButtonType = 'default' | 'circle';
16
+ type ButtonType = 'default' | 'circle'
17
17
 
18
18
  /** 组件属性定义 */
19
19
  interface Props {
20
20
  /** 是否折叠状态 */
21
- collapsed?: boolean;
21
+ collapsed?: boolean
22
22
  /** 按钮类型 */
23
- type?: ButtonType;
23
+ type?: ButtonType
24
24
  /** 图标大小 */
25
- iconSize?: number;
25
+ iconSize?: number
26
26
  /** 是否禁用 */
27
- disabled?: boolean;
27
+ disabled?: boolean
28
28
  }
29
29
 
30
30
  /** 组件事件定义 */
31
31
  interface Emits {
32
- (e: 'click'): void;
33
- (e: 'update:collapsed', value: boolean): void;
32
+ (e: 'click'): void
33
+ (e: 'update:collapsed', value: boolean): void
34
34
  }
35
35
 
36
36
  const props = withDefaults(defineProps<Props>(), {
@@ -38,29 +38,29 @@ const props = withDefaults(defineProps<Props>(), {
38
38
  type: 'circle',
39
39
  iconSize: 10,
40
40
  disabled: false
41
- });
41
+ })
42
42
 
43
- const emit = defineEmits<Emits>();
44
- const { b } = useBemClass();
43
+ const emit = defineEmits<Emits>()
44
+ const { b } = useBemClass()
45
45
 
46
46
  /** 计算按钮类名 */
47
47
  const getClass = computed(() => {
48
- const arr: string[] = [b('split-button'), b(`split-button--${props.type}`)];
48
+ const arr: string[] = [b('split-button'), b(`split-button--${props.type}`)]
49
49
  if (props.collapsed) {
50
- arr.push(b('split-button--collapsed'));
50
+ arr.push(b('split-button--collapsed'))
51
51
  }
52
52
  if (props.disabled) {
53
- arr.push(b('split-button--disabled'));
53
+ arr.push(b('split-button--disabled'))
54
54
  }
55
- return arr.join(' ');
56
- });
55
+ return arr.join(' ')
56
+ })
57
57
 
58
58
  /** 处理点击事件 */
59
59
  const handleClick = () => {
60
- if (props.disabled) return;
61
- emit('click');
62
- emit('update:collapsed', !props.collapsed);
63
- };
60
+ if (props.disabled) return
61
+ emit('click')
62
+ emit('update:collapsed', !props.collapsed)
63
+ }
64
64
  </script>
65
65
 
66
66
  <style lang="scss" scoped>
@@ -1,12 +1,12 @@
1
- import type { SplitterPanelProps } from 'element-plus';
2
- import type { CSSProperties } from 'vue';
1
+ import type { SplitterPanelProps } from 'element-plus'
2
+ import type { CSSProperties } from 'vue'
3
3
 
4
4
  export interface PageLayoutProps {
5
- size?: SplitterPanelProps['size'];
6
- bordered?: boolean;
7
- collapse?: boolean;
8
- leftStyle?: CSSProperties;
9
- headerStyle?: CSSProperties;
10
- toolStyle?: CSSProperties;
11
- bodyStyle?: CSSProperties;
5
+ size?: SplitterPanelProps['size']
6
+ bordered?: boolean
7
+ collapse?: boolean
8
+ leftStyle?: CSSProperties
9
+ headerStyle?: CSSProperties
10
+ toolStyle?: CSSProperties
11
+ bodyStyle?: CSSProperties
12
12
  }
@@ -1,5 +1,5 @@
1
- import Table from './src/table.vue';
1
+ import Table from './src/table.vue'
2
2
 
3
- export type TableInstance = InstanceType<typeof Table>;
4
- export * from './src/type';
5
- export default Table;
3
+ export type TableInstance = InstanceType<typeof Table>
4
+ export * from './src/type'
5
+ export default Table
@@ -1,9 +1,9 @@
1
1
  <template>
2
2
  <el-table-column v-bind="columnProps">
3
3
  <!-- 处理render函数 -->
4
- <template v-if="column.render" v-slot="scope">
4
+ <template v-if="column.render" #default="scope">
5
5
  <template v-if="typeof column.render(scope) === 'string'">{{ column.render(scope) }}</template>
6
- <component v-else :is="column.render(scope)" />
6
+ <component :is="column.render(scope)" v-else />
7
7
  </template>
8
8
 
9
9
  <!-- 处理插槽内容 -->
@@ -24,19 +24,19 @@
24
24
  </template>
25
25
 
26
26
  <script lang="ts" setup>
27
- import type { TableColumnItem } from './type';
28
- import { computed } from 'vue';
29
- import TableColumn from './TableColumn.vue';
27
+ import type { TableColumnItem } from './type'
28
+ import { computed } from 'vue'
29
+ import TableColumn from './TableColumn.vue'
30
30
 
31
31
  const props = defineProps<{
32
- column: TableColumnItem;
33
- }>();
32
+ column: TableColumnItem
33
+ }>()
34
34
 
35
35
  // 计算el-table-column需要的属性
36
36
  const columnProps = computed(() => {
37
- const { slotName, render, children, ...restProps } = props.column;
38
- return restProps;
39
- });
37
+ const { slotName, render, children, ...restProps } = props.column
38
+ return restProps
39
+ })
40
40
  </script>
41
41
 
42
42
  <style scoped></style>
@@ -18,19 +18,19 @@
18
18
  </template>
19
19
 
20
20
  <script lang="ts" setup>
21
- import type { TableProps } from './type';
22
- import { computed, useAttrs, useTemplateRef } from 'vue';
23
- import { useBemClass } from '../../../hooks';
24
- import TableColumn from './TableColumn.vue';
21
+ import type { TableProps } from './type'
22
+ import { computed, useAttrs, useTemplateRef } from 'vue'
23
+ import { useBemClass } from '../../../hooks'
24
+ import TableColumn from './TableColumn.vue'
25
25
 
26
26
  const props = withDefaults(defineProps<TableProps>(), {
27
27
  columns: () => [],
28
28
  pagination: () => ({})
29
- });
29
+ })
30
30
 
31
- const attrs = useAttrs();
32
- const { b } = useBemClass();
33
- const tableRef = useTemplateRef('tableRef');
31
+ const attrs = useAttrs()
32
+ const { b } = useBemClass()
33
+ const tableRef = useTemplateRef('tableRef')
34
34
 
35
35
  const tableProps = computed(() => {
36
36
  return {
@@ -38,8 +38,8 @@ const tableProps = computed(() => {
38
38
  ...props,
39
39
  columns: undefined,
40
40
  pagination: undefined
41
- };
42
- });
41
+ }
42
+ })
43
43
 
44
44
  const paginationProps = computed(() => {
45
45
  return {
@@ -47,17 +47,17 @@ const paginationProps = computed(() => {
47
47
  layout: 'prev, pager, next, sizes, total',
48
48
  pageSizes: [10, 20, 50, 100],
49
49
  ...props.pagination
50
- };
51
- });
50
+ }
51
+ })
52
52
 
53
53
  function handleSizeChange(size: number) {
54
54
  // @ts-ignore
55
- props.pagination.pageSize = size;
55
+ props.pagination.pageSize = size
56
56
  }
57
57
 
58
58
  function handleCurrentChange(page: number) {
59
59
  // @ts-ignore
60
- props.pagination.currentPage = page;
60
+ props.pagination.currentPage = page
61
61
  }
62
62
 
63
63
  defineExpose({
@@ -1,14 +1,14 @@
1
- import type { TableProps as ElTableProps, PaginationProps, TableColumnInstance } from 'element-plus';
2
- import type { ExtractPropTypes, VNode } from 'vue';
1
+ import type { TableProps as ElTableProps, PaginationProps, TableColumnInstance } from 'element-plus'
2
+ import type { ExtractPropTypes, VNode } from 'vue'
3
3
 
4
4
  type DefaultRow = Record<PropertyKey, any>
5
5
  export interface TableColumnItem<T extends DefaultRow = DefaultRow> extends Omit<TableColumnInstance['$props'], never> {
6
- slotName?: string;
7
- children?: TableColumnItem[];
8
- render?: (scope: { $index: number; cellIndex: number; column: TableColumnItem<T>; row: T }) => VNode | VNode[] | string;
6
+ slotName?: string
7
+ children?: TableColumnItem[]
8
+ render?: (scope: { $index: number, cellIndex: number, column: TableColumnItem<T>, row: T }) => VNode | VNode[] | string
9
9
  }
10
10
 
11
11
  export interface TableProps extends ExtractPropTypes<ElTableProps<Record<string | number | symbol, any>>> {
12
- columns?: TableColumnItem[];
13
- pagination?: Partial<PaginationProps>;
12
+ columns?: TableColumnItem[]
13
+ pagination?: Partial<PaginationProps>
14
14
  }
@@ -1,5 +1,5 @@
1
- import Tabs from './src/tabs.vue';
1
+ import Tabs from './src/tabs.vue'
2
2
 
3
- export type TabsInstance = InstanceType<typeof Tabs>;
4
- export * from './src/type';
5
- export default Tabs;
3
+ export type TabsInstance = InstanceType<typeof Tabs>
4
+ export * from './src/type'
5
+ export default Tabs
@@ -19,42 +19,42 @@
19
19
  </template>
20
20
 
21
21
  <script setup lang="ts">
22
- import type { TabsProps as ElTabsProps, TabsPaneContext } from 'element-plus';
23
- import type { TabsOptionItem, TabsProps } from './type.ts';
24
- import { computed, useSlots } from 'vue';
25
- import { useBemClass } from '../../../hooks';
22
+ import type { TabsProps as ElTabsProps, TabsPaneContext } from 'element-plus'
23
+ import type { TabsOptionItem, TabsProps } from './type.ts'
24
+ import { computed, useSlots } from 'vue'
25
+ import { useBemClass } from '../../../hooks'
26
26
 
27
- const model = defineModel<ElTabsProps['modelValue']>();
27
+ const model = defineModel<ElTabsProps['modelValue']>()
28
28
 
29
29
  const props = withDefaults(defineProps<TabsProps>(), {
30
30
  type: '',
31
31
  options: () => [],
32
32
  size: 'medium',
33
33
  inner: false
34
- });
34
+ })
35
35
 
36
36
  const emits = defineEmits<{
37
- (e: 'tabClick', pane: TabsPaneContext, ev: Event): void;
38
- (e: 'tabChange', value: string): void;
39
- }>();
37
+ (e: 'tabClick', pane: TabsPaneContext, ev: Event): void
38
+ (e: 'tabChange', value: string): void
39
+ }>()
40
40
 
41
41
  defineSlots<{
42
- default: () => void;
43
- extra: () => void;
44
- label: (e: { data: TabsOptionItem }) => void;
45
- }>();
42
+ default: () => void
43
+ extra: () => void
44
+ label: (e: { data: TabsOptionItem }) => void
45
+ }>()
46
46
 
47
- const slots = useSlots();
48
- const { b } = useBemClass();
47
+ const slots = useSlots()
48
+ const { b } = useBemClass()
49
49
 
50
50
  const getClass = computed(() => {
51
- const arr: string[] = [b('tabs')];
52
- arr.push(b(`tabs--${props.size}`));
51
+ const arr: string[] = [b('tabs')]
52
+ arr.push(b(`tabs--${props.size}`))
53
53
  if (props.inner) {
54
- arr.push(b('tabs--inner'));
54
+ arr.push(b('tabs--inner'))
55
55
  }
56
- return arr.join(' ');
57
- });
56
+ return arr.join(' ')
57
+ })
58
58
  </script>
59
59
 
60
60
  <style lang="scss" scoped>
@@ -1,15 +1,15 @@
1
- import type { TabsProps as ElTabsProps } from 'element-plus';
1
+ import type { TabsProps as ElTabsProps } from 'element-plus'
2
2
 
3
3
  export type TabsOptionItem = {
4
- label: string;
5
- name: string;
6
- disabled?: boolean;
7
- };
4
+ label: string
5
+ name: string
6
+ disabled?: boolean
7
+ }
8
8
 
9
9
  export interface TabsProps
10
10
  extends Partial<Pick<ElTabsProps, 'type' | 'stretch'>> {
11
- type?: ElTabsProps['type'];
12
- options?: TabsOptionItem[];
13
- size?: 'small' | 'medium';
14
- inner?: boolean; // 内嵌模式
11
+ type?: ElTabsProps['type']
12
+ options?: TabsOptionItem[]
13
+ size?: 'small' | 'medium'
14
+ inner?: boolean // 内嵌模式
15
15
  }
@@ -1,2 +1,2 @@
1
- export * from './useBemClass';
2
- export * from './useTable';
1
+ export * from './useBemClass'
2
+ export * from './useTable'
@@ -1,11 +1,11 @@
1
- import { getCurrentInstance } from 'vue';
1
+ import { getCurrentInstance } from 'vue'
2
2
 
3
3
  export function useBemClass() {
4
- const instance = getCurrentInstance();
5
- const configPrefix =
6
- instance?.appContext.config.globalProperties.$config?.prefix || 'gi';
7
- const prefix = configPrefix.toLowerCase();
8
- const b = (name: string = '') => `${prefix}-${name ? `${name}` : ''}`;
4
+ const instance = getCurrentInstance()
5
+ const configPrefix
6
+ = instance?.appContext.config.globalProperties.$config?.prefix || 'gi'
7
+ const prefix = configPrefix.toLowerCase()
8
+ const b = (name: string = '') => `${prefix}-${name ? `${name}` : ''}`
9
9
 
10
- return { b };
10
+ return { b }
11
11
  }
@@ -1,6 +1,5 @@
1
-
2
- import { ElMessageBox } from 'element-plus'
3
- import { reactive, ref, getCurrentInstance, type Ref } from 'vue'
1
+ import type { Ref } from 'vue'
2
+ import { reactive, ref } from 'vue'
4
3
 
5
4
  interface Options<T, U> {
6
5
  onSuccess?: () => void
@@ -20,7 +19,7 @@ interface PageResult<T> {
20
19
  total: number
21
20
  }
22
21
 
23
- export interface UseTablePaginationParams { page: number; size: number; }
22
+ export interface UseTablePaginationParams { page: number, size: number }
24
23
 
25
24
  export interface UseTableApi<T> {
26
25
  (params: UseTablePaginationParams): Promise<ApiResult<PageResult<T[]>>> | Promise<ApiResult<T[]>>
@@ -46,7 +45,7 @@ export function useTable<T extends U, U = T>(api: UseTableApi<T>, options: Optio
46
45
  onSizeChange: (size: number) => {
47
46
  pagination.pageSize = size
48
47
  getTableData()
49
- },
48
+ }
50
49
  })
51
50
 
52
51
  function setTotal(total: number) {
@@ -93,6 +92,6 @@ export function useTable<T extends U, U = T>(api: UseTableApi<T>, options: Optio
93
92
  /** 搜索 */
94
93
  search,
95
94
  /** 刷新 */
96
- refresh,
95
+ refresh
97
96
  }
98
- }
97
+ }
package/packages/index.ts CHANGED
@@ -1,26 +1,26 @@
1
- import type { App } from 'vue';
1
+ import type { App } from 'vue'
2
2
 
3
- import Button from './components/button';
4
- import Card from './components/card';
5
- import Dialog from './components/dialog';
6
- import EditTable from './components/edit-table';
7
- import Form from './components/form';
8
- import GridItem from './components/grid/src/grid-item.vue';
9
- import Grid from './components/grid/src/grid.vue';
10
- import InputGroup from './components/input-group';
11
- import InputSearch from './components/input-search';
12
- import PageLayout from './components/page-layout';
13
- import Table from './components/table';
14
- import Tabs from './components/tabs';
15
- import './styles/index.scss';
3
+ import Button from './components/button'
4
+ import Card from './components/card'
5
+ import Dialog from './components/dialog'
6
+ import EditTable from './components/edit-table'
7
+ import Form from './components/form'
8
+ import GridItem from './components/grid/src/grid-item.vue'
9
+ import Grid from './components/grid/src/grid.vue'
10
+ import InputGroup from './components/input-group'
11
+ import InputSearch from './components/input-search'
12
+ import PageLayout from './components/page-layout'
13
+ import Table from './components/table'
14
+ import Tabs from './components/tabs'
15
+ import './styles/index.scss'
16
16
 
17
- export * from './components/dialog';
18
- export * from './components/edit-table';
19
- export * from './components/form';
20
- export * from './components/table';
21
- export * from './components/tabs';
22
- export * from './hooks';
23
- export * from './utils';
17
+ export * from './components/dialog'
18
+ export * from './components/edit-table'
19
+ export * from './components/form'
20
+ export * from './components/table'
21
+ export * from './components/tabs'
22
+ export * from './hooks'
23
+ export * from './utils'
24
24
 
25
25
  const components = {
26
26
  Button,
@@ -35,49 +35,49 @@ const components = {
35
35
  Dialog,
36
36
  EditTable,
37
37
  Table
38
- };
38
+ }
39
39
 
40
40
  // 导出Gi前缀的组件并添加明确类型注解
41
- export const GiButton: typeof Button = Button;
42
- export const GiCard: typeof Card = Card;
43
- export const GiTabs: typeof Tabs = Tabs;
44
- export const GiInputGroup: typeof InputGroup = InputGroup;
45
- export const GiInputSearch: typeof InputSearch = InputSearch;
46
- export const GiGrid: typeof Grid = Grid;
47
- export const GiGridItem: typeof GridItem = GridItem;
48
- export const GiForm: typeof Form = Form;
49
- export const GiPageLayout: typeof PageLayout = PageLayout;
50
- export const GiDialog: typeof Dialog = Dialog;
51
- export const GiEditTable: typeof EditTable = EditTable;
52
- export const GiTable: typeof Table = Table;
41
+ export const GiButton: typeof Button = Button
42
+ export const GiCard: typeof Card = Card
43
+ export const GiTabs: typeof Tabs = Tabs
44
+ export const GiInputGroup: typeof InputGroup = InputGroup
45
+ export const GiInputSearch: typeof InputSearch = InputSearch
46
+ export const GiGrid: typeof Grid = Grid
47
+ export const GiGridItem: typeof GridItem = GridItem
48
+ export const GiForm: typeof Form = Form
49
+ export const GiPageLayout: typeof PageLayout = PageLayout
50
+ export const GiDialog: typeof Dialog = Dialog
51
+ export const GiEditTable: typeof EditTable = EditTable
52
+ export const GiTable: typeof Table = Table
53
53
 
54
54
  function capitalizeWord(word: string) {
55
55
  // 检查输入是否为字符串且不为空
56
56
  if (typeof word !== 'string' || word.length === 0) {
57
- return word;
57
+ return word
58
58
  }
59
59
  // 首字母大写,其余字母小写
60
- return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
60
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
61
61
  }
62
62
 
63
63
  // 全局默认配置
64
64
  export interface Config {
65
- prefix?: string; // 组件前缀
65
+ prefix?: string // 组件前缀
66
66
  /** 输入框是否可清除 */
67
- clearable?: boolean;
67
+ clearable?: boolean
68
68
  /** 字典请求方法 */
69
- dictRequest?: () => Promise<any>;
69
+ dictRequest?: () => Promise<any>
70
70
  /** 格式化响应数据, 用于useTable */
71
71
  // formatResponse?: (data: any) => any;
72
72
  }
73
73
 
74
74
  export default {
75
75
  install(app: App, options?: Config) {
76
- const prefix = options?.prefix || 'Gi';
76
+ const prefix = options?.prefix || 'Gi'
77
77
  Object.entries(components).forEach(([name, component]) => {
78
- app.component(`${capitalizeWord(prefix)}${name}`, component);
79
- });
78
+ app.component(`${capitalizeWord(prefix)}${name}`, component)
79
+ })
80
80
  // 将配置保存到全局属性
81
- app.config.globalProperties.$config = options;
81
+ app.config.globalProperties.$config = options
82
82
  }
83
- };
83
+ }
@@ -28,6 +28,12 @@ body {
28
28
  }
29
29
  }
30
30
 
31
+ .el-dialog__headerbtn {
32
+ display: flex;
33
+ justify-content: center;
34
+ align-items: center;
35
+ }
36
+
31
37
  .gi-w-full {
32
38
  width: 100%;
33
39
  }
@@ -1,14 +1,14 @@
1
1
  // 辅助类型:获取所有类型的键的联合
2
- type AllKeys<T> = T extends any ? keyof T : never;
2
+ type AllKeys<T> = T extends any ? keyof T : never
3
3
 
4
4
  // 辅助类型:获取属性在所有类型中的联合类型
5
5
  type UnionType<T, K extends PropertyKey> = T extends any
6
6
  ? K extends keyof T
7
- ? T[K]
7
+ ? T[K]
8
+ : never
8
9
  : never
9
- : never;
10
10
 
11
11
  // 合并多个类型,同名属性转为联合类型
12
12
  export type MergeMultiple<T extends any[]> = {
13
13
  [K in AllKeys<T[number]>]: UnionType<T[number], K>
14
- };
14
+ }