zetan-cli-dev-template-vue-element-admin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. package/package.json +8 -0
  2. package/template/.editorconfig +14 -0
  3. package/template/.env.development +5 -0
  4. package/template/.env.production +6 -0
  5. package/template/.env.staging +8 -0
  6. package/template/.eslintignore +4 -0
  7. package/template/.eslintrc.js +198 -0
  8. package/template/.travis.yml +5 -0
  9. package/template/LICENSE +21 -0
  10. package/template/README.es.md +228 -0
  11. package/template/README.ja.md +224 -0
  12. package/template/README.md +250 -0
  13. package/template/README.zh-CN.md +273 -0
  14. package/template/babel.config.js +14 -0
  15. package/template/build/index.js +35 -0
  16. package/template/jest.config.js +24 -0
  17. package/template/jsconfig.json +9 -0
  18. package/template/mock/article.js +116 -0
  19. package/template/mock/index.js +60 -0
  20. package/template/mock/mock-server.js +81 -0
  21. package/template/mock/remote-search.js +51 -0
  22. package/template/mock/role/index.js +98 -0
  23. package/template/mock/role/routes.js +530 -0
  24. package/template/mock/user.js +84 -0
  25. package/template/mock/utils.js +48 -0
  26. package/template/package.json +111 -0
  27. package/template/plop-templates/component/index.hbs +26 -0
  28. package/template/plop-templates/component/prompt.js +55 -0
  29. package/template/plop-templates/store/index.hbs +16 -0
  30. package/template/plop-templates/store/prompt.js +62 -0
  31. package/template/plop-templates/utils.js +2 -0
  32. package/template/plop-templates/view/index.hbs +26 -0
  33. package/template/plop-templates/view/prompt.js +55 -0
  34. package/template/plopfile.js +9 -0
  35. package/template/postcss.config.js +5 -0
  36. package/template/public/favicon.ico +0 -0
  37. package/template/public/index.html +15 -0
  38. package/template/src/App.vue +11 -0
  39. package/template/src/api/article.js +41 -0
  40. package/template/src/api/qiniu.js +8 -0
  41. package/template/src/api/remote-search.js +17 -0
  42. package/template/src/api/role.js +38 -0
  43. package/template/src/api/user.js +24 -0
  44. package/template/src/assets/401_images/401.gif +0 -0
  45. package/template/src/assets/404_images/404.png +0 -0
  46. package/template/src/assets/404_images/404_cloud.png +0 -0
  47. package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
  48. package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
  49. package/template/src/assets/custom-theme/index.css +1 -0
  50. package/template/src/components/BackToTop/index.vue +111 -0
  51. package/template/src/components/Breadcrumb/index.vue +82 -0
  52. package/template/src/components/Charts/Keyboard.vue +155 -0
  53. package/template/src/components/Charts/LineMarker.vue +227 -0
  54. package/template/src/components/Charts/MixChart.vue +271 -0
  55. package/template/src/components/Charts/mixins/resize.js +56 -0
  56. package/template/src/components/DndList/index.vue +166 -0
  57. package/template/src/components/DragSelect/index.vue +65 -0
  58. package/template/src/components/Dropzone/index.vue +297 -0
  59. package/template/src/components/ErrorLog/index.vue +78 -0
  60. package/template/src/components/GithubCorner/index.vue +54 -0
  61. package/template/src/components/Hamburger/index.vue +44 -0
  62. package/template/src/components/HeaderSearch/index.vue +180 -0
  63. package/template/src/components/ImageCropper/index.vue +1779 -0
  64. package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
  65. package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
  66. package/template/src/components/ImageCropper/utils/language.js +232 -0
  67. package/template/src/components/ImageCropper/utils/mimes.js +7 -0
  68. package/template/src/components/JsonEditor/index.vue +77 -0
  69. package/template/src/components/Kanban/index.vue +99 -0
  70. package/template/src/components/MDinput/index.vue +360 -0
  71. package/template/src/components/MarkdownEditor/default-options.js +31 -0
  72. package/template/src/components/MarkdownEditor/index.vue +118 -0
  73. package/template/src/components/Pagination/index.vue +101 -0
  74. package/template/src/components/PanThumb/index.vue +142 -0
  75. package/template/src/components/RightPanel/index.vue +145 -0
  76. package/template/src/components/Screenfull/index.vue +60 -0
  77. package/template/src/components/Share/DropdownMenu.vue +103 -0
  78. package/template/src/components/SizeSelect/index.vue +57 -0
  79. package/template/src/components/Sticky/index.vue +91 -0
  80. package/template/src/components/SvgIcon/index.vue +62 -0
  81. package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
  82. package/template/src/components/ThemePicker/index.vue +175 -0
  83. package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
  84. package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
  85. package/template/src/components/Tinymce/index.vue +247 -0
  86. package/template/src/components/Tinymce/plugins.js +7 -0
  87. package/template/src/components/Tinymce/toolbar.js +6 -0
  88. package/template/src/components/Upload/SingleImage.vue +134 -0
  89. package/template/src/components/Upload/SingleImage2.vue +130 -0
  90. package/template/src/components/Upload/SingleImage3.vue +157 -0
  91. package/template/src/components/UploadExcel/index.vue +138 -0
  92. package/template/src/directive/clipboard/clipboard.js +49 -0
  93. package/template/src/directive/clipboard/index.js +13 -0
  94. package/template/src/directive/el-drag-dialog/drag.js +77 -0
  95. package/template/src/directive/el-drag-dialog/index.js +13 -0
  96. package/template/src/directive/el-table/adaptive.js +41 -0
  97. package/template/src/directive/el-table/index.js +13 -0
  98. package/template/src/directive/permission/index.js +13 -0
  99. package/template/src/directive/permission/permission.js +31 -0
  100. package/template/src/directive/sticky.js +91 -0
  101. package/template/src/directive/waves/index.js +13 -0
  102. package/template/src/directive/waves/waves.css +26 -0
  103. package/template/src/directive/waves/waves.js +72 -0
  104. package/template/src/filters/index.js +68 -0
  105. package/template/src/icons/index.js +9 -0
  106. package/template/src/icons/svg/404.svg +1 -0
  107. package/template/src/icons/svg/bug.svg +1 -0
  108. package/template/src/icons/svg/chart.svg +1 -0
  109. package/template/src/icons/svg/clipboard.svg +1 -0
  110. package/template/src/icons/svg/component.svg +1 -0
  111. package/template/src/icons/svg/dashboard.svg +1 -0
  112. package/template/src/icons/svg/documentation.svg +1 -0
  113. package/template/src/icons/svg/drag.svg +1 -0
  114. package/template/src/icons/svg/edit.svg +1 -0
  115. package/template/src/icons/svg/education.svg +1 -0
  116. package/template/src/icons/svg/email.svg +1 -0
  117. package/template/src/icons/svg/example.svg +1 -0
  118. package/template/src/icons/svg/excel.svg +1 -0
  119. package/template/src/icons/svg/exit-fullscreen.svg +1 -0
  120. package/template/src/icons/svg/eye-open.svg +1 -0
  121. package/template/src/icons/svg/eye.svg +1 -0
  122. package/template/src/icons/svg/form.svg +1 -0
  123. package/template/src/icons/svg/fullscreen.svg +1 -0
  124. package/template/src/icons/svg/guide.svg +1 -0
  125. package/template/src/icons/svg/icon.svg +1 -0
  126. package/template/src/icons/svg/international.svg +1 -0
  127. package/template/src/icons/svg/language.svg +1 -0
  128. package/template/src/icons/svg/link.svg +1 -0
  129. package/template/src/icons/svg/list.svg +1 -0
  130. package/template/src/icons/svg/lock.svg +1 -0
  131. package/template/src/icons/svg/message.svg +1 -0
  132. package/template/src/icons/svg/money.svg +1 -0
  133. package/template/src/icons/svg/nested.svg +1 -0
  134. package/template/src/icons/svg/password.svg +1 -0
  135. package/template/src/icons/svg/pdf.svg +1 -0
  136. package/template/src/icons/svg/people.svg +1 -0
  137. package/template/src/icons/svg/peoples.svg +1 -0
  138. package/template/src/icons/svg/qq.svg +1 -0
  139. package/template/src/icons/svg/search.svg +1 -0
  140. package/template/src/icons/svg/shopping.svg +1 -0
  141. package/template/src/icons/svg/size.svg +1 -0
  142. package/template/src/icons/svg/skill.svg +1 -0
  143. package/template/src/icons/svg/star.svg +1 -0
  144. package/template/src/icons/svg/tab.svg +1 -0
  145. package/template/src/icons/svg/table.svg +1 -0
  146. package/template/src/icons/svg/theme.svg +1 -0
  147. package/template/src/icons/svg/tree-table.svg +1 -0
  148. package/template/src/icons/svg/tree.svg +1 -0
  149. package/template/src/icons/svg/user.svg +1 -0
  150. package/template/src/icons/svg/wechat.svg +1 -0
  151. package/template/src/icons/svg/zip.svg +1 -0
  152. package/template/src/icons/svgo.yml +22 -0
  153. package/template/src/layout/components/AppMain.vue +57 -0
  154. package/template/src/layout/components/Navbar.vue +167 -0
  155. package/template/src/layout/components/Settings/index.vue +108 -0
  156. package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
  157. package/template/src/layout/components/Sidebar/Item.vue +41 -0
  158. package/template/src/layout/components/Sidebar/Link.vue +43 -0
  159. package/template/src/layout/components/Sidebar/Logo.vue +82 -0
  160. package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
  161. package/template/src/layout/components/Sidebar/index.vue +54 -0
  162. package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
  163. package/template/src/layout/components/TagsView/index.vue +292 -0
  164. package/template/src/layout/components/index.js +5 -0
  165. package/template/src/layout/index.vue +102 -0
  166. package/template/src/layout/mixin/ResizeHandler.js +45 -0
  167. package/template/src/main.js +53 -0
  168. package/template/src/permission.js +74 -0
  169. package/template/src/router/index.js +404 -0
  170. package/template/src/router/modules/charts.js +36 -0
  171. package/template/src/router/modules/components.js +102 -0
  172. package/template/src/router/modules/nested.js +66 -0
  173. package/template/src/router/modules/table.js +41 -0
  174. package/template/src/settings.js +35 -0
  175. package/template/src/store/getters.js +15 -0
  176. package/template/src/store/index.js +25 -0
  177. package/template/src/store/modules/app.js +56 -0
  178. package/template/src/store/modules/errorLog.js +28 -0
  179. package/template/src/store/modules/permission.js +69 -0
  180. package/template/src/store/modules/settings.js +35 -0
  181. package/template/src/store/modules/tagsView.js +160 -0
  182. package/template/src/store/modules/user.js +131 -0
  183. package/template/src/styles/btn.scss +99 -0
  184. package/template/src/styles/element-ui.scss +84 -0
  185. package/template/src/styles/element-variables.scss +31 -0
  186. package/template/src/styles/index.scss +191 -0
  187. package/template/src/styles/mixin.scss +66 -0
  188. package/template/src/styles/sidebar.scss +226 -0
  189. package/template/src/styles/transition.scss +48 -0
  190. package/template/src/styles/variables.scss +35 -0
  191. package/template/src/utils/auth.js +15 -0
  192. package/template/src/utils/clipboard.js +32 -0
  193. package/template/src/utils/error-log.js +35 -0
  194. package/template/src/utils/get-page-title.js +10 -0
  195. package/template/src/utils/index.js +357 -0
  196. package/template/src/utils/open-window.js +25 -0
  197. package/template/src/utils/permission.js +21 -0
  198. package/template/src/utils/request.js +85 -0
  199. package/template/src/utils/scroll-to.js +58 -0
  200. package/template/src/utils/validate.js +87 -0
  201. package/template/src/vendor/Export2Excel.js +220 -0
  202. package/template/src/vendor/Export2Zip.js +24 -0
  203. package/template/src/views/charts/keyboard.vue +23 -0
  204. package/template/src/views/charts/line.vue +23 -0
  205. package/template/src/views/charts/mix-chart.vue +23 -0
  206. package/template/src/views/clipboard/index.vue +49 -0
  207. package/template/src/views/components-demo/avatar-upload.vue +61 -0
  208. package/template/src/views/components-demo/back-to-top.vue +154 -0
  209. package/template/src/views/components-demo/count-to.vue +218 -0
  210. package/template/src/views/components-demo/dnd-list.vue +39 -0
  211. package/template/src/views/components-demo/drag-dialog.vue +61 -0
  212. package/template/src/views/components-demo/drag-kanban.vue +66 -0
  213. package/template/src/views/components-demo/drag-select.vue +43 -0
  214. package/template/src/views/components-demo/dropzone.vue +31 -0
  215. package/template/src/views/components-demo/json-editor.vue +36 -0
  216. package/template/src/views/components-demo/markdown.vue +101 -0
  217. package/template/src/views/components-demo/mixin.vue +169 -0
  218. package/template/src/views/components-demo/split-pane.vue +67 -0
  219. package/template/src/views/components-demo/sticky.vue +135 -0
  220. package/template/src/views/components-demo/tinymce.vue +36 -0
  221. package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
  222. package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
  223. package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
  224. package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
  225. package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
  226. package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
  227. package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
  228. package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
  229. package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
  230. package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
  231. package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
  232. package/template/src/views/dashboard/admin/index.vue +124 -0
  233. package/template/src/views/dashboard/editor/index.vue +74 -0
  234. package/template/src/views/dashboard/index.vue +31 -0
  235. package/template/src/views/documentation/index.vue +57 -0
  236. package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
  237. package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
  238. package/template/src/views/error-log/index.vue +32 -0
  239. package/template/src/views/error-page/401.vue +99 -0
  240. package/template/src/views/error-page/404.vue +228 -0
  241. package/template/src/views/example/components/ArticleDetail.vue +289 -0
  242. package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
  243. package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
  244. package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
  245. package/template/src/views/example/components/Dropdown/index.js +3 -0
  246. package/template/src/views/example/components/Warning.vue +13 -0
  247. package/template/src/views/example/create.vue +13 -0
  248. package/template/src/views/example/edit.vue +13 -0
  249. package/template/src/views/example/list.vue +112 -0
  250. package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
  251. package/template/src/views/excel/components/BookTypeOption.vue +39 -0
  252. package/template/src/views/excel/components/FilenameOption.vue +27 -0
  253. package/template/src/views/excel/export-excel.vue +116 -0
  254. package/template/src/views/excel/merge-header.vue +101 -0
  255. package/template/src/views/excel/select-excel.vue +107 -0
  256. package/template/src/views/excel/upload-excel.vue +42 -0
  257. package/template/src/views/guide/index.vue +36 -0
  258. package/template/src/views/guide/steps.js +53 -0
  259. package/template/src/views/icons/element-icons.js +3 -0
  260. package/template/src/views/icons/index.vue +101 -0
  261. package/template/src/views/icons/svg-icons.js +10 -0
  262. package/template/src/views/login/auth-redirect.vue +15 -0
  263. package/template/src/views/login/components/SocialSignin.vue +72 -0
  264. package/template/src/views/login/index.vue +324 -0
  265. package/template/src/views/nested/menu1/index.vue +7 -0
  266. package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
  267. package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
  268. package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
  269. package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
  270. package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
  271. package/template/src/views/nested/menu2/index.vue +5 -0
  272. package/template/src/views/pdf/content.js +58 -0
  273. package/template/src/views/pdf/download.vue +201 -0
  274. package/template/src/views/pdf/index.vue +13 -0
  275. package/template/src/views/permission/components/SwitchRoles.vue +32 -0
  276. package/template/src/views/permission/directive.vue +111 -0
  277. package/template/src/views/permission/page.vue +19 -0
  278. package/template/src/views/permission/role.vue +270 -0
  279. package/template/src/views/profile/components/Account.vue +38 -0
  280. package/template/src/views/profile/components/Activity.vue +185 -0
  281. package/template/src/views/profile/components/Timeline.vue +43 -0
  282. package/template/src/views/profile/components/UserCard.vue +134 -0
  283. package/template/src/views/profile/index.vue +68 -0
  284. package/template/src/views/qiniu/upload.vue +41 -0
  285. package/template/src/views/redirect/index.vue +12 -0
  286. package/template/src/views/tab/components/TabPane.vue +103 -0
  287. package/template/src/views/tab/index.vue +57 -0
  288. package/template/src/views/table/complex-table.vue +379 -0
  289. package/template/src/views/table/drag-table.vue +153 -0
  290. package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
  291. package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
  292. package/template/src/views/table/dynamic-table/index.vue +24 -0
  293. package/template/src/views/table/inline-edit-table.vue +149 -0
  294. package/template/src/views/theme/index.vue +120 -0
  295. package/template/src/views/zip/index.vue +77 -0
  296. package/template/tests/unit/.eslintrc.js +5 -0
  297. package/template/tests/unit/components/Hamburger.spec.js +18 -0
  298. package/template/tests/unit/components/SvgIcon.spec.js +22 -0
  299. package/template/tests/unit/utils/formatTime.spec.js +29 -0
  300. package/template/tests/unit/utils/param2Obj.spec.js +14 -0
  301. package/template/tests/unit/utils/parseTime.spec.js +37 -0
  302. package/template/tests/unit/utils/validate.spec.js +28 -0
  303. package/template/vue.config.js +124 -0
@@ -0,0 +1,360 @@
1
+ <template>
2
+ <div :class="computedClasses" class="material-input__component">
3
+ <div :class="{iconClass:icon}">
4
+ <i v-if="icon" :class="['el-icon-' + icon]" class="el-input__icon material-input__icon" />
5
+ <input
6
+ v-if="type === 'email'"
7
+ v-model="currentValue"
8
+ :name="name"
9
+ :placeholder="fillPlaceHolder"
10
+ :readonly="readonly"
11
+ :disabled="disabled"
12
+ :autocomplete="autoComplete"
13
+ :required="required"
14
+ type="email"
15
+ class="material-input"
16
+ @focus="handleMdFocus"
17
+ @blur="handleMdBlur"
18
+ @input="handleModelInput"
19
+ >
20
+ <input
21
+ v-if="type === 'url'"
22
+ v-model="currentValue"
23
+ :name="name"
24
+ :placeholder="fillPlaceHolder"
25
+ :readonly="readonly"
26
+ :disabled="disabled"
27
+ :autocomplete="autoComplete"
28
+ :required="required"
29
+ type="url"
30
+ class="material-input"
31
+ @focus="handleMdFocus"
32
+ @blur="handleMdBlur"
33
+ @input="handleModelInput"
34
+ >
35
+ <input
36
+ v-if="type === 'number'"
37
+ v-model="currentValue"
38
+ :name="name"
39
+ :placeholder="fillPlaceHolder"
40
+ :step="step"
41
+ :readonly="readonly"
42
+ :disabled="disabled"
43
+ :autocomplete="autoComplete"
44
+ :max="max"
45
+ :min="min"
46
+ :minlength="minlength"
47
+ :maxlength="maxlength"
48
+ :required="required"
49
+ type="number"
50
+ class="material-input"
51
+ @focus="handleMdFocus"
52
+ @blur="handleMdBlur"
53
+ @input="handleModelInput"
54
+ >
55
+ <input
56
+ v-if="type === 'password'"
57
+ v-model="currentValue"
58
+ :name="name"
59
+ :placeholder="fillPlaceHolder"
60
+ :readonly="readonly"
61
+ :disabled="disabled"
62
+ :autocomplete="autoComplete"
63
+ :max="max"
64
+ :min="min"
65
+ :required="required"
66
+ type="password"
67
+ class="material-input"
68
+ @focus="handleMdFocus"
69
+ @blur="handleMdBlur"
70
+ @input="handleModelInput"
71
+ >
72
+ <input
73
+ v-if="type === 'tel'"
74
+ v-model="currentValue"
75
+ :name="name"
76
+ :placeholder="fillPlaceHolder"
77
+ :readonly="readonly"
78
+ :disabled="disabled"
79
+ :autocomplete="autoComplete"
80
+ :required="required"
81
+ type="tel"
82
+ class="material-input"
83
+ @focus="handleMdFocus"
84
+ @blur="handleMdBlur"
85
+ @input="handleModelInput"
86
+ >
87
+ <input
88
+ v-if="type === 'text'"
89
+ v-model="currentValue"
90
+ :name="name"
91
+ :placeholder="fillPlaceHolder"
92
+ :readonly="readonly"
93
+ :disabled="disabled"
94
+ :autocomplete="autoComplete"
95
+ :minlength="minlength"
96
+ :maxlength="maxlength"
97
+ :required="required"
98
+ type="text"
99
+ class="material-input"
100
+ @focus="handleMdFocus"
101
+ @blur="handleMdBlur"
102
+ @input="handleModelInput"
103
+ >
104
+ <span class="material-input-bar" />
105
+ <label class="material-label">
106
+ <slot />
107
+ </label>
108
+ </div>
109
+ </div>
110
+ </template>
111
+
112
+ <script>
113
+ // source:https://github.com/wemake-services/vue-material-input/blob/master/src/components/MaterialInput.vue
114
+
115
+ export default {
116
+ name: 'MdInput',
117
+ props: {
118
+ /* eslint-disable */
119
+ icon: String,
120
+ name: String,
121
+ type: {
122
+ type: String,
123
+ default: 'text'
124
+ },
125
+ value: [String, Number],
126
+ placeholder: String,
127
+ readonly: Boolean,
128
+ disabled: Boolean,
129
+ min: String,
130
+ max: String,
131
+ step: String,
132
+ minlength: Number,
133
+ maxlength: Number,
134
+ required: {
135
+ type: Boolean,
136
+ default: true
137
+ },
138
+ autoComplete: {
139
+ type: String,
140
+ default: 'off'
141
+ },
142
+ validateEvent: {
143
+ type: Boolean,
144
+ default: true
145
+ }
146
+ },
147
+ data() {
148
+ return {
149
+ currentValue: this.value,
150
+ focus: false,
151
+ fillPlaceHolder: null
152
+ }
153
+ },
154
+ computed: {
155
+ computedClasses() {
156
+ return {
157
+ 'material--active': this.focus,
158
+ 'material--disabled': this.disabled,
159
+ 'material--raised': Boolean(this.focus || this.currentValue) // has value
160
+ }
161
+ }
162
+ },
163
+ watch: {
164
+ value(newValue) {
165
+ this.currentValue = newValue
166
+ }
167
+ },
168
+ methods: {
169
+ handleModelInput(event) {
170
+ const value = event.target.value
171
+ this.$emit('input', value)
172
+ if (this.$parent.$options.componentName === 'ElFormItem') {
173
+ if (this.validateEvent) {
174
+ this.$parent.$emit('el.form.change', [value])
175
+ }
176
+ }
177
+ this.$emit('change', value)
178
+ },
179
+ handleMdFocus(event) {
180
+ this.focus = true
181
+ this.$emit('focus', event)
182
+ if (this.placeholder && this.placeholder !== '') {
183
+ this.fillPlaceHolder = this.placeholder
184
+ }
185
+ },
186
+ handleMdBlur(event) {
187
+ this.focus = false
188
+ this.$emit('blur', event)
189
+ this.fillPlaceHolder = null
190
+ if (this.$parent.$options.componentName === 'ElFormItem') {
191
+ if (this.validateEvent) {
192
+ this.$parent.$emit('el.form.blur', [this.currentValue])
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ </script>
199
+
200
+ <style lang="scss" scoped>
201
+ // Fonts:
202
+ $font-size-base: 16px;
203
+ $font-size-small: 18px;
204
+ $font-size-smallest: 12px;
205
+ $font-weight-normal: normal;
206
+ $font-weight-bold: bold;
207
+ $apixel: 1px;
208
+ // Utils
209
+ $spacer: 12px;
210
+ $transition: 0.2s ease all;
211
+ $index: 0px;
212
+ $index-has-icon: 30px;
213
+ // Theme:
214
+ $color-white: white;
215
+ $color-grey: #9E9E9E;
216
+ $color-grey-light: #E0E0E0;
217
+ $color-blue: #2196F3;
218
+ $color-red: #F44336;
219
+ $color-black: black;
220
+ // Base clases:
221
+ %base-bar-pseudo {
222
+ content: '';
223
+ height: 1px;
224
+ width: 0;
225
+ bottom: 0;
226
+ position: absolute;
227
+ transition: $transition;
228
+ }
229
+
230
+ // Mixins:
231
+ @mixin slided-top() {
232
+ top: - ($font-size-base + $spacer);
233
+ left: 0;
234
+ font-size: $font-size-base;
235
+ font-weight: $font-weight-bold;
236
+ }
237
+
238
+ // Component:
239
+ .material-input__component {
240
+ margin-top: 36px;
241
+ position: relative;
242
+ * {
243
+ box-sizing: border-box;
244
+ }
245
+ .iconClass {
246
+ .material-input__icon {
247
+ position: absolute;
248
+ left: 0;
249
+ line-height: $font-size-base;
250
+ color: $color-blue;
251
+ top: $spacer;
252
+ width: $index-has-icon;
253
+ height: $font-size-base;
254
+ font-size: $font-size-base;
255
+ font-weight: $font-weight-normal;
256
+ pointer-events: none;
257
+ }
258
+ .material-label {
259
+ left: $index-has-icon;
260
+ }
261
+ .material-input {
262
+ text-indent: $index-has-icon;
263
+ }
264
+ }
265
+ .material-input {
266
+ font-size: $font-size-base;
267
+ padding: $spacer $spacer $spacer - $apixel * 10 $spacer / 2;
268
+ display: block;
269
+ width: 100%;
270
+ border: none;
271
+ line-height: 1;
272
+ border-radius: 0;
273
+ &:focus {
274
+ outline: none;
275
+ border: none;
276
+ border-bottom: 1px solid transparent; // fixes the height issue
277
+ }
278
+ }
279
+ .material-label {
280
+ font-weight: $font-weight-normal;
281
+ position: absolute;
282
+ pointer-events: none;
283
+ left: $index;
284
+ top: 0;
285
+ transition: $transition;
286
+ font-size: $font-size-small;
287
+ }
288
+ .material-input-bar {
289
+ position: relative;
290
+ display: block;
291
+ width: 100%;
292
+ &:before {
293
+ @extend %base-bar-pseudo;
294
+ left: 50%;
295
+ }
296
+ &:after {
297
+ @extend %base-bar-pseudo;
298
+ right: 50%;
299
+ }
300
+ }
301
+ // Disabled state:
302
+ &.material--disabled {
303
+ .material-input {
304
+ border-bottom-style: dashed;
305
+ }
306
+ }
307
+ // Raised state:
308
+ &.material--raised {
309
+ .material-label {
310
+ @include slided-top();
311
+ }
312
+ }
313
+ // Active state:
314
+ &.material--active {
315
+ .material-input-bar {
316
+ &:before,
317
+ &:after {
318
+ width: 50%;
319
+ }
320
+ }
321
+ }
322
+ }
323
+
324
+ .material-input__component {
325
+ background: $color-white;
326
+ .material-input {
327
+ background: none;
328
+ color: $color-black;
329
+ text-indent: $index;
330
+ border-bottom: 1px solid $color-grey-light;
331
+ }
332
+ .material-label {
333
+ color: $color-grey;
334
+ }
335
+ .material-input-bar {
336
+ &:before,
337
+ &:after {
338
+ background: $color-blue;
339
+ }
340
+ }
341
+ // Active state:
342
+ &.material--active {
343
+ .material-label {
344
+ color: $color-blue;
345
+ }
346
+ }
347
+ // Errors:
348
+ &.material--has-errors {
349
+ &.material--active .material-label {
350
+ color: $color-red;
351
+ }
352
+ .material-input-bar {
353
+ &:before,
354
+ &:after {
355
+ background: transparent;
356
+ }
357
+ }
358
+ }
359
+ }
360
+ </style>
@@ -0,0 +1,31 @@
1
+ // doc: https://nhnent.github.io/tui.editor/api/latest/ToastUIEditor.html#ToastUIEditor
2
+ export default {
3
+ minHeight: '200px',
4
+ previewStyle: 'vertical',
5
+ useCommandShortcut: true,
6
+ useDefaultHTMLSanitizer: true,
7
+ usageStatistics: false,
8
+ hideModeSwitch: false,
9
+ toolbarItems: [
10
+ 'heading',
11
+ 'bold',
12
+ 'italic',
13
+ 'strike',
14
+ 'divider',
15
+ 'hr',
16
+ 'quote',
17
+ 'divider',
18
+ 'ul',
19
+ 'ol',
20
+ 'task',
21
+ 'indent',
22
+ 'outdent',
23
+ 'divider',
24
+ 'table',
25
+ 'image',
26
+ 'link',
27
+ 'divider',
28
+ 'code',
29
+ 'codeblock'
30
+ ]
31
+ }
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <div :id="id" />
3
+ </template>
4
+
5
+ <script>
6
+ // deps for editor
7
+ import 'codemirror/lib/codemirror.css' // codemirror
8
+ import 'tui-editor/dist/tui-editor.css' // editor ui
9
+ import 'tui-editor/dist/tui-editor-contents.css' // editor content
10
+
11
+ import Editor from 'tui-editor'
12
+ import defaultOptions from './default-options'
13
+
14
+ export default {
15
+ name: 'MarkdownEditor',
16
+ props: {
17
+ value: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+ id: {
22
+ type: String,
23
+ required: false,
24
+ default() {
25
+ return 'markdown-editor-' + +new Date() + ((Math.random() * 1000).toFixed(0) + '')
26
+ }
27
+ },
28
+ options: {
29
+ type: Object,
30
+ default() {
31
+ return defaultOptions
32
+ }
33
+ },
34
+ mode: {
35
+ type: String,
36
+ default: 'markdown'
37
+ },
38
+ height: {
39
+ type: String,
40
+ required: false,
41
+ default: '300px'
42
+ },
43
+ language: {
44
+ type: String,
45
+ required: false,
46
+ default: 'en_US' // https://github.com/nhnent/tui.editor/tree/master/src/js/langs
47
+ }
48
+ },
49
+ data() {
50
+ return {
51
+ editor: null
52
+ }
53
+ },
54
+ computed: {
55
+ editorOptions() {
56
+ const options = Object.assign({}, defaultOptions, this.options)
57
+ options.initialEditType = this.mode
58
+ options.height = this.height
59
+ options.language = this.language
60
+ return options
61
+ }
62
+ },
63
+ watch: {
64
+ value(newValue, preValue) {
65
+ if (newValue !== preValue && newValue !== this.editor.getValue()) {
66
+ this.editor.setValue(newValue)
67
+ }
68
+ },
69
+ language(val) {
70
+ this.destroyEditor()
71
+ this.initEditor()
72
+ },
73
+ height(newValue) {
74
+ this.editor.height(newValue)
75
+ },
76
+ mode(newValue) {
77
+ this.editor.changeMode(newValue)
78
+ }
79
+ },
80
+ mounted() {
81
+ this.initEditor()
82
+ },
83
+ destroyed() {
84
+ this.destroyEditor()
85
+ },
86
+ methods: {
87
+ initEditor() {
88
+ this.editor = new Editor({
89
+ el: document.getElementById(this.id),
90
+ ...this.editorOptions
91
+ })
92
+ if (this.value) {
93
+ this.editor.setValue(this.value)
94
+ }
95
+ this.editor.on('change', () => {
96
+ this.$emit('input', this.editor.getValue())
97
+ })
98
+ },
99
+ destroyEditor() {
100
+ if (!this.editor) return
101
+ this.editor.off('change')
102
+ this.editor.remove()
103
+ },
104
+ setValue(value) {
105
+ this.editor.setValue(value)
106
+ },
107
+ getValue() {
108
+ return this.editor.getValue()
109
+ },
110
+ setHtml(value) {
111
+ this.editor.setHtml(value)
112
+ },
113
+ getHtml() {
114
+ return this.editor.getHtml()
115
+ }
116
+ }
117
+ }
118
+ </script>
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <div :class="{'hidden':hidden}" class="pagination-container">
3
+ <el-pagination
4
+ :background="background"
5
+ :current-page.sync="currentPage"
6
+ :page-size.sync="pageSize"
7
+ :layout="layout"
8
+ :page-sizes="pageSizes"
9
+ :total="total"
10
+ v-bind="$attrs"
11
+ @size-change="handleSizeChange"
12
+ @current-change="handleCurrentChange"
13
+ />
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import { scrollTo } from '@/utils/scroll-to'
19
+
20
+ export default {
21
+ name: 'Pagination',
22
+ props: {
23
+ total: {
24
+ required: true,
25
+ type: Number
26
+ },
27
+ page: {
28
+ type: Number,
29
+ default: 1
30
+ },
31
+ limit: {
32
+ type: Number,
33
+ default: 20
34
+ },
35
+ pageSizes: {
36
+ type: Array,
37
+ default() {
38
+ return [10, 20, 30, 50]
39
+ }
40
+ },
41
+ layout: {
42
+ type: String,
43
+ default: 'total, sizes, prev, pager, next, jumper'
44
+ },
45
+ background: {
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ autoScroll: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ hidden: {
54
+ type: Boolean,
55
+ default: false
56
+ }
57
+ },
58
+ computed: {
59
+ currentPage: {
60
+ get() {
61
+ return this.page
62
+ },
63
+ set(val) {
64
+ this.$emit('update:page', val)
65
+ }
66
+ },
67
+ pageSize: {
68
+ get() {
69
+ return this.limit
70
+ },
71
+ set(val) {
72
+ this.$emit('update:limit', val)
73
+ }
74
+ }
75
+ },
76
+ methods: {
77
+ handleSizeChange(val) {
78
+ this.$emit('pagination', { page: this.currentPage, limit: val })
79
+ if (this.autoScroll) {
80
+ scrollTo(0, 800)
81
+ }
82
+ },
83
+ handleCurrentChange(val) {
84
+ this.$emit('pagination', { page: val, limit: this.pageSize })
85
+ if (this.autoScroll) {
86
+ scrollTo(0, 800)
87
+ }
88
+ }
89
+ }
90
+ }
91
+ </script>
92
+
93
+ <style scoped>
94
+ .pagination-container {
95
+ background: #fff;
96
+ padding: 32px 16px;
97
+ }
98
+ .pagination-container.hidden {
99
+ display: none;
100
+ }
101
+ </style>