btxui 1.0.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 +42 -0
- package/app.vue +162 -0
- package/assets/css/_main.js +73 -0
- package/assets/css/btx.min.css +1 -0
- package/assets/css/btx.mob.min.css +1 -0
- package/assets/css/btx.pad.min.css +1 -0
- package/assets/css/btx.webapp.min.css +1 -0
- package/assets/css/custom_fonts/iconfont.css +37 -0
- package/assets/css/custom_fonts/iconfont.eot +0 -0
- package/assets/css/custom_fonts/iconfont.svg +47 -0
- package/assets/css/custom_fonts/iconfont.ttf +0 -0
- package/assets/css/custom_fonts/iconfont.woff +0 -0
- package/assets/css/custom_fonts/iconfont.woff2 +0 -0
- package/assets/css/res-l.css +47 -0
- package/assets/css/res-m.css +47 -0
- package/assets/css/res-s.css +61 -0
- package/assets/custom_fonts/iconfont.css +37 -0
- package/assets/custom_fonts/iconfont.eot +0 -0
- package/assets/custom_fonts/iconfont.svg +47 -0
- package/assets/custom_fonts/iconfont.ttf +0 -0
- package/assets/custom_fonts/iconfont.woff +0 -0
- package/assets/custom_fonts/iconfont.woff2 +0 -0
- package/assets/js/Btx.js +196 -0
- package/assets/js/Utils.js +421 -0
- package/assets/js/fastclick.js +802 -0
- package/assets/js/lazy.min.js +2 -0
- package/assets/js/touchwipe.js +111 -0
- package/assets/server.js +8 -0
- package/assets/start_site_code_str.js +119 -0
- package/cdn/css/btx.min.css +1 -0
- package/cdn/css/btx.min.css.map +1 -0
- package/cdn/fonts/iconfont.ttf +0 -0
- package/cdn/fonts/iconfont.woff +0 -0
- package/cdn/fonts/iconfont.woff2 +0 -0
- package/components/BTXUI/app/app-wid.vue +182 -0
- package/components/BTXUI/btn/btn-wid.vue +128 -0
- package/components/BTXUI/carousel/carousel-wid.vue +138 -0
- package/components/BTXUI/checkbox/checkbox-wid.vue +72 -0
- package/components/BTXUI/confirm/confirm-wid.vue +279 -0
- package/components/BTXUI/content/content-checkbox-wid.vue +44 -0
- package/components/BTXUI/content/content-node-wid.vue +114 -0
- package/components/BTXUI/content/content-tag-wid.vue +25 -0
- package/components/BTXUI/content/content-wid.vue +254 -0
- package/components/BTXUI/core/anis/ani-fail.vue +46 -0
- package/components/BTXUI/core/anis/ani-loading.vue +32 -0
- package/components/BTXUI/core/anis/ani-notic.vue +47 -0
- package/components/BTXUI/core/anis/ani-success.vue +48 -0
- package/components/BTXUI/core/b-drag.vue +258 -0
- package/components/BTXUI/core/b-grid.vue +84 -0
- package/components/BTXUI/core/b-hot.vue +171 -0
- package/components/BTXUI/core/b-icon.vue +76 -0
- package/components/BTXUI/core/b-img.vue +84 -0
- package/components/BTXUI/core/b-input.vue +198 -0
- package/components/BTXUI/core/b-list.vue +276 -0
- package/components/BTXUI/core/b-text/doc.ts +9 -0
- package/components/BTXUI/core/b-text/index.vue +16 -0
- package/components/BTXUI/core/b-textarea.vue +58 -0
- package/components/BTXUI/core/b-video.vue +35 -0
- package/components/BTXUI/core/b-view/doc.ts +10 -0
- package/components/BTXUI/core/b-view/index.vue +20 -0
- package/components/BTXUI/core/b-webview.vue +20 -0
- package/components/BTXUI/core/lib/ChapterLink.js +49 -0
- package/components/BTXUI/core/lib/Search.vue +60 -0
- package/components/BTXUI/core/styles/doc.ts +55 -0
- package/components/BTXUI/core/styles/index.vue +98 -0
- package/components/BTXUI/core/styles/prestyles.ts +471 -0
- package/components/BTXUI/core/styles/theme.ts +29 -0
- package/components/BTXUI/drawer/drawer-wid.vue +165 -0
- package/components/BTXUI/drawer/title-tag-wid.vue +114 -0
- package/components/BTXUI/form/form-select-wid.vue +57 -0
- package/components/BTXUI/form/form-wid.vue +324 -0
- package/components/BTXUI/formPannel/form-pannel-wid.vue +133 -0
- package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +149 -0
- package/components/BTXUI/index.js +83 -0
- package/components/BTXUI/pageFlip/page-flip-wid.vue +206 -0
- package/components/BTXUI/pannel/pannel-wid.vue +167 -0
- package/components/BTXUI/range/range-wid.vue +134 -0
- package/components/BTXUI/search/search-wid.vue +80 -0
- package/components/BTXUI/select/select-wid.vue +186 -0
- package/components/BTXUI/slider/slider-wid.vue +444 -0
- package/components/BTXUI/tab/tab-wid.vue +109 -0
- package/components/BTXUI/table/table-wid.vue +324 -0
- package/components/BTXUI/tag/tag-wid.vue +183 -0
- package/components/BTXUI/tags/tags-wid.vue +121 -0
- package/components/BTXUI/tooltip/tooltip-wid.vue +146 -0
- package/components/BTXUI/upload/upload-wid.vue +215 -0
- package/components/BTXUI/waterfall/waterfall-wid.vue +166 -0
- package/components/header-info.vue +167 -0
- package/composables/@types.ts +4 -0
- package/composables/api.ts +18 -0
- package/env.d.ts +5 -0
- package/main.js +6 -0
- package/nuxt.config.ts +51 -0
- package/package.json +23 -0
- package/pages/article.vue +16 -0
- package/pages/download.vue +50 -0
- package/pages/example/app_wid/app/data_demo.vue +9 -0
- package/pages/example/app_wid/app/download_demo.vue +9 -0
- package/pages/example/app_wid/app/list_demo.vue +11 -0
- package/pages/example/app_wid/app/system_demo.vue +9 -0
- package/pages/example/app_wid/app_wid_demo.vue +198 -0
- package/pages/example/app_wid/btn_wid_demo.vue +179 -0
- package/pages/example/app_wid/carousel_wid_demo.vue +152 -0
- package/pages/example/app_wid/checkbox_wid_demo.vue +65 -0
- package/pages/example/app_wid/confirm_wid_demo.vue +197 -0
- package/pages/example/app_wid/content_wid_demo.vue +369 -0
- package/pages/example/app_wid/drawer_wid_demo.vue +155 -0
- package/pages/example/app_wid/form_pannel_wid_demo.vue +338 -0
- package/pages/example/app_wid/form_wid_demo.vue +550 -0
- package/pages/example/app_wid/imgs_upload_wid_demo.vue +159 -0
- package/pages/example/app_wid/index.js +158 -0
- package/pages/example/app_wid/page_flip_wid_demo.vue +99 -0
- package/pages/example/app_wid/pannel_wid_demo.vue +177 -0
- package/pages/example/app_wid/range_wid_demo.vue +101 -0
- package/pages/example/app_wid/search_wid_demo.vue +75 -0
- package/pages/example/app_wid/select_wid_demo.vue +217 -0
- package/pages/example/app_wid/slider_wid_demo.vue +143 -0
- package/pages/example/app_wid/tab_wid_demo.vue +170 -0
- package/pages/example/app_wid/table_wid_demo.vue +377 -0
- package/pages/example/app_wid/tag_wid_demo.vue +133 -0
- package/pages/example/app_wid/tags_wid_demo.vue +143 -0
- package/pages/example/app_wid/tooltip_wid_demo.vue +117 -0
- package/pages/example/app_wid/upload_wid_demo.vue +123 -0
- package/pages/example/base_wid/b_drag_demo.vue +159 -0
- package/pages/example/base_wid/b_grid_demo.vue +225 -0
- package/pages/example/base_wid/b_hot_demo.vue +135 -0
- package/pages/example/base_wid/b_icon_demo.vue +80 -0
- package/pages/example/base_wid/b_img_demo.vue +95 -0
- package/pages/example/base_wid/b_input_demo.vue +171 -0
- package/pages/example/base_wid/b_list_demo.vue +241 -0
- package/pages/example/base_wid/b_style_demo.vue +928 -0
- package/pages/example/base_wid/b_text_demo.vue +36 -0
- package/pages/example/base_wid/b_textarea_demo.vue +64 -0
- package/pages/example/base_wid/b_video_demo.vue +42 -0
- package/pages/example/base_wid/b_view_demo.vue +36 -0
- package/pages/example/base_wid/index.js +76 -0
- package/pages/example/content.js +49 -0
- package/pages/example/global_style/animation.vue +197 -0
- package/pages/example/global_style/color.vue +134 -0
- package/pages/example/global_style/decoration.vue +546 -0
- package/pages/example/global_style/icon.vue +345 -0
- package/pages/example/global_style/index.js +52 -0
- package/pages/example/global_style/layout.vue +846 -0
- package/pages/example/global_style/special.vue +37 -0
- package/pages/example/global_style/table.vue +298 -0
- package/pages/example/global_style/text.vue +159 -0
- package/pages/index.vue +29 -0
- package/pages/level_widget.vue +11 -0
- package/pages/start.vue +200 -0
- package/plugins/index.ts +2 -0
- package/public/favicon.gif +0 -0
- package/public/fonts/iconfont.ttf +0 -0
- package/public/fonts/iconfont.woff +0 -0
- package/public/fonts/iconfont.woff2 +0 -0
- package/public/img/banner.jpg +0 -0
- package/public/img/banner2.jpg +0 -0
- package/public/img/bg_pattern.png +0 -0
- package/public/img/btx.jpg +0 -0
- package/public/img/btx_ui.jpg +0 -0
- package/public/img/dir.png +0 -0
- package/public/img/f.png +0 -0
- package/public/img/head.jpg +0 -0
- package/public/img/head2.jpg +0 -0
- package/public/img/home_ico.png +0 -0
- package/public/img/icons.svg +164 -0
- package/public/img/mechanism/b-style.png +0 -0
- package/public/img/mechanism/slider-wid.png +0 -0
- package/public/img/mechanism/upload-wid.png +0 -0
- package/public/img/transform_origin.png +0 -0
- package/sass/animation.scss +400 -0
- package/sass/btx.mob.scss +10 -0
- package/sass/btx.pad.scss +3 -0
- package/sass/btx.scss +22 -0
- package/sass/btx.webapp.scss +22 -0
- package/sass/colors.scss +65 -0
- package/sass/decoration.scss +220 -0
- package/sass/flex.scss +29 -0
- package/sass/icons.scss +100 -0
- package/sass/layout.scss +88 -0
- package/sass/reset.scss +111 -0
- package/sass/response/flex_mixin.scss +91 -0
- package/sass/response/layout_mixin.scss +227 -0
- package/sass/response/main.scss +59 -0
- package/sass/response/text_mixin.scss +65 -0
- package/sass/scroll.scss +100 -0
- package/sass/special.scss +13 -0
- package/sass/table.scss +103 -0
- package/sass/text.scss +86 -0
- package/sass/webpack.config.js +31 -0
- package/tsconfig.json +4 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view :styles="`line thick-1 pleft round-sm no-scroll line-${colors.outline}`">
|
|
3
|
+
<!--表头-->
|
|
4
|
+
<b-view :styles="`flex-4 bold bg-color-${colors.thead}`">
|
|
5
|
+
|
|
6
|
+
<!--复选表头单元格-->
|
|
7
|
+
<b-view :styles="`flex-4 alpha-0 trans-fast w-0 thick-1 line-r line-${colors.line}`"
|
|
8
|
+
:states="{
|
|
9
|
+
show: {
|
|
10
|
+
style: 'alpha-1 w-10 pad-l-1',
|
|
11
|
+
state: checkbox_td_state
|
|
12
|
+
}
|
|
13
|
+
}">
|
|
14
|
+
<checkbox-wid id="selectAll" text="All" v-model="select_all_state" />
|
|
15
|
+
</b-view>
|
|
16
|
+
|
|
17
|
+
<b-view v-for="(th, n) of thead" :key="n"
|
|
18
|
+
:styles="`pad-.7 thick-1 ${n>0? 'line-l': ''} line-${colors.line} ${$_set_td_width(thead[n])}`"
|
|
19
|
+
v-html="th.title">
|
|
20
|
+
</b-view>
|
|
21
|
+
</b-view>
|
|
22
|
+
|
|
23
|
+
<!--表身-->
|
|
24
|
+
<component v-for="(tr, i) of tbody.slice(0, show_rows)"
|
|
25
|
+
:key="i"
|
|
26
|
+
:is="hover_tr_color? 'b-hot': 'b-view'"
|
|
27
|
+
:styles="`flex line-t thick-1 line-${colors.line} bg-color-${i%2? colors.row.even: colors.row.odd}`"
|
|
28
|
+
:hover="hover_tr_color? 'bg-color-' + hover_tr_color: ''"
|
|
29
|
+
@on_click="$_click(i)">
|
|
30
|
+
|
|
31
|
+
<!--复选表身单元格-->
|
|
32
|
+
<b-view :styles="`flex-4 alpha-0 trans-fast w-0 thick-1 line-r line-${colors.line}`"
|
|
33
|
+
:states="{
|
|
34
|
+
show: {
|
|
35
|
+
style: 'alpha-1 w-10 pad-l-1.4',
|
|
36
|
+
state: checkbox_td_state
|
|
37
|
+
}
|
|
38
|
+
}">
|
|
39
|
+
<checkbox-wid :id="i" v-model="tbody_data[i]" />
|
|
40
|
+
</b-view>
|
|
41
|
+
|
|
42
|
+
<b-view v-for="(data, k) of tr"
|
|
43
|
+
:key="k"
|
|
44
|
+
:styles="`flex-4 pad-h-.7 pad-v-.4 thick-1 ${k>0? 'line-l': ''} line-${colors.line} ${k==0? 'bg-color-' + colors.row.head: ''} ${$_set_td_width(thead[k])}`" >
|
|
45
|
+
|
|
46
|
+
<!--单元格标签按钮-->
|
|
47
|
+
<tag-wid v-if="data.tag_data" :id="i" v-bind="data.tag_data" v-model="data.selected" @on_click="data.callback" />
|
|
48
|
+
|
|
49
|
+
<!--单元格图片-->
|
|
50
|
+
<b-img v-else-if="data.src"
|
|
51
|
+
:key="`${i}-${k}-${Math.random() * 1000}`"
|
|
52
|
+
:img="data.src"
|
|
53
|
+
:defaultSrc="data.default_src"
|
|
54
|
+
:styles="`round-sm w-${data.width || 'auto'} h-${data.height || 'auto'}`" />
|
|
55
|
+
|
|
56
|
+
<!--单元格文本-->
|
|
57
|
+
<b-text v-else v-html="data"></b-text>
|
|
58
|
+
|
|
59
|
+
</b-view>
|
|
60
|
+
</component>
|
|
61
|
+
|
|
62
|
+
<!--折叠按钮-->
|
|
63
|
+
<b-view v-if="collapse" styles="flex-2 pad-v-2">
|
|
64
|
+
<tag-wid v-bind="toggle_tag.data" v-model="toggle_tag.selected" />
|
|
65
|
+
</b-view>
|
|
66
|
+
</b-view>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
71
|
+
import BImg from "@/components/BTXUI/core/b-img"
|
|
72
|
+
import BText from "@/components/BTXUI/core/b-text"
|
|
73
|
+
import BHot from "@/components/BTXUI/core/b-hot"
|
|
74
|
+
import TagWid from "@/components/BTXUI/tag/tag-wid"
|
|
75
|
+
import CheckboxWid from "@/components/BTXUI/checkbox/checkbox-wid"
|
|
76
|
+
|
|
77
|
+
const desc = ["该组件用于显示表格数据。"],
|
|
78
|
+
extend = [],
|
|
79
|
+
dependent = ["checkbox-wid", "tag-wid", "b-img", "b-hot", "b-text", "b-view"],
|
|
80
|
+
api = {
|
|
81
|
+
event: [
|
|
82
|
+
{
|
|
83
|
+
name: "on_click",
|
|
84
|
+
ef: "单元行点击触发",
|
|
85
|
+
params: "row_index"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "on_select",
|
|
89
|
+
ef: "单元格复选框勾选触发",
|
|
90
|
+
params: "selected_rows"
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
methods: [
|
|
94
|
+
{
|
|
95
|
+
name: "enable_row_select",
|
|
96
|
+
ef: "开启单元行选择模式",
|
|
97
|
+
params: "-",
|
|
98
|
+
return: "-"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: "disable_row_select",
|
|
102
|
+
ef: "关闭单元行选择模式",
|
|
103
|
+
params: "-",
|
|
104
|
+
return: "-"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "enable_row_click",
|
|
108
|
+
ef: "开启单元行点击模式",
|
|
109
|
+
params: "-",
|
|
110
|
+
return: "-"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "disable_row_click",
|
|
114
|
+
ef: "关闭单元行点击模式",
|
|
115
|
+
params: "-",
|
|
116
|
+
return: "-"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
init_data = `{
|
|
121
|
+
thead: "[
|
|
122
|
+
{
|
|
123
|
+
title: "标题文本"
|
|
124
|
+
grow: "自生长比率,默认为 1",
|
|
125
|
+
width: "单元格宽度,可缺省,效果优先级大于 grow"
|
|
126
|
+
},...
|
|
127
|
+
]",
|
|
128
|
+
tbody: "[
|
|
129
|
+
[ "对应表头标题数据" | {
|
|
130
|
+
src: "图片地址",
|
|
131
|
+
default_src: "缺省图片地址",
|
|
132
|
+
width: "图片宽度,可缺省",
|
|
133
|
+
height: "图片高度,可缺省"
|
|
134
|
+
} | {
|
|
135
|
+
tag_data: "(参照:tag-wid 组件入参,id 字段无效,自动设置为行索引)",
|
|
136
|
+
selected: "默认选中状态"
|
|
137
|
+
callback: "点击回调函数"
|
|
138
|
+
},... ],...
|
|
139
|
+
]",
|
|
140
|
+
/* colors: {
|
|
141
|
+
thead: "标题背景色",
|
|
142
|
+
row: {
|
|
143
|
+
head: "行首色",
|
|
144
|
+
odd: "奇数行色",
|
|
145
|
+
even: "偶数行色",
|
|
146
|
+
hover: "行悬停色,默认无效果"
|
|
147
|
+
},
|
|
148
|
+
line: "表格描边色",
|
|
149
|
+
outline: "表格轮廓色"
|
|
150
|
+
} */,
|
|
151
|
+
/* collapse: {
|
|
152
|
+
rows: "折叠显示单元行数目",
|
|
153
|
+
tag_data: "(参照:tag-wid 组件入参,id 字段无效,自动设置为随机数)"
|
|
154
|
+
} */,
|
|
155
|
+
}`;
|
|
156
|
+
|
|
157
|
+
export default {
|
|
158
|
+
name: "table-wid",
|
|
159
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
160
|
+
components: {
|
|
161
|
+
BView,
|
|
162
|
+
BImg,
|
|
163
|
+
BHot,
|
|
164
|
+
BText,
|
|
165
|
+
TagWid,
|
|
166
|
+
CheckboxWid
|
|
167
|
+
},
|
|
168
|
+
props: {
|
|
169
|
+
thead: {
|
|
170
|
+
type: Array,
|
|
171
|
+
required: true
|
|
172
|
+
},
|
|
173
|
+
tbody: {
|
|
174
|
+
type: Array,
|
|
175
|
+
required: true
|
|
176
|
+
},
|
|
177
|
+
colors: {
|
|
178
|
+
type: Object,
|
|
179
|
+
required: false,
|
|
180
|
+
default: ()=>{
|
|
181
|
+
return {
|
|
182
|
+
thead: "none",
|
|
183
|
+
row: {
|
|
184
|
+
head: "none",
|
|
185
|
+
odd: "#f7f7f7",
|
|
186
|
+
even: "none",
|
|
187
|
+
hover: ""
|
|
188
|
+
},
|
|
189
|
+
line: "none",
|
|
190
|
+
outline: "none"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
collapse: {
|
|
195
|
+
type: Object,
|
|
196
|
+
required: false
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
data(){
|
|
200
|
+
return {
|
|
201
|
+
|
|
202
|
+
//单元行悬停颜色
|
|
203
|
+
hover_tr_color: this.colors.row.hover,
|
|
204
|
+
|
|
205
|
+
//复选框单元格显示状态
|
|
206
|
+
checkbox_td_state: false,
|
|
207
|
+
|
|
208
|
+
//表身数据
|
|
209
|
+
tbody_data: this.tbody.map(()=>{
|
|
210
|
+
return false;
|
|
211
|
+
}),
|
|
212
|
+
|
|
213
|
+
//全选状态
|
|
214
|
+
select_all_state: false,
|
|
215
|
+
|
|
216
|
+
//折叠按钮
|
|
217
|
+
toggle_tag: {
|
|
218
|
+
data: {
|
|
219
|
+
text: "展开表格",
|
|
220
|
+
actText: "收起表格",
|
|
221
|
+
colors: {
|
|
222
|
+
normal: {
|
|
223
|
+
bg: "rgba(170,170,170,.4)"
|
|
224
|
+
},
|
|
225
|
+
act: {
|
|
226
|
+
bg: "blue"
|
|
227
|
+
},
|
|
228
|
+
hover: {
|
|
229
|
+
bg: "neutral"
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
...(this.collapse? this.collapse.tag_data: {}),
|
|
233
|
+
id: Math.floor(Math.random() * 1000),
|
|
234
|
+
mode: "checkbox",
|
|
235
|
+
},
|
|
236
|
+
selected: false
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
computed: {
|
|
242
|
+
|
|
243
|
+
//表格显示单元行数
|
|
244
|
+
show_rows(){
|
|
245
|
+
if(!this.collapse) return this.tbody.length;
|
|
246
|
+
return this.toggle_tag.selected? this.tbody.length: this.collapse.rows;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
},
|
|
250
|
+
methods: {
|
|
251
|
+
|
|
252
|
+
//开启单元行选择模式
|
|
253
|
+
enable_row_select(){
|
|
254
|
+
this.checkbox_td_state = true;
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
//关闭单元行选择模式
|
|
258
|
+
disable_row_select(){
|
|
259
|
+
this.checkbox_td_state = false;
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
//开启单元行点击模式
|
|
263
|
+
enable_row_click(){
|
|
264
|
+
this.hover_tr_color = this.colors.row.hover;
|
|
265
|
+
},
|
|
266
|
+
|
|
267
|
+
//关闭单元行点击模式
|
|
268
|
+
disable_row_click(){
|
|
269
|
+
this.hover_tr_color = "";
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
//处理单元行标题文本
|
|
273
|
+
$_format_tr_title(text){
|
|
274
|
+
return text.split("").join("<br>");
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
//单元行点击效果
|
|
278
|
+
$_click(index){
|
|
279
|
+
this.$emit("on_click", index);
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
//设置单元格宽度样式
|
|
283
|
+
$_set_td_width(item){
|
|
284
|
+
return item.width? `w-${item.width}`: `grow-${item.grow || 1}`
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
//数据验证
|
|
288
|
+
$_check_data(){
|
|
289
|
+
if(this.tbody[0]) this.thead.length !== this.tbody[0].length && console.warn("thead & tbody have different length!");
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
},
|
|
293
|
+
watch: {
|
|
294
|
+
|
|
295
|
+
//监测表格数据
|
|
296
|
+
tbody(val){
|
|
297
|
+
this.$_check_data();
|
|
298
|
+
this.tbody_data = val.map(()=>{
|
|
299
|
+
return false;
|
|
300
|
+
})
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
//监测单元行选择
|
|
304
|
+
tbody_data(val){
|
|
305
|
+
this.$emit("on_select", val.reduce((total, select, i)=>{
|
|
306
|
+
select && total.push(i);
|
|
307
|
+
return total;
|
|
308
|
+
}, []));
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
//监测全选
|
|
312
|
+
select_all_state(state){
|
|
313
|
+
let select = state? true: false;
|
|
314
|
+
this.tbody_data = this.tbody_data.map(()=>{
|
|
315
|
+
return select;
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
},
|
|
320
|
+
mounted(){
|
|
321
|
+
this.$_check_data();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
</script>
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-hot @on_click="$_click"
|
|
3
|
+
@on_move="$emit('on_move', $event)"
|
|
4
|
+
@on_enter="$emit('on_enter', $event)"
|
|
5
|
+
@on_leave="$emit('on_leave', $event)"
|
|
6
|
+
:styles="`pad-h-1.4 pad-v-.4 round-sm mrg-r-.4 mrg-b-.4 line thick-1 line-${tag_colors.normal.line} color-${tag_colors.normal.text} bg-color-${tag_colors.normal.bg}`"
|
|
7
|
+
:states="{
|
|
8
|
+
act: {
|
|
9
|
+
style: `line thick-1 line-${tag_colors.act.line} bg-color-${tag_colors.act.bg} color-${tag_colors.act.text}`,
|
|
10
|
+
state: selected
|
|
11
|
+
}
|
|
12
|
+
}"
|
|
13
|
+
:hover="`line thick-1 line-${tag_colors.hover.line} bg-color-${tag_colors.hover.bg} color-${tag_colors.hover.text}`">
|
|
14
|
+
<b-text styles="scale-.9"
|
|
15
|
+
:states="{
|
|
16
|
+
act: {
|
|
17
|
+
style: 'scale-1',
|
|
18
|
+
state: selected
|
|
19
|
+
}
|
|
20
|
+
}"
|
|
21
|
+
v-html="tag_text" />
|
|
22
|
+
</b-hot>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import BHot from "@/components/BTXUI/core/b-hot"
|
|
27
|
+
import BText from "@/components/BTXUI/core/b-text"
|
|
28
|
+
|
|
29
|
+
let desc = ["该组件用于进行标签选择,分为 “单选” 和 “复选” 两种方式。“单选(once)” 仅限一次性点击,不可通过点击撤回;“复选(toggle)” 则可以反复进行点击切换。"],
|
|
30
|
+
extend = [],
|
|
31
|
+
dependent = ["b-hot"],
|
|
32
|
+
api = {
|
|
33
|
+
event: [
|
|
34
|
+
{
|
|
35
|
+
name: "on_click",
|
|
36
|
+
ef: "点击触发",
|
|
37
|
+
params: "id, selected, event"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "on_enter",
|
|
41
|
+
ef: "鼠标移入或手指按下(悬停)",
|
|
42
|
+
params: "event"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "on_leave",
|
|
46
|
+
ef: "鼠标移出或手指抬起",
|
|
47
|
+
params: "event"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "on_move",
|
|
51
|
+
ef: "鼠标移动",
|
|
52
|
+
params: "event"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
init_data = `{
|
|
57
|
+
id: "标签 id",
|
|
58
|
+
text: "标签未选中状态文字(支持富文本)",
|
|
59
|
+
selected: "(v-model)选中状态",
|
|
60
|
+
/* actText: "标签选中状态文字(支持富文本)" */,
|
|
61
|
+
/* colors: {
|
|
62
|
+
normal: {
|
|
63
|
+
text: "默认文字色样式色值",
|
|
64
|
+
bg: "默认背景色样式色值",
|
|
65
|
+
line: "默认边框色样式色值",
|
|
66
|
+
},
|
|
67
|
+
act: {
|
|
68
|
+
text: "激活文字色样式色值",
|
|
69
|
+
bg: "激活背景色样式色值",
|
|
70
|
+
line: "激活边框色样式色值",
|
|
71
|
+
},
|
|
72
|
+
hover: {
|
|
73
|
+
text: "悬停文字色样式色值",
|
|
74
|
+
bg: "悬停背景色样式色值",
|
|
75
|
+
line: "悬停边框色样式色值",
|
|
76
|
+
},
|
|
77
|
+
} */,
|
|
78
|
+
/* mode: "选择模式(默认"radio":单选、"checkbox":复选)" */,
|
|
79
|
+
}`;
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
name: "tag-wid",
|
|
83
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
84
|
+
components: {
|
|
85
|
+
BHot,
|
|
86
|
+
BText
|
|
87
|
+
},
|
|
88
|
+
model:{
|
|
89
|
+
prop: "selected",
|
|
90
|
+
event: "on_select"
|
|
91
|
+
},
|
|
92
|
+
props: {
|
|
93
|
+
id: {
|
|
94
|
+
type: [String, Number],
|
|
95
|
+
required: true
|
|
96
|
+
},
|
|
97
|
+
text: {
|
|
98
|
+
type: String,
|
|
99
|
+
required: true
|
|
100
|
+
},
|
|
101
|
+
selected: {
|
|
102
|
+
type: [Boolean, Number],
|
|
103
|
+
required: false
|
|
104
|
+
},
|
|
105
|
+
actText: {
|
|
106
|
+
type: String,
|
|
107
|
+
required: false
|
|
108
|
+
},
|
|
109
|
+
colors: {
|
|
110
|
+
type: Object,
|
|
111
|
+
required: false,
|
|
112
|
+
default: () => {
|
|
113
|
+
return {
|
|
114
|
+
normal:{},
|
|
115
|
+
hover:{},
|
|
116
|
+
act:{},
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
mode: {
|
|
121
|
+
type: String,
|
|
122
|
+
required: false,
|
|
123
|
+
default: "radio"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
data(){
|
|
127
|
+
return {
|
|
128
|
+
|
|
129
|
+
//色彩方案
|
|
130
|
+
tag_colors: {
|
|
131
|
+
normal: {
|
|
132
|
+
text: "dgray",
|
|
133
|
+
bg: "light",
|
|
134
|
+
line: "none",
|
|
135
|
+
...this.colors.normal
|
|
136
|
+
},
|
|
137
|
+
hover: {
|
|
138
|
+
text: "blue",
|
|
139
|
+
bg: "light",
|
|
140
|
+
line: "none",
|
|
141
|
+
...this.colors.hover
|
|
142
|
+
},
|
|
143
|
+
act: {
|
|
144
|
+
text: "light",
|
|
145
|
+
bg: "blue",
|
|
146
|
+
line: "none",
|
|
147
|
+
...this.colors.act
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
//参数类型
|
|
152
|
+
data_type: typeof(this.selected)
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
computed: {
|
|
157
|
+
|
|
158
|
+
//标签文字
|
|
159
|
+
tag_text(){
|
|
160
|
+
return this.selected? (this.actText? this.actText: this.text): this.text;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
},
|
|
164
|
+
methods: {
|
|
165
|
+
|
|
166
|
+
//点击事件
|
|
167
|
+
$_click(e){
|
|
168
|
+
let state;
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
if(this.mode === "checkbox"){ //复选
|
|
171
|
+
state = !this.selected;
|
|
172
|
+
}else if(this.mode === "radio"){ //单选
|
|
173
|
+
if(this.selected === true) return;
|
|
174
|
+
state = true;
|
|
175
|
+
}
|
|
176
|
+
if(this.data_type === "number") state = state? 1: 0;
|
|
177
|
+
this.$emit("on_select", state);
|
|
178
|
+
this.$emit("on_click", this.id, state, e);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
</script>
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view :styles="column? 'flex-column': 'flex'">
|
|
3
|
+
<tag-wid v-for="item of tag_list" :key="item.id"
|
|
4
|
+
@on_click="$_click"
|
|
5
|
+
:id="item.id"
|
|
6
|
+
:text="item.text"
|
|
7
|
+
v-bind="tag_data"
|
|
8
|
+
v-model="item.selected" />
|
|
9
|
+
</b-view>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
14
|
+
import TagWid from "@/components/BTXUI/tag/tag-wid"
|
|
15
|
+
|
|
16
|
+
let desc = ["该组件用于进行单选及复选操作。"],
|
|
17
|
+
extend = [],
|
|
18
|
+
dependent = ["tag-wid", "b-view"],
|
|
19
|
+
api = {
|
|
20
|
+
event: [
|
|
21
|
+
{
|
|
22
|
+
name: "on_click",
|
|
23
|
+
ef: "点击触发",
|
|
24
|
+
params: "selected"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
init_data = `{
|
|
29
|
+
value: "(v-model)当前标签 id 列表",
|
|
30
|
+
tagList: "[
|
|
31
|
+
{
|
|
32
|
+
id: "标签 id",
|
|
33
|
+
text: "标签文字",
|
|
34
|
+
},...
|
|
35
|
+
]",
|
|
36
|
+
/* colors: "(参照:tag-wid 组件 colors 参数)" */,
|
|
37
|
+
/* mode: "(参照:tag-wid 组件 mode 参数)" */,
|
|
38
|
+
/* column: "纵向排列,默认 false" */,
|
|
39
|
+
}`;
|
|
40
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: "tags-wid",
|
|
43
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
44
|
+
components: {
|
|
45
|
+
BView,
|
|
46
|
+
TagWid
|
|
47
|
+
},
|
|
48
|
+
model:{
|
|
49
|
+
prop: "value",
|
|
50
|
+
event: "on_select"
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
value: {
|
|
54
|
+
type: Array,
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
tagList: {
|
|
58
|
+
type: Array,
|
|
59
|
+
required: true
|
|
60
|
+
},
|
|
61
|
+
colors: {
|
|
62
|
+
type: Object,
|
|
63
|
+
required: false,
|
|
64
|
+
default: () => {
|
|
65
|
+
return {
|
|
66
|
+
normal:{},
|
|
67
|
+
hover:{},
|
|
68
|
+
act:{},
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
mode: {
|
|
73
|
+
type: String,
|
|
74
|
+
required: false,
|
|
75
|
+
default: "radio"
|
|
76
|
+
},
|
|
77
|
+
column: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: false
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
data(){
|
|
83
|
+
return {
|
|
84
|
+
|
|
85
|
+
//标签数据
|
|
86
|
+
tag_data: {
|
|
87
|
+
colors: this.colors,
|
|
88
|
+
mode: this.mode
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
|
|
95
|
+
//标签数据列表
|
|
96
|
+
tag_list(){
|
|
97
|
+
return this.tagList.map(item=>{
|
|
98
|
+
return {
|
|
99
|
+
...item,
|
|
100
|
+
selected: this.value.includes(item.id)
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
|
|
108
|
+
//点击事件
|
|
109
|
+
$_click(id){
|
|
110
|
+
if(this.mode === "checkbox"){ //多选
|
|
111
|
+
let index = this.value.indexOf(id);
|
|
112
|
+
index === -1? this.value.push(id): this.value.splice(index, 1);
|
|
113
|
+
}else if(this.mode === "radio"){ //单选
|
|
114
|
+
this.$emit("on_select", [id]);
|
|
115
|
+
}
|
|
116
|
+
this.$emit("on_click", this.value);
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
</script>
|