@sme.up/ketchup 4.2.0-SNAPSHOT → 4.3.0-SNAPSHOT

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.
Files changed (104) hide show
  1. package/dist/cjs/{cell-utils-1d44a3f0.js → cell-utils-dc0884a3.js} +2 -2
  2. package/dist/cjs/{f-button-a5788453.js → f-button-2ba74fb5.js} +1 -1
  3. package/dist/cjs/{f-cell-eba6f39e.js → f-cell-fe60a08d.js} +31 -27
  4. package/dist/cjs/{f-chip-ce69b7d2.js → f-chip-90d95d22.js} +2 -2
  5. package/dist/cjs/{f-image-e03842eb.js → f-image-d3bd4e08.js} +1 -1
  6. package/dist/cjs/ketchup.cjs.js +1 -1
  7. package/dist/cjs/kup-accordion.cjs.entry.js +3 -3
  8. package/dist/cjs/kup-autocomplete_28.cjs.entry.js +1024 -633
  9. package/dist/cjs/kup-calendar.cjs.entry.js +6 -6
  10. package/dist/cjs/kup-cell.cjs.entry.js +6 -6
  11. package/dist/cjs/kup-dash-list.cjs.entry.js +3 -3
  12. package/dist/cjs/kup-dash_2.cjs.entry.js +2 -2
  13. package/dist/cjs/kup-drawer.cjs.entry.js +2 -2
  14. package/dist/cjs/kup-field.cjs.entry.js +1 -1
  15. package/dist/cjs/kup-iframe.cjs.entry.js +2 -2
  16. package/dist/cjs/kup-lazy.cjs.entry.js +2 -2
  17. package/dist/cjs/kup-magic-box.cjs.entry.js +3 -3
  18. package/dist/cjs/{kup-manager-75f1a2cd.js → kup-manager-1a2688ca.js} +20 -1
  19. package/dist/cjs/kup-nav-bar.cjs.entry.js +2 -2
  20. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  21. package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
  22. package/dist/cjs/kup-snackbar.cjs.entry.js +4 -4
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/cjs/{utils-b3ec89fe.js → utils-0cc466b9.js} +1 -59
  25. package/dist/collection/components/kup-card/builtin/kup-card-builtin.js +20 -0
  26. package/dist/collection/components/kup-card/builtin/kup-card-calendar.js +458 -0
  27. package/dist/collection/components/kup-card/builtin/kup-card-clock.js +321 -0
  28. package/dist/collection/components/kup-card/free/kup-card-free.js +13 -0
  29. package/dist/collection/components/kup-card/kup-card-declarations.js +19 -0
  30. package/dist/collection/components/kup-card/kup-card.css +502 -3
  31. package/dist/collection/components/kup-card/kup-card.js +18 -9
  32. package/dist/collection/components/kup-data-table/kup-data-table.css +0 -38
  33. package/dist/collection/components/kup-data-table/kup-data-table.js +21 -10
  34. package/dist/collection/components/kup-date-picker/kup-date-picker.css +0 -82
  35. package/dist/collection/components/kup-date-picker/kup-date-picker.js +35 -309
  36. package/dist/collection/components/kup-text-field/kup-text-field.css +1 -0
  37. package/dist/collection/components/kup-time-picker/kup-time-picker.css +1 -0
  38. package/dist/collection/components/kup-time-picker/kup-time-picker.js +51 -241
  39. package/dist/collection/f-components/f-cell/f-cell.js +26 -22
  40. package/dist/collection/utils/kup-search/kup-search.js +0 -1
  41. package/dist/esm/{cell-utils-9a2914fc.js → cell-utils-8f512ea9.js} +2 -2
  42. package/dist/esm/{f-button-55a9ed88.js → f-button-30dbcaa9.js} +1 -1
  43. package/dist/esm/{f-cell-ac520cb2.js → f-cell-95c186c6.js} +31 -27
  44. package/dist/esm/{f-chip-babf1740.js → f-chip-c0e9c0ff.js} +2 -2
  45. package/dist/esm/{f-image-70ca9dfe.js → f-image-3bc8b24f.js} +1 -1
  46. package/dist/esm/ketchup.js +1 -1
  47. package/dist/esm/kup-accordion.entry.js +3 -3
  48. package/dist/esm/kup-autocomplete_28.entry.js +1053 -662
  49. package/dist/esm/kup-calendar.entry.js +6 -6
  50. package/dist/esm/kup-cell.entry.js +6 -6
  51. package/dist/esm/kup-dash-list.entry.js +3 -3
  52. package/dist/esm/kup-dash_2.entry.js +2 -2
  53. package/dist/esm/kup-drawer.entry.js +2 -2
  54. package/dist/esm/kup-field.entry.js +1 -1
  55. package/dist/esm/kup-iframe.entry.js +2 -2
  56. package/dist/esm/kup-lazy.entry.js +2 -2
  57. package/dist/esm/kup-magic-box.entry.js +3 -3
  58. package/dist/esm/{kup-manager-bba32828.js → kup-manager-7fc234da.js} +21 -2
  59. package/dist/esm/kup-nav-bar.entry.js +2 -2
  60. package/dist/esm/kup-probe.entry.js +1 -1
  61. package/dist/esm/kup-qlik.entry.js +1 -1
  62. package/dist/esm/kup-snackbar.entry.js +4 -4
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/{utils-cfcbe33f.js → utils-6c73709d.js} +2 -58
  65. package/dist/ketchup/ketchup.esm.js +1 -1
  66. package/dist/ketchup/{p-1ce9a037.js → p-15321eae.js} +1 -1
  67. package/dist/ketchup/{p-daf03877.entry.js → p-1baf1205.entry.js} +1 -1
  68. package/dist/ketchup/p-1c6178e4.entry.js +1 -0
  69. package/dist/ketchup/{p-52038ccb.js → p-44375e49.js} +1 -1
  70. package/dist/ketchup/{p-d58dbf0e.js → p-5a5f2a53.js} +1 -1
  71. package/dist/ketchup/{p-4748be4b.js → p-61faaa38.js} +2 -2
  72. package/dist/ketchup/{p-69a705ae.entry.js → p-62816d0b.entry.js} +1 -1
  73. package/dist/ketchup/{p-ff7d590e.entry.js → p-65adc15b.entry.js} +1 -1
  74. package/dist/ketchup/p-7e23ea7c.entry.js +1 -0
  75. package/dist/ketchup/{p-5faf7715.entry.js → p-a378ba56.entry.js} +1 -1
  76. package/dist/ketchup/{p-74259992.entry.js → p-a878016f.entry.js} +1 -1
  77. package/dist/ketchup/{p-d6ce1ac6.entry.js → p-a96e6e32.entry.js} +1 -1
  78. package/dist/ketchup/{p-6cc8264d.entry.js → p-ad32821e.entry.js} +1 -1
  79. package/dist/ketchup/{p-03ae1be9.entry.js → p-af4a6191.entry.js} +1 -1
  80. package/dist/ketchup/{p-a7687c0e.entry.js → p-c18c7bb0.entry.js} +5 -5
  81. package/dist/ketchup/{p-62208488.entry.js → p-ca0ca27f.entry.js} +1 -1
  82. package/dist/ketchup/{p-e90934b5.entry.js → p-ccda584a.entry.js} +1 -1
  83. package/dist/ketchup/p-d4aa4922.js +1 -0
  84. package/dist/ketchup/{p-40df35de.entry.js → p-dbb6998b.entry.js} +1 -1
  85. package/dist/ketchup/{p-06c209a5.js → p-de83f2f6.js} +1 -1
  86. package/dist/ketchup/p-ec3a3db9.js +1 -0
  87. package/dist/ketchup/p-ecccb3a4.entry.js +45 -0
  88. package/dist/types/components/kup-card/builtin/kup-card-builtin.d.ts +14 -0
  89. package/dist/types/components/kup-card/builtin/kup-card-calendar.d.ts +2 -0
  90. package/dist/types/components/kup-card/builtin/kup-card-clock.d.ts +2 -0
  91. package/dist/types/components/kup-card/free/kup-card-free.d.ts +8 -0
  92. package/dist/types/components/kup-card/kup-card-declarations.d.ts +74 -0
  93. package/dist/types/components/kup-card/kup-card.d.ts +3 -3
  94. package/dist/types/components/kup-data-table/kup-data-table-declarations.d.ts +0 -5
  95. package/dist/types/components/kup-data-table/kup-data-table.d.ts +1 -2
  96. package/dist/types/components/kup-date-picker/kup-date-picker.d.ts +0 -10
  97. package/dist/types/components/kup-time-picker/kup-time-picker.d.ts +2 -9
  98. package/dist/types/components.d.ts +2 -2
  99. package/package.json +1 -1
  100. package/dist/ketchup/p-1e2c3497.js +0 -1
  101. package/dist/ketchup/p-5db41fae.entry.js +0 -45
  102. package/dist/ketchup/p-756aa8b1.entry.js +0 -1
  103. package/dist/ketchup/p-ea387b49.entry.js +0 -1
  104. package/dist/ketchup/p-f6bff949.js +0 -1
@@ -296,6 +296,7 @@ export class KupDataTable {
296
296
  this.removeDropareaRef = null;
297
297
  this.groupsDropareaRef = null;
298
298
  this.clickCb = null;
299
+ this.clickCbCustomPanel = null;
299
300
  /**
300
301
  * Reference to the row detail card.
301
302
  */
@@ -1288,11 +1289,9 @@ export class KupDataTable {
1288
1289
  }
1289
1290
  }
1290
1291
  customizePanelPosition() {
1291
- if (this.customizeTopButtonRef) {
1292
- this.kupManager.dynamicPosition.register(this.customizeTopPanelRef, this.customizeTopButtonRef);
1293
- }
1294
- if (this.customizeBottomButtonRef) {
1295
- this.kupManager.dynamicPosition.register(this.customizeBottomPanelRef, this.customizeBottomButtonRef);
1292
+ if (this.customizeTopButtonRef &&
1293
+ !this.kupManager.dynamicPosition.isRegistered(this.customizeTopPanelRef)) {
1294
+ this.kupManager.dynamicPosition.register(this.customizeTopPanelRef, this.customizeTopButtonRef, 0, KupDynamicPositionPlacement.BOTTOM, true);
1296
1295
  }
1297
1296
  }
1298
1297
  rowsPointLength() {
@@ -3040,19 +3039,28 @@ export class KupDataTable {
3040
3039
  }
3041
3040
  }
3042
3041
  openCustomSettings() {
3043
- this.customizeTopPanelRef.classList.add('visible');
3042
+ this.customizeTopPanelRef.menuVisible = true;
3044
3043
  this.customizeTopButtonRef.classList.add('toggled');
3045
3044
  this.kupManager.dynamicPosition.start(this.customizeTopPanelRef);
3046
3045
  this.openedCustomSettings = true;
3046
+ if (!this.clickCbCustomPanel) {
3047
+ this.clickCbCustomPanel = {
3048
+ cb: () => {
3049
+ this.closeCustomSettings();
3050
+ },
3051
+ el: this.customizeTopPanelRef,
3052
+ };
3053
+ }
3054
+ this.kupManager.addClickCallback(this.clickCbCustomPanel, true);
3047
3055
  }
3048
3056
  closeCustomSettings() {
3049
3057
  this.customizeTopButtonRef.classList.remove('toggled');
3050
3058
  if (this.customizeTopPanelRef == null) {
3051
3059
  return;
3052
3060
  }
3053
- this.customizeTopPanelRef.classList.remove('visible');
3054
- this.kupManager.dynamicPosition.stop(this.customizeTopPanelRef);
3061
+ this.customizeTopPanelRef.menuVisible = false;
3055
3062
  this.openedCustomSettings = false;
3063
+ this.kupManager.removeClickCallback(this.clickCbCustomPanel);
3056
3064
  }
3057
3065
  renderPaginator(top) {
3058
3066
  return (h("div", { class: "paginator-wrapper" },
@@ -3076,9 +3084,9 @@ export class KupDataTable {
3076
3084
  totalsMatrix = this.renderTotalsMatrix();
3077
3085
  }
3078
3086
  }
3079
- return (h("div", { class: "kup-menu customize-panel", ref: (el) => {
3087
+ return (h("kup-card", { customStyle: "::slotted(kup-switch) { width: max-content !important; } ::slotted(*) { margin: auto !important; } ::slotted(.customize-element) { margin: auto !important; padding: 0 1em 1em 1em !important; width: max-content !important; } ::slotted(.customize-element):nth-child(1) { padding-top: 1em !important; }", isMenu: true, layoutFamily: KupCardFamily.FREE, ref: (el) => {
3080
3088
  this.customizeTopPanelRef = el;
3081
- } },
3089
+ }, sizeX: "360px", sizeY: "300px" },
3082
3090
  density,
3083
3091
  grid,
3084
3092
  fontsize,
@@ -3480,6 +3488,9 @@ export class KupDataTable {
3480
3488
  if (dynamicPositionElements.length > 0) {
3481
3489
  this.kupManager.dynamicPosition.unregister(Array.prototype.slice.call(dynamicPositionElements));
3482
3490
  }
3491
+ if (this.customizeTopPanelRef) {
3492
+ this.customizeTopPanelRef.remove();
3493
+ }
3483
3494
  if (this.columnMenuCard) {
3484
3495
  this.columnMenuCard.remove();
3485
3496
  }
@@ -3,88 +3,6 @@
3
3
  font-size: var(--kup-font-size);
4
4
  }
5
5
 
6
- #date-picker-div {
7
- outline: none;
8
- pointer-events: all;
9
- background-color: var(--kup-background-color);
10
- box-shadow: var(--kup-box-shadow);
11
- color: var(--kup-text-color);
12
- display: none;
13
- overflow: hidden;
14
- padding: 10px;
15
- box-sizing: border-box;
16
- flex-direction: column;
17
- justify-content: center;
18
- height: 22em;
19
- width: 22em;
20
- position: absolute;
21
- z-index: 1;
22
- }
23
- #date-picker-div.visible {
24
- display: block;
25
- }
26
- #date-picker-div.dynamic-position-active {
27
- display: flex;
28
- }
29
- #date-picker-div .section-1 {
30
- box-sizing: border-box;
31
- height: 5em;
32
- overflow: auto;
33
- padding-bottom: 1em;
34
- width: 100%;
35
- }
36
- #date-picker-div .section-1 .sub-1 {
37
- display: flex;
38
- flex-direction: row;
39
- justify-content: center;
40
- }
41
- #date-picker-div .section-2 {
42
- height: calc(100% - 60px);
43
- overflow: auto;
44
- width: 100%;
45
- }
46
- #date-picker-div #prev-page {
47
- margin-left: auto;
48
- }
49
- #date-picker-div #change-view-button {
50
- margin: auto;
51
- width: 12em;
52
- text-align: center;
53
- }
54
- #date-picker-div #next-page {
55
- margin-right: auto;
56
- }
57
- #date-picker-div #calendar {
58
- border-collapse: collapse;
59
- width: 100%;
60
- }
61
- #date-picker-div thead {
62
- border-bottom: 1px solid var(--kup-border-color);
63
- }
64
- #date-picker-div .item-text {
65
- color: rgba(var(--kup-text-color-rgb), 0.5);
66
- }
67
- #date-picker-div .item {
68
- text-align: center;
69
- }
70
- #date-picker-div .item:not(.selected) .item-number:hover {
71
- background-color: var(--kup-hover-background-color);
72
- }
73
- #date-picker-div .item.selected .item-number, #date-picker-div .item.selected .item-number:hover {
74
- background-color: rgba(var(--kup-primary-color-rgb), 0.175);
75
- }
76
- #date-picker-div .item-number {
77
- border-radius: 50%;
78
- cursor: pointer;
79
- display: flex;
80
- justify-content: center;
81
- line-height: 2.5em;
82
- margin: auto;
83
- width: 2.5em;
84
- transition: background-color 0.25s;
85
- text-transform: capitalize;
86
- }
87
-
88
6
  .f-text-field {
89
7
  position: relative;
90
8
  }
@@ -1,13 +1,12 @@
1
1
  import { Component, Element, Event, forceUpdate, h, Host, Listen, Method, Prop, State, Watch, } from '@stencil/core';
2
2
  import { kupManagerInstance, } from '../../utils/kup-manager/kup-manager';
3
- import { getMonthsAsStringByLocale, getDaysOfWeekAsStringByLocale, fillString, DateTimeFormatOptionsMonth, } from '../../utils/utils';
4
- import { KupDatePickerProps, SourceEvent, } from './kup-date-picker-declarations';
5
- import { FButtonStyling } from '../../f-components/f-button/f-button-declarations';
3
+ import { KupDatePickerProps, } from './kup-date-picker-declarations';
6
4
  import { KupDebugCategory } from '../../utils/kup-debug/kup-debug-declarations';
7
5
  import { componentWrapperId } from '../../variables/GenericVariables';
8
6
  import { KupDatesFormats, KupDatesNormalize, } from '../../utils/kup-dates/kup-dates-declarations';
9
7
  import { FTextField } from '../../f-components/f-text-field/f-text-field';
10
8
  import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
9
+ import { KupDynamicPositionPlacement } from '../../utils/kup-dynamic-position/kup-dynamic-position-declarations';
11
10
  export class KupDatePicker {
12
11
  constructor() {
13
12
  /*-------------------------------------------------*/
@@ -52,14 +51,12 @@ export class KupDatePicker {
52
51
  * Instance of the KupManager class.
53
52
  */
54
53
  this.kupManager = kupManagerInstance();
55
- this.calendarView = SourceEvent.DATE;
56
54
  this.textfieldEl = null;
57
55
  this.pickerContainerEl = null;
58
56
  this.pickerEl = {
59
57
  value: new Date().toISOString(),
60
58
  date: new Date(),
61
59
  };
62
- this.pickerOpened = false;
63
60
  this.clickCb = null;
64
61
  }
65
62
  onKupDatePickerItemClick(value) {
@@ -74,6 +71,7 @@ export class KupDatePicker {
74
71
  id: this.rootElement.id,
75
72
  value: this.value,
76
73
  });
74
+ this.setFocus();
77
75
  }
78
76
  onKupClearIconClick() {
79
77
  this.setPickerValueSelected('');
@@ -87,19 +85,6 @@ export class KupDatePicker {
87
85
  id: this.rootElement.id,
88
86
  });
89
87
  }
90
- onKupDatePickerMonthYearItemClick(value) {
91
- switch (this.calendarView) {
92
- case SourceEvent.MONTH: {
93
- this.calendarView = SourceEvent.DATE;
94
- break;
95
- }
96
- case SourceEvent.YEAR: {
97
- this.calendarView = SourceEvent.MONTH;
98
- break;
99
- }
100
- }
101
- this.refreshPickerComponentValue(value);
102
- }
103
88
  onKupBlur() {
104
89
  this.kupBlur.emit({
105
90
  id: this.rootElement.id,
@@ -275,20 +260,22 @@ export class KupDatePicker {
275
260
  return this.value;
276
261
  }
277
262
  openPicker() {
278
- this.calendarView = SourceEvent.DATE;
279
- let textfieldEl = this.textfieldEl;
280
- let containerEl = this.pickerContainerEl;
281
- this.pickerOpened = true;
263
+ const textfieldEl = this.textfieldEl;
264
+ this.pickerContainerEl.menuVisible = true;
265
+ const elStyle = this.pickerContainerEl.style;
266
+ elStyle.height = 'auto';
267
+ elStyle.minWidth = this.textfieldEl.parentElement.clientWidth + 'px';
282
268
  this.refreshPickerComponentValue(this.getValueForPickerComponent());
283
269
  if (textfieldEl != null) {
284
270
  textfieldEl.classList.add('toggled');
285
271
  }
286
- if (containerEl != null) {
287
- containerEl.classList.add('visible');
288
- const elStyle = containerEl.style;
289
- elStyle.height = 'auto';
290
- elStyle.minWidth = textfieldEl.clientWidth + 'px';
272
+ if (this.kupManager.dynamicPosition.isRegistered(this.pickerContainerEl)) {
273
+ this.kupManager.dynamicPosition.changeAnchor(this.pickerContainerEl, this.textfieldEl.parentElement);
291
274
  }
275
+ else {
276
+ this.kupManager.dynamicPosition.register(this.pickerContainerEl, this.textfieldEl.parentElement, 0, KupDynamicPositionPlacement.AUTO, true);
277
+ }
278
+ this.kupManager.dynamicPosition.start(this.pickerContainerEl);
292
279
  if (!this.clickCb) {
293
280
  this.clickCb = {
294
281
  cb: () => {
@@ -305,22 +292,21 @@ export class KupDatePicker {
305
292
  return;
306
293
  }
307
294
  let textfieldEl = this.textfieldEl;
308
- let containerEl = this.pickerContainerEl;
309
- this.pickerOpened = false;
310
295
  if (textfieldEl != null) {
311
296
  textfieldEl.classList.remove('toggled');
312
297
  }
313
- if (containerEl != null) {
314
- containerEl.classList.remove('visible');
315
- }
298
+ this.pickerContainerEl.menuVisible = false;
299
+ this.kupManager.dynamicPosition.stop(this.pickerContainerEl);
316
300
  }
317
301
  isPickerOpened() {
318
- return this.pickerOpened;
302
+ return this.pickerContainerEl.menuVisible == true;
319
303
  }
320
304
  getTextFieldId() {
321
305
  return this.textfieldEl.id;
322
306
  }
323
307
  prepTextfield(initialValue) {
308
+ const fullHeight = this.rootElement.classList.contains('kup-full-height');
309
+ const fullWidth = this.rootElement.classList.contains('kup-full-width');
324
310
  const textfieldData = Object.assign({}, this.data['kup-text-field']);
325
311
  if (!textfieldData.icon) {
326
312
  textfieldData.icon = 'calendar';
@@ -328,7 +314,7 @@ export class KupDatePicker {
328
314
  if (textfieldData.icon) {
329
315
  textfieldData.trailingIcon = true;
330
316
  }
331
- return (h(FTextField, Object.assign({}, textfieldData, { disabled: this.disabled, id: this.rootElement.id + '_text-field', value: initialValue, onBlur: () => this.onKupBlur(), onChange: (e) => this.onKupChange(e), onClearIconClick: () => this.onKupClearIconClick(), onClick: () => this.onKupClick(), onFocus: () => this.onKupFocus(), onIconClick: () => this.onKupIconClick(), onKeyDown: (e) => this.onkupTextFieldSubmit(e), onInput: (e) => this.onKupInput(e) }), this.prepDatePicker()));
317
+ return (h(FTextField, Object.assign({}, textfieldData, { disabled: this.disabled, fullHeight: fullHeight, fullWidth: fullWidth, id: this.rootElement.id + '_text-field', value: initialValue, onBlur: () => this.onKupBlur(), onChange: (e) => this.onKupChange(e), onClearIconClick: () => this.onKupClearIconClick(), onClick: () => this.onKupClick(), onFocus: () => this.onKupFocus(), onIconClick: () => this.onKupIconClick(), onKeyDown: (e) => this.onkupTextFieldSubmit(e), onInput: (e) => this.onKupInput(e) }), this.prepDatePicker()));
332
318
  }
333
319
  getInitEndYear(curYear) {
334
320
  let initYear = curYear - (curYear % 10);
@@ -350,268 +336,17 @@ export class KupDatePicker {
350
336
  return idConc.indexOf('#' + id + '#') >= 0;
351
337
  }
352
338
  prepDatePicker() {
353
- let date = this.pickerEl.date;
354
- let months = getMonthsAsStringByLocale();
355
- let curYear = date.getFullYear();
356
- let yearRange = this.getInitEndYear(curYear);
357
- let initYear = yearRange.initYear;
358
- let endYear = yearRange.endYear;
359
- let changeViewButtonLabel = 'not-set';
360
- switch (this.calendarView) {
361
- case SourceEvent.DATE: {
362
- changeViewButtonLabel =
363
- months[date.getMonth()] + ', ' + curYear.toString();
364
- break;
365
- }
366
- case SourceEvent.MONTH: {
367
- changeViewButtonLabel = curYear.toString();
368
- break;
369
- }
370
- case SourceEvent.YEAR: {
371
- changeViewButtonLabel =
372
- initYear.toString() + ' - ' + endYear.toString();
373
- break;
374
- }
375
- }
376
- let prevButtonComp = null;
377
- let nextButtonComp = null;
378
- prevButtonComp = (h("kup-button", { id: "prev-page", icon: "chevron_left", "onkup-button-click": () => this.prevPage() }));
379
- nextButtonComp = (h("kup-button", { id: "next-page", icon: "chevron_right", "onkup-button-click": () => this.nextPage() }));
380
- return (h("div", { id: "date-picker-div", ref: (el) => (this.pickerContainerEl = el) },
381
- h("div", { class: "section-1" },
382
- h("div", { class: "sub-1 nav" },
383
- prevButtonComp,
384
- h("kup-button", { customStyle: "#kup-component button {text-transform:capitalize}", id: "change-view-button", styling: FButtonStyling.FLAT, label: changeViewButtonLabel, "onkup-button-click": () => this.changeView() }),
385
- nextButtonComp)),
386
- h("div", { class: "section-2" }, this.createCalendar())));
387
- }
388
- createCalendar() {
389
- switch (this.calendarView) {
390
- case SourceEvent.DATE: {
391
- return this.createDaysCalendar();
392
- }
393
- case SourceEvent.MONTH: {
394
- return this.createMonthsCalendar();
395
- }
396
- case SourceEvent.YEAR: {
397
- return this.createYearsCalendar();
398
- }
399
- }
400
- }
401
- createDaysCalendar() {
402
- let days = getDaysOfWeekAsStringByLocale(this.firstDayIndex);
403
- let date = this.pickerEl.date;
404
- let selecteDate = new Date(date);
405
- let thead = [];
406
- let tbody = [];
407
- for (let index = 0; index < days.length; index++) {
408
- thead.push(h("th", null,
409
- h("span", { class: "item-text" }, days[index])));
410
- }
411
- let firstMonthDay = new Date(date.getFullYear(), date.getMonth(), 1);
412
- let lastMonthDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
413
- let finish = false;
414
- let currentDayIndex = this.firstDayIndex;
415
- let firstMonthDayIndex = firstMonthDay.getDay();
416
- let row = [];
417
- let daysForRowAdded = 0;
418
- while (!finish) {
419
- if (currentDayIndex == firstMonthDayIndex) {
420
- break;
421
- }
422
- row.push(h("td", { class: "item empty" }));
423
- currentDayIndex++;
424
- daysForRowAdded++;
425
- if (currentDayIndex > 6) {
426
- currentDayIndex = 0;
427
- }
428
- }
429
- let dayCount = 1;
430
- while (dayCount <= lastMonthDay.getDate()) {
431
- for (let i = daysForRowAdded; i < 7; i++) {
432
- let dayClass = 'item';
433
- let dataIndex = {
434
- 'data-index': date.getFullYear().toString() +
435
- '-' +
436
- fillString((date.getMonth() + 1).toString(), '0', 2, true) +
437
- '-' +
438
- fillString(dayCount.toString(), '0', 2, true),
439
- };
440
- if (dayCount === selecteDate.getDate() &&
441
- date.getMonth() === selecteDate.getMonth() &&
442
- date.getFullYear() === selecteDate.getFullYear()) {
443
- dayClass += ' selected';
444
- }
445
- row.push(h("td", { class: dayClass },
446
- h("span", Object.assign({}, dataIndex, { class: "item-number", onClick: () => {
447
- this.onKupDatePickerItemClick(dataIndex['data-index']);
448
- } }), dayCount)));
449
- dayCount++;
450
- if (dayCount > lastMonthDay.getDate()) {
451
- break;
452
- }
453
- }
454
- if (row.length > 0) {
455
- tbody.push(h("tr", null, row));
456
- row = [];
457
- }
458
- daysForRowAdded = 0;
459
- }
460
- return (h("table", { id: "calendar" },
461
- h("thead", null, thead),
462
- h("tbody", null, tbody)));
463
- }
464
- createMonthsCalendar() {
465
- let months = getMonthsAsStringByLocale(DateTimeFormatOptionsMonth.SHORT);
466
- let date = this.pickerEl.date;
467
- let selecteDate;
468
- if (this.value == null || this.value.trim() == '') {
469
- selecteDate = new Date();
470
- }
471
- else {
472
- selecteDate = new Date(this.value);
473
- }
474
- let tbody = [];
475
- let row = [];
476
- let monthCount = 0;
477
- while (monthCount < 12) {
478
- for (let i = 0; i < 4; i++) {
479
- let monthClass = 'item';
480
- let dataIndex = {
481
- 'data-index': date.getFullYear().toString() +
482
- '-' +
483
- fillString((monthCount + 1).toString(), '0', 2, true) +
484
- '-' +
485
- fillString(date.getDate().toString(), '0', 2, true),
486
- };
487
- if (monthCount === selecteDate.getMonth() &&
488
- date.getFullYear() == selecteDate.getFullYear()) {
489
- monthClass += ' selected';
490
- }
491
- row.push(h("td", { class: monthClass },
492
- h("span", Object.assign({}, dataIndex, { class: "item-number", onClick: () => {
493
- this.onKupDatePickerMonthYearItemClick(dataIndex['data-index']);
494
- } }), months[monthCount])));
495
- monthCount++;
496
- }
497
- if (row.length > 0) {
498
- tbody.push(h("tr", null, row));
499
- row = [];
500
- }
501
- }
502
- return (h("table", { id: "calendar" },
503
- h("tbody", null, tbody)));
504
- }
505
- createYearsCalendar() {
506
- let date = this.pickerEl.date;
507
- let curYear = date.getFullYear();
508
- let yearRange = this.getInitEndYear(curYear);
509
- let initYear = yearRange.initYear;
510
- let endYear = yearRange.endYear;
511
- let selecteDate;
512
- if (this.value == null || this.value.trim() == '') {
513
- selecteDate = new Date();
514
- }
515
- else {
516
- selecteDate = new Date(this.value);
517
- }
518
- let tbody = [];
519
- let row = [];
520
- let yearCount = initYear;
521
- while (yearCount <= endYear) {
522
- for (let i = 0; i < 4; i++) {
523
- let yearClass = 'item';
524
- let dataIndex = {
525
- 'data-index': yearCount.toString() +
526
- '-' +
527
- fillString((date.getMonth() + 1).toString(), '0', 2, true) +
528
- '-' +
529
- fillString(date.getDate().toString(), '0', 2, true),
530
- };
531
- if (yearCount === selecteDate.getFullYear()) {
532
- yearClass += ' selected';
533
- }
534
- row.push(h("td", { class: yearClass },
535
- h("span", Object.assign({}, dataIndex, { class: "item-number", onClick: () => {
536
- this.onKupDatePickerMonthYearItemClick(dataIndex['data-index']);
537
- } }), yearCount)));
538
- yearCount++;
539
- }
540
- if (row.length > 0) {
541
- tbody.push(h("tr", null, row));
542
- row = [];
543
- }
544
- }
545
- return (h("table", { id: "calendar" },
546
- h("tbody", null, tbody)));
547
- }
548
- changeView() {
549
- switch (this.calendarView) {
550
- case SourceEvent.DATE: {
551
- this.calendarView = SourceEvent.MONTH;
552
- break;
553
- }
554
- case SourceEvent.MONTH: {
555
- this.calendarView = SourceEvent.YEAR;
556
- break;
557
- }
558
- case SourceEvent.YEAR: {
559
- this.calendarView = SourceEvent.DATE;
560
- }
561
- }
562
- this.refresh();
563
- }
564
- prevPage() {
565
- let date = this.pickerEl.date;
566
- let yy = date.getFullYear();
567
- let mm = date.getMonth();
568
- if (this.calendarView == SourceEvent.DATE) {
569
- if (mm < 1) {
570
- mm = 11;
571
- yy--;
572
- }
573
- else {
574
- mm--;
575
- }
576
- }
577
- if (this.calendarView == SourceEvent.MONTH) {
578
- yy--;
579
- }
580
- if (this.calendarView == SourceEvent.YEAR) {
581
- let yearRange = this.getInitEndYear(yy);
582
- yy = yearRange.initYear - 1;
583
- }
584
- date.setFullYear(yy);
585
- date.setMonth(mm);
586
- this.pickerEl.value = date.toISOString();
587
- this.pickerEl.date = date;
588
- this.refresh();
589
- }
590
- nextPage() {
591
- let date = this.pickerEl.date;
592
- let yy = date.getFullYear();
593
- let mm = date.getMonth();
594
- if (this.calendarView == SourceEvent.DATE) {
595
- if (mm > 10) {
596
- mm = 0;
597
- yy++;
598
- }
599
- else {
600
- mm++;
601
- }
602
- }
603
- if (this.calendarView == SourceEvent.MONTH) {
604
- yy++;
605
- }
606
- if (this.calendarView == SourceEvent.YEAR) {
607
- let yearRange = this.getInitEndYear(yy);
608
- yy = yearRange.endYear + 1;
609
- }
610
- date.setFullYear(yy);
611
- date.setMonth(mm);
612
- this.pickerEl.value = date.toISOString();
613
- this.pickerEl.date = date;
614
- this.refresh();
339
+ const data = {
340
+ options: {
341
+ initialValue: this.value,
342
+ firstDayIndex: this.firstDayIndex,
343
+ resetStatus: true,
344
+ },
345
+ };
346
+ return (h("kup-card", { ref: (el) => (this.pickerContainerEl = el), data: data, "layout-family": "builtin", "layout-number": "1", "size-x": "300px", "size-y": "300px", "is-menu": true, "onkup-card-click": (ev) => {
347
+ if (ev.detail.value != null && ev.detail.value != '')
348
+ this.onKupDatePickerItemClick(ev.detail.value);
349
+ } }));
615
350
  }
616
351
  getDateForOutput() {
617
352
  if (this.value == null || this.value.trim() == '') {
@@ -652,24 +387,15 @@ export class KupDatePicker {
652
387
  this.kupManager.debug.logRender(this, true);
653
388
  }
654
389
  render() {
655
- const hostClass = {};
656
- if (this.data &&
657
- this.data['kup-text-field'] &&
658
- this.data['kup-text-field']['className'] &&
659
- this.data['kup-text-field']['className'].indexOf('kup-full-height') > -1) {
660
- hostClass['kup-full-height'] = true;
661
- }
662
- if (this.data &&
663
- this.data['kup-text-field'] &&
664
- this.data['kup-text-field']['fullWidth']) {
665
- hostClass['kup-full-width'] = true;
666
- }
667
- return (h(Host, { class: hostClass },
390
+ return (h(Host, null,
668
391
  h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)),
669
392
  h("div", { id: componentWrapperId }, this.prepTextfield(this.getDateForOutput()))));
670
393
  }
671
394
  disconnectedCallback() {
672
395
  this.kupManager.theme.unregister(this);
396
+ if (this.pickerContainerEl) {
397
+ this.pickerContainerEl.remove();
398
+ }
673
399
  }
674
400
  static get is() { return "kup-date-picker"; }
675
401
  static get encapsulation() { return "shadow"; }
@@ -9,6 +9,7 @@
9
9
  * @prop --kup-textfield-icon-color: Sets icon color of the component.
10
10
  * @prop --kup-textfield-primary-color: Sets primary color of the text field.
11
11
  * @prop --kup-textfield-primary-color-rgb: Sets primary color RGB values of the text field (used for shaders).
12
+ * @prop --kup-textfield-text-align: Sets the text alignment of the text field.
12
13
  *
13
14
  * NOTE: These variables are defined in the "kup-theme.css" file, because they must work even without the kup component (it's a functional component)
14
15
  *
@@ -1,6 +1,7 @@
1
1
  :host {
2
2
  display: block;
3
3
  font-size: var(--kup-font-size);
4
+ width: max-content;
4
5
  }
5
6
 
6
7
  #time-picker-div {