btxui 1.0.1 → 1.0.3

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.
Files changed (197) hide show
  1. package/demo.html +1 -0
  2. package/index.common.js +93 -0
  3. package/index.common.js.map +1 -0
  4. package/index.umd.js +104 -0
  5. package/index.umd.js.map +1 -0
  6. package/index.umd.min.js +2 -0
  7. package/index.umd.min.js.map +1 -0
  8. package/package.json +12 -23
  9. package/README.md +0 -42
  10. package/app.vue +0 -162
  11. package/assets/css/_main.js +0 -73
  12. package/assets/css/btx.min.css +0 -1
  13. package/assets/css/btx.mob.min.css +0 -1
  14. package/assets/css/btx.pad.min.css +0 -1
  15. package/assets/css/btx.webapp.min.css +0 -1
  16. package/assets/css/custom_fonts/iconfont.css +0 -37
  17. package/assets/css/custom_fonts/iconfont.eot +0 -0
  18. package/assets/css/custom_fonts/iconfont.svg +0 -47
  19. package/assets/css/custom_fonts/iconfont.ttf +0 -0
  20. package/assets/css/custom_fonts/iconfont.woff +0 -0
  21. package/assets/css/custom_fonts/iconfont.woff2 +0 -0
  22. package/assets/css/res-l.css +0 -47
  23. package/assets/css/res-m.css +0 -47
  24. package/assets/css/res-s.css +0 -61
  25. package/assets/custom_fonts/iconfont.css +0 -37
  26. package/assets/custom_fonts/iconfont.eot +0 -0
  27. package/assets/custom_fonts/iconfont.svg +0 -47
  28. package/assets/custom_fonts/iconfont.ttf +0 -0
  29. package/assets/custom_fonts/iconfont.woff +0 -0
  30. package/assets/custom_fonts/iconfont.woff2 +0 -0
  31. package/assets/js/Btx.js +0 -196
  32. package/assets/js/Utils.js +0 -421
  33. package/assets/js/fastclick.js +0 -802
  34. package/assets/js/lazy.min.js +0 -2
  35. package/assets/js/touchwipe.js +0 -111
  36. package/assets/server.js +0 -8
  37. package/assets/start_site_code_str.js +0 -119
  38. package/cdn/css/btx.min.css +0 -1
  39. package/cdn/css/btx.min.css.map +0 -1
  40. package/cdn/fonts/iconfont.ttf +0 -0
  41. package/cdn/fonts/iconfont.woff +0 -0
  42. package/cdn/fonts/iconfont.woff2 +0 -0
  43. package/components/BTXUI/app/app-wid.vue +0 -182
  44. package/components/BTXUI/btn/btn-wid.vue +0 -128
  45. package/components/BTXUI/carousel/carousel-wid.vue +0 -138
  46. package/components/BTXUI/checkbox/checkbox-wid.vue +0 -72
  47. package/components/BTXUI/confirm/confirm-wid.vue +0 -279
  48. package/components/BTXUI/content/content-checkbox-wid.vue +0 -44
  49. package/components/BTXUI/content/content-node-wid.vue +0 -114
  50. package/components/BTXUI/content/content-tag-wid.vue +0 -25
  51. package/components/BTXUI/content/content-wid.vue +0 -254
  52. package/components/BTXUI/core/anis/ani-fail.vue +0 -46
  53. package/components/BTXUI/core/anis/ani-loading.vue +0 -32
  54. package/components/BTXUI/core/anis/ani-notic.vue +0 -47
  55. package/components/BTXUI/core/anis/ani-success.vue +0 -48
  56. package/components/BTXUI/core/b-drag.vue +0 -258
  57. package/components/BTXUI/core/b-grid.vue +0 -84
  58. package/components/BTXUI/core/b-hot.vue +0 -171
  59. package/components/BTXUI/core/b-icon.vue +0 -76
  60. package/components/BTXUI/core/b-img.vue +0 -84
  61. package/components/BTXUI/core/b-input.vue +0 -198
  62. package/components/BTXUI/core/b-list.vue +0 -276
  63. package/components/BTXUI/core/b-text/doc.ts +0 -9
  64. package/components/BTXUI/core/b-text/index.vue +0 -16
  65. package/components/BTXUI/core/b-textarea.vue +0 -58
  66. package/components/BTXUI/core/b-video.vue +0 -35
  67. package/components/BTXUI/core/b-view/doc.ts +0 -10
  68. package/components/BTXUI/core/b-view/index.vue +0 -20
  69. package/components/BTXUI/core/b-webview.vue +0 -20
  70. package/components/BTXUI/core/lib/ChapterLink.js +0 -49
  71. package/components/BTXUI/core/lib/Search.vue +0 -60
  72. package/components/BTXUI/core/styles/doc.ts +0 -55
  73. package/components/BTXUI/core/styles/index.vue +0 -98
  74. package/components/BTXUI/core/styles/prestyles.ts +0 -471
  75. package/components/BTXUI/core/styles/theme.ts +0 -29
  76. package/components/BTXUI/drawer/drawer-wid.vue +0 -165
  77. package/components/BTXUI/drawer/title-tag-wid.vue +0 -114
  78. package/components/BTXUI/form/form-select-wid.vue +0 -57
  79. package/components/BTXUI/form/form-wid.vue +0 -324
  80. package/components/BTXUI/formPannel/form-pannel-wid.vue +0 -133
  81. package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +0 -149
  82. package/components/BTXUI/index.js +0 -83
  83. package/components/BTXUI/pageFlip/page-flip-wid.vue +0 -206
  84. package/components/BTXUI/pannel/pannel-wid.vue +0 -167
  85. package/components/BTXUI/range/range-wid.vue +0 -134
  86. package/components/BTXUI/search/search-wid.vue +0 -80
  87. package/components/BTXUI/select/select-wid.vue +0 -186
  88. package/components/BTXUI/slider/slider-wid.vue +0 -444
  89. package/components/BTXUI/tab/tab-wid.vue +0 -109
  90. package/components/BTXUI/table/table-wid.vue +0 -324
  91. package/components/BTXUI/tag/tag-wid.vue +0 -183
  92. package/components/BTXUI/tags/tags-wid.vue +0 -121
  93. package/components/BTXUI/tooltip/tooltip-wid.vue +0 -146
  94. package/components/BTXUI/upload/upload-wid.vue +0 -215
  95. package/components/BTXUI/waterfall/waterfall-wid.vue +0 -166
  96. package/components/header-info.vue +0 -167
  97. package/composables/@types.ts +0 -4
  98. package/composables/api.ts +0 -18
  99. package/env.d.ts +0 -5
  100. package/main.js +0 -6
  101. package/nuxt.config.ts +0 -51
  102. package/pages/article.vue +0 -16
  103. package/pages/download.vue +0 -50
  104. package/pages/example/app_wid/app/data_demo.vue +0 -9
  105. package/pages/example/app_wid/app/download_demo.vue +0 -9
  106. package/pages/example/app_wid/app/list_demo.vue +0 -11
  107. package/pages/example/app_wid/app/system_demo.vue +0 -9
  108. package/pages/example/app_wid/app_wid_demo.vue +0 -198
  109. package/pages/example/app_wid/btn_wid_demo.vue +0 -179
  110. package/pages/example/app_wid/carousel_wid_demo.vue +0 -152
  111. package/pages/example/app_wid/checkbox_wid_demo.vue +0 -65
  112. package/pages/example/app_wid/confirm_wid_demo.vue +0 -197
  113. package/pages/example/app_wid/content_wid_demo.vue +0 -369
  114. package/pages/example/app_wid/drawer_wid_demo.vue +0 -155
  115. package/pages/example/app_wid/form_pannel_wid_demo.vue +0 -338
  116. package/pages/example/app_wid/form_wid_demo.vue +0 -550
  117. package/pages/example/app_wid/imgs_upload_wid_demo.vue +0 -159
  118. package/pages/example/app_wid/index.js +0 -158
  119. package/pages/example/app_wid/page_flip_wid_demo.vue +0 -99
  120. package/pages/example/app_wid/pannel_wid_demo.vue +0 -177
  121. package/pages/example/app_wid/range_wid_demo.vue +0 -101
  122. package/pages/example/app_wid/search_wid_demo.vue +0 -75
  123. package/pages/example/app_wid/select_wid_demo.vue +0 -217
  124. package/pages/example/app_wid/slider_wid_demo.vue +0 -143
  125. package/pages/example/app_wid/tab_wid_demo.vue +0 -170
  126. package/pages/example/app_wid/table_wid_demo.vue +0 -377
  127. package/pages/example/app_wid/tag_wid_demo.vue +0 -133
  128. package/pages/example/app_wid/tags_wid_demo.vue +0 -143
  129. package/pages/example/app_wid/tooltip_wid_demo.vue +0 -117
  130. package/pages/example/app_wid/upload_wid_demo.vue +0 -123
  131. package/pages/example/base_wid/b_drag_demo.vue +0 -159
  132. package/pages/example/base_wid/b_grid_demo.vue +0 -225
  133. package/pages/example/base_wid/b_hot_demo.vue +0 -135
  134. package/pages/example/base_wid/b_icon_demo.vue +0 -80
  135. package/pages/example/base_wid/b_img_demo.vue +0 -95
  136. package/pages/example/base_wid/b_input_demo.vue +0 -171
  137. package/pages/example/base_wid/b_list_demo.vue +0 -241
  138. package/pages/example/base_wid/b_style_demo.vue +0 -928
  139. package/pages/example/base_wid/b_text_demo.vue +0 -36
  140. package/pages/example/base_wid/b_textarea_demo.vue +0 -64
  141. package/pages/example/base_wid/b_video_demo.vue +0 -42
  142. package/pages/example/base_wid/b_view_demo.vue +0 -36
  143. package/pages/example/base_wid/index.js +0 -76
  144. package/pages/example/content.js +0 -49
  145. package/pages/example/global_style/animation.vue +0 -197
  146. package/pages/example/global_style/color.vue +0 -134
  147. package/pages/example/global_style/decoration.vue +0 -546
  148. package/pages/example/global_style/icon.vue +0 -345
  149. package/pages/example/global_style/index.js +0 -52
  150. package/pages/example/global_style/layout.vue +0 -846
  151. package/pages/example/global_style/special.vue +0 -37
  152. package/pages/example/global_style/table.vue +0 -298
  153. package/pages/example/global_style/text.vue +0 -159
  154. package/pages/index.vue +0 -29
  155. package/pages/level_widget.vue +0 -11
  156. package/pages/start.vue +0 -200
  157. package/plugins/index.ts +0 -2
  158. package/public/favicon.gif +0 -0
  159. package/public/fonts/iconfont.ttf +0 -0
  160. package/public/fonts/iconfont.woff +0 -0
  161. package/public/fonts/iconfont.woff2 +0 -0
  162. package/public/img/banner.jpg +0 -0
  163. package/public/img/banner2.jpg +0 -0
  164. package/public/img/bg_pattern.png +0 -0
  165. package/public/img/btx.jpg +0 -0
  166. package/public/img/btx_ui.jpg +0 -0
  167. package/public/img/dir.png +0 -0
  168. package/public/img/f.png +0 -0
  169. package/public/img/head.jpg +0 -0
  170. package/public/img/head2.jpg +0 -0
  171. package/public/img/home_ico.png +0 -0
  172. package/public/img/icons.svg +0 -164
  173. package/public/img/mechanism/b-style.png +0 -0
  174. package/public/img/mechanism/slider-wid.png +0 -0
  175. package/public/img/mechanism/upload-wid.png +0 -0
  176. package/public/img/transform_origin.png +0 -0
  177. package/sass/animation.scss +0 -400
  178. package/sass/btx.mob.scss +0 -10
  179. package/sass/btx.pad.scss +0 -3
  180. package/sass/btx.scss +0 -22
  181. package/sass/btx.webapp.scss +0 -22
  182. package/sass/colors.scss +0 -65
  183. package/sass/decoration.scss +0 -220
  184. package/sass/flex.scss +0 -29
  185. package/sass/icons.scss +0 -100
  186. package/sass/layout.scss +0 -88
  187. package/sass/reset.scss +0 -111
  188. package/sass/response/flex_mixin.scss +0 -91
  189. package/sass/response/layout_mixin.scss +0 -227
  190. package/sass/response/main.scss +0 -59
  191. package/sass/response/text_mixin.scss +0 -65
  192. package/sass/scroll.scss +0 -100
  193. package/sass/special.scss +0 -13
  194. package/sass/table.scss +0 -103
  195. package/sass/text.scss +0 -86
  196. package/sass/webpack.config.js +0 -31
  197. package/tsconfig.json +0 -4
@@ -1,29 +0,0 @@
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
- }
@@ -1,165 +0,0 @@
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>
@@ -1,114 +0,0 @@
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>
@@ -1,57 +0,0 @@
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>
@@ -1,324 +0,0 @@
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>