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,29 @@
|
|
|
1
|
+
interface Colors {
|
|
2
|
+
[key:string]: string
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
|
|
7
|
+
// 预置主题色
|
|
8
|
+
colors: <Colors>{
|
|
9
|
+
none: "transparent",
|
|
10
|
+
main: "#051c24",
|
|
11
|
+
sub: "#b4967a",
|
|
12
|
+
light: "#fff",
|
|
13
|
+
lgray: "#eee",
|
|
14
|
+
mgray: "#a7a7a7",
|
|
15
|
+
dgray: "#373737",
|
|
16
|
+
dark: "#111",
|
|
17
|
+
blue: "#4085f3",
|
|
18
|
+
green: "#02b9a1",
|
|
19
|
+
yellow: "#fdba00",
|
|
20
|
+
red: "#ec4334",
|
|
21
|
+
neutral: "rgba(134,134,134,.17)",
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// 追加或覆盖主题色
|
|
25
|
+
append(colors: any){
|
|
26
|
+
this.colors = { ...this.colors, ...colors }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view styles="max-w">
|
|
3
|
+
<!--标题-->
|
|
4
|
+
<title-tag-wid v-bind="tagData"
|
|
5
|
+
:icon-data="iconData"
|
|
6
|
+
:arrow-fixed="arrowFixed"
|
|
7
|
+
:checkbox="checkbox"
|
|
8
|
+
v-model="tag_spread"
|
|
9
|
+
@on_move="$emit('on_title_move', $event)"
|
|
10
|
+
@on_enter="$emit('on_title_enter', $event)"
|
|
11
|
+
@on_leave="$emit('on_title_leave', $event)" />
|
|
12
|
+
|
|
13
|
+
<!--内容-->
|
|
14
|
+
<b-view styles="rel no-scroll trans-fast t-f2px alpha-0" ref="cont"
|
|
15
|
+
@on_transitionend="$_set_state"
|
|
16
|
+
:dynamic="`h-${cont_height} ${cont_show}`"
|
|
17
|
+
:states="{
|
|
18
|
+
spread: {
|
|
19
|
+
style: 'alpha-1',
|
|
20
|
+
state: tag_spread
|
|
21
|
+
}
|
|
22
|
+
}">
|
|
23
|
+
<slot />
|
|
24
|
+
</b-view>
|
|
25
|
+
</b-view>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
30
|
+
import TitleTagWid from "./title-tag-wid"
|
|
31
|
+
|
|
32
|
+
const desc = ["该组件用于实现内容的展开与收起。"],
|
|
33
|
+
extend = [],
|
|
34
|
+
dependent = ["title-tag-wid", "b-view"],
|
|
35
|
+
api = {
|
|
36
|
+
methods: [
|
|
37
|
+
{
|
|
38
|
+
name: "comp_height",
|
|
39
|
+
ef: "设置内容高度",
|
|
40
|
+
params: "-",
|
|
41
|
+
return: "-"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
event: [
|
|
45
|
+
{
|
|
46
|
+
name: "on_toggle",
|
|
47
|
+
ef: "折叠、展开切换",
|
|
48
|
+
params: "spread"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "on_title_move",
|
|
52
|
+
ef: "标题区域鼠标移动",
|
|
53
|
+
params: "event"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "on_title_enter",
|
|
57
|
+
ef: "标题区域鼠标移入或手指按下(悬停)",
|
|
58
|
+
params: "event"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "on_title_leave",
|
|
62
|
+
ef: "标题区域鼠标移出或手指抬起",
|
|
63
|
+
params: "event"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
init_data = `{
|
|
68
|
+
tagData: "(参照:tag-wid 组件入参)",
|
|
69
|
+
/* spread: "展开状态,默认关闭" */,
|
|
70
|
+
/* iconData: "(参照:b-icon 组件入参)" */,
|
|
71
|
+
/* arrowFixed: "下拉图标位置固定右侧,默认 true" */,
|
|
72
|
+
/* checkbox: "启用复选框,默认 false" */,
|
|
73
|
+
}`;
|
|
74
|
+
|
|
75
|
+
export default {
|
|
76
|
+
name: "drawer-wid",
|
|
77
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
78
|
+
components: {
|
|
79
|
+
BView,
|
|
80
|
+
TitleTagWid
|
|
81
|
+
},
|
|
82
|
+
props: {
|
|
83
|
+
tagData: {
|
|
84
|
+
type: Object,
|
|
85
|
+
required: true,
|
|
86
|
+
},
|
|
87
|
+
iconData: {
|
|
88
|
+
type: Object,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
spread: {
|
|
92
|
+
type: Boolean,
|
|
93
|
+
required: false
|
|
94
|
+
},
|
|
95
|
+
arrowFixed: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
required: false,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
checkbox: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
data(){
|
|
106
|
+
return {
|
|
107
|
+
|
|
108
|
+
//抽屉展开状态
|
|
109
|
+
tag_spread: this.spread,
|
|
110
|
+
|
|
111
|
+
//内容区高度
|
|
112
|
+
cont_height: "",
|
|
113
|
+
|
|
114
|
+
//内容显示状态
|
|
115
|
+
cont_show: ""
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
computed: {
|
|
120
|
+
|
|
121
|
+
//内容区域
|
|
122
|
+
cont(){
|
|
123
|
+
return this.$refs.cont;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
},
|
|
127
|
+
watch: {
|
|
128
|
+
|
|
129
|
+
//监听抽屉展开状态
|
|
130
|
+
tag_spread(val){
|
|
131
|
+
if(val) this.cont_show = "show";
|
|
132
|
+
this.$nextTick(()=>{
|
|
133
|
+
this.cont_height = val? `${this.cont.$el.scrollHeight + 1}px`: 0;
|
|
134
|
+
this.$emit("on_toggle", val);
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
},
|
|
139
|
+
methods: {
|
|
140
|
+
|
|
141
|
+
//设置内容高度
|
|
142
|
+
comp_height(){
|
|
143
|
+
if(this.tag_spread){
|
|
144
|
+
this.cont_height = "auto";
|
|
145
|
+
this.cont_show = "show";
|
|
146
|
+
setTimeout(()=>{
|
|
147
|
+
this.cont_height = `${this.cont.$el.scrollHeight + 1}px`;
|
|
148
|
+
}, 500)
|
|
149
|
+
}else{
|
|
150
|
+
this.cont_height = 0;
|
|
151
|
+
this.cont_show = "hide";
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
//设置显示状态
|
|
156
|
+
$_set_state(e){
|
|
157
|
+
if(e.propertyName === "height" && this.cont_height === 0) this.cont_show = "hide";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
},
|
|
161
|
+
mounted(){
|
|
162
|
+
this.comp_height();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
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="`flex-4 pad-v-.7 pad-h-1.4 round-sm color-${tag_colors.normal.text} bg-color-${tag_colors.normal.bg}`"
|
|
7
|
+
:states="{
|
|
8
|
+
act: {
|
|
9
|
+
style: `bg-color-${tag_colors.act.bg} color-${tag_colors.act.text}`,
|
|
10
|
+
state: selected
|
|
11
|
+
}
|
|
12
|
+
}"
|
|
13
|
+
:hover="`bg-color-${tag_colors.hover.bg} color-${tag_colors.hover.text}`" >
|
|
14
|
+
|
|
15
|
+
<!--复选框-->
|
|
16
|
+
<b-view v-if="checkbox" styles="mrg-r-1">
|
|
17
|
+
<checkbox-wid :id="id" v-model="item_selected" />
|
|
18
|
+
</b-view>
|
|
19
|
+
|
|
20
|
+
<!--标题文字-->
|
|
21
|
+
<b-view styles="flex-4 grow-1">
|
|
22
|
+
<b-icon v-if="iconData" v-bind="iconData" styles="mrg-r-1 scale-1.5" />
|
|
23
|
+
<b-text v-html="tag_text"></b-text>
|
|
24
|
+
<b-icon v-if="!arrowFixed"
|
|
25
|
+
icon="arrow-right"
|
|
26
|
+
styles="mrg-l-1.5 trans-fast alpha-.6"
|
|
27
|
+
:states="{
|
|
28
|
+
act: {
|
|
29
|
+
style: 'rotate-90',
|
|
30
|
+
state: selected
|
|
31
|
+
}
|
|
32
|
+
}" />
|
|
33
|
+
</b-view>
|
|
34
|
+
|
|
35
|
+
<!--下拉箭头-->
|
|
36
|
+
<b-icon v-if="arrowFixed"
|
|
37
|
+
icon="arrow-right"
|
|
38
|
+
styles="trans-fast alpha-.6"
|
|
39
|
+
:states="{
|
|
40
|
+
act: {
|
|
41
|
+
style: 'rotate-90',
|
|
42
|
+
state: selected
|
|
43
|
+
}
|
|
44
|
+
}" />
|
|
45
|
+
</b-hot>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import BHot from "@/components/BTXUI/core/b-hot"
|
|
50
|
+
import BText from "@/components/BTXUI/core/b-text"
|
|
51
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
52
|
+
import BIcon from "@/components/BTXUI/core/b-icon"
|
|
53
|
+
import TagWid from "@/components/BTXUI/tag/tag-wid"
|
|
54
|
+
import CheckboxWid from "@/components/BTXUI/checkbox/checkbox-wid"
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
extends: TagWid,
|
|
58
|
+
name: "title-tag-wid",
|
|
59
|
+
components: {
|
|
60
|
+
BHot,
|
|
61
|
+
BText,
|
|
62
|
+
BIcon,
|
|
63
|
+
BView,
|
|
64
|
+
CheckboxWid
|
|
65
|
+
},
|
|
66
|
+
props: {
|
|
67
|
+
iconData: {
|
|
68
|
+
type: Object,
|
|
69
|
+
required: false
|
|
70
|
+
},
|
|
71
|
+
mode: {
|
|
72
|
+
type: String,
|
|
73
|
+
required: false,
|
|
74
|
+
default: "checkbox"
|
|
75
|
+
},
|
|
76
|
+
arrowFixed: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
required: false,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
checkbox: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: false
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
data(){
|
|
87
|
+
return {
|
|
88
|
+
|
|
89
|
+
//色彩方案
|
|
90
|
+
tag_colors: {
|
|
91
|
+
normal: {
|
|
92
|
+
text: "dgray",
|
|
93
|
+
bg: "none",
|
|
94
|
+
...this.colors.normal
|
|
95
|
+
},
|
|
96
|
+
hover: {
|
|
97
|
+
text: "blue",
|
|
98
|
+
bg: "none",
|
|
99
|
+
...this.colors.hover
|
|
100
|
+
},
|
|
101
|
+
act: {
|
|
102
|
+
text: "dark",
|
|
103
|
+
bg: "none",
|
|
104
|
+
...this.colors.act
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
//选中状态
|
|
109
|
+
item_selected: false
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
</script>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view styles="rel color-rgba(70,70,70,.2) z2">
|
|
3
|
+
<!--热点区-->
|
|
4
|
+
<b-hot styles="flex-4" @on_click="$_toggle_options">
|
|
5
|
+
<b-text v-if="selected_text" :styles="`grow-1 color-${option_color.text}`" key="val">
|
|
6
|
+
{{selected_text}}
|
|
7
|
+
</b-text>
|
|
8
|
+
<b-text v-else :styles="`alpha-.7 grow-1 color-${option_color.text}`" key="notic">
|
|
9
|
+
{{placeholder}}
|
|
10
|
+
</b-text>
|
|
11
|
+
<b-icon icon="arrow-right"
|
|
12
|
+
styles="trans-fast color-#777"
|
|
13
|
+
:states="{
|
|
14
|
+
spread: {
|
|
15
|
+
state: spread,
|
|
16
|
+
style: 'rotate-90'
|
|
17
|
+
}
|
|
18
|
+
}" />
|
|
19
|
+
</b-hot>
|
|
20
|
+
|
|
21
|
+
<!--下拉区-->
|
|
22
|
+
<b-view :styles="`abs transform-translateY(f1.5rem) alpha-0 round-sm mrg-t-1 shadow-lg max-w no-scroll bg-color-${option_color.normal.bg}`"
|
|
23
|
+
:states="{
|
|
24
|
+
spread: {
|
|
25
|
+
state: spread,
|
|
26
|
+
style: 'trans-fast alpha-1 transform-translateY(0)'
|
|
27
|
+
}
|
|
28
|
+
}">
|
|
29
|
+
<b-list :styles="`color-${option_color.normal.text} h-${rows? Math.min(rows, listData.length) * 2.7: 'auto'}`">
|
|
30
|
+
<b-hot v-for="(item,index) of listData" :key="index"
|
|
31
|
+
@on_click="$_select(item.val)"
|
|
32
|
+
styles="flex pad-h-1"
|
|
33
|
+
:states="{
|
|
34
|
+
selected: {
|
|
35
|
+
state: selected === item.val,
|
|
36
|
+
style: `color-${option_color.act.text} bg-color-${option_color.act.bg}`
|
|
37
|
+
}
|
|
38
|
+
}"
|
|
39
|
+
:hover="`color-${option_color.hover.text} bg-color-${option_color.hover.bg}`">
|
|
40
|
+
<b-view :styles="`flex-4 grow-1 h-2.7 ${index>0? 'line-t thick-1 line-neutral': ''}`">
|
|
41
|
+
<b-text styles="bold mrg-r-1">·</b-text>
|
|
42
|
+
<b-text>{{item.text}}</b-text>
|
|
43
|
+
</b-view>
|
|
44
|
+
</b-hot>
|
|
45
|
+
</b-list>
|
|
46
|
+
</b-view>
|
|
47
|
+
</b-view>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script>
|
|
51
|
+
import SelectWid from "@/components/BTXUI/select/select-wid";
|
|
52
|
+
|
|
53
|
+
export default {
|
|
54
|
+
extends: SelectWid,
|
|
55
|
+
name: "form-select-wid"
|
|
56
|
+
};
|
|
57
|
+
</script>
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view>
|
|
3
|
+
<!--表单项-->
|
|
4
|
+
<b-view v-for="(item, index) of formData" :key="index"
|
|
5
|
+
styles="flex-4 mrg-b-1"
|
|
6
|
+
:states="{
|
|
7
|
+
column: {
|
|
8
|
+
style: 'flex flex-column mrg-b-1.4',
|
|
9
|
+
state: layout.title_wrap
|
|
10
|
+
}
|
|
11
|
+
}">
|
|
12
|
+
|
|
13
|
+
<!--标题区-->
|
|
14
|
+
<b-view styles="flex-4"
|
|
15
|
+
:states="{
|
|
16
|
+
fixed_title_width: {
|
|
17
|
+
style: `w-${layout.title_width}`,
|
|
18
|
+
state: layout.title_width
|
|
19
|
+
},
|
|
20
|
+
column: {
|
|
21
|
+
style: 'mrg-b-.7',
|
|
22
|
+
state: layout.title_wrap
|
|
23
|
+
}
|
|
24
|
+
}">
|
|
25
|
+
<b-icon v-if="item.icon" :icon="item.icon"
|
|
26
|
+
styles="mrg-r-1 fsize-1.4"/>
|
|
27
|
+
<b-text v-if="item.text"
|
|
28
|
+
styles="mrg-r-1"
|
|
29
|
+
v-html="item.text" />
|
|
30
|
+
</b-view>
|
|
31
|
+
|
|
32
|
+
<!--输入型表单元素-->
|
|
33
|
+
<b-view v-if="item.input_data"
|
|
34
|
+
:styles="`no-scroll round-sm ${layout.title_wrap? '': 'grow-1'}`">
|
|
35
|
+
<component :is="item.input_data.type === 'textarea'? 'b-textarea': 'b-input'"
|
|
36
|
+
:styles="`fsize-1.1 pad-v-.5 pad-h-1 round-sm thick-1 ${baseLine? 'round-t line-b': 'line'}`"
|
|
37
|
+
:dynamic="item.input_data.readonly? 'bg-color-none line-none': item_colors.normal"
|
|
38
|
+
ref="input"
|
|
39
|
+
v-bind="{...item.input_data, focus: item_colors.focus}"
|
|
40
|
+
v-model="selected[item.input_data.name]"
|
|
41
|
+
@on_check="$_record_inp_check" />
|
|
42
|
+
</b-view>
|
|
43
|
+
|
|
44
|
+
<!--图片上传表单元素-->
|
|
45
|
+
<imgs-upload-wid v-if="item.imgs"
|
|
46
|
+
v-bind="item.imgs.imgs_upload_data"
|
|
47
|
+
v-model="selected[item.imgs.name]"
|
|
48
|
+
ref="imgs_upload"
|
|
49
|
+
@on_change="files => { $_append_file(files, item.imgs.name) }"/>
|
|
50
|
+
|
|
51
|
+
<!--下拉框表单元素-->
|
|
52
|
+
<b-view v-if="item.select"
|
|
53
|
+
:styles="`grow-1 pad-v-.5 pad-h-1 round-sm thick-1 ${item_colors.normal} ${baseLine? 'round-t line-b': 'line'}`">
|
|
54
|
+
<form-select-wid v-bind="item.select.select_data" v-model="selected[item.select.name]" />
|
|
55
|
+
</b-view>
|
|
56
|
+
|
|
57
|
+
</b-view>
|
|
58
|
+
|
|
59
|
+
<b-view v-if="submit" :styles="`mrg-t-2.4 flex-${btn_align}`">
|
|
60
|
+
<!--提交按钮-->
|
|
61
|
+
<b-view styles="mrg-r-1">
|
|
62
|
+
<btn-wid @on_click="$_submit" v-bind="submit.btn_data" />
|
|
63
|
+
</b-view>
|
|
64
|
+
|
|
65
|
+
<!--重置按钮-->
|
|
66
|
+
<b-view>
|
|
67
|
+
<btn-wid v-if="submit.reset" @on_click="reset" v-bind="reset_btn" />
|
|
68
|
+
</b-view>
|
|
69
|
+
</b-view>
|
|
70
|
+
</b-view>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
import BView from "@/components/BTXUI/core/b-view";
|
|
75
|
+
import BText from "@/components/BTXUI/core/b-text";
|
|
76
|
+
import BHot from "@/components/BTXUI/core/b-hot";
|
|
77
|
+
import BIcon from "@/components/BTXUI/core/b-icon";
|
|
78
|
+
import BInput from "@/components/BTXUI/core/b-input";
|
|
79
|
+
import BTextarea from "@/components/BTXUI/core/b-textarea";
|
|
80
|
+
import BtnWid from "@/components/BTXUI/btn/btn-wid";
|
|
81
|
+
import ImgsUploadWid from "@/components/BTXUI/imgsUpload/imgs-upload-wid";
|
|
82
|
+
import FormSelectWid from "./form-select-wid";
|
|
83
|
+
|
|
84
|
+
const desc = ["该组件用于表单构建及操作。"],
|
|
85
|
+
extend = [],
|
|
86
|
+
dependent = ["imgs-upload-wid", "form-select-wid", "btn-wid", "b-textarea", "b-input", "b-icon", "b-hot", "b-text", "b-view"],
|
|
87
|
+
api = {
|
|
88
|
+
methods: [
|
|
89
|
+
{
|
|
90
|
+
name: "reset",
|
|
91
|
+
ef: "重置表单",
|
|
92
|
+
params: "-",
|
|
93
|
+
return: "-"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "set_only_read",
|
|
97
|
+
ef: "设置表单项只读",
|
|
98
|
+
params: "name",
|
|
99
|
+
return: "-"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "set_write",
|
|
103
|
+
ef: "设置表单项可写",
|
|
104
|
+
params: "name",
|
|
105
|
+
return: "-"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
init_data = `{
|
|
110
|
+
selected: "(model){
|
|
111
|
+
'name(所选表单元素键名)': 'value(所选表单元素键值)',...
|
|
112
|
+
}",
|
|
113
|
+
formData: [
|
|
114
|
+
{
|
|
115
|
+
text: "表单元素字段,可缺省",
|
|
116
|
+
icon: "表单元素图标,可缺省",
|
|
117
|
+
select: {
|
|
118
|
+
name: "下拉数据键名",
|
|
119
|
+
select_data: "(参照:select-wid 组件入参)"
|
|
120
|
+
},
|
|
121
|
+
imgs: {
|
|
122
|
+
name: "图片数据键名",
|
|
123
|
+
imgs_upload_data: "(参照:imgs-upload-wid 组件入参。推荐使用后续上传)"
|
|
124
|
+
}
|
|
125
|
+
input_data: "(参照:b-input 组件入参)"
|
|
126
|
+
},...
|
|
127
|
+
],
|
|
128
|
+
/* layout: {
|
|
129
|
+
title_width: "表单元素标题宽度,默认单位 rem",
|
|
130
|
+
title_wrap: "表单元素标题是否折行",
|
|
131
|
+
} */,
|
|
132
|
+
/* submit: {
|
|
133
|
+
align: "对齐方式:默认 left、center、right",
|
|
134
|
+
callback(selected, check_result, form_data){
|
|
135
|
+
"提交回调函数..."
|
|
136
|
+
},
|
|
137
|
+
reset: "启用重置按钮,可缺省",
|
|
138
|
+
btn_data: "(参照:btn-wid 组件入参)"
|
|
139
|
+
} */,
|
|
140
|
+
/* colors: {
|
|
141
|
+
normal: {
|
|
142
|
+
text: "常规状态文字颜色",
|
|
143
|
+
bg: "常规状态背景颜色",
|
|
144
|
+
line: "常规状态描边颜色",
|
|
145
|
+
},
|
|
146
|
+
focus: {
|
|
147
|
+
text: "激活状态文字颜色",
|
|
148
|
+
bg: "激活状态背景颜色"
|
|
149
|
+
line: "激活状态描边颜色",
|
|
150
|
+
}
|
|
151
|
+
} */,
|
|
152
|
+
/* baseLine: "基线模式,默认 false" */,
|
|
153
|
+
}`;
|
|
154
|
+
|
|
155
|
+
export default {
|
|
156
|
+
name: "form-wid",
|
|
157
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
158
|
+
components: {
|
|
159
|
+
BView,
|
|
160
|
+
BText,
|
|
161
|
+
BHot,
|
|
162
|
+
BIcon,
|
|
163
|
+
BTextarea,
|
|
164
|
+
BInput,
|
|
165
|
+
BtnWid,
|
|
166
|
+
FormSelectWid,
|
|
167
|
+
ImgsUploadWid
|
|
168
|
+
},
|
|
169
|
+
model: {
|
|
170
|
+
prop: "selected",
|
|
171
|
+
event: "on_reset"
|
|
172
|
+
},
|
|
173
|
+
props: {
|
|
174
|
+
formData: {
|
|
175
|
+
type: Array,
|
|
176
|
+
required: true
|
|
177
|
+
},
|
|
178
|
+
selected: {
|
|
179
|
+
type: Object,
|
|
180
|
+
required: true
|
|
181
|
+
},
|
|
182
|
+
layout: {
|
|
183
|
+
type: Object,
|
|
184
|
+
required: false,
|
|
185
|
+
default: ()=>{
|
|
186
|
+
return {title_width: "", title_wrap: false}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
submit: {
|
|
190
|
+
type: Object,
|
|
191
|
+
required: false
|
|
192
|
+
},
|
|
193
|
+
colors: {
|
|
194
|
+
type: Object,
|
|
195
|
+
required: false,
|
|
196
|
+
default: () => {
|
|
197
|
+
return {
|
|
198
|
+
normal: {},
|
|
199
|
+
focus: {}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
baseLine: {
|
|
204
|
+
type: Boolean,
|
|
205
|
+
required: false
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
data(){
|
|
209
|
+
return {
|
|
210
|
+
|
|
211
|
+
//初始选择
|
|
212
|
+
ori_selected: {...this.selected},
|
|
213
|
+
|
|
214
|
+
//表单验证结果
|
|
215
|
+
check_result: {},
|
|
216
|
+
|
|
217
|
+
//重置按钮
|
|
218
|
+
reset_btn: this.submit? { ...this.submit.btn_data, btnText: "重置" }: null,
|
|
219
|
+
|
|
220
|
+
//按钮水平对齐
|
|
221
|
+
btn_align: this.submit? (()=>{
|
|
222
|
+
switch(this.submit.align){
|
|
223
|
+
case "right": return 3;
|
|
224
|
+
break;
|
|
225
|
+
case "center": return 2;
|
|
226
|
+
break;
|
|
227
|
+
default: return 1;
|
|
228
|
+
}
|
|
229
|
+
})(): null,
|
|
230
|
+
|
|
231
|
+
//formData
|
|
232
|
+
form_data: new FormData(),
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
computed: {
|
|
237
|
+
|
|
238
|
+
// 输入型表单项集合
|
|
239
|
+
inputs(){
|
|
240
|
+
return this.$refs.input;
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
// 表单项颜色风格
|
|
244
|
+
item_colors(){
|
|
245
|
+
var {text, bg, line} = {
|
|
246
|
+
text: "dgray",
|
|
247
|
+
bg: "neutral",
|
|
248
|
+
line: "none",
|
|
249
|
+
...this.colors.normal
|
|
250
|
+
},
|
|
251
|
+
normal = `color-${text} bg-color-${bg} line-${line}`,
|
|
252
|
+
{text, bg, line} = {
|
|
253
|
+
text: "dgray",
|
|
254
|
+
bg: "rgba(134,134,134,.24);",
|
|
255
|
+
line: "none",
|
|
256
|
+
...this.colors.focus
|
|
257
|
+
},
|
|
258
|
+
focus = `color-${text} bg-color-${bg} line-${line}`;
|
|
259
|
+
return { normal, focus }
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
},
|
|
263
|
+
methods: {
|
|
264
|
+
|
|
265
|
+
// 重置表单
|
|
266
|
+
reset(){
|
|
267
|
+
const imgs_upload = this.$refs.imgs_upload;
|
|
268
|
+
this.$emit("on_reset", {...this.ori_selected});
|
|
269
|
+
imgs_upload && imgs_upload.forEach(wid=>{
|
|
270
|
+
wid.clear_preview();
|
|
271
|
+
})
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
// 设置表单项只读
|
|
275
|
+
set_only_read(name){
|
|
276
|
+
this.$_set_readonly(name, true);
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
// 设置表单项可写
|
|
280
|
+
set_write(name){
|
|
281
|
+
this.$_set_readonly(name, false);
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// 设置 readonly 属性
|
|
285
|
+
$_set_readonly(name, state){
|
|
286
|
+
this.$set(this.formData.find(item => {
|
|
287
|
+
const {input_data} = item;
|
|
288
|
+
return input_data && input_data.name === name;
|
|
289
|
+
}).input_data, "readonly", state);
|
|
290
|
+
},
|
|
291
|
+
|
|
292
|
+
// 记录表单项验证结果
|
|
293
|
+
$_record_inp_check(result){
|
|
294
|
+
if(!result) return;
|
|
295
|
+
let res = this.check_result;
|
|
296
|
+
if(!result.pass){ // 验证有误,记录
|
|
297
|
+
res[result.name] = result.notic;
|
|
298
|
+
}else { // 验证无误,移除记录
|
|
299
|
+
delete res[result.name];
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
// 提交表单
|
|
304
|
+
$_submit(){
|
|
305
|
+
this.inputs && this.inputs.forEach((inp)=>{ // 输入型表单验证
|
|
306
|
+
this.$_record_inp_check(inp.check());
|
|
307
|
+
})
|
|
308
|
+
for(let pro in this.selected){
|
|
309
|
+
this.form_data.append(pro, this.selected[pro]);
|
|
310
|
+
}
|
|
311
|
+
this.submit && this.submit.callback(this.selected, this.check_result, this.form_data);
|
|
312
|
+
this.form_data = new FormData();
|
|
313
|
+
},
|
|
314
|
+
|
|
315
|
+
// 添加上传文件数据
|
|
316
|
+
$_append_file(files, key){
|
|
317
|
+
for(let i=0; i<files.length; i++){
|
|
318
|
+
this.form_data.append(`${key}_${i}`, files[i]);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
</script>
|