ember-sortable 4.0.1 → 4.0.3
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/CHANGELOG.md +30 -0
- package/addon/modifiers/sortable-item.js +30 -15
- package/config/environment.js +2 -23
- package/package.json +5 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
## v4.0.3 (2022-10-14)
|
|
8
|
+
|
|
9
|
+
#### :bug: Bug Fix
|
|
10
|
+
* [#485](https://github.com/adopted-ember-addons/ember-sortable/pull/485) when item is disabled, do not add event listeners ([@st-h](https://github.com/st-h))
|
|
11
|
+
* [#472](https://github.com/adopted-ember-addons/ember-sortable/pull/472) sortableGroup may be undefined ([@NullVoxPopuli](https://github.com/NullVoxPopuli))
|
|
12
|
+
|
|
13
|
+
#### :house: Internal
|
|
14
|
+
* [#490](https://github.com/adopted-ember-addons/ember-sortable/pull/490) Bump parse-url from 6.0.0 to 6.0.5 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
|
15
|
+
* [#491](https://github.com/adopted-ember-addons/ember-sortable/pull/491) Bump vm2 from 3.9.9 to 3.9.11 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
|
16
|
+
* [#496](https://github.com/adopted-ember-addons/ember-sortable/pull/496) Bump terser from 5.13.1 to 5.15.1 ([@dependabot[bot]](https://github.com/apps/dependabot))
|
|
17
|
+
* [#494](https://github.com/adopted-ember-addons/ember-sortable/pull/494) Move test config to the dummy app ([@Windvis](https://github.com/Windvis))
|
|
18
|
+
* [#495](https://github.com/adopted-ember-addons/ember-sortable/pull/495) Use the `isTesting` macro ([@Windvis](https://github.com/Windvis))
|
|
19
|
+
* [#488](https://github.com/adopted-ember-addons/ember-sortable/pull/488) Remove unused dependencies ([@bertdeblock](https://github.com/bertdeblock))
|
|
20
|
+
|
|
21
|
+
#### Committers: 4
|
|
22
|
+
- Bert De Block ([@bertdeblock](https://github.com/bertdeblock))
|
|
23
|
+
- Sam Van Campenhout ([@Windvis](https://github.com/Windvis))
|
|
24
|
+
- Steve ([@st-h](https://github.com/st-h))
|
|
25
|
+
- [@NullVoxPopuli](https://github.com/NullVoxPopuli)
|
|
26
|
+
|
|
27
|
+
## v4.0.2 (2022-10-06)
|
|
28
|
+
|
|
29
|
+
#### :bug: Bug Fix
|
|
30
|
+
* [#493](https://github.com/adopted-ember-addons/ember-sortable/pull/493) fix: Handle element in sortable item should be the most recent ([@nicolechung](https://github.com/nicolechung))
|
|
31
|
+
|
|
32
|
+
#### Committers: 1
|
|
33
|
+
- nicole chung ([@nicolechung](https://github.com/nicolechung))
|
|
34
|
+
|
|
5
35
|
## v4.0.1 (2022-10-03)
|
|
6
36
|
|
|
7
37
|
#### :memo: Documentation
|
|
@@ -12,11 +12,8 @@ import { getBorderSpacing } from '../utils/css-calculation';
|
|
|
12
12
|
import { buildWaiter } from '@ember/test-waiters';
|
|
13
13
|
import { inject as service } from '@ember/service';
|
|
14
14
|
import { assert, deprecate } from '@ember/debug';
|
|
15
|
-
import config from 'ember-get-config';
|
|
16
15
|
import { registerDestructor } from '@ember/destroyable';
|
|
17
|
-
|
|
18
|
-
const { environment } = config;
|
|
19
|
-
const isTesting = environment === 'test';
|
|
16
|
+
import { isTesting } from '@embroider/macros';
|
|
20
17
|
|
|
21
18
|
const sortableItemWaiter = buildWaiter('sortable-item-waiter');
|
|
22
19
|
|
|
@@ -67,11 +64,11 @@ export default class SortableItemModifier extends Modifier {
|
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
get direction() {
|
|
70
|
-
return this.sortableGroup
|
|
67
|
+
return this.sortableGroup?.direction;
|
|
71
68
|
}
|
|
72
69
|
|
|
73
70
|
get groupDisabled() {
|
|
74
|
-
return this.sortableGroup
|
|
71
|
+
return this.sortableGroup?.disabled;
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
/**
|
|
@@ -244,7 +241,7 @@ export default class SortableItemModifier extends Modifier {
|
|
|
244
241
|
@property disableCheckScrollBounds
|
|
245
242
|
*/
|
|
246
243
|
get disableCheckScrollBounds() {
|
|
247
|
-
return this.named.disableCheckScrollBounds != undefined ? this.named.disableCheckScrollBounds : isTesting;
|
|
244
|
+
return this.named.disableCheckScrollBounds != undefined ? this.named.disableCheckScrollBounds : isTesting();
|
|
248
245
|
}
|
|
249
246
|
|
|
250
247
|
/**
|
|
@@ -268,6 +265,8 @@ export default class SortableItemModifier extends Modifier {
|
|
|
268
265
|
return;
|
|
269
266
|
}
|
|
270
267
|
|
|
268
|
+
this.setupHandleElement();
|
|
269
|
+
|
|
271
270
|
// If the event is coming from within the item, we do not want to activate keyboard reorder mode.
|
|
272
271
|
if (event.target === this.handleElement || event.target === this.element) {
|
|
273
272
|
this.sortableGroup.activateKeyDown(this);
|
|
@@ -803,17 +802,34 @@ export default class SortableItemModifier extends Modifier {
|
|
|
803
802
|
this.element.addEventListener('keydown', this.keyDown);
|
|
804
803
|
this.element.addEventListener('mousedown', this.mouseDown);
|
|
805
804
|
this.element.addEventListener('touchstart', this.touchStart);
|
|
805
|
+
this.listenersRegistered = true;
|
|
806
806
|
}
|
|
807
807
|
|
|
808
808
|
removeEventListener() {
|
|
809
809
|
this.element.removeEventListener('keydown', this.keyDown);
|
|
810
810
|
this.element.removeEventListener('mousedown', this.mouseDown);
|
|
811
811
|
this.element.removeEventListener('touchstart', this.touchStart);
|
|
812
|
+
this.listenersRegistered = false;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
setupHandleElement() {
|
|
816
|
+
this.handleElement = this.element.querySelector(this.handle);
|
|
817
|
+
|
|
818
|
+
if (this.handleElement) {
|
|
819
|
+
this.handleElement.style['touch-action'] = 'none';
|
|
820
|
+
} else {
|
|
821
|
+
this.element.style['touch-action'] = 'none';
|
|
822
|
+
}
|
|
812
823
|
}
|
|
813
824
|
|
|
814
825
|
element;
|
|
815
826
|
didSetup = false;
|
|
816
827
|
|
|
828
|
+
/**
|
|
829
|
+
* tracks if event listeners have been registered. Registering event handlers is unnecessary if item is disabled.
|
|
830
|
+
*/
|
|
831
|
+
listenersRegistered = false;
|
|
832
|
+
|
|
817
833
|
constructor(owner, args) {
|
|
818
834
|
super(owner, args);
|
|
819
835
|
registerDestructor(this, cleanup);
|
|
@@ -827,20 +843,19 @@ export default class SortableItemModifier extends Modifier {
|
|
|
827
843
|
|
|
828
844
|
// Instead of using `event.preventDefault()` in the 'primeDrag' event,
|
|
829
845
|
// (doesn't work in Chrome 56), we set touch-action: none as a workaround.
|
|
830
|
-
this.
|
|
831
|
-
|
|
832
|
-
if (this.handleElement) {
|
|
833
|
-
this.handleElement.style['touch-action'] = 'none';
|
|
834
|
-
} else {
|
|
835
|
-
this.element.style['touch-action'] = 'none';
|
|
836
|
-
}
|
|
846
|
+
this.setupHandleElement();
|
|
837
847
|
|
|
838
848
|
if (!this.didSetup) {
|
|
839
|
-
this.addEventListener();
|
|
840
849
|
this.element.dataset.sortableItem = true;
|
|
841
850
|
this.sortableService.registerItem(this.groupName, this);
|
|
842
851
|
this.didSetup = true;
|
|
843
852
|
}
|
|
853
|
+
|
|
854
|
+
if (this.named.disabled && this.listenersRegistered) {
|
|
855
|
+
this.removeEventListener();
|
|
856
|
+
} else if (!this.named.disabled && !this.listenersRegistered) {
|
|
857
|
+
this.addEventListener();
|
|
858
|
+
}
|
|
844
859
|
}
|
|
845
860
|
}
|
|
846
861
|
|
package/config/environment.js
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
module.exports = function (environment) {
|
|
4
|
-
|
|
5
|
-
environment,
|
|
6
|
-
|
|
7
|
-
'ember-a11y-testing': {
|
|
8
|
-
componentOptions: {
|
|
9
|
-
turnAuditOff: true,
|
|
10
|
-
excludeAxeCore: true,
|
|
11
|
-
axeOptions: {
|
|
12
|
-
iframes: false,
|
|
13
|
-
reporter: 'v2',
|
|
14
|
-
resultTypes: ['violations'],
|
|
15
|
-
rules: {
|
|
16
|
-
'duplicate-id': { enabled: false },
|
|
17
|
-
'duplicate-id-active': { enabled: false },
|
|
18
|
-
'duplicate-id-aria': { enabled: false },
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return ENV;
|
|
3
|
+
module.exports = function (/* environment, appConfig */) {
|
|
4
|
+
return {};
|
|
26
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-sortable",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Sortable UI primitives for Ember.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -24,14 +24,10 @@
|
|
|
24
24
|
"release": "release-it"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ember/render-modifiers": "^1.0.2 || ^2.0.0",
|
|
28
27
|
"@ember/test-waiters": "^3.0.1",
|
|
28
|
+
"@embroider/macros": "^1.9.0",
|
|
29
29
|
"ember-cli-babel": "^7.26.11",
|
|
30
|
-
"ember-
|
|
31
|
-
"ember-cli-version-checker": "^5.1.2",
|
|
32
|
-
"ember-get-config": "^2.0.0",
|
|
33
|
-
"ember-modifier": "^3.2.0",
|
|
34
|
-
"ember-test-selectors": "^6.0.0"
|
|
30
|
+
"ember-modifier": "^3.2.0"
|
|
35
31
|
},
|
|
36
32
|
"devDependencies": {
|
|
37
33
|
"@ember/optional-features": "^2.0.0",
|
|
@@ -45,6 +41,7 @@
|
|
|
45
41
|
"ember-auto-import": "^2.4.0",
|
|
46
42
|
"ember-cli": "^4.2.0",
|
|
47
43
|
"ember-cli-dependency-checker": "^3.0.0",
|
|
44
|
+
"ember-cli-htmlbars": "^6.0.1",
|
|
48
45
|
"ember-cli-inject-live-reload": "^2.0.0",
|
|
49
46
|
"ember-cli-sri": "^2.1.1",
|
|
50
47
|
"ember-cli-terser": "^4.0.2",
|
|
@@ -56,6 +53,7 @@
|
|
|
56
53
|
"ember-source": "^4.2.0",
|
|
57
54
|
"ember-source-channel-url": "^3.0.0",
|
|
58
55
|
"ember-template-lint": "^4.2.0",
|
|
56
|
+
"ember-test-selectors": "^6.0.0",
|
|
59
57
|
"ember-try": "^2.0.0",
|
|
60
58
|
"eslint": "^7.32.0",
|
|
61
59
|
"eslint-config-prettier": "^8.4.0",
|