vue-devui 1.0.0-alpha.5 → 1.0.0-beta.11

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