gi-component 0.0.48 → 0.0.50
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 +2 -0
- package/dist/components/button/index.d.ts +2 -1
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/src/{button.vue.d.ts → button.d.ts} +5 -3
- package/dist/components/button/src/button.d.ts.map +1 -0
- package/dist/components/button/src/type.d.ts +1 -0
- package/dist/components/button/src/type.d.ts.map +1 -0
- package/dist/components/card/index.d.ts +2 -1
- package/dist/components/card/index.d.ts.map +1 -0
- package/dist/components/card/src/card.d.ts +37 -0
- package/dist/components/card/src/card.d.ts.map +1 -0
- package/dist/components/card/src/type.d.ts +1 -0
- package/dist/components/card/src/type.d.ts.map +1 -0
- package/dist/components/descriptions/index.d.ts +2 -2
- package/dist/components/descriptions/index.d.ts.map +1 -0
- package/dist/components/descriptions/src/descriptions.d.ts +25 -0
- package/dist/components/descriptions/src/descriptions.d.ts.map +1 -0
- package/dist/components/descriptions/src/type.d.ts +25 -11
- package/dist/components/descriptions/src/type.d.ts.map +1 -0
- package/dist/components/dialog/index.d.ts +2 -1
- package/dist/components/dialog/index.d.ts.map +1 -0
- package/dist/components/dialog/src/dialog-content.d.ts +11 -0
- package/dist/components/dialog/src/dialog-content.d.ts.map +1 -0
- package/dist/components/dialog/src/dialog.d.ts +16 -0
- package/dist/components/dialog/src/dialog.d.ts.map +1 -0
- package/dist/components/dialog/src/type.d.ts +1 -0
- package/dist/components/dialog/src/type.d.ts.map +1 -0
- package/dist/components/dot/index.d.ts +2 -1
- package/dist/components/dot/index.d.ts.map +1 -0
- package/dist/components/dot/src/dot.d.ts +9 -0
- package/dist/components/dot/src/dot.d.ts.map +1 -0
- package/dist/components/dot/src/type.d.ts +1 -0
- package/dist/components/dot/src/type.d.ts.map +1 -0
- package/dist/components/drawer/index.d.ts +2 -1
- package/dist/components/drawer/index.d.ts.map +1 -0
- package/dist/components/drawer/src/drawer.d.ts +1 -0
- package/dist/components/drawer/src/drawer.d.ts.map +1 -0
- package/dist/components/drawer/src/type.d.ts +1 -0
- package/dist/components/drawer/src/type.d.ts.map +1 -0
- package/dist/components/edit-table/index.d.ts +2 -1
- package/dist/components/edit-table/index.d.ts.map +1 -0
- package/dist/components/edit-table/src/type.d.ts +1 -0
- package/dist/components/edit-table/src/type.d.ts.map +1 -0
- package/dist/components/flex/index.d.ts +2 -1
- package/dist/components/flex/index.d.ts.map +1 -0
- package/dist/components/flex/src/{flex.vue.d.ts → flex.d.ts} +5 -2
- package/dist/components/flex/src/flex.d.ts.map +1 -0
- package/dist/components/flex/src/type.d.ts +3 -0
- package/dist/components/flex/src/type.d.ts.map +1 -0
- package/dist/components/form/index.d.ts +2 -1
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/src/type.d.ts +1 -0
- package/dist/components/form/src/type.d.ts.map +1 -0
- package/dist/components/grid/index.d.ts +3 -2
- package/dist/components/grid/index.d.ts.map +1 -0
- package/dist/components/grid/src/context.d.ts +1 -0
- package/dist/components/grid/src/context.d.ts.map +1 -0
- package/dist/components/grid/src/{grid-item.vue.d.ts → grid-item.d.ts} +9 -8
- package/dist/components/grid/src/grid-item.d.ts.map +1 -0
- package/dist/components/grid/src/{grid.vue.d.ts → grid.d.ts} +7 -6
- package/dist/components/grid/src/grid.d.ts.map +1 -0
- package/dist/components/grid/src/hook/use-index.d.ts +3 -2
- package/dist/components/grid/src/hook/use-index.d.ts.map +1 -0
- package/dist/components/grid/src/hook/use-responsive-state.d.ts +3 -2
- package/dist/components/grid/src/hook/use-responsive-state.d.ts.map +1 -0
- package/dist/components/grid/src/hook/use-responsive-value.d.ts +3 -2
- package/dist/components/grid/src/hook/use-responsive-value.d.ts.map +1 -0
- package/dist/components/grid/src/interface.d.ts +1 -0
- package/dist/components/grid/src/interface.d.ts.map +1 -0
- package/dist/components/grid/src/type.d.ts +1 -0
- package/dist/components/grid/src/type.d.ts.map +1 -0
- package/dist/components/grid/src/utils/global-config.d.ts +1 -0
- package/dist/components/grid/src/utils/global-config.d.ts.map +1 -0
- package/dist/components/grid/src/utils/index.d.ts +1 -0
- package/dist/components/grid/src/utils/index.d.ts.map +1 -0
- package/dist/components/grid/src/utils/is.d.ts +1 -0
- package/dist/components/grid/src/utils/is.d.ts.map +1 -0
- package/dist/components/grid/src/utils/responsive-observe.d.ts +1 -0
- package/dist/components/grid/src/utils/responsive-observe.d.ts.map +1 -0
- package/dist/components/input-group/index.d.ts +2 -1
- package/dist/components/input-group/index.d.ts.map +1 -0
- package/dist/components/input-group/src/{input-group.vue.d.ts → input-group.d.ts} +3 -1
- package/dist/components/input-group/src/input-group.d.ts.map +1 -0
- package/dist/components/input-group/src/type.d.ts +1 -0
- package/dist/components/input-group/src/type.d.ts.map +1 -0
- package/dist/components/input-search/index.d.ts +2 -1
- package/dist/components/input-search/index.d.ts.map +1 -0
- package/dist/components/input-search/src/{input-search.vue.d.ts → input-search.d.ts} +6 -4
- package/dist/components/input-search/src/input-search.d.ts.map +1 -0
- package/dist/components/input-search/src/type.d.ts +1 -0
- package/dist/components/input-search/src/type.d.ts.map +1 -0
- package/dist/components/nav-tabs/index.d.ts +2 -1
- package/dist/components/nav-tabs/index.d.ts.map +1 -0
- package/dist/components/nav-tabs/src/{nav-tabs.vue.d.ts → nav-tabs.d.ts} +6 -4
- package/dist/components/nav-tabs/src/nav-tabs.d.ts.map +1 -0
- package/dist/components/nav-tabs/src/type.d.ts +1 -0
- package/dist/components/nav-tabs/src/type.d.ts.map +1 -0
- package/dist/components/page-layout/index.d.ts +2 -1
- package/dist/components/page-layout/index.d.ts.map +1 -0
- package/dist/components/page-layout/src/page-layout.d.ts +219 -0
- package/dist/components/page-layout/src/page-layout.d.ts.map +1 -0
- package/dist/components/page-layout/src/{split-button.vue.d.ts → split-button.d.ts} +5 -3
- package/dist/components/page-layout/src/split-button.d.ts.map +1 -0
- package/dist/components/page-layout/src/type.d.ts +12 -0
- package/dist/components/page-layout/src/type.d.ts.map +1 -0
- package/dist/components/page-layout/src/useAutoCollapse.d.ts +12 -0
- package/dist/components/page-layout/src/useAutoCollapse.d.ts.map +1 -0
- package/dist/components/table/index.d.ts +5 -2
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/src/{TableColumn.vue.d.ts → table-column.d.ts} +1 -0
- package/dist/components/table/src/table-column.d.ts.map +1 -0
- package/dist/components/table/src/type.d.ts +7 -6
- package/dist/components/table/src/type.d.ts.map +1 -0
- package/dist/components/tabs/index.d.ts +2 -1
- package/dist/components/tabs/index.d.ts.map +1 -0
- package/dist/components/tabs/src/{tabs.vue.d.ts → tabs.d.ts} +16 -14
- package/dist/components/tabs/src/tabs.d.ts.map +1 -0
- package/dist/components/tabs/src/type.d.ts +1 -0
- package/dist/components/tabs/src/type.d.ts.map +1 -0
- package/dist/components/tag/index.d.ts +2 -1
- package/dist/components/tag/index.d.ts.map +1 -0
- package/dist/components/tag/src/{tag.vue.d.ts → tag.d.ts} +7 -5
- package/dist/components/tag/src/tag.d.ts.map +1 -0
- package/dist/components/tag/src/type.d.ts +1 -0
- package/dist/components/tag/src/type.d.ts.map +1 -0
- package/dist/components/tree-transfer/index.d.ts +2 -1
- package/dist/components/tree-transfer/index.d.ts.map +1 -0
- package/dist/components/tree-transfer/src/tree-transfer.d.ts +14438 -0
- package/dist/components/tree-transfer/src/tree-transfer.d.ts.map +1 -0
- package/dist/components/tree-transfer/src/type.d.ts +1 -0
- package/dist/components/tree-transfer/src/type.d.ts.map +1 -0
- package/dist/components/tree-transfer/src/utils.d.ts +1 -0
- package/dist/components/tree-transfer/src/utils.d.ts.map +1 -0
- package/dist/gi.css +1 -1
- package/dist/global.d.ts +26 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useBemClass.d.ts +1 -0
- package/dist/hooks/useBemClass.d.ts.map +1 -0
- package/dist/hooks/useNavTabs.d.ts +1 -0
- package/dist/hooks/useNavTabs.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +148 -47
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/tool.d.ts +1 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/utils/createSelectDialog.d.ts +1 -0
- package/dist/utils/createSelectDialog.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +7 -6
- package/dist/components/card/src/card.vue.d.ts +0 -35
- package/dist/components/descriptions/src/descriptions.vue.d.ts +0 -20
- package/dist/components/dialog/src/dialog-content.vue.d.ts +0 -9
- package/dist/components/dialog/src/dialog.vue.d.ts +0 -43
- package/dist/components/dot/src/dot.vue.d.ts +0 -7
- package/dist/components/drawer/src/drawer.vue.d.ts +0 -47
- package/dist/components/page-layout/src/page-layout.vue.d.ts +0 -19
- package/dist/components/plus-tabs/index.d.ts +0 -8
- package/dist/components/plus-tabs/src/context.d.ts +0 -26
- package/dist/components/plus-tabs/src/plus-tab-pane.vue.d.ts +0 -39
- package/dist/components/plus-tabs/src/plus-tabs.vue.d.ts +0 -78
- package/dist/components/plus-tabs/src/type.d.ts +0 -5
- package/dist/components/tab/index.d.ts +0 -2
- package/dist/components/tab/src/context.d.ts +0 -10
- package/dist/components/tab/src/tab-item.vue.d.ts +0 -26
- package/dist/components/tab/src/tab.vue.d.ts +0 -44
- package/dist/components/tab/src/type.d.ts +0 -21
- package/dist/components/tab/src/use-nav-tabs.d.ts +0 -2
- package/dist/components/tab/src/use-tabs.d.ts +0 -13
- package/dist/components/table/src/table.d.ts +0 -4
- package/dist/components/table/src/table.vue.d.ts +0 -4
- package/dist/components/table-pro/index.d.ts +0 -4
- package/dist/components/table-pro/src/table-pro-column-setting.vue.d.ts +0 -13
- package/dist/components/table-pro/src/type.d.ts +0 -5
- package/dist/components/tree-transfer/src/tree-transfer.vue.d.ts +0 -14436
- package/dist/components.d.ts +0 -27
- package/packages/components/button/index.ts +0 -5
- package/packages/components/button/src/button.vue +0 -60
- package/packages/components/button/src/type.ts +0 -15
- package/packages/components/card/index.ts +0 -5
- package/packages/components/card/src/card.vue +0 -171
- package/packages/components/card/src/type.ts +0 -12
- package/packages/components/descriptions/index.ts +0 -5
- package/packages/components/descriptions/src/descriptions.vue +0 -72
- package/packages/components/descriptions/src/type.ts +0 -44
- package/packages/components/dialog/index.ts +0 -6
- package/packages/components/dialog/src/dialog-content.vue +0 -40
- package/packages/components/dialog/src/dialog.ts +0 -131
- package/packages/components/dialog/src/dialog.vue +0 -114
- package/packages/components/dialog/src/type.ts +0 -16
- package/packages/components/dot/index.ts +0 -5
- package/packages/components/dot/src/dot.vue +0 -107
- package/packages/components/dot/src/type.ts +0 -6
- package/packages/components/drawer/index.ts +0 -6
- package/packages/components/drawer/src/drawer.ts +0 -84
- package/packages/components/drawer/src/drawer.vue +0 -114
- package/packages/components/drawer/src/type.ts +0 -15
- package/packages/components/edit-table/index.ts +0 -5
- package/packages/components/edit-table/src/edit-table.vue +0 -201
- package/packages/components/edit-table/src/type.ts +0 -51
- package/packages/components/flex/index.ts +0 -5
- package/packages/components/flex/src/flex.vue +0 -82
- package/packages/components/flex/src/type.ts +0 -16
- package/packages/components/form/index.ts +0 -5
- package/packages/components/form/src/form.vue +0 -424
- package/packages/components/form/src/type.ts +0 -85
- package/packages/components/grid/index.ts +0 -8
- package/packages/components/grid/src/context.ts +0 -30
- package/packages/components/grid/src/grid-item.vue +0 -143
- package/packages/components/grid/src/grid.vue +0 -151
- package/packages/components/grid/src/hook/use-index.ts +0 -63
- package/packages/components/grid/src/hook/use-responsive-state.ts +0 -66
- package/packages/components/grid/src/hook/use-responsive-value.ts +0 -36
- package/packages/components/grid/src/interface.ts +0 -74
- package/packages/components/grid/src/type.ts +0 -0
- package/packages/components/grid/src/utils/global-config.ts +0 -6
- package/packages/components/grid/src/utils/index.ts +0 -73
- package/packages/components/grid/src/utils/is.ts +0 -9
- package/packages/components/grid/src/utils/responsive-observe.ts +0 -135
- package/packages/components/input-group/index.ts +0 -5
- package/packages/components/input-group/src/input-group.vue +0 -79
- package/packages/components/input-group/src/type.ts +0 -1
- package/packages/components/input-search/index.ts +0 -5
- package/packages/components/input-search/src/input-search.vue +0 -48
- package/packages/components/input-search/src/type.ts +0 -6
- package/packages/components/nav-tabs/index.ts +0 -8
- package/packages/components/nav-tabs/src/nav-tabs.vue +0 -235
- package/packages/components/nav-tabs/src/type.ts +0 -24
- package/packages/components/page-layout/index.ts +0 -5
- package/packages/components/page-layout/src/page-layout.vue +0 -170
- package/packages/components/page-layout/src/split-button.vue +0 -107
- package/packages/components/page-layout/src/type.ts +0 -12
- package/packages/components/table/index.ts +0 -5
- package/packages/components/table/src/TableColumn.vue +0 -43
- package/packages/components/table/src/table.vue +0 -89
- package/packages/components/table/src/type.ts +0 -24
- package/packages/components/tabs/index.ts +0 -5
- package/packages/components/tabs/src/tabs.vue +0 -139
- package/packages/components/tabs/src/type.ts +0 -15
- package/packages/components/tag/index.ts +0 -5
- package/packages/components/tag/src/tag.vue +0 -355
- package/packages/components/tag/src/type.ts +0 -38
- package/packages/components/tree-transfer/index.ts +0 -5
- package/packages/components/tree-transfer/src/tree-transfer.vue +0 -225
- package/packages/components/tree-transfer/src/type.ts +0 -7
- package/packages/components/tree-transfer/src/utils.ts +0 -23
- package/packages/components.d.ts +0 -34
- package/packages/hooks/index.ts +0 -2
- package/packages/hooks/useBemClass.ts +0 -11
- package/packages/hooks/useNavTabs.ts +0 -497
- package/packages/index.ts +0 -118
- package/packages/styles/el.scss +0 -90
- package/packages/styles/index.scss +0 -141
- package/packages/styles/var.scss +0 -1
- package/packages/types/global.d.ts +0 -7
- package/packages/types/tool.ts +0 -14
- package/packages/utils/createSelectDialog.ts +0 -74
- package/packages/utils/index.ts +0 -1
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { getCurrentInstance } from 'vue'
|
|
2
|
-
|
|
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}` : ''}`
|
|
9
|
-
|
|
10
|
-
return { b }
|
|
11
|
-
}
|
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
import type { MaybeRefOrGetter, Ref } from 'vue'
|
|
2
|
-
import {
|
|
3
|
-
getCurrentInstance,
|
|
4
|
-
nextTick,
|
|
5
|
-
onMounted,
|
|
6
|
-
onUnmounted,
|
|
7
|
-
ref,
|
|
8
|
-
toRef,
|
|
9
|
-
toValue,
|
|
10
|
-
watch
|
|
11
|
-
} from 'vue'
|
|
12
|
-
|
|
13
|
-
export interface UseNavTabsOptions {
|
|
14
|
-
/** 根容器:选择器(.tab)或 HTMLElement / Ref */
|
|
15
|
-
tabEl: MaybeRefOrGetter<string | HTMLElement | null>
|
|
16
|
-
/** 滚动容器:类名 tab__scroll 或 .tab__scroll 或 HTMLElement */
|
|
17
|
-
tabScrollEl: MaybeRefOrGetter<string | HTMLElement | null>
|
|
18
|
-
/** tab 项 class,如 tab-item */
|
|
19
|
-
tabItemClassName: string
|
|
20
|
-
/** 当前选中值;变化时自动居中(推荐传入) */
|
|
21
|
-
activeValue?: MaybeRefOrGetter<string | number | undefined>
|
|
22
|
-
/** 滚轮换算系数,默认 1 */
|
|
23
|
-
wheelSpeed?: number
|
|
24
|
-
/** 左侧滚动按钮元素 */
|
|
25
|
-
tabLeftScrollBtnEl?: MaybeRefOrGetter<string | HTMLElement | null>
|
|
26
|
-
/** 右侧滚动按钮元素 */
|
|
27
|
-
tabRightScrollBtnEl?: MaybeRefOrGetter<string | HTMLElement | null>
|
|
28
|
-
/** 按钮滚动步长占可视宽度比例,默认 0.6 */
|
|
29
|
-
scrollBtnStepRatio?: number
|
|
30
|
-
/** 按钮滚动最小步长(px),默认 120 */
|
|
31
|
-
scrollBtnMinStep?: number
|
|
32
|
-
/** 按钮不可滚动时添加的 class(如 nav-tabs__nav-btn--disabled) */
|
|
33
|
-
navBtnDisabledClassName?: string
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface UseNavTabsReturn {
|
|
37
|
-
/** 滚动到当前选中项并居中 */
|
|
38
|
-
scrollToActive: (behavior?: ScrollBehavior) => void
|
|
39
|
-
/** 获取解析后的滚动容器 */
|
|
40
|
-
getScrollEl: () => HTMLElement | null
|
|
41
|
-
/** 停止滚轮插值动画,避免与 scrollTo 冲突 */
|
|
42
|
-
cancelWheelScroll: () => void
|
|
43
|
-
/** 按步滚动(供外部调用,传入按钮时内部已绑定) */
|
|
44
|
-
scrollByStep: (direction: -1 | 1) => void
|
|
45
|
-
/** 内容是否溢出(可选,与按钮显隐同步更新) */
|
|
46
|
-
showNavBtn: Ref<boolean>
|
|
47
|
-
/** 是否可向左滚动 */
|
|
48
|
-
canScrollLeft: Ref<boolean>
|
|
49
|
-
/** 是否可向右滚动 */
|
|
50
|
-
canScrollRight: Ref<boolean>
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function normalizeSelector(value: string): string {
|
|
54
|
-
if (value.startsWith('.') || value.startsWith('#')) {
|
|
55
|
-
return value
|
|
56
|
-
}
|
|
57
|
-
return `.${value}`
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function resolveElement(
|
|
61
|
-
target: string | HTMLElement | null | undefined,
|
|
62
|
-
root?: HTMLElement | Document | null
|
|
63
|
-
): HTMLElement | null {
|
|
64
|
-
if (!target) {
|
|
65
|
-
return null
|
|
66
|
-
}
|
|
67
|
-
if (typeof target !== 'string') {
|
|
68
|
-
return target
|
|
69
|
-
}
|
|
70
|
-
const scope = root ?? document
|
|
71
|
-
return scope.querySelector(normalizeSelector(target))
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function getMaxScrollLeft(scrollEl: HTMLElement) {
|
|
75
|
-
return Math.max(0, scrollEl.scrollWidth - scrollEl.clientWidth)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** 边界容差,避免浮点误差导致禁用态抖动 */
|
|
79
|
-
const SCROLL_EDGE_EPSILON = 1
|
|
80
|
-
|
|
81
|
-
function canScrollToLeft(scrollEl: HTMLElement) {
|
|
82
|
-
return scrollEl.scrollLeft > SCROLL_EDGE_EPSILON
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function canScrollToRight(scrollEl: HTMLElement) {
|
|
86
|
-
return scrollEl.scrollLeft < getMaxScrollLeft(scrollEl) - SCROLL_EDGE_EPSILON
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/** 滚轮平滑插值系数,越大跟手越快 */
|
|
90
|
-
const WHEEL_SCROLL_LERP = 0.4
|
|
91
|
-
const WHEEL_LINE_HEIGHT = 16
|
|
92
|
-
|
|
93
|
-
function getWheelPixelDelta(event: WheelEvent, scrollEl: HTMLElement): number {
|
|
94
|
-
let delta = Math.abs(event.deltaX) > Math.abs(event.deltaY)
|
|
95
|
-
? event.deltaX
|
|
96
|
-
: event.deltaY
|
|
97
|
-
|
|
98
|
-
if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) {
|
|
99
|
-
delta *= WHEEL_LINE_HEIGHT
|
|
100
|
-
} else if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
|
|
101
|
-
delta *= scrollEl.clientWidth
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return delta
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function clampScrollLeft(scrollEl: HTMLElement, left: number): number {
|
|
108
|
-
return Math.max(0, Math.min(left, getMaxScrollLeft(scrollEl)))
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function scrollItemToCenter(
|
|
112
|
-
scrollEl: HTMLElement,
|
|
113
|
-
activeEl: HTMLElement,
|
|
114
|
-
behavior: ScrollBehavior = 'smooth'
|
|
115
|
-
) {
|
|
116
|
-
const maxScroll = getMaxScrollLeft(scrollEl)
|
|
117
|
-
if (maxScroll <= 0) {
|
|
118
|
-
return
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const scrollRect = scrollEl.getBoundingClientRect()
|
|
122
|
-
const activeRect = activeEl.getBoundingClientRect()
|
|
123
|
-
const activeLeftInContent = activeRect.left - scrollRect.left + scrollEl.scrollLeft
|
|
124
|
-
const target = activeLeftInContent - (scrollEl.clientWidth - activeRect.width) / 2
|
|
125
|
-
|
|
126
|
-
scrollEl.scrollTo({
|
|
127
|
-
left: Math.max(0, Math.min(target, maxScroll)),
|
|
128
|
-
behavior
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function setElementVisible(el: HTMLElement | null, visible: boolean) {
|
|
133
|
-
if (!el) {
|
|
134
|
-
return
|
|
135
|
-
}
|
|
136
|
-
el.style.display = visible ? 'flex' : 'none'
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function setBtnDisabled(
|
|
140
|
-
el: HTMLElement | null,
|
|
141
|
-
disabled: boolean,
|
|
142
|
-
disabledClassName?: string
|
|
143
|
-
) {
|
|
144
|
-
if (!el) {
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
if (disabledClassName) {
|
|
148
|
-
el.classList.toggle(disabledClassName, disabled)
|
|
149
|
-
}
|
|
150
|
-
if (disabled) {
|
|
151
|
-
el.setAttribute('aria-disabled', 'true')
|
|
152
|
-
} else {
|
|
153
|
-
el.removeAttribute('aria-disabled')
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export function useNavTabs(options: UseNavTabsOptions): UseNavTabsReturn {
|
|
158
|
-
const {
|
|
159
|
-
tabEl,
|
|
160
|
-
tabScrollEl,
|
|
161
|
-
tabItemClassName,
|
|
162
|
-
activeValue,
|
|
163
|
-
wheelSpeed = 1,
|
|
164
|
-
tabLeftScrollBtnEl,
|
|
165
|
-
tabRightScrollBtnEl,
|
|
166
|
-
scrollBtnStepRatio = 0.6,
|
|
167
|
-
scrollBtnMinStep = 120,
|
|
168
|
-
navBtnDisabledClassName
|
|
169
|
-
} = options
|
|
170
|
-
|
|
171
|
-
const activeClassName = `${tabItemClassName}--active`
|
|
172
|
-
const itemSelector = normalizeSelector(tabItemClassName)
|
|
173
|
-
const showNavBtn = ref(false)
|
|
174
|
-
const canScrollLeft = ref(false)
|
|
175
|
-
const canScrollRight = ref(false)
|
|
176
|
-
|
|
177
|
-
let rootEl: HTMLElement | null = null
|
|
178
|
-
let scrollEl: HTMLElement | null = null
|
|
179
|
-
let leftBtnEl: HTMLElement | null = null
|
|
180
|
-
let rightBtnEl: HTMLElement | null = null
|
|
181
|
-
let resizeObserver: ResizeObserver | null = null
|
|
182
|
-
let wheelRafId: number | null = null
|
|
183
|
-
let wheelTargetScrollLeft = 0
|
|
184
|
-
let navBtnRafId: number | null = null
|
|
185
|
-
|
|
186
|
-
let onPrevClick: ((event: MouseEvent) => void) | null = null
|
|
187
|
-
let onNextClick: ((event: MouseEvent) => void) | null = null
|
|
188
|
-
|
|
189
|
-
const cancelWheelAnimation = () => {
|
|
190
|
-
if (wheelRafId !== null) {
|
|
191
|
-
cancelAnimationFrame(wheelRafId)
|
|
192
|
-
wheelRafId = null
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
const cancelWheelScroll = () => {
|
|
197
|
-
if (scrollEl) {
|
|
198
|
-
wheelTargetScrollLeft = scrollEl.scrollLeft
|
|
199
|
-
}
|
|
200
|
-
cancelWheelAnimation()
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const runWheelAnimation = () => {
|
|
204
|
-
if (!scrollEl) {
|
|
205
|
-
cancelWheelAnimation()
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const current = scrollEl.scrollLeft
|
|
210
|
-
const diff = wheelTargetScrollLeft - current
|
|
211
|
-
|
|
212
|
-
if (Math.abs(diff) < 0.5) {
|
|
213
|
-
scrollEl.scrollLeft = wheelTargetScrollLeft
|
|
214
|
-
cancelWheelAnimation()
|
|
215
|
-
scheduleUpdateNavBtnState()
|
|
216
|
-
return
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
scrollEl.scrollLeft = current + diff * WHEEL_SCROLL_LERP
|
|
220
|
-
wheelRafId = requestAnimationFrame(runWheelAnimation)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
const updateNavBtnState = () => {
|
|
224
|
-
if (!scrollEl) {
|
|
225
|
-
showNavBtn.value = false
|
|
226
|
-
canScrollLeft.value = false
|
|
227
|
-
canScrollRight.value = false
|
|
228
|
-
setElementVisible(leftBtnEl, false)
|
|
229
|
-
setElementVisible(rightBtnEl, false)
|
|
230
|
-
setBtnDisabled(leftBtnEl, false, navBtnDisabledClassName)
|
|
231
|
-
setBtnDisabled(rightBtnEl, false, navBtnDisabledClassName)
|
|
232
|
-
return
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const overflow = getMaxScrollLeft(scrollEl) > 1
|
|
236
|
-
const scrollLeftEnabled = canScrollToLeft(scrollEl)
|
|
237
|
-
const scrollRightEnabled = canScrollToRight(scrollEl)
|
|
238
|
-
|
|
239
|
-
showNavBtn.value = overflow
|
|
240
|
-
canScrollLeft.value = scrollLeftEnabled
|
|
241
|
-
canScrollRight.value = scrollRightEnabled
|
|
242
|
-
|
|
243
|
-
setElementVisible(leftBtnEl, overflow)
|
|
244
|
-
setElementVisible(rightBtnEl, overflow)
|
|
245
|
-
setBtnDisabled(leftBtnEl, overflow && !scrollLeftEnabled, navBtnDisabledClassName)
|
|
246
|
-
setBtnDisabled(rightBtnEl, overflow && !scrollRightEnabled, navBtnDisabledClassName)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const scheduleUpdateNavBtnState = () => {
|
|
250
|
-
if (navBtnRafId !== null) {
|
|
251
|
-
return
|
|
252
|
-
}
|
|
253
|
-
navBtnRafId = requestAnimationFrame(() => {
|
|
254
|
-
navBtnRafId = null
|
|
255
|
-
updateNavBtnState()
|
|
256
|
-
})
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const cancelNavBtnRaf = () => {
|
|
260
|
-
if (navBtnRafId !== null) {
|
|
261
|
-
cancelAnimationFrame(navBtnRafId)
|
|
262
|
-
navBtnRafId = null
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const scrollByStep = (direction: -1 | 1) => {
|
|
267
|
-
if (!scrollEl) {
|
|
268
|
-
return
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (direction === -1 && !canScrollToLeft(scrollEl)) {
|
|
272
|
-
return
|
|
273
|
-
}
|
|
274
|
-
if (direction === 1 && !canScrollToRight(scrollEl)) {
|
|
275
|
-
return
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
cancelWheelScroll()
|
|
279
|
-
|
|
280
|
-
const maxScroll = getMaxScrollLeft(scrollEl)
|
|
281
|
-
if (maxScroll <= 0) {
|
|
282
|
-
return
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
const step = Math.max(scrollBtnMinStep, scrollEl.clientWidth * scrollBtnStepRatio)
|
|
286
|
-
const target = clampScrollLeft(scrollEl, scrollEl.scrollLeft + direction * step)
|
|
287
|
-
|
|
288
|
-
if (Math.abs(target - scrollEl.scrollLeft) < 1) {
|
|
289
|
-
return
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
scrollEl.scrollTo({ left: target, behavior: 'smooth' })
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const resolveElements = () => {
|
|
296
|
-
const instanceRoot = getCurrentInstance()?.proxy?.$el as HTMLElement | undefined
|
|
297
|
-
const fallbackRoot = instanceRoot instanceof HTMLElement ? instanceRoot : document
|
|
298
|
-
|
|
299
|
-
rootEl = resolveElement(toValue(tabEl), fallbackRoot)
|
|
300
|
-
const scope = rootEl ?? fallbackRoot
|
|
301
|
-
scrollEl = resolveElement(toValue(tabScrollEl), scope)
|
|
302
|
-
leftBtnEl = resolveElement(toValue(tabLeftScrollBtnEl), scope)
|
|
303
|
-
rightBtnEl = resolveElement(toValue(tabRightScrollBtnEl), scope)
|
|
304
|
-
|
|
305
|
-
return Boolean(rootEl && scrollEl)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
const findActiveItem = (): HTMLElement | null => {
|
|
309
|
-
if (!scrollEl) {
|
|
310
|
-
return null
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const activeByClass = scrollEl.querySelector(normalizeSelector(activeClassName))
|
|
314
|
-
if (activeByClass instanceof HTMLElement) {
|
|
315
|
-
return activeByClass
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
const value = activeValue !== undefined ? toValue(activeValue) : undefined
|
|
319
|
-
if (value === undefined) {
|
|
320
|
-
return null
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const items = scrollEl.querySelectorAll<HTMLElement>(itemSelector)
|
|
324
|
-
const matched = Array.from(items).find((item) => item.dataset.value === String(value))
|
|
325
|
-
return matched ?? null
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
const scrollToActive = (behavior: ScrollBehavior = 'smooth') => {
|
|
329
|
-
if (!scrollEl) {
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
cancelWheelScroll()
|
|
333
|
-
const activeItem = findActiveItem()
|
|
334
|
-
if (activeItem) {
|
|
335
|
-
scrollItemToCenter(scrollEl, activeItem, behavior)
|
|
336
|
-
}
|
|
337
|
-
scheduleUpdateNavBtnState()
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
const handleWheel = (event: WheelEvent) => {
|
|
341
|
-
if (!scrollEl) {
|
|
342
|
-
return
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const delta = getWheelPixelDelta(event, scrollEl)
|
|
346
|
-
if (delta === 0) {
|
|
347
|
-
return
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
event.preventDefault()
|
|
351
|
-
|
|
352
|
-
if (wheelRafId === null) {
|
|
353
|
-
wheelTargetScrollLeft = scrollEl.scrollLeft
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
wheelTargetScrollLeft = clampScrollLeft(
|
|
357
|
-
scrollEl,
|
|
358
|
-
wheelTargetScrollLeft + delta * wheelSpeed
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
if (wheelRafId === null) {
|
|
362
|
-
wheelRafId = requestAnimationFrame(runWheelAnimation)
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
scheduleUpdateNavBtnState()
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
const handleScroll = () => {
|
|
369
|
-
scheduleUpdateNavBtnState()
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const bindWheel = () => {
|
|
373
|
-
scrollEl?.addEventListener('wheel', handleWheel, { passive: false })
|
|
374
|
-
scrollEl?.addEventListener('scroll', handleScroll, { passive: true })
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
const unbindWheel = () => {
|
|
378
|
-
scrollEl?.removeEventListener('wheel', handleWheel)
|
|
379
|
-
scrollEl?.removeEventListener('scroll', handleScroll)
|
|
380
|
-
cancelWheelAnimation()
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
const bindNavButtons = () => {
|
|
384
|
-
unbindNavButtons()
|
|
385
|
-
|
|
386
|
-
if (leftBtnEl) {
|
|
387
|
-
onPrevClick = (event: MouseEvent) => {
|
|
388
|
-
if (leftBtnEl?.getAttribute('aria-disabled') === 'true') {
|
|
389
|
-
event.preventDefault()
|
|
390
|
-
return
|
|
391
|
-
}
|
|
392
|
-
scrollByStep(-1)
|
|
393
|
-
}
|
|
394
|
-
leftBtnEl.addEventListener('click', onPrevClick)
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
if (rightBtnEl) {
|
|
398
|
-
onNextClick = (event: MouseEvent) => {
|
|
399
|
-
if (rightBtnEl?.getAttribute('aria-disabled') === 'true') {
|
|
400
|
-
event.preventDefault()
|
|
401
|
-
return
|
|
402
|
-
}
|
|
403
|
-
scrollByStep(1)
|
|
404
|
-
}
|
|
405
|
-
rightBtnEl.addEventListener('click', onNextClick)
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
const unbindNavButtons = () => {
|
|
410
|
-
if (leftBtnEl && onPrevClick) {
|
|
411
|
-
leftBtnEl.removeEventListener('click', onPrevClick)
|
|
412
|
-
}
|
|
413
|
-
if (rightBtnEl && onNextClick) {
|
|
414
|
-
rightBtnEl.removeEventListener('click', onNextClick)
|
|
415
|
-
}
|
|
416
|
-
onPrevClick = null
|
|
417
|
-
onNextClick = null
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const bindResizeObserver = () => {
|
|
421
|
-
if (!scrollEl || typeof ResizeObserver === 'undefined') {
|
|
422
|
-
return
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
resizeObserver = new ResizeObserver(() => {
|
|
426
|
-
scheduleUpdateNavBtnState()
|
|
427
|
-
scrollToActive('auto')
|
|
428
|
-
})
|
|
429
|
-
resizeObserver.observe(scrollEl)
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
const unbindResizeObserver = () => {
|
|
433
|
-
resizeObserver?.disconnect()
|
|
434
|
-
resizeObserver = null
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
const teardown = () => {
|
|
438
|
-
unbindWheel()
|
|
439
|
-
unbindNavButtons()
|
|
440
|
-
unbindResizeObserver()
|
|
441
|
-
cancelWheelAnimation()
|
|
442
|
-
cancelNavBtnRaf()
|
|
443
|
-
rootEl = null
|
|
444
|
-
scrollEl = null
|
|
445
|
-
leftBtnEl = null
|
|
446
|
-
rightBtnEl = null
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
const setup = async () => {
|
|
450
|
-
await nextTick()
|
|
451
|
-
if (!resolveElements()) {
|
|
452
|
-
return
|
|
453
|
-
}
|
|
454
|
-
bindWheel()
|
|
455
|
-
bindNavButtons()
|
|
456
|
-
bindResizeObserver()
|
|
457
|
-
updateNavBtnState()
|
|
458
|
-
scrollToActive('auto')
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
onMounted(() => {
|
|
462
|
-
setup()
|
|
463
|
-
})
|
|
464
|
-
|
|
465
|
-
watch(
|
|
466
|
-
() => [
|
|
467
|
-
toValue(tabEl),
|
|
468
|
-
toValue(tabScrollEl),
|
|
469
|
-
toValue(tabLeftScrollBtnEl),
|
|
470
|
-
toValue(tabRightScrollBtnEl)
|
|
471
|
-
] as const,
|
|
472
|
-
() => {
|
|
473
|
-
teardown()
|
|
474
|
-
setup()
|
|
475
|
-
}
|
|
476
|
-
)
|
|
477
|
-
|
|
478
|
-
if (activeValue !== undefined) {
|
|
479
|
-
watch(toRef(activeValue), () => {
|
|
480
|
-
nextTick(() => scrollToActive())
|
|
481
|
-
})
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
onUnmounted(() => {
|
|
485
|
-
teardown()
|
|
486
|
-
})
|
|
487
|
-
|
|
488
|
-
return {
|
|
489
|
-
scrollToActive,
|
|
490
|
-
getScrollEl: () => scrollEl,
|
|
491
|
-
cancelWheelScroll,
|
|
492
|
-
scrollByStep,
|
|
493
|
-
showNavBtn,
|
|
494
|
-
canScrollLeft,
|
|
495
|
-
canScrollRight
|
|
496
|
-
}
|
|
497
|
-
}
|
package/packages/index.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import type { App, Component } from 'vue'
|
|
2
|
-
|
|
3
|
-
import Button from './components/button'
|
|
4
|
-
import Card from './components/card'
|
|
5
|
-
import Descriptions from './components/descriptions'
|
|
6
|
-
import DialogComponent, { Dialog as DialogFunction } from './components/dialog'
|
|
7
|
-
import Dot from './components/dot'
|
|
8
|
-
import Drawer from './components/drawer'
|
|
9
|
-
import EditTable from './components/edit-table'
|
|
10
|
-
import Flex from './components/flex'
|
|
11
|
-
import Form from './components/form'
|
|
12
|
-
import GridItem from './components/grid/src/grid-item.vue'
|
|
13
|
-
import Grid from './components/grid/src/grid.vue'
|
|
14
|
-
import InputGroup from './components/input-group'
|
|
15
|
-
import InputSearch from './components/input-search'
|
|
16
|
-
import NavTabs from './components/nav-tabs'
|
|
17
|
-
import PageLayout from './components/page-layout'
|
|
18
|
-
import Table from './components/table'
|
|
19
|
-
import Tabs from './components/tabs'
|
|
20
|
-
import Tag from './components/tag'
|
|
21
|
-
import TreeTransfer from './components/tree-transfer'
|
|
22
|
-
import './styles/index.scss'
|
|
23
|
-
|
|
24
|
-
// 防止打包时 tree-shake 掉 Dialog.info/success/warning/error(内部只用到 Dialog.open)
|
|
25
|
-
void [DialogFunction.info, DialogFunction.success, DialogFunction.warning, DialogFunction.error]
|
|
26
|
-
|
|
27
|
-
export * from './components/descriptions'
|
|
28
|
-
export * from './components/dialog'
|
|
29
|
-
export * from './components/drawer'
|
|
30
|
-
export * from './components/edit-table'
|
|
31
|
-
export * from './components/form'
|
|
32
|
-
export * from './components/nav-tabs'
|
|
33
|
-
export * from './components/table'
|
|
34
|
-
export * from './components/tabs'
|
|
35
|
-
export * from './components/tag'
|
|
36
|
-
export * from './hooks'
|
|
37
|
-
export * from './utils'
|
|
38
|
-
|
|
39
|
-
const components = {
|
|
40
|
-
Button,
|
|
41
|
-
Card,
|
|
42
|
-
Descriptions,
|
|
43
|
-
Drawer,
|
|
44
|
-
Dot,
|
|
45
|
-
Tabs,
|
|
46
|
-
InputGroup,
|
|
47
|
-
InputSearch,
|
|
48
|
-
NavTabs,
|
|
49
|
-
Flex,
|
|
50
|
-
Grid,
|
|
51
|
-
GridItem,
|
|
52
|
-
Form,
|
|
53
|
-
PageLayout,
|
|
54
|
-
Dialog: DialogComponent,
|
|
55
|
-
EditTable,
|
|
56
|
-
Table,
|
|
57
|
-
Tag,
|
|
58
|
-
TreeTransfer
|
|
59
|
-
} as unknown as Record<string, Component>
|
|
60
|
-
|
|
61
|
-
// 导出Gi前缀的组件并添加明确类型注解
|
|
62
|
-
export const GiButton: typeof Button = Button
|
|
63
|
-
export const GiCard: typeof Card = Card
|
|
64
|
-
export const GiDescriptions: typeof Descriptions = Descriptions
|
|
65
|
-
export const GiDrawer: typeof Drawer = Drawer
|
|
66
|
-
export const GiDot: typeof Dot = Dot
|
|
67
|
-
export const GiTabs: typeof Tabs = Tabs
|
|
68
|
-
export const GiInputGroup: typeof InputGroup = InputGroup
|
|
69
|
-
export const GiInputSearch: typeof InputSearch = InputSearch
|
|
70
|
-
export const GiNavTabs: typeof NavTabs = NavTabs
|
|
71
|
-
export const GiFlex: typeof Flex = Flex
|
|
72
|
-
export const GiGrid: typeof Grid = Grid
|
|
73
|
-
export const GiGridItem: typeof GridItem = GridItem
|
|
74
|
-
export const GiForm: typeof Form = Form
|
|
75
|
-
export const GiPageLayout: typeof PageLayout = PageLayout
|
|
76
|
-
export const GiDialog: typeof DialogComponent = DialogComponent
|
|
77
|
-
export const GiEditTable: typeof EditTable = EditTable
|
|
78
|
-
export const GiTable: typeof Table = Table
|
|
79
|
-
export const GiTag: typeof Tag = Tag
|
|
80
|
-
export const GiTreeTransfer: typeof TreeTransfer = TreeTransfer
|
|
81
|
-
|
|
82
|
-
function capitalizeWord(word: string) {
|
|
83
|
-
// 检查输入是否为字符串且不为空
|
|
84
|
-
if (typeof word !== 'string' || word.length === 0) {
|
|
85
|
-
return word
|
|
86
|
-
}
|
|
87
|
-
// 首字母大写,其余字母小写
|
|
88
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// 定义字典数据类型
|
|
92
|
-
export interface DictItem {
|
|
93
|
-
label: string
|
|
94
|
-
value: string | number
|
|
95
|
-
[key: string]: any // 允许扩展其他属性
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// 全局默认配置
|
|
99
|
-
export interface Config {
|
|
100
|
-
prefix?: string // 组件前缀
|
|
101
|
-
/** 输入框是否可清除 */
|
|
102
|
-
clearable?: boolean
|
|
103
|
-
/** 字典请求方法 */
|
|
104
|
-
dictRequest?: (code: string) => Promise<DictItem[]>
|
|
105
|
-
/** 格式化响应数据, 用于useTable */
|
|
106
|
-
// formatResponse?: (data: any) => any;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export default {
|
|
110
|
-
install(app: App, options?: Config) {
|
|
111
|
-
const prefix = options?.prefix || 'Gi'
|
|
112
|
-
Object.entries(components).forEach(([name, component]) => {
|
|
113
|
-
app.component(`${capitalizeWord(prefix)}${name}`, component)
|
|
114
|
-
})
|
|
115
|
-
// 将配置保存到全局属性
|
|
116
|
-
app.config.globalProperties.$config = options
|
|
117
|
-
}
|
|
118
|
-
}
|
package/packages/styles/el.scss
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
@use './var.scss' as a;
|
|
2
|
-
|
|
3
|
-
.el-dialog {
|
|
4
|
-
padding: 0 !important;
|
|
5
|
-
|
|
6
|
-
&.is-fullscreen {
|
|
7
|
-
overflow: hidden;
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
|
|
11
|
-
.el-dialog__body {
|
|
12
|
-
flex: 1;
|
|
13
|
-
overflow-y: auto;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.el-dialog__header {
|
|
18
|
-
height: 48px;
|
|
19
|
-
padding-left: var(--el-dialog-padding-primary);
|
|
20
|
-
padding-bottom: 0;
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
border-bottom: 1px solid var(--el-border-color);
|
|
24
|
-
|
|
25
|
-
.el-dialog__headerbtn {
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
align-items: center;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.el-dialog__body {
|
|
33
|
-
padding: var(--el-dialog-padding-primary);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.el-dialog__footer {
|
|
37
|
-
padding: 12px var(--el-dialog-padding-primary);
|
|
38
|
-
border-top: 1px solid var(--el-border-color);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.el-dialog.#{a.$prefix}-dialog--simple {
|
|
43
|
-
.el-dialog__header {
|
|
44
|
-
border-bottom: none;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.el-dialog__body {
|
|
48
|
-
padding-top: 0;
|
|
49
|
-
padding-bottom: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.el-dialog__footer {
|
|
53
|
-
border-top: none;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.el-drawer[role=dialog] {
|
|
58
|
-
--el-drawer-padding-primary: 16px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.el-drawer {
|
|
62
|
-
.el-drawer__header {
|
|
63
|
-
height: 48px;
|
|
64
|
-
margin-bottom: 0;
|
|
65
|
-
padding-top: 0;
|
|
66
|
-
border-bottom: 1px solid var(--el-border-color);
|
|
67
|
-
display: flex;
|
|
68
|
-
justify-content: space-between;
|
|
69
|
-
align-items: center;
|
|
70
|
-
box-sizing: border-box;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.el-drawer__body {
|
|
74
|
-
font-size: 14px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.el-drawer__footer {
|
|
78
|
-
padding-top: 12px;
|
|
79
|
-
padding-bottom: 12px;
|
|
80
|
-
border-top: 1px solid var(--el-border-color);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.#{a.$prefix}-table .el-table {
|
|
85
|
-
--el-table-header-bg-color: var(--el-fill-color-lighter);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.#{a.$prefix}-table .el-table thead.is-group th.el-table__cell {
|
|
89
|
-
background: var(--el-fill-color-lighter);
|
|
90
|
-
}
|