ember-sortable 4.0.2 → 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 CHANGED
@@ -3,6 +3,27 @@
3
3
 
4
4
 
5
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
+
6
27
  ## v4.0.2 (2022-10-06)
7
28
 
8
29
  #### :bug: Bug Fix
@@ -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.direction;
67
+ return this.sortableGroup?.direction;
71
68
  }
72
69
 
73
70
  get groupDisabled() {
74
- return this.sortableGroup.disabled;
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
  /**
@@ -805,12 +802,14 @@ export default class SortableItemModifier extends Modifier {
805
802
  this.element.addEventListener('keydown', this.keyDown);
806
803
  this.element.addEventListener('mousedown', this.mouseDown);
807
804
  this.element.addEventListener('touchstart', this.touchStart);
805
+ this.listenersRegistered = true;
808
806
  }
809
807
 
810
808
  removeEventListener() {
811
809
  this.element.removeEventListener('keydown', this.keyDown);
812
810
  this.element.removeEventListener('mousedown', this.mouseDown);
813
811
  this.element.removeEventListener('touchstart', this.touchStart);
812
+ this.listenersRegistered = false;
814
813
  }
815
814
 
816
815
  setupHandleElement() {
@@ -826,6 +825,11 @@ export default class SortableItemModifier extends Modifier {
826
825
  element;
827
826
  didSetup = false;
828
827
 
828
+ /**
829
+ * tracks if event listeners have been registered. Registering event handlers is unnecessary if item is disabled.
830
+ */
831
+ listenersRegistered = false;
832
+
829
833
  constructor(owner, args) {
830
834
  super(owner, args);
831
835
  registerDestructor(this, cleanup);
@@ -842,11 +846,16 @@ export default class SortableItemModifier extends Modifier {
842
846
  this.setupHandleElement();
843
847
 
844
848
  if (!this.didSetup) {
845
- this.addEventListener();
846
849
  this.element.dataset.sortableItem = true;
847
850
  this.sortableService.registerItem(this.groupName, this);
848
851
  this.didSetup = true;
849
852
  }
853
+
854
+ if (this.named.disabled && this.listenersRegistered) {
855
+ this.removeEventListener();
856
+ } else if (!this.named.disabled && !this.listenersRegistered) {
857
+ this.addEventListener();
858
+ }
850
859
  }
851
860
  }
852
861
 
@@ -1,26 +1,5 @@
1
1
  'use strict';
2
2
 
3
- module.exports = function (environment) {
4
- const ENV = {
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.2",
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-cli-htmlbars": "^6.0.1",
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",