gyyg-components 0.1.1-6.1
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 +24 -0
- package/babel.config.js +12 -0
- package/jsconfig.json +19 -0
- package/lib/demo.html +10 -0
- package/lib/gyyg-components.common.js +6623 -0
- package/lib/gyyg-components.common.js.map +1 -0
- package/lib/gyyg-components.css +1 -0
- package/lib/gyyg-components.umd.js +6633 -0
- package/lib/gyyg-components.umd.js.map +1 -0
- package/lib/gyyg-components.umd.min.js +2 -0
- package/lib/gyyg-components.umd.min.js.map +1 -0
- package/package.json +50 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +46 -0
- package/src/assets/images/down.png +0 -0
- package/src/components/EmcTable/EmcTable.js +5 -0
- package/src/components/EmcTable/EmcTable.vue +244 -0
- package/src/components/GyygLayout/GyygLayout.js +5 -0
- package/src/components/GyygLayout/GyygLayout.vue +412 -0
- package/src/components/GyygModal/GyygModal.js +5 -0
- package/src/components/GyygModal/GyygModal.vue +333 -0
- package/src/components/GyygTable/GyygTable.js +5 -0
- package/src/components/GyygTable/GyygTable.vue +82 -0
- package/src/components/SvgIcon/index.vue +62 -0
- package/src/directive/el-drag-dialog/drag.js +64 -0
- package/src/directive/el-drag-dialog/index.js +13 -0
- package/src/directive/feeInput.js +48 -0
- package/src/directive/numberInput.js +32 -0
- package/src/icons/index.js +9 -0
- package/src/icons/svg/down.svg +1 -0
- package/src/icons/svg/up.svg +1 -0
- package/src/icons/svgo.yml +22 -0
- package/src/index.js +45 -0
- package/src/main.js +21 -0
- package/src/otherComponents/btnClick.vue +52 -0
- package/src/otherComponents/iconButton.vue +82 -0
- package/src/otherComponents/styleText.vue +51 -0
- package/src/utils/common.js +25 -0
- package/vue.config.js +24 -0
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gyyg-components",
|
|
3
|
+
"version": "0.1.16.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "lib/gyyg-components.umd.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"serve": "vue-cli-service serve",
|
|
8
|
+
"start": "vue-cli-service build --target lib --name gyyg-components --dest lib src/index.js --watch",
|
|
9
|
+
"build": "vue-cli-service build --target lib --name gyyg-components --dest lib src/index.js",
|
|
10
|
+
"lint": "vue-cli-service lint"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"babel-plugin-component": "^1.1.1",
|
|
14
|
+
"core-js": "^3.6.5",
|
|
15
|
+
"element-resize-detector": "^1.2.4",
|
|
16
|
+
"element-ui": "2.15.6",
|
|
17
|
+
"vue": "^2.6.11"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@vue/cli-plugin-babel": "~4.5.15",
|
|
21
|
+
"@vue/cli-plugin-eslint": "~4.5.15",
|
|
22
|
+
"@vue/cli-service": "~4.5.15",
|
|
23
|
+
"babel-eslint": "^10.1.0",
|
|
24
|
+
"eslint": "^6.7.2",
|
|
25
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
26
|
+
"less": "^4.2.1",
|
|
27
|
+
"less-loader": "^7.3.0",
|
|
28
|
+
"svg-sprite-loader": "^4.1.3",
|
|
29
|
+
"vue-template-compiler": "^2.6.11"
|
|
30
|
+
},
|
|
31
|
+
"eslintConfig": {
|
|
32
|
+
"root": true,
|
|
33
|
+
"env": {
|
|
34
|
+
"node": true
|
|
35
|
+
},
|
|
36
|
+
"extends": [
|
|
37
|
+
"plugin:vue/essential",
|
|
38
|
+
"eslint:recommended"
|
|
39
|
+
],
|
|
40
|
+
"parserOptions": {
|
|
41
|
+
"parser": "babel-eslint"
|
|
42
|
+
},
|
|
43
|
+
"rules": {}
|
|
44
|
+
},
|
|
45
|
+
"browserslist": [
|
|
46
|
+
"> 1%",
|
|
47
|
+
"last 2 versions",
|
|
48
|
+
"not dead"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<noscript>
|
|
12
|
+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
13
|
+
</noscript>
|
|
14
|
+
<div id="app"></div>
|
|
15
|
+
<!-- built files will be auto injected -->
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
package/src/App.vue
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<!-- <gyyg-layout>
|
|
4
|
+
<template slot="table">
|
|
5
|
+
<gyyg-table :data='data' @selection-change="change" >
|
|
6
|
+
<template slot='content'>
|
|
7
|
+
<el-table-column type="selection" width="55"> </el-table-column>
|
|
8
|
+
<el-table-column prop='a'></el-table-column>
|
|
9
|
+
</template>
|
|
10
|
+
</gyyg-table>
|
|
11
|
+
</template>
|
|
12
|
+
</gyyg-layout> -->
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'App',
|
|
19
|
+
data(){
|
|
20
|
+
return{
|
|
21
|
+
// text:'',
|
|
22
|
+
// data:[
|
|
23
|
+
// {
|
|
24
|
+
// a:'1322'
|
|
25
|
+
// }
|
|
26
|
+
// ]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
methods:{
|
|
30
|
+
change(val){
|
|
31
|
+
console.log(val)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<style>
|
|
38
|
+
#app {
|
|
39
|
+
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
40
|
+
-webkit-font-smoothing: antialiased;
|
|
41
|
+
-moz-osx-font-smoothing: grayscale;
|
|
42
|
+
text-align: center;
|
|
43
|
+
color: #2c3e50;
|
|
44
|
+
margin-top: 60px;
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
Binary file
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="table-container">
|
|
3
|
+
<el-table
|
|
4
|
+
:data="tableData"
|
|
5
|
+
ref='table'
|
|
6
|
+
:height="height"
|
|
7
|
+
:max-height="maxHeight"
|
|
8
|
+
:highlight-current-row="highlightCurrentRow"
|
|
9
|
+
:row-class-name="tableRowClassName"
|
|
10
|
+
:header-cell-style="headerCellStyle"
|
|
11
|
+
:row-key="rowKey"
|
|
12
|
+
:expand-row-keys="expandRowKeys"
|
|
13
|
+
:tree-props="treeProps"
|
|
14
|
+
@current-change="currentChange"
|
|
15
|
+
@sort-change="sortChange"
|
|
16
|
+
@selection-change="selectionChange"
|
|
17
|
+
@select="select"
|
|
18
|
+
:row-style="selectedRowStyle"
|
|
19
|
+
:default-expand-all="defaultExpandAll"
|
|
20
|
+
>
|
|
21
|
+
<!-- 多选框 -->
|
|
22
|
+
<el-table-column
|
|
23
|
+
type="selection"
|
|
24
|
+
width="55"
|
|
25
|
+
align="center"
|
|
26
|
+
:reserve-selection="reserveSelection"
|
|
27
|
+
v-if="selection"
|
|
28
|
+
></el-table-column>
|
|
29
|
+
<template v-for="(col, index) in column">
|
|
30
|
+
<el-table-column
|
|
31
|
+
v-if="!col['type']"
|
|
32
|
+
:label="col.label"
|
|
33
|
+
:align="col.align"
|
|
34
|
+
:min-width="col.minWidth"
|
|
35
|
+
:max-width="col.maxWidth"
|
|
36
|
+
:width="col.width"
|
|
37
|
+
:sortable="col.sortable"
|
|
38
|
+
:show-overflow-tooltip="col.showOverflowTooltip"
|
|
39
|
+
:key="index"
|
|
40
|
+
:fixed="col.fixed"
|
|
41
|
+
:prop="col.bind"
|
|
42
|
+
>
|
|
43
|
+
<template slot="header" v-if="col.header == 'custom'">
|
|
44
|
+
<span>{{ col.label }}
|
|
45
|
+
<el-tooltip class="item" effect="dark" :content="col.message" placement="top">
|
|
46
|
+
<i :class="col.headerIcon || 'el-icon-question'"></i>
|
|
47
|
+
</el-tooltip>
|
|
48
|
+
</span>
|
|
49
|
+
</template>
|
|
50
|
+
</el-table-column>
|
|
51
|
+
<el-table-column
|
|
52
|
+
v-else
|
|
53
|
+
:label="col.label"
|
|
54
|
+
:align="col.align"
|
|
55
|
+
:min-width="col.minWidth"
|
|
56
|
+
:max-width="col.maxWidth"
|
|
57
|
+
:width="col.width"
|
|
58
|
+
:sortable="col.sortable"
|
|
59
|
+
:show-overflow-tooltip="col.showOverflowTooltip"
|
|
60
|
+
:key="index + col.type"
|
|
61
|
+
:fixed="col.fixed"
|
|
62
|
+
>
|
|
63
|
+
<template slot-scope="scope">
|
|
64
|
+
<component
|
|
65
|
+
:key="index"
|
|
66
|
+
:is="col['type']"
|
|
67
|
+
:scope="scope"
|
|
68
|
+
:tableData="col"
|
|
69
|
+
v-model="scope.row[col.bind]"
|
|
70
|
+
v-bind="col.componentProps || {}"
|
|
71
|
+
v-on="col.componentListeners || {}"
|
|
72
|
+
></component>
|
|
73
|
+
</template>
|
|
74
|
+
<template slot="header" v-if="col.header == 'custom'">
|
|
75
|
+
<span>{{ col.label }}
|
|
76
|
+
<el-tooltip class="item" effect="dark" :content="col.message" placement="top">
|
|
77
|
+
<i :class="col.headerIcon || 'el-icon-question'"></i>
|
|
78
|
+
</el-tooltip>
|
|
79
|
+
</span>
|
|
80
|
+
</template>
|
|
81
|
+
</el-table-column>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
</el-table>
|
|
85
|
+
<!-- 分页 -->
|
|
86
|
+
<div class="pagination-layout">
|
|
87
|
+
<el-pagination
|
|
88
|
+
v-if="page"
|
|
89
|
+
@size-change="handleSizeChange"
|
|
90
|
+
@current-change="handleCurrentChange"
|
|
91
|
+
:page-sizes="[10, 20, 30, 50]"
|
|
92
|
+
:page-size="page.pageSize"
|
|
93
|
+
:current-page="page.currentPage"
|
|
94
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
95
|
+
:total="page.totalRecords"
|
|
96
|
+
></el-pagination>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
<script>
|
|
101
|
+
import styleText from '@/otherComponents/styleText.vue'
|
|
102
|
+
import btnClick from '@/otherComponents/btnClick.vue'
|
|
103
|
+
import iconButton from '@/otherComponents/iconButton.vue';
|
|
104
|
+
export default {
|
|
105
|
+
name: 'EmcTable',
|
|
106
|
+
components: {
|
|
107
|
+
styleText,
|
|
108
|
+
btnClick,
|
|
109
|
+
iconButton,
|
|
110
|
+
},
|
|
111
|
+
props: {
|
|
112
|
+
// 表格数据
|
|
113
|
+
tableData: {
|
|
114
|
+
reauried: true,
|
|
115
|
+
},
|
|
116
|
+
// 表格列
|
|
117
|
+
columns: {
|
|
118
|
+
required: true,
|
|
119
|
+
},
|
|
120
|
+
// 表格高度
|
|
121
|
+
height: {
|
|
122
|
+
required: false
|
|
123
|
+
},
|
|
124
|
+
// 表格最大高度
|
|
125
|
+
maxHeight: {
|
|
126
|
+
required: false,
|
|
127
|
+
},
|
|
128
|
+
// 是否显示多选框
|
|
129
|
+
selection: {
|
|
130
|
+
required: false,
|
|
131
|
+
},
|
|
132
|
+
// 是否保留多选框
|
|
133
|
+
reserveSelection: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false
|
|
136
|
+
},
|
|
137
|
+
// 分页
|
|
138
|
+
page: {
|
|
139
|
+
// 分页
|
|
140
|
+
required: false,
|
|
141
|
+
},
|
|
142
|
+
// 是否高亮当前行
|
|
143
|
+
highlightCurrentRow: {
|
|
144
|
+
required: false,
|
|
145
|
+
},
|
|
146
|
+
// 表头样式
|
|
147
|
+
headerCellStyle:{
|
|
148
|
+
required: false,
|
|
149
|
+
default: () => {
|
|
150
|
+
return {
|
|
151
|
+
backgroundColor: "#fff",
|
|
152
|
+
textAlign: "center",
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
// 行数据的key
|
|
157
|
+
rowKey: {
|
|
158
|
+
type: [String,Number],
|
|
159
|
+
default: 'id',
|
|
160
|
+
},
|
|
161
|
+
// 行className回调
|
|
162
|
+
tableRowClassName:{
|
|
163
|
+
type: [Function, String],
|
|
164
|
+
required: false,
|
|
165
|
+
},
|
|
166
|
+
// 展开行的key
|
|
167
|
+
expandRowKeys: {
|
|
168
|
+
type: Array,
|
|
169
|
+
required: false,
|
|
170
|
+
},
|
|
171
|
+
// 嵌套数据的配置选项
|
|
172
|
+
treeProps: {
|
|
173
|
+
type: Object,
|
|
174
|
+
default: () => {
|
|
175
|
+
return {};
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
// 是否默认展开所有行
|
|
179
|
+
defaultExpandAll: {
|
|
180
|
+
default: false,
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
data() {
|
|
184
|
+
return {
|
|
185
|
+
multipleSelection: [],
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
methods: {
|
|
189
|
+
// 列表选中当前行字体加粗
|
|
190
|
+
selectedRowStyle({ row }) {
|
|
191
|
+
const idArr = this.multipleSelection.map(row => row[this.rowKey])
|
|
192
|
+
if (idArr.includes(row[this.rowKey])) {
|
|
193
|
+
return { 'font-weight': '700' }
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
// pageSize 改变时会触发
|
|
197
|
+
handleSizeChange(val) {
|
|
198
|
+
this.$emit('page-size-change', val);
|
|
199
|
+
},
|
|
200
|
+
// // currentPage 改变时会触发
|
|
201
|
+
handleCurrentChange(val) {
|
|
202
|
+
this.$emit('page-change', val);
|
|
203
|
+
},
|
|
204
|
+
// 表格属性回调
|
|
205
|
+
currentChange(val) {
|
|
206
|
+
this.$emit('current-change', val);
|
|
207
|
+
},
|
|
208
|
+
// 排序规则发生变化时会触发
|
|
209
|
+
sortChange(column, prop, order) {
|
|
210
|
+
this.$emit('sort-change', column, prop, order);
|
|
211
|
+
},
|
|
212
|
+
// 手动勾选数据行的checkbox时触发的事件
|
|
213
|
+
select(column, row) {
|
|
214
|
+
let refs = this.$refs.table;
|
|
215
|
+
this.$emit('select', column, row, refs);
|
|
216
|
+
},
|
|
217
|
+
// 选择项发生变化时会触发
|
|
218
|
+
selectionChange(column) {
|
|
219
|
+
this.multipleSelection = column
|
|
220
|
+
this.$emit('selection-change', column);
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
},
|
|
224
|
+
watch: {
|
|
225
|
+
columns: {
|
|
226
|
+
handler: function (val) {
|
|
227
|
+
|
|
228
|
+
this.column = val;
|
|
229
|
+
},
|
|
230
|
+
immediate: true,
|
|
231
|
+
deep: true,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
}
|
|
235
|
+
</script>
|
|
236
|
+
<style lang="less" scoped>
|
|
237
|
+
.table-container {
|
|
238
|
+
background-color: #fff;
|
|
239
|
+
}
|
|
240
|
+
.pagination-layout {
|
|
241
|
+
text-align: right;
|
|
242
|
+
height: 35px;
|
|
243
|
+
}
|
|
244
|
+
</style>
|