inviton-powerduck 0.0.120 → 0.0.121

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,12 @@
1
+ export default class LocationUtils {
2
+ static getCurrentLocation (): Promise<GeolocationPosition> {
3
+ return new Promise((resolve, reject) => {
4
+ if (!navigator.geolocation) {
5
+ reject(new Error('Geolocation is not supported.'));
6
+ return;
7
+ }
8
+
9
+ navigator.geolocation.getCurrentPosition(resolve, reject);
10
+ });
11
+ }
12
+ }
@@ -45,6 +45,11 @@ import Modal, { ModalSize } from '../modal/modal';
45
45
  import ModalBody from '../modal/modal-body';
46
46
  import ModalFooter from '../modal/modal-footer';
47
47
 
48
+ interface TagItem {
49
+ id: string;
50
+ text: string;
51
+ }
52
+
48
53
  @Component
49
54
  class TestAllComponentsPageComponent extends PowerduckViewModelBase {
50
55
  name: string = null; // Needs to have =null suffixed so that TS compiler takes it into account
@@ -55,6 +60,8 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
55
60
  blockModal: boolean = false;
56
61
  color: string = '#FF00FF';
57
62
  numberVal: number = 1;
63
+ tags: TagItem[] = [];
64
+ selectedTagIds: string[] = [];
58
65
 
59
66
  protected get breadcrumbItems(): BreadcrumbItem[] {
60
67
  return [
@@ -128,6 +135,19 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
128
135
  });
129
136
  }
130
137
 
138
+ getTagDropdown(): typeof DropdownList.prototype {
139
+ return this.$refs.tagsDropdown as typeof DropdownList.prototype;
140
+ }
141
+
142
+ fireChangedEvent(e: string[]) {
143
+ this.$nextTick(() => {
144
+ this.getTagDropdown().close();
145
+ this.$nextTick(() => {
146
+ this.selectedTagIds = e;
147
+ });
148
+ });
149
+ }
150
+
131
151
  render(h) {
132
152
  return (
133
153
  <div>
@@ -292,11 +312,11 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
292
312
  <p>Some modal content1</p>
293
313
  </ModalSection>
294
314
  {this.boolValue == true
295
- && (
296
- <ModalSection icon="icon icon-settings" navCaption="Settings2">
297
- <p>Some modal content2</p>
298
- </ModalSection>
299
- )}
315
+ && (
316
+ <ModalSection icon="icon icon-settings" navCaption="Settings2">
317
+ <p>Some modal content2</p>
318
+ </ModalSection>
319
+ )}
300
320
 
301
321
  <ModalSection icon="icon icon-settings" navCaption="Settings4">
302
322
  <p>Some modal content4444</p>
@@ -360,6 +380,37 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
360
380
  this.selectedOptions = v.id;
361
381
  }}
362
382
  />
383
+ <DropdownList
384
+ ref="tagsDropdown"
385
+ closeOnSelect={true}
386
+ blocked={false}
387
+ options={this.tags}
388
+ displayMember={item => item.text}
389
+ valueMember={item => item.text}
390
+ multiselect={true}
391
+ label=""
392
+ tags={true}
393
+ tagsShouldPrependContent={true}
394
+ tagsAdded={(e) => {
395
+ e.closeSelection = true;
396
+
397
+ const newItem: TagItem = {
398
+ id: e.tagArr[0],
399
+ text: e.tagArr[0],
400
+ };
401
+
402
+ const selectedClone = [...this.selectedTagIds];
403
+ selectedClone.push(newItem.id);
404
+
405
+ this.tags.push(newItem);
406
+ this.fireChangedEvent(selectedClone);
407
+ }}
408
+ selected={this.tags.filter(p => (this.selectedTagIds || []).includes(p.id))}
409
+ changed={(e) => {
410
+ this.fireChangedEvent((e || []).map(p => p.id));
411
+ }}
412
+ />
413
+
363
414
  <DropdownButton layout={ButtonLayout.Default} size={ButtonSize.Regular} text="Akcie">
364
415
  <DropdownButtonItem icon="icon icon-settings" text="Edit" clicked={() => alert('clicked me')} />
365
416
  <DropdownButtonSeparator />
@@ -1104,10 +1104,10 @@ class DropdownListComponent extends TsxComponent<DropdownListArgs> implements Dr
1104
1104
  const retVal = $(tagsTemplate);
1105
1105
  if (self.tagsShouldPrependContent != false) {
1106
1106
  const oldAppend = retVal.append;
1107
- retVal.append = (elem) => {
1107
+ retVal.append = (elem): any => {
1108
1108
  retVal.prepend(elem);
1109
1109
  retVal.append = oldAppend;
1110
- } as any;
1110
+ };
1111
1111
  }
1112
1112
 
1113
1113
  return retVal;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.120",
4
+ "version": "0.0.121",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",