inviton-powerduck 0.0.159 → 0.0.160

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.
@@ -0,0 +1,77 @@
1
+ .pd-dropdown-open-animation {
2
+ animation: pdInputShowAnimationIn 180ms cubic-bezier(.2, .8, .2, 1);
3
+ transform-origin: top center;
4
+ }
5
+
6
+ .pd-dropdown-open-animation-above {
7
+ animation: pdInputShowAnimationInAbove 180ms cubic-bezier(.2, .8, .2, 1);
8
+ transform-origin: bottom center;
9
+ }
10
+
11
+ .pd-dropdown-close-animation {
12
+ animation: pdInputHideAnimationInAbove 160ms cubic-bezier(.4, .2, .2, 1);
13
+ transform-origin: top center;
14
+ }
15
+
16
+ .pd-dropdown-close-animation-above {
17
+ animation: pdInputHideAnimationInAboveAbove 160ms cubic-bezier(.4, .2, .2, 1);
18
+ transform-origin: bottom center;
19
+ }
20
+
21
+
22
+ @keyframes pdInputShowAnimationIn {
23
+ 0% {
24
+ opacity: 0;
25
+ transform: translateY(-6px) scale(.95);
26
+ }
27
+
28
+ 100% {
29
+ opacity: 1;
30
+ transform: translateY(0) scale(1);
31
+ }
32
+ }
33
+
34
+ @keyframes pdInputShowAnimationInAbove {
35
+ 0% {
36
+ opacity: 0;
37
+ transform: translateY(6px) scale(.95);
38
+ }
39
+
40
+ 100% {
41
+ opacity: 1;
42
+ transform: translateY(0) scale(1);
43
+ }
44
+ }
45
+
46
+ @keyframes pdInputHideAnimationInAbove {
47
+ 0% {
48
+ opacity: 1;
49
+ transform: translateY(0) scale(1);
50
+ }
51
+
52
+ 100% {
53
+ opacity: 0;
54
+ transform: translateY(-6px) scale(.96);
55
+ }
56
+ }
57
+
58
+ @keyframes pdInputHideAnimationInAboveAbove {
59
+ 0% {
60
+ opacity: 1;
61
+ transform: translateY(0) scale(1);
62
+ }
63
+
64
+ 100% {
65
+ opacity: 0;
66
+ transform: translateY(6px) scale(.96);
67
+ }
68
+ }
69
+
70
+
71
+ @media (prefers-reduced-motion: reduce) {
72
+
73
+ .pd-dropdown-open-animation,
74
+ .pd-dropdown-open-animation-above-above {
75
+ animation: none;
76
+ }
77
+ }
@@ -14,6 +14,7 @@ import FilterableSelect from './mobile/legacy_fdd';
14
14
  import 'select2';
15
15
  import './ts/select2-multi-checkboxes';
16
16
  import 'select2/dist/css/select2.css';
17
+ import './../../app/css/input-effects.css';
17
18
  import './css/dropdown.css';
18
19
  import { capitalize } from '../../common/extensions/string-extensions';
19
20
 
@@ -447,10 +448,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
447
448
  const self = this;
448
449
  return (row) => {
449
450
  const retVal = $(`<span class="s2-ri-withtb">${row.text
450
- }<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
451
- } btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
452
- }${self.trailingButton.text || ''
453
- }</button></span>`);
451
+ }<button class="s2-trailing-button ${self.trailingButton.cssClass || ''
452
+ } btn-sm">${self.trailingButton.icon != null ? `<i class="${self.trailingButton.icon}"></i> ` : ''
453
+ }${self.trailingButton.text || ''
454
+ }</button></span>`);
454
455
  retVal.find('button').click((e) => {
455
456
  try {
456
457
  clearTimeout(self.preventDefaultTimeout);
@@ -541,10 +542,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
541
542
  useListviewBuilder: false,
542
543
  formatSelection: this.customRenderSelectionResult != null
543
544
  ? this.handleCustomRenderResult(
544
- h,
545
- this.customRenderSelectionResult,
546
- 'mobile',
547
- )
545
+ h,
546
+ this.customRenderSelectionResult,
547
+ 'mobile',
548
+ )
548
549
  : null,
549
550
  formatResult: this.getCustomFormatOptions(h, 'mobile'),
550
551
  onItemSelected: (items, exclusivity) => {
@@ -759,6 +760,21 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
759
760
  s2Elem
760
761
  .attr('data-vebound', 'true')
761
762
  .on('select2:close', () => {
763
+ const $container = DropdownSelect2Helper.getSelect2Instance(this.getSelect2RootElement()).$dropdown;
764
+ $container.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above');
765
+ $container[0].offsetWidth;
766
+
767
+ if ($container.hasClass('select2-container--above')) {
768
+ $container.addClass('pd-dropdown-close-animation-above');
769
+ } else {
770
+ $container.addClass('pd-dropdown-close-animation');
771
+ }
772
+
773
+ $container.one('animationend', function () {
774
+ $container.removeClass('pd-dropdown-close-animation pd-dropdown-close-animation-above');
775
+ });
776
+
777
+
762
778
  if (self.pendingChange != null) {
763
779
  const data = self.pendingChange?.data;
764
780
  self.pendingChange = null;
@@ -772,6 +788,17 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
772
788
  e.stopPropagation();
773
789
  }
774
790
  })
791
+ .on('select2:open', () => {
792
+ const $container = DropdownSelect2Helper.getSelect2Instance(this.getSelect2RootElement()).$dropdown;
793
+ $container.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
794
+ $container[0].offsetWidth; // reflow
795
+
796
+ if ($container.hasClass('select2-container--above')) {
797
+ $container.addClass('pd-dropdown-open-animation-above');
798
+ } else {
799
+ $container.addClass('pd-dropdown-open-animation');
800
+ }
801
+ })
775
802
  .on('select2:unselect', (e) => {
776
803
  (self as any).preventOpen = true;
777
804
  setTimeout(() => {
@@ -1069,11 +1069,15 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1069
1069
  });
1070
1070
  });
1071
1071
  } else {
1072
- box[isModalDisplayMode() ? 'fadeIn' : 'slideDown'](animationTime, () => {
1073
- $(self).trigger('datepicker-opened', {
1074
- relatedTarget: box,
1075
- });
1076
- });
1072
+ box.show();
1073
+ box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above');
1074
+ box[0].offsetWidth; // reflow
1075
+
1076
+ if (box.hasClass('select2-container--above')) {
1077
+ box.addClass('pd-dropdown-open-animation-above');
1078
+ } else {
1079
+ box.addClass('pd-dropdown-open-animation');
1080
+ }
1077
1081
  }
1078
1082
 
1079
1083
  $(self).trigger('datepicker-open', {
@@ -1932,7 +1936,9 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1932
1936
  }
1933
1937
 
1934
1938
  function closeDatePicker(): void {
1935
- if (opt.alwaysOpen) { return; }
1939
+ if (opt.alwaysOpen) {
1940
+ return;
1941
+ }
1936
1942
 
1937
1943
  const afterAnim = function () {
1938
1944
  $(self).data('date-picker-opened', false);
@@ -1943,7 +1949,14 @@ import { utcEpochMilliseconds } from '../../../../common/extensions/temporal-ext
1943
1949
  if (opt.customCloseAnimation) {
1944
1950
  opt.customCloseAnimation.call(box.get(0), afterAnim);
1945
1951
  } else {
1946
- $(box)[isModalDisplayMode() ? 'fadeOut' : 'slideUp'](opt.duration, afterAnim);
1952
+ box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
1953
+ box[0].offsetWidth; // reflow
1954
+ box.addClass('pd-dropdown-close-animation');
1955
+
1956
+ box.one('animationend', function () {
1957
+ box.hide();
1958
+ box.removeClass('pd-dropdown-open-animation pd-dropdown-open-animation-above pd-dropdown-close-animation pd-dropdown-close-animation-above');
1959
+ });
1947
1960
  }
1948
1961
 
1949
1962
  $(self).trigger('datepicker-close', {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.159",
4
+ "version": "0.0.160",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",