@limetech/lime-elements 40.12.3 → 40.13.1

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 (352) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/drag-to-reorder-BP5YkPuu.js +3092 -0
  3. package/dist/cjs/lime-elements.cjs.js +1 -1
  4. package/dist/cjs/limel-3d-hover-effect-glow.cjs.entry.js +1 -1
  5. package/dist/cjs/limel-action-bar_3.cjs.entry.js +4 -4
  6. package/dist/cjs/limel-ai-avatar.cjs.entry.js +2 -2
  7. package/dist/cjs/limel-badge.cjs.entry.js +2 -2
  8. package/dist/cjs/limel-banner.cjs.entry.js +1 -1
  9. package/dist/cjs/limel-breadcrumbs_6.cjs.entry.js +6 -6
  10. package/dist/cjs/limel-button-group.cjs.entry.js +1 -1
  11. package/dist/cjs/limel-button.cjs.entry.js +2 -2
  12. package/dist/cjs/limel-callout.cjs.entry.js +2 -2
  13. package/dist/cjs/limel-card.cjs.entry.js +1 -1
  14. package/dist/cjs/limel-chart.cjs.entry.js +1 -1
  15. package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
  16. package/dist/cjs/limel-chip-set.cjs.entry.js +2 -2
  17. package/dist/cjs/limel-chip_2.cjs.entry.js +2 -2
  18. package/dist/cjs/limel-circular-progress.cjs.entry.js +1 -1
  19. package/dist/cjs/limel-code-diff.cjs.entry.js +2 -2
  20. package/dist/cjs/limel-code-editor.cjs.entry.js +2 -2
  21. package/dist/cjs/limel-collapsible-section.cjs.entry.js +2 -2
  22. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +2 -2
  23. package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
  24. package/dist/cjs/limel-dialog.cjs.entry.js +2 -2
  25. package/dist/cjs/limel-dock.cjs.entry.js +3 -3
  26. package/dist/cjs/{limel-scroller.cjs.entry.js → limel-drag-handle_2.cjs.entry.js} +40 -2
  27. package/dist/cjs/limel-email-viewer.cjs.entry.js +2 -2
  28. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +2 -2
  29. package/dist/cjs/limel-file-viewer.cjs.entry.js +65 -56
  30. package/dist/cjs/limel-file.cjs.entry.js +2 -2
  31. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +2 -2
  32. package/dist/cjs/limel-flex-container.cjs.entry.js +1 -1
  33. package/dist/cjs/limel-form.cjs.entry.js +539 -3171
  34. package/dist/cjs/limel-grid.cjs.entry.js +1 -1
  35. package/dist/cjs/limel-header.cjs.entry.js +1 -1
  36. package/dist/cjs/limel-help-content.cjs.entry.js +1 -1
  37. package/dist/cjs/limel-help.cjs.entry.js +2 -2
  38. package/dist/cjs/limel-helper-line_3.cjs.entry.js +4 -4
  39. package/dist/cjs/limel-hotkey_4.cjs.entry.js +5 -5
  40. package/dist/cjs/limel-icon-button.cjs.entry.js +1 -1
  41. package/dist/cjs/limel-icon.cjs.entry.js +1 -1
  42. package/dist/cjs/limel-info-tile.cjs.entry.js +2 -2
  43. package/dist/cjs/limel-list-item.cjs.entry.js +3 -3
  44. package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
  45. package/dist/cjs/limel-masonry-layout.cjs.entry.js +1 -1
  46. package/dist/cjs/limel-menu-item-meta.cjs.entry.js +1 -1
  47. package/dist/cjs/limel-pagination-jump.cjs.entry.js +1 -1
  48. package/dist/cjs/limel-pagination.cjs.entry.js +2 -2
  49. package/dist/cjs/limel-picker.cjs.entry.js +2 -2
  50. package/dist/cjs/limel-popover_2.cjs.entry.js +2 -2
  51. package/dist/cjs/limel-profile-picture.cjs.entry.js +1 -1
  52. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +2 -2
  53. package/dist/cjs/limel-radio-button-group.cjs.entry.js +1 -1
  54. package/dist/cjs/limel-radio-button.cjs.entry.js +2 -2
  55. package/dist/cjs/limel-resize-handle.cjs.entry.js +43 -2
  56. package/dist/cjs/limel-select.cjs.entry.js +1 -1
  57. package/dist/cjs/limel-shortcut.cjs.entry.js +1 -1
  58. package/dist/cjs/limel-side-panel.cjs.entry.js +16 -6
  59. package/dist/cjs/limel-slider.cjs.entry.js +4 -4
  60. package/dist/cjs/limel-snackbar.cjs.entry.js +3 -3
  61. package/dist/cjs/limel-split-button.cjs.entry.js +2 -2
  62. package/dist/cjs/limel-switch.cjs.entry.js +1 -1
  63. package/dist/cjs/limel-tab-bar.cjs.entry.js +120 -16
  64. package/dist/cjs/limel-tab-panel.cjs.entry.js +7 -1
  65. package/dist/cjs/limel-table.cjs.entry.js +3 -3
  66. package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +4 -4
  67. package/dist/cjs/limel-text-editor.cjs.entry.js +1 -1
  68. package/dist/cjs/loader.cjs.js +1 -1
  69. package/dist/cjs/{translations-DDyw5Zzz.js → translations-CLSqfR3x.js} +56 -0
  70. package/dist/collection/components/3d-hover-effect-glow/3d-hover-effect-glow.js +1 -1
  71. package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js +1 -1
  72. package/dist/collection/components/action-bar/action-bar.js +2 -2
  73. package/dist/collection/components/ai-avatar/ai-avatar.js +1 -1
  74. package/dist/collection/components/badge/badge.js +2 -2
  75. package/dist/collection/components/banner/banner.js +1 -1
  76. package/dist/collection/components/breadcrumbs/breadcrumbs.js +1 -1
  77. package/dist/collection/components/button/button.js +2 -2
  78. package/dist/collection/components/button-group/button-group.js +1 -1
  79. package/dist/collection/components/callout/callout.js +1 -1
  80. package/dist/collection/components/card/card.js +1 -1
  81. package/dist/collection/components/checkbox/checkbox.js +1 -1
  82. package/dist/collection/components/chip/chip.js +1 -1
  83. package/dist/collection/components/chip-set/chip-set.js +1 -1
  84. package/dist/collection/components/circular-progress/circular-progress.js +1 -1
  85. package/dist/collection/components/code-diff/code-diff.js +1 -1
  86. package/dist/collection/components/code-editor/code-editor.js +1 -1
  87. package/dist/collection/components/collapsible-section/collapsible-section.js +1 -1
  88. package/dist/collection/components/color-picker/color-picker-palette.js +2 -2
  89. package/dist/collection/components/color-picker/color-picker.js +1 -1
  90. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +1 -1
  91. package/dist/collection/components/dialog/dialog.js +2 -2
  92. package/dist/collection/components/dock/dock.js +2 -2
  93. package/dist/collection/components/drag-handle/drag-handle.js +1 -1
  94. package/dist/collection/components/email-viewer/email-viewer.js +1 -1
  95. package/dist/collection/components/file/file.js +1 -1
  96. package/dist/collection/components/file-dropzone/file-dropzone.js +1 -1
  97. package/dist/collection/components/file-input/file-input.js +1 -1
  98. package/dist/collection/components/flex-container/flex-container.js +1 -1
  99. package/dist/collection/components/form/form.css +59 -0
  100. package/dist/collection/components/form/form.js +49 -2
  101. package/dist/collection/components/form/show-field.js +116 -0
  102. package/dist/collection/components/form/templates/array-field-collapsible-item.js +1 -0
  103. package/dist/collection/components/form/templates/array-field-item.js +5 -0
  104. package/dist/collection/components/form/templates/array-field.js +20 -158
  105. package/dist/collection/components/form/templates/field.js +17 -0
  106. package/dist/collection/components/grid/grid.js +1 -1
  107. package/dist/collection/components/header/header.js +1 -1
  108. package/dist/collection/components/help/help-content.js +1 -1
  109. package/dist/collection/components/help/help.js +2 -2
  110. package/dist/collection/components/helper-line/helper-line.js +2 -2
  111. package/dist/collection/components/hotkey/hotkey.js +1 -1
  112. package/dist/collection/components/icon/icon.js +1 -1
  113. package/dist/collection/components/icon-button/icon-button.js +1 -1
  114. package/dist/collection/components/info-tile/info-tile.js +2 -2
  115. package/dist/collection/components/input-field/input-field.js +1 -1
  116. package/dist/collection/components/list/list.js +1 -1
  117. package/dist/collection/components/list-item/list-item.js +2 -2
  118. package/dist/collection/components/list-item/menu-item-meta/menu-item-meta.js +1 -1
  119. package/dist/collection/components/markdown/markdown.js +1 -1
  120. package/dist/collection/components/masonry-layout/masonry-layout.js +1 -1
  121. package/dist/collection/components/menu/menu.js +1 -1
  122. package/dist/collection/components/menu-list/menu-list.js +1 -1
  123. package/dist/collection/components/menu-surface/menu-surface.js +1 -1
  124. package/dist/collection/components/notched-outline/notched-outline.js +1 -1
  125. package/dist/collection/components/pagination/pagination.js +1 -1
  126. package/dist/collection/components/picker/picker.js +1 -1
  127. package/dist/collection/components/popover/popover.js +1 -1
  128. package/dist/collection/components/popover-surface/popover-surface.js +1 -1
  129. package/dist/collection/components/portal/portal.js +1 -1
  130. package/dist/collection/components/radio-button-group/radio-button-group.js +1 -1
  131. package/dist/collection/components/radio-button-group/radio-button.js +2 -2
  132. package/dist/collection/components/resize-handle/resize-handle.css +35 -33
  133. package/dist/collection/components/resize-handle/resize-handle.js +86 -4
  134. package/dist/collection/components/scroller/scroller.js +2 -2
  135. package/dist/collection/components/select/select.js +1 -1
  136. package/dist/collection/components/shortcut/shortcut.js +1 -1
  137. package/dist/collection/components/side-panel/side-panel.js +44 -27
  138. package/dist/collection/components/slider/slider.js +3 -3
  139. package/dist/collection/components/snackbar/snackbar.js +2 -2
  140. package/dist/collection/components/spinner/spinner.js +1 -1
  141. package/dist/collection/components/split-button/split-button.js +2 -2
  142. package/dist/collection/components/switch/switch.js +1 -1
  143. package/dist/collection/components/tab-bar/tab-bar.css +68 -22
  144. package/dist/collection/components/tab-bar/tab-bar.js +131 -4
  145. package/dist/collection/components/tab-bar/tabs.js +23 -0
  146. package/dist/collection/components/tab-panel/tab-panel.js +54 -1
  147. package/dist/collection/components/table/table.js +2 -2
  148. package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +3 -3
  149. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +1 -1
  150. package/dist/collection/components/text-editor/text-editor.js +1 -1
  151. package/dist/collection/components/tooltip/tooltip-content.js +1 -1
  152. package/dist/collection/components/tooltip/tooltip.js +2 -2
  153. package/dist/collection/translations/da.js +7 -0
  154. package/dist/collection/translations/de.js +7 -0
  155. package/dist/collection/translations/en.js +7 -0
  156. package/dist/collection/translations/fi.js +7 -0
  157. package/dist/collection/translations/fr.js +7 -0
  158. package/dist/collection/translations/nl.js +7 -0
  159. package/dist/collection/translations/no.js +7 -0
  160. package/dist/collection/translations/sv.js +7 -0
  161. package/dist/collection/util/drag-to-reorder.js +116 -0
  162. package/dist/esm/{_baseForOwn-D5j7fHlv.js → _baseForOwn-vKFWmmaS.js} +1 -1
  163. package/dist/esm/{_baseIsEqual-CyF4P8uM.js → _baseIsEqual-B_JRErB0.js} +1 -1
  164. package/dist/esm/{_baseIteratee-CpbczHY1.js → _baseIteratee-CVz7aes3.js} +1 -1
  165. package/dist/esm/{_baseSet-Cw2IE6ZF.js → _baseSet-BUAq8NGm.js} +1 -1
  166. package/dist/esm/{cloneDeep-DAbOtbs8.js → cloneDeep-Bcll-3f8.js} +1 -1
  167. package/dist/esm/drag-to-reorder-BXmXIwCa.js +3086 -0
  168. package/dist/esm/{isEqual-CE83yS8T.js → isEqual-C-pK6AAU.js} +1 -1
  169. package/dist/esm/lime-elements.js +1 -1
  170. package/dist/esm/limel-3d-hover-effect-glow.entry.js +1 -1
  171. package/dist/esm/limel-action-bar_3.entry.js +4 -4
  172. package/dist/esm/limel-ai-avatar.entry.js +2 -2
  173. package/dist/esm/limel-badge.entry.js +2 -2
  174. package/dist/esm/limel-banner.entry.js +1 -1
  175. package/dist/esm/limel-breadcrumbs_6.entry.js +6 -6
  176. package/dist/esm/limel-button-group.entry.js +1 -1
  177. package/dist/esm/limel-button.entry.js +2 -2
  178. package/dist/esm/limel-callout.entry.js +2 -2
  179. package/dist/esm/limel-card.entry.js +1 -1
  180. package/dist/esm/limel-chart.entry.js +1 -1
  181. package/dist/esm/limel-checkbox.entry.js +1 -1
  182. package/dist/esm/limel-chip-set.entry.js +4 -4
  183. package/dist/esm/limel-chip_2.entry.js +2 -2
  184. package/dist/esm/limel-circular-progress.entry.js +1 -1
  185. package/dist/esm/limel-code-diff.entry.js +2 -2
  186. package/dist/esm/limel-code-editor.entry.js +2 -2
  187. package/dist/esm/limel-collapsible-section.entry.js +2 -2
  188. package/dist/esm/limel-color-picker-palette.entry.js +2 -2
  189. package/dist/esm/limel-color-picker.entry.js +1 -1
  190. package/dist/esm/limel-dialog.entry.js +4 -4
  191. package/dist/esm/limel-dock.entry.js +3 -3
  192. package/dist/esm/{limel-scroller.entry.js → limel-drag-handle_2.entry.js} +40 -3
  193. package/dist/esm/limel-email-viewer.entry.js +2 -2
  194. package/dist/esm/limel-file-dropzone_2.entry.js +5 -5
  195. package/dist/esm/limel-file-viewer.entry.js +65 -56
  196. package/dist/esm/limel-file.entry.js +2 -2
  197. package/dist/esm/limel-flatpickr-adapter.entry.js +2 -2
  198. package/dist/esm/limel-flex-container.entry.js +1 -1
  199. package/dist/esm/limel-form.entry.js +536 -3168
  200. package/dist/esm/limel-grid.entry.js +1 -1
  201. package/dist/esm/limel-header.entry.js +1 -1
  202. package/dist/esm/limel-help-content.entry.js +1 -1
  203. package/dist/esm/limel-help.entry.js +2 -2
  204. package/dist/esm/limel-helper-line_3.entry.js +4 -4
  205. package/dist/esm/limel-hotkey_4.entry.js +5 -5
  206. package/dist/esm/limel-icon-button.entry.js +1 -1
  207. package/dist/esm/limel-icon.entry.js +1 -1
  208. package/dist/esm/limel-info-tile.entry.js +2 -2
  209. package/dist/esm/limel-list-item.entry.js +3 -3
  210. package/dist/esm/limel-markdown.entry.js +1 -1
  211. package/dist/esm/limel-masonry-layout.entry.js +1 -1
  212. package/dist/esm/limel-menu-item-meta.entry.js +1 -1
  213. package/dist/esm/limel-pagination-jump.entry.js +1 -1
  214. package/dist/esm/limel-pagination.entry.js +2 -2
  215. package/dist/esm/limel-picker.entry.js +2 -2
  216. package/dist/esm/limel-popover_2.entry.js +2 -2
  217. package/dist/esm/limel-profile-picture.entry.js +1 -1
  218. package/dist/esm/limel-prosemirror-adapter.entry.js +5 -5
  219. package/dist/esm/limel-radio-button-group.entry.js +1 -1
  220. package/dist/esm/limel-radio-button.entry.js +2 -2
  221. package/dist/esm/limel-resize-handle.entry.js +43 -2
  222. package/dist/esm/limel-select.entry.js +1 -1
  223. package/dist/esm/limel-shortcut.entry.js +1 -1
  224. package/dist/esm/limel-side-panel.entry.js +16 -6
  225. package/dist/esm/limel-slider.entry.js +4 -4
  226. package/dist/esm/limel-snackbar.entry.js +3 -3
  227. package/dist/esm/limel-split-button.entry.js +2 -2
  228. package/dist/esm/limel-switch.entry.js +1 -1
  229. package/dist/esm/limel-tab-bar.entry.js +117 -13
  230. package/dist/esm/limel-tab-panel.entry.js +7 -1
  231. package/dist/esm/limel-table.entry.js +7 -7
  232. package/dist/esm/limel-text-editor-link-menu.entry.js +4 -4
  233. package/dist/esm/limel-text-editor.entry.js +1 -1
  234. package/dist/esm/loader.js +1 -1
  235. package/dist/esm/{translations-UrIr-5_D.js → translations-Drl5LNAD.js} +56 -0
  236. package/dist/lime-elements/lime-elements.esm.js +1 -1
  237. package/dist/lime-elements/{p-35bc5ed2.entry.js → p-01de145c.entry.js} +1 -1
  238. package/dist/lime-elements/{p-3ee121fa.entry.js → p-026eed2d.entry.js} +1 -1
  239. package/dist/lime-elements/{p-9ff6a455.entry.js → p-068b141b.entry.js} +1 -1
  240. package/dist/lime-elements/{p-9168793f.entry.js → p-09f8f883.entry.js} +1 -1
  241. package/dist/lime-elements/p-1066a057.entry.js +1 -0
  242. package/dist/lime-elements/{p-95322502.entry.js → p-1663fa9d.entry.js} +1 -1
  243. package/dist/lime-elements/{p-def7b38f.entry.js → p-17aa9235.entry.js} +1 -1
  244. package/dist/lime-elements/{p-910807cb.entry.js → p-19426c76.entry.js} +1 -1
  245. package/dist/lime-elements/{p-622660dd.entry.js → p-1d6014ed.entry.js} +1 -1
  246. package/dist/lime-elements/p-2370ff51.entry.js +1 -0
  247. package/dist/lime-elements/{p-0f18981d.entry.js → p-242f1032.entry.js} +1 -1
  248. package/dist/lime-elements/{p-828558cf.entry.js → p-27d375f3.entry.js} +1 -1
  249. package/dist/lime-elements/{p-2ba9d62f.entry.js → p-300f80e7.entry.js} +1 -1
  250. package/dist/lime-elements/{p-9ca18ba5.entry.js → p-3b4f6329.entry.js} +1 -1
  251. package/dist/lime-elements/{p-2528f75e.entry.js → p-3de45ea6.entry.js} +2 -2
  252. package/dist/lime-elements/{p-675a7469.entry.js → p-3f447d22.entry.js} +1 -1
  253. package/dist/lime-elements/{p-780dae0b.entry.js → p-3fa66fb1.entry.js} +1 -1
  254. package/dist/lime-elements/{p-09390c6a.entry.js → p-41172b62.entry.js} +1 -1
  255. package/dist/lime-elements/{p-d5144955.entry.js → p-41fb6e88.entry.js} +1 -1
  256. package/dist/lime-elements/{p-f4c9940e.entry.js → p-44ec1f22.entry.js} +1 -1
  257. package/dist/lime-elements/{p-268b4da1.entry.js → p-4a272ac2.entry.js} +1 -1
  258. package/dist/lime-elements/{p-e25bfb2c.entry.js → p-4a381bc6.entry.js} +1 -1
  259. package/dist/lime-elements/p-56fe13ef.entry.js +1 -0
  260. package/dist/lime-elements/p-5d623004.entry.js +1 -0
  261. package/dist/lime-elements/{p-8a59698f.entry.js → p-5ea07cbe.entry.js} +1 -1
  262. package/dist/lime-elements/p-600466a9.entry.js +1 -0
  263. package/dist/lime-elements/{p-657bfa36.entry.js → p-62b6e235.entry.js} +1 -1
  264. package/dist/lime-elements/p-64540beb.entry.js +1 -0
  265. package/dist/lime-elements/{p-1020ca20.entry.js → p-674680f9.entry.js} +1 -1
  266. package/dist/lime-elements/{p-d79d777e.entry.js → p-67536ac3.entry.js} +1 -1
  267. package/dist/lime-elements/{p-dd075353.entry.js → p-6770cf06.entry.js} +1 -1
  268. package/dist/lime-elements/{p-887eea11.entry.js → p-7375fac2.entry.js} +1 -1
  269. package/dist/lime-elements/{p-fb15f608.entry.js → p-7829198d.entry.js} +1 -1
  270. package/dist/lime-elements/{p-abed5afd.entry.js → p-82672504.entry.js} +1 -1
  271. package/dist/lime-elements/{p-24e5d420.entry.js → p-8339d921.entry.js} +1 -1
  272. package/dist/lime-elements/{p-33ed0c68.entry.js → p-87c9f4de.entry.js} +1 -1
  273. package/dist/lime-elements/{p-7a290372.entry.js → p-89316964.entry.js} +1 -1
  274. package/dist/lime-elements/{p-527e9c95.entry.js → p-8a9361a2.entry.js} +1 -1
  275. package/dist/lime-elements/{p-46bf8b22.entry.js → p-8e78fd4f.entry.js} +1 -1
  276. package/dist/lime-elements/{p-db1f9eba.entry.js → p-8f133cd6.entry.js} +1 -1
  277. package/dist/lime-elements/{p-ff4a8b89.entry.js → p-90198515.entry.js} +1 -1
  278. package/dist/lime-elements/{p-236743f1.entry.js → p-95ca7426.entry.js} +1 -1
  279. package/dist/lime-elements/{p-55b56742.entry.js → p-9aa921a2.entry.js} +1 -1
  280. package/dist/lime-elements/{p-540b2b24.entry.js → p-9bbf2612.entry.js} +1 -1
  281. package/dist/lime-elements/{p-a449ca04.entry.js → p-9d354eca.entry.js} +1 -1
  282. package/dist/lime-elements/{p-68542e00.entry.js → p-9e9187ce.entry.js} +1 -1
  283. package/dist/lime-elements/p-B26k4gw8.js +1 -0
  284. package/dist/lime-elements/p-BAqAt5It.js +1 -0
  285. package/dist/lime-elements/p-Cu9Ji1iJ.js +1 -0
  286. package/dist/lime-elements/{p-BY5NjPj8.js → p-D9Ezd43A.js} +1 -1
  287. package/dist/lime-elements/{p-nVemxylR.js → p-DFu1q54T.js} +1 -1
  288. package/dist/lime-elements/p-DdnBHYb-.js +7 -0
  289. package/dist/lime-elements/{p-B6-3WXAv.js → p-DeIIlp6m.js} +1 -1
  290. package/dist/lime-elements/p-Dq0uNStc.js +1 -0
  291. package/dist/lime-elements/{p-4a7df81a.entry.js → p-aac603af.entry.js} +1 -1
  292. package/dist/lime-elements/{p-5473eb74.entry.js → p-aee75ad1.entry.js} +1 -1
  293. package/dist/lime-elements/{p-4882acaa.entry.js → p-afbe54e6.entry.js} +1 -1
  294. package/dist/lime-elements/{p-a78aaf37.entry.js → p-b5ebcbfc.entry.js} +1 -1
  295. package/dist/lime-elements/{p-07916acc.entry.js → p-be8950a6.entry.js} +2 -2
  296. package/dist/lime-elements/p-c8cb4912.entry.js +16 -0
  297. package/dist/lime-elements/{p-de4d261a.entry.js → p-dd065596.entry.js} +1 -1
  298. package/dist/lime-elements/{p-0c2ce99b.entry.js → p-ddabfac0.entry.js} +1 -1
  299. package/dist/lime-elements/{p-d3475514.entry.js → p-de3cf7d8.entry.js} +1 -1
  300. package/dist/lime-elements/{p-458c131f.entry.js → p-e13e0001.entry.js} +2 -2
  301. package/dist/lime-elements/p-e2971111.entry.js +1 -0
  302. package/dist/lime-elements/{p-ecded772.entry.js → p-e332bb9b.entry.js} +1 -1
  303. package/dist/lime-elements/{p-54631dbf.entry.js → p-e50acec1.entry.js} +1 -1
  304. package/dist/lime-elements/{p-074275f4.entry.js → p-e9b1e0bd.entry.js} +1 -1
  305. package/dist/lime-elements/p-ec531ecb.entry.js +1 -0
  306. package/dist/lime-elements/{p-90286e5c.entry.js → p-f0bf3fd1.entry.js} +1 -1
  307. package/dist/lime-elements/p-f1ac7608.entry.js +1 -0
  308. package/dist/lime-elements/{p-c12fbc91.entry.js → p-f455150b.entry.js} +1 -1
  309. package/dist/types/components/form/form.d.ts +15 -0
  310. package/dist/types/components/form/show-field.d.ts +9 -0
  311. package/dist/types/components/form/templates/array-context.d.ts +4 -0
  312. package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +5 -0
  313. package/dist/types/components/form/templates/array-field.d.ts +3 -13
  314. package/dist/types/components/form/templates/field.d.ts +1 -0
  315. package/dist/types/components/form/templates/object-field.d.ts +2 -2
  316. package/dist/types/components/resize-handle/resize-handle.d.ts +31 -2
  317. package/dist/types/components/side-panel/side-panel.d.ts +11 -4
  318. package/dist/types/components/tab-bar/tab-bar.d.ts +25 -0
  319. package/dist/types/components/tab-bar/tab.types.d.ts +18 -0
  320. package/dist/types/components/tab-bar/tabs.d.ts +12 -1
  321. package/dist/types/components/tab-panel/tab-panel.d.ts +18 -1
  322. package/dist/types/components.d.ts +143 -18
  323. package/dist/types/translations/da.d.ts +7 -0
  324. package/dist/types/translations/de.d.ts +7 -0
  325. package/dist/types/translations/en.d.ts +7 -0
  326. package/dist/types/translations/fi.d.ts +7 -0
  327. package/dist/types/translations/fr.d.ts +7 -0
  328. package/dist/types/translations/nl.d.ts +7 -0
  329. package/dist/types/translations/no.d.ts +7 -0
  330. package/dist/types/translations/sv.d.ts +7 -0
  331. package/dist/types/util/drag-to-reorder.d.ts +65 -0
  332. package/package.json +4 -4
  333. package/dist/cjs/isArrayLikeObject-U2Ddbw4n.js +0 -326
  334. package/dist/cjs/limel-drag-handle.cjs.entry.js +0 -42
  335. package/dist/esm/isArrayLikeObject-CJB8HbtH.js +0 -321
  336. package/dist/esm/limel-drag-handle.entry.js +0 -40
  337. package/dist/lime-elements/p-26813b2c.entry.js +0 -1
  338. package/dist/lime-elements/p-49eb2f64.entry.js +0 -13
  339. package/dist/lime-elements/p-4f58c6b3.entry.js +0 -1
  340. package/dist/lime-elements/p-646731b6.entry.js +0 -1
  341. package/dist/lime-elements/p-8d567e42.entry.js +0 -1
  342. package/dist/lime-elements/p-9b384d62.entry.js +0 -1
  343. package/dist/lime-elements/p-BQeIv4aA.js +0 -1
  344. package/dist/lime-elements/p-COdirXg1.js +0 -1
  345. package/dist/lime-elements/p-ORUNaKm-.js +0 -1
  346. package/dist/lime-elements/p-a317f2fa.entry.js +0 -1
  347. package/dist/lime-elements/p-a5246373.entry.js +0 -1
  348. package/dist/lime-elements/p-b609552e.entry.js +0 -1
  349. package/dist/lime-elements/p-bf849dc9.entry.js +0 -1
  350. package/dist/lime-elements/p-d7e5a4a7.entry.js +0 -1
  351. package/dist/lime-elements/p-pk5KIdKH.js +0 -1
  352. package/dist/lime-elements/p-w3yKYfBQ.js +0 -1
@@ -0,0 +1,3092 @@
1
+ 'use strict';
2
+
3
+ var identity = require('./identity-Dz5mxHaJ.js');
4
+ var _defineProperty$1 = require('./_defineProperty-Csu6P9HT.js');
5
+ var _baseIsEqual = require('./_baseIsEqual-zzV9DKMv.js');
6
+ var isObject = require('./isObject-B6Osvvqp.js');
7
+ var _getTag = require('./_getTag-BC28Za7d.js');
8
+ var isArray = require('./isArray-BuFVIU_i.js');
9
+ var isArrayLike = require('./isArrayLike-C2RwZMG4.js');
10
+ var isObjectLike = require('./isObjectLike-Dlpn-j-1.js');
11
+
12
+ /**
13
+ * A faster alternative to `Function#apply`, this function invokes `func`
14
+ * with the `this` binding of `thisArg` and the arguments of `args`.
15
+ *
16
+ * @private
17
+ * @param {Function} func The function to invoke.
18
+ * @param {*} thisArg The `this` binding of `func`.
19
+ * @param {Array} args The arguments to invoke `func` with.
20
+ * @returns {*} Returns the result of `func`.
21
+ */
22
+ function apply(func, thisArg, args) {
23
+ switch (args.length) {
24
+ case 0: return func.call(thisArg);
25
+ case 1: return func.call(thisArg, args[0]);
26
+ case 2: return func.call(thisArg, args[0], args[1]);
27
+ case 3: return func.call(thisArg, args[0], args[1], args[2]);
28
+ }
29
+ return func.apply(thisArg, args);
30
+ }
31
+
32
+ /** Used to detect hot functions by number of calls within a span of milliseconds. */
33
+ var HOT_COUNT = 800,
34
+ HOT_SPAN = 16;
35
+
36
+ /* Built-in method references for those with the same name as other `lodash` methods. */
37
+ var nativeNow = Date.now;
38
+
39
+ /**
40
+ * Creates a function that'll short out and invoke `identity` instead
41
+ * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
42
+ * milliseconds.
43
+ *
44
+ * @private
45
+ * @param {Function} func The function to restrict.
46
+ * @returns {Function} Returns the new shortable function.
47
+ */
48
+ function shortOut(func) {
49
+ var count = 0,
50
+ lastCalled = 0;
51
+
52
+ return function() {
53
+ var stamp = nativeNow(),
54
+ remaining = HOT_SPAN - (stamp - lastCalled);
55
+
56
+ lastCalled = stamp;
57
+ if (remaining > 0) {
58
+ if (++count >= HOT_COUNT) {
59
+ return arguments[0];
60
+ }
61
+ } else {
62
+ count = 0;
63
+ }
64
+ return func.apply(undefined, arguments);
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Creates a function that returns `value`.
70
+ *
71
+ * @static
72
+ * @memberOf _
73
+ * @since 2.4.0
74
+ * @category Util
75
+ * @param {*} value The value to return from the new function.
76
+ * @returns {Function} Returns the new constant function.
77
+ * @example
78
+ *
79
+ * var objects = _.times(2, _.constant({ 'a': 1 }));
80
+ *
81
+ * console.log(objects);
82
+ * // => [{ 'a': 1 }, { 'a': 1 }]
83
+ *
84
+ * console.log(objects[0] === objects[1]);
85
+ * // => true
86
+ */
87
+ function constant(value) {
88
+ return function() {
89
+ return value;
90
+ };
91
+ }
92
+
93
+ /**
94
+ * The base implementation of `setToString` without support for hot loop shorting.
95
+ *
96
+ * @private
97
+ * @param {Function} func The function to modify.
98
+ * @param {Function} string The `toString` result.
99
+ * @returns {Function} Returns `func`.
100
+ */
101
+ var baseSetToString = !_defineProperty$1.defineProperty ? identity.identity : function(func, string) {
102
+ return _defineProperty$1.defineProperty(func, 'toString', {
103
+ 'configurable': true,
104
+ 'enumerable': false,
105
+ 'value': constant(string),
106
+ 'writable': true
107
+ });
108
+ };
109
+
110
+ /**
111
+ * Sets the `toString` method of `func` to return `string`.
112
+ *
113
+ * @private
114
+ * @param {Function} func The function to modify.
115
+ * @param {Function} string The `toString` result.
116
+ * @returns {Function} Returns `func`.
117
+ */
118
+ var setToString = shortOut(baseSetToString);
119
+
120
+ /**
121
+ * The base implementation of `_.findIndex` and `_.findLastIndex` without
122
+ * support for iteratee shorthands.
123
+ *
124
+ * @private
125
+ * @param {Array} array The array to inspect.
126
+ * @param {Function} predicate The function invoked per iteration.
127
+ * @param {number} fromIndex The index to search from.
128
+ * @param {boolean} [fromRight] Specify iterating from right to left.
129
+ * @returns {number} Returns the index of the matched value, else `-1`.
130
+ */
131
+ function baseFindIndex(array, predicate, fromIndex, fromRight) {
132
+ var length = array.length,
133
+ index = fromIndex + (-1);
134
+
135
+ while ((++index < length)) {
136
+ if (predicate(array[index], index, array)) {
137
+ return index;
138
+ }
139
+ }
140
+ return -1;
141
+ }
142
+
143
+ /**
144
+ * The base implementation of `_.isNaN` without support for number objects.
145
+ *
146
+ * @private
147
+ * @param {*} value The value to check.
148
+ * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
149
+ */
150
+ function baseIsNaN(value) {
151
+ return value !== value;
152
+ }
153
+
154
+ /**
155
+ * A specialized version of `_.indexOf` which performs strict equality
156
+ * comparisons of values, i.e. `===`.
157
+ *
158
+ * @private
159
+ * @param {Array} array The array to inspect.
160
+ * @param {*} value The value to search for.
161
+ * @param {number} fromIndex The index to search from.
162
+ * @returns {number} Returns the index of the matched value, else `-1`.
163
+ */
164
+ function strictIndexOf(array, value, fromIndex) {
165
+ var index = fromIndex - 1,
166
+ length = array.length;
167
+
168
+ while (++index < length) {
169
+ if (array[index] === value) {
170
+ return index;
171
+ }
172
+ }
173
+ return -1;
174
+ }
175
+
176
+ /**
177
+ * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
178
+ *
179
+ * @private
180
+ * @param {Array} array The array to inspect.
181
+ * @param {*} value The value to search for.
182
+ * @param {number} fromIndex The index to search from.
183
+ * @returns {number} Returns the index of the matched value, else `-1`.
184
+ */
185
+ function baseIndexOf(array, value, fromIndex) {
186
+ return value === value
187
+ ? strictIndexOf(array, value, fromIndex)
188
+ : baseFindIndex(array, baseIsNaN, fromIndex);
189
+ }
190
+
191
+ /**
192
+ * A specialized version of `_.includes` for arrays without support for
193
+ * specifying an index to search from.
194
+ *
195
+ * @private
196
+ * @param {Array} [array] The array to inspect.
197
+ * @param {*} target The value to search for.
198
+ * @returns {boolean} Returns `true` if `target` is found, else `false`.
199
+ */
200
+ function arrayIncludes(array, value) {
201
+ var length = array == null ? 0 : array.length;
202
+ return !!length && baseIndexOf(array, value, 0) > -1;
203
+ }
204
+
205
+ /* Built-in method references for those with the same name as other `lodash` methods. */
206
+ var nativeMax = Math.max;
207
+
208
+ /**
209
+ * A specialized version of `baseRest` which transforms the rest array.
210
+ *
211
+ * @private
212
+ * @param {Function} func The function to apply a rest parameter to.
213
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
214
+ * @param {Function} transform The rest array transform.
215
+ * @returns {Function} Returns the new function.
216
+ */
217
+ function overRest(func, start, transform) {
218
+ start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
219
+ return function() {
220
+ var args = arguments,
221
+ index = -1,
222
+ length = nativeMax(args.length - start, 0),
223
+ array = Array(length);
224
+
225
+ while (++index < length) {
226
+ array[index] = args[start + index];
227
+ }
228
+ index = -1;
229
+ var otherArgs = Array(start + 1);
230
+ while (++index < start) {
231
+ otherArgs[index] = args[index];
232
+ }
233
+ otherArgs[start] = transform(array);
234
+ return apply(func, this, otherArgs);
235
+ };
236
+ }
237
+
238
+ /**
239
+ * The base implementation of `_.rest` which doesn't validate or coerce arguments.
240
+ *
241
+ * @private
242
+ * @param {Function} func The function to apply a rest parameter to.
243
+ * @param {number} [start=func.length-1] The start position of the rest parameter.
244
+ * @returns {Function} Returns the new function.
245
+ */
246
+ function baseRest(func, start) {
247
+ return setToString(overRest(func, start, identity.identity), func + '');
248
+ }
249
+
250
+ /** Built-in value references. */
251
+ var spreadableSymbol = isObject.Symbol ? isObject.Symbol.isConcatSpreadable : undefined;
252
+
253
+ /**
254
+ * Checks if `value` is a flattenable `arguments` object or array.
255
+ *
256
+ * @private
257
+ * @param {*} value The value to check.
258
+ * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
259
+ */
260
+ function isFlattenable(value) {
261
+ return isArray.isArray(value) || _getTag.isArguments(value) ||
262
+ !!(spreadableSymbol && value && value[spreadableSymbol]);
263
+ }
264
+
265
+ /**
266
+ * The base implementation of `_.flatten` with support for restricting flattening.
267
+ *
268
+ * @private
269
+ * @param {Array} array The array to flatten.
270
+ * @param {number} depth The maximum recursion depth.
271
+ * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
272
+ * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
273
+ * @param {Array} [result=[]] The initial result value.
274
+ * @returns {Array} Returns the new flattened array.
275
+ */
276
+ function baseFlatten(array, depth, predicate, isStrict, result) {
277
+ var index = -1,
278
+ length = array.length;
279
+
280
+ predicate || (predicate = isFlattenable);
281
+ result || (result = []);
282
+
283
+ while (++index < length) {
284
+ var value = array[index];
285
+ if (predicate(value)) {
286
+ {
287
+ _baseIsEqual.arrayPush(result, value);
288
+ }
289
+ }
290
+ }
291
+ return result;
292
+ }
293
+
294
+ /**
295
+ * This method is like `_.isArrayLike` except that it also checks if `value`
296
+ * is an object.
297
+ *
298
+ * @static
299
+ * @memberOf _
300
+ * @since 4.0.0
301
+ * @category Lang
302
+ * @param {*} value The value to check.
303
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
304
+ * else `false`.
305
+ * @example
306
+ *
307
+ * _.isArrayLikeObject([1, 2, 3]);
308
+ * // => true
309
+ *
310
+ * _.isArrayLikeObject(document.body.children);
311
+ * // => true
312
+ *
313
+ * _.isArrayLikeObject('abc');
314
+ * // => false
315
+ *
316
+ * _.isArrayLikeObject(_.noop);
317
+ * // => false
318
+ */
319
+ function isArrayLikeObject(value) {
320
+ return isObjectLike.isObjectLike(value) && isArrayLike.isArrayLike(value);
321
+ }
322
+
323
+ /**!
324
+ * Sortable 1.15.7
325
+ * @author RubaXa <trash@rubaxa.org>
326
+ * @author owenm <owen23355@gmail.com>
327
+ * @license MIT
328
+ */
329
+ function _defineProperty(e, r, t) {
330
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
331
+ value: t,
332
+ enumerable: true,
333
+ configurable: true,
334
+ writable: true
335
+ }) : e[r] = t, e;
336
+ }
337
+ function _extends() {
338
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
339
+ for (var e = 1; e < arguments.length; e++) {
340
+ var t = arguments[e];
341
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
342
+ }
343
+ return n;
344
+ }, _extends.apply(null, arguments);
345
+ }
346
+ function ownKeys(e, r) {
347
+ var t = Object.keys(e);
348
+ if (Object.getOwnPropertySymbols) {
349
+ var o = Object.getOwnPropertySymbols(e);
350
+ r && (o = o.filter(function (r) {
351
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
352
+ })), t.push.apply(t, o);
353
+ }
354
+ return t;
355
+ }
356
+ function _objectSpread2(e) {
357
+ for (var r = 1; r < arguments.length; r++) {
358
+ var t = null != arguments[r] ? arguments[r] : {};
359
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
360
+ _defineProperty(e, r, t[r]);
361
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
362
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
363
+ });
364
+ }
365
+ return e;
366
+ }
367
+ function _objectWithoutProperties(e, t) {
368
+ if (null == e) return {};
369
+ var o,
370
+ r,
371
+ i = _objectWithoutPropertiesLoose(e, t);
372
+ if (Object.getOwnPropertySymbols) {
373
+ var n = Object.getOwnPropertySymbols(e);
374
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
375
+ }
376
+ return i;
377
+ }
378
+ function _objectWithoutPropertiesLoose(r, e) {
379
+ if (null == r) return {};
380
+ var t = {};
381
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
382
+ if (-1 !== e.indexOf(n)) continue;
383
+ t[n] = r[n];
384
+ }
385
+ return t;
386
+ }
387
+ function _toPrimitive(t, r) {
388
+ if ("object" != typeof t || !t) return t;
389
+ var e = t[Symbol.toPrimitive];
390
+ if (void 0 !== e) {
391
+ var i = e.call(t, r);
392
+ if ("object" != typeof i) return i;
393
+ throw new TypeError("@@toPrimitive must return a primitive value.");
394
+ }
395
+ return ("string" === r ? String : Number)(t);
396
+ }
397
+ function _toPropertyKey(t) {
398
+ var i = _toPrimitive(t, "string");
399
+ return "symbol" == typeof i ? i : i + "";
400
+ }
401
+ function _typeof(o) {
402
+ "@babel/helpers - typeof";
403
+
404
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
405
+ return typeof o;
406
+ } : function (o) {
407
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
408
+ }, _typeof(o);
409
+ }
410
+
411
+ var version = "1.15.7";
412
+
413
+ function userAgent(pattern) {
414
+ if (typeof window !== 'undefined' && window.navigator) {
415
+ return !! /*@__PURE__*/navigator.userAgent.match(pattern);
416
+ }
417
+ }
418
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
419
+ var Edge = userAgent(/Edge/i);
420
+ var FireFox = userAgent(/firefox/i);
421
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
422
+ var IOS = userAgent(/iP(ad|od|hone)/i);
423
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
424
+
425
+ var captureMode = {
426
+ capture: false,
427
+ passive: false
428
+ };
429
+ function on(el, event, fn) {
430
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
431
+ }
432
+ function off(el, event, fn) {
433
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
434
+ }
435
+ function matches( /**HTMLElement*/el, /**String*/selector) {
436
+ if (!selector) return;
437
+ selector[0] === '>' && (selector = selector.substring(1));
438
+ if (el) {
439
+ try {
440
+ if (el.matches) {
441
+ return el.matches(selector);
442
+ } else if (el.msMatchesSelector) {
443
+ return el.msMatchesSelector(selector);
444
+ } else if (el.webkitMatchesSelector) {
445
+ return el.webkitMatchesSelector(selector);
446
+ }
447
+ } catch (_) {
448
+ return false;
449
+ }
450
+ }
451
+ return false;
452
+ }
453
+ function getParentOrHost(el) {
454
+ return el.host && el !== document && el.host.nodeType && el.host !== el ? el.host : el.parentNode;
455
+ }
456
+ function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
457
+ if (el) {
458
+ ctx = ctx || document;
459
+ do {
460
+ if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
461
+ return el;
462
+ }
463
+ if (el === ctx) break;
464
+ /* jshint boss:true */
465
+ } while (el = getParentOrHost(el));
466
+ }
467
+ return null;
468
+ }
469
+ var R_SPACE = /\s+/g;
470
+ function toggleClass(el, name, state) {
471
+ if (el && name) {
472
+ if (el.classList) {
473
+ el.classList[state ? 'add' : 'remove'](name);
474
+ } else {
475
+ var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
476
+ el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
477
+ }
478
+ }
479
+ }
480
+ function css(el, prop, val) {
481
+ var style = el && el.style;
482
+ if (style) {
483
+ if (val === void 0) {
484
+ if (document.defaultView && document.defaultView.getComputedStyle) {
485
+ val = document.defaultView.getComputedStyle(el, '');
486
+ } else if (el.currentStyle) {
487
+ val = el.currentStyle;
488
+ }
489
+ return prop === void 0 ? val : val[prop];
490
+ } else {
491
+ if (!(prop in style) && prop.indexOf('webkit') === -1) {
492
+ prop = '-webkit-' + prop;
493
+ }
494
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
495
+ }
496
+ }
497
+ }
498
+ function matrix(el, selfOnly) {
499
+ var appliedTransforms = '';
500
+ if (typeof el === 'string') {
501
+ appliedTransforms = el;
502
+ } else {
503
+ do {
504
+ var transform = css(el, 'transform');
505
+ if (transform && transform !== 'none') {
506
+ appliedTransforms = transform + ' ' + appliedTransforms;
507
+ }
508
+ /* jshint boss:true */
509
+ } while (!selfOnly && (el = el.parentNode));
510
+ }
511
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
512
+ /*jshint -W056 */
513
+ return matrixFn && new matrixFn(appliedTransforms);
514
+ }
515
+ function find(ctx, tagName, iterator) {
516
+ if (ctx) {
517
+ var list = ctx.getElementsByTagName(tagName),
518
+ i = 0,
519
+ n = list.length;
520
+ if (iterator) {
521
+ for (; i < n; i++) {
522
+ iterator(list[i], i);
523
+ }
524
+ }
525
+ return list;
526
+ }
527
+ return [];
528
+ }
529
+ function getWindowScrollingElement() {
530
+ var scrollingElement = document.scrollingElement;
531
+ if (scrollingElement) {
532
+ return scrollingElement;
533
+ } else {
534
+ return document.documentElement;
535
+ }
536
+ }
537
+
538
+ /**
539
+ * Returns the "bounding client rect" of given element
540
+ * @param {HTMLElement} el The element whose boundingClientRect is wanted
541
+ * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
542
+ * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
543
+ * @param {[Boolean]} undoScale Whether the container's scale() should be undone
544
+ * @param {[HTMLElement]} container The parent the element will be placed in
545
+ * @return {Object} The boundingClientRect of el, with specified adjustments
546
+ */
547
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
548
+ if (!el.getBoundingClientRect && el !== window) return;
549
+ var elRect, top, left, bottom, right, height, width;
550
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
551
+ elRect = el.getBoundingClientRect();
552
+ top = elRect.top;
553
+ left = elRect.left;
554
+ bottom = elRect.bottom;
555
+ right = elRect.right;
556
+ height = elRect.height;
557
+ width = elRect.width;
558
+ } else {
559
+ top = 0;
560
+ left = 0;
561
+ bottom = window.innerHeight;
562
+ right = window.innerWidth;
563
+ height = window.innerHeight;
564
+ width = window.innerWidth;
565
+ }
566
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
567
+ // Adjust for translate()
568
+ container = container || el.parentNode;
569
+
570
+ // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
571
+ // Not needed on <= IE11
572
+ if (!IE11OrLess) {
573
+ do {
574
+ if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
575
+ var containerRect = container.getBoundingClientRect();
576
+
577
+ // Set relative to edges of padding box of container
578
+ top -= containerRect.top + parseInt(css(container, 'border-top-width'));
579
+ left -= containerRect.left + parseInt(css(container, 'border-left-width'));
580
+ bottom = top + elRect.height;
581
+ right = left + elRect.width;
582
+ break;
583
+ }
584
+ /* jshint boss:true */
585
+ } while (container = container.parentNode);
586
+ }
587
+ }
588
+ if (undoScale && el !== window) {
589
+ // Adjust for scale()
590
+ var elMatrix = matrix(container || el),
591
+ scaleX = elMatrix && elMatrix.a,
592
+ scaleY = elMatrix && elMatrix.d;
593
+ if (elMatrix) {
594
+ top /= scaleY;
595
+ left /= scaleX;
596
+ width /= scaleX;
597
+ height /= scaleY;
598
+ bottom = top + height;
599
+ right = left + width;
600
+ }
601
+ }
602
+ return {
603
+ top: top,
604
+ left: left,
605
+ bottom: bottom,
606
+ right: right,
607
+ width: width,
608
+ height: height
609
+ };
610
+ }
611
+
612
+ /**
613
+ * Checks if a side of an element is scrolled past a side of its parents
614
+ * @param {HTMLElement} el The element who's side being scrolled out of view is in question
615
+ * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
616
+ * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
617
+ * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
618
+ */
619
+ function isScrolledPast(el, elSide, parentSide) {
620
+ var parent = getParentAutoScrollElement(el, true),
621
+ elSideVal = getRect(el)[elSide];
622
+
623
+ /* jshint boss:true */
624
+ while (parent) {
625
+ var parentSideVal = getRect(parent)[parentSide],
626
+ visible = void 0;
627
+ {
628
+ visible = elSideVal >= parentSideVal;
629
+ }
630
+ if (!visible) return parent;
631
+ if (parent === getWindowScrollingElement()) break;
632
+ parent = getParentAutoScrollElement(parent, false);
633
+ }
634
+ return false;
635
+ }
636
+
637
+ /**
638
+ * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
639
+ * and non-draggable elements
640
+ * @param {HTMLElement} el The parent element
641
+ * @param {Number} childNum The index of the child
642
+ * @param {Object} options Parent Sortable's options
643
+ * @return {HTMLElement} The child at index childNum, or null if not found
644
+ */
645
+ function getChild(el, childNum, options, includeDragEl) {
646
+ var currentChild = 0,
647
+ i = 0,
648
+ children = el.children;
649
+ while (i < children.length) {
650
+ if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
651
+ if (currentChild === childNum) {
652
+ return children[i];
653
+ }
654
+ currentChild++;
655
+ }
656
+ i++;
657
+ }
658
+ return null;
659
+ }
660
+
661
+ /**
662
+ * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
663
+ * @param {HTMLElement} el Parent element
664
+ * @param {selector} selector Any other elements that should be ignored
665
+ * @return {HTMLElement} The last child, ignoring ghostEl
666
+ */
667
+ function lastChild(el, selector) {
668
+ var last = el.lastElementChild;
669
+ while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
670
+ last = last.previousElementSibling;
671
+ }
672
+ return last || null;
673
+ }
674
+
675
+ /**
676
+ * Returns the index of an element within its parent for a selected set of
677
+ * elements
678
+ * @param {HTMLElement} el
679
+ * @param {selector} selector
680
+ * @return {number}
681
+ */
682
+ function index(el, selector) {
683
+ var index = 0;
684
+ if (!el || !el.parentNode) {
685
+ return -1;
686
+ }
687
+
688
+ /* jshint boss:true */
689
+ while (el = el.previousElementSibling) {
690
+ if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
691
+ index++;
692
+ }
693
+ }
694
+ return index;
695
+ }
696
+
697
+ /**
698
+ * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
699
+ * The value is returned in real pixels.
700
+ * @param {HTMLElement} el
701
+ * @return {Array} Offsets in the format of [left, top]
702
+ */
703
+ function getRelativeScrollOffset(el) {
704
+ var offsetLeft = 0,
705
+ offsetTop = 0,
706
+ winScroller = getWindowScrollingElement();
707
+ if (el) {
708
+ do {
709
+ var elMatrix = matrix(el),
710
+ scaleX = elMatrix.a,
711
+ scaleY = elMatrix.d;
712
+ offsetLeft += el.scrollLeft * scaleX;
713
+ offsetTop += el.scrollTop * scaleY;
714
+ } while (el !== winScroller && (el = el.parentNode));
715
+ }
716
+ return [offsetLeft, offsetTop];
717
+ }
718
+
719
+ /**
720
+ * Returns the index of the object within the given array
721
+ * @param {Array} arr Array that may or may not hold the object
722
+ * @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
723
+ * @return {Number} The index of the object in the array, or -1
724
+ */
725
+ function indexOfObject(arr, obj) {
726
+ for (var i in arr) {
727
+ if (!arr.hasOwnProperty(i)) continue;
728
+ for (var key in obj) {
729
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
730
+ }
731
+ }
732
+ return -1;
733
+ }
734
+ function getParentAutoScrollElement(el, includeSelf) {
735
+ // skip to window
736
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
737
+ var elem = el;
738
+ var gotSelf = false;
739
+ do {
740
+ // we don't need to get elem css if it isn't even overflowing in the first place (performance)
741
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
742
+ var elemCSS = css(elem);
743
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
744
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
745
+ if (gotSelf || includeSelf) return elem;
746
+ gotSelf = true;
747
+ }
748
+ }
749
+ /* jshint boss:true */
750
+ } while (elem = elem.parentNode);
751
+ return getWindowScrollingElement();
752
+ }
753
+ function extend(dst, src) {
754
+ if (dst && src) {
755
+ for (var key in src) {
756
+ if (src.hasOwnProperty(key)) {
757
+ dst[key] = src[key];
758
+ }
759
+ }
760
+ }
761
+ return dst;
762
+ }
763
+ function isRectEqual(rect1, rect2) {
764
+ 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);
765
+ }
766
+ var _throttleTimeout;
767
+ function throttle(callback, ms) {
768
+ return function () {
769
+ if (!_throttleTimeout) {
770
+ var args = arguments,
771
+ _this = this;
772
+ if (args.length === 1) {
773
+ callback.call(_this, args[0]);
774
+ } else {
775
+ callback.apply(_this, args);
776
+ }
777
+ _throttleTimeout = setTimeout(function () {
778
+ _throttleTimeout = void 0;
779
+ }, ms);
780
+ }
781
+ };
782
+ }
783
+ function cancelThrottle() {
784
+ clearTimeout(_throttleTimeout);
785
+ _throttleTimeout = void 0;
786
+ }
787
+ function scrollBy(el, x, y) {
788
+ el.scrollLeft += x;
789
+ el.scrollTop += y;
790
+ }
791
+ function clone(el) {
792
+ var Polymer = window.Polymer;
793
+ var $ = window.jQuery || window.Zepto;
794
+ if (Polymer && Polymer.dom) {
795
+ return Polymer.dom(el).cloneNode(true);
796
+ } else if ($) {
797
+ return $(el).clone(true)[0];
798
+ } else {
799
+ return el.cloneNode(true);
800
+ }
801
+ }
802
+ function getChildContainingRectFromElement(container, options, ghostEl) {
803
+ var rect = {};
804
+ Array.from(container.children).forEach(function (child) {
805
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
806
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
807
+ var childRect = getRect(child);
808
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
809
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
810
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
811
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
812
+ });
813
+ rect.width = rect.right - rect.left;
814
+ rect.height = rect.bottom - rect.top;
815
+ rect.x = rect.left;
816
+ rect.y = rect.top;
817
+ return rect;
818
+ }
819
+ var expando = 'Sortable' + new Date().getTime();
820
+
821
+ function AnimationStateManager() {
822
+ var animationStates = [],
823
+ animationCallbackId;
824
+ return {
825
+ captureAnimationState: function captureAnimationState() {
826
+ animationStates = [];
827
+ if (!this.options.animation) return;
828
+ var children = [].slice.call(this.el.children);
829
+ children.forEach(function (child) {
830
+ if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
831
+ animationStates.push({
832
+ target: child,
833
+ rect: getRect(child)
834
+ });
835
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
836
+
837
+ // If animating: compensate for current animation
838
+ if (child.thisAnimationDuration) {
839
+ var childMatrix = matrix(child, true);
840
+ if (childMatrix) {
841
+ fromRect.top -= childMatrix.f;
842
+ fromRect.left -= childMatrix.e;
843
+ }
844
+ }
845
+ child.fromRect = fromRect;
846
+ });
847
+ },
848
+ addAnimationState: function addAnimationState(state) {
849
+ animationStates.push(state);
850
+ },
851
+ removeAnimationState: function removeAnimationState(target) {
852
+ animationStates.splice(indexOfObject(animationStates, {
853
+ target: target
854
+ }), 1);
855
+ },
856
+ animateAll: function animateAll(callback) {
857
+ var _this = this;
858
+ if (!this.options.animation) {
859
+ clearTimeout(animationCallbackId);
860
+ if (typeof callback === 'function') callback();
861
+ return;
862
+ }
863
+ var animating = false,
864
+ animationTime = 0;
865
+ animationStates.forEach(function (state) {
866
+ var time = 0,
867
+ target = state.target,
868
+ fromRect = target.fromRect,
869
+ toRect = getRect(target),
870
+ prevFromRect = target.prevFromRect,
871
+ prevToRect = target.prevToRect,
872
+ animatingRect = state.rect,
873
+ targetMatrix = matrix(target, true);
874
+ if (targetMatrix) {
875
+ // Compensate for current animation
876
+ toRect.top -= targetMatrix.f;
877
+ toRect.left -= targetMatrix.e;
878
+ }
879
+ target.toRect = toRect;
880
+ if (target.thisAnimationDuration) {
881
+ // Could also check if animatingRect is between fromRect and toRect
882
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
883
+ // Make sure animatingRect is on line between toRect & fromRect
884
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
885
+ // If returning to same place as started from animation and on same axis
886
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
887
+ }
888
+ }
889
+
890
+ // if fromRect != toRect: animate
891
+ if (!isRectEqual(toRect, fromRect)) {
892
+ target.prevFromRect = fromRect;
893
+ target.prevToRect = toRect;
894
+ if (!time) {
895
+ time = _this.options.animation;
896
+ }
897
+ _this.animate(target, animatingRect, toRect, time);
898
+ }
899
+ if (time) {
900
+ animating = true;
901
+ animationTime = Math.max(animationTime, time);
902
+ clearTimeout(target.animationResetTimer);
903
+ target.animationResetTimer = setTimeout(function () {
904
+ target.animationTime = 0;
905
+ target.prevFromRect = null;
906
+ target.fromRect = null;
907
+ target.prevToRect = null;
908
+ target.thisAnimationDuration = null;
909
+ }, time);
910
+ target.thisAnimationDuration = time;
911
+ }
912
+ });
913
+ clearTimeout(animationCallbackId);
914
+ if (!animating) {
915
+ if (typeof callback === 'function') callback();
916
+ } else {
917
+ animationCallbackId = setTimeout(function () {
918
+ if (typeof callback === 'function') callback();
919
+ }, animationTime);
920
+ }
921
+ animationStates = [];
922
+ },
923
+ animate: function animate(target, currentRect, toRect, duration) {
924
+ if (duration) {
925
+ css(target, 'transition', '');
926
+ css(target, 'transform', '');
927
+ var elMatrix = matrix(this.el),
928
+ scaleX = elMatrix && elMatrix.a,
929
+ scaleY = elMatrix && elMatrix.d,
930
+ translateX = (currentRect.left - toRect.left) / (scaleX || 1),
931
+ translateY = (currentRect.top - toRect.top) / (scaleY || 1);
932
+ target.animatingX = !!translateX;
933
+ target.animatingY = !!translateY;
934
+ css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
935
+ this.forRepaintDummy = repaint(target); // repaint
936
+
937
+ css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
938
+ css(target, 'transform', 'translate3d(0,0,0)');
939
+ typeof target.animated === 'number' && clearTimeout(target.animated);
940
+ target.animated = setTimeout(function () {
941
+ css(target, 'transition', '');
942
+ css(target, 'transform', '');
943
+ target.animated = false;
944
+ target.animatingX = false;
945
+ target.animatingY = false;
946
+ }, duration);
947
+ }
948
+ }
949
+ };
950
+ }
951
+ function repaint(target) {
952
+ return target.offsetWidth;
953
+ }
954
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
955
+ 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;
956
+ }
957
+
958
+ var plugins = [];
959
+ var defaults = {
960
+ initializeByDefault: true
961
+ };
962
+ var PluginManager = {
963
+ mount: function mount(plugin) {
964
+ // Set default static properties
965
+ for (var option in defaults) {
966
+ if (defaults.hasOwnProperty(option) && !(option in plugin)) {
967
+ plugin[option] = defaults[option];
968
+ }
969
+ }
970
+ plugins.forEach(function (p) {
971
+ if (p.pluginName === plugin.pluginName) {
972
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
973
+ }
974
+ });
975
+ plugins.push(plugin);
976
+ },
977
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
978
+ var _this = this;
979
+ this.eventCanceled = false;
980
+ evt.cancel = function () {
981
+ _this.eventCanceled = true;
982
+ };
983
+ var eventNameGlobal = eventName + 'Global';
984
+ plugins.forEach(function (plugin) {
985
+ if (!sortable[plugin.pluginName]) return;
986
+ // Fire global events if it exists in this sortable
987
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
988
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
989
+ sortable: sortable
990
+ }, evt));
991
+ }
992
+
993
+ // Only fire plugin event if plugin is enabled in this sortable,
994
+ // and plugin has event defined
995
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
996
+ sortable[plugin.pluginName][eventName](_objectSpread2({
997
+ sortable: sortable
998
+ }, evt));
999
+ }
1000
+ });
1001
+ },
1002
+ initializePlugins: function initializePlugins(sortable, el, defaults, options) {
1003
+ plugins.forEach(function (plugin) {
1004
+ var pluginName = plugin.pluginName;
1005
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
1006
+ var initialized = new plugin(sortable, el, sortable.options);
1007
+ initialized.sortable = sortable;
1008
+ initialized.options = sortable.options;
1009
+ sortable[pluginName] = initialized;
1010
+
1011
+ // Add default options from plugin
1012
+ _extends(defaults, initialized.defaults);
1013
+ });
1014
+ for (var option in sortable.options) {
1015
+ if (!sortable.options.hasOwnProperty(option)) continue;
1016
+ var modified = this.modifyOption(sortable, option, sortable.options[option]);
1017
+ if (typeof modified !== 'undefined') {
1018
+ sortable.options[option] = modified;
1019
+ }
1020
+ }
1021
+ },
1022
+ getEventProperties: function getEventProperties(name, sortable) {
1023
+ var eventProperties = {};
1024
+ plugins.forEach(function (plugin) {
1025
+ if (typeof plugin.eventProperties !== 'function') return;
1026
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
1027
+ });
1028
+ return eventProperties;
1029
+ },
1030
+ modifyOption: function modifyOption(sortable, name, value) {
1031
+ var modifiedValue;
1032
+ plugins.forEach(function (plugin) {
1033
+ // Plugin must exist on the Sortable
1034
+ if (!sortable[plugin.pluginName]) return;
1035
+
1036
+ // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
1037
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
1038
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
1039
+ }
1040
+ });
1041
+ return modifiedValue;
1042
+ }
1043
+ };
1044
+
1045
+ function dispatchEvent(_ref) {
1046
+ var sortable = _ref.sortable,
1047
+ rootEl = _ref.rootEl,
1048
+ name = _ref.name,
1049
+ targetEl = _ref.targetEl,
1050
+ cloneEl = _ref.cloneEl,
1051
+ toEl = _ref.toEl,
1052
+ fromEl = _ref.fromEl,
1053
+ oldIndex = _ref.oldIndex,
1054
+ newIndex = _ref.newIndex,
1055
+ oldDraggableIndex = _ref.oldDraggableIndex,
1056
+ newDraggableIndex = _ref.newDraggableIndex,
1057
+ originalEvent = _ref.originalEvent,
1058
+ putSortable = _ref.putSortable,
1059
+ extraEventProperties = _ref.extraEventProperties;
1060
+ sortable = sortable || rootEl && rootEl[expando];
1061
+ if (!sortable) return;
1062
+ var evt,
1063
+ options = sortable.options,
1064
+ onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
1065
+ // Support for new CustomEvent feature
1066
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
1067
+ evt = new CustomEvent(name, {
1068
+ bubbles: true,
1069
+ cancelable: true
1070
+ });
1071
+ } else {
1072
+ evt = document.createEvent('Event');
1073
+ evt.initEvent(name, true, true);
1074
+ }
1075
+ evt.to = toEl || rootEl;
1076
+ evt.from = fromEl || rootEl;
1077
+ evt.item = targetEl || rootEl;
1078
+ evt.clone = cloneEl;
1079
+ evt.oldIndex = oldIndex;
1080
+ evt.newIndex = newIndex;
1081
+ evt.oldDraggableIndex = oldDraggableIndex;
1082
+ evt.newDraggableIndex = newDraggableIndex;
1083
+ evt.originalEvent = originalEvent;
1084
+ evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
1085
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
1086
+ for (var option in allEventProperties) {
1087
+ evt[option] = allEventProperties[option];
1088
+ }
1089
+ if (rootEl) {
1090
+ rootEl.dispatchEvent(evt);
1091
+ }
1092
+ if (options[onName]) {
1093
+ options[onName].call(sortable, evt);
1094
+ }
1095
+ }
1096
+
1097
+ var _excluded = ["evt"];
1098
+ var pluginEvent = function pluginEvent(eventName, sortable) {
1099
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
1100
+ originalEvent = _ref.evt,
1101
+ data = _objectWithoutProperties(_ref, _excluded);
1102
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
1103
+ dragEl: dragEl,
1104
+ parentEl: parentEl,
1105
+ ghostEl: ghostEl,
1106
+ rootEl: rootEl,
1107
+ nextEl: nextEl,
1108
+ lastDownEl: lastDownEl,
1109
+ cloneEl: cloneEl,
1110
+ cloneHidden: cloneHidden,
1111
+ dragStarted: moved,
1112
+ putSortable: putSortable,
1113
+ activeSortable: Sortable.active,
1114
+ originalEvent: originalEvent,
1115
+ oldIndex: oldIndex,
1116
+ oldDraggableIndex: oldDraggableIndex,
1117
+ newIndex: newIndex,
1118
+ newDraggableIndex: newDraggableIndex,
1119
+ hideGhostForTarget: _hideGhostForTarget,
1120
+ unhideGhostForTarget: _unhideGhostForTarget,
1121
+ cloneNowHidden: function cloneNowHidden() {
1122
+ cloneHidden = true;
1123
+ },
1124
+ cloneNowShown: function cloneNowShown() {
1125
+ cloneHidden = false;
1126
+ },
1127
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
1128
+ _dispatchEvent({
1129
+ sortable: sortable,
1130
+ name: name,
1131
+ originalEvent: originalEvent
1132
+ });
1133
+ }
1134
+ }, data));
1135
+ };
1136
+ function _dispatchEvent(info) {
1137
+ dispatchEvent(_objectSpread2({
1138
+ putSortable: putSortable,
1139
+ cloneEl: cloneEl,
1140
+ targetEl: dragEl,
1141
+ rootEl: rootEl,
1142
+ oldIndex: oldIndex,
1143
+ oldDraggableIndex: oldDraggableIndex,
1144
+ newIndex: newIndex,
1145
+ newDraggableIndex: newDraggableIndex
1146
+ }, info));
1147
+ }
1148
+ var dragEl,
1149
+ parentEl,
1150
+ ghostEl,
1151
+ rootEl,
1152
+ nextEl,
1153
+ lastDownEl,
1154
+ cloneEl,
1155
+ cloneHidden,
1156
+ oldIndex,
1157
+ newIndex,
1158
+ oldDraggableIndex,
1159
+ newDraggableIndex,
1160
+ activeGroup,
1161
+ putSortable,
1162
+ awaitingDragStarted = false,
1163
+ ignoreNextClick = false,
1164
+ sortables = [],
1165
+ tapEvt,
1166
+ touchEvt,
1167
+ lastDx,
1168
+ lastDy,
1169
+ tapDistanceLeft,
1170
+ tapDistanceTop,
1171
+ moved,
1172
+ lastTarget,
1173
+ lastDirection,
1174
+ pastFirstInvertThresh = false,
1175
+ isCircumstantialInvert = false,
1176
+ targetMoveDistance,
1177
+ // For positioning ghost absolutely
1178
+ ghostRelativeParent,
1179
+ ghostRelativeParentInitialScroll = [],
1180
+ // (left, top)
1181
+
1182
+ _silent = false,
1183
+ savedInputChecked = [];
1184
+
1185
+ /** @const */
1186
+ var documentExists = typeof document !== 'undefined',
1187
+ PositionGhostAbsolutely = IOS,
1188
+ CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
1189
+ // This will not pass for IE9, because IE9 DnD only works on anchors
1190
+ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
1191
+ supportCssPointerEvents = function () {
1192
+ if (!documentExists) return;
1193
+ // false when <= IE11
1194
+ if (IE11OrLess) {
1195
+ return false;
1196
+ }
1197
+ var el = document.createElement('x');
1198
+ el.style.cssText = 'pointer-events:auto';
1199
+ return el.style.pointerEvents === 'auto';
1200
+ }(),
1201
+ _detectDirection = function _detectDirection(el, options) {
1202
+ var elCSS = css(el),
1203
+ elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
1204
+ child1 = getChild(el, 0, options),
1205
+ child2 = getChild(el, 1, options),
1206
+ firstChildCSS = child1 && css(child1),
1207
+ secondChildCSS = child2 && css(child2),
1208
+ firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
1209
+ secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
1210
+ if (elCSS.display === 'flex') {
1211
+ return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
1212
+ }
1213
+ if (elCSS.display === 'grid') {
1214
+ return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
1215
+ }
1216
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
1217
+ var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
1218
+ return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
1219
+ }
1220
+ 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';
1221
+ },
1222
+ _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
1223
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
1224
+ dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
1225
+ dragElOppLength = vertical ? dragRect.width : dragRect.height,
1226
+ targetS1Opp = vertical ? targetRect.left : targetRect.top,
1227
+ targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
1228
+ targetOppLength = vertical ? targetRect.width : targetRect.height;
1229
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
1230
+ },
1231
+ /**
1232
+ * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
1233
+ * @param {Number} x X position
1234
+ * @param {Number} y Y position
1235
+ * @return {HTMLElement} Element of the first found nearest Sortable
1236
+ */
1237
+ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
1238
+ var ret;
1239
+ sortables.some(function (sortable) {
1240
+ var threshold = sortable[expando].options.emptyInsertThreshold;
1241
+ if (!threshold || lastChild(sortable)) return;
1242
+ var rect = getRect(sortable),
1243
+ insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
1244
+ insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
1245
+ if (insideHorizontally && insideVertically) {
1246
+ return ret = sortable;
1247
+ }
1248
+ });
1249
+ return ret;
1250
+ },
1251
+ _prepareGroup = function _prepareGroup(options) {
1252
+ function toFn(value, pull) {
1253
+ return function (to, from, dragEl, evt) {
1254
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
1255
+ if (value == null && (pull || sameGroup)) {
1256
+ // Default pull value
1257
+ // Default pull and put value if same group
1258
+ return true;
1259
+ } else if (value == null || value === false) {
1260
+ return false;
1261
+ } else if (pull && value === 'clone') {
1262
+ return value;
1263
+ } else if (typeof value === 'function') {
1264
+ return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
1265
+ } else {
1266
+ var otherGroup = (pull ? to : from).options.group.name;
1267
+ return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
1268
+ }
1269
+ };
1270
+ }
1271
+ var group = {};
1272
+ var originalGroup = options.group;
1273
+ if (!originalGroup || _typeof(originalGroup) != 'object') {
1274
+ originalGroup = {
1275
+ name: originalGroup
1276
+ };
1277
+ }
1278
+ group.name = originalGroup.name;
1279
+ group.checkPull = toFn(originalGroup.pull, true);
1280
+ group.checkPut = toFn(originalGroup.put);
1281
+ group.revertClone = originalGroup.revertClone;
1282
+ options.group = group;
1283
+ },
1284
+ _hideGhostForTarget = function _hideGhostForTarget() {
1285
+ if (!supportCssPointerEvents && ghostEl) {
1286
+ css(ghostEl, 'display', 'none');
1287
+ }
1288
+ },
1289
+ _unhideGhostForTarget = function _unhideGhostForTarget() {
1290
+ if (!supportCssPointerEvents && ghostEl) {
1291
+ css(ghostEl, 'display', '');
1292
+ }
1293
+ };
1294
+
1295
+ // #1184 fix - Prevent click event on fallback if dragged but item not changed position
1296
+ if (documentExists && !ChromeForAndroid) {
1297
+ document.addEventListener('click', function (evt) {
1298
+ if (ignoreNextClick) {
1299
+ evt.preventDefault();
1300
+ evt.stopPropagation && evt.stopPropagation();
1301
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1302
+ ignoreNextClick = false;
1303
+ return false;
1304
+ }
1305
+ }, true);
1306
+ }
1307
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
1308
+ if (dragEl) {
1309
+ evt = evt.touches ? evt.touches[0] : evt;
1310
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
1311
+ if (nearest) {
1312
+ // Create imitation event
1313
+ var event = {};
1314
+ for (var i in evt) {
1315
+ if (evt.hasOwnProperty(i)) {
1316
+ event[i] = evt[i];
1317
+ }
1318
+ }
1319
+ event.target = event.rootEl = nearest;
1320
+ event.preventDefault = void 0;
1321
+ event.stopPropagation = void 0;
1322
+ nearest[expando]._onDragOver(event);
1323
+ }
1324
+ }
1325
+ };
1326
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
1327
+ if (dragEl) {
1328
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1329
+ }
1330
+ };
1331
+
1332
+ /**
1333
+ * @class Sortable
1334
+ * @param {HTMLElement} el
1335
+ * @param {Object} [options]
1336
+ */
1337
+ function Sortable(el, options) {
1338
+ if (!(el && el.nodeType && el.nodeType === 1)) {
1339
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
1340
+ }
1341
+ this.el = el; // root element
1342
+ this.options = options = _extends({}, options);
1343
+
1344
+ // Export instance
1345
+ el[expando] = this;
1346
+ var defaults = {
1347
+ group: null,
1348
+ sort: true,
1349
+ disabled: false,
1350
+ store: null,
1351
+ handle: null,
1352
+ draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
1353
+ swapThreshold: 1,
1354
+ // percentage; 0 <= x <= 1
1355
+ invertSwap: false,
1356
+ // invert always
1357
+ invertedSwapThreshold: null,
1358
+ // will be set to same as swapThreshold if default
1359
+ removeCloneOnHide: true,
1360
+ direction: function direction() {
1361
+ return _detectDirection(el, this.options);
1362
+ },
1363
+ ghostClass: 'sortable-ghost',
1364
+ chosenClass: 'sortable-chosen',
1365
+ dragClass: 'sortable-drag',
1366
+ ignore: 'a, img',
1367
+ filter: null,
1368
+ preventOnFilter: true,
1369
+ animation: 0,
1370
+ easing: null,
1371
+ setData: function setData(dataTransfer, dragEl) {
1372
+ dataTransfer.setData('Text', dragEl.textContent);
1373
+ },
1374
+ dropBubble: false,
1375
+ dragoverBubble: false,
1376
+ dataIdAttr: 'data-id',
1377
+ delay: 0,
1378
+ delayOnTouchOnly: false,
1379
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1380
+ forceFallback: false,
1381
+ fallbackClass: 'sortable-fallback',
1382
+ fallbackOnBody: false,
1383
+ fallbackTolerance: 0,
1384
+ fallbackOffset: {
1385
+ x: 0,
1386
+ y: 0
1387
+ },
1388
+ // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
1389
+ supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
1390
+ emptyInsertThreshold: 5
1391
+ };
1392
+ PluginManager.initializePlugins(this, el, defaults);
1393
+
1394
+ // Set default options
1395
+ for (var name in defaults) {
1396
+ !(name in options) && (options[name] = defaults[name]);
1397
+ }
1398
+ _prepareGroup(options);
1399
+
1400
+ // Bind all private methods
1401
+ for (var fn in this) {
1402
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
1403
+ this[fn] = this[fn].bind(this);
1404
+ }
1405
+ }
1406
+
1407
+ // Setup drag mode
1408
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
1409
+ if (this.nativeDraggable) {
1410
+ // Touch start threshold cannot be greater than the native dragstart threshold
1411
+ this.options.touchStartThreshold = 1;
1412
+ }
1413
+
1414
+ // Bind events
1415
+ if (options.supportPointer) {
1416
+ on(el, 'pointerdown', this._onTapStart);
1417
+ } else {
1418
+ on(el, 'mousedown', this._onTapStart);
1419
+ on(el, 'touchstart', this._onTapStart);
1420
+ }
1421
+ if (this.nativeDraggable) {
1422
+ on(el, 'dragover', this);
1423
+ on(el, 'dragenter', this);
1424
+ }
1425
+ sortables.push(this.el);
1426
+
1427
+ // Restore sorting
1428
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
1429
+
1430
+ // Add animation state manager
1431
+ _extends(this, AnimationStateManager());
1432
+ }
1433
+ Sortable.prototype = /** @lends Sortable.prototype */{
1434
+ constructor: Sortable,
1435
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
1436
+ if (!this.el.contains(target) && target !== this.el) {
1437
+ lastTarget = null;
1438
+ }
1439
+ },
1440
+ _getDirection: function _getDirection(evt, target) {
1441
+ return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
1442
+ },
1443
+ _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
1444
+ if (!evt.cancelable) return;
1445
+ var _this = this,
1446
+ el = this.el,
1447
+ options = this.options,
1448
+ preventOnFilter = options.preventOnFilter,
1449
+ type = evt.type,
1450
+ touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
1451
+ target = (touch || evt).target,
1452
+ originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
1453
+ filter = options.filter;
1454
+ _saveInputCheckedState(el);
1455
+
1456
+ // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
1457
+ if (dragEl) {
1458
+ return;
1459
+ }
1460
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
1461
+ return; // only left button and enabled
1462
+ }
1463
+
1464
+ // cancel dnd if original target is content editable
1465
+ if (originalTarget.isContentEditable) {
1466
+ return;
1467
+ }
1468
+
1469
+ // Safari ignores further event handling after mousedown
1470
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1471
+ return;
1472
+ }
1473
+ target = closest(target, options.draggable, el, false);
1474
+ if (target && target.animated) {
1475
+ return;
1476
+ }
1477
+ if (lastDownEl === target) {
1478
+ // Ignoring duplicate `down`
1479
+ return;
1480
+ }
1481
+
1482
+ // Get the index of the dragged element within its parent
1483
+ oldIndex = index(target);
1484
+ oldDraggableIndex = index(target, options.draggable);
1485
+
1486
+ // Check filter
1487
+ if (typeof filter === 'function') {
1488
+ if (filter.call(this, evt, target, this)) {
1489
+ _dispatchEvent({
1490
+ sortable: _this,
1491
+ rootEl: originalTarget,
1492
+ name: 'filter',
1493
+ targetEl: target,
1494
+ toEl: el,
1495
+ fromEl: el
1496
+ });
1497
+ pluginEvent('filter', _this, {
1498
+ evt: evt
1499
+ });
1500
+ preventOnFilter && evt.preventDefault();
1501
+ return; // cancel dnd
1502
+ }
1503
+ } else if (filter) {
1504
+ filter = filter.split(',').some(function (criteria) {
1505
+ criteria = closest(originalTarget, criteria.trim(), el, false);
1506
+ if (criteria) {
1507
+ _dispatchEvent({
1508
+ sortable: _this,
1509
+ rootEl: criteria,
1510
+ name: 'filter',
1511
+ targetEl: target,
1512
+ fromEl: el,
1513
+ toEl: el
1514
+ });
1515
+ pluginEvent('filter', _this, {
1516
+ evt: evt
1517
+ });
1518
+ return true;
1519
+ }
1520
+ });
1521
+ if (filter) {
1522
+ preventOnFilter && evt.preventDefault();
1523
+ return; // cancel dnd
1524
+ }
1525
+ }
1526
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
1527
+ return;
1528
+ }
1529
+
1530
+ // Prepare `dragstart`
1531
+ this._prepareDragStart(evt, touch, target);
1532
+ },
1533
+ _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
1534
+ var _this = this,
1535
+ el = _this.el,
1536
+ options = _this.options,
1537
+ ownerDocument = el.ownerDocument,
1538
+ dragStartFn;
1539
+ if (target && !dragEl && target.parentNode === el) {
1540
+ var dragRect = getRect(target);
1541
+ rootEl = el;
1542
+ dragEl = target;
1543
+ parentEl = dragEl.parentNode;
1544
+ nextEl = dragEl.nextSibling;
1545
+ lastDownEl = target;
1546
+ activeGroup = options.group;
1547
+ Sortable.dragged = dragEl;
1548
+ tapEvt = {
1549
+ target: dragEl,
1550
+ clientX: (touch || evt).clientX,
1551
+ clientY: (touch || evt).clientY
1552
+ };
1553
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
1554
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
1555
+ this._lastX = (touch || evt).clientX;
1556
+ this._lastY = (touch || evt).clientY;
1557
+ dragEl.style['will-change'] = 'all';
1558
+ dragStartFn = function dragStartFn() {
1559
+ pluginEvent('delayEnded', _this, {
1560
+ evt: evt
1561
+ });
1562
+ if (Sortable.eventCanceled) {
1563
+ _this._onDrop();
1564
+ return;
1565
+ }
1566
+ // Delayed drag has been triggered
1567
+ // we can re-enable the events: touchmove/mousemove
1568
+ _this._disableDelayedDragEvents();
1569
+ if (!FireFox && _this.nativeDraggable) {
1570
+ dragEl.draggable = true;
1571
+ }
1572
+
1573
+ // Bind the events: dragstart/dragend
1574
+ _this._triggerDragStart(evt, touch);
1575
+
1576
+ // Drag start event
1577
+ _dispatchEvent({
1578
+ sortable: _this,
1579
+ name: 'choose',
1580
+ originalEvent: evt
1581
+ });
1582
+
1583
+ // Chosen item
1584
+ toggleClass(dragEl, options.chosenClass, true);
1585
+ };
1586
+
1587
+ // Disable "draggable"
1588
+ options.ignore.split(',').forEach(function (criteria) {
1589
+ find(dragEl, criteria.trim(), _disableDraggable);
1590
+ });
1591
+ on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1592
+ on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1593
+ on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1594
+ if (options.supportPointer) {
1595
+ on(ownerDocument, 'pointerup', _this._onDrop);
1596
+ // Native D&D triggers pointercancel
1597
+ !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
1598
+ } else {
1599
+ on(ownerDocument, 'mouseup', _this._onDrop);
1600
+ on(ownerDocument, 'touchend', _this._onDrop);
1601
+ on(ownerDocument, 'touchcancel', _this._onDrop);
1602
+ }
1603
+
1604
+ // Make dragEl draggable (must be before delay for FireFox)
1605
+ if (FireFox && this.nativeDraggable) {
1606
+ this.options.touchStartThreshold = 4;
1607
+ dragEl.draggable = true;
1608
+ }
1609
+ pluginEvent('delayStart', this, {
1610
+ evt: evt
1611
+ });
1612
+
1613
+ // Delay is impossible for native DnD in Edge or IE
1614
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
1615
+ if (Sortable.eventCanceled) {
1616
+ this._onDrop();
1617
+ return;
1618
+ }
1619
+ // If the user moves the pointer or let go the click or touch
1620
+ // before the delay has been reached:
1621
+ // disable the delayed drag
1622
+ if (options.supportPointer) {
1623
+ on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
1624
+ on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
1625
+ } else {
1626
+ on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1627
+ on(ownerDocument, 'touchend', _this._disableDelayedDrag);
1628
+ on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1629
+ }
1630
+ on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1631
+ on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1632
+ options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1633
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1634
+ } else {
1635
+ dragStartFn();
1636
+ }
1637
+ }
1638
+ },
1639
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
1640
+ var touch = e.touches ? e.touches[0] : e;
1641
+ 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))) {
1642
+ this._disableDelayedDrag();
1643
+ }
1644
+ },
1645
+ _disableDelayedDrag: function _disableDelayedDrag() {
1646
+ dragEl && _disableDraggable(dragEl);
1647
+ clearTimeout(this._dragStartTimer);
1648
+ this._disableDelayedDragEvents();
1649
+ },
1650
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1651
+ var ownerDocument = this.el.ownerDocument;
1652
+ off(ownerDocument, 'mouseup', this._disableDelayedDrag);
1653
+ off(ownerDocument, 'touchend', this._disableDelayedDrag);
1654
+ off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1655
+ off(ownerDocument, 'pointerup', this._disableDelayedDrag);
1656
+ off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
1657
+ off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1658
+ off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1659
+ off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1660
+ },
1661
+ _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
1662
+ touch = touch || evt.pointerType == 'touch' && evt;
1663
+ if (!this.nativeDraggable || touch) {
1664
+ if (this.options.supportPointer) {
1665
+ on(document, 'pointermove', this._onTouchMove);
1666
+ } else if (touch) {
1667
+ on(document, 'touchmove', this._onTouchMove);
1668
+ } else {
1669
+ on(document, 'mousemove', this._onTouchMove);
1670
+ }
1671
+ } else {
1672
+ on(dragEl, 'dragend', this);
1673
+ on(rootEl, 'dragstart', this._onDragStart);
1674
+ }
1675
+ try {
1676
+ if (document.selection) {
1677
+ _nextTick(function () {
1678
+ document.selection.empty();
1679
+ });
1680
+ } else {
1681
+ window.getSelection().removeAllRanges();
1682
+ }
1683
+ } catch (err) {}
1684
+ },
1685
+ _dragStarted: function _dragStarted(fallback, evt) {
1686
+ awaitingDragStarted = false;
1687
+ if (rootEl && dragEl) {
1688
+ pluginEvent('dragStarted', this, {
1689
+ evt: evt
1690
+ });
1691
+ if (this.nativeDraggable) {
1692
+ on(document, 'dragover', _checkOutsideTargetEl);
1693
+ }
1694
+ var options = this.options;
1695
+
1696
+ // Apply effect
1697
+ !fallback && toggleClass(dragEl, options.dragClass, false);
1698
+ toggleClass(dragEl, options.ghostClass, true);
1699
+ Sortable.active = this;
1700
+ fallback && this._appendGhost();
1701
+
1702
+ // Drag start event
1703
+ _dispatchEvent({
1704
+ sortable: this,
1705
+ name: 'start',
1706
+ originalEvent: evt
1707
+ });
1708
+ } else {
1709
+ this._nulling();
1710
+ }
1711
+ },
1712
+ _emulateDragOver: function _emulateDragOver() {
1713
+ if (touchEvt) {
1714
+ this._lastX = touchEvt.clientX;
1715
+ this._lastY = touchEvt.clientY;
1716
+ _hideGhostForTarget();
1717
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1718
+ var parent = target;
1719
+ while (target && target.shadowRoot) {
1720
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1721
+ if (target === parent) break;
1722
+ parent = target;
1723
+ }
1724
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
1725
+ if (parent) {
1726
+ do {
1727
+ if (parent[expando]) {
1728
+ var inserted = void 0;
1729
+ inserted = parent[expando]._onDragOver({
1730
+ clientX: touchEvt.clientX,
1731
+ clientY: touchEvt.clientY,
1732
+ target: target,
1733
+ rootEl: parent
1734
+ });
1735
+ if (inserted && !this.options.dragoverBubble) {
1736
+ break;
1737
+ }
1738
+ }
1739
+ target = parent; // store last element
1740
+ }
1741
+ /* jshint boss:true */ while (parent = getParentOrHost(parent));
1742
+ }
1743
+ _unhideGhostForTarget();
1744
+ }
1745
+ },
1746
+ _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
1747
+ if (tapEvt) {
1748
+ var options = this.options,
1749
+ fallbackTolerance = options.fallbackTolerance,
1750
+ fallbackOffset = options.fallbackOffset,
1751
+ touch = evt.touches ? evt.touches[0] : evt,
1752
+ ghostMatrix = ghostEl && matrix(ghostEl, true),
1753
+ scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
1754
+ scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
1755
+ relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
1756
+ dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
1757
+ dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
1758
+
1759
+ // only set the status to dragging, when we are actually dragging
1760
+ if (!Sortable.active && !awaitingDragStarted) {
1761
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
1762
+ return;
1763
+ }
1764
+ this._onDragStart(evt, true);
1765
+ }
1766
+ if (ghostEl) {
1767
+ if (ghostMatrix) {
1768
+ ghostMatrix.e += dx - (lastDx || 0);
1769
+ ghostMatrix.f += dy - (lastDy || 0);
1770
+ } else {
1771
+ ghostMatrix = {
1772
+ a: 1,
1773
+ b: 0,
1774
+ c: 0,
1775
+ d: 1,
1776
+ e: dx,
1777
+ f: dy
1778
+ };
1779
+ }
1780
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
1781
+ css(ghostEl, 'webkitTransform', cssMatrix);
1782
+ css(ghostEl, 'mozTransform', cssMatrix);
1783
+ css(ghostEl, 'msTransform', cssMatrix);
1784
+ css(ghostEl, 'transform', cssMatrix);
1785
+ lastDx = dx;
1786
+ lastDy = dy;
1787
+ touchEvt = touch;
1788
+ }
1789
+ evt.cancelable && evt.preventDefault();
1790
+ }
1791
+ },
1792
+ _appendGhost: function _appendGhost() {
1793
+ // Bug if using scale(): https://stackoverflow.com/questions/2637058
1794
+ // Not being adjusted for
1795
+ if (!ghostEl) {
1796
+ var container = this.options.fallbackOnBody ? document.body : rootEl,
1797
+ rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
1798
+ options = this.options;
1799
+
1800
+ // Position absolutely
1801
+ if (PositionGhostAbsolutely) {
1802
+ // Get relatively positioned parent
1803
+ ghostRelativeParent = container;
1804
+ while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
1805
+ ghostRelativeParent = ghostRelativeParent.parentNode;
1806
+ }
1807
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
1808
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
1809
+ rect.top += ghostRelativeParent.scrollTop;
1810
+ rect.left += ghostRelativeParent.scrollLeft;
1811
+ } else {
1812
+ ghostRelativeParent = getWindowScrollingElement();
1813
+ }
1814
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
1815
+ }
1816
+ ghostEl = dragEl.cloneNode(true);
1817
+ toggleClass(ghostEl, options.ghostClass, false);
1818
+ toggleClass(ghostEl, options.fallbackClass, true);
1819
+ toggleClass(ghostEl, options.dragClass, true);
1820
+ css(ghostEl, 'transition', '');
1821
+ css(ghostEl, 'transform', '');
1822
+ css(ghostEl, 'box-sizing', 'border-box');
1823
+ css(ghostEl, 'margin', 0);
1824
+ css(ghostEl, 'top', rect.top);
1825
+ css(ghostEl, 'left', rect.left);
1826
+ css(ghostEl, 'width', rect.width);
1827
+ css(ghostEl, 'height', rect.height);
1828
+ css(ghostEl, 'opacity', '0.8');
1829
+ css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
1830
+ css(ghostEl, 'zIndex', '100000');
1831
+ css(ghostEl, 'pointerEvents', 'none');
1832
+ Sortable.ghost = ghostEl;
1833
+ container.appendChild(ghostEl);
1834
+
1835
+ // Set transform-origin
1836
+ css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
1837
+ }
1838
+ },
1839
+ _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
1840
+ var _this = this;
1841
+ var dataTransfer = evt.dataTransfer;
1842
+ var options = _this.options;
1843
+ pluginEvent('dragStart', this, {
1844
+ evt: evt
1845
+ });
1846
+ if (Sortable.eventCanceled) {
1847
+ this._onDrop();
1848
+ return;
1849
+ }
1850
+ pluginEvent('setupClone', this);
1851
+ if (!Sortable.eventCanceled) {
1852
+ cloneEl = clone(dragEl);
1853
+ cloneEl.removeAttribute("id");
1854
+ cloneEl.draggable = false;
1855
+ cloneEl.style['will-change'] = '';
1856
+ this._hideClone();
1857
+ toggleClass(cloneEl, this.options.chosenClass, false);
1858
+ Sortable.clone = cloneEl;
1859
+ }
1860
+
1861
+ // #1143: IFrame support workaround
1862
+ _this.cloneId = _nextTick(function () {
1863
+ pluginEvent('clone', _this);
1864
+ if (Sortable.eventCanceled) return;
1865
+ if (!_this.options.removeCloneOnHide) {
1866
+ rootEl.insertBefore(cloneEl, dragEl);
1867
+ }
1868
+ _this._hideClone();
1869
+ _dispatchEvent({
1870
+ sortable: _this,
1871
+ name: 'clone'
1872
+ });
1873
+ });
1874
+ !fallback && toggleClass(dragEl, options.dragClass, true);
1875
+
1876
+ // Set proper drop events
1877
+ if (fallback) {
1878
+ ignoreNextClick = true;
1879
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1880
+ } else {
1881
+ // Undo what was set in _prepareDragStart before drag started
1882
+ off(document, 'mouseup', _this._onDrop);
1883
+ off(document, 'touchend', _this._onDrop);
1884
+ off(document, 'touchcancel', _this._onDrop);
1885
+ if (dataTransfer) {
1886
+ dataTransfer.effectAllowed = 'move';
1887
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1888
+ }
1889
+ on(document, 'drop', _this);
1890
+
1891
+ // #1276 fix:
1892
+ css(dragEl, 'transform', 'translateZ(0)');
1893
+ }
1894
+ awaitingDragStarted = true;
1895
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1896
+ on(document, 'selectstart', _this);
1897
+ moved = true;
1898
+ window.getSelection().removeAllRanges();
1899
+ if (Safari) {
1900
+ css(document.body, 'user-select', 'none');
1901
+ }
1902
+ },
1903
+ // Returns true - if no further action is needed (either inserted or another condition)
1904
+ _onDragOver: function _onDragOver( /**Event*/evt) {
1905
+ var el = this.el,
1906
+ target = evt.target,
1907
+ dragRect,
1908
+ targetRect,
1909
+ revert,
1910
+ options = this.options,
1911
+ group = options.group,
1912
+ activeSortable = Sortable.active,
1913
+ isOwner = activeGroup === group,
1914
+ canSort = options.sort,
1915
+ fromSortable = putSortable || activeSortable,
1916
+ vertical,
1917
+ _this = this,
1918
+ completedFired = false;
1919
+ if (_silent) return;
1920
+ function dragOverEvent(name, extra) {
1921
+ pluginEvent(name, _this, _objectSpread2({
1922
+ evt: evt,
1923
+ isOwner: isOwner,
1924
+ axis: vertical ? 'vertical' : 'horizontal',
1925
+ revert: revert,
1926
+ dragRect: dragRect,
1927
+ targetRect: targetRect,
1928
+ canSort: canSort,
1929
+ fromSortable: fromSortable,
1930
+ target: target,
1931
+ completed: completed,
1932
+ onMove: function onMove(target, after) {
1933
+ return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
1934
+ },
1935
+ changed: changed
1936
+ }, extra));
1937
+ }
1938
+
1939
+ // Capture animation state
1940
+ function capture() {
1941
+ dragOverEvent('dragOverAnimationCapture');
1942
+ _this.captureAnimationState();
1943
+ if (_this !== fromSortable) {
1944
+ fromSortable.captureAnimationState();
1945
+ }
1946
+ }
1947
+
1948
+ // Return invocation when dragEl is inserted (or completed)
1949
+ function completed(insertion) {
1950
+ dragOverEvent('dragOverCompleted', {
1951
+ insertion: insertion
1952
+ });
1953
+ if (insertion) {
1954
+ // Clones must be hidden before folding animation to capture dragRectAbsolute properly
1955
+ if (isOwner) {
1956
+ activeSortable._hideClone();
1957
+ } else {
1958
+ activeSortable._showClone(_this);
1959
+ }
1960
+ if (_this !== fromSortable) {
1961
+ // Set ghost class to new sortable's ghost class
1962
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1963
+ toggleClass(dragEl, options.ghostClass, true);
1964
+ }
1965
+ if (putSortable !== _this && _this !== Sortable.active) {
1966
+ putSortable = _this;
1967
+ } else if (_this === Sortable.active && putSortable) {
1968
+ putSortable = null;
1969
+ }
1970
+
1971
+ // Animation
1972
+ if (fromSortable === _this) {
1973
+ _this._ignoreWhileAnimating = target;
1974
+ }
1975
+ _this.animateAll(function () {
1976
+ dragOverEvent('dragOverAnimationComplete');
1977
+ _this._ignoreWhileAnimating = null;
1978
+ });
1979
+ if (_this !== fromSortable) {
1980
+ fromSortable.animateAll();
1981
+ fromSortable._ignoreWhileAnimating = null;
1982
+ }
1983
+ }
1984
+
1985
+ // Null lastTarget if it is not inside a previously swapped element
1986
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
1987
+ lastTarget = null;
1988
+ }
1989
+
1990
+ // no bubbling and not fallback
1991
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1992
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1993
+
1994
+ // Do not detect for empty insert if already inserted
1995
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1996
+ }
1997
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1998
+ return completedFired = true;
1999
+ }
2000
+
2001
+ // Call when dragEl has been inserted
2002
+ function changed() {
2003
+ newIndex = index(dragEl);
2004
+ newDraggableIndex = index(dragEl, options.draggable);
2005
+ _dispatchEvent({
2006
+ sortable: _this,
2007
+ name: 'change',
2008
+ toEl: el,
2009
+ newIndex: newIndex,
2010
+ newDraggableIndex: newDraggableIndex,
2011
+ originalEvent: evt
2012
+ });
2013
+ }
2014
+ if (evt.preventDefault !== void 0) {
2015
+ evt.cancelable && evt.preventDefault();
2016
+ }
2017
+ target = closest(target, options.draggable, el, true);
2018
+ dragOverEvent('dragOver');
2019
+ if (Sortable.eventCanceled) return completedFired;
2020
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
2021
+ return completed(false);
2022
+ }
2023
+ ignoreNextClick = false;
2024
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
2025
+ : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
2026
+ vertical = this._getDirection(evt, target) === 'vertical';
2027
+ dragRect = getRect(dragEl);
2028
+ dragOverEvent('dragOverValid');
2029
+ if (Sortable.eventCanceled) return completedFired;
2030
+ if (revert) {
2031
+ parentEl = rootEl; // actualization
2032
+ capture();
2033
+ this._hideClone();
2034
+ dragOverEvent('revert');
2035
+ if (!Sortable.eventCanceled) {
2036
+ if (nextEl) {
2037
+ rootEl.insertBefore(dragEl, nextEl);
2038
+ } else {
2039
+ rootEl.appendChild(dragEl);
2040
+ }
2041
+ }
2042
+ return completed(true);
2043
+ }
2044
+ var elLastChild = lastChild(el, options.draggable);
2045
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
2046
+ // Insert to end of list
2047
+
2048
+ // If already at end of list: Do not insert
2049
+ if (elLastChild === dragEl) {
2050
+ return completed(false);
2051
+ }
2052
+
2053
+ // if there is a last element, it is the target
2054
+ if (elLastChild && el === evt.target) {
2055
+ target = elLastChild;
2056
+ }
2057
+ if (target) {
2058
+ targetRect = getRect(target);
2059
+ }
2060
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
2061
+ capture();
2062
+ if (elLastChild && elLastChild.nextSibling) {
2063
+ // the last draggable element is not the last node
2064
+ el.insertBefore(dragEl, elLastChild.nextSibling);
2065
+ } else {
2066
+ el.appendChild(dragEl);
2067
+ }
2068
+ parentEl = el; // actualization
2069
+
2070
+ changed();
2071
+ return completed(true);
2072
+ }
2073
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
2074
+ // Insert to start of list
2075
+ var firstChild = getChild(el, 0, options, true);
2076
+ if (firstChild === dragEl) {
2077
+ return completed(false);
2078
+ }
2079
+ target = firstChild;
2080
+ targetRect = getRect(target);
2081
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
2082
+ capture();
2083
+ el.insertBefore(dragEl, firstChild);
2084
+ parentEl = el; // actualization
2085
+
2086
+ changed();
2087
+ return completed(true);
2088
+ }
2089
+ } else if (target.parentNode === el) {
2090
+ targetRect = getRect(target);
2091
+ var direction = 0,
2092
+ targetBeforeFirstSwap,
2093
+ differentLevel = dragEl.parentNode !== el,
2094
+ differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
2095
+ side1 = vertical ? 'top' : 'left',
2096
+ scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
2097
+ scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
2098
+ if (lastTarget !== target) {
2099
+ targetBeforeFirstSwap = targetRect[side1];
2100
+ pastFirstInvertThresh = false;
2101
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
2102
+ }
2103
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
2104
+ var sibling;
2105
+ if (direction !== 0) {
2106
+ // Check if target is beside dragEl in respective direction (ignoring hidden elements)
2107
+ var dragIndex = index(dragEl);
2108
+ do {
2109
+ dragIndex -= direction;
2110
+ sibling = parentEl.children[dragIndex];
2111
+ } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
2112
+ }
2113
+ // If dragEl is already beside target: Do not insert
2114
+ if (direction === 0 || sibling === target) {
2115
+ return completed(false);
2116
+ }
2117
+ lastTarget = target;
2118
+ lastDirection = direction;
2119
+ var nextSibling = target.nextElementSibling,
2120
+ after = false;
2121
+ after = direction === 1;
2122
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
2123
+ if (moveVector !== false) {
2124
+ if (moveVector === 1 || moveVector === -1) {
2125
+ after = moveVector === 1;
2126
+ }
2127
+ _silent = true;
2128
+ setTimeout(_unsilent, 30);
2129
+ capture();
2130
+ if (after && !nextSibling) {
2131
+ el.appendChild(dragEl);
2132
+ } else {
2133
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
2134
+ }
2135
+
2136
+ // Undo chrome's scroll adjustment (has no effect on other browsers)
2137
+ if (scrolledPastTop) {
2138
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
2139
+ }
2140
+ parentEl = dragEl.parentNode; // actualization
2141
+
2142
+ // must be done before animation
2143
+ if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
2144
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
2145
+ }
2146
+ changed();
2147
+ return completed(true);
2148
+ }
2149
+ }
2150
+ if (el.contains(dragEl)) {
2151
+ return completed(false);
2152
+ }
2153
+ }
2154
+ return false;
2155
+ },
2156
+ _ignoreWhileAnimating: null,
2157
+ _offMoveEvents: function _offMoveEvents() {
2158
+ off(document, 'mousemove', this._onTouchMove);
2159
+ off(document, 'touchmove', this._onTouchMove);
2160
+ off(document, 'pointermove', this._onTouchMove);
2161
+ off(document, 'dragover', nearestEmptyInsertDetectEvent);
2162
+ off(document, 'mousemove', nearestEmptyInsertDetectEvent);
2163
+ off(document, 'touchmove', nearestEmptyInsertDetectEvent);
2164
+ },
2165
+ _offUpEvents: function _offUpEvents() {
2166
+ var ownerDocument = this.el.ownerDocument;
2167
+ off(ownerDocument, 'mouseup', this._onDrop);
2168
+ off(ownerDocument, 'touchend', this._onDrop);
2169
+ off(ownerDocument, 'pointerup', this._onDrop);
2170
+ off(ownerDocument, 'pointercancel', this._onDrop);
2171
+ off(ownerDocument, 'touchcancel', this._onDrop);
2172
+ off(document, 'selectstart', this);
2173
+ },
2174
+ _onDrop: function _onDrop( /**Event*/evt) {
2175
+ var el = this.el,
2176
+ options = this.options;
2177
+
2178
+ // Get the index of the dragged element within its parent
2179
+ newIndex = index(dragEl);
2180
+ newDraggableIndex = index(dragEl, options.draggable);
2181
+ pluginEvent('drop', this, {
2182
+ evt: evt
2183
+ });
2184
+ parentEl = dragEl && dragEl.parentNode;
2185
+
2186
+ // Get again after plugin event
2187
+ newIndex = index(dragEl);
2188
+ newDraggableIndex = index(dragEl, options.draggable);
2189
+ if (Sortable.eventCanceled) {
2190
+ this._nulling();
2191
+ return;
2192
+ }
2193
+ awaitingDragStarted = false;
2194
+ isCircumstantialInvert = false;
2195
+ pastFirstInvertThresh = false;
2196
+ clearInterval(this._loopId);
2197
+ clearTimeout(this._dragStartTimer);
2198
+ _cancelNextTick(this.cloneId);
2199
+ _cancelNextTick(this._dragStartId);
2200
+
2201
+ // Unbind events
2202
+ if (this.nativeDraggable) {
2203
+ off(document, 'drop', this);
2204
+ off(el, 'dragstart', this._onDragStart);
2205
+ }
2206
+ this._offMoveEvents();
2207
+ this._offUpEvents();
2208
+ if (Safari) {
2209
+ css(document.body, 'user-select', '');
2210
+ }
2211
+ css(dragEl, 'transform', '');
2212
+ if (evt) {
2213
+ if (moved) {
2214
+ evt.cancelable && evt.preventDefault();
2215
+ !options.dropBubble && evt.stopPropagation();
2216
+ }
2217
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
2218
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
2219
+ // Remove clone(s)
2220
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
2221
+ }
2222
+ if (dragEl) {
2223
+ if (this.nativeDraggable) {
2224
+ off(dragEl, 'dragend', this);
2225
+ }
2226
+ _disableDraggable(dragEl);
2227
+ dragEl.style['will-change'] = '';
2228
+
2229
+ // Remove classes
2230
+ // ghostClass is added in dragStarted
2231
+ if (moved && !awaitingDragStarted) {
2232
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
2233
+ }
2234
+ toggleClass(dragEl, this.options.chosenClass, false);
2235
+
2236
+ // Drag stop event
2237
+ _dispatchEvent({
2238
+ sortable: this,
2239
+ name: 'unchoose',
2240
+ toEl: parentEl,
2241
+ newIndex: null,
2242
+ newDraggableIndex: null,
2243
+ originalEvent: evt
2244
+ });
2245
+ if (rootEl !== parentEl) {
2246
+ if (newIndex >= 0) {
2247
+ // Add event
2248
+ _dispatchEvent({
2249
+ rootEl: parentEl,
2250
+ name: 'add',
2251
+ toEl: parentEl,
2252
+ fromEl: rootEl,
2253
+ originalEvent: evt
2254
+ });
2255
+
2256
+ // Remove event
2257
+ _dispatchEvent({
2258
+ sortable: this,
2259
+ name: 'remove',
2260
+ toEl: parentEl,
2261
+ originalEvent: evt
2262
+ });
2263
+
2264
+ // drag from one list and drop into another
2265
+ _dispatchEvent({
2266
+ rootEl: parentEl,
2267
+ name: 'sort',
2268
+ toEl: parentEl,
2269
+ fromEl: rootEl,
2270
+ originalEvent: evt
2271
+ });
2272
+ _dispatchEvent({
2273
+ sortable: this,
2274
+ name: 'sort',
2275
+ toEl: parentEl,
2276
+ originalEvent: evt
2277
+ });
2278
+ }
2279
+ putSortable && putSortable.save();
2280
+ } else {
2281
+ if (newIndex !== oldIndex) {
2282
+ if (newIndex >= 0) {
2283
+ // drag & drop within the same list
2284
+ _dispatchEvent({
2285
+ sortable: this,
2286
+ name: 'update',
2287
+ toEl: parentEl,
2288
+ originalEvent: evt
2289
+ });
2290
+ _dispatchEvent({
2291
+ sortable: this,
2292
+ name: 'sort',
2293
+ toEl: parentEl,
2294
+ originalEvent: evt
2295
+ });
2296
+ }
2297
+ }
2298
+ }
2299
+ if (Sortable.active) {
2300
+ /* jshint eqnull:true */
2301
+ if (newIndex == null || newIndex === -1) {
2302
+ newIndex = oldIndex;
2303
+ newDraggableIndex = oldDraggableIndex;
2304
+ }
2305
+ _dispatchEvent({
2306
+ sortable: this,
2307
+ name: 'end',
2308
+ toEl: parentEl,
2309
+ originalEvent: evt
2310
+ });
2311
+
2312
+ // Save sorting
2313
+ this.save();
2314
+ }
2315
+ }
2316
+ }
2317
+ this._nulling();
2318
+ },
2319
+ _nulling: function _nulling() {
2320
+ pluginEvent('nulling', this);
2321
+ 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;
2322
+ var el = this.el;
2323
+ savedInputChecked.forEach(function (checkEl) {
2324
+ if (el.contains(checkEl)) {
2325
+ checkEl.checked = true;
2326
+ }
2327
+ });
2328
+ savedInputChecked.length = lastDx = lastDy = 0;
2329
+ },
2330
+ handleEvent: function handleEvent( /**Event*/evt) {
2331
+ switch (evt.type) {
2332
+ case 'drop':
2333
+ case 'dragend':
2334
+ this._onDrop(evt);
2335
+ break;
2336
+ case 'dragenter':
2337
+ case 'dragover':
2338
+ if (dragEl) {
2339
+ this._onDragOver(evt);
2340
+ _globalDragOver(evt);
2341
+ }
2342
+ break;
2343
+ case 'selectstart':
2344
+ evt.preventDefault();
2345
+ break;
2346
+ }
2347
+ },
2348
+ /**
2349
+ * Serializes the item into an array of string.
2350
+ * @returns {String[]}
2351
+ */
2352
+ toArray: function toArray() {
2353
+ var order = [],
2354
+ el,
2355
+ children = this.el.children,
2356
+ i = 0,
2357
+ n = children.length,
2358
+ options = this.options;
2359
+ for (; i < n; i++) {
2360
+ el = children[i];
2361
+ if (closest(el, options.draggable, this.el, false)) {
2362
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
2363
+ }
2364
+ }
2365
+ return order;
2366
+ },
2367
+ /**
2368
+ * Sorts the elements according to the array.
2369
+ * @param {String[]} order order of the items
2370
+ */
2371
+ sort: function sort(order, useAnimation) {
2372
+ var items = {},
2373
+ rootEl = this.el;
2374
+ this.toArray().forEach(function (id, i) {
2375
+ var el = rootEl.children[i];
2376
+ if (closest(el, this.options.draggable, rootEl, false)) {
2377
+ items[id] = el;
2378
+ }
2379
+ }, this);
2380
+ useAnimation && this.captureAnimationState();
2381
+ order.forEach(function (id) {
2382
+ if (items[id]) {
2383
+ rootEl.removeChild(items[id]);
2384
+ rootEl.appendChild(items[id]);
2385
+ }
2386
+ });
2387
+ useAnimation && this.animateAll();
2388
+ },
2389
+ /**
2390
+ * Save the current sorting
2391
+ */
2392
+ save: function save() {
2393
+ var store = this.options.store;
2394
+ store && store.set && store.set(this);
2395
+ },
2396
+ /**
2397
+ * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
2398
+ * @param {HTMLElement} el
2399
+ * @param {String} [selector] default: `options.draggable`
2400
+ * @returns {HTMLElement|null}
2401
+ */
2402
+ closest: function closest$1(el, selector) {
2403
+ return closest(el, selector || this.options.draggable, this.el, false);
2404
+ },
2405
+ /**
2406
+ * Set/get option
2407
+ * @param {string} name
2408
+ * @param {*} [value]
2409
+ * @returns {*}
2410
+ */
2411
+ option: function option(name, value) {
2412
+ var options = this.options;
2413
+ if (value === void 0) {
2414
+ return options[name];
2415
+ } else {
2416
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
2417
+ if (typeof modifiedValue !== 'undefined') {
2418
+ options[name] = modifiedValue;
2419
+ } else {
2420
+ options[name] = value;
2421
+ }
2422
+ if (name === 'group') {
2423
+ _prepareGroup(options);
2424
+ }
2425
+ }
2426
+ },
2427
+ /**
2428
+ * Destroy
2429
+ */
2430
+ destroy: function destroy() {
2431
+ pluginEvent('destroy', this);
2432
+ var el = this.el;
2433
+ el[expando] = null;
2434
+ off(el, 'mousedown', this._onTapStart);
2435
+ off(el, 'touchstart', this._onTapStart);
2436
+ off(el, 'pointerdown', this._onTapStart);
2437
+ if (this.nativeDraggable) {
2438
+ off(el, 'dragover', this);
2439
+ off(el, 'dragenter', this);
2440
+ }
2441
+ // Remove draggable attributes
2442
+ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
2443
+ el.removeAttribute('draggable');
2444
+ });
2445
+ this._onDrop();
2446
+ this._disableDelayedDragEvents();
2447
+ sortables.splice(sortables.indexOf(this.el), 1);
2448
+ this.el = el = null;
2449
+ },
2450
+ _hideClone: function _hideClone() {
2451
+ if (!cloneHidden) {
2452
+ pluginEvent('hideClone', this);
2453
+ if (Sortable.eventCanceled) return;
2454
+ css(cloneEl, 'display', 'none');
2455
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
2456
+ cloneEl.parentNode.removeChild(cloneEl);
2457
+ }
2458
+ cloneHidden = true;
2459
+ }
2460
+ },
2461
+ _showClone: function _showClone(putSortable) {
2462
+ if (putSortable.lastPutMode !== 'clone') {
2463
+ this._hideClone();
2464
+ return;
2465
+ }
2466
+ if (cloneHidden) {
2467
+ pluginEvent('showClone', this);
2468
+ if (Sortable.eventCanceled) return;
2469
+
2470
+ // show clone at dragEl or original position
2471
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
2472
+ rootEl.insertBefore(cloneEl, dragEl);
2473
+ } else if (nextEl) {
2474
+ rootEl.insertBefore(cloneEl, nextEl);
2475
+ } else {
2476
+ rootEl.appendChild(cloneEl);
2477
+ }
2478
+ if (this.options.group.revertClone) {
2479
+ this.animate(dragEl, cloneEl);
2480
+ }
2481
+ css(cloneEl, 'display', '');
2482
+ cloneHidden = false;
2483
+ }
2484
+ }
2485
+ };
2486
+ function _globalDragOver( /**Event*/evt) {
2487
+ if (evt.dataTransfer) {
2488
+ evt.dataTransfer.dropEffect = 'move';
2489
+ }
2490
+ evt.cancelable && evt.preventDefault();
2491
+ }
2492
+ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
2493
+ var evt,
2494
+ sortable = fromEl[expando],
2495
+ onMoveFn = sortable.options.onMove,
2496
+ retVal;
2497
+ // Support for new CustomEvent feature
2498
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
2499
+ evt = new CustomEvent('move', {
2500
+ bubbles: true,
2501
+ cancelable: true
2502
+ });
2503
+ } else {
2504
+ evt = document.createEvent('Event');
2505
+ evt.initEvent('move', true, true);
2506
+ }
2507
+ evt.to = toEl;
2508
+ evt.from = fromEl;
2509
+ evt.dragged = dragEl;
2510
+ evt.draggedRect = dragRect;
2511
+ evt.related = targetEl || toEl;
2512
+ evt.relatedRect = targetRect || getRect(toEl);
2513
+ evt.willInsertAfter = willInsertAfter;
2514
+ evt.originalEvent = originalEvent;
2515
+ fromEl.dispatchEvent(evt);
2516
+ if (onMoveFn) {
2517
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
2518
+ }
2519
+ return retVal;
2520
+ }
2521
+ function _disableDraggable(el) {
2522
+ el.draggable = false;
2523
+ }
2524
+ function _unsilent() {
2525
+ _silent = false;
2526
+ }
2527
+ function _ghostIsFirst(evt, vertical, sortable) {
2528
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
2529
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
2530
+ var spacer = 10;
2531
+ 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;
2532
+ }
2533
+ function _ghostIsLast(evt, vertical, sortable) {
2534
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
2535
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
2536
+ var spacer = 10;
2537
+ 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;
2538
+ }
2539
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
2540
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
2541
+ targetLength = vertical ? targetRect.height : targetRect.width,
2542
+ targetS1 = vertical ? targetRect.top : targetRect.left,
2543
+ targetS2 = vertical ? targetRect.bottom : targetRect.right,
2544
+ invert = false;
2545
+ if (!invertSwap) {
2546
+ // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
2547
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
2548
+ // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
2549
+ // check if past first invert threshold on side opposite of lastDirection
2550
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
2551
+ // past first invert threshold, do not restrict inverted threshold to dragEl shadow
2552
+ pastFirstInvertThresh = true;
2553
+ }
2554
+ if (!pastFirstInvertThresh) {
2555
+ // dragEl shadow (target move distance shadow)
2556
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
2557
+ : mouseOnAxis > targetS2 - targetMoveDistance) {
2558
+ return -lastDirection;
2559
+ }
2560
+ } else {
2561
+ invert = true;
2562
+ }
2563
+ } else {
2564
+ // Regular
2565
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
2566
+ return _getInsertDirection(target);
2567
+ }
2568
+ }
2569
+ }
2570
+ invert = invert || invertSwap;
2571
+ if (invert) {
2572
+ // Invert of regular
2573
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
2574
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
2575
+ }
2576
+ }
2577
+ return 0;
2578
+ }
2579
+
2580
+ /**
2581
+ * Gets the direction dragEl must be swapped relative to target in order to make it
2582
+ * seem that dragEl has been "inserted" into that element's position
2583
+ * @param {HTMLElement} target The target whose position dragEl is being inserted at
2584
+ * @return {Number} Direction dragEl must be swapped
2585
+ */
2586
+ function _getInsertDirection(target) {
2587
+ if (index(dragEl) < index(target)) {
2588
+ return 1;
2589
+ } else {
2590
+ return -1;
2591
+ }
2592
+ }
2593
+
2594
+ /**
2595
+ * Generate id
2596
+ * @param {HTMLElement} el
2597
+ * @returns {String}
2598
+ * @private
2599
+ */
2600
+ function _generateId(el) {
2601
+ var str = el.tagName + el.className + el.src + el.href + el.textContent,
2602
+ i = str.length,
2603
+ sum = 0;
2604
+ while (i--) {
2605
+ sum += str.charCodeAt(i);
2606
+ }
2607
+ return sum.toString(36);
2608
+ }
2609
+ function _saveInputCheckedState(root) {
2610
+ savedInputChecked.length = 0;
2611
+ var inputs = root.getElementsByTagName('input');
2612
+ var idx = inputs.length;
2613
+ while (idx--) {
2614
+ var el = inputs[idx];
2615
+ el.checked && savedInputChecked.push(el);
2616
+ }
2617
+ }
2618
+ function _nextTick(fn) {
2619
+ return setTimeout(fn, 0);
2620
+ }
2621
+ function _cancelNextTick(id) {
2622
+ return clearTimeout(id);
2623
+ }
2624
+
2625
+ // Fixed #973:
2626
+ if (documentExists) {
2627
+ on(document, 'touchmove', function (evt) {
2628
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2629
+ evt.preventDefault();
2630
+ }
2631
+ });
2632
+ }
2633
+
2634
+ // Export utils
2635
+ Sortable.utils = {
2636
+ on: on,
2637
+ off: off,
2638
+ css: css,
2639
+ find: find,
2640
+ is: function is(el, selector) {
2641
+ return !!closest(el, selector, el, false);
2642
+ },
2643
+ extend: extend,
2644
+ throttle: throttle,
2645
+ closest: closest,
2646
+ toggleClass: toggleClass,
2647
+ clone: clone,
2648
+ index: index,
2649
+ nextTick: _nextTick,
2650
+ cancelNextTick: _cancelNextTick,
2651
+ detectDirection: _detectDirection,
2652
+ getChild: getChild,
2653
+ expando: expando
2654
+ };
2655
+
2656
+ /**
2657
+ * Get the Sortable instance of an element
2658
+ * @param {HTMLElement} element The element
2659
+ * @return {Sortable|undefined} The instance of Sortable
2660
+ */
2661
+ Sortable.get = function (element) {
2662
+ return element[expando];
2663
+ };
2664
+
2665
+ /**
2666
+ * Mount a plugin to Sortable
2667
+ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
2668
+ */
2669
+ Sortable.mount = function () {
2670
+ for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
2671
+ plugins[_key] = arguments[_key];
2672
+ }
2673
+ if (plugins[0].constructor === Array) plugins = plugins[0];
2674
+ plugins.forEach(function (plugin) {
2675
+ if (!plugin.prototype || !plugin.prototype.constructor) {
2676
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
2677
+ }
2678
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
2679
+ PluginManager.mount(plugin);
2680
+ });
2681
+ };
2682
+
2683
+ /**
2684
+ * Create sortable instance
2685
+ * @param {HTMLElement} el
2686
+ * @param {Object} [options]
2687
+ */
2688
+ Sortable.create = function (el, options) {
2689
+ return new Sortable(el, options);
2690
+ };
2691
+
2692
+ // Export
2693
+ Sortable.version = version;
2694
+
2695
+ var autoScrolls = [],
2696
+ scrollEl,
2697
+ scrollRootEl,
2698
+ scrolling = false,
2699
+ lastAutoScrollX,
2700
+ lastAutoScrollY,
2701
+ touchEvt$1,
2702
+ pointerElemChangedInterval;
2703
+ function AutoScrollPlugin() {
2704
+ function AutoScroll() {
2705
+ this.defaults = {
2706
+ scroll: true,
2707
+ forceAutoScrollFallback: false,
2708
+ scrollSensitivity: 30,
2709
+ scrollSpeed: 10,
2710
+ bubbleScroll: true
2711
+ };
2712
+
2713
+ // Bind all private methods
2714
+ for (var fn in this) {
2715
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
2716
+ this[fn] = this[fn].bind(this);
2717
+ }
2718
+ }
2719
+ }
2720
+ AutoScroll.prototype = {
2721
+ dragStarted: function dragStarted(_ref) {
2722
+ var originalEvent = _ref.originalEvent;
2723
+ if (this.sortable.nativeDraggable) {
2724
+ on(document, 'dragover', this._handleAutoScroll);
2725
+ } else {
2726
+ if (this.options.supportPointer) {
2727
+ on(document, 'pointermove', this._handleFallbackAutoScroll);
2728
+ } else if (originalEvent.touches) {
2729
+ on(document, 'touchmove', this._handleFallbackAutoScroll);
2730
+ } else {
2731
+ on(document, 'mousemove', this._handleFallbackAutoScroll);
2732
+ }
2733
+ }
2734
+ },
2735
+ dragOverCompleted: function dragOverCompleted(_ref2) {
2736
+ var originalEvent = _ref2.originalEvent;
2737
+ // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
2738
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
2739
+ this._handleAutoScroll(originalEvent);
2740
+ }
2741
+ },
2742
+ drop: function drop() {
2743
+ if (this.sortable.nativeDraggable) {
2744
+ off(document, 'dragover', this._handleAutoScroll);
2745
+ } else {
2746
+ off(document, 'pointermove', this._handleFallbackAutoScroll);
2747
+ off(document, 'touchmove', this._handleFallbackAutoScroll);
2748
+ off(document, 'mousemove', this._handleFallbackAutoScroll);
2749
+ }
2750
+ clearPointerElemChangedInterval();
2751
+ clearAutoScrolls();
2752
+ cancelThrottle();
2753
+ },
2754
+ nulling: function nulling() {
2755
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
2756
+ autoScrolls.length = 0;
2757
+ },
2758
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
2759
+ this._handleAutoScroll(evt, true);
2760
+ },
2761
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
2762
+ var _this = this;
2763
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2764
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2765
+ elem = document.elementFromPoint(x, y);
2766
+ touchEvt$1 = evt;
2767
+
2768
+ // IE does not seem to have native autoscroll,
2769
+ // Edge's autoscroll seems too conditional,
2770
+ // MACOS Safari does not have autoscroll,
2771
+ // Firefox and Chrome are good
2772
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
2773
+ autoScroll(evt, this.options, elem, fallback);
2774
+
2775
+ // Listener for pointer element change
2776
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
2777
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
2778
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
2779
+ // Detect for pointer elem change, emulating native DnD behaviour
2780
+ pointerElemChangedInterval = setInterval(function () {
2781
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
2782
+ if (newElem !== ogElemScroller) {
2783
+ ogElemScroller = newElem;
2784
+ clearAutoScrolls();
2785
+ }
2786
+ autoScroll(evt, _this.options, newElem, fallback);
2787
+ }, 10);
2788
+ lastAutoScrollX = x;
2789
+ lastAutoScrollY = y;
2790
+ }
2791
+ } else {
2792
+ // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
2793
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
2794
+ clearAutoScrolls();
2795
+ return;
2796
+ }
2797
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
2798
+ }
2799
+ }
2800
+ };
2801
+ return _extends(AutoScroll, {
2802
+ pluginName: 'scroll',
2803
+ initializeByDefault: true
2804
+ });
2805
+ }
2806
+ function clearAutoScrolls() {
2807
+ autoScrolls.forEach(function (autoScroll) {
2808
+ clearInterval(autoScroll.pid);
2809
+ });
2810
+ autoScrolls = [];
2811
+ }
2812
+ function clearPointerElemChangedInterval() {
2813
+ clearInterval(pointerElemChangedInterval);
2814
+ }
2815
+ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
2816
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
2817
+ if (!options.scroll) return;
2818
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2819
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2820
+ sens = options.scrollSensitivity,
2821
+ speed = options.scrollSpeed,
2822
+ winScroller = getWindowScrollingElement();
2823
+ var scrollThisInstance = false,
2824
+ scrollCustomFn;
2825
+
2826
+ // New scroll root, set scrollEl
2827
+ if (scrollRootEl !== rootEl) {
2828
+ scrollRootEl = rootEl;
2829
+ clearAutoScrolls();
2830
+ scrollEl = options.scroll;
2831
+ scrollCustomFn = options.scrollFn;
2832
+ if (scrollEl === true) {
2833
+ scrollEl = getParentAutoScrollElement(rootEl, true);
2834
+ }
2835
+ }
2836
+ var layersOut = 0;
2837
+ var currentParent = scrollEl;
2838
+ do {
2839
+ var el = currentParent,
2840
+ rect = getRect(el),
2841
+ top = rect.top,
2842
+ bottom = rect.bottom,
2843
+ left = rect.left,
2844
+ right = rect.right,
2845
+ width = rect.width,
2846
+ height = rect.height,
2847
+ canScrollX = void 0,
2848
+ canScrollY = void 0,
2849
+ scrollWidth = el.scrollWidth,
2850
+ scrollHeight = el.scrollHeight,
2851
+ elCSS = css(el),
2852
+ scrollPosX = el.scrollLeft,
2853
+ scrollPosY = el.scrollTop;
2854
+ if (el === winScroller) {
2855
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
2856
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
2857
+ } else {
2858
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
2859
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
2860
+ }
2861
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
2862
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
2863
+ if (!autoScrolls[layersOut]) {
2864
+ for (var i = 0; i <= layersOut; i++) {
2865
+ if (!autoScrolls[i]) {
2866
+ autoScrolls[i] = {};
2867
+ }
2868
+ }
2869
+ }
2870
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
2871
+ autoScrolls[layersOut].el = el;
2872
+ autoScrolls[layersOut].vx = vx;
2873
+ autoScrolls[layersOut].vy = vy;
2874
+ clearInterval(autoScrolls[layersOut].pid);
2875
+ if (vx != 0 || vy != 0) {
2876
+ scrollThisInstance = true;
2877
+ /* jshint loopfunc:true */
2878
+ autoScrolls[layersOut].pid = setInterval(function () {
2879
+ // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
2880
+ if (isFallback && this.layer === 0) {
2881
+ Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
2882
+ }
2883
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
2884
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
2885
+ if (typeof scrollCustomFn === 'function') {
2886
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
2887
+ return;
2888
+ }
2889
+ }
2890
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2891
+ }.bind({
2892
+ layer: layersOut
2893
+ }), 24);
2894
+ }
2895
+ }
2896
+ layersOut++;
2897
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
2898
+ scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
2899
+ }, 30);
2900
+
2901
+ var drop = function drop(_ref) {
2902
+ var originalEvent = _ref.originalEvent,
2903
+ putSortable = _ref.putSortable,
2904
+ dragEl = _ref.dragEl,
2905
+ activeSortable = _ref.activeSortable,
2906
+ dispatchSortableEvent = _ref.dispatchSortableEvent,
2907
+ hideGhostForTarget = _ref.hideGhostForTarget,
2908
+ unhideGhostForTarget = _ref.unhideGhostForTarget;
2909
+ if (!originalEvent) return;
2910
+ var toSortable = putSortable || activeSortable;
2911
+ hideGhostForTarget();
2912
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
2913
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
2914
+ unhideGhostForTarget();
2915
+ if (toSortable && !toSortable.el.contains(target)) {
2916
+ dispatchSortableEvent('spill');
2917
+ this.onSpill({
2918
+ dragEl: dragEl,
2919
+ putSortable: putSortable
2920
+ });
2921
+ }
2922
+ };
2923
+ function Revert() {}
2924
+ Revert.prototype = {
2925
+ startIndex: null,
2926
+ dragStart: function dragStart(_ref2) {
2927
+ var oldDraggableIndex = _ref2.oldDraggableIndex;
2928
+ this.startIndex = oldDraggableIndex;
2929
+ },
2930
+ onSpill: function onSpill(_ref3) {
2931
+ var dragEl = _ref3.dragEl,
2932
+ putSortable = _ref3.putSortable;
2933
+ this.sortable.captureAnimationState();
2934
+ if (putSortable) {
2935
+ putSortable.captureAnimationState();
2936
+ }
2937
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
2938
+ if (nextSibling) {
2939
+ this.sortable.el.insertBefore(dragEl, nextSibling);
2940
+ } else {
2941
+ this.sortable.el.appendChild(dragEl);
2942
+ }
2943
+ this.sortable.animateAll();
2944
+ if (putSortable) {
2945
+ putSortable.animateAll();
2946
+ }
2947
+ },
2948
+ drop: drop
2949
+ };
2950
+ _extends(Revert, {
2951
+ pluginName: 'revertOnSpill'
2952
+ });
2953
+ function Remove() {}
2954
+ Remove.prototype = {
2955
+ onSpill: function onSpill(_ref4) {
2956
+ var dragEl = _ref4.dragEl,
2957
+ putSortable = _ref4.putSortable;
2958
+ var parentSortable = putSortable || this.sortable;
2959
+ parentSortable.captureAnimationState();
2960
+ dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
2961
+ parentSortable.animateAll();
2962
+ },
2963
+ drop: drop
2964
+ };
2965
+ _extends(Remove, {
2966
+ pluginName: 'removeOnSpill'
2967
+ });
2968
+
2969
+ Sortable.mount(new AutoScrollPlugin());
2970
+ Sortable.mount(Remove, Revert);
2971
+
2972
+ const DRAG_HANDLE_SELECTOR = '[data-drag-handle]';
2973
+ const DRAGGING_CONTAINER_CLASS = 'has-an-item-which-is-being-dragged';
2974
+ const ELEVATED_ITEM_CLASS = 'is-elevated';
2975
+ const ELEVATION_DURATION_MS = 1000;
2976
+ const TOUCH_DRAG_DELAY_MS = 200;
2977
+ const ANIMATION_DURATION_MS = 150;
2978
+ /**
2979
+ * Lets the user reorder the children of a list with a drag handle.
2980
+ *
2981
+ * Every child of the list has a `data-reorder-id`, and the drag starts from
2982
+ * an element with the `data-drag-handle` attribute inside a child.
2983
+ */
2984
+ class DragToReorder {
2985
+ constructor(options) {
2986
+ this.options = options;
2987
+ this.orderBeforeDrag = [];
2988
+ this.handleStart = (event) => {
2989
+ var _a, _b;
2990
+ this.orderBeforeDrag = this.readOrder();
2991
+ this.nextSiblingBeforeDrag = (_a = event.item.nextElementSibling) !== null && _a !== void 0 ? _a : undefined;
2992
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.classList.add(DRAGGING_CONTAINER_CLASS);
2993
+ this.elevate(event.item);
2994
+ };
2995
+ this.handleEnd = (event) => {
2996
+ var _a;
2997
+ (_a = this.container) === null || _a === void 0 ? void 0 : _a.classList.remove(DRAGGING_CONTAINER_CLASS);
2998
+ this.keepElevatedBriefly(event.item);
2999
+ const order = this.readOrder();
3000
+ const id = event.item.dataset.reorderId;
3001
+ const fromIndex = this.orderBeforeDrag.indexOf(id);
3002
+ const toIndex = order.indexOf(id);
3003
+ const nextSibling = this.nextSiblingBeforeDrag;
3004
+ this.orderBeforeDrag = [];
3005
+ this.nextSiblingBeforeDrag = undefined;
3006
+ if (fromIndex === -1 || toIndex === -1 || fromIndex === toIndex) {
3007
+ return;
3008
+ }
3009
+ if (this.options.revertDrop) {
3010
+ this.putBack(event.item, nextSibling);
3011
+ }
3012
+ this.options.onReorder({ order, fromIndex, toIndex });
3013
+ };
3014
+ }
3015
+ /**
3016
+ * @param container - the list
3017
+ * @param direction - the way the children are laid out. Leave it out to
3018
+ * let SortableJS find out. Setting up the same list again without it keeps
3019
+ * the direction that the list has.
3020
+ */
3021
+ setup(container, direction) {
3022
+ if (this.getDraggableItems(container).length < 2) {
3023
+ this.teardown();
3024
+ return;
3025
+ }
3026
+ if (this.sortable && this.container === container) {
3027
+ this.changeDirection(direction);
3028
+ return;
3029
+ }
3030
+ this.teardown();
3031
+ this.container = container;
3032
+ this.direction = direction;
3033
+ this.sortable = Sortable.create(container, Object.assign(Object.assign({ animation: ANIMATION_DURATION_MS, handle: DRAG_HANDLE_SELECTOR, draggable: this.options.draggable, delay: TOUCH_DRAG_DELAY_MS, delayOnTouchOnly: true }, (direction && { direction: direction })), { onStart: this.handleStart, onEnd: this.handleEnd }));
3034
+ }
3035
+ teardown() {
3036
+ var _a, _b;
3037
+ (_a = this.sortable) === null || _a === void 0 ? void 0 : _a.destroy();
3038
+ this.sortable = undefined;
3039
+ this.removeElevation();
3040
+ (_b = this.container) === null || _b === void 0 ? void 0 : _b.classList.remove(DRAGGING_CONTAINER_CLASS);
3041
+ this.container = undefined;
3042
+ this.direction = undefined;
3043
+ this.orderBeforeDrag = [];
3044
+ this.nextSiblingBeforeDrag = undefined;
3045
+ }
3046
+ putBack(item, nextSibling) {
3047
+ const isStillInList = (nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.parentNode) === this.container;
3048
+ this.container.insertBefore(item, isStillInList ? nextSibling : null);
3049
+ }
3050
+ changeDirection(direction) {
3051
+ if (!direction || direction === this.direction) {
3052
+ return;
3053
+ }
3054
+ this.direction = direction;
3055
+ this.sortable.option('direction', direction);
3056
+ }
3057
+ getDraggableItems(container) {
3058
+ return [...container.children].filter((child) => child.matches(this.options.draggable));
3059
+ }
3060
+ readOrder() {
3061
+ var _a, _b;
3062
+ const children = [...((_b = (_a = this.container) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [])];
3063
+ return children
3064
+ .filter((child) => {
3065
+ return (child instanceof HTMLElement &&
3066
+ child.dataset.reorderId !== undefined);
3067
+ })
3068
+ .map((child) => child.dataset.reorderId);
3069
+ }
3070
+ elevate(item) {
3071
+ this.removeElevation();
3072
+ item.classList.add(ELEVATED_ITEM_CLASS);
3073
+ this.elevatedItem = item;
3074
+ }
3075
+ keepElevatedBriefly(item) {
3076
+ this.elevate(item);
3077
+ this.elevationTimeout = setTimeout(() => this.removeElevation(), ELEVATION_DURATION_MS);
3078
+ }
3079
+ removeElevation() {
3080
+ var _a;
3081
+ clearTimeout(this.elevationTimeout);
3082
+ this.elevationTimeout = undefined;
3083
+ (_a = this.elevatedItem) === null || _a === void 0 ? void 0 : _a.classList.remove(ELEVATED_ITEM_CLASS);
3084
+ this.elevatedItem = undefined;
3085
+ }
3086
+ }
3087
+
3088
+ exports.DragToReorder = DragToReorder;
3089
+ exports.arrayIncludes = arrayIncludes;
3090
+ exports.baseFlatten = baseFlatten;
3091
+ exports.baseRest = baseRest;
3092
+ exports.isArrayLikeObject = isArrayLikeObject;