inviton-powerduck 0.0.187 → 0.0.189

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.
@@ -84,7 +84,7 @@
84
84
  width: 100%;
85
85
  }
86
86
 
87
- .input-group > .s2-fw-root {
87
+ .input-group>.s2-fw-root {
88
88
  position: relative;
89
89
  -ms-flex: 1 1 auto;
90
90
  flex: 1 1 auto;
@@ -92,19 +92,14 @@
92
92
  margin-bottom: 0;
93
93
  }
94
94
 
95
- .s2-fw-root.s2-append-icon
96
- .select2.select2-container.select2-container--default
97
- > .selection
98
- > .select2-selection--single,
99
- .s2-fw-root.s2-append-icon.select2.select2-container.select2-container--default
100
- > .selection
101
- > .select2-selection--single {
95
+ .s2-fw-root.s2-append-icon .select2.select2-container.select2-container--default>.selection>.select2-selection--single,
96
+ .s2-fw-root.s2-append-icon.select2.select2-container.select2-container--default>.selection>.select2-selection--single {
102
97
  border-bottom-right-radius: 0;
103
98
  border-top-right-radius: 0;
104
99
  border-right: 0;
105
100
  }
106
101
 
107
- .select2-container.select2-container--default.select2-container--open > .select2-dropdown {
102
+ .select2-container.select2-container--default.select2-container--open>.select2-dropdown {
108
103
  border-color: #8a8a8a;
109
104
  border-top: 1px solid #8a8a8a;
110
105
  -webkit-box-shadow:
@@ -126,11 +121,18 @@
126
121
  font-size: 16px;
127
122
  }
128
123
 
129
- .ddl-mobile-placeholder {
124
+ .ddl-mobile-placeholder {}
125
+
126
+ .dropdownlist-inline-mode .s2-fw-root>.select2-container,
127
+ .dropdownlist-inline-mode .s2-fw-root>.select2-container>.select2-dropdown {
128
+ display: block !important;
129
+ position: static !important;
130
+ top: 0 !important;
131
+ left: 0 !important;
130
132
  }
131
133
 
132
134
  .imgddl-result-remove.imgddl-result-button.select2-selection__choice__remove,
133
- .imgddl-selected-item .imgddl-dropdown-resultroot .imgddl-dropdown-resultwrap > .imgddl-result-button {
135
+ .imgddl-selected-item .imgddl-dropdown-resultroot .imgddl-dropdown-resultwrap>.imgddl-result-button {
134
136
  color: #eaeaea;
135
137
  cursor: pointer;
136
138
  font-weight: bold;
@@ -144,4 +146,4 @@
144
146
  display: inline-block;
145
147
  vertical-align: top;
146
148
  padding-top: 1px;
147
- }
149
+ }
@@ -65,6 +65,7 @@ interface DropdownListArgs extends FormItemWrapperArgs {
65
65
  containerCssClass?: string;
66
66
  options: Array<string> | Array<DropdownOptionGroup> | Array<any>;
67
67
  selected: string | any | Array<string> | Array<any>;
68
+ displayMode?: 'default' | 'inline';
68
69
  displayMember?: string | RowToString;
69
70
  valueMember?: string | RowToString;
70
71
  multiselect?: boolean;
@@ -143,6 +144,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
143
144
  @Prop() displayMember!: (row) => string | string;
144
145
  @Prop() valueMember!: (row) => string | string;
145
146
  @Prop() selected!: string | any | Array<string> | Array<any>;
147
+ @Prop() displayMode?: 'default' | 'inline';
146
148
  @Prop() changed: (newValue: string | any | Array<string> | Array<any>, exclusivity?: MultiSelectExclusivity) => void;
147
149
  @Prop() afterBound: (elem: JQuery<Element>, select2Instance: any) => void;
148
150
  @Prop() maxWidth?: number;
@@ -380,13 +382,17 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
380
382
 
381
383
  render(h) {
382
384
  // Dummy stuff to ensure reactivity
383
- let dummyCss: string = '';
385
+ let cssBuilder: string = '';
384
386
  if (this.selected != null) {
385
- dummyCss += `ddl-dummy-selected${this.selected.toString().substring(0, 1)}`;
387
+ cssBuilder += `ddl-dummy-selected${this.selected.toString().substring(0, 1)}`;
388
+ }
389
+
390
+ if (this.displayInline()) {
391
+ cssBuilder += ` dropdownlist-inline-mode `;
386
392
  }
387
393
 
388
394
  if (this.options != null) {
389
- dummyCss += 'opts';
395
+ cssBuilder += 'opts';
390
396
  }
391
397
 
392
398
  return (
@@ -402,7 +408,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
402
408
  marginType={this.marginType}
403
409
  maxWidth={this.maxWidth}
404
410
  validationState={this.validationState}
405
- cssClass={dummyCss}
411
+ cssClass={cssBuilder}
406
412
  subtitle={this.subtitle}
407
413
  labelButtons={this.labelButtons}
408
414
  appendIconClicked={this.appendIconClicked}
@@ -624,6 +630,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
624
630
  }
625
631
 
626
632
  useMobile() {
633
+ if (this.displayInline()) {
634
+ return false;
635
+ }
636
+
627
637
  return PortalUtils.treatAsMobileDevice() && !this.tags && !PortalUtils.isInIframe();
628
638
  }
629
639
 
@@ -749,6 +759,14 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
749
759
  }
750
760
  }
751
761
 
762
+ displayInline(): boolean {
763
+ if (this.displayMode == null || this.displayMode == 'default') {
764
+ return false;
765
+ }
766
+
767
+ return true;
768
+ }
769
+
752
770
  updateSelect2() {
753
771
  if (this.useSelect2()) {
754
772
  const self = this;
@@ -756,6 +774,7 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
756
774
  const s2Constructor: 'select2MultiCheckboxes' | 'select2' = this.useMultiCheckboxes() ? 'select2MultiCheckboxes' : 'select2';
757
775
  const selected = this.getSelectedItems();
758
776
  const s2Elem = this.getSelect2RootElement();
777
+ const isInline = this.displayInline();
759
778
  let alreadyBound = true;
760
779
 
761
780
  if (this.disabled == true) {
@@ -824,6 +843,11 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
824
843
  }
825
844
  })
826
845
  .on('select2:closing', (e) => {
846
+ if (isInline) {
847
+ e.preventDefault();
848
+ return;
849
+ }
850
+
827
851
  if (self.trailingButton) {
828
852
  if (self.preventDefaultTrigger == false) {
829
853
  self.preventDefaultTrigger = null;
@@ -922,7 +946,8 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
922
946
  const s2Args: any = {
923
947
  allowExclusiveSearch: this.allowExclusiveSearch == true,
924
948
  minimumResultsForSearch: this.disableSearch == true ? -1 : 0,
925
- closeOnSelect: this.closeOnSelect != false && !this.useMultiCheckboxes(),
949
+ dropdownParent: isInline ? s2Elem.parent() : undefined,
950
+ closeOnSelect: isInline ? false : (this.closeOnSelect != false && !this.useMultiCheckboxes()),
926
951
  placeholder: this.placeholder,
927
952
  selectionCssClass: ':all:',
928
953
  allowClear: this.placeholder != null && this.placeholder.length > 0,
@@ -1273,6 +1298,24 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
1273
1298
  this.bindSelect2TagsButton(DropdownSelect2Helper.getSelect2Instance(s2Elem));
1274
1299
  }
1275
1300
  }
1301
+
1302
+ if (isInline) {
1303
+ instance.dropdown._attachPositioningHandler = () => { };
1304
+ instance.results.ensureHighlightVisible = () => { };
1305
+
1306
+ const oldTrigger = instance.dropdown.$search.trigger;
1307
+ instance.dropdown.$search.trigger = (ev: string) => {
1308
+ if (ev == 'focus') {
1309
+ return;
1310
+ }
1311
+
1312
+ oldTrigger.call(instance.dropdown.$search, ev);
1313
+ };
1314
+
1315
+ setTimeout(() => {
1316
+ instance.open();
1317
+ }, 0);
1318
+ }
1276
1319
  }
1277
1320
 
1278
1321
  DropdownSelect2Helper.getSelect2Instance(s2Elem).dataAccessor.getData = () => opts;
@@ -127,6 +127,7 @@ import { PortalUtils } from '../../../common/utils/utils';
127
127
  },
128
128
  },
129
129
  language: options.language,
130
+ dropdownParent: options.dropdownParent,
130
131
  dropdownAutoWidth: options.dropdownAutoWidth == true,
131
132
  minimumResultsForSearch: options.minimumResultsForSearch,
132
133
  placeholder: options.placeholder,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.187",
4
+ "version": "0.0.189",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",