@falcon-ui/falcon-ui 1.0.0

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 (289) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +182 -0
  3. package/cjs/JsBarcode-BlUjuVmB.cjs +3519 -0
  4. package/cjs/JsBarcode-BlUjuVmB.cjs.map +1 -0
  5. package/cjs/chunk-D4y6LrGi.cjs +40 -0
  6. package/cjs/components/JsBarcode-BOXEZn4Q.cjs +3519 -0
  7. package/cjs/components/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  8. package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs +3519 -0
  9. package/cjs/components/barcode/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  10. package/cjs/components/barcode/chunk-D4y6LrGi.cjs +40 -0
  11. package/cjs/components/barcode/index.cjs +211 -0
  12. package/cjs/components/barcode/index.cjs.map +1 -0
  13. package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs +3519 -0
  14. package/cjs/components/barcode/src/JsBarcode-BOXEZn4Q.cjs.map +1 -0
  15. package/cjs/components/barcode/src/barcode.cjs +102 -0
  16. package/cjs/components/barcode/src/barcode.cjs.map +1 -0
  17. package/cjs/components/barcode/src/barcode.vue.cjs +200 -0
  18. package/cjs/components/barcode/src/barcode.vue.cjs.map +1 -0
  19. package/cjs/components/barcode/src/chunk-D4y6LrGi.cjs +40 -0
  20. package/cjs/components/button/index.cjs +135 -0
  21. package/cjs/components/button/index.cjs.map +1 -0
  22. package/cjs/components/button/src/button.cjs +16 -0
  23. package/cjs/components/button/src/button.cjs.map +1 -0
  24. package/cjs/components/button/src/button.vue.cjs +124 -0
  25. package/cjs/components/button/src/button.vue.cjs.map +1 -0
  26. package/cjs/components/chunk-D4y6LrGi.cjs +40 -0
  27. package/cjs/components/date-picker/index.cjs +164 -0
  28. package/cjs/components/date-picker/index.cjs.map +1 -0
  29. package/cjs/components/date-picker/src/date-picker.cjs +25 -0
  30. package/cjs/components/date-picker/src/date-picker.cjs.map +1 -0
  31. package/cjs/components/date-picker/src/date-picker.vue.cjs +153 -0
  32. package/cjs/components/date-picker/src/date-picker.vue.cjs.map +1 -0
  33. package/cjs/components/dialog/index.cjs +346 -0
  34. package/cjs/components/dialog/index.cjs.map +1 -0
  35. package/cjs/components/dialog/src/dialog.cjs +40 -0
  36. package/cjs/components/dialog/src/dialog.cjs.map +1 -0
  37. package/cjs/components/dialog/src/dialog.vue.cjs +343 -0
  38. package/cjs/components/dialog/src/dialog.vue.cjs.map +1 -0
  39. package/cjs/components/index.cjs +9450 -0
  40. package/cjs/components/index.cjs.map +1 -0
  41. package/cjs/components/input/index.cjs +175 -0
  42. package/cjs/components/input/index.cjs.map +1 -0
  43. package/cjs/components/input/src/input.cjs +27 -0
  44. package/cjs/components/input/src/input.cjs.map +1 -0
  45. package/cjs/components/input/src/input.vue.cjs +164 -0
  46. package/cjs/components/input/src/input.vue.cjs.map +1 -0
  47. package/cjs/components/input-number/index.cjs +374 -0
  48. package/cjs/components/input-number/index.cjs.map +1 -0
  49. package/cjs/components/input-number/src/input-number.cjs +48 -0
  50. package/cjs/components/input-number/src/input-number.cjs.map +1 -0
  51. package/cjs/components/input-number/src/input-number.vue.cjs +363 -0
  52. package/cjs/components/input-number/src/input-number.vue.cjs.map +1 -0
  53. package/cjs/components/input-search/index.cjs +286 -0
  54. package/cjs/components/input-search/index.cjs.map +1 -0
  55. package/cjs/components/input-search/src/input-search.cjs +55 -0
  56. package/cjs/components/input-search/src/input-search.cjs.map +1 -0
  57. package/cjs/components/input-search/src/input-search.vue.cjs +275 -0
  58. package/cjs/components/input-search/src/input-search.vue.cjs.map +1 -0
  59. package/cjs/components/qr-code/index.cjs +1975 -0
  60. package/cjs/components/qr-code/index.cjs.map +1 -0
  61. package/cjs/components/qr-code/src/qr-code.cjs +63 -0
  62. package/cjs/components/qr-code/src/qr-code.cjs.map +1 -0
  63. package/cjs/components/qr-code/src/qr-code.vue.cjs +1964 -0
  64. package/cjs/components/qr-code/src/qr-code.vue.cjs.map +1 -0
  65. package/cjs/components/radial-menu/index.cjs +983 -0
  66. package/cjs/components/radial-menu/index.cjs.map +1 -0
  67. package/cjs/components/radial-menu/src/radial-menu.cjs +96 -0
  68. package/cjs/components/radial-menu/src/radial-menu.cjs.map +1 -0
  69. package/cjs/components/radial-menu/src/radial-menu.vue.cjs +921 -0
  70. package/cjs/components/radial-menu/src/radial-menu.vue.cjs.map +1 -0
  71. package/cjs/components/select/index.cjs +163 -0
  72. package/cjs/components/select/index.cjs.map +1 -0
  73. package/cjs/components/select/src/select.cjs +16 -0
  74. package/cjs/components/select/src/select.cjs.map +1 -0
  75. package/cjs/components/select/src/select.vue.cjs +152 -0
  76. package/cjs/components/select/src/select.vue.cjs.map +1 -0
  77. package/cjs/components/table/index.cjs +3351 -0
  78. package/cjs/components/table/index.cjs.map +1 -0
  79. package/cjs/components/table/src/table.cjs +62 -0
  80. package/cjs/components/table/src/table.cjs.map +1 -0
  81. package/cjs/components/table/src/table.vue.cjs +3085 -0
  82. package/cjs/components/table/src/table.vue.cjs.map +1 -0
  83. package/cjs/dialog-CJU00aEV.cjs +614 -0
  84. package/cjs/dialog-CJU00aEV.cjs.map +1 -0
  85. package/cjs/dialog-DcH26KbE.cjs +2 -0
  86. package/cjs/hooks/dialog-DpYPBcKV.cjs +266 -0
  87. package/cjs/hooks/dialog-DpYPBcKV.cjs.map +1 -0
  88. package/cjs/hooks/hooks-D2Jaq5kO.cjs +328 -0
  89. package/cjs/hooks/hooks-D2Jaq5kO.cjs.map +1 -0
  90. package/cjs/hooks/index.cjs +8 -0
  91. package/cjs/icons/index.cjs +86 -0
  92. package/cjs/icons/index.cjs.map +1 -0
  93. package/cjs/index.cjs +9141 -0
  94. package/cjs/index.cjs.map +1 -0
  95. package/cjs/utils/index.cjs +69 -0
  96. package/cjs/utils/index.cjs.map +1 -0
  97. package/esm/JsBarcode-kVJER62m.js +3514 -0
  98. package/esm/JsBarcode-kVJER62m.js.map +1 -0
  99. package/esm/chunk-BuRq7rDw.js +23 -0
  100. package/esm/components/JsBarcode-CzzxrEd_.js +3514 -0
  101. package/esm/components/JsBarcode-CzzxrEd_.js.map +1 -0
  102. package/esm/components/barcode/JsBarcode-C5ux6wsb.js +3514 -0
  103. package/esm/components/barcode/JsBarcode-C5ux6wsb.js.map +1 -0
  104. package/esm/components/barcode/chunk--em_ddB3.js +23 -0
  105. package/esm/components/barcode/index.mjs +204 -0
  106. package/esm/components/barcode/index.mjs.map +1 -0
  107. package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js +3514 -0
  108. package/esm/components/barcode/src/JsBarcode-C5ux6wsb.js.map +1 -0
  109. package/esm/components/barcode/src/barcode.mjs +98 -0
  110. package/esm/components/barcode/src/barcode.mjs.map +1 -0
  111. package/esm/components/barcode/src/barcode.vue.mjs +194 -0
  112. package/esm/components/barcode/src/barcode.vue.mjs.map +1 -0
  113. package/esm/components/barcode/src/chunk--em_ddB3.js +23 -0
  114. package/esm/components/button/index.mjs +126 -0
  115. package/esm/components/button/index.mjs.map +1 -0
  116. package/esm/components/button/src/button.mjs +14 -0
  117. package/esm/components/button/src/button.mjs.map +1 -0
  118. package/esm/components/button/src/button.vue.mjs +117 -0
  119. package/esm/components/button/src/button.vue.mjs.map +1 -0
  120. package/esm/components/chunk-BuRq7rDw.js +23 -0
  121. package/esm/components/date-picker/index.mjs +155 -0
  122. package/esm/components/date-picker/index.mjs.map +1 -0
  123. package/esm/components/date-picker/src/date-picker.mjs +23 -0
  124. package/esm/components/date-picker/src/date-picker.mjs.map +1 -0
  125. package/esm/components/date-picker/src/date-picker.vue.mjs +146 -0
  126. package/esm/components/date-picker/src/date-picker.vue.mjs.map +1 -0
  127. package/esm/components/dialog/index.mjs +335 -0
  128. package/esm/components/dialog/index.mjs.map +1 -0
  129. package/esm/components/dialog/src/dialog.mjs +38 -0
  130. package/esm/components/dialog/src/dialog.mjs.map +1 -0
  131. package/esm/components/dialog/src/dialog.vue.mjs +334 -0
  132. package/esm/components/dialog/src/dialog.vue.mjs.map +1 -0
  133. package/esm/components/index.mjs +9386 -0
  134. package/esm/components/index.mjs.map +1 -0
  135. package/esm/components/input/index.mjs +166 -0
  136. package/esm/components/input/index.mjs.map +1 -0
  137. package/esm/components/input/src/input.mjs +25 -0
  138. package/esm/components/input/src/input.mjs.map +1 -0
  139. package/esm/components/input/src/input.vue.mjs +157 -0
  140. package/esm/components/input/src/input.vue.mjs.map +1 -0
  141. package/esm/components/input-number/index.mjs +365 -0
  142. package/esm/components/input-number/index.mjs.map +1 -0
  143. package/esm/components/input-number/src/input-number.mjs +45 -0
  144. package/esm/components/input-number/src/input-number.mjs.map +1 -0
  145. package/esm/components/input-number/src/input-number.vue.mjs +356 -0
  146. package/esm/components/input-number/src/input-number.vue.mjs.map +1 -0
  147. package/esm/components/input-search/index.mjs +277 -0
  148. package/esm/components/input-search/index.mjs.map +1 -0
  149. package/esm/components/input-search/src/input-search.mjs +53 -0
  150. package/esm/components/input-search/src/input-search.mjs.map +1 -0
  151. package/esm/components/input-search/src/input-search.vue.mjs +268 -0
  152. package/esm/components/input-search/src/input-search.vue.mjs.map +1 -0
  153. package/esm/components/qr-code/index.mjs +1967 -0
  154. package/esm/components/qr-code/index.mjs.map +1 -0
  155. package/esm/components/qr-code/src/qr-code.mjs +59 -0
  156. package/esm/components/qr-code/src/qr-code.mjs.map +1 -0
  157. package/esm/components/qr-code/src/qr-code.vue.mjs +1958 -0
  158. package/esm/components/qr-code/src/qr-code.vue.mjs.map +1 -0
  159. package/esm/components/radial-menu/index.mjs +974 -0
  160. package/esm/components/radial-menu/index.mjs.map +1 -0
  161. package/esm/components/radial-menu/src/radial-menu.mjs +94 -0
  162. package/esm/components/radial-menu/src/radial-menu.mjs.map +1 -0
  163. package/esm/components/radial-menu/src/radial-menu.vue.mjs +916 -0
  164. package/esm/components/radial-menu/src/radial-menu.vue.mjs.map +1 -0
  165. package/esm/components/select/index.mjs +154 -0
  166. package/esm/components/select/index.mjs.map +1 -0
  167. package/esm/components/select/src/select.mjs +14 -0
  168. package/esm/components/select/src/select.mjs.map +1 -0
  169. package/esm/components/select/src/select.vue.mjs +145 -0
  170. package/esm/components/select/src/select.vue.mjs.map +1 -0
  171. package/esm/components/table/index.mjs +3342 -0
  172. package/esm/components/table/index.mjs.map +1 -0
  173. package/esm/components/table/src/table.mjs +60 -0
  174. package/esm/components/table/src/table.mjs.map +1 -0
  175. package/esm/components/table/src/table.vue.mjs +3080 -0
  176. package/esm/components/table/src/table.vue.mjs.map +1 -0
  177. package/esm/dialog-Cm3Px-Bu.js +537 -0
  178. package/esm/dialog-Cm3Px-Bu.js.map +1 -0
  179. package/esm/dialog-CzZm50XM.js +2 -0
  180. package/esm/hooks/dialog-d4SMZWbw.js +261 -0
  181. package/esm/hooks/dialog-d4SMZWbw.js.map +1 -0
  182. package/esm/hooks/hooks-DdjieG2I.js +281 -0
  183. package/esm/hooks/hooks-DdjieG2I.js.map +1 -0
  184. package/esm/hooks/index.mjs +2 -0
  185. package/esm/icons/index.mjs +79 -0
  186. package/esm/icons/index.mjs.map +1 -0
  187. package/esm/index.mjs +9065 -0
  188. package/esm/index.mjs.map +1 -0
  189. package/esm/utils/index.mjs +65 -0
  190. package/esm/utils/index.mjs.map +1 -0
  191. package/global.d.ts +39 -0
  192. package/package.json +131 -0
  193. package/theme/index.css +1 -0
  194. package/theme/index.scss +16 -0
  195. package/theme/src/barcode.scss +14 -0
  196. package/theme/src/button.scss +65 -0
  197. package/theme/src/date-picker.scss +87 -0
  198. package/theme/src/dialog.scss +146 -0
  199. package/theme/src/ep-vars.scss +11 -0
  200. package/theme/src/input-number.scss +66 -0
  201. package/theme/src/input-search.scss +78 -0
  202. package/theme/src/input.scss +66 -0
  203. package/theme/src/mixins/bem.scss +35 -0
  204. package/theme/src/mixins/color.scss +8 -0
  205. package/theme/src/qr-code.scss +23 -0
  206. package/theme/src/radial-menu.scss +346 -0
  207. package/theme/src/select.scss +44 -0
  208. package/theme/src/table.scss +143 -0
  209. package/theme/src/tokens.scss +26 -0
  210. package/theme/src/tree-select.scss +45 -0
  211. package/theme/src/tree.scss +369 -0
  212. package/types/components/barcode/index.d.ts +183 -0
  213. package/types/components/barcode/src/barcode.d.ts +147 -0
  214. package/types/components/barcode/src/barcode.vue.d.ts +184 -0
  215. package/types/components/button/index.d.ts +135 -0
  216. package/types/components/button/src/button.d.ts +33 -0
  217. package/types/components/button/src/button.vue.d.ts +138 -0
  218. package/types/components/date-picker/index.d.ts +508 -0
  219. package/types/components/date-picker/src/date-picker.d.ts +35 -0
  220. package/types/components/date-picker/src/date-picker.vue.d.ts +509 -0
  221. package/types/components/dialog/index.d.ts +630 -0
  222. package/types/components/dialog/src/dialog.d.ts +70 -0
  223. package/types/components/dialog/src/dialog.vue.d.ts +257 -0
  224. package/types/components/index.d.ts +27 -0
  225. package/types/components/input/index.d.ts +233 -0
  226. package/types/components/input/src/input.d.ts +65 -0
  227. package/types/components/input/src/input.vue.d.ts +239 -0
  228. package/types/components/input-number/index.d.ts +713 -0
  229. package/types/components/input-number/src/input-number.d.ts +101 -0
  230. package/types/components/input-number/src/input-number.vue.d.ts +283 -0
  231. package/types/components/input-search/index.d.ts +113 -0
  232. package/types/components/input-search/src/input-search.d.ts +128 -0
  233. package/types/components/input-search/src/input-search.vue.d.ts +114 -0
  234. package/types/components/qr-code/index.d.ts +109 -0
  235. package/types/components/qr-code/src/qr-code.d.ts +93 -0
  236. package/types/components/qr-code/src/qr-code.vue.d.ts +109 -0
  237. package/types/components/radial-menu/index.d.ts +499 -0
  238. package/types/components/radial-menu/src/radial-menu-item.d.ts +40 -0
  239. package/types/components/radial-menu/src/radial-menu-item.vue.d.ts +95 -0
  240. package/types/components/radial-menu/src/radial-menu.d.ts +92 -0
  241. package/types/components/radial-menu/src/radial-menu.vue.d.ts +200 -0
  242. package/types/components/radial-menu/src/types.d.ts +48 -0
  243. package/types/components/radial-menu/src/use-radial-menu-items.d.ts +19 -0
  244. package/types/components/radial-menu/src/use-radial-menu-keyboard.d.ts +17 -0
  245. package/types/components/radial-menu/src/use-radial-menu-position.d.ts +45 -0
  246. package/types/components/radial-menu/src/use-radial-menu-shortcut.d.ts +8 -0
  247. package/types/components/radial-menu/src/use-radial-menu-state.d.ts +15 -0
  248. package/types/components/select/index.d.ts +5 -0
  249. package/types/components/select/src/select.d.ts +30 -0
  250. package/types/components/select/src/select.vue.d.ts +25 -0
  251. package/types/components/table/index.d.ts +8 -0
  252. package/types/components/table/src/editor-registry.d.ts +24 -0
  253. package/types/components/table/src/proxy-data.d.ts +10 -0
  254. package/types/components/table/src/table-editor.d.ts +18 -0
  255. package/types/components/table/src/table-editor.vue.d.ts +43 -0
  256. package/types/components/table/src/table.d.ts +179 -0
  257. package/types/components/table/src/table.vue.d.ts +121 -0
  258. package/types/components/tree/index.d.ts +5 -0
  259. package/types/components/tree/src/tree-node.vue.d.ts +88 -0
  260. package/types/components/tree/src/tree-types.d.ts +90 -0
  261. package/types/components/tree/src/tree.d.ts +448 -0
  262. package/types/components/tree/src/tree.vue.d.ts +301 -0
  263. package/types/components/tree/src/use-tree-check-conduct.d.ts +43 -0
  264. package/types/components/tree/src/use-tree-checked-state.d.ts +34 -0
  265. package/types/components/tree/src/use-tree-drag.d.ts +45 -0
  266. package/types/components/tree/src/use-tree-expanded-state.d.ts +41 -0
  267. package/types/components/tree/src/use-tree-keyboard.d.ts +21 -0
  268. package/types/components/tree/src/use-tree-load.d.ts +25 -0
  269. package/types/components/tree/src/use-tree-scroll.d.ts +17 -0
  270. package/types/components/tree/src/use-tree-selected-state.d.ts +29 -0
  271. package/types/components/tree-select/index.d.ts +5 -0
  272. package/types/components/tree-select/src/tree-select.d.ts +26 -0
  273. package/types/components/tree-select/src/tree-select.vue.d.ts +25 -0
  274. package/types/falcon-ui/index.d.ts +8 -0
  275. package/types/hooks/index.d.ts +3 -0
  276. package/types/hooks/src/use-clearable-state.d.ts +10 -0
  277. package/types/hooks/src/use-component.d.ts +15 -0
  278. package/types/hooks/src/use-dialog.d.ts +49 -0
  279. package/types/icons/index.d.ts +1 -0
  280. package/types/icons/src/components/holder-outlined.vue.d.ts +3 -0
  281. package/types/icons/src/components/index.d.ts +3 -0
  282. package/types/icons/src/components/minus-square-outlined.vue.d.ts +3 -0
  283. package/types/icons/src/components/plus-square-outlined.vue.d.ts +3 -0
  284. package/types/utils/index.d.ts +3 -0
  285. package/types/utils/src/bem.d.ts +11 -0
  286. package/types/utils/src/component.d.ts +6 -0
  287. package/types/utils/src/install.d.ts +5 -0
  288. package/umd/falcon-ui.umd.js +13297 -0
  289. package/umd/falcon-ui.umd.js.map +1 -0
@@ -0,0 +1,3351 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ let vue = require("vue");
6
+ let element_plus = require("element-plus");
7
+ function _defineProperty(e, r, t) {
8
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
9
+ value: t,
10
+ enumerable: !0,
11
+ configurable: !0,
12
+ writable: !0
13
+ }) : e[r] = t, e;
14
+ }
15
+ function _extends() {
16
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
17
+ for (var e = 1; e < arguments.length; e++) {
18
+ var t = arguments[e];
19
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
20
+ }
21
+ return n;
22
+ }, _extends.apply(null, arguments);
23
+ }
24
+ function ownKeys(e, r) {
25
+ var t = Object.keys(e);
26
+ if (Object.getOwnPropertySymbols) {
27
+ var o = Object.getOwnPropertySymbols(e);
28
+ r && (o = o.filter(function(r$1) {
29
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
30
+ })), t.push.apply(t, o);
31
+ }
32
+ return t;
33
+ }
34
+ function _objectSpread2(e) {
35
+ for (var r = 1; r < arguments.length; r++) {
36
+ var t = null != arguments[r] ? arguments[r] : {};
37
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
38
+ _defineProperty(e, r$1, t[r$1]);
39
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
40
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
41
+ });
42
+ }
43
+ return e;
44
+ }
45
+ function _objectWithoutProperties(e, t) {
46
+ if (null == e) return {};
47
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
48
+ if (Object.getOwnPropertySymbols) {
49
+ var n = Object.getOwnPropertySymbols(e);
50
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
51
+ }
52
+ return i;
53
+ }
54
+ function _objectWithoutPropertiesLoose(r, e) {
55
+ if (null == r) return {};
56
+ var t = {};
57
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
58
+ if (-1 !== e.indexOf(n)) continue;
59
+ t[n] = r[n];
60
+ }
61
+ return t;
62
+ }
63
+ function _toPrimitive(t, r) {
64
+ if ("object" != typeof t || !t) return t;
65
+ var e = t[Symbol.toPrimitive];
66
+ if (void 0 !== e) {
67
+ var i = e.call(t, r || "default");
68
+ if ("object" != typeof i) return i;
69
+ throw new TypeError("@@toPrimitive must return a primitive value.");
70
+ }
71
+ return ("string" === r ? String : Number)(t);
72
+ }
73
+ function _toPropertyKey(t) {
74
+ var i = _toPrimitive(t, "string");
75
+ return "symbol" == typeof i ? i : i + "";
76
+ }
77
+ function _typeof(o) {
78
+ "@babel/helpers - typeof";
79
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
80
+ return typeof o$1;
81
+ } : function(o$1) {
82
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
83
+ }, _typeof(o);
84
+ }
85
+ var version = "1.15.7";
86
+ function userAgent(pattern) {
87
+ if (typeof window !== "undefined" && window.navigator) return !!/* @__PURE__ */ navigator.userAgent.match(pattern);
88
+ }
89
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
90
+ var Edge = userAgent(/Edge/i);
91
+ var FireFox = userAgent(/firefox/i);
92
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
93
+ var IOS = userAgent(/iP(ad|od|hone)/i);
94
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
95
+ var captureMode = {
96
+ capture: false,
97
+ passive: false
98
+ };
99
+ function on(el, event, fn) {
100
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
101
+ }
102
+ function off(el, event, fn) {
103
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
104
+ }
105
+ function matches(el, selector) {
106
+ if (!selector) return;
107
+ selector[0] === ">" && (selector = selector.substring(1));
108
+ if (el) try {
109
+ if (el.matches) return el.matches(selector);
110
+ else if (el.msMatchesSelector) return el.msMatchesSelector(selector);
111
+ else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);
112
+ } catch (_) {
113
+ return false;
114
+ }
115
+ return false;
116
+ }
117
+ function getParentOrHost(el) {
118
+ return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
119
+ }
120
+ function closest(el, selector, ctx, includeCTX) {
121
+ if (el) {
122
+ ctx = ctx || document;
123
+ do {
124
+ if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) return el;
125
+ if (el === ctx) break;
126
+ } while (el = getParentOrHost(el));
127
+ }
128
+ return null;
129
+ }
130
+ var R_SPACE = /\s+/g;
131
+ function toggleClass(el, name, state) {
132
+ if (el && name) if (el.classList) el.classList[state ? "add" : "remove"](name);
133
+ else el.className = ((" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " ") + (state ? " " + name : "")).replace(R_SPACE, " ");
134
+ }
135
+ function css(el, prop, val) {
136
+ var style = el && el.style;
137
+ if (style) if (val === void 0) {
138
+ if (document.defaultView && document.defaultView.getComputedStyle) val = document.defaultView.getComputedStyle(el, "");
139
+ else if (el.currentStyle) val = el.currentStyle;
140
+ return prop === void 0 ? val : val[prop];
141
+ } else {
142
+ if (!(prop in style) && prop.indexOf("webkit") === -1) prop = "-webkit-" + prop;
143
+ style[prop] = val + (typeof val === "string" ? "" : "px");
144
+ }
145
+ }
146
+ function matrix(el, selfOnly) {
147
+ var appliedTransforms = "";
148
+ if (typeof el === "string") appliedTransforms = el;
149
+ else do {
150
+ var transform = css(el, "transform");
151
+ if (transform && transform !== "none") appliedTransforms = transform + " " + appliedTransforms;
152
+ } while (!selfOnly && (el = el.parentNode));
153
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
154
+ return matrixFn && new matrixFn(appliedTransforms);
155
+ }
156
+ function find(ctx, tagName, iterator) {
157
+ if (ctx) {
158
+ var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
159
+ if (iterator) for (; i < n; i++) iterator(list[i], i);
160
+ return list;
161
+ }
162
+ return [];
163
+ }
164
+ function getWindowScrollingElement() {
165
+ var scrollingElement = document.scrollingElement;
166
+ if (scrollingElement) return scrollingElement;
167
+ else return document.documentElement;
168
+ }
169
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
170
+ if (!el.getBoundingClientRect && el !== window) return;
171
+ var elRect, top, left, bottom, right, height, width;
172
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
173
+ elRect = el.getBoundingClientRect();
174
+ top = elRect.top;
175
+ left = elRect.left;
176
+ bottom = elRect.bottom;
177
+ right = elRect.right;
178
+ height = elRect.height;
179
+ width = elRect.width;
180
+ } else {
181
+ top = 0;
182
+ left = 0;
183
+ bottom = window.innerHeight;
184
+ right = window.innerWidth;
185
+ height = window.innerHeight;
186
+ width = window.innerWidth;
187
+ }
188
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
189
+ container = container || el.parentNode;
190
+ if (!IE11OrLess) do
191
+ if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) {
192
+ var containerRect = container.getBoundingClientRect();
193
+ top -= containerRect.top + parseInt(css(container, "border-top-width"));
194
+ left -= containerRect.left + parseInt(css(container, "border-left-width"));
195
+ bottom = top + elRect.height;
196
+ right = left + elRect.width;
197
+ break;
198
+ }
199
+ while (container = container.parentNode);
200
+ }
201
+ if (undoScale && el !== window) {
202
+ var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d;
203
+ if (elMatrix) {
204
+ top /= scaleY;
205
+ left /= scaleX;
206
+ width /= scaleX;
207
+ height /= scaleY;
208
+ bottom = top + height;
209
+ right = left + width;
210
+ }
211
+ }
212
+ return {
213
+ top,
214
+ left,
215
+ bottom,
216
+ right,
217
+ width,
218
+ height
219
+ };
220
+ }
221
+ function isScrolledPast(el, elSide, parentSide) {
222
+ var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide];
223
+ while (parent) {
224
+ var parentSideVal = getRect(parent)[parentSide], visible = void 0;
225
+ if (parentSide === "top" || parentSide === "left") visible = elSideVal >= parentSideVal;
226
+ else visible = elSideVal <= parentSideVal;
227
+ if (!visible) return parent;
228
+ if (parent === getWindowScrollingElement()) break;
229
+ parent = getParentAutoScrollElement(parent, false);
230
+ }
231
+ return false;
232
+ }
233
+ function getChild(el, childNum, options, includeDragEl) {
234
+ var currentChild = 0, i = 0, children = el.children;
235
+ while (i < children.length) {
236
+ if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
237
+ if (currentChild === childNum) return children[i];
238
+ currentChild++;
239
+ }
240
+ i++;
241
+ }
242
+ return null;
243
+ }
244
+ function lastChild(el, selector) {
245
+ var last = el.lastElementChild;
246
+ while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches(last, selector))) last = last.previousElementSibling;
247
+ return last || null;
248
+ }
249
+ function index(el, selector) {
250
+ var index$1 = 0;
251
+ if (!el || !el.parentNode) return -1;
252
+ while (el = el.previousElementSibling) if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches(el, selector))) index$1++;
253
+ return index$1;
254
+ }
255
+ function getRelativeScrollOffset(el) {
256
+ var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement();
257
+ if (el) do {
258
+ var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d;
259
+ offsetLeft += el.scrollLeft * scaleX;
260
+ offsetTop += el.scrollTop * scaleY;
261
+ } while (el !== winScroller && (el = el.parentNode));
262
+ return [offsetLeft, offsetTop];
263
+ }
264
+ function indexOfObject(arr, obj) {
265
+ for (var i in arr) {
266
+ if (!arr.hasOwnProperty(i)) continue;
267
+ for (var key in obj) if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
268
+ }
269
+ return -1;
270
+ }
271
+ function getParentAutoScrollElement(el, includeSelf) {
272
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
273
+ var elem = el;
274
+ var gotSelf = false;
275
+ do
276
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
277
+ var elemCSS = css(elem);
278
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) {
279
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
280
+ if (gotSelf || includeSelf) return elem;
281
+ gotSelf = true;
282
+ }
283
+ }
284
+ while (elem = elem.parentNode);
285
+ return getWindowScrollingElement();
286
+ }
287
+ function extend(dst, src) {
288
+ if (dst && src) {
289
+ for (var key in src) if (src.hasOwnProperty(key)) dst[key] = src[key];
290
+ }
291
+ return dst;
292
+ }
293
+ function isRectEqual(rect1, rect2) {
294
+ return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
295
+ }
296
+ var _throttleTimeout;
297
+ function throttle(callback, ms) {
298
+ return function() {
299
+ if (!_throttleTimeout) {
300
+ var args = arguments, _this = this;
301
+ if (args.length === 1) callback.call(_this, args[0]);
302
+ else callback.apply(_this, args);
303
+ _throttleTimeout = setTimeout(function() {
304
+ _throttleTimeout = void 0;
305
+ }, ms);
306
+ }
307
+ };
308
+ }
309
+ function cancelThrottle() {
310
+ clearTimeout(_throttleTimeout);
311
+ _throttleTimeout = void 0;
312
+ }
313
+ function scrollBy(el, x, y) {
314
+ el.scrollLeft += x;
315
+ el.scrollTop += y;
316
+ }
317
+ function clone(el) {
318
+ var Polymer = window.Polymer;
319
+ var $ = window.jQuery || window.Zepto;
320
+ if (Polymer && Polymer.dom) return Polymer.dom(el).cloneNode(true);
321
+ else if ($) return $(el).clone(true)[0];
322
+ else return el.cloneNode(true);
323
+ }
324
+ function getChildContainingRectFromElement(container, options, ghostEl$1) {
325
+ var rect = {};
326
+ Array.from(container.children).forEach(function(child) {
327
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
328
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl$1) return;
329
+ var childRect = getRect(child);
330
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
331
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
332
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
333
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
334
+ });
335
+ rect.width = rect.right - rect.left;
336
+ rect.height = rect.bottom - rect.top;
337
+ rect.x = rect.left;
338
+ rect.y = rect.top;
339
+ return rect;
340
+ }
341
+ var expando = "Sortable" + (/* @__PURE__ */ new Date()).getTime();
342
+ function AnimationStateManager() {
343
+ var animationStates = [], animationCallbackId;
344
+ return {
345
+ captureAnimationState: function captureAnimationState() {
346
+ animationStates = [];
347
+ if (!this.options.animation) return;
348
+ [].slice.call(this.el.children).forEach(function(child) {
349
+ if (css(child, "display") === "none" || child === Sortable.ghost) return;
350
+ animationStates.push({
351
+ target: child,
352
+ rect: getRect(child)
353
+ });
354
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
355
+ if (child.thisAnimationDuration) {
356
+ var childMatrix = matrix(child, true);
357
+ if (childMatrix) {
358
+ fromRect.top -= childMatrix.f;
359
+ fromRect.left -= childMatrix.e;
360
+ }
361
+ }
362
+ child.fromRect = fromRect;
363
+ });
364
+ },
365
+ addAnimationState: function addAnimationState(state) {
366
+ animationStates.push(state);
367
+ },
368
+ removeAnimationState: function removeAnimationState(target) {
369
+ animationStates.splice(indexOfObject(animationStates, { target }), 1);
370
+ },
371
+ animateAll: function animateAll(callback) {
372
+ var _this = this;
373
+ if (!this.options.animation) {
374
+ clearTimeout(animationCallbackId);
375
+ if (typeof callback === "function") callback();
376
+ return;
377
+ }
378
+ var animating = false, animationTime = 0;
379
+ animationStates.forEach(function(state) {
380
+ var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true);
381
+ if (targetMatrix) {
382
+ toRect.top -= targetMatrix.f;
383
+ toRect.left -= targetMatrix.e;
384
+ }
385
+ target.toRect = toRect;
386
+ if (target.thisAnimationDuration) {
387
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
388
+ }
389
+ if (!isRectEqual(toRect, fromRect)) {
390
+ target.prevFromRect = fromRect;
391
+ target.prevToRect = toRect;
392
+ if (!time) time = _this.options.animation;
393
+ _this.animate(target, animatingRect, toRect, time);
394
+ }
395
+ if (time) {
396
+ animating = true;
397
+ animationTime = Math.max(animationTime, time);
398
+ clearTimeout(target.animationResetTimer);
399
+ target.animationResetTimer = setTimeout(function() {
400
+ target.animationTime = 0;
401
+ target.prevFromRect = null;
402
+ target.fromRect = null;
403
+ target.prevToRect = null;
404
+ target.thisAnimationDuration = null;
405
+ }, time);
406
+ target.thisAnimationDuration = time;
407
+ }
408
+ });
409
+ clearTimeout(animationCallbackId);
410
+ if (!animating) {
411
+ if (typeof callback === "function") callback();
412
+ } else animationCallbackId = setTimeout(function() {
413
+ if (typeof callback === "function") callback();
414
+ }, animationTime);
415
+ animationStates = [];
416
+ },
417
+ animate: function animate(target, currentRect, toRect, duration) {
418
+ if (duration) {
419
+ css(target, "transition", "");
420
+ css(target, "transform", "");
421
+ var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1);
422
+ target.animatingX = !!translateX;
423
+ target.animatingY = !!translateY;
424
+ css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)");
425
+ this.forRepaintDummy = repaint(target);
426
+ css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : ""));
427
+ css(target, "transform", "translate3d(0,0,0)");
428
+ typeof target.animated === "number" && clearTimeout(target.animated);
429
+ target.animated = setTimeout(function() {
430
+ css(target, "transition", "");
431
+ css(target, "transform", "");
432
+ target.animated = false;
433
+ target.animatingX = false;
434
+ target.animatingY = false;
435
+ }, duration);
436
+ }
437
+ }
438
+ };
439
+ }
440
+ function repaint(target) {
441
+ return target.offsetWidth;
442
+ }
443
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
444
+ return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
445
+ }
446
+ var plugins = [];
447
+ var defaults = { initializeByDefault: true };
448
+ var PluginManager = {
449
+ mount: function mount(plugin) {
450
+ for (var option in defaults) if (defaults.hasOwnProperty(option) && !(option in plugin)) plugin[option] = defaults[option];
451
+ plugins.forEach(function(p) {
452
+ if (p.pluginName === plugin.pluginName) throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
453
+ });
454
+ plugins.push(plugin);
455
+ },
456
+ pluginEvent: function pluginEvent$1(eventName, sortable, evt) {
457
+ var _this = this;
458
+ this.eventCanceled = false;
459
+ evt.cancel = function() {
460
+ _this.eventCanceled = true;
461
+ };
462
+ var eventNameGlobal = eventName + "Global";
463
+ plugins.forEach(function(plugin) {
464
+ if (!sortable[plugin.pluginName]) return;
465
+ if (sortable[plugin.pluginName][eventNameGlobal]) sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({ sortable }, evt));
466
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) sortable[plugin.pluginName][eventName](_objectSpread2({ sortable }, evt));
467
+ });
468
+ },
469
+ initializePlugins: function initializePlugins(sortable, el, defaults$1, options) {
470
+ plugins.forEach(function(plugin) {
471
+ var pluginName = plugin.pluginName;
472
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
473
+ var initialized = new plugin(sortable, el, sortable.options);
474
+ initialized.sortable = sortable;
475
+ initialized.options = sortable.options;
476
+ sortable[pluginName] = initialized;
477
+ _extends(defaults$1, initialized.defaults);
478
+ });
479
+ for (var option in sortable.options) {
480
+ if (!sortable.options.hasOwnProperty(option)) continue;
481
+ var modified = this.modifyOption(sortable, option, sortable.options[option]);
482
+ if (typeof modified !== "undefined") sortable.options[option] = modified;
483
+ }
484
+ },
485
+ getEventProperties: function getEventProperties(name, sortable) {
486
+ var eventProperties = {};
487
+ plugins.forEach(function(plugin) {
488
+ if (typeof plugin.eventProperties !== "function") return;
489
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
490
+ });
491
+ return eventProperties;
492
+ },
493
+ modifyOption: function modifyOption(sortable, name, value) {
494
+ var modifiedValue;
495
+ plugins.forEach(function(plugin) {
496
+ if (!sortable[plugin.pluginName]) return;
497
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === "function") modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
498
+ });
499
+ return modifiedValue;
500
+ }
501
+ };
502
+ function dispatchEvent(_ref) {
503
+ var sortable = _ref.sortable, rootEl$1 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl$1 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex$1 = _ref.oldIndex, newIndex$1 = _ref.newIndex, oldDraggableIndex$1 = _ref.oldDraggableIndex, newDraggableIndex$1 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable$1 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties;
504
+ sortable = sortable || rootEl$1 && rootEl$1[expando];
505
+ if (!sortable) return;
506
+ var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1);
507
+ if (window.CustomEvent && !IE11OrLess && !Edge) evt = new CustomEvent(name, {
508
+ bubbles: true,
509
+ cancelable: true
510
+ });
511
+ else {
512
+ evt = document.createEvent("Event");
513
+ evt.initEvent(name, true, true);
514
+ }
515
+ evt.to = toEl || rootEl$1;
516
+ evt.from = fromEl || rootEl$1;
517
+ evt.item = targetEl || rootEl$1;
518
+ evt.clone = cloneEl$1;
519
+ evt.oldIndex = oldIndex$1;
520
+ evt.newIndex = newIndex$1;
521
+ evt.oldDraggableIndex = oldDraggableIndex$1;
522
+ evt.newDraggableIndex = newDraggableIndex$1;
523
+ evt.originalEvent = originalEvent;
524
+ evt.pullMode = putSortable$1 ? putSortable$1.lastPutMode : void 0;
525
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
526
+ for (var option in allEventProperties) evt[option] = allEventProperties[option];
527
+ if (rootEl$1) rootEl$1.dispatchEvent(evt);
528
+ if (options[onName]) options[onName].call(sortable, evt);
529
+ }
530
+ var _excluded = ["evt"];
531
+ var pluginEvent = function pluginEvent$1(eventName, sortable) {
532
+ var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, _excluded);
533
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
534
+ dragEl,
535
+ parentEl,
536
+ ghostEl,
537
+ rootEl,
538
+ nextEl,
539
+ lastDownEl,
540
+ cloneEl,
541
+ cloneHidden,
542
+ dragStarted: moved,
543
+ putSortable,
544
+ activeSortable: Sortable.active,
545
+ originalEvent,
546
+ oldIndex,
547
+ oldDraggableIndex,
548
+ newIndex,
549
+ newDraggableIndex,
550
+ hideGhostForTarget: _hideGhostForTarget,
551
+ unhideGhostForTarget: _unhideGhostForTarget,
552
+ cloneNowHidden: function cloneNowHidden() {
553
+ cloneHidden = true;
554
+ },
555
+ cloneNowShown: function cloneNowShown() {
556
+ cloneHidden = false;
557
+ },
558
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
559
+ _dispatchEvent({
560
+ sortable,
561
+ name,
562
+ originalEvent
563
+ });
564
+ }
565
+ }, data));
566
+ };
567
+ function _dispatchEvent(info) {
568
+ dispatchEvent(_objectSpread2({
569
+ putSortable,
570
+ cloneEl,
571
+ targetEl: dragEl,
572
+ rootEl,
573
+ oldIndex,
574
+ oldDraggableIndex,
575
+ newIndex,
576
+ newDraggableIndex
577
+ }, info));
578
+ }
579
+ var dragEl, parentEl, ghostEl, rootEl, nextEl, lastDownEl, cloneEl, cloneHidden, oldIndex, newIndex, oldDraggableIndex, newDraggableIndex, activeGroup, putSortable, awaitingDragStarted = false, ignoreNextClick = false, sortables = [], tapEvt, touchEvt, lastDx, lastDy, tapDistanceLeft, tapDistanceTop, moved, lastTarget, lastDirection, pastFirstInvertThresh = false, isCircumstantialInvert = false, targetMoveDistance, ghostRelativeParent, ghostRelativeParentInitialScroll = [], _silent = false, savedInputChecked = [];
580
+ var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), supportCssPointerEvents = function() {
581
+ if (!documentExists) return;
582
+ if (IE11OrLess) return false;
583
+ var el = document.createElement("x");
584
+ el.style.cssText = "pointer-events:auto";
585
+ return el.style.pointerEvents === "auto";
586
+ }(), _detectDirection = function _detectDirection$1(el, options) {
587
+ var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
588
+ if (elCSS.display === "flex") return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal";
589
+ if (elCSS.display === "grid") return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal";
590
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") {
591
+ var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right";
592
+ return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal";
593
+ }
594
+ return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal";
595
+ }, _dragElInRowColumn = function _dragElInRowColumn$1(dragRect, targetRect, vertical) {
596
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height;
597
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
598
+ }, _detectNearestEmptySortable = function _detectNearestEmptySortable$1(x, y) {
599
+ var ret;
600
+ sortables.some(function(sortable) {
601
+ var threshold = sortable[expando].options.emptyInsertThreshold;
602
+ if (!threshold || lastChild(sortable)) return;
603
+ var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
604
+ if (insideHorizontally && insideVertically) return ret = sortable;
605
+ });
606
+ return ret;
607
+ }, _prepareGroup = function _prepareGroup$1(options) {
608
+ function toFn(value, pull) {
609
+ return function(to, from, dragEl$1, evt) {
610
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
611
+ if (value == null && (pull || sameGroup)) return true;
612
+ else if (value == null || value === false) return false;
613
+ else if (pull && value === "clone") return value;
614
+ else if (typeof value === "function") return toFn(value(to, from, dragEl$1, evt), pull)(to, from, dragEl$1, evt);
615
+ else {
616
+ var otherGroup = (pull ? to : from).options.group.name;
617
+ return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
618
+ }
619
+ };
620
+ }
621
+ var group = {};
622
+ var originalGroup = options.group;
623
+ if (!originalGroup || _typeof(originalGroup) != "object") originalGroup = { name: originalGroup };
624
+ group.name = originalGroup.name;
625
+ group.checkPull = toFn(originalGroup.pull, true);
626
+ group.checkPut = toFn(originalGroup.put);
627
+ group.revertClone = originalGroup.revertClone;
628
+ options.group = group;
629
+ }, _hideGhostForTarget = function _hideGhostForTarget$1() {
630
+ if (!supportCssPointerEvents && ghostEl) css(ghostEl, "display", "none");
631
+ }, _unhideGhostForTarget = function _unhideGhostForTarget$1() {
632
+ if (!supportCssPointerEvents && ghostEl) css(ghostEl, "display", "");
633
+ };
634
+ if (documentExists && !ChromeForAndroid) document.addEventListener("click", function(evt) {
635
+ if (ignoreNextClick) {
636
+ evt.preventDefault();
637
+ evt.stopPropagation && evt.stopPropagation();
638
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
639
+ ignoreNextClick = false;
640
+ return false;
641
+ }
642
+ }, true);
643
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent$1(evt) {
644
+ if (dragEl) {
645
+ evt = evt.touches ? evt.touches[0] : evt;
646
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
647
+ if (nearest) {
648
+ var event = {};
649
+ for (var i in evt) if (evt.hasOwnProperty(i)) event[i] = evt[i];
650
+ event.target = event.rootEl = nearest;
651
+ event.preventDefault = void 0;
652
+ event.stopPropagation = void 0;
653
+ nearest[expando]._onDragOver(event);
654
+ }
655
+ }
656
+ };
657
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl$1(evt) {
658
+ if (dragEl) dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
659
+ };
660
+ function Sortable(el, options) {
661
+ if (!(el && el.nodeType && el.nodeType === 1)) throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
662
+ this.el = el;
663
+ this.options = options = _extends({}, options);
664
+ el[expando] = this;
665
+ var defaults$1 = {
666
+ group: null,
667
+ sort: true,
668
+ disabled: false,
669
+ store: null,
670
+ handle: null,
671
+ draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*",
672
+ swapThreshold: 1,
673
+ invertSwap: false,
674
+ invertedSwapThreshold: null,
675
+ removeCloneOnHide: true,
676
+ direction: function direction() {
677
+ return _detectDirection(el, this.options);
678
+ },
679
+ ghostClass: "sortable-ghost",
680
+ chosenClass: "sortable-chosen",
681
+ dragClass: "sortable-drag",
682
+ ignore: "a, img",
683
+ filter: null,
684
+ preventOnFilter: true,
685
+ animation: 0,
686
+ easing: null,
687
+ setData: function setData(dataTransfer, dragEl$1) {
688
+ dataTransfer.setData("Text", dragEl$1.textContent);
689
+ },
690
+ dropBubble: false,
691
+ dragoverBubble: false,
692
+ dataIdAttr: "data-id",
693
+ delay: 0,
694
+ delayOnTouchOnly: false,
695
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
696
+ forceFallback: false,
697
+ fallbackClass: "sortable-fallback",
698
+ fallbackOnBody: false,
699
+ fallbackTolerance: 0,
700
+ fallbackOffset: {
701
+ x: 0,
702
+ y: 0
703
+ },
704
+ supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && (!Safari || IOS),
705
+ emptyInsertThreshold: 5
706
+ };
707
+ PluginManager.initializePlugins(this, el, defaults$1);
708
+ for (var name in defaults$1) !(name in options) && (options[name] = defaults$1[name]);
709
+ _prepareGroup(options);
710
+ for (var fn in this) if (fn.charAt(0) === "_" && typeof this[fn] === "function") this[fn] = this[fn].bind(this);
711
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
712
+ if (this.nativeDraggable) this.options.touchStartThreshold = 1;
713
+ if (options.supportPointer) on(el, "pointerdown", this._onTapStart);
714
+ else {
715
+ on(el, "mousedown", this._onTapStart);
716
+ on(el, "touchstart", this._onTapStart);
717
+ }
718
+ if (this.nativeDraggable) {
719
+ on(el, "dragover", this);
720
+ on(el, "dragenter", this);
721
+ }
722
+ sortables.push(this.el);
723
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
724
+ _extends(this, AnimationStateManager());
725
+ }
726
+ Sortable.prototype = {
727
+ constructor: Sortable,
728
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
729
+ if (!this.el.contains(target) && target !== this.el) lastTarget = null;
730
+ },
731
+ _getDirection: function _getDirection(evt, target) {
732
+ return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
733
+ },
734
+ _onTapStart: function _onTapStart(evt) {
735
+ if (!evt.cancelable) return;
736
+ var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter;
737
+ _saveInputCheckedState(el);
738
+ if (dragEl) return;
739
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) return;
740
+ if (originalTarget.isContentEditable) return;
741
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") return;
742
+ target = closest(target, options.draggable, el, false);
743
+ if (target && target.animated) return;
744
+ if (lastDownEl === target) return;
745
+ oldIndex = index(target);
746
+ oldDraggableIndex = index(target, options.draggable);
747
+ if (typeof filter === "function") {
748
+ if (filter.call(this, evt, target, this)) {
749
+ _dispatchEvent({
750
+ sortable: _this,
751
+ rootEl: originalTarget,
752
+ name: "filter",
753
+ targetEl: target,
754
+ toEl: el,
755
+ fromEl: el
756
+ });
757
+ pluginEvent("filter", _this, { evt });
758
+ preventOnFilter && evt.preventDefault();
759
+ return;
760
+ }
761
+ } else if (filter) {
762
+ filter = filter.split(",").some(function(criteria) {
763
+ criteria = closest(originalTarget, criteria.trim(), el, false);
764
+ if (criteria) {
765
+ _dispatchEvent({
766
+ sortable: _this,
767
+ rootEl: criteria,
768
+ name: "filter",
769
+ targetEl: target,
770
+ fromEl: el,
771
+ toEl: el
772
+ });
773
+ pluginEvent("filter", _this, { evt });
774
+ return true;
775
+ }
776
+ });
777
+ if (filter) {
778
+ preventOnFilter && evt.preventDefault();
779
+ return;
780
+ }
781
+ }
782
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) return;
783
+ this._prepareDragStart(evt, touch, target);
784
+ },
785
+ _prepareDragStart: function _prepareDragStart(evt, touch, target) {
786
+ var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn;
787
+ if (target && !dragEl && target.parentNode === el) {
788
+ var dragRect = getRect(target);
789
+ rootEl = el;
790
+ dragEl = target;
791
+ parentEl = dragEl.parentNode;
792
+ nextEl = dragEl.nextSibling;
793
+ lastDownEl = target;
794
+ activeGroup = options.group;
795
+ Sortable.dragged = dragEl;
796
+ tapEvt = {
797
+ target: dragEl,
798
+ clientX: (touch || evt).clientX,
799
+ clientY: (touch || evt).clientY
800
+ };
801
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
802
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
803
+ this._lastX = (touch || evt).clientX;
804
+ this._lastY = (touch || evt).clientY;
805
+ dragEl.style["will-change"] = "all";
806
+ dragStartFn = function dragStartFn$1() {
807
+ pluginEvent("delayEnded", _this, { evt });
808
+ if (Sortable.eventCanceled) {
809
+ _this._onDrop();
810
+ return;
811
+ }
812
+ _this._disableDelayedDragEvents();
813
+ if (!FireFox && _this.nativeDraggable) dragEl.draggable = true;
814
+ _this._triggerDragStart(evt, touch);
815
+ _dispatchEvent({
816
+ sortable: _this,
817
+ name: "choose",
818
+ originalEvent: evt
819
+ });
820
+ toggleClass(dragEl, options.chosenClass, true);
821
+ };
822
+ options.ignore.split(",").forEach(function(criteria) {
823
+ find(dragEl, criteria.trim(), _disableDraggable);
824
+ });
825
+ on(ownerDocument, "dragover", nearestEmptyInsertDetectEvent);
826
+ on(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent);
827
+ on(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent);
828
+ if (options.supportPointer) {
829
+ on(ownerDocument, "pointerup", _this._onDrop);
830
+ !this.nativeDraggable && on(ownerDocument, "pointercancel", _this._onDrop);
831
+ } else {
832
+ on(ownerDocument, "mouseup", _this._onDrop);
833
+ on(ownerDocument, "touchend", _this._onDrop);
834
+ on(ownerDocument, "touchcancel", _this._onDrop);
835
+ }
836
+ if (FireFox && this.nativeDraggable) {
837
+ this.options.touchStartThreshold = 4;
838
+ dragEl.draggable = true;
839
+ }
840
+ pluginEvent("delayStart", this, { evt });
841
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
842
+ if (Sortable.eventCanceled) {
843
+ this._onDrop();
844
+ return;
845
+ }
846
+ if (options.supportPointer) {
847
+ on(ownerDocument, "pointerup", _this._disableDelayedDrag);
848
+ on(ownerDocument, "pointercancel", _this._disableDelayedDrag);
849
+ } else {
850
+ on(ownerDocument, "mouseup", _this._disableDelayedDrag);
851
+ on(ownerDocument, "touchend", _this._disableDelayedDrag);
852
+ on(ownerDocument, "touchcancel", _this._disableDelayedDrag);
853
+ }
854
+ on(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler);
855
+ on(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler);
856
+ options.supportPointer && on(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler);
857
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
858
+ } else dragStartFn();
859
+ }
860
+ },
861
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) {
862
+ var touch = e.touches ? e.touches[0] : e;
863
+ if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) this._disableDelayedDrag();
864
+ },
865
+ _disableDelayedDrag: function _disableDelayedDrag() {
866
+ dragEl && _disableDraggable(dragEl);
867
+ clearTimeout(this._dragStartTimer);
868
+ this._disableDelayedDragEvents();
869
+ },
870
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
871
+ var ownerDocument = this.el.ownerDocument;
872
+ off(ownerDocument, "mouseup", this._disableDelayedDrag);
873
+ off(ownerDocument, "touchend", this._disableDelayedDrag);
874
+ off(ownerDocument, "touchcancel", this._disableDelayedDrag);
875
+ off(ownerDocument, "pointerup", this._disableDelayedDrag);
876
+ off(ownerDocument, "pointercancel", this._disableDelayedDrag);
877
+ off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler);
878
+ off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler);
879
+ off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler);
880
+ },
881
+ _triggerDragStart: function _triggerDragStart(evt, touch) {
882
+ touch = touch || evt.pointerType == "touch" && evt;
883
+ if (!this.nativeDraggable || touch) if (this.options.supportPointer) on(document, "pointermove", this._onTouchMove);
884
+ else if (touch) on(document, "touchmove", this._onTouchMove);
885
+ else on(document, "mousemove", this._onTouchMove);
886
+ else {
887
+ on(dragEl, "dragend", this);
888
+ on(rootEl, "dragstart", this._onDragStart);
889
+ }
890
+ try {
891
+ if (document.selection) _nextTick(function() {
892
+ document.selection.empty();
893
+ });
894
+ else window.getSelection().removeAllRanges();
895
+ } catch (err) {}
896
+ },
897
+ _dragStarted: function _dragStarted(fallback, evt) {
898
+ awaitingDragStarted = false;
899
+ if (rootEl && dragEl) {
900
+ pluginEvent("dragStarted", this, { evt });
901
+ if (this.nativeDraggable) on(document, "dragover", _checkOutsideTargetEl);
902
+ var options = this.options;
903
+ !fallback && toggleClass(dragEl, options.dragClass, false);
904
+ toggleClass(dragEl, options.ghostClass, true);
905
+ Sortable.active = this;
906
+ fallback && this._appendGhost();
907
+ _dispatchEvent({
908
+ sortable: this,
909
+ name: "start",
910
+ originalEvent: evt
911
+ });
912
+ } else this._nulling();
913
+ },
914
+ _emulateDragOver: function _emulateDragOver() {
915
+ if (touchEvt) {
916
+ this._lastX = touchEvt.clientX;
917
+ this._lastY = touchEvt.clientY;
918
+ _hideGhostForTarget();
919
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
920
+ var parent = target;
921
+ while (target && target.shadowRoot) {
922
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
923
+ if (target === parent) break;
924
+ parent = target;
925
+ }
926
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
927
+ if (parent) do {
928
+ if (parent[expando]) {
929
+ var inserted = void 0;
930
+ inserted = parent[expando]._onDragOver({
931
+ clientX: touchEvt.clientX,
932
+ clientY: touchEvt.clientY,
933
+ target,
934
+ rootEl: parent
935
+ });
936
+ if (inserted && !this.options.dragoverBubble) break;
937
+ }
938
+ target = parent;
939
+ } while (parent = getParentOrHost(parent));
940
+ _unhideGhostForTarget();
941
+ }
942
+ },
943
+ _onTouchMove: function _onTouchMove(evt) {
944
+ if (tapEvt) {
945
+ var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
946
+ if (!Sortable.active && !awaitingDragStarted) {
947
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) return;
948
+ this._onDragStart(evt, true);
949
+ }
950
+ if (ghostEl) {
951
+ if (ghostMatrix) {
952
+ ghostMatrix.e += dx - (lastDx || 0);
953
+ ghostMatrix.f += dy - (lastDy || 0);
954
+ } else ghostMatrix = {
955
+ a: 1,
956
+ b: 0,
957
+ c: 0,
958
+ d: 1,
959
+ e: dx,
960
+ f: dy
961
+ };
962
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
963
+ css(ghostEl, "webkitTransform", cssMatrix);
964
+ css(ghostEl, "mozTransform", cssMatrix);
965
+ css(ghostEl, "msTransform", cssMatrix);
966
+ css(ghostEl, "transform", cssMatrix);
967
+ lastDx = dx;
968
+ lastDy = dy;
969
+ touchEvt = touch;
970
+ }
971
+ evt.cancelable && evt.preventDefault();
972
+ }
973
+ },
974
+ _appendGhost: function _appendGhost() {
975
+ if (!ghostEl) {
976
+ var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options;
977
+ if (PositionGhostAbsolutely) {
978
+ ghostRelativeParent = container;
979
+ while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) ghostRelativeParent = ghostRelativeParent.parentNode;
980
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
981
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
982
+ rect.top += ghostRelativeParent.scrollTop;
983
+ rect.left += ghostRelativeParent.scrollLeft;
984
+ } else ghostRelativeParent = getWindowScrollingElement();
985
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
986
+ }
987
+ ghostEl = dragEl.cloneNode(true);
988
+ toggleClass(ghostEl, options.ghostClass, false);
989
+ toggleClass(ghostEl, options.fallbackClass, true);
990
+ toggleClass(ghostEl, options.dragClass, true);
991
+ css(ghostEl, "transition", "");
992
+ css(ghostEl, "transform", "");
993
+ css(ghostEl, "box-sizing", "border-box");
994
+ css(ghostEl, "margin", 0);
995
+ css(ghostEl, "top", rect.top);
996
+ css(ghostEl, "left", rect.left);
997
+ css(ghostEl, "width", rect.width);
998
+ css(ghostEl, "height", rect.height);
999
+ css(ghostEl, "opacity", "0.8");
1000
+ css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed");
1001
+ css(ghostEl, "zIndex", "100000");
1002
+ css(ghostEl, "pointerEvents", "none");
1003
+ Sortable.ghost = ghostEl;
1004
+ container.appendChild(ghostEl);
1005
+ css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%");
1006
+ }
1007
+ },
1008
+ _onDragStart: function _onDragStart(evt, fallback) {
1009
+ var _this = this;
1010
+ var dataTransfer = evt.dataTransfer;
1011
+ var options = _this.options;
1012
+ pluginEvent("dragStart", this, { evt });
1013
+ if (Sortable.eventCanceled) {
1014
+ this._onDrop();
1015
+ return;
1016
+ }
1017
+ pluginEvent("setupClone", this);
1018
+ if (!Sortable.eventCanceled) {
1019
+ cloneEl = clone(dragEl);
1020
+ cloneEl.removeAttribute("id");
1021
+ cloneEl.draggable = false;
1022
+ cloneEl.style["will-change"] = "";
1023
+ this._hideClone();
1024
+ toggleClass(cloneEl, this.options.chosenClass, false);
1025
+ Sortable.clone = cloneEl;
1026
+ }
1027
+ _this.cloneId = _nextTick(function() {
1028
+ pluginEvent("clone", _this);
1029
+ if (Sortable.eventCanceled) return;
1030
+ if (!_this.options.removeCloneOnHide) rootEl.insertBefore(cloneEl, dragEl);
1031
+ _this._hideClone();
1032
+ _dispatchEvent({
1033
+ sortable: _this,
1034
+ name: "clone"
1035
+ });
1036
+ });
1037
+ !fallback && toggleClass(dragEl, options.dragClass, true);
1038
+ if (fallback) {
1039
+ ignoreNextClick = true;
1040
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1041
+ } else {
1042
+ off(document, "mouseup", _this._onDrop);
1043
+ off(document, "touchend", _this._onDrop);
1044
+ off(document, "touchcancel", _this._onDrop);
1045
+ if (dataTransfer) {
1046
+ dataTransfer.effectAllowed = "move";
1047
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1048
+ }
1049
+ on(document, "drop", _this);
1050
+ css(dragEl, "transform", "translateZ(0)");
1051
+ }
1052
+ awaitingDragStarted = true;
1053
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1054
+ on(document, "selectstart", _this);
1055
+ moved = true;
1056
+ window.getSelection().removeAllRanges();
1057
+ if (Safari) css(document.body, "user-select", "none");
1058
+ },
1059
+ _onDragOver: function _onDragOver(evt) {
1060
+ var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false;
1061
+ if (_silent) return;
1062
+ function dragOverEvent(name, extra) {
1063
+ pluginEvent(name, _this, _objectSpread2({
1064
+ evt,
1065
+ isOwner,
1066
+ axis: vertical ? "vertical" : "horizontal",
1067
+ revert,
1068
+ dragRect,
1069
+ targetRect,
1070
+ canSort,
1071
+ fromSortable,
1072
+ target,
1073
+ completed,
1074
+ onMove: function onMove(target$1, after$1) {
1075
+ return _onMove(rootEl, el, dragEl, dragRect, target$1, getRect(target$1), evt, after$1);
1076
+ },
1077
+ changed
1078
+ }, extra));
1079
+ }
1080
+ function capture() {
1081
+ dragOverEvent("dragOverAnimationCapture");
1082
+ _this.captureAnimationState();
1083
+ if (_this !== fromSortable) fromSortable.captureAnimationState();
1084
+ }
1085
+ function completed(insertion) {
1086
+ dragOverEvent("dragOverCompleted", { insertion });
1087
+ if (insertion) {
1088
+ if (isOwner) activeSortable._hideClone();
1089
+ else activeSortable._showClone(_this);
1090
+ if (_this !== fromSortable) {
1091
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1092
+ toggleClass(dragEl, options.ghostClass, true);
1093
+ }
1094
+ if (putSortable !== _this && _this !== Sortable.active) putSortable = _this;
1095
+ else if (_this === Sortable.active && putSortable) putSortable = null;
1096
+ if (fromSortable === _this) _this._ignoreWhileAnimating = target;
1097
+ _this.animateAll(function() {
1098
+ dragOverEvent("dragOverAnimationComplete");
1099
+ _this._ignoreWhileAnimating = null;
1100
+ });
1101
+ if (_this !== fromSortable) {
1102
+ fromSortable.animateAll();
1103
+ fromSortable._ignoreWhileAnimating = null;
1104
+ }
1105
+ }
1106
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) lastTarget = null;
1107
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1108
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1109
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1110
+ }
1111
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1112
+ return completedFired = true;
1113
+ }
1114
+ function changed() {
1115
+ newIndex = index(dragEl);
1116
+ newDraggableIndex = index(dragEl, options.draggable);
1117
+ _dispatchEvent({
1118
+ sortable: _this,
1119
+ name: "change",
1120
+ toEl: el,
1121
+ newIndex,
1122
+ newDraggableIndex,
1123
+ originalEvent: evt
1124
+ });
1125
+ }
1126
+ if (evt.preventDefault !== void 0) evt.cancelable && evt.preventDefault();
1127
+ target = closest(target, options.draggable, el, true);
1128
+ dragOverEvent("dragOver");
1129
+ if (Sortable.eventCanceled) return completedFired;
1130
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) return completed(false);
1131
+ ignoreNextClick = false;
1132
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
1133
+ vertical = this._getDirection(evt, target) === "vertical";
1134
+ dragRect = getRect(dragEl);
1135
+ dragOverEvent("dragOverValid");
1136
+ if (Sortable.eventCanceled) return completedFired;
1137
+ if (revert) {
1138
+ parentEl = rootEl;
1139
+ capture();
1140
+ this._hideClone();
1141
+ dragOverEvent("revert");
1142
+ if (!Sortable.eventCanceled) if (nextEl) rootEl.insertBefore(dragEl, nextEl);
1143
+ else rootEl.appendChild(dragEl);
1144
+ return completed(true);
1145
+ }
1146
+ var elLastChild = lastChild(el, options.draggable);
1147
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
1148
+ if (elLastChild === dragEl) return completed(false);
1149
+ if (elLastChild && el === evt.target) target = elLastChild;
1150
+ if (target) targetRect = getRect(target);
1151
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
1152
+ capture();
1153
+ if (elLastChild && elLastChild.nextSibling) el.insertBefore(dragEl, elLastChild.nextSibling);
1154
+ else el.appendChild(dragEl);
1155
+ parentEl = el;
1156
+ changed();
1157
+ return completed(true);
1158
+ }
1159
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
1160
+ var firstChild = getChild(el, 0, options, true);
1161
+ if (firstChild === dragEl) return completed(false);
1162
+ target = firstChild;
1163
+ targetRect = getRect(target);
1164
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
1165
+ capture();
1166
+ el.insertBefore(dragEl, firstChild);
1167
+ parentEl = el;
1168
+ changed();
1169
+ return completed(true);
1170
+ }
1171
+ } else if (target.parentNode === el) {
1172
+ targetRect = getRect(target);
1173
+ var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
1174
+ if (lastTarget !== target) {
1175
+ targetBeforeFirstSwap = targetRect[side1];
1176
+ pastFirstInvertThresh = false;
1177
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
1178
+ }
1179
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
1180
+ var sibling;
1181
+ if (direction !== 0) {
1182
+ var dragIndex = index(dragEl);
1183
+ do {
1184
+ dragIndex -= direction;
1185
+ sibling = parentEl.children[dragIndex];
1186
+ } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl));
1187
+ }
1188
+ if (direction === 0 || sibling === target) return completed(false);
1189
+ lastTarget = target;
1190
+ lastDirection = direction;
1191
+ var nextSibling = target.nextElementSibling, after = false;
1192
+ after = direction === 1;
1193
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
1194
+ if (moveVector !== false) {
1195
+ if (moveVector === 1 || moveVector === -1) after = moveVector === 1;
1196
+ _silent = true;
1197
+ setTimeout(_unsilent, 30);
1198
+ capture();
1199
+ if (after && !nextSibling) el.appendChild(dragEl);
1200
+ else target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
1201
+ if (scrolledPastTop) scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
1202
+ parentEl = dragEl.parentNode;
1203
+ if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
1204
+ changed();
1205
+ return completed(true);
1206
+ }
1207
+ }
1208
+ if (el.contains(dragEl)) return completed(false);
1209
+ }
1210
+ return false;
1211
+ },
1212
+ _ignoreWhileAnimating: null,
1213
+ _offMoveEvents: function _offMoveEvents() {
1214
+ off(document, "mousemove", this._onTouchMove);
1215
+ off(document, "touchmove", this._onTouchMove);
1216
+ off(document, "pointermove", this._onTouchMove);
1217
+ off(document, "dragover", nearestEmptyInsertDetectEvent);
1218
+ off(document, "mousemove", nearestEmptyInsertDetectEvent);
1219
+ off(document, "touchmove", nearestEmptyInsertDetectEvent);
1220
+ },
1221
+ _offUpEvents: function _offUpEvents() {
1222
+ var ownerDocument = this.el.ownerDocument;
1223
+ off(ownerDocument, "mouseup", this._onDrop);
1224
+ off(ownerDocument, "touchend", this._onDrop);
1225
+ off(ownerDocument, "pointerup", this._onDrop);
1226
+ off(ownerDocument, "pointercancel", this._onDrop);
1227
+ off(ownerDocument, "touchcancel", this._onDrop);
1228
+ off(document, "selectstart", this);
1229
+ },
1230
+ _onDrop: function _onDrop(evt) {
1231
+ var el = this.el, options = this.options;
1232
+ newIndex = index(dragEl);
1233
+ newDraggableIndex = index(dragEl, options.draggable);
1234
+ pluginEvent("drop", this, { evt });
1235
+ parentEl = dragEl && dragEl.parentNode;
1236
+ newIndex = index(dragEl);
1237
+ newDraggableIndex = index(dragEl, options.draggable);
1238
+ if (Sortable.eventCanceled) {
1239
+ this._nulling();
1240
+ return;
1241
+ }
1242
+ awaitingDragStarted = false;
1243
+ isCircumstantialInvert = false;
1244
+ pastFirstInvertThresh = false;
1245
+ clearInterval(this._loopId);
1246
+ clearTimeout(this._dragStartTimer);
1247
+ _cancelNextTick(this.cloneId);
1248
+ _cancelNextTick(this._dragStartId);
1249
+ if (this.nativeDraggable) {
1250
+ off(document, "drop", this);
1251
+ off(el, "dragstart", this._onDragStart);
1252
+ }
1253
+ this._offMoveEvents();
1254
+ this._offUpEvents();
1255
+ if (Safari) css(document.body, "user-select", "");
1256
+ css(dragEl, "transform", "");
1257
+ if (evt) {
1258
+ if (moved) {
1259
+ evt.cancelable && evt.preventDefault();
1260
+ !options.dropBubble && evt.stopPropagation();
1261
+ }
1262
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
1263
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
1264
+ if (dragEl) {
1265
+ if (this.nativeDraggable) off(dragEl, "dragend", this);
1266
+ _disableDraggable(dragEl);
1267
+ dragEl.style["will-change"] = "";
1268
+ if (moved && !awaitingDragStarted) toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
1269
+ toggleClass(dragEl, this.options.chosenClass, false);
1270
+ _dispatchEvent({
1271
+ sortable: this,
1272
+ name: "unchoose",
1273
+ toEl: parentEl,
1274
+ newIndex: null,
1275
+ newDraggableIndex: null,
1276
+ originalEvent: evt
1277
+ });
1278
+ if (rootEl !== parentEl) {
1279
+ if (newIndex >= 0) {
1280
+ _dispatchEvent({
1281
+ rootEl: parentEl,
1282
+ name: "add",
1283
+ toEl: parentEl,
1284
+ fromEl: rootEl,
1285
+ originalEvent: evt
1286
+ });
1287
+ _dispatchEvent({
1288
+ sortable: this,
1289
+ name: "remove",
1290
+ toEl: parentEl,
1291
+ originalEvent: evt
1292
+ });
1293
+ _dispatchEvent({
1294
+ rootEl: parentEl,
1295
+ name: "sort",
1296
+ toEl: parentEl,
1297
+ fromEl: rootEl,
1298
+ originalEvent: evt
1299
+ });
1300
+ _dispatchEvent({
1301
+ sortable: this,
1302
+ name: "sort",
1303
+ toEl: parentEl,
1304
+ originalEvent: evt
1305
+ });
1306
+ }
1307
+ putSortable && putSortable.save();
1308
+ } else if (newIndex !== oldIndex) {
1309
+ if (newIndex >= 0) {
1310
+ _dispatchEvent({
1311
+ sortable: this,
1312
+ name: "update",
1313
+ toEl: parentEl,
1314
+ originalEvent: evt
1315
+ });
1316
+ _dispatchEvent({
1317
+ sortable: this,
1318
+ name: "sort",
1319
+ toEl: parentEl,
1320
+ originalEvent: evt
1321
+ });
1322
+ }
1323
+ }
1324
+ if (Sortable.active) {
1325
+ if (newIndex == null || newIndex === -1) {
1326
+ newIndex = oldIndex;
1327
+ newDraggableIndex = oldDraggableIndex;
1328
+ }
1329
+ _dispatchEvent({
1330
+ sortable: this,
1331
+ name: "end",
1332
+ toEl: parentEl,
1333
+ originalEvent: evt
1334
+ });
1335
+ this.save();
1336
+ }
1337
+ }
1338
+ }
1339
+ this._nulling();
1340
+ },
1341
+ _nulling: function _nulling() {
1342
+ pluginEvent("nulling", this);
1343
+ rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null;
1344
+ var el = this.el;
1345
+ savedInputChecked.forEach(function(checkEl) {
1346
+ if (el.contains(checkEl)) checkEl.checked = true;
1347
+ });
1348
+ savedInputChecked.length = lastDx = lastDy = 0;
1349
+ },
1350
+ handleEvent: function handleEvent(evt) {
1351
+ switch (evt.type) {
1352
+ case "drop":
1353
+ case "dragend":
1354
+ this._onDrop(evt);
1355
+ break;
1356
+ case "dragenter":
1357
+ case "dragover":
1358
+ if (dragEl) {
1359
+ this._onDragOver(evt);
1360
+ _globalDragOver(evt);
1361
+ }
1362
+ break;
1363
+ case "selectstart":
1364
+ evt.preventDefault();
1365
+ break;
1366
+ }
1367
+ },
1368
+ toArray: function toArray() {
1369
+ var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options;
1370
+ for (; i < n; i++) {
1371
+ el = children[i];
1372
+ if (closest(el, options.draggable, this.el, false)) order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
1373
+ }
1374
+ return order;
1375
+ },
1376
+ sort: function sort(order, useAnimation) {
1377
+ var items = {}, rootEl$1 = this.el;
1378
+ this.toArray().forEach(function(id, i) {
1379
+ var el = rootEl$1.children[i];
1380
+ if (closest(el, this.options.draggable, rootEl$1, false)) items[id] = el;
1381
+ }, this);
1382
+ useAnimation && this.captureAnimationState();
1383
+ order.forEach(function(id) {
1384
+ if (items[id]) {
1385
+ rootEl$1.removeChild(items[id]);
1386
+ rootEl$1.appendChild(items[id]);
1387
+ }
1388
+ });
1389
+ useAnimation && this.animateAll();
1390
+ },
1391
+ save: function save() {
1392
+ var store = this.options.store;
1393
+ store && store.set && store.set(this);
1394
+ },
1395
+ closest: function closest$1(el, selector) {
1396
+ return closest(el, selector || this.options.draggable, this.el, false);
1397
+ },
1398
+ option: function option(name, value) {
1399
+ var options = this.options;
1400
+ if (value === void 0) return options[name];
1401
+ else {
1402
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
1403
+ if (typeof modifiedValue !== "undefined") options[name] = modifiedValue;
1404
+ else options[name] = value;
1405
+ if (name === "group") _prepareGroup(options);
1406
+ }
1407
+ },
1408
+ destroy: function destroy() {
1409
+ pluginEvent("destroy", this);
1410
+ var el = this.el;
1411
+ el[expando] = null;
1412
+ off(el, "mousedown", this._onTapStart);
1413
+ off(el, "touchstart", this._onTapStart);
1414
+ off(el, "pointerdown", this._onTapStart);
1415
+ if (this.nativeDraggable) {
1416
+ off(el, "dragover", this);
1417
+ off(el, "dragenter", this);
1418
+ }
1419
+ Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el$1) {
1420
+ el$1.removeAttribute("draggable");
1421
+ });
1422
+ this._onDrop();
1423
+ this._disableDelayedDragEvents();
1424
+ sortables.splice(sortables.indexOf(this.el), 1);
1425
+ this.el = el = null;
1426
+ },
1427
+ _hideClone: function _hideClone() {
1428
+ if (!cloneHidden) {
1429
+ pluginEvent("hideClone", this);
1430
+ if (Sortable.eventCanceled) return;
1431
+ css(cloneEl, "display", "none");
1432
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) cloneEl.parentNode.removeChild(cloneEl);
1433
+ cloneHidden = true;
1434
+ }
1435
+ },
1436
+ _showClone: function _showClone(putSortable$1) {
1437
+ if (putSortable$1.lastPutMode !== "clone") {
1438
+ this._hideClone();
1439
+ return;
1440
+ }
1441
+ if (cloneHidden) {
1442
+ pluginEvent("showClone", this);
1443
+ if (Sortable.eventCanceled) return;
1444
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) rootEl.insertBefore(cloneEl, dragEl);
1445
+ else if (nextEl) rootEl.insertBefore(cloneEl, nextEl);
1446
+ else rootEl.appendChild(cloneEl);
1447
+ if (this.options.group.revertClone) this.animate(dragEl, cloneEl);
1448
+ css(cloneEl, "display", "");
1449
+ cloneHidden = false;
1450
+ }
1451
+ }
1452
+ };
1453
+ function _globalDragOver(evt) {
1454
+ if (evt.dataTransfer) evt.dataTransfer.dropEffect = "move";
1455
+ evt.cancelable && evt.preventDefault();
1456
+ }
1457
+ function _onMove(fromEl, toEl, dragEl$1, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
1458
+ var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal;
1459
+ if (window.CustomEvent && !IE11OrLess && !Edge) evt = new CustomEvent("move", {
1460
+ bubbles: true,
1461
+ cancelable: true
1462
+ });
1463
+ else {
1464
+ evt = document.createEvent("Event");
1465
+ evt.initEvent("move", true, true);
1466
+ }
1467
+ evt.to = toEl;
1468
+ evt.from = fromEl;
1469
+ evt.dragged = dragEl$1;
1470
+ evt.draggedRect = dragRect;
1471
+ evt.related = targetEl || toEl;
1472
+ evt.relatedRect = targetRect || getRect(toEl);
1473
+ evt.willInsertAfter = willInsertAfter;
1474
+ evt.originalEvent = originalEvent;
1475
+ fromEl.dispatchEvent(evt);
1476
+ if (onMoveFn) retVal = onMoveFn.call(sortable, evt, originalEvent);
1477
+ return retVal;
1478
+ }
1479
+ function _disableDraggable(el) {
1480
+ el.draggable = false;
1481
+ }
1482
+ function _unsilent() {
1483
+ _silent = false;
1484
+ }
1485
+ function _ghostIsFirst(evt, vertical, sortable) {
1486
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
1487
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1488
+ var spacer = 10;
1489
+ return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
1490
+ }
1491
+ function _ghostIsLast(evt, vertical, sortable) {
1492
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
1493
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
1494
+ var spacer = 10;
1495
+ return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
1496
+ }
1497
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
1498
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false;
1499
+ if (!invertSwap) {
1500
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
1501
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) pastFirstInvertThresh = true;
1502
+ if (!pastFirstInvertThresh) {
1503
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) return -lastDirection;
1504
+ } else invert = true;
1505
+ } else if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) return _getInsertDirection(target);
1506
+ }
1507
+ invert = invert || invertSwap;
1508
+ if (invert) {
1509
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
1510
+ }
1511
+ return 0;
1512
+ }
1513
+ function _getInsertDirection(target) {
1514
+ if (index(dragEl) < index(target)) return 1;
1515
+ else return -1;
1516
+ }
1517
+ function _generateId(el) {
1518
+ var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0;
1519
+ while (i--) sum += str.charCodeAt(i);
1520
+ return sum.toString(36);
1521
+ }
1522
+ function _saveInputCheckedState(root) {
1523
+ savedInputChecked.length = 0;
1524
+ var inputs = root.getElementsByTagName("input");
1525
+ var idx = inputs.length;
1526
+ while (idx--) {
1527
+ var el = inputs[idx];
1528
+ el.checked && savedInputChecked.push(el);
1529
+ }
1530
+ }
1531
+ function _nextTick(fn) {
1532
+ return setTimeout(fn, 0);
1533
+ }
1534
+ function _cancelNextTick(id) {
1535
+ return clearTimeout(id);
1536
+ }
1537
+ if (documentExists) on(document, "touchmove", function(evt) {
1538
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) evt.preventDefault();
1539
+ });
1540
+ Sortable.utils = {
1541
+ on,
1542
+ off,
1543
+ css,
1544
+ find,
1545
+ is: function is(el, selector) {
1546
+ return !!closest(el, selector, el, false);
1547
+ },
1548
+ extend,
1549
+ throttle,
1550
+ closest,
1551
+ toggleClass,
1552
+ clone,
1553
+ index,
1554
+ nextTick: _nextTick,
1555
+ cancelNextTick: _cancelNextTick,
1556
+ detectDirection: _detectDirection,
1557
+ getChild,
1558
+ expando
1559
+ };
1560
+ Sortable.get = function(element) {
1561
+ return element[expando];
1562
+ };
1563
+ Sortable.mount = function() {
1564
+ for (var _len = arguments.length, plugins$1 = new Array(_len), _key = 0; _key < _len; _key++) plugins$1[_key] = arguments[_key];
1565
+ if (plugins$1[0].constructor === Array) plugins$1 = plugins$1[0];
1566
+ plugins$1.forEach(function(plugin) {
1567
+ if (!plugin.prototype || !plugin.prototype.constructor) throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
1568
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
1569
+ PluginManager.mount(plugin);
1570
+ });
1571
+ };
1572
+ Sortable.create = function(el, options) {
1573
+ return new Sortable(el, options);
1574
+ };
1575
+ Sortable.version = version;
1576
+ var autoScrolls = [], scrollEl, scrollRootEl, scrolling = false, lastAutoScrollX, lastAutoScrollY, touchEvt$1, pointerElemChangedInterval;
1577
+ function AutoScrollPlugin() {
1578
+ function AutoScroll() {
1579
+ this.defaults = {
1580
+ scroll: true,
1581
+ forceAutoScrollFallback: false,
1582
+ scrollSensitivity: 30,
1583
+ scrollSpeed: 10,
1584
+ bubbleScroll: true
1585
+ };
1586
+ for (var fn in this) if (fn.charAt(0) === "_" && typeof this[fn] === "function") this[fn] = this[fn].bind(this);
1587
+ }
1588
+ AutoScroll.prototype = {
1589
+ dragStarted: function dragStarted(_ref) {
1590
+ var originalEvent = _ref.originalEvent;
1591
+ if (this.sortable.nativeDraggable) on(document, "dragover", this._handleAutoScroll);
1592
+ else if (this.options.supportPointer) on(document, "pointermove", this._handleFallbackAutoScroll);
1593
+ else if (originalEvent.touches) on(document, "touchmove", this._handleFallbackAutoScroll);
1594
+ else on(document, "mousemove", this._handleFallbackAutoScroll);
1595
+ },
1596
+ dragOverCompleted: function dragOverCompleted(_ref2) {
1597
+ var originalEvent = _ref2.originalEvent;
1598
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) this._handleAutoScroll(originalEvent);
1599
+ },
1600
+ drop: function drop$1() {
1601
+ if (this.sortable.nativeDraggable) off(document, "dragover", this._handleAutoScroll);
1602
+ else {
1603
+ off(document, "pointermove", this._handleFallbackAutoScroll);
1604
+ off(document, "touchmove", this._handleFallbackAutoScroll);
1605
+ off(document, "mousemove", this._handleFallbackAutoScroll);
1606
+ }
1607
+ clearPointerElemChangedInterval();
1608
+ clearAutoScrolls();
1609
+ cancelThrottle();
1610
+ },
1611
+ nulling: function nulling() {
1612
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
1613
+ autoScrolls.length = 0;
1614
+ },
1615
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
1616
+ this._handleAutoScroll(evt, true);
1617
+ },
1618
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
1619
+ var _this = this;
1620
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y);
1621
+ touchEvt$1 = evt;
1622
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
1623
+ autoScroll(evt, this.options, elem, fallback);
1624
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
1625
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
1626
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
1627
+ pointerElemChangedInterval = setInterval(function() {
1628
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
1629
+ if (newElem !== ogElemScroller) {
1630
+ ogElemScroller = newElem;
1631
+ clearAutoScrolls();
1632
+ }
1633
+ autoScroll(evt, _this.options, newElem, fallback);
1634
+ }, 10);
1635
+ lastAutoScrollX = x;
1636
+ lastAutoScrollY = y;
1637
+ }
1638
+ } else {
1639
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
1640
+ clearAutoScrolls();
1641
+ return;
1642
+ }
1643
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
1644
+ }
1645
+ }
1646
+ };
1647
+ return _extends(AutoScroll, {
1648
+ pluginName: "scroll",
1649
+ initializeByDefault: true
1650
+ });
1651
+ }
1652
+ function clearAutoScrolls() {
1653
+ autoScrolls.forEach(function(autoScroll$1) {
1654
+ clearInterval(autoScroll$1.pid);
1655
+ });
1656
+ autoScrolls = [];
1657
+ }
1658
+ function clearPointerElemChangedInterval() {
1659
+ clearInterval(pointerElemChangedInterval);
1660
+ }
1661
+ var autoScroll = throttle(function(evt, options, rootEl$1, isFallback) {
1662
+ if (!options.scroll) return;
1663
+ var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement();
1664
+ var scrollThisInstance = false, scrollCustomFn;
1665
+ if (scrollRootEl !== rootEl$1) {
1666
+ scrollRootEl = rootEl$1;
1667
+ clearAutoScrolls();
1668
+ scrollEl = options.scroll;
1669
+ scrollCustomFn = options.scrollFn;
1670
+ if (scrollEl === true) scrollEl = getParentAutoScrollElement(rootEl$1, true);
1671
+ }
1672
+ var layersOut = 0;
1673
+ var currentParent = scrollEl;
1674
+ do {
1675
+ var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop;
1676
+ if (el === winScroller) {
1677
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible");
1678
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible");
1679
+ } else {
1680
+ canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll");
1681
+ canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll");
1682
+ }
1683
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
1684
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
1685
+ if (!autoScrolls[layersOut]) {
1686
+ for (var i = 0; i <= layersOut; i++) if (!autoScrolls[i]) autoScrolls[i] = {};
1687
+ }
1688
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
1689
+ autoScrolls[layersOut].el = el;
1690
+ autoScrolls[layersOut].vx = vx;
1691
+ autoScrolls[layersOut].vy = vy;
1692
+ clearInterval(autoScrolls[layersOut].pid);
1693
+ if (vx != 0 || vy != 0) {
1694
+ scrollThisInstance = true;
1695
+ autoScrolls[layersOut].pid = setInterval(function() {
1696
+ if (isFallback && this.layer === 0) Sortable.active._onTouchMove(touchEvt$1);
1697
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
1698
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
1699
+ if (typeof scrollCustomFn === "function") {
1700
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") return;
1701
+ }
1702
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
1703
+ }.bind({ layer: layersOut }), 24);
1704
+ }
1705
+ }
1706
+ layersOut++;
1707
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
1708
+ scrolling = scrollThisInstance;
1709
+ }, 30);
1710
+ var drop = function drop$1(_ref) {
1711
+ var originalEvent = _ref.originalEvent, putSortable$1 = _ref.putSortable, dragEl$1 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget;
1712
+ if (!originalEvent) return;
1713
+ var toSortable = putSortable$1 || activeSortable;
1714
+ hideGhostForTarget();
1715
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
1716
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
1717
+ unhideGhostForTarget();
1718
+ if (toSortable && !toSortable.el.contains(target)) {
1719
+ dispatchSortableEvent("spill");
1720
+ this.onSpill({
1721
+ dragEl: dragEl$1,
1722
+ putSortable: putSortable$1
1723
+ });
1724
+ }
1725
+ };
1726
+ function Revert() {}
1727
+ Revert.prototype = {
1728
+ startIndex: null,
1729
+ dragStart: function dragStart(_ref2) {
1730
+ this.startIndex = _ref2.oldDraggableIndex;
1731
+ },
1732
+ onSpill: function onSpill(_ref3) {
1733
+ var dragEl$1 = _ref3.dragEl, putSortable$1 = _ref3.putSortable;
1734
+ this.sortable.captureAnimationState();
1735
+ if (putSortable$1) putSortable$1.captureAnimationState();
1736
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
1737
+ if (nextSibling) this.sortable.el.insertBefore(dragEl$1, nextSibling);
1738
+ else this.sortable.el.appendChild(dragEl$1);
1739
+ this.sortable.animateAll();
1740
+ if (putSortable$1) putSortable$1.animateAll();
1741
+ },
1742
+ drop
1743
+ };
1744
+ _extends(Revert, { pluginName: "revertOnSpill" });
1745
+ function Remove() {}
1746
+ Remove.prototype = {
1747
+ onSpill: function onSpill(_ref4) {
1748
+ var dragEl$1 = _ref4.dragEl;
1749
+ var parentSortable = _ref4.putSortable || this.sortable;
1750
+ parentSortable.captureAnimationState();
1751
+ dragEl$1.parentNode && dragEl$1.parentNode.removeChild(dragEl$1);
1752
+ parentSortable.animateAll();
1753
+ },
1754
+ drop
1755
+ };
1756
+ _extends(Remove, { pluginName: "removeOnSpill" });
1757
+ Sortable.mount(new AutoScrollPlugin());
1758
+ Sortable.mount(Remove, Revert);
1759
+ var sortable_esm_default = Sortable;
1760
+ var defaultNamespace = "fl";
1761
+ var statePrefix = "is-";
1762
+ var buildBemName = (namespace, block, blockSuffix = "", element = "", modifier = "") => {
1763
+ let className = `${namespace}-${block}`;
1764
+ if (blockSuffix) className += `-${blockSuffix}`;
1765
+ if (element) className += `__${element}`;
1766
+ if (modifier) className += `--${modifier}`;
1767
+ return className;
1768
+ };
1769
+ const useNamespace = (block, namespace = defaultNamespace) => {
1770
+ const b = (blockSuffix = "") => buildBemName(namespace, block, blockSuffix);
1771
+ const e = (element) => element ? buildBemName(namespace, block, "", element) : "";
1772
+ const m = (modifier) => modifier ? buildBemName(namespace, block, "", "", modifier) : "";
1773
+ const be = (blockSuffix, element) => {
1774
+ if (!blockSuffix || !element) return "";
1775
+ return buildBemName(namespace, block, blockSuffix, element);
1776
+ };
1777
+ const em = (element, modifier) => {
1778
+ if (!element || !modifier) return "";
1779
+ return buildBemName(namespace, block, "", element, modifier);
1780
+ };
1781
+ const bm = (blockSuffix, modifier) => {
1782
+ if (!blockSuffix || !modifier) return "";
1783
+ return buildBemName(namespace, block, blockSuffix, "", modifier);
1784
+ };
1785
+ const bem = (blockSuffix, element, modifier) => {
1786
+ if (!blockSuffix && !element && !modifier) return b();
1787
+ return buildBemName(namespace, block, blockSuffix, element, modifier);
1788
+ };
1789
+ const is = (name, state = true) => state ? `${statePrefix}${name}` : "";
1790
+ return {
1791
+ namespace,
1792
+ b,
1793
+ e,
1794
+ m,
1795
+ be,
1796
+ em,
1797
+ bm,
1798
+ bem,
1799
+ is
1800
+ };
1801
+ };
1802
+ const mergeComponentExpose = (vm, exposed, extras = {}) => {
1803
+ if (!vm?.exposed || !exposed || typeof exposed !== "object" && typeof exposed !== "function") return;
1804
+ Object.assign(vm.exposed, extras, exposed);
1805
+ };
1806
+ const invokeListener = (listener, ...args) => {
1807
+ if (typeof listener === "function") {
1808
+ listener(...args);
1809
+ return;
1810
+ }
1811
+ if (!Array.isArray(listener)) return;
1812
+ for (const item of listener) if (typeof item === "function") item(...args);
1813
+ };
1814
+ const withInstall = (component) => {
1815
+ const installable = component;
1816
+ installable.install = (app) => {
1817
+ if (!component.name) return;
1818
+ app.component(component.name, component);
1819
+ };
1820
+ return installable;
1821
+ };
1822
+ const useMergedExpose = (extras) => {
1823
+ const vm = (0, vue.getCurrentInstance)();
1824
+ const changeRef = (exposed) => {
1825
+ mergeComponentExpose(vm, exposed, extras);
1826
+ };
1827
+ return { changeRef };
1828
+ };
1829
+ const tableProps = {
1830
+ selectionRowClick: {
1831
+ type: Boolean,
1832
+ default: true
1833
+ },
1834
+ selectionSingle: {
1835
+ type: Boolean,
1836
+ default: false
1837
+ },
1838
+ isEdit: {
1839
+ type: Boolean,
1840
+ default: true
1841
+ },
1842
+ cellProxyMaxDepth: {
1843
+ type: Number,
1844
+ default: 4,
1845
+ validator: (value) => Number.isInteger(value) && value >= 1
1846
+ },
1847
+ crossHighlight: {
1848
+ type: Boolean,
1849
+ default: false
1850
+ },
1851
+ rowDraggable: {
1852
+ type: Boolean,
1853
+ default: true
1854
+ },
1855
+ columnDraggable: {
1856
+ type: Boolean,
1857
+ default: true
1858
+ },
1859
+ rowDragHandleColumnIndex: {
1860
+ type: Number,
1861
+ default: 0,
1862
+ validator: (value) => Number.isInteger(value) && value >= 0
1863
+ },
1864
+ rowKeyField: {
1865
+ type: String,
1866
+ default: "id"
1867
+ },
1868
+ data: {
1869
+ type: Array,
1870
+ default: () => []
1871
+ }
1872
+ };
1873
+ var isRecord = (value) => value !== null && typeof value === "object";
1874
+ var isNumber = (value) => typeof value === "number";
1875
+ const tableEmits = {
1876
+ "selection-row-toggle": (payload) => isRecord(payload) && isRecord(payload.row) && isNumber(payload.rowIndex) && typeof payload.selected === "boolean" && Array.isArray(payload.selectionBefore) && Array.isArray(payload.selectionAfter) && (payload.trigger === "row-click" || payload.trigger === "selection-change"),
1877
+ "selection-single-conflict": (payload) => isRecord(payload) && (payload.reason === "multiple-selected" || payload.reason === "select-all-disabled") && Array.isArray(payload.selection),
1878
+ "cell-change": (payload) => isRecord(payload) && isNumber(payload.rowIndex) && (typeof payload.rowKey === "string" || typeof payload.rowKey === "number") && typeof payload.columnKey === "string" && typeof payload.path === "string" && payload.trigger === "proxy-set",
1879
+ "row-drag-start": (payload) => isRecord(payload) && (payload.oldIndex === null || isNumber(payload.oldIndex)) && (payload.newIndex === null || isNumber(payload.newIndex)),
1880
+ "row-drag-end": (payload) => isRecord(payload) && (payload.oldIndex === null || isNumber(payload.oldIndex)) && (payload.newIndex === null || isNumber(payload.newIndex)),
1881
+ "row-order-change": (payload) => isRecord(payload) && isNumber(payload.oldIndex) && isNumber(payload.newIndex) && isRecord(payload.row) && Array.isArray(payload.data),
1882
+ "column-drag-start": (payload) => isRecord(payload) && (payload.oldIndex === null || isNumber(payload.oldIndex)) && (payload.newIndex === null || isNumber(payload.newIndex)) && (payload.columnIndex === null || isNumber(payload.columnIndex)),
1883
+ "column-drag-end": (payload) => isRecord(payload) && (payload.oldIndex === null || isNumber(payload.oldIndex)) && (payload.newIndex === null || isNumber(payload.newIndex)) && (payload.columnIndex === null || isNumber(payload.columnIndex)),
1884
+ "column-order-change": (payload) => isRecord(payload) && isNumber(payload.oldIndex) && isNumber(payload.newIndex) && isNumber(payload.columnIndex) && Array.isArray(payload.order)
1885
+ };
1886
+ var isObjectLike = (value) => value !== null && typeof value === "object";
1887
+ var composePath = (base, key) => {
1888
+ const keyText = typeof key === "symbol" ? "" : String(key);
1889
+ if (!keyText) return base;
1890
+ return base ? `${base}.${keyText}` : keyText;
1891
+ };
1892
+ var resolveRowKey = (row, rowIndex, rowKeyField) => {
1893
+ const candidate = row[rowKeyField];
1894
+ if (typeof candidate === "string" || typeof candidate === "number") return candidate;
1895
+ return rowIndex;
1896
+ };
1897
+ var resolveColumnKey = (path) => {
1898
+ if (!path) return "";
1899
+ const [first] = path.split(".");
1900
+ return first || path;
1901
+ };
1902
+ const createTableProxyDataBuilder = () => {
1903
+ const cache = /* @__PURE__ */ new WeakMap();
1904
+ const runtime = {
1905
+ onCellChange: () => void 0,
1906
+ resolveRowIndex: () => -1,
1907
+ rowKeyField: "id",
1908
+ maxDepth: 4
1909
+ };
1910
+ const getCachedProxy = (target, path) => cache.get(target)?.get(path);
1911
+ const setCachedProxy = (target, path, proxy) => {
1912
+ if (!cache.has(target)) cache.set(target, /* @__PURE__ */ new Map());
1913
+ cache.get(target)?.set(path, proxy);
1914
+ };
1915
+ const toNullableRow = (value) => {
1916
+ if (!isObjectLike(value)) return null;
1917
+ return value;
1918
+ };
1919
+ const createProxy = (target, rootRow, path, depth) => {
1920
+ const cached = getCachedProxy(target, path);
1921
+ if (cached) return cached;
1922
+ const proxy = new Proxy(target, {
1923
+ get(currentTarget, key) {
1924
+ const value = Reflect.get(currentTarget, key);
1925
+ if (!isObjectLike(value)) return value;
1926
+ if (depth >= runtime.maxDepth) return value;
1927
+ return createProxy(value, rootRow, composePath(path, key), depth + 1);
1928
+ },
1929
+ set(currentTarget, key, value) {
1930
+ const previousValue = Reflect.get(currentTarget, key);
1931
+ const result = Reflect.set(currentTarget, key, value);
1932
+ if (!result || typeof key === "symbol" || Object.is(previousValue, value)) return result;
1933
+ const nextPath = composePath(path, key);
1934
+ const rowIndex = runtime.resolveRowIndex(rootRow);
1935
+ runtime.onCellChange({
1936
+ rowIndex,
1937
+ rowKey: resolveRowKey(rootRow, rowIndex, runtime.rowKeyField),
1938
+ columnKey: resolveColumnKey(nextPath),
1939
+ path: nextPath,
1940
+ prevValue: previousValue,
1941
+ nextValue: value,
1942
+ trigger: "proxy-set"
1943
+ });
1944
+ return result;
1945
+ }
1946
+ });
1947
+ setCachedProxy(target, path, proxy);
1948
+ return proxy;
1949
+ };
1950
+ return ({ data, onCellChange, resolveRowIndex, rowKeyField, maxDepth }) => {
1951
+ runtime.onCellChange = onCellChange;
1952
+ runtime.resolveRowIndex = resolveRowIndex;
1953
+ runtime.rowKeyField = rowKeyField;
1954
+ runtime.maxDepth = maxDepth;
1955
+ return data.map((row) => {
1956
+ const rawRow = toNullableRow(row);
1957
+ if (!rawRow) return row;
1958
+ return createProxy(rawRow, rawRow, "", 0);
1959
+ });
1960
+ };
1961
+ };
1962
+ const tableEditorRegistryDomKey = Symbol("fl-table-editor-registry");
1963
+ var resolveEditorCell = (endpoint) => {
1964
+ const cell = endpoint.getRootEl()?.closest("td.el-table__cell");
1965
+ return cell instanceof HTMLElement ? cell : null;
1966
+ };
1967
+ const createTableEditorRegistry = () => {
1968
+ const records = /* @__PURE__ */ new Map();
1969
+ const unindexedIds = /* @__PURE__ */ new Set();
1970
+ let idsByCell = /* @__PURE__ */ new WeakMap();
1971
+ let isIndexDirty = false;
1972
+ const detachRecord = (record) => {
1973
+ if (!record.cell) {
1974
+ unindexedIds.delete(record.endpoint.id);
1975
+ return;
1976
+ }
1977
+ const ids = idsByCell.get(record.cell);
1978
+ ids?.delete(record.endpoint.id);
1979
+ if (ids?.size === 0) idsByCell.delete(record.cell);
1980
+ record.cell = null;
1981
+ };
1982
+ const indexRecord = (record) => {
1983
+ detachRecord(record);
1984
+ const cell = resolveEditorCell(record.endpoint);
1985
+ record.cell = cell;
1986
+ if (!cell) {
1987
+ unindexedIds.add(record.endpoint.id);
1988
+ return;
1989
+ }
1990
+ const ids = idsByCell.get(cell) ?? /* @__PURE__ */ new Set();
1991
+ ids.add(record.endpoint.id);
1992
+ idsByCell.set(cell, ids);
1993
+ };
1994
+ const refresh = () => {
1995
+ idsByCell = /* @__PURE__ */ new WeakMap();
1996
+ unindexedIds.clear();
1997
+ for (const record of records.values()) {
1998
+ record.cell = null;
1999
+ indexRecord(record);
2000
+ }
2001
+ isIndexDirty = false;
2002
+ };
2003
+ const refreshUnindexed = () => {
2004
+ for (const id of [...unindexedIds]) {
2005
+ const record = records.get(id);
2006
+ if (record) indexRecord(record);
2007
+ else unindexedIds.delete(id);
2008
+ }
2009
+ };
2010
+ return {
2011
+ register(endpoint) {
2012
+ const previous = records.get(endpoint.id);
2013
+ if (previous) detachRecord(previous);
2014
+ const record = {
2015
+ endpoint,
2016
+ cell: null
2017
+ };
2018
+ records.set(endpoint.id, record);
2019
+ indexRecord(record);
2020
+ return () => {
2021
+ const current = records.get(endpoint.id);
2022
+ if (current?.endpoint !== endpoint) return;
2023
+ detachRecord(current);
2024
+ records.delete(endpoint.id);
2025
+ };
2026
+ },
2027
+ getEditors: () => [...records.values()].map((record) => record.endpoint),
2028
+ getEditorsInCells(cells) {
2029
+ if (cells.length === 0) return [];
2030
+ if (isIndexDirty) refresh();
2031
+ else if (unindexedIds.size > 0) refreshUnindexed();
2032
+ const cellSet = new Set(cells);
2033
+ const candidateIds = /* @__PURE__ */ new Set();
2034
+ for (const cell of cells) for (const id of idsByCell.get(cell) ?? []) candidateIds.add(id);
2035
+ const candidates = [];
2036
+ for (const id of candidateIds) {
2037
+ const record = records.get(id);
2038
+ if (!record) continue;
2039
+ const root = record.endpoint.getRootEl();
2040
+ if (root && cells.some((cell) => cell.contains(root))) {
2041
+ candidates.push(record.endpoint);
2042
+ continue;
2043
+ }
2044
+ indexRecord(record);
2045
+ if (record.cell && cellSet.has(record.cell)) candidates.push(record.endpoint);
2046
+ }
2047
+ return candidates;
2048
+ },
2049
+ invalidate: () => {
2050
+ isIndexDirty = true;
2051
+ },
2052
+ refresh
2053
+ };
2054
+ };
2055
+ var COLUMN_RESIZE_HOTZONE_PX = 8;
2056
+ var ROW_DRAG_HANDLE_HOTZONE_PX = 24;
2057
+ var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
2058
+ name: "FlTable",
2059
+ inheritAttrs: false,
2060
+ __name: "table",
2061
+ props: tableProps,
2062
+ emits: tableEmits,
2063
+ setup(__props, { expose: __expose, emit: __emit }) {
2064
+ const CONTROL_COLUMN_TYPES = new Set([
2065
+ "selection",
2066
+ "index",
2067
+ "expand"
2068
+ ]);
2069
+ const props = __props;
2070
+ const emit = __emit;
2071
+ const attrs = (0, vue.useAttrs)();
2072
+ const slots = (0, vue.useSlots)();
2073
+ const ns = useNamespace("table");
2074
+ const rawAttrs = attrs;
2075
+ const tableRef = (0, vue.shallowRef)(null);
2076
+ const rowSortable = (0, vue.shallowRef)(null);
2077
+ const columnSortable = (0, vue.shallowRef)(null);
2078
+ const columnOrder = (0, vue.ref)([]);
2079
+ const columnDragCount = (0, vue.ref)(null);
2080
+ const visibleColumnCount = (0, vue.ref)(0);
2081
+ const draggingColumnOldDisplayIndex = (0, vue.ref)(null);
2082
+ const pendingColumnDropDisplayIndex = (0, vue.ref)(null);
2083
+ const columnDragIndicatorDisplayIndex = (0, vue.ref)(null);
2084
+ const columnDragIndicatorSide = (0, vue.ref)(null);
2085
+ const isColumnDragging = (0, vue.ref)(false);
2086
+ const columnDragPointerMoveListener = (0, vue.ref)(null);
2087
+ const isColumnResizeGesture = (0, vue.ref)(false);
2088
+ const columnResizeGuardHeaderRow = (0, vue.shallowRef)(null);
2089
+ const columnResizePointerDownListener = (0, vue.ref)(null);
2090
+ const columnResizePointerUpListener = (0, vue.ref)(null);
2091
+ const activeCell = (0, vue.ref)(null);
2092
+ const isEditing = (0, vue.ref)(false);
2093
+ const outsidePointerDownListener = (0, vue.ref)(null);
2094
+ const keyboardListener = (0, vue.ref)(null);
2095
+ const editorFocusInListener = (0, vue.ref)(null);
2096
+ const buildProxyData = createTableProxyDataBuilder();
2097
+ const editorRegistry = createTableEditorRegistry();
2098
+ let activeCellClassSnapshot = null;
2099
+ let renderedActiveCell = null;
2100
+ let renderedCrossHighlight = props.crossHighlight;
2101
+ let activeCellClassSyncVersion = 0;
2102
+ let shouldResetActiveCellClasses = false;
2103
+ const { changeRef } = useMergedExpose({});
2104
+ const setTableRef = (instance) => {
2105
+ tableRef.value = instance;
2106
+ changeRef(instance);
2107
+ };
2108
+ const flattenSlotNodes = (nodes) => {
2109
+ const flatNodes = [];
2110
+ const list = Array.isArray(nodes) ? nodes : [];
2111
+ const visit = (node) => {
2112
+ if (!(0, vue.isVNode)(node)) return;
2113
+ if (node.type === vue.Comment || node.type === vue.Text) return;
2114
+ if (node.type === vue.Fragment && Array.isArray(node.children)) {
2115
+ for (const child of node.children) visit(child);
2116
+ return;
2117
+ }
2118
+ flatNodes.push(node);
2119
+ };
2120
+ for (const node of list) visit(node);
2121
+ return flatNodes;
2122
+ };
2123
+ const getInternalColumnKey = (sourceIndex) => `column-${sourceIndex}`;
2124
+ const createColumnOrder = (count) => Array.from({ length: count }, (_, index$1) => index$1);
2125
+ const resolveColumnOrder = (count, currentOrder = columnOrder.value) => {
2126
+ if (count <= 0 || currentOrder.length !== count || new Set(currentOrder).size !== count || currentOrder.some((index$1) => index$1 < 0 || index$1 >= count)) return createColumnOrder(count);
2127
+ return currentOrder;
2128
+ };
2129
+ const reorderColumnOrder = (order, oldIndex$1, newIndex$1) => {
2130
+ if (oldIndex$1 === newIndex$1) return [...order];
2131
+ const nextOrder = [...order];
2132
+ const [moved$1] = nextOrder.splice(oldIndex$1, 1);
2133
+ if (moved$1 === void 0) return [...order];
2134
+ nextOrder.splice(newIndex$1, 0, moved$1);
2135
+ return nextOrder;
2136
+ };
2137
+ const tableSlots = (0, vue.computed)(() => {
2138
+ const orderSnapshot = columnOrder.value;
2139
+ const userDefaultSlot = slots.default;
2140
+ if (!userDefaultSlot) return slots;
2141
+ return {
2142
+ ...slots,
2143
+ default: (...args) => {
2144
+ const rawNodes = userDefaultSlot(...args);
2145
+ const columnNodes = flattenSlotNodes(rawNodes);
2146
+ if (columnNodes.length === 0) return rawNodes;
2147
+ return resolveColumnOrder(columnNodes.length, orderSnapshot).map((sourceIndex) => {
2148
+ const node = columnNodes[sourceIndex];
2149
+ if (!node) return null;
2150
+ return (0, vue.cloneVNode)(node, {
2151
+ key: node.key ?? `fl-table-column-${sourceIndex}`,
2152
+ columnKey: getInternalColumnKey(sourceIndex)
2153
+ });
2154
+ }).filter((node) => node !== null);
2155
+ }
2156
+ };
2157
+ });
2158
+ const controlledAttrKeys = [
2159
+ "class",
2160
+ "data",
2161
+ "border",
2162
+ "stripe",
2163
+ "highlightCurrentRow",
2164
+ "highlight-current-row",
2165
+ "headerRowClassName",
2166
+ "header-row-class-name",
2167
+ "cellClassName",
2168
+ "cell-class-name",
2169
+ "headerCellClassName",
2170
+ "header-cell-class-name",
2171
+ "onCellClick",
2172
+ "onCell-click",
2173
+ "onRowClick",
2174
+ "onSelect",
2175
+ "onSelectAll"
2176
+ ];
2177
+ const readAttr = (...keys) => {
2178
+ for (const key of keys) if (key in rawAttrs) return rawAttrs[key];
2179
+ };
2180
+ const normalizeClass = (value) => {
2181
+ if (!value) return [];
2182
+ if (typeof value === "string") return value.split(" ").map((item) => item.trim()).filter(Boolean);
2183
+ if (Array.isArray(value)) return value.flatMap((item) => normalizeClass(item));
2184
+ if (typeof value === "object") return Object.entries(value).filter(([, enabled]) => Boolean(enabled)).map(([name]) => name);
2185
+ return [];
2186
+ };
2187
+ const mergeClass = (...values) => {
2188
+ const classSet = /* @__PURE__ */ new Set();
2189
+ for (const item of values.flatMap((value) => normalizeClass(value))) classSet.add(item);
2190
+ return Array.from(classSet).join(" ");
2191
+ };
2192
+ const resolveBooleanAttr = (defaultValue, ...keys) => {
2193
+ const value = readAttr(...keys);
2194
+ if (value === void 0) return defaultValue;
2195
+ if (value === "") return true;
2196
+ if (typeof value === "boolean") return value;
2197
+ return Boolean(value);
2198
+ };
2199
+ const toNullableIndex = (value) => typeof value === "number" && Number.isInteger(value) ? value : null;
2200
+ const reorderRows = (rows, oldIndex$1, newIndex$1) => {
2201
+ if (oldIndex$1 === newIndex$1) return [...rows];
2202
+ const next = [...rows];
2203
+ const [moved$1] = next.splice(oldIndex$1, 1);
2204
+ if (!moved$1) return [...rows];
2205
+ next.splice(newIndex$1, 0, moved$1);
2206
+ return next;
2207
+ };
2208
+ const getTableElement = () => {
2209
+ const candidate = tableRef.value?.$el;
2210
+ return candidate instanceof HTMLElement ? candidate : null;
2211
+ };
2212
+ const bindEditorRegistryHost = () => {
2213
+ const tableElement = getTableElement();
2214
+ if (tableElement) tableElement[tableEditorRegistryDomKey] = editorRegistry;
2215
+ };
2216
+ const unbindEditorRegistryHost = () => {
2217
+ const tableElement = getTableElement();
2218
+ if (tableElement?.[tableEditorRegistryDomKey]) delete tableElement[tableEditorRegistryDomKey];
2219
+ };
2220
+ const hasSelectionColumn = () => {
2221
+ const tableElement = getTableElement();
2222
+ if (!tableElement) return false;
2223
+ return tableElement.querySelector(".el-table__header-wrapper th.el-table-column--selection") !== null;
2224
+ };
2225
+ const getSelectionRows = () => {
2226
+ const rows = tableRef.value?.getSelectionRows?.();
2227
+ return Array.isArray(rows) ? rows : [];
2228
+ };
2229
+ const sourceData = (0, vue.computed)(() => props.data);
2230
+ const tableData = (0, vue.computed)(() => {
2231
+ if (!props.isEdit) return sourceData.value;
2232
+ return buildProxyData({
2233
+ data: sourceData.value,
2234
+ rowKeyField: props.rowKeyField,
2235
+ maxDepth: props.cellProxyMaxDepth,
2236
+ resolveRowIndex: (row) => sourceData.value.indexOf(row),
2237
+ onCellChange: (payload) => {
2238
+ emit("cell-change", payload);
2239
+ }
2240
+ });
2241
+ });
2242
+ const forwardedAttrs = (0, vue.computed)(() => {
2243
+ const next = { ...rawAttrs };
2244
+ for (const key of controlledAttrKeys) delete next[key];
2245
+ return next;
2246
+ });
2247
+ const readRowKey = (row) => {
2248
+ const candidate = row[props.rowKeyField];
2249
+ return typeof candidate === "string" || typeof candidate === "number" ? candidate : null;
2250
+ };
2251
+ const isControlColumn = (column) => typeof column?.type === "string" && CONTROL_COLUMN_TYPES.has(column.type);
2252
+ const resolveColumnKey$1 = (column, displayIndex = null) => {
2253
+ if (typeof column?.columnKey === "string" && column.columnKey) return column.columnKey;
2254
+ if (typeof column?.rawColumnKey === "string" && column.rawColumnKey) return column.rawColumnKey;
2255
+ if (displayIndex === null) return null;
2256
+ return getInternalColumnKey(resolveColumnOrder(Math.max(columnOrder.value.length, displayIndex + 1, visibleColumnCount.value))[displayIndex] ?? displayIndex);
2257
+ };
2258
+ const resolveCellDisplayIndex = (cell) => {
2259
+ if (!(cell instanceof HTMLTableCellElement) || !(cell.parentElement instanceof HTMLTableRowElement)) return null;
2260
+ return Array.from(cell.parentElement.children).indexOf(cell);
2261
+ };
2262
+ const isRowDragHandleHotzone = (cell, event, displayIndex) => {
2263
+ if (!props.rowDraggable || displayIndex !== props.rowDragHandleColumnIndex || !(cell instanceof HTMLElement)) return false;
2264
+ const point = readClientPointFromEvent(event);
2265
+ if (!point) return false;
2266
+ const rect = cell.getBoundingClientRect();
2267
+ if (rect.width <= 0 || rect.height <= 0) return false;
2268
+ return point.x - rect.left <= Math.min(ROW_DRAG_HANDLE_HOTZONE_PX, rect.width);
2269
+ };
2270
+ const commitActiveCell = (nextActiveCell) => {
2271
+ activeCellClassSnapshot = nextActiveCell ? { ...nextActiveCell } : null;
2272
+ activeCell.value = nextActiveCell ? { ...nextActiveCell } : null;
2273
+ scheduleActiveCellClassSync();
2274
+ };
2275
+ const setActiveCell = (row, column, displayIndex) => {
2276
+ if (isControlColumn(column)) return;
2277
+ const rowKey = readRowKey(row);
2278
+ const columnKey = resolveColumnKey$1(column, displayIndex);
2279
+ if (rowKey === null || !columnKey) return;
2280
+ commitActiveCell({
2281
+ rowKey,
2282
+ columnKey
2283
+ });
2284
+ };
2285
+ const resolveVisibleColumns = () => {
2286
+ const columns = readStoreColumns();
2287
+ if (!Array.isArray(columns)) return [];
2288
+ return columns.flatMap((item, displayIndex) => {
2289
+ const column = item;
2290
+ if (isControlColumn(column)) return [];
2291
+ const columnKey = resolveColumnKey$1(column, displayIndex);
2292
+ if (!columnKey) return [];
2293
+ return [{
2294
+ displayIndex,
2295
+ columnKey,
2296
+ column
2297
+ }];
2298
+ });
2299
+ };
2300
+ const resolveCellPosition = (cell, rows = sourceData.value) => {
2301
+ if (!cell) return null;
2302
+ const rowIndex = rows.findIndex((row$1) => readRowKey(row$1) === cell.rowKey);
2303
+ if (rowIndex < 0) return null;
2304
+ const columns = resolveVisibleColumns();
2305
+ const column = columns.find((item) => item.columnKey === cell.columnKey);
2306
+ if (!column) return null;
2307
+ const row = rows[rowIndex];
2308
+ if (!row) return null;
2309
+ return {
2310
+ rowIndex,
2311
+ row,
2312
+ column,
2313
+ columns
2314
+ };
2315
+ };
2316
+ const resolveActiveCellPosition = () => resolveCellPosition(activeCell.value);
2317
+ const getBodyWrappers = () => {
2318
+ const tableElement = getTableElement();
2319
+ if (!tableElement) return [];
2320
+ return Array.from(tableElement.querySelectorAll(".el-table__body-wrapper, .el-table__fixed-body-wrapper"));
2321
+ };
2322
+ const isFixedCloneElement = (element) => Boolean(element?.closest(".el-table__fixed, .el-table__fixed-right"));
2323
+ const resolveBodyCellsByPosition = (rowIndex, displayIndex) => getBodyWrappers().flatMap((wrapper) => {
2324
+ const row = wrapper.querySelectorAll("tbody tr")[rowIndex];
2325
+ if (!row) return [];
2326
+ const cell = row.querySelectorAll("td.el-table__cell")[displayIndex];
2327
+ return cell ? [cell] : [];
2328
+ });
2329
+ const pickPrimaryCell = (cells) => cells.find((cell) => !isFixedCloneElement(cell)) ?? cells[0] ?? null;
2330
+ const activeCellClassNames = {
2331
+ active: ns.e("cross-active"),
2332
+ row: ns.e("cross-row"),
2333
+ column: ns.e("cross-column"),
2334
+ control: ns.e("cross-control-cell")
2335
+ };
2336
+ const getHeaderWrappers = () => {
2337
+ const tableElement = getTableElement();
2338
+ if (!tableElement) return [];
2339
+ return Array.from(tableElement.querySelectorAll(".el-table__header-wrapper, .el-table__fixed-header-wrapper"));
2340
+ };
2341
+ const resolveHeaderCellsByPosition = (displayIndex) => getHeaderWrappers().flatMap((wrapper) => {
2342
+ const rows = wrapper.querySelectorAll("thead tr");
2343
+ const cell = rows[rows.length - 1]?.querySelectorAll("th.el-table__cell")[displayIndex];
2344
+ return cell ? [cell] : [];
2345
+ });
2346
+ const createActiveCellDomLookup = () => {
2347
+ const bodyWrappers = getBodyWrappers().map((wrapper) => ({
2348
+ rows: wrapper.querySelectorAll("tbody tr"),
2349
+ rowCells: /* @__PURE__ */ new Map()
2350
+ }));
2351
+ const readRowCells = (wrapper, rowIndex) => {
2352
+ const cached = wrapper.rowCells.get(rowIndex);
2353
+ if (cached) return cached;
2354
+ const row = wrapper.rows[rowIndex];
2355
+ if (!row) return null;
2356
+ const cells = Array.from(row.querySelectorAll("td.el-table__cell"));
2357
+ wrapper.rowCells.set(rowIndex, cells);
2358
+ return cells;
2359
+ };
2360
+ return {
2361
+ resolveBodyCells(rowIndex, displayIndex) {
2362
+ return bodyWrappers.flatMap((wrapper) => {
2363
+ const cell = readRowCells(wrapper, rowIndex)?.[displayIndex];
2364
+ return cell ? [cell] : [];
2365
+ });
2366
+ },
2367
+ resolveBodyRowCells(rowIndex) {
2368
+ return bodyWrappers.flatMap((wrapper) => Array.from(readRowCells(wrapper, rowIndex) ?? []).map((cell, displayIndex) => ({
2369
+ cell,
2370
+ displayIndex
2371
+ })));
2372
+ },
2373
+ resolveBodyColumnCells(displayIndex) {
2374
+ const selector = `tr > td.el-table__cell:nth-child(${displayIndex + 1})`;
2375
+ return bodyWrappers.flatMap((wrapper) => Array.from(wrapper.rows[0]?.parentElement?.querySelectorAll(selector) ?? []));
2376
+ },
2377
+ resolveHeaderCells: resolveHeaderCellsByPosition
2378
+ };
2379
+ };
2380
+ const addActiveCellClass = (state, elements, className) => {
2381
+ for (const element of elements) {
2382
+ const classes = state.get(element) ?? /* @__PURE__ */ new Set();
2383
+ classes.add(className);
2384
+ state.set(element, classes);
2385
+ }
2386
+ };
2387
+ const collectActiveCellClasses = (cell, crossHighlight, lookup) => {
2388
+ const state = /* @__PURE__ */ new Map();
2389
+ const storeData = readStoreData();
2390
+ const position = resolveCellPosition(cell, Array.isArray(storeData) ? storeData : sourceData.value);
2391
+ if (!position) return state;
2392
+ const activeCells = lookup.resolveBodyCells(position.rowIndex, position.column.displayIndex);
2393
+ addActiveCellClass(state, activeCells, activeCellClassNames.active);
2394
+ if (!crossHighlight) return state;
2395
+ const columns = readStoreColumns();
2396
+ if (Array.isArray(columns)) for (const { cell: rowCell, displayIndex } of lookup.resolveBodyRowCells(position.rowIndex)) {
2397
+ if (displayIndex === position.column.displayIndex) continue;
2398
+ addActiveCellClass(state, [rowCell], isControlColumn(columns[displayIndex]) ? activeCellClassNames.control : activeCellClassNames.row);
2399
+ }
2400
+ const activeCellSet = new Set(activeCells);
2401
+ addActiveCellClass(state, lookup.resolveBodyColumnCells(position.column.displayIndex).filter((columnCell) => !activeCellSet.has(columnCell)), activeCellClassNames.column);
2402
+ addActiveCellClass(state, lookup.resolveHeaderCells(position.column.displayIndex), activeCellClassNames.column);
2403
+ return state;
2404
+ };
2405
+ const applyActiveCellClassDelta = (previous, next) => {
2406
+ for (const [element, classes] of previous) {
2407
+ const nextClasses = next.get(element);
2408
+ for (const className of classes) if (!nextClasses?.has(className)) element.classList.remove(className);
2409
+ }
2410
+ for (const [element, classes] of next) {
2411
+ const previousClasses = previous.get(element);
2412
+ for (const className of classes) if (!previousClasses?.has(className)) element.classList.add(className);
2413
+ }
2414
+ };
2415
+ const clearActiveCellClasses = () => {
2416
+ const tableElement = getTableElement();
2417
+ if (!tableElement) return;
2418
+ const selector = Object.values(activeCellClassNames).map((className) => `.${className}`).join(",");
2419
+ for (const element of tableElement.querySelectorAll(selector)) element.classList.remove(...Object.values(activeCellClassNames));
2420
+ };
2421
+ const syncActiveCellClasses = () => {
2422
+ const nextActiveCell = activeCellClassSnapshot ? { ...activeCellClassSnapshot } : null;
2423
+ const nextCrossHighlight = props.crossHighlight;
2424
+ const lookup = createActiveCellDomLookup();
2425
+ const nextClasses = collectActiveCellClasses(nextActiveCell, nextCrossHighlight, lookup);
2426
+ if (shouldResetActiveCellClasses) {
2427
+ clearActiveCellClasses();
2428
+ applyActiveCellClassDelta(/* @__PURE__ */ new Map(), nextClasses);
2429
+ } else applyActiveCellClassDelta(collectActiveCellClasses(renderedActiveCell, renderedCrossHighlight, lookup), nextClasses);
2430
+ renderedActiveCell = nextActiveCell;
2431
+ renderedCrossHighlight = nextCrossHighlight;
2432
+ shouldResetActiveCellClasses = false;
2433
+ };
2434
+ function scheduleActiveCellClassSync(shouldReset = false) {
2435
+ shouldResetActiveCellClasses ||= shouldReset;
2436
+ const version$1 = ++activeCellClassSyncVersion;
2437
+ (0, vue.nextTick)(() => {
2438
+ if (version$1 === activeCellClassSyncVersion) syncActiveCellClasses();
2439
+ });
2440
+ }
2441
+ const sortEditorCandidates = (items) => [...items].sort((left, right) => {
2442
+ const fixedDelta = Number(Boolean(left.isFixedClone)) - Number(Boolean(right.isFixedClone));
2443
+ if (fixedDelta !== 0) return fixedDelta;
2444
+ return (right.priority ?? 0) - (left.priority ?? 0);
2445
+ });
2446
+ const findEditorsInCells = (cells) => sortEditorCandidates(editorRegistry.getEditorsInCells(cells));
2447
+ const findEditorForActiveCell = () => {
2448
+ const position = resolveActiveCellPosition();
2449
+ if (!position) return null;
2450
+ return findEditorsInCells(resolveBodyCellsByPosition(position.rowIndex, position.column.displayIndex))[0] ?? null;
2451
+ };
2452
+ const resolveNextActiveCell = (direction) => {
2453
+ const position = resolveActiveCellPosition();
2454
+ if (!position) return null;
2455
+ if (direction === "ArrowUp" || direction === "ArrowDown") {
2456
+ const nextRowIndex = position.rowIndex + (direction === "ArrowDown" ? 1 : -1);
2457
+ const nextRow = sourceData.value[nextRowIndex];
2458
+ const nextRowKey = nextRow ? readRowKey(nextRow) : null;
2459
+ if (nextRowIndex < 0 || !nextRow || nextRowKey === null) return null;
2460
+ return {
2461
+ rowKey: nextRowKey,
2462
+ columnKey: position.column.columnKey
2463
+ };
2464
+ }
2465
+ const currentColumnIndex = position.columns.findIndex((item) => item.columnKey === position.column.columnKey);
2466
+ if (currentColumnIndex < 0) return null;
2467
+ const nextColumnIndex = currentColumnIndex + (direction === "ArrowRight" ? 1 : -1);
2468
+ const nextColumn = position.columns[nextColumnIndex];
2469
+ if (!nextColumn) return null;
2470
+ const rowKey = readRowKey(position.row);
2471
+ if (rowKey === null) return null;
2472
+ return {
2473
+ rowKey,
2474
+ columnKey: nextColumn.columnKey
2475
+ };
2476
+ };
2477
+ const scrollActiveCellIntoView = () => {
2478
+ const position = resolveActiveCellPosition();
2479
+ if (!position) return;
2480
+ pickPrimaryCell(resolveBodyCellsByPosition(position.rowIndex, position.column.displayIndex))?.scrollIntoView({
2481
+ block: "nearest",
2482
+ inline: "nearest"
2483
+ });
2484
+ };
2485
+ const blurActiveEditor = async () => {
2486
+ const editor = findEditorForActiveCell();
2487
+ if (!editor) return;
2488
+ await Promise.resolve(editor.close?.());
2489
+ await Promise.resolve(editor.blur());
2490
+ isEditing.value = false;
2491
+ };
2492
+ const isActiveEditorPanelOpen = () => {
2493
+ const editor = findEditorForActiveCell();
2494
+ if (!editor?.isPanelOpen) return false;
2495
+ return Boolean(editor.isPanelOpen());
2496
+ };
2497
+ const resolveSelectionTogglePayload = (row, selectionBefore, selectionAfter, trigger) => ({
2498
+ row,
2499
+ rowIndex: sourceData.value.indexOf(row),
2500
+ selected: selectionAfter.includes(row),
2501
+ selectionBefore,
2502
+ selectionAfter,
2503
+ trigger
2504
+ });
2505
+ const handleRowClick = (row, column, event) => {
2506
+ if (props.selectionRowClick && hasSelectionColumn() && tableRef.value) {
2507
+ const selectionBefore = getSelectionRows();
2508
+ if (props.selectionSingle) {
2509
+ tableRef.value.clearSelection();
2510
+ tableRef.value.toggleRowSelection(row, true);
2511
+ } else {
2512
+ const nextSelected = !selectionBefore.includes(row);
2513
+ tableRef.value.toggleRowSelection(row, nextSelected);
2514
+ }
2515
+ emit("selection-row-toggle", resolveSelectionTogglePayload(row, selectionBefore, getSelectionRows(), "row-click"));
2516
+ }
2517
+ invokeListener(readAttr("onRowClick"), row, column, event);
2518
+ };
2519
+ const handleCellClick = (row, column, cell, event) => {
2520
+ const displayIndex = resolveCellDisplayIndex(cell);
2521
+ if (!isRowDragHandleHotzone(cell, event, displayIndex) && displayIndex !== null) {
2522
+ setActiveCell(row, column, displayIndex);
2523
+ syncEditingStateFromTarget(event.target);
2524
+ }
2525
+ invokeListener(readAttr("onCellClick", "onCell-click"), row, column, cell, event);
2526
+ };
2527
+ const handleSelect = (selection, row) => {
2528
+ if (props.selectionSingle && tableRef.value && selection.length > 1) {
2529
+ tableRef.value.clearSelection();
2530
+ tableRef.value.toggleRowSelection(row, true);
2531
+ const nextSelection = getSelectionRows();
2532
+ emit("selection-single-conflict", {
2533
+ reason: "multiple-selected",
2534
+ selection
2535
+ });
2536
+ emit("selection-row-toggle", resolveSelectionTogglePayload(row, selection, nextSelection, "selection-change"));
2537
+ invokeListener(readAttr("onSelect"), nextSelection, row);
2538
+ return;
2539
+ }
2540
+ invokeListener(readAttr("onSelect"), selection, row);
2541
+ };
2542
+ const handleSelectAll = (selection) => {
2543
+ if (props.selectionSingle && tableRef.value) {
2544
+ tableRef.value.clearSelection();
2545
+ emit("selection-single-conflict", {
2546
+ reason: "select-all-disabled",
2547
+ selection
2548
+ });
2549
+ invokeListener(readAttr("onSelectAll"), []);
2550
+ return;
2551
+ }
2552
+ invokeListener(readAttr("onSelectAll"), selection);
2553
+ };
2554
+ const resolveHeaderRowClassName = () => {
2555
+ const baseClass = ns.e("header-row");
2556
+ const userClassName = readAttr("headerRowClassName", "header-row-class-name");
2557
+ if (typeof userClassName === "function") return (...args) => mergeClass(userClassName(...args), baseClass);
2558
+ return mergeClass(userClassName, baseClass);
2559
+ };
2560
+ const resolveCellClassName = () => {
2561
+ const userCellClassName = readAttr("cellClassName", "cell-class-name");
2562
+ const resolveCrossClass = (scope) => {
2563
+ const focusCell = activeCellClassSnapshot;
2564
+ if (!focusCell) return null;
2565
+ const rowKey = readRowKey(scope.row);
2566
+ if (rowKey === null) return null;
2567
+ if (isControlColumn(scope.column)) return props.crossHighlight && rowKey === focusCell.rowKey ? ns.e("cross-control-cell") : null;
2568
+ const columnKey = resolveColumnKey$1(scope.column, scope.columnIndex);
2569
+ if (!columnKey) return null;
2570
+ const isActiveRow = rowKey === focusCell.rowKey;
2571
+ const isActiveColumn = columnKey === focusCell.columnKey;
2572
+ if (isActiveRow && isActiveColumn) return ns.e("cross-active");
2573
+ if (!props.crossHighlight) return null;
2574
+ if (isActiveRow) return ns.e("cross-row");
2575
+ if (isActiveColumn) return ns.e("cross-column");
2576
+ return null;
2577
+ };
2578
+ const resolveByScope = (scope) => mergeClass(typeof userCellClassName === "function" ? userCellClassName(scope) : userCellClassName, props.rowDraggable && scope.columnIndex === props.rowDragHandleColumnIndex && ns.e("row-drag-cell"), resolveCrossClass(scope));
2579
+ return (scope) => resolveByScope(scope);
2580
+ };
2581
+ const resolveHeaderCellClassName = () => {
2582
+ const userHeaderCellClassName = readAttr("headerCellClassName", "header-cell-class-name");
2583
+ const resolveByScope = (scope) => {
2584
+ const focusCell = activeCellClassSnapshot;
2585
+ const columnClass = props.crossHighlight && focusCell && !isControlColumn(scope.column) && resolveColumnKey$1(scope.column, scope.columnIndex) === focusCell.columnKey ? ns.e("cross-column") : null;
2586
+ return mergeClass(typeof userHeaderCellClassName === "function" ? userHeaderCellClassName(scope) : userHeaderCellClassName, columnClass);
2587
+ };
2588
+ return (scope) => resolveByScope(scope);
2589
+ };
2590
+ const syncVisibleColumnCount = (headerRow) => {
2591
+ visibleColumnCount.value = headerRow.querySelectorAll("th.el-table__cell").length;
2592
+ };
2593
+ const readStoreColumns = () => tableRef.value?.store?.states?.columns?.value;
2594
+ const readStoreData = () => tableRef.value?.store?.states?.data?.value;
2595
+ const columnStoreSignature = (0, vue.computed)(() => {
2596
+ const columns = readStoreColumns();
2597
+ if (!Array.isArray(columns)) return "";
2598
+ return columns.map((column, index$1) => {
2599
+ const current = column;
2600
+ return [
2601
+ index$1,
2602
+ String(current.columnKey ?? ""),
2603
+ String(current.type ?? ""),
2604
+ String(current.label ?? ""),
2605
+ String(current.property ?? "")
2606
+ ].join(":");
2607
+ }).join("|");
2608
+ });
2609
+ const readStoreColumnCount = () => {
2610
+ const columns = readStoreColumns();
2611
+ return Array.isArray(columns) ? columns.length : 0;
2612
+ };
2613
+ const resolveColumnCount = (headerRow, minimumCount = 0) => {
2614
+ const headerCount = headerRow?.querySelectorAll("th.el-table__cell").length ?? 0;
2615
+ return Math.max(minimumCount, columnOrder.value.length, readStoreColumnCount(), headerCount);
2616
+ };
2617
+ const destroyRowSortable = () => {
2618
+ rowSortable.value?.destroy();
2619
+ rowSortable.value = null;
2620
+ };
2621
+ const stopColumnResizeGestureReleaseTracking = () => {
2622
+ if (!columnResizePointerUpListener.value) return;
2623
+ document.removeEventListener("pointerup", columnResizePointerUpListener.value);
2624
+ document.removeEventListener("mouseup", columnResizePointerUpListener.value);
2625
+ document.removeEventListener("touchend", columnResizePointerUpListener.value);
2626
+ document.removeEventListener("touchcancel", columnResizePointerUpListener.value);
2627
+ document.removeEventListener("dragend", columnResizePointerUpListener.value);
2628
+ columnResizePointerUpListener.value = null;
2629
+ };
2630
+ const clearColumnResizeGesture = () => {
2631
+ stopColumnResizeGestureReleaseTracking();
2632
+ columnSortable.value?.option?.("disabled", false);
2633
+ isColumnResizeGesture.value = false;
2634
+ };
2635
+ const unbindColumnResizeGuard = () => {
2636
+ if (columnResizeGuardHeaderRow.value && columnResizePointerDownListener.value) {
2637
+ columnResizeGuardHeaderRow.value.removeEventListener("pointerdown", columnResizePointerDownListener.value, true);
2638
+ columnResizeGuardHeaderRow.value.removeEventListener("mousedown", columnResizePointerDownListener.value, true);
2639
+ columnResizeGuardHeaderRow.value.removeEventListener("touchstart", columnResizePointerDownListener.value, true);
2640
+ }
2641
+ columnResizeGuardHeaderRow.value = null;
2642
+ columnResizePointerDownListener.value = null;
2643
+ };
2644
+ const destroyColumnSortable = () => {
2645
+ clearColumnResizeGesture();
2646
+ unbindColumnResizeGuard();
2647
+ columnSortable.value?.destroy();
2648
+ columnSortable.value = null;
2649
+ if (columnDragPointerMoveListener.value) {
2650
+ document.removeEventListener("dragover", columnDragPointerMoveListener.value);
2651
+ document.removeEventListener("pointermove", columnDragPointerMoveListener.value);
2652
+ document.removeEventListener("mousemove", columnDragPointerMoveListener.value);
2653
+ document.removeEventListener("touchmove", columnDragPointerMoveListener.value);
2654
+ columnDragPointerMoveListener.value = null;
2655
+ }
2656
+ isColumnDragging.value = false;
2657
+ columnDragCount.value = null;
2658
+ draggingColumnOldDisplayIndex.value = null;
2659
+ pendingColumnDropDisplayIndex.value = null;
2660
+ columnDragIndicatorDisplayIndex.value = null;
2661
+ columnDragIndicatorSide.value = null;
2662
+ const tableElement = getTableElement();
2663
+ if (tableElement) {
2664
+ const leftClass = ns.e("column-drag-indicator-left");
2665
+ const rightClass = ns.e("column-drag-indicator-right");
2666
+ tableElement.querySelectorAll("th.el-table__cell, td.el-table__cell").forEach((cell) => {
2667
+ cell.classList.remove(leftClass, rightClass);
2668
+ });
2669
+ }
2670
+ };
2671
+ const unbindOutsidePointerDown = () => {
2672
+ if (!outsidePointerDownListener.value) return;
2673
+ document.removeEventListener("pointerdown", outsidePointerDownListener.value, true);
2674
+ document.removeEventListener("mousedown", outsidePointerDownListener.value, true);
2675
+ document.removeEventListener("touchstart", outsidePointerDownListener.value, true);
2676
+ outsidePointerDownListener.value = null;
2677
+ };
2678
+ const bindOutsidePointerDown = () => {
2679
+ unbindOutsidePointerDown();
2680
+ const listener = (event) => {
2681
+ if (!activeCell.value) return;
2682
+ const tableElement = getTableElement();
2683
+ const target = event.target;
2684
+ const isOverlayTarget = target instanceof Element && Boolean(target.closest(".el-select__popper, .el-picker__popper, .el-popper"));
2685
+ if (!tableElement || !(target instanceof Node) || tableElement.contains(target) || isEditing.value && isOverlayTarget) return;
2686
+ blurActiveEditor();
2687
+ isEditing.value = false;
2688
+ commitActiveCell(null);
2689
+ };
2690
+ outsidePointerDownListener.value = listener;
2691
+ document.addEventListener("pointerdown", listener, true);
2692
+ document.addEventListener("mousedown", listener, true);
2693
+ document.addEventListener("touchstart", listener, true);
2694
+ };
2695
+ const isDirectionKey = (value) => value === "ArrowUp" || value === "ArrowDown" || value === "ArrowLeft" || value === "ArrowRight";
2696
+ const isInputActivationKey = (event) => event.key.length === 1 || event.key === "Backspace" || event.key === "Delete" || event.key === "Enter" || event.key === "F2";
2697
+ const canHandleKeyEvent = (event) => {
2698
+ if (!activeCell.value || event.isComposing || event.ctrlKey || event.metaKey || event.altKey) return false;
2699
+ const tableElement = getTableElement();
2700
+ if (!tableElement) return false;
2701
+ if (isEditing.value) return true;
2702
+ const target = event.target;
2703
+ if (target instanceof Node && tableElement.contains(target)) return true;
2704
+ const activeElement = document.activeElement;
2705
+ return activeElement === null || activeElement === document.body || activeElement === document.documentElement || activeElement instanceof Node && tableElement.contains(activeElement);
2706
+ };
2707
+ const syncEditingStateFromTarget = (target) => {
2708
+ if (!activeCell.value) {
2709
+ isEditing.value = false;
2710
+ return;
2711
+ }
2712
+ const root = findEditorForActiveCell()?.getRootEl();
2713
+ if (root && target instanceof Node && root.contains(target)) {
2714
+ isEditing.value = true;
2715
+ return;
2716
+ }
2717
+ const tableElement = getTableElement();
2718
+ if (tableElement && target instanceof Node && tableElement.contains(target)) isEditing.value = false;
2719
+ };
2720
+ const unbindKeyboardListener = () => {
2721
+ if (!keyboardListener.value) return;
2722
+ document.removeEventListener("keydown", keyboardListener.value, true);
2723
+ keyboardListener.value = null;
2724
+ };
2725
+ const bindKeyboardListener = () => {
2726
+ unbindKeyboardListener();
2727
+ const listener = async (event) => {
2728
+ if (!canHandleKeyEvent(event)) return;
2729
+ if (isDirectionKey(event.key)) {
2730
+ if (isActiveEditorPanelOpen()) return;
2731
+ event.preventDefault();
2732
+ event.stopPropagation();
2733
+ const nextActive = resolveNextActiveCell(event.key);
2734
+ if (!nextActive) return;
2735
+ await blurActiveEditor();
2736
+ commitActiveCell(nextActive);
2737
+ await (0, vue.nextTick)();
2738
+ scrollActiveCellIntoView();
2739
+ return;
2740
+ }
2741
+ if (isActiveEditorPanelOpen()) return;
2742
+ if (!isInputActivationKey(event) || isEditing.value) return;
2743
+ const editor = findEditorForActiveCell();
2744
+ if (!editor) return;
2745
+ event.preventDefault();
2746
+ if (await editor.handoffFirstKey(event)) isEditing.value = true;
2747
+ };
2748
+ keyboardListener.value = listener;
2749
+ document.addEventListener("keydown", listener, true);
2750
+ };
2751
+ const unbindEditorFocusTracking = () => {
2752
+ if (!editorFocusInListener.value) return;
2753
+ document.removeEventListener("focusin", editorFocusInListener.value, true);
2754
+ editorFocusInListener.value = null;
2755
+ };
2756
+ const bindEditorFocusTracking = () => {
2757
+ unbindEditorFocusTracking();
2758
+ const listener = (event) => {
2759
+ syncEditingStateFromTarget(event.target);
2760
+ };
2761
+ editorFocusInListener.value = listener;
2762
+ document.addEventListener("focusin", listener, true);
2763
+ };
2764
+ const readClientPointFromEvent = (event) => {
2765
+ const pointEvent = event;
2766
+ if (typeof pointEvent.clientX === "number" && typeof pointEvent.clientY === "number") return {
2767
+ x: pointEvent.clientX,
2768
+ y: pointEvent.clientY
2769
+ };
2770
+ if (typeof MouseEvent !== "undefined" && event instanceof MouseEvent) return {
2771
+ x: event.clientX,
2772
+ y: event.clientY
2773
+ };
2774
+ if (typeof TouchEvent !== "undefined" && event instanceof TouchEvent) {
2775
+ const touch = event.touches[0] ?? event.changedTouches[0];
2776
+ return touch ? {
2777
+ x: touch.clientX,
2778
+ y: touch.clientY
2779
+ } : null;
2780
+ }
2781
+ return null;
2782
+ };
2783
+ const resolveHeaderCellFromEvent = (event) => {
2784
+ const target = event.target;
2785
+ if (!(target instanceof Element)) return null;
2786
+ const headerCell = target.closest("th.el-table__cell");
2787
+ return headerCell instanceof HTMLElement ? headerCell : null;
2788
+ };
2789
+ const isColumnResizeHotzone = (headerCell, clientX) => {
2790
+ const rect = headerCell.getBoundingClientRect();
2791
+ if (rect.width <= 0) return false;
2792
+ const hotzoneWidth = Math.min(COLUMN_RESIZE_HOTZONE_PX, rect.width / 2);
2793
+ return clientX - rect.left <= hotzoneWidth || rect.right - clientX <= hotzoneWidth;
2794
+ };
2795
+ const startColumnResizeGestureReleaseTracking = () => {
2796
+ stopColumnResizeGestureReleaseTracking();
2797
+ const listener = () => {
2798
+ clearColumnResizeGesture();
2799
+ };
2800
+ columnResizePointerUpListener.value = listener;
2801
+ document.addEventListener("pointerup", listener);
2802
+ document.addEventListener("mouseup", listener);
2803
+ document.addEventListener("touchend", listener);
2804
+ document.addEventListener("touchcancel", listener);
2805
+ document.addEventListener("dragend", listener);
2806
+ };
2807
+ const bindColumnResizeGuard = (headerRow) => {
2808
+ unbindColumnResizeGuard();
2809
+ const listener = (event) => {
2810
+ const point = readClientPointFromEvent(event);
2811
+ const headerCell = resolveHeaderCellFromEvent(event);
2812
+ if (!(point !== null && headerCell !== null && isColumnResizeHotzone(headerCell, point.x))) {
2813
+ if (!isColumnDragging.value && isColumnResizeGesture.value) clearColumnResizeGesture();
2814
+ return;
2815
+ }
2816
+ isColumnResizeGesture.value = true;
2817
+ updateColumnDragState(null);
2818
+ columnSortable.value?.option?.("disabled", true);
2819
+ startColumnResizeGestureReleaseTracking();
2820
+ };
2821
+ columnResizeGuardHeaderRow.value = headerRow;
2822
+ columnResizePointerDownListener.value = listener;
2823
+ headerRow.addEventListener("pointerdown", listener, true);
2824
+ headerRow.addEventListener("mousedown", listener, true);
2825
+ headerRow.addEventListener("touchstart", listener, true);
2826
+ };
2827
+ const updateColumnDragState = (state) => {
2828
+ const leftClass = ns.e("column-drag-indicator-left");
2829
+ const rightClass = ns.e("column-drag-indicator-right");
2830
+ const tableElement = getTableElement();
2831
+ if (tableElement) tableElement.querySelectorAll("th.el-table__cell, td.el-table__cell").forEach((cell) => {
2832
+ cell.classList.remove(leftClass, rightClass);
2833
+ });
2834
+ if (!state) {
2835
+ pendingColumnDropDisplayIndex.value = null;
2836
+ columnDragIndicatorDisplayIndex.value = null;
2837
+ columnDragIndicatorSide.value = null;
2838
+ return;
2839
+ }
2840
+ pendingColumnDropDisplayIndex.value = state.dropDisplayIndex;
2841
+ columnDragIndicatorDisplayIndex.value = state.targetDisplayIndex;
2842
+ columnDragIndicatorSide.value = state.side;
2843
+ if (!tableElement) return;
2844
+ const indicatorClass = state.side === "left" ? leftClass : rightClass;
2845
+ Array.from(tableElement.querySelectorAll(".el-table__header-wrapper th.el-table__cell"))[state.targetDisplayIndex]?.classList.add(indicatorClass);
2846
+ const bodyRows = Array.from(tableElement.querySelectorAll(".el-table__body-wrapper tbody tr"));
2847
+ for (const row of bodyRows) Array.from(row.querySelectorAll("td.el-table__cell"))[state.targetDisplayIndex]?.classList.add(indicatorClass);
2848
+ };
2849
+ const resolveColumnDropStateByClientPoint = (point, oldIndex$1) => {
2850
+ const headerRow = getTableElement()?.querySelector(".el-table__header-wrapper thead tr");
2851
+ if (!(headerRow instanceof HTMLElement)) return null;
2852
+ const headerRowRect = headerRow.getBoundingClientRect();
2853
+ if (point.x < headerRowRect.left || point.x > headerRowRect.right || point.y < headerRowRect.top || point.y > headerRowRect.bottom) return null;
2854
+ const cells = Array.from(headerRow.querySelectorAll("th.el-table__cell"));
2855
+ if (cells.length === 0) return null;
2856
+ let targetDisplayIndex = cells.length - 1;
2857
+ for (let index$1 = 0; index$1 < cells.length; index$1 += 1) {
2858
+ const rect = cells[index$1].getBoundingClientRect();
2859
+ if (point.x <= rect.right) {
2860
+ targetDisplayIndex = index$1;
2861
+ break;
2862
+ }
2863
+ }
2864
+ const targetCellRect = cells[targetDisplayIndex]?.getBoundingClientRect();
2865
+ if (!targetCellRect) return null;
2866
+ const targetCenterX = targetCellRect.left + targetCellRect.width / 2;
2867
+ const side = point.x < targetCenterX ? "left" : "right";
2868
+ let dropDisplayIndex = targetDisplayIndex + (side === "right" ? 1 : 0);
2869
+ if (oldIndex$1 !== null && dropDisplayIndex > oldIndex$1) dropDisplayIndex -= 1;
2870
+ const maxIndex = cells.length - 1;
2871
+ return {
2872
+ dropDisplayIndex: Math.min(Math.max(dropDisplayIndex, 0), maxIndex),
2873
+ targetDisplayIndex,
2874
+ side
2875
+ };
2876
+ };
2877
+ const startColumnDragPointerTracking = (oldIndex$1) => {
2878
+ if (columnDragPointerMoveListener.value) {
2879
+ document.removeEventListener("dragover", columnDragPointerMoveListener.value);
2880
+ document.removeEventListener("pointermove", columnDragPointerMoveListener.value);
2881
+ document.removeEventListener("mousemove", columnDragPointerMoveListener.value);
2882
+ document.removeEventListener("touchmove", columnDragPointerMoveListener.value);
2883
+ }
2884
+ const listener = (event) => {
2885
+ const point = readClientPointFromEvent(event);
2886
+ if (!point) return;
2887
+ updateColumnDragState(resolveColumnDropStateByClientPoint(point, oldIndex$1));
2888
+ };
2889
+ columnDragPointerMoveListener.value = listener;
2890
+ document.addEventListener("dragover", listener);
2891
+ document.addEventListener("pointermove", listener);
2892
+ document.addEventListener("mousemove", listener);
2893
+ document.addEventListener("touchmove", listener);
2894
+ };
2895
+ const initRowSortable = () => {
2896
+ destroyRowSortable();
2897
+ if (!props.rowDraggable) return;
2898
+ const body = getTableElement()?.querySelector(".el-table__body-wrapper tbody");
2899
+ if (!(body instanceof HTMLElement)) return;
2900
+ rowSortable.value = sortable_esm_default.create(body, {
2901
+ animation: 180,
2902
+ draggable: "tr",
2903
+ handle: `.${ns.e("row-drag-cell")}`,
2904
+ onStart: (event) => {
2905
+ const oldIndex$1 = toNullableIndex(event.oldIndex);
2906
+ emit("row-drag-start", {
2907
+ oldIndex: oldIndex$1,
2908
+ newIndex: null,
2909
+ row: oldIndex$1 === null ? null : sourceData.value[oldIndex$1] ?? null
2910
+ });
2911
+ },
2912
+ onEnd: (event) => {
2913
+ const oldIndex$1 = toNullableIndex(event.oldIndex);
2914
+ const newIndex$1 = toNullableIndex(event.newIndex);
2915
+ const row = oldIndex$1 === null ? null : sourceData.value[oldIndex$1] ?? null;
2916
+ emit("row-drag-end", {
2917
+ oldIndex: oldIndex$1,
2918
+ newIndex: newIndex$1,
2919
+ row
2920
+ });
2921
+ if (row && oldIndex$1 !== null && newIndex$1 !== null && oldIndex$1 !== newIndex$1) emit("row-order-change", {
2922
+ oldIndex: oldIndex$1,
2923
+ newIndex: newIndex$1,
2924
+ row,
2925
+ data: reorderRows(sourceData.value, oldIndex$1, newIndex$1)
2926
+ });
2927
+ }
2928
+ });
2929
+ };
2930
+ const initColumnSortable = () => {
2931
+ destroyColumnSortable();
2932
+ if (!props.columnDraggable) return;
2933
+ const headerRow = getTableElement()?.querySelector(".el-table__header-wrapper thead tr");
2934
+ if (!(headerRow instanceof HTMLElement)) return;
2935
+ syncVisibleColumnCount(headerRow);
2936
+ columnSortable.value = sortable_esm_default.create(headerRow, {
2937
+ animation: 180,
2938
+ draggable: "th.el-table__cell",
2939
+ sort: false,
2940
+ onStart: (event) => {
2941
+ if (isColumnResizeGesture.value) return;
2942
+ const oldIndex$1 = toNullableIndex(event.oldIndex);
2943
+ isColumnDragging.value = true;
2944
+ draggingColumnOldDisplayIndex.value = oldIndex$1;
2945
+ updateColumnDragState(null);
2946
+ startColumnDragPointerTracking(oldIndex$1);
2947
+ const count = resolveColumnCount(headerRow, (oldIndex$1 ?? -1) + 1);
2948
+ columnDragCount.value = count;
2949
+ const activeOrder = resolveColumnOrder(count);
2950
+ emit("column-drag-start", {
2951
+ oldIndex: oldIndex$1,
2952
+ newIndex: null,
2953
+ columnIndex: oldIndex$1 === null ? null : activeOrder[oldIndex$1] ?? oldIndex$1
2954
+ });
2955
+ },
2956
+ onEnd: (event) => {
2957
+ if (isColumnResizeGesture.value) {
2958
+ clearColumnResizeGesture();
2959
+ return;
2960
+ }
2961
+ if (columnDragPointerMoveListener.value) {
2962
+ document.removeEventListener("dragover", columnDragPointerMoveListener.value);
2963
+ document.removeEventListener("pointermove", columnDragPointerMoveListener.value);
2964
+ document.removeEventListener("mousemove", columnDragPointerMoveListener.value);
2965
+ document.removeEventListener("touchmove", columnDragPointerMoveListener.value);
2966
+ columnDragPointerMoveListener.value = null;
2967
+ }
2968
+ const oldIndex$1 = toNullableIndex(event.oldIndex) ?? draggingColumnOldDisplayIndex.value;
2969
+ const fallbackNewIndex = toNullableIndex(event.newIndex);
2970
+ const originalEvent = event.originalEvent;
2971
+ const point = originalEvent ? readClientPointFromEvent(originalEvent) : null;
2972
+ const newIndex$1 = (point === null ? null : resolveColumnDropStateByClientPoint(point, draggingColumnOldDisplayIndex.value))?.dropDisplayIndex ?? pendingColumnDropDisplayIndex.value ?? fallbackNewIndex;
2973
+ const maxDragIndex = Math.max(oldIndex$1 ?? -1, newIndex$1 ?? -1);
2974
+ const latestHeaderRow = getTableElement()?.querySelector(".el-table__header-wrapper thead tr");
2975
+ const activeOrder = resolveColumnOrder(Math.max(columnDragCount.value ?? 0, resolveColumnCount(latestHeaderRow instanceof HTMLElement ? latestHeaderRow : headerRow, maxDragIndex + 1)));
2976
+ emit("column-drag-end", {
2977
+ oldIndex: oldIndex$1,
2978
+ newIndex: newIndex$1,
2979
+ columnIndex: oldIndex$1 === null ? null : activeOrder[oldIndex$1] ?? oldIndex$1
2980
+ });
2981
+ if (oldIndex$1 !== null && newIndex$1 !== null && oldIndex$1 !== newIndex$1) {
2982
+ const nextOrder = reorderColumnOrder(activeOrder, oldIndex$1, newIndex$1);
2983
+ const movedColumnSourceIndex = activeOrder[oldIndex$1] ?? oldIndex$1;
2984
+ columnOrder.value = nextOrder;
2985
+ emit("column-order-change", {
2986
+ oldIndex: oldIndex$1,
2987
+ newIndex: newIndex$1,
2988
+ columnIndex: movedColumnSourceIndex,
2989
+ order: nextOrder
2990
+ });
2991
+ (0, vue.nextTick)(() => {
2992
+ const latestHeaderRow$1 = getTableElement()?.querySelector(".el-table__header-wrapper thead tr");
2993
+ if (latestHeaderRow$1 instanceof HTMLElement) syncVisibleColumnCount(latestHeaderRow$1);
2994
+ });
2995
+ }
2996
+ isColumnDragging.value = false;
2997
+ columnDragCount.value = null;
2998
+ draggingColumnOldDisplayIndex.value = null;
2999
+ updateColumnDragState(null);
3000
+ }
3001
+ });
3002
+ bindColumnResizeGuard(headerRow);
3003
+ };
3004
+ const refreshSortables = async () => {
3005
+ await (0, vue.nextTick)();
3006
+ initRowSortable();
3007
+ initColumnSortable();
3008
+ };
3009
+ const mergedTableAttrs = (0, vue.computed)(() => ({
3010
+ ...forwardedAttrs.value,
3011
+ class: [ns.b(), readAttr("class")],
3012
+ data: tableData.value,
3013
+ border: resolveBooleanAttr(true, "border"),
3014
+ stripe: resolveBooleanAttr(true, "stripe"),
3015
+ highlightCurrentRow: resolveBooleanAttr(true, "highlightCurrentRow", "highlight-current-row"),
3016
+ headerRowClassName: resolveHeaderRowClassName(),
3017
+ cellClassName: resolveCellClassName(),
3018
+ headerCellClassName: resolveHeaderCellClassName(),
3019
+ onCellClick: handleCellClick,
3020
+ onRowClick: handleRowClick,
3021
+ onSelect: handleSelect,
3022
+ onSelectAll: handleSelectAll
3023
+ }));
3024
+ (0, vue.watch)(columnStoreSignature, (next, prev) => {
3025
+ if (prev !== void 0 && next !== prev) {
3026
+ editorRegistry.invalidate();
3027
+ blurActiveEditor();
3028
+ isEditing.value = false;
3029
+ commitActiveCell(null);
3030
+ scheduleActiveCellClassSync(true);
3031
+ }
3032
+ });
3033
+ (0, vue.watch)(() => [sourceData.value.length, props.rowKeyField], () => {
3034
+ editorRegistry.invalidate();
3035
+ if (!activeCell.value) {
3036
+ scheduleActiveCellClassSync(true);
3037
+ return;
3038
+ }
3039
+ if (!sourceData.value.some((row) => readRowKey(row) === activeCell.value?.rowKey)) {
3040
+ blurActiveEditor();
3041
+ isEditing.value = false;
3042
+ commitActiveCell(null);
3043
+ }
3044
+ scheduleActiveCellClassSync(true);
3045
+ });
3046
+ (0, vue.watch)(sourceData, () => {
3047
+ editorRegistry.invalidate();
3048
+ scheduleActiveCellClassSync(true);
3049
+ }, { flush: "post" });
3050
+ (0, vue.watch)(() => props.crossHighlight, () => {
3051
+ scheduleActiveCellClassSync();
3052
+ }, { flush: "post" });
3053
+ (0, vue.watch)(activeCell, (nextActiveCell) => {
3054
+ if (!nextActiveCell) isEditing.value = false;
3055
+ });
3056
+ (0, vue.onMounted)(() => {
3057
+ bindEditorRegistryHost();
3058
+ bindOutsidePointerDown();
3059
+ bindKeyboardListener();
3060
+ bindEditorFocusTracking();
3061
+ scheduleActiveCellClassSync(true);
3062
+ refreshSortables();
3063
+ });
3064
+ (0, vue.watch)(() => [
3065
+ props.rowDraggable,
3066
+ props.columnDraggable,
3067
+ props.rowDragHandleColumnIndex,
3068
+ sourceData.value.length
3069
+ ], () => {
3070
+ refreshSortables();
3071
+ }, { flush: "post" });
3072
+ (0, vue.onBeforeUnmount)(() => {
3073
+ clearActiveCellClasses();
3074
+ unbindEditorRegistryHost();
3075
+ unbindOutsidePointerDown();
3076
+ unbindKeyboardListener();
3077
+ unbindEditorFocusTracking();
3078
+ destroyRowSortable();
3079
+ destroyColumnSortable();
3080
+ });
3081
+ __expose({});
3082
+ return (_ctx, _cache) => {
3083
+ return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.h)((0, vue.unref)(element_plus.ElTable), {
3084
+ ...mergedTableAttrs.value,
3085
+ ref: setTableRef
3086
+ }, tableSlots.value)));
3087
+ };
3088
+ }
3089
+ });
3090
+ var table_default$1 = table_vue_vue_type_script_setup_true_lang_default;
3091
+ const tableEditorProps = {
3092
+ mode: {
3093
+ type: String,
3094
+ required: true
3095
+ },
3096
+ targetRef: {
3097
+ type: Object,
3098
+ default: void 0
3099
+ },
3100
+ priority: {
3101
+ type: Number,
3102
+ default: 0
3103
+ }
3104
+ };
3105
+ var table_editor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
3106
+ name: "FlTableEditor",
3107
+ __name: "table-editor",
3108
+ props: tableEditorProps,
3109
+ setup(__props) {
3110
+ const props = __props;
3111
+ const hostRef = (0, vue.ref)(null);
3112
+ const isTextInput = (element) => {
3113
+ if (!element) return false;
3114
+ if (!(element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement)) return false;
3115
+ return element.type !== "hidden" && !element.readOnly && !element.disabled;
3116
+ };
3117
+ const resolveTargetValue = () => props.targetRef?.value ?? null;
3118
+ const resolveRootFromTarget = (target) => {
3119
+ if (target instanceof HTMLElement) return target;
3120
+ const componentTarget = target;
3121
+ if (componentTarget?.$el instanceof HTMLElement) return componentTarget.$el;
3122
+ return null;
3123
+ };
3124
+ const resolveRootEl = () => resolveRootFromTarget(resolveTargetValue()) ?? hostRef.value;
3125
+ const resolveTextInputFromRoot = (root) => {
3126
+ if (!root) return null;
3127
+ if (isTextInput(root)) return root;
3128
+ return root.querySelector("input:not([type=\"hidden\"]):not([readonly]):not([disabled]), textarea:not([readonly]):not([disabled])");
3129
+ };
3130
+ const resolveFocusableTarget = (root) => {
3131
+ if (!root) return null;
3132
+ if (root.tabIndex >= 0) return root;
3133
+ return root.querySelector([
3134
+ "[role=\"combobox\"]",
3135
+ ".el-select__wrapper",
3136
+ ".el-date-editor .el-input__wrapper",
3137
+ ".el-date-editor input",
3138
+ "input:not([type=\"hidden\"])",
3139
+ "textarea",
3140
+ "button",
3141
+ "[tabindex]:not([tabindex=\"-1\"])"
3142
+ ].join(","));
3143
+ };
3144
+ const getInstanceMethod = (name) => {
3145
+ const target = resolveTargetValue();
3146
+ if (!target || target instanceof HTMLElement) return null;
3147
+ const candidate = target[name];
3148
+ return typeof candidate === "function" ? candidate : null;
3149
+ };
3150
+ const getInstanceBoolean = (name) => {
3151
+ const target = resolveTargetValue();
3152
+ if (!target || target instanceof HTMLElement) return null;
3153
+ const candidate = target[name];
3154
+ if (typeof candidate === "boolean") return candidate;
3155
+ if (typeof candidate === "object" && candidate !== null && "value" in candidate && typeof candidate.value === "boolean") return candidate.value;
3156
+ return null;
3157
+ };
3158
+ const hasExpandedTrigger = (root) => {
3159
+ if (!root) return false;
3160
+ if (root.getAttribute("aria-expanded") === "true") return true;
3161
+ return root.querySelector("[aria-expanded=\"true\"], .el-date-editor.is-focus, .el-range-editor.is-active") !== null;
3162
+ };
3163
+ const cloneKeyboardEventInit = (event) => ({
3164
+ key: event.key,
3165
+ code: event.code,
3166
+ location: event.location,
3167
+ repeat: event.repeat,
3168
+ ctrlKey: event.ctrlKey,
3169
+ shiftKey: event.shiftKey,
3170
+ altKey: event.altKey,
3171
+ metaKey: event.metaKey,
3172
+ bubbles: true,
3173
+ cancelable: true,
3174
+ composed: true
3175
+ });
3176
+ const dispatchKeyboardEvent = (target, event) => target.dispatchEvent(new KeyboardEvent("keydown", cloneKeyboardEventInit(event)));
3177
+ const waitForNextMacroTask = () => new Promise((resolve) => {
3178
+ window.setTimeout(resolve, 0);
3179
+ });
3180
+ const dispatchInputEvents = (target, inputType, data) => {
3181
+ target.dispatchEvent(new InputEvent("input", {
3182
+ bubbles: true,
3183
+ data,
3184
+ inputType
3185
+ }));
3186
+ target.dispatchEvent(new Event("input", { bubbles: true }));
3187
+ };
3188
+ const insertText = (target, text) => {
3189
+ const start = target.selectionStart ?? target.value.length;
3190
+ const end = target.selectionEnd ?? target.value.length;
3191
+ target.setRangeText(text, start, end, "end");
3192
+ dispatchInputEvents(target, "insertText", text);
3193
+ };
3194
+ const deleteText = (target, direction) => {
3195
+ const start = target.selectionStart ?? target.value.length;
3196
+ const end = target.selectionEnd ?? target.value.length;
3197
+ if (start !== end) target.setRangeText("", start, end, "start");
3198
+ else if (direction === "backward" && start > 0) target.setRangeText("", start - 1, start, "start");
3199
+ else if (direction === "forward" && end < target.value.length) target.setRangeText("", start, start + 1, "start");
3200
+ dispatchInputEvents(target, direction === "backward" ? "deleteContentBackward" : "deleteContentForward", null);
3201
+ };
3202
+ const focusTextTarget = () => {
3203
+ const input = resolveTextInputFromRoot(resolveRootEl());
3204
+ input?.focus();
3205
+ return input;
3206
+ };
3207
+ const focusControlledTarget = async () => {
3208
+ const instanceFocus = getInstanceMethod("focus");
3209
+ if (instanceFocus) await Promise.resolve(instanceFocus());
3210
+ const focusTarget = resolveFocusableTarget(resolveRootEl());
3211
+ focusTarget?.focus();
3212
+ return focusTarget;
3213
+ };
3214
+ const focusEditor = async () => {
3215
+ if (props.mode === "text") {
3216
+ focusTextTarget();
3217
+ return;
3218
+ }
3219
+ await focusControlledTarget();
3220
+ };
3221
+ const blurEditor = async () => {
3222
+ const activeElement = document.activeElement;
3223
+ const root = resolveRootEl();
3224
+ if (activeElement instanceof HTMLElement && root?.contains(activeElement)) activeElement.blur();
3225
+ const instanceBlur = getInstanceMethod("blur");
3226
+ if (instanceBlur) await Promise.resolve(instanceBlur());
3227
+ };
3228
+ const openEditor = async () => {
3229
+ const handleOpen = getInstanceMethod("handleOpen");
3230
+ if (handleOpen) {
3231
+ await Promise.resolve(handleOpen());
3232
+ return;
3233
+ }
3234
+ const focusTarget = resolveFocusableTarget(resolveRootEl());
3235
+ if (!focusTarget) return;
3236
+ focusTarget.dispatchEvent(new MouseEvent("mousedown", {
3237
+ bubbles: true,
3238
+ cancelable: true
3239
+ }));
3240
+ focusTarget.click();
3241
+ };
3242
+ const closeEditor = async () => {
3243
+ const handleClose = getInstanceMethod("handleClose");
3244
+ if (handleClose) {
3245
+ await Promise.resolve(handleClose());
3246
+ return;
3247
+ }
3248
+ const focusTarget = resolveFocusableTarget(resolveRootEl());
3249
+ if (focusTarget) focusTarget.dispatchEvent(new KeyboardEvent("keydown", {
3250
+ key: "Escape",
3251
+ code: "Escape",
3252
+ bubbles: true,
3253
+ cancelable: true
3254
+ }));
3255
+ };
3256
+ const isPanelOpen = () => {
3257
+ const getPanelState = getInstanceMethod("isPanelOpen");
3258
+ if (getPanelState) return Boolean(getPanelState());
3259
+ for (const key of [
3260
+ "expanded",
3261
+ "pickerVisible",
3262
+ "dropdownMenuVisible",
3263
+ "visible"
3264
+ ]) {
3265
+ const state = getInstanceBoolean(key);
3266
+ if (state !== null) return state;
3267
+ }
3268
+ return hasExpandedTrigger(resolveRootEl());
3269
+ };
3270
+ const handoffTextKey = async (event) => {
3271
+ const input = focusTextTarget();
3272
+ if (!input) return false;
3273
+ dispatchKeyboardEvent(input, event);
3274
+ if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
3275
+ insertText(input, event.key);
3276
+ return true;
3277
+ }
3278
+ if (event.key === "Backspace") {
3279
+ deleteText(input, "backward");
3280
+ return true;
3281
+ }
3282
+ if (event.key === "Delete") {
3283
+ deleteText(input, "forward");
3284
+ return true;
3285
+ }
3286
+ if (event.key === "Enter" || event.key === "F2") return true;
3287
+ return false;
3288
+ };
3289
+ const handoffControlledKey = async (event) => {
3290
+ const focusTarget = await focusControlledTarget();
3291
+ await openEditor();
3292
+ await (0, vue.nextTick)();
3293
+ await waitForNextMacroTask();
3294
+ if (resolveTextInputFromRoot(resolveRootEl())) return handoffTextKey(event);
3295
+ const target = document.activeElement ?? focusTarget;
3296
+ if (!target) return false;
3297
+ dispatchKeyboardEvent(target, event);
3298
+ return true;
3299
+ };
3300
+ const endpoint = {
3301
+ id: Symbol("table-editor"),
3302
+ getRootEl: () => resolveRootEl(),
3303
+ focus: () => focusEditor(),
3304
+ blur: () => blurEditor(),
3305
+ handoffFirstKey: (event) => props.mode === "text" ? handoffTextKey(event) : handoffControlledKey(event),
3306
+ isPanelOpen: () => props.mode === "controlled" ? isPanelOpen() : false,
3307
+ open: () => openEditor(),
3308
+ close: () => closeEditor(),
3309
+ get isFixedClone() {
3310
+ return Boolean(resolveRootEl()?.closest(".el-table__fixed, .el-table__fixed-right"));
3311
+ },
3312
+ priority: props.priority
3313
+ };
3314
+ let unregister = null;
3315
+ const resolveRegistry = async () => {
3316
+ for (let attempt = 0; attempt < 2; attempt += 1) {
3317
+ const tableRoot = resolveRootEl()?.closest(".fl-table");
3318
+ if (tableRoot?.[tableEditorRegistryDomKey]) return tableRoot[tableEditorRegistryDomKey] ?? null;
3319
+ await (0, vue.nextTick)();
3320
+ }
3321
+ return null;
3322
+ };
3323
+ (0, vue.onMounted)(() => {
3324
+ (async () => {
3325
+ const registry = await resolveRegistry();
3326
+ if (!registry) return;
3327
+ unregister = registry.register(endpoint);
3328
+ })();
3329
+ });
3330
+ (0, vue.onBeforeUnmount)(() => {
3331
+ unregister?.();
3332
+ unregister = null;
3333
+ });
3334
+ return (_ctx, _cache) => {
3335
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
3336
+ ref_key: "hostRef",
3337
+ ref: hostRef,
3338
+ style: { "display": "contents" }
3339
+ }, [(0, vue.renderSlot)(_ctx.$slots, "default")], 512);
3340
+ };
3341
+ }
3342
+ });
3343
+ var table_editor_default = table_editor_vue_vue_type_script_setup_true_lang_default;
3344
+ const FlTable = withInstall(table_default$1);
3345
+ const FlTableEditor = withInstall(table_editor_default);
3346
+ var table_default = FlTable;
3347
+ exports.FlTable = FlTable;
3348
+ exports.FlTableEditor = FlTableEditor;
3349
+ exports.default = table_default;
3350
+
3351
+ //# sourceMappingURL=index.cjs.map