genesys-spark-components 4.22.0 → 4.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/genesys-webcomponents.cjs.js +1 -1
- package/dist/cjs/gux-accordion.cjs.entry.js +1 -1
- package/dist/cjs/gux-action-button.cjs.entry.js +1 -1
- package/dist/cjs/gux-action-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-advanced-dropdown-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-announce-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-avatar-beta.cjs.entry.js +73 -8
- package/dist/cjs/gux-badge.cjs.entry.js +1 -1
- package/dist/cjs/gux-blank-state.cjs.entry.js +1 -1
- package/dist/cjs/gux-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/gux-button-multi.cjs.entry.js +1 -1
- package/dist/cjs/gux-button-slot.cjs.entry.js +1 -1
- package/dist/cjs/gux-button.cjs.entry.js +1 -1
- package/dist/cjs/gux-calendar.cjs.entry.js +1 -1
- package/dist/cjs/gux-card.cjs.entry.js +1 -1
- package/dist/cjs/gux-column-manager.cjs.entry.js +1 -1
- package/dist/cjs/gux-content-search.cjs.entry.js +1 -1
- package/dist/cjs/gux-context-menu.cjs.entry.js +1 -1
- package/dist/cjs/gux-copy-to-clipboard.cjs.entry.js +1 -1
- package/dist/cjs/gux-date-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-date-time-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/gux-disclosure-button-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-dismiss-button.cjs.entry.js +1 -1
- package/dist/cjs/gux-dropdown-multi.cjs.entry.js +1 -1
- package/dist/cjs/gux-dropdown_3.cjs.entry.js +1 -1
- package/dist/cjs/gux-flag-icon-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-flyout-menu.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-color.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-input-clear-button.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-number_3.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-phone.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-radio.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-range.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-search.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-select.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-text-like.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-textarea.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-time-picker.cjs.entry.js +1 -1
- package/dist/cjs/gux-form-field-time-zone-picker.cjs.entry.js +1 -1
- package/dist/cjs/gux-icon.cjs.entry.js +1 -1
- package/dist/cjs/gux-inline-alert.cjs.entry.js +1 -1
- package/dist/cjs/gux-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-listbox-multi.cjs.entry.js +1 -1
- package/dist/cjs/gux-loading-message.cjs.entry.js +1 -1
- package/dist/cjs/gux-modal-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-modal.cjs.entry.js +1 -1
- package/dist/cjs/gux-month-picker-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-notification-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-page-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-cursor.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-pagination.cjs.entry.js +1 -1
- package/dist/cjs/gux-phone-input-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-popover-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-radial-loading.cjs.entry.js +1 -1
- package/dist/cjs/gux-radial-progress.cjs.entry.js +1 -1
- package/dist/cjs/gux-rating.cjs.entry.js +1 -1
- package/dist/cjs/gux-screen-reader-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-segmented-control-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-simple-toast-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-skip-navigation-list.cjs.entry.js +1 -1
- package/dist/cjs/gux-sort-control.cjs.entry.js +1 -1
- package/dist/cjs/gux-switch-legacy.cjs.entry.js +1 -1
- package/dist/cjs/gux-tab-advanced-list.cjs.entry.js +500 -871
- package/dist/cjs/gux-table-toolbar-action.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-toolbar-custom-action.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-toolbar-menu-button.cjs.entry.js +1 -1
- package/dist/cjs/gux-table-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/gux-table.cjs.entry.js +1 -1
- package/dist/cjs/gux-tabs-advanced.cjs.entry.js +1 -1
- package/dist/cjs/gux-tabs.cjs.entry.js +1 -1
- package/dist/cjs/gux-tag.cjs.entry.js +1 -1
- package/dist/cjs/gux-text-highlight.cjs.entry.js +1 -1
- package/dist/cjs/gux-time-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-time-picker.cjs.entry.js +1 -1
- package/dist/cjs/gux-time-zone-picker-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-toast.cjs.entry.js +1 -1
- package/dist/cjs/gux-toggle.cjs.entry.js +1 -1
- package/dist/cjs/gux-tooltip-base-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-tooltip-beta.cjs.entry.js +1 -1
- package/dist/cjs/gux-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{usage-d4f6418b.js → usage-9ea1a406.js} +9 -9
- package/dist/collection/components/beta/gux-avatar/gux-avatar.css +168 -30
- package/dist/collection/components/beta/gux-avatar/gux-avatar.js +161 -6
- package/dist/collection/components/beta/gux-avatar/tests/gux-avatar.spec.js +42 -0
- package/dist/collection/components/stable/gux-icon/gux-icon.js +1 -1
- package/dist/collection/components/stable/gux-icon/icons/fa/00-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/fa/anchor-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/fa/arrows-up-down-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/building-user-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/calendar-circle-user-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/compass-drafting-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/grid-2-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/headset-regular.svg +1 -0
- package/dist/collection/components/stable/gux-icon/icons/restricted/fa/screwdriver-wrench-regular.svg +1 -0
- package/dist/deploy-info.json +3 -3
- package/dist/esm/genesys-webcomponents.js +1 -1
- package/dist/esm/gux-accordion.entry.js +1 -1
- package/dist/esm/gux-action-button.entry.js +1 -1
- package/dist/esm/gux-action-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-advanced-dropdown-legacy.entry.js +1 -1
- package/dist/esm/gux-announce-beta.entry.js +1 -1
- package/dist/esm/gux-avatar-beta.entry.js +73 -8
- package/dist/esm/gux-badge.entry.js +1 -1
- package/dist/esm/gux-blank-state.entry.js +1 -1
- package/dist/esm/gux-breadcrumbs.entry.js +1 -1
- package/dist/esm/gux-button-multi.entry.js +1 -1
- package/dist/esm/gux-button-slot.entry.js +1 -1
- package/dist/esm/gux-button.entry.js +1 -1
- package/dist/esm/gux-calendar.entry.js +1 -1
- package/dist/esm/gux-card.entry.js +1 -1
- package/dist/esm/gux-column-manager.entry.js +1 -1
- package/dist/esm/gux-content-search.entry.js +1 -1
- package/dist/esm/gux-context-menu.entry.js +1 -1
- package/dist/esm/gux-copy-to-clipboard.entry.js +1 -1
- package/dist/esm/gux-date-beta.entry.js +1 -1
- package/dist/esm/gux-date-time-beta.entry.js +1 -1
- package/dist/esm/gux-datepicker.entry.js +1 -1
- package/dist/esm/gux-disclosure-button-legacy.entry.js +1 -1
- package/dist/esm/gux-dismiss-button.entry.js +1 -1
- package/dist/esm/gux-dropdown-multi.entry.js +1 -1
- package/dist/esm/gux-dropdown_3.entry.js +1 -1
- package/dist/esm/gux-flag-icon-beta.entry.js +1 -1
- package/dist/esm/gux-flyout-menu.entry.js +1 -1
- package/dist/esm/gux-form-field-checkbox.entry.js +1 -1
- package/dist/esm/gux-form-field-color.entry.js +1 -1
- package/dist/esm/gux-form-field-dropdown.entry.js +1 -1
- package/dist/esm/gux-form-field-input-clear-button.entry.js +1 -1
- package/dist/esm/gux-form-field-number_3.entry.js +1 -1
- package/dist/esm/gux-form-field-phone.entry.js +1 -1
- package/dist/esm/gux-form-field-radio.entry.js +1 -1
- package/dist/esm/gux-form-field-range.entry.js +1 -1
- package/dist/esm/gux-form-field-search.entry.js +1 -1
- package/dist/esm/gux-form-field-select.entry.js +1 -1
- package/dist/esm/gux-form-field-text-like.entry.js +1 -1
- package/dist/esm/gux-form-field-textarea.entry.js +1 -1
- package/dist/esm/gux-form-field-time-picker.entry.js +1 -1
- package/dist/esm/gux-form-field-time-zone-picker.entry.js +1 -1
- package/dist/esm/gux-icon.entry.js +1 -1
- package/dist/esm/gux-inline-alert.entry.js +1 -1
- package/dist/esm/gux-list.entry.js +1 -1
- package/dist/esm/gux-listbox-multi.entry.js +1 -1
- package/dist/esm/gux-loading-message.entry.js +1 -1
- package/dist/esm/gux-modal-legacy.entry.js +1 -1
- package/dist/esm/gux-modal.entry.js +1 -1
- package/dist/esm/gux-month-picker-beta.entry.js +1 -1
- package/dist/esm/gux-notification-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-page-loading-spinner.entry.js +1 -1
- package/dist/esm/gux-pagination-cursor.entry.js +1 -1
- package/dist/esm/gux-pagination-legacy.entry.js +1 -1
- package/dist/esm/gux-pagination.entry.js +1 -1
- package/dist/esm/gux-phone-input-beta.entry.js +1 -1
- package/dist/esm/gux-popover-list.entry.js +1 -1
- package/dist/esm/gux-radial-loading.entry.js +1 -1
- package/dist/esm/gux-radial-progress.entry.js +1 -1
- package/dist/esm/gux-rating.entry.js +1 -1
- package/dist/esm/gux-screen-reader-beta.entry.js +1 -1
- package/dist/esm/gux-segmented-control-beta.entry.js +1 -1
- package/dist/esm/gux-simple-toast-legacy.entry.js +1 -1
- package/dist/esm/gux-skip-navigation-list.entry.js +1 -1
- package/dist/esm/gux-sort-control.entry.js +1 -1
- package/dist/esm/gux-switch-legacy.entry.js +1 -1
- package/dist/esm/gux-tab-advanced-list.entry.js +500 -871
- package/dist/esm/gux-table-toolbar-action.entry.js +1 -1
- package/dist/esm/gux-table-toolbar-custom-action.entry.js +1 -1
- package/dist/esm/gux-table-toolbar-menu-button.entry.js +1 -1
- package/dist/esm/gux-table-toolbar.entry.js +1 -1
- package/dist/esm/gux-table.entry.js +1 -1
- package/dist/esm/gux-tabs-advanced.entry.js +1 -1
- package/dist/esm/gux-tabs.entry.js +1 -1
- package/dist/esm/gux-tag.entry.js +1 -1
- package/dist/esm/gux-text-highlight.entry.js +1 -1
- package/dist/esm/gux-time-beta.entry.js +1 -1
- package/dist/esm/gux-time-picker.entry.js +1 -1
- package/dist/esm/gux-time-zone-picker-beta.entry.js +1 -1
- package/dist/esm/gux-toast.entry.js +1 -1
- package/dist/esm/gux-toggle.entry.js +1 -1
- package/dist/esm/gux-tooltip-base-beta.entry.js +1 -1
- package/dist/esm/gux-tooltip-beta.entry.js +1 -1
- package/dist/esm/gux-tooltip.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{usage-ccad1705.js → usage-eea733de.js} +9 -9
- package/dist/genesys-webcomponents/genesys-webcomponents.esm.js +1 -1
- package/dist/genesys-webcomponents/i18n/genesys-webcomponents.i18n.en.json +1 -1
- package/dist/genesys-webcomponents/icons/fa/00-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/fa/anchor-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/fa/arrows-up-down-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/building-user-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/calendar-circle-user-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/compass-drafting-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/grid-2-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/headset-regular.svg +1 -0
- package/dist/genesys-webcomponents/icons/restricted/fa/screwdriver-wrench-regular.svg +1 -0
- package/dist/genesys-webcomponents/{p-c3a10929.entry.js → p-014b7b95.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-d3922e0d.entry.js → p-01a8d6c1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bd633b17.entry.js → p-04c030c9.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-436839a1.entry.js → p-058b1736.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-183ebc76.entry.js → p-077188b0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-51696fd4.entry.js → p-09afb249.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9deee030.entry.js → p-0adf91e0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0ceb12d0.entry.js → p-121da8e3.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-d4e792cd.entry.js → p-193966c2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1f3e0cea.entry.js → p-1a068ac8.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a98a27ea.entry.js → p-1b718321.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-665596a4.entry.js → p-20a720bc.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-164cbe2d.entry.js → p-236b382d.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-b35fcc0e.entry.js → p-24248e7e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-d368a948.entry.js → p-34c40a4c.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-eaf65c90.entry.js → p-3cdf8399.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-fb351660.entry.js → p-3ce032c1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5a657bbc.entry.js → p-3cea1bf3.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2c542005.entry.js → p-442f93cd.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f6f69e46.entry.js → p-4451e9e7.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-11af17f2.entry.js → p-45311fde.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a255e23a.entry.js → p-489636ea.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-c36d1b5a.entry.js → p-4935a82e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-79fbe8e0.entry.js → p-499550e5.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7ca55c80.entry.js → p-49a85cb8.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-23171357.entry.js → p-49d2dcaf.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-207ba8d5.entry.js → p-4ce1b965.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bdfcd4db.entry.js → p-511f214f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7904b3fd.entry.js → p-5196bdf4.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-52704a37.entry.js → p-55ea85d3.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-56d2d225.entry.js +1 -0
- package/dist/genesys-webcomponents/{p-e5c64958.entry.js → p-58d6febb.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-772098d0.entry.js → p-5a6ce278.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-84b54a2f.entry.js → p-5b859e97.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-78d84998.entry.js → p-5d887843.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-e3dfe5d3.entry.js → p-5ecac4a0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-1b170b63.entry.js → p-5ff5df46.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9220bd29.entry.js → p-610191fd.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8d6953cd.entry.js → p-64e00c2b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0d96f4e7.entry.js → p-6b9c841e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5e1c9998.entry.js → p-6bbdd915.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bf7644f8.entry.js → p-79136dcf.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ce7c9d60.entry.js → p-7d95c216.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-37e1b433.entry.js → p-7f3cfaa1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-41dd7efe.entry.js → p-7f4a59da.entry.js} +1 -1
- package/dist/genesys-webcomponents/p-80a2f466.entry.js +7 -0
- package/dist/genesys-webcomponents/{p-c4b8e38d.entry.js → p-8995a20b.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-34505fdc.entry.js → p-8feba2d5.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-60a50d43.js → p-92ca1cb8.js} +1 -1
- package/dist/genesys-webcomponents/{p-1c4a2a1c.entry.js → p-9a9db5c4.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8066476e.entry.js → p-9d8299c0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-b3dc16e3.entry.js → p-9f776d21.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-beaf804b.entry.js → p-aa495152.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-69501693.entry.js → p-ae7194ef.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-fa3a24f2.entry.js → p-b1e06b6a.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8eaf5391.entry.js → p-b38e2806.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-fb69efcf.entry.js → p-b61152b7.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5eee572e.entry.js → p-b8089f64.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-a31b5c94.entry.js → p-bcb2307f.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-444a5df9.entry.js → p-c0417b42.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-eb29dca1.entry.js → p-c1b66bdb.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-9de59cfa.entry.js → p-c4a5a383.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-03ba668d.entry.js → p-c60f8690.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-0ab1bbb6.entry.js → p-c8e43c05.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-fca8d502.entry.js → p-c9a6c986.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-2e073447.entry.js → p-ca92d44e.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-6bb263db.entry.js → p-d653e150.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-5de076c5.entry.js → p-dc4c2180.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-7a135697.entry.js → p-dc841662.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-bc6b4ae4.entry.js → p-ddfcfea2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8aeb5e21.entry.js → p-e4d1ab82.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-78b2275c.entry.js → p-e6688260.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ac3b69fa.entry.js → p-e693c9fe.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-857815d7.entry.js → p-e6c0695a.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-8c253e0e.entry.js → p-e7535dd1.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-36446966.entry.js → p-e8074f91.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-52de21b5.entry.js → p-e8eade47.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-ecbe0963.entry.js → p-edcbdcf4.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-f1b51ca5.entry.js → p-f0b4f3c8.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-983a999c.entry.js → p-f521a7b2.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-98b0d772.entry.js → p-f91a5996.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-445107bf.entry.js → p-fbad3254.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-82adf097.entry.js → p-ff467af0.entry.js} +1 -1
- package/dist/genesys-webcomponents/{p-b1b47734.entry.js → p-ffd1add0.entry.js} +1 -1
- package/dist/stencil-wrapper.js +1 -1
- package/dist/types/components/beta/gux-avatar/gux-avatar.d.ts +28 -2
- package/dist/types/components/beta/gux-avatar/gux-avatar.types.d.ts +1 -0
- package/dist/types/components/stable/gux-icon/gux-icon.types.d.ts +1 -1
- package/dist/types/components.d.ts +42 -2
- package/dist/types/stencil-wrapper.d.ts +1 -1
- package/package.json +9 -9
- package/dist/genesys-webcomponents/p-45c42eca.entry.js +0 -1
- package/dist/genesys-webcomponents/p-54bbb104.entry.js +0 -7
@@ -7,33 +7,27 @@ import { t as tabsResources } from './en-bf740e9b.js';
|
|
7
7
|
import './get-closest-element-66f63212.js';
|
8
8
|
|
9
9
|
/**!
|
10
|
-
* Sortable 1.15.
|
10
|
+
* Sortable 1.15.2
|
11
11
|
* @author RubaXa <trash@rubaxa.org>
|
12
12
|
* @author owenm <owen23355@gmail.com>
|
13
13
|
* @license MIT
|
14
14
|
*/
|
15
15
|
function ownKeys(object, enumerableOnly) {
|
16
16
|
var keys = Object.keys(object);
|
17
|
-
|
18
17
|
if (Object.getOwnPropertySymbols) {
|
19
18
|
var symbols = Object.getOwnPropertySymbols(object);
|
20
|
-
|
21
19
|
if (enumerableOnly) {
|
22
20
|
symbols = symbols.filter(function (sym) {
|
23
21
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
24
22
|
});
|
25
23
|
}
|
26
|
-
|
27
24
|
keys.push.apply(keys, symbols);
|
28
25
|
}
|
29
|
-
|
30
26
|
return keys;
|
31
27
|
}
|
32
|
-
|
33
28
|
function _objectSpread2(target) {
|
34
29
|
for (var i = 1; i < arguments.length; i++) {
|
35
30
|
var source = arguments[i] != null ? arguments[i] : {};
|
36
|
-
|
37
31
|
if (i % 2) {
|
38
32
|
ownKeys(Object(source), true).forEach(function (key) {
|
39
33
|
_defineProperty(target, key, source[key]);
|
@@ -46,10 +40,8 @@ function _objectSpread2(target) {
|
|
46
40
|
});
|
47
41
|
}
|
48
42
|
}
|
49
|
-
|
50
43
|
return target;
|
51
44
|
}
|
52
|
-
|
53
45
|
function _typeof(obj) {
|
54
46
|
"@babel/helpers - typeof";
|
55
47
|
|
@@ -62,10 +54,8 @@ function _typeof(obj) {
|
|
62
54
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
63
55
|
};
|
64
56
|
}
|
65
|
-
|
66
57
|
return _typeof(obj);
|
67
58
|
}
|
68
|
-
|
69
59
|
function _defineProperty(obj, key, value) {
|
70
60
|
if (key in obj) {
|
71
61
|
Object.defineProperty(obj, key, {
|
@@ -77,53 +67,40 @@ function _defineProperty(obj, key, value) {
|
|
77
67
|
} else {
|
78
68
|
obj[key] = value;
|
79
69
|
}
|
80
|
-
|
81
70
|
return obj;
|
82
71
|
}
|
83
|
-
|
84
72
|
function _extends() {
|
85
73
|
_extends = Object.assign || function (target) {
|
86
74
|
for (var i = 1; i < arguments.length; i++) {
|
87
75
|
var source = arguments[i];
|
88
|
-
|
89
76
|
for (var key in source) {
|
90
77
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
91
78
|
target[key] = source[key];
|
92
79
|
}
|
93
80
|
}
|
94
81
|
}
|
95
|
-
|
96
82
|
return target;
|
97
83
|
};
|
98
|
-
|
99
84
|
return _extends.apply(this, arguments);
|
100
85
|
}
|
101
|
-
|
102
86
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
103
87
|
if (source == null) return {};
|
104
88
|
var target = {};
|
105
89
|
var sourceKeys = Object.keys(source);
|
106
90
|
var key, i;
|
107
|
-
|
108
91
|
for (i = 0; i < sourceKeys.length; i++) {
|
109
92
|
key = sourceKeys[i];
|
110
93
|
if (excluded.indexOf(key) >= 0) continue;
|
111
94
|
target[key] = source[key];
|
112
95
|
}
|
113
|
-
|
114
96
|
return target;
|
115
97
|
}
|
116
|
-
|
117
98
|
function _objectWithoutProperties(source, excluded) {
|
118
99
|
if (source == null) return {};
|
119
|
-
|
120
100
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
121
|
-
|
122
101
|
var key, i;
|
123
|
-
|
124
102
|
if (Object.getOwnPropertySymbols) {
|
125
103
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
126
|
-
|
127
104
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
128
105
|
key = sourceSymbolKeys[i];
|
129
106
|
if (excluded.indexOf(key) >= 0) continue;
|
@@ -131,18 +108,16 @@ function _objectWithoutProperties(source, excluded) {
|
|
131
108
|
target[key] = source[key];
|
132
109
|
}
|
133
110
|
}
|
134
|
-
|
135
111
|
return target;
|
136
112
|
}
|
137
113
|
|
138
|
-
var version = "1.15.
|
114
|
+
var version = "1.15.2";
|
139
115
|
|
140
116
|
function userAgent(pattern) {
|
141
117
|
if (typeof window !== 'undefined' && window.navigator) {
|
142
118
|
return !! /*@__PURE__*/navigator.userAgent.match(pattern);
|
143
119
|
}
|
144
120
|
}
|
145
|
-
|
146
121
|
var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);
|
147
122
|
var Edge = userAgent(/Edge/i);
|
148
123
|
var FireFox = userAgent(/firefox/i);
|
@@ -154,23 +129,15 @@ var captureMode = {
|
|
154
129
|
capture: false,
|
155
130
|
passive: false
|
156
131
|
};
|
157
|
-
|
158
132
|
function on(el, event, fn) {
|
159
133
|
el.addEventListener(event, fn, !IE11OrLess && captureMode);
|
160
134
|
}
|
161
|
-
|
162
135
|
function off(el, event, fn) {
|
163
136
|
el.removeEventListener(event, fn, !IE11OrLess && captureMode);
|
164
137
|
}
|
165
|
-
|
166
|
-
function matches(
|
167
|
-
/**HTMLElement*/
|
168
|
-
el,
|
169
|
-
/**String*/
|
170
|
-
selector) {
|
138
|
+
function matches( /**HTMLElement*/el, /**String*/selector) {
|
171
139
|
if (!selector) return;
|
172
140
|
selector[0] === '>' && (selector = selector.substring(1));
|
173
|
-
|
174
141
|
if (el) {
|
175
142
|
try {
|
176
143
|
if (el.matches) {
|
@@ -184,39 +151,25 @@ selector) {
|
|
184
151
|
return false;
|
185
152
|
}
|
186
153
|
}
|
187
|
-
|
188
154
|
return false;
|
189
155
|
}
|
190
|
-
|
191
156
|
function getParentOrHost(el) {
|
192
157
|
return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode;
|
193
158
|
}
|
194
|
-
|
195
|
-
function closest(
|
196
|
-
/**HTMLElement*/
|
197
|
-
el,
|
198
|
-
/**String*/
|
199
|
-
selector,
|
200
|
-
/**HTMLElement*/
|
201
|
-
ctx, includeCTX) {
|
159
|
+
function closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx, includeCTX) {
|
202
160
|
if (el) {
|
203
161
|
ctx = ctx || document;
|
204
|
-
|
205
162
|
do {
|
206
163
|
if (selector != null && (selector[0] === '>' ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) {
|
207
164
|
return el;
|
208
165
|
}
|
209
|
-
|
210
166
|
if (el === ctx) break;
|
211
167
|
/* jshint boss:true */
|
212
168
|
} while (el = getParentOrHost(el));
|
213
169
|
}
|
214
|
-
|
215
170
|
return null;
|
216
171
|
}
|
217
|
-
|
218
172
|
var R_SPACE = /\s+/g;
|
219
|
-
|
220
173
|
function toggleClass(el, name, state) {
|
221
174
|
if (el && name) {
|
222
175
|
if (el.classList) {
|
@@ -227,10 +180,8 @@ function toggleClass(el, name, state) {
|
|
227
180
|
}
|
228
181
|
}
|
229
182
|
}
|
230
|
-
|
231
183
|
function css(el, prop, val) {
|
232
184
|
var style = el && el.style;
|
233
|
-
|
234
185
|
if (style) {
|
235
186
|
if (val === void 0) {
|
236
187
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
@@ -238,83 +189,67 @@ function css(el, prop, val) {
|
|
238
189
|
} else if (el.currentStyle) {
|
239
190
|
val = el.currentStyle;
|
240
191
|
}
|
241
|
-
|
242
192
|
return prop === void 0 ? val : val[prop];
|
243
193
|
} else {
|
244
194
|
if (!(prop in style) && prop.indexOf('webkit') === -1) {
|
245
195
|
prop = '-webkit-' + prop;
|
246
196
|
}
|
247
|
-
|
248
197
|
style[prop] = val + (typeof val === 'string' ? '' : 'px');
|
249
198
|
}
|
250
199
|
}
|
251
200
|
}
|
252
|
-
|
253
201
|
function matrix(el, selfOnly) {
|
254
202
|
var appliedTransforms = '';
|
255
|
-
|
256
203
|
if (typeof el === 'string') {
|
257
204
|
appliedTransforms = el;
|
258
205
|
} else {
|
259
206
|
do {
|
260
207
|
var transform = css(el, 'transform');
|
261
|
-
|
262
208
|
if (transform && transform !== 'none') {
|
263
209
|
appliedTransforms = transform + ' ' + appliedTransforms;
|
264
210
|
}
|
265
211
|
/* jshint boss:true */
|
266
|
-
|
267
212
|
} while (!selfOnly && (el = el.parentNode));
|
268
213
|
}
|
269
|
-
|
270
214
|
var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix;
|
271
215
|
/*jshint -W056 */
|
272
|
-
|
273
216
|
return matrixFn && new matrixFn(appliedTransforms);
|
274
217
|
}
|
275
|
-
|
276
218
|
function find(ctx, tagName, iterator) {
|
277
219
|
if (ctx) {
|
278
220
|
var list = ctx.getElementsByTagName(tagName),
|
279
|
-
|
280
|
-
|
281
|
-
|
221
|
+
i = 0,
|
222
|
+
n = list.length;
|
282
223
|
if (iterator) {
|
283
224
|
for (; i < n; i++) {
|
284
225
|
iterator(list[i], i);
|
285
226
|
}
|
286
227
|
}
|
287
|
-
|
288
228
|
return list;
|
289
229
|
}
|
290
|
-
|
291
230
|
return [];
|
292
231
|
}
|
293
|
-
|
294
232
|
function getWindowScrollingElement() {
|
295
233
|
var scrollingElement = document.scrollingElement;
|
296
|
-
|
297
234
|
if (scrollingElement) {
|
298
235
|
return scrollingElement;
|
299
236
|
} else {
|
300
237
|
return document.documentElement;
|
301
238
|
}
|
302
239
|
}
|
303
|
-
/**
|
304
|
-
* Returns the "bounding client rect" of given element
|
305
|
-
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
306
|
-
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
307
|
-
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
308
|
-
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
309
|
-
* @param {[HTMLElement]} container The parent the element will be placed in
|
310
|
-
* @return {Object} The boundingClientRect of el, with specified adjustments
|
311
|
-
*/
|
312
|
-
|
313
240
|
|
241
|
+
/**
|
242
|
+
* Returns the "bounding client rect" of given element
|
243
|
+
* @param {HTMLElement} el The element whose boundingClientRect is wanted
|
244
|
+
* @param {[Boolean]} relativeToContainingBlock Whether the rect should be relative to the containing block of (including) the container
|
245
|
+
* @param {[Boolean]} relativeToNonStaticParent Whether the rect should be relative to the relative parent of (including) the contaienr
|
246
|
+
* @param {[Boolean]} undoScale Whether the container's scale() should be undone
|
247
|
+
* @param {[HTMLElement]} container The parent the element will be placed in
|
248
|
+
* @return {Object} The boundingClientRect of el, with specified adjustments
|
249
|
+
*/
|
314
250
|
function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) {
|
315
251
|
if (!el.getBoundingClientRect && el !== window) return;
|
316
252
|
var elRect, top, left, bottom, right, height, width;
|
317
|
-
|
318
253
|
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
|
319
254
|
elRect = el.getBoundingClientRect();
|
320
255
|
top = elRect.top;
|
@@ -331,17 +266,18 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
|
|
331
266
|
height = window.innerHeight;
|
332
267
|
width = window.innerWidth;
|
333
268
|
}
|
334
|
-
|
335
269
|
if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) {
|
336
270
|
// Adjust for translate()
|
337
|
-
container = container || el.parentNode;
|
338
|
-
// Not needed on <= IE11
|
271
|
+
container = container || el.parentNode;
|
339
272
|
|
273
|
+
// solves #1123 (see: https://stackoverflow.com/a/37953806/6088312)
|
274
|
+
// Not needed on <= IE11
|
340
275
|
if (!IE11OrLess) {
|
341
276
|
do {
|
342
277
|
if (container && container.getBoundingClientRect && (css(container, 'transform') !== 'none' || relativeToNonStaticParent && css(container, 'position') !== 'static')) {
|
343
|
-
var containerRect = container.getBoundingClientRect();
|
278
|
+
var containerRect = container.getBoundingClientRect();
|
344
279
|
|
280
|
+
// Set relative to edges of padding box of container
|
345
281
|
top -= containerRect.top + parseInt(css(container, 'border-top-width'));
|
346
282
|
left -= containerRect.left + parseInt(css(container, 'border-left-width'));
|
347
283
|
bottom = top + elRect.height;
|
@@ -349,17 +285,14 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
|
|
349
285
|
break;
|
350
286
|
}
|
351
287
|
/* jshint boss:true */
|
352
|
-
|
353
288
|
} while (container = container.parentNode);
|
354
289
|
}
|
355
290
|
}
|
356
|
-
|
357
291
|
if (undoScale && el !== window) {
|
358
292
|
// Adjust for scale()
|
359
293
|
var elMatrix = matrix(container || el),
|
360
|
-
|
361
|
-
|
362
|
-
|
294
|
+
scaleX = elMatrix && elMatrix.a,
|
295
|
+
scaleY = elMatrix && elMatrix.d;
|
363
296
|
if (elMatrix) {
|
364
297
|
top /= scaleY;
|
365
298
|
left /= scaleX;
|
@@ -369,7 +302,6 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
|
|
369
302
|
right = left + width;
|
370
303
|
}
|
371
304
|
}
|
372
|
-
|
373
305
|
return {
|
374
306
|
top: top,
|
375
307
|
left: left,
|
@@ -379,165 +311,140 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
|
|
379
311
|
height: height
|
380
312
|
};
|
381
313
|
}
|
382
|
-
/**
|
383
|
-
* Checks if a side of an element is scrolled past a side of its parents
|
384
|
-
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
385
|
-
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
386
|
-
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
387
|
-
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
388
|
-
*/
|
389
|
-
|
390
314
|
|
315
|
+
/**
|
316
|
+
* Checks if a side of an element is scrolled past a side of its parents
|
317
|
+
* @param {HTMLElement} el The element who's side being scrolled out of view is in question
|
318
|
+
* @param {String} elSide Side of the element in question ('top', 'left', 'right', 'bottom')
|
319
|
+
* @param {String} parentSide Side of the parent in question ('top', 'left', 'right', 'bottom')
|
320
|
+
* @return {HTMLElement} The parent scroll element that the el's side is scrolled past, or null if there is no such element
|
321
|
+
*/
|
391
322
|
function isScrolledPast(el, elSide, parentSide) {
|
392
323
|
var parent = getParentAutoScrollElement(el, true),
|
393
|
-
|
394
|
-
/* jshint boss:true */
|
324
|
+
elSideVal = getRect(el)[elSide];
|
395
325
|
|
326
|
+
/* jshint boss:true */
|
396
327
|
while (parent) {
|
397
328
|
var parentSideVal = getRect(parent)[parentSide],
|
398
|
-
|
399
|
-
|
329
|
+
visible = void 0;
|
400
330
|
if (parentSide === 'top' || parentSide === 'left') {
|
401
331
|
visible = elSideVal >= parentSideVal;
|
402
332
|
} else {
|
403
333
|
visible = elSideVal <= parentSideVal;
|
404
334
|
}
|
405
|
-
|
406
335
|
if (!visible) return parent;
|
407
336
|
if (parent === getWindowScrollingElement()) break;
|
408
337
|
parent = getParentAutoScrollElement(parent, false);
|
409
338
|
}
|
410
|
-
|
411
339
|
return false;
|
412
340
|
}
|
413
|
-
/**
|
414
|
-
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
415
|
-
* and non-draggable elements
|
416
|
-
* @param {HTMLElement} el The parent element
|
417
|
-
* @param {Number} childNum The index of the child
|
418
|
-
* @param {Object} options Parent Sortable's options
|
419
|
-
* @return {HTMLElement} The child at index childNum, or null if not found
|
420
|
-
*/
|
421
|
-
|
422
341
|
|
342
|
+
/**
|
343
|
+
* Gets nth child of el, ignoring hidden children, sortable's elements (does not ignore clone if it's visible)
|
344
|
+
* and non-draggable elements
|
345
|
+
* @param {HTMLElement} el The parent element
|
346
|
+
* @param {Number} childNum The index of the child
|
347
|
+
* @param {Object} options Parent Sortable's options
|
348
|
+
* @return {HTMLElement} The child at index childNum, or null if not found
|
349
|
+
*/
|
423
350
|
function getChild(el, childNum, options, includeDragEl) {
|
424
351
|
var currentChild = 0,
|
425
|
-
|
426
|
-
|
427
|
-
|
352
|
+
i = 0,
|
353
|
+
children = el.children;
|
428
354
|
while (i < children.length) {
|
429
355
|
if (children[i].style.display !== 'none' && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) {
|
430
356
|
if (currentChild === childNum) {
|
431
357
|
return children[i];
|
432
358
|
}
|
433
|
-
|
434
359
|
currentChild++;
|
435
360
|
}
|
436
|
-
|
437
361
|
i++;
|
438
362
|
}
|
439
|
-
|
440
363
|
return null;
|
441
364
|
}
|
442
|
-
/**
|
443
|
-
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
444
|
-
* @param {HTMLElement} el Parent element
|
445
|
-
* @param {selector} selector Any other elements that should be ignored
|
446
|
-
* @return {HTMLElement} The last child, ignoring ghostEl
|
447
|
-
*/
|
448
|
-
|
449
365
|
|
366
|
+
/**
|
367
|
+
* Gets the last child in the el, ignoring ghostEl or invisible elements (clones)
|
368
|
+
* @param {HTMLElement} el Parent element
|
369
|
+
* @param {selector} selector Any other elements that should be ignored
|
370
|
+
* @return {HTMLElement} The last child, ignoring ghostEl
|
371
|
+
*/
|
450
372
|
function lastChild(el, selector) {
|
451
373
|
var last = el.lastElementChild;
|
452
|
-
|
453
374
|
while (last && (last === Sortable.ghost || css(last, 'display') === 'none' || selector && !matches(last, selector))) {
|
454
375
|
last = last.previousElementSibling;
|
455
376
|
}
|
456
|
-
|
457
377
|
return last || null;
|
458
378
|
}
|
459
|
-
/**
|
460
|
-
* Returns the index of an element within its parent for a selected set of
|
461
|
-
* elements
|
462
|
-
* @param {HTMLElement} el
|
463
|
-
* @param {selector} selector
|
464
|
-
* @return {number}
|
465
|
-
*/
|
466
|
-
|
467
379
|
|
380
|
+
/**
|
381
|
+
* Returns the index of an element within its parent for a selected set of
|
382
|
+
* elements
|
383
|
+
* @param {HTMLElement} el
|
384
|
+
* @param {selector} selector
|
385
|
+
* @return {number}
|
386
|
+
*/
|
468
387
|
function index(el, selector) {
|
469
388
|
var index = 0;
|
470
|
-
|
471
389
|
if (!el || !el.parentNode) {
|
472
390
|
return -1;
|
473
391
|
}
|
474
|
-
/* jshint boss:true */
|
475
|
-
|
476
392
|
|
393
|
+
/* jshint boss:true */
|
477
394
|
while (el = el.previousElementSibling) {
|
478
395
|
if (el.nodeName.toUpperCase() !== 'TEMPLATE' && el !== Sortable.clone && (!selector || matches(el, selector))) {
|
479
396
|
index++;
|
480
397
|
}
|
481
398
|
}
|
482
|
-
|
483
399
|
return index;
|
484
400
|
}
|
485
|
-
/**
|
486
|
-
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
487
|
-
* The value is returned in real pixels.
|
488
|
-
* @param {HTMLElement} el
|
489
|
-
* @return {Array} Offsets in the format of [left, top]
|
490
|
-
*/
|
491
|
-
|
492
401
|
|
402
|
+
/**
|
403
|
+
* Returns the scroll offset of the given element, added with all the scroll offsets of parent elements.
|
404
|
+
* The value is returned in real pixels.
|
405
|
+
* @param {HTMLElement} el
|
406
|
+
* @return {Array} Offsets in the format of [left, top]
|
407
|
+
*/
|
493
408
|
function getRelativeScrollOffset(el) {
|
494
409
|
var offsetLeft = 0,
|
495
|
-
|
496
|
-
|
497
|
-
|
410
|
+
offsetTop = 0,
|
411
|
+
winScroller = getWindowScrollingElement();
|
498
412
|
if (el) {
|
499
413
|
do {
|
500
414
|
var elMatrix = matrix(el),
|
501
|
-
|
502
|
-
|
415
|
+
scaleX = elMatrix.a,
|
416
|
+
scaleY = elMatrix.d;
|
503
417
|
offsetLeft += el.scrollLeft * scaleX;
|
504
418
|
offsetTop += el.scrollTop * scaleY;
|
505
419
|
} while (el !== winScroller && (el = el.parentNode));
|
506
420
|
}
|
507
|
-
|
508
421
|
return [offsetLeft, offsetTop];
|
509
422
|
}
|
510
|
-
/**
|
511
|
-
* Returns the index of the object within the given array
|
512
|
-
* @param {Array} arr Array that may or may not hold the object
|
513
|
-
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
514
|
-
* @return {Number} The index of the object in the array, or -1
|
515
|
-
*/
|
516
|
-
|
517
423
|
|
424
|
+
/**
|
425
|
+
* Returns the index of the object within the given array
|
426
|
+
* @param {Array} arr Array that may or may not hold the object
|
427
|
+
* @param {Object} obj An object that has a key-value pair unique to and identical to a key-value pair in the object you want to find
|
428
|
+
* @return {Number} The index of the object in the array, or -1
|
429
|
+
*/
|
518
430
|
function indexOfObject(arr, obj) {
|
519
431
|
for (var i in arr) {
|
520
432
|
if (!arr.hasOwnProperty(i)) continue;
|
521
|
-
|
522
433
|
for (var key in obj) {
|
523
434
|
if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) return Number(i);
|
524
435
|
}
|
525
436
|
}
|
526
|
-
|
527
437
|
return -1;
|
528
438
|
}
|
529
|
-
|
530
439
|
function getParentAutoScrollElement(el, includeSelf) {
|
531
440
|
// skip to window
|
532
441
|
if (!el || !el.getBoundingClientRect) return getWindowScrollingElement();
|
533
442
|
var elem = el;
|
534
443
|
var gotSelf = false;
|
535
|
-
|
536
444
|
do {
|
537
445
|
// we don't need to get elem css if it isn't even overflowing in the first place (performance)
|
538
446
|
if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) {
|
539
447
|
var elemCSS = css(elem);
|
540
|
-
|
541
448
|
if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == 'auto' || elemCSS.overflowX == 'scroll') || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == 'auto' || elemCSS.overflowY == 'scroll')) {
|
542
449
|
if (!elem.getBoundingClientRect || elem === document.body) return getWindowScrollingElement();
|
543
450
|
if (gotSelf || includeSelf) return elem;
|
@@ -545,12 +452,9 @@ function getParentAutoScrollElement(el, includeSelf) {
|
|
545
452
|
}
|
546
453
|
}
|
547
454
|
/* jshint boss:true */
|
548
|
-
|
549
455
|
} while (elem = elem.parentNode);
|
550
|
-
|
551
456
|
return getWindowScrollingElement();
|
552
457
|
}
|
553
|
-
|
554
458
|
function extend(dst, src) {
|
555
459
|
if (dst && src) {
|
556
460
|
for (var key in src) {
|
@@ -559,49 +463,39 @@ function extend(dst, src) {
|
|
559
463
|
}
|
560
464
|
}
|
561
465
|
}
|
562
|
-
|
563
466
|
return dst;
|
564
467
|
}
|
565
|
-
|
566
468
|
function isRectEqual(rect1, rect2) {
|
567
469
|
return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width);
|
568
470
|
}
|
569
|
-
|
570
471
|
var _throttleTimeout;
|
571
|
-
|
572
472
|
function throttle(callback, ms) {
|
573
473
|
return function () {
|
574
474
|
if (!_throttleTimeout) {
|
575
475
|
var args = arguments,
|
576
|
-
|
577
|
-
|
476
|
+
_this = this;
|
578
477
|
if (args.length === 1) {
|
579
478
|
callback.call(_this, args[0]);
|
580
479
|
} else {
|
581
480
|
callback.apply(_this, args);
|
582
481
|
}
|
583
|
-
|
584
482
|
_throttleTimeout = setTimeout(function () {
|
585
483
|
_throttleTimeout = void 0;
|
586
484
|
}, ms);
|
587
485
|
}
|
588
486
|
};
|
589
487
|
}
|
590
|
-
|
591
488
|
function cancelThrottle() {
|
592
489
|
clearTimeout(_throttleTimeout);
|
593
490
|
_throttleTimeout = void 0;
|
594
491
|
}
|
595
|
-
|
596
492
|
function scrollBy(el, x, y) {
|
597
493
|
el.scrollLeft += x;
|
598
494
|
el.scrollTop += y;
|
599
495
|
}
|
600
|
-
|
601
496
|
function clone(el) {
|
602
497
|
var Polymer = window.Polymer;
|
603
498
|
var $ = window.jQuery || window.Zepto;
|
604
|
-
|
605
499
|
if (Polymer && Polymer.dom) {
|
606
500
|
return Polymer.dom(el).cloneNode(true);
|
607
501
|
} else if ($) {
|
@@ -610,12 +504,28 @@ function clone(el) {
|
|
610
504
|
return el.cloneNode(true);
|
611
505
|
}
|
612
506
|
}
|
613
|
-
|
507
|
+
function getChildContainingRectFromElement(container, options, ghostEl) {
|
508
|
+
var rect = {};
|
509
|
+
Array.from(container.children).forEach(function (child) {
|
510
|
+
var _rect$left, _rect$top, _rect$right, _rect$bottom;
|
511
|
+
if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl) return;
|
512
|
+
var childRect = getRect(child);
|
513
|
+
rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left);
|
514
|
+
rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top);
|
515
|
+
rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right);
|
516
|
+
rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom);
|
517
|
+
});
|
518
|
+
rect.width = rect.right - rect.left;
|
519
|
+
rect.height = rect.bottom - rect.top;
|
520
|
+
rect.x = rect.left;
|
521
|
+
rect.y = rect.top;
|
522
|
+
return rect;
|
523
|
+
}
|
614
524
|
var expando = 'Sortable' + new Date().getTime();
|
615
525
|
|
616
526
|
function AnimationStateManager() {
|
617
527
|
var animationStates = [],
|
618
|
-
|
528
|
+
animationCallbackId;
|
619
529
|
return {
|
620
530
|
captureAnimationState: function captureAnimationState() {
|
621
531
|
animationStates = [];
|
@@ -627,19 +537,16 @@ function AnimationStateManager() {
|
|
627
537
|
target: child,
|
628
538
|
rect: getRect(child)
|
629
539
|
});
|
540
|
+
var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect);
|
630
541
|
|
631
|
-
|
632
|
-
|
633
|
-
|
542
|
+
// If animating: compensate for current animation
|
634
543
|
if (child.thisAnimationDuration) {
|
635
544
|
var childMatrix = matrix(child, true);
|
636
|
-
|
637
545
|
if (childMatrix) {
|
638
546
|
fromRect.top -= childMatrix.f;
|
639
547
|
fromRect.left -= childMatrix.e;
|
640
548
|
}
|
641
549
|
}
|
642
|
-
|
643
550
|
child.fromRect = fromRect;
|
644
551
|
});
|
645
552
|
},
|
@@ -653,54 +560,47 @@ function AnimationStateManager() {
|
|
653
560
|
},
|
654
561
|
animateAll: function animateAll(callback) {
|
655
562
|
var _this = this;
|
656
|
-
|
657
563
|
if (!this.options.animation) {
|
658
564
|
clearTimeout(animationCallbackId);
|
659
565
|
if (typeof callback === 'function') callback();
|
660
566
|
return;
|
661
567
|
}
|
662
|
-
|
663
568
|
var animating = false,
|
664
|
-
|
569
|
+
animationTime = 0;
|
665
570
|
animationStates.forEach(function (state) {
|
666
571
|
var time = 0,
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
572
|
+
target = state.target,
|
573
|
+
fromRect = target.fromRect,
|
574
|
+
toRect = getRect(target),
|
575
|
+
prevFromRect = target.prevFromRect,
|
576
|
+
prevToRect = target.prevToRect,
|
577
|
+
animatingRect = state.rect,
|
578
|
+
targetMatrix = matrix(target, true);
|
675
579
|
if (targetMatrix) {
|
676
580
|
// Compensate for current animation
|
677
581
|
toRect.top -= targetMatrix.f;
|
678
582
|
toRect.left -= targetMatrix.e;
|
679
583
|
}
|
680
|
-
|
681
584
|
target.toRect = toRect;
|
682
|
-
|
683
585
|
if (target.thisAnimationDuration) {
|
684
586
|
// Could also check if animatingRect is between fromRect and toRect
|
685
|
-
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
587
|
+
if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) &&
|
588
|
+
// Make sure animatingRect is on line between toRect & fromRect
|
686
589
|
(animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) {
|
687
590
|
// If returning to same place as started from animation and on same axis
|
688
591
|
time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options);
|
689
592
|
}
|
690
|
-
}
|
691
|
-
|
593
|
+
}
|
692
594
|
|
595
|
+
// if fromRect != toRect: animate
|
693
596
|
if (!isRectEqual(toRect, fromRect)) {
|
694
597
|
target.prevFromRect = fromRect;
|
695
598
|
target.prevToRect = toRect;
|
696
|
-
|
697
599
|
if (!time) {
|
698
600
|
time = _this.options.animation;
|
699
601
|
}
|
700
|
-
|
701
602
|
_this.animate(target, animatingRect, toRect, time);
|
702
603
|
}
|
703
|
-
|
704
604
|
if (time) {
|
705
605
|
animating = true;
|
706
606
|
animationTime = Math.max(animationTime, time);
|
@@ -716,7 +616,6 @@ function AnimationStateManager() {
|
|
716
616
|
}
|
717
617
|
});
|
718
618
|
clearTimeout(animationCallbackId);
|
719
|
-
|
720
619
|
if (!animating) {
|
721
620
|
if (typeof callback === 'function') callback();
|
722
621
|
} else {
|
@@ -724,7 +623,6 @@ function AnimationStateManager() {
|
|
724
623
|
if (typeof callback === 'function') callback();
|
725
624
|
}, animationTime);
|
726
625
|
}
|
727
|
-
|
728
626
|
animationStates = [];
|
729
627
|
},
|
730
628
|
animate: function animate(target, currentRect, toRect, duration) {
|
@@ -732,10 +630,10 @@ function AnimationStateManager() {
|
|
732
630
|
css(target, 'transition', '');
|
733
631
|
css(target, 'transform', '');
|
734
632
|
var elMatrix = matrix(this.el),
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
633
|
+
scaleX = elMatrix && elMatrix.a,
|
634
|
+
scaleY = elMatrix && elMatrix.d,
|
635
|
+
translateX = (currentRect.left - toRect.left) / (scaleX || 1),
|
636
|
+
translateY = (currentRect.top - toRect.top) / (scaleY || 1);
|
739
637
|
target.animatingX = !!translateX;
|
740
638
|
target.animatingY = !!translateY;
|
741
639
|
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
|
@@ -755,11 +653,9 @@ function AnimationStateManager() {
|
|
755
653
|
}
|
756
654
|
};
|
757
655
|
}
|
758
|
-
|
759
656
|
function repaint(target) {
|
760
657
|
return target.offsetWidth;
|
761
658
|
}
|
762
|
-
|
763
659
|
function calculateRealTime(animatingRect, fromRect, toRect, options) {
|
764
660
|
return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation;
|
765
661
|
}
|
@@ -776,7 +672,6 @@ var PluginManager = {
|
|
776
672
|
plugin[option] = defaults[option];
|
777
673
|
}
|
778
674
|
}
|
779
|
-
|
780
675
|
plugins.forEach(function (p) {
|
781
676
|
if (p.pluginName === plugin.pluginName) {
|
782
677
|
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
|
@@ -786,25 +681,22 @@ var PluginManager = {
|
|
786
681
|
},
|
787
682
|
pluginEvent: function pluginEvent(eventName, sortable, evt) {
|
788
683
|
var _this = this;
|
789
|
-
|
790
684
|
this.eventCanceled = false;
|
791
|
-
|
792
685
|
evt.cancel = function () {
|
793
686
|
_this.eventCanceled = true;
|
794
687
|
};
|
795
|
-
|
796
688
|
var eventNameGlobal = eventName + 'Global';
|
797
689
|
plugins.forEach(function (plugin) {
|
798
|
-
if (!sortable[plugin.pluginName]) return;
|
799
|
-
|
690
|
+
if (!sortable[plugin.pluginName]) return;
|
691
|
+
// Fire global events if it exists in this sortable
|
800
692
|
if (sortable[plugin.pluginName][eventNameGlobal]) {
|
801
693
|
sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({
|
802
694
|
sortable: sortable
|
803
695
|
}, evt));
|
804
|
-
}
|
805
|
-
// and plugin has event defined
|
806
|
-
|
696
|
+
}
|
807
697
|
|
698
|
+
// Only fire plugin event if plugin is enabled in this sortable,
|
699
|
+
// and plugin has event defined
|
808
700
|
if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) {
|
809
701
|
sortable[plugin.pluginName][eventName](_objectSpread2({
|
810
702
|
sortable: sortable
|
@@ -819,15 +711,14 @@ var PluginManager = {
|
|
819
711
|
var initialized = new plugin(sortable, el, sortable.options);
|
820
712
|
initialized.sortable = sortable;
|
821
713
|
initialized.options = sortable.options;
|
822
|
-
sortable[pluginName] = initialized;
|
714
|
+
sortable[pluginName] = initialized;
|
823
715
|
|
716
|
+
// Add default options from plugin
|
824
717
|
_extends(defaults, initialized.defaults);
|
825
718
|
});
|
826
|
-
|
827
719
|
for (var option in sortable.options) {
|
828
720
|
if (!sortable.options.hasOwnProperty(option)) continue;
|
829
721
|
var modified = this.modifyOption(sortable, option, sortable.options[option]);
|
830
|
-
|
831
722
|
if (typeof modified !== 'undefined') {
|
832
723
|
sortable.options[option] = modified;
|
833
724
|
}
|
@@ -837,7 +728,6 @@ var PluginManager = {
|
|
837
728
|
var eventProperties = {};
|
838
729
|
plugins.forEach(function (plugin) {
|
839
730
|
if (typeof plugin.eventProperties !== 'function') return;
|
840
|
-
|
841
731
|
_extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name));
|
842
732
|
});
|
843
733
|
return eventProperties;
|
@@ -846,8 +736,9 @@ var PluginManager = {
|
|
846
736
|
var modifiedValue;
|
847
737
|
plugins.forEach(function (plugin) {
|
848
738
|
// Plugin must exist on the Sortable
|
849
|
-
if (!sortable[plugin.pluginName]) return;
|
739
|
+
if (!sortable[plugin.pluginName]) return;
|
850
740
|
|
741
|
+
// If static option listener exists for this option, call in the context of the Sortable's instance of this plugin
|
851
742
|
if (plugin.optionListeners && typeof plugin.optionListeners[name] === 'function') {
|
852
743
|
modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value);
|
853
744
|
}
|
@@ -858,25 +749,25 @@ var PluginManager = {
|
|
858
749
|
|
859
750
|
function dispatchEvent(_ref) {
|
860
751
|
var sortable = _ref.sortable,
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
752
|
+
rootEl = _ref.rootEl,
|
753
|
+
name = _ref.name,
|
754
|
+
targetEl = _ref.targetEl,
|
755
|
+
cloneEl = _ref.cloneEl,
|
756
|
+
toEl = _ref.toEl,
|
757
|
+
fromEl = _ref.fromEl,
|
758
|
+
oldIndex = _ref.oldIndex,
|
759
|
+
newIndex = _ref.newIndex,
|
760
|
+
oldDraggableIndex = _ref.oldDraggableIndex,
|
761
|
+
newDraggableIndex = _ref.newDraggableIndex,
|
762
|
+
originalEvent = _ref.originalEvent,
|
763
|
+
putSortable = _ref.putSortable,
|
764
|
+
extraEventProperties = _ref.extraEventProperties;
|
874
765
|
sortable = sortable || rootEl && rootEl[expando];
|
875
766
|
if (!sortable) return;
|
876
767
|
var evt,
|
877
|
-
|
878
|
-
|
879
|
-
|
768
|
+
options = sortable.options,
|
769
|
+
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
|
770
|
+
// Support for new CustomEvent feature
|
880
771
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
881
772
|
evt = new CustomEvent(name, {
|
882
773
|
bubbles: true,
|
@@ -886,7 +777,6 @@ function dispatchEvent(_ref) {
|
|
886
777
|
evt = document.createEvent('Event');
|
887
778
|
evt.initEvent(name, true, true);
|
888
779
|
}
|
889
|
-
|
890
780
|
evt.to = toEl || rootEl;
|
891
781
|
evt.from = fromEl || rootEl;
|
892
782
|
evt.item = targetEl || rootEl;
|
@@ -897,29 +787,23 @@ function dispatchEvent(_ref) {
|
|
897
787
|
evt.newDraggableIndex = newDraggableIndex;
|
898
788
|
evt.originalEvent = originalEvent;
|
899
789
|
evt.pullMode = putSortable ? putSortable.lastPutMode : undefined;
|
900
|
-
|
901
790
|
var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable));
|
902
|
-
|
903
791
|
for (var option in allEventProperties) {
|
904
792
|
evt[option] = allEventProperties[option];
|
905
793
|
}
|
906
|
-
|
907
794
|
if (rootEl) {
|
908
795
|
rootEl.dispatchEvent(evt);
|
909
796
|
}
|
910
|
-
|
911
797
|
if (options[onName]) {
|
912
798
|
options[onName].call(sortable, evt);
|
913
799
|
}
|
914
800
|
}
|
915
801
|
|
916
802
|
var _excluded = ["evt"];
|
917
|
-
|
918
803
|
var pluginEvent = function pluginEvent(eventName, sortable) {
|
919
804
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
920
|
-
|
921
|
-
|
922
|
-
|
805
|
+
originalEvent = _ref.evt,
|
806
|
+
data = _objectWithoutProperties(_ref, _excluded);
|
923
807
|
PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({
|
924
808
|
dragEl: dragEl,
|
925
809
|
parentEl: parentEl,
|
@@ -954,7 +838,6 @@ var pluginEvent = function pluginEvent(eventName, sortable) {
|
|
954
838
|
}
|
955
839
|
}, data));
|
956
840
|
};
|
957
|
-
|
958
841
|
function _dispatchEvent(info) {
|
959
842
|
dispatchEvent(_objectSpread2({
|
960
843
|
putSortable: putSortable,
|
@@ -967,62 +850,61 @@ function _dispatchEvent(info) {
|
|
967
850
|
newDraggableIndex: newDraggableIndex
|
968
851
|
}, info));
|
969
852
|
}
|
970
|
-
|
971
853
|
var dragEl,
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
ghostRelativeParent,
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
854
|
+
parentEl,
|
855
|
+
ghostEl,
|
856
|
+
rootEl,
|
857
|
+
nextEl,
|
858
|
+
lastDownEl,
|
859
|
+
cloneEl,
|
860
|
+
cloneHidden,
|
861
|
+
oldIndex,
|
862
|
+
newIndex,
|
863
|
+
oldDraggableIndex,
|
864
|
+
newDraggableIndex,
|
865
|
+
activeGroup,
|
866
|
+
putSortable,
|
867
|
+
awaitingDragStarted = false,
|
868
|
+
ignoreNextClick = false,
|
869
|
+
sortables = [],
|
870
|
+
tapEvt,
|
871
|
+
touchEvt,
|
872
|
+
lastDx,
|
873
|
+
lastDy,
|
874
|
+
tapDistanceLeft,
|
875
|
+
tapDistanceTop,
|
876
|
+
moved,
|
877
|
+
lastTarget,
|
878
|
+
lastDirection,
|
879
|
+
pastFirstInvertThresh = false,
|
880
|
+
isCircumstantialInvert = false,
|
881
|
+
targetMoveDistance,
|
882
|
+
// For positioning ghost absolutely
|
883
|
+
ghostRelativeParent,
|
884
|
+
ghostRelativeParentInitialScroll = [],
|
885
|
+
// (left, top)
|
886
|
+
|
887
|
+
_silent = false,
|
888
|
+
savedInputChecked = [];
|
1007
889
|
|
890
|
+
/** @const */
|
1008
891
|
var documentExists = typeof document !== 'undefined',
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
var elCSS = css(el),
|
892
|
+
PositionGhostAbsolutely = IOS,
|
893
|
+
CSSFloatProperty = Edge || IE11OrLess ? 'cssFloat' : 'float',
|
894
|
+
// This will not pass for IE9, because IE9 DnD only works on anchors
|
895
|
+
supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in document.createElement('div'),
|
896
|
+
supportCssPointerEvents = function () {
|
897
|
+
if (!documentExists) return;
|
898
|
+
// false when <= IE11
|
899
|
+
if (IE11OrLess) {
|
900
|
+
return false;
|
901
|
+
}
|
902
|
+
var el = document.createElement('x');
|
903
|
+
el.style.cssText = 'pointer-events:auto';
|
904
|
+
return el.style.pointerEvents === 'auto';
|
905
|
+
}(),
|
906
|
+
_detectDirection = function _detectDirection(el, options) {
|
907
|
+
var elCSS = css(el),
|
1026
908
|
elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth),
|
1027
909
|
child1 = getChild(el, 0, options),
|
1028
910
|
child2 = getChild(el, 1, options),
|
@@ -1030,102 +912,92 @@ supportDraggable = documentExists && !ChromeForAndroid && !IOS && 'draggable' in
|
|
1030
912
|
secondChildCSS = child2 && css(child2),
|
1031
913
|
firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width,
|
1032
914
|
secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
1048
|
-
},
|
1049
|
-
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
1050
|
-
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
915
|
+
if (elCSS.display === 'flex') {
|
916
|
+
return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal';
|
917
|
+
}
|
918
|
+
if (elCSS.display === 'grid') {
|
919
|
+
return elCSS.gridTemplateColumns.split(' ').length <= 1 ? 'vertical' : 'horizontal';
|
920
|
+
}
|
921
|
+
if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== 'none') {
|
922
|
+
var touchingSideChild2 = firstChildCSS["float"] === 'left' ? 'left' : 'right';
|
923
|
+
return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? 'vertical' : 'horizontal';
|
924
|
+
}
|
925
|
+
return child1 && (firstChildCSS.display === 'block' || firstChildCSS.display === 'flex' || firstChildCSS.display === 'table' || firstChildCSS.display === 'grid' || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === 'none' || child2 && elCSS[CSSFloatProperty] === 'none' && firstChildWidth + secondChildWidth > elWidth) ? 'vertical' : 'horizontal';
|
926
|
+
},
|
927
|
+
_dragElInRowColumn = function _dragElInRowColumn(dragRect, targetRect, vertical) {
|
928
|
+
var dragElS1Opp = vertical ? dragRect.left : dragRect.top,
|
1051
929
|
dragElS2Opp = vertical ? dragRect.right : dragRect.bottom,
|
1052
930
|
dragElOppLength = vertical ? dragRect.width : dragRect.height,
|
1053
931
|
targetS1Opp = vertical ? targetRect.left : targetRect.top,
|
1054
932
|
targetS2Opp = vertical ? targetRect.right : targetRect.bottom,
|
1055
933
|
targetOppLength = vertical ? targetRect.width : targetRect.height;
|
1056
|
-
|
1057
|
-
},
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
var rect = getRect(sortable),
|
934
|
+
return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2;
|
935
|
+
},
|
936
|
+
/**
|
937
|
+
* Detects first nearest empty sortable to X and Y position using emptyInsertThreshold.
|
938
|
+
* @param {Number} x X position
|
939
|
+
* @param {Number} y Y position
|
940
|
+
* @return {HTMLElement} Element of the first found nearest Sortable
|
941
|
+
*/
|
942
|
+
_detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
|
943
|
+
var ret;
|
944
|
+
sortables.some(function (sortable) {
|
945
|
+
var threshold = sortable[expando].options.emptyInsertThreshold;
|
946
|
+
if (!threshold || lastChild(sortable)) return;
|
947
|
+
var rect = getRect(sortable),
|
1071
948
|
insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold,
|
1072
949
|
insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold;
|
1073
|
-
|
1074
|
-
|
1075
|
-
return ret = sortable;
|
1076
|
-
}
|
1077
|
-
});
|
1078
|
-
return ret;
|
1079
|
-
},
|
1080
|
-
_prepareGroup = function _prepareGroup(options) {
|
1081
|
-
function toFn(value, pull) {
|
1082
|
-
return function (to, from, dragEl, evt) {
|
1083
|
-
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
1084
|
-
|
1085
|
-
if (value == null && (pull || sameGroup)) {
|
1086
|
-
// Default pull value
|
1087
|
-
// Default pull and put value if same group
|
1088
|
-
return true;
|
1089
|
-
} else if (value == null || value === false) {
|
1090
|
-
return false;
|
1091
|
-
} else if (pull && value === 'clone') {
|
1092
|
-
return value;
|
1093
|
-
} else if (typeof value === 'function') {
|
1094
|
-
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
1095
|
-
} else {
|
1096
|
-
var otherGroup = (pull ? to : from).options.group.name;
|
1097
|
-
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
950
|
+
if (insideHorizontally && insideVertically) {
|
951
|
+
return ret = sortable;
|
1098
952
|
}
|
1099
|
-
};
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
}
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
}
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
953
|
+
});
|
954
|
+
return ret;
|
955
|
+
},
|
956
|
+
_prepareGroup = function _prepareGroup(options) {
|
957
|
+
function toFn(value, pull) {
|
958
|
+
return function (to, from, dragEl, evt) {
|
959
|
+
var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name;
|
960
|
+
if (value == null && (pull || sameGroup)) {
|
961
|
+
// Default pull value
|
962
|
+
// Default pull and put value if same group
|
963
|
+
return true;
|
964
|
+
} else if (value == null || value === false) {
|
965
|
+
return false;
|
966
|
+
} else if (pull && value === 'clone') {
|
967
|
+
return value;
|
968
|
+
} else if (typeof value === 'function') {
|
969
|
+
return toFn(value(to, from, dragEl, evt), pull)(to, from, dragEl, evt);
|
970
|
+
} else {
|
971
|
+
var otherGroup = (pull ? to : from).options.group.name;
|
972
|
+
return value === true || typeof value === 'string' && value === otherGroup || value.join && value.indexOf(otherGroup) > -1;
|
973
|
+
}
|
974
|
+
};
|
975
|
+
}
|
976
|
+
var group = {};
|
977
|
+
var originalGroup = options.group;
|
978
|
+
if (!originalGroup || _typeof(originalGroup) != 'object') {
|
979
|
+
originalGroup = {
|
980
|
+
name: originalGroup
|
981
|
+
};
|
982
|
+
}
|
983
|
+
group.name = originalGroup.name;
|
984
|
+
group.checkPull = toFn(originalGroup.pull, true);
|
985
|
+
group.checkPut = toFn(originalGroup.put);
|
986
|
+
group.revertClone = originalGroup.revertClone;
|
987
|
+
options.group = group;
|
988
|
+
},
|
989
|
+
_hideGhostForTarget = function _hideGhostForTarget() {
|
990
|
+
if (!supportCssPointerEvents && ghostEl) {
|
991
|
+
css(ghostEl, 'display', 'none');
|
992
|
+
}
|
993
|
+
},
|
994
|
+
_unhideGhostForTarget = function _unhideGhostForTarget() {
|
995
|
+
if (!supportCssPointerEvents && ghostEl) {
|
996
|
+
css(ghostEl, 'display', '');
|
997
|
+
}
|
998
|
+
};
|
1128
999
|
|
1000
|
+
// #1184 fix - Prevent click event on fallback if dragged but item not changed position
|
1129
1001
|
if (documentExists && !ChromeForAndroid) {
|
1130
1002
|
document.addEventListener('click', function (evt) {
|
1131
1003
|
if (ignoreNextClick) {
|
@@ -1137,53 +1009,44 @@ if (documentExists && !ChromeForAndroid) {
|
|
1137
1009
|
}
|
1138
1010
|
}, true);
|
1139
1011
|
}
|
1140
|
-
|
1141
1012
|
var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent(evt) {
|
1142
1013
|
if (dragEl) {
|
1143
1014
|
evt = evt.touches ? evt.touches[0] : evt;
|
1144
|
-
|
1145
1015
|
var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY);
|
1146
|
-
|
1147
1016
|
if (nearest) {
|
1148
1017
|
// Create imitation event
|
1149
1018
|
var event = {};
|
1150
|
-
|
1151
1019
|
for (var i in evt) {
|
1152
1020
|
if (evt.hasOwnProperty(i)) {
|
1153
1021
|
event[i] = evt[i];
|
1154
1022
|
}
|
1155
1023
|
}
|
1156
|
-
|
1157
1024
|
event.target = event.rootEl = nearest;
|
1158
1025
|
event.preventDefault = void 0;
|
1159
1026
|
event.stopPropagation = void 0;
|
1160
|
-
|
1161
1027
|
nearest[expando]._onDragOver(event);
|
1162
1028
|
}
|
1163
1029
|
}
|
1164
1030
|
};
|
1165
|
-
|
1166
1031
|
var _checkOutsideTargetEl = function _checkOutsideTargetEl(evt) {
|
1167
1032
|
if (dragEl) {
|
1168
1033
|
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
1169
1034
|
}
|
1170
1035
|
};
|
1036
|
+
|
1171
1037
|
/**
|
1172
1038
|
* @class Sortable
|
1173
1039
|
* @param {HTMLElement} el
|
1174
1040
|
* @param {Object} [options]
|
1175
1041
|
*/
|
1176
|
-
|
1177
|
-
|
1178
1042
|
function Sortable(el, options) {
|
1179
1043
|
if (!(el && el.nodeType && el.nodeType === 1)) {
|
1180
1044
|
throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
|
1181
1045
|
}
|
1182
|
-
|
1183
1046
|
this.el = el; // root element
|
1047
|
+
this.options = options = _extends({}, options);
|
1184
1048
|
|
1185
|
-
|
1186
|
-
|
1049
|
+
// Export instance
|
1187
1050
|
el[expando] = this;
|
1188
1051
|
var defaults = {
|
1189
1052
|
group: null,
|
@@ -1230,52 +1093,48 @@ function Sortable(el, options) {
|
|
1230
1093
|
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
|
1231
1094
|
emptyInsertThreshold: 5
|
1232
1095
|
};
|
1233
|
-
PluginManager.initializePlugins(this, el, defaults);
|
1096
|
+
PluginManager.initializePlugins(this, el, defaults);
|
1234
1097
|
|
1098
|
+
// Set default options
|
1235
1099
|
for (var name in defaults) {
|
1236
1100
|
!(name in options) && (options[name] = defaults[name]);
|
1237
1101
|
}
|
1102
|
+
_prepareGroup(options);
|
1238
1103
|
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1104
|
+
// Bind all private methods
|
1242
1105
|
for (var fn in this) {
|
1243
1106
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
1244
1107
|
this[fn] = this[fn].bind(this);
|
1245
1108
|
}
|
1246
|
-
}
|
1247
|
-
|
1109
|
+
}
|
1248
1110
|
|
1111
|
+
// Setup drag mode
|
1249
1112
|
this.nativeDraggable = options.forceFallback ? false : supportDraggable;
|
1250
|
-
|
1251
1113
|
if (this.nativeDraggable) {
|
1252
1114
|
// Touch start threshold cannot be greater than the native dragstart threshold
|
1253
1115
|
this.options.touchStartThreshold = 1;
|
1254
|
-
}
|
1255
|
-
|
1116
|
+
}
|
1256
1117
|
|
1118
|
+
// Bind events
|
1257
1119
|
if (options.supportPointer) {
|
1258
1120
|
on(el, 'pointerdown', this._onTapStart);
|
1259
1121
|
} else {
|
1260
1122
|
on(el, 'mousedown', this._onTapStart);
|
1261
1123
|
on(el, 'touchstart', this._onTapStart);
|
1262
1124
|
}
|
1263
|
-
|
1264
1125
|
if (this.nativeDraggable) {
|
1265
1126
|
on(el, 'dragover', this);
|
1266
1127
|
on(el, 'dragenter', this);
|
1267
1128
|
}
|
1129
|
+
sortables.push(this.el);
|
1268
1130
|
|
1269
|
-
|
1270
|
-
|
1271
|
-
options.store && options.store.get && this.sort(options.store.get(this) || []); // Add animation state manager
|
1131
|
+
// Restore sorting
|
1132
|
+
options.store && options.store.get && this.sort(options.store.get(this) || []);
|
1272
1133
|
|
1134
|
+
// Add animation state manager
|
1273
1135
|
_extends(this, AnimationStateManager());
|
1274
1136
|
}
|
1275
|
-
|
1276
|
-
Sortable.prototype =
|
1277
|
-
/** @lends Sortable.prototype */
|
1278
|
-
{
|
1137
|
+
Sortable.prototype = /** @lends Sortable.prototype */{
|
1279
1138
|
constructor: Sortable,
|
1280
1139
|
_isOutsideThisEl: function _isOutsideThisEl(target) {
|
1281
1140
|
if (!this.el.contains(target) && target !== this.el) {
|
@@ -1285,57 +1144,50 @@ Sortable.prototype =
|
|
1285
1144
|
_getDirection: function _getDirection(evt, target) {
|
1286
1145
|
return typeof this.options.direction === 'function' ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction;
|
1287
1146
|
},
|
1288
|
-
_onTapStart: function _onTapStart(
|
1289
|
-
/** Event|TouchEvent */
|
1290
|
-
evt) {
|
1147
|
+
_onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
|
1291
1148
|
if (!evt.cancelable) return;
|
1292
|
-
|
1293
1149
|
var _this = this,
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1150
|
+
el = this.el,
|
1151
|
+
options = this.options,
|
1152
|
+
preventOnFilter = options.preventOnFilter,
|
1153
|
+
type = evt.type,
|
1154
|
+
touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === 'touch' && evt,
|
1155
|
+
target = (touch || evt).target,
|
1156
|
+
originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target,
|
1157
|
+
filter = options.filter;
|
1158
|
+
_saveInputCheckedState(el);
|
1159
|
+
|
1160
|
+
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
|
1306
1161
|
if (dragEl) {
|
1307
1162
|
return;
|
1308
1163
|
}
|
1309
|
-
|
1310
1164
|
if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
|
1311
1165
|
return; // only left button and enabled
|
1312
|
-
}
|
1313
|
-
|
1166
|
+
}
|
1314
1167
|
|
1168
|
+
// cancel dnd if original target is content editable
|
1315
1169
|
if (originalTarget.isContentEditable) {
|
1316
1170
|
return;
|
1317
|
-
}
|
1318
|
-
|
1171
|
+
}
|
1319
1172
|
|
1173
|
+
// Safari ignores further event handling after mousedown
|
1320
1174
|
if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
|
1321
1175
|
return;
|
1322
1176
|
}
|
1323
|
-
|
1324
1177
|
target = closest(target, options.draggable, el, false);
|
1325
|
-
|
1326
1178
|
if (target && target.animated) {
|
1327
1179
|
return;
|
1328
1180
|
}
|
1329
|
-
|
1330
1181
|
if (lastDownEl === target) {
|
1331
1182
|
// Ignoring duplicate `down`
|
1332
1183
|
return;
|
1333
|
-
}
|
1334
|
-
|
1184
|
+
}
|
1335
1185
|
|
1186
|
+
// Get the index of the dragged element within its parent
|
1336
1187
|
oldIndex = index(target);
|
1337
|
-
oldDraggableIndex = index(target, options.draggable);
|
1188
|
+
oldDraggableIndex = index(target, options.draggable);
|
1338
1189
|
|
1190
|
+
// Check filter
|
1339
1191
|
if (typeof filter === 'function') {
|
1340
1192
|
if (filter.call(this, evt, target, this)) {
|
1341
1193
|
_dispatchEvent({
|
@@ -1346,7 +1198,6 @@ Sortable.prototype =
|
|
1346
1198
|
toEl: el,
|
1347
1199
|
fromEl: el
|
1348
1200
|
});
|
1349
|
-
|
1350
1201
|
pluginEvent('filter', _this, {
|
1351
1202
|
evt: evt
|
1352
1203
|
});
|
@@ -1356,7 +1207,6 @@ Sortable.prototype =
|
|
1356
1207
|
} else if (filter) {
|
1357
1208
|
filter = filter.split(',').some(function (criteria) {
|
1358
1209
|
criteria = closest(originalTarget, criteria.trim(), el, false);
|
1359
|
-
|
1360
1210
|
if (criteria) {
|
1361
1211
|
_dispatchEvent({
|
1362
1212
|
sortable: _this,
|
@@ -1366,40 +1216,30 @@ Sortable.prototype =
|
|
1366
1216
|
fromEl: el,
|
1367
1217
|
toEl: el
|
1368
1218
|
});
|
1369
|
-
|
1370
1219
|
pluginEvent('filter', _this, {
|
1371
1220
|
evt: evt
|
1372
1221
|
});
|
1373
1222
|
return true;
|
1374
1223
|
}
|
1375
1224
|
});
|
1376
|
-
|
1377
1225
|
if (filter) {
|
1378
1226
|
preventOnFilter && evt.cancelable && evt.preventDefault();
|
1379
1227
|
return; // cancel dnd
|
1380
1228
|
}
|
1381
1229
|
}
|
1382
|
-
|
1383
1230
|
if (options.handle && !closest(originalTarget, options.handle, el, false)) {
|
1384
1231
|
return;
|
1385
|
-
}
|
1386
|
-
|
1232
|
+
}
|
1387
1233
|
|
1234
|
+
// Prepare `dragstart`
|
1388
1235
|
this._prepareDragStart(evt, touch, target);
|
1389
1236
|
},
|
1390
|
-
_prepareDragStart: function _prepareDragStart(
|
1391
|
-
/** Event */
|
1392
|
-
evt,
|
1393
|
-
/** Touch */
|
1394
|
-
touch,
|
1395
|
-
/** HTMLElement */
|
1396
|
-
target) {
|
1237
|
+
_prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target) {
|
1397
1238
|
var _this = this,
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1239
|
+
el = _this.el,
|
1240
|
+
options = _this.options,
|
1241
|
+
ownerDocument = el.ownerDocument,
|
1242
|
+
dragStartFn;
|
1403
1243
|
if (target && !dragEl && target.parentNode === el) {
|
1404
1244
|
var dragRect = getRect(target);
|
1405
1245
|
rootEl = el;
|
@@ -1419,41 +1259,36 @@ Sortable.prototype =
|
|
1419
1259
|
this._lastX = (touch || evt).clientX;
|
1420
1260
|
this._lastY = (touch || evt).clientY;
|
1421
1261
|
dragEl.style['will-change'] = 'all';
|
1422
|
-
|
1423
1262
|
dragStartFn = function dragStartFn() {
|
1424
1263
|
pluginEvent('delayEnded', _this, {
|
1425
1264
|
evt: evt
|
1426
1265
|
});
|
1427
|
-
|
1428
1266
|
if (Sortable.eventCanceled) {
|
1429
1267
|
_this._onDrop();
|
1430
|
-
|
1431
1268
|
return;
|
1432
|
-
}
|
1269
|
+
}
|
1270
|
+
// Delayed drag has been triggered
|
1433
1271
|
// we can re-enable the events: touchmove/mousemove
|
1434
|
-
|
1435
|
-
|
1436
1272
|
_this._disableDelayedDragEvents();
|
1437
|
-
|
1438
1273
|
if (!FireFox && _this.nativeDraggable) {
|
1439
1274
|
dragEl.draggable = true;
|
1440
|
-
}
|
1441
|
-
|
1442
|
-
|
1443
|
-
_this._triggerDragStart(evt, touch); // Drag start event
|
1275
|
+
}
|
1444
1276
|
|
1277
|
+
// Bind the events: dragstart/dragend
|
1278
|
+
_this._triggerDragStart(evt, touch);
|
1445
1279
|
|
1280
|
+
// Drag start event
|
1446
1281
|
_dispatchEvent({
|
1447
1282
|
sortable: _this,
|
1448
1283
|
name: 'choose',
|
1449
1284
|
originalEvent: evt
|
1450
|
-
});
|
1451
|
-
|
1285
|
+
});
|
1452
1286
|
|
1287
|
+
// Chosen item
|
1453
1288
|
toggleClass(dragEl, options.chosenClass, true);
|
1454
|
-
};
|
1455
|
-
|
1289
|
+
};
|
1456
1290
|
|
1291
|
+
// Disable "draggable"
|
1457
1292
|
options.ignore.split(',').forEach(function (criteria) {
|
1458
1293
|
find(dragEl, criteria.trim(), _disableDraggable);
|
1459
1294
|
});
|
@@ -1462,27 +1297,26 @@ Sortable.prototype =
|
|
1462
1297
|
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent);
|
1463
1298
|
on(ownerDocument, 'mouseup', _this._onDrop);
|
1464
1299
|
on(ownerDocument, 'touchend', _this._onDrop);
|
1465
|
-
on(ownerDocument, 'touchcancel', _this._onDrop);
|
1300
|
+
on(ownerDocument, 'touchcancel', _this._onDrop);
|
1466
1301
|
|
1302
|
+
// Make dragEl draggable (must be before delay for FireFox)
|
1467
1303
|
if (FireFox && this.nativeDraggable) {
|
1468
1304
|
this.options.touchStartThreshold = 4;
|
1469
1305
|
dragEl.draggable = true;
|
1470
1306
|
}
|
1471
|
-
|
1472
1307
|
pluginEvent('delayStart', this, {
|
1473
1308
|
evt: evt
|
1474
|
-
});
|
1309
|
+
});
|
1475
1310
|
|
1311
|
+
// Delay is impossible for native DnD in Edge or IE
|
1476
1312
|
if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) {
|
1477
1313
|
if (Sortable.eventCanceled) {
|
1478
1314
|
this._onDrop();
|
1479
|
-
|
1480
1315
|
return;
|
1481
|
-
}
|
1316
|
+
}
|
1317
|
+
// If the user moves the pointer or let go the click or touch
|
1482
1318
|
// before the delay has been reached:
|
1483
1319
|
// disable the delayed drag
|
1484
|
-
|
1485
|
-
|
1486
1320
|
on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
1487
1321
|
on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
1488
1322
|
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
@@ -1495,11 +1329,8 @@ Sortable.prototype =
|
|
1495
1329
|
}
|
1496
1330
|
}
|
1497
1331
|
},
|
1498
|
-
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(
|
1499
|
-
/** TouchEvent|PointerEvent **/
|
1500
|
-
e) {
|
1332
|
+
_delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler( /** TouchEvent|PointerEvent **/e) {
|
1501
1333
|
var touch = e.touches ? e.touches[0] : e;
|
1502
|
-
|
1503
1334
|
if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) {
|
1504
1335
|
this._disableDelayedDrag();
|
1505
1336
|
}
|
@@ -1507,7 +1338,6 @@ Sortable.prototype =
|
|
1507
1338
|
_disableDelayedDrag: function _disableDelayedDrag() {
|
1508
1339
|
dragEl && _disableDraggable(dragEl);
|
1509
1340
|
clearTimeout(this._dragStartTimer);
|
1510
|
-
|
1511
1341
|
this._disableDelayedDragEvents();
|
1512
1342
|
},
|
1513
1343
|
_disableDelayedDragEvents: function _disableDelayedDragEvents() {
|
@@ -1519,13 +1349,8 @@ Sortable.prototype =
|
|
1519
1349
|
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler);
|
1520
1350
|
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler);
|
1521
1351
|
},
|
1522
|
-
_triggerDragStart: function _triggerDragStart(
|
1523
|
-
/** Event */
|
1524
|
-
evt,
|
1525
|
-
/** Touch */
|
1526
|
-
touch) {
|
1352
|
+
_triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
|
1527
1353
|
touch = touch || evt.pointerType == 'touch' && evt;
|
1528
|
-
|
1529
1354
|
if (!this.nativeDraggable || touch) {
|
1530
1355
|
if (this.options.supportPointer) {
|
1531
1356
|
on(document, 'pointermove', this._onTouchMove);
|
@@ -1538,7 +1363,6 @@ Sortable.prototype =
|
|
1538
1363
|
on(dragEl, 'dragend', this);
|
1539
1364
|
on(rootEl, 'dragstart', this._onDragStart);
|
1540
1365
|
}
|
1541
|
-
|
1542
1366
|
try {
|
1543
1367
|
if (document.selection) {
|
1544
1368
|
// Timeout neccessary for IE9
|
@@ -1551,25 +1375,23 @@ Sortable.prototype =
|
|
1551
1375
|
} catch (err) {}
|
1552
1376
|
},
|
1553
1377
|
_dragStarted: function _dragStarted(fallback, evt) {
|
1554
|
-
|
1555
1378
|
awaitingDragStarted = false;
|
1556
|
-
|
1557
1379
|
if (rootEl && dragEl) {
|
1558
1380
|
pluginEvent('dragStarted', this, {
|
1559
1381
|
evt: evt
|
1560
1382
|
});
|
1561
|
-
|
1562
1383
|
if (this.nativeDraggable) {
|
1563
1384
|
on(document, 'dragover', _checkOutsideTargetEl);
|
1564
1385
|
}
|
1386
|
+
var options = this.options;
|
1565
1387
|
|
1566
|
-
|
1567
|
-
|
1388
|
+
// Apply effect
|
1568
1389
|
!fallback && toggleClass(dragEl, options.dragClass, false);
|
1569
1390
|
toggleClass(dragEl, options.ghostClass, true);
|
1570
1391
|
Sortable.active = this;
|
1571
|
-
fallback && this._appendGhost();
|
1392
|
+
fallback && this._appendGhost();
|
1572
1393
|
|
1394
|
+
// Drag start event
|
1573
1395
|
_dispatchEvent({
|
1574
1396
|
sortable: this,
|
1575
1397
|
name: 'start',
|
@@ -1583,20 +1405,15 @@ Sortable.prototype =
|
|
1583
1405
|
if (touchEvt) {
|
1584
1406
|
this._lastX = touchEvt.clientX;
|
1585
1407
|
this._lastY = touchEvt.clientY;
|
1586
|
-
|
1587
1408
|
_hideGhostForTarget();
|
1588
|
-
|
1589
1409
|
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
1590
1410
|
var parent = target;
|
1591
|
-
|
1592
1411
|
while (target && target.shadowRoot) {
|
1593
1412
|
target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY);
|
1594
1413
|
if (target === parent) break;
|
1595
1414
|
parent = target;
|
1596
1415
|
}
|
1597
|
-
|
1598
1416
|
dragEl.parentNode[expando]._isOutsideThisEl(target);
|
1599
|
-
|
1600
1417
|
if (parent) {
|
1601
1418
|
do {
|
1602
1419
|
if (parent[expando]) {
|
@@ -1607,44 +1424,37 @@ Sortable.prototype =
|
|
1607
1424
|
target: target,
|
1608
1425
|
rootEl: parent
|
1609
1426
|
});
|
1610
|
-
|
1611
1427
|
if (inserted && !this.options.dragoverBubble) {
|
1612
1428
|
break;
|
1613
1429
|
}
|
1614
1430
|
}
|
1615
|
-
|
1616
1431
|
target = parent; // store last element
|
1617
1432
|
}
|
1618
|
-
/* jshint boss:true */
|
1619
|
-
while (parent = parent.parentNode);
|
1433
|
+
/* jshint boss:true */ while (parent = parent.parentNode);
|
1620
1434
|
}
|
1621
|
-
|
1622
1435
|
_unhideGhostForTarget();
|
1623
1436
|
}
|
1624
1437
|
},
|
1625
|
-
_onTouchMove: function _onTouchMove(
|
1626
|
-
/**TouchEvent*/
|
1627
|
-
evt) {
|
1438
|
+
_onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
|
1628
1439
|
if (tapEvt) {
|
1629
1440
|
var options = this.options,
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1441
|
+
fallbackTolerance = options.fallbackTolerance,
|
1442
|
+
fallbackOffset = options.fallbackOffset,
|
1443
|
+
touch = evt.touches ? evt.touches[0] : evt,
|
1444
|
+
ghostMatrix = ghostEl && matrix(ghostEl, true),
|
1445
|
+
scaleX = ghostEl && ghostMatrix && ghostMatrix.a,
|
1446
|
+
scaleY = ghostEl && ghostMatrix && ghostMatrix.d,
|
1447
|
+
relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent),
|
1448
|
+
dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1),
|
1449
|
+
dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1);
|
1450
|
+
|
1451
|
+
// only set the status to dragging, when we are actually dragging
|
1640
1452
|
if (!Sortable.active && !awaitingDragStarted) {
|
1641
1453
|
if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) {
|
1642
1454
|
return;
|
1643
1455
|
}
|
1644
|
-
|
1645
1456
|
this._onDragStart(evt, true);
|
1646
1457
|
}
|
1647
|
-
|
1648
1458
|
if (ghostEl) {
|
1649
1459
|
if (ghostMatrix) {
|
1650
1460
|
ghostMatrix.e += dx - (lastDx || 0);
|
@@ -1659,7 +1469,6 @@ Sortable.prototype =
|
|
1659
1469
|
f: dy
|
1660
1470
|
};
|
1661
1471
|
}
|
1662
|
-
|
1663
1472
|
var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")");
|
1664
1473
|
css(ghostEl, 'webkitTransform', cssMatrix);
|
1665
1474
|
css(ghostEl, 'mozTransform', cssMatrix);
|
@@ -1669,7 +1478,6 @@ Sortable.prototype =
|
|
1669
1478
|
lastDy = dy;
|
1670
1479
|
touchEvt = touch;
|
1671
1480
|
}
|
1672
|
-
|
1673
1481
|
evt.cancelable && evt.preventDefault();
|
1674
1482
|
}
|
1675
1483
|
},
|
@@ -1678,17 +1486,16 @@ Sortable.prototype =
|
|
1678
1486
|
// Not being adjusted for
|
1679
1487
|
if (!ghostEl) {
|
1680
1488
|
var container = this.options.fallbackOnBody ? document.body : rootEl,
|
1681
|
-
|
1682
|
-
|
1489
|
+
rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container),
|
1490
|
+
options = this.options;
|
1683
1491
|
|
1492
|
+
// Position absolutely
|
1684
1493
|
if (PositionGhostAbsolutely) {
|
1685
1494
|
// Get relatively positioned parent
|
1686
1495
|
ghostRelativeParent = container;
|
1687
|
-
|
1688
1496
|
while (css(ghostRelativeParent, 'position') === 'static' && css(ghostRelativeParent, 'transform') === 'none' && ghostRelativeParent !== document) {
|
1689
1497
|
ghostRelativeParent = ghostRelativeParent.parentNode;
|
1690
1498
|
}
|
1691
|
-
|
1692
1499
|
if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) {
|
1693
1500
|
if (ghostRelativeParent === document) ghostRelativeParent = getWindowScrollingElement();
|
1694
1501
|
rect.top += ghostRelativeParent.scrollTop;
|
@@ -1696,10 +1503,8 @@ Sortable.prototype =
|
|
1696
1503
|
} else {
|
1697
1504
|
ghostRelativeParent = getWindowScrollingElement();
|
1698
1505
|
}
|
1699
|
-
|
1700
1506
|
ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent);
|
1701
1507
|
}
|
1702
|
-
|
1703
1508
|
ghostEl = dragEl.cloneNode(true);
|
1704
1509
|
toggleClass(ghostEl, options.ghostClass, false);
|
1705
1510
|
toggleClass(ghostEl, options.fallbackClass, true);
|
@@ -1717,62 +1522,50 @@ Sortable.prototype =
|
|
1717
1522
|
css(ghostEl, 'zIndex', '100000');
|
1718
1523
|
css(ghostEl, 'pointerEvents', 'none');
|
1719
1524
|
Sortable.ghost = ghostEl;
|
1720
|
-
container.appendChild(ghostEl);
|
1525
|
+
container.appendChild(ghostEl);
|
1721
1526
|
|
1527
|
+
// Set transform-origin
|
1722
1528
|
css(ghostEl, 'transform-origin', tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + '% ' + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + '%');
|
1723
1529
|
}
|
1724
1530
|
},
|
1725
|
-
_onDragStart: function _onDragStart(
|
1726
|
-
/**Event*/
|
1727
|
-
evt,
|
1728
|
-
/**boolean*/
|
1729
|
-
fallback) {
|
1531
|
+
_onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/fallback) {
|
1730
1532
|
var _this = this;
|
1731
|
-
|
1732
1533
|
var dataTransfer = evt.dataTransfer;
|
1733
1534
|
var options = _this.options;
|
1734
1535
|
pluginEvent('dragStart', this, {
|
1735
1536
|
evt: evt
|
1736
1537
|
});
|
1737
|
-
|
1738
1538
|
if (Sortable.eventCanceled) {
|
1739
1539
|
this._onDrop();
|
1740
|
-
|
1741
1540
|
return;
|
1742
1541
|
}
|
1743
|
-
|
1744
1542
|
pluginEvent('setupClone', this);
|
1745
|
-
|
1746
1543
|
if (!Sortable.eventCanceled) {
|
1747
1544
|
cloneEl = clone(dragEl);
|
1748
1545
|
cloneEl.removeAttribute("id");
|
1749
1546
|
cloneEl.draggable = false;
|
1750
1547
|
cloneEl.style['will-change'] = '';
|
1751
|
-
|
1752
1548
|
this._hideClone();
|
1753
|
-
|
1754
1549
|
toggleClass(cloneEl, this.options.chosenClass, false);
|
1755
1550
|
Sortable.clone = cloneEl;
|
1756
|
-
}
|
1757
|
-
|
1551
|
+
}
|
1758
1552
|
|
1553
|
+
// #1143: IFrame support workaround
|
1759
1554
|
_this.cloneId = _nextTick(function () {
|
1760
1555
|
pluginEvent('clone', _this);
|
1761
1556
|
if (Sortable.eventCanceled) return;
|
1762
|
-
|
1763
1557
|
if (!_this.options.removeCloneOnHide) {
|
1764
1558
|
rootEl.insertBefore(cloneEl, dragEl);
|
1765
1559
|
}
|
1766
|
-
|
1767
1560
|
_this._hideClone();
|
1768
|
-
|
1769
1561
|
_dispatchEvent({
|
1770
1562
|
sortable: _this,
|
1771
1563
|
name: 'clone'
|
1772
1564
|
});
|
1773
1565
|
});
|
1774
|
-
!fallback && toggleClass(dragEl, options.dragClass, true);
|
1566
|
+
!fallback && toggleClass(dragEl, options.dragClass, true);
|
1775
1567
|
|
1568
|
+
// Set proper drop events
|
1776
1569
|
if (fallback) {
|
1777
1570
|
ignoreNextClick = true;
|
1778
1571
|
_this._loopId = setInterval(_this._emulateDragOver, 50);
|
@@ -1781,47 +1574,40 @@ Sortable.prototype =
|
|
1781
1574
|
off(document, 'mouseup', _this._onDrop);
|
1782
1575
|
off(document, 'touchend', _this._onDrop);
|
1783
1576
|
off(document, 'touchcancel', _this._onDrop);
|
1784
|
-
|
1785
1577
|
if (dataTransfer) {
|
1786
1578
|
dataTransfer.effectAllowed = 'move';
|
1787
1579
|
options.setData && options.setData.call(_this, dataTransfer, dragEl);
|
1788
1580
|
}
|
1581
|
+
on(document, 'drop', _this);
|
1789
1582
|
|
1790
|
-
|
1791
|
-
|
1583
|
+
// #1276 fix:
|
1792
1584
|
css(dragEl, 'transform', 'translateZ(0)');
|
1793
1585
|
}
|
1794
|
-
|
1795
1586
|
awaitingDragStarted = true;
|
1796
1587
|
_this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt));
|
1797
1588
|
on(document, 'selectstart', _this);
|
1798
1589
|
moved = true;
|
1799
|
-
|
1800
1590
|
if (Safari) {
|
1801
1591
|
css(document.body, 'user-select', 'none');
|
1802
1592
|
}
|
1803
1593
|
},
|
1804
1594
|
// Returns true - if no further action is needed (either inserted or another condition)
|
1805
|
-
_onDragOver: function _onDragOver(
|
1806
|
-
/**Event*/
|
1807
|
-
evt) {
|
1595
|
+
_onDragOver: function _onDragOver( /**Event*/evt) {
|
1808
1596
|
var el = this.el,
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1597
|
+
target = evt.target,
|
1598
|
+
dragRect,
|
1599
|
+
targetRect,
|
1600
|
+
revert,
|
1601
|
+
options = this.options,
|
1602
|
+
group = options.group,
|
1603
|
+
activeSortable = Sortable.active,
|
1604
|
+
isOwner = activeGroup === group,
|
1605
|
+
canSort = options.sort,
|
1606
|
+
fromSortable = putSortable || activeSortable,
|
1607
|
+
vertical,
|
1608
|
+
_this = this,
|
1609
|
+
completedFired = false;
|
1823
1610
|
if (_silent) return;
|
1824
|
-
|
1825
1611
|
function dragOverEvent(name, extra) {
|
1826
1612
|
pluginEvent(name, _this, _objectSpread2({
|
1827
1613
|
evt: evt,
|
@@ -1839,25 +1625,22 @@ Sortable.prototype =
|
|
1839
1625
|
},
|
1840
1626
|
changed: changed
|
1841
1627
|
}, extra));
|
1842
|
-
}
|
1843
|
-
|
1628
|
+
}
|
1844
1629
|
|
1630
|
+
// Capture animation state
|
1845
1631
|
function capture() {
|
1846
1632
|
dragOverEvent('dragOverAnimationCapture');
|
1847
|
-
|
1848
1633
|
_this.captureAnimationState();
|
1849
|
-
|
1850
1634
|
if (_this !== fromSortable) {
|
1851
1635
|
fromSortable.captureAnimationState();
|
1852
1636
|
}
|
1853
|
-
}
|
1854
|
-
|
1637
|
+
}
|
1855
1638
|
|
1639
|
+
// Return invocation when dragEl is inserted (or completed)
|
1856
1640
|
function completed(insertion) {
|
1857
1641
|
dragOverEvent('dragOverCompleted', {
|
1858
1642
|
insertion: insertion
|
1859
1643
|
});
|
1860
|
-
|
1861
1644
|
if (insertion) {
|
1862
1645
|
// Clones must be hidden before folding animation to capture dragRectAbsolute properly
|
1863
1646
|
if (isOwner) {
|
@@ -1865,57 +1648,51 @@ Sortable.prototype =
|
|
1865
1648
|
} else {
|
1866
1649
|
activeSortable._showClone(_this);
|
1867
1650
|
}
|
1868
|
-
|
1869
1651
|
if (_this !== fromSortable) {
|
1870
1652
|
// Set ghost class to new sortable's ghost class
|
1871
1653
|
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false);
|
1872
1654
|
toggleClass(dragEl, options.ghostClass, true);
|
1873
1655
|
}
|
1874
|
-
|
1875
1656
|
if (putSortable !== _this && _this !== Sortable.active) {
|
1876
1657
|
putSortable = _this;
|
1877
1658
|
} else if (_this === Sortable.active && putSortable) {
|
1878
1659
|
putSortable = null;
|
1879
|
-
}
|
1880
|
-
|
1660
|
+
}
|
1881
1661
|
|
1662
|
+
// Animation
|
1882
1663
|
if (fromSortable === _this) {
|
1883
1664
|
_this._ignoreWhileAnimating = target;
|
1884
1665
|
}
|
1885
|
-
|
1886
1666
|
_this.animateAll(function () {
|
1887
1667
|
dragOverEvent('dragOverAnimationComplete');
|
1888
1668
|
_this._ignoreWhileAnimating = null;
|
1889
1669
|
});
|
1890
|
-
|
1891
1670
|
if (_this !== fromSortable) {
|
1892
1671
|
fromSortable.animateAll();
|
1893
1672
|
fromSortable._ignoreWhileAnimating = null;
|
1894
1673
|
}
|
1895
|
-
}
|
1896
|
-
|
1674
|
+
}
|
1897
1675
|
|
1676
|
+
// Null lastTarget if it is not inside a previously swapped element
|
1898
1677
|
if (target === dragEl && !dragEl.animated || target === el && !target.animated) {
|
1899
1678
|
lastTarget = null;
|
1900
|
-
}
|
1901
|
-
|
1679
|
+
}
|
1902
1680
|
|
1681
|
+
// no bubbling and not fallback
|
1903
1682
|
if (!options.dragoverBubble && !evt.rootEl && target !== document) {
|
1904
|
-
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
1905
|
-
|
1683
|
+
dragEl.parentNode[expando]._isOutsideThisEl(evt.target);
|
1906
1684
|
|
1685
|
+
// Do not detect for empty insert if already inserted
|
1907
1686
|
!insertion && nearestEmptyInsertDetectEvent(evt);
|
1908
1687
|
}
|
1909
|
-
|
1910
1688
|
!options.dragoverBubble && evt.stopPropagation && evt.stopPropagation();
|
1911
1689
|
return completedFired = true;
|
1912
|
-
}
|
1913
|
-
|
1690
|
+
}
|
1914
1691
|
|
1692
|
+
// Call when dragEl has been inserted
|
1915
1693
|
function changed() {
|
1916
1694
|
newIndex = index(dragEl);
|
1917
1695
|
newDraggableIndex = index(dragEl, options.draggable);
|
1918
|
-
|
1919
1696
|
_dispatchEvent({
|
1920
1697
|
sortable: _this,
|
1921
1698
|
name: 'change',
|
@@ -1925,37 +1702,27 @@ Sortable.prototype =
|
|
1925
1702
|
originalEvent: evt
|
1926
1703
|
});
|
1927
1704
|
}
|
1928
|
-
|
1929
1705
|
if (evt.preventDefault !== void 0) {
|
1930
1706
|
evt.cancelable && evt.preventDefault();
|
1931
1707
|
}
|
1932
|
-
|
1933
1708
|
target = closest(target, options.draggable, el, true);
|
1934
1709
|
dragOverEvent('dragOver');
|
1935
1710
|
if (Sortable.eventCanceled) return completedFired;
|
1936
|
-
|
1937
1711
|
if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) {
|
1938
1712
|
return completed(false);
|
1939
1713
|
}
|
1940
|
-
|
1941
1714
|
ignoreNextClick = false;
|
1942
|
-
|
1943
1715
|
if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) // Reverting item into the original list
|
1944
1716
|
: putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) {
|
1945
1717
|
vertical = this._getDirection(evt, target) === 'vertical';
|
1946
1718
|
dragRect = getRect(dragEl);
|
1947
1719
|
dragOverEvent('dragOverValid');
|
1948
1720
|
if (Sortable.eventCanceled) return completedFired;
|
1949
|
-
|
1950
1721
|
if (revert) {
|
1951
1722
|
parentEl = rootEl; // actualization
|
1952
|
-
|
1953
1723
|
capture();
|
1954
|
-
|
1955
1724
|
this._hideClone();
|
1956
|
-
|
1957
1725
|
dragOverEvent('revert');
|
1958
|
-
|
1959
1726
|
if (!Sortable.eventCanceled) {
|
1960
1727
|
if (nextEl) {
|
1961
1728
|
rootEl.insertBefore(dragEl, nextEl);
|
@@ -1963,38 +1730,32 @@ Sortable.prototype =
|
|
1963
1730
|
rootEl.appendChild(dragEl);
|
1964
1731
|
}
|
1965
1732
|
}
|
1966
|
-
|
1967
1733
|
return completed(true);
|
1968
1734
|
}
|
1969
|
-
|
1970
1735
|
var elLastChild = lastChild(el, options.draggable);
|
1971
|
-
|
1972
1736
|
if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) {
|
1973
1737
|
// Insert to end of list
|
1738
|
+
|
1974
1739
|
// If already at end of list: Do not insert
|
1975
1740
|
if (elLastChild === dragEl) {
|
1976
1741
|
return completed(false);
|
1977
|
-
}
|
1978
|
-
|
1742
|
+
}
|
1979
1743
|
|
1744
|
+
// if there is a last element, it is the target
|
1980
1745
|
if (elLastChild && el === evt.target) {
|
1981
1746
|
target = elLastChild;
|
1982
1747
|
}
|
1983
|
-
|
1984
1748
|
if (target) {
|
1985
1749
|
targetRect = getRect(target);
|
1986
1750
|
}
|
1987
|
-
|
1988
1751
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
|
1989
1752
|
capture();
|
1990
|
-
|
1991
1753
|
if (elLastChild && elLastChild.nextSibling) {
|
1992
1754
|
// the last draggable element is not the last node
|
1993
1755
|
el.insertBefore(dragEl, elLastChild.nextSibling);
|
1994
1756
|
} else {
|
1995
1757
|
el.appendChild(dragEl);
|
1996
1758
|
}
|
1997
|
-
|
1998
1759
|
parentEl = el; // actualization
|
1999
1760
|
|
2000
1761
|
changed();
|
@@ -2003,14 +1764,11 @@ Sortable.prototype =
|
|
2003
1764
|
} else if (elLastChild && _ghostIsFirst(evt, vertical, this)) {
|
2004
1765
|
// Insert to start of list
|
2005
1766
|
var firstChild = getChild(el, 0, options, true);
|
2006
|
-
|
2007
1767
|
if (firstChild === dragEl) {
|
2008
1768
|
return completed(false);
|
2009
1769
|
}
|
2010
|
-
|
2011
1770
|
target = firstChild;
|
2012
1771
|
targetRect = getRect(target);
|
2013
|
-
|
2014
1772
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) {
|
2015
1773
|
capture();
|
2016
1774
|
el.insertBefore(dragEl, firstChild);
|
@@ -2022,82 +1780,68 @@ Sortable.prototype =
|
|
2022
1780
|
} else if (target.parentNode === el) {
|
2023
1781
|
targetRect = getRect(target);
|
2024
1782
|
var direction = 0,
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
1783
|
+
targetBeforeFirstSwap,
|
1784
|
+
differentLevel = dragEl.parentNode !== el,
|
1785
|
+
differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical),
|
1786
|
+
side1 = vertical ? 'top' : 'left',
|
1787
|
+
scrolledPastTop = isScrolledPast(target, 'top', 'top') || isScrolledPast(dragEl, 'top', 'top'),
|
1788
|
+
scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0;
|
2032
1789
|
if (lastTarget !== target) {
|
2033
1790
|
targetBeforeFirstSwap = targetRect[side1];
|
2034
1791
|
pastFirstInvertThresh = false;
|
2035
1792
|
isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel;
|
2036
1793
|
}
|
2037
|
-
|
2038
1794
|
direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target);
|
2039
1795
|
var sibling;
|
2040
|
-
|
2041
1796
|
if (direction !== 0) {
|
2042
1797
|
// Check if target is beside dragEl in respective direction (ignoring hidden elements)
|
2043
1798
|
var dragIndex = index(dragEl);
|
2044
|
-
|
2045
1799
|
do {
|
2046
1800
|
dragIndex -= direction;
|
2047
1801
|
sibling = parentEl.children[dragIndex];
|
2048
1802
|
} while (sibling && (css(sibling, 'display') === 'none' || sibling === ghostEl));
|
2049
|
-
}
|
2050
|
-
|
2051
|
-
|
1803
|
+
}
|
1804
|
+
// If dragEl is already beside target: Do not insert
|
2052
1805
|
if (direction === 0 || sibling === target) {
|
2053
1806
|
return completed(false);
|
2054
1807
|
}
|
2055
|
-
|
2056
1808
|
lastTarget = target;
|
2057
1809
|
lastDirection = direction;
|
2058
1810
|
var nextSibling = target.nextElementSibling,
|
2059
|
-
|
1811
|
+
after = false;
|
2060
1812
|
after = direction === 1;
|
2061
|
-
|
2062
1813
|
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
|
2063
|
-
|
2064
1814
|
if (moveVector !== false) {
|
2065
1815
|
if (moveVector === 1 || moveVector === -1) {
|
2066
1816
|
after = moveVector === 1;
|
2067
1817
|
}
|
2068
|
-
|
2069
1818
|
_silent = true;
|
2070
1819
|
setTimeout(_unsilent, 30);
|
2071
1820
|
capture();
|
2072
|
-
|
2073
1821
|
if (after && !nextSibling) {
|
2074
1822
|
el.appendChild(dragEl);
|
2075
1823
|
} else {
|
2076
1824
|
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
|
2077
|
-
}
|
2078
|
-
|
1825
|
+
}
|
2079
1826
|
|
1827
|
+
// Undo chrome's scroll adjustment (has no effect on other browsers)
|
2080
1828
|
if (scrolledPastTop) {
|
2081
1829
|
scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop);
|
2082
1830
|
}
|
2083
|
-
|
2084
1831
|
parentEl = dragEl.parentNode; // actualization
|
2085
|
-
// must be done before animation
|
2086
1832
|
|
1833
|
+
// must be done before animation
|
2087
1834
|
if (targetBeforeFirstSwap !== undefined && !isCircumstantialInvert) {
|
2088
1835
|
targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]);
|
2089
1836
|
}
|
2090
|
-
|
2091
1837
|
changed();
|
2092
1838
|
return completed(true);
|
2093
1839
|
}
|
2094
1840
|
}
|
2095
|
-
|
2096
1841
|
if (el.contains(dragEl)) {
|
2097
1842
|
return completed(false);
|
2098
1843
|
}
|
2099
1844
|
}
|
2100
|
-
|
2101
1845
|
return false;
|
2102
1846
|
},
|
2103
1847
|
_ignoreWhileAnimating: null,
|
@@ -2117,83 +1861,69 @@ Sortable.prototype =
|
|
2117
1861
|
off(ownerDocument, 'touchcancel', this._onDrop);
|
2118
1862
|
off(document, 'selectstart', this);
|
2119
1863
|
},
|
2120
|
-
_onDrop: function _onDrop(
|
2121
|
-
/**Event*/
|
2122
|
-
evt) {
|
1864
|
+
_onDrop: function _onDrop( /**Event*/evt) {
|
2123
1865
|
var el = this.el,
|
2124
|
-
|
1866
|
+
options = this.options;
|
2125
1867
|
|
1868
|
+
// Get the index of the dragged element within its parent
|
2126
1869
|
newIndex = index(dragEl);
|
2127
1870
|
newDraggableIndex = index(dragEl, options.draggable);
|
2128
1871
|
pluginEvent('drop', this, {
|
2129
1872
|
evt: evt
|
2130
1873
|
});
|
2131
|
-
parentEl = dragEl && dragEl.parentNode;
|
1874
|
+
parentEl = dragEl && dragEl.parentNode;
|
2132
1875
|
|
1876
|
+
// Get again after plugin event
|
2133
1877
|
newIndex = index(dragEl);
|
2134
1878
|
newDraggableIndex = index(dragEl, options.draggable);
|
2135
|
-
|
2136
1879
|
if (Sortable.eventCanceled) {
|
2137
1880
|
this._nulling();
|
2138
|
-
|
2139
1881
|
return;
|
2140
1882
|
}
|
2141
|
-
|
2142
1883
|
awaitingDragStarted = false;
|
2143
1884
|
isCircumstantialInvert = false;
|
2144
1885
|
pastFirstInvertThresh = false;
|
2145
1886
|
clearInterval(this._loopId);
|
2146
1887
|
clearTimeout(this._dragStartTimer);
|
2147
|
-
|
2148
1888
|
_cancelNextTick(this.cloneId);
|
1889
|
+
_cancelNextTick(this._dragStartId);
|
2149
1890
|
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
1891
|
+
// Unbind events
|
2153
1892
|
if (this.nativeDraggable) {
|
2154
1893
|
off(document, 'drop', this);
|
2155
1894
|
off(el, 'dragstart', this._onDragStart);
|
2156
1895
|
}
|
2157
|
-
|
2158
1896
|
this._offMoveEvents();
|
2159
|
-
|
2160
1897
|
this._offUpEvents();
|
2161
|
-
|
2162
1898
|
if (Safari) {
|
2163
1899
|
css(document.body, 'user-select', '');
|
2164
1900
|
}
|
2165
|
-
|
2166
1901
|
css(dragEl, 'transform', '');
|
2167
|
-
|
2168
1902
|
if (evt) {
|
2169
1903
|
if (moved) {
|
2170
1904
|
evt.cancelable && evt.preventDefault();
|
2171
1905
|
!options.dropBubble && evt.stopPropagation();
|
2172
1906
|
}
|
2173
|
-
|
2174
1907
|
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
|
2175
|
-
|
2176
1908
|
if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== 'clone') {
|
2177
1909
|
// Remove clone(s)
|
2178
1910
|
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
|
2179
1911
|
}
|
2180
|
-
|
2181
1912
|
if (dragEl) {
|
2182
1913
|
if (this.nativeDraggable) {
|
2183
1914
|
off(dragEl, 'dragend', this);
|
2184
1915
|
}
|
2185
|
-
|
2186
1916
|
_disableDraggable(dragEl);
|
1917
|
+
dragEl.style['will-change'] = '';
|
2187
1918
|
|
2188
|
-
|
1919
|
+
// Remove classes
|
2189
1920
|
// ghostClass is added in dragStarted
|
2190
|
-
|
2191
1921
|
if (moved && !awaitingDragStarted) {
|
2192
1922
|
toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false);
|
2193
1923
|
}
|
1924
|
+
toggleClass(dragEl, this.options.chosenClass, false);
|
2194
1925
|
|
2195
|
-
|
2196
|
-
|
1926
|
+
// Drag stop event
|
2197
1927
|
_dispatchEvent({
|
2198
1928
|
sortable: this,
|
2199
1929
|
name: 'unchoose',
|
@@ -2202,7 +1932,6 @@ Sortable.prototype =
|
|
2202
1932
|
newDraggableIndex: null,
|
2203
1933
|
originalEvent: evt
|
2204
1934
|
});
|
2205
|
-
|
2206
1935
|
if (rootEl !== parentEl) {
|
2207
1936
|
if (newIndex >= 0) {
|
2208
1937
|
// Add event
|
@@ -2212,17 +1941,17 @@ Sortable.prototype =
|
|
2212
1941
|
toEl: parentEl,
|
2213
1942
|
fromEl: rootEl,
|
2214
1943
|
originalEvent: evt
|
2215
|
-
});
|
2216
|
-
|
1944
|
+
});
|
2217
1945
|
|
1946
|
+
// Remove event
|
2218
1947
|
_dispatchEvent({
|
2219
1948
|
sortable: this,
|
2220
1949
|
name: 'remove',
|
2221
1950
|
toEl: parentEl,
|
2222
1951
|
originalEvent: evt
|
2223
|
-
});
|
2224
|
-
|
1952
|
+
});
|
2225
1953
|
|
1954
|
+
// drag from one list and drop into another
|
2226
1955
|
_dispatchEvent({
|
2227
1956
|
rootEl: parentEl,
|
2228
1957
|
name: 'sort',
|
@@ -2230,7 +1959,6 @@ Sortable.prototype =
|
|
2230
1959
|
fromEl: rootEl,
|
2231
1960
|
originalEvent: evt
|
2232
1961
|
});
|
2233
|
-
|
2234
1962
|
_dispatchEvent({
|
2235
1963
|
sortable: this,
|
2236
1964
|
name: 'sort',
|
@@ -2238,7 +1966,6 @@ Sortable.prototype =
|
|
2238
1966
|
originalEvent: evt
|
2239
1967
|
});
|
2240
1968
|
}
|
2241
|
-
|
2242
1969
|
putSortable && putSortable.save();
|
2243
1970
|
} else {
|
2244
1971
|
if (newIndex !== oldIndex) {
|
@@ -2250,7 +1977,6 @@ Sortable.prototype =
|
|
2250
1977
|
toEl: parentEl,
|
2251
1978
|
originalEvent: evt
|
2252
1979
|
});
|
2253
|
-
|
2254
1980
|
_dispatchEvent({
|
2255
1981
|
sortable: this,
|
2256
1982
|
name: 'sort',
|
@@ -2260,27 +1986,24 @@ Sortable.prototype =
|
|
2260
1986
|
}
|
2261
1987
|
}
|
2262
1988
|
}
|
2263
|
-
|
2264
1989
|
if (Sortable.active) {
|
2265
1990
|
/* jshint eqnull:true */
|
2266
1991
|
if (newIndex == null || newIndex === -1) {
|
2267
1992
|
newIndex = oldIndex;
|
2268
1993
|
newDraggableIndex = oldDraggableIndex;
|
2269
1994
|
}
|
2270
|
-
|
2271
1995
|
_dispatchEvent({
|
2272
1996
|
sortable: this,
|
2273
1997
|
name: 'end',
|
2274
1998
|
toEl: parentEl,
|
2275
1999
|
originalEvent: evt
|
2276
|
-
});
|
2277
|
-
|
2000
|
+
});
|
2278
2001
|
|
2002
|
+
// Save sorting
|
2279
2003
|
this.save();
|
2280
2004
|
}
|
2281
2005
|
}
|
2282
2006
|
}
|
2283
|
-
|
2284
2007
|
this._nulling();
|
2285
2008
|
},
|
2286
2009
|
_nulling: function _nulling() {
|
@@ -2291,65 +2014,52 @@ Sortable.prototype =
|
|
2291
2014
|
});
|
2292
2015
|
savedInputChecked.length = lastDx = lastDy = 0;
|
2293
2016
|
},
|
2294
|
-
handleEvent: function handleEvent(
|
2295
|
-
/**Event*/
|
2296
|
-
evt) {
|
2017
|
+
handleEvent: function handleEvent( /**Event*/evt) {
|
2297
2018
|
switch (evt.type) {
|
2298
2019
|
case 'drop':
|
2299
2020
|
case 'dragend':
|
2300
2021
|
this._onDrop(evt);
|
2301
|
-
|
2302
2022
|
break;
|
2303
|
-
|
2304
2023
|
case 'dragenter':
|
2305
2024
|
case 'dragover':
|
2306
2025
|
if (dragEl) {
|
2307
2026
|
this._onDragOver(evt);
|
2308
|
-
|
2309
2027
|
_globalDragOver(evt);
|
2310
2028
|
}
|
2311
|
-
|
2312
2029
|
break;
|
2313
|
-
|
2314
2030
|
case 'selectstart':
|
2315
2031
|
evt.preventDefault();
|
2316
2032
|
break;
|
2317
2033
|
}
|
2318
2034
|
},
|
2319
|
-
|
2320
2035
|
/**
|
2321
2036
|
* Serializes the item into an array of string.
|
2322
2037
|
* @returns {String[]}
|
2323
2038
|
*/
|
2324
2039
|
toArray: function toArray() {
|
2325
2040
|
var order = [],
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2041
|
+
el,
|
2042
|
+
children = this.el.children,
|
2043
|
+
i = 0,
|
2044
|
+
n = children.length,
|
2045
|
+
options = this.options;
|
2332
2046
|
for (; i < n; i++) {
|
2333
2047
|
el = children[i];
|
2334
|
-
|
2335
2048
|
if (closest(el, options.draggable, this.el, false)) {
|
2336
2049
|
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
2337
2050
|
}
|
2338
2051
|
}
|
2339
|
-
|
2340
2052
|
return order;
|
2341
2053
|
},
|
2342
|
-
|
2343
2054
|
/**
|
2344
2055
|
* Sorts the elements according to the array.
|
2345
2056
|
* @param {String[]} order order of the items
|
2346
2057
|
*/
|
2347
2058
|
sort: function sort(order, useAnimation) {
|
2348
2059
|
var items = {},
|
2349
|
-
|
2060
|
+
rootEl = this.el;
|
2350
2061
|
this.toArray().forEach(function (id, i) {
|
2351
2062
|
var el = rootEl.children[i];
|
2352
|
-
|
2353
2063
|
if (closest(el, this.options.draggable, rootEl, false)) {
|
2354
2064
|
items[id] = el;
|
2355
2065
|
}
|
@@ -2363,7 +2073,6 @@ Sortable.prototype =
|
|
2363
2073
|
});
|
2364
2074
|
useAnimation && this.animateAll();
|
2365
2075
|
},
|
2366
|
-
|
2367
2076
|
/**
|
2368
2077
|
* Save the current sorting
|
2369
2078
|
*/
|
@@ -2371,7 +2080,6 @@ Sortable.prototype =
|
|
2371
2080
|
var store = this.options.store;
|
2372
2081
|
store && store.set && store.set(this);
|
2373
2082
|
},
|
2374
|
-
|
2375
2083
|
/**
|
2376
2084
|
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
2377
2085
|
* @param {HTMLElement} el
|
@@ -2381,7 +2089,6 @@ Sortable.prototype =
|
|
2381
2089
|
closest: function closest$1(el, selector) {
|
2382
2090
|
return closest(el, selector || this.options.draggable, this.el, false);
|
2383
2091
|
},
|
2384
|
-
|
2385
2092
|
/**
|
2386
2093
|
* Set/get option
|
2387
2094
|
* @param {string} name
|
@@ -2390,24 +2097,20 @@ Sortable.prototype =
|
|
2390
2097
|
*/
|
2391
2098
|
option: function option(name, value) {
|
2392
2099
|
var options = this.options;
|
2393
|
-
|
2394
2100
|
if (value === void 0) {
|
2395
2101
|
return options[name];
|
2396
2102
|
} else {
|
2397
2103
|
var modifiedValue = PluginManager.modifyOption(this, name, value);
|
2398
|
-
|
2399
2104
|
if (typeof modifiedValue !== 'undefined') {
|
2400
2105
|
options[name] = modifiedValue;
|
2401
2106
|
} else {
|
2402
2107
|
options[name] = value;
|
2403
2108
|
}
|
2404
|
-
|
2405
2109
|
if (name === 'group') {
|
2406
2110
|
_prepareGroup(options);
|
2407
2111
|
}
|
2408
2112
|
}
|
2409
2113
|
},
|
2410
|
-
|
2411
2114
|
/**
|
2412
2115
|
* Destroy
|
2413
2116
|
*/
|
@@ -2418,21 +2121,16 @@ Sortable.prototype =
|
|
2418
2121
|
off(el, 'mousedown', this._onTapStart);
|
2419
2122
|
off(el, 'touchstart', this._onTapStart);
|
2420
2123
|
off(el, 'pointerdown', this._onTapStart);
|
2421
|
-
|
2422
2124
|
if (this.nativeDraggable) {
|
2423
2125
|
off(el, 'dragover', this);
|
2424
2126
|
off(el, 'dragenter', this);
|
2425
|
-
}
|
2426
|
-
|
2427
|
-
|
2127
|
+
}
|
2128
|
+
// Remove draggable attributes
|
2428
2129
|
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
|
2429
2130
|
el.removeAttribute('draggable');
|
2430
2131
|
});
|
2431
|
-
|
2432
2132
|
this._onDrop();
|
2433
|
-
|
2434
2133
|
this._disableDelayedDragEvents();
|
2435
|
-
|
2436
2134
|
sortables.splice(sortables.indexOf(this.el), 1);
|
2437
2135
|
this.el = el = null;
|
2438
2136
|
},
|
@@ -2441,25 +2139,22 @@ Sortable.prototype =
|
|
2441
2139
|
pluginEvent('hideClone', this);
|
2442
2140
|
if (Sortable.eventCanceled) return;
|
2443
2141
|
css(cloneEl, 'display', 'none');
|
2444
|
-
|
2445
2142
|
if (this.options.removeCloneOnHide && cloneEl.parentNode) {
|
2446
2143
|
cloneEl.parentNode.removeChild(cloneEl);
|
2447
2144
|
}
|
2448
|
-
|
2449
2145
|
cloneHidden = true;
|
2450
2146
|
}
|
2451
2147
|
},
|
2452
2148
|
_showClone: function _showClone(putSortable) {
|
2453
2149
|
if (putSortable.lastPutMode !== 'clone') {
|
2454
2150
|
this._hideClone();
|
2455
|
-
|
2456
2151
|
return;
|
2457
2152
|
}
|
2458
|
-
|
2459
2153
|
if (cloneHidden) {
|
2460
2154
|
pluginEvent('showClone', this);
|
2461
|
-
if (Sortable.eventCanceled) return;
|
2155
|
+
if (Sortable.eventCanceled) return;
|
2462
2156
|
|
2157
|
+
// show clone at dragEl or original position
|
2463
2158
|
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
|
2464
2159
|
rootEl.insertBefore(cloneEl, dragEl);
|
2465
2160
|
} else if (nextEl) {
|
@@ -2467,33 +2162,26 @@ Sortable.prototype =
|
|
2467
2162
|
} else {
|
2468
2163
|
rootEl.appendChild(cloneEl);
|
2469
2164
|
}
|
2470
|
-
|
2471
2165
|
if (this.options.group.revertClone) {
|
2472
2166
|
this.animate(dragEl, cloneEl);
|
2473
2167
|
}
|
2474
|
-
|
2475
2168
|
css(cloneEl, 'display', '');
|
2476
2169
|
cloneHidden = false;
|
2477
2170
|
}
|
2478
2171
|
}
|
2479
2172
|
};
|
2480
|
-
|
2481
|
-
function _globalDragOver(
|
2482
|
-
/**Event*/
|
2483
|
-
evt) {
|
2173
|
+
function _globalDragOver( /**Event*/evt) {
|
2484
2174
|
if (evt.dataTransfer) {
|
2485
2175
|
evt.dataTransfer.dropEffect = 'move';
|
2486
2176
|
}
|
2487
|
-
|
2488
2177
|
evt.cancelable && evt.preventDefault();
|
2489
2178
|
}
|
2490
|
-
|
2491
2179
|
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) {
|
2492
2180
|
var evt,
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2181
|
+
sortable = fromEl[expando],
|
2182
|
+
onMoveFn = sortable.options.onMove,
|
2183
|
+
retVal;
|
2184
|
+
// Support for new CustomEvent feature
|
2497
2185
|
if (window.CustomEvent && !IE11OrLess && !Edge) {
|
2498
2186
|
evt = new CustomEvent('move', {
|
2499
2187
|
bubbles: true,
|
@@ -2503,7 +2191,6 @@ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalE
|
|
2503
2191
|
evt = document.createEvent('Event');
|
2504
2192
|
evt.initEvent('move', true, true);
|
2505
2193
|
}
|
2506
|
-
|
2507
2194
|
evt.to = toEl;
|
2508
2195
|
evt.from = fromEl;
|
2509
2196
|
evt.dragged = dragEl;
|
@@ -2513,41 +2200,35 @@ function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalE
|
|
2513
2200
|
evt.willInsertAfter = willInsertAfter;
|
2514
2201
|
evt.originalEvent = originalEvent;
|
2515
2202
|
fromEl.dispatchEvent(evt);
|
2516
|
-
|
2517
2203
|
if (onMoveFn) {
|
2518
2204
|
retVal = onMoveFn.call(sortable, evt, originalEvent);
|
2519
2205
|
}
|
2520
|
-
|
2521
2206
|
return retVal;
|
2522
2207
|
}
|
2523
|
-
|
2524
2208
|
function _disableDraggable(el) {
|
2525
2209
|
el.draggable = false;
|
2526
2210
|
}
|
2527
|
-
|
2528
2211
|
function _unsilent() {
|
2529
2212
|
_silent = false;
|
2530
2213
|
}
|
2531
|
-
|
2532
2214
|
function _ghostIsFirst(evt, vertical, sortable) {
|
2533
|
-
var
|
2215
|
+
var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true));
|
2216
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
2534
2217
|
var spacer = 10;
|
2535
|
-
return vertical ? evt.clientX <
|
2218
|
+
return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left;
|
2536
2219
|
}
|
2537
|
-
|
2538
2220
|
function _ghostIsLast(evt, vertical, sortable) {
|
2539
|
-
var
|
2221
|
+
var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable));
|
2222
|
+
var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl);
|
2540
2223
|
var spacer = 10;
|
2541
|
-
return vertical ? evt.clientX >
|
2224
|
+
return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top;
|
2542
2225
|
}
|
2543
|
-
|
2544
2226
|
function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) {
|
2545
2227
|
var mouseOnAxis = vertical ? evt.clientY : evt.clientX,
|
2546
|
-
|
2547
|
-
|
2548
|
-
|
2549
|
-
|
2550
|
-
|
2228
|
+
targetLength = vertical ? targetRect.height : targetRect.width,
|
2229
|
+
targetS1 = vertical ? targetRect.top : targetRect.left,
|
2230
|
+
targetS2 = vertical ? targetRect.bottom : targetRect.right,
|
2231
|
+
invert = false;
|
2551
2232
|
if (!invertSwap) {
|
2552
2233
|
// Never invert or create dragEl shadow when target movemenet causes mouse to move past the end of regular swapThreshold
|
2553
2234
|
if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) {
|
@@ -2557,7 +2238,6 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
2557
2238
|
// past first invert threshold, do not restrict inverted threshold to dragEl shadow
|
2558
2239
|
pastFirstInvertThresh = true;
|
2559
2240
|
}
|
2560
|
-
|
2561
2241
|
if (!pastFirstInvertThresh) {
|
2562
2242
|
// dragEl shadow (target move distance shadow)
|
2563
2243
|
if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance // over dragEl shadow
|
@@ -2574,26 +2254,22 @@ function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, inv
|
|
2574
2254
|
}
|
2575
2255
|
}
|
2576
2256
|
}
|
2577
|
-
|
2578
2257
|
invert = invert || invertSwap;
|
2579
|
-
|
2580
2258
|
if (invert) {
|
2581
2259
|
// Invert of regular
|
2582
2260
|
if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) {
|
2583
2261
|
return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1;
|
2584
2262
|
}
|
2585
2263
|
}
|
2586
|
-
|
2587
2264
|
return 0;
|
2588
2265
|
}
|
2266
|
+
|
2589
2267
|
/**
|
2590
2268
|
* Gets the direction dragEl must be swapped relative to target in order to make it
|
2591
2269
|
* seem that dragEl has been "inserted" into that element's position
|
2592
2270
|
* @param {HTMLElement} target The target whose position dragEl is being inserted at
|
2593
2271
|
* @return {Number} Direction dragEl must be swapped
|
2594
2272
|
*/
|
2595
|
-
|
2596
|
-
|
2597
2273
|
function _getInsertDirection(target) {
|
2598
2274
|
if (index(dragEl) < index(target)) {
|
2599
2275
|
return 1;
|
@@ -2601,55 +2277,48 @@ function _getInsertDirection(target) {
|
|
2601
2277
|
return -1;
|
2602
2278
|
}
|
2603
2279
|
}
|
2280
|
+
|
2604
2281
|
/**
|
2605
2282
|
* Generate id
|
2606
2283
|
* @param {HTMLElement} el
|
2607
2284
|
* @returns {String}
|
2608
2285
|
* @private
|
2609
2286
|
*/
|
2610
|
-
|
2611
|
-
|
2612
2287
|
function _generateId(el) {
|
2613
2288
|
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2289
|
+
i = str.length,
|
2290
|
+
sum = 0;
|
2617
2291
|
while (i--) {
|
2618
2292
|
sum += str.charCodeAt(i);
|
2619
2293
|
}
|
2620
|
-
|
2621
2294
|
return sum.toString(36);
|
2622
2295
|
}
|
2623
|
-
|
2624
2296
|
function _saveInputCheckedState(root) {
|
2625
2297
|
savedInputChecked.length = 0;
|
2626
2298
|
var inputs = root.getElementsByTagName('input');
|
2627
2299
|
var idx = inputs.length;
|
2628
|
-
|
2629
2300
|
while (idx--) {
|
2630
2301
|
var el = inputs[idx];
|
2631
2302
|
el.checked && savedInputChecked.push(el);
|
2632
2303
|
}
|
2633
2304
|
}
|
2634
|
-
|
2635
2305
|
function _nextTick(fn) {
|
2636
2306
|
return setTimeout(fn, 0);
|
2637
2307
|
}
|
2638
|
-
|
2639
2308
|
function _cancelNextTick(id) {
|
2640
2309
|
return clearTimeout(id);
|
2641
|
-
}
|
2642
|
-
|
2310
|
+
}
|
2643
2311
|
|
2312
|
+
// Fixed #973:
|
2644
2313
|
if (documentExists) {
|
2645
2314
|
on(document, 'touchmove', function (evt) {
|
2646
2315
|
if ((Sortable.active || awaitingDragStarted) && evt.cancelable) {
|
2647
2316
|
evt.preventDefault();
|
2648
2317
|
}
|
2649
2318
|
});
|
2650
|
-
}
|
2651
|
-
|
2319
|
+
}
|
2652
2320
|
|
2321
|
+
// Export utils
|
2653
2322
|
Sortable.utils = {
|
2654
2323
|
on: on,
|
2655
2324
|
off: off,
|
@@ -2669,59 +2338,54 @@ Sortable.utils = {
|
|
2669
2338
|
detectDirection: _detectDirection,
|
2670
2339
|
getChild: getChild
|
2671
2340
|
};
|
2341
|
+
|
2672
2342
|
/**
|
2673
2343
|
* Get the Sortable instance of an element
|
2674
2344
|
* @param {HTMLElement} element The element
|
2675
2345
|
* @return {Sortable|undefined} The instance of Sortable
|
2676
2346
|
*/
|
2677
|
-
|
2678
2347
|
Sortable.get = function (element) {
|
2679
2348
|
return element[expando];
|
2680
2349
|
};
|
2350
|
+
|
2681
2351
|
/**
|
2682
2352
|
* Mount a plugin to Sortable
|
2683
2353
|
* @param {...SortablePlugin|SortablePlugin[]} plugins Plugins being mounted
|
2684
2354
|
*/
|
2685
|
-
|
2686
|
-
|
2687
2355
|
Sortable.mount = function () {
|
2688
2356
|
for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
|
2689
2357
|
plugins[_key] = arguments[_key];
|
2690
2358
|
}
|
2691
|
-
|
2692
2359
|
if (plugins[0].constructor === Array) plugins = plugins[0];
|
2693
2360
|
plugins.forEach(function (plugin) {
|
2694
2361
|
if (!plugin.prototype || !plugin.prototype.constructor) {
|
2695
2362
|
throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin));
|
2696
2363
|
}
|
2697
|
-
|
2698
2364
|
if (plugin.utils) Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils);
|
2699
2365
|
PluginManager.mount(plugin);
|
2700
2366
|
});
|
2701
2367
|
};
|
2368
|
+
|
2702
2369
|
/**
|
2703
2370
|
* Create sortable instance
|
2704
2371
|
* @param {HTMLElement} el
|
2705
2372
|
* @param {Object} [options]
|
2706
2373
|
*/
|
2707
|
-
|
2708
|
-
|
2709
2374
|
Sortable.create = function (el, options) {
|
2710
2375
|
return new Sortable(el, options);
|
2711
|
-
};
|
2712
|
-
|
2376
|
+
};
|
2713
2377
|
|
2378
|
+
// Export
|
2714
2379
|
Sortable.version = version;
|
2715
2380
|
|
2716
2381
|
var autoScrolls = [],
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2382
|
+
scrollEl,
|
2383
|
+
scrollRootEl,
|
2384
|
+
scrolling = false,
|
2385
|
+
lastAutoScrollX,
|
2386
|
+
lastAutoScrollY,
|
2387
|
+
touchEvt$1,
|
2388
|
+
pointerElemChangedInterval;
|
2725
2389
|
function AutoScrollPlugin() {
|
2726
2390
|
function AutoScroll() {
|
2727
2391
|
this.defaults = {
|
@@ -2730,19 +2394,18 @@ function AutoScrollPlugin() {
|
|
2730
2394
|
scrollSensitivity: 30,
|
2731
2395
|
scrollSpeed: 10,
|
2732
2396
|
bubbleScroll: true
|
2733
|
-
};
|
2397
|
+
};
|
2734
2398
|
|
2399
|
+
// Bind all private methods
|
2735
2400
|
for (var fn in this) {
|
2736
2401
|
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
2737
2402
|
this[fn] = this[fn].bind(this);
|
2738
2403
|
}
|
2739
2404
|
}
|
2740
2405
|
}
|
2741
|
-
|
2742
2406
|
AutoScroll.prototype = {
|
2743
2407
|
dragStarted: function dragStarted(_ref) {
|
2744
2408
|
var originalEvent = _ref.originalEvent;
|
2745
|
-
|
2746
2409
|
if (this.sortable.nativeDraggable) {
|
2747
2410
|
on(document, 'dragover', this._handleAutoScroll);
|
2748
2411
|
} else {
|
@@ -2757,7 +2420,6 @@ function AutoScrollPlugin() {
|
|
2757
2420
|
},
|
2758
2421
|
dragOverCompleted: function dragOverCompleted(_ref2) {
|
2759
2422
|
var originalEvent = _ref2.originalEvent;
|
2760
|
-
|
2761
2423
|
// For when bubbling is canceled and using fallback (fallback 'touchmove' always reached)
|
2762
2424
|
if (!this.options.dragOverBubble && !originalEvent.rootEl) {
|
2763
2425
|
this._handleAutoScroll(originalEvent);
|
@@ -2771,7 +2433,6 @@ function AutoScrollPlugin() {
|
|
2771
2433
|
off(document, 'touchmove', this._handleFallbackAutoScroll);
|
2772
2434
|
off(document, 'mousemove', this._handleFallbackAutoScroll);
|
2773
2435
|
}
|
2774
|
-
|
2775
2436
|
clearPointerElemChangedInterval();
|
2776
2437
|
clearAutoScrolls();
|
2777
2438
|
cancelThrottle();
|
@@ -2785,31 +2446,29 @@ function AutoScrollPlugin() {
|
|
2785
2446
|
},
|
2786
2447
|
_handleAutoScroll: function _handleAutoScroll(evt, fallback) {
|
2787
2448
|
var _this = this;
|
2788
|
-
|
2789
2449
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
2790
|
-
|
2791
|
-
|
2792
|
-
touchEvt$1 = evt;
|
2450
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
2451
|
+
elem = document.elementFromPoint(x, y);
|
2452
|
+
touchEvt$1 = evt;
|
2453
|
+
|
2454
|
+
// IE does not seem to have native autoscroll,
|
2793
2455
|
// Edge's autoscroll seems too conditional,
|
2794
2456
|
// MACOS Safari does not have autoscroll,
|
2795
2457
|
// Firefox and Chrome are good
|
2796
|
-
|
2797
2458
|
if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) {
|
2798
|
-
autoScroll(evt, this.options, elem, fallback);
|
2459
|
+
autoScroll(evt, this.options, elem, fallback);
|
2799
2460
|
|
2461
|
+
// Listener for pointer element change
|
2800
2462
|
var ogElemScroller = getParentAutoScrollElement(elem, true);
|
2801
|
-
|
2802
2463
|
if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) {
|
2803
|
-
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
2804
|
-
|
2464
|
+
pointerElemChangedInterval && clearPointerElemChangedInterval();
|
2465
|
+
// Detect for pointer elem change, emulating native DnD behaviour
|
2805
2466
|
pointerElemChangedInterval = setInterval(function () {
|
2806
2467
|
var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true);
|
2807
|
-
|
2808
2468
|
if (newElem !== ogElemScroller) {
|
2809
2469
|
ogElemScroller = newElem;
|
2810
2470
|
clearAutoScrolls();
|
2811
2471
|
}
|
2812
|
-
|
2813
2472
|
autoScroll(evt, _this.options, newElem, fallback);
|
2814
2473
|
}, 10);
|
2815
2474
|
lastAutoScrollX = x;
|
@@ -2821,7 +2480,6 @@ function AutoScrollPlugin() {
|
|
2821
2480
|
clearAutoScrolls();
|
2822
2481
|
return;
|
2823
2482
|
}
|
2824
|
-
|
2825
2483
|
autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false);
|
2826
2484
|
}
|
2827
2485
|
}
|
@@ -2831,60 +2489,54 @@ function AutoScrollPlugin() {
|
|
2831
2489
|
initializeByDefault: true
|
2832
2490
|
});
|
2833
2491
|
}
|
2834
|
-
|
2835
2492
|
function clearAutoScrolls() {
|
2836
2493
|
autoScrolls.forEach(function (autoScroll) {
|
2837
2494
|
clearInterval(autoScroll.pid);
|
2838
2495
|
});
|
2839
2496
|
autoScrolls = [];
|
2840
2497
|
}
|
2841
|
-
|
2842
2498
|
function clearPointerElemChangedInterval() {
|
2843
2499
|
clearInterval(pointerElemChangedInterval);
|
2844
2500
|
}
|
2845
|
-
|
2846
2501
|
var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
|
2847
2502
|
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
|
2848
2503
|
if (!options.scroll) return;
|
2849
2504
|
var x = (evt.touches ? evt.touches[0] : evt).clientX,
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2505
|
+
y = (evt.touches ? evt.touches[0] : evt).clientY,
|
2506
|
+
sens = options.scrollSensitivity,
|
2507
|
+
speed = options.scrollSpeed,
|
2508
|
+
winScroller = getWindowScrollingElement();
|
2854
2509
|
var scrollThisInstance = false,
|
2855
|
-
|
2510
|
+
scrollCustomFn;
|
2856
2511
|
|
2512
|
+
// New scroll root, set scrollEl
|
2857
2513
|
if (scrollRootEl !== rootEl) {
|
2858
2514
|
scrollRootEl = rootEl;
|
2859
2515
|
clearAutoScrolls();
|
2860
2516
|
scrollEl = options.scroll;
|
2861
2517
|
scrollCustomFn = options.scrollFn;
|
2862
|
-
|
2863
2518
|
if (scrollEl === true) {
|
2864
2519
|
scrollEl = getParentAutoScrollElement(rootEl, true);
|
2865
2520
|
}
|
2866
2521
|
}
|
2867
|
-
|
2868
2522
|
var layersOut = 0;
|
2869
2523
|
var currentParent = scrollEl;
|
2870
|
-
|
2871
2524
|
do {
|
2872
2525
|
var el = currentParent,
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2526
|
+
rect = getRect(el),
|
2527
|
+
top = rect.top,
|
2528
|
+
bottom = rect.bottom,
|
2529
|
+
left = rect.left,
|
2530
|
+
right = rect.right,
|
2531
|
+
width = rect.width,
|
2532
|
+
height = rect.height,
|
2533
|
+
canScrollX = void 0,
|
2534
|
+
canScrollY = void 0,
|
2535
|
+
scrollWidth = el.scrollWidth,
|
2536
|
+
scrollHeight = el.scrollHeight,
|
2537
|
+
elCSS = css(el),
|
2538
|
+
scrollPosX = el.scrollLeft,
|
2539
|
+
scrollPosY = el.scrollTop;
|
2888
2540
|
if (el === winScroller) {
|
2889
2541
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll' || elCSS.overflowX === 'visible');
|
2890
2542
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll' || elCSS.overflowY === 'visible');
|
@@ -2892,10 +2544,8 @@ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
|
|
2892
2544
|
canScrollX = width < scrollWidth && (elCSS.overflowX === 'auto' || elCSS.overflowX === 'scroll');
|
2893
2545
|
canScrollY = height < scrollHeight && (elCSS.overflowY === 'auto' || elCSS.overflowY === 'scroll');
|
2894
2546
|
}
|
2895
|
-
|
2896
2547
|
var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX);
|
2897
2548
|
var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY);
|
2898
|
-
|
2899
2549
|
if (!autoScrolls[layersOut]) {
|
2900
2550
|
for (var i = 0; i <= layersOut; i++) {
|
2901
2551
|
if (!autoScrolls[i]) {
|
@@ -2903,61 +2553,51 @@ var autoScroll = throttle(function (evt, options, rootEl, isFallback) {
|
|
2903
2553
|
}
|
2904
2554
|
}
|
2905
2555
|
}
|
2906
|
-
|
2907
2556
|
if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) {
|
2908
2557
|
autoScrolls[layersOut].el = el;
|
2909
2558
|
autoScrolls[layersOut].vx = vx;
|
2910
2559
|
autoScrolls[layersOut].vy = vy;
|
2911
2560
|
clearInterval(autoScrolls[layersOut].pid);
|
2912
|
-
|
2913
2561
|
if (vx != 0 || vy != 0) {
|
2914
2562
|
scrollThisInstance = true;
|
2915
2563
|
/* jshint loopfunc:true */
|
2916
|
-
|
2917
2564
|
autoScrolls[layersOut].pid = setInterval(function () {
|
2918
2565
|
// emulate drag over during autoscroll (fallback), emulating native DnD behaviour
|
2919
2566
|
if (isFallback && this.layer === 0) {
|
2920
2567
|
Sortable.active._onTouchMove(touchEvt$1); // To move ghost if it is positioned absolutely
|
2921
|
-
|
2922
2568
|
}
|
2923
|
-
|
2924
2569
|
var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0;
|
2925
2570
|
var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0;
|
2926
|
-
|
2927
2571
|
if (typeof scrollCustomFn === 'function') {
|
2928
2572
|
if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== 'continue') {
|
2929
2573
|
return;
|
2930
2574
|
}
|
2931
2575
|
}
|
2932
|
-
|
2933
2576
|
scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY);
|
2934
2577
|
}.bind({
|
2935
2578
|
layer: layersOut
|
2936
2579
|
}), 24);
|
2937
2580
|
}
|
2938
2581
|
}
|
2939
|
-
|
2940
2582
|
layersOut++;
|
2941
2583
|
} while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false)));
|
2942
|
-
|
2943
2584
|
scrolling = scrollThisInstance; // in case another function catches scrolling as false in between when it is not
|
2944
2585
|
}, 30);
|
2945
2586
|
|
2946
2587
|
var drop = function drop(_ref) {
|
2947
2588
|
var originalEvent = _ref.originalEvent,
|
2948
|
-
|
2949
|
-
|
2950
|
-
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2589
|
+
putSortable = _ref.putSortable,
|
2590
|
+
dragEl = _ref.dragEl,
|
2591
|
+
activeSortable = _ref.activeSortable,
|
2592
|
+
dispatchSortableEvent = _ref.dispatchSortableEvent,
|
2593
|
+
hideGhostForTarget = _ref.hideGhostForTarget,
|
2594
|
+
unhideGhostForTarget = _ref.unhideGhostForTarget;
|
2954
2595
|
if (!originalEvent) return;
|
2955
2596
|
var toSortable = putSortable || activeSortable;
|
2956
2597
|
hideGhostForTarget();
|
2957
2598
|
var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent;
|
2958
2599
|
var target = document.elementFromPoint(touch.clientX, touch.clientY);
|
2959
2600
|
unhideGhostForTarget();
|
2960
|
-
|
2961
2601
|
if (toSortable && !toSortable.el.contains(target)) {
|
2962
2602
|
dispatchSortableEvent('spill');
|
2963
2603
|
this.onSpill({
|
@@ -2966,9 +2606,7 @@ var drop = function drop(_ref) {
|
|
2966
2606
|
});
|
2967
2607
|
}
|
2968
2608
|
};
|
2969
|
-
|
2970
2609
|
function Revert() {}
|
2971
|
-
|
2972
2610
|
Revert.prototype = {
|
2973
2611
|
startIndex: null,
|
2974
2612
|
dragStart: function dragStart(_ref2) {
|
@@ -2977,40 +2615,32 @@ Revert.prototype = {
|
|
2977
2615
|
},
|
2978
2616
|
onSpill: function onSpill(_ref3) {
|
2979
2617
|
var dragEl = _ref3.dragEl,
|
2980
|
-
|
2618
|
+
putSortable = _ref3.putSortable;
|
2981
2619
|
this.sortable.captureAnimationState();
|
2982
|
-
|
2983
2620
|
if (putSortable) {
|
2984
2621
|
putSortable.captureAnimationState();
|
2985
2622
|
}
|
2986
|
-
|
2987
2623
|
var nextSibling = getChild(this.sortable.el, this.startIndex, this.options);
|
2988
|
-
|
2989
2624
|
if (nextSibling) {
|
2990
2625
|
this.sortable.el.insertBefore(dragEl, nextSibling);
|
2991
2626
|
} else {
|
2992
2627
|
this.sortable.el.appendChild(dragEl);
|
2993
2628
|
}
|
2994
|
-
|
2995
2629
|
this.sortable.animateAll();
|
2996
|
-
|
2997
2630
|
if (putSortable) {
|
2998
2631
|
putSortable.animateAll();
|
2999
2632
|
}
|
3000
2633
|
},
|
3001
2634
|
drop: drop
|
3002
2635
|
};
|
3003
|
-
|
3004
2636
|
_extends(Revert, {
|
3005
2637
|
pluginName: 'revertOnSpill'
|
3006
2638
|
});
|
3007
|
-
|
3008
2639
|
function Remove() {}
|
3009
|
-
|
3010
2640
|
Remove.prototype = {
|
3011
2641
|
onSpill: function onSpill(_ref4) {
|
3012
2642
|
var dragEl = _ref4.dragEl,
|
3013
|
-
|
2643
|
+
putSortable = _ref4.putSortable;
|
3014
2644
|
var parentSortable = putSortable || this.sortable;
|
3015
2645
|
parentSortable.captureAnimationState();
|
3016
2646
|
dragEl.parentNode && dragEl.parentNode.removeChild(dragEl);
|
@@ -3018,7 +2648,6 @@ Remove.prototype = {
|
|
3018
2648
|
},
|
3019
2649
|
drop: drop
|
3020
2650
|
};
|
3021
|
-
|
3022
2651
|
_extends(Remove, {
|
3023
2652
|
pluginName: 'removeOnSpill'
|
3024
2653
|
});
|