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
package/table/index.es.js CHANGED
@@ -1 +1,1626 @@
1
- import{computed as e,ref as t,watch as n,defineComponent as r,inject as l,createVNode as s,toRefs as a,getCurrentInstance as u,provide as o,createTextVNode as d,onBeforeMount as i,onMounted as c}from"vue";const m={data:{type:Array,default:[]},striped:{type:Boolean,default:!1}};var p=r({name:"DColGroup",setup:()=>({columns:l("table").store.states._columns}),render(){const{columns:e}=this;return s("colgroup",null,[e.map(((e,t)=>s("col",{key:t,width:e.realWidth},null)))])}});var f=r({name:"DTableHeader",props:{store:{type:Object,default:{}}},setup(e){const{store:t}=a(e);return{columns:t.value.states._columns.value}},render(){const{columns:e}=this;return s("thead",{class:"devui-thead"},[s("tr",null,[e.map(((e,t)=>s("th",{key:t},[e.renderHeader()])))])])}});var h=r({name:"DTableBody",props:{store:{type:Object,default:{}}},setup(t){const{rowColumns:n}=function(t){const n=t.store.states;return{rowColumns:e((()=>n._data.value.map((e=>{const t=Object.assign({},e);return t.columns=n._columns.value,t}))))}}(t);return{rowColumns:n}},render(){const{rowColumns:e}=this;return s("tbody",{class:"devui-tbody"},[e.map(((e,t)=>s("tr",{key:t},[e.columns.map(((t,n)=>s("td",{key:n},[t.renderCell({row:e,column:t,$index:n})])))])))])}}),v=r({name:"DTable",props:m,setup(r){const l=u(),s=function(e){const r=t([]),l=t([]);function s(){r.value=[],e.data.forEach((e=>{r.value.push(e)}))}return s(),n((()=>e.data),s,{deep:!0}),{insertColumn:e=>{l.value.push(e)},states:{_data:r,_columns:l}}}(r);l.store=s;const{classes:a}=function(t){return{classes:e((()=>({"devui-table":!0,"devui-table-striped":t.striped})))}}(r);return o("table",l),{classes:a,store:s}},render(){const{classes:e,data:t,store:n,$slots:r}=this;return s("div",{class:"devui-table-wrapper"},[r.default(),s("table",{class:e,cellpadding:"0",cellspacing:"0"},[s(p,null,null),s(f,{store:n},null),!!t.length&&s(h,{store:n},null)]),!t.length&&s("div",{class:"devui-table-empty"},[d("No Data")])])}});function b(e){return"number"==typeof e?e:parseInt(e,10)||0}function y(e){const n=t(b(e.width)),r=t(b(e.minWidth)||80);return{setColumnWidth:e=>(e.width=n.value,e.minWidth=r.value,e.realWidth=e.width||e.minWidth,e),setColumnRender:e=>{e.renderHeader=()=>function(e){return e.header}(e),e.renderCell=e=>function({row:e,column:t,$index:n}){var r;const l=e[t.field];if(t.formatter)return t.formatter(e,t,l,n);return(null==(r=null==l?void 0:l.toString)?void 0:r.call(l))||""}(e)}}}var C=r({name:"DColumn",props:{header:{type:String,default:""},field:{type:String,default:""},width:{type:[String,Number],default:""},minWidth:{type:[String,Number],default:80},formatter:{type:Function}},setup(e){const t={field:e.field,header:e.header},n=l("table"),{setColumnWidth:r,setColumnRender:s}=y(e);i((()=>{r(t),s(t)})),c((()=>{n.store.insertColumn(t)}))},render:()=>null});v.install=function(e){e.component(v.name,v),e.component(C.name,C)};var g={title:"Table 表格",category:"数据展示",status:void 0,install(e){e.use(v)}};export{C as Column,v as Table,g as default};
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { computed, ref, watch, defineComponent, inject, createVNode, mergeProps, toRef, provide, Teleport, Transition, renderSlot, isVNode, onMounted, onUnmounted, withDirectives, vShow, reactive, isRef, toRefs, Fragment, shallowRef, getCurrentInstance, createTextVNode, resolveDirective, onBeforeMount, h, onBeforeUnmount } from "vue";
21
+ const TableProps = {
22
+ data: {
23
+ type: Array,
24
+ default: []
25
+ },
26
+ striped: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ scrollable: {
31
+ type: Boolean,
32
+ default: false
33
+ },
34
+ maxWidth: {
35
+ type: String
36
+ },
37
+ maxHeight: {
38
+ type: String
39
+ },
40
+ tableWidth: {
41
+ type: String
42
+ },
43
+ tableHeight: {
44
+ type: String
45
+ },
46
+ size: {
47
+ type: String,
48
+ validator(value) {
49
+ return value === "sm" || value === "md" || value === "lg";
50
+ }
51
+ },
52
+ rowHoveredHighlight: {
53
+ type: Boolean,
54
+ default: true
55
+ },
56
+ fixHeader: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ checkable: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ tableLayout: {
65
+ type: String,
66
+ default: "auto",
67
+ validator(v) {
68
+ return v === "fixed" || v === "auto";
69
+ }
70
+ },
71
+ showLoading: {
72
+ type: Boolean,
73
+ default: false
74
+ },
75
+ headerBg: {
76
+ type: Boolean,
77
+ default: false
78
+ }
79
+ };
80
+ const TABLE_TOKEN = Symbol();
81
+ function useTable(props) {
82
+ const classes = computed(() => ({
83
+ "devui-table": true,
84
+ "devui-table-striped": props.striped,
85
+ "header-bg": props.headerBg,
86
+ "table-layout-auto": props.tableLayout === "auto"
87
+ }));
88
+ const style = computed(() => ({
89
+ maxHeight: props.maxHeight,
90
+ maxWidth: props.maxWidth,
91
+ height: props.tableHeight,
92
+ width: props.tableWidth
93
+ }));
94
+ return { classes, style };
95
+ }
96
+ const useFixedColumn = (column) => {
97
+ const stickyCell = computed(() => {
98
+ const col = column.value;
99
+ if (col.fixedLeft) {
100
+ return `devui-sticky-cell left`;
101
+ }
102
+ if (col.fixedRight) {
103
+ return `devui-sticky-cell right`;
104
+ }
105
+ return void 0;
106
+ });
107
+ const offsetStyle = computed(() => {
108
+ const col = column.value;
109
+ if (col.fixedLeft) {
110
+ return `left:${col.fixedLeft}`;
111
+ }
112
+ if (col.fixedRight) {
113
+ return `right:${col.fixedRight}`;
114
+ }
115
+ return void 0;
116
+ });
117
+ return {
118
+ stickyCell,
119
+ offsetStyle
120
+ };
121
+ };
122
+ function createStore(dataSource) {
123
+ const _data = ref([]);
124
+ watch(dataSource, (value) => {
125
+ _data.value = [...value];
126
+ }, { deep: true, immediate: true });
127
+ const { _columns, insertColumn, removeColumn, sortColumn } = createColumnGenerator();
128
+ const { _checkAll, _checkList, _halfChecked, getCheckedRows } = createSelection(dataSource, _data);
129
+ const { sortData } = createSorter(dataSource, _data);
130
+ const { filterData, resetFilterData } = createFilter(dataSource, _data);
131
+ const { isFixedLeft } = createFixedLogic(_columns);
132
+ return {
133
+ states: {
134
+ _data,
135
+ _columns,
136
+ _checkList,
137
+ _checkAll,
138
+ _halfChecked,
139
+ isFixedLeft
140
+ },
141
+ insertColumn,
142
+ sortColumn,
143
+ removeColumn,
144
+ getCheckedRows,
145
+ sortData,
146
+ filterData,
147
+ resetFilterData
148
+ };
149
+ }
150
+ const createColumnGenerator = () => {
151
+ const _columns = ref([]);
152
+ const insertColumn = (column) => {
153
+ _columns.value.push(column);
154
+ _columns.value.sort((a, b) => a.order > b.order ? 1 : -1);
155
+ };
156
+ const sortColumn = () => {
157
+ _columns.value.sort((a, b) => a.order > b.order ? 1 : -1);
158
+ };
159
+ const removeColumn = (column) => {
160
+ const i = _columns.value.findIndex((v) => v === column);
161
+ if (i === -1) {
162
+ return;
163
+ }
164
+ _columns.value.splice(i, 1);
165
+ };
166
+ return { _columns, insertColumn, removeColumn, sortColumn };
167
+ };
168
+ const createSelection = (dataSource, _data) => {
169
+ const _checkList = ref([]);
170
+ const _checkAllRecord = ref(false);
171
+ const _checkAll = computed({
172
+ get: () => _checkAllRecord.value,
173
+ set: (val) => {
174
+ _checkAllRecord.value = val;
175
+ for (let i = 0; i < _checkList.value.length; i++) {
176
+ _checkList.value[i] = val;
177
+ }
178
+ }
179
+ });
180
+ const _halfChecked = ref(false);
181
+ watch(dataSource, (value) => {
182
+ _checkList.value = new Array(value.length).fill(false);
183
+ }, { deep: true, immediate: true });
184
+ watch(_checkList, (list) => {
185
+ if (list.length === 0) {
186
+ return;
187
+ }
188
+ let allTrue = true;
189
+ let allFalse = true;
190
+ for (let i = 0; i < list.length; i++) {
191
+ allTrue && (allTrue = list[i]);
192
+ allFalse && (allFalse = !list[i]);
193
+ }
194
+ _checkAllRecord.value = allTrue;
195
+ _halfChecked.value = !(allFalse || allTrue);
196
+ }, { immediate: true, deep: true });
197
+ const getCheckedRows = () => {
198
+ return _data.value.filter((_, index2) => _checkList.value[index2]);
199
+ };
200
+ return {
201
+ _checkList,
202
+ _checkAll,
203
+ _halfChecked,
204
+ getCheckedRows
205
+ };
206
+ };
207
+ const createSorter = (dataSource, _data) => {
208
+ const sortData = (field, direction, compareFn = (field2, a, b) => a[field2] > b[field2]) => {
209
+ if (direction === "ASC") {
210
+ _data.value = _data.value.sort((a, b) => compareFn(field, a, b) ? 1 : -1);
211
+ } else if (direction === "DESC") {
212
+ _data.value = _data.value.sort((a, b) => !compareFn(field, a, b) ? 1 : -1);
213
+ } else {
214
+ _data.value = [...dataSource.value];
215
+ }
216
+ };
217
+ return { sortData };
218
+ };
219
+ const createFilter = (dataSource, _data) => {
220
+ const fieldSet = new Set();
221
+ const filterData = (field, results) => {
222
+ fieldSet.add(field);
223
+ const fields = [...fieldSet];
224
+ _data.value = dataSource.value.filter((item) => {
225
+ return fields.reduce((prev, field2) => {
226
+ return prev && results.indexOf(item[field2]) !== -1;
227
+ }, true);
228
+ });
229
+ };
230
+ const resetFilterData = () => {
231
+ fieldSet.clear();
232
+ _data.value = [...dataSource.value];
233
+ };
234
+ return { filterData, resetFilterData };
235
+ };
236
+ const createFixedLogic = (columns) => {
237
+ const isFixedLeft = computed(() => {
238
+ return columns.value.reduce((prev, current) => prev || !!current.fixedLeft, false);
239
+ });
240
+ return { isFixedLeft };
241
+ };
242
+ var ColGroup = defineComponent({
243
+ name: "DColGroup",
244
+ setup() {
245
+ const parent = inject(TABLE_TOKEN);
246
+ const columns = parent.store.states._columns;
247
+ return () => parent.props.tableLayout === "fixed" ? createVNode("colgroup", null, [parent.props.checkable ? createVNode("col", {
248
+ "width": 36
249
+ }, null) : null, columns.value.map((column, index2) => {
250
+ return createVNode("col", {
251
+ "key": index2,
252
+ "width": column.realWidth
253
+ }, null);
254
+ })]) : null;
255
+ }
256
+ });
257
+ var checkbox = "";
258
+ const commonProps = {
259
+ name: {
260
+ type: String,
261
+ default: void 0
262
+ },
263
+ halfchecked: {
264
+ type: Boolean,
265
+ default: false
266
+ },
267
+ isShowTitle: {
268
+ type: Boolean,
269
+ default: true
270
+ },
271
+ title: {
272
+ type: String
273
+ },
274
+ color: {
275
+ type: String,
276
+ default: void 0
277
+ },
278
+ showAnimation: {
279
+ type: Boolean,
280
+ default: true
281
+ },
282
+ disabled: {
283
+ type: Boolean,
284
+ default: false
285
+ },
286
+ beforeChange: {
287
+ type: Function,
288
+ default: void 0
289
+ }
290
+ };
291
+ const checkboxProps = __spreadProps(__spreadValues({}, commonProps), {
292
+ halfchecked: {
293
+ type: Boolean,
294
+ default: false
295
+ },
296
+ checked: {
297
+ type: Boolean,
298
+ default: false
299
+ },
300
+ value: {
301
+ type: String
302
+ },
303
+ label: {
304
+ type: String,
305
+ default: void 0
306
+ },
307
+ title: {
308
+ type: String,
309
+ default: void 0
310
+ },
311
+ "onUpdate:checked": {
312
+ type: Function,
313
+ default: void 0
314
+ },
315
+ onChange: {
316
+ type: Function,
317
+ default: void 0
318
+ },
319
+ modelValue: {
320
+ type: Boolean
321
+ },
322
+ "onUpdate:modelValue": {
323
+ type: Function
324
+ }
325
+ });
326
+ const checkboxGroupProps = __spreadProps(__spreadValues({}, commonProps), {
327
+ modelValue: {
328
+ type: Array,
329
+ required: true
330
+ },
331
+ direction: {
332
+ type: String,
333
+ default: "column"
334
+ },
335
+ itemWidth: {
336
+ type: Number,
337
+ default: void 0
338
+ },
339
+ options: {
340
+ type: Array,
341
+ default: () => []
342
+ },
343
+ onChange: {
344
+ type: Function,
345
+ default: void 0
346
+ },
347
+ "onUpdate:modelValue": {
348
+ type: Function,
349
+ default: void 0
350
+ }
351
+ });
352
+ const checkboxGroupInjectionKey = Symbol("d-checkbox-group");
353
+ var Checkbox = defineComponent({
354
+ name: "DCheckbox",
355
+ props: checkboxProps,
356
+ emits: ["change", "update:checked", "update:modelValue"],
357
+ setup(props, ctx) {
358
+ const checkboxGroupConf = inject(checkboxGroupInjectionKey, null);
359
+ const isChecked = computed(() => props.checked || props.modelValue);
360
+ const mergedDisabled = computed(() => {
361
+ return (checkboxGroupConf == null ? void 0 : checkboxGroupConf.disabled.value) || props.disabled;
362
+ });
363
+ const mergedChecked = computed(() => {
364
+ var _a, _b;
365
+ return (_b = (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isItemChecked) == null ? void 0 : _a.call(checkboxGroupConf, props.value)) != null ? _b : isChecked.value;
366
+ });
367
+ const mergedIsShowTitle = computed(() => {
368
+ var _a;
369
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.isShowTitle.value) != null ? _a : props.isShowTitle;
370
+ });
371
+ const mergedShowAnimation = computed(() => {
372
+ var _a;
373
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.showAnimation.value) != null ? _a : props.showAnimation;
374
+ });
375
+ const mergedColor = computed(() => {
376
+ var _a;
377
+ return (_a = checkboxGroupConf == null ? void 0 : checkboxGroupConf.color.value) != null ? _a : props.color;
378
+ });
379
+ const itemWidth = checkboxGroupConf == null ? void 0 : checkboxGroupConf.itemWidth.value;
380
+ const direction = checkboxGroupConf == null ? void 0 : checkboxGroupConf.direction.value;
381
+ const canChange = (isChecked2, val) => {
382
+ var _a;
383
+ if (mergedDisabled.value) {
384
+ return Promise.resolve(false);
385
+ }
386
+ const beforeChange = (_a = props.beforeChange) != null ? _a : checkboxGroupConf == null ? void 0 : checkboxGroupConf.beforeChange;
387
+ if (beforeChange) {
388
+ const res = beforeChange(isChecked2, val);
389
+ if (typeof res === "boolean") {
390
+ return Promise.resolve(res);
391
+ }
392
+ return res;
393
+ }
394
+ return Promise.resolve(true);
395
+ };
396
+ const toggle = () => {
397
+ const current = !isChecked.value;
398
+ checkboxGroupConf == null ? void 0 : checkboxGroupConf.toggleGroupVal(props.value);
399
+ ctx.emit("update:checked", current);
400
+ ctx.emit("update:modelValue", current);
401
+ ctx.emit("change", current);
402
+ };
403
+ const handleClick = () => {
404
+ canChange(!isChecked.value, props.label).then((res) => res && toggle());
405
+ };
406
+ return {
407
+ itemWidth,
408
+ direction,
409
+ mergedColor,
410
+ mergedDisabled,
411
+ mergedIsShowTitle,
412
+ mergedChecked,
413
+ mergedShowAnimation,
414
+ handleClick
415
+ };
416
+ },
417
+ render() {
418
+ var _a;
419
+ const {
420
+ itemWidth,
421
+ direction,
422
+ mergedChecked,
423
+ mergedDisabled,
424
+ mergedIsShowTitle,
425
+ mergedShowAnimation,
426
+ halfchecked,
427
+ title,
428
+ label,
429
+ handleClick,
430
+ name,
431
+ value,
432
+ mergedColor,
433
+ $slots
434
+ } = this;
435
+ const wrapperCls = {
436
+ "devui-checkbox-column-margin": direction === "column",
437
+ "devui-checkbox-wrap": typeof itemWidth !== "undefined"
438
+ };
439
+ const wrapperStyle = itemWidth ? [`width: ${itemWidth}px`] : [];
440
+ const checkboxCls = {
441
+ "devui-checkbox": true,
442
+ active: mergedChecked,
443
+ halfchecked,
444
+ disabled: mergedDisabled,
445
+ unchecked: !mergedChecked
446
+ };
447
+ const labelTitle = mergedIsShowTitle ? title || label : "";
448
+ const bgImgStyle = mergedColor && halfchecked || mergedColor ? `linear-gradient(${mergedColor}, ${mergedColor})` : "";
449
+ const spanStyle = [`border-color:${(mergedChecked || halfchecked) && mergedColor ? mergedColor : ""}`, `background-image:${bgImgStyle}`, `background-color:${mergedColor && halfchecked ? mergedColor : ""}`];
450
+ const spanCls = {
451
+ "devui-checkbox-material": true,
452
+ "custom-color": mergedColor,
453
+ "devui-checkbox-no-label": !label && !$slots.default,
454
+ "devui-no-animation": !mergedShowAnimation,
455
+ "devui-checkbox-default-background": !halfchecked
456
+ };
457
+ const polygonCls = {
458
+ "devui-tick": true,
459
+ "devui-no-animation": !mergedShowAnimation
460
+ };
461
+ const stopPropagation = ($event) => $event.stopPropagation();
462
+ const inputProps = {
463
+ indeterminate: halfchecked
464
+ };
465
+ return createVNode("div", {
466
+ "class": wrapperCls,
467
+ "style": wrapperStyle
468
+ }, [createVNode("div", {
469
+ "class": checkboxCls
470
+ }, [createVNode("label", {
471
+ "title": labelTitle,
472
+ "onClick": handleClick
473
+ }, [createVNode("input", mergeProps({
474
+ "name": name || value,
475
+ "class": "devui-checkbox-input",
476
+ "type": "checkbox"
477
+ }, inputProps, {
478
+ "checked": mergedChecked,
479
+ "disabled": mergedDisabled,
480
+ "onClick": stopPropagation,
481
+ "onChange": stopPropagation
482
+ }), null), createVNode("span", {
483
+ "style": spanStyle,
484
+ "class": spanCls
485
+ }, [createVNode("span", {
486
+ "class": "devui-checkbox-halfchecked-bg"
487
+ }, null), createVNode("svg", {
488
+ "viewBox": "0 0 16 16",
489
+ "version": "1.1",
490
+ "xmlns": "http://www.w3.org/2000/svg",
491
+ "class": "devui-checkbox-tick"
492
+ }, [createVNode("g", {
493
+ "stroke": "none",
494
+ "stroke-width": "1",
495
+ "fill": "none",
496
+ "fill-rule": "evenodd"
497
+ }, [createVNode("polygon", {
498
+ "fill-rule": "nonzero",
499
+ "points": "5.17391304 6.56521739 7.7173913 9.10869565 11.826087 5 13 6.17391304 7.7173913 11.4565217 4 7.73913043",
500
+ "class": polygonCls
501
+ }, null)])])]), label || ((_a = $slots.default) == null ? void 0 : _a.call($slots))])])]);
502
+ }
503
+ });
504
+ var checkboxGroup = "";
505
+ var CheckboxGroup = defineComponent({
506
+ name: "DCheckboxGroup",
507
+ props: checkboxGroupProps,
508
+ emits: ["change", "update:modelValue"],
509
+ setup(props, ctx) {
510
+ const valList = toRef(props, "modelValue");
511
+ const defaultOpt = {
512
+ checked: false,
513
+ isShowTitle: true,
514
+ halfchecked: false,
515
+ showAnimation: true,
516
+ disabled: false
517
+ };
518
+ const toggleGroupVal = (val) => {
519
+ let index2 = -1;
520
+ if (typeof valList.value[0] === "string") {
521
+ index2 = valList.value.findIndex((item) => item === val);
522
+ } else if (typeof valList.value[0] === "object") {
523
+ index2 = valList.value.findIndex((item) => item.value === val);
524
+ }
525
+ if (index2 === -1) {
526
+ if (typeof props.options[0] === "object") {
527
+ const newOne = props.options.find((item) => item.value === val);
528
+ const res2 = [...valList.value, newOne];
529
+ ctx.emit("update:modelValue", res2);
530
+ ctx.emit("change", res2);
531
+ return;
532
+ }
533
+ const res = [...valList.value, val];
534
+ ctx.emit("update:modelValue", res);
535
+ ctx.emit("change", res);
536
+ return;
537
+ }
538
+ valList.value.splice(index2, 1);
539
+ ctx.emit("update:modelValue", valList.value);
540
+ ctx.emit("change", valList.value);
541
+ };
542
+ const isItemChecked = (itemVal) => {
543
+ if (typeof valList.value[0] === "string") {
544
+ return valList.value.includes(itemVal);
545
+ } else if (typeof valList.value[0] === "object") {
546
+ return valList.value.some((item) => item.value === itemVal);
547
+ }
548
+ };
549
+ provide(checkboxGroupInjectionKey, {
550
+ disabled: toRef(props, "disabled"),
551
+ isShowTitle: toRef(props, "isShowTitle"),
552
+ color: toRef(props, "color"),
553
+ showAnimation: toRef(props, "showAnimation"),
554
+ beforeChange: props.beforeChange,
555
+ isItemChecked,
556
+ toggleGroupVal,
557
+ itemWidth: toRef(props, "itemWidth"),
558
+ direction: toRef(props, "direction")
559
+ });
560
+ return {
561
+ defaultOpt
562
+ };
563
+ },
564
+ render() {
565
+ var _a;
566
+ const {
567
+ direction,
568
+ $slots,
569
+ defaultOpt,
570
+ options
571
+ } = this;
572
+ let children = (_a = $slots.default) == null ? void 0 : _a.call($slots);
573
+ if ((options == null ? void 0 : options.length) > 0) {
574
+ children = options.map((opt) => {
575
+ let mergedOpt = null;
576
+ if (typeof opt === "string") {
577
+ mergedOpt = Object.assign({}, defaultOpt, {
578
+ label: opt,
579
+ value: opt
580
+ });
581
+ } else if (typeof opt === "object") {
582
+ mergedOpt = Object.assign({}, defaultOpt, __spreadProps(__spreadValues({}, opt), {
583
+ label: opt.name
584
+ }));
585
+ }
586
+ return createVNode(Checkbox, mergedOpt, null);
587
+ });
588
+ }
589
+ return createVNode("div", {
590
+ "class": "devui-checkbox-group"
591
+ }, [createVNode("div", {
592
+ "class": {
593
+ "devui-checkbox-list-inline": direction === "row"
594
+ }
595
+ }, [children])]);
596
+ }
597
+ });
598
+ Checkbox.install = function(app) {
599
+ app.component(Checkbox.name, Checkbox);
600
+ };
601
+ CheckboxGroup.install = function(app) {
602
+ app.component(CheckboxGroup.name, CheckboxGroup);
603
+ };
604
+ var sort = "";
605
+ const Sort = defineComponent({
606
+ props: {
607
+ modelValue: {
608
+ type: String,
609
+ default: ""
610
+ },
611
+ "onUpdate:modelValue": {
612
+ type: Function
613
+ }
614
+ },
615
+ emits: ["update:modelValue"],
616
+ setup(props, ctx) {
617
+ const changeDirection = () => {
618
+ let direction = "";
619
+ if (props.modelValue === "ASC") {
620
+ direction = "DESC";
621
+ } else if (props.modelValue === "DESC") {
622
+ direction = "";
623
+ } else {
624
+ direction = "ASC";
625
+ }
626
+ ctx.emit("update:modelValue", direction);
627
+ };
628
+ return () => createVNode("span", {
629
+ "onClick": changeDirection,
630
+ "class": "sort-clickable"
631
+ }, [createVNode("i", {
632
+ "class": ["datatable-svg", {
633
+ "sort-icon-default": !props.modelValue,
634
+ "sort-icon-asc": props.modelValue === "ASC",
635
+ "sort-icon-desc": props.modelValue === "DESC"
636
+ }]
637
+ }, [createVNode("svg", {
638
+ "width": "16px",
639
+ "height": "16px",
640
+ "viewBox": "0 0 16 16",
641
+ "version": "1.1",
642
+ "xmlns": "http://www.w3.org/2000/svg",
643
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
644
+ }, [createVNode("defs", null, [createVNode("circle", {
645
+ "id": "sort-svg-path-1",
646
+ "cx": "8",
647
+ "cy": "8",
648
+ "r": "8"
649
+ }, null), createVNode("filter", {
650
+ "x": "-34.4%",
651
+ "y": "-21.9%",
652
+ "width": "168.8%",
653
+ "height": "168.8%",
654
+ "filterUnits": "objectBoundingBox",
655
+ "id": "filter-2"
656
+ }, [createVNode("feOffset", {
657
+ "dx": "0",
658
+ "dy": "2",
659
+ "in": "SourceAlpha",
660
+ "result": "shadowOffsetOuter1"
661
+ }, null), createVNode("feGaussianBlur", {
662
+ "stdDeviation": "1.5",
663
+ "in": "shadowOffsetOuter1",
664
+ "result": "shadowBlurOuter1"
665
+ }, null), createVNode("feColorMatrix", {
666
+ "values": "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.085309222 0",
667
+ "type": "matrix",
668
+ "in": "shadowBlurOuter1"
669
+ }, null)])]), createVNode("g", {
670
+ "stroke": "none",
671
+ "stroke-width": "1",
672
+ "fill": "none",
673
+ "fill-rule": "evenodd"
674
+ }, [createVNode("use", {
675
+ "fill-rule": "evenodd",
676
+ "xlink:href": "#sort-svg-path-1"
677
+ }, null), createVNode("polygon", {
678
+ "points": "8 4 11 7 5 7"
679
+ }, null), createVNode("polygon", {
680
+ "points": "8 12 5 9 11 9"
681
+ }, null)])])])]);
682
+ }
683
+ });
684
+ const dropdownProps = {
685
+ origin: {
686
+ type: Object
687
+ },
688
+ isOpen: {
689
+ type: Boolean,
690
+ default: false
691
+ },
692
+ disabled: {
693
+ type: Boolean,
694
+ default: false
695
+ },
696
+ trigger: {
697
+ type: String,
698
+ default: "click"
699
+ },
700
+ closeScope: {
701
+ type: String,
702
+ default: "all"
703
+ },
704
+ closeOnMouseLeaveMenu: {
705
+ type: Boolean,
706
+ default: false
707
+ },
708
+ showAnimation: {
709
+ type: Boolean,
710
+ default: true
711
+ }
712
+ };
713
+ function isComponent(target) {
714
+ return !!(target == null ? void 0 : target.$el);
715
+ }
716
+ function getElement(element) {
717
+ if (element instanceof Element) {
718
+ return element;
719
+ }
720
+ if (element && typeof element === "object" && element.$el instanceof Element) {
721
+ return element.$el;
722
+ }
723
+ return null;
724
+ }
725
+ function subscribeEvent(dom, type, callback) {
726
+ dom == null ? void 0 : dom.addEventListener(type, callback);
727
+ return () => {
728
+ dom == null ? void 0 : dom.removeEventListener(type, callback);
729
+ };
730
+ }
731
+ const useDropdown = ({
732
+ visible,
733
+ trigger,
734
+ origin,
735
+ closeScope,
736
+ closeOnMouseLeaveMenu
737
+ }) => {
738
+ const dropdownElRef = ref();
739
+ const closeByScope = () => {
740
+ if (closeScope.value === "none") {
741
+ return;
742
+ }
743
+ visible.value = false;
744
+ };
745
+ watch([trigger, origin, dropdownElRef], ([trigger2, origin2, dropdownEl], ov, onInvalidate) => {
746
+ const originEl = getElement(origin2);
747
+ if (!originEl || !dropdownEl) {
748
+ return;
749
+ }
750
+ const subscriptions = [
751
+ subscribeEvent(dropdownEl, "click", () => {
752
+ if (closeScope.value === "all") {
753
+ visible.value = false;
754
+ }
755
+ })
756
+ ];
757
+ if (trigger2 === "click") {
758
+ subscriptions.push(subscribeEvent(originEl, "click", () => visible.value = !visible.value), subscribeEvent(document, "click", (e) => {
759
+ if (!visible.value) {
760
+ return;
761
+ }
762
+ const target = e.target;
763
+ const isContain = originEl.contains(target) || dropdownEl.contains(target);
764
+ if (isContain) {
765
+ return;
766
+ }
767
+ closeByScope();
768
+ }), subscribeEvent(dropdownEl, "mouseleave", () => {
769
+ if (closeOnMouseLeaveMenu.value) {
770
+ visible.value = false;
771
+ }
772
+ }));
773
+ } else if (trigger2 === "hover") {
774
+ let overlayEnter = false;
775
+ let originEnter = false;
776
+ const handleLeave = async (elementType) => {
777
+ await new Promise((resolve) => setTimeout(resolve, 50));
778
+ if (elementType === "origin" && overlayEnter || elementType === "dropdown" && originEnter) {
779
+ return;
780
+ }
781
+ closeByScope();
782
+ };
783
+ subscriptions.push(subscribeEvent(originEl, "mouseenter", () => {
784
+ originEnter = true;
785
+ visible.value = true;
786
+ }), subscribeEvent(originEl, "mouseleave", () => {
787
+ originEnter = false;
788
+ if (!closeOnMouseLeaveMenu.value) {
789
+ handleLeave("origin");
790
+ }
791
+ }), subscribeEvent(dropdownEl, "mouseenter", () => {
792
+ overlayEnter = true;
793
+ visible.value = true;
794
+ }), subscribeEvent(dropdownEl, "mouseleave", () => {
795
+ overlayEnter = false;
796
+ handleLeave("dropdown");
797
+ }));
798
+ }
799
+ onInvalidate(() => subscriptions.forEach((v) => v()));
800
+ });
801
+ return { dropdownEl: dropdownElRef };
802
+ };
803
+ var overlay = "";
804
+ function _isSlot(s) {
805
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
806
+ }
807
+ const CommonOverlay = defineComponent({
808
+ setup(props, ctx) {
809
+ return () => {
810
+ let _slot;
811
+ return createVNode(Teleport, {
812
+ "to": "#d-overlay-anchor"
813
+ }, {
814
+ default: () => [createVNode(Transition, {
815
+ "name": "devui-overlay-fade"
816
+ }, _isSlot(_slot = renderSlot(ctx.slots, "default")) ? _slot : {
817
+ default: () => [_slot]
818
+ })]
819
+ });
820
+ };
821
+ }
822
+ });
823
+ const overlayProps = {
824
+ visible: {
825
+ type: Boolean
826
+ },
827
+ backgroundBlock: {
828
+ type: Boolean,
829
+ default: false
830
+ },
831
+ backgroundClass: {
832
+ type: String,
833
+ default: ""
834
+ },
835
+ backgroundStyle: {
836
+ type: [String, Object]
837
+ },
838
+ onBackdropClick: {
839
+ type: Function
840
+ },
841
+ backdropClose: {
842
+ type: Boolean,
843
+ default: true
844
+ },
845
+ hasBackdrop: {
846
+ type: Boolean,
847
+ default: true
848
+ }
849
+ };
850
+ const overlayEmits = ["update:visible", "backdropClick"];
851
+ const fixedOverlayProps = __spreadProps(__spreadValues({}, overlayProps), {
852
+ overlayStyle: {
853
+ type: [String, Object],
854
+ default: void 0
855
+ }
856
+ });
857
+ const flexibleOverlayProps = __spreadValues({
858
+ origin: {
859
+ type: Object,
860
+ require: true
861
+ },
862
+ position: {
863
+ type: Object,
864
+ default: () => ({
865
+ originX: "left",
866
+ originY: "top",
867
+ overlayX: "left",
868
+ overlayY: "top"
869
+ })
870
+ }
871
+ }, overlayProps);
872
+ function useOverlayLogic(props, ctx) {
873
+ const backgroundClass = computed(() => {
874
+ return [
875
+ "devui-overlay-background",
876
+ props.backgroundClass,
877
+ !props.hasBackdrop ? "devui-overlay-background__disabled" : "devui-overlay-background__color"
878
+ ];
879
+ });
880
+ const overlayClass = computed(() => {
881
+ return "devui-overlay";
882
+ });
883
+ const handleBackdropClick = (event) => {
884
+ var _a;
885
+ event.preventDefault();
886
+ (_a = props.onBackdropClick) == null ? void 0 : _a.call(props);
887
+ if (props.backdropClose) {
888
+ ctx.emit("update:visible", false);
889
+ }
890
+ };
891
+ const handleOverlayBubbleCancel = (event) => event.cancelBubble = true;
892
+ onMounted(() => {
893
+ const body2 = document.body;
894
+ const originOverflow = body2.style.overflow;
895
+ const originPosition = body2.style.position;
896
+ watch([() => props.visible, () => props.backgroundBlock], ([visible, backgroundBlock]) => {
897
+ if (backgroundBlock) {
898
+ const top = body2.getBoundingClientRect().y;
899
+ if (visible) {
900
+ body2.style.overflowY = "scroll";
901
+ body2.style.position = visible ? "fixed" : "";
902
+ body2.style.top = `${top}px`;
903
+ } else {
904
+ body2.style.overflowY = originOverflow;
905
+ body2.style.position = originPosition;
906
+ body2.style.top = "";
907
+ window.scrollTo(0, -top);
908
+ }
909
+ }
910
+ });
911
+ onUnmounted(() => {
912
+ document.body.style.overflow = originOverflow;
913
+ });
914
+ });
915
+ return {
916
+ backgroundClass,
917
+ overlayClass,
918
+ handleBackdropClick,
919
+ handleOverlayBubbleCancel
920
+ };
921
+ }
922
+ const FixedOverlay = defineComponent({
923
+ name: "DFixedOverlay",
924
+ props: fixedOverlayProps,
925
+ emits: overlayEmits,
926
+ setup(props, ctx) {
927
+ const {
928
+ backgroundClass,
929
+ overlayClass,
930
+ handleBackdropClick,
931
+ handleOverlayBubbleCancel
932
+ } = useOverlayLogic(props, ctx);
933
+ return () => createVNode(CommonOverlay, null, {
934
+ default: () => [withDirectives(createVNode("div", {
935
+ "class": backgroundClass.value,
936
+ "style": props.backgroundStyle,
937
+ "onClick": handleBackdropClick
938
+ }, [createVNode("div", {
939
+ "class": overlayClass.value,
940
+ "style": props.overlayStyle,
941
+ "onClick": handleOverlayBubbleCancel
942
+ }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
943
+ });
944
+ }
945
+ });
946
+ const FlexibleOverlay = defineComponent({
947
+ name: "DFlexibleOverlay",
948
+ props: flexibleOverlayProps,
949
+ emits: overlayEmits,
950
+ setup(props, ctx) {
951
+ const overlayRef = ref(null);
952
+ const positionedStyle = reactive({
953
+ position: "absolute"
954
+ });
955
+ onMounted(async () => {
956
+ const handleRectChange = (position, rect, origin) => {
957
+ const point = calculatePosition(position, rect, origin);
958
+ positionedStyle.left = `${point.x}px`;
959
+ positionedStyle.top = `${point.y}px`;
960
+ };
961
+ const locationElements = computed(() => {
962
+ const overlay2 = overlayRef.value;
963
+ const origin = getOrigin(props.origin);
964
+ if (!overlay2 || !origin) {
965
+ return;
966
+ }
967
+ return {
968
+ origin,
969
+ overlay: overlay2
970
+ };
971
+ });
972
+ const visibleRef = toRef(props, "visible");
973
+ const positionRef = toRef(props, "position");
974
+ watch([locationElements, visibleRef, positionRef], async ([locationElements2, visible, position], ov, onInvalidate) => {
975
+ if (!visible || !locationElements2) {
976
+ return;
977
+ }
978
+ const {
979
+ origin,
980
+ overlay: overlay2
981
+ } = locationElements2;
982
+ handleRectChange(position, overlay2.getBoundingClientRect(), origin);
983
+ const unsubscriptions = [subscribeLayoutEvent(() => handleRectChange(position, overlay2.getBoundingClientRect(), origin)), subscribeOverlayResize(overlay2, (entries) => handleRectChange(position, entries[0].contentRect, origin)), subscribeOriginResize(origin, () => handleRectChange(position, overlay2.getBoundingClientRect(), origin))];
984
+ onInvalidate(() => {
985
+ unsubscriptions.forEach((fn) => fn());
986
+ });
987
+ });
988
+ });
989
+ const {
990
+ backgroundClass,
991
+ overlayClass,
992
+ handleBackdropClick,
993
+ handleOverlayBubbleCancel
994
+ } = useOverlayLogic(props);
995
+ return () => createVNode(CommonOverlay, null, {
996
+ default: () => [withDirectives(createVNode("div", {
997
+ "style": props.backgroundStyle,
998
+ "class": backgroundClass.value,
999
+ "onClick": handleBackdropClick
1000
+ }, [createVNode("div", {
1001
+ "ref": overlayRef,
1002
+ "class": overlayClass.value,
1003
+ "style": positionedStyle,
1004
+ "onClick": handleOverlayBubbleCancel
1005
+ }, [renderSlot(ctx.slots, "default")])]), [[vShow, props.visible]])]
1006
+ });
1007
+ }
1008
+ });
1009
+ function getOrigin(origin) {
1010
+ if (origin instanceof Element) {
1011
+ return origin;
1012
+ }
1013
+ if (isRef(origin)) {
1014
+ return getElement(origin.value);
1015
+ }
1016
+ if (isComponent(origin)) {
1017
+ return getElement(origin);
1018
+ }
1019
+ return origin;
1020
+ }
1021
+ function calculatePosition(position, rect, origin) {
1022
+ const originRect = getOriginRect(origin);
1023
+ const originPoint = getOriginRelativePoint(originRect, position);
1024
+ return getOverlayPoint(originPoint, rect, position);
1025
+ }
1026
+ function getOriginRect(origin) {
1027
+ if (origin instanceof Element) {
1028
+ return origin.getBoundingClientRect();
1029
+ }
1030
+ const width = origin.width || 0;
1031
+ const height = origin.height || 0;
1032
+ return {
1033
+ top: origin.y,
1034
+ bottom: origin.y + height,
1035
+ left: origin.x,
1036
+ right: origin.x + width,
1037
+ height,
1038
+ width
1039
+ };
1040
+ }
1041
+ function getOverlayPoint(originPoint, rect, position) {
1042
+ let x;
1043
+ const {
1044
+ width,
1045
+ height
1046
+ } = rect;
1047
+ if (position.overlayX == "center") {
1048
+ x = originPoint.x - width / 2;
1049
+ } else {
1050
+ x = position.overlayX == "left" ? originPoint.x : originPoint.x - width;
1051
+ }
1052
+ let y;
1053
+ if (position.overlayY == "center") {
1054
+ y = originPoint.y - height / 2;
1055
+ } else {
1056
+ y = position.overlayY == "top" ? originPoint.y : originPoint.y - height;
1057
+ }
1058
+ return {
1059
+ x,
1060
+ y
1061
+ };
1062
+ }
1063
+ function getOriginRelativePoint(originRect, position) {
1064
+ let x;
1065
+ if (position.originX == "center") {
1066
+ x = originRect.left + originRect.width / 2;
1067
+ } else {
1068
+ const startX = originRect.left;
1069
+ const endX = originRect.right;
1070
+ x = position.originX == "left" ? startX : endX;
1071
+ }
1072
+ let y;
1073
+ if (position.originY == "center") {
1074
+ y = originRect.top + originRect.height / 2;
1075
+ } else {
1076
+ y = position.originY == "top" ? originRect.top : originRect.bottom;
1077
+ }
1078
+ return {
1079
+ x,
1080
+ y
1081
+ };
1082
+ }
1083
+ function subscribeLayoutEvent(event) {
1084
+ window.addEventListener("scroll", event, true);
1085
+ window.addEventListener("resize", event);
1086
+ window.addEventListener("orientationchange", event);
1087
+ return () => {
1088
+ window.removeEventListener("scroll", event, true);
1089
+ window.removeEventListener("resize", event);
1090
+ window.removeEventListener("orientationchange", event);
1091
+ };
1092
+ }
1093
+ function subscribeOverlayResize(overlay2, callback) {
1094
+ if (overlay2 instanceof Element) {
1095
+ const resizeObserver = new ResizeObserver(callback);
1096
+ resizeObserver.observe(overlay2);
1097
+ return () => resizeObserver.disconnect();
1098
+ }
1099
+ return () => {
1100
+ };
1101
+ }
1102
+ function subscribeOriginResize(origin, callback) {
1103
+ if (origin instanceof Element) {
1104
+ const observer = new MutationObserver(callback);
1105
+ observer.observe(origin, {
1106
+ attributeFilter: ["style"]
1107
+ });
1108
+ return () => observer.disconnect();
1109
+ }
1110
+ return () => {
1111
+ };
1112
+ }
1113
+ FlexibleOverlay.install = function(app) {
1114
+ app.component(FlexibleOverlay.name, FlexibleOverlay);
1115
+ };
1116
+ FixedOverlay.install = function(app) {
1117
+ app.component(FixedOverlay.name, FixedOverlay);
1118
+ };
1119
+ var dropdown = "";
1120
+ var Dropdown = defineComponent({
1121
+ name: "DDropdown",
1122
+ props: dropdownProps,
1123
+ emits: [],
1124
+ setup(props, ctx) {
1125
+ const {
1126
+ isOpen,
1127
+ origin,
1128
+ trigger,
1129
+ closeScope,
1130
+ closeOnMouseLeaveMenu
1131
+ } = toRefs(props);
1132
+ const visible = ref(false);
1133
+ watch(isOpen, (value) => {
1134
+ visible.value = value;
1135
+ }, {
1136
+ immediate: true
1137
+ });
1138
+ const position = {
1139
+ originX: "center",
1140
+ originY: "bottom",
1141
+ overlayX: "center",
1142
+ overlayY: "top"
1143
+ };
1144
+ const {
1145
+ dropdownEl
1146
+ } = useDropdown({
1147
+ visible,
1148
+ origin,
1149
+ trigger,
1150
+ closeScope,
1151
+ closeOnMouseLeaveMenu
1152
+ });
1153
+ const animatedVisible = computed(() => {
1154
+ return props.showAnimation ? visible.value : true;
1155
+ });
1156
+ return () => {
1157
+ return createVNode(Fragment, null, [createVNode(FlexibleOverlay, {
1158
+ "origin": props.origin,
1159
+ "visible": visible.value,
1160
+ "onUpdate:visible": ($event) => visible.value = $event,
1161
+ "position": position,
1162
+ "hasBackdrop": false
1163
+ }, {
1164
+ default: () => [createVNode(Transition, {
1165
+ "name": "devui-dropdown-fade"
1166
+ }, {
1167
+ default: () => {
1168
+ var _a, _b;
1169
+ return [withDirectives(createVNode("div", {
1170
+ "ref": dropdownEl,
1171
+ "style": "min-width:102px"
1172
+ }, [(_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, animatedVisible.value]])];
1173
+ }
1174
+ })]
1175
+ })]);
1176
+ };
1177
+ }
1178
+ });
1179
+ Dropdown.install = function(app) {
1180
+ app.component(Dropdown.name, Dropdown);
1181
+ };
1182
+ var filter = "";
1183
+ const Filter = defineComponent({
1184
+ props: {
1185
+ modelValue: {
1186
+ type: Array,
1187
+ default: []
1188
+ },
1189
+ "onUpdate:modelValue": {
1190
+ type: Function
1191
+ },
1192
+ customTemplate: {
1193
+ type: Function
1194
+ },
1195
+ filterList: {
1196
+ type: Array,
1197
+ required: true
1198
+ },
1199
+ filterMultiple: {
1200
+ type: Boolean,
1201
+ default: true
1202
+ }
1203
+ },
1204
+ emits: ["update:modelValue"],
1205
+ setup(props) {
1206
+ const filterOrigin = ref(null);
1207
+ const onUpdateChecked = (config, value) => {
1208
+ const checkedList = props.modelValue;
1209
+ const update = props["onUpdate:modelValue"];
1210
+ const contained = !!checkedList.find((item) => item === config.value);
1211
+ if (value && !contained) {
1212
+ update == null ? void 0 : update([...checkedList, config.value]);
1213
+ } else if (!value && contained) {
1214
+ update == null ? void 0 : update(checkedList.filter((item) => config.value !== item));
1215
+ }
1216
+ };
1217
+ const updateSingleChecked = (config) => {
1218
+ var _a;
1219
+ (_a = props["onUpdate:modelValue"]) == null ? void 0 : _a.call(props, [config.value]);
1220
+ };
1221
+ const dropdownContent = computed(() => {
1222
+ const checkedList = props.modelValue;
1223
+ const isContained = (config) => !!checkedList.find((item) => item === config.value);
1224
+ return () => createVNode("ul", {
1225
+ "class": "devui-dropdown-menu data-table-column-filter-content",
1226
+ "style": "padding:10px"
1227
+ }, [props.filterList.map((item, index2) => {
1228
+ return createVNode("li", {
1229
+ "style": index2 > 0 ? "margin-top:10px" : ""
1230
+ }, [props.filterMultiple ? createVNode(Checkbox, {
1231
+ "modelValue": isContained(item),
1232
+ "onUpdate:modelValue": (value) => onUpdateChecked(item, value)
1233
+ }, {
1234
+ default: () => [item.name]
1235
+ }) : createVNode("span", {
1236
+ "onClick": () => updateSingleChecked(item)
1237
+ }, [item.name])]);
1238
+ })]);
1239
+ });
1240
+ return () => createVNode(Fragment, null, [createVNode("span", {
1241
+ "ref": filterOrigin
1242
+ }, [createVNode("i", {
1243
+ "class": ["filter-icon", {
1244
+ "filter-icon-active": true
1245
+ }]
1246
+ }, [createVNode("svg", {
1247
+ "width": "16px",
1248
+ "height": "16px",
1249
+ "viewBox": "0 0 16 16",
1250
+ "version": "1.1",
1251
+ "xmlns": "http://www.w3.org/2000/svg",
1252
+ "xmlns:xlink": "http://www.w3.org/1999/xlink"
1253
+ }, [createVNode("g", {
1254
+ "stroke": "none",
1255
+ "stroke-width": "1",
1256
+ "fill": "none",
1257
+ "fill-rule": "evenodd"
1258
+ }, [createVNode("g", null, [createVNode("polygon", {
1259
+ "points": "10.0085775 7 10.0085775 15 6 13 6 7 2 3 2 1 14 1 14 3"
1260
+ }, null)])])])])]), createVNode(Dropdown, {
1261
+ "origin": filterOrigin.value,
1262
+ "closeScope": "blank"
1263
+ }, {
1264
+ default: () => {
1265
+ var _a, _b;
1266
+ return [(_b = (_a = props.customTemplate) == null ? void 0 : _a.call(props, {
1267
+ value: props.modelValue,
1268
+ onChange: props["onUpdate:modelValue"]
1269
+ })) != null ? _b : dropdownContent.value()];
1270
+ }
1271
+ })]);
1272
+ }
1273
+ });
1274
+ var header = "";
1275
+ var body = "";
1276
+ const useSort = (store, column) => {
1277
+ const directionRef = ref("DESC");
1278
+ watch([directionRef, column], ([direction, column2]) => {
1279
+ if (column2.sortable) {
1280
+ store.sortData(column2.field, direction, column2.compareFn);
1281
+ }
1282
+ }, { immediate: true });
1283
+ return directionRef;
1284
+ };
1285
+ const useFliter = (store, column) => {
1286
+ const filteredRef = shallowRef();
1287
+ watch(filteredRef, (results) => {
1288
+ store.filterData(column.value.field, results);
1289
+ });
1290
+ return filteredRef;
1291
+ };
1292
+ var TableHeader = defineComponent({
1293
+ name: "DTableHeader",
1294
+ setup() {
1295
+ const table2 = inject(TABLE_TOKEN);
1296
+ const {
1297
+ _checkAll: checkAll,
1298
+ _halfChecked: halfChecked,
1299
+ _columns: columns,
1300
+ isFixedLeft
1301
+ } = table2.store.states;
1302
+ const thAttrs = computed(() => isFixedLeft.value ? {
1303
+ class: "devui-sticky-cell left",
1304
+ style: "left:0;"
1305
+ } : null);
1306
+ const checkbox2 = computed(() => table2.props.checkable ? createVNode("th", thAttrs.value, [createVNode(Checkbox, {
1307
+ "style": "padding:10px;",
1308
+ "modelValue": checkAll.value,
1309
+ "onUpdate:modelValue": ($event) => checkAll.value = $event,
1310
+ "halfchecked": halfChecked.value
1311
+ }, null)]) : null);
1312
+ return () => {
1313
+ return createVNode("thead", {
1314
+ "class": "devui-thead"
1315
+ }, [createVNode("tr", null, [checkbox2.value, columns.value.map((column, index2) => createVNode(Th, {
1316
+ "key": index2,
1317
+ "column": column
1318
+ }, null))])]);
1319
+ };
1320
+ }
1321
+ });
1322
+ const Th = defineComponent({
1323
+ props: {
1324
+ column: {
1325
+ type: Object,
1326
+ required: true
1327
+ }
1328
+ },
1329
+ setup(props) {
1330
+ const table2 = inject(TABLE_TOKEN);
1331
+ const {
1332
+ column
1333
+ } = toRefs(props);
1334
+ const directionRef = useSort(table2.store, column);
1335
+ const filteredRef = useFliter(table2.store, column);
1336
+ const {
1337
+ stickyCell,
1338
+ offsetStyle
1339
+ } = useFixedColumn(column);
1340
+ return () => createVNode("th", {
1341
+ "class": stickyCell.value,
1342
+ "style": offsetStyle.value
1343
+ }, [createVNode("div", {
1344
+ "class": "header-container"
1345
+ }, [props.column.renderHeader(), props.column.filterable && createVNode(Filter, {
1346
+ "modelValue": filteredRef.value,
1347
+ "onUpdate:modelValue": ($event) => filteredRef.value = $event,
1348
+ "filterList": props.column.filterList,
1349
+ "customTemplate": props.column.customFilterTemplate
1350
+ }, null)]), props.column.sortable && createVNode(Sort, {
1351
+ "modelValue": directionRef.value,
1352
+ "onUpdate:modelValue": ($event) => directionRef.value = $event
1353
+ }, null)]);
1354
+ }
1355
+ });
1356
+ var TableBody = defineComponent({
1357
+ name: "DTableBody",
1358
+ setup() {
1359
+ const table2 = inject(TABLE_TOKEN);
1360
+ const {
1361
+ _data: data,
1362
+ _columns: columns,
1363
+ _checkList: checkList,
1364
+ isFixedLeft
1365
+ } = table2.store.states;
1366
+ const hoverEnabled = computed(() => table2.props.rowHoveredHighlight);
1367
+ const tdAttrs = computed(() => isFixedLeft.value ? {
1368
+ class: "devui-sticky-cell left",
1369
+ style: "left:0;"
1370
+ } : null);
1371
+ const renderCheckbox = (index2) => table2.props.checkable ? createVNode("td", tdAttrs.value, [createVNode(Checkbox, {
1372
+ "modelValue": checkList.value[index2],
1373
+ "onUpdate:modelValue": ($event) => checkList.value[index2] = $event
1374
+ }, null)]) : null;
1375
+ return () => createVNode("tbody", {
1376
+ "class": "devui-tbody"
1377
+ }, [data.value.map((row, rowIndex) => {
1378
+ return createVNode("tr", {
1379
+ "key": rowIndex,
1380
+ "class": {
1381
+ "hover-enabled": hoverEnabled.value
1382
+ }
1383
+ }, [renderCheckbox(rowIndex), columns.value.map((column, index2) => createVNode(TD, {
1384
+ "column": column,
1385
+ "index": index2,
1386
+ "row": row
1387
+ }, null))]);
1388
+ })]);
1389
+ }
1390
+ });
1391
+ const TD = defineComponent({
1392
+ props: {
1393
+ column: {
1394
+ type: Object
1395
+ },
1396
+ row: {
1397
+ type: Object
1398
+ },
1399
+ index: {
1400
+ type: Number
1401
+ }
1402
+ },
1403
+ setup(props) {
1404
+ const column = toRef(props, "column");
1405
+ const {
1406
+ stickyCell,
1407
+ offsetStyle
1408
+ } = useFixedColumn(column);
1409
+ return () => createVNode("td", {
1410
+ "class": stickyCell.value,
1411
+ "style": offsetStyle.value
1412
+ }, [column.value.renderCell(props.row, props.index)]);
1413
+ }
1414
+ });
1415
+ var table = "";
1416
+ var Table = defineComponent({
1417
+ name: "DTable",
1418
+ props: TableProps,
1419
+ setup(props, ctx) {
1420
+ const table2 = getCurrentInstance();
1421
+ const store = createStore(toRef(props, "data"));
1422
+ table2.store = store;
1423
+ provide(TABLE_TOKEN, table2);
1424
+ const {
1425
+ classes,
1426
+ style
1427
+ } = useTable(props);
1428
+ const isEmpty = computed(() => props.data.length === 0);
1429
+ const fixHeaderCompo = computed(() => {
1430
+ return createVNode("div", {
1431
+ "class": "devui-table-view"
1432
+ }, [createVNode("div", {
1433
+ "style": "overflow: hidden scroll;"
1434
+ }, [createVNode("table", {
1435
+ "class": classes.value,
1436
+ "cellpadding": "0",
1437
+ "cellspacing": "0"
1438
+ }, [createVNode(ColGroup, null, null), createVNode(TableHeader, null, null)])]), createVNode("div", {
1439
+ "class": "scroll-view"
1440
+ }, [createVNode("table", {
1441
+ "class": classes.value,
1442
+ "cellpadding": "0",
1443
+ "cellspacing": "0"
1444
+ }, [createVNode(ColGroup, null, null), !isEmpty.value && createVNode(TableBody, {
1445
+ "style": "flex: 1"
1446
+ }, null)])])]);
1447
+ });
1448
+ const normalHeaderCompo = computed(() => {
1449
+ return createVNode("table", {
1450
+ "class": classes.value,
1451
+ "cellpadding": "0",
1452
+ "cellspacing": "0"
1453
+ }, [createVNode(ColGroup, null, null), createVNode(TableHeader, {
1454
+ "style": "position: relative"
1455
+ }, null), !isEmpty.value && createVNode(TableBody, null, null)]);
1456
+ });
1457
+ ctx.expose({
1458
+ getCheckedRows() {
1459
+ return store.getCheckedRows();
1460
+ }
1461
+ });
1462
+ return () => withDirectives(createVNode("div", {
1463
+ "class": "devui-table-wrapper",
1464
+ "style": style.value
1465
+ }, [ctx.slots.default(), props.fixHeader ? fixHeaderCompo.value : normalHeaderCompo.value, isEmpty.value && createVNode("div", {
1466
+ "class": "devui-table-empty"
1467
+ }, [createTextVNode("No Data")])]), [[resolveDirective("dLoading"), props.showLoading]]);
1468
+ }
1469
+ });
1470
+ const TableColumnProps = {
1471
+ header: {
1472
+ type: String,
1473
+ default: ""
1474
+ },
1475
+ field: {
1476
+ type: String,
1477
+ default: ""
1478
+ },
1479
+ width: {
1480
+ type: [String, Number],
1481
+ default: ""
1482
+ },
1483
+ minWidth: {
1484
+ type: [String, Number],
1485
+ default: 80
1486
+ },
1487
+ formatter: {
1488
+ type: Function
1489
+ },
1490
+ order: {
1491
+ type: Number,
1492
+ default: 0
1493
+ },
1494
+ sortable: {
1495
+ type: Boolean,
1496
+ default: false
1497
+ },
1498
+ compareFn: {
1499
+ type: Function,
1500
+ default: (field, a, b) => a[field] < b[field]
1501
+ },
1502
+ filterable: {
1503
+ type: Boolean,
1504
+ default: false
1505
+ },
1506
+ filterMultiple: {
1507
+ type: Boolean,
1508
+ default: false
1509
+ },
1510
+ filterList: {
1511
+ type: Array,
1512
+ default: []
1513
+ },
1514
+ fixedLeft: {
1515
+ type: String
1516
+ },
1517
+ fixedRight: {
1518
+ type: String
1519
+ }
1520
+ };
1521
+ function formatWidth(width) {
1522
+ if (typeof width === "number") {
1523
+ return width;
1524
+ }
1525
+ return parseInt(width, 10) || 0;
1526
+ }
1527
+ function formatMinWidth(minWidth) {
1528
+ return formatWidth(minWidth) || 80;
1529
+ }
1530
+ function createColumn(props, templates) {
1531
+ const {
1532
+ field,
1533
+ header: header2,
1534
+ sortable,
1535
+ width,
1536
+ minWidth,
1537
+ formatter,
1538
+ compareFn,
1539
+ filterable,
1540
+ filterList,
1541
+ filterMultiple,
1542
+ order,
1543
+ fixedLeft,
1544
+ fixedRight
1545
+ } = props;
1546
+ const column = reactive({});
1547
+ watch([field, header2, order], ([field2, header22, order2]) => {
1548
+ column.field = field2;
1549
+ column.header = header22;
1550
+ column.order = order2;
1551
+ }, { immediate: true });
1552
+ watch([sortable, compareFn], ([sortable2, compareFn2]) => {
1553
+ column.sortable = sortable2;
1554
+ column.compareFn = compareFn2;
1555
+ });
1556
+ watch([
1557
+ filterable,
1558
+ filterList,
1559
+ filterMultiple
1560
+ ], ([filterable2, filterList2, filterMultiple2]) => {
1561
+ column.filterable = filterable2;
1562
+ column.filterMultiple = filterMultiple2;
1563
+ column.filterList = filterList2;
1564
+ }, { immediate: true });
1565
+ watch([fixedLeft, fixedRight], ([left, right]) => {
1566
+ column.fixedLeft = left;
1567
+ column.fixedRight = right;
1568
+ }, { immediate: true });
1569
+ watch([width, minWidth], ([width2, minWidth2]) => {
1570
+ column.width = formatWidth(width2);
1571
+ column.minWidth = formatMinWidth(minWidth2);
1572
+ column.realWidth = column.width || column.minWidth;
1573
+ });
1574
+ onBeforeMount(() => {
1575
+ column.renderHeader = defaultRenderHeader;
1576
+ column.renderCell = defaultRenderCell;
1577
+ column.formatter = formatter.value;
1578
+ column.customFilterTemplate = templates.customFilterTemplate;
1579
+ column.subColumns = templates.subColumns;
1580
+ });
1581
+ return column;
1582
+ }
1583
+ function defaultRenderHeader() {
1584
+ return h("span", { class: "title" }, this.header);
1585
+ }
1586
+ function defaultRenderCell(rowData, index2) {
1587
+ var _a, _b;
1588
+ const value = rowData[this.field];
1589
+ if (this.formatter) {
1590
+ return this.formatter(rowData, value, index2);
1591
+ }
1592
+ return (_b = (_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) != null ? _b : "";
1593
+ }
1594
+ var Column = defineComponent({
1595
+ name: "DColumn",
1596
+ props: TableColumnProps,
1597
+ setup(props, ctx) {
1598
+ const column = createColumn(toRefs(props), ctx.slots);
1599
+ const parent = inject(TABLE_TOKEN);
1600
+ onMounted(() => {
1601
+ parent.store.insertColumn(column);
1602
+ watch(() => column.order, () => {
1603
+ parent.store.sortColumn();
1604
+ });
1605
+ });
1606
+ onBeforeUnmount(() => {
1607
+ parent.store.removeColumn(column);
1608
+ });
1609
+ },
1610
+ render() {
1611
+ return null;
1612
+ }
1613
+ });
1614
+ Table.install = function(app) {
1615
+ app.component(Table.name, Table);
1616
+ app.component(Column.name, Column);
1617
+ };
1618
+ var index = {
1619
+ title: "Table \u8868\u683C",
1620
+ category: "\u6570\u636E\u5C55\u793A",
1621
+ status: "10%",
1622
+ install(app) {
1623
+ app.use(Table);
1624
+ }
1625
+ };
1626
+ export { Column, Table, index as default };