tianheng-ui 0.1.0 → 0.1.2

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 (254) hide show
  1. package/README.md +9 -18
  2. package/lib/039af9192b9bb277966ceb4e4ce29c41.js +16 -0
  3. package/lib/2d84c80112a372bc149cad3464e90fa3.js +1617 -0
  4. package/lib/5977b934a4c6b480790864ea01303173.js +10834 -0
  5. package/lib/7745f3e776488705a38e62f85adad54d.js +16 -0
  6. package/lib/de8dee841ffdaaede3a2254deef30376.js +15395 -0
  7. package/lib/e78eab250e7f8ccac3d918dfdb06ca10.js +8904 -0
  8. package/lib/theme-chalk/fonts/PingFang.ttf +0 -0
  9. package/lib/theme-chalk/fonts/bpmn.eot +0 -0
  10. package/lib/theme-chalk/fonts/bpmn.svg +224 -0
  11. package/lib/theme-chalk/fonts/bpmn.ttf +0 -0
  12. package/lib/theme-chalk/fonts/bpmn.woff +0 -0
  13. package/lib/theme-chalk/fonts/bpmn.woff2 +0 -0
  14. package/lib/theme-chalk/fonts/fontawesome-webfont.eot +0 -0
  15. package/lib/theme-chalk/fonts/fontawesome-webfont.svg +2671 -0
  16. package/lib/theme-chalk/fonts/fontawesome-webfont.ttf +0 -0
  17. package/lib/theme-chalk/fonts/fontawesome-webfont.woff +0 -0
  18. package/lib/theme-chalk/fonts/fontawesome-webfont.woff2 +0 -0
  19. package/lib/theme-chalk/fonts/iconfont.eot +0 -0
  20. package/lib/theme-chalk/fonts/iconfont.svg +155 -0
  21. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  22. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  23. package/lib/theme-chalk/fonts/iconfont.woff2 +0 -0
  24. package/lib/theme-chalk/images/notData.png +0 -0
  25. package/lib/theme-chalk/index.scss +31 -0
  26. package/lib/theme-chalk/js/Log.js +99 -0
  27. package/lib/theme-chalk/js/axios.js +86 -0
  28. package/lib/theme-chalk/js/store/getters.js +5 -0
  29. package/lib/theme-chalk/js/store/modules/makingForm.js +21 -0
  30. package/lib/theme-chalk/js/store/store.js +26 -0
  31. package/lib/theme-chalk/styles/button.scss +501 -0
  32. package/lib/theme-chalk/styles/card.scss +29 -0
  33. package/lib/theme-chalk/styles/cell.scss +54 -0
  34. package/lib/theme-chalk/styles/codeEditor.scss +9 -0
  35. package/lib/theme-chalk/styles/col.scss +151 -0
  36. package/lib/theme-chalk/styles/dialog.scss +56 -0
  37. package/lib/theme-chalk/styles/empty.scss +22 -0
  38. package/lib/theme-chalk/styles/feature.scss +46 -0
  39. package/lib/theme-chalk/styles/font.css +7 -0
  40. package/lib/theme-chalk/styles/grid.scss +41 -0
  41. package/lib/theme-chalk/styles/icon.css +1944 -0
  42. package/lib/theme-chalk/styles/imagePreview.scss +113 -0
  43. package/lib/theme-chalk/styles/img.scss +35 -0
  44. package/lib/theme-chalk/styles/reset.scss +17 -0
  45. package/lib/theme-chalk/styles/root.css +64 -0
  46. package/lib/theme-chalk/styles/row.scss +23 -0
  47. package/lib/theme-chalk/styles/upload.scss +744 -0
  48. package/lib/theme-chalk/styles/variable.scss +80 -0
  49. package/lib/tianheng-ui.js +116 -0
  50. package/package.json +86 -48
  51. package/packages/Button/index.js +8 -0
  52. package/packages/Button/index.vue +80 -0
  53. package/packages/Card/index.js +8 -0
  54. package/packages/Card/index.vue +37 -0
  55. package/packages/Cell/index.js +8 -0
  56. package/packages/Cell/index.vue +68 -0
  57. package/packages/CodeEditor/index.js +8 -0
  58. package/packages/CodeEditor/index.vue +177 -0
  59. package/packages/Col/index.js +8 -0
  60. package/packages/Col/index.vue +43 -0
  61. package/packages/Dialog/index.js +8 -0
  62. package/packages/Dialog/index.vue +129 -0
  63. package/packages/Empty/index.js +8 -0
  64. package/packages/Empty/index.vue +35 -0
  65. package/packages/FormMaking/FormConfig.vue +60 -0
  66. package/packages/FormMaking/GenerateForm.vue +308 -0
  67. package/packages/FormMaking/GenerateFormItem.vue +887 -0
  68. package/packages/FormMaking/GenerateFormItemH5.vue +825 -0
  69. package/packages/FormMaking/Upload/index.vue +572 -0
  70. package/packages/FormMaking/WidgetConfig.vue +472 -0
  71. package/packages/FormMaking/WidgetForm.vue +159 -0
  72. package/packages/FormMaking/WidgetFormItem.vue +187 -0
  73. package/packages/FormMaking/custom/config.js +762 -0
  74. package/packages/FormMaking/custom/configs/alliance.vue +0 -0
  75. package/packages/FormMaking/custom/configs/blank.vue +54 -0
  76. package/packages/FormMaking/custom/configs/button.vue +172 -0
  77. package/packages/FormMaking/custom/configs/cascader.vue +175 -0
  78. package/packages/FormMaking/custom/configs/cell.vue +81 -0
  79. package/packages/FormMaking/custom/configs/checkbox.vue +234 -0
  80. package/packages/FormMaking/custom/configs/color.vue +137 -0
  81. package/packages/FormMaking/custom/configs/date.vue +158 -0
  82. package/packages/FormMaking/custom/configs/divider.vue +61 -0
  83. package/packages/FormMaking/custom/configs/editor.vue +71 -0
  84. package/packages/FormMaking/custom/configs/filler.vue +57 -0
  85. package/packages/FormMaking/custom/configs/grid.vue +103 -0
  86. package/packages/FormMaking/custom/configs/image.vue +138 -0
  87. package/packages/FormMaking/custom/configs/input.vue +176 -0
  88. package/packages/FormMaking/custom/configs/number.vue +140 -0
  89. package/packages/FormMaking/custom/configs/radio.vue +211 -0
  90. package/packages/FormMaking/custom/configs/rate.vue +109 -0
  91. package/packages/FormMaking/custom/configs/select.vue +305 -0
  92. package/packages/FormMaking/custom/configs/slider.vue +142 -0
  93. package/packages/FormMaking/custom/configs/switch.vue +130 -0
  94. package/packages/FormMaking/custom/configs/table.vue +105 -0
  95. package/packages/FormMaking/custom/configs/table_h5.vue +102 -0
  96. package/packages/FormMaking/custom/configs/tabs.vue +175 -0
  97. package/packages/FormMaking/custom/configs/text.vue +71 -0
  98. package/packages/FormMaking/custom/configs/textarea.vue +167 -0
  99. package/packages/FormMaking/custom/configs/time.vue +153 -0
  100. package/packages/FormMaking/custom/configs/upload.vue +155 -0
  101. package/packages/FormMaking/custom/index.js +32 -0
  102. package/packages/FormMaking/custom/items/alliance.vue +132 -0
  103. package/packages/FormMaking/custom/items/blank.vue +16 -0
  104. package/packages/FormMaking/custom/items/button.vue +27 -0
  105. package/packages/FormMaking/custom/items/cascader.vue +29 -0
  106. package/packages/FormMaking/custom/items/cell.vue +18 -0
  107. package/packages/FormMaking/custom/items/checkbox.vue +46 -0
  108. package/packages/FormMaking/custom/items/color.vue +19 -0
  109. package/packages/FormMaking/custom/items/date.vue +29 -0
  110. package/packages/FormMaking/custom/items/divider.vue +14 -0
  111. package/packages/FormMaking/custom/items/editor.vue +22 -0
  112. package/packages/FormMaking/custom/items/filler.vue +17 -0
  113. package/packages/FormMaking/custom/items/grid.vue +130 -0
  114. package/packages/FormMaking/custom/items/image.vue +70 -0
  115. package/packages/FormMaking/custom/items/input.vue +33 -0
  116. package/packages/FormMaking/custom/items/login.vue +13 -0
  117. package/packages/FormMaking/custom/items/number.vue +24 -0
  118. package/packages/FormMaking/custom/items/radio.vue +44 -0
  119. package/packages/FormMaking/custom/items/rate.vue +20 -0
  120. package/packages/FormMaking/custom/items/select.vue +32 -0
  121. package/packages/FormMaking/custom/items/slider.vue +34 -0
  122. package/packages/FormMaking/custom/items/switch.vue +22 -0
  123. package/packages/FormMaking/custom/items/table.vue +106 -0
  124. package/packages/FormMaking/custom/items/table_h5.vue +126 -0
  125. package/packages/FormMaking/custom/items/tabs.vue +145 -0
  126. package/packages/FormMaking/custom/items/text.vue +18 -0
  127. package/packages/FormMaking/custom/items/textarea.vue +37 -0
  128. package/packages/FormMaking/custom/items/time.vue +32 -0
  129. package/packages/FormMaking/custom/items/upload.vue +102 -0
  130. package/packages/FormMaking/custom/mixins/index.js +61 -0
  131. package/packages/FormMaking/custom/register.js +18 -0
  132. package/packages/FormMaking/generate.js +5 -0
  133. package/packages/FormMaking/iconfont/demo.css +539 -0
  134. package/packages/FormMaking/iconfont/demo_index.html +1159 -0
  135. package/packages/FormMaking/iconfont/iconfont.css +189 -0
  136. package/packages/FormMaking/iconfont/iconfont.eot +0 -0
  137. package/packages/FormMaking/iconfont/iconfont.js +1 -0
  138. package/packages/FormMaking/iconfont/iconfont.svg +155 -0
  139. package/packages/FormMaking/iconfont/iconfont.ttf +0 -0
  140. package/packages/FormMaking/iconfont/iconfont.woff +0 -0
  141. package/packages/FormMaking/iconfont/iconfont.woff2 +0 -0
  142. package/packages/FormMaking/index.js +33 -0
  143. package/packages/FormMaking/index.vue +807 -0
  144. package/packages/FormMaking/lang/en-US.js +187 -0
  145. package/packages/FormMaking/lang/zh-CN.js +187 -0
  146. package/packages/FormMaking/making.js +9 -0
  147. package/packages/FormMaking/styles/cover.scss +41 -0
  148. package/packages/FormMaking/styles/index.scss +785 -0
  149. package/packages/FormMaking/util/generateCode.js +163 -0
  150. package/packages/FormMaking/util/index.js +33 -0
  151. package/packages/FormMaking/util/request.js +28 -0
  152. package/packages/Grid/index.js +8 -0
  153. package/packages/Grid/index.vue +21 -0
  154. package/packages/GridItem/index.js +8 -0
  155. package/packages/GridItem/index.vue +69 -0
  156. package/packages/Icons/index.js +8 -0
  157. package/packages/Icons/index.vue +377 -0
  158. package/packages/Image/index.js +8 -0
  159. package/packages/Image/index.vue +146 -0
  160. package/packages/ImagePreview/index.js +8 -0
  161. package/packages/ImagePreview/index.vue +386 -0
  162. package/packages/Row/index.js +8 -0
  163. package/packages/Row/index.vue +33 -0
  164. package/packages/Table/action.js +8 -0
  165. package/packages/Table/action.vue +168 -0
  166. package/packages/Table/column.vue +63 -0
  167. package/packages/Table/index.js +8 -0
  168. package/packages/Table/index.vue +327 -0
  169. package/packages/Table/search.js +8 -0
  170. package/packages/Table/search.vue +163 -0
  171. package/packages/Table/tools.js +8 -0
  172. package/packages/Table/tools.vue +49 -0
  173. package/packages/TableMaking/custom/configs/fieldSearch.vue +17 -0
  174. package/packages/TableMaking/custom/configs/fieldTable.vue +15 -0
  175. package/packages/TableMaking/custom/items/search/index.vue +158 -0
  176. package/packages/TableMaking/custom/items/tools/index.vue +49 -0
  177. package/packages/TableMaking/generate.js +5 -0
  178. package/packages/TableMaking/generateTable.vue +560 -0
  179. package/packages/TableMaking/index.vue +229 -0
  180. package/packages/TableMaking/making.js +5 -0
  181. package/packages/TableMaking/util/index.js +433 -0
  182. package/packages/TableMaking/widgetConfig.vue +390 -0
  183. package/packages/TableMaking/widgetTable.vue +305 -0
  184. package/packages/Upload/ajax.js +85 -0
  185. package/packages/Upload/index.js +8 -0
  186. package/packages/Upload/index.vue +325 -0
  187. package/packages/Upload/upload-dragger.vue +70 -0
  188. package/packages/Upload/upload-list.vue +121 -0
  189. package/packages/Upload/upload.vue +193 -0
  190. package/packages/VueEditor/index.js +8 -0
  191. package/packages/VueEditor/index.vue +38 -0
  192. package/packages/Workflow/Log.js +99 -0
  193. package/packages/Workflow/designer/ProcessDesigner.vue +628 -0
  194. package/packages/Workflow/designer/index.js +7 -0
  195. package/packages/Workflow/designer/plugins/content-pad/contentPadProvider.js +390 -0
  196. package/packages/Workflow/designer/plugins/content-pad/index.js +6 -0
  197. package/packages/Workflow/designer/plugins/defaultEmpty.js +24 -0
  198. package/packages/Workflow/designer/plugins/descriptor/activitiDescriptor.json +1071 -0
  199. package/packages/Workflow/designer/plugins/descriptor/camundaDescriptor.json +1087 -0
  200. package/packages/Workflow/designer/plugins/descriptor/flowableDescriptor.json +1215 -0
  201. package/packages/Workflow/designer/plugins/extension-moddle/activiti/activitiExtension.js +74 -0
  202. package/packages/Workflow/designer/plugins/extension-moddle/activiti/index.js +9 -0
  203. package/packages/Workflow/designer/plugins/extension-moddle/camunda/extension.js +148 -0
  204. package/packages/Workflow/designer/plugins/extension-moddle/camunda/index.js +6 -0
  205. package/packages/Workflow/designer/plugins/extension-moddle/flowable/flowableExtension.js +74 -0
  206. package/packages/Workflow/designer/plugins/extension-moddle/flowable/index.js +9 -0
  207. package/packages/Workflow/designer/plugins/palette/CustomPalette.js +156 -0
  208. package/packages/Workflow/designer/plugins/palette/index.js +6 -0
  209. package/packages/Workflow/designer/plugins/palette/paletteProvider.js +160 -0
  210. package/packages/Workflow/designer/plugins/translate/customTranslate.js +41 -0
  211. package/packages/Workflow/designer/plugins/translate/zh.js +238 -0
  212. package/packages/Workflow/highlight/index.js +5 -0
  213. package/packages/Workflow/index.js +34 -0
  214. package/packages/Workflow/index.vue +399 -0
  215. package/packages/Workflow/modules/auto-place/CustomAutoPlace.js +81 -0
  216. package/packages/Workflow/modules/auto-place/index.js +6 -0
  217. package/packages/Workflow/modules/custom-renderer/CustomRenderer.js +17 -0
  218. package/packages/Workflow/modules/custom-renderer/index.js +6 -0
  219. package/packages/Workflow/modules/rules/CustomRules.js +16 -0
  220. package/packages/Workflow/modules/rules/index.js +6 -0
  221. package/packages/Workflow/palette/ProcessPalette.vue +106 -0
  222. package/packages/Workflow/palette/index.js +7 -0
  223. package/packages/Workflow/penal/PropertiesPanel.vue +245 -0
  224. package/packages/Workflow/penal/base/ElementBaseInfo.vue +80 -0
  225. package/packages/Workflow/penal/flow-condition/FlowCondition.vue +142 -0
  226. package/packages/Workflow/penal/form/ElementForm.vue +367 -0
  227. package/packages/Workflow/penal/index.js +7 -0
  228. package/packages/Workflow/penal/listeners/ElementListeners.vue +299 -0
  229. package/packages/Workflow/penal/listeners/UserTaskListeners.vue +322 -0
  230. package/packages/Workflow/penal/listeners/template.js +178 -0
  231. package/packages/Workflow/penal/listeners/utilSelf.js +64 -0
  232. package/packages/Workflow/penal/multi-instance/ElementMultiInstance.vue +200 -0
  233. package/packages/Workflow/penal/other/ElementOtherConfig.vue +59 -0
  234. package/packages/Workflow/penal/properties/ElementProperties.vue +135 -0
  235. package/packages/Workflow/penal/signal-message/SignalAndMessage.vue +104 -0
  236. package/packages/Workflow/penal/task/ElementTask.vue +73 -0
  237. package/packages/Workflow/penal/task/task-components/ReceiveTask.vue +97 -0
  238. package/packages/Workflow/penal/task/task-components/ScriptTask.vue +85 -0
  239. package/packages/Workflow/penal/task/task-components/UserTask.vue +535 -0
  240. package/packages/Workflow/theme/element-variables.scss +70 -0
  241. package/packages/Workflow/theme/index.scss +2 -0
  242. package/packages/Workflow/theme/process-designer.scss +157 -0
  243. package/packages/Workflow/theme/process-panel.scss +107 -0
  244. package/packages/Workflow/translations.js +25 -0
  245. package/packages/Workflow/utils.js +71 -0
  246. package/packages/index.js +160 -0
  247. package/babel.config.js +0 -15
  248. package/index.js +0 -11
  249. package/public/favicon.ico +0 -0
  250. package/public/index.html +0 -17
  251. package/src/App.vue +0 -28
  252. package/src/assets/logo.png +0 -0
  253. package/src/components/HelloWorld.vue +0 -58
  254. package/src/main.js +0 -8
@@ -0,0 +1,386 @@
1
+ <template>
2
+ <div class="th-image-preview">
3
+ <!-- 预览外层图片 -->
4
+ <div class="th-preview">
5
+ <div
6
+ v-for="(item, index) in imgArr"
7
+ v-if="!startIndex && startIndex !== 0 && !src"
8
+ :key="srcKey ? index : item"
9
+ class="th-preview-item-out"
10
+ @click="clickHandler(index)"
11
+ >
12
+ <img
13
+ :src="srcKey ? item[srcKey] : imgArr[index]"
14
+ class="th-preview-item-image-out"
15
+ @click="onClick"
16
+ />
17
+ </div>
18
+ </div>
19
+
20
+ <!-- 预览组件 -->
21
+ <transition name="viewer-fade">
22
+ <template v-if="showViewer">
23
+ <div class="th-image-viewer__wrapper">
24
+ <!-- 阴影外层遮罩 -->
25
+ <div class="th-image-viewer__mask" @click="onClose"></div>
26
+ <!-- 关闭按钮 -->
27
+ <span
28
+ class="th-image-viewer__btn th-image-viewer__close"
29
+ @click="onClose"
30
+ >
31
+ <i class="el-icon-close"></i>
32
+ </span>
33
+
34
+ <div class="th-image-viewer__item" v-if="this.topList">
35
+ <div
36
+ v-for="(item, index) in imgArr"
37
+ :key="srcKey ? index : item"
38
+ class="th-preview-item-ins zindex"
39
+ @click="clickHandler(index)"
40
+ >
41
+ <img
42
+ :src="srcKey ? item[srcKey] : item"
43
+ class="th-preview-item-image-ins"
44
+ />
45
+ </div>
46
+ </div>
47
+
48
+ <!-- 图片前进后退 -->
49
+ <template v-if="!isSingle">
50
+ <span
51
+ class="th-image-viewer__btn th-image-viewer__prev"
52
+ @click="prev"
53
+ >
54
+ <i class="th-icon-arrow-left" />
55
+ </span>
56
+ <span
57
+ class="th-image-viewer__btn th-image-viewer__next"
58
+ @click="next"
59
+ >
60
+ <i class="th-icon-arrow-right" />
61
+ </span>
62
+ </template>
63
+
64
+ <!-- 旋转等操作按钮 -->
65
+ <div class="th-image-viewer__btn th-image-viewer__actions">
66
+ <div class="el-image-viewer__actions__inner">
67
+ <i class="el-icon-zoom-out" @click="handleActions('zoomOut')"></i>
68
+ <i class="el-icon-zoom-in" @click="handleActions('zoomIn')"></i>
69
+ <i class="el-image-viewer__actions__divider"></i>
70
+ <i :class="mode.icon" @click="toggleMode"></i>
71
+ <i :class="showIcon" @click="showList"></i>
72
+ <i class="el-image-viewer__actions__divider"></i>
73
+ <i
74
+ class="el-icon-refresh-left"
75
+ @click="handleActions('anticlocelise')"
76
+ ></i>
77
+ <i
78
+ class="el-icon-refresh-right"
79
+ @click="handleActions('clocelise')"
80
+ ></i>
81
+ </div>
82
+ </div>
83
+ <!-- 中心大图 -->
84
+ <div class="th-image-viewer__canvas">
85
+ <img
86
+ v-for="(url, i) in imgArr"
87
+ v-if="i === index"
88
+ ref="img"
89
+ class="th-image-viewer__img"
90
+ :key="srcKey ? i : url"
91
+ :src="srcKey ? url[srcKey] : imgArr[index]"
92
+ :style="imgStyle()"
93
+ @mousedown="handleMouseDown"
94
+ @load="changeImg(url)"
95
+ />
96
+ </div>
97
+ </div>
98
+ </template>
99
+ </transition>
100
+ </div>
101
+ </template>
102
+
103
+ <script>
104
+ const Mode = {
105
+ CONTAIN: {
106
+ name: "contain",
107
+ icon: "el-icon-full-screen"
108
+ },
109
+ ORIGINAL: {
110
+ name: "original",
111
+ icon: "el-icon-c-scale-to-original"
112
+ }
113
+ };
114
+
115
+ const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
116
+
117
+ import { rafThrottle, isFirefox } from "element-ui/src/utils/util";
118
+ import { on, off } from "element-ui/src/utils/dom";
119
+
120
+ export default {
121
+ name: "ThImagePreview",
122
+ props: {
123
+ imgArr: Array,
124
+ srcKey: String,
125
+ startIndex: Number,
126
+ src: String,
127
+ onClose: {
128
+ type: Function,
129
+ default: () => {}
130
+ },
131
+ onClick: {
132
+ type: Function,
133
+ default: () => {}
134
+ },
135
+ showViewer: {
136
+ type: Boolean,
137
+ default: true
138
+ }
139
+ },
140
+ data() {
141
+ return {
142
+ srcNum: null,
143
+ firstNum: 0,
144
+ topList: false,
145
+ showIcon: "el-icon-picture-outline",
146
+ showView: false,
147
+ index: this.startIndex,
148
+ mode: Mode.CONTAIN,
149
+ transform: {
150
+ scale: 1,
151
+ deg: 0,
152
+ offsetX: 0,
153
+ offsetY: 0,
154
+ enableTransition: false
155
+ }
156
+ };
157
+ },
158
+ computed: {
159
+ isSingle() {
160
+ if (!this.srcKey) {
161
+ return;
162
+ }
163
+ return this.imgArr.length <= 1;
164
+ },
165
+ currentImg() {
166
+ return this.srcKey ? this.imgArr[this.srcKey] : this.imgArr;
167
+ },
168
+ isFirst() {
169
+ return this.index === 0;
170
+ },
171
+ isLast() {
172
+ if (!this.srcKey) {
173
+ return;
174
+ }
175
+ return this.index === this.imgArr.length - 1;
176
+ }
177
+ },
178
+ watch: {
179
+ currentImg(val) {
180
+ this.$nextTick(_ => {
181
+ const $img = this.$refs.img[0];
182
+ // if (!$img.complete) {
183
+ // this.loading = true;
184
+ // }
185
+ });
186
+ },
187
+ showViewer() {
188
+ if (!this.showViewer) {
189
+ this.firstNum = 0;
190
+ this.showIcon = "el-icon-picture-outline";
191
+ this.topList = false;
192
+ }
193
+ if (this.showViewer) {
194
+ let bodyStyle = document.body.style;
195
+ bodyStyle.overflow = "hidden";
196
+ }
197
+ }
198
+ },
199
+ mounted() {
200
+ this.deviceSupportInstall();
201
+ this.srcClick();
202
+ },
203
+ methods: {
204
+ // 监听键盘事件
205
+ deviceSupportInstall() {
206
+ this._keyDownHandler = e => {
207
+ e.stopPropagation();
208
+ const keyCode = e.keyCode;
209
+ switch (keyCode) {
210
+ // ESC
211
+ case 27:
212
+ this.onClose();
213
+ break;
214
+ // SPACE
215
+ case 32:
216
+ this.toggleMode();
217
+ break;
218
+ // LEFT_ARROW
219
+ case 37:
220
+ this.prev();
221
+ break;
222
+ // UP_ARROW
223
+ case 38:
224
+ this.handleActions("zoomIn");
225
+ break;
226
+ // RIGHT_ARROW
227
+ case 39:
228
+ this.next();
229
+ break;
230
+ // DOWN_ARROW
231
+ case 40:
232
+ this.handleActions("zoomOut");
233
+ break;
234
+ }
235
+ };
236
+ this._mouseWheelHandler = rafThrottle(e => {
237
+ const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
238
+ if (delta > 0) {
239
+ this.handleActions("zoomIn", {
240
+ zoomRate: 0.015,
241
+ enableTransition: false
242
+ });
243
+ } else {
244
+ this.handleActions("zoomOut", {
245
+ zoomRate: 0.015,
246
+ enableTransition: false
247
+ });
248
+ }
249
+ });
250
+ on(document, "keydown", this._keyDownHandler);
251
+ on(document, mousewheelEventName, this._mouseWheelHandler);
252
+ },
253
+ deviceSupportUninstall() {
254
+ off(document, "keydown", this._keyDownHandler);
255
+ off(document, mousewheelEventName, this._mouseWheelHandler);
256
+ this._keyDownHandler = null;
257
+ this._mouseWheelHandler = null;
258
+ },
259
+ handleMouseDown(e) {
260
+ // if (this.loading || e.button !== 0) return;
261
+
262
+ const { offsetX, offsetY } = this.transform;
263
+ const startX = e.pageX;
264
+ const startY = e.pageY;
265
+ this._dragHandler = rafThrottle(ev => {
266
+ this.transform.offsetX = offsetX + ev.pageX - startX;
267
+ this.transform.offsetY = offsetY + ev.pageY - startY;
268
+ });
269
+ on(document, "mousemove", this._dragHandler);
270
+ on(document, "mouseup", ev => {
271
+ off(document, "mousemove", this._dragHandler);
272
+ });
273
+
274
+ e.preventDefault();
275
+ },
276
+ // 显示隐藏这招内图片列表
277
+ showList() {
278
+ if (!this.topList) {
279
+ this.showIcon = "el-icon-picture";
280
+ this.topList = true;
281
+ } else {
282
+ this.showIcon = "el-icon-picture-outline";
283
+ this.topList = false;
284
+ }
285
+ },
286
+ clickHandler(i) {
287
+ this.prevOverflow = document.body.style.overflow;
288
+ this.index = i;
289
+ this.$emit("on-click");
290
+ },
291
+ // 后退
292
+ prev() {
293
+ if (this.isFirst && !this.infinite) return;
294
+ const len = this.imgArr.length;
295
+ this.index = (this.index - 1 + len) % len;
296
+ },
297
+ // 前进
298
+ next() {
299
+ if (this.isLast && !this.infinite) return;
300
+ const len = this.imgArr.length;
301
+ this.index = (this.index + 1) % len;
302
+ },
303
+ changeImg(e) {
304
+ this.firstNum += 1;
305
+ if (this.firstNum !== 1) {
306
+ this.$emit("on-change", e);
307
+ }
308
+ },
309
+ // 图片放大缩小样式
310
+ imgStyle() {
311
+ const { scale, deg, offsetX, offsetY, enableTransition } = this.transform;
312
+ const style = {
313
+ transform: `scale(${scale}) rotate(${deg}deg)`,
314
+ transition: enableTransition ? "transform .3s" : "",
315
+ "margin-left": `${offsetX}px`,
316
+ "margin-top": `${offsetY}px`
317
+ };
318
+ if (this.mode === Mode.CONTAIN) {
319
+ style.maxWidth = style.maxHeight = "100%";
320
+ }
321
+ return style;
322
+ },
323
+ // 重置图片大小
324
+ reset() {
325
+ this.transform = {
326
+ scale: 1,
327
+ deg: 0,
328
+ offsetX: 0,
329
+ offsetY: 0,
330
+ enableTransition: false
331
+ };
332
+ },
333
+ toggleMode() {
334
+ const modeNames = Object.keys(Mode);
335
+ const modeValues = Object.values(Mode);
336
+ const index = modeValues.indexOf(this.mode);
337
+ const nextIndex = (index + 1) % modeNames.length;
338
+ this.mode = Mode[modeNames[nextIndex]];
339
+ this.reset();
340
+ },
341
+ // 点击操作列表
342
+ handleActions(action, options = {}) {
343
+ const { zoomRate, rotateDeg, enableTransition } = {
344
+ zoomRate: 0.2,
345
+ rotateDeg: 90,
346
+ enableTransition: true,
347
+ ...options
348
+ };
349
+ const { transform } = this;
350
+ switch (action) {
351
+ case "zoomOut":
352
+ if (transform.scale > 0.2) {
353
+ transform.scale = parseFloat(
354
+ (transform.scale - zoomRate).toFixed(3)
355
+ );
356
+ }
357
+ break;
358
+ case "zoomIn":
359
+ transform.scale = parseFloat((transform.scale + zoomRate).toFixed(3));
360
+ break;
361
+ case "clocelise":
362
+ transform.deg += rotateDeg;
363
+ break;
364
+ case "anticlocelise":
365
+ transform.deg -= rotateDeg;
366
+ break;
367
+ }
368
+ transform.enableTransition = enableTransition;
369
+ },
370
+ srcClick() {
371
+ if (this.srcKey) {
372
+ if (!this.startIndex) {
373
+ // console.log(this.src,this.imgArr);
374
+ this.imgArr.forEach((item, index) => {
375
+ if (item[this.srcKey] === this.src) {
376
+ this.index = index;
377
+ }
378
+ });
379
+ }
380
+ }
381
+ }
382
+ }
383
+ };
384
+ </script>
385
+
386
+ <style lang="less" scoped></style>
@@ -0,0 +1,8 @@
1
+ import Row from "./index.vue";
2
+
3
+ /* istanbul ignore next */
4
+ Row.install = function(Vue) {
5
+ Vue.component(Row.name, Row);
6
+ };
7
+
8
+ export default Row;
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div :class="selfClass" :style="selfStyle">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: "ThRow",
10
+ props: { gutter: Number, flex: Boolean, justify: String, align: String },
11
+ computed: {
12
+ selfClass() {
13
+ let className = "th-row";
14
+ if (this.flex) className = `${className} th-row-flex`;
15
+ return className;
16
+ },
17
+ selfStyle() {
18
+ const style = {};
19
+ if (this.gutter) {
20
+ style.marginLeft = `-${this.gutter / 2}px`;
21
+ style.marginRight = style.marginLeft;
22
+ }
23
+ if (this.justify) {
24
+ style.justifyContent = this.justify;
25
+ }
26
+ if (this.align) {
27
+ style.alignItems = this.align;
28
+ }
29
+ return style;
30
+ }
31
+ }
32
+ };
33
+ </script>
@@ -0,0 +1,8 @@
1
+ import TableAction from "./action.vue";
2
+
3
+ /* istanbul ignore next */
4
+ TableAction.install = function(Vue) {
5
+ Vue.component(TableAction.name, TableAction);
6
+ };
7
+
8
+ export default TableAction;
@@ -0,0 +1,168 @@
1
+ <template>
2
+ <div class="th-table-action" @click.stop>
3
+ <template v-for="(item, index) in actions">
4
+ <el-popover
5
+ v-if="item.act === 'delete' && !btnHide(item)"
6
+ v-model="pop"
7
+ :key="index"
8
+ placement="top"
9
+ width="180"
10
+ trigger="manual"
11
+ >
12
+ <p>{{ item.delmsg || msg }}</p>
13
+ <div style="text-align: right; margin: 0">
14
+ <el-button type="text" :disabled="loadingDel" @click="handleCancel"
15
+ >取消</el-button
16
+ >
17
+ <el-button
18
+ type="text"
19
+ :loading="loadingDel"
20
+ @click="handleDelete(item)"
21
+ >确定</el-button
22
+ >
23
+ </div>
24
+ <el-button
25
+ :style="item.style"
26
+ slot="reference"
27
+ :disabled="loadingDel || btnDisabled(item)"
28
+ :type="item.type"
29
+ :icon="item.icon"
30
+ @click="pop = true"
31
+ >{{ item.name }}</el-button
32
+ >
33
+ </el-popover>
34
+ <el-dropdown
35
+ v-else-if="item.act === 'more' && !btnHide(item)"
36
+ :key="index"
37
+ :trigger="item.trigger || 'click'"
38
+ :placement="item.placement || 'bottom-end'"
39
+ :disabled="btnDisabled(item)"
40
+ @command="
41
+ value => {
42
+ handleMore(value, index, item);
43
+ }
44
+ "
45
+ >
46
+ <el-button
47
+ :style="item.style"
48
+ :disabled="loadingDel || btnDisabled(item)"
49
+ :type="item.type"
50
+ :icon="item.icon"
51
+ >{{ item.name }}</el-button
52
+ >
53
+ <el-dropdown-menu slot="dropdown">
54
+ <el-dropdown-item
55
+ v-for="(btnItem, btnIndex) in item.children"
56
+ :key="btnIndex"
57
+ :style="btnItem.style"
58
+ :command="btnItem.act"
59
+ :icon="btnItem.icon"
60
+ :disabled="btnItem.disabled"
61
+ >{{ btnItem.name }}</el-dropdown-item
62
+ >
63
+ </el-dropdown-menu>
64
+ </el-dropdown>
65
+ <el-button
66
+ v-else-if="!btnHide(item)"
67
+ :key="index"
68
+ :style="item.style"
69
+ :type="item.type"
70
+ :icon="item.icon"
71
+ :disabled="btnDisabled(item)"
72
+ @click="handleClick(item)"
73
+ >{{ item.name }}</el-button
74
+ >
75
+ </template>
76
+ </div>
77
+ </template>
78
+
79
+ <script>
80
+ export default {
81
+ name: "ThTableAction",
82
+ props: {
83
+ actions: {
84
+ type: Array,
85
+ default: () => {
86
+ return [];
87
+ }
88
+ },
89
+ scope: {
90
+ type: Object | String
91
+ },
92
+ permission: {
93
+ type: Object,
94
+ required: false
95
+ },
96
+ msg: {
97
+ type: String,
98
+ default: "确定删除本条数据吗?"
99
+ }
100
+ },
101
+ data() {
102
+ return {
103
+ pop: false,
104
+ loadingDel: false
105
+ };
106
+ },
107
+ computed: {
108
+ btnDisabled() {
109
+ return item => {
110
+ if (typeof item.disabled == "boolean") {
111
+ return item.disabled;
112
+ }
113
+ if (typeof item.disabled == "function") {
114
+ return item.disabled(this.scope);
115
+ }
116
+ };
117
+ },
118
+ btnHide() {
119
+ return item => {
120
+ if (typeof item.hide == "boolean") {
121
+ return item.hide;
122
+ }
123
+ if (typeof item.hide == "function") {
124
+ return item.hide(this.scope);
125
+ }
126
+ };
127
+ }
128
+ },
129
+ methods: {
130
+ handleCancel() {
131
+ this.loadingDel = false;
132
+ this.pop = false;
133
+ },
134
+ handleClick(item, callback) {
135
+ this.$emit("on-click", item, callback);
136
+ },
137
+ handleDelete(item) {
138
+ this.loadingDel = true;
139
+ const callback = bool => {
140
+ bool ? this.handleCancel() : (this.loadingDel = false);
141
+ };
142
+ this.handleClick(item, callback);
143
+ },
144
+ handleMore(value, index, item) {
145
+ for (let i = 0; i < item.children.length; i++) {
146
+ const element = item.children[i];
147
+ if (element.act === value) {
148
+ this.handleClick(element);
149
+ break;
150
+ }
151
+ }
152
+ }
153
+ }
154
+ };
155
+ </script>
156
+
157
+ <style lang="less">
158
+ .th-table-action {
159
+ width: 100%;
160
+ display: flex;
161
+ align-items: center;
162
+ justify-content: space-around;
163
+
164
+ .el-button + .el-button {
165
+ margin-left: 0px;
166
+ }
167
+ }
168
+ </style>
@@ -0,0 +1,63 @@
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="item.showOverflowTooltip"
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="item.showOverflowTooltip"
38
+ >
39
+ <template slot-scope="scope">
40
+ <slot v-if="item.slot" name="slot" :scope="scope" :option="item" />
41
+ <span v-else>{{ scope.row[item.prop] }}</span>
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
+ };
61
+ </script>
62
+
63
+ <style></style>
@@ -0,0 +1,8 @@
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;