vue-devui 1.0.0-alpha.4 → 1.0.0-beta.10

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 (346) hide show
  1. package/accordion/index.d.ts +7 -0
  2. package/accordion/index.es.js +237 -1
  3. package/accordion/index.umd.js +1 -1
  4. package/accordion/style.css +1 -1
  5. package/alert/index.d.ts +7 -0
  6. package/alert/index.es.js +175 -1
  7. package/alert/index.umd.js +1 -1
  8. package/alert/style.css +1 -1
  9. package/anchor/index.d.ts +7 -0
  10. package/anchor/index.es.js +263 -1
  11. package/anchor/index.umd.js +1 -1
  12. package/avatar/index.d.ts +7 -0
  13. package/avatar/index.es.js +301 -1
  14. package/avatar/index.umd.js +1 -1
  15. package/back-top/index.d.ts +7 -0
  16. package/back-top/index.es.js +128 -0
  17. package/back-top/index.umd.js +1 -0
  18. package/back-top/package.json +7 -0
  19. package/back-top/style.css +1 -0
  20. package/badge/index.d.ts +7 -0
  21. package/badge/index.es.js +95 -1
  22. package/badge/index.umd.js +1 -1
  23. package/breadcrumb/index.d.ts +7 -0
  24. package/breadcrumb/index.es.js +127 -1
  25. package/breadcrumb/index.umd.js +1 -1
  26. package/breadcrumb/style.css +1 -1
  27. package/button/index.d.ts +7 -0
  28. package/button/index.es.js +190 -1
  29. package/button/index.umd.js +1 -1
  30. package/card/index.d.ts +7 -0
  31. package/card/index.es.js +61 -1
  32. package/card/index.umd.js +1 -1
  33. package/carousel/index.d.ts +7 -0
  34. package/carousel/index.es.js +329 -1
  35. package/carousel/index.umd.js +1 -1
  36. package/cascader/index.d.ts +7 -0
  37. package/cascader/index.es.js +1343 -1
  38. package/cascader/index.umd.js +1 -1
  39. package/cascader/style.css +1 -1
  40. package/checkbox/index.d.ts +7 -0
  41. package/checkbox/index.es.js +377 -1
  42. package/checkbox/index.umd.js +1 -1
  43. package/comment/index.d.ts +7 -0
  44. package/comment/index.es.js +85 -0
  45. package/comment/index.umd.js +1 -0
  46. package/comment/package.json +7 -0
  47. package/comment/style.css +1 -0
  48. package/countdown/index.d.ts +7 -0
  49. package/countdown/index.es.js +176 -0
  50. package/countdown/index.umd.js +1 -0
  51. package/countdown/package.json +7 -0
  52. package/countdown/style.css +1 -0
  53. package/date-picker/index.d.ts +7 -0
  54. package/date-picker/index.es.js +1172 -1
  55. package/date-picker/index.umd.js +1 -1
  56. package/date-picker/style.css +1 -1
  57. package/dragdrop/index.d.ts +7 -0
  58. package/dragdrop/index.es.js +32 -0
  59. package/dragdrop/index.umd.js +1 -0
  60. package/dragdrop/package.json +7 -0
  61. package/drawer/index.d.ts +7 -0
  62. package/drawer/index.es.js +288 -0
  63. package/drawer/index.umd.js +1 -0
  64. package/drawer/package.json +7 -0
  65. package/drawer/style.css +1 -0
  66. package/dropdown/index.d.ts +7 -0
  67. package/dropdown/index.es.js +527 -0
  68. package/dropdown/index.umd.js +1 -0
  69. package/dropdown/package.json +7 -0
  70. package/dropdown/style.css +1 -0
  71. package/editable-select/index.d.ts +7 -0
  72. package/editable-select/index.es.js +5793 -1
  73. package/editable-select/index.umd.js +27 -1
  74. package/editable-select/style.css +1 -1
  75. package/form/index.d.ts +7 -0
  76. package/form/index.es.js +2244 -0
  77. package/form/index.umd.js +1 -0
  78. package/form/package.json +7 -0
  79. package/form/style.css +1 -0
  80. package/fullscreen/index.d.ts +7 -0
  81. package/fullscreen/index.es.js +163 -1
  82. package/fullscreen/index.umd.js +1 -1
  83. package/gantt/index.d.ts +7 -0
  84. package/gantt/index.es.js +535 -0
  85. package/gantt/index.umd.js +1 -0
  86. package/gantt/package.json +7 -0
  87. package/gantt/style.css +1 -0
  88. package/grid/index.d.ts +7 -0
  89. package/grid/index.es.js +269 -0
  90. package/grid/index.umd.js +1 -0
  91. package/grid/package.json +7 -0
  92. package/grid/style.css +1 -0
  93. package/icon/index.d.ts +7 -0
  94. package/icon/index.es.js +75 -1
  95. package/icon/index.umd.js +1 -1
  96. package/image-preview/index.d.ts +7 -0
  97. package/image-preview/index.es.js +480 -1
  98. package/image-preview/index.umd.js +1 -1
  99. package/image-preview/style.css +1 -1
  100. package/index.d.ts +7 -0
  101. package/input/index.d.ts +7 -0
  102. package/input/index.es.js +190 -1
  103. package/input/index.umd.js +1 -1
  104. package/input-icon/index.d.ts +7 -0
  105. package/input-icon/index.es.js +332 -0
  106. package/input-icon/index.umd.js +1 -0
  107. package/input-icon/package.json +7 -0
  108. package/input-icon/style.css +1 -0
  109. package/input-number/index.d.ts +7 -0
  110. package/input-number/index.es.js +240 -1
  111. package/input-number/index.umd.js +1 -1
  112. package/input-number/style.css +1 -1
  113. package/layout/index.d.ts +7 -0
  114. package/layout/index.es.js +100 -0
  115. package/layout/index.umd.js +1 -0
  116. package/layout/package.json +7 -0
  117. package/layout/style.css +1 -0
  118. package/loading/index.d.ts +7 -0
  119. package/loading/index.es.js +256 -1
  120. package/loading/index.umd.js +1 -1
  121. package/modal/index.d.ts +7 -0
  122. package/modal/index.es.js +1027 -1
  123. package/modal/index.umd.js +1 -1
  124. package/modal/style.css +1 -1
  125. package/nav-sprite/index.d.ts +7 -0
  126. package/nav-sprite/index.es.js +742 -0
  127. package/nav-sprite/index.umd.js +1 -0
  128. package/nav-sprite/package.json +7 -0
  129. package/nuxt/components/Accordion.js +3 -0
  130. package/nuxt/components/Alert.js +3 -0
  131. package/nuxt/components/Anchor.js +3 -0
  132. package/nuxt/components/Aside.js +3 -0
  133. package/nuxt/components/Avatar.js +3 -0
  134. package/nuxt/components/BackTop.js +3 -0
  135. package/nuxt/components/Badge.js +3 -0
  136. package/nuxt/components/Breadcrumb.js +3 -0
  137. package/nuxt/components/Button.js +3 -0
  138. package/nuxt/components/Card.js +3 -0
  139. package/nuxt/components/Carousel.js +3 -0
  140. package/nuxt/components/Cascader.js +3 -0
  141. package/nuxt/components/Checkbox.js +3 -0
  142. package/nuxt/components/Col.js +3 -0
  143. package/nuxt/components/Column.js +3 -0
  144. package/nuxt/components/Comment.js +3 -0
  145. package/nuxt/components/Content.js +3 -0
  146. package/nuxt/components/Countdown.js +3 -0
  147. package/nuxt/components/DatePicker.js +3 -0
  148. package/nuxt/components/Drawer.js +3 -0
  149. package/nuxt/components/Dropdown.js +3 -0
  150. package/nuxt/components/EditableSelect.js +3 -0
  151. package/nuxt/components/FixedOverlay.js +3 -0
  152. package/nuxt/components/FlexibleOverlay.js +3 -0
  153. package/nuxt/components/Footer.js +3 -0
  154. package/nuxt/components/Form.js +3 -0
  155. package/nuxt/components/FormControl.js +3 -0
  156. package/nuxt/components/FormItem.js +3 -0
  157. package/nuxt/components/FormLabel.js +3 -0
  158. package/nuxt/components/FormOperation.js +3 -0
  159. package/nuxt/components/Fullscreen.js +3 -0
  160. package/nuxt/components/Gantt.js +3 -0
  161. package/nuxt/components/Header.js +3 -0
  162. package/nuxt/components/Icon.js +2 -0
  163. package/nuxt/components/ImagePreviewService.js +3 -0
  164. package/nuxt/components/Input.js +3 -0
  165. package/nuxt/components/InputIcon.js +3 -0
  166. package/nuxt/components/InputNumber.js +3 -0
  167. package/nuxt/components/Layout.js +3 -0
  168. package/nuxt/components/Loading.js +3 -0
  169. package/nuxt/components/LoadingService.js +3 -0
  170. package/nuxt/components/Modal.js +3 -0
  171. package/nuxt/components/MultiUpload.js +3 -0
  172. package/nuxt/components/NavSprite.js +2 -0
  173. package/nuxt/components/Pagination.js +3 -0
  174. package/nuxt/components/Panel.js +3 -0
  175. package/nuxt/components/Popover.js +3 -0
  176. package/nuxt/components/Progress.js +3 -0
  177. package/nuxt/components/QuadrantDiagram.js +3 -0
  178. package/nuxt/components/Radio.js +3 -0
  179. package/nuxt/components/RadioGroup.js +3 -0
  180. package/nuxt/components/Rate.js +3 -0
  181. package/nuxt/components/ReadTip.js +3 -0
  182. package/nuxt/components/Result.js +3 -0
  183. package/nuxt/components/Row.js +3 -0
  184. package/nuxt/components/Search.js +3 -0
  185. package/nuxt/components/Select.js +3 -0
  186. package/nuxt/components/Skeleton.js +3 -0
  187. package/nuxt/components/SkeletonItem.js +3 -0
  188. package/nuxt/components/Slider.js +3 -0
  189. package/nuxt/components/Splitter.js +3 -0
  190. package/nuxt/components/Statistic.js +3 -0
  191. package/nuxt/components/Status.js +3 -0
  192. package/nuxt/components/StepsGuide.js +3 -0
  193. package/nuxt/components/StickSlider.js +3 -0
  194. package/nuxt/components/Sticky.js +2 -0
  195. package/nuxt/components/Switch.js +3 -0
  196. package/nuxt/components/Table.js +3 -0
  197. package/nuxt/components/Tabs.js +3 -0
  198. package/nuxt/components/Tag.js +3 -0
  199. package/nuxt/components/TagInput.js +3 -0
  200. package/nuxt/components/Textarea.js +3 -0
  201. package/nuxt/components/TimeAxis.js +3 -0
  202. package/nuxt/components/TimeAxisItem.js +3 -0
  203. package/nuxt/components/TimePicker.js +3 -0
  204. package/nuxt/components/Toast.js +3 -0
  205. package/nuxt/components/ToastService.js +3 -0
  206. package/nuxt/components/Tooltip.js +3 -0
  207. package/nuxt/components/Transfer.js +3 -0
  208. package/nuxt/components/Tree.js +3 -0
  209. package/nuxt/components/TreeSelect.js +3 -0
  210. package/nuxt/components/Upload.js +3 -0
  211. package/nuxt/components/buttonProps.js +3 -0
  212. package/nuxt/index.js +13 -0
  213. package/overlay/index.d.ts +7 -0
  214. package/overlay/index.es.js +368 -1
  215. package/overlay/index.umd.js +1 -1
  216. package/overlay/style.css +1 -1
  217. package/package.json +8 -33
  218. package/pagination/index.d.ts +7 -0
  219. package/pagination/index.es.js +642 -1
  220. package/pagination/index.umd.js +1 -1
  221. package/panel/index.d.ts +7 -0
  222. package/panel/index.es.js +205 -1
  223. package/panel/index.umd.js +1 -1
  224. package/panel/style.css +1 -1
  225. package/popover/index.d.ts +7 -0
  226. package/popover/index.es.js +236 -1
  227. package/popover/index.umd.js +1 -1
  228. package/popover/style.css +1 -1
  229. package/progress/index.d.ts +7 -0
  230. package/progress/index.es.js +153 -1
  231. package/progress/index.umd.js +3 -1
  232. package/quadrant-diagram/index.d.ts +7 -0
  233. package/quadrant-diagram/index.es.js +489 -1
  234. package/quadrant-diagram/index.umd.js +1 -1
  235. package/radio/index.d.ts +7 -0
  236. package/radio/index.es.js +225 -1
  237. package/radio/index.umd.js +1 -1
  238. package/rate/index.d.ts +7 -0
  239. package/rate/index.es.js +220 -1
  240. package/rate/index.umd.js +1 -1
  241. package/read-tip/index.d.ts +7 -0
  242. package/read-tip/index.es.js +258 -0
  243. package/read-tip/index.umd.js +1 -0
  244. package/read-tip/package.json +7 -0
  245. package/read-tip/style.css +1 -0
  246. package/result/index.d.ts +7 -0
  247. package/result/index.es.js +119 -0
  248. package/result/index.umd.js +1 -0
  249. package/result/package.json +7 -0
  250. package/result/style.css +1 -0
  251. package/ripple/index.d.ts +7 -0
  252. package/ripple/index.es.js +181 -1
  253. package/ripple/index.umd.js +1 -1
  254. package/search/index.d.ts +7 -0
  255. package/search/index.es.js +543 -1
  256. package/search/index.umd.js +1 -1
  257. package/select/index.d.ts +7 -0
  258. package/select/index.es.js +706 -1
  259. package/select/index.umd.js +1 -1
  260. package/skeleton/index.d.ts +7 -0
  261. package/skeleton/index.es.js +297 -1
  262. package/skeleton/index.umd.js +1 -1
  263. package/skeleton/style.css +1 -1
  264. package/slider/index.d.ts +7 -0
  265. package/slider/index.es.js +199 -1
  266. package/slider/index.umd.js +1 -1
  267. package/slider/style.css +1 -1
  268. package/splitter/index.d.ts +7 -0
  269. package/splitter/index.es.js +636 -1
  270. package/splitter/index.umd.js +1 -1
  271. package/statistic/index.d.ts +7 -0
  272. package/statistic/index.es.js +280 -0
  273. package/statistic/index.umd.js +1 -0
  274. package/statistic/package.json +7 -0
  275. package/statistic/style.css +1 -0
  276. package/status/index.d.ts +7 -0
  277. package/status/index.es.js +42 -1
  278. package/status/index.umd.js +1 -1
  279. package/steps-guide/index.d.ts +7 -0
  280. package/steps-guide/index.es.js +239 -1
  281. package/steps-guide/index.umd.js +1 -1
  282. package/steps-guide/style.css +1 -1
  283. package/sticky/index.d.ts +7 -0
  284. package/sticky/index.es.js +197 -1
  285. package/sticky/index.umd.js +1 -1
  286. package/style.css +1 -1
  287. package/switch/index.d.ts +7 -0
  288. package/switch/index.es.js +100 -1
  289. package/switch/index.umd.js +1 -1
  290. package/switch/style.css +1 -1
  291. package/table/index.d.ts +7 -0
  292. package/table/index.es.js +1626 -1
  293. package/table/index.umd.js +1 -1
  294. package/table/style.css +1 -1
  295. package/tabs/index.d.ts +7 -0
  296. package/tabs/index.es.js +195 -1
  297. package/tabs/index.umd.js +1 -1
  298. package/tabs/style.css +1 -1
  299. package/tag/index.d.ts +7 -0
  300. package/tag/index.es.js +131 -0
  301. package/tag/index.umd.js +1 -0
  302. package/tag/package.json +7 -0
  303. package/tag/style.css +1 -0
  304. package/tag-input/index.d.ts +7 -0
  305. package/tag-input/index.es.js +329 -1
  306. package/tag-input/index.umd.js +1 -1
  307. package/textarea/index.d.ts +7 -0
  308. package/textarea/index.es.js +132 -0
  309. package/textarea/index.umd.js +1 -0
  310. package/textarea/package.json +7 -0
  311. package/textarea/style.css +1 -0
  312. package/time-axis/index.d.ts +7 -0
  313. package/time-axis/index.es.js +299 -0
  314. package/time-axis/index.umd.js +1 -0
  315. package/time-axis/package.json +7 -0
  316. package/time-axis/style.css +1 -0
  317. package/time-picker/index.d.ts +7 -0
  318. package/time-picker/index.es.js +1053 -1
  319. package/time-picker/index.umd.js +1 -1
  320. package/time-picker/style.css +1 -1
  321. package/toast/index.d.ts +7 -0
  322. package/toast/index.es.js +2060 -1
  323. package/toast/index.umd.js +1 -1
  324. package/toast/style.css +1 -1
  325. package/tooltip/index.d.ts +7 -0
  326. package/tooltip/index.es.js +171 -1
  327. package/tooltip/index.umd.js +1 -1
  328. package/transfer/index.d.ts +7 -0
  329. package/transfer/index.es.js +1725 -1
  330. package/transfer/index.umd.js +1 -1
  331. package/transfer/style.css +1 -1
  332. package/tree/index.d.ts +7 -0
  333. package/tree/index.es.js +907 -1
  334. package/tree/index.umd.js +1 -1
  335. package/tree/style.css +1 -1
  336. package/tree-select/index.d.ts +7 -0
  337. package/tree-select/index.es.js +528 -0
  338. package/tree-select/index.umd.js +1 -0
  339. package/tree-select/package.json +7 -0
  340. package/tree-select/style.css +1 -0
  341. package/upload/index.d.ts +7 -0
  342. package/upload/index.es.js +3179 -1
  343. package/upload/index.umd.js +1 -1
  344. package/upload/style.css +1 -1
  345. package/vue-devui.es.js +27755 -1
  346. package/vue-devui.umd.js +29 -1
@@ -1 +1,543 @@
1
- import{computed as e,ref as t,watch as n,defineComponent as o,createVNode as a,withDirectives as i,mergeProps as u,resolveDirective as r,resolveComponent as l}from"vue";const s={size:{type:String,default:""},placeholder:{type:String,default:"请输入关键字"},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},delay:{type:Number,default:300},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},isKeyupSearch:{type:Boolean,default:!1},iconPosition:{type:String,default:"right"},noBorder:{type:Boolean,default:!1},cssClass:{type:String,default:""},modelValue:{type:String,default:""},searchFn:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}},c={lg:"lg",sm:"sm"},d={right:"right",left:"left"};var p="object"==typeof global&&global&&global.Object===Object&&global,v="object"==typeof self&&self&&self.Object===Object&&self,f=p||v||Function("return this")(),y=f.Symbol,h=Object.prototype,m=h.hasOwnProperty,g=h.toString,b=y?y.toStringTag:void 0;var w=Object.prototype.toString;var S=y?y.toStringTag:void 0;function F(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":S&&S in Object(e)?function(e){var t=m.call(e,b),n=e[b];try{e[b]=void 0;var o=!0}catch(i){}var a=g.call(e);return o&&(t?e[b]=n:delete e[b]),a}(e):function(e){return w.call(e)}(e)}var _=/\s/;var C=/^\s+/;function I(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&_.test(e.charAt(t)););return t}(e)+1).replace(C,""):e}function x(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var T=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,B=/^0o[0-7]+$/i,k=parseInt;function z(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==F(e)}(e))return NaN;if(x(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=x(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=I(e);var n=j.test(e);return n||B.test(e)?k(e.slice(2),n?2:8):T.test(e)?NaN:+e}var E=function(){return f.Date.now()},N=Math.max,P=Math.min;function K(e,t,n){var o,a,i,u,r,l,s=0,c=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function v(t){var n=o,i=a;return o=a=void 0,s=t,u=e.apply(i,n)}function f(e){return s=e,r=setTimeout(h,t),c?v(e):u}function y(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-s>=i}function h(){var e=E();if(y(e))return m(e);r=setTimeout(h,function(e){var n=t-(e-l);return d?P(n,i-(e-s)):n}(e))}function m(e){return r=void 0,p&&o?v(e):(o=a=void 0,u)}function g(){var e=E(),n=y(e);if(o=arguments,a=this,l=e,n){if(void 0===r)return f(l);if(d)return clearTimeout(r),r=setTimeout(h,t),v(l)}return void 0===r&&(r=setTimeout(h,t)),u}return t=z(t)||0,x(n)&&(c=!!n.leading,i=(d="maxWait"in n)?N(z(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),g.cancel=function(){void 0!==r&&clearTimeout(r),s=0,o=l=a=r=void 0},g.flush=function(){return void 0===r?u:m(E())},g}const O="Enter";var L=o({name:"DInput",directives:{focus:{mounted:function(e,t){t.value&&e.focus()}}},props:{placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},value:{type:String,default:""},"onUpdate:value":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}},emits:["update:value","focus","blur","change","keydown"],setup(o,a){const i=e((()=>`devui-input-${o.size}`)),u=t(!1),r=t("text"),l=e((()=>({error:o.error,[o.cssClass]:!0,[i.value]:""!==o.size}))),s=e((()=>"password"===r.value));n((()=>o.showPassword),(e=>{r.value=e?"password":"text"}),{immediate:!0}),n((()=>o.value),(e=>{e&&e.length>0&&s.value?u.value=!0:u.value=!1}));return{inputCls:l,inputType:r,showPreviewIcon:s,showPwdIcon:u,onInput:e=>{a.emit("update:value",e.target.value)},onFocus:()=>{a.emit("focus")},onBlur:()=>{a.emit("blur")},onChange:e=>{a.emit("change",e.target.value)},onKeydown:e=>{a.emit("keydown",e)},onChangeInputType:()=>{r.value="password"===r.value?"text":"password"}}},render(){const{value:e,showPreviewIcon:t,showPwdIcon:n,inputCls:o,inputType:s,maxLength:c,autoFocus:d,placeholder:p,disabled:v,onInput:f,onFocus:y,onBlur:h,onChange:m,onKeydown:g,onChangeInputType:b}=this;return a("div",{class:"devui-input__wrap"},[i(a("input",u({dinput:!0},{value:e,disabled:v,type:s,maxlength:c,placeholder:p,class:o,onInput:f,onFocus:y,onBlur:h,onChange:m,onKeydown:g}),null),[[r("focus"),d]]),n&&a("div",{class:"devui-input__preview",onClick:b},[a(l("d-icon"),t?{name:"preview",size:"12px",key:1}:{name:"preview-forbidden",size:"12px",key:2},null)])])}}),V=o({name:"DSearch",props:s,emits:["update:modelValue","searchFn"],setup(o,i){const u=(t=>e((()=>({"devui-search":!0,"devui-search__disbaled":t.disabled,"devui-search__no-border":t.noBorder,[`devui-search__${t.size}`]:c[t.size],[`devui-search__${t.iconPosition}`]:d[t.iconPosition]}))))(o),{keywords:r,clearIconShow:s,onClearHandle:p}=((o,a)=>{const i=t("");n((()=>a.modelValue),(e=>{i.value=e}),{immediate:!0});const u=e((()=>i.value.length>0));return{keywords:i,clearIconShow:u,onClearHandle:()=>{i.value="",o.emit("update:modelValue","")}}})(i,o),{onInputKeydown:v,onClickHandle:f,useEmitKeyword:y}=((e,t,n)=>{const o=e=>{if(e.target instanceof HTMLInputElement){const t=e.target.value;a(t)}},a=K((t=>{e.emit("searchFn",t)}),n);return{onInputKeydown:e=>{switch(e.key){case O:o(e)}},useEmitKeyword:a,onClickHandle:()=>{a(t.value)}}})(i,r,o.delay),h=e=>{o.isKeyupSearch&&y(e),r.value=e,i.emit("update:modelValue",e)};return()=>a("div",{class:u.value},["left"===o.iconPosition&&a("div",{class:"devui-search__icon",onClick:f},[a(l("d-icon"),{name:"search",size:"inherit"},null)]),a(L,{size:o.size,disabled:o.disabled,autoFocus:o.autoFocus,value:r.value,maxLength:o.maxLength,placeholder:o.placeholder,cssClass:o.cssClass,onKeydown:v,"onUpdate:value":h},null),s.value&&a("div",{class:"devui-search__clear",onClick:p},[a(l("d-icon"),{name:"close",size:"inherit"},null)]),"right"===o.iconPosition&&a("div",{class:"devui-search__icon",onClick:f},[a(l("d-icon"),{name:"search",size:"inherit"},null)])])}});V.install=function(e){e.component(V.name,V)};var $={title:"Search 搜索框",category:"通用",install(e){e.use(V)}};export{V as Search,$ as default};
1
+ import { computed, ref, watch, defineComponent, inject, createVNode, withDirectives, mergeProps, resolveDirective, resolveComponent } from "vue";
2
+ const searchProps = {
3
+ size: {
4
+ type: String,
5
+ default: ""
6
+ },
7
+ placeholder: {
8
+ type: String,
9
+ default: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57"
10
+ },
11
+ maxLength: {
12
+ type: Number,
13
+ default: Number.MAX_SAFE_INTEGER
14
+ },
15
+ delay: {
16
+ type: Number,
17
+ default: 300
18
+ },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ autoFocus: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ isKeyupSearch: {
28
+ type: Boolean,
29
+ default: false
30
+ },
31
+ iconPosition: {
32
+ type: String,
33
+ default: "right"
34
+ },
35
+ noBorder: {
36
+ type: Boolean,
37
+ default: false
38
+ },
39
+ cssClass: {
40
+ type: String,
41
+ default: ""
42
+ },
43
+ modelValue: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ onSearch: {
48
+ type: Function,
49
+ default: void 0
50
+ },
51
+ "onUpdate:modelValue": {
52
+ type: Function,
53
+ default: void 0
54
+ }
55
+ };
56
+ const SIZE_CLASS = {
57
+ lg: "lg",
58
+ sm: "sm"
59
+ };
60
+ const ICON_POSITION = {
61
+ right: "right",
62
+ left: "left"
63
+ };
64
+ const getRootClass = (props) => {
65
+ return computed(() => ({
66
+ "devui-search": true,
67
+ "devui-search__disbaled": props.disabled,
68
+ "devui-search__no-border": props.noBorder,
69
+ [`devui-search__${props.size}`]: SIZE_CLASS[props.size],
70
+ [`devui-search__${props.iconPosition}`]: ICON_POSITION[props.iconPosition]
71
+ }));
72
+ };
73
+ const keywordsHandles = (ctx, props) => {
74
+ const keywords = ref("");
75
+ watch(() => props.modelValue, (val) => {
76
+ keywords.value = val;
77
+ }, { immediate: true });
78
+ const onClearHandle = () => {
79
+ keywords.value = "";
80
+ ctx.emit("update:modelValue", "");
81
+ };
82
+ const clearIconShow = computed(() => {
83
+ return keywords.value.length > 0;
84
+ });
85
+ return {
86
+ keywords,
87
+ clearIconShow,
88
+ onClearHandle
89
+ };
90
+ };
91
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
92
+ var freeGlobal$1 = freeGlobal;
93
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
94
+ var root = freeGlobal$1 || freeSelf || Function("return this")();
95
+ var root$1 = root;
96
+ var Symbol$1 = root$1.Symbol;
97
+ var Symbol$2 = Symbol$1;
98
+ var objectProto$1 = Object.prototype;
99
+ var hasOwnProperty = objectProto$1.hasOwnProperty;
100
+ var nativeObjectToString$1 = objectProto$1.toString;
101
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
102
+ function getRawTag(value) {
103
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1), tag = value[symToStringTag$1];
104
+ try {
105
+ value[symToStringTag$1] = void 0;
106
+ var unmasked = true;
107
+ } catch (e) {
108
+ }
109
+ var result = nativeObjectToString$1.call(value);
110
+ if (unmasked) {
111
+ if (isOwn) {
112
+ value[symToStringTag$1] = tag;
113
+ } else {
114
+ delete value[symToStringTag$1];
115
+ }
116
+ }
117
+ return result;
118
+ }
119
+ var objectProto = Object.prototype;
120
+ var nativeObjectToString = objectProto.toString;
121
+ function objectToString(value) {
122
+ return nativeObjectToString.call(value);
123
+ }
124
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
125
+ var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
126
+ function baseGetTag(value) {
127
+ if (value == null) {
128
+ return value === void 0 ? undefinedTag : nullTag;
129
+ }
130
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
131
+ }
132
+ function isObjectLike(value) {
133
+ return value != null && typeof value == "object";
134
+ }
135
+ var symbolTag = "[object Symbol]";
136
+ function isSymbol(value) {
137
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
138
+ }
139
+ var reWhitespace = /\s/;
140
+ function trimmedEndIndex(string) {
141
+ var index2 = string.length;
142
+ while (index2-- && reWhitespace.test(string.charAt(index2))) {
143
+ }
144
+ return index2;
145
+ }
146
+ var reTrimStart = /^\s+/;
147
+ function baseTrim(string) {
148
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
149
+ }
150
+ function isObject(value) {
151
+ var type = typeof value;
152
+ return value != null && (type == "object" || type == "function");
153
+ }
154
+ var NAN = 0 / 0;
155
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
156
+ var reIsBinary = /^0b[01]+$/i;
157
+ var reIsOctal = /^0o[0-7]+$/i;
158
+ var freeParseInt = parseInt;
159
+ function toNumber(value) {
160
+ if (typeof value == "number") {
161
+ return value;
162
+ }
163
+ if (isSymbol(value)) {
164
+ return NAN;
165
+ }
166
+ if (isObject(value)) {
167
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
168
+ value = isObject(other) ? other + "" : other;
169
+ }
170
+ if (typeof value != "string") {
171
+ return value === 0 ? value : +value;
172
+ }
173
+ value = baseTrim(value);
174
+ var isBinary = reIsBinary.test(value);
175
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
176
+ }
177
+ var now = function() {
178
+ return root$1.Date.now();
179
+ };
180
+ var now$1 = now;
181
+ var FUNC_ERROR_TEXT = "Expected a function";
182
+ var nativeMax = Math.max, nativeMin = Math.min;
183
+ function debounce(func, wait, options) {
184
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
185
+ if (typeof func != "function") {
186
+ throw new TypeError(FUNC_ERROR_TEXT);
187
+ }
188
+ wait = toNumber(wait) || 0;
189
+ if (isObject(options)) {
190
+ leading = !!options.leading;
191
+ maxing = "maxWait" in options;
192
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
193
+ trailing = "trailing" in options ? !!options.trailing : trailing;
194
+ }
195
+ function invokeFunc(time) {
196
+ var args = lastArgs, thisArg = lastThis;
197
+ lastArgs = lastThis = void 0;
198
+ lastInvokeTime = time;
199
+ result = func.apply(thisArg, args);
200
+ return result;
201
+ }
202
+ function leadingEdge(time) {
203
+ lastInvokeTime = time;
204
+ timerId = setTimeout(timerExpired, wait);
205
+ return leading ? invokeFunc(time) : result;
206
+ }
207
+ function remainingWait(time) {
208
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
209
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
210
+ }
211
+ function shouldInvoke(time) {
212
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
213
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
214
+ }
215
+ function timerExpired() {
216
+ var time = now$1();
217
+ if (shouldInvoke(time)) {
218
+ return trailingEdge(time);
219
+ }
220
+ timerId = setTimeout(timerExpired, remainingWait(time));
221
+ }
222
+ function trailingEdge(time) {
223
+ timerId = void 0;
224
+ if (trailing && lastArgs) {
225
+ return invokeFunc(time);
226
+ }
227
+ lastArgs = lastThis = void 0;
228
+ return result;
229
+ }
230
+ function cancel() {
231
+ if (timerId !== void 0) {
232
+ clearTimeout(timerId);
233
+ }
234
+ lastInvokeTime = 0;
235
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
236
+ }
237
+ function flush() {
238
+ return timerId === void 0 ? result : trailingEdge(now$1());
239
+ }
240
+ function debounced() {
241
+ var time = now$1(), isInvoking = shouldInvoke(time);
242
+ lastArgs = arguments;
243
+ lastThis = this;
244
+ lastCallTime = time;
245
+ if (isInvoking) {
246
+ if (timerId === void 0) {
247
+ return leadingEdge(lastCallTime);
248
+ }
249
+ if (maxing) {
250
+ clearTimeout(timerId);
251
+ timerId = setTimeout(timerExpired, wait);
252
+ return invokeFunc(lastCallTime);
253
+ }
254
+ }
255
+ if (timerId === void 0) {
256
+ timerId = setTimeout(timerExpired, wait);
257
+ }
258
+ return result;
259
+ }
260
+ debounced.cancel = cancel;
261
+ debounced.flush = flush;
262
+ return debounced;
263
+ }
264
+ const KEYS_MAP = {
265
+ enter: "Enter"
266
+ };
267
+ const keydownHandles = (ctx, keywords, delay) => {
268
+ const onInputKeydown = ($event) => {
269
+ switch ($event.key) {
270
+ case KEYS_MAP.enter:
271
+ handleEnter($event);
272
+ break;
273
+ }
274
+ };
275
+ const handleEnter = ($event) => {
276
+ if ($event.target instanceof HTMLInputElement) {
277
+ const value = $event.target.value;
278
+ useEmitKeyword(value);
279
+ }
280
+ };
281
+ const onClickHandle = () => {
282
+ useEmitKeyword(keywords.value);
283
+ };
284
+ const useEmitKeyword = debounce((value) => {
285
+ ctx.emit("onSearch", value);
286
+ }, delay);
287
+ return {
288
+ onInputKeydown,
289
+ useEmitKeyword,
290
+ onClickHandle
291
+ };
292
+ };
293
+ const inputProps = {
294
+ placeholder: {
295
+ type: String,
296
+ default: void 0
297
+ },
298
+ disabled: {
299
+ type: Boolean,
300
+ default: false
301
+ },
302
+ autoFocus: {
303
+ type: Boolean,
304
+ default: false
305
+ },
306
+ maxLength: {
307
+ type: Number,
308
+ default: Number.MAX_SAFE_INTEGER
309
+ },
310
+ cssClass: {
311
+ type: String,
312
+ default: ""
313
+ },
314
+ error: {
315
+ type: Boolean,
316
+ default: false
317
+ },
318
+ size: {
319
+ type: String,
320
+ default: ""
321
+ },
322
+ showPassword: {
323
+ type: Boolean,
324
+ default: false
325
+ },
326
+ modelValue: {
327
+ type: String,
328
+ default: ""
329
+ },
330
+ "update:modelValue": {
331
+ type: Function,
332
+ default: void 0
333
+ },
334
+ onChange: {
335
+ type: Function,
336
+ default: void 0
337
+ },
338
+ onKeydown: {
339
+ type: Function,
340
+ default: void 0
341
+ },
342
+ onFocus: {
343
+ type: Function,
344
+ default: void 0
345
+ },
346
+ onBlur: {
347
+ type: Function,
348
+ default: void 0
349
+ }
350
+ };
351
+ var input = "";
352
+ const formItemInjectionKey = Symbol("dFormItem");
353
+ const dFormItemEvents = {
354
+ blur: "d.form.blur",
355
+ change: "d.form.change",
356
+ input: "d.form.input"
357
+ };
358
+ var DInput = defineComponent({
359
+ name: "DInput",
360
+ directives: {
361
+ focus: {
362
+ mounted: function(el, binding) {
363
+ if (binding.value) {
364
+ el.focus();
365
+ }
366
+ }
367
+ }
368
+ },
369
+ props: inputProps,
370
+ emits: ["update:modelValue", "focus", "blur", "change", "keydown"],
371
+ setup(props, ctx) {
372
+ const formItem = inject(formItemInjectionKey, {});
373
+ const hasFormItem = Object.keys(formItem).length > 0;
374
+ const sizeCls = computed(() => `devui-input-${props.size}`);
375
+ const showPwdIcon = ref(false);
376
+ const inputType = ref("text");
377
+ const inputCls = computed(() => {
378
+ return {
379
+ error: props.error,
380
+ [props.cssClass]: true,
381
+ [sizeCls.value]: props.size !== ""
382
+ };
383
+ });
384
+ const showPreviewIcon = computed(() => inputType.value === "password");
385
+ watch(() => props.showPassword, (flg) => {
386
+ inputType.value = flg ? "password" : "text";
387
+ }, {
388
+ immediate: true
389
+ });
390
+ watch(() => props.modelValue, (value) => {
391
+ value && value.length > 0 && showPreviewIcon.value ? showPwdIcon.value = true : showPwdIcon.value = false;
392
+ });
393
+ const onInput = ($event) => {
394
+ ctx.emit("update:modelValue", $event.target.value);
395
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.input);
396
+ }, onFocus = () => {
397
+ ctx.emit("focus");
398
+ }, onBlur = () => {
399
+ ctx.emit("blur");
400
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.blur);
401
+ }, onChange = ($event) => {
402
+ ctx.emit("change", $event.target.value);
403
+ hasFormItem && formItem.formItemMitt.emit(dFormItemEvents.change);
404
+ }, onKeydown = ($event) => {
405
+ ctx.emit("keydown", $event);
406
+ }, onChangeInputType = () => {
407
+ inputType.value = inputType.value === "password" ? "text" : "password";
408
+ };
409
+ return {
410
+ inputCls,
411
+ inputType,
412
+ showPreviewIcon,
413
+ showPwdIcon,
414
+ onInput,
415
+ onFocus,
416
+ onBlur,
417
+ onChange,
418
+ onKeydown,
419
+ onChangeInputType
420
+ };
421
+ },
422
+ render() {
423
+ const {
424
+ modelValue,
425
+ showPreviewIcon,
426
+ showPwdIcon,
427
+ inputCls,
428
+ inputType,
429
+ maxLength,
430
+ autoFocus,
431
+ placeholder,
432
+ disabled,
433
+ onInput,
434
+ onFocus,
435
+ onBlur,
436
+ onChange,
437
+ onKeydown,
438
+ onChangeInputType
439
+ } = this;
440
+ return createVNode("div", {
441
+ "class": "devui-input__wrap"
442
+ }, [withDirectives(createVNode("input", mergeProps({
443
+ dinput: true
444
+ }, {
445
+ "value": modelValue,
446
+ "disabled": disabled,
447
+ "type": inputType,
448
+ "maxlength": maxLength,
449
+ "placeholder": placeholder,
450
+ "class": inputCls,
451
+ "onInput": onInput,
452
+ "onFocus": onFocus,
453
+ "onBlur": onBlur,
454
+ "onChange": onChange,
455
+ "onKeydown": onKeydown
456
+ }), null), [[resolveDirective("focus"), autoFocus]]), showPwdIcon && createVNode("div", {
457
+ "class": "devui-input__preview",
458
+ "onClick": onChangeInputType
459
+ }, [showPreviewIcon ? createVNode(resolveComponent("d-icon"), {
460
+ "name": "preview",
461
+ "size": "12px",
462
+ "key": 1
463
+ }, null) : createVNode(resolveComponent("d-icon"), {
464
+ "name": "preview-forbidden",
465
+ "size": "12px",
466
+ "key": 2
467
+ }, null)])]);
468
+ }
469
+ });
470
+ var search = "";
471
+ var Search = defineComponent({
472
+ name: "DSearch",
473
+ props: searchProps,
474
+ emits: ["update:modelValue", "onSearch"],
475
+ setup(props, ctx) {
476
+ const rootClasses = getRootClass(props);
477
+ const {
478
+ keywords,
479
+ clearIconShow,
480
+ onClearHandle
481
+ } = keywordsHandles(ctx, props);
482
+ const {
483
+ onInputKeydown,
484
+ onClickHandle,
485
+ useEmitKeyword
486
+ } = keydownHandles(ctx, keywords, props.delay);
487
+ const onInputUpdate = (event) => {
488
+ if (props.isKeyupSearch) {
489
+ useEmitKeyword(event);
490
+ }
491
+ keywords.value = event;
492
+ ctx.emit("update:modelValue", event);
493
+ };
494
+ return () => {
495
+ return createVNode("div", {
496
+ "class": rootClasses.value
497
+ }, [props.iconPosition === "left" && createVNode("div", {
498
+ "class": "devui-search__icon",
499
+ "onClick": onClickHandle
500
+ }, [createVNode(resolveComponent("d-icon"), {
501
+ "name": "search",
502
+ "size": "inherit",
503
+ "key": "search"
504
+ }, null)]), createVNode(DInput, {
505
+ "size": props.size,
506
+ "disabled": props.disabled,
507
+ "autoFocus": props.autoFocus,
508
+ "modelValue": keywords.value,
509
+ "maxLength": props.maxLength,
510
+ "placeholder": props.placeholder,
511
+ "cssClass": props.cssClass,
512
+ "onKeydown": onInputKeydown,
513
+ "onUpdate:modelValue": onInputUpdate
514
+ }, null), clearIconShow.value && createVNode("div", {
515
+ "class": "devui-search__clear",
516
+ "onClick": onClearHandle
517
+ }, [createVNode(resolveComponent("d-icon"), {
518
+ "name": "close",
519
+ "size": "inherit",
520
+ "key": "close"
521
+ }, null)]), props.iconPosition === "right" && createVNode("div", {
522
+ "class": "devui-search__icon",
523
+ "onClick": onClickHandle
524
+ }, [createVNode(resolveComponent("d-icon"), {
525
+ "name": "search",
526
+ "size": "inherit",
527
+ "key": "search"
528
+ }, null)])]);
529
+ };
530
+ }
531
+ });
532
+ Search.install = function(app) {
533
+ app.component(Search.name, Search);
534
+ };
535
+ var index = {
536
+ title: "Search \u641C\u7D22\u6846",
537
+ category: "\u901A\u7528",
538
+ status: "100%",
539
+ install(app) {
540
+ app.use(Search);
541
+ }
542
+ };
543
+ export { Search, index as default };
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).index={},e.Vue)}(this,(function(e,t){"use strict";const n={size:{type:String,default:""},placeholder:{type:String,default:"请输入关键字"},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},delay:{type:Number,default:300},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},isKeyupSearch:{type:Boolean,default:!1},iconPosition:{type:String,default:"right"},noBorder:{type:Boolean,default:!1},cssClass:{type:String,default:""},modelValue:{type:String,default:""},searchFn:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}},o={lg:"lg",sm:"sm"},a={right:"right",left:"left"};var i="object"==typeof global&&global&&global.Object===Object&&global,r="object"==typeof self&&self&&self.Object===Object&&self,u=i||r||Function("return this")(),l=u.Symbol,c=Object.prototype,d=c.hasOwnProperty,s=c.toString,p=l?l.toStringTag:void 0;var f=Object.prototype.toString;var v=l?l.toStringTag:void 0;function y(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":v&&v in Object(e)?function(e){var t=d.call(e,p),n=e[p];try{e[p]=void 0;var o=!0}catch(i){}var a=s.call(e);return o&&(t?e[p]=n:delete e[p]),a}(e):function(e){return f.call(e)}(e)}var m=/\s/;var h=/^\s+/;function g(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&m.test(e.charAt(t)););return t}(e)+1).replace(h,""):e}function b(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var w=/^[-+]0x[0-9a-f]+$/i,C=/^0b[01]+$/i,S=/^0o[0-7]+$/i,N=parseInt;function _(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==y(e)}(e))return NaN;if(b(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=b(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=g(e);var n=C.test(e);return n||S.test(e)?N(e.slice(2),n?2:8):w.test(e)?NaN:+e}var F=function(){return u.Date.now()},x=Math.max,V=Math.min;function T(e,t,n){var o,a,i,r,u,l,c=0,d=!1,s=!1,p=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=o,i=a;return o=a=void 0,c=t,r=e.apply(i,n)}function v(e){return c=e,u=setTimeout(m,t),d?f(e):r}function y(e){var n=e-l;return void 0===l||n>=t||n<0||s&&e-c>=i}function m(){var e=F();if(y(e))return h(e);u=setTimeout(m,function(e){var n=t-(e-l);return s?V(n,i-(e-c)):n}(e))}function h(e){return u=void 0,p&&o?f(e):(o=a=void 0,r)}function g(){var e=F(),n=y(e);if(o=arguments,a=this,l=e,n){if(void 0===u)return v(l);if(s)return clearTimeout(u),u=setTimeout(m,t),f(l)}return void 0===u&&(u=setTimeout(m,t)),r}return t=_(t)||0,b(n)&&(d=!!n.leading,i=(s="maxWait"in n)?x(_(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),g.cancel=function(){void 0!==u&&clearTimeout(u),c=0,o=l=a=u=void 0},g.flush=function(){return void 0===u?r:h(F())},g}const I="Enter",j={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},value:{type:String,default:""},"onUpdate:value":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}};var B=t.defineComponent({name:"DInput",directives:{focus:{mounted:function(e,t){t.value&&e.focus()}}},props:j,emits:["update:value","focus","blur","change","keydown"],setup(e,n){const o=t.computed((()=>`devui-input-${e.size}`)),a=t.ref(!1),i=t.ref("text"),r=t.computed((()=>({error:e.error,[e.cssClass]:!0,[o.value]:""!==e.size}))),u=t.computed((()=>"password"===i.value));t.watch((()=>e.showPassword),(e=>{i.value=e?"password":"text"}),{immediate:!0}),t.watch((()=>e.value),(e=>{e&&e.length>0&&u.value?a.value=!0:a.value=!1}));return{inputCls:r,inputType:i,showPreviewIcon:u,showPwdIcon:a,onInput:e=>{n.emit("update:value",e.target.value)},onFocus:()=>{n.emit("focus")},onBlur:()=>{n.emit("blur")},onChange:e=>{n.emit("change",e.target.value)},onKeydown:e=>{n.emit("keydown",e)},onChangeInputType:()=>{i.value="password"===i.value?"text":"password"}}},render(){const{value:e,showPreviewIcon:n,showPwdIcon:o,inputCls:a,inputType:i,maxLength:r,autoFocus:u,placeholder:l,disabled:c,onInput:d,onFocus:s,onBlur:p,onChange:f,onKeydown:v,onChangeInputType:y}=this;return t.createVNode("div",{class:"devui-input__wrap"},[t.withDirectives(t.createVNode("input",t.mergeProps({dinput:!0},{value:e,disabled:c,type:i,maxlength:r,placeholder:l,class:a,onInput:d,onFocus:s,onBlur:p,onChange:f,onKeydown:v}),null),[[t.resolveDirective("focus"),u]]),o&&t.createVNode("div",{class:"devui-input__preview",onClick:y},[n?t.createVNode(t.resolveComponent("d-icon"),{name:"preview",size:"12px",key:1},null):t.createVNode(t.resolveComponent("d-icon"),{name:"preview-forbidden",size:"12px",key:2},null)])])}}),P=t.defineComponent({name:"DSearch",props:n,emits:["update:modelValue","searchFn"],setup(e,n){const i=(e=>t.computed((()=>({"devui-search":!0,"devui-search__disbaled":e.disabled,"devui-search__no-border":e.noBorder,[`devui-search__${e.size}`]:o[e.size],[`devui-search__${e.iconPosition}`]:a[e.iconPosition]}))))(e),{keywords:r,clearIconShow:u,onClearHandle:l}=((e,n)=>{const o=t.ref("");t.watch((()=>n.modelValue),(e=>{o.value=e}),{immediate:!0});const a=t.computed((()=>o.value.length>0));return{keywords:o,clearIconShow:a,onClearHandle:()=>{o.value="",e.emit("update:modelValue","")}}})(n,e),{onInputKeydown:c,onClickHandle:d,useEmitKeyword:s}=((e,t,n)=>{const o=e=>{if(e.target instanceof HTMLInputElement){const t=e.target.value;a(t)}},a=T((t=>{e.emit("searchFn",t)}),n);return{onInputKeydown:e=>{switch(e.key){case I:o(e)}},useEmitKeyword:a,onClickHandle:()=>{a(t.value)}}})(n,r,e.delay),p=t=>{e.isKeyupSearch&&s(t),r.value=t,n.emit("update:modelValue",t)};return()=>t.createVNode("div",{class:i.value},["left"===e.iconPosition&&t.createVNode("div",{class:"devui-search__icon",onClick:d},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit"},null)]),t.createVNode(B,{size:e.size,disabled:e.disabled,autoFocus:e.autoFocus,value:r.value,maxLength:e.maxLength,placeholder:e.placeholder,cssClass:e.cssClass,onKeydown:c,"onUpdate:value":p},null),u.value&&t.createVNode("div",{class:"devui-search__clear",onClick:l},[t.createVNode(t.resolveComponent("d-icon"),{name:"close",size:"inherit"},null)]),"right"===e.iconPosition&&t.createVNode("div",{class:"devui-search__icon",onClick:d},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit"},null)])])}});P.install=function(e){e.component(P.name,P)};var k={title:"Search 搜索框",category:"通用",install(e){e.use(P)}};e.Search=P,e.default=k,Object.defineProperty(e,"__esModule",{value:!0}),e[Symbol.toStringTag]="Module"}));
1
+ (function(m,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(m=typeof globalThis!="undefined"?globalThis:m||self,t(m.index={},m.Vue))})(this,function(m,t){"use strict";const K={size:{type:String,default:""},placeholder:{type:String,default:"\u8BF7\u8F93\u5165\u5173\u952E\u5B57"},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},delay:{type:Number,default:300},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},isKeyupSearch:{type:Boolean,default:!1},iconPosition:{type:String,default:"right"},noBorder:{type:Boolean,default:!1},cssClass:{type:String,default:""},modelValue:{type:String,default:""},onSearch:{type:Function,default:void 0},"onUpdate:modelValue":{type:Function,default:void 0}},M={lg:"lg",sm:"sm"},L={right:"right",left:"left"},$=e=>t.computed(()=>({"devui-search":!0,"devui-search__disbaled":e.disabled,"devui-search__no-border":e.noBorder,[`devui-search__${e.size}`]:M[e.size],[`devui-search__${e.iconPosition}`]:L[e.iconPosition]})),A=(e,n)=>{const o=t.ref("");t.watch(()=>n.modelValue,d=>{o.value=d},{immediate:!0});const a=()=>{o.value="",e.emit("update:modelValue","")},u=t.computed(()=>o.value.length>0);return{keywords:o,clearIconShow:u,onClearHandle:a}};var H=typeof global=="object"&&global&&global.Object===Object&&global,D=H,R=typeof self=="object"&&self&&self.Object===Object&&self,W=D||R||Function("return this")(),N=W,G=N.Symbol,I=G,j=Object.prototype,U=j.hasOwnProperty,X=j.toString,S=I?I.toStringTag:void 0;function q(e){var n=U.call(e,S),o=e[S];try{e[S]=void 0;var a=!0}catch{}var u=X.call(e);return a&&(n?e[S]=o:delete e[S]),u}var Y=Object.prototype,Z=Y.toString;function J(e){return Z.call(e)}var Q="[object Null]",ee="[object Undefined]",E=I?I.toStringTag:void 0;function te(e){return e==null?e===void 0?ee:Q:E&&E in Object(e)?q(e):J(e)}function ne(e){return e!=null&&typeof e=="object"}var oe="[object Symbol]";function re(e){return typeof e=="symbol"||ne(e)&&te(e)==oe}var ae=/\s/;function ie(e){for(var n=e.length;n--&&ae.test(e.charAt(n)););return n}var le=/^\s+/;function ue(e){return e&&e.slice(0,ie(e)+1).replace(le,"")}function _(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}var O=0/0,de=/^[-+]0x[0-9a-f]+$/i,se=/^0b[01]+$/i,ce=/^0o[0-7]+$/i,fe=parseInt;function P(e){if(typeof e=="number")return e;if(re(e))return O;if(_(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=_(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=ue(e);var o=se.test(e);return o||ce.test(e)?fe(e.slice(2),o?2:8):de.test(e)?O:+e}var me=function(){return N.Date.now()},V=me,ye="Expected a function",he=Math.max,pe=Math.min;function ge(e,n,o){var a,u,d,i,r,s,f=0,y=!1,h=!1,g=!0;if(typeof e!="function")throw new TypeError(ye);n=P(n)||0,_(o)&&(y=!!o.leading,h="maxWait"in o,d=h?he(P(o.maxWait)||0,n):d,g="trailing"in o?!!o.trailing:g);function b(l){var p=a,w=u;return a=u=void 0,f=l,i=e.apply(w,p),i}function C(l){return f=l,r=setTimeout(T,n),y?b(l):i}function c(l){var p=l-s,w=l-f,z=n-p;return h?pe(z,d-w):z}function B(l){var p=l-s,w=l-f;return s===void 0||p>=n||p<0||h&&w>=d}function T(){var l=V();if(B(l))return x(l);r=setTimeout(T,c(l))}function x(l){return r=void 0,g&&a?b(l):(a=u=void 0,i)}function Te(){r!==void 0&&clearTimeout(r),f=0,a=s=u=r=void 0}function _e(){return r===void 0?i:x(V())}function F(){var l=V(),p=B(l);if(a=arguments,u=this,s=l,p){if(r===void 0)return C(s);if(h)return clearTimeout(r),r=setTimeout(T,n),b(s)}return r===void 0&&(r=setTimeout(T,n)),i}return F.cancel=Te,F.flush=_e,F}const be={enter:"Enter"},Se=(e,n,o)=>{const a=r=>{switch(r.key){case be.enter:u(r);break}},u=r=>{if(r.target instanceof HTMLInputElement){const s=r.target.value;i(s)}},d=()=>{i(n.value)},i=ge(r=>{e.emit("onSearch",r)},o);return{onInputKeydown:a,useEmitKeyword:i,onClickHandle:d}},ve={placeholder:{type:String,default:void 0},disabled:{type:Boolean,default:!1},autoFocus:{type:Boolean,default:!1},maxLength:{type:Number,default:Number.MAX_SAFE_INTEGER},cssClass:{type:String,default:""},error:{type:Boolean,default:!1},size:{type:String,default:""},showPassword:{type:Boolean,default:!1},modelValue:{type:String,default:""},"update:modelValue":{type:Function,default:void 0},onChange:{type:Function,default:void 0},onKeydown:{type:Function,default:void 0},onFocus:{type:Function,default:void 0},onBlur:{type:Function,default:void 0}};var Ve="";const we=Symbol("dFormItem"),k={blur:"d.form.blur",change:"d.form.change",input:"d.form.input"};var Ie=t.defineComponent({name:"DInput",directives:{focus:{mounted:function(e,n){n.value&&e.focus()}}},props:ve,emits:["update:modelValue","focus","blur","change","keydown"],setup(e,n){const o=t.inject(we,{}),a=Object.keys(o).length>0,u=t.computed(()=>`devui-input-${e.size}`),d=t.ref(!1),i=t.ref("text"),r=t.computed(()=>({error:e.error,[e.cssClass]:!0,[u.value]:e.size!==""})),s=t.computed(()=>i.value==="password");return t.watch(()=>e.showPassword,c=>{i.value=c?"password":"text"},{immediate:!0}),t.watch(()=>e.modelValue,c=>{c&&c.length>0&&s.value?d.value=!0:d.value=!1}),{inputCls:r,inputType:i,showPreviewIcon:s,showPwdIcon:d,onInput:c=>{n.emit("update:modelValue",c.target.value),a&&o.formItemMitt.emit(k.input)},onFocus:()=>{n.emit("focus")},onBlur:()=>{n.emit("blur"),a&&o.formItemMitt.emit(k.blur)},onChange:c=>{n.emit("change",c.target.value),a&&o.formItemMitt.emit(k.change)},onKeydown:c=>{n.emit("keydown",c)},onChangeInputType:()=>{i.value=i.value==="password"?"text":"password"}}},render(){const{modelValue:e,showPreviewIcon:n,showPwdIcon:o,inputCls:a,inputType:u,maxLength:d,autoFocus:i,placeholder:r,disabled:s,onInput:f,onFocus:y,onBlur:h,onChange:g,onKeydown:b,onChangeInputType:C}=this;return t.createVNode("div",{class:"devui-input__wrap"},[t.withDirectives(t.createVNode("input",t.mergeProps({dinput:!0},{value:e,disabled:s,type:u,maxlength:d,placeholder:r,class:a,onInput:f,onFocus:y,onBlur:h,onChange:g,onKeydown:b}),null),[[t.resolveDirective("focus"),i]]),o&&t.createVNode("div",{class:"devui-input__preview",onClick:C},[n?t.createVNode(t.resolveComponent("d-icon"),{name:"preview",size:"12px",key:1},null):t.createVNode(t.resolveComponent("d-icon"),{name:"preview-forbidden",size:"12px",key:2},null)])])}}),ke="",v=t.defineComponent({name:"DSearch",props:K,emits:["update:modelValue","onSearch"],setup(e,n){const o=$(e),{keywords:a,clearIconShow:u,onClearHandle:d}=A(n,e),{onInputKeydown:i,onClickHandle:r,useEmitKeyword:s}=Se(n,a,e.delay),f=y=>{e.isKeyupSearch&&s(y),a.value=y,n.emit("update:modelValue",y)};return()=>t.createVNode("div",{class:o.value},[e.iconPosition==="left"&&t.createVNode("div",{class:"devui-search__icon",onClick:r},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit",key:"search"},null)]),t.createVNode(Ie,{size:e.size,disabled:e.disabled,autoFocus:e.autoFocus,modelValue:a.value,maxLength:e.maxLength,placeholder:e.placeholder,cssClass:e.cssClass,onKeydown:i,"onUpdate:modelValue":f},null),u.value&&t.createVNode("div",{class:"devui-search__clear",onClick:d},[t.createVNode(t.resolveComponent("d-icon"),{name:"close",size:"inherit",key:"close"},null)]),e.iconPosition==="right"&&t.createVNode("div",{class:"devui-search__icon",onClick:r},[t.createVNode(t.resolveComponent("d-icon"),{name:"search",size:"inherit",key:"search"},null)])])}});v.install=function(e){e.component(v.name,v)};var Ce={title:"Search \u641C\u7D22\u6846",category:"\u901A\u7528",status:"100%",install(e){e.use(v)}};m.Search=v,m.default=Ce,Object.defineProperty(m,"__esModule",{value:!0}),m[Symbol.toStringTag]="Module"});
@@ -0,0 +1,7 @@
1
+ import { App } from 'vue';
2
+ declare function install(app: App): void
3
+ declare const _default: {
4
+ install: typeof install;
5
+ version: string;
6
+ };
7
+ export default _default;