tianheng-ui 0.0.3 → 0.0.4

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.
@@ -1,111 +0,0 @@
1
- <template>
2
- <div>
3
- <template v-for="(item, index) in options">
4
- <template v-if="!item.hide">
5
- <el-table-column
6
- v-if="item.type"
7
- :key="index"
8
- :type="item.type"
9
- :label="item.label"
10
- width="50"
11
- >
12
- </el-table-column>
13
- <el-table-column
14
- v-else-if="item.children"
15
- :key="index"
16
- :prop="item.prop"
17
- :label="item.label"
18
- :width="item.width"
19
- :align="item.align"
20
- :fixed="item.fixed"
21
- :sortable="item.sortable"
22
- :sort-method="item.sortMethod"
23
- show-overflow-tooltip
24
- >
25
- <TableColumn :key="index" :options="item.children"></TableColumn>
26
- </el-table-column>
27
- <el-table-column
28
- v-else
29
- :key="index"
30
- :prop="item.prop"
31
- :label="item.label"
32
- :width="item.width"
33
- :align="item.align"
34
- :fixed="item.fixed"
35
- :sortable="item.sortable"
36
- :sort-method="item.sortMethod"
37
- show-overflow-tooltip
38
- >
39
- <template slot-scope="scope">
40
- <slot v-if="item.slot" name="slot" :scope="scope" :option="item" />
41
- <div v-else>{{ scope.row[item.prop] }}</div>
42
- </template>
43
- </el-table-column>
44
- </template>
45
- </template>
46
- </div>
47
- </template>
48
-
49
- <script>
50
- export default {
51
- name: "TableColumn",
52
- props: {
53
- options: {
54
- type: Array,
55
- default: () => {
56
- return [];
57
- },
58
- },
59
- },
60
- created(){
61
- /**
62
- *
63
- * <template v-if={!item.hide}>
64
- <el-table-column
65
- v-if={item.type}
66
- type={item.type}
67
- label={item.label}
68
- width="50"
69
- ></el-table-column>
70
- <el-table-column
71
- v-else-if={item.children}
72
- prop={item.prop}
73
- label={item.label}
74
- width={item.width}
75
- align={item.align}
76
- fixed={item.fixed}
77
- sortable={item.sortable}
78
- sort-method={item.sortMethod}
79
- show-overflow-tooltip
80
- >
81
- {this.dynamicItem(item.children)}
82
- </el-table-column>
83
- <el-table-column
84
- v-else
85
- prop={item.prop}
86
- label={item.label}
87
- width={item.width}
88
- align={item.align}
89
- fixed={item.fixed}
90
- sortable={item.sortable}
91
- sort-method={item.sortMethod}
92
- show-overflow-tooltip
93
- >
94
- <template slot-scope="scope">
95
- <slot
96
- v-if={item.slot}
97
- name="slot"
98
- scope={scope}
99
- option={item}
100
- />
101
- <div v-else>{scope.row[item.prop]}</div>
102
- </template>
103
- </el-table-column>
104
- </template>
105
- */
106
- console.log(this.options)
107
- }
108
- };
109
- </script>
110
-
111
- <style></style>
@@ -1,8 +0,0 @@
1
- import Table from "./index.vue";
2
-
3
- /* istanbul ignore next */
4
- Table.install = function(Vue) {
5
- Vue.component(Table.name, Table);
6
- };
7
-
8
- export default Table;
@@ -1,251 +0,0 @@
1
- <template>
2
- <div class="th-table">
3
- <el-table
4
- ref="th_table"
5
- v-loading="loading"
6
- :data="data"
7
- :row-key="rowKey"
8
- stripe
9
- :highlight-current-row="selectType === 'single'"
10
- :tree-props="treeProps"
11
- @current-change="handleSingleSelect"
12
- @row-dblclick="dblclick"
13
- @selection-change="handleSelectionChange"
14
- >
15
- <template v-for="(item, index) in options">
16
- <template v-if="!item.hide">
17
- <el-table-column
18
- v-if="item.type"
19
- :key="index"
20
- :type="item.type"
21
- :label="item.label"
22
- width="50"
23
- >
24
- </el-table-column>
25
- <el-table-column
26
- v-else-if="item.children"
27
- :key="index"
28
- :prop="item.prop"
29
- :label="item.label"
30
- :width="item.width"
31
- :align="item.align || 'left'"
32
- :fixed="item.fixed || null"
33
- :sortable="item.sortable"
34
- :sort-method="item.sortMethod"
35
- show-overflow-tooltip
36
- >
37
- <table-column :options="item.children"></table-column>
38
- </el-table-column>
39
- <el-table-column
40
- v-else
41
- :key="index"
42
- :prop="item.prop"
43
- :label="item.label"
44
- :width="item.width"
45
- :align="item.align || 'left'"
46
- :fixed="item.fixed || null"
47
- :sortable="item.sortable"
48
- :sort-method="item.sortMethod"
49
- show-overflow-tooltip
50
- >
51
- <template slot-scope="scope">
52
- <slot
53
- v-if="item.slot"
54
- :name="item.slot"
55
- :scope="scope"
56
- :option="item"
57
- />
58
- <div v-else>{{ scope.row[item.prop] }}</div>
59
- </template>
60
- </el-table-column>
61
- </template>
62
- </template>
63
- <!-- <table-column :options="options">
64
- <template #slot="{ scope,option }">
65
- <slot :name="option.slot" :scope="scope" :option="option" />
66
- </template>
67
- </table-column> -->
68
- <template #empty>
69
- <div>
70
- {{ loading ? loadingText || "加载中" : emptyText || "暂无数据" }}
71
- </div>
72
- </template>
73
- </el-table>
74
- <!-- <i class="th-table-more el-icon-setting"></i> -->
75
-
76
- <div v-if="Object.keys(pageInfo).length > 0 && showPage" class="pagination">
77
- <el-pagination
78
- :current-page="pageInfo.currentPage"
79
- :page-sizes="pageInfo.sizes"
80
- :page-size="pageInfo.pageSize"
81
- layout="total, prev, pager, next, sizes"
82
- :total="pageInfo.total"
83
- @size-change="handleSizeChange"
84
- @current-change="handleCurrentChange"
85
- @prev-click="handlePrevClick"
86
- @next-click="handleNextClick"
87
- />
88
- </div>
89
- </div>
90
- </template>
91
-
92
- <script>
93
- import TableColumn from "./column.vue";
94
-
95
- export default {
96
- name:'ThTable',
97
- components: {
98
- TableColumn,
99
- },
100
- props: {
101
- data: {
102
- type: Array,
103
- default: () => {
104
- return [];
105
- },
106
- },
107
- options: {
108
- type: Array,
109
- default: () => {
110
- return [];
111
- },
112
- },
113
- // single:单行选中 multiple:多行选中
114
- selectType: {
115
- type: String,
116
- default: () => {
117
- return "";
118
- },
119
- },
120
- // 行双击事件
121
- dblclick: {
122
- type: Function,
123
- default: () => {
124
- return null;
125
- },
126
- },
127
- treeProps: {
128
- type: Object,
129
- default: function() {
130
- return {};
131
- },
132
- },
133
- // 对象,不传表示没有分页,包含三个参数,均必填pageSize:每页展示的条数。currentPage:当前页码。pageCount:总页数
134
- pageInfo: {
135
- type: Object,
136
- default: function() {
137
- return {};
138
- },
139
- },
140
- loading: {
141
- type: Boolean,
142
- default: () => {
143
- return false;
144
- },
145
- },
146
- height: {
147
- type: String,
148
- default: () => {
149
- return "";
150
- },
151
- },
152
- rowKey: {
153
- type: String,
154
- default: () => {
155
- return "";
156
- },
157
- },
158
- showPage: {
159
- type: Boolean,
160
- default: () => {
161
- return true;
162
- },
163
- },
164
- emptyText: {
165
- type: String,
166
- default: () => {
167
- return "暂无数据";
168
- },
169
- },
170
- loadingText: {
171
- type: String,
172
- default: () => {
173
- return "加载中";
174
- },
175
- },
176
- },
177
- data() {
178
- return {};
179
- },
180
- methods: {
181
- handleSelectionChange(currentRow) {
182
- if (currentRow) {
183
- this.$emit("selection-change", currentRow);
184
- }
185
- },
186
- // 选中行--单选
187
- handleSingleSelect(currentRow, oldCurrentRow) {
188
- if (currentRow) {
189
- this.$emit("select-row-change", currentRow);
190
- }
191
- },
192
- // 每页展示的条数 改变时
193
- handleSizeChange(val) {
194
- this.pageInfo.pageSize = val;
195
- this.$emit(
196
- "pageNumberChange",
197
- this.pageInfo.currentPage,
198
- this.pageInfo.pageSize
199
- );
200
- },
201
- // 当前页码 改变时
202
- handleCurrentChange(val) {
203
- this.pageInfo.currentPage = val;
204
- this.$emit(
205
- "pageNumberChange",
206
- this.pageInfo.currentPage,
207
- this.pageInfo.pageSize
208
- );
209
- },
210
- // 点击上一页
211
- handlePrevClick() {
212
- if (this.pageInfo.currentPage === 1) return;
213
- this.pageInfo.currentPage -= 1;
214
- this.$emit(
215
- "pageNumberChange",
216
- this.pageInfo.currentPage,
217
- this.pageInfo.pageSize
218
- );
219
- },
220
- // 点击下一页
221
- handleNextClick() {
222
- if (this.pageInfo.currentPage === this.pageInfo.pageCount) return;
223
- this.pageInfo.currentPage += 1;
224
- this.$emit(
225
- "pageNumberChange",
226
- this.pageInfo.currentPage,
227
- this.pageInfo.pageSize
228
- );
229
- },
230
- getTable() {
231
- return this.$refs["th_table"];
232
- },
233
- },
234
- };
235
- </script>
236
-
237
- <style lang="less" scoped>
238
- .th-table {
239
- position: relative;
240
- width: 100%;
241
- .pagination {
242
- margin-top: 20px;
243
- }
244
- &-more {
245
- position: absolute;
246
- top: 13px;
247
- right: 5px;
248
- cursor: pointer;
249
- }
250
- }
251
- </style>
@@ -1,105 +0,0 @@
1
- <template>
2
- <div class="table-search">
3
- <template v-for="(item, index) in options">
4
- <el-input
5
- v-if="item.type === 'input'"
6
- class="table-search-item"
7
- v-model="params[item.value]"
8
- :key="index"
9
- :style="{ width: item.width + 'px' }"
10
- :placeholder="item.placeholder || '请输入'"
11
- :size="item.size || 'mini'"
12
- clearable
13
- ></el-input>
14
- <el-date-picker
15
- v-if="item.type === 'date'"
16
- class="table-search-item"
17
- v-model="params[item.value]"
18
- :key="index"
19
- :style="{ width: item.width + 'px' }"
20
- :type="item.dateType || 'date'"
21
- :format="item.format"
22
- :value-format="item.valueFormat"
23
- :size="item.size || 'mini'"
24
- range-separator="至"
25
- start-placeholder="开始日期"
26
- end-placeholder="结束日期"
27
- >
28
- </el-date-picker>
29
- </template>
30
-
31
- <el-button
32
- type="primary"
33
- icon="el-icon-search"
34
- size="mini"
35
- plain
36
- @click="doSearch"
37
- >查询</el-button
38
- >
39
- <el-button
40
- type="primary"
41
- icon="el-icon-refresh-right"
42
- size="mini"
43
- plain
44
- @click="doReset"
45
- >重置</el-button
46
- >
47
- </div>
48
- </template>
49
-
50
- <script>
51
- export default {
52
- props: {
53
- options: {
54
- type: Array,
55
- default: () => {
56
- return [];
57
- },
58
- },
59
- params: {
60
- type: Object,
61
- default: () => {
62
- return {};
63
- },
64
- },
65
- },
66
- data() {
67
- return {
68
- datePickerTypes: [
69
- "year",
70
- "month",
71
- "date",
72
- "dates",
73
- "week",
74
- "datetime",
75
- "datetimerange",
76
- "daterange",
77
- "monthrange",
78
- ],
79
- };
80
- },
81
- methods: {
82
- doSearch() {
83
- this.$emit("on-search", this.params);
84
- },
85
- doReset() {
86
- this.params = {};
87
- this.$emit("on-reset", this.params);
88
- },
89
- },
90
- };
91
- </script>
92
-
93
- <style lang="less" scoped>
94
- .table-search {
95
- display: flex;
96
- align-items: center;
97
- margin-bottom: 10px;
98
- &-item {
99
- margin-right: 10px;
100
- }
101
- }
102
- .table-search-item:last-child {
103
- margin-right: 20px !important;
104
- }
105
- </style>
@@ -1,98 +0,0 @@
1
- <template>
2
- <div class="tableTools">
3
- <template v-for="(item, index) in options">
4
- <el-button
5
- v-if="item.act_type === 'add'"
6
- :key="index"
7
- :style="{ color: item.btn_color }"
8
- :type="item.btn_type"
9
- :icon="item.btn_icon"
10
- :disabled="item.btn_disabled"
11
- @click="doAdd(item)"
12
- >{{ item.btn_name }}</el-button
13
- >
14
- <el-button
15
- v-if="item.act_type === 'refresh'"
16
- :key="index"
17
- :style="{ color: item.btn_color }"
18
- :type="item.btn_type"
19
- :icon="item.btn_icon"
20
- :disabled="item.btn_disabled"
21
- @click="doRefresh(item)"
22
- >{{ item.btn_name }}</el-button
23
- >
24
- <el-button
25
- v-if="item.act_type === 'export'"
26
- :key="index"
27
- :style="{ color: item.btn_color }"
28
- :type="item.btn_type"
29
- :icon="item.btn_icon"
30
- :disabled="item.btn_disabled"
31
- @click="doExport(item)"
32
- >{{ item.btn_name }}</el-button
33
- >
34
- <el-button
35
- v-if="item.act_type === 'batch'"
36
- :key="index"
37
- :style="{ color: item.btn_color }"
38
- :type="item.btn_type"
39
- :icon="item.btn_icon"
40
- :disabled="item.btn_disabled || selectionDisabled"
41
- :loading="loadingDel"
42
- @click="doBatch(item)"
43
- >{{ item.btn_name }}</el-button
44
- >
45
- </template>
46
- </div>
47
- </template>
48
-
49
- <script>
50
- export default {
51
- props: {
52
- options: {
53
- type: Array,
54
- default: () => {
55
- return [];
56
- },
57
- },
58
- selectionDisabled: {
59
- type: Boolean,
60
- default: () => {
61
- return true;
62
- },
63
- },
64
- },
65
- data() {
66
- return {
67
- loadingDel: false,
68
- };
69
- },
70
- methods: {
71
- doEval(item) {
72
- this.$emit("on-eval", item);
73
- },
74
- doAdd(item) {
75
- this.$emit("on-add", item);
76
- },
77
- doRefresh(item) {
78
- this.$emit("on-refresh", item);
79
- },
80
- doExport(item) {
81
- this.$emit("on-export", item);
82
- },
83
- doBatch(item) {
84
- this.loadingDel = true;
85
- const callback = (bool) => {
86
- this.loadingDel = false;
87
- };
88
- this.$emit("on-batch", item, callback);
89
- },
90
- },
91
- };
92
- </script>
93
-
94
- <style lang="less">
95
- .tableTools {
96
- margin-bottom: 10px;
97
- }
98
- </style>
package/webpack.config.js DELETED
@@ -1,97 +0,0 @@
1
- var path = require("path");
2
- var webpack = require("webpack");
3
-
4
- module.exports = {
5
- // entry: './src/main.js',
6
- entry: "./src/index.js",
7
- output: {
8
- path: path.resolve(__dirname, "./dist"),
9
- publicPath: "/dist/",
10
- filename: "tianheng-ui.js",
11
- library: "tianheng-ui",
12
- libraryTarget: "umd",
13
- umdNamedDefine: true
14
- },
15
- module: {
16
- rules: [
17
- {
18
- test: /\.css$/,
19
- use: ["vue-style-loader", "css-loader"]
20
- },
21
- {
22
- test: /\.scss$/,
23
- use: ["vue-style-loader", "css-loader", "sass-loader"]
24
- },
25
- {
26
- test: /\.sass$/,
27
- use: ["vue-style-loader", "css-loader", "sass-loader?indentedSyntax"]
28
- },
29
- {
30
- test: /\.vue$/,
31
- loader: "vue-loader",
32
- options: {
33
- loaders: {
34
- // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
35
- // the "scss" and "sass" values for the lang attribute to the right configs here.
36
- // other preprocessors should work out of the box, no loader config like this necessary.
37
- scss: ["vue-style-loader", "css-loader", "sass-loader"],
38
- sass: [
39
- "vue-style-loader",
40
- "css-loader",
41
- "sass-loader?indentedSyntax"
42
- ]
43
- }
44
- // other vue-loader options go here
45
- }
46
- },
47
- {
48
- test: /\.js$/,
49
- loader: "babel-loader",
50
- exclude: /node_modules/
51
- },
52
- {
53
- test: /\.(png|jpg|gif|svg|woff|ttf)$/,
54
- loader: "file-loader",
55
- options: {
56
- name: "[name].[ext]?[hash]"
57
- }
58
- },
59
- ]
60
- },
61
- resolve: {
62
- alias: {
63
- vue$: "vue/dist/vue.esm.js"
64
- },
65
- extensions: ["*", ".js", ".vue", ".json"]
66
- },
67
- devServer: {
68
- historyApiFallback: true,
69
- noInfo: true,
70
- overlay: true
71
- },
72
- performance: {
73
- hints: false
74
- },
75
- devtool: "#eval-source-map"
76
- };
77
-
78
- if (process.env.NODE_ENV === "production") {
79
- module.exports.devtool = "#source-map";
80
- // http://vue-loader.vuejs.org/en/workflow/production.html
81
- module.exports.plugins = (module.exports.plugins || []).concat([
82
- new webpack.DefinePlugin({
83
- "process.env": {
84
- NODE_ENV: '"production"'
85
- }
86
- }),
87
- new webpack.optimize.UglifyJsPlugin({
88
- sourceMap: true,
89
- compress: {
90
- warnings: false
91
- }
92
- }),
93
- new webpack.LoaderOptionsPlugin({
94
- minimize: true
95
- })
96
- ]);
97
- }