@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
@@ -1,3202 +0,0 @@
1
- import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h, Host, Fragment } from '@stencil/core/internal/client';
2
- import { ApplicationContext, ElementIDUtils } from '@sankhyalabs/core';
3
- import { C as CONFIG_EVENTS, c as CONFIG_SORTABLE_EVENTS, K as KEY_EVENTS, e as TYPE_ACTIONS, d as TAB_NAMES } from './constants.js';
4
-
5
- class AbstractEvent {
6
-
7
- constructor(data) {
8
-
9
- this._canceled = false;
10
- this.data = data;
11
- }
12
-
13
- get type() {
14
- return this.constructor.type;
15
- }
16
-
17
- get cancelable() {
18
- return this.constructor.cancelable;
19
- }
20
-
21
- cancel() {
22
- this._canceled = true;
23
- }
24
-
25
- canceled() {
26
- return this._canceled;
27
- }
28
-
29
- clone(data) {
30
- return new this.constructor({
31
- ...this.data,
32
- ...data
33
- });
34
- }
35
- }
36
-
37
- AbstractEvent.type = 'event';
38
-
39
- AbstractEvent.cancelable = false;
40
-
41
- class AbstractPlugin {
42
-
43
- constructor(draggable) {
44
- this.draggable = draggable;
45
- }
46
-
47
- attach() {
48
- throw new Error('Not Implemented');
49
- }
50
-
51
- detach() {
52
- throw new Error('Not Implemented');
53
- }
54
- }
55
-
56
- const defaultDelay = {
57
- mouse: 0,
58
- drag: 0,
59
- touch: 100
60
- };
61
-
62
- class Sensor {
63
-
64
- constructor(containers = [], options = {}) {
65
-
66
- this.containers = [...containers];
67
-
68
- this.options = {
69
- ...options
70
- };
71
-
72
- this.dragging = false;
73
-
74
- this.currentContainer = null;
75
-
76
- this.originalSource = null;
77
-
78
- this.startEvent = null;
79
-
80
- this.delay = calcDelay(options.delay);
81
- }
82
-
83
- attach() {
84
- return this;
85
- }
86
-
87
- detach() {
88
- return this;
89
- }
90
-
91
- addContainer(...containers) {
92
- this.containers = [...this.containers, ...containers];
93
- }
94
-
95
- removeContainer(...containers) {
96
- this.containers = this.containers.filter(container => !containers.includes(container));
97
- }
98
-
99
- trigger(element, sensorEvent) {
100
- const event = document.createEvent('Event');
101
- event.detail = sensorEvent;
102
- event.initEvent(sensorEvent.type, true, true);
103
- element.dispatchEvent(event);
104
- this.lastEvent = sensorEvent;
105
- return sensorEvent;
106
- }
107
- }
108
-
109
- function calcDelay(optionsDelay) {
110
- const delay = {};
111
- if (optionsDelay === undefined) {
112
- return {
113
- ...defaultDelay
114
- };
115
- }
116
- if (typeof optionsDelay === 'number') {
117
- for (const key in defaultDelay) {
118
- if (Object.prototype.hasOwnProperty.call(defaultDelay, key)) {
119
- delay[key] = optionsDelay;
120
- }
121
- }
122
- return delay;
123
- }
124
- for (const key in defaultDelay) {
125
- if (Object.prototype.hasOwnProperty.call(defaultDelay, key)) {
126
- if (optionsDelay[key] === undefined) {
127
- delay[key] = defaultDelay[key];
128
- } else {
129
- delay[key] = optionsDelay[key];
130
- }
131
- }
132
- }
133
- return delay;
134
- }
135
-
136
- function closest(node, value) {
137
- if (node == null) {
138
- return null;
139
- }
140
- function conditionFn(currentNode) {
141
- if (currentNode == null || value == null) {
142
- return false;
143
- } else if (isSelector(value)) {
144
- return Element.prototype.matches.call(currentNode, value);
145
- } else if (isNodeList(value)) {
146
- return [...value].includes(currentNode);
147
- } else if (isElement(value)) {
148
- return value === currentNode;
149
- } else if (isFunction(value)) {
150
- return value(currentNode);
151
- } else {
152
- return false;
153
- }
154
- }
155
- let current = node;
156
- do {
157
- current = current.correspondingUseElement || current.correspondingElement || current;
158
- if (conditionFn(current)) {
159
- return current;
160
- }
161
- current = current?.parentNode || null;
162
- } while (current != null && current !== document.body && current !== document);
163
- return null;
164
- }
165
- function isSelector(value) {
166
- return Boolean(typeof value === 'string');
167
- }
168
- function isNodeList(value) {
169
- return Boolean(value instanceof NodeList || value instanceof Array);
170
- }
171
- function isElement(value) {
172
- return Boolean(value instanceof Node);
173
- }
174
- function isFunction(value) {
175
- return Boolean(typeof value === 'function');
176
- }
177
-
178
- function distance(x1, y1, x2, y2) {
179
- return Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
180
- }
181
-
182
- class SensorEvent extends AbstractEvent {
183
-
184
- get originalEvent() {
185
- return this.data.originalEvent;
186
- }
187
-
188
- get clientX() {
189
- return this.data.clientX;
190
- }
191
-
192
- get clientY() {
193
- return this.data.clientY;
194
- }
195
-
196
- get target() {
197
- return this.data.target;
198
- }
199
-
200
- get container() {
201
- return this.data.container;
202
- }
203
-
204
- get originalSource() {
205
- return this.data.originalSource;
206
- }
207
-
208
- get pressure() {
209
- return this.data.pressure;
210
- }
211
- }
212
-
213
- class DragStartSensorEvent extends SensorEvent {}
214
-
215
- DragStartSensorEvent.type = 'drag:start';
216
- class DragMoveSensorEvent extends SensorEvent {}
217
-
218
- DragMoveSensorEvent.type = 'drag:move';
219
- class DragStopSensorEvent extends SensorEvent {}
220
-
221
- DragStopSensorEvent.type = 'drag:stop';
222
-
223
- const onContextMenuWhileDragging = Symbol('onContextMenuWhileDragging');
224
- const onMouseDown = Symbol('onMouseDown');
225
- const onMouseMove = Symbol('onMouseMove');
226
- const onMouseUp = Symbol('onMouseUp');
227
- const startDrag$1 = Symbol('startDrag');
228
- const onDistanceChange$1 = Symbol('onDistanceChange');
229
-
230
- class MouseSensor extends Sensor {
231
-
232
- constructor(containers = [], options = {}) {
233
- super(containers, options);
234
-
235
- this.mouseDownTimeout = null;
236
-
237
- this.pageX = null;
238
-
239
- this.pageY = null;
240
- this[onContextMenuWhileDragging] = this[onContextMenuWhileDragging].bind(this);
241
- this[onMouseDown] = this[onMouseDown].bind(this);
242
- this[onMouseMove] = this[onMouseMove].bind(this);
243
- this[onMouseUp] = this[onMouseUp].bind(this);
244
- this[startDrag$1] = this[startDrag$1].bind(this);
245
- this[onDistanceChange$1] = this[onDistanceChange$1].bind(this);
246
- }
247
-
248
- attach() {
249
- document.addEventListener('mousedown', this[onMouseDown], true);
250
- }
251
-
252
- detach() {
253
- document.removeEventListener('mousedown', this[onMouseDown], true);
254
- }
255
-
256
- [onMouseDown](event) {
257
- if (event.button !== 0 || event.ctrlKey || event.metaKey) {
258
- return;
259
- }
260
- const container = closest(event.target, this.containers);
261
- if (!container) {
262
- return;
263
- }
264
- if (this.options.handle && event.target && !closest(event.target, this.options.handle)) {
265
- return;
266
- }
267
- const originalSource = closest(event.target, this.options.draggable);
268
- if (!originalSource) {
269
- return;
270
- }
271
- const {
272
- delay
273
- } = this;
274
- const {
275
- pageX,
276
- pageY
277
- } = event;
278
- Object.assign(this, {
279
- pageX,
280
- pageY
281
- });
282
- this.onMouseDownAt = Date.now();
283
- this.startEvent = event;
284
- this.currentContainer = container;
285
- this.originalSource = originalSource;
286
- document.addEventListener('mouseup', this[onMouseUp]);
287
- document.addEventListener('dragstart', preventNativeDragStart);
288
- document.addEventListener('mousemove', this[onDistanceChange$1]);
289
- this.mouseDownTimeout = window.setTimeout(() => {
290
- this[onDistanceChange$1]({
291
- pageX: this.pageX,
292
- pageY: this.pageY
293
- });
294
- }, delay.mouse);
295
- }
296
-
297
- [startDrag$1]() {
298
- const startEvent = this.startEvent;
299
- const container = this.currentContainer;
300
- const originalSource = this.originalSource;
301
- const dragStartEvent = new DragStartSensorEvent({
302
- clientX: startEvent.clientX,
303
- clientY: startEvent.clientY,
304
- target: startEvent.target,
305
- container,
306
- originalSource,
307
- originalEvent: startEvent
308
- });
309
- this.trigger(this.currentContainer, dragStartEvent);
310
- this.dragging = !dragStartEvent.canceled();
311
- if (this.dragging) {
312
- document.addEventListener('contextmenu', this[onContextMenuWhileDragging], true);
313
- document.addEventListener('mousemove', this[onMouseMove]);
314
- }
315
- }
316
-
317
- [onDistanceChange$1](event) {
318
- const {
319
- pageX,
320
- pageY
321
- } = event;
322
- const {
323
- distance: distance$1
324
- } = this.options;
325
- const {
326
- startEvent,
327
- delay
328
- } = this;
329
- Object.assign(this, {
330
- pageX,
331
- pageY
332
- });
333
- if (!this.currentContainer) {
334
- return;
335
- }
336
- const timeElapsed = Date.now() - this.onMouseDownAt;
337
- const distanceTravelled = distance(startEvent.pageX, startEvent.pageY, pageX, pageY) || 0;
338
- clearTimeout(this.mouseDownTimeout);
339
- if (timeElapsed < delay.mouse) {
340
-
341
- document.removeEventListener('mousemove', this[onDistanceChange$1]);
342
- } else if (distanceTravelled >= distance$1) {
343
- document.removeEventListener('mousemove', this[onDistanceChange$1]);
344
- this[startDrag$1]();
345
- }
346
- }
347
-
348
- [onMouseMove](event) {
349
- if (!this.dragging) {
350
- return;
351
- }
352
- const target = document.elementFromPoint(event.clientX, event.clientY);
353
- const dragMoveEvent = new DragMoveSensorEvent({
354
- clientX: event.clientX,
355
- clientY: event.clientY,
356
- target,
357
- container: this.currentContainer,
358
- originalEvent: event
359
- });
360
- this.trigger(this.currentContainer, dragMoveEvent);
361
- }
362
-
363
- [onMouseUp](event) {
364
- clearTimeout(this.mouseDownTimeout);
365
- if (event.button !== 0) {
366
- return;
367
- }
368
- document.removeEventListener('mouseup', this[onMouseUp]);
369
- document.removeEventListener('dragstart', preventNativeDragStart);
370
- document.removeEventListener('mousemove', this[onDistanceChange$1]);
371
- if (!this.dragging) {
372
- return;
373
- }
374
- const target = document.elementFromPoint(event.clientX, event.clientY);
375
- const dragStopEvent = new DragStopSensorEvent({
376
- clientX: event.clientX,
377
- clientY: event.clientY,
378
- target,
379
- container: this.currentContainer,
380
- originalEvent: event
381
- });
382
- this.trigger(this.currentContainer, dragStopEvent);
383
- document.removeEventListener('contextmenu', this[onContextMenuWhileDragging], true);
384
- document.removeEventListener('mousemove', this[onMouseMove]);
385
- this.currentContainer = null;
386
- this.dragging = false;
387
- this.startEvent = null;
388
- }
389
-
390
- [onContextMenuWhileDragging](event) {
391
- event.preventDefault();
392
- }
393
- }
394
- function preventNativeDragStart(event) {
395
- event.preventDefault();
396
- }
397
-
398
- function touchCoords(event) {
399
- const {
400
- touches,
401
- changedTouches
402
- } = event;
403
- return touches && touches[0] || changedTouches && changedTouches[0];
404
- }
405
-
406
- const onTouchStart = Symbol('onTouchStart');
407
- const onTouchEnd = Symbol('onTouchEnd');
408
- const onTouchMove = Symbol('onTouchMove');
409
- const startDrag = Symbol('startDrag');
410
- const onDistanceChange = Symbol('onDistanceChange');
411
-
412
- let preventScrolling = false;
413
-
414
- window.addEventListener('touchmove', event => {
415
- if (!preventScrolling) {
416
- return;
417
- }
418
-
419
- event.preventDefault();
420
- }, {
421
- passive: false
422
- });
423
-
424
- class TouchSensor extends Sensor {
425
-
426
- constructor(containers = [], options = {}) {
427
- super(containers, options);
428
-
429
- this.currentScrollableParent = null;
430
-
431
- this.tapTimeout = null;
432
-
433
- this.touchMoved = false;
434
-
435
- this.pageX = null;
436
-
437
- this.pageY = null;
438
- this[onTouchStart] = this[onTouchStart].bind(this);
439
- this[onTouchEnd] = this[onTouchEnd].bind(this);
440
- this[onTouchMove] = this[onTouchMove].bind(this);
441
- this[startDrag] = this[startDrag].bind(this);
442
- this[onDistanceChange] = this[onDistanceChange].bind(this);
443
- }
444
-
445
- attach() {
446
- document.addEventListener('touchstart', this[onTouchStart]);
447
- }
448
-
449
- detach() {
450
- document.removeEventListener('touchstart', this[onTouchStart]);
451
- }
452
-
453
- [onTouchStart](event) {
454
- const container = closest(event.target, this.containers);
455
- if (!container) {
456
- return;
457
- }
458
- if (this.options.handle && event.target && !closest(event.target, this.options.handle)) {
459
- return;
460
- }
461
- const originalSource = closest(event.target, this.options.draggable);
462
- if (!originalSource) {
463
- return;
464
- }
465
- const {
466
- distance = 0
467
- } = this.options;
468
- const {
469
- delay
470
- } = this;
471
- const {
472
- pageX,
473
- pageY
474
- } = touchCoords(event);
475
- Object.assign(this, {
476
- pageX,
477
- pageY
478
- });
479
- this.onTouchStartAt = Date.now();
480
- this.startEvent = event;
481
- this.currentContainer = container;
482
- this.originalSource = originalSource;
483
- document.addEventListener('touchend', this[onTouchEnd]);
484
- document.addEventListener('touchcancel', this[onTouchEnd]);
485
- document.addEventListener('touchmove', this[onDistanceChange]);
486
- container.addEventListener('contextmenu', onContextMenu);
487
- if (distance) {
488
- preventScrolling = true;
489
- }
490
- this.tapTimeout = window.setTimeout(() => {
491
- this[onDistanceChange]({
492
- touches: [{
493
- pageX: this.pageX,
494
- pageY: this.pageY
495
- }]
496
- });
497
- }, delay.touch);
498
- }
499
-
500
- [startDrag]() {
501
- const startEvent = this.startEvent;
502
- const container = this.currentContainer;
503
- const touch = touchCoords(startEvent);
504
- const originalSource = this.originalSource;
505
- const dragStartEvent = new DragStartSensorEvent({
506
- clientX: touch.pageX,
507
- clientY: touch.pageY,
508
- target: startEvent.target,
509
- container,
510
- originalSource,
511
- originalEvent: startEvent
512
- });
513
- this.trigger(this.currentContainer, dragStartEvent);
514
- this.dragging = !dragStartEvent.canceled();
515
- if (this.dragging) {
516
- document.addEventListener('touchmove', this[onTouchMove]);
517
- }
518
- preventScrolling = this.dragging;
519
- }
520
-
521
- [onDistanceChange](event) {
522
- const {
523
- distance: distance$1
524
- } = this.options;
525
- const {
526
- startEvent,
527
- delay
528
- } = this;
529
- const start = touchCoords(startEvent);
530
- const current = touchCoords(event);
531
- const timeElapsed = Date.now() - this.onTouchStartAt;
532
- const distanceTravelled = distance(start.pageX, start.pageY, current.pageX, current.pageY);
533
- Object.assign(this, current);
534
- clearTimeout(this.tapTimeout);
535
- if (timeElapsed < delay.touch) {
536
-
537
- document.removeEventListener('touchmove', this[onDistanceChange]);
538
- } else if (distanceTravelled >= distance$1) {
539
- document.removeEventListener('touchmove', this[onDistanceChange]);
540
- this[startDrag]();
541
- }
542
- }
543
-
544
- [onTouchMove](event) {
545
- if (!this.dragging) {
546
- return;
547
- }
548
- const {
549
- pageX,
550
- pageY
551
- } = touchCoords(event);
552
- const target = document.elementFromPoint(pageX - window.scrollX, pageY - window.scrollY);
553
- const dragMoveEvent = new DragMoveSensorEvent({
554
- clientX: pageX,
555
- clientY: pageY,
556
- target,
557
- container: this.currentContainer,
558
- originalEvent: event
559
- });
560
- this.trigger(this.currentContainer, dragMoveEvent);
561
- }
562
-
563
- [onTouchEnd](event) {
564
- clearTimeout(this.tapTimeout);
565
- preventScrolling = false;
566
- document.removeEventListener('touchend', this[onTouchEnd]);
567
- document.removeEventListener('touchcancel', this[onTouchEnd]);
568
- document.removeEventListener('touchmove', this[onDistanceChange]);
569
- if (this.currentContainer) {
570
- this.currentContainer.removeEventListener('contextmenu', onContextMenu);
571
- }
572
- if (!this.dragging) {
573
- return;
574
- }
575
- document.removeEventListener('touchmove', this[onTouchMove]);
576
- const {
577
- pageX,
578
- pageY
579
- } = touchCoords(event);
580
- const target = document.elementFromPoint(pageX - window.scrollX, pageY - window.scrollY);
581
- event.preventDefault();
582
- const dragStopEvent = new DragStopSensorEvent({
583
- clientX: pageX,
584
- clientY: pageY,
585
- target,
586
- container: this.currentContainer,
587
- originalEvent: event
588
- });
589
- this.trigger(this.currentContainer, dragStopEvent);
590
- this.currentContainer = null;
591
- this.dragging = false;
592
- this.startEvent = null;
593
- }
594
- }
595
- function onContextMenu(event) {
596
- event.preventDefault();
597
- event.stopPropagation();
598
- }
599
-
600
- function createAddInitializerMethod(e, t) {
601
- return function (r) {
602
- assertNotFinished(t, "addInitializer"), assertCallable(r, "An initializer"), e.push(r);
603
- };
604
- }
605
- function assertInstanceIfPrivate(e, t) {
606
- if (!e(t)) throw new TypeError("Attempted to access private element on non-instance");
607
- }
608
- function memberDec(e, t, r, a, n, i, s, o, c, l, u) {
609
- var f;
610
- switch (i) {
611
- case 1:
612
- f = "accessor";
613
- break;
614
- case 2:
615
- f = "method";
616
- break;
617
- case 3:
618
- f = "getter";
619
- break;
620
- case 4:
621
- f = "setter";
622
- break;
623
- default:
624
- f = "field";
625
- }
626
- var d,
627
- p,
628
- h = {
629
- kind: f,
630
- name: o ? "#" + r : r,
631
- static: s,
632
- private: o,
633
- metadata: u
634
- },
635
- v = {
636
- v: !1
637
- };
638
- if (0 !== i && (h.addInitializer = createAddInitializerMethod(n, v)), o || 0 !== i && 2 !== i) {
639
- if (2 === i) d = function (e) {
640
- return assertInstanceIfPrivate(l, e), a.value;
641
- };else {
642
- var y = 0 === i || 1 === i;
643
- (y || 3 === i) && (d = o ? function (e) {
644
- return assertInstanceIfPrivate(l, e), a.get.call(e);
645
- } : function (e) {
646
- return a.get.call(e);
647
- }), (y || 4 === i) && (p = o ? function (e, t) {
648
- assertInstanceIfPrivate(l, e), a.set.call(e, t);
649
- } : function (e, t) {
650
- a.set.call(e, t);
651
- });
652
- }
653
- } else d = function (e) {
654
- return e[r];
655
- }, 0 === i && (p = function (e, t) {
656
- e[r] = t;
657
- });
658
- var m = o ? l.bind() : function (e) {
659
- return r in e;
660
- };
661
- h.access = d && p ? {
662
- get: d,
663
- set: p,
664
- has: m
665
- } : d ? {
666
- get: d,
667
- has: m
668
- } : {
669
- set: p,
670
- has: m
671
- };
672
- try {
673
- return e.call(t, c, h);
674
- } finally {
675
- v.v = !0;
676
- }
677
- }
678
- function assertNotFinished(e, t) {
679
- if (e.v) throw new Error("attempted to call " + t + " after decoration was finished");
680
- }
681
- function assertCallable(e, t) {
682
- if ("function" != typeof e) throw new TypeError(t + " must be a function");
683
- }
684
- function assertValidReturnValue(e, t) {
685
- var r = typeof t;
686
- if (1 === e) {
687
- if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
688
- void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
689
- } else if ("function" !== r) {
690
- var a;
691
- throw a = 0 === e ? "field" : 5 === e ? "class" : "method", new TypeError(a + " decorators must return a function or void 0");
692
- }
693
- }
694
- function curryThis1(e) {
695
- return function () {
696
- return e(this);
697
- };
698
- }
699
- function curryThis2(e) {
700
- return function (t) {
701
- e(this, t);
702
- };
703
- }
704
- function applyMemberDec(e, t, r, a, n, i, s, o, c, l, u) {
705
- var f,
706
- d,
707
- p,
708
- h,
709
- v,
710
- y,
711
- m = r[0];
712
- a || Array.isArray(m) || (m = [m]), o ? f = 0 === i || 1 === i ? {
713
- get: curryThis1(r[3]),
714
- set: curryThis2(r[4])
715
- } : 3 === i ? {
716
- get: r[3]
717
- } : 4 === i ? {
718
- set: r[3]
719
- } : {
720
- value: r[3]
721
- } : 0 !== i && (f = Object.getOwnPropertyDescriptor(t, n)), 1 === i ? p = {
722
- get: f.get,
723
- set: f.set
724
- } : 2 === i ? p = f.value : 3 === i ? p = f.get : 4 === i && (p = f.set);
725
- for (var g = a ? 2 : 1, b = m.length - 1; b >= 0; b -= g) {
726
- var I;
727
- if (void 0 !== (h = memberDec(m[b], a ? m[b - 1] : void 0, n, f, c, i, s, o, p, l, u))) assertValidReturnValue(i, h), 0 === i ? I = h : 1 === i ? (I = h.init, v = h.get || p.get, y = h.set || p.set, p = {
728
- get: v,
729
- set: y
730
- }) : p = h, void 0 !== I && (void 0 === d ? d = I : "function" == typeof d ? d = [d, I] : d.push(I));
731
- }
732
- if (0 === i || 1 === i) {
733
- if (void 0 === d) d = function (e, t) {
734
- return t;
735
- };else if ("function" != typeof d) {
736
- var w = d;
737
- d = function (e, t) {
738
- for (var r = t, a = w.length - 1; a >= 0; a--) r = w[a].call(e, r);
739
- return r;
740
- };
741
- } else {
742
- var M = d;
743
- d = function (e, t) {
744
- return M.call(e, t);
745
- };
746
- }
747
- e.push(d);
748
- }
749
- 0 !== i && (1 === i ? (f.get = p.get, f.set = p.set) : 2 === i ? f.value = p : 3 === i ? f.get = p : 4 === i && (f.set = p), o ? 1 === i ? (e.push(function (e, t) {
750
- return p.get.call(e, t);
751
- }), e.push(function (e, t) {
752
- return p.set.call(e, t);
753
- })) : 2 === i ? e.push(p) : e.push(function (e, t) {
754
- return p.call(e, t);
755
- }) : Object.defineProperty(t, n, f));
756
- }
757
- function applyMemberDecs(e, t, r, a) {
758
- for (var n, i, s, o = [], c = new Map(), l = new Map(), u = 0; u < t.length; u++) {
759
- var f = t[u];
760
- if (Array.isArray(f)) {
761
- var d,
762
- p,
763
- h = f[1],
764
- v = f[2],
765
- y = f.length > 3,
766
- m = 16 & h,
767
- g = !!(8 & h),
768
- b = r;
769
- if (h &= 7, g ? (d = e, 0 !== h && (p = i = i || []), y && !s && (s = function (t) {
770
- return _checkInRHS(t) === e;
771
- }), b = s) : (d = e.prototype, 0 !== h && (p = n = n || [])), 0 !== h && !y) {
772
- var I = g ? l : c,
773
- w = I.get(v) || 0;
774
- if (!0 === w || 3 === w && 4 !== h || 4 === w && 3 !== h) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + v);
775
- I.set(v, !(!w && h > 2) || h);
776
- }
777
- applyMemberDec(o, d, f, m, v, h, g, y, p, b, a);
778
- }
779
- }
780
- return pushInitializers(o, n), pushInitializers(o, i), o;
781
- }
782
- function pushInitializers(e, t) {
783
- t && e.push(function (e) {
784
- for (var r = 0; r < t.length; r++) t[r].call(e);
785
- return e;
786
- });
787
- }
788
- function applyClassDecs(e, t, r, a) {
789
- if (t.length) {
790
- for (var n = [], i = e, s = e.name, o = r ? 2 : 1, c = t.length - 1; c >= 0; c -= o) {
791
- var l = {
792
- v: !1
793
- };
794
- try {
795
- var u = t[c].call(r ? t[c - 1] : void 0, i, {
796
- kind: "class",
797
- name: s,
798
- addInitializer: createAddInitializerMethod(n, l),
799
- metadata: a
800
- });
801
- } finally {
802
- l.v = !0;
803
- }
804
- void 0 !== u && (assertValidReturnValue(5, u), i = u);
805
- }
806
- return [defineMetadata(i, a), function () {
807
- for (var e = 0; e < n.length; e++) n[e].call(i);
808
- }];
809
- }
810
- }
811
- function defineMetadata(e, t) {
812
- return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), {
813
- configurable: !0,
814
- enumerable: !0,
815
- value: t
816
- });
817
- }
818
- function _applyDecs2305(e, t, r, a, n, i) {
819
- if (arguments.length >= 6) var s = i[Symbol.metadata || Symbol.for("Symbol.metadata")];
820
- var o = Object.create(void 0 === s ? null : s),
821
- c = applyMemberDecs(e, t, n, o);
822
- return r.length || defineMetadata(e, o), {
823
- e: c,
824
- get c() {
825
- return applyClassDecs(e, r, a, o);
826
- }
827
- };
828
- }
829
- function _checkInRHS(e) {
830
- if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null"));
831
- return e;
832
- }
833
-
834
- function AutoBind(originalMethod, {
835
- name,
836
- addInitializer
837
- }) {
838
- addInitializer(function () {
839
-
840
- this[name] = originalMethod.bind(this);
841
-
842
- });
843
- }
844
-
845
- function requestNextAnimationFrame(callback) {
846
- return requestAnimationFrame(() => {
847
- requestAnimationFrame(callback);
848
- });
849
- }
850
-
851
- class DragEvent extends AbstractEvent {
852
-
853
- constructor(data) {
854
- super(data);
855
- this.data = data;
856
- }
857
-
858
- get source() {
859
- return this.data.source;
860
- }
861
-
862
- get originalSource() {
863
- return this.data.originalSource;
864
- }
865
-
866
- get mirror() {
867
- return this.data.mirror;
868
- }
869
-
870
- get sourceContainer() {
871
- return this.data.sourceContainer;
872
- }
873
-
874
- get sensorEvent() {
875
- return this.data.sensorEvent;
876
- }
877
-
878
- get originalEvent() {
879
- if (this.sensorEvent) {
880
- return this.sensorEvent.originalEvent;
881
- }
882
- return null;
883
- }
884
- }
885
-
886
- DragEvent.type = 'drag';
887
- class DragStartEvent extends DragEvent {}
888
-
889
- DragStartEvent.type = 'drag:start';
890
- DragStartEvent.cancelable = true;
891
- class DragMoveEvent extends DragEvent {}
892
-
893
- DragMoveEvent.type = 'drag:move';
894
-
895
- class DragOverEvent extends DragEvent {
896
-
897
- get overContainer() {
898
- return this.data.overContainer;
899
- }
900
-
901
- get over() {
902
- return this.data.over;
903
- }
904
- }
905
- DragOverEvent.type = 'drag:over';
906
- DragOverEvent.cancelable = true;
907
- function isDragOverEvent(event) {
908
- return event.type === DragOverEvent.type;
909
- }
910
-
911
- class DragOutEvent extends DragEvent {
912
-
913
- get overContainer() {
914
- return this.data.overContainer;
915
- }
916
-
917
- get over() {
918
- return this.data.over;
919
- }
920
- }
921
-
922
- DragOutEvent.type = 'drag:out';
923
-
924
- class DragOverContainerEvent extends DragEvent {
925
-
926
- get overContainer() {
927
- return this.data.overContainer;
928
- }
929
- }
930
-
931
- DragOverContainerEvent.type = 'drag:over:container';
932
-
933
- class DragOutContainerEvent extends DragEvent {
934
-
935
- get overContainer() {
936
- return this.data.overContainer;
937
- }
938
- }
939
-
940
- DragOutContainerEvent.type = 'drag:out:container';
941
-
942
- class DragPressureEvent extends DragEvent {
943
-
944
- get pressure() {
945
- return this.data.pressure;
946
- }
947
- }
948
-
949
- DragPressureEvent.type = 'drag:pressure';
950
- class DragStopEvent extends DragEvent {}
951
-
952
- DragStopEvent.type = 'drag:stop';
953
- DragStopEvent.cancelable = true;
954
- class DragStoppedEvent extends DragEvent {}
955
- DragStoppedEvent.type = 'drag:stopped';
956
-
957
- var _initProto$1, _class$1;
958
-
959
- class ResizeMirror extends AbstractPlugin {
960
-
961
- constructor(draggable) {
962
- _initProto$1(super(draggable));
963
-
964
- this.lastWidth = 0;
965
-
966
- this.lastHeight = 0;
967
-
968
- this.mirror = null;
969
- }
970
-
971
- attach() {
972
- this.draggable.on('mirror:created', this.onMirrorCreated).on('drag:over', this.onDragOver).on('drag:over:container', this.onDragOver);
973
- }
974
-
975
- detach() {
976
- this.draggable.off('mirror:created', this.onMirrorCreated).off('mirror:destroy', this.onMirrorDestroy).off('drag:over', this.onDragOver).off('drag:over:container', this.onDragOver);
977
- }
978
-
979
- getOptions() {
980
- return this.draggable.options.resizeMirror || {};
981
- }
982
-
983
- onMirrorCreated({
984
- mirror
985
- }) {
986
- this.mirror = mirror;
987
- }
988
-
989
- onMirrorDestroy() {
990
- this.mirror = null;
991
- }
992
-
993
- onDragOver(dragEvent) {
994
- this.resize(dragEvent);
995
- }
996
-
997
- resize(dragEvent) {
998
- requestAnimationFrame(() => {
999
- let over = null;
1000
- const {
1001
- overContainer
1002
- } = dragEvent;
1003
- if (this.mirror == null || this.mirror.parentNode == null) {
1004
- return;
1005
- }
1006
- if (this.mirror.parentNode !== overContainer) {
1007
- overContainer.appendChild(this.mirror);
1008
- }
1009
- if (isDragOverEvent(dragEvent)) {
1010
- over = dragEvent.over;
1011
- }
1012
- const overElement = over || this.draggable.getDraggableElementsForContainer(overContainer)[0];
1013
- if (!overElement) {
1014
- return;
1015
- }
1016
- requestNextAnimationFrame(() => {
1017
- const overRect = overElement.getBoundingClientRect();
1018
- if (this.mirror == null || this.lastHeight === overRect.height && this.lastWidth === overRect.width) {
1019
- return;
1020
- }
1021
- this.mirror.style.width = `${overRect.width}px`;
1022
- this.mirror.style.height = `${overRect.height}px`;
1023
- this.lastWidth = overRect.width;
1024
- this.lastHeight = overRect.height;
1025
- });
1026
- });
1027
- }
1028
- }
1029
- _class$1 = ResizeMirror;
1030
- [_initProto$1] = _applyDecs2305(_class$1, [[AutoBind, 2, "onMirrorCreated"], [AutoBind, 2, "onMirrorDestroy"], [AutoBind, 2, "onDragOver"]], [], 0, void 0, AbstractPlugin).e;
1031
-
1032
- var _initProto, _class;
1033
-
1034
- const defaultOptions$5 = {
1035
- duration: 150,
1036
- easingFunction: 'ease-in-out',
1037
- horizontal: false
1038
- };
1039
-
1040
- class SwapAnimation extends AbstractPlugin {
1041
-
1042
- constructor(draggable) {
1043
- _initProto(super(draggable));
1044
-
1045
- this.options = {
1046
- ...defaultOptions$5,
1047
- ...this.getOptions()
1048
- };
1049
-
1050
- this.lastAnimationFrame = null;
1051
- }
1052
-
1053
- attach() {
1054
- this.draggable.on('sortable:sorted', this.onSortableSorted);
1055
- }
1056
-
1057
- detach() {
1058
- this.draggable.off('sortable:sorted', this.onSortableSorted);
1059
- }
1060
-
1061
- getOptions() {
1062
- return this.draggable.options.swapAnimation || {};
1063
- }
1064
-
1065
- onSortableSorted({
1066
- oldIndex,
1067
- newIndex,
1068
- dragEvent
1069
- }) {
1070
- const {
1071
- source,
1072
- over
1073
- } = dragEvent;
1074
- if (this.lastAnimationFrame) {
1075
- cancelAnimationFrame(this.lastAnimationFrame);
1076
- }
1077
-
1078
- this.lastAnimationFrame = requestAnimationFrame(() => {
1079
- if (oldIndex >= newIndex) {
1080
- animate(source, over, this.options);
1081
- } else {
1082
- animate(over, source, this.options);
1083
- }
1084
- });
1085
- }
1086
- }
1087
-
1088
- _class = SwapAnimation;
1089
- [_initProto] = _applyDecs2305(_class, [[AutoBind, 2, "onSortableSorted"]], [], 0, void 0, AbstractPlugin).e;
1090
- function animate(from, to, {
1091
- duration,
1092
- easingFunction,
1093
- horizontal
1094
- }) {
1095
- for (const element of [from, to]) {
1096
- element.style.pointerEvents = 'none';
1097
- }
1098
- if (horizontal) {
1099
- const width = from.offsetWidth;
1100
- from.style.transform = `translate3d(${width}px, 0, 0)`;
1101
- to.style.transform = `translate3d(-${width}px, 0, 0)`;
1102
- } else {
1103
- const height = from.offsetHeight;
1104
- from.style.transform = `translate3d(0, ${height}px, 0)`;
1105
- to.style.transform = `translate3d(0, -${height}px, 0)`;
1106
- }
1107
- requestAnimationFrame(() => {
1108
- for (const element of [from, to]) {
1109
- element.addEventListener('transitionend', resetElementOnTransitionEnd);
1110
- element.style.transition = `transform ${duration}ms ${easingFunction}`;
1111
- element.style.transform = '';
1112
- }
1113
- });
1114
- }
1115
-
1116
- function resetElementOnTransitionEnd(event) {
1117
- if (event.target == null || !isHTMLElement(event.target)) {
1118
- return;
1119
- }
1120
- event.target.style.transition = '';
1121
- event.target.style.pointerEvents = '';
1122
- event.target.removeEventListener('transitionend', resetElementOnTransitionEnd);
1123
- }
1124
- function isHTMLElement(eventTarget) {
1125
- return Boolean('style' in eventTarget);
1126
- }
1127
-
1128
- const onInitialize$1 = Symbol('onInitialize');
1129
- const onDestroy$1 = Symbol('onDestroy');
1130
- const announceEvent = Symbol('announceEvent');
1131
- const announceMessage = Symbol('announceMessage');
1132
- const ARIA_RELEVANT = 'aria-relevant';
1133
- const ARIA_ATOMIC = 'aria-atomic';
1134
- const ARIA_LIVE = 'aria-live';
1135
- const ROLE = 'role';
1136
-
1137
- const defaultOptions$4 = {
1138
- expire: 7000
1139
- };
1140
-
1141
- class Announcement extends AbstractPlugin {
1142
-
1143
- constructor(draggable) {
1144
- super(draggable);
1145
-
1146
- this.options = {
1147
- ...defaultOptions$4,
1148
- ...this.getOptions()
1149
- };
1150
-
1151
- this.originalTriggerMethod = this.draggable.trigger;
1152
- this[onInitialize$1] = this[onInitialize$1].bind(this);
1153
- this[onDestroy$1] = this[onDestroy$1].bind(this);
1154
- }
1155
-
1156
- attach() {
1157
- this.draggable.on('draggable:initialize', this[onInitialize$1]);
1158
- }
1159
-
1160
- detach() {
1161
- this.draggable.off('draggable:destroy', this[onDestroy$1]);
1162
- }
1163
-
1164
- getOptions() {
1165
- return this.draggable.options.announcements || {};
1166
- }
1167
-
1168
- [announceEvent](event) {
1169
- const message = this.options[event.type];
1170
- if (message && typeof message === 'string') {
1171
- this[announceMessage](message);
1172
- }
1173
- if (message && typeof message === 'function') {
1174
- this[announceMessage](message(event));
1175
- }
1176
- }
1177
-
1178
- [announceMessage](message) {
1179
- announce(message, {
1180
- expire: this.options.expire
1181
- });
1182
- }
1183
-
1184
- [onInitialize$1]() {
1185
-
1186
- this.draggable.trigger = event => {
1187
- try {
1188
- this[announceEvent](event);
1189
- } finally {
1190
-
1191
- this.originalTriggerMethod.call(this.draggable, event);
1192
- }
1193
- };
1194
- }
1195
-
1196
- [onDestroy$1]() {
1197
- this.draggable.trigger = this.originalTriggerMethod;
1198
- }
1199
- }
1200
-
1201
- const liveRegion = createRegion();
1202
-
1203
- function announce(message, {
1204
- expire
1205
- }) {
1206
- const element = document.createElement('div');
1207
- element.textContent = message;
1208
- liveRegion.appendChild(element);
1209
- return setTimeout(() => {
1210
- liveRegion.removeChild(element);
1211
- }, expire);
1212
- }
1213
-
1214
- function createRegion() {
1215
- const element = document.createElement('div');
1216
- element.setAttribute('id', 'draggable-live-region');
1217
- element.setAttribute(ARIA_RELEVANT, 'additions');
1218
- element.setAttribute(ARIA_ATOMIC, 'true');
1219
- element.setAttribute(ARIA_LIVE, 'assertive');
1220
- element.setAttribute(ROLE, 'log');
1221
- element.style.position = 'fixed';
1222
- element.style.width = '1px';
1223
- element.style.height = '1px';
1224
- element.style.top = '-1px';
1225
- element.style.overflow = 'hidden';
1226
- return element;
1227
- }
1228
-
1229
- document.addEventListener('DOMContentLoaded', () => {
1230
- document.body.appendChild(liveRegion);
1231
- });
1232
-
1233
- const onInitialize = Symbol('onInitialize');
1234
- const onDestroy = Symbol('onDestroy');
1235
-
1236
- const defaultOptions$3 = {};
1237
-
1238
- class Focusable extends AbstractPlugin {
1239
-
1240
- constructor(draggable) {
1241
- super(draggable);
1242
-
1243
- this.options = {
1244
- ...defaultOptions$3,
1245
- ...this.getOptions()
1246
- };
1247
- this[onInitialize] = this[onInitialize].bind(this);
1248
- this[onDestroy] = this[onDestroy].bind(this);
1249
- }
1250
-
1251
- attach() {
1252
- this.draggable.on('draggable:initialize', this[onInitialize]).on('draggable:destroy', this[onDestroy]);
1253
- }
1254
-
1255
- detach() {
1256
- this.draggable.off('draggable:initialize', this[onInitialize]).off('draggable:destroy', this[onDestroy]);
1257
-
1258
- this[onDestroy]();
1259
- }
1260
-
1261
- getOptions() {
1262
- return this.draggable.options.focusable || {};
1263
- }
1264
-
1265
- getElements() {
1266
- return [...this.draggable.containers, ...this.draggable.getDraggableElements()];
1267
- }
1268
-
1269
- [onInitialize]() {
1270
-
1271
- requestAnimationFrame(() => {
1272
- this.getElements().forEach(element => decorateElement(element));
1273
- });
1274
- }
1275
-
1276
- [onDestroy]() {
1277
-
1278
- requestAnimationFrame(() => {
1279
- this.getElements().forEach(element => stripElement(element));
1280
- });
1281
- }
1282
- }
1283
-
1284
- const elementsWithMissingTabIndex = [];
1285
-
1286
- function decorateElement(element) {
1287
- const hasMissingTabIndex = Boolean(!element.getAttribute('tabindex') && element.tabIndex === -1);
1288
- if (hasMissingTabIndex) {
1289
- elementsWithMissingTabIndex.push(element);
1290
- element.tabIndex = 0;
1291
- }
1292
- }
1293
-
1294
- function stripElement(element) {
1295
- const tabIndexElementPosition = elementsWithMissingTabIndex.indexOf(element);
1296
- if (tabIndexElementPosition !== -1) {
1297
- element.tabIndex = -1;
1298
- elementsWithMissingTabIndex.splice(tabIndexElementPosition, 1);
1299
- }
1300
- }
1301
-
1302
- class MirrorEvent extends AbstractEvent {
1303
-
1304
- constructor(data) {
1305
- super(data);
1306
- this.data = data;
1307
- }
1308
-
1309
- get source() {
1310
- return this.data.source;
1311
- }
1312
-
1313
- get originalSource() {
1314
- return this.data.originalSource;
1315
- }
1316
-
1317
- get sourceContainer() {
1318
- return this.data.sourceContainer;
1319
- }
1320
-
1321
- get sensorEvent() {
1322
- return this.data.sensorEvent;
1323
- }
1324
-
1325
- get dragEvent() {
1326
- return this.data.dragEvent;
1327
- }
1328
-
1329
- get originalEvent() {
1330
- if (this.sensorEvent) {
1331
- return this.sensorEvent.originalEvent;
1332
- }
1333
- return null;
1334
- }
1335
- }
1336
-
1337
- class MirrorCreateEvent extends MirrorEvent {}
1338
- MirrorCreateEvent.type = 'mirror:create';
1339
-
1340
- class MirrorCreatedEvent extends MirrorEvent {
1341
-
1342
- get mirror() {
1343
- return this.data.mirror;
1344
- }
1345
- }
1346
- MirrorCreatedEvent.type = 'mirror:created';
1347
-
1348
- class MirrorAttachedEvent extends MirrorEvent {
1349
-
1350
- get mirror() {
1351
- return this.data.mirror;
1352
- }
1353
- }
1354
- MirrorAttachedEvent.type = 'mirror:attached';
1355
-
1356
- class MirrorMoveEvent extends MirrorEvent {
1357
-
1358
- get mirror() {
1359
- return this.data.mirror;
1360
- }
1361
-
1362
- get passedThreshX() {
1363
- return this.data.passedThreshX;
1364
- }
1365
-
1366
- get passedThreshY() {
1367
- return this.data.passedThreshY;
1368
- }
1369
- }
1370
- MirrorMoveEvent.type = 'mirror:move';
1371
- MirrorMoveEvent.cancelable = true;
1372
-
1373
- class MirrorMovedEvent extends MirrorEvent {
1374
-
1375
- get mirror() {
1376
- return this.data.mirror;
1377
- }
1378
-
1379
- get passedThreshX() {
1380
- return this.data.passedThreshX;
1381
- }
1382
-
1383
- get passedThreshY() {
1384
- return this.data.passedThreshY;
1385
- }
1386
- }
1387
- MirrorMovedEvent.type = 'mirror:moved';
1388
-
1389
- class MirrorDestroyEvent extends MirrorEvent {
1390
-
1391
- get mirror() {
1392
- return this.data.mirror;
1393
- }
1394
- }
1395
- MirrorDestroyEvent.type = 'mirror:destroy';
1396
- MirrorDestroyEvent.cancelable = true;
1397
-
1398
- const onDragStart$3 = Symbol('onDragStart');
1399
- const onDragMove$2 = Symbol('onDragMove');
1400
- const onDragStop$3 = Symbol('onDragStop');
1401
- const onMirrorCreated = Symbol('onMirrorCreated');
1402
- const onMirrorMove = Symbol('onMirrorMove');
1403
- const onScroll = Symbol('onScroll');
1404
- const getAppendableContainer = Symbol('getAppendableContainer');
1405
-
1406
- const defaultOptions$2 = {
1407
- constrainDimensions: false,
1408
- xAxis: true,
1409
- yAxis: true,
1410
- cursorOffsetX: null,
1411
- cursorOffsetY: null,
1412
- thresholdX: null,
1413
- thresholdY: null
1414
- };
1415
-
1416
- class Mirror extends AbstractPlugin {
1417
-
1418
- constructor(draggable) {
1419
- super(draggable);
1420
-
1421
- this.options = {
1422
- ...defaultOptions$2,
1423
- ...this.getOptions()
1424
- };
1425
-
1426
- this.scrollOffset = {
1427
- x: 0,
1428
- y: 0
1429
- };
1430
-
1431
- this.initialScrollOffset = {
1432
- x: window.scrollX,
1433
- y: window.scrollY
1434
- };
1435
- this[onDragStart$3] = this[onDragStart$3].bind(this);
1436
- this[onDragMove$2] = this[onDragMove$2].bind(this);
1437
- this[onDragStop$3] = this[onDragStop$3].bind(this);
1438
- this[onMirrorCreated] = this[onMirrorCreated].bind(this);
1439
- this[onMirrorMove] = this[onMirrorMove].bind(this);
1440
- this[onScroll] = this[onScroll].bind(this);
1441
- }
1442
-
1443
- attach() {
1444
- this.draggable.on('drag:start', this[onDragStart$3]).on('drag:move', this[onDragMove$2]).on('drag:stop', this[onDragStop$3]).on('mirror:created', this[onMirrorCreated]).on('mirror:move', this[onMirrorMove]);
1445
- }
1446
-
1447
- detach() {
1448
- this.draggable.off('drag:start', this[onDragStart$3]).off('drag:move', this[onDragMove$2]).off('drag:stop', this[onDragStop$3]).off('mirror:created', this[onMirrorCreated]).off('mirror:move', this[onMirrorMove]);
1449
- }
1450
-
1451
- getOptions() {
1452
- return this.draggable.options.mirror || {};
1453
- }
1454
- [onDragStart$3](dragEvent) {
1455
- if (dragEvent.canceled()) {
1456
- return;
1457
- }
1458
- if ('ontouchstart' in window) {
1459
- document.addEventListener('scroll', this[onScroll], true);
1460
- }
1461
- this.initialScrollOffset = {
1462
- x: window.scrollX,
1463
- y: window.scrollY
1464
- };
1465
- const {
1466
- source,
1467
- originalSource,
1468
- sourceContainer,
1469
- sensorEvent
1470
- } = dragEvent;
1471
-
1472
- this.lastMirrorMovedClient = {
1473
- x: sensorEvent.clientX,
1474
- y: sensorEvent.clientY
1475
- };
1476
- const mirrorCreateEvent = new MirrorCreateEvent({
1477
- source,
1478
- originalSource,
1479
- sourceContainer,
1480
- sensorEvent,
1481
- dragEvent
1482
- });
1483
- this.draggable.trigger(mirrorCreateEvent);
1484
- if (isNativeDragEvent(sensorEvent) || mirrorCreateEvent.canceled()) {
1485
- return;
1486
- }
1487
- const appendableContainer = this[getAppendableContainer](source) || sourceContainer;
1488
- this.mirror = source.cloneNode(true);
1489
- const mirrorCreatedEvent = new MirrorCreatedEvent({
1490
- source,
1491
- originalSource,
1492
- sourceContainer,
1493
- sensorEvent,
1494
- dragEvent,
1495
- mirror: this.mirror
1496
- });
1497
- const mirrorAttachedEvent = new MirrorAttachedEvent({
1498
- source,
1499
- originalSource,
1500
- sourceContainer,
1501
- sensorEvent,
1502
- dragEvent,
1503
- mirror: this.mirror
1504
- });
1505
- this.draggable.trigger(mirrorCreatedEvent);
1506
- appendableContainer.appendChild(this.mirror);
1507
- this.draggable.trigger(mirrorAttachedEvent);
1508
- }
1509
- [onDragMove$2](dragEvent) {
1510
- if (!this.mirror || dragEvent.canceled()) {
1511
- return;
1512
- }
1513
- const {
1514
- source,
1515
- originalSource,
1516
- sourceContainer,
1517
- sensorEvent
1518
- } = dragEvent;
1519
- let passedThreshX = true;
1520
- let passedThreshY = true;
1521
- if (this.options.thresholdX || this.options.thresholdY) {
1522
- const {
1523
- x: lastX,
1524
- y: lastY
1525
- } = this.lastMirrorMovedClient;
1526
- if (Math.abs(lastX - sensorEvent.clientX) < this.options.thresholdX) {
1527
- passedThreshX = false;
1528
- } else {
1529
- this.lastMirrorMovedClient.x = sensorEvent.clientX;
1530
- }
1531
- if (Math.abs(lastY - sensorEvent.clientY) < this.options.thresholdY) {
1532
- passedThreshY = false;
1533
- } else {
1534
- this.lastMirrorMovedClient.y = sensorEvent.clientY;
1535
- }
1536
- if (!passedThreshX && !passedThreshY) {
1537
- return;
1538
- }
1539
- }
1540
- const mirrorMoveEvent = new MirrorMoveEvent({
1541
- source,
1542
- originalSource,
1543
- sourceContainer,
1544
- sensorEvent,
1545
- dragEvent,
1546
- mirror: this.mirror,
1547
- passedThreshX,
1548
- passedThreshY
1549
- });
1550
- this.draggable.trigger(mirrorMoveEvent);
1551
- }
1552
- [onDragStop$3](dragEvent) {
1553
- if ('ontouchstart' in window) {
1554
- document.removeEventListener('scroll', this[onScroll], true);
1555
- }
1556
- this.initialScrollOffset = {
1557
- x: 0,
1558
- y: 0
1559
- };
1560
- this.scrollOffset = {
1561
- x: 0,
1562
- y: 0
1563
- };
1564
- if (!this.mirror) {
1565
- return;
1566
- }
1567
- const {
1568
- source,
1569
- sourceContainer,
1570
- sensorEvent
1571
- } = dragEvent;
1572
- const mirrorDestroyEvent = new MirrorDestroyEvent({
1573
- source,
1574
- mirror: this.mirror,
1575
- sourceContainer,
1576
- sensorEvent,
1577
- dragEvent
1578
- });
1579
- this.draggable.trigger(mirrorDestroyEvent);
1580
- if (!mirrorDestroyEvent.canceled()) {
1581
- this.mirror.remove();
1582
- }
1583
- }
1584
- [onScroll]() {
1585
- this.scrollOffset = {
1586
- x: window.scrollX - this.initialScrollOffset.x,
1587
- y: window.scrollY - this.initialScrollOffset.y
1588
- };
1589
- }
1590
-
1591
- [onMirrorCreated]({
1592
- mirror,
1593
- source,
1594
- sensorEvent
1595
- }) {
1596
- const mirrorClasses = this.draggable.getClassNamesFor('mirror');
1597
- const setState = ({
1598
- mirrorOffset,
1599
- initialX,
1600
- initialY,
1601
- ...args
1602
- }) => {
1603
- this.mirrorOffset = mirrorOffset;
1604
- this.initialX = initialX;
1605
- this.initialY = initialY;
1606
- this.lastMovedX = initialX;
1607
- this.lastMovedY = initialY;
1608
- return {
1609
- mirrorOffset,
1610
- initialX,
1611
- initialY,
1612
- ...args
1613
- };
1614
- };
1615
- mirror.style.display = 'none';
1616
- const initialState = {
1617
- mirror,
1618
- source,
1619
- sensorEvent,
1620
- mirrorClasses,
1621
- scrollOffset: this.scrollOffset,
1622
- options: this.options,
1623
- passedThreshX: true,
1624
- passedThreshY: true
1625
- };
1626
- return Promise.resolve(initialState)
1627
-
1628
- .then(computeMirrorDimensions).then(calculateMirrorOffset).then(resetMirror).then(addMirrorClasses).then(positionMirror({
1629
- initial: true
1630
- })).then(removeMirrorID).then(setState);
1631
- }
1632
-
1633
- [onMirrorMove](mirrorEvent) {
1634
- if (mirrorEvent.canceled()) {
1635
- return null;
1636
- }
1637
- const setState = ({
1638
- lastMovedX,
1639
- lastMovedY,
1640
- ...args
1641
- }) => {
1642
- this.lastMovedX = lastMovedX;
1643
- this.lastMovedY = lastMovedY;
1644
- return {
1645
- lastMovedX,
1646
- lastMovedY,
1647
- ...args
1648
- };
1649
- };
1650
- const triggerMoved = args => {
1651
- const mirrorMovedEvent = new MirrorMovedEvent({
1652
- source: mirrorEvent.source,
1653
- originalSource: mirrorEvent.originalSource,
1654
- sourceContainer: mirrorEvent.sourceContainer,
1655
- sensorEvent: mirrorEvent.sensorEvent,
1656
- dragEvent: mirrorEvent.dragEvent,
1657
- mirror: this.mirror,
1658
- passedThreshX: mirrorEvent.passedThreshX,
1659
- passedThreshY: mirrorEvent.passedThreshY
1660
- });
1661
- this.draggable.trigger(mirrorMovedEvent);
1662
- return args;
1663
- };
1664
- const initialState = {
1665
- mirror: mirrorEvent.mirror,
1666
- sensorEvent: mirrorEvent.sensorEvent,
1667
- mirrorOffset: this.mirrorOffset,
1668
- options: this.options,
1669
- initialX: this.initialX,
1670
- initialY: this.initialY,
1671
- scrollOffset: this.scrollOffset,
1672
- passedThreshX: mirrorEvent.passedThreshX,
1673
- passedThreshY: mirrorEvent.passedThreshY,
1674
- lastMovedX: this.lastMovedX,
1675
- lastMovedY: this.lastMovedY
1676
- };
1677
- return Promise.resolve(initialState).then(positionMirror({
1678
- raf: true
1679
- })).then(setState).then(triggerMoved);
1680
- }
1681
-
1682
- [getAppendableContainer](source) {
1683
- const appendTo = this.options.appendTo;
1684
- if (typeof appendTo === 'string') {
1685
- return document.querySelector(appendTo);
1686
- } else if (appendTo instanceof HTMLElement) {
1687
- return appendTo;
1688
- } else if (typeof appendTo === 'function') {
1689
- return appendTo(source);
1690
- } else {
1691
- return source.parentNode;
1692
- }
1693
- }
1694
- }
1695
-
1696
- function computeMirrorDimensions({
1697
- source,
1698
- ...args
1699
- }) {
1700
- return withPromise(resolve => {
1701
- const sourceRect = source.getBoundingClientRect();
1702
- resolve({
1703
- source,
1704
- sourceRect,
1705
- ...args
1706
- });
1707
- });
1708
- }
1709
-
1710
- function calculateMirrorOffset({
1711
- sensorEvent,
1712
- sourceRect,
1713
- options,
1714
- ...args
1715
- }) {
1716
- return withPromise(resolve => {
1717
- const top = options.cursorOffsetY === null ? sensorEvent.clientY - sourceRect.top : options.cursorOffsetY;
1718
- const left = options.cursorOffsetX === null ? sensorEvent.clientX - sourceRect.left : options.cursorOffsetX;
1719
- const mirrorOffset = {
1720
- top,
1721
- left
1722
- };
1723
- resolve({
1724
- sensorEvent,
1725
- sourceRect,
1726
- mirrorOffset,
1727
- options,
1728
- ...args
1729
- });
1730
- });
1731
- }
1732
-
1733
- function resetMirror({
1734
- mirror,
1735
- source,
1736
- options,
1737
- ...args
1738
- }) {
1739
- return withPromise(resolve => {
1740
- let offsetHeight;
1741
- let offsetWidth;
1742
- if (options.constrainDimensions) {
1743
- const computedSourceStyles = getComputedStyle(source);
1744
- offsetHeight = computedSourceStyles.getPropertyValue('height');
1745
- offsetWidth = computedSourceStyles.getPropertyValue('width');
1746
- }
1747
- mirror.style.display = null;
1748
- mirror.style.position = 'fixed';
1749
- mirror.style.pointerEvents = 'none';
1750
- mirror.style.top = 0;
1751
- mirror.style.left = 0;
1752
- mirror.style.margin = 0;
1753
- if (options.constrainDimensions) {
1754
- mirror.style.height = offsetHeight;
1755
- mirror.style.width = offsetWidth;
1756
- }
1757
- resolve({
1758
- mirror,
1759
- source,
1760
- options,
1761
- ...args
1762
- });
1763
- });
1764
- }
1765
-
1766
- function addMirrorClasses({
1767
- mirror,
1768
- mirrorClasses,
1769
- ...args
1770
- }) {
1771
- return withPromise(resolve => {
1772
- mirror.classList.add(...mirrorClasses);
1773
- resolve({
1774
- mirror,
1775
- mirrorClasses,
1776
- ...args
1777
- });
1778
- });
1779
- }
1780
-
1781
- function removeMirrorID({
1782
- mirror,
1783
- ...args
1784
- }) {
1785
- return withPromise(resolve => {
1786
- mirror.removeAttribute('id');
1787
- delete mirror.id;
1788
- resolve({
1789
- mirror,
1790
- ...args
1791
- });
1792
- });
1793
- }
1794
-
1795
- function positionMirror({
1796
- withFrame = false,
1797
- initial = false
1798
- } = {}) {
1799
- return ({
1800
- mirror,
1801
- sensorEvent,
1802
- mirrorOffset,
1803
- initialY,
1804
- initialX,
1805
- scrollOffset,
1806
- options,
1807
- passedThreshX,
1808
- passedThreshY,
1809
- lastMovedX,
1810
- lastMovedY,
1811
- ...args
1812
- }) => {
1813
- return withPromise(resolve => {
1814
- const result = {
1815
- mirror,
1816
- sensorEvent,
1817
- mirrorOffset,
1818
- options,
1819
- ...args
1820
- };
1821
- if (mirrorOffset) {
1822
- const x = passedThreshX ? Math.round((sensorEvent.clientX - mirrorOffset.left - scrollOffset.x) / (options.thresholdX || 1)) * (options.thresholdX || 1) : Math.round(lastMovedX);
1823
- const y = passedThreshY ? Math.round((sensorEvent.clientY - mirrorOffset.top - scrollOffset.y) / (options.thresholdY || 1)) * (options.thresholdY || 1) : Math.round(lastMovedY);
1824
- if (options.xAxis && options.yAxis || initial) {
1825
- mirror.style.transform = `translate3d(${x}px, ${y}px, 0)`;
1826
- } else if (options.xAxis && !options.yAxis) {
1827
- mirror.style.transform = `translate3d(${x}px, ${initialY}px, 0)`;
1828
- } else if (options.yAxis && !options.xAxis) {
1829
- mirror.style.transform = `translate3d(${initialX}px, ${y}px, 0)`;
1830
- }
1831
- if (initial) {
1832
- result.initialX = x;
1833
- result.initialY = y;
1834
- }
1835
- result.lastMovedX = x;
1836
- result.lastMovedY = y;
1837
- }
1838
- resolve(result);
1839
- }, {
1840
- frame: withFrame
1841
- });
1842
- };
1843
- }
1844
-
1845
- function withPromise(callback, {
1846
- raf = false
1847
- } = {}) {
1848
- return new Promise((resolve, reject) => {
1849
- if (raf) {
1850
- requestAnimationFrame(() => {
1851
- callback(resolve, reject);
1852
- });
1853
- } else {
1854
- callback(resolve, reject);
1855
- }
1856
- });
1857
- }
1858
-
1859
- function isNativeDragEvent(sensorEvent) {
1860
- return /^drag/.test(sensorEvent.originalEvent.type);
1861
- }
1862
-
1863
- const onDragStart$2 = Symbol('onDragStart');
1864
- const onDragMove$1 = Symbol('onDragMove');
1865
- const onDragStop$2 = Symbol('onDragStop');
1866
- const scroll = Symbol('scroll');
1867
-
1868
- const defaultOptions$1 = {
1869
- speed: 6,
1870
- sensitivity: 50,
1871
- scrollableElements: []
1872
- };
1873
-
1874
- class Scrollable extends AbstractPlugin {
1875
-
1876
- constructor(draggable) {
1877
- super(draggable);
1878
-
1879
- this.options = {
1880
- ...defaultOptions$1,
1881
- ...this.getOptions()
1882
- };
1883
-
1884
- this.currentMousePosition = null;
1885
-
1886
- this.scrollAnimationFrame = null;
1887
-
1888
- this.scrollableElement = null;
1889
-
1890
- this.findScrollableElementFrame = null;
1891
- this[onDragStart$2] = this[onDragStart$2].bind(this);
1892
- this[onDragMove$1] = this[onDragMove$1].bind(this);
1893
- this[onDragStop$2] = this[onDragStop$2].bind(this);
1894
- this[scroll] = this[scroll].bind(this);
1895
- }
1896
-
1897
- attach() {
1898
- this.draggable.on('drag:start', this[onDragStart$2]).on('drag:move', this[onDragMove$1]).on('drag:stop', this[onDragStop$2]);
1899
- }
1900
-
1901
- detach() {
1902
- this.draggable.off('drag:start', this[onDragStart$2]).off('drag:move', this[onDragMove$1]).off('drag:stop', this[onDragStop$2]);
1903
- }
1904
-
1905
- getOptions() {
1906
- return this.draggable.options.scrollable || {};
1907
- }
1908
-
1909
- getScrollableElement(target) {
1910
- if (this.hasDefinedScrollableElements()) {
1911
- return closest(target, this.options.scrollableElements) || document.documentElement;
1912
- } else {
1913
- return closestScrollableElement(target);
1914
- }
1915
- }
1916
-
1917
- hasDefinedScrollableElements() {
1918
- return Boolean(this.options.scrollableElements.length !== 0);
1919
- }
1920
-
1921
- [onDragStart$2](dragEvent) {
1922
- this.findScrollableElementFrame = requestAnimationFrame(() => {
1923
- this.scrollableElement = this.getScrollableElement(dragEvent.source);
1924
- });
1925
- }
1926
-
1927
- [onDragMove$1](dragEvent) {
1928
- this.findScrollableElementFrame = requestAnimationFrame(() => {
1929
- this.scrollableElement = this.getScrollableElement(dragEvent.sensorEvent.target);
1930
- });
1931
- if (!this.scrollableElement) {
1932
- return;
1933
- }
1934
- const sensorEvent = dragEvent.sensorEvent;
1935
- const scrollOffset = {
1936
- x: 0,
1937
- y: 0
1938
- };
1939
- if ('ontouchstart' in window) {
1940
- scrollOffset.y = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
1941
- scrollOffset.x = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0;
1942
- }
1943
- this.currentMousePosition = {
1944
- clientX: sensorEvent.clientX - scrollOffset.x,
1945
- clientY: sensorEvent.clientY - scrollOffset.y
1946
- };
1947
- this.scrollAnimationFrame = requestAnimationFrame(this[scroll]);
1948
- }
1949
-
1950
- [onDragStop$2]() {
1951
- cancelAnimationFrame(this.scrollAnimationFrame);
1952
- cancelAnimationFrame(this.findScrollableElementFrame);
1953
- this.scrollableElement = null;
1954
- this.scrollAnimationFrame = null;
1955
- this.findScrollableElementFrame = null;
1956
- this.currentMousePosition = null;
1957
- }
1958
-
1959
- [scroll]() {
1960
- if (!this.scrollableElement || !this.currentMousePosition) {
1961
- return;
1962
- }
1963
- cancelAnimationFrame(this.scrollAnimationFrame);
1964
- const {
1965
- speed,
1966
- sensitivity
1967
- } = this.options;
1968
- const rect = this.scrollableElement.getBoundingClientRect();
1969
- const bottomCutOff = rect.bottom > window.innerHeight;
1970
- const topCutOff = rect.top < 0;
1971
- const cutOff = topCutOff || bottomCutOff;
1972
- const documentScrollingElement = getDocumentScrollingElement();
1973
- const scrollableElement = this.scrollableElement;
1974
- const clientX = this.currentMousePosition.clientX;
1975
- const clientY = this.currentMousePosition.clientY;
1976
- if (scrollableElement !== document.body && scrollableElement !== document.documentElement && !cutOff) {
1977
- const {
1978
- offsetHeight,
1979
- offsetWidth
1980
- } = scrollableElement;
1981
- if (rect.top + offsetHeight - clientY < sensitivity) {
1982
- scrollableElement.scrollTop += speed;
1983
- } else if (clientY - rect.top < sensitivity) {
1984
- scrollableElement.scrollTop -= speed;
1985
- }
1986
- if (rect.left + offsetWidth - clientX < sensitivity) {
1987
- scrollableElement.scrollLeft += speed;
1988
- } else if (clientX - rect.left < sensitivity) {
1989
- scrollableElement.scrollLeft -= speed;
1990
- }
1991
- } else {
1992
- const {
1993
- innerHeight,
1994
- innerWidth
1995
- } = window;
1996
- if (clientY < sensitivity) {
1997
- documentScrollingElement.scrollTop -= speed;
1998
- } else if (innerHeight - clientY < sensitivity) {
1999
- documentScrollingElement.scrollTop += speed;
2000
- }
2001
- if (clientX < sensitivity) {
2002
- documentScrollingElement.scrollLeft -= speed;
2003
- } else if (innerWidth - clientX < sensitivity) {
2004
- documentScrollingElement.scrollLeft += speed;
2005
- }
2006
- }
2007
- this.scrollAnimationFrame = requestAnimationFrame(this[scroll]);
2008
- }
2009
- }
2010
-
2011
- function hasOverflow(element) {
2012
- const overflowRegex = /(auto|scroll)/;
2013
- const computedStyles = getComputedStyle(element, null);
2014
- const overflow = computedStyles.getPropertyValue('overflow') + computedStyles.getPropertyValue('overflow-y') + computedStyles.getPropertyValue('overflow-x');
2015
- return overflowRegex.test(overflow);
2016
- }
2017
-
2018
- function isStaticallyPositioned(element) {
2019
- const position = getComputedStyle(element).getPropertyValue('position');
2020
- return position === 'static';
2021
- }
2022
-
2023
- function closestScrollableElement(element) {
2024
- if (!element) {
2025
- return getDocumentScrollingElement();
2026
- }
2027
- const position = getComputedStyle(element).getPropertyValue('position');
2028
- const excludeStaticParents = position === 'absolute';
2029
- const scrollableElement = closest(element, parent => {
2030
- if (excludeStaticParents && isStaticallyPositioned(parent)) {
2031
- return false;
2032
- }
2033
- return hasOverflow(parent);
2034
- });
2035
- if (position === 'fixed' || !scrollableElement) {
2036
- return getDocumentScrollingElement();
2037
- } else {
2038
- return scrollableElement;
2039
- }
2040
- }
2041
-
2042
- function getDocumentScrollingElement() {
2043
- return document.scrollingElement || document.documentElement;
2044
- }
2045
-
2046
- class Emitter {
2047
- constructor() {
2048
- this.callbacks = {};
2049
- }
2050
-
2051
- on(type, ...callbacks) {
2052
- if (!this.callbacks[type]) {
2053
- this.callbacks[type] = [];
2054
- }
2055
- this.callbacks[type].push(...callbacks);
2056
- return this;
2057
- }
2058
-
2059
- off(type, callback) {
2060
- if (!this.callbacks[type]) {
2061
- return null;
2062
- }
2063
- const copy = this.callbacks[type].slice(0);
2064
- for (let i = 0; i < copy.length; i++) {
2065
- if (callback === copy[i]) {
2066
- this.callbacks[type].splice(i, 1);
2067
- }
2068
- }
2069
- return this;
2070
- }
2071
-
2072
- trigger(event) {
2073
- if (!this.callbacks[event.type]) {
2074
- return null;
2075
- }
2076
- const callbacks = [...this.callbacks[event.type]];
2077
- const caughtErrors = [];
2078
- for (let i = callbacks.length - 1; i >= 0; i--) {
2079
- const callback = callbacks[i];
2080
- try {
2081
- callback(event);
2082
- } catch (error) {
2083
- caughtErrors.push(error);
2084
- }
2085
- }
2086
- if (caughtErrors.length) {
2087
-
2088
- console.error(`Draggable caught errors while triggering '${event.type}'`, caughtErrors);
2089
-
2090
- }
2091
-
2092
- return this;
2093
- }
2094
- }
2095
-
2096
- class DraggableEvent extends AbstractEvent {
2097
-
2098
- get draggable() {
2099
- return this.data.draggable;
2100
- }
2101
- }
2102
-
2103
- DraggableEvent.type = 'draggable';
2104
- class DraggableInitializedEvent extends DraggableEvent {}
2105
-
2106
- DraggableInitializedEvent.type = 'draggable:initialize';
2107
- class DraggableDestroyEvent extends DraggableEvent {}
2108
- DraggableDestroyEvent.type = 'draggable:destroy';
2109
-
2110
- const onDragStart$1 = Symbol('onDragStart');
2111
- const onDragMove = Symbol('onDragMove');
2112
- const onDragStop$1 = Symbol('onDragStop');
2113
- const onDragPressure = Symbol('onDragPressure');
2114
- const dragStop = Symbol('dragStop');
2115
-
2116
- const defaultAnnouncements$1 = {
2117
- 'drag:start': event => `Picked up ${event.source.textContent.trim() || event.source.id || 'draggable element'}`,
2118
- 'drag:stop': event => `Released ${event.source.textContent.trim() || event.source.id || 'draggable element'}`
2119
- };
2120
- const defaultClasses = {
2121
- 'container:dragging': 'draggable-container--is-dragging',
2122
- 'source:dragging': 'draggable-source--is-dragging',
2123
- 'source:placed': 'draggable-source--placed',
2124
- 'container:placed': 'draggable-container--placed',
2125
- 'body:dragging': 'draggable--is-dragging',
2126
- 'draggable:over': 'draggable--over',
2127
- 'container:over': 'draggable-container--over',
2128
- 'source:original': 'draggable--original',
2129
- mirror: 'draggable-mirror'
2130
- };
2131
- const defaultOptions = {
2132
- draggable: '.draggable-source',
2133
- handle: null,
2134
- delay: {},
2135
- distance: 0,
2136
- placedTimeout: 800,
2137
- plugins: [],
2138
- sensors: [],
2139
- exclude: {
2140
- plugins: [],
2141
- sensors: []
2142
- }
2143
- };
2144
-
2145
- class Draggable {
2146
-
2147
- constructor(containers = [document.body], options = {}) {
2148
-
2149
- if (containers instanceof NodeList || containers instanceof Array) {
2150
- this.containers = [...containers];
2151
- } else if (containers instanceof HTMLElement) {
2152
- this.containers = [containers];
2153
- } else {
2154
- throw new Error('Draggable containers are expected to be of type `NodeList`, `HTMLElement[]` or `HTMLElement`');
2155
- }
2156
- this.options = {
2157
- ...defaultOptions,
2158
- ...options,
2159
- classes: {
2160
- ...defaultClasses,
2161
- ...(options.classes || {})
2162
- },
2163
- announcements: {
2164
- ...defaultAnnouncements$1,
2165
- ...(options.announcements || {})
2166
- },
2167
- exclude: {
2168
- plugins: options.exclude && options.exclude.plugins || [],
2169
- sensors: options.exclude && options.exclude.sensors || []
2170
- }
2171
- };
2172
-
2173
- this.emitter = new Emitter();
2174
-
2175
- this.dragging = false;
2176
-
2177
- this.plugins = [];
2178
-
2179
- this.sensors = [];
2180
- this[onDragStart$1] = this[onDragStart$1].bind(this);
2181
- this[onDragMove] = this[onDragMove].bind(this);
2182
- this[onDragStop$1] = this[onDragStop$1].bind(this);
2183
- this[onDragPressure] = this[onDragPressure].bind(this);
2184
- this[dragStop] = this[dragStop].bind(this);
2185
- document.addEventListener('drag:start', this[onDragStart$1], true);
2186
- document.addEventListener('drag:move', this[onDragMove], true);
2187
- document.addEventListener('drag:stop', this[onDragStop$1], true);
2188
- document.addEventListener('drag:pressure', this[onDragPressure], true);
2189
- const defaultPlugins = Object.values(Draggable.Plugins).filter(Plugin => !this.options.exclude.plugins.includes(Plugin));
2190
- const defaultSensors = Object.values(Draggable.Sensors).filter(sensor => !this.options.exclude.sensors.includes(sensor));
2191
- this.addPlugin(...[...defaultPlugins, ...this.options.plugins]);
2192
- this.addSensor(...[...defaultSensors, ...this.options.sensors]);
2193
- const draggableInitializedEvent = new DraggableInitializedEvent({
2194
- draggable: this
2195
- });
2196
- this.on('mirror:created', ({
2197
- mirror
2198
- }) => this.mirror = mirror);
2199
- this.on('mirror:destroy', () => this.mirror = null);
2200
- this.trigger(draggableInitializedEvent);
2201
- }
2202
-
2203
- destroy() {
2204
- document.removeEventListener('drag:start', this[onDragStart$1], true);
2205
- document.removeEventListener('drag:move', this[onDragMove], true);
2206
- document.removeEventListener('drag:stop', this[onDragStop$1], true);
2207
- document.removeEventListener('drag:pressure', this[onDragPressure], true);
2208
- const draggableDestroyEvent = new DraggableDestroyEvent({
2209
- draggable: this
2210
- });
2211
- this.trigger(draggableDestroyEvent);
2212
- this.removePlugin(...this.plugins.map(plugin => plugin.constructor));
2213
- this.removeSensor(...this.sensors.map(sensor => sensor.constructor));
2214
- }
2215
-
2216
- addPlugin(...plugins) {
2217
- const activePlugins = plugins.map(Plugin => new Plugin(this));
2218
- activePlugins.forEach(plugin => plugin.attach());
2219
- this.plugins = [...this.plugins, ...activePlugins];
2220
- return this;
2221
- }
2222
-
2223
- removePlugin(...plugins) {
2224
- const removedPlugins = this.plugins.filter(plugin => plugins.includes(plugin.constructor));
2225
- removedPlugins.forEach(plugin => plugin.detach());
2226
- this.plugins = this.plugins.filter(plugin => !plugins.includes(plugin.constructor));
2227
- return this;
2228
- }
2229
-
2230
- addSensor(...sensors) {
2231
- const activeSensors = sensors.map(Sensor => new Sensor(this.containers, this.options));
2232
- activeSensors.forEach(sensor => sensor.attach());
2233
- this.sensors = [...this.sensors, ...activeSensors];
2234
- return this;
2235
- }
2236
-
2237
- removeSensor(...sensors) {
2238
- const removedSensors = this.sensors.filter(sensor => sensors.includes(sensor.constructor));
2239
- removedSensors.forEach(sensor => sensor.detach());
2240
- this.sensors = this.sensors.filter(sensor => !sensors.includes(sensor.constructor));
2241
- return this;
2242
- }
2243
-
2244
- addContainer(...containers) {
2245
- this.containers = [...this.containers, ...containers];
2246
- this.sensors.forEach(sensor => sensor.addContainer(...containers));
2247
- return this;
2248
- }
2249
-
2250
- removeContainer(...containers) {
2251
- this.containers = this.containers.filter(container => !containers.includes(container));
2252
- this.sensors.forEach(sensor => sensor.removeContainer(...containers));
2253
- return this;
2254
- }
2255
-
2256
- on(type, ...callbacks) {
2257
- this.emitter.on(type, ...callbacks);
2258
- return this;
2259
- }
2260
-
2261
- off(type, callback) {
2262
- this.emitter.off(type, callback);
2263
- return this;
2264
- }
2265
-
2266
- trigger(event) {
2267
- this.emitter.trigger(event);
2268
- return this;
2269
- }
2270
-
2271
- getClassNameFor(name) {
2272
- return this.getClassNamesFor(name)[0];
2273
- }
2274
-
2275
- getClassNamesFor(name) {
2276
- const classNames = this.options.classes[name];
2277
- if (classNames instanceof Array) {
2278
- return classNames;
2279
- } else if (typeof classNames === 'string' || classNames instanceof String) {
2280
- return [classNames];
2281
- } else {
2282
- return [];
2283
- }
2284
- }
2285
-
2286
- isDragging() {
2287
- return Boolean(this.dragging);
2288
- }
2289
-
2290
- getDraggableElements() {
2291
- return this.containers.reduce((current, container) => {
2292
- return [...current, ...this.getDraggableElementsForContainer(container)];
2293
- }, []);
2294
- }
2295
-
2296
- getDraggableElementsForContainer(container) {
2297
- const allDraggableElements = container.querySelectorAll(this.options.draggable);
2298
- return [...allDraggableElements].filter(childElement => {
2299
- return childElement !== this.originalSource && childElement !== this.mirror;
2300
- });
2301
- }
2302
-
2303
- cancel() {
2304
- this[dragStop]();
2305
- }
2306
-
2307
- [onDragStart$1](event) {
2308
- const sensorEvent = getSensorEvent(event);
2309
- const {
2310
- target,
2311
- container,
2312
- originalSource
2313
- } = sensorEvent;
2314
- if (!this.containers.includes(container)) {
2315
- return;
2316
- }
2317
- if (this.options.handle && target && !closest(target, this.options.handle)) {
2318
- sensorEvent.cancel();
2319
- return;
2320
- }
2321
- this.originalSource = originalSource;
2322
- this.sourceContainer = container;
2323
- if (this.lastPlacedSource && this.lastPlacedContainer) {
2324
- clearTimeout(this.placedTimeoutID);
2325
- this.lastPlacedSource.classList.remove(...this.getClassNamesFor('source:placed'));
2326
- this.lastPlacedContainer.classList.remove(...this.getClassNamesFor('container:placed'));
2327
- }
2328
- this.source = this.originalSource.cloneNode(true);
2329
- this.originalSource.parentNode.insertBefore(this.source, this.originalSource);
2330
- this.originalSource.style.display = 'none';
2331
- const dragStartEvent = new DragStartEvent({
2332
- source: this.source,
2333
- originalSource: this.originalSource,
2334
- sourceContainer: container,
2335
- sensorEvent
2336
- });
2337
- this.trigger(dragStartEvent);
2338
- this.dragging = !dragStartEvent.canceled();
2339
- if (dragStartEvent.canceled()) {
2340
- this.source.remove();
2341
- this.originalSource.style.display = null;
2342
- return;
2343
- }
2344
- this.originalSource.classList.add(...this.getClassNamesFor('source:original'));
2345
- this.source.classList.add(...this.getClassNamesFor('source:dragging'));
2346
- this.sourceContainer.classList.add(...this.getClassNamesFor('container:dragging'));
2347
- document.body.classList.add(...this.getClassNamesFor('body:dragging'));
2348
- applyUserSelect(document.body, 'none');
2349
- requestAnimationFrame(() => {
2350
- const oldSensorEvent = getSensorEvent(event);
2351
- const newSensorEvent = oldSensorEvent.clone({
2352
- target: this.source
2353
- });
2354
- this[onDragMove]({
2355
- ...event,
2356
- detail: newSensorEvent
2357
- });
2358
- });
2359
- }
2360
-
2361
- [onDragMove](event) {
2362
- if (!this.dragging) {
2363
- return;
2364
- }
2365
- const sensorEvent = getSensorEvent(event);
2366
- const {
2367
- container
2368
- } = sensorEvent;
2369
- let target = sensorEvent.target;
2370
- const dragMoveEvent = new DragMoveEvent({
2371
- source: this.source,
2372
- originalSource: this.originalSource,
2373
- sourceContainer: container,
2374
- sensorEvent
2375
- });
2376
- this.trigger(dragMoveEvent);
2377
- if (dragMoveEvent.canceled()) {
2378
- sensorEvent.cancel();
2379
- }
2380
- target = closest(target, this.options.draggable);
2381
- const withinCorrectContainer = closest(sensorEvent.target, this.containers);
2382
- const overContainer = sensorEvent.overContainer || withinCorrectContainer;
2383
- const isLeavingContainer = this.currentOverContainer && overContainer !== this.currentOverContainer;
2384
- const isLeavingDraggable = this.currentOver && target !== this.currentOver;
2385
- const isOverContainer = overContainer && this.currentOverContainer !== overContainer;
2386
- const isOverDraggable = withinCorrectContainer && target && this.currentOver !== target;
2387
- if (isLeavingDraggable) {
2388
- const dragOutEvent = new DragOutEvent({
2389
- source: this.source,
2390
- originalSource: this.originalSource,
2391
- sourceContainer: container,
2392
- sensorEvent,
2393
- over: this.currentOver,
2394
- overContainer: this.currentOverContainer
2395
- });
2396
- this.currentOver.classList.remove(...this.getClassNamesFor('draggable:over'));
2397
- this.currentOver = null;
2398
- this.trigger(dragOutEvent);
2399
- }
2400
- if (isLeavingContainer) {
2401
- const dragOutContainerEvent = new DragOutContainerEvent({
2402
- source: this.source,
2403
- originalSource: this.originalSource,
2404
- sourceContainer: container,
2405
- sensorEvent,
2406
- overContainer: this.currentOverContainer
2407
- });
2408
- this.currentOverContainer.classList.remove(...this.getClassNamesFor('container:over'));
2409
- this.currentOverContainer = null;
2410
- this.trigger(dragOutContainerEvent);
2411
- }
2412
- if (isOverContainer) {
2413
- overContainer.classList.add(...this.getClassNamesFor('container:over'));
2414
- const dragOverContainerEvent = new DragOverContainerEvent({
2415
- source: this.source,
2416
- originalSource: this.originalSource,
2417
- sourceContainer: container,
2418
- sensorEvent,
2419
- overContainer
2420
- });
2421
- this.currentOverContainer = overContainer;
2422
- this.trigger(dragOverContainerEvent);
2423
- }
2424
- if (isOverDraggable) {
2425
- target.classList.add(...this.getClassNamesFor('draggable:over'));
2426
- const dragOverEvent = new DragOverEvent({
2427
- source: this.source,
2428
- originalSource: this.originalSource,
2429
- sourceContainer: container,
2430
- sensorEvent,
2431
- overContainer,
2432
- over: target
2433
- });
2434
- this.currentOver = target;
2435
- this.trigger(dragOverEvent);
2436
- }
2437
- }
2438
-
2439
- [dragStop](event) {
2440
- if (!this.dragging) {
2441
- return;
2442
- }
2443
- this.dragging = false;
2444
- const dragStopEvent = new DragStopEvent({
2445
- source: this.source,
2446
- originalSource: this.originalSource,
2447
- sensorEvent: event ? event.sensorEvent : null,
2448
- sourceContainer: this.sourceContainer
2449
- });
2450
- this.trigger(dragStopEvent);
2451
- if (!dragStopEvent.canceled()) this.source.parentNode.insertBefore(this.originalSource, this.source);
2452
- this.source.remove();
2453
- this.originalSource.style.display = '';
2454
- this.source.classList.remove(...this.getClassNamesFor('source:dragging'));
2455
- this.originalSource.classList.remove(...this.getClassNamesFor('source:original'));
2456
- this.originalSource.classList.add(...this.getClassNamesFor('source:placed'));
2457
- this.sourceContainer.classList.add(...this.getClassNamesFor('container:placed'));
2458
- this.sourceContainer.classList.remove(...this.getClassNamesFor('container:dragging'));
2459
- document.body.classList.remove(...this.getClassNamesFor('body:dragging'));
2460
- applyUserSelect(document.body, '');
2461
- if (this.currentOver) {
2462
- this.currentOver.classList.remove(...this.getClassNamesFor('draggable:over'));
2463
- }
2464
- if (this.currentOverContainer) {
2465
- this.currentOverContainer.classList.remove(...this.getClassNamesFor('container:over'));
2466
- }
2467
- this.lastPlacedSource = this.originalSource;
2468
- this.lastPlacedContainer = this.sourceContainer;
2469
- this.placedTimeoutID = setTimeout(() => {
2470
- if (this.lastPlacedSource) {
2471
- this.lastPlacedSource.classList.remove(...this.getClassNamesFor('source:placed'));
2472
- }
2473
- if (this.lastPlacedContainer) {
2474
- this.lastPlacedContainer.classList.remove(...this.getClassNamesFor('container:placed'));
2475
- }
2476
- this.lastPlacedSource = null;
2477
- this.lastPlacedContainer = null;
2478
- }, this.options.placedTimeout);
2479
- const dragStoppedEvent = new DragStoppedEvent({
2480
- source: this.source,
2481
- originalSource: this.originalSource,
2482
- sensorEvent: event ? event.sensorEvent : null,
2483
- sourceContainer: this.sourceContainer
2484
- });
2485
- this.trigger(dragStoppedEvent);
2486
- this.source = null;
2487
- this.originalSource = null;
2488
- this.currentOverContainer = null;
2489
- this.currentOver = null;
2490
- this.sourceContainer = null;
2491
- }
2492
-
2493
- [onDragStop$1](event) {
2494
- this[dragStop](event);
2495
- }
2496
-
2497
- [onDragPressure](event) {
2498
- if (!this.dragging) {
2499
- return;
2500
- }
2501
- const sensorEvent = getSensorEvent(event);
2502
- const source = this.source || closest(sensorEvent.originalEvent.target, this.options.draggable);
2503
- const dragPressureEvent = new DragPressureEvent({
2504
- sensorEvent,
2505
- source,
2506
- pressure: sensorEvent.pressure
2507
- });
2508
- this.trigger(dragPressureEvent);
2509
- }
2510
- }
2511
-
2512
- Draggable.Plugins = {
2513
- Announcement,
2514
- Focusable,
2515
- Mirror,
2516
- Scrollable
2517
- };
2518
-
2519
- Draggable.Sensors = {
2520
- MouseSensor,
2521
- TouchSensor
2522
- };
2523
- function getSensorEvent(event) {
2524
- return event.detail;
2525
- }
2526
- function applyUserSelect(element, value) {
2527
- element.style.webkitUserSelect = value;
2528
- element.style.mozUserSelect = value;
2529
- element.style.msUserSelect = value;
2530
- element.style.oUserSelect = value;
2531
- element.style.userSelect = value;
2532
- }
2533
-
2534
- class SortableEvent extends AbstractEvent {
2535
-
2536
- constructor(data) {
2537
- super(data);
2538
- this.data = data;
2539
- }
2540
-
2541
- get dragEvent() {
2542
- return this.data.dragEvent;
2543
- }
2544
- }
2545
- SortableEvent.type = 'sortable';
2546
-
2547
- class SortableStartEvent extends SortableEvent {
2548
-
2549
- get startIndex() {
2550
- return this.data.startIndex;
2551
- }
2552
-
2553
- get startContainer() {
2554
- return this.data.startContainer;
2555
- }
2556
- }
2557
- SortableStartEvent.type = 'sortable:start';
2558
- SortableStartEvent.cancelable = true;
2559
-
2560
- class SortableSortEvent extends SortableEvent {
2561
-
2562
- get currentIndex() {
2563
- return this.data.currentIndex;
2564
- }
2565
-
2566
- get over() {
2567
- return this.data.over;
2568
- }
2569
-
2570
- get overContainer() {
2571
- return this.data.dragEvent.overContainer;
2572
- }
2573
- }
2574
- SortableSortEvent.type = 'sortable:sort';
2575
- SortableSortEvent.cancelable = true;
2576
-
2577
- class SortableSortedEvent extends SortableEvent {
2578
-
2579
- get oldIndex() {
2580
- return this.data.oldIndex;
2581
- }
2582
-
2583
- get newIndex() {
2584
- return this.data.newIndex;
2585
- }
2586
-
2587
- get oldContainer() {
2588
- return this.data.oldContainer;
2589
- }
2590
-
2591
- get newContainer() {
2592
- return this.data.newContainer;
2593
- }
2594
- }
2595
- SortableSortedEvent.type = 'sortable:sorted';
2596
-
2597
- class SortableStopEvent extends SortableEvent {
2598
-
2599
- get oldIndex() {
2600
- return this.data.oldIndex;
2601
- }
2602
-
2603
- get newIndex() {
2604
- return this.data.newIndex;
2605
- }
2606
-
2607
- get oldContainer() {
2608
- return this.data.oldContainer;
2609
- }
2610
-
2611
- get newContainer() {
2612
- return this.data.newContainer;
2613
- }
2614
- }
2615
- SortableStopEvent.type = 'sortable:stop';
2616
-
2617
- const onDragStart = Symbol('onDragStart');
2618
- const onDragOverContainer = Symbol('onDragOverContainer');
2619
- const onDragOver = Symbol('onDragOver');
2620
- const onDragStop = Symbol('onDragStop');
2621
-
2622
- function onSortableSortedDefaultAnnouncement({
2623
- dragEvent
2624
- }) {
2625
- const sourceText = dragEvent.source.textContent.trim() || dragEvent.source.id || 'sortable element';
2626
- if (dragEvent.over) {
2627
- const overText = dragEvent.over.textContent.trim() || dragEvent.over.id || 'sortable element';
2628
- const isFollowing = dragEvent.source.compareDocumentPosition(dragEvent.over) & Node.DOCUMENT_POSITION_FOLLOWING;
2629
- if (isFollowing) {
2630
- return `Placed ${sourceText} after ${overText}`;
2631
- } else {
2632
- return `Placed ${sourceText} before ${overText}`;
2633
- }
2634
- } else {
2635
-
2636
- return `Placed ${sourceText} into a different container`;
2637
- }
2638
- }
2639
-
2640
- const defaultAnnouncements = {
2641
- 'sortable:sorted': onSortableSortedDefaultAnnouncement
2642
- };
2643
-
2644
- class Sortable extends Draggable {
2645
-
2646
- constructor(containers = [], options = {}) {
2647
- super(containers, {
2648
- ...options,
2649
- announcements: {
2650
- ...defaultAnnouncements,
2651
- ...(options.announcements || {})
2652
- }
2653
- });
2654
-
2655
- this.startIndex = null;
2656
-
2657
- this.startContainer = null;
2658
- this[onDragStart] = this[onDragStart].bind(this);
2659
- this[onDragOverContainer] = this[onDragOverContainer].bind(this);
2660
- this[onDragOver] = this[onDragOver].bind(this);
2661
- this[onDragStop] = this[onDragStop].bind(this);
2662
- this.on('drag:start', this[onDragStart]).on('drag:over:container', this[onDragOverContainer]).on('drag:over', this[onDragOver]).on('drag:stop', this[onDragStop]);
2663
- }
2664
-
2665
- destroy() {
2666
- super.destroy();
2667
- this.off('drag:start', this[onDragStart]).off('drag:over:container', this[onDragOverContainer]).off('drag:over', this[onDragOver]).off('drag:stop', this[onDragStop]);
2668
- }
2669
-
2670
- index(element) {
2671
- return this.getSortableElementsForContainer(element.parentNode).indexOf(element);
2672
- }
2673
-
2674
- getSortableElementsForContainer(container) {
2675
- const allSortableElements = container.querySelectorAll(this.options.draggable);
2676
- return [...allSortableElements].filter(childElement => {
2677
- return childElement !== this.originalSource && childElement !== this.mirror && childElement.parentNode === container;
2678
- });
2679
- }
2680
-
2681
- [onDragStart](event) {
2682
- this.startContainer = event.source.parentNode;
2683
- this.startIndex = this.index(event.source);
2684
- const sortableStartEvent = new SortableStartEvent({
2685
- dragEvent: event,
2686
- startIndex: this.startIndex,
2687
- startContainer: this.startContainer
2688
- });
2689
- this.trigger(sortableStartEvent);
2690
- if (sortableStartEvent.canceled()) {
2691
- event.cancel();
2692
- }
2693
- }
2694
-
2695
- [onDragOverContainer](event) {
2696
- if (event.canceled()) {
2697
- return;
2698
- }
2699
- const {
2700
- source,
2701
- over,
2702
- overContainer
2703
- } = event;
2704
- const oldIndex = this.index(source);
2705
- const sortableSortEvent = new SortableSortEvent({
2706
- dragEvent: event,
2707
- currentIndex: oldIndex,
2708
- source,
2709
- over
2710
- });
2711
- this.trigger(sortableSortEvent);
2712
- if (sortableSortEvent.canceled()) {
2713
- return;
2714
- }
2715
- const children = this.getSortableElementsForContainer(overContainer);
2716
- const moves = move({
2717
- source,
2718
- over,
2719
- overContainer,
2720
- children
2721
- });
2722
- if (!moves) {
2723
- return;
2724
- }
2725
- const {
2726
- oldContainer,
2727
- newContainer
2728
- } = moves;
2729
- const newIndex = this.index(event.source);
2730
- const sortableSortedEvent = new SortableSortedEvent({
2731
- dragEvent: event,
2732
- oldIndex,
2733
- newIndex,
2734
- oldContainer,
2735
- newContainer
2736
- });
2737
- this.trigger(sortableSortedEvent);
2738
- }
2739
-
2740
- [onDragOver](event) {
2741
- if (event.over === event.originalSource || event.over === event.source) {
2742
- return;
2743
- }
2744
- const {
2745
- source,
2746
- over,
2747
- overContainer
2748
- } = event;
2749
- const oldIndex = this.index(source);
2750
- const sortableSortEvent = new SortableSortEvent({
2751
- dragEvent: event,
2752
- currentIndex: oldIndex,
2753
- source,
2754
- over
2755
- });
2756
- this.trigger(sortableSortEvent);
2757
- if (sortableSortEvent.canceled()) {
2758
- return;
2759
- }
2760
- const children = this.getDraggableElementsForContainer(overContainer);
2761
- const moves = move({
2762
- source,
2763
- over,
2764
- overContainer,
2765
- children
2766
- });
2767
- if (!moves) {
2768
- return;
2769
- }
2770
- const {
2771
- oldContainer,
2772
- newContainer
2773
- } = moves;
2774
- const newIndex = this.index(source);
2775
- const sortableSortedEvent = new SortableSortedEvent({
2776
- dragEvent: event,
2777
- oldIndex,
2778
- newIndex,
2779
- oldContainer,
2780
- newContainer
2781
- });
2782
- this.trigger(sortableSortedEvent);
2783
- }
2784
-
2785
- [onDragStop](event) {
2786
- const sortableStopEvent = new SortableStopEvent({
2787
- dragEvent: event,
2788
- oldIndex: this.startIndex,
2789
- newIndex: this.index(event.source),
2790
- oldContainer: this.startContainer,
2791
- newContainer: event.source.parentNode
2792
- });
2793
- this.trigger(sortableStopEvent);
2794
- this.startIndex = null;
2795
- this.startContainer = null;
2796
- }
2797
- }
2798
- function index(element) {
2799
- return Array.prototype.indexOf.call(element.parentNode.children, element);
2800
- }
2801
- function move({
2802
- source,
2803
- over,
2804
- overContainer,
2805
- children
2806
- }) {
2807
- const emptyOverContainer = !children.length;
2808
- const differentContainer = source.parentNode !== overContainer;
2809
- const sameContainer = over && source.parentNode === over.parentNode;
2810
- if (emptyOverContainer) {
2811
- return moveInsideEmptyContainer(source, overContainer);
2812
- } else if (sameContainer) {
2813
- return moveWithinContainer(source, over);
2814
- } else if (differentContainer) {
2815
- return moveOutsideContainer(source, over, overContainer);
2816
- } else {
2817
- return null;
2818
- }
2819
- }
2820
- function moveInsideEmptyContainer(source, overContainer) {
2821
- const oldContainer = source.parentNode;
2822
- overContainer.appendChild(source);
2823
- return {
2824
- oldContainer,
2825
- newContainer: overContainer
2826
- };
2827
- }
2828
- function moveWithinContainer(source, over) {
2829
- const oldIndex = index(source);
2830
- const newIndex = index(over);
2831
- if (oldIndex < newIndex) {
2832
- source.parentNode.insertBefore(source, over.nextElementSibling);
2833
- } else {
2834
- source.parentNode.insertBefore(source, over);
2835
- }
2836
- return {
2837
- oldContainer: source.parentNode,
2838
- newContainer: source.parentNode
2839
- };
2840
- }
2841
- function moveOutsideContainer(source, over, overContainer) {
2842
- const oldContainer = source.parentNode;
2843
- if (over) {
2844
- over.parentNode.insertBefore(source, over);
2845
- } else {
2846
-
2847
- overContainer.appendChild(source);
2848
- }
2849
- return {
2850
- oldContainer,
2851
- newContainer: source.parentNode
2852
- };
2853
- }
2854
-
2855
- const snkTabConfigCss = "@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}.sc-snk-tab-config-h{--snk-tab-config--backward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--snk-tab-config--forward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>');--snk-tab-config__lower-bar--background-color:var(--color--disable-primary, #e5eaf0);--snk-tab-config__lower-bar--border:2px solid var(--color--disable-primary, #e5eaf0);--snk-tab-config__tab--color:var(--text--primary, #626e82);--snk-tab-config__tab--font-family:var(--font-pattern, \"Roboto\");--snk-tab-config__tab--font-size:var(--title--small, 14px);--snk-tab-config__tab--padding:var(--space--small, 6px) var(--space--medium, 12px);--snk-tab-config__tab-is-active--color:var(--color--primary, #008561);--snk-tab-config__tab-hover--color:var(--color--secondary, #383c45);--snk-tab-config__tab-is-focused--border:1px dashed var(--color--primary, #008561);--snk-tab-config__tab-label--text-shadow:var(--text-shadow, 0 0 0 #353535, 0 0 1px transparent);--snk-tab-config__tab-label--margin-bottom:var(--space--extra-small, 3px);--snk-tab-config__new-button-icon--color:var(--color--secondary-700, #1C1D22);--snk-tab-config__forward-button--background-color:var(--text--primary, #626e82);--snk-tab-config__forward-button-hover--background-color:var(--color--primary, #008561);--snk-tab-config__left-icon--padding-right:var(--space--small, 6px);--snk-tab-config__left-icon--color:var(--text--disable, #AFB6C0);--snk-tab-config__tab-label-disabled--color:var(--text--disable, #AFB6C0);--snk-tab-config__slot--margin-left:var(--space--small, 6px);display:flex;position:relative;width:100%;overflow:hidden}.tab-config__scroll.sc-snk-tab-config{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.tab-config__lower-bar.sc-snk-tab-config{position:absolute;left:0%;right:0%;top:91%;bottom:0%;border-radius:2px;background-color:var(--snk-tab-config__lower-bar--background-color);border:var(--snk-tab-config__lower-bar--border)}.tab-config__tab.sc-snk-tab-config{display:flex;border:none;background-color:unset;cursor:pointer;align-items:center;justify-content:center;min-width:fit-content;color:var(--snk-tab-config__tab--color);font-family:var(--snk-tab-config__tab--font-family);font-size:var(--snk-tab-config__tab--font-size);padding:var(--snk-tab-config__tab--padding)}.tab-config__tab.sc-snk-tab-config:focus,.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{outline:none}.tab-config__tab--is-active.sc-snk-tab-config{position:relative;color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover{color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-active.sc-snk-tab-config::after{content:\"\";position:absolute;width:100%;height:100%;clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out;background-color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab--is-focused.sc-snk-tab-config{border:var(--snk-tab-config__tab-is-focused--border)}.tab-config__tab-label.sc-snk-tab-config{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--snk-tab-config__tab-label--text-shadow);margin-bottom:var(--snk-tab-config__tab-label--margin-bottom)}.tab-config__forward-button.sc-snk-tab-config,.tab-config__backward-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.tab-config__new-button.sc-snk-tab-config ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__new-button-icon--color)}.tab-config__backward-button.sc-snk-tab-config{left:0px;box-shadow:10px 10px 5px 5px white;background:white}.tab-config__forward-button.sc-snk-tab-config{box-shadow:10px 10px 5px 20px white;background:white}.tab-config__forward-button.sc-snk-tab-config::after,.tab-config__backward-button.sc-snk-tab-config::after{content:'';display:flex;width:10px;height:16px;background-color:var(--snk-tab-config__forward-button--background-color)}.tab-config__forward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--forward-icon);mask-image:var(--snk-tab-config--forward-icon)}.tab-config__backward-button.sc-snk-tab-config::after{-webkit-mask-image:var(--snk-tab-config--backward-icon);mask-image:var(--snk-tab-config--backward-icon)}.tab-config__forward-button.sc-snk-tab-config:hover::after,.tab-config__backward-button.sc-snk-tab-config:hover::after{background-color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__new-button.sc-snk-tab-config:hover ez-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__forward-button-hover--background-color)}.tab-config__hidden.sc-snk-tab-config{display:none}.tab-config__scroll.sc-snk-tab-config::-webkit-scrollbar{display:none}.tab-config__left-icon.sc-snk-tab-config{padding-right:var(--snk-tab-config__left-icon--padding-right);--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__left-icon--eye-off.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__left-icon--color)}.tab-config__right-icon.sc-snk-tab-config{visibility:hidden;padding-left:var(--snk-tab-config__left-icon--padding-right)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{visibility:visible}.tab-config__tab--is-active.sc-snk-tab-config .tab-config__right-icon.sc-snk-tab-config{visibility:visible;--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__tab.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-hover--color)}.tab-config__tab--is-active.sc-snk-tab-config:hover .tab-config__right-icon.sc-snk-tab-config{--ez-icon--color:var(--snk-tab-config__tab-is-active--color)}.tab-config__actions-button.sc-snk-tab-config{--ez-actions-button__btn-action--min-width:100px;visibility:hidden;opacity:0;transition:visibility 1s linear, opacity 0.3s linear}.tab-config__tab.sc-snk-tab-config:hover .tab-config__actions-button.sc-snk-tab-config{visibility:visible;opacity:1;transition:visibility 0.2s linear, opacity 0.10s linear}[data-draggable-element].sc-snk-tab-config{cursor:grab}.tab-config__tab-label-disabled.sc-snk-tab-config{color:var(--snk-tab-config__tab-label-disabled--color)}.tab-config__slot.sc-snk-tab-config{margin-left:var(--snk-tab-config__slot--margin-left)}";
2856
-
2857
- const SnkTabConfig = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
2858
- constructor() {
2859
- super();
2860
- this.__registerHost();
2861
- this.ezTabChange = createEvent(this, "ezTabChange", 7);
2862
- this.editionTitleTab = createEvent(this, "editionTitleTab", 7);
2863
- this.deleteTab = createEvent(this, "deleteTab", 7);
2864
- this.hideTab = createEvent(this, "hideTab", 7);
2865
- this.ezOrderChange = createEvent(this, "ezOrderChange", 7);
2866
- this.canStartDrag = createEvent(this, "canStartDrag", 7);
2867
- this._refTabActions = [];
2868
- this._processedTabs = undefined;
2869
- this._activeEditText = undefined;
2870
- this._activeEditTextIndex = undefined;
2871
- this._actionsHide = [];
2872
- this._actionsShow = [];
2873
- this.selectedIndex = undefined;
2874
- this.selectedTab = undefined;
2875
- this.tabs = undefined;
2876
- this.tabItems = undefined;
2877
- this.messagesBuilder = undefined;
2878
- }
2879
- /**
2880
- * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
2881
- * através de um pequeno modulo na estrutura da aplicação:
2882
- * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
2883
- * Para conhecer os detalhes do módulo, vide o arquivo neste projeto "/src/lib/message/resources/snk-form.msg.ts"
2884
- */
2885
- getMessage(key, params) {
2886
- return this.messagesBuilder.getMessage(key, params);
2887
- }
2888
- controlSortableTab() {
2889
- if (this._sortableTab) {
2890
- this._sortableTab.destroy();
2891
- }
2892
- this._sortableTab = new Sortable(this._hostElem.querySelectorAll('[data-draggable-parent="tab"]'), {
2893
- draggable: '[data-draggable-element="tab"]',
2894
- mirror: {
2895
- constrainDimensions: true
2896
- },
2897
- distance: CONFIG_EVENTS.dragStartDistance
2898
- });
2899
- this._sortableTab.on(CONFIG_SORTABLE_EVENTS.dragStart, (evt) => this.controlStartDraggingTab(evt));
2900
- this._sortableTab.on(CONFIG_SORTABLE_EVENTS.dragStop, (evt) => this.controlStopDraggingTab(evt));
2901
- }
2902
- controlStartDraggingTab(evt) {
2903
- var _a, _b;
2904
- const mouseEvent = (_a = evt === null || evt === void 0 ? void 0 : evt.dragEvent) === null || _a === void 0 ? void 0 : _a.originalEvent;
2905
- const targetElement = mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.target;
2906
- const targetName = (_b = targetElement === null || targetElement === void 0 ? void 0 : targetElement.tagName) === null || _b === void 0 ? void 0 : _b.toUpperCase();
2907
- if (this._activeEditText === true || targetName === "EZ-ACTIONS-BUTTON") {
2908
- evt === null || evt === void 0 ? void 0 : evt.cancel();
2909
- }
2910
- else {
2911
- this.canStartDrag.emit();
2912
- }
2913
- }
2914
- controlStopDraggingTab(evt) {
2915
- const updateTimer = 500;
2916
- if (evt.data.newIndex !== evt.data.oldIndex) {
2917
- setTimeout(() => {
2918
- const newIndex = (evt.data.newIndex || 0) + 1;
2919
- this.ezOrderChange.emit(newIndex);
2920
- }, updateTimer);
2921
- }
2922
- }
2923
- handleTabClick(tab) {
2924
- this.selectedIndex = tab.index;
2925
- this._focusedIndex = tab.index;
2926
- this.selectedTab = tab.tabKey;
2927
- this.ezTabChange.emit(tab);
2928
- this.setFocusedBtn(false, tab.index);
2929
- this.setFocusedTab(tab.index);
2930
- }
2931
- handleSlotChange(ev) {
2932
- const slot = ev.target;
2933
- const content = slot.assignedElements()[0];
2934
- if (content) {
2935
- content.classList.add("tab-config__slot");
2936
- }
2937
- }
2938
- scrollBackward() {
2939
- const container = this._scrollContainer;
2940
- if (container) {
2941
- container.scrollLeft -= container.clientWidth;
2942
- }
2943
- }
2944
- scrollFoward() {
2945
- const container = this._scrollContainer;
2946
- if (container) {
2947
- let lastTab = null;
2948
- container.querySelectorAll(".tab-config__tab").forEach((tab) => {
2949
- if (tab.getBoundingClientRect().right < container.clientWidth) {
2950
- lastTab = tab;
2951
- }
2952
- });
2953
- container.scrollLeft = lastTab.offsetLeft + lastTab.offsetWidth;
2954
- }
2955
- }
2956
- updateScroll() {
2957
- const container = this._scrollContainer;
2958
- if (container) {
2959
- const { scrollWidth, clientWidth, scrollLeft } = container;
2960
- const remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
2961
- this._startHidden = container.scrollLeft > 0;
2962
- this._endHidden = remainingScroll > 0;
2963
- if (this._startHidden) {
2964
- this._backwardButton.classList.remove("tab-config__hidden");
2965
- }
2966
- else {
2967
- this._backwardButton.classList.add("tab-config__hidden");
2968
- }
2969
- if (this._endHidden) {
2970
- this._forwardButton.classList.remove("tab-config__hidden");
2971
- }
2972
- else {
2973
- this._forwardButton.classList.add("tab-config__hidden");
2974
- }
2975
- }
2976
- }
2977
- domScrollHandler() {
2978
- window.clearTimeout(this._scrollCallBackScroll);
2979
- this._scrollCallBackScroll = window.setTimeout(() => { this.updateScroll(); }, 200);
2980
- }
2981
- setFocusedTab(index) {
2982
- window.clearTimeout(this._scrollCallBackFocus);
2983
- this._scrollCallBackFocus = window.setTimeout(() => {
2984
- const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
2985
- tabtoscroll === null || tabtoscroll === void 0 ? void 0 : tabtoscroll.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
2986
- }, 200);
2987
- }
2988
- controlKeyEventEnter(evt) {
2989
- evt.preventDefault();
2990
- const selectedTab = this._processedTabs[this._focusedIndex];
2991
- this.handleTabClick(selectedTab);
2992
- this.setFocusedTab(selectedTab.index);
2993
- }
2994
- controlKeyEventArrow(evt) {
2995
- let operator = undefined;
2996
- if (evt.key === KEY_EVENTS.arrowLeft) {
2997
- operator = false;
2998
- }
2999
- else if (evt.key === KEY_EVENTS.arrowRight) {
3000
- operator = true;
3001
- }
3002
- else {
3003
- return;
3004
- }
3005
- if (this._focusedIndex === undefined) {
3006
- if (operator === false) {
3007
- this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex - 1 : undefined;
3008
- }
3009
- else {
3010
- this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex + 1 : undefined;
3011
- }
3012
- }
3013
- else {
3014
- if (operator === false) {
3015
- this._focusedIndex = this._focusedIndex - 1;
3016
- }
3017
- else {
3018
- this._focusedIndex = this._focusedIndex + 1;
3019
- }
3020
- }
3021
- if (this._focusedIndex < 0) {
3022
- this._focusedIndex = 0;
3023
- }
3024
- else if (this._focusedIndex > this._processedTabs.length - 1) {
3025
- this._focusedIndex = this._processedTabs.length - 1;
3026
- }
3027
- this.setFocusedBtn(true, this._focusedIndex);
3028
- this.setFocusedTab(this._focusedIndex);
3029
- }
3030
- controlKeyEventEscape(evt) {
3031
- evt.preventDefault();
3032
- const currentTab = this._processedTabs[this.selectedIndex];
3033
- this._focusedIndex = undefined;
3034
- this.handleTabClick(currentTab);
3035
- this.setFocusedTab(this.selectedIndex);
3036
- }
3037
- setFocusedParam(evt) {
3038
- if (this._activeEditText === true || evt == undefined) {
3039
- return;
3040
- }
3041
- if (evt.key === KEY_EVENTS.enter) {
3042
- this.controlKeyEventEnter(evt);
3043
- return;
3044
- }
3045
- if (evt.key === KEY_EVENTS.arrowLeft || evt.key === KEY_EVENTS.arrowRight) {
3046
- this.controlKeyEventArrow(evt);
3047
- return;
3048
- }
3049
- if (evt.key === KEY_EVENTS.tab || evt.key === KEY_EVENTS.escape) {
3050
- this.controlKeyEventEscape(evt);
3051
- return;
3052
- }
3053
- }
3054
- setFocusedBtn(visible, parameter) {
3055
- const tabsButtons = this._scrollContainer.querySelectorAll(".tab-config__tab");
3056
- tabsButtons.forEach((el) => {
3057
- el.classList.remove("tab-config__tab--is-focused");
3058
- if (el.id === "tab" + parameter && visible) {
3059
- el.classList.add("tab-config__tab--is-focused");
3060
- }
3061
- });
3062
- }
3063
- getStyledLabel(tabId) {
3064
- const tabElem = this._hostElem.querySelector(`#${tabId}`);
3065
- if (tabElem == undefined) {
3066
- return;
3067
- }
3068
- let styledLabel = {
3069
- fontSize: window.getComputedStyle(tabElem).getPropertyValue('font-size'),
3070
- fontWeight: window.getComputedStyle(tabElem).getPropertyValue('font-weight'),
3071
- fontFamily: window.getComputedStyle(tabElem).getPropertyValue('font-family')
3072
- };
3073
- return styledLabel;
3074
- }
3075
- cancelEditText(cancelTextEdition) {
3076
- var _a;
3077
- cancelTextEdition.stopPropagation();
3078
- this._activeEditText = false;
3079
- if (this._scrollContainer != undefined) {
3080
- (_a = this._scrollContainer.querySelector('.tab-config__tab--is-active')) === null || _a === void 0 ? void 0 : _a.focus();
3081
- }
3082
- }
3083
- handleActions(actionSelect, tab) {
3084
- const { value: typeAction } = actionSelect.detail;
3085
- if (typeAction === TYPE_ACTIONS.rename) {
3086
- this._activeEditText = true;
3087
- this._activeEditTextIndex = tab.index;
3088
- }
3089
- else if (typeAction === TYPE_ACTIONS.hide || typeAction === TYPE_ACTIONS.show) {
3090
- this.hideTab.emit(tab);
3091
- }
3092
- else if (typeAction === TYPE_ACTIONS.delete) {
3093
- this.deleteTab.emit(tab);
3094
- }
3095
- }
3096
- handleSaveEditionText(editDetails) {
3097
- const { value, newValue } = editDetails.detail;
3098
- if (value === newValue) {
3099
- this.cancelEditText(editDetails);
3100
- return;
3101
- }
3102
- this._processedTabs.forEach((tab) => {
3103
- if (tab.label === value) {
3104
- tab.label = newValue;
3105
- this.cancelEditText(editDetails);
3106
- this.editionTitleTab.emit(editDetails);
3107
- }
3108
- });
3109
- }
3110
- onHideActions(index) {
3111
- const elementActionsBtn = this._refTabActions[index];
3112
- if (elementActionsBtn) {
3113
- elementActionsBtn.isOpened().then((isOpened) => {
3114
- if (isOpened) {
3115
- elementActionsBtn === null || elementActionsBtn === void 0 ? void 0 : elementActionsBtn.hideActions();
3116
- }
3117
- });
3118
- }
3119
- }
3120
- componentWillLoad() {
3121
- this._application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
3122
- if (this._application != undefined) {
3123
- this._actionsHide = [
3124
- { value: TYPE_ACTIONS.rename, label: this.getMessage("snkTabConfig.labelRename") },
3125
- { value: TYPE_ACTIONS.hide, label: this.getMessage("snkTabConfig.labelHide") },
3126
- { value: TYPE_ACTIONS.delete, label: this.getMessage("snkTabConfig.labelDelete") }
3127
- ];
3128
- this._actionsShow = [
3129
- { value: TYPE_ACTIONS.rename, label: this.getMessage("snkTabConfig.labelRename") },
3130
- { value: TYPE_ACTIONS.show, label: this.getMessage("snkTabConfig.labelShow") },
3131
- { value: TYPE_ACTIONS.delete, label: this.getMessage("snkTabConfig.labelDelete") }
3132
- ];
3133
- }
3134
- }
3135
- componentWillRender() {
3136
- this._processedTabs = [];
3137
- if (this.tabs) {
3138
- this.tabs.split(",").forEach((label) => {
3139
- label = label.trim();
3140
- this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
3141
- });
3142
- }
3143
- this.tabItems.forEach((tab) => {
3144
- tab.label = tab.label !== TAB_NAMES.main ? tab.label : this.getMessage("snkFormConfig.form.mainArea");
3145
- tab.index = this._processedTabs.length;
3146
- this._processedTabs.push(tab);
3147
- });
3148
- }
3149
- componentDidRender() {
3150
- this.updateScroll();
3151
- this.controlSortableTab();
3152
- }
3153
- componentDidLoad() {
3154
- ElementIDUtils.addIDInfo(this._hostElem, "itemConfig");
3155
- this._processedTabs.forEach((tab, index) => {
3156
- const dataID = { id: tab.label };
3157
- ElementIDUtils.addIDInfo(this._hostElem.querySelector(`#tab${index}`), "itemConfig", dataID);
3158
- });
3159
- }
3160
- render() {
3161
- return (h(Host, null, h("button", { class: "tab-config__backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }), h("div", { class: "tab-config__lower-bar" }), h("div", { class: "tab-config__scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.setFocusedParam(ev), "data-draggable-parent": "tab" }, this._processedTabs.map((tab, index) => {
3162
- const tabId = "tab" + index;
3163
- const isSelected = index === this.selectedIndex || (this.selectedTab && tab.tabKey === this.selectedTab);
3164
- if (isSelected) {
3165
- this.selectedTab = tab.tabKey;
3166
- this.selectedIndex = index;
3167
- }
3168
- return h("button", { id: tabId, class: `tab-config__tab${isSelected ? " tab-config__tab--is-active" : ""}`, onClick: () => this.handleTabClick(tab), onDblClick: () => { this._activeEditText = true; this._activeEditTextIndex = index; }, "data-draggable-element": index > 0 ? "tab" : "", onMouseLeave: () => this.onHideActions(index), key: tab.label }, (this._activeEditText === true && this._activeEditTextIndex === index && index > 0) ||
3169
- h(Fragment, null, index > 0 && h("ez-icon", { iconName: tab.leftIcon || "drag-indicator", class: "tab-config__left-icon" }), (tab.visible === false && index > 0) && h("ez-icon", { iconName: tab.leftIcon || "eye-off", class: "tab-config__left-icon tab-config__left-icon--eye-off" }), h("span", { class: "tab-config__tab-label" + (tab.visible === false && index > 0 ? " tab-config__tab-label-disabled" : ""), title: tab.label }, tab.label), index > 0 &&
3170
- h("ez-actions-button", { class: "tab-config__actions-button", size: "small", ref: elem => this._refTabActions[index] = elem, actions: tab.visible === false ? this._actionsShow : this._actionsHide, isTransparent: true, arrowActive: true, onEzAction: (ev) => this.handleActions(ev, tab) }), h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } })), (this._activeEditText === true && index > 0 && this._activeEditTextIndex === index) &&
3171
- h("ez-text-edit", { value: tab.label, styled: this.getStyledLabel(tabId), class: "tab-config__edit-text", onSaveEdition: (ev) => this.handleSaveEditionText(ev), onCancelEdition: (ev) => this.cancelEditText(ev) }));
3172
- })), h("button", { class: "tab-config__forward-button", ref: (el) => this._forwardButton = el, onClick: () => this.scrollFoward() })));
3173
- }
3174
- get _hostElem() { return this; }
3175
- static get style() { return snkTabConfigCss; }
3176
- }, [6, "snk-tab-config", {
3177
- "selectedIndex": [1538, "selected-index"],
3178
- "selectedTab": [1537, "selected-tab"],
3179
- "tabs": [1],
3180
- "tabItems": [16],
3181
- "messagesBuilder": [1040],
3182
- "_processedTabs": [32],
3183
- "_activeEditText": [32],
3184
- "_activeEditTextIndex": [32],
3185
- "_actionsHide": [32],
3186
- "_actionsShow": [32]
3187
- }]);
3188
- function defineCustomElement() {
3189
- if (typeof customElements === "undefined") {
3190
- return;
3191
- }
3192
- const components = ["snk-tab-config"];
3193
- components.forEach(tagName => { switch (tagName) {
3194
- case "snk-tab-config":
3195
- if (!customElements.get(tagName)) {
3196
- customElements.define(tagName, SnkTabConfig);
3197
- }
3198
- break;
3199
- } });
3200
- }
3201
-
3202
- export { SnkTabConfig as S, Sortable as a, defineCustomElement as d };