gy-ui-plus 1.0.6 → 1.0.7
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/dist/gy-ui-plus.es.js +1764 -1839
- package/dist/gy-ui-plus.umd.js +2 -2
- package/package.json +12 -11
- package/packages/button/src/index.vue +41 -0
- package/packages/button/src/type.ts +11 -0
- package/packages/index.ts +5 -3
- package/packages/layout-page/index.ts +4 -0
- package/packages/layout-page/src/index.vue +75 -0
- package/packages/layout-page/style/index.ts +1 -0
- package/packages/layout-page/style/layout-page.scss +37 -0
- package/packages/table/index.ts +5 -0
- package/packages/table/src/GyTableColumn.vue +100 -0
- package/packages/table/src/index.vue +1073 -0
- package/packages/table/src/operator.vue +203 -0
- package/packages/table/src/renderCol.vue +20 -0
- package/packages/table/src/renderHeader.vue +18 -0
- package/packages/table/src/singleEdit.vue +352 -0
- package/packages/table/src/singleEditCell.vue +301 -0
- package/packages/table/src/tableProps.ts +146 -0
- package/packages/{gy-table → table}/src/useExpose.ts +15 -15
- package/packages/table/style/index.ts +1 -0
- package/packages/table/style/table.scss +348 -0
- package/dist/gy-ui-plus.css +0 -1
- package/packages/gy-button/src/index.vue +0 -29
- package/packages/gy-table/index.ts +0 -8
- package/packages/gy-table/src/TTableColumn.vue +0 -140
- package/packages/gy-table/src/index.vue +0 -1205
- package/packages/gy-table/src/operator.vue +0 -246
- package/packages/gy-table/src/renderCol.vue +0 -24
- package/packages/gy-table/src/renderHeader.vue +0 -18
- package/packages/gy-table/src/singleEdit.vue +0 -406
- package/packages/gy-table/src/singleEditCell.vue +0 -337
- package/packages/gy-table/src/tableProps.ts +0 -174
- package/packages/gy-table/style/table.scss +0 -368
- /package/packages/{gy-button → button}/index.ts +0 -0
- /package/packages/{gy-table → table}/src/ColumnSet.vue +0 -0
- /package/packages/{gy-table → table}/src/useVirtualized.ts +0 -0
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
},
|
|
6
6
|
"author": "zyj",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.7",
|
|
9
9
|
"private": false,
|
|
10
10
|
"type": "module",
|
|
11
11
|
"main": "dist/gy-ui-plus.umd.js",
|
|
@@ -38,10 +38,9 @@
|
|
|
38
38
|
"scripts": {
|
|
39
39
|
"lib": "vite build",
|
|
40
40
|
"deploy": "deploy.sh",
|
|
41
|
-
"dev": "
|
|
42
|
-
"build": "
|
|
43
|
-
"preview": "
|
|
44
|
-
"build-only": "vite build",
|
|
41
|
+
"docs:dev": "vitepress dev docs",
|
|
42
|
+
"docs:build": "vitepress build docs",
|
|
43
|
+
"docs:preview": "vitepress preview docs",
|
|
45
44
|
"type-check": "vue-tsc --build",
|
|
46
45
|
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
|
|
47
46
|
"lint:eslint": "eslint . --fix --cache",
|
|
@@ -49,20 +48,17 @@
|
|
|
49
48
|
"format": "prettier --write --experimental-cli src/"
|
|
50
49
|
},
|
|
51
50
|
"dependencies": {
|
|
52
|
-
"sortablejs": "1.15.0",
|
|
53
51
|
"axios": "^1.13.2",
|
|
54
52
|
"element-plus": "^2.13.1",
|
|
55
|
-
"
|
|
53
|
+
"sortablejs": "1.15.0",
|
|
56
54
|
"vue-router": "^4.6.3"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
|
-
"@vitejs/plugin-vue": "^6.0.2",
|
|
60
|
-
"vite-plugin-compression": "^0.5.1",
|
|
61
|
-
"vite-plugin-dts": "^3.0.0",
|
|
62
|
-
"vite-plugin-vue-setup-extend": "^0.4.0",
|
|
63
57
|
"@prettier/plugin-oxc": "^0.0.5",
|
|
64
58
|
"@tsconfig/node24": "^24.0.3",
|
|
65
59
|
"@types/node": "^24.10.1",
|
|
60
|
+
"@vitejs/plugin-vue": "^6.0.2",
|
|
61
|
+
"@vitejs/plugin-vue-jsx": "^5.1.3",
|
|
66
62
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
67
63
|
"@vue/tsconfig": "^0.8.1",
|
|
68
64
|
"eslint": "^9.39.1",
|
|
@@ -75,7 +71,12 @@
|
|
|
75
71
|
"sass": "^1.97.1",
|
|
76
72
|
"typescript": "~5.9.0",
|
|
77
73
|
"vite": "^7.2.4",
|
|
74
|
+
"vite-plugin-compression": "^0.5.1",
|
|
75
|
+
"vite-plugin-dts": "^3.0.0",
|
|
78
76
|
"vite-plugin-vue-devtools": "^8.0.5",
|
|
77
|
+
"vite-plugin-vue-setup-extend": "^0.4.0",
|
|
78
|
+
"vitepress": "^1.6.4",
|
|
79
|
+
"vue": "^3.5.27",
|
|
79
80
|
"vue-tsc": "^3.1.5"
|
|
80
81
|
}
|
|
81
82
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip v-if="tip" :content="tip" :placement="placement" v-bind="tipProps">
|
|
3
|
+
<el-button v-bind="$attrs" class="gy-button-tip" @click="handleClick">
|
|
4
|
+
<slot />
|
|
5
|
+
</el-button>
|
|
6
|
+
</el-tooltip>
|
|
7
|
+
<el-button v-else v-bind="$attrs" @click="handleClick">
|
|
8
|
+
<slot />
|
|
9
|
+
</el-button>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
import { ref } from 'vue'
|
|
14
|
+
import type { GyButtonSelfProps as GyButtonProps } from './type'
|
|
15
|
+
|
|
16
|
+
defineOptions({
|
|
17
|
+
name: 'GyButton',
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
const props = withDefaults(defineProps<GyButtonProps>(), {
|
|
21
|
+
time: 1000,
|
|
22
|
+
tip: '',
|
|
23
|
+
placement: 'top',
|
|
24
|
+
tipProps: () => ({}),
|
|
25
|
+
isDebounce: true,
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
// 抛出事件
|
|
29
|
+
const emits = defineEmits(['click'])
|
|
30
|
+
|
|
31
|
+
const record = ref(0)
|
|
32
|
+
|
|
33
|
+
const handleClick = () => {
|
|
34
|
+
if (!props.isDebounce) return emits('click')
|
|
35
|
+
const newTime = new Date()
|
|
36
|
+
if (newTime.getTime() - record.value > props.time) {
|
|
37
|
+
emits('click')
|
|
38
|
+
}
|
|
39
|
+
record.value = newTime.getTime()
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ButtonProps } from "element-plus"
|
|
2
|
+
import type { Mutable } from "element-plus/es/utils"
|
|
3
|
+
|
|
4
|
+
export interface GyButtonSelfProps {
|
|
5
|
+
time?: number
|
|
6
|
+
tip?: string
|
|
7
|
+
placement?: string
|
|
8
|
+
tipProps?: Record<string, any>
|
|
9
|
+
isDebounce?: boolean
|
|
10
|
+
}
|
|
11
|
+
export type GyButtonProps = GyButtonSelfProps & Partial<Mutable<ButtonProps>>
|
package/packages/index.ts
CHANGED
|
@@ -2,8 +2,9 @@ import type { Component, App } from 'vue'
|
|
|
2
2
|
// import ElementPlus from 'element-plus'
|
|
3
3
|
// import 'element-plus/dist/index.css'
|
|
4
4
|
// import locale from 'element-plus/lib/locale/lang/zh-cn' // 因element-plus默认是英文,我们指定一下默认中文
|
|
5
|
-
import GyButton from './
|
|
6
|
-
import GyTable from './
|
|
5
|
+
import GyButton from './button/src/index.vue'
|
|
6
|
+
import GyTable from './table/src/index.vue'
|
|
7
|
+
import GyLayoutPage from './layout-page/src/index.vue'
|
|
7
8
|
|
|
8
9
|
// 存储组件列表
|
|
9
10
|
const components: {
|
|
@@ -11,6 +12,7 @@ const components: {
|
|
|
11
12
|
} = {
|
|
12
13
|
GyButton,
|
|
13
14
|
GyTable,
|
|
15
|
+
GyLayoutPage,
|
|
14
16
|
}
|
|
15
17
|
// 插件声明:声明所有插件
|
|
16
18
|
// 插件注册:在 Vue 项目的入口文件中,通过 ( app.use(插件) ) 进行注册
|
|
@@ -28,7 +30,7 @@ const install: any = (app: any, router?: any) => {
|
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
// 按需引入
|
|
31
|
-
export { GyButton, GyTable }
|
|
33
|
+
export { GyButton, GyTable, GyLayoutPage }
|
|
32
34
|
export default {
|
|
33
35
|
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
|
34
36
|
install,
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="GyLayoutPageRef"
|
|
4
|
+
class="gy_layout_page"
|
|
5
|
+
:class="{ layout_page_no_margin: isNoMargin }"
|
|
6
|
+
@scroll="(e: any) => (scrollTop = e.target.scrollTop)"
|
|
7
|
+
>
|
|
8
|
+
<slot />
|
|
9
|
+
<div class="back_to_top" v-if="showGoTopButton">
|
|
10
|
+
<div v-if="isShowGoTopButton" @click="backToTop">
|
|
11
|
+
<el-icon v-bind="{ size: 24, ...$attrs }"><CaretTop /></el-icon>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { onActivated, onMounted, ref, watch } from 'vue'
|
|
18
|
+
import { CaretTop } from '@element-plus/icons-vue'
|
|
19
|
+
defineOptions({
|
|
20
|
+
name: 'GyLayoutPage',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export interface GyLayoutPageProps {
|
|
24
|
+
keepScrollDisabled?: boolean
|
|
25
|
+
isNoMargin?: boolean
|
|
26
|
+
showGoTopButton?: boolean
|
|
27
|
+
scrollToTop?: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = withDefaults(defineProps<GyLayoutPageProps>(), {
|
|
31
|
+
keepScrollDisabled: false,
|
|
32
|
+
isNoMargin: false,
|
|
33
|
+
showGoTopButton: true,
|
|
34
|
+
scrollToTop: 100,
|
|
35
|
+
})
|
|
36
|
+
const isShowGoTopButton = ref(false)
|
|
37
|
+
|
|
38
|
+
const GyLayoutPageRef = ref(null)
|
|
39
|
+
const scrollTop = ref(0)
|
|
40
|
+
watch(
|
|
41
|
+
() => scrollTop.value,
|
|
42
|
+
(newVal) => {
|
|
43
|
+
if (newVal > props.scrollToTop) {
|
|
44
|
+
isShowGoTopButton.value = true
|
|
45
|
+
} else {
|
|
46
|
+
isShowGoTopButton.value = false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
const backToTop = () => {
|
|
51
|
+
scrollTop.value = 0
|
|
52
|
+
;(GyLayoutPageRef.value as any).scrollTo({
|
|
53
|
+
top: 0,
|
|
54
|
+
behavior: 'smooth',
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
const pageItems = (GyLayoutPageRef.value as any).querySelectorAll('.gy_layout_page_item')
|
|
59
|
+
if (pageItems.length === 2) {
|
|
60
|
+
pageItems[0].style.marginBottom = '8px'
|
|
61
|
+
}
|
|
62
|
+
if (pageItems.length > 2) {
|
|
63
|
+
pageItems.forEach((item: any) => {
|
|
64
|
+
item.style.marginBottom = '8px'
|
|
65
|
+
})
|
|
66
|
+
pageItems[pageItems.length - 1].style.marginBottom = '0'
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
onActivated(() => {
|
|
71
|
+
if (!props.keepScrollDisabled) {
|
|
72
|
+
;(GyLayoutPageRef.value as any).scrollTop = scrollTop
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./layout-page.scss"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.t_layout_page {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
padding: 8px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
overflow: auto;
|
|
8
|
+
.back_to_top {
|
|
9
|
+
position: absolute;
|
|
10
|
+
right: 10px;
|
|
11
|
+
bottom: 100px;
|
|
12
|
+
z-index: 100;
|
|
13
|
+
box-shadow: 0 5px 6px 2px rgba(0, 0, 0, 0.5);
|
|
14
|
+
background: #fff;
|
|
15
|
+
border-radius: 5px;
|
|
16
|
+
opacity: 0.6;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
opacity: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> div {
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
height: 40px;
|
|
25
|
+
width: 40px;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
.el-icon {
|
|
30
|
+
color: #9b59b6;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
.layout_page_no_margin {
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-table-column
|
|
3
|
+
v-if="typeof item.isShowCol == 'function' ? item.isShowCol(item) : !item.isShowCol"
|
|
4
|
+
:prop="item.prop"
|
|
5
|
+
:label="item.label"
|
|
6
|
+
:type="item.type"
|
|
7
|
+
:align="item.align || align"
|
|
8
|
+
:min-width="item['min-width'] || item.minWidth"
|
|
9
|
+
:width="item.width"
|
|
10
|
+
:fixed="item.fixed"
|
|
11
|
+
>
|
|
12
|
+
<template #header v-if="item.renderHeader">
|
|
13
|
+
<render-header :column="item" :render="item.renderHeader" />
|
|
14
|
+
</template>
|
|
15
|
+
<template v-for="(val, index) of item.children">
|
|
16
|
+
<gy-table-column v-if="val.children" :key="index" :item="val" v-bind="$attrs">
|
|
17
|
+
<template v-for="(_index, name) in slots" v-slot:[name]="data">
|
|
18
|
+
<slot :name="name" v-bind="data"></slot>
|
|
19
|
+
</template>
|
|
20
|
+
</gy-table-column>
|
|
21
|
+
<el-table-column
|
|
22
|
+
v-else
|
|
23
|
+
:key="val.prop"
|
|
24
|
+
:prop="val.prop"
|
|
25
|
+
:label="val.label"
|
|
26
|
+
:min-width="val['min-width'] || val.minWidth"
|
|
27
|
+
:width="val.width"
|
|
28
|
+
:sortable="val.sortable || val.sort || sortable"
|
|
29
|
+
:align="val.align || align"
|
|
30
|
+
:fixed="val.fixed"
|
|
31
|
+
:formatter="val.formatter"
|
|
32
|
+
v-if="typeof val.isShowCol == 'function' ? val.isShowCol(val) : !val.isShowCol"
|
|
33
|
+
v-bind="{ 'show-overflow-tooltip': true, ...val.bind, ...$attrs }"
|
|
34
|
+
>
|
|
35
|
+
<template #header v-if="val.renderHeader">
|
|
36
|
+
<render-header :column="val" :render="val.renderHeader" />
|
|
37
|
+
</template>
|
|
38
|
+
<template #default="scope">
|
|
39
|
+
<!-- render渲染 -->
|
|
40
|
+
<template v-if="val.render">
|
|
41
|
+
<render-col :column="val" :row="scope.row" :render="val.render" :index="scope.$index" />
|
|
42
|
+
</template>
|
|
43
|
+
<!-- 自定义插槽 -->
|
|
44
|
+
<template v-if="val.slotNameMerge">
|
|
45
|
+
<slot :name="val.slotNameMerge" :scope="scope"></slot>
|
|
46
|
+
</template>
|
|
47
|
+
<!-- 单个单元格编辑 -->
|
|
48
|
+
<template v-if="val.canEdit">
|
|
49
|
+
<single-edit-cell
|
|
50
|
+
:isShowRules="false"
|
|
51
|
+
:configEdit="val.configEdit"
|
|
52
|
+
v-model="scope.row[val.prop]"
|
|
53
|
+
:prop="val.prop"
|
|
54
|
+
:scope="scope"
|
|
55
|
+
@handleEvent="({ type, val }:any) => emits('handleEvent', type, val, scope.$index)"
|
|
56
|
+
v-bind="$attrs"
|
|
57
|
+
>
|
|
58
|
+
<template v-for="(_index, name) in slots" v-slot:[name]="data">
|
|
59
|
+
<slot :name="name" v-bind="data"></slot>
|
|
60
|
+
</template>
|
|
61
|
+
</single-edit-cell>
|
|
62
|
+
</template>
|
|
63
|
+
<div v-if="!val.render && !val.slotNameMerge && !val.canEdit && !val.formatter">
|
|
64
|
+
{{ scope.row[val.prop] }}
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
</el-table-column>
|
|
68
|
+
</template>
|
|
69
|
+
</el-table-column>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script setup lang="tsx">
|
|
73
|
+
import SingleEditCell from './singleEditCell.vue'
|
|
74
|
+
import RenderCol from './renderCol.vue'
|
|
75
|
+
import RenderHeader from './renderHeader.vue'
|
|
76
|
+
import { useSlots } from 'vue'
|
|
77
|
+
defineOptions({
|
|
78
|
+
name: 'GyTableColumn',
|
|
79
|
+
})
|
|
80
|
+
defineProps({
|
|
81
|
+
item: {
|
|
82
|
+
type: Object,
|
|
83
|
+
default: () => {
|
|
84
|
+
return {}
|
|
85
|
+
},
|
|
86
|
+
required: true,
|
|
87
|
+
},
|
|
88
|
+
align: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'center',
|
|
91
|
+
},
|
|
92
|
+
sortable: {
|
|
93
|
+
type: [Boolean, String],
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
// 抛出事件
|
|
97
|
+
const emits = defineEmits(['handleEvent'])
|
|
98
|
+
// 获取所有插槽
|
|
99
|
+
const slots = useSlots()
|
|
100
|
+
</script>
|