@sankhyalabs/sankhyablocks 8.16.0-ms.10 → 8.16.0-ms.12

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 (476) hide show
  1. package/dist/cjs/{ClientSideExporterProvider-fe52f7cf.js → ClientSideExporterProvider-0ce2bcd9.js} +23 -28
  2. package/dist/cjs/{ConfigStorage-6b633b10.js → ConfigStorage-48ba265b.js} +47 -19
  3. package/dist/cjs/{DataFetcher-875371e9.js → DataFetcher-1afdb18e.js} +14 -2
  4. package/dist/cjs/FormConfigHelper-c664dbae.js +260 -0
  5. package/dist/cjs/{pesquisa-fetcher-30cab386.js → ISave-c76e2c51.js} +35 -3
  6. package/dist/cjs/{PersonalizedFilterUtils-0184ffbb.js → PersonalizedFilterUtils-7259cf65.js} +1 -1
  7. package/dist/cjs/{SnkFormConfigManager-d680be08.js → SnkFormConfigManager-aa4631bd.js} +4 -5
  8. package/dist/cjs/{SnkMessageBuilder-bae64d0d.js → SnkMessageBuilder-e3b7850b.js} +63 -30
  9. package/dist/cjs/{auth-fetcher-24ba4135.js → auth-fetcher-1687ac0a.js} +1 -1
  10. package/dist/cjs/config-header.cjs.entry.js +79 -0
  11. package/dist/cjs/configs-button.cjs.entry.js +61 -0
  12. package/dist/cjs/{constants-241934b3.js → constants-6d82e405.js} +9 -38
  13. package/dist/cjs/{dataunit-fetcher-b95768e8.js → dataunit-fetcher-a723f0dc.js} +12 -8
  14. package/dist/cjs/default-filters-a09bf82b.js +8 -0
  15. package/dist/cjs/field-config_2.cjs.entry.js +324 -0
  16. package/dist/cjs/fields-layout.cjs.entry.js +341 -0
  17. package/dist/cjs/fields-selector.cjs.entry.js +74 -0
  18. package/dist/cjs/{filter-type.enum-b14ce507.js → filter-type.enum-2bb46d2a.js} +1 -0
  19. package/dist/cjs/{form-config-fetcher-e0a512c3.js → form-config-fetcher-40d3f752.js} +15 -1
  20. package/dist/cjs/guides-configurator.cjs.entry.js +164 -0
  21. package/dist/cjs/{index-ab1cfb44.js → index-0ad2baeb.js} +1 -1
  22. package/dist/cjs/{index-f9e81701.js → index-1cf293c1.js} +34 -12
  23. package/dist/cjs/{index-c5771aba.js → index-62760a9c.js} +5 -0
  24. package/dist/cjs/loader.cjs.js +2 -2
  25. package/dist/cjs/pesquisa-grid_2.cjs.entry.js +7 -8
  26. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  27. package/dist/cjs/{snk-actions-button_5.cjs.entry.js → snk-actions-button_8.cjs.entry.js} +132 -10
  28. package/dist/cjs/snk-actions-form.cjs.entry.js +1 -1
  29. package/dist/cjs/snk-application.cjs.entry.js +185 -24
  30. package/dist/cjs/snk-attach.cjs.entry.js +9 -10
  31. package/dist/cjs/snk-client-confirm.cjs.entry.js +1 -1
  32. package/dist/cjs/snk-configurator.cjs.entry.js +10 -3
  33. package/dist/cjs/snk-crud.cjs.entry.js +48 -76
  34. package/dist/cjs/snk-custom-slot-elements.cjs.entry.js +1 -1
  35. package/dist/cjs/snk-data-exporter.cjs.entry.js +8 -9
  36. package/dist/cjs/{snk-data-unit-33937ffe.js → snk-data-unit-3684c96e.js} +227 -13
  37. package/dist/cjs/snk-data-unit.cjs.entry.js +5 -5
  38. package/dist/cjs/snk-default-filter.cjs.entry.js +77 -0
  39. package/dist/cjs/snk-detail-view.cjs.entry.js +68 -16
  40. package/dist/cjs/snk-entity-list.cjs.entry.js +3 -8
  41. package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
  42. package/dist/cjs/snk-expression-group_2.cjs.entry.js +10 -8
  43. package/dist/cjs/snk-filter-advanced-mode_2.cjs.entry.js +5 -4
  44. package/dist/cjs/snk-filter-bar_4.cjs.entry.js +85 -31
  45. package/dist/cjs/snk-filter-binary-select.cjs.entry.js +1 -1
  46. package/dist/cjs/snk-filter-checkbox-list.cjs.entry.js +1 -1
  47. package/dist/cjs/snk-filter-detail.cjs.entry.js +3 -3
  48. package/dist/cjs/snk-filter-field-search_2.cjs.entry.js +3 -3
  49. package/dist/cjs/snk-filter-modal-item.cjs.entry.js +5 -5
  50. package/dist/cjs/snk-filter-multi-select.cjs.entry.js +1 -1
  51. package/dist/cjs/snk-filter-number.cjs.entry.js +1 -1
  52. package/dist/cjs/snk-filter-period.cjs.entry.js +1 -1
  53. package/dist/cjs/snk-filter-search.cjs.entry.js +19 -6
  54. package/dist/cjs/snk-filter-text.cjs.entry.js +1 -1
  55. package/dist/cjs/snk-form-summary.cjs.entry.js +1 -1
  56. package/dist/cjs/snk-form-view.cjs.entry.js +20 -8
  57. package/dist/cjs/snk-form_2.cjs.entry.js +433 -0
  58. package/dist/cjs/snk-grid.cjs.entry.js +52 -39
  59. package/dist/cjs/{snk-guides-viewer-b6002ea7.js → snk-guides-viewer-edc0a00a.js} +139 -73
  60. package/dist/cjs/snk-guides-viewer.cjs.entry.js +13 -13
  61. package/dist/cjs/snk-personalized-filter-editor.cjs.entry.js +1 -1
  62. package/dist/cjs/snk-personalized-filter.cjs.entry.js +55 -20
  63. package/dist/cjs/snk-pesquisa.cjs.entry.js +14 -15
  64. package/dist/cjs/snk-print-selector.cjs.entry.js +1 -1
  65. package/dist/cjs/snk-simple-bar.cjs.entry.js +1 -1
  66. package/dist/cjs/snk-simple-crud.cjs.entry.js +148 -114
  67. package/dist/cjs/snk-taskbar.cjs.entry.js +10 -5
  68. package/dist/cjs/sortable.esm-9a110bb7.js +2668 -0
  69. package/dist/cjs/{taskbar-elements-ebddaef4.js → taskbar-elements-3b74cd21.js} +13 -2
  70. package/dist/cjs/{field-search-68e34bf4.js → taskbar-processor-2fba34a8.js} +0 -35
  71. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  72. package/dist/collection/collection-manifest.json +11 -14
  73. package/dist/collection/components/snk-application/errorhandler/snk-error-handler.js +5 -2
  74. package/dist/collection/components/snk-application/search-strategy/exec-prepared-search-plus.js +107 -0
  75. package/dist/collection/components/snk-application/snk-application.js +133 -13
  76. package/dist/collection/components/snk-configurator/snk-configurator.js +26 -1
  77. package/dist/collection/components/snk-crud/snk-crud.js +76 -67
  78. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.css +10 -1
  79. package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +82 -4
  80. package/dist/collection/components/snk-crud/subcomponents/snk-form-view.js +54 -7
  81. package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +152 -82
  82. package/dist/collection/components/snk-data-exporter/interfaces/IExporterProvider.js +15 -19
  83. package/dist/collection/components/snk-data-unit/MultipleUpdateHelper.js +128 -0
  84. package/dist/collection/components/snk-data-unit/snk-data-unit.js +107 -12
  85. package/dist/collection/components/snk-entity-list/snk-entity-list.js +2 -7
  86. package/dist/collection/components/snk-filter-bar/filter-item/dataunitfilter/data-unit-filter-builder.js +1 -1
  87. package/dist/collection/components/snk-filter-bar/filter-item/editors/snk-filter-search.js +18 -5
  88. package/dist/collection/components/snk-filter-bar/filter-modal/snk-filter-modal.js +80 -12
  89. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.css +34 -0
  90. package/dist/collection/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.js +142 -0
  91. package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +24 -15
  92. package/dist/collection/components/snk-filter-bar/types/default-filters.js +6 -0
  93. package/dist/collection/components/snk-filter-bar/types/filter-type.enum.js +1 -0
  94. package/dist/collection/components/snk-filter-bar/utils/SnkFilterModalFactory.js +4 -4
  95. package/dist/collection/components/snk-form-config/FormConfigHelper.js +245 -0
  96. package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +4 -5
  97. package/dist/collection/components/snk-form-config/config-header/config-header.css +18 -0
  98. package/dist/collection/components/snk-form-config/config-header/config-header.js +236 -0
  99. package/dist/collection/components/snk-form-config/config-header/configs-button/configs-button.css +41 -0
  100. package/dist/collection/components/snk-form-config/config-header/configs-button/configs-button.js +170 -0
  101. package/dist/collection/components/snk-form-config/field-item/field-config/field-config.css +21 -0
  102. package/dist/collection/components/snk-form-config/field-item/field-config/field-config.js +408 -0
  103. package/dist/collection/components/snk-form-config/field-item/field-item.css +108 -0
  104. package/dist/collection/components/snk-form-config/field-item/field-item.js +206 -0
  105. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.css +133 -0
  106. package/dist/collection/components/snk-form-config/fields-layout/fields-layout.js +578 -0
  107. package/dist/collection/components/snk-form-config/fields-selector/fields-selector.css +38 -0
  108. package/dist/collection/components/snk-form-config/fields-selector/fields-selector.js +146 -0
  109. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.css +132 -0
  110. package/dist/collection/components/snk-form-config/guides-configurator/guides-configurator.js +317 -0
  111. package/dist/collection/components/snk-form-config/snk-form-config.css +16 -229
  112. package/dist/collection/components/snk-form-config/snk-form-config.js +288 -980
  113. package/dist/collection/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.js +2 -2
  114. package/dist/collection/components/snk-grid/snk-grid.js +93 -42
  115. package/dist/collection/components/snk-grid-config/snk-grid-config.js +2 -0
  116. package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.css +3 -0
  117. package/dist/collection/components/snk-layout-form-config/snk-layout-form-config.js +73 -0
  118. package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.css +78 -0
  119. package/dist/collection/components/snk-layout-form-config/snk-view-representation/snk-view-representation.js +57 -0
  120. package/dist/collection/components/snk-personalized-filter/interfaces/index.js +5 -0
  121. package/dist/collection/components/snk-personalized-filter/snk-personalized-filter.js +67 -13
  122. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.css +3 -0
  123. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.js +20 -1
  124. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.js +22 -3
  125. package/dist/collection/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.js +20 -1
  126. package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +177 -104
  127. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.css +13 -0
  128. package/dist/collection/components/snk-taskbar/elements/taskbar-actions-button/taskbar-actions-button.js +1 -1
  129. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +11 -0
  130. package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.css +0 -0
  131. package/dist/collection/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.js +220 -0
  132. package/dist/collection/components/snk-taskbar/snk-taskbar.js +30 -4
  133. package/dist/collection/lib/configs/ConfigStorage.js +16 -8
  134. package/dist/collection/lib/configs/LayoutFormConfig.js +25 -0
  135. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +14 -2
  136. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.js +5 -2
  137. package/dist/collection/lib/http/data-fetcher/fetchers/data-unit/loadstrategy/DatasetStrategy.js +6 -5
  138. package/dist/collection/lib/http/data-fetcher/fetchers/form-config-fetcher.js +14 -0
  139. package/dist/collection/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.js +29 -9
  140. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +26 -2
  141. package/dist/collection/lib/message/SnkMessageBuilder.js +1 -0
  142. package/dist/collection/lib/message/resources/snk-crud.msg.js +1 -1
  143. package/dist/collection/lib/message/resources/snk-data-unit.msg.js +28 -23
  144. package/dist/collection/lib/message/resources/snk-filter-bar.msg.js +6 -0
  145. package/dist/collection/lib/message/resources/snk-form.msg.js +16 -2
  146. package/dist/collection/lib/message/resources/snk-grid.msg.js +1 -1
  147. package/dist/collection/lib/message/resources/snk-personalized-filter.msg.js +6 -1
  148. package/dist/collection/lib/message/resources/snk-simple-crud.msg.js +2 -1
  149. package/dist/collection/lib/message/resources/snk-taskbar.msg.js +1 -0
  150. package/dist/collection/lib/utils/constants.js +8 -1
  151. package/dist/components/ConfigStorage.js +45 -17
  152. package/dist/components/ContinuousInsertUtils.js +19 -54
  153. package/dist/components/DataFetcher.js +14 -2
  154. package/dist/components/ISave.js +26 -2
  155. package/dist/components/PersonalizedFilterUtils.js +6 -1
  156. package/dist/components/SnkFormConfigManager.js +2 -3
  157. package/dist/components/SnkMessageBuilder.js +63 -30
  158. package/dist/components/{snk-tab-config.d.ts → config-header.d.ts} +4 -4
  159. package/dist/components/config-header.js +6 -0
  160. package/dist/components/config-header2.js +103 -0
  161. package/dist/components/configs-button.d.ts +11 -0
  162. package/dist/components/configs-button.js +6 -0
  163. package/dist/components/configs-button2.js +76 -0
  164. package/dist/components/constants.js +9 -34
  165. package/dist/components/dataunit-fetcher.js +11 -7
  166. package/dist/components/field-config.d.ts +11 -0
  167. package/dist/components/field-config.js +6 -0
  168. package/dist/components/field-config2.js +525 -0
  169. package/dist/components/field-item.d.ts +11 -0
  170. package/dist/components/field-item.js +6 -0
  171. package/dist/components/field-item2.js +93 -0
  172. package/dist/components/fields-layout.d.ts +11 -0
  173. package/dist/components/fields-layout.js +6 -0
  174. package/dist/components/fields-layout2.js +370 -0
  175. package/dist/components/{snk-field-config.d.ts → fields-selector.d.ts} +4 -4
  176. package/dist/components/fields-selector.js +6 -0
  177. package/dist/components/fields-selector2.js +98 -0
  178. package/dist/components/form-config-fetcher.js +14 -0
  179. package/dist/components/guides-configurator.d.ts +11 -0
  180. package/dist/components/guides-configurator.js +6 -0
  181. package/dist/components/guides-configurator2.js +182 -0
  182. package/dist/components/index.d.ts +11 -3
  183. package/dist/components/index.js +11 -3
  184. package/dist/components/snk-application2.js +182 -16
  185. package/dist/components/snk-attach2.js +42 -24
  186. package/dist/components/snk-configurator2.js +22 -2
  187. package/dist/components/snk-crud.js +145 -128
  188. package/dist/components/snk-data-unit2.js +225 -11
  189. package/dist/components/{snk-config-options.d.ts → snk-default-filter.d.ts} +4 -4
  190. package/dist/components/snk-default-filter.js +6 -0
  191. package/dist/components/snk-default-filter2.js +97 -0
  192. package/dist/components/snk-detail-view2.js +331 -152
  193. package/dist/components/snk-entity-list.js +2 -7
  194. package/dist/components/snk-expression-group2.js +4 -2
  195. package/dist/components/snk-expression-item2.js +5 -3
  196. package/dist/components/snk-filter-assistent-mode2.js +4 -2
  197. package/dist/components/snk-filter-bar2.js +29 -20
  198. package/dist/components/snk-filter-modal-item2.js +1 -0
  199. package/dist/components/snk-filter-modal.js +59 -8
  200. package/dist/components/snk-filter-search.js +18 -5
  201. package/dist/components/snk-form-config2.js +253 -953
  202. package/dist/components/snk-form-view2.js +22 -8
  203. package/dist/components/snk-form.js +33 -9
  204. package/dist/components/snk-grid-config2.js +2 -0
  205. package/dist/components/snk-grid2.js +85 -63
  206. package/dist/components/snk-layout-form-config.d.ts +11 -0
  207. package/dist/components/snk-layout-form-config.js +6 -0
  208. package/dist/components/snk-layout-form-config2.js +73 -0
  209. package/dist/components/snk-personalized-filter2.js +50 -14
  210. package/dist/components/snk-simple-crud2.js +180 -124
  211. package/dist/components/snk-taskbar2.js +33 -10
  212. package/dist/components/snk-view-representation.d.ts +11 -0
  213. package/dist/components/snk-view-representation.js +6 -0
  214. package/dist/components/snk-view-representation2.js +41 -0
  215. package/dist/components/sortable.esm.js +2666 -0
  216. package/dist/components/taskbar-actions-button2.js +2 -2
  217. package/dist/components/taskbar-split-button.d.ts +11 -0
  218. package/dist/components/taskbar-split-button.js +6 -0
  219. package/dist/components/taskbar-split-button2.js +87 -0
  220. package/dist/esm/{ClientSideExporterProvider-bd24a4b3.js → ClientSideExporterProvider-3ed744fd.js} +23 -28
  221. package/dist/esm/{ConfigStorage-e5c1f4c0.js → ConfigStorage-79b9e180.js} +47 -19
  222. package/dist/esm/{DataFetcher-ecf5f903.js → DataFetcher-88e56266.js} +14 -2
  223. package/dist/esm/FormConfigHelper-49fe72ca.js +248 -0
  224. package/dist/esm/{pesquisa-fetcher-e26c3295.js → ISave-5efafc97.js} +36 -4
  225. package/dist/esm/{PersonalizedFilterUtils-e2b38ef7.js → PersonalizedFilterUtils-2db38ff2.js} +1 -1
  226. package/dist/esm/{SnkFormConfigManager-1efd102b.js → SnkFormConfigManager-b4b93298.js} +4 -5
  227. package/dist/esm/{SnkMessageBuilder-6fff4a4c.js → SnkMessageBuilder-9c269caf.js} +63 -30
  228. package/dist/esm/{auth-fetcher-9987c66e.js → auth-fetcher-3510520e.js} +1 -1
  229. package/dist/esm/config-header.entry.js +75 -0
  230. package/dist/esm/configs-button.entry.js +57 -0
  231. package/dist/esm/{constants-75abb876.js → constants-7b422de0.js} +9 -34
  232. package/dist/esm/{dataunit-fetcher-ed6e65ef.js → dataunit-fetcher-0e025732.js} +12 -8
  233. package/dist/esm/default-filters-50105e43.js +8 -0
  234. package/dist/esm/field-config_2.entry.js +319 -0
  235. package/dist/esm/fields-layout.entry.js +337 -0
  236. package/dist/esm/fields-selector.entry.js +70 -0
  237. package/dist/esm/{filter-type.enum-a80c1b6b.js → filter-type.enum-f6a8fe23.js} +1 -0
  238. package/dist/esm/{form-config-fetcher-34becd23.js → form-config-fetcher-fa208a6c.js} +15 -1
  239. package/dist/esm/guides-configurator.entry.js +160 -0
  240. package/dist/esm/{index-a7d3d3f1.js → index-479e1293.js} +34 -12
  241. package/dist/esm/{index-ae591a44.js → index-8acbae97.js} +6 -1
  242. package/dist/esm/{index-c57e49af.js → index-b72af127.js} +1 -1
  243. package/dist/esm/loader.js +3 -3
  244. package/dist/esm/pesquisa-grid_2.entry.js +6 -7
  245. package/dist/esm/sankhyablocks.js +3 -3
  246. package/dist/esm/{snk-actions-button_5.entry.js → snk-actions-button_8.entry.js} +131 -12
  247. package/dist/esm/snk-actions-form.entry.js +1 -1
  248. package/dist/esm/snk-application.entry.js +185 -24
  249. package/dist/esm/snk-attach.entry.js +9 -10
  250. package/dist/esm/snk-client-confirm.entry.js +1 -1
  251. package/dist/esm/snk-configurator.entry.js +10 -3
  252. package/dist/esm/snk-crud.entry.js +49 -77
  253. package/dist/esm/snk-custom-slot-elements.entry.js +1 -1
  254. package/dist/esm/snk-data-exporter.entry.js +8 -9
  255. package/dist/esm/{snk-data-unit-6258b8ae.js → snk-data-unit-027bca56.js} +227 -13
  256. package/dist/esm/snk-data-unit.entry.js +5 -5
  257. package/dist/esm/snk-default-filter.entry.js +73 -0
  258. package/dist/esm/snk-detail-view.entry.js +69 -17
  259. package/dist/esm/snk-entity-list.entry.js +3 -8
  260. package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
  261. package/dist/esm/snk-expression-group_2.entry.js +10 -8
  262. package/dist/esm/snk-filter-advanced-mode_2.entry.js +5 -4
  263. package/dist/esm/snk-filter-bar_4.entry.js +85 -31
  264. package/dist/esm/snk-filter-binary-select.entry.js +1 -1
  265. package/dist/esm/snk-filter-checkbox-list.entry.js +1 -1
  266. package/dist/esm/snk-filter-detail.entry.js +3 -3
  267. package/dist/esm/snk-filter-field-search_2.entry.js +3 -3
  268. package/dist/esm/snk-filter-modal-item.entry.js +5 -5
  269. package/dist/esm/snk-filter-multi-select.entry.js +1 -1
  270. package/dist/esm/snk-filter-number.entry.js +1 -1
  271. package/dist/esm/snk-filter-period.entry.js +1 -1
  272. package/dist/esm/snk-filter-search.entry.js +19 -6
  273. package/dist/esm/snk-filter-text.entry.js +1 -1
  274. package/dist/esm/snk-form-summary.entry.js +1 -1
  275. package/dist/esm/snk-form-view.entry.js +20 -8
  276. package/dist/esm/snk-form_2.entry.js +428 -0
  277. package/dist/esm/snk-grid.entry.js +50 -37
  278. package/dist/esm/{snk-guides-viewer-39fae8d5.js → snk-guides-viewer-32f3d3ab.js} +140 -74
  279. package/dist/esm/snk-guides-viewer.entry.js +13 -13
  280. package/dist/esm/snk-personalized-filter-editor.entry.js +1 -1
  281. package/dist/esm/snk-personalized-filter.entry.js +55 -20
  282. package/dist/esm/snk-pesquisa.entry.js +6 -7
  283. package/dist/esm/snk-print-selector.entry.js +1 -1
  284. package/dist/esm/snk-simple-bar.entry.js +1 -1
  285. package/dist/esm/snk-simple-crud.entry.js +150 -116
  286. package/dist/esm/snk-taskbar.entry.js +10 -5
  287. package/dist/esm/sortable.esm-842f85a3.js +2666 -0
  288. package/dist/esm/{taskbar-elements-ed51e143.js → taskbar-elements-171476d4.js} +13 -2
  289. package/dist/esm/{field-search-f8b1d91e.js → taskbar-processor-3436124c.js} +1 -34
  290. package/dist/esm/teste-pesquisa.entry.js +1 -1
  291. package/dist/sankhyablocks/p-0024d3fd.entry.js +1 -0
  292. package/dist/sankhyablocks/p-09e60995.entry.js +11 -0
  293. package/dist/sankhyablocks/p-0cb295c1.entry.js +1 -0
  294. package/dist/sankhyablocks/p-1456d7cb.entry.js +1 -0
  295. package/dist/sankhyablocks/{p-9531fd46.entry.js → p-180716b2.entry.js} +1 -1
  296. package/dist/sankhyablocks/p-19156e59.entry.js +1 -0
  297. package/dist/sankhyablocks/p-1a0caadb.js +1 -0
  298. package/dist/sankhyablocks/p-21107f0d.entry.js +1 -0
  299. package/dist/sankhyablocks/{p-118e769b.entry.js → p-27482793.entry.js} +1 -1
  300. package/dist/sankhyablocks/p-2bde486e.js +1 -0
  301. package/dist/sankhyablocks/{p-26b0ce3e.entry.js → p-2fdac5e6.entry.js} +1 -1
  302. package/dist/sankhyablocks/p-349d1968.entry.js +1 -0
  303. package/dist/sankhyablocks/p-35e73c5d.js +1 -0
  304. package/dist/sankhyablocks/{p-89c92727.entry.js → p-398cdd67.entry.js} +1 -1
  305. package/dist/sankhyablocks/p-3a48bff3.entry.js +1 -0
  306. package/dist/sankhyablocks/{p-434817f0.entry.js → p-3d41f5a8.entry.js} +1 -1
  307. package/dist/sankhyablocks/p-3f24c9b2.js +1 -0
  308. package/dist/sankhyablocks/{p-8002dcd0.entry.js → p-471b34f4.entry.js} +1 -1
  309. package/dist/sankhyablocks/{p-7e2ded86.entry.js → p-49d968e2.entry.js} +1 -1
  310. package/dist/sankhyablocks/p-4d2ff2fb.entry.js +1 -0
  311. package/dist/sankhyablocks/p-51833248.js +7 -0
  312. package/dist/sankhyablocks/p-601b252b.js +26 -0
  313. package/dist/sankhyablocks/p-60dd1d27.entry.js +1 -0
  314. package/dist/sankhyablocks/p-6416975c.js +56 -0
  315. package/dist/sankhyablocks/p-65c5d430.entry.js +1 -0
  316. package/dist/sankhyablocks/{p-21a81901.entry.js → p-667cab42.entry.js} +1 -1
  317. package/dist/sankhyablocks/p-67d6d0c8.entry.js +1 -0
  318. package/dist/sankhyablocks/p-6a4b21dd.js +1 -0
  319. package/dist/sankhyablocks/p-6dd38d7b.js +6 -0
  320. package/dist/sankhyablocks/p-71a05822.entry.js +1 -0
  321. package/dist/sankhyablocks/p-72c8c847.entry.js +1 -0
  322. package/dist/sankhyablocks/{p-a77bdadc.js → p-73285a8a.js} +1 -1
  323. package/dist/sankhyablocks/{p-ac8d1cd6.entry.js → p-7345782c.entry.js} +1 -1
  324. package/dist/sankhyablocks/p-763b04fa.js +1 -0
  325. package/dist/sankhyablocks/p-7993b2e3.js +60 -0
  326. package/dist/sankhyablocks/p-7de79adf.js +1 -0
  327. package/dist/sankhyablocks/p-7e250432.entry.js +1 -0
  328. package/dist/sankhyablocks/{p-47178038.entry.js → p-83c100f2.entry.js} +1 -1
  329. package/dist/sankhyablocks/p-84345e7a.js +1 -0
  330. package/dist/sankhyablocks/p-86bd4478.entry.js +1 -0
  331. package/dist/sankhyablocks/p-9019a32f.js +1 -0
  332. package/dist/sankhyablocks/{p-54a5d52a.entry.js → p-90805683.entry.js} +1 -1
  333. package/dist/sankhyablocks/{p-c2e468c9.entry.js → p-91a9abb6.entry.js} +1 -1
  334. package/dist/sankhyablocks/p-9751c42f.entry.js +1 -0
  335. package/dist/sankhyablocks/{p-057fad05.js → p-988afe78.js} +1 -1
  336. package/dist/sankhyablocks/{p-16a1dd18.entry.js → p-9a63f3f7.entry.js} +1 -1
  337. package/dist/sankhyablocks/p-9ad3557c.entry.js +1 -0
  338. package/dist/sankhyablocks/p-9fd87bfd.entry.js +1 -0
  339. package/dist/sankhyablocks/p-a06bf7b9.entry.js +1 -0
  340. package/dist/sankhyablocks/{p-5e9fbd76.js → p-a349689a.js} +1 -1
  341. package/dist/sankhyablocks/p-a5bb2f93.entry.js +1 -0
  342. package/dist/sankhyablocks/{p-3ce68be5.js → p-a6513fcb.js} +1 -1
  343. package/dist/sankhyablocks/{p-8c235d4c.entry.js → p-a76e6d51.entry.js} +1 -1
  344. package/dist/sankhyablocks/p-b568c1d4.js +1 -0
  345. package/dist/sankhyablocks/p-bd665460.entry.js +1 -0
  346. package/dist/sankhyablocks/p-c3324d79.entry.js +1 -0
  347. package/dist/sankhyablocks/{p-bf2acf72.entry.js → p-c6a8a8bc.entry.js} +1 -1
  348. package/dist/sankhyablocks/{p-d3b9b377.entry.js → p-c926cf6b.entry.js} +1 -1
  349. package/dist/sankhyablocks/p-cfd0a4c6.entry.js +1 -0
  350. package/dist/sankhyablocks/{p-79f823f3.entry.js → p-d67526b6.entry.js} +1 -1
  351. package/dist/sankhyablocks/{p-d2d301a6.js → p-d8d8169b.js} +1 -1
  352. package/dist/sankhyablocks/p-d9491f6f.entry.js +1 -0
  353. package/dist/sankhyablocks/{p-5f157b09.entry.js → p-dff65083.entry.js} +1 -1
  354. package/dist/sankhyablocks/{p-2746d606.entry.js → p-e3521eae.entry.js} +1 -1
  355. package/dist/sankhyablocks/p-e7cccc45.entry.js +1 -0
  356. package/dist/sankhyablocks/{p-33718dfc.entry.js → p-e824d565.entry.js} +1 -1
  357. package/dist/sankhyablocks/{p-5a7e18f4.js → p-fbba7e3d.js} +1 -1
  358. package/dist/sankhyablocks/p-fc0b609e.js +1 -0
  359. package/dist/sankhyablocks/p-ff7060bc.entry.js +1 -0
  360. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  361. package/dist/types/components/snk-application/search-strategy/exec-prepared-search-plus.d.ts +5 -0
  362. package/dist/types/components/snk-application/snk-application.d.ts +17 -2
  363. package/dist/types/components/snk-configurator/snk-configurator.d.ts +6 -0
  364. package/dist/types/components/snk-crud/snk-crud.d.ts +9 -3
  365. package/dist/types/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.d.ts +17 -0
  366. package/dist/types/components/snk-crud/subcomponents/snk-form-view.d.ts +11 -1
  367. package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +16 -7
  368. package/dist/types/components/snk-data-unit/MultipleUpdateHelper.d.ts +9 -0
  369. package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +17 -0
  370. package/dist/types/components/snk-filter-bar/filter-item/editors/snk-filter-search.d.ts +5 -3
  371. package/dist/types/components/snk-filter-bar/filter-modal/snk-filter-modal.d.ts +16 -4
  372. package/dist/types/components/snk-filter-bar/filter-modal/subcomponents/snk-default-filter/snk-default-filter.d.ts +27 -0
  373. package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +4 -3
  374. package/dist/types/components/snk-filter-bar/types/default-filters.d.ts +5 -0
  375. package/dist/types/components/snk-filter-bar/types/filter-type.enum.d.ts +2 -1
  376. package/dist/types/components/snk-filter-bar/utils/SnkFilterModalFactory.d.ts +3 -3
  377. package/dist/types/components/snk-form-config/FormConfigHelper.d.ts +31 -0
  378. package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +3 -3
  379. package/dist/types/components/snk-form-config/config-header/config-header.d.ts +23 -0
  380. package/dist/types/components/snk-form-config/config-header/configs-button/configs-button.d.ts +19 -0
  381. package/dist/types/components/snk-form-config/field-item/field-config/field-config.d.ts +56 -0
  382. package/dist/types/components/snk-form-config/fields-layout/fields-layout.d.ts +63 -0
  383. package/dist/types/components/snk-form-config/fields-selector/fields-selector.d.ts +18 -0
  384. package/dist/types/components/snk-form-config/guides-configurator/guides-configurator.d.ts +42 -0
  385. package/dist/types/components/snk-form-config/snk-form-config.d.ts +51 -120
  386. package/dist/types/components/snk-grid/filtercolumn/SnkMultiSelectionListDataSource.d.ts +2 -1
  387. package/dist/types/components/snk-grid/snk-grid.d.ts +16 -5
  388. package/dist/types/components/snk-grid-config/snk-grid-config.d.ts +1 -0
  389. package/dist/types/components/snk-layout-form-config/snk-layout-form-config.d.ts +15 -0
  390. package/dist/types/components/snk-layout-form-config/snk-view-representation/snk-view-representation.d.ts +10 -0
  391. package/dist/types/components/snk-personalized-filter/interfaces/index.d.ts +4 -0
  392. package/dist/types/components/snk-personalized-filter/snk-personalized-filter.d.ts +7 -1
  393. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-group/snk-expression-group.d.ts +4 -0
  394. package/dist/types/components/snk-personalized-filter/subcomponents/snk-expression-item/snk-expression-item.d.ts +4 -0
  395. package/dist/types/components/snk-personalized-filter/subcomponents/snk-filter-assistent-mode/snk-filter-assistent-mode.d.ts +4 -0
  396. package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +24 -12
  397. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +2 -1
  398. package/dist/types/components/snk-taskbar/elements/taskbar-split-button/taskbar-split-button.d.ts +44 -0
  399. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +6 -0
  400. package/dist/types/components.d.ts +502 -212
  401. package/dist/types/lib/configs/ConfigStorage.d.ts +4 -2
  402. package/dist/types/lib/configs/LayoutFormConfig.d.ts +11 -0
  403. package/dist/types/lib/http/data-fetcher/fetchers/data-unit/cache/PreloadManager.d.ts +1 -1
  404. package/dist/types/lib/http/data-fetcher/fetchers/form-config-fetcher.d.ts +6 -0
  405. package/dist/types/lib/http/data-fetcher/fetchers/personalized-filter-fetcher.d.ts +8 -4
  406. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +4 -1
  407. package/dist/types/lib/message/SnkMessageBuilder.d.ts +2 -1
  408. package/dist/types/lib/utils/constants.d.ts +7 -0
  409. package/package.json +8 -6
  410. package/react/components.d.ts +11 -3
  411. package/react/components.js +11 -3
  412. package/react/components.js.map +1 -1
  413. package/dist/cjs/ISave-e91b70a7.js +0 -9
  414. package/dist/cjs/Sortable-fb1c4cbb.js +0 -2853
  415. package/dist/cjs/snk-config-options_3.cjs.entry.js +0 -1388
  416. package/dist/cjs/snk-field-config.cjs.entry.js +0 -60
  417. package/dist/cjs/snk-tab-config.cjs.entry.js +0 -332
  418. package/dist/collection/components/snk-form-config/subcomponents/snk-config-options/snk-config-options.css +0 -16
  419. package/dist/collection/components/snk-form-config/subcomponents/snk-config-options/snk-config-options.js +0 -344
  420. package/dist/collection/components/snk-form-config/subcomponents/snk-field-config/snk-field-config.css +0 -219
  421. package/dist/collection/components/snk-form-config/subcomponents/snk-field-config/snk-field-config.js +0 -184
  422. package/dist/collection/components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config.css +0 -323
  423. package/dist/collection/components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config.js +0 -527
  424. package/dist/collection/components/snk-taskbar/subcomponents/field-search.js +0 -31
  425. package/dist/components/snk-config-options.js +0 -6
  426. package/dist/components/snk-config-options2.js +0 -255
  427. package/dist/components/snk-field-config.js +0 -6
  428. package/dist/components/snk-field-config2.js +0 -76
  429. package/dist/components/snk-tab-config.js +0 -6
  430. package/dist/components/snk-tab-config2.js +0 -3202
  431. package/dist/esm/ISave-d8c8bc59.js +0 -9
  432. package/dist/esm/Sortable-83960219.js +0 -2851
  433. package/dist/esm/snk-config-options_3.entry.js +0 -1382
  434. package/dist/esm/snk-field-config.entry.js +0 -56
  435. package/dist/esm/snk-tab-config.entry.js +0 -328
  436. package/dist/sankhyablocks/p-11afea24.entry.js +0 -1
  437. package/dist/sankhyablocks/p-17425c72.js +0 -1
  438. package/dist/sankhyablocks/p-18389343.entry.js +0 -1
  439. package/dist/sankhyablocks/p-1d19a5b0.js +0 -1
  440. package/dist/sankhyablocks/p-1db45d26.entry.js +0 -1
  441. package/dist/sankhyablocks/p-21749402.js +0 -1
  442. package/dist/sankhyablocks/p-22ddc147.js +0 -26
  443. package/dist/sankhyablocks/p-23736d75.js +0 -1
  444. package/dist/sankhyablocks/p-23cd6abf.entry.js +0 -1
  445. package/dist/sankhyablocks/p-240ac47f.entry.js +0 -1
  446. package/dist/sankhyablocks/p-2953c481.entry.js +0 -1
  447. package/dist/sankhyablocks/p-3ab6df3d.entry.js +0 -1
  448. package/dist/sankhyablocks/p-3fcb90d6.js +0 -56
  449. package/dist/sankhyablocks/p-43769aa9.js +0 -1
  450. package/dist/sankhyablocks/p-4b01cbad.entry.js +0 -11
  451. package/dist/sankhyablocks/p-4c9adf1c.entry.js +0 -1
  452. package/dist/sankhyablocks/p-517efc93.js +0 -1
  453. package/dist/sankhyablocks/p-6b898a51.entry.js +0 -1
  454. package/dist/sankhyablocks/p-77168ab4.entry.js +0 -1
  455. package/dist/sankhyablocks/p-7e0a0aae.js +0 -60
  456. package/dist/sankhyablocks/p-91708c3d.entry.js +0 -1
  457. package/dist/sankhyablocks/p-933c0c0b.js +0 -1
  458. package/dist/sankhyablocks/p-9523fc40.entry.js +0 -1
  459. package/dist/sankhyablocks/p-9887a437.entry.js +0 -1
  460. package/dist/sankhyablocks/p-9ebc3f3b.entry.js +0 -1
  461. package/dist/sankhyablocks/p-a5bdcb3f.entry.js +0 -1
  462. package/dist/sankhyablocks/p-a61bbe18.entry.js +0 -1
  463. package/dist/sankhyablocks/p-abd9681c.js +0 -1
  464. package/dist/sankhyablocks/p-bfdf92e9.entry.js +0 -1
  465. package/dist/sankhyablocks/p-c8622597.entry.js +0 -1
  466. package/dist/sankhyablocks/p-cb1e77e0.entry.js +0 -1
  467. package/dist/sankhyablocks/p-d9804798.js +0 -1
  468. package/dist/sankhyablocks/p-e289826a.js +0 -1
  469. package/dist/sankhyablocks/p-e51c52cf.entry.js +0 -1
  470. package/dist/sankhyablocks/p-e66bcb5c.entry.js +0 -1
  471. package/dist/sankhyablocks/p-ef076eea.js +0 -6
  472. package/dist/sankhyablocks/p-fa816fb2.js +0 -1
  473. package/dist/types/components/snk-form-config/subcomponents/snk-config-options/snk-config-options.d.ts +0 -57
  474. package/dist/types/components/snk-form-config/subcomponents/snk-field-config/snk-field-config.d.ts +0 -43
  475. package/dist/types/components/snk-form-config/subcomponents/snk-tab-config/snk-tab-config.d.ts +0 -105
  476. package/dist/types/components/snk-taskbar/subcomponents/field-search.d.ts +0 -4
@@ -0,0 +1,2668 @@
1
+ 'use strict';
2
+
3
+ /**!
4
+ * Sortable 1.15.6
5
+ * @author RubaXa <trash@rubaxa.org>
6
+ * @author owenm <owen23355@gmail.com>
7
+ * @license MIT
8
+ */
9
+ function ownKeys(object, enumerableOnly) {
10
+ var keys = Object.keys(object);
11
+ if (Object.getOwnPropertySymbols) {
12
+ var symbols = Object.getOwnPropertySymbols(object);
13
+ if (enumerableOnly) {
14
+ symbols = symbols.filter(function (sym) {
15
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
16
+ });
17
+ }
18
+ keys.push.apply(keys, symbols);
19
+ }
20
+ return keys;
21
+ }
22
+ function _objectSpread2(target) {
23
+ for (var i = 1; i < arguments.length; i++) {
24
+ var source = arguments[i] != null ? arguments[i] : {};
25
+ if (i % 2) {
26
+ ownKeys(Object(source), true).forEach(function (key) {
27
+ _defineProperty(target, key, source[key]);
28
+ });
29
+ } else if (Object.getOwnPropertyDescriptors) {
30
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
31
+ } else {
32
+ ownKeys(Object(source)).forEach(function (key) {
33
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
34
+ });
35
+ }
36
+ }
37
+ return target;
38
+ }
39
+ function _typeof(obj) {
40
+ "@babel/helpers - typeof";
41
+
42
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
43
+ _typeof = function (obj) {
44
+ return typeof obj;
45
+ };
46
+ } else {
47
+ _typeof = function (obj) {
48
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
49
+ };
50
+ }
51
+ return _typeof(obj);
52
+ }
53
+ function _defineProperty(obj, key, value) {
54
+ if (key in obj) {
55
+ Object.defineProperty(obj, key, {
56
+ value: value,
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true
60
+ });
61
+ } else {
62
+ obj[key] = value;
63
+ }
64
+ return obj;
65
+ }
66
+ function _extends() {
67
+ _extends = Object.assign || function (target) {
68
+ for (var i = 1; i < arguments.length; i++) {
69
+ var source = arguments[i];
70
+ for (var key in source) {
71
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
72
+ target[key] = source[key];
73
+ }
74
+ }
75
+ }
76
+ return target;
77
+ };
78
+ return _extends.apply(this, arguments);
79
+ }
80
+ function _objectWithoutPropertiesLoose(source, excluded) {
81
+ if (source == null) return {};
82
+ var target = {};
83
+ var sourceKeys = Object.keys(source);
84
+ var key, i;
85
+ for (i = 0; i < sourceKeys.length; i++) {
86
+ key = sourceKeys[i];
87
+ if (excluded.indexOf(key) >= 0) continue;
88
+ target[key] = source[key];
89
+ }
90
+ return target;
91
+ }
92
+ function _objectWithoutProperties(source, excluded) {
93
+ if (source == null) return {};
94
+ var target = _objectWithoutPropertiesLoose(source, excluded);
95
+ var key, i;
96
+ if (Object.getOwnPropertySymbols) {
97
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
98
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
99
+ key = sourceSymbolKeys[i];
100
+ if (excluded.indexOf(key) >= 0) continue;
101
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
102
+ target[key] = source[key];
103
+ }
104
+ }
105
+ return target;
106
+ }
107
+
108
+ var version = "1.15.6";
109
+
110
+ function userAgent(pattern) {
111
+ if (typeof window !== 'undefined' && window.navigator) {
112
+ return !! /*@__PURE__*/navigator.userAgent.match(pattern);
113
+ }
114
+ }
115
+ var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
116
+ var Edge = userAgent(/Edge/i);
117
+ var FireFox = userAgent(/firefox/i);
118
+ var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i);
119
+ var IOS = userAgent(/iP(ad|od|hone)/i);
120
+ var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i);
121
+
122
+ var captureMode = {
123
+ capture: false,
124
+ passive: false
125
+ };
126
+ function on(el, event, fn) {
127
+ el.addEventListener(event, fn, !IE11OrLess && captureMode);
128
+ }
129
+ function off(el, event, fn) {
130
+ el.removeEventListener(event, fn, !IE11OrLess && captureMode);
131
+ }
132
+ function matches( /**HTMLElement*/el, /**String*/selector) {
133
+ if (!selector) return;
134
+ selector[0] === '>' && (selector = selector.substring(1));
135
+ if (el) {
136
+ try {
137
+ if (el.matches) {
138
+ return el.matches(selector);
139
+ } else if (el.msMatchesSelector) {
140
+ return el.msMatchesSelector(selector);
141
+ } else if (el.webkitMatchesSelector) {
142
+ return el.webkitMatchesSelector(selector);
143
+ }
144
+ } catch (_) {
145
+ return false;
146
+ }
147
+ }
148
+ return false;
149
+ }
150
+ function getParentOrHost(el) {
151
+ return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
152
+ }
153
+ function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
154
+ if (el) {
155
+ ctx = ctx || document;
156
+ do {
157
+ if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
158
+ return el;
159
+ }
160
+ if (el === ctx) break;
161
+ /* jshint boss:true */
162
+ } while (el = getParentOrHost(el));
163
+ }
164
+ return null;
165
+ }
166
+ var R_SPACE = /\s+/g;
167
+ function toggleClass(el, name, state) {
168
+ if (el && name) {
169
+ if (el.classList) {
170
+ el.classList[state ? 'add' : 'remove'](name);
171
+ } else {
172
+ var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
173
+ el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
174
+ }
175
+ }
176
+ }
177
+ function css(el, prop, val) {
178
+ var style = el && el.style;
179
+ if (style) {
180
+ if (val === void 0) {
181
+ if (document.defaultView && document.defaultView.getComputedStyle) {
182
+ val = document.defaultView.getComputedStyle(el, '');
183
+ } else if (el.currentStyle) {
184
+ val = el.currentStyle;
185
+ }
186
+ return prop === void 0 ? val : val[prop];
187
+ } else {
188
+ if (!(prop in style) && prop.indexOf('webkit') === -1) {
189
+ prop = '-webkit-' + prop;
190
+ }
191
+ style[prop] = val + (typeof val === 'string' ? '' : 'px');
192
+ }
193
+ }
194
+ }
195
+ function matrix(el, selfOnly) {
196
+ var appliedTransforms = '';
197
+ if (typeof el === 'string') {
198
+ appliedTransforms = el;
199
+ } else {
200
+ do {
201
+ var transform = css(el, 'transform');
202
+ if (transform && transform !== 'none') {
203
+ appliedTransforms = transform + ' ' + appliedTransforms;
204
+ }
205
+ /* jshint boss:true */
206
+ } while (!selfOnly && (el = el.parentNode));
207
+ }
208
+ var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
209
+ /*jshint -W056 */
210
+ return matrixFn && new matrixFn(appliedTransforms);
211
+ }
212
+ function find(ctx, tagName, iterator) {
213
+ if (ctx) {
214
+ var list = ctx.getElementsByTagName(tagName),
215
+ i = 0,
216
+ n = list.length;
217
+ if (iterator) {
218
+ for (; i < n; i++) {
219
+ iterator(list[i], i);
220
+ }
221
+ }
222
+ return list;
223
+ }
224
+ return [];
225
+ }
226
+ function getWindowScrollingElement() {
227
+ var scrollingElement = document.scrollingElement;
228
+ if (scrollingElement) {
229
+ return scrollingElement;
230
+ } else {
231
+ return document.documentElement;
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Returns the "bounding client rect" of given element
237
+ * @param {HTMLElement} el The element whose boundingClientRect is wanted
238
+ * @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
239
+ * @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
240
+ * @param {[Boolean]} undoScale Whether the container's scale() should be undone
241
+ * @param {[HTMLElement]} container The parent the element will be placed in
242
+ * @return {Object} The boundingClientRect of el, with specified adjustments
243
+ */
244
+ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
245
+ if (!el.getBoundingClientRect && el !== window) return;
246
+ var elRect, top, left, bottom, right, height, width;
247
+ if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
248
+ elRect = el.getBoundingClientRect();
249
+ top = elRect.top;
250
+ left = elRect.left;
251
+ bottom = elRect.bottom;
252
+ right = elRect.right;
253
+ height = elRect.height;
254
+ width = elRect.width;
255
+ } else {
256
+ top = 0;
257
+ left = 0;
258
+ bottom = window.innerHeight;
259
+ right = window.innerWidth;
260
+ height = window.innerHeight;
261
+ width = window.innerWidth;
262
+ }
263
+ if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
264
+ // Adjust for translate()
265
+ container = container || el.parentNode;
266
+
267
+ // solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
268
+ // Not needed on <= IE11
269
+ if (!IE11OrLess) {
270
+ do {
271
+ if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
272
+ var containerRect = container.getBoundingClientRect();
273
+
274
+ // Set relative to edges of padding box of container
275
+ top -= containerRect.top + parseInt(css(container, 'border-top-width'));
276
+ left -= containerRect.left + parseInt(css(container, 'border-left-width'));
277
+ bottom = top + elRect.height;
278
+ right = left + elRect.width;
279
+ break;
280
+ }
281
+ /* jshint boss:true */
282
+ } while (container = container.parentNode);
283
+ }
284
+ }
285
+ if (undoScale && el !== window) {
286
+ // Adjust for scale()
287
+ var elMatrix = matrix(container || el),
288
+ scaleX = elMatrix && elMatrix.a,
289
+ scaleY = elMatrix && elMatrix.d;
290
+ if (elMatrix) {
291
+ top /= scaleY;
292
+ left /= scaleX;
293
+ width /= scaleX;
294
+ height /= scaleY;
295
+ bottom = top + height;
296
+ right = left + width;
297
+ }
298
+ }
299
+ return {
300
+ top: top,
301
+ left: left,
302
+ bottom: bottom,
303
+ right: right,
304
+ width: width,
305
+ height: height
306
+ };
307
+ }
308
+
309
+ /**
310
+ * Checks if a side of an element is scrolled past a side of its parents
311
+ * @param {HTMLElement} el The element who's side being scrolled out of view is in question
312
+ * @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
313
+ * @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
314
+ * @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
315
+ */
316
+ function isScrolledPast(el, elSide, parentSide) {
317
+ var parent = getParentAutoScrollElement(el, true),
318
+ elSideVal = getRect(el)[elSide];
319
+
320
+ /* jshint boss:true */
321
+ while (parent) {
322
+ var parentSideVal = getRect(parent)[parentSide],
323
+ visible = void 0;
324
+ if (parentSide === 'top' || parentSide === 'left') {
325
+ visible = elSideVal >= parentSideVal;
326
+ } else {
327
+ visible = elSideVal <= parentSideVal;
328
+ }
329
+ if (!visible) return parent;
330
+ if (parent === getWindowScrollingElement()) break;
331
+ parent = getParentAutoScrollElement(parent, false);
332
+ }
333
+ return false;
334
+ }
335
+
336
+ /**
337
+ * Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
338
+ * and non-draggable elements
339
+ * @param {HTMLElement} el The parent element
340
+ * @param {Number} childNum The index of the child
341
+ * @param {Object} options Parent Sortable's options
342
+ * @return {HTMLElement} The child at index childNum, or null if not found
343
+ */
344
+ function getChild(el, childNum, options, includeDragEl) {
345
+ var currentChild = 0,
346
+ i = 0,
347
+ children = el.children;
348
+ while (i < children.length) {
349
+ if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
350
+ if (currentChild === childNum) {
351
+ return children[i];
352
+ }
353
+ currentChild++;
354
+ }
355
+ i++;
356
+ }
357
+ return null;
358
+ }
359
+
360
+ /**
361
+ * Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
362
+ * @param {HTMLElement} el Parent element
363
+ * @param {selector} selector Any other elements that should be ignored
364
+ * @return {HTMLElement} The last child, ignoring ghostEl
365
+ */
366
+ function lastChild(el, selector) {
367
+ var last = el.lastElementChild;
368
+ while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
369
+ last = last.previousElementSibling;
370
+ }
371
+ return last || null;
372
+ }
373
+
374
+ /**
375
+ * Returns the index of an element within its parent for a selected set of
376
+ * elements
377
+ * @param {HTMLElement} el
378
+ * @param {selector} selector
379
+ * @return {number}
380
+ */
381
+ function index(el, selector) {
382
+ var index = 0;
383
+ if (!el || !el.parentNode) {
384
+ return -1;
385
+ }
386
+
387
+ /* jshint boss:true */
388
+ while (el = el.previousElementSibling) {
389
+ if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
390
+ index++;
391
+ }
392
+ }
393
+ return index;
394
+ }
395
+
396
+ /**
397
+ * Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
398
+ * The value is returned in real pixels.
399
+ * @param {HTMLElement} el
400
+ * @return {Array} Offsets in the format of [left, top]
401
+ */
402
+ function getRelativeScrollOffset(el) {
403
+ var offsetLeft = 0,
404
+ offsetTop = 0,
405
+ winScroller = getWindowScrollingElement();
406
+ if (el) {
407
+ do {
408
+ var elMatrix = matrix(el),
409
+ scaleX = elMatrix.a,
410
+ scaleY = elMatrix.d;
411
+ offsetLeft += el.scrollLeft * scaleX;
412
+ offsetTop += el.scrollTop * scaleY;
413
+ } while (el !== winScroller && (el = el.parentNode));
414
+ }
415
+ return [offsetLeft, offsetTop];
416
+ }
417
+
418
+ /**
419
+ * Returns the index of the object within the given array
420
+ * @param {Array} arr Array that may or may not hold the object
421
+ * @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
422
+ * @return {Number} The index of the object in the array, or -1
423
+ */
424
+ function indexOfObject(arr, obj) {
425
+ for (var i in arr) {
426
+ if (!arr.hasOwnProperty(i)) continue;
427
+ for (var key in obj) {
428
+ if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
429
+ }
430
+ }
431
+ return -1;
432
+ }
433
+ function getParentAutoScrollElement(el, includeSelf) {
434
+ // skip to window
435
+ if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
436
+ var elem = el;
437
+ var gotSelf = false;
438
+ do {
439
+ // we don't need to get elem css if it isn't even overflowing in the first place (performance)
440
+ if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
441
+ var elemCSS = css(elem);
442
+ if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
443
+ if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
444
+ if (gotSelf || includeSelf) return elem;
445
+ gotSelf = true;
446
+ }
447
+ }
448
+ /* jshint boss:true */
449
+ } while (elem = elem.parentNode);
450
+ return getWindowScrollingElement();
451
+ }
452
+ function extend(dst, src) {
453
+ if (dst && src) {
454
+ for (var key in src) {
455
+ if (src.hasOwnProperty(key)) {
456
+ dst[key] = src[key];
457
+ }
458
+ }
459
+ }
460
+ return dst;
461
+ }
462
+ function isRectEqual(rect1, rect2) {
463
+ 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);
464
+ }
465
+ var _throttleTimeout;
466
+ function throttle(callback, ms) {
467
+ return function () {
468
+ if (!_throttleTimeout) {
469
+ var args = arguments,
470
+ _this = this;
471
+ if (args.length === 1) {
472
+ callback.call(_this, args[0]);
473
+ } else {
474
+ callback.apply(_this, args);
475
+ }
476
+ _throttleTimeout = setTimeout(function () {
477
+ _throttleTimeout = void 0;
478
+ }, ms);
479
+ }
480
+ };
481
+ }
482
+ function cancelThrottle() {
483
+ clearTimeout(_throttleTimeout);
484
+ _throttleTimeout = void 0;
485
+ }
486
+ function scrollBy(el, x, y) {
487
+ el.scrollLeft += x;
488
+ el.scrollTop += y;
489
+ }
490
+ function clone(el) {
491
+ var Polymer = window.Polymer;
492
+ var $ = window.jQuery || window.Zepto;
493
+ if (Polymer && Polymer.dom) {
494
+ return Polymer.dom(el).cloneNode(true);
495
+ } else if ($) {
496
+ return $(el).clone(true)[0];
497
+ } else {
498
+ return el.cloneNode(true);
499
+ }
500
+ }
501
+ function getChildContainingRectFromElement(container, options, ghostEl) {
502
+ var rect = {};
503
+ Array.from(container.children).forEach(function (child) {
504
+ var _rect$left, _rect$top, _rect$right, _rect$bottom;
505
+ if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
506
+ var childRect = getRect(child);
507
+ rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
508
+ rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
509
+ rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
510
+ rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
511
+ });
512
+ rect.width = rect.right - rect.left;
513
+ rect.height = rect.bottom - rect.top;
514
+ rect.x = rect.left;
515
+ rect.y = rect.top;
516
+ return rect;
517
+ }
518
+ var expando = 'Sortable' + new Date().getTime();
519
+
520
+ function AnimationStateManager() {
521
+ var animationStates = [],
522
+ animationCallbackId;
523
+ return {
524
+ captureAnimationState: function captureAnimationState() {
525
+ animationStates = [];
526
+ if (!this.options.animation) return;
527
+ var children = [].slice.call(this.el.children);
528
+ children.forEach(function (child) {
529
+ if (css(child, 'display') === 'none' || child === Sortable.ghost) return;
530
+ animationStates.push({
531
+ target: child,
532
+ rect: getRect(child)
533
+ });
534
+ var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
535
+
536
+ // If animating: compensate for current animation
537
+ if (child.thisAnimationDuration) {
538
+ var childMatrix = matrix(child, true);
539
+ if (childMatrix) {
540
+ fromRect.top -= childMatrix.f;
541
+ fromRect.left -= childMatrix.e;
542
+ }
543
+ }
544
+ child.fromRect = fromRect;
545
+ });
546
+ },
547
+ addAnimationState: function addAnimationState(state) {
548
+ animationStates.push(state);
549
+ },
550
+ removeAnimationState: function removeAnimationState(target) {
551
+ animationStates.splice(indexOfObject(animationStates, {
552
+ target: target
553
+ }), 1);
554
+ },
555
+ animateAll: function animateAll(callback) {
556
+ var _this = this;
557
+ if (!this.options.animation) {
558
+ clearTimeout(animationCallbackId);
559
+ if (typeof callback === 'function') callback();
560
+ return;
561
+ }
562
+ var animating = false,
563
+ animationTime = 0;
564
+ animationStates.forEach(function (state) {
565
+ var time = 0,
566
+ target = state.target,
567
+ fromRect = target.fromRect,
568
+ toRect = getRect(target),
569
+ prevFromRect = target.prevFromRect,
570
+ prevToRect = target.prevToRect,
571
+ animatingRect = state.rect,
572
+ targetMatrix = matrix(target, true);
573
+ if (targetMatrix) {
574
+ // Compensate for current animation
575
+ toRect.top -= targetMatrix.f;
576
+ toRect.left -= targetMatrix.e;
577
+ }
578
+ target.toRect = toRect;
579
+ if (target.thisAnimationDuration) {
580
+ // Could also check if animatingRect is between fromRect and toRect
581
+ if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
582
+ // Make sure animatingRect is on line between toRect & fromRect
583
+ (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
584
+ // If returning to same place as started from animation and on same axis
585
+ time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
586
+ }
587
+ }
588
+
589
+ // if fromRect != toRect: animate
590
+ if (!isRectEqual(toRect, fromRect)) {
591
+ target.prevFromRect = fromRect;
592
+ target.prevToRect = toRect;
593
+ if (!time) {
594
+ time = _this.options.animation;
595
+ }
596
+ _this.animate(target, animatingRect, toRect, time);
597
+ }
598
+ if (time) {
599
+ animating = true;
600
+ animationTime = Math.max(animationTime, time);
601
+ clearTimeout(target.animationResetTimer);
602
+ target.animationResetTimer = setTimeout(function () {
603
+ target.animationTime = 0;
604
+ target.prevFromRect = null;
605
+ target.fromRect = null;
606
+ target.prevToRect = null;
607
+ target.thisAnimationDuration = null;
608
+ }, time);
609
+ target.thisAnimationDuration = time;
610
+ }
611
+ });
612
+ clearTimeout(animationCallbackId);
613
+ if (!animating) {
614
+ if (typeof callback === 'function') callback();
615
+ } else {
616
+ animationCallbackId = setTimeout(function () {
617
+ if (typeof callback === 'function') callback();
618
+ }, animationTime);
619
+ }
620
+ animationStates = [];
621
+ },
622
+ animate: function animate(target, currentRect, toRect, duration) {
623
+ if (duration) {
624
+ css(target, 'transition', '');
625
+ css(target, 'transform', '');
626
+ var elMatrix = matrix(this.el),
627
+ scaleX = elMatrix && elMatrix.a,
628
+ scaleY = elMatrix && elMatrix.d,
629
+ translateX = (currentRect.left - toRect.left) / (scaleX || 1),
630
+ translateY = (currentRect.top - toRect.top) / (scaleY || 1);
631
+ target.animatingX = !!translateX;
632
+ target.animatingY = !!translateY;
633
+ css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
634
+ this.forRepaintDummy = repaint(target); // repaint
635
+
636
+ css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
637
+ css(target, 'transform', 'translate3d(0,0,0)');
638
+ typeof target.animated === 'number' && clearTimeout(target.animated);
639
+ target.animated = setTimeout(function () {
640
+ css(target, 'transition', '');
641
+ css(target, 'transform', '');
642
+ target.animated = false;
643
+ target.animatingX = false;
644
+ target.animatingY = false;
645
+ }, duration);
646
+ }
647
+ }
648
+ };
649
+ }
650
+ function repaint(target) {
651
+ return target.offsetWidth;
652
+ }
653
+ function calculateRealTime(animatingRect, fromRect, toRect, options) {
654
+ 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;
655
+ }
656
+
657
+ var plugins = [];
658
+ var defaults = {
659
+ initializeByDefault: true
660
+ };
661
+ var PluginManager = {
662
+ mount: function mount(plugin) {
663
+ // Set default static properties
664
+ for (var option in defaults) {
665
+ if (defaults.hasOwnProperty(option) && !(option in plugin)) {
666
+ plugin[option] = defaults[option];
667
+ }
668
+ }
669
+ plugins.forEach(function (p) {
670
+ if (p.pluginName === plugin.pluginName) {
671
+ throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
672
+ }
673
+ });
674
+ plugins.push(plugin);
675
+ },
676
+ pluginEvent: function pluginEvent(eventName, sortable, evt) {
677
+ var _this = this;
678
+ this.eventCanceled = false;
679
+ evt.cancel = function () {
680
+ _this.eventCanceled = true;
681
+ };
682
+ var eventNameGlobal = eventName + 'Global';
683
+ plugins.forEach(function (plugin) {
684
+ if (!sortable[plugin.pluginName]) return;
685
+ // Fire global events if it exists in this sortable
686
+ if (sortable[plugin.pluginName][eventNameGlobal]) {
687
+ sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
688
+ sortable: sortable
689
+ }, evt));
690
+ }
691
+
692
+ // Only fire plugin event if plugin is enabled in this sortable,
693
+ // and plugin has event defined
694
+ if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
695
+ sortable[plugin.pluginName][eventName](_objectSpread2({
696
+ sortable: sortable
697
+ }, evt));
698
+ }
699
+ });
700
+ },
701
+ initializePlugins: function initializePlugins(sortable, el, defaults, options) {
702
+ plugins.forEach(function (plugin) {
703
+ var pluginName = plugin.pluginName;
704
+ if (!sortable.options[pluginName] && !plugin.initializeByDefault) return;
705
+ var initialized = new plugin(sortable, el, sortable.options);
706
+ initialized.sortable = sortable;
707
+ initialized.options = sortable.options;
708
+ sortable[pluginName] = initialized;
709
+
710
+ // Add default options from plugin
711
+ _extends(defaults, initialized.defaults);
712
+ });
713
+ for (var option in sortable.options) {
714
+ if (!sortable.options.hasOwnProperty(option)) continue;
715
+ var modified = this.modifyOption(sortable, option, sortable.options[option]);
716
+ if (typeof modified !== 'undefined') {
717
+ sortable.options[option] = modified;
718
+ }
719
+ }
720
+ },
721
+ getEventProperties: function getEventProperties(name, sortable) {
722
+ var eventProperties = {};
723
+ plugins.forEach(function (plugin) {
724
+ if (typeof plugin.eventProperties !== 'function') return;
725
+ _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
726
+ });
727
+ return eventProperties;
728
+ },
729
+ modifyOption: function modifyOption(sortable, name, value) {
730
+ var modifiedValue;
731
+ plugins.forEach(function (plugin) {
732
+ // Plugin must exist on the Sortable
733
+ if (!sortable[plugin.pluginName]) return;
734
+
735
+ // If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
736
+ if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
737
+ modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
738
+ }
739
+ });
740
+ return modifiedValue;
741
+ }
742
+ };
743
+
744
+ function dispatchEvent(_ref) {
745
+ var sortable = _ref.sortable,
746
+ rootEl = _ref.rootEl,
747
+ name = _ref.name,
748
+ targetEl = _ref.targetEl,
749
+ cloneEl = _ref.cloneEl,
750
+ toEl = _ref.toEl,
751
+ fromEl = _ref.fromEl,
752
+ oldIndex = _ref.oldIndex,
753
+ newIndex = _ref.newIndex,
754
+ oldDraggableIndex = _ref.oldDraggableIndex,
755
+ newDraggableIndex = _ref.newDraggableIndex,
756
+ originalEvent = _ref.originalEvent,
757
+ putSortable = _ref.putSortable,
758
+ extraEventProperties = _ref.extraEventProperties;
759
+ sortable = sortable || rootEl && rootEl[expando];
760
+ if (!sortable) return;
761
+ var evt,
762
+ options = sortable.options,
763
+ onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
764
+ // Support for new CustomEvent feature
765
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
766
+ evt = new CustomEvent(name, {
767
+ bubbles: true,
768
+ cancelable: true
769
+ });
770
+ } else {
771
+ evt = document.createEvent('Event');
772
+ evt.initEvent(name, true, true);
773
+ }
774
+ evt.to = toEl || rootEl;
775
+ evt.from = fromEl || rootEl;
776
+ evt.item = targetEl || rootEl;
777
+ evt.clone = cloneEl;
778
+ evt.oldIndex = oldIndex;
779
+ evt.newIndex = newIndex;
780
+ evt.oldDraggableIndex = oldDraggableIndex;
781
+ evt.newDraggableIndex = newDraggableIndex;
782
+ evt.originalEvent = originalEvent;
783
+ evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
784
+ var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
785
+ for (var option in allEventProperties) {
786
+ evt[option] = allEventProperties[option];
787
+ }
788
+ if (rootEl) {
789
+ rootEl.dispatchEvent(evt);
790
+ }
791
+ if (options[onName]) {
792
+ options[onName].call(sortable, evt);
793
+ }
794
+ }
795
+
796
+ var _excluded = ["evt"];
797
+ var pluginEvent = function pluginEvent(eventName, sortable) {
798
+ var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
799
+ originalEvent = _ref.evt,
800
+ data = _objectWithoutProperties(_ref, _excluded);
801
+ PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
802
+ dragEl: dragEl,
803
+ parentEl: parentEl,
804
+ ghostEl: ghostEl,
805
+ rootEl: rootEl,
806
+ nextEl: nextEl,
807
+ lastDownEl: lastDownEl,
808
+ cloneEl: cloneEl,
809
+ cloneHidden: cloneHidden,
810
+ dragStarted: moved,
811
+ putSortable: putSortable,
812
+ activeSortable: Sortable.active,
813
+ originalEvent: originalEvent,
814
+ oldIndex: oldIndex,
815
+ oldDraggableIndex: oldDraggableIndex,
816
+ newIndex: newIndex,
817
+ newDraggableIndex: newDraggableIndex,
818
+ hideGhostForTarget: _hideGhostForTarget,
819
+ unhideGhostForTarget: _unhideGhostForTarget,
820
+ cloneNowHidden: function cloneNowHidden() {
821
+ cloneHidden = true;
822
+ },
823
+ cloneNowShown: function cloneNowShown() {
824
+ cloneHidden = false;
825
+ },
826
+ dispatchSortableEvent: function dispatchSortableEvent(name) {
827
+ _dispatchEvent({
828
+ sortable: sortable,
829
+ name: name,
830
+ originalEvent: originalEvent
831
+ });
832
+ }
833
+ }, data));
834
+ };
835
+ function _dispatchEvent(info) {
836
+ dispatchEvent(_objectSpread2({
837
+ putSortable: putSortable,
838
+ cloneEl: cloneEl,
839
+ targetEl: dragEl,
840
+ rootEl: rootEl,
841
+ oldIndex: oldIndex,
842
+ oldDraggableIndex: oldDraggableIndex,
843
+ newIndex: newIndex,
844
+ newDraggableIndex: newDraggableIndex
845
+ }, info));
846
+ }
847
+ var dragEl,
848
+ parentEl,
849
+ ghostEl,
850
+ rootEl,
851
+ nextEl,
852
+ lastDownEl,
853
+ cloneEl,
854
+ cloneHidden,
855
+ oldIndex,
856
+ newIndex,
857
+ oldDraggableIndex,
858
+ newDraggableIndex,
859
+ activeGroup,
860
+ putSortable,
861
+ awaitingDragStarted = false,
862
+ ignoreNextClick = false,
863
+ sortables = [],
864
+ tapEvt,
865
+ touchEvt,
866
+ lastDx,
867
+ lastDy,
868
+ tapDistanceLeft,
869
+ tapDistanceTop,
870
+ moved,
871
+ lastTarget,
872
+ lastDirection,
873
+ pastFirstInvertThresh = false,
874
+ isCircumstantialInvert = false,
875
+ targetMoveDistance,
876
+ // For positioning ghost absolutely
877
+ ghostRelativeParent,
878
+ ghostRelativeParentInitialScroll = [],
879
+ // (left, top)
880
+
881
+ _silent = false,
882
+ savedInputChecked = [];
883
+
884
+ /** @const */
885
+ var documentExists = typeof document !== 'undefined',
886
+ PositionGhostAbsolutely = IOS,
887
+ CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
888
+ // This will not pass for IE9, because IE9 DnD only works on anchors
889
+ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
890
+ supportCssPointerEvents = function () {
891
+ if (!documentExists) return;
892
+ // false when <= IE11
893
+ if (IE11OrLess) {
894
+ return false;
895
+ }
896
+ var el = document.createElement('x');
897
+ el.style.cssText = 'pointer-events:auto';
898
+ return el.style.pointerEvents === 'auto';
899
+ }(),
900
+ _detectDirection = function _detectDirection(el, options) {
901
+ var elCSS = css(el),
902
+ elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
903
+ child1 = getChild(el, 0, options),
904
+ child2 = getChild(el, 1, options),
905
+ firstChildCSS = child1 && css(child1),
906
+ secondChildCSS = child2 && css(child2),
907
+ firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
908
+ secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
909
+ if (elCSS.display === 'flex') {
910
+ return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
911
+ }
912
+ if (elCSS.display === 'grid') {
913
+ return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
914
+ }
915
+ if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
916
+ var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
917
+ return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
918
+ }
919
+ 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';
920
+ },
921
+ _dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
922
+ var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
923
+ dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
924
+ dragElOppLength = vertical ? dragRect.width : dragRect.height,
925
+ targetS1Opp = vertical ? targetRect.left : targetRect.top,
926
+ targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
927
+ targetOppLength = vertical ? targetRect.width : targetRect.height;
928
+ return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
929
+ },
930
+ /**
931
+ * Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
932
+ * @param {Number} x X position
933
+ * @param {Number} y Y position
934
+ * @return {HTMLElement} Element of the first found nearest Sortable
935
+ */
936
+ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
937
+ var ret;
938
+ sortables.some(function (sortable) {
939
+ var threshold = sortable[expando].options.emptyInsertThreshold;
940
+ if (!threshold || lastChild(sortable)) return;
941
+ var rect = getRect(sortable),
942
+ insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
943
+ insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
944
+ if (insideHorizontally && insideVertically) {
945
+ return ret = sortable;
946
+ }
947
+ });
948
+ return ret;
949
+ },
950
+ _prepareGroup = function _prepareGroup(options) {
951
+ function toFn(value, pull) {
952
+ return function (to, from, dragEl, evt) {
953
+ var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
954
+ if (value == null && (pull || sameGroup)) {
955
+ // Default pull value
956
+ // Default pull and put value if same group
957
+ return true;
958
+ } else if (value == null || value === false) {
959
+ return false;
960
+ } else if (pull && value === 'clone') {
961
+ return value;
962
+ } else if (typeof value === 'function') {
963
+ return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
964
+ } else {
965
+ var otherGroup = (pull ? to : from).options.group.name;
966
+ return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
967
+ }
968
+ };
969
+ }
970
+ var group = {};
971
+ var originalGroup = options.group;
972
+ if (!originalGroup || _typeof(originalGroup) != 'object') {
973
+ originalGroup = {
974
+ name: originalGroup
975
+ };
976
+ }
977
+ group.name = originalGroup.name;
978
+ group.checkPull = toFn(originalGroup.pull, true);
979
+ group.checkPut = toFn(originalGroup.put);
980
+ group.revertClone = originalGroup.revertClone;
981
+ options.group = group;
982
+ },
983
+ _hideGhostForTarget = function _hideGhostForTarget() {
984
+ if (!supportCssPointerEvents && ghostEl) {
985
+ css(ghostEl, 'display', 'none');
986
+ }
987
+ },
988
+ _unhideGhostForTarget = function _unhideGhostForTarget() {
989
+ if (!supportCssPointerEvents && ghostEl) {
990
+ css(ghostEl, 'display', '');
991
+ }
992
+ };
993
+
994
+ // #1184 fix - Prevent click event on fallback if dragged but item not changed position
995
+ if (documentExists && !ChromeForAndroid) {
996
+ document.addEventListener('click', function (evt) {
997
+ if (ignoreNextClick) {
998
+ evt.preventDefault();
999
+ evt.stopPropagation && evt.stopPropagation();
1000
+ evt.stopImmediatePropagation && evt.stopImmediatePropagation();
1001
+ ignoreNextClick = false;
1002
+ return false;
1003
+ }
1004
+ }, true);
1005
+ }
1006
+ var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
1007
+ if (dragEl) {
1008
+ evt = evt.touches ? evt.touches[0] : evt;
1009
+ var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
1010
+ if (nearest) {
1011
+ // Create imitation event
1012
+ var event = {};
1013
+ for (var i in evt) {
1014
+ if (evt.hasOwnProperty(i)) {
1015
+ event[i] = evt[i];
1016
+ }
1017
+ }
1018
+ event.target = event.rootEl = nearest;
1019
+ event.preventDefault = void 0;
1020
+ event.stopPropagation = void 0;
1021
+ nearest[expando]._onDragOver(event);
1022
+ }
1023
+ }
1024
+ };
1025
+ var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
1026
+ if (dragEl) {
1027
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1028
+ }
1029
+ };
1030
+
1031
+ /**
1032
+ * @class Sortable
1033
+ * @param {HTMLElement} el
1034
+ * @param {Object} [options]
1035
+ */
1036
+ function Sortable(el, options) {
1037
+ if (!(el && el.nodeType && el.nodeType === 1)) {
1038
+ throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
1039
+ }
1040
+ this.el = el; // root element
1041
+ this.options = options = _extends({}, options);
1042
+
1043
+ // Export instance
1044
+ el[expando] = this;
1045
+ var defaults = {
1046
+ group: null,
1047
+ sort: true,
1048
+ disabled: false,
1049
+ store: null,
1050
+ handle: null,
1051
+ draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
1052
+ swapThreshold: 1,
1053
+ // percentage; 0 <= x <= 1
1054
+ invertSwap: false,
1055
+ // invert always
1056
+ invertedSwapThreshold: null,
1057
+ // will be set to same as swapThreshold if default
1058
+ removeCloneOnHide: true,
1059
+ direction: function direction() {
1060
+ return _detectDirection(el, this.options);
1061
+ },
1062
+ ghostClass: 'sortable-ghost',
1063
+ chosenClass: 'sortable-chosen',
1064
+ dragClass: 'sortable-drag',
1065
+ ignore: 'a, img',
1066
+ filter: null,
1067
+ preventOnFilter: true,
1068
+ animation: 0,
1069
+ easing: null,
1070
+ setData: function setData(dataTransfer, dragEl) {
1071
+ dataTransfer.setData('Text', dragEl.textContent);
1072
+ },
1073
+ dropBubble: false,
1074
+ dragoverBubble: false,
1075
+ dataIdAttr: 'data-id',
1076
+ delay: 0,
1077
+ delayOnTouchOnly: false,
1078
+ touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1079
+ forceFallback: false,
1080
+ fallbackClass: 'sortable-fallback',
1081
+ fallbackOnBody: false,
1082
+ fallbackTolerance: 0,
1083
+ fallbackOffset: {
1084
+ x: 0,
1085
+ y: 0
1086
+ },
1087
+ // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
1088
+ supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
1089
+ emptyInsertThreshold: 5
1090
+ };
1091
+ PluginManager.initializePlugins(this, el, defaults);
1092
+
1093
+ // Set default options
1094
+ for (var name in defaults) {
1095
+ !(name in options) && (options[name] = defaults[name]);
1096
+ }
1097
+ _prepareGroup(options);
1098
+
1099
+ // Bind all private methods
1100
+ for (var fn in this) {
1101
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
1102
+ this[fn] = this[fn].bind(this);
1103
+ }
1104
+ }
1105
+
1106
+ // Setup drag mode
1107
+ this.nativeDraggable = options.forceFallback ? false : supportDraggable;
1108
+ if (this.nativeDraggable) {
1109
+ // Touch start threshold cannot be greater than the native dragstart threshold
1110
+ this.options.touchStartThreshold = 1;
1111
+ }
1112
+
1113
+ // Bind events
1114
+ if (options.supportPointer) {
1115
+ on(el, 'pointerdown', this._onTapStart);
1116
+ } else {
1117
+ on(el, 'mousedown', this._onTapStart);
1118
+ on(el, 'touchstart', this._onTapStart);
1119
+ }
1120
+ if (this.nativeDraggable) {
1121
+ on(el, 'dragover', this);
1122
+ on(el, 'dragenter', this);
1123
+ }
1124
+ sortables.push(this.el);
1125
+
1126
+ // Restore sorting
1127
+ options.store && options.store.get && this.sort(options.store.get(this) || []);
1128
+
1129
+ // Add animation state manager
1130
+ _extends(this, AnimationStateManager());
1131
+ }
1132
+ Sortable.prototype = /** @lends Sortable.prototype */{
1133
+ constructor: Sortable,
1134
+ _isOutsideThisEl: function _isOutsideThisEl(target) {
1135
+ if (!this.el.contains(target) && target !== this.el) {
1136
+ lastTarget = null;
1137
+ }
1138
+ },
1139
+ _getDirection: function _getDirection(evt, target) {
1140
+ return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
1141
+ },
1142
+ _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
1143
+ if (!evt.cancelable) return;
1144
+ var _this = this,
1145
+ el = this.el,
1146
+ options = this.options,
1147
+ preventOnFilter = options.preventOnFilter,
1148
+ type = evt.type,
1149
+ touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
1150
+ target = (touch || evt).target,
1151
+ originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
1152
+ filter = options.filter;
1153
+ _saveInputCheckedState(el);
1154
+
1155
+ // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
1156
+ if (dragEl) {
1157
+ return;
1158
+ }
1159
+ if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
1160
+ return; // only left button and enabled
1161
+ }
1162
+
1163
+ // cancel dnd if original target is content editable
1164
+ if (originalTarget.isContentEditable) {
1165
+ return;
1166
+ }
1167
+
1168
+ // Safari ignores further event handling after mousedown
1169
+ if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
1170
+ return;
1171
+ }
1172
+ target = closest(target, options.draggable, el, false);
1173
+ if (target && target.animated) {
1174
+ return;
1175
+ }
1176
+ if (lastDownEl === target) {
1177
+ // Ignoring duplicate `down`
1178
+ return;
1179
+ }
1180
+
1181
+ // Get the index of the dragged element within its parent
1182
+ oldIndex = index(target);
1183
+ oldDraggableIndex = index(target, options.draggable);
1184
+
1185
+ // Check filter
1186
+ if (typeof filter === 'function') {
1187
+ if (filter.call(this, evt, target, this)) {
1188
+ _dispatchEvent({
1189
+ sortable: _this,
1190
+ rootEl: originalTarget,
1191
+ name: 'filter',
1192
+ targetEl: target,
1193
+ toEl: el,
1194
+ fromEl: el
1195
+ });
1196
+ pluginEvent('filter', _this, {
1197
+ evt: evt
1198
+ });
1199
+ preventOnFilter && evt.preventDefault();
1200
+ return; // cancel dnd
1201
+ }
1202
+ } else if (filter) {
1203
+ filter = filter.split(',').some(function (criteria) {
1204
+ criteria = closest(originalTarget, criteria.trim(), el, false);
1205
+ if (criteria) {
1206
+ _dispatchEvent({
1207
+ sortable: _this,
1208
+ rootEl: criteria,
1209
+ name: 'filter',
1210
+ targetEl: target,
1211
+ fromEl: el,
1212
+ toEl: el
1213
+ });
1214
+ pluginEvent('filter', _this, {
1215
+ evt: evt
1216
+ });
1217
+ return true;
1218
+ }
1219
+ });
1220
+ if (filter) {
1221
+ preventOnFilter && evt.preventDefault();
1222
+ return; // cancel dnd
1223
+ }
1224
+ }
1225
+ if (options.handle && !closest(originalTarget, options.handle, el, false)) {
1226
+ return;
1227
+ }
1228
+
1229
+ // Prepare `dragstart`
1230
+ this._prepareDragStart(evt, touch, target);
1231
+ },
1232
+ _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
1233
+ var _this = this,
1234
+ el = _this.el,
1235
+ options = _this.options,
1236
+ ownerDocument = el.ownerDocument,
1237
+ dragStartFn;
1238
+ if (target && !dragEl && target.parentNode === el) {
1239
+ var dragRect = getRect(target);
1240
+ rootEl = el;
1241
+ dragEl = target;
1242
+ parentEl = dragEl.parentNode;
1243
+ nextEl = dragEl.nextSibling;
1244
+ lastDownEl = target;
1245
+ activeGroup = options.group;
1246
+ Sortable.dragged = dragEl;
1247
+ tapEvt = {
1248
+ target: dragEl,
1249
+ clientX: (touch || evt).clientX,
1250
+ clientY: (touch || evt).clientY
1251
+ };
1252
+ tapDistanceLeft = tapEvt.clientX - dragRect.left;
1253
+ tapDistanceTop = tapEvt.clientY - dragRect.top;
1254
+ this._lastX = (touch || evt).clientX;
1255
+ this._lastY = (touch || evt).clientY;
1256
+ dragEl.style['will-change'] = 'all';
1257
+ dragStartFn = function dragStartFn() {
1258
+ pluginEvent('delayEnded', _this, {
1259
+ evt: evt
1260
+ });
1261
+ if (Sortable.eventCanceled) {
1262
+ _this._onDrop();
1263
+ return;
1264
+ }
1265
+ // Delayed drag has been triggered
1266
+ // we can re-enable the events: touchmove/mousemove
1267
+ _this._disableDelayedDragEvents();
1268
+ if (!FireFox && _this.nativeDraggable) {
1269
+ dragEl.draggable = true;
1270
+ }
1271
+
1272
+ // Bind the events: dragstart/dragend
1273
+ _this._triggerDragStart(evt, touch);
1274
+
1275
+ // Drag start event
1276
+ _dispatchEvent({
1277
+ sortable: _this,
1278
+ name: 'choose',
1279
+ originalEvent: evt
1280
+ });
1281
+
1282
+ // Chosen item
1283
+ toggleClass(dragEl, options.chosenClass, true);
1284
+ };
1285
+
1286
+ // Disable "draggable"
1287
+ options.ignore.split(',').forEach(function (criteria) {
1288
+ find(dragEl, criteria.trim(), _disableDraggable);
1289
+ });
1290
+ on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent);
1291
+ on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent);
1292
+ on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
1293
+ if (options.supportPointer) {
1294
+ on(ownerDocument, 'pointerup', _this._onDrop);
1295
+ // Native D&D triggers pointercancel
1296
+ !this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop);
1297
+ } else {
1298
+ on(ownerDocument, 'mouseup', _this._onDrop);
1299
+ on(ownerDocument, 'touchend', _this._onDrop);
1300
+ on(ownerDocument, 'touchcancel', _this._onDrop);
1301
+ }
1302
+
1303
+ // Make dragEl draggable (must be before delay for FireFox)
1304
+ if (FireFox && this.nativeDraggable) {
1305
+ this.options.touchStartThreshold = 4;
1306
+ dragEl.draggable = true;
1307
+ }
1308
+ pluginEvent('delayStart', this, {
1309
+ evt: evt
1310
+ });
1311
+
1312
+ // Delay is impossible for native DnD in Edge or IE
1313
+ if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
1314
+ if (Sortable.eventCanceled) {
1315
+ this._onDrop();
1316
+ return;
1317
+ }
1318
+ // If the user moves the pointer or let go the click or touch
1319
+ // before the delay has been reached:
1320
+ // disable the delayed drag
1321
+ if (options.supportPointer) {
1322
+ on(ownerDocument, 'pointerup', _this._disableDelayedDrag);
1323
+ on(ownerDocument, 'pointercancel', _this._disableDelayedDrag);
1324
+ } else {
1325
+ on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
1326
+ on(ownerDocument, 'touchend', _this._disableDelayedDrag);
1327
+ on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
1328
+ }
1329
+ on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler);
1330
+ on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler);
1331
+ options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler);
1332
+ _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
1333
+ } else {
1334
+ dragStartFn();
1335
+ }
1336
+ }
1337
+ },
1338
+ _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
1339
+ var touch = e.touches ? e.touches[0] : e;
1340
+ 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))) {
1341
+ this._disableDelayedDrag();
1342
+ }
1343
+ },
1344
+ _disableDelayedDrag: function _disableDelayedDrag() {
1345
+ dragEl && _disableDraggable(dragEl);
1346
+ clearTimeout(this._dragStartTimer);
1347
+ this._disableDelayedDragEvents();
1348
+ },
1349
+ _disableDelayedDragEvents: function _disableDelayedDragEvents() {
1350
+ var ownerDocument = this.el.ownerDocument;
1351
+ off(ownerDocument, 'mouseup', this._disableDelayedDrag);
1352
+ off(ownerDocument, 'touchend', this._disableDelayedDrag);
1353
+ off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
1354
+ off(ownerDocument, 'pointerup', this._disableDelayedDrag);
1355
+ off(ownerDocument, 'pointercancel', this._disableDelayedDrag);
1356
+ off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler);
1357
+ off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
1358
+ off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
1359
+ },
1360
+ _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
1361
+ touch = touch || evt.pointerType == 'touch' && evt;
1362
+ if (!this.nativeDraggable || touch) {
1363
+ if (this.options.supportPointer) {
1364
+ on(document, 'pointermove', this._onTouchMove);
1365
+ } else if (touch) {
1366
+ on(document, 'touchmove', this._onTouchMove);
1367
+ } else {
1368
+ on(document, 'mousemove', this._onTouchMove);
1369
+ }
1370
+ } else {
1371
+ on(dragEl, 'dragend', this);
1372
+ on(rootEl, 'dragstart', this._onDragStart);
1373
+ }
1374
+ try {
1375
+ if (document.selection) {
1376
+ _nextTick(function () {
1377
+ document.selection.empty();
1378
+ });
1379
+ } else {
1380
+ window.getSelection().removeAllRanges();
1381
+ }
1382
+ } catch (err) {}
1383
+ },
1384
+ _dragStarted: function _dragStarted(fallback, evt) {
1385
+ awaitingDragStarted = false;
1386
+ if (rootEl && dragEl) {
1387
+ pluginEvent('dragStarted', this, {
1388
+ evt: evt
1389
+ });
1390
+ if (this.nativeDraggable) {
1391
+ on(document, 'dragover', _checkOutsideTargetEl);
1392
+ }
1393
+ var options = this.options;
1394
+
1395
+ // Apply effect
1396
+ !fallback && toggleClass(dragEl, options.dragClass, false);
1397
+ toggleClass(dragEl, options.ghostClass, true);
1398
+ Sortable.active = this;
1399
+ fallback && this._appendGhost();
1400
+
1401
+ // Drag start event
1402
+ _dispatchEvent({
1403
+ sortable: this,
1404
+ name: 'start',
1405
+ originalEvent: evt
1406
+ });
1407
+ } else {
1408
+ this._nulling();
1409
+ }
1410
+ },
1411
+ _emulateDragOver: function _emulateDragOver() {
1412
+ if (touchEvt) {
1413
+ this._lastX = touchEvt.clientX;
1414
+ this._lastY = touchEvt.clientY;
1415
+ _hideGhostForTarget();
1416
+ var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1417
+ var parent = target;
1418
+ while (target && target.shadowRoot) {
1419
+ target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
1420
+ if (target === parent) break;
1421
+ parent = target;
1422
+ }
1423
+ dragEl.parentNode[expando]._isOutsideThisEl(target);
1424
+ if (parent) {
1425
+ do {
1426
+ if (parent[expando]) {
1427
+ var inserted = void 0;
1428
+ inserted = parent[expando]._onDragOver({
1429
+ clientX: touchEvt.clientX,
1430
+ clientY: touchEvt.clientY,
1431
+ target: target,
1432
+ rootEl: parent
1433
+ });
1434
+ if (inserted && !this.options.dragoverBubble) {
1435
+ break;
1436
+ }
1437
+ }
1438
+ target = parent; // store last element
1439
+ }
1440
+ /* jshint boss:true */ while (parent = getParentOrHost(parent));
1441
+ }
1442
+ _unhideGhostForTarget();
1443
+ }
1444
+ },
1445
+ _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
1446
+ if (tapEvt) {
1447
+ var options = this.options,
1448
+ fallbackTolerance = options.fallbackTolerance,
1449
+ fallbackOffset = options.fallbackOffset,
1450
+ touch = evt.touches ? evt.touches[0] : evt,
1451
+ ghostMatrix = ghostEl && matrix(ghostEl, true),
1452
+ scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
1453
+ scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
1454
+ relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
1455
+ dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
1456
+ dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
1457
+
1458
+ // only set the status to dragging, when we are actually dragging
1459
+ if (!Sortable.active && !awaitingDragStarted) {
1460
+ if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
1461
+ return;
1462
+ }
1463
+ this._onDragStart(evt, true);
1464
+ }
1465
+ if (ghostEl) {
1466
+ if (ghostMatrix) {
1467
+ ghostMatrix.e += dx - (lastDx || 0);
1468
+ ghostMatrix.f += dy - (lastDy || 0);
1469
+ } else {
1470
+ ghostMatrix = {
1471
+ a: 1,
1472
+ b: 0,
1473
+ c: 0,
1474
+ d: 1,
1475
+ e: dx,
1476
+ f: dy
1477
+ };
1478
+ }
1479
+ var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
1480
+ css(ghostEl, 'webkitTransform', cssMatrix);
1481
+ css(ghostEl, 'mozTransform', cssMatrix);
1482
+ css(ghostEl, 'msTransform', cssMatrix);
1483
+ css(ghostEl, 'transform', cssMatrix);
1484
+ lastDx = dx;
1485
+ lastDy = dy;
1486
+ touchEvt = touch;
1487
+ }
1488
+ evt.cancelable && evt.preventDefault();
1489
+ }
1490
+ },
1491
+ _appendGhost: function _appendGhost() {
1492
+ // Bug if using scale(): https://stackoverflow.com/questions/2637058
1493
+ // Not being adjusted for
1494
+ if (!ghostEl) {
1495
+ var container = this.options.fallbackOnBody ? document.body : rootEl,
1496
+ rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
1497
+ options = this.options;
1498
+
1499
+ // Position absolutely
1500
+ if (PositionGhostAbsolutely) {
1501
+ // Get relatively positioned parent
1502
+ ghostRelativeParent = container;
1503
+ while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
1504
+ ghostRelativeParent = ghostRelativeParent.parentNode;
1505
+ }
1506
+ if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
1507
+ if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
1508
+ rect.top += ghostRelativeParent.scrollTop;
1509
+ rect.left += ghostRelativeParent.scrollLeft;
1510
+ } else {
1511
+ ghostRelativeParent = getWindowScrollingElement();
1512
+ }
1513
+ ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
1514
+ }
1515
+ ghostEl = dragEl.cloneNode(true);
1516
+ toggleClass(ghostEl, options.ghostClass, false);
1517
+ toggleClass(ghostEl, options.fallbackClass, true);
1518
+ toggleClass(ghostEl, options.dragClass, true);
1519
+ css(ghostEl, 'transition', '');
1520
+ css(ghostEl, 'transform', '');
1521
+ css(ghostEl, 'box-sizing', 'border-box');
1522
+ css(ghostEl, 'margin', 0);
1523
+ css(ghostEl, 'top', rect.top);
1524
+ css(ghostEl, 'left', rect.left);
1525
+ css(ghostEl, 'width', rect.width);
1526
+ css(ghostEl, 'height', rect.height);
1527
+ css(ghostEl, 'opacity', '0.8');
1528
+ css(ghostEl, 'position', PositionGhostAbsolutely ? 'absolute' : 'fixed');
1529
+ css(ghostEl, 'zIndex', '100000');
1530
+ css(ghostEl, 'pointerEvents', 'none');
1531
+ Sortable.ghost = ghostEl;
1532
+ container.appendChild(ghostEl);
1533
+
1534
+ // Set transform-origin
1535
+ css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
1536
+ }
1537
+ },
1538
+ _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
1539
+ var _this = this;
1540
+ var dataTransfer = evt.dataTransfer;
1541
+ var options = _this.options;
1542
+ pluginEvent('dragStart', this, {
1543
+ evt: evt
1544
+ });
1545
+ if (Sortable.eventCanceled) {
1546
+ this._onDrop();
1547
+ return;
1548
+ }
1549
+ pluginEvent('setupClone', this);
1550
+ if (!Sortable.eventCanceled) {
1551
+ cloneEl = clone(dragEl);
1552
+ cloneEl.removeAttribute("id");
1553
+ cloneEl.draggable = false;
1554
+ cloneEl.style['will-change'] = '';
1555
+ this._hideClone();
1556
+ toggleClass(cloneEl, this.options.chosenClass, false);
1557
+ Sortable.clone = cloneEl;
1558
+ }
1559
+
1560
+ // #1143: IFrame support workaround
1561
+ _this.cloneId = _nextTick(function () {
1562
+ pluginEvent('clone', _this);
1563
+ if (Sortable.eventCanceled) return;
1564
+ if (!_this.options.removeCloneOnHide) {
1565
+ rootEl.insertBefore(cloneEl, dragEl);
1566
+ }
1567
+ _this._hideClone();
1568
+ _dispatchEvent({
1569
+ sortable: _this,
1570
+ name: 'clone'
1571
+ });
1572
+ });
1573
+ !fallback && toggleClass(dragEl, options.dragClass, true);
1574
+
1575
+ // Set proper drop events
1576
+ if (fallback) {
1577
+ ignoreNextClick = true;
1578
+ _this._loopId = setInterval(_this._emulateDragOver, 50);
1579
+ } else {
1580
+ // Undo what was set in _prepareDragStart before drag started
1581
+ off(document, 'mouseup', _this._onDrop);
1582
+ off(document, 'touchend', _this._onDrop);
1583
+ off(document, 'touchcancel', _this._onDrop);
1584
+ if (dataTransfer) {
1585
+ dataTransfer.effectAllowed = 'move';
1586
+ options.setData && options.setData.call(_this, dataTransfer, dragEl);
1587
+ }
1588
+ on(document, 'drop', _this);
1589
+
1590
+ // #1276 fix:
1591
+ css(dragEl, 'transform', 'translateZ(0)');
1592
+ }
1593
+ awaitingDragStarted = true;
1594
+ _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
1595
+ on(document, 'selectstart', _this);
1596
+ moved = true;
1597
+ window.getSelection().removeAllRanges();
1598
+ if (Safari) {
1599
+ css(document.body, 'user-select', 'none');
1600
+ }
1601
+ },
1602
+ // Returns true - if no further action is needed (either inserted or another condition)
1603
+ _onDragOver: function _onDragOver( /**Event*/evt) {
1604
+ var el = this.el,
1605
+ target = evt.target,
1606
+ dragRect,
1607
+ targetRect,
1608
+ revert,
1609
+ options = this.options,
1610
+ group = options.group,
1611
+ activeSortable = Sortable.active,
1612
+ isOwner = activeGroup === group,
1613
+ canSort = options.sort,
1614
+ fromSortable = putSortable || activeSortable,
1615
+ vertical,
1616
+ _this = this,
1617
+ completedFired = false;
1618
+ if (_silent) return;
1619
+ function dragOverEvent(name, extra) {
1620
+ pluginEvent(name, _this, _objectSpread2({
1621
+ evt: evt,
1622
+ isOwner: isOwner,
1623
+ axis: vertical ? 'vertical' : 'horizontal',
1624
+ revert: revert,
1625
+ dragRect: dragRect,
1626
+ targetRect: targetRect,
1627
+ canSort: canSort,
1628
+ fromSortable: fromSortable,
1629
+ target: target,
1630
+ completed: completed,
1631
+ onMove: function onMove(target, after) {
1632
+ return _onMove(rootEl, el, dragEl, dragRect, target, getRect(target), evt, after);
1633
+ },
1634
+ changed: changed
1635
+ }, extra));
1636
+ }
1637
+
1638
+ // Capture animation state
1639
+ function capture() {
1640
+ dragOverEvent('dragOverAnimationCapture');
1641
+ _this.captureAnimationState();
1642
+ if (_this !== fromSortable) {
1643
+ fromSortable.captureAnimationState();
1644
+ }
1645
+ }
1646
+
1647
+ // Return invocation when dragEl is inserted (or completed)
1648
+ function completed(insertion) {
1649
+ dragOverEvent('dragOverCompleted', {
1650
+ insertion: insertion
1651
+ });
1652
+ if (insertion) {
1653
+ // Clones must be hidden before folding animation to capture dragRectAbsolute properly
1654
+ if (isOwner) {
1655
+ activeSortable._hideClone();
1656
+ } else {
1657
+ activeSortable._showClone(_this);
1658
+ }
1659
+ if (_this !== fromSortable) {
1660
+ // Set ghost class to new sortable's ghost class
1661
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
1662
+ toggleClass(dragEl, options.ghostClass, true);
1663
+ }
1664
+ if (putSortable !== _this && _this !== Sortable.active) {
1665
+ putSortable = _this;
1666
+ } else if (_this === Sortable.active && putSortable) {
1667
+ putSortable = null;
1668
+ }
1669
+
1670
+ // Animation
1671
+ if (fromSortable === _this) {
1672
+ _this._ignoreWhileAnimating = target;
1673
+ }
1674
+ _this.animateAll(function () {
1675
+ dragOverEvent('dragOverAnimationComplete');
1676
+ _this._ignoreWhileAnimating = null;
1677
+ });
1678
+ if (_this !== fromSortable) {
1679
+ fromSortable.animateAll();
1680
+ fromSortable._ignoreWhileAnimating = null;
1681
+ }
1682
+ }
1683
+
1684
+ // Null lastTarget if it is not inside a previously swapped element
1685
+ if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
1686
+ lastTarget = null;
1687
+ }
1688
+
1689
+ // no bubbling and not fallback
1690
+ if (!options.dragoverBubble && !evt.rootEl && target !== document) {
1691
+ dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
1692
+
1693
+ // Do not detect for empty insert if already inserted
1694
+ !insertion && nearestEmptyInsertDetectEvent(evt);
1695
+ }
1696
+ !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
1697
+ return completedFired = true;
1698
+ }
1699
+
1700
+ // Call when dragEl has been inserted
1701
+ function changed() {
1702
+ newIndex = index(dragEl);
1703
+ newDraggableIndex = index(dragEl, options.draggable);
1704
+ _dispatchEvent({
1705
+ sortable: _this,
1706
+ name: 'change',
1707
+ toEl: el,
1708
+ newIndex: newIndex,
1709
+ newDraggableIndex: newDraggableIndex,
1710
+ originalEvent: evt
1711
+ });
1712
+ }
1713
+ if (evt.preventDefault !== void 0) {
1714
+ evt.cancelable && evt.preventDefault();
1715
+ }
1716
+ target = closest(target, options.draggable, el, true);
1717
+ dragOverEvent('dragOver');
1718
+ if (Sortable.eventCanceled) return completedFired;
1719
+ if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
1720
+ return completed(false);
1721
+ }
1722
+ ignoreNextClick = false;
1723
+ if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
1724
+ : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
1725
+ vertical = this._getDirection(evt, target) === 'vertical';
1726
+ dragRect = getRect(dragEl);
1727
+ dragOverEvent('dragOverValid');
1728
+ if (Sortable.eventCanceled) return completedFired;
1729
+ if (revert) {
1730
+ parentEl = rootEl; // actualization
1731
+ capture();
1732
+ this._hideClone();
1733
+ dragOverEvent('revert');
1734
+ if (!Sortable.eventCanceled) {
1735
+ if (nextEl) {
1736
+ rootEl.insertBefore(dragEl, nextEl);
1737
+ } else {
1738
+ rootEl.appendChild(dragEl);
1739
+ }
1740
+ }
1741
+ return completed(true);
1742
+ }
1743
+ var elLastChild = lastChild(el, options.draggable);
1744
+ if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
1745
+ // Insert to end of list
1746
+
1747
+ // If already at end of list: Do not insert
1748
+ if (elLastChild === dragEl) {
1749
+ return completed(false);
1750
+ }
1751
+
1752
+ // if there is a last element, it is the target
1753
+ if (elLastChild && el === evt.target) {
1754
+ target = elLastChild;
1755
+ }
1756
+ if (target) {
1757
+ targetRect = getRect(target);
1758
+ }
1759
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
1760
+ capture();
1761
+ if (elLastChild && elLastChild.nextSibling) {
1762
+ // the last draggable element is not the last node
1763
+ el.insertBefore(dragEl, elLastChild.nextSibling);
1764
+ } else {
1765
+ el.appendChild(dragEl);
1766
+ }
1767
+ parentEl = el; // actualization
1768
+
1769
+ changed();
1770
+ return completed(true);
1771
+ }
1772
+ } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
1773
+ // Insert to start of list
1774
+ var firstChild = getChild(el, 0, options, true);
1775
+ if (firstChild === dragEl) {
1776
+ return completed(false);
1777
+ }
1778
+ target = firstChild;
1779
+ targetRect = getRect(target);
1780
+ if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
1781
+ capture();
1782
+ el.insertBefore(dragEl, firstChild);
1783
+ parentEl = el; // actualization
1784
+
1785
+ changed();
1786
+ return completed(true);
1787
+ }
1788
+ } else if (target.parentNode === el) {
1789
+ targetRect = getRect(target);
1790
+ var direction = 0,
1791
+ targetBeforeFirstSwap,
1792
+ differentLevel = dragEl.parentNode !== el,
1793
+ differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
1794
+ side1 = vertical ? 'top' : 'left',
1795
+ scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
1796
+ scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
1797
+ if (lastTarget !== target) {
1798
+ targetBeforeFirstSwap = targetRect[side1];
1799
+ pastFirstInvertThresh = false;
1800
+ isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
1801
+ }
1802
+ direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
1803
+ var sibling;
1804
+ if (direction !== 0) {
1805
+ // Check if target is beside dragEl in respective direction (ignoring hidden elements)
1806
+ var dragIndex = index(dragEl);
1807
+ do {
1808
+ dragIndex -= direction;
1809
+ sibling = parentEl.children[dragIndex];
1810
+ } while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
1811
+ }
1812
+ // If dragEl is already beside target: Do not insert
1813
+ if (direction === 0 || sibling === target) {
1814
+ return completed(false);
1815
+ }
1816
+ lastTarget = target;
1817
+ lastDirection = direction;
1818
+ var nextSibling = target.nextElementSibling,
1819
+ after = false;
1820
+ after = direction === 1;
1821
+ var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
1822
+ if (moveVector !== false) {
1823
+ if (moveVector === 1 || moveVector === -1) {
1824
+ after = moveVector === 1;
1825
+ }
1826
+ _silent = true;
1827
+ setTimeout(_unsilent, 30);
1828
+ capture();
1829
+ if (after && !nextSibling) {
1830
+ el.appendChild(dragEl);
1831
+ } else {
1832
+ target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
1833
+ }
1834
+
1835
+ // Undo chrome's scroll adjustment (has no effect on other browsers)
1836
+ if (scrolledPastTop) {
1837
+ scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
1838
+ }
1839
+ parentEl = dragEl.parentNode; // actualization
1840
+
1841
+ // must be done before animation
1842
+ if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
1843
+ targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
1844
+ }
1845
+ changed();
1846
+ return completed(true);
1847
+ }
1848
+ }
1849
+ if (el.contains(dragEl)) {
1850
+ return completed(false);
1851
+ }
1852
+ }
1853
+ return false;
1854
+ },
1855
+ _ignoreWhileAnimating: null,
1856
+ _offMoveEvents: function _offMoveEvents() {
1857
+ off(document, 'mousemove', this._onTouchMove);
1858
+ off(document, 'touchmove', this._onTouchMove);
1859
+ off(document, 'pointermove', this._onTouchMove);
1860
+ off(document, 'dragover', nearestEmptyInsertDetectEvent);
1861
+ off(document, 'mousemove', nearestEmptyInsertDetectEvent);
1862
+ off(document, 'touchmove', nearestEmptyInsertDetectEvent);
1863
+ },
1864
+ _offUpEvents: function _offUpEvents() {
1865
+ var ownerDocument = this.el.ownerDocument;
1866
+ off(ownerDocument, 'mouseup', this._onDrop);
1867
+ off(ownerDocument, 'touchend', this._onDrop);
1868
+ off(ownerDocument, 'pointerup', this._onDrop);
1869
+ off(ownerDocument, 'pointercancel', this._onDrop);
1870
+ off(ownerDocument, 'touchcancel', this._onDrop);
1871
+ off(document, 'selectstart', this);
1872
+ },
1873
+ _onDrop: function _onDrop( /**Event*/evt) {
1874
+ var el = this.el,
1875
+ options = this.options;
1876
+
1877
+ // Get the index of the dragged element within its parent
1878
+ newIndex = index(dragEl);
1879
+ newDraggableIndex = index(dragEl, options.draggable);
1880
+ pluginEvent('drop', this, {
1881
+ evt: evt
1882
+ });
1883
+ parentEl = dragEl && dragEl.parentNode;
1884
+
1885
+ // Get again after plugin event
1886
+ newIndex = index(dragEl);
1887
+ newDraggableIndex = index(dragEl, options.draggable);
1888
+ if (Sortable.eventCanceled) {
1889
+ this._nulling();
1890
+ return;
1891
+ }
1892
+ awaitingDragStarted = false;
1893
+ isCircumstantialInvert = false;
1894
+ pastFirstInvertThresh = false;
1895
+ clearInterval(this._loopId);
1896
+ clearTimeout(this._dragStartTimer);
1897
+ _cancelNextTick(this.cloneId);
1898
+ _cancelNextTick(this._dragStartId);
1899
+
1900
+ // Unbind events
1901
+ if (this.nativeDraggable) {
1902
+ off(document, 'drop', this);
1903
+ off(el, 'dragstart', this._onDragStart);
1904
+ }
1905
+ this._offMoveEvents();
1906
+ this._offUpEvents();
1907
+ if (Safari) {
1908
+ css(document.body, 'user-select', '');
1909
+ }
1910
+ css(dragEl, 'transform', '');
1911
+ if (evt) {
1912
+ if (moved) {
1913
+ evt.cancelable && evt.preventDefault();
1914
+ !options.dropBubble && evt.stopPropagation();
1915
+ }
1916
+ ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
1917
+ if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
1918
+ // Remove clone(s)
1919
+ cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
1920
+ }
1921
+ if (dragEl) {
1922
+ if (this.nativeDraggable) {
1923
+ off(dragEl, 'dragend', this);
1924
+ }
1925
+ _disableDraggable(dragEl);
1926
+ dragEl.style['will-change'] = '';
1927
+
1928
+ // Remove classes
1929
+ // ghostClass is added in dragStarted
1930
+ if (moved && !awaitingDragStarted) {
1931
+ toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
1932
+ }
1933
+ toggleClass(dragEl, this.options.chosenClass, false);
1934
+
1935
+ // Drag stop event
1936
+ _dispatchEvent({
1937
+ sortable: this,
1938
+ name: 'unchoose',
1939
+ toEl: parentEl,
1940
+ newIndex: null,
1941
+ newDraggableIndex: null,
1942
+ originalEvent: evt
1943
+ });
1944
+ if (rootEl !== parentEl) {
1945
+ if (newIndex >= 0) {
1946
+ // Add event
1947
+ _dispatchEvent({
1948
+ rootEl: parentEl,
1949
+ name: 'add',
1950
+ toEl: parentEl,
1951
+ fromEl: rootEl,
1952
+ originalEvent: evt
1953
+ });
1954
+
1955
+ // Remove event
1956
+ _dispatchEvent({
1957
+ sortable: this,
1958
+ name: 'remove',
1959
+ toEl: parentEl,
1960
+ originalEvent: evt
1961
+ });
1962
+
1963
+ // drag from one list and drop into another
1964
+ _dispatchEvent({
1965
+ rootEl: parentEl,
1966
+ name: 'sort',
1967
+ toEl: parentEl,
1968
+ fromEl: rootEl,
1969
+ originalEvent: evt
1970
+ });
1971
+ _dispatchEvent({
1972
+ sortable: this,
1973
+ name: 'sort',
1974
+ toEl: parentEl,
1975
+ originalEvent: evt
1976
+ });
1977
+ }
1978
+ putSortable && putSortable.save();
1979
+ } else {
1980
+ if (newIndex !== oldIndex) {
1981
+ if (newIndex >= 0) {
1982
+ // drag & drop within the same list
1983
+ _dispatchEvent({
1984
+ sortable: this,
1985
+ name: 'update',
1986
+ toEl: parentEl,
1987
+ originalEvent: evt
1988
+ });
1989
+ _dispatchEvent({
1990
+ sortable: this,
1991
+ name: 'sort',
1992
+ toEl: parentEl,
1993
+ originalEvent: evt
1994
+ });
1995
+ }
1996
+ }
1997
+ }
1998
+ if (Sortable.active) {
1999
+ /* jshint eqnull:true */
2000
+ if (newIndex == null || newIndex === -1) {
2001
+ newIndex = oldIndex;
2002
+ newDraggableIndex = oldDraggableIndex;
2003
+ }
2004
+ _dispatchEvent({
2005
+ sortable: this,
2006
+ name: 'end',
2007
+ toEl: parentEl,
2008
+ originalEvent: evt
2009
+ });
2010
+
2011
+ // Save sorting
2012
+ this.save();
2013
+ }
2014
+ }
2015
+ }
2016
+ this._nulling();
2017
+ },
2018
+ _nulling: function _nulling() {
2019
+ pluginEvent('nulling', this);
2020
+ 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;
2021
+ savedInputChecked.forEach(function (el) {
2022
+ el.checked = true;
2023
+ });
2024
+ savedInputChecked.length = lastDx = lastDy = 0;
2025
+ },
2026
+ handleEvent: function handleEvent( /**Event*/evt) {
2027
+ switch (evt.type) {
2028
+ case 'drop':
2029
+ case 'dragend':
2030
+ this._onDrop(evt);
2031
+ break;
2032
+ case 'dragenter':
2033
+ case 'dragover':
2034
+ if (dragEl) {
2035
+ this._onDragOver(evt);
2036
+ _globalDragOver(evt);
2037
+ }
2038
+ break;
2039
+ case 'selectstart':
2040
+ evt.preventDefault();
2041
+ break;
2042
+ }
2043
+ },
2044
+ /**
2045
+ * Serializes the item into an array of string.
2046
+ * @returns {String[]}
2047
+ */
2048
+ toArray: function toArray() {
2049
+ var order = [],
2050
+ el,
2051
+ children = this.el.children,
2052
+ i = 0,
2053
+ n = children.length,
2054
+ options = this.options;
2055
+ for (; i < n; i++) {
2056
+ el = children[i];
2057
+ if (closest(el, options.draggable, this.el, false)) {
2058
+ order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
2059
+ }
2060
+ }
2061
+ return order;
2062
+ },
2063
+ /**
2064
+ * Sorts the elements according to the array.
2065
+ * @param {String[]} order order of the items
2066
+ */
2067
+ sort: function sort(order, useAnimation) {
2068
+ var items = {},
2069
+ rootEl = this.el;
2070
+ this.toArray().forEach(function (id, i) {
2071
+ var el = rootEl.children[i];
2072
+ if (closest(el, this.options.draggable, rootEl, false)) {
2073
+ items[id] = el;
2074
+ }
2075
+ }, this);
2076
+ useAnimation && this.captureAnimationState();
2077
+ order.forEach(function (id) {
2078
+ if (items[id]) {
2079
+ rootEl.removeChild(items[id]);
2080
+ rootEl.appendChild(items[id]);
2081
+ }
2082
+ });
2083
+ useAnimation && this.animateAll();
2084
+ },
2085
+ /**
2086
+ * Save the current sorting
2087
+ */
2088
+ save: function save() {
2089
+ var store = this.options.store;
2090
+ store && store.set && store.set(this);
2091
+ },
2092
+ /**
2093
+ * 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.
2094
+ * @param {HTMLElement} el
2095
+ * @param {String} [selector] default: `options.draggable`
2096
+ * @returns {HTMLElement|null}
2097
+ */
2098
+ closest: function closest$1(el, selector) {
2099
+ return closest(el, selector || this.options.draggable, this.el, false);
2100
+ },
2101
+ /**
2102
+ * Set/get option
2103
+ * @param {string} name
2104
+ * @param {*} [value]
2105
+ * @returns {*}
2106
+ */
2107
+ option: function option(name, value) {
2108
+ var options = this.options;
2109
+ if (value === void 0) {
2110
+ return options[name];
2111
+ } else {
2112
+ var modifiedValue = PluginManager.modifyOption(this, name, value);
2113
+ if (typeof modifiedValue !== 'undefined') {
2114
+ options[name] = modifiedValue;
2115
+ } else {
2116
+ options[name] = value;
2117
+ }
2118
+ if (name === 'group') {
2119
+ _prepareGroup(options);
2120
+ }
2121
+ }
2122
+ },
2123
+ /**
2124
+ * Destroy
2125
+ */
2126
+ destroy: function destroy() {
2127
+ pluginEvent('destroy', this);
2128
+ var el = this.el;
2129
+ el[expando] = null;
2130
+ off(el, 'mousedown', this._onTapStart);
2131
+ off(el, 'touchstart', this._onTapStart);
2132
+ off(el, 'pointerdown', this._onTapStart);
2133
+ if (this.nativeDraggable) {
2134
+ off(el, 'dragover', this);
2135
+ off(el, 'dragenter', this);
2136
+ }
2137
+ // Remove draggable attributes
2138
+ Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
2139
+ el.removeAttribute('draggable');
2140
+ });
2141
+ this._onDrop();
2142
+ this._disableDelayedDragEvents();
2143
+ sortables.splice(sortables.indexOf(this.el), 1);
2144
+ this.el = el = null;
2145
+ },
2146
+ _hideClone: function _hideClone() {
2147
+ if (!cloneHidden) {
2148
+ pluginEvent('hideClone', this);
2149
+ if (Sortable.eventCanceled) return;
2150
+ css(cloneEl, 'display', 'none');
2151
+ if (this.options.removeCloneOnHide && cloneEl.parentNode) {
2152
+ cloneEl.parentNode.removeChild(cloneEl);
2153
+ }
2154
+ cloneHidden = true;
2155
+ }
2156
+ },
2157
+ _showClone: function _showClone(putSortable) {
2158
+ if (putSortable.lastPutMode !== 'clone') {
2159
+ this._hideClone();
2160
+ return;
2161
+ }
2162
+ if (cloneHidden) {
2163
+ pluginEvent('showClone', this);
2164
+ if (Sortable.eventCanceled) return;
2165
+
2166
+ // show clone at dragEl or original position
2167
+ if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
2168
+ rootEl.insertBefore(cloneEl, dragEl);
2169
+ } else if (nextEl) {
2170
+ rootEl.insertBefore(cloneEl, nextEl);
2171
+ } else {
2172
+ rootEl.appendChild(cloneEl);
2173
+ }
2174
+ if (this.options.group.revertClone) {
2175
+ this.animate(dragEl, cloneEl);
2176
+ }
2177
+ css(cloneEl, 'display', '');
2178
+ cloneHidden = false;
2179
+ }
2180
+ }
2181
+ };
2182
+ function _globalDragOver( /**Event*/evt) {
2183
+ if (evt.dataTransfer) {
2184
+ evt.dataTransfer.dropEffect = 'move';
2185
+ }
2186
+ evt.cancelable && evt.preventDefault();
2187
+ }
2188
+ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
2189
+ var evt,
2190
+ sortable = fromEl[expando],
2191
+ onMoveFn = sortable.options.onMove,
2192
+ retVal;
2193
+ // Support for new CustomEvent feature
2194
+ if (window.CustomEvent && !IE11OrLess && !Edge) {
2195
+ evt = new CustomEvent('move', {
2196
+ bubbles: true,
2197
+ cancelable: true
2198
+ });
2199
+ } else {
2200
+ evt = document.createEvent('Event');
2201
+ evt.initEvent('move', true, true);
2202
+ }
2203
+ evt.to = toEl;
2204
+ evt.from = fromEl;
2205
+ evt.dragged = dragEl;
2206
+ evt.draggedRect = dragRect;
2207
+ evt.related = targetEl || toEl;
2208
+ evt.relatedRect = targetRect || getRect(toEl);
2209
+ evt.willInsertAfter = willInsertAfter;
2210
+ evt.originalEvent = originalEvent;
2211
+ fromEl.dispatchEvent(evt);
2212
+ if (onMoveFn) {
2213
+ retVal = onMoveFn.call(sortable, evt, originalEvent);
2214
+ }
2215
+ return retVal;
2216
+ }
2217
+ function _disableDraggable(el) {
2218
+ el.draggable = false;
2219
+ }
2220
+ function _unsilent() {
2221
+ _silent = false;
2222
+ }
2223
+ function _ghostIsFirst(evt, vertical, sortable) {
2224
+ var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
2225
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
2226
+ var spacer = 10;
2227
+ 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;
2228
+ }
2229
+ function _ghostIsLast(evt, vertical, sortable) {
2230
+ var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
2231
+ var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
2232
+ var spacer = 10;
2233
+ 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;
2234
+ }
2235
+ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
2236
+ var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
2237
+ targetLength = vertical ? targetRect.height : targetRect.width,
2238
+ targetS1 = vertical ? targetRect.top : targetRect.left,
2239
+ targetS2 = vertical ? targetRect.bottom : targetRect.right,
2240
+ invert = false;
2241
+ if (!invertSwap) {
2242
+ // Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
2243
+ if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
2244
+ // multiplied only by swapThreshold because mouse will already be inside target by (1 - threshold) * targetLength / 2
2245
+ // check if past first invert threshold on side opposite of lastDirection
2246
+ if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) {
2247
+ // past first invert threshold, do not restrict inverted threshold to dragEl shadow
2248
+ pastFirstInvertThresh = true;
2249
+ }
2250
+ if (!pastFirstInvertThresh) {
2251
+ // dragEl shadow (target move distance shadow)
2252
+ if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
2253
+ : mouseOnAxis > targetS2 - targetMoveDistance) {
2254
+ return -lastDirection;
2255
+ }
2256
+ } else {
2257
+ invert = true;
2258
+ }
2259
+ } else {
2260
+ // Regular
2261
+ if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) {
2262
+ return _getInsertDirection(target);
2263
+ }
2264
+ }
2265
+ }
2266
+ invert = invert || invertSwap;
2267
+ if (invert) {
2268
+ // Invert of regular
2269
+ if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
2270
+ return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
2271
+ }
2272
+ }
2273
+ return 0;
2274
+ }
2275
+
2276
+ /**
2277
+ * Gets the direction dragEl must be swapped relative to target in order to make it
2278
+ * seem that dragEl has been "inserted" into that element's position
2279
+ * @param {HTMLElement} target The target whose position dragEl is being inserted at
2280
+ * @return {Number} Direction dragEl must be swapped
2281
+ */
2282
+ function _getInsertDirection(target) {
2283
+ if (index(dragEl) < index(target)) {
2284
+ return 1;
2285
+ } else {
2286
+ return -1;
2287
+ }
2288
+ }
2289
+
2290
+ /**
2291
+ * Generate id
2292
+ * @param {HTMLElement} el
2293
+ * @returns {String}
2294
+ * @private
2295
+ */
2296
+ function _generateId(el) {
2297
+ var str = el.tagName + el.className + el.src + el.href + el.textContent,
2298
+ i = str.length,
2299
+ sum = 0;
2300
+ while (i--) {
2301
+ sum += str.charCodeAt(i);
2302
+ }
2303
+ return sum.toString(36);
2304
+ }
2305
+ function _saveInputCheckedState(root) {
2306
+ savedInputChecked.length = 0;
2307
+ var inputs = root.getElementsByTagName('input');
2308
+ var idx = inputs.length;
2309
+ while (idx--) {
2310
+ var el = inputs[idx];
2311
+ el.checked && savedInputChecked.push(el);
2312
+ }
2313
+ }
2314
+ function _nextTick(fn) {
2315
+ return setTimeout(fn, 0);
2316
+ }
2317
+ function _cancelNextTick(id) {
2318
+ return clearTimeout(id);
2319
+ }
2320
+
2321
+ // Fixed #973:
2322
+ if (documentExists) {
2323
+ on(document, 'touchmove', function (evt) {
2324
+ if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
2325
+ evt.preventDefault();
2326
+ }
2327
+ });
2328
+ }
2329
+
2330
+ // Export utils
2331
+ Sortable.utils = {
2332
+ on: on,
2333
+ off: off,
2334
+ css: css,
2335
+ find: find,
2336
+ is: function is(el, selector) {
2337
+ return !!closest(el, selector, el, false);
2338
+ },
2339
+ extend: extend,
2340
+ throttle: throttle,
2341
+ closest: closest,
2342
+ toggleClass: toggleClass,
2343
+ clone: clone,
2344
+ index: index,
2345
+ nextTick: _nextTick,
2346
+ cancelNextTick: _cancelNextTick,
2347
+ detectDirection: _detectDirection,
2348
+ getChild: getChild,
2349
+ expando: expando
2350
+ };
2351
+
2352
+ /**
2353
+ * Get the Sortable instance of an element
2354
+ * @param {HTMLElement} element The element
2355
+ * @return {Sortable|undefined} The instance of Sortable
2356
+ */
2357
+ Sortable.get = function (element) {
2358
+ return element[expando];
2359
+ };
2360
+
2361
+ /**
2362
+ * Mount a plugin to Sortable
2363
+ * @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
2364
+ */
2365
+ Sortable.mount = function () {
2366
+ for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
2367
+ plugins[_key] = arguments[_key];
2368
+ }
2369
+ if (plugins[0].constructor === Array) plugins = plugins[0];
2370
+ plugins.forEach(function (plugin) {
2371
+ if (!plugin.prototype || !plugin.prototype.constructor) {
2372
+ throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
2373
+ }
2374
+ if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
2375
+ PluginManager.mount(plugin);
2376
+ });
2377
+ };
2378
+
2379
+ /**
2380
+ * Create sortable instance
2381
+ * @param {HTMLElement} el
2382
+ * @param {Object} [options]
2383
+ */
2384
+ Sortable.create = function (el, options) {
2385
+ return new Sortable(el, options);
2386
+ };
2387
+
2388
+ // Export
2389
+ Sortable.version = version;
2390
+
2391
+ var autoScrolls = [],
2392
+ scrollEl,
2393
+ scrollRootEl,
2394
+ scrolling = false,
2395
+ lastAutoScrollX,
2396
+ lastAutoScrollY,
2397
+ touchEvt$1,
2398
+ pointerElemChangedInterval;
2399
+ function AutoScrollPlugin() {
2400
+ function AutoScroll() {
2401
+ this.defaults = {
2402
+ scroll: true,
2403
+ forceAutoScrollFallback: false,
2404
+ scrollSensitivity: 30,
2405
+ scrollSpeed: 10,
2406
+ bubbleScroll: true
2407
+ };
2408
+
2409
+ // Bind all private methods
2410
+ for (var fn in this) {
2411
+ if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
2412
+ this[fn] = this[fn].bind(this);
2413
+ }
2414
+ }
2415
+ }
2416
+ AutoScroll.prototype = {
2417
+ dragStarted: function dragStarted(_ref) {
2418
+ var originalEvent = _ref.originalEvent;
2419
+ if (this.sortable.nativeDraggable) {
2420
+ on(document, 'dragover', this._handleAutoScroll);
2421
+ } else {
2422
+ if (this.options.supportPointer) {
2423
+ on(document, 'pointermove', this._handleFallbackAutoScroll);
2424
+ } else if (originalEvent.touches) {
2425
+ on(document, 'touchmove', this._handleFallbackAutoScroll);
2426
+ } else {
2427
+ on(document, 'mousemove', this._handleFallbackAutoScroll);
2428
+ }
2429
+ }
2430
+ },
2431
+ dragOverCompleted: function dragOverCompleted(_ref2) {
2432
+ var originalEvent = _ref2.originalEvent;
2433
+ // For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
2434
+ if (!this.options.dragOverBubble && !originalEvent.rootEl) {
2435
+ this._handleAutoScroll(originalEvent);
2436
+ }
2437
+ },
2438
+ drop: function drop() {
2439
+ if (this.sortable.nativeDraggable) {
2440
+ off(document, 'dragover', this._handleAutoScroll);
2441
+ } else {
2442
+ off(document, 'pointermove', this._handleFallbackAutoScroll);
2443
+ off(document, 'touchmove', this._handleFallbackAutoScroll);
2444
+ off(document, 'mousemove', this._handleFallbackAutoScroll);
2445
+ }
2446
+ clearPointerElemChangedInterval();
2447
+ clearAutoScrolls();
2448
+ cancelThrottle();
2449
+ },
2450
+ nulling: function nulling() {
2451
+ touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null;
2452
+ autoScrolls.length = 0;
2453
+ },
2454
+ _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) {
2455
+ this._handleAutoScroll(evt, true);
2456
+ },
2457
+ _handleAutoScroll: function _handleAutoScroll(evt, fallback) {
2458
+ var _this = this;
2459
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2460
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2461
+ elem = document.elementFromPoint(x, y);
2462
+ touchEvt$1 = evt;
2463
+
2464
+ // IE does not seem to have native autoscroll,
2465
+ // Edge's autoscroll seems too conditional,
2466
+ // MACOS Safari does not have autoscroll,
2467
+ // Firefox and Chrome are good
2468
+ if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
2469
+ autoScroll(evt, this.options, elem, fallback);
2470
+
2471
+ // Listener for pointer element change
2472
+ var ogElemScroller = getParentAutoScrollElement(elem, true);
2473
+ if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
2474
+ pointerElemChangedInterval && clearPointerElemChangedInterval();
2475
+ // Detect for pointer elem change, emulating native DnD behaviour
2476
+ pointerElemChangedInterval = setInterval(function () {
2477
+ var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
2478
+ if (newElem !== ogElemScroller) {
2479
+ ogElemScroller = newElem;
2480
+ clearAutoScrolls();
2481
+ }
2482
+ autoScroll(evt, _this.options, newElem, fallback);
2483
+ }, 10);
2484
+ lastAutoScrollX = x;
2485
+ lastAutoScrollY = y;
2486
+ }
2487
+ } else {
2488
+ // if DnD is enabled (and browser has good autoscrolling), first autoscroll will already scroll, so get parent autoscroll of first autoscroll
2489
+ if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) {
2490
+ clearAutoScrolls();
2491
+ return;
2492
+ }
2493
+ autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
2494
+ }
2495
+ }
2496
+ };
2497
+ return _extends(AutoScroll, {
2498
+ pluginName: 'scroll',
2499
+ initializeByDefault: true
2500
+ });
2501
+ }
2502
+ function clearAutoScrolls() {
2503
+ autoScrolls.forEach(function (autoScroll) {
2504
+ clearInterval(autoScroll.pid);
2505
+ });
2506
+ autoScrolls = [];
2507
+ }
2508
+ function clearPointerElemChangedInterval() {
2509
+ clearInterval(pointerElemChangedInterval);
2510
+ }
2511
+ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
2512
+ // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
2513
+ if (!options.scroll) return;
2514
+ var x = (evt.touches ? evt.touches[0] : evt).clientX,
2515
+ y = (evt.touches ? evt.touches[0] : evt).clientY,
2516
+ sens = options.scrollSensitivity,
2517
+ speed = options.scrollSpeed,
2518
+ winScroller = getWindowScrollingElement();
2519
+ var scrollThisInstance = false,
2520
+ scrollCustomFn;
2521
+
2522
+ // New scroll root, set scrollEl
2523
+ if (scrollRootEl !== rootEl) {
2524
+ scrollRootEl = rootEl;
2525
+ clearAutoScrolls();
2526
+ scrollEl = options.scroll;
2527
+ scrollCustomFn = options.scrollFn;
2528
+ if (scrollEl === true) {
2529
+ scrollEl = getParentAutoScrollElement(rootEl, true);
2530
+ }
2531
+ }
2532
+ var layersOut = 0;
2533
+ var currentParent = scrollEl;
2534
+ do {
2535
+ var el = currentParent,
2536
+ rect = getRect(el),
2537
+ top = rect.top,
2538
+ bottom = rect.bottom,
2539
+ left = rect.left,
2540
+ right = rect.right,
2541
+ width = rect.width,
2542
+ height = rect.height,
2543
+ canScrollX = void 0,
2544
+ canScrollY = void 0,
2545
+ scrollWidth = el.scrollWidth,
2546
+ scrollHeight = el.scrollHeight,
2547
+ elCSS = css(el),
2548
+ scrollPosX = el.scrollLeft,
2549
+ scrollPosY = el.scrollTop;
2550
+ if (el === winScroller) {
2551
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
2552
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
2553
+ } else {
2554
+ canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
2555
+ canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
2556
+ }
2557
+ var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
2558
+ var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
2559
+ if (!autoScrolls[layersOut]) {
2560
+ for (var i = 0; i <= layersOut; i++) {
2561
+ if (!autoScrolls[i]) {
2562
+ autoScrolls[i] = {};
2563
+ }
2564
+ }
2565
+ }
2566
+ if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
2567
+ autoScrolls[layersOut].el = el;
2568
+ autoScrolls[layersOut].vx = vx;
2569
+ autoScrolls[layersOut].vy = vy;
2570
+ clearInterval(autoScrolls[layersOut].pid);
2571
+ if (vx != 0 || vy != 0) {
2572
+ scrollThisInstance = true;
2573
+ /* jshint loopfunc:true */
2574
+ autoScrolls[layersOut].pid = setInterval(function () {
2575
+ // emulate drag over during autoscroll (fallback), emulating native DnD behaviour
2576
+ if (isFallback && this.layer === 0) {
2577
+ Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
2578
+ }
2579
+ var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
2580
+ var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
2581
+ if (typeof scrollCustomFn === 'function') {
2582
+ if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
2583
+ return;
2584
+ }
2585
+ }
2586
+ scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
2587
+ }.bind({
2588
+ layer: layersOut
2589
+ }), 24);
2590
+ }
2591
+ }
2592
+ layersOut++;
2593
+ } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
2594
+ scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
2595
+ }, 30);
2596
+
2597
+ var drop = function drop(_ref) {
2598
+ var originalEvent = _ref.originalEvent,
2599
+ putSortable = _ref.putSortable,
2600
+ dragEl = _ref.dragEl,
2601
+ activeSortable = _ref.activeSortable,
2602
+ dispatchSortableEvent = _ref.dispatchSortableEvent,
2603
+ hideGhostForTarget = _ref.hideGhostForTarget,
2604
+ unhideGhostForTarget = _ref.unhideGhostForTarget;
2605
+ if (!originalEvent) return;
2606
+ var toSortable = putSortable || activeSortable;
2607
+ hideGhostForTarget();
2608
+ var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
2609
+ var target = document.elementFromPoint(touch.clientX, touch.clientY);
2610
+ unhideGhostForTarget();
2611
+ if (toSortable && !toSortable.el.contains(target)) {
2612
+ dispatchSortableEvent('spill');
2613
+ this.onSpill({
2614
+ dragEl: dragEl,
2615
+ putSortable: putSortable
2616
+ });
2617
+ }
2618
+ };
2619
+ function Revert() {}
2620
+ Revert.prototype = {
2621
+ startIndex: null,
2622
+ dragStart: function dragStart(_ref2) {
2623
+ var oldDraggableIndex = _ref2.oldDraggableIndex;
2624
+ this.startIndex = oldDraggableIndex;
2625
+ },
2626
+ onSpill: function onSpill(_ref3) {
2627
+ var dragEl = _ref3.dragEl,
2628
+ putSortable = _ref3.putSortable;
2629
+ this.sortable.captureAnimationState();
2630
+ if (putSortable) {
2631
+ putSortable.captureAnimationState();
2632
+ }
2633
+ var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
2634
+ if (nextSibling) {
2635
+ this.sortable.el.insertBefore(dragEl, nextSibling);
2636
+ } else {
2637
+ this.sortable.el.appendChild(dragEl);
2638
+ }
2639
+ this.sortable.animateAll();
2640
+ if (putSortable) {
2641
+ putSortable.animateAll();
2642
+ }
2643
+ },
2644
+ drop: drop
2645
+ };
2646
+ _extends(Revert, {
2647
+ pluginName: 'revertOnSpill'
2648
+ });
2649
+ function Remove() {}
2650
+ Remove.prototype = {
2651
+ onSpill: function onSpill(_ref4) {
2652
+ var dragEl = _ref4.dragEl,
2653
+ putSortable = _ref4.putSortable;
2654
+ var parentSortable = putSortable || this.sortable;
2655
+ parentSortable.captureAnimationState();
2656
+ dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
2657
+ parentSortable.animateAll();
2658
+ },
2659
+ drop: drop
2660
+ };
2661
+ _extends(Remove, {
2662
+ pluginName: 'removeOnSpill'
2663
+ });
2664
+
2665
+ Sortable.mount(new AutoScrollPlugin());
2666
+ Sortable.mount(Remove, Revert);
2667
+
2668
+ exports.Sortable = Sortable;