inviton-powerduck 0.0.217 → 0.0.219

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.
@@ -1,104 +1,104 @@
1
- /* Javascript plotting library for jQuery, version 0.8.3.
2
-
3
- Copyright (c) 2007-2014 IOLA and Ole Laursen.
4
- Licensed under the MIT license.
5
-
6
- */
7
- (function ($) {
8
- var options = { series: { stack: null } };
9
- function init(plot) {
10
- function findMatchingSeries(s, allseries) {
11
- var res = null;
12
- for (var i = 0; i < allseries.length; ++i) {
13
- if (s == allseries[i]) break;
14
- if (allseries[i].stack == s.stack) res = allseries[i];
15
- }
16
- return res;
17
- }
18
- function stackData(plot, s, datapoints) {
19
- if (s.stack == null || s.stack === false) return;
20
- var other = findMatchingSeries(s, plot.getData());
21
- if (!other) return;
22
- var ps = datapoints.pointsize,
23
- points = datapoints.points,
24
- otherps = other.datapoints.pointsize,
25
- otherpoints = other.datapoints.points,
26
- newpoints = [],
27
- px,
28
- py,
29
- intery,
30
- qx,
31
- qy,
32
- bottom,
33
- withlines = s.lines.show,
34
- horizontal = s.bars.horizontal,
35
- withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
36
- withsteps = withlines && s.lines.steps,
37
- fromgap = true,
38
- keyOffset = horizontal ? 1 : 0,
39
- accumulateOffset = horizontal ? 0 : 1,
40
- i = 0,
41
- j = 0,
42
- l,
43
- m;
44
- while (true) {
45
- if (i >= points.length) break;
46
- l = newpoints.length;
47
- if (points[i] == null) {
48
- for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
49
- i += ps;
50
- } else if (j >= otherpoints.length) {
51
- if (!withlines) {
52
- for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
53
- }
54
- i += ps;
55
- } else if (otherpoints[j] == null) {
56
- for (m = 0; m < ps; ++m) newpoints.push(null);
57
- fromgap = true;
58
- j += otherps;
59
- } else {
60
- px = points[i + keyOffset];
61
- py = points[i + accumulateOffset];
62
- qx = otherpoints[j + keyOffset];
63
- qy = otherpoints[j + accumulateOffset];
64
- bottom = 0;
65
- if (px == qx) {
66
- for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
67
- newpoints[l + accumulateOffset] += qy;
68
- bottom = qy;
69
- i += ps;
70
- j += otherps;
71
- } else if (px > qx) {
72
- if (withlines && i > 0 && points[i - ps] != null) {
73
- intery = py + ((points[i - ps + accumulateOffset] - py) * (qx - px)) / (points[i - ps + keyOffset] - px);
74
- newpoints.push(qx);
75
- newpoints.push(intery + qy);
76
- for (m = 2; m < ps; ++m) newpoints.push(points[i + m]);
77
- bottom = qy;
78
- }
79
- j += otherps;
80
- } else {
81
- if (fromgap && withlines) {
82
- i += ps;
83
- continue;
84
- }
85
- for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
86
- if (withlines && j > 0 && otherpoints[j - otherps] != null)
87
- bottom = qy + ((otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx)) / (otherpoints[j - otherps + keyOffset] - qx);
88
- newpoints[l + accumulateOffset] += bottom;
89
- i += ps;
90
- }
91
- fromgap = false;
92
- if (l != newpoints.length && withbottom) newpoints[l + 2] += bottom;
93
- }
94
- if (withsteps && l != newpoints.length && l > 0 && newpoints[l] != null && newpoints[l] != newpoints[l - ps] && newpoints[l + 1] != newpoints[l - ps + 1]) {
95
- for (m = 0; m < ps; ++m) newpoints[l + ps + m] = newpoints[l + m];
96
- newpoints[l + 1] = newpoints[l - ps + 1];
97
- }
98
- }
99
- datapoints.points = newpoints;
100
- }
101
- plot.hooks.processDatapoints.push(stackData);
102
- }
103
- $.plot.plugins.push({ init: init, options: options, name: "stack", version: "1.2" });
104
- })(jQuery);
1
+ /* Javascript plotting library for jQuery, version 0.8.3.
2
+
3
+ Copyright (c) 2007-2014 IOLA and Ole Laursen.
4
+ Licensed under the MIT license.
5
+
6
+ */
7
+ (function ($) {
8
+ var options = { series: { stack: null } };
9
+ function init(plot) {
10
+ function findMatchingSeries(s, allseries) {
11
+ var res = null;
12
+ for (var i = 0; i < allseries.length; ++i) {
13
+ if (s == allseries[i]) break;
14
+ if (allseries[i].stack == s.stack) res = allseries[i];
15
+ }
16
+ return res;
17
+ }
18
+ function stackData(plot, s, datapoints) {
19
+ if (s.stack == null || s.stack === false) return;
20
+ var other = findMatchingSeries(s, plot.getData());
21
+ if (!other) return;
22
+ var ps = datapoints.pointsize,
23
+ points = datapoints.points,
24
+ otherps = other.datapoints.pointsize,
25
+ otherpoints = other.datapoints.points,
26
+ newpoints = [],
27
+ px,
28
+ py,
29
+ intery,
30
+ qx,
31
+ qy,
32
+ bottom,
33
+ withlines = s.lines.show,
34
+ horizontal = s.bars.horizontal,
35
+ withbottom = ps > 2 && (horizontal ? datapoints.format[2].x : datapoints.format[2].y),
36
+ withsteps = withlines && s.lines.steps,
37
+ fromgap = true,
38
+ keyOffset = horizontal ? 1 : 0,
39
+ accumulateOffset = horizontal ? 0 : 1,
40
+ i = 0,
41
+ j = 0,
42
+ l,
43
+ m;
44
+ while (true) {
45
+ if (i >= points.length) break;
46
+ l = newpoints.length;
47
+ if (points[i] == null) {
48
+ for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
49
+ i += ps;
50
+ } else if (j >= otherpoints.length) {
51
+ if (!withlines) {
52
+ for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
53
+ }
54
+ i += ps;
55
+ } else if (otherpoints[j] == null) {
56
+ for (m = 0; m < ps; ++m) newpoints.push(null);
57
+ fromgap = true;
58
+ j += otherps;
59
+ } else {
60
+ px = points[i + keyOffset];
61
+ py = points[i + accumulateOffset];
62
+ qx = otherpoints[j + keyOffset];
63
+ qy = otherpoints[j + accumulateOffset];
64
+ bottom = 0;
65
+ if (px == qx) {
66
+ for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
67
+ newpoints[l + accumulateOffset] += qy;
68
+ bottom = qy;
69
+ i += ps;
70
+ j += otherps;
71
+ } else if (px > qx) {
72
+ if (withlines && i > 0 && points[i - ps] != null) {
73
+ intery = py + ((points[i - ps + accumulateOffset] - py) * (qx - px)) / (points[i - ps + keyOffset] - px);
74
+ newpoints.push(qx);
75
+ newpoints.push(intery + qy);
76
+ for (m = 2; m < ps; ++m) newpoints.push(points[i + m]);
77
+ bottom = qy;
78
+ }
79
+ j += otherps;
80
+ } else {
81
+ if (fromgap && withlines) {
82
+ i += ps;
83
+ continue;
84
+ }
85
+ for (m = 0; m < ps; ++m) newpoints.push(points[i + m]);
86
+ if (withlines && j > 0 && otherpoints[j - otherps] != null)
87
+ bottom = qy + ((otherpoints[j - otherps + accumulateOffset] - qy) * (px - qx)) / (otherpoints[j - otherps + keyOffset] - qx);
88
+ newpoints[l + accumulateOffset] += bottom;
89
+ i += ps;
90
+ }
91
+ fromgap = false;
92
+ if (l != newpoints.length && withbottom) newpoints[l + 2] += bottom;
93
+ }
94
+ if (withsteps && l != newpoints.length && l > 0 && newpoints[l] != null && newpoints[l] != newpoints[l - ps] && newpoints[l + 1] != newpoints[l - ps + 1]) {
95
+ for (m = 0; m < ps; ++m) newpoints[l + ps + m] = newpoints[l + m];
96
+ newpoints[l + 1] = newpoints[l - ps + 1];
97
+ }
98
+ }
99
+ datapoints.points = newpoints;
100
+ }
101
+ plot.hooks.processDatapoints.push(stackData);
102
+ }
103
+ $.plot.plugins.push({ init: init, options: options, name: "stack", version: "1.2" });
104
+ })(jQuery);
@@ -7,6 +7,7 @@ import type { AppMenuItem } from '../app/menu';
7
7
  import type { CardHeaderDropdownArgs } from '../card/card-header-with-options';
8
8
  import type { DropdownListOption } from '../dropdown';
9
9
  import type { ImageDropdownDataItem } from '../dropdown/image-dropdown';
10
+ import type { SmartDropdownCategoryItem, SmartDropdownSearchResultItem } from '../dropdown/smart-dropdown';
10
11
  import type { TimegridCalendarAddClickedArgs, TimegridCalendarEvent } from '../fullcalendar/timegrid-calendar';
11
12
  import { Temporal } from '@js-temporal/polyfill';
12
13
  import { Prop, toNative } from 'vue-facing-decorator';
@@ -30,6 +31,7 @@ import DropdownButtonItem from '../dropdown-button/dropdown-button-item';
30
31
  import DropdownButtonSeparator from '../dropdown-button/dropdown-button-separator';
31
32
  import CountryDropdown from '../dropdown/country-dropdown';
32
33
  import ImageDropdown from '../dropdown/image-dropdown';
34
+ import SmartDropdown from '../dropdown/smart-dropdown';
33
35
  import Fieldset from '../form/fieldset';
34
36
  import FlexContainer from '../form/flex-container';
35
37
  import FooterButtons from '../form/footer-buttons';
@@ -155,6 +157,81 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
155
157
  });
156
158
  }
157
159
 
160
+ // 1. Static Categories
161
+ categories: SmartDropdownCategoryItem[] = [
162
+ { id: 101, text: 'Skipass' },
163
+ { id: 102, text: 'Výlet lanovkou' },
164
+ { id: 103, text: 'Aquapass' },
165
+ { id: 104, text: 'Ubytovanie' },
166
+ { id: 105, text: 'Parkovanie' },
167
+ { id: 106, text: 'Eventy' },
168
+ { id: 107, text: 'Zazitky' },
169
+ { id: 108, text: 'Ine srandy' },
170
+ { id: 109, text: 'Vouchery' },
171
+ { id: 110, text: 'Pokemony' },
172
+ { id: 111, text: 'Kino' },
173
+ { id: 112, text: 'Restauracie' },
174
+ { id: 113, text: 'Este insie srandy' },
175
+ { id: 114, text: 'Sranda banda' },
176
+ ];
177
+
178
+ // 2. Selected State
179
+ selectedItems: (SmartDropdownCategoryItem | SmartDropdownSearchResultItem)[] = [];
180
+
181
+ // 3. Search Data Logic (Simulated Backend)
182
+ async fetchSmartDropdownSearchData(query: string): Promise<SmartDropdownSearchResultItem[]> {
183
+ console.log('Fetching for:', query);
184
+
185
+ // Simulate network delay
186
+ await new Promise(resolve => setTimeout(resolve, 500)); // 500ms delay
187
+
188
+ const mockDb: SmartDropdownSearchResultItem[] = [
189
+ { id: 1, text: 'Hotel Grand Jasná', subtitle: 'Ubytovanie • Jasná', imageUrl: 'https://picsum.photos/200' },
190
+ { id: 2, text: 'Celosezónny Skipass', subtitle: 'Produkt • Nízke Tatry', imageUrl: 'https://picsum.photos/200' },
191
+ { id: 3, text: 'Hotel Rotunda', subtitle: 'Ubytovanie • Chopok', imageUrl: 'https://picsum.photos/200' },
192
+ { id: 4, text: 'Fresh Track', subtitle: 'Zážitok • Lomnica' },
193
+ { id: 5, text: 'Wellness Hotel', subtitle: 'Ubytovanie • Bešeňová' },
194
+ ];
195
+
196
+ return mockDb.filter(item =>
197
+ item.text.toLowerCase().includes(query.toLowerCase()));
198
+ }
199
+
200
+ // 4. Handle Change
201
+ onSmartDropdownSelectionChange(newSelection: any[]) {
202
+ console.log('Selection updated:', newSelection);
203
+ this.selectedItems = newSelection;
204
+ }
205
+
206
+ // 2. Custom Sections (History & Inspiration)
207
+ get customSections() {
208
+ return [
209
+ {
210
+ id: 'history',
211
+ title: 'Nedávne vyhľadávania',
212
+ items: [
213
+ { id: 'h1', text: 'Jasná', type: 'history' },
214
+ { id: 'h2', text: 'Vysoké Tatry', type: 'history' },
215
+ ],
216
+ },
217
+ {
218
+ id: 'inspiration',
219
+ title: 'Váhate, kam cestovať najbližšie?',
220
+ items: [
221
+ { id: 'insp1', text: 'Zadajte Kamkoľvek', type: 'special', icon: 'pin' },
222
+ { id: 'insp2', text: 'V mojej lokalite', type: 'special', icon: 'target' },
223
+ ],
224
+ },
225
+ ];
226
+ }
227
+
228
+ // 4. Custom Handler for History Delete
229
+ removeSmartDropdownHistory(e: Event, id: string | number) {
230
+ e.stopPropagation();
231
+ console.log('Removing history', id);
232
+ // logic to remove from customSections...
233
+ }
234
+
158
235
  render(h) {
159
236
  return (
160
237
  <div>
@@ -333,11 +410,11 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
333
410
  <p>Some modal content1</p>
334
411
  </ModalSection>
335
412
  {this.boolValue == true
336
- && (
337
- <ModalSection icon="icon icon-settings" navCaption="Settings2">
338
- <p>Some modal content2</p>
339
- </ModalSection>
340
- )}
413
+ && (
414
+ <ModalSection icon="icon icon-settings" navCaption="Settings2">
415
+ <p>Some modal content2</p>
416
+ </ModalSection>
417
+ )}
341
418
 
342
419
  <ModalSection icon="icon icon-settings" navCaption="Settings4">
343
420
  <p>Some modal content4444</p>
@@ -411,16 +488,12 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
411
488
  h,
412
489
  item,
413
490
  originator,
414
- ) => {
415
- return (<CustomDropdownItem text={item.text} />);
416
- }}
491
+ ) => <CustomDropdownItem text={item.text} />}
417
492
  customRenderSelectionResult={(
418
493
  h,
419
494
  item,
420
495
  originator,
421
- ) => {
422
- return (<CustomDropdownItem text={item.text} />);
423
- }}
496
+ ) => <CustomDropdownItem text={item.text} />}
424
497
  changed={(v) => {
425
498
  this.selectedOptions = v.id;
426
499
  }}
@@ -479,6 +552,58 @@ class TestAllComponentsPageComponent extends PowerduckViewModelBase {
479
552
  }}
480
553
  />
481
554
 
555
+ <SmartDropdown
556
+ label="Mudry dropdown"
557
+ wrap={false}
558
+ categories={this.categories}
559
+ searchData={this.fetchSmartDropdownSearchData}
560
+ customSections={this.customSections}
561
+ value={this.selectedItems}
562
+ buttonLayout="inline"
563
+ selectionDisplay="chips"
564
+
565
+ searchMode="input"
566
+ changed={this.onSmartDropdownSelectionChange} // Or use @selectionChanged in template
567
+ multiselect={true} // Toggle to false for single select
568
+ placeholder="Hľadajte hotel, službu..."
569
+ // customSectionRender={(item, selected) => {
570
+ // // Example: History Item
571
+ // if (item.type === 'history') {
572
+ // return (
573
+ // <div style="display:flex; justify-content:space-between; padding: 8px 16px;">
574
+ // <span>
575
+ // ↻
576
+ // <b>{item.text}</b>
577
+ // </span>
578
+ // <span onClick={e => this.removeHistory(e, item.id)}>x</span>
579
+ // </div>
580
+ // );
581
+ // }
582
+
583
+ // // Example: Default Checkbox style via simple HTML
584
+ // return (
585
+ // <div style="display:flex; align-items:center; padding: 8px 16px;">
586
+ // <div class={`checkbox-visual ${selected ? 'checked' : ''}`} style="margin-right:10px; width:16px; height:16px; border:1px solid #ccc;"></div>
587
+ // {item.text}
588
+ // </div>
589
+ // );
590
+ // }}
591
+ customTriggerScope="mobile"
592
+ customTriggerRender={() => (
593
+ <div style="display:flex; flex-direction:column; width:100%; gap:8px;">
594
+ {/* Mimicking the stacked mobile inputs */}
595
+ <div style="border:1px solid #eee; padding:8px; border-radius:8px; display:flex; justify-content:space-between;">
596
+ <span style="color:#999; font-size:12px">Kam</span>
597
+ <strong>Jasná</strong>
598
+ </div>
599
+ <div style="border:1px solid #eee; padding:8px; border-radius:8px; display:flex; justify-content:space-between;">
600
+ <span style="color:#999; font-size:12px">Čo hľadáte</span>
601
+ <strong>Skipass</strong>
602
+ </div>
603
+ </div>
604
+ )}
605
+ />
606
+
482
607
  <DropdownButton layout={ButtonLayout.Default} size={ButtonSize.Regular} text="Akcie">
483
608
  <DropdownButtonItem icon="icon icon-settings" text="Edit" clicked={() => alert('clicked me')} />
484
609
  <DropdownButtonSeparator />